VMMapView
@objcMembers public class VMMapView: NSObject
VMMapView is an abstract class used to display a Venue Map Data file (VMD)
Warning
DO NOT instantiate directly, instead use one of the concrete subclasses VMVectorMapView or VMRasterMapView.Since
1.1-
Create a mapivew for a given venue
Since
1.2Declaration
Swift
public init(venueId: String, buildingNumber: Int, activeIndoorFloors: [VMMSMapBuildingFloor], activeOutdoorFloors: [VMMSMapOutdoorBuildingFloor], frame: CGRect, iconBaseURL: URL?, fontBaseURL: URL? )Parameters
venueIdthe venue identifier for the associated VMD
buildingNumberthe current building index
activeIndoorFloorsthe initial indoor floors to show
activeOutdoorFloorsthe initial outdoor floors to show
framethe frame for the map
iconBaseURLicon url
fontBaseURLfont base url
-
Create a new VMMapView for a given venue
Declaration
Swift
public convenience init(venueId: String, buildingNumber: Int, floor: VMMSMapBuildingFloor, frame: CGRect, iconBaseURL: URL?, fontBaseURL: URL? )Parameters
venueIdthe venue identifier for the associated VMD
buildingNumberthe current building index
floorthe current indoor floor
framethe frame for the map
iconBaseURLicon url
fontBaseURLfont base url
-
Create a new VMMapView for a given venue using default icon & fonts
Declaration
Swift
public convenience init(venueId: String, buildingNumber: Int, floor: VMMSMapBuildingFloor, frame: CGRect)Parameters
venueIdthe venue identifier for the associated VMD
buildingNumberthe current building index
floorthe current indoor floor
framethe frame for the map
-
Create a new VMMapView for a given VMD using default icons, fonts initially displaying the defualt floors and buildings
Since
1.2Declaration
Swift
public convenience init( frame: CGRect, vmd: VMMSMap)Parameters
frameframe for the mapview
vmda VMMSMap object that contains the venue information
-
Undocumented
Declaration
Swift
@objcMembers public class VMMapView: NSObject
-
Reference to the VMD map
Declaration
Swift
public var map: VMMSMap?; -
The venue ID from the VMD file
Declaration
Swift
public var venueId: String = "" -
Current building index
Declaration
Swift
public var currentBuilding: Int!; -
Reference to internal map view
Declaration
Swift
public private(set) var mapView: MGLMapView?; -
Delegate for receiving callbacks.
Declaration
Swift
public weak var delegate: VMMapViewDelegate? -
Get the currently visible portion of the map
Since
1.2Declaration
Swift
public var visibleCoordinateBounds: VMMSCoordinateBounds?Return Value
The rectangular lat/lng boundaries of the visible portion of the map;
-
Style for the venue
Declaration
Swift
public var style: VMVenueStyle? -
Base url/filepath for spritesheet with icons/images
Declaration
Swift
public private(set) var iconBaseURL: String = "" -
Base url/filepath for font SDF files
Declaration
Swift
public private(set) var fontBaseURL: String = "" -
Base url/filepath to find tiles Note: Folder structure is expected as
/ / Declaration
Swift
public var tileBaseURL: String = "" -
Base url/filepath to find tiles Note: Folder structure is expected as
/ / Since
1.2.4Declaration
Swift
public var artTileBaseURL: String = "" -
Base url/filepath to find vector tiles for icons & text data Note: Folder structure is expected as
/ / Declaration
Swift
public var vectorCommonBaseURL: String = "" -
The currently selected map unit, if any
Declaration
Swift
public var selectedUnit: VMMSMapUnit? -
The currently displayed indoor floor for the map
Warning
Deprecated since 1.2. Use activeIndoorFloors instead.Declaration
Swift
public var currentFloor: VMMSMapBuildingFloor! -
The currently displayed outdoor floor for the map
Warning
Deprecated since 1.2. Use activeOutdoorFloors instead.Declaration
Swift
public var currentOutdoorFloor: VMMSMapOutdoorBuildingFloor! -
All currently displayed outdoor floors for the map
Since
1.2Declaration
Swift
public var activeOutdoorFloors: [VMMSMapOutdoorBuildingFloor]! -
All currently displayed indoor floors for the map
Since
1.2Declaration
Swift
public var activeIndoorFloors: [VMMSMapBuildingFloor]! -
The minimum allowable zoom level for the map
- Default: 1.0
Declaration
Swift
public var minZoom: Float = 1.0 -
The maximium allowable zoom level for the map
- Default: 21.0
Declaration
Swift
public var maxZoom: Float = 21.0 -
<#Description#>
Declaration
Swift
public var zoomLevel: Float -
Undocumented
Declaration
Swift
@objcMembers public class VMMapView: NSObject -
Undocumented
Declaration
Swift
@objcMembers public class VMMapView: NSObject -
Undocumented
Declaration
Swift
@objcMembers public class VMMapView: NSObject -
Shows a rectangle around map tiles and othe rdebug information. Defaults to false.
Since
1.3Declaration
Swift
public var showTileBoundaries: Bool = false
-
Adjusts map’s camera to zoom and adjust position to the current floor is completely visible
Since
1.2Declaration
Swift
public func fixCameraToFloor(_ floor: VMMSBaseFloor!, constrainedToSize: CGSize, zoomOffset: Double, skipRotation: Bool = false)Parameters
floorthe floor to zoom to
constrainedToSizethe size of the screen that you want the floor visible in
zoomOffsetadditional zoom padding, if needed
skipRotationif true, resets the rotation of the map back to the initial rotation defined in the VMD
-
Add the mapview above the given view Note, when using a VMMapView in addition to another map provider (google maps, apple maps, etc), it’s recommended to attach directly above that view for the other map provider
Declaration
Swift
public func attachInView(_ parent: UIView, aboveView: UIView?)Parameters
parentthe parent view to add this map to
aboveViewa reference view to insert above (nil to just addSubview at the top)
-
Add the mapview above the given view
Since
1.2Declaration
Swift
public func attachInView(_ parent: UIView,_ aboveView: UIView?)Parameters
parentthe parent view to add this map to
aboveViewa reference view to insert above (nil to just add at the top of the view hierarchy)
-
Adds map to parent view
Since
1.2Declaration
Swift
public func addToView(_ parent: UIView )Parameters
parentthe superview
-
Clears map tile cache to free up memory
Declaration
Swift
public func clearTileCache() -
Set initial map position after it’s done loading
Since
1.2Declaration
Swift
public func setMapPosition(target:CLLocationCoordinate2D, bearing:Float, zoomLevel: Float, pitch: Double )Parameters
targetlocation for the map
bearingbearing for the map
zoomLevelzoom for the map
pitchthe pitch for the map
-
Set initial map position after it’s done loading
Since
1.2.1Declaration
Swift
public func setMapPosition( target:CLLocationCoordinate2D, bearing:Float, zoomLevel: Float )Parameters
targetlocation for the map
bearingbearing for the map
zoomLevelzoom for the map
-
Set initial map position after it’s done loading
Declaration
Swift
public func setMapPosition( target:CLLocationCoordinate2D, bearing:Float, zoom: Double )Parameters
targetlocation for the map
bearingbearing for the map
zoomzoom for the map
-
Set initial map position after it’s done loading
Since
1.2.1Declaration
Swift
public func setMapPosition(target:CLLocationCoordinate2D, bearing:Float, zoom: Double, pitch: Double )Parameters
targetlocation for the map
bearingbearing for the map
zoomzoom for the map
pitchthe pitch for the map
-
Respond to a tap at the given location
Declaration
Swift
public func handleSingleTapAt( _ location: CLLocationCoordinate2D )Parameters
locationthe location of the tap
-
Change the background layer’s alpha
Declaration
Swift
public func setBackgroundAlpha(_ alpha: Float)Parameters
alphaThe new alpha value (1.0 represents fully opaque, and 0.0 represents full transparent)
-
Add annotation to the map
Declaration
Swift
public func addAnnotation(_ annotation: VMMapAnnotation )Parameters
annotationthe annotation
-
Remove annotation from the map
Declaration
Swift
public func removeAnnotation(_ annotation: VMMapAnnotation)Parameters
annotationthe annotation
-
Apply a custom style to an indivudual map element
Since
1.2Declaration
Swift
public func setStyle(_ style: VMVenueLayerStyle, forUnit unit: VMMSMapUnit)Parameters
unitthe unit to apply the style to
stylethe style information
-
Remove a custom style from an indivudual map element
Since
1.2Declaration
Swift
public func removeStyleForUnit(_ unit: VMMSMapUnit )Parameters
unitthe unit to remove the style from
-
Finds the bottom most symbol layer in the map layer heirarchy
Declaration
Swift
public func findLowestSymbolLayer() -> MGLSymbolStyleLayer?Return Value
the symbol layer if it exists
-
Called when map changes
Declaration
Swift
public func mapViewRegionIsChanging(_ mapView: MGLMapView)Parameters
mapViewthe map
-
Called to check if the map’s camera should change
Declaration
Swift
public func mapView(_ mapView: MGLMapView, shouldChangeFrom oldCamera: MGLMapCamera, to newCamera: MGLMapCamera) -> BoolParameters
mapViewthe map
oldCamerathe previous camera position
newCamerathe new camera position
Return Value
true if it is OK to change to the new camera position
-
Called if map fails to load
Declaration
Swift
public func mapViewDidFailLoadingMap(_ mapView: MGLMapView, withError error: Error)Parameters
mapViewthe mapview
errorthe error
-
Called when mapview finishes loading style
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle)Parameters
mapViewthe mapview
stylethe style
-
Called when map finishes loading, this is where all the setup occurs
Declaration
Swift
public func mapViewDidFinishLoadingMap(_ mapView: MGLMapView)Parameters
mapViewthe mapview
-
Indicates the map finished redrawing the frame
Declaration
Swift
public func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool)Parameters
mapViewthe mapview
fullyRenderedtrue if frame is full rendered
-
Indicates map is about to be redrawn
Declaration
Swift
public func mapViewWillStartRenderingFrame(_ mapView: MGLMapView)Parameters
mapViewthe mapview
-
Called when annotation view is selected
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didSelect annotationView: MGLAnnotationView)Parameters
mapViewthe map
annotationViewthe selected annotation
-
Called when annotation view is deselected
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didDeselect annotationView: MGLAnnotationView)Parameters
mapViewthe map
annotationViewthe deselected annotation
-
Called when annotation is selected
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation)Parameters
mapViewthe map
annotationthe annotation
-
Provide stroke color for lines
Declaration
Swift
public func mapView(_ mapView: MGLMapView, strokeColorForShapeAnnotation annotation: MGLShape) -> UIColorParameters
mapViewthe mapview
annotationthe shape annotation
Return Value
the color
-
Provide stroke width for lines
Declaration
Swift
public func mapView(_ mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloatParameters
mapViewthe mapview
annotationthe line
Return Value
the width
-
Provide alpha for shape annotation
Declaration
Swift
public func mapView(_ mapView: MGLMapView, alphaForShapeAnnotation annotation: MGLShape) -> CGFloatParameters
mapViewthe map
annotationthe shape
Return Value
the alpha value
-
Provide a custom view for an annotation
Declaration
Swift
public func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView?Parameters
mapViewthe mapview
annotationthe annotation
Return Value
the custom view
-
Provide a custom image for an annoation
Declaration
Swift
public func mapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage?Parameters
mapViewthe map
annotationthe annotation
Return Value
the custom image
VMMapView Class Reference