MapView
public class MapView : UIView
MapView is a custom view designed to handle displaying Maps for a Venue.
call setMap(Map)
to display the first map.
-
the
MapViewDelegate
that will be sent events from the MapView.Declaration
Swift
public var delegate: MapViewDelegate?
-
The map that should be currently displayed
Declaration
Swift
public var activeMap: Map? { get set }
-
When set the store labels will be drawn over top of venues. The store labels will always be rendered using
storeLabelDefaultFont
.This property does not override any per-
Polygon
settings of store labels.Defaults to:
false
Declaration
Swift
public var storeLabelsEnable: Bool { get set }
-
Specific the font to be used by default (ignoring any per-
polygon
overrides).Defaults to: UIFontTextStyle.body
Declaration
Swift
public var storeLabelsDefaultFont: UIFontDescriptor { get set }
-
Specify the color to use for store label text. This will be used if no other color has been selected for a polygon.
Defaults to: UIColor.black
Declaration
Swift
public var storeLablesDefaultColor: UIColor { get set }
-
defines a camera constraint that is applied when a user drags the camera
Declaration
Swift
public var cameraBounds: CameraBounds
-
Add an element to be rendered into the MapView
Declaration
Swift
public func add(_ element: Element)
-
Remove an element from being rendered by the MapeView
Declaration
Swift
public func remove(_ element: Element)
-
Changes the mapview background color
Declaration
Swift
public func setBackgroundColor(color: UIColor)
Parameters
color
Color to be set for the background
-
Changes the polygon color, animated over some time. Use this to highlight polygons.
Declaration
Swift
public func setColor(of polygon: Polygon, to color: UIColor, over animationInterval: TimeInterval)
Parameters
polygon
Polygon to have its color changed
color
Color to be set for the polygon
animationInterval
Animation time in seconds
-
Changes the polygon height over time. Can be useful as part of setColor to highlight a polygon.
Declaration
Swift
public func setHeight(of polygon: Polygon, to height: Float, over animationInterval: TimeInterval)
Parameters
polygon
Polygon to have its height changed
height
Height to be set for the polygon
animationInterval
Animation time in seconds.
-
set the color of a an polygon,
Declaration
Swift
public func setStoreLabelColor(of polygon: Polygon, to: UIColor)
-
resets the color of a polygon back to the default color
Declaration
Swift
public func resetStoreLabelColor(of polygon: Polygon)
-
Sets the MapView to display a specific map associated with the current venue.
This will also display any Element objects that fall onto the new map.
Note: Any Elements that existed that were not map specific will be present after a new map is loaded.
Declaration
Swift
public func setMap(_ map: Map)
Parameters
map
The map to display
-
Returns a set of polygons currently in view of the camera
Declaration
Swift
public func polygonsInView() -> Set<Polygon>
-
Returns a set of locations that have polygons currently in view of the camera
Declaration
Swift
public func locationsInView() -> Set<Location>
-
Returns true if polygon is currently in view of the camera
Declaration
Swift
public func isInView(polygon: Polygon) -> Bool
Parameters
polygon
the polygon to test against the camera.
-
Returns true if location has polygons currently in view of the camera
Declaration
Swift
public func isInView(location: Location) -> Bool
Parameters
location
the location to test against the camera.
-
What direction, in Radians, is the Camera looking. From a bird eye view, A value of 0 would be North, and value of Pi / 2 would be east. 2 * Pi would be North again.
Declaration
Swift
public var cameraHeading: Radians { get }
-
How the Camera is tilted down to see the Map view
Declaration
Swift
public var cameraTilt: Radians { get }
-
Given the following object that is conforms to the
Focusable
protocol frame that object in the current Camera view.Note
The animation will stack if applied with other animation, so calling this function back to back will cause multiple animations
Declaration
Swift
public func frame(_ focusable: Focusable, padding: Float = 0, heading: Radians, tilt: Radians, over animationInterval: TimeInterval, minimumSize: Float = 25)
Parameters
focusable
An object that implemented the
Focusable
protocol This will be used to frame the bounds of the Camerapadding
Amount of visual space around what is being fitted into the camera
heading
What direction in Radians the camera should be pointed at the focusable object.
0
Being from the North andPi / 2
would be east.tilt
What direction the camera should be tilted down toward the map.
0
Would be level, andPi / 2
would be directly overhead.over
A duration in which to animate the transition between the current Camera position and the target camera position.
minimumSize
Some small objects will be too small to see on the map if you were to frame a single point for example. This parameter will control how tightly the camera is allowed to zoom into said point. If the point is smaller then the size, this API will treat it as an object that is at least a
minimumSize
sized object in all axies. Defaults to 25. -
Given the following objects that is conforms to the
Focusable
protocol frame that object in the current Camera view.Note
The animation will stack if applied with other animation, so calling this function back to back will cause multiple animations
Declaration
Swift
public func frame(_ focusable: [Focusable], padding: Float = 0, heading: Radians, tilt: Radians, over animationInterval: TimeInterval, minimumSize: Float = 25)
Parameters
focusable
An array of object that implemented the
Focusable
protocol This will be used to frame the bounds of the Camerapadding
Amount of visual space around what is being fitted into the camera
heading
What direction in Radians the camera should be pointed at the focusable object.
0
Being from the North andPi / 2
would be east.tilt
What direction the camera should be tilted down toward the map.
0
Would be level, andPi / 2
would be directly overhead.over
A duration in which to animate the transition between the current Camera position and the target camera position.
minimumSize
Some small objects will be too small to see on the map if you were to frame a single point for example. This parameter will control how tightly the camera is allowed to zoom into said point. If the point is smaller then the size, this API will treat it as an object that is at least a
minimumSize
sized object in all axis. Defaults to 25. -
Grab the CLLocationCoordinate2D from a tap on the map *
Declaration
Swift
func clLocationCoordinate2DFromTap(_ touches: Set<UITouch>) -> CLLocationCoordinate2D?