Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Navmii SDK provides an easy way to present custom images on the map and to draw polylines. Children classes of NMGeoObject abstract class represent these custom images (NMGeoMarker) and polylines (NMGeoPolyline) in the SDK. NMMapView instance is responsible for creating and handling this type of objects.

CREATING MARKERS ON THE MAP

To present a marker on the map at specified coordinates with default image, instantiate it first with either initWithCoordinates: instance method or geoMarkerWithCoordinates: class method and, then, add it to the map using NMMapView instance's addGeoObject: method: 

NMGeoMarker *marker = [[NMGeoMarker alloc] initWithCoordinates:coords];
/* or, alternatively
NMGeoMarker *marker = [NMGeoMarker geoMakerWithCoordinates:coords];
*/
[mapView addGeoObject:marker];

To present a marker with specified image, use one of initWithCoordinates:andImagePath: and geoMarkerWithCoordinates:andImagePath: pair of methods. Make sure you add them to the map as in previous case:

NMGeoMarker *marker = [[NMGeoMarker alloc] initWithCoordinates:coords
                                                  andImagePath:pathToImage];
/* or, alternatively
NMGeoMarker *marker = [NMGeoMarker geoMakerWithCoordinates:coords
                                              andImagePath:pathToImage];
*/
[mapView addGeoObject:marker];

DRAWING POLYLINES

To draw a polyline on the map use either initWithVertices: instance method or geoPolylineWithVertices: class method. Pass an array of NMMapCoordinates representing polyline vertices geo position as the argument.  Add the polyline instantiated with this methods to the NMMapView instance:

NMGeoPolyline *polyline = [[NMGeoPolyline alloc] initWithVertices:vertices];
/* or, alternatively
NMGeoPolyline *polyline = [NMGeoPolyline geoPolylineWithVertices:vertices];
*/
[mapView addGeoObject:polyline];
  • No labels