|
ConceptualDesignMap
This page describes the design decisions behind the use of the Map.
IntroductionWe use MapsForge to draw our map and overlay Ways and Points of interest. We use an ItemizedOverlay to display all POIs, the current position and waypoints. A WayOverlay serves as representation for all recorded ways and areas. DetailsMapsForgeActivityOur MapsForgeActivity extends the MapsForge MapActivity, not only to display a context menu but also to overwrite dispatchTouchEvent(), so that we can move Points around. We send notifications about different possible actions like adding way nodes, change of the current position, etc. as broadcast Intent, GpsMessage provides methods for composing such Intends. MapsForgeActivity therefore registers a GPSReceiver, a BroadcastReceiver that will receive these Intends. It will however only receive messages when the MapsForgeActivity is active. So we clear all overlays on resume an populate them again with all POIs and ways, this way we make sure not to miss anything. (It actually saves us from handling the case of adding a POI to the overlay by BroadCast intent as we have no means of adding a POI without rendering the MapActivity inactive. Every DataNode references an OverlayItem, it will automatically update the OverlayItems position if it's position changes, it's OverlayItem should be added to the list of invalid items when it is removed. GPSReceiver
DataNodeArrayItemizedOverlayThe DataNodeArrayItemizedOverlay extends MapsForges ArrayItemizedOverlay to overwrite the onTap() method and display a context menu (an AlertDialog actually) for each POI. It gets the actual DataNode corresponding to the OverlayItem by searching all Nodes of the currentTrack. If the OverlayItem is not referenced by any DataNode, it is assumed it is the marker marking the current position of the user. DataPointsListArrayRouteOverlayThe DataPointsListArrayRouteOverlay extends MapsForges DataPointsListArrayRouteOverlay just for convenience, it doesn't overwrite any methods but only offers some wrappers to add DataPointsLists. Those store their OverlayWay just as the DataNode. (They however do not update it's content automatically, but updateOverlayRoute() is required to align the OverlayWay's data.) |