NavmiiSDK
Write yourself a navigation system in iOS
Instance Methods | Class Methods | Properties | List of all members
NMMapControl Class Reference

#import <NMMapControl.h>

Inherits NSObject.

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(void) - start
 
(void) - setMapView:
 
(void) - startAddressLookup:pattern:location:
 
(void) - cancelAddressLookup:
 
(void) - startReverseLookup:location:
 
(void) - cancelReverseLookup:
 
(void) - startPoiLookup:pattern:poiCategories:location:radius:maxResults:
 
(void) - cancelPoiLookup:
 
(void) - setResourcePath:
 
(void) - setSpecificMapResourcePath:
 
(void) - setUserDataPath:
 
(void) - setDownloadedProductsPath:
 
(void) - setMapViewSize:
 
(void) - setScreenSize:andDpi:
 
(void) - setMapZoom:aroundPoint:
 
(void) - setMapRotation:aroundPoint:
 
(void) - setSnapToGps:
 
(void) - setCurrentPosition:withCourse:
 
(BOOL) - isCountryMapLoaded:stateCode:
 
(NMSnappingResult *) - snapPositionToRoad:heading:radius:snappingType:
 
(void) - fitBounds:screenRect:completion:
 
(NSInteger) - createImageOnMap:leftTop:leftBottom:rightTop:rightBottom:
 
(NSInteger) - createMarkerOnMap:center:imageCenter:clickable:
 
(NSInteger) - createDirectedMarkerOnMap:center:heading:imageCenter:clickable:
 
(void) - setMarkerPosition:center:
 
(void) - setMarkerHeading:heading:
 
(void) - setMarkerImage:imagePath:imageCenter:
 
(void) - setMarkerClickable:clickable:
 
(NSInteger) - markerIdAtScreenPosition:
 
(NSInteger) - markerIdAtLocation:radius:
 
(NSInteger) - createPolylineOnMap:width:points:
 
(void) - insertPointsToPolyline:index:points:
 
(void) - insertPointToPolyline:index:point:
 
(void) - removePointsFromPolyline:index:count:
 
(void) - removePointFromPolyline:index:
 
(NSInteger) - polylineSize:
 
(void) - setPolylinePoint:index:point:
 
(void) - setItemOnMapZLevel:level:
 
(void) - deleteItemOnMap:
 
(void) - deleteItemsOnMap:
 
(NMNavigationInfo *) - navigationInfo
 
(void) - countryAndStateCodeAtLocation:countryIso3Code:state:
 
(NMAddress *) - addressAtLocation:
 
(NSArray< NMPoiItem * > *) - poiItemsAtScreenPosition:
 
(NSArray< NMPoiItem * > *) - poiItemsAtLocation:radius:
 
(UIImage *) - loadDirectionImage:
 
(void) - makeRoute:
 
(void) - makeRouteFromGpsPosition:
 
(void) - clearRoute
 
(BOOL) - isRouteCreated
 
(NMRouteCalculationStatus) - routeCalculationStatus
 
(void) - enableRerouting:
 
(BOOL) - isReroutingEnabled
 
(void) - cancelRouteCalculation
 
(void) - clearAlternativeRoutes
 
(void) - setDrawAlternativeRoutesEnabled:
 
(int) - routesCount
 
(int) - currentRouteIndex
 
(void) - applyRoute:
 
(void) - selectRoute:
 
(void) - skipRoute
 
(NMRouteInfo *) - routeInfo:
 
(void) - setSkipRouteByTrafficTime:
 
(void) - setSkipRouteByTrafficLength:
 
(void) - startDemoRoute
 
(void) - stopDemoRoute
 
(BOOL) - isDemoRouteActive
 
(NMMapCoordinates *) - screenToMapCoordinates:
 
(CGPoint) - mapCoordinatesToScreen:
 

Class Methods

(NMMapControl *) + sharedInstance
 

Properties

NMMapSettingssettings
 
NMMapViewmapView
 
id< NMMapControlDelegatemapControlDelegate
 
id< NMHudDelegatehudDelegate
 
id< NMControlDelegatecontrolDelegate
 
id< NMNotificationManagerDelegatenotificationManagerDelegate
 
id< NMOnRouteDelegateonRouteDelegate
 
id< NMPOIImporterDelegatePOIImporterDelegate
 
