×
Namespaces

Variants
Actions

Simple Distance Presenter

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: Den123 (31 Mar 2008)
Last edited: hamishwillee (26 Jul 2012)
ID Creation date March 31, 2008
Platform S60 3rd, S60 3rd FP1 Tested on devices N95 8Gb
Category Symbian C++ Subcategory Location
Keywords: Simple Distance Presenter

Simple Distance Presenter (SDP).

This program demonstrates:

  • how to select landmarks from the database
  • how to read landmarks data
  • how to display landmarks on the screen
  • how to calculate distance between two landmarks


SDP.PNG


SDP allows user to select landmarks from the database to display them on the screen and to calculate the distance between them. Latitude and longitude - these coordinates are used for defining the location of the point on the sphere surface. For displaying the landmarks on the rectangular screen, we can provide the value of latitude as Y, and longitude as X. This approach allows to display data enough exactly, if the landmarks are located not very far apart.

This program offers You to select one main landmark (shown in red) and many active landmarks (green). The main landmark is displayed on the center of the screen. The displaying of the active landmarks are depended on the location of the main landmark.

For the correct displaying the data, the most distant landmark from main is searched every time, when the list of the active landmarks is selected. The coordinates of that landmark are used for calculation transformation factor (depending on the size of the screen) for displaying all active landmarks. After having displayed current active landmark, the line from this point to the center point is drawn and the distance between these landmarks is printed in the navigation pane. You can change current active point via cursor keys.

Classes description:

  • TSimpleLandmark - is used for storing data that contain landmark position.
  • CLandmarkDistanceCalc - is used for storing data from many landmarks and for distance calculation.
  • CLandmarkDistancePresenter - it is a custom control, it is used for drawing the map.
  • MLandmarkPresenterObserver - is used for notification that new distance line is drawed.

Source code: File:SimpleDistancePresenter.zip

It contains detailed comments.

Internal Links

This page was last modified on 26 July 2012, at 09:40.
43 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×