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
venueId
the venue identifier for the associated VMD
buildingNumber
the current building index
activeIndoorFloors
the initial indoor floors to show
activeOutdoorFloors
the initial outdoor floors to show
frame
the frame for the map
iconBaseURL
icon url
fontBaseURL
font 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
venueId
the venue identifier for the associated VMD
buildingNumber
the current building index
floor
the current indoor floor
frame
the frame for the map
iconBaseURL
icon url
fontBaseURL
font 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
venueId
the venue identifier for the associated VMD
buildingNumber
the current building index
floor
the current indoor floor
frame
the 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
frame
frame for the mapview
vmd
a 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
floor
the floor to zoom to
constrainedToSize
the size of the screen that you want the floor visible in
zoomOffset
additional zoom padding, if needed
skipRotation
if 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
parent
the parent view to add this map to
aboveView
a 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
parent
the parent view to add this map to
aboveView
a 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
parent
the 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
target
location for the map
bearing
bearing for the map
zoomLevel
zoom for the map
pitch
the 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
target
location for the map
bearing
bearing for the map
zoomLevel
zoom for the map
-
Set initial map position after it’s done loading
Declaration
Swift
public func setMapPosition( target:CLLocationCoordinate2D, bearing:Float, zoom: Double )
Parameters
target
location for the map
bearing
bearing for the map
zoom
zoom 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
target
location for the map
bearing
bearing for the map
zoom
zoom for the map
pitch
the pitch for the map
-
Respond to a tap at the given location
Declaration
Swift
public func handleSingleTapAt( _ location: CLLocationCoordinate2D )
Parameters
location
the location of the tap
-
Change the background layer’s alpha
Declaration
Swift
public func setBackgroundAlpha(_ alpha: Float)
Parameters
alpha
The 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
annotation
the annotation
-
Remove annotation from the map
Declaration
Swift
public func removeAnnotation(_ annotation: VMMapAnnotation)
Parameters
annotation
the annotation
-
Apply a custom style to an indivudual map element
Since
1.2Declaration
Swift
public func setStyle(_ style: VMVenueLayerStyle, forUnit unit: VMMSMapUnit)
Parameters
unit
the unit to apply the style to
style
the style information
-
Remove a custom style from an indivudual map element
Since
1.2Declaration
Swift
public func removeStyleForUnit(_ unit: VMMSMapUnit )
Parameters
unit
the 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
mapView
the map
-
Called to check if the map’s camera should change
Declaration
Swift
public func mapView(_ mapView: MGLMapView, shouldChangeFrom oldCamera: MGLMapCamera, to newCamera: MGLMapCamera) -> Bool
Parameters
mapView
the map
oldCamera
the previous camera position
newCamera
the 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
mapView
the mapview
error
the error
-
Called when mapview finishes loading style
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle)
Parameters
mapView
the mapview
style
the style
-
Called when map finishes loading, this is where all the setup occurs
Declaration
Swift
public func mapViewDidFinishLoadingMap(_ mapView: MGLMapView)
Parameters
mapView
the mapview
-
Indicates the map finished redrawing the frame
Declaration
Swift
public func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool)
Parameters
mapView
the mapview
fullyRendered
true if frame is full rendered
-
Indicates map is about to be redrawn
Declaration
Swift
public func mapViewWillStartRenderingFrame(_ mapView: MGLMapView)
Parameters
mapView
the mapview
-
Called when annotation view is selected
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didSelect annotationView: MGLAnnotationView)
Parameters
mapView
the map
annotationView
the selected annotation
-
Called when annotation view is deselected
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didDeselect annotationView: MGLAnnotationView)
Parameters
mapView
the map
annotationView
the deselected annotation
-
Called when annotation is selected
Declaration
Swift
public func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation)
Parameters
mapView
the map
annotation
the annotation
-
Provide stroke color for lines
Declaration
Swift
public func mapView(_ mapView: MGLMapView, strokeColorForShapeAnnotation annotation: MGLShape) -> UIColor
Parameters
mapView
the mapview
annotation
the shape annotation
Return Value
the color
-
Provide stroke width for lines
Declaration
Swift
public func mapView(_ mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloat
Parameters
mapView
the mapview
annotation
the line
Return Value
the width
-
Provide alpha for shape annotation
Declaration
Swift
public func mapView(_ mapView: MGLMapView, alphaForShapeAnnotation annotation: MGLShape) -> CGFloat
Parameters
mapView
the map
annotation
the 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
mapView
the mapview
annotation
the 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
mapView
the map
annotation
the annotation
Return Value
the custom image