MapstedMapApi

@objc
public class MapstedMapApi : NSObject
extension MapstedMapApi: PackageDelegate
extension MapstedMapApi: MNDeepLinkDelegate
extension MapstedMapApi: PositionChangeListener, PositionAnimationListener, PositionVisibilityListener
extension MapstedMapApi : PropertyCompletionListener

This class contains all public api for map

Tags

Method to hide mapsted logo

Methods to add and remove custom icons

Methods to customize the Tag and Destination Pin image

  • Declaration

    Swift

    public func setDestinationPinImage(destinationPin: UIImage)
  • Declaration

    Swift

    public func setTagImage(tagPin: UIImage)
  • 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()

Calibration

Routing

  • Declaration

    Swift

    public func handleRouteResponse(routeResponse: MNRouteResponse)
  • Declaration

    Swift

    public func handleRouteError(errorCode: Int, errorMessage: String, alertIds: [String])
  • Handle User Progress On Route while in navigation

    Declaration

    Swift

    public func handleUserProgressOnRoute(routeUserProgress: MNRouteUserProgress)
  • Handle Route Segment Reached On Route while in navigation

    Declaration

    Swift

    public func handleRouteSegmentReached(currentRouteSegment: MNRouteSegment, visitedRouteSegments: [MNRouteSegment], upcomingRouteSegments: [MNRouteSegment])
  • 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(segmentIndex: Int) -> Int

    Return Value

    Returns floor if for current route

  • Declaration

    Swift

    public func buildingId(segmentIndex: Int) -> Int
  • 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 segmentCountForCurrentRoute() -> 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 use getRoutingErrorIfFailed == 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. Call getRoutingInstructions: 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. Call getRoutingInstructions: to get a list of route instructions [MNRouteInstructions]. Use current route segment number to get current route instruction MNRouteInstructions. The floorNumBySegment should not be larger than the size of routeInstructionByFloor property inside the current route instruction.

    Remember you need to call switchFloor to switch to the corresponding floor as well.

    Declaration

    Swift

    public func switchSegmentForCurrentRoute(routeSegmentIndex: 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.

    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 nextNavigationInstruction() -> MNRouteNode?

    Return Value

    Nilable MNRouteNode object which has details of the next instruction

  • 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)

Extension

Center Property on Map

  • Center property on the map

    Declaration

    Swift

    public func centerOnProperty(propertyId: Int) -> Bool

    Parameters

    propertyId

    Property Id of the property

    Return Value

    true if successful.

Center Building on Map

  • Center building on the map

    Declaration

    Swift

    public func centerOnBuilding(buildingId: Int) -> Bool

    Parameters

    buildingId

    building Id of the building

    Return Value

    true if successful.

Map Overlays

  • Refresh and Plot Map Overlays.

    Declaration

    Swift

    public func refreshAndPlotMapOverlays(propertyId: Int, completion: @escaping ((Bool) -> ()))

    Parameters

    propertyId

    PropertyId of the property for which map overlays needs to be fetched

MAP RENDERING OPTIONS

  • 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

  • Declaration

    Swift

    public func getBaseMapStyle() -> MapstedMapMeta.BaseMapStyle
  • 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

MAP BOUNDS