Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

A MARKER

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: 

Code Block
languagecpp
themeEclipse
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:

Code Block
languagecpp
themeEclipse
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:

Code Block
languagecpp
themeEclipse
NMGeoPolyline *polyline = [[NMGeoPolyline alloc] initWithVertices:vertices];
/* or, alternatively
NMGeoPolyline *polyline = [NMGeoPolyline geoPolylineWithVertices:vertices];
*/
[mapView addGeoObject:polyline];