NavmiiSDK
Write yourself a navigation system in iOS
|
#import <NMMapControl.h>
Inherits NSObject.
Class Methods | |
(NMMapControl *) | + sharedInstance |
Properties | |
NMMapSettings * | settings |
NMMapView * | mapView |
id< NMMapControlDelegate > | mapControlDelegate |
id< NMHudDelegate > | hudDelegate |
id< NMControlDelegate > | controlDelegate |
id< NMNotificationManagerDelegate > | notificationManagerDelegate |
id< NMOnRouteDelegate > | onRouteDelegate |
id< NMPOIImporterDelegate > | POIImporterDelegate |
id< NMRouteDelegate > | routeDelegate |
id< NMTrafficJamOnRouteDelegate > | trafficJamOnRouteDelegate |
id< NMUserItemsOnMapDelegate > | userItemsOnMapDelegate |
id< NMAudioDelegate > | audioDelegate |
CGFloat | mapZoom |
CGFloat | distanceToSafetyCameraAlert |
CGFloat | mapRotation |
NMMapCoordinates * | mapCenter |
BOOL | isMapViewMode3D |
NMMapCoordinates * | currentPosition |
Navigation system control
- (NMAddress *) addressAtLocation: | (NMMapCoordinates *) | location |
Returns address from geo coordinate
location | Coordinate |
- (void) applyRoute: | (int) | index |
Applies route by index to start routing.
index | Route index |
- (void) cancelAddressLookup: | (id< NMAddressLookupDelegate >) | delegate |
Cancels address lookup
- (void) cancelPoiLookup: | (id< NMPOILookupDelegate >) | delegate |
Cancels POI lookup
- (void) cancelReverseLookup: | (id< NMReverseLookupDelegate >) | delegate |
Cancels address lookup
- (void) cancelRouteCalculation |
Cancels route calculation.
- (void) clearAlternativeRoutes |
Clears alternative routes. Route should be calculated
- (void) clearRoute |
Clears route.
- (void) countryAndStateCodeAtLocation: | (NMMapCoordinates *) | location | |
countryIso3Code: | (NSString **) | countryIso3Code | |
state: | (NSString **) | state | |
Returns country and state iso3 code by geo coordinate
location | Coordinate |
- (NSInteger) createDirectedMarkerOnMap: | (NSString *) | imagePath | |
center: | (NMMapCoordinates *) | center | |
heading: | (CGFloat) | heading | |
imageCenter: | (CGPoint) | imageCenter | |
clickable: | (BOOL) | clickable | |
Creates directed marker on map
imagePath | Image path |
center | Marker position |
heading | New marker heading. Values range is 0-360 deg. |
imageCenter | Image center offset. Values can be any from 0 to 1. 0 means offset is 0% of width and height 1 means 100% of width and height |
clickable | Status |
- (NSInteger) createImageOnMap: | (NSString *) | imagePath | |
leftTop: | (NMMapCoordinates *) | leftTop | |
leftBottom: | (NMMapCoordinates *) | leftBottom | |
rightTop: | (NMMapCoordinates *) | rightTop | |
rightBottom: | (NMMapCoordinates *) | rightBottom | |
Creates user image on map
imagePath | Path to image, image resolution must be power of 2 for mipmap generation |
leftTop | Left top coordinate |
leftBottom | Left bottom coordinate |
rightTop | Right top coordinate |
rightBottom | Right bottom coordinate |
- (NSInteger) createMarkerOnMap: | (NSString *) | imagePath | |
center: | (NMMapCoordinates *) | center | |
imageCenter: | (CGPoint) | imageCenter | |
clickable: | (BOOL) | clickable | |
Creates not directed marker on map
imagePath | Image path |
center | Marker position |
imageCenter | Image center offset. Values can be any from 0 to 1. 0 means offset is 0% of width and height 1 means 100% of width and height |
clickable | Status |
- (NSInteger) createPolylineOnMap: | (int) | colorRGB | |
width: | (CGFloat) | width | |
points: | (NSArray< NMMapCoordinates * > *) | points | |
Creates polyline on map
colorRGB | RGB color |
width | Width |
points | Polyline points |
- (int) currentRouteIndex |
- (void) deleteItemOnMap: | (NSInteger) | itemId |
Deletes item from map.
itemId | Object id. |
- (void) deleteItemsOnMap: | (NSSet *) | itemIds |
Deletes items from map.
itemIds | Objects ids (NSInteger). |
- (void) enableRerouting: | (BOOL) | enable |
Enables/Disables rerouting. After SDK creation rerouting is enabled.
enable | If enable is YES, this method enables rerouting, otherwise it disables rerouting |
- (void) fitBounds: | (NMMapRectangle *) | boundingBox | |
screenRect: | (CGRect) | screenRect | |
completion: | (void(^)(void)) | completion | |
Changes map center and zoom to fit object in rectangle. Only for 2D mode.
boundingBox | |
screenRect | Region on the screen in pixels |
completion |
- (void) insertPointsToPolyline: | (NSInteger) | polylineId | |
index: | (int) | index | |
points: | (NSArray< NMMapCoordinates * > *) | points | |
Inserts points into specified polyline
polylineId | Polyline id |
index | Index at which points will be inserted |
points | Points to insertion |
- (void) insertPointToPolyline: | (NSInteger) | polylineId | |
index: | (int) | index | |
point: | (NMMapCoordinates *) | point | |
Inserts point into specified polyline
polylineId | Polyline id |
index | Index at which points will be inserted |
point | Point to insertion |
- (BOOL) isCountryMapLoaded: | (NSString *) | countryIso3Code | |
stateCode: | (NSString *) | stateCode | |
Returns if map of the specified country is loaded
countryIso3Code | ISO3 code of the country |
stateCode | Code of the state (can be null if the country doesn't have states) |
- (BOOL) isDemoRouteActive |
Returns is demo route active.
- (BOOL) isReroutingEnabled |
Returns rerouting mode.
- (BOOL) isRouteCreated |
Returns is route created.
- (UIImage *) loadDirectionImage: | (NSString *) | imageName |
Returns Direction image from name
imageName | Image name |
- (void) makeRoute: | (NSArray< NMMapCoordinates * > *) | routePlan |
Starts async route calculation process that calculates route with fixed route plan.
Calculated route can be recalculated when SDK receives traffic data update. In this case RouteEventsListener receives RouteCalculationReason. ReroutingCausedByTraffic as a reason argument in its callbacks.
Calculated route cannot be recalculated due to gps position update.
routePlan | Route plan points with start point |
- (void) makeRouteFromGpsPosition: | (NSArray< NMMapCoordinates * > *) | routePlan |
Starts async route calculation process that calculates route from gps position.
When gps position updates, SDK checks if the new position is on the route, and if it's not, recalculates the route. In this case RouteEventsListener receives RouteCalculationReason.Rerouting as a reason argument in it's callbacks. Thus this route always passes through a current gps position.
Calculated route can be recalculated when SDK receives traffic data update. In this case RouteEventsListener receives RouteCalculationReason.ReroutingCausedByTraffic as a reason argument in its callbacks.
routePlan | Route plan points without start point |
- (CGPoint) mapCoordinatesToScreen: | (NMMapCoordinates *) | coord |
Translates map coord to screen coord
point | Map coord |
- (NSInteger) markerIdAtLocation: | (NMMapCoordinates *) | coord | |
radius: | (CGFloat) | radius | |
Returns marker ID near at geo location
coord | Geo coordinate |
radius | Radius in meters to search marker |
- (NSInteger) markerIdAtScreenPosition: | (CGPoint) | coord |
Returns marker ID near at screen position
coord | Screen coord in pixels |
- (NMNavigationInfo *) navigationInfo |
Returns the navigation information.
- (NSArray <NMPoiItem *> *) poiItemsAtLocation: | (NMMapCoordinates *) | location | |
radius: | (double) | radius | |
Returns POI items near near geo coord
location | Geo coordinate |
radius | Search radius in meters |
- (NSArray <NMPoiItem *> *) poiItemsAtScreenPosition: | (CGPoint) | point |
Returns POI items near screen coord
point | Screen coordinate |
- (NSInteger) polylineSize: | (NSInteger) | polylineId |
Returns polyline points count
polylineId | Polyline id |
- (void) removePointFromPolyline: | (NSInteger) | polylineId | |
index: | (int) | index | |
Removes point from specified polyline
polylineId | Polyline id |
index | Index at which points will be removed |
- (void) removePointsFromPolyline: | (NSInteger) | polylineId | |
index: | (int) | index | |
count: | (int) | count | |
Removes points from specified polyline.
polylineId | Polyline id. |
index | Index at which points will be removed |
count | Amount points to removing |
- (NMRouteCalculationStatus) routeCalculationStatus |
Returns route calculation status.
- (NMRouteInfo *) routeInfo: | (int) | index |
- (int) routesCount |
- (NMMapCoordinates *) screenToMapCoordinates: | (CGPoint) | point |
Translates screen coord to map coord
point | Screen coord |
- (void) selectRoute: | (int) | index |
Selects route by index
index | Route index |
- (void) setCurrentPosition: | (NMMapCoordinates *) | position | |
withCourse: | (CGFloat) | course | |
Sets current position (user on map position)
position | New position |
course | New course |
- (void) setDownloadedProductsPath: | (NSString *) | path |
Set the path to the folder with downloaded products
path | The path to the folder in the platform-dependent format. |
- (void) setDrawAlternativeRoutesEnabled: | (BOOL) | value |
Changes alternative routes draw mode
value | Show or hide alternative routes on map |
- (void) setItemOnMapZLevel: | (NSInteger) | itemId | |
level: | (CGFloat) | level | |
Changes specified user object Z level. 0 is bottommost object. default Z-levels (can be changed): 4 - polyline 6 - marker 6.1 - directed marker
itemId | Object id. |
level | New z-level value. |
- (void) setMapRotation: | (CGFloat) | angle | |
aroundPoint: | (CGPoint) | point | |
Rotates the map around the point
angle | New map rotation angle |
point | Rotation axis center in pixels |
- (void) setMapView: | (NMMapView *) | mapView |
Destroy the SDK.
- (void) setMapViewSize: | (CGSize) | size |
Sets the map view size in pixels.
size | The size in pixels |
- (void) setMapZoom: | (CGFloat) | zoom | |
aroundPoint: | (CGPoint) | point | |
Scales the map around the point
zoom | New zoom value (map scale factor) |
point | Zooming center in pixels |
- (void) setMarkerClickable: | (NSInteger) | markerId | |
clickable: | (BOOL) | clickable | |
Changes the marker clickable status. Clickable markers sends various touch events to navigation system control nested activity
markerId | Marker id |
clickable | New value |
- (void) setMarkerHeading: | (NSInteger) | markerId | |
heading: | (CGFloat) | heading | |
Changes the marker heading
markerId | Marker id |
heading | New marker heading. Values range is 0-360 deg. |
- (void) setMarkerImage: | (NSInteger) | markerId | |
imagePath: | (NSString *) | imagePath | |
imageCenter: | (CGPoint) | imageCenter | |
Changes the marker image
markerId | Marker id |
imagePath | New marker image path |
imageCenter | Image center offset. Values can be any from 0 to 1. 0 means offset is 0% of width and height 1 means 100% of width and height |
- (void) setMarkerPosition: | (NSInteger) | markerId | |
center: | (NMMapCoordinates *) | center | |
Changes the marker position
markerId | Marker id |
center | New marker position |
- (void) setPolylinePoint: | (NSInteger) | polylineId | |
index: | (int) | index | |
point: | (NMMapCoordinates *) | point | |
Changes specified polyline point coordinate
polylineId | Polyline id |
index | Point index to change |
point | New coord value |
- (void) setResourcePath: | (NSString *) | path |
Sets the path to the folder with the resources for the Navmii SDK (maps, etc.)
path | The path to the folder in the platform-dependent format. |
- (void) setScreenSize: | (CGSize) | screenSize | |
andDpi: | (CGSize) | dpi | |
Sets the screen size in pixels and the DPI (or PPI, pixels per inch).
screenSize | The size of the screen in pixels. |
dpi | DPI (or PPI, pixels per inch). |
- (void) setSkipRouteByTrafficLength: | (CGFloat) | differenceInPercents |
Sets skip route by traffic length
differenceInPercent | Difference in percent 0..100 |
- (void) setSkipRouteByTrafficTime: | (CGFloat) | timeInMinutes |
Sets skip route by traffic time
timeInMinutes | Time in minutes |
- (void) setSnapToGps: | (BOOL) | enabled |
Snaps map center to GPS position
enabled | YES snap, NO unsnap |
- (void) setSpecificMapResourcePath: | (NSString *) | path |
Sets specific map resource path
path | The path to the folder in the platform-dependent format. |
- (void) setUserDataPath: | (NSString *) | path |
Set the path to the folder with user data, by default it is UserData folder in resource path
path | The path to the folder in the platform-dependent format. |
+ (NMMapControl *) sharedInstance |
Returns singleton.
- (void) skipRoute |
Skips new route and restore previous.
- (NMSnappingResult *) snapPositionToRoad: | (NMMapCoordinates *) | coord | |
heading: | (CGFloat) | heading | |
radius: | (CGFloat) | radius | |
snappingType: | (NMSnappingType) | snappingType | |
Snaps coords to road
coord | Source coords |
heading | Coords heading +-360 |
radius | Snapping radius in meters |
snappingType | Snapping type |
- (void) start |
Starts the SDK.
- (void) startAddressLookup: | (id< NMAddressLookupDelegate >) | delegate | |
pattern: | (NSString *) | pattern | |
location: | (NMMapCoordinates *) | location | |
Starts address lookup
delegate | Results delegate |
pattern | Search pattern |
location | Results will be sorted by distance around this coord |
- (void) startDemoRoute |
Starts demo route. Route should be calculated
- (void) startPoiLookup: | (id< NMPOILookupDelegate >) | delegate | |
pattern: | (NSString *) | pattern | |
poiCategories: | (NSArray< NSNumber * > *) | poiCategories | |
location: | (NMMapCoordinates *) | location | |
radius: | (double) | radius | |
maxResults: | (int) | maxResults | |
Starts POI lookup
delegate | POI lookup delegate |
pattern | Search pattern |
poiCategories | POI categories from [NavmiiSettings poiCategories] |
location | Results will be sorted by distance around this coord |
radius | Search radius in meters, set to -1 to use default search radius by POI category |
maxResult | Max number of results |
- (void) startReverseLookup: | (id< NMReverseLookupDelegate >) | delegate | |
location: | (NMMapCoordinates *) | location | |
Starts reverse lookup
delegate | Results delegate |
location | Results will be sorted by distance around this coord |
- (void) stopDemoRoute |
Stops demo route.
|
readwritenonatomicweak |
Audio delegate
|
readwritenonatomicweak |
Navigation system control delegate
|
readnonatomicstrong |
Current GPS position
|
readwritenonatomicassign |
Distance in meters to nearest safety camera alert.
|
readwritenonatomicweak |
HUD delegate
|
readwritenonatomicassign |
Current view mode YES if 3D mode, NO if 2D
|
readwritenonatomicstrong |
Current map center
|
readwritenonatomicweak |
Map control delegate
|
readwritenonatomicassign |
Current map rotation angle in degrees +-360
|
readwritenonatomicstrong |
Rendered map view
|
readwritenonatomicassign |
Current map zoom level (map scale factor).
|
readwritenonatomicweak |
Notification manager delegate
|
readwritenonatomicweak |
Route navigation delegate
|
readwritenonatomicweak |
POI importer delegate
|
readwritenonatomicweak |
Route calculation delegate
|
readwritenonatomicstrong |
Navigation system settings
|
readwritenonatomicweak |
Traffic jam event listener
|
readwritenonatomicweak |
User data structure delegate