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

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

  • Call this function to release the map resources when moving away from the screen which displays Mapsted’s map view.

    Declaration

    Swift

    public func unloadMapResources()
  • Call this function to set the custom logo instead of the Mapsted logo on the map view.

    Declaration

    Swift

    public func setCustomLogo(logo: UIImage, dimension: CustomLogoDimension? = nil)

    Parameters

    logo

    UIImage to be set as the custom logo.

    dimension

    This is object of CustomLogoDimension which can be used to specify custom dimensions, if this is kept nil, then it will take default dimensions.

  • Call this function to set the custom icon for the compass button

    Declaration

    Swift

    public func setCompassIcon(logo: UIImage?)

    Parameters

    logo

    UIImage to be set as the compass button image.

  • Call this function to change the location and dimension of the compass button on the screen

    Declaration

    Swift

    public func setCompassPosition(dimension: CompassDimension?)

    Parameters

    dimension

    This is a struct CompassDimension where it take the top, left, height and width to set for the compass button.

  • Call this function to change the location of the copyright label on the screen

    Declaration

    Swift

    public func setCopyRightLabelBottomMargin(bottom: CGFloat?)

    Parameters

    bottom

    This is the bottom margin of the copyright label

  • 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: PackageDelegate)
  • 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
  • Set Camera Auto-Follow Change Delegate

    Declaration

    Swift

    public func setCameraAutoFollowChangeDelegate(delegate: CameraAutoFollowChangeObserver?)
  • This method can be used to enable/disable the Camera Auto-Follow

    Declaration

    Swift

    public func setCameraAutofollow(enabled: Bool)

    Parameters

    enabled

    Set to true to enable the Camera Auto-Follow and set to false to disable the Camera Auto-Follow

  • This method can be get whether the Camera Auto-Follow is enabled or disabled

    Declaration

    Swift

    public func isCameraAutoFollowEnabled() -> Bool
  • Declaration

    Swift

    public func handleZoom(propertyId: Int, closestToCentreBuildingId: [Int], zoom: Float)
  • Declaration

    Swift

    public func handleOverlays(onScreenPropertyIds: [Int],
                               onScreenBuildingIds: [Int],
                               closestToCenterPropertyId: Int,
                               previousZoom: Float,
                               newZoom: Float,
                               shouldPolygonOverlaysBeVisible: Bool)

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

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

Add & Remove Map Listener

  • Call this method to register or add the MNMapListenerDelegate

    Declaration

    Swift

    public func addMapListenerDelegate(delegate: MNMapListenerDelegate)

    Parameters

    delegate

    This is object of the MNMapListenerDelegate. This can be used to pass the instance of the class which needs to listen to the MNMapListenerDelegate.

  • Call this method to unregister or remove the MNMapListenerDelegate

    Declaration

    Swift

    public func removeMapListenerDelegate(delegate: MNMapListenerDelegate)

    Parameters

    delegate

    This is object of the MNMapListenerDelegate. This can be used to pass the instance of the class which needs to stop listening to the MNMapListenerDelegate.

Add & Remove Map Vector Element Listener

  • Call this method to register or add the MNMapVectorElementListenerDelegate

    Declaration

    Swift

    public func addMapVectorElementListenerDelegate(delegate: MNMapVectorElementListenerDelegate)

    Parameters

    delegate

    This is object of the MNMapVectorElementListenerDelegate. This can be used to pass the instance of the class which needs to listen to the MNMapVectorElementListenerDelegate.

  • Call this method to unregister or remove the MNMapVectorElementListenerDelegate

    Declaration

    Swift

    public func removeMapVectorElementListenerDelegate(delegate: MNMapVectorElementListenerDelegate)

    Parameters

    delegate

    This is object of the MNMapVectorElementListenerDelegate. This can be used to pass the instance of the class which needs to stop listening to the MNMapVectorElementListenerDelegate.

Add & Remove Map Tile Event Listener

  • Call this method to register or add the MNMapVectorTileEventListenerDelegate

    Declaration

    Swift

    public func addMapTileEventListenerDelegate(delegate: MNMapVectorTileEventListenerDelegate)

    Parameters

    delegate

    This is object of the MNMapVectorTileEventListenerDelegate. This can be used to pass the instance of the class which needs to listen to the MNMapVectorTileEventListenerDelegate.

  • Call this method to unregister or remove the MNMapVectorTileEventListenerDelegate

    Declaration

    Swift

    public func removeMapTileEventListenerDelegate(delegate: MNMapVectorTileEventListenerDelegate)

    Parameters

    delegate

    This is object of the MNMapVectorTileEventListenerDelegate. This can be used to pass the instance of the class which needs to stop listening to the MNMapVectorTileEventListenerDelegate.

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