MapstedMapApi
@objc
public class MapstedMapApi : NSObject
extension MapstedMapApi: MNDeepLinkDelegate
This class contains all public api for map
-
Declaration
Swift
public enum TapType : Int
-
Declaration
Swift
public enum StartingPoint : String
-
Declaration
Swift
public static let shared: MapstedMapApi
-
Declaration
Swift
public var startingPointForRouting: StartingPoint
-
Declaration
Swift
public var startSearchable: Searchable? { get set }
-
Set from callback setPositionVisibility(visible:)
Declaration
Swift
public var askedToShowUserPositionMarker: Bool { get set }
-
Selection manager responsible for anything related to select. For example, select the property, building, or select an entity. Public Api’s aviliable in
MNSelectionManager
.Declaration
Swift
public var selectionManager: MNSelectionManager { get }
-
Call this function to init the map and positioning library. Note if this
setup:
is called, please don’t call setup function inside the positioning library.Declaration
Swift
public func setUp(prefetchProperties: Bool, callback: CoreInitCallback? = nil)
Parameters
prefetchProperties
Whether to prefetch properties at the time of set up.
-
Note: Internal use only!!! Call this function to init the map and positioning library. Note if this
setup:
is called, please don’t call setup function inside the positioning library.Declaration
Swift
public func setUp(prefetchProperties: Bool, calibrationMode: Bool)
Parameters
prefetchProperties
Whether to prefetch properties at the time of set up.
calibrate
Whether to setup for calibration mode.
-
Check whether MapSDK is calibration mode or not.
Declaration
Swift
public func isCalibrationMode() -> Bool
-
Draw property on map. For v3.0, when drawing a property will also draw its building.
Declaration
Swift
public func drawProperty(isSelected: Bool, propertyData: MNPropertyData)
Parameters
isSelected
Set to
true
will also select the property.propertyData
The property to draw on the map.
-
Declaration
Swift
public func fetchMapOverlayData(propertyId: Int, buildingId: Int?, floorId: Int?) -> [MapOverlayItem]
-
Declaration
Swift
public func getMapOverlayData() -> [MapOverlayItem]
-
Declaration
Swift
public func updateIcons(propertyIds: [Int], buildingIds: [Int], mapZoom: Float, mapRotation: Float)
-
Remove property from map. For v3.0, when removing a property will also remove its buildings.
Declaration
Swift
public func removeProperty(propertyId: Int)
Parameters
propertyId
The property to remove from the map.
-
Call this function to download basemap for a property.
Declaration
Swift
public func downloadPackage(propertyId: Int)
-
Call this function to download world basemap - should be called once only.
Declaration
Swift
public func downloadBasemap(delegate: MapDownloadFinished)
-
Call this function to select a search entity.
Declaration
Swift
public func selectEntity(entity: ISearchable)
Parameters
entity
The search entity you want to select.
-
Call this function to deselect a search entity.
Declaration
Swift
public func deselectEntity()
Parameters
entity
The search entity you want to select.
-
Call this function to select a search entity. This will highlight the polygon on map where the search entity located. It will also select the floor where the search entity located.
If this search entity has multiple entities, it will select the entity depend on the logic implemented in positioning module.
Declaration
Swift
public func selectSearchEntity(entity: MNMapEntity?, showPopup: Bool)
Parameters
searchEntity
The search entity you want to select. Pass in
nil
to deselect search entity.showPopup
If
true
will show bollon style popup. -
Declaration
Swift
public func selectMapOverlayItem(item: MapOverlayItem)
-
Declaration
Swift
public func switchFloor(buildingId: Int, floorId: Int)
-
Declaration
Swift
public func currentFloor(buildingId: Int) -> Int?
-
Declaration
Swift
public func mapFocus() -> MNMercator?
-
Declaration
Swift
public func setAutoRotateMap(val: Bool)
-
Declaration
Swift
public func shouldAutoRotateMap() -> Bool
-
Declaration
Swift
public func handleZoom(propertyId: Int, closestToCentreBuildingId: [Int], zoom: Float)
-
Declaration
Swift
public func displayFriendLocations(profiles: [MNShareLocationItem])
-
Declaration
Swift
public func deleteFriendLocations(profiles: [MNShareLocationItem])
-
Call this function to clear all tags from map.
Declaration
Swift
public func clearAllTagsFromMap()
-
Call this function to plot all tags on map.
Declaration
Swift
public func plotTagsOnMap(propertyId: Int, tags: [MNTag], propertyTags: [MNTag])
-
Call this function to update user marker
Declaration
Swift
public func updateUserMarker(position: MNPosition)
-
Call this function to plot a location marker
Declaration
Swift
public func plotLocationMarker(completion: ((Bool) -> Void)? = nil)
-
Call this function to show the user location marker
Declaration
Swift
public func showLocationMarker()
-
Call this function to hide the user location marker
Declaration
Swift
public func hideLocationMarker()
-
Call this function to hide the clear location marker from map
Declaration
Swift
public func clearLocationMarker()
-
Declaration
Swift
public func setUserMarkerVisibility(_ visible: Bool)
-
Call this function to plot a tag that has not been saved yet.
Declaration
Swift
public func plotTemporaryTag(tag: MNPosition)
-
Call this function to clear a tag that has not been saved yet.
Declaration
Swift
public func clearTemporaryTag()
-
Declaration
Swift
public func addDataCapturePoint(point: MNTag)
-
Declaration
Swift
public func removeLastDataCapturePoint()
-
Declaration
Swift
public func clearAllDataCapturePoints()
-
Declaration
Swift
public func dataCapturePointCount() -> Int
-
Declaration
Swift
public func startCalibration() -> Bool
-
Declaration
Swift
public func isCalibrationStarted() -> Bool
-
Declaration
Swift
public func stopCalibration(sendData: Bool, description: String)
-
Declaration
Swift
public func targetPin()
-
Declaration
Swift
public func allTargetsAdded() -> Bool
-
Declaration
Swift
public func switchToFloorForCalibration(floorId: Int)
-
Declaration
Swift
public func setCalibrationFloorChangeCallback(callback: @escaping ((Int, Int) -> Void))
-
Declaration
Swift
public func handleRouteResponse(routeResponse: MNRouteResponse)
-
Declaration
Swift
public func handleRouteError(errorCode: Int, errorMessage: String, alertIds: [String])
-
Reset routing. Clear all routing related on map.
Declaration
Swift
public func clearRoute()
-
Declaration
Swift
public func displayRouteForFloor(floorId: Int)
-
Get the route start and destination names.
Declaration
Swift
public func routeStartAndDestinationNames() -> (String?, String?)
Return Value
Returns a tuple of start and destination names for current route
-
Get the route start and destination names.
Declaration
Swift
public func routeStartAndDestinationNamesForRoute(routeIndex: Int) -> (String?, String?)
Return Value
Returns a tuple of start and destination names for specified route
-
Get the floor id for current route.
Declaration
Swift
public func floorId(floorIndex: Int) -> Int
Return Value
Returns floor if for current route
-
Get the route instructions for specified route.
Declaration
Swift
public func routingInstructions(routeIndex: Int) -> [[MNRouteNode]]
Return Value
Returns the route instructions for specified route
-
Get the route instructions for current route.
Declaration
Swift
public func routingInstructions() -> [MNRouteNode]
Return Value
Returns the route instructions for current route
-
Get the route count.
Declaration
Swift
public func routeCount() -> Int
Return Value
Returns the number of routes
-
Declaration
Swift
public func routeBuildingIds() -> Set<Int>
-
Declaration
Swift
public func simulateRoute()
-
Declaration
Swift
public func endRouteSimulation()
-
Get the floor count for current route.
Declaration
Swift
public func floorCountForCurrentRoute() -> Int
Return Value
Returns the number of floors the current route spans.
-
Declaration
Swift
public func alertsForCurrentRoute() -> [String]
-
This will normally returns
nil
. Only if the routing failed, it will return the error message. We can usegetRoutingErrorIfFailed == nil
to see if routing succeed.Declaration
Swift
public func routingErrorIfFailed() -> String?
Return Value
Nilable Returns an error message if routing fails. If routing succeed, it will return
nil
-
Use this function to determain if routing response has been received, if it is not received and routing request has called, then it means it is currently waiting for route response.
Declaration
Swift
public func isRoutingSuccessful() -> Bool
-
This returns current route index. There are two values that belongs to the index. One is the segment index, the other is floor index.
- Return: Returns a tuple of segment index and floor index
Declaration
Swift
public func curRoutingIdx() -> (seg: Int, floor: Int)
-
Change path drawing to a different route segment. If you want to change floor only and keep the same route segment, use
routingSwitchFloorSegment
instead.Segment number should less than max size of
[MNRouteInstructions]
size. CallgetRoutingInstructions:
to get a list of route instructions.Declaration
Swift
public func switchRoute(routeIndex: Int)
Parameters
segment
The segment number you want to switch.
-
Change path drawing to current route segment and floor segment number. Switch the routing path to other floor by pass in
floorNumBySegment
.Call
getCurRoutingIdx:
to get current route segment number. CallgetRoutingInstructions:
to get a list of route instructions[MNRouteInstructions]
. Use current route segment number to get current route instructionMNRouteInstructions
. ThefloorNumBySegment
should not be larger than the size ofrouteInstructionByFloor
property inside the current route instruction.Remember you need to call
switchFloor
to switch to the corresponding floor as well.Declaration
Swift
public func switchFloorForRoute(floorIndex: Int)
-
Declaration
Swift
public func switchFloorForRoute(floorIndex: Int, floorId: Int)
-
Start navigation process.
This function will start navigation process. It will tilt focus map, handle all the path drawing on map, path redrawing when recalculate path is needed and will call positioning library to start navigation process.
See also
stopNavigation:
Declaration
Swift
public func startNavigation(fromPosition: MNMercator?)
-
Stop navigation process.
This function will stop navigation process. It will restore all the changes on map for navigation and call positioning library to stop navigation process.
See also
startNavigation:
Declaration
Swift
public func stopNavigation(finalPosition: MNMercator?)
-
Get distance/time estimate for route.
This function returns the distance/time estimate for the current route.
Declaration
Swift
public func routeDistanceTimeEstimate() -> MNRouteDistanceTime?
-
Declaration
Swift
public func routeDetourDistanceTime() -> MNRouteDistanceTime?
-
Get distance/time estimate for specified route.
This function returns the distance/time estimate for the specified route.
Declaration
Swift
public func routeDistanceTimeEstimate(routeIndex: Int) -> MNRouteDistanceTime?
-
Declaration
Swift
public func routeSegmentDistanceTimeEstimate(segIndex: Int) -> MNRouteDistanceTime?
-
Get total distance/time estimate across all destinations.
This function returns the total distance/time estimate across all destinations.
Declaration
Swift
public func totalRouteDistanceTimeEstimate() -> MNRouteDistanceTime?
-
Declaration
Swift
public func totalRouteDetourDistanceTime() -> MNRouteDistanceTime?
-
Get distance/time to destination. This function returns the distance/time estimate to destination from current node.
Declaration
Swift
public func routeDistanceTimeToDestination(nodeId: Int) -> MNRouteDistanceTime
Parameters
nodeId
Node id from which distance/time to be computed
-
Declaration
Swift
public func floorIdsForRoute(routeIndex: Int) -> [Int]
-
Get current navigation instruction.
Call this function to get the latest navigation instruction. This function need to be called inside navigation mode. Assume
startNavigation:
is already called.Declaration
Swift
public func curNavigationInstruction() -> MNRouteNode?
Return Value
Nilable The next route node
-
Get next navigation instruction based on the currrent instruction
Call this function to get the next navigation instruction. This function need to be called inside navigation mode. Assume
startNavigation:
is already called.Declaration
Swift
public func nxtNavigationInstruction(currentInstruction: MNRouteNode) -> MNRouteNode?
Return Value
Nilable The next to next route node which has details of the next instruction
-
Get the transition type at end of segment.
Call this function to get the transition type at end of segment.
Declaration
Swift
public func transitionTypeAtEnd(routeIndex: Int, floorIndex: Int) -> RouteTransitionType?
Parameters
routeIndex
Route index
floorIndex
Floor index
Return Value
Nilable The transition type at end
-
Sets map pan type. Can be restricted to around property or free.
Declaration
Swift
public func setMapPanType(type: MapstedMapMeta.MapPanType)
Parameters
panType
The type of pan desired
-
Declaration
Swift
public func tiltMap(angle: Float, duration: Float)
-
Call this function to draw current position on map.
Declaration
Swift
public func drawCurrent(switchFloor: Bool)
-
Call this function to draw current position on map.
Declaration
Swift
public func drawCurrent(position: MNPosition, switchFloor: Bool)
-
Declaration
Swift
public func rotateMarker(degree: Float)
-
Declaration
Swift
public func isUserOnProperty() -> Bool
-
Declaration
Swift
public func isUserOnProperty(propertyId: Int) -> Bool
-
Declaration
Swift
public func selectedLocationMatchesCurrentPosition() -> Bool
-
Sets the map perspective to the value provided
Declaration
Swift
public func setMapPerspective(enable3D: Bool)
Parameters
enable3D
If true, enables 3D in map rendering
-
Sets the map perspective to the map pan type
Declaration
Swift
public func setMapPanType()
-
Whether or not to use Map Overlays
Declaration
Swift
public func useMapOverlays(enable: Bool)
Parameters
enable
If true, enables map overlays from CMS
-
Declaration
Swift
public func isUsingMapOverlays() -> Bool
-
Sets the layering method to the value provided
Declaration
Swift
public func useGeoJSONLayers(enable: Bool)
Parameters
enable3D
If true, enables GeoJSON layers in map rendering
-
Sets the base map style to the value provided
Declaration
Swift
public func setBaseMapStyle(style: MapstedMapMeta.BaseMapStyle)
Parameters
style
One of the available base map styles
-
Sets the name of the asset file to be used for styling the map
Declaration
Swift
public func setMapStyleFileName(assetFileName: String)
Parameters
assetFileName
Name of the asset containing styles for map rendering
-
Sets the map bounds to a new value
Declaration
Swift
public func setMapBounds(to mapstedMapBounds: MapstedMapBounds?)
Parameters
mapstedMapBounds
The new map bounds
-
Sets the map bounds to a new value
Declaration
Swift
public func setMapBounds(with mercators: [MNMercator]?, deltaSet: MapstedMapDelta)
Parameters
mercators
An array of mercators with which to create the map bounds
-
Highlight entity on the map with the specified hex color
Declaration
Swift
public func highlightEntity(entity: MNMapEntity, hexColor: String, imageUrl: String)
-
Remove all entity highlights
Declaration
Swift
public func removeAllEntityHighlights(propertyId: Int)
-
Remove entity highlights by entity
Declaration
Swift
public func removeEntityHighlight(entity: MNMapEntity)
-
Remove all entity highlights by hexColor
Declaration
Swift
public func removeEntityHighlightsByColor(propertyId: Int, hexColorToRemove: String)
-
Highlight entities on the map with the specified hex color. Note: All entities should be on the same property
Declaration
Swift
public func highlightEntities(entities: [MNMapEntity], hexColor: String, imageUrl: [String])
-
Declaration
Swift
public func processDeepLink(uri: URL, completion: ((Bool) -> Void)?)
-
Declaration
Swift
public func processDeepLink(path: String, params: [URLQueryItem]?, completion: ((Bool) -> Void)?)