id< NMRouteDelegaterouteDelegate
 
id< NMTrafficJamOnRouteDelegatetrafficJamOnRouteDelegate
 
id< NMUserItemsOnMapDelegateuserItemsOnMapDelegate
 
id< NMAudioDelegateaudioDelegate
 
CGFloat mapZoom
 
CGFloat distanceToSafetyCameraAlert
 
CGFloat mapRotation
 
NMMapCoordinatesmapCenter
 
BOOL isMapViewMode3D
 
NMMapCoordinatescurrentPosition
 

Detailed Description

Navigation system control

Method Documentation

- (NMAddress *) addressAtLocation: (NMMapCoordinates *)  location

Returns address from geo coordinate

Parameters
locationCoordinate
Returns
Address or nil
- (void) applyRoute: (int)  index

Applies route by index to start routing.

Parameters
indexRoute 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

Parameters
locationCoordinate
Returns
country and state iso3 code
- (NSInteger) createDirectedMarkerOnMap: (NSString *)  imagePath
center: (NMMapCoordinates *)  center
heading: (CGFloat)  heading
imageCenter: (CGPoint)  imageCenter
clickable: (BOOL)  clickable 

Creates directed marker on map

Parameters
imagePathImage path
centerMarker position
headingNew marker heading. Values range is 0-360 deg.
imageCenterImage 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
clickableStatus
Returns
user Item id
- (NSInteger) createImageOnMap: (NSString *)  imagePath
leftTop: (NMMapCoordinates *)  leftTop
leftBottom: (NMMapCoordinates *)  leftBottom
rightTop: (NMMapCoordinates *)  rightTop
rightBottom: (NMMapCoordinates *)  rightBottom 

Creates user image on map

Parameters
imagePathPath to image, image resolution must be power of 2 for mipmap generation
leftTopLeft top coordinate
leftBottomLeft bottom coordinate
rightTopRight top coordinate
rightBottomRight bottom coordinate
Returns
user Item id
- (NSInteger) createMarkerOnMap: (NSString *)  imagePath
center: (NMMapCoordinates *)  center
imageCenter: (CGPoint)  imageCenter
clickable: (BOOL)  clickable 

Creates not directed marker on map

Parameters
imagePathImage path
centerMarker position
imageCenterImage 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
clickableStatus
Returns
user Item id
- (NSInteger) createPolylineOnMap: (int)  colorRGB
width: (CGFloat)  width
points: (NSArray< NMMapCoordinates * > *)  points 

Creates polyline on map

Parameters
colorRGBRGB color
widthWidth
pointsPolyline points
Returns
user Item id
- (int) currentRouteIndex
Returns
current route index or -1 if no alternative routes
- (void) deleteItemOnMap: (NSInteger)  itemId

Deletes item from map.

Parameters
itemIdObject id.
- (void) deleteItemsOnMap: (NSSet *)  itemIds

Deletes items from map.

Parameters
itemIdsObjects ids (NSInteger).
- (void) enableRerouting: (BOOL)  enable

Enables/Disables rerouting. After SDK creation rerouting is enabled.

Parameters
enableIf 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.

Parameters
boundingBox
screenRectRegion on the screen in pixels
completion
- (void) insertPointsToPolyline: (NSInteger)  polylineId
index: (int)  index
points: (NSArray< NMMapCoordinates * > *)  points 

Inserts points into specified polyline

Parameters
polylineIdPolyline id
indexIndex at which points will be inserted
pointsPoints to insertion
- (void) insertPointToPolyline: (NSInteger)  polylineId
index: (int)  index
point: (NMMapCoordinates *)  point 

Inserts point into specified polyline

Parameters
polylineIdPolyline id
indexIndex at which points will be inserted
pointPoint to insertion
- (BOOL) isCountryMapLoaded: (NSString *)  countryIso3Code
stateCode: (NSString *)  stateCode 

Returns if map of the specified country is loaded

