Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
Simple Distance Presenter
|ID||Creation date||March 31, 2008|
|Platform||S60 3rd, S60 3rd FP1||Tested on devices||N95 8Gb|
|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 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.
- 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.