Parameters
countryIso3CodeISO3 code of the country
stateCodeCode of the state (can be null if the country doesn't have states)
Returns
YES if the map is loaded, NO otherwise
- (BOOL) isDemoRouteActive

Returns is demo route active.

Returns
YES if demo route is active.
- (BOOL) isReroutingEnabled

Returns rerouting mode.

Returns
YES if rerouting enabled and NO if disabled.
- (BOOL) isRouteCreated

Returns is route created.

- (UIImage *) loadDirectionImage: (NSString *)  imageName

Returns Direction image from name

Parameters
imageNameImage name
Returns
Direction image
- (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.

Parameters
routePlanRoute 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.

Parameters
routePlanRoute plan points without start point
- (CGPoint) mapCoordinatesToScreen: (NMMapCoordinates *)  coord

Translates map coord to screen coord

Parameters
pointMap coord
Returns
screen coord in pixels
- (NSInteger) markerIdAtLocation: (NMMapCoordinates *)  coord
radius: (CGFloat)  radius 

Returns marker ID near at geo location

Parameters
coordGeo coordinate
radiusRadius in meters to search marker
Returns
user item id
- (NSInteger) markerIdAtScreenPosition: (CGPoint)  coord

Returns marker ID near at screen position

Parameters
coordScreen coord in pixels
Returns
user Item id
- (NMNavigationInfo *) navigationInfo

Returns the navigation information.

Returns
The navigation information.
- (NSArray <NMPoiItem *> *) poiItemsAtLocation: (NMMapCoordinates *)  location
radius: (double)  radius 

Returns POI items near near geo coord

Parameters
locationGeo coordinate
radiusSearch radius in meters
Returns
POI items array
- (NSArray <NMPoiItem *> *) poiItemsAtScreenPosition: (CGPoint)  point

Returns POI items near screen coord

Parameters
pointScreen coordinate
Returns
POI items array
- (NSInteger) polylineSize: (NSInteger)  polylineId

Returns polyline points count

Parameters
polylineIdPolyline id
Returns
polyline Points count
- (void) removePointFromPolyline: (NSInteger)  polylineId
index: (int)  index 

Removes point from specified polyline

Parameters
polylineIdPolyline id
indexIndex at which points will be removed
- (void) removePointsFromPolyline: (NSInteger)  polylineId
index: (int)  index
count: (int)  count 

Removes points from specified polyline.

Parameters
polylineIdPolyline id.
indexIndex at which points will be removed
countAmount points to removing
- (NMRouteCalculationStatus) routeCalculationStatus

Returns route calculation status.

- (NMRouteInfo *) routeInfo: (int)  index

Returns route info

Parameters
indexRoute index
Returns
NMRouteInfo object or nil
- (int) routesCount
Returns
routes count (Counts of primary and alternative routes).
- (NMMapCoordinates *) screenToMapCoordinates: (CGPoint)  point

Translates screen coord to map coord

Parameters
pointScreen coord
- (void) selectRoute: (int)  index

Selects route by index

Parameters
indexRoute index
- (void) setCurrentPosition: (NMMapCoordinates *)  position
withCourse: (CGFloat)  course 

Sets current position (user on map position)

Parameters
positionNew position
courseNew course
- (void) setDownloadedProductsPath: (NSString *)  path

Set the path to the folder with downloaded products

Parameters
pathThe path to the folder in the platform-dependent format.
- (void) setDrawAlternativeRoutesEnabled: (BOOL)  value

Changes alternative routes draw mode

Parameters
valueShow 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

Parameters
itemIdObject id.
levelNew z-level value.
- (void) setMapRotation: (CGFloat)  angle
aroundPoint: (CGPoint)  point 

Rotates the map around the point

Parameters
angleNew map rotation angle
pointRotation axis center in pixels
- (void) setMapView: (NMMapView *)  mapView

Destroy the SDK.

- (void) setMapViewSize: (CGSize)  size

Sets the map view size in pixels.

Parameters
sizeThe size in pixels
- (void) setMapZoom: (CGFloat)  zoom
aroundPoint: (CGPoint)  point 

Scales the map around the point

Parameters
zoomNew zoom value (map scale factor)
pointZooming 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

Parameters
markerIdMarker id
clickableNew value
- (void) setMarkerHeading: (NSInteger)  markerId
heading: (CGFloat)  heading 

Changes the marker heading

Parameters
markerIdMarker id
headingNew marker heading. Values range is 0-360 deg.
- (void) setMarkerImage: (NSInteger)  markerId
imagePath: (NSString *)  imagePath
imageCenter: (CGPoint)  imageCenter 

Changes the marker image

Parameters
markerIdMarker id
imagePathNew marker image path
imageCenterImage 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

Parameters
markerIdMarker id
centerNew marker position
- (void) setPolylinePoint: (NSInteger)  polylineId
index: (int)  index
point: (NMMapCoordinates *)  point 

Changes specified polyline point coordinate

Parameters
polylineIdPolyline id
indexPoint index to change
pointNew coord value
- (void) setResourcePath: (NSString *)  path

Sets the path to the folder with the resources for the Navmii SDK (maps, etc.)

Parameters
pathThe 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).

Parameters
screenSizeThe size of the screen in pixels.
dpiDPI (or PPI, pixels per inch).
- (void) setSkipRouteByTrafficLength: (CGFloat)  differenceInPercents

Sets skip route by traffic length

Parameters
differenceInPercentDifference in percent 0..100
- (void) setSkipRouteByTrafficTime: (CGFloat)  timeInMinutes

Sets skip route by traffic time

Parameters
timeInMinutesTime in minutes
- (void) setSnapToGps: (BOOL)  enabled

Snaps map center to GPS position

Parameters
enabledYES snap, NO unsnap
- (void) setSpecificMapResourcePath: (NSString *)  path

Sets specific map resource path

Parameters
pathThe 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

Parameters
pathThe 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

Parameters
coordSource coords
headingCoords heading +-360
radiusSnapping radius in meters
snappingTypeSnapping type
Returns
SnappingResult object
- (void) start

Starts the SDK.

- (void) startAddressLookup: (id< NMAddressLookupDelegate >)  delegate
pattern: (NSString *)  pattern
location: (NMMapCoordinates *)  location 

Starts address lookup

Parameters
delegateResults delegate
patternSearch pattern
locationResults 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

Parameters
delegatePOI lookup delegate
patternSearch pattern
poiCategoriesPOI categories from [NavmiiSettings poiCategories]
locationResults will be sorted by distance around this coord
radiusSearch radius in meters, set to -1 to use default search radius by POI category
maxResultMax number of results
- (void) startReverseLookup: (id< NMReverseLookupDelegate >)  delegate
location: (NMMapCoordinates *)  location 

Starts reverse lookup

Parameters
delegateResults delegate
locationResults will be sorted by distance around this coord
- (void) stopDemoRoute

Stops demo route.

Property Documentation

- (id<NMAudioDelegate>) audioDelegate
readwritenonatomicweak

Audio delegate

- (id<NMControlDelegate>) controlDelegate
readwritenonatomicweak

Navigation system control delegate

- (NMMapCoordinates*) currentPosition
readnonatomicstrong

Current GPS position

- (CGFloat) distanceToSafetyCameraAlert
readwritenonatomicassign

Distance in meters to nearest safety camera alert.

- (id<NMHudDelegate>) hudDelegate
readwritenonatomicweak

HUD delegate

- (BOOL) isMapViewMode3D
readwritenonatomicassign

Current view mode YES if 3D mode, NO if 2D

- (NMMapCoordinates*) mapCenter
readwritenonatomicstrong

Current map center

- (id<NMMapControlDelegate>) mapControlDelegate
readwritenonatomicweak

Map control delegate

- (CGFloat) mapRotation
readwritenonatomicassign

Current map rotation angle in degrees +-360

- (NMMapView*) mapView
readwritenonatomicstrong

Rendered map view

- (CGFloat) mapZoom
readwritenonatomicassign

Current map zoom level (map scale factor).

- (id<NMNotificationManagerDelegate>) notificationManagerDelegate
readwritenonatomicweak

Notification manager delegate

- (id<NMOnRouteDelegate>) onRouteDelegate
readwritenonatomicweak

Route navigation delegate

- (id<NMPOIImporterDelegate>) POIImporterDelegate
readwritenonatomicweak

POI importer delegate

- (id<NMRouteDelegate>) routeDelegate
readwritenonatomicweak

Route calculation delegate

- (NMMapSettings*) settings
readwritenonatomicstrong

Navigation system settings

- (id<NMTrafficJamOnRouteDelegate>) trafficJamOnRouteDelegate
readwritenonatomicweak

Traffic jam event listener

- (id<NMUserItemsOnMapDelegate>) userItemsOnMapDelegate
readwritenonatomicweak

User data structure delegate


The documentation for this class was generated from the following file: