WRLDMapView Class Reference
A view which displays a 3D map. Also exposes most of the methods for manipulating the map.
Initialization
@property delegate
@property (nonatomic, weak, nullable) IBOutlet id<WRLDMapViewDelegate> delegate
A WRLDMapViewDelegate object to receive events from this view. Can be wired up in Interface Builder.
– initWithFrame:
- (instancetype)initWithFrame:(CGRect)frame
Allocates and initializes a new WRLDMapView object with the given frame and default map options.
Returns:The initialized view.
Argument | Description |
---|---|
frame | The frame rectangle for the view, measured in pts. |
– initWithFrame:andMapOptions:
- (instancetype)initWithFrame:(CGRect)frame andMapOptions:(nullable WRLDMapOptions *)mapOptions
Allocates and initializes a new WRLDMapView object with the given frame and map options.
Returns:The initialized view.
Argument | Description |
---|---|
frame | The frame rectangle for the view, measured in pts. |
mapOptions | The map options to initialize the map with. Specify nil for the default map options. |
View properties
@property centerCoordinate
@property (nonatomic) CLLocationCoordinate2D centerCoordinate
The coordinate at the center of the map view.
@property zoomLevel
@property (nonatomic) double zoomLevel
The zoom level of the map.
@property direction
@property (nonatomic) CLLocationDirection direction
The heading of the map.
@property camera
@property (nonatomic, copy) WRLDMapCamera *camera
The WRLDMapCamera represents the current view of the map.
View methods
– setCenterCoordinate:
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate
– setCenterCoordinate:animated:
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated
– setCenterCoordinate:zoomLevel:animated:
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate zoomLevel:(double)zoomLevel animated:(BOOL)animated
– setCenterCoordinate:direction:animated:
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate direction:(CLLocationDirection)direction animated:(BOOL)animated
– setCenterCoordinate:zoomLevel:direction:animated:
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated
Set the center coordinate, and optionally the zoom level and heading, of the map.
Argument | Description |
---|---|
coordinate | The LatLong coordinate to look at. |
zoomLevel | How zoomed in the resulting view should be. |
direction | The new heading of the map. |
animated | YES to animate smoothly to the new camera state, NO to snap immediately. Note that if the specified location is too far away from the current camera location, this parameter will be ignored and the camera will snap the new location. |
– setZoomLevel:
- (void)setZoomLevel:(double)zoomLevel
– setZoomLevel:animated:
- (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated
Set the zoom level of the map, optionally animating from the current zoom level.
Argument | Description |
---|---|
zoomLevel | The target zoom level. |
animated | Whether to animate this transition, or just snap to the destination zoom level. |
– setDirection:animated:
- (void)setDirection:(double)direction animated:(BOOL)animated
Set the heading of the map, optionally animating from the current heading.
Argument | Description |
---|---|
direction | The target heading direction. |
animated | Whether to animate this transition, or just snap to the destination heading. |
– setIndoorCameraRestriction:
- (void)setIndoorCameraRestriction:(BOOL)indoorCameraRestriction
Enable or Disable the camera restriction when viewing Indoor Maps. When enabled, the camera is unable to move outside the bounds of the Indoor Map.
Argument | Description |
---|---|
indoorCameraRestriction | Whether the restriction is enabled or disabled. |
– setCameraScreenSpaceOffset:
- (void)setCameraScreenSpaceOffset:(CGPoint)screenPoint
Set the camera to focus at a particular screen coordinate, so it will rotate + zoom around this point on screen.
Argument | Description |
---|---|
screenPoint | The screen coordinate to focus the camera around. |
– disableCameraScreenSpaceOffset
- (void)disableCameraScreenSpaceOffset
Disable any previously set screen space offset set by setCameraScreenSpaceOffset and resume the default behavior.
– setCamera:
- (void)setCamera:(WRLDMapCamera *)camera
– setCamera:animated:
- (void)setCamera:(WRLDMapCamera *)camera animated:(BOOL)animated
Set the camera of the map, optionally animating from the current view.
Argument | Description |
---|---|
camera | The target WRLDMapCamera. |
animated | Whether to animate this transition, or just snap to the new map view. |
– setCamera:duration:
- (void)setCamera:(WRLDMapCamera *)camera duration:(NSTimeInterval)duration
Set the camera of the map, animating for the supplied duration.
Argument | Description |
---|---|
camera | The target WRLDMapCamera. |
duration | The length of time for the transition to take. |
– setCoordinateBounds:animated:
- (void)setCoordinateBounds:(WRLDCoordinateBounds)bounds animated:(BOOL)animated
Position the camera to encapsulate a bounded region.
Argument | Description |
---|---|
bounds | Instance of an WRLDCoordinateBounds object, which describes the region to encapsulate. |
animated | YES to animate smoothly to the new camera state, NO to snap immediately. Note that if the region is too far away from the current camera location, this parameter will be ignored and the camera will snap the new location. |
Markers
– addMarker:
- (void)addMarker:(WRLDMarker *)marker
Add a marker to the map.
Argument | Description |
---|---|
marker | The WRLDMarker object to add to the map. !Deprecated prefer to use addOverlay |
– addMarkers:
- (void)addMarkers:(NSArray<WRLDMarker*> *)markers
Add multiple markers to the map.
Argument | Description |
---|---|
markers | An array of WRLDMarker objects to add to the map. !Deprecated prefer to use addOverlay |
– removeMarker:
- (void)removeMarker:(WRLDMarker *)marker
Remove a marker from the map.
Argument | Description |
---|---|
marker | The WRLDMarker object to remove from the map. !Deprecated prefer to use removeOverlay |
– removeMarkers:
- (void)removeMarkers:(NSArray<WRLDMarker*> *)markers
Remove multiple markers from the map.
Argument | Description |
---|---|
markers | An array of WRLDMarker objects to remove from the map. !Deprecated prefer to use removeOverlay |
Positioners
– addPositioner:
- (void)addPositioner:(WRLDPositioner *)positioner
Add a positioner to the map.
Argument | Description |
---|---|
positioner | The WRLDPositioner object to add to the map. |
– removePositioner:
- (void)removePositioner:(WRLDPositioner *)positioner
Remove a positioner from the map.
Argument | Description |
---|---|
positioner | The WRLDPositioner object to remove from the map. |
Polygons
– addPolygon:
- (void)addPolygon:(WRLDPolygon *)polygon
Add a polygon to the map.
Argument | Description |
---|---|
polygon | The WRLDPolygon object to add to the map. !Deprecated prefer to use addOverlay |
– addPolygons:
- (void)addPolygons:(NSArray<WRLDPolygon*> *)polygons
Add multiple polygons to the map.
Argument | Description |
---|---|
polygons | An array of WRLDPolygon objects to add to the map. !Deprecated prefer to use addOverlay |
– removePolygon:
- (void)removePolygon:(WRLDPolygon *)polygon
Remove a polygon from the map.
Argument | Description |
---|---|
polygon | The WRLDPolygon object to remove from the map. !Deprecated prefer to use removeOverlay |
– removePolygons:
- (void)removePolygons:(NSArray<WRLDPolygon*> *)polygons
Remove multiple polygons from the map.
Argument | Description |
---|---|
polygons | An array of WRLDPolygon objects to remove from the map. !Deprecated prefer to use removeOverlay |
Building highlights
– addBuildingHighlight:
- (void)addBuildingHighlight:(WRLDBuildingHighlight *)buildingHighlight
Add a building highlight to the map.
Argument | Description |
---|---|
buildingHighlight | The WRLDBuildingHighlight object to add to the map. |
– removeBuildingHighlight:
- (void)removeBuildingHighlight:(WRLDBuildingHighlight *)buildingHighlight
Remove a WRLDBuildingHighlight from the map and destroy it.
Argument | Description |
---|---|
buildingHighlight | The WRLDBuildingHighlight object to remove from the map. |
Feature Picking
– pickFeatureAtScreenPoint:
- (WRLDPickResult *)pickFeatureAtScreenPoint:(CGPoint)screenPoint
Attempts to find a map feature at the given screen point. A ray is constructed from the camera location and passing through the screen point. The first intersection of the ray with any of the currently streamed map features is found, if any. See WRLDPickResult for details of information returned.
Returns:Information about the map feature intersected with, if any.
Argument | Description |
---|---|
screenPoint | A screen space point, in units of pixels with the origin at the top left * corner of the screen. |
– pickFeatureAtLocation:
- (WRLDPickResult *)pickFeatureAtLocation:(CLLocationCoordinate2D)location
Attempts to find a map feature at the given CLLocationCoordinate2D location. See WRLDPickResult for details of information returned.
Returns:Information about the map feature intersected with, if any.
Argument | Description |
---|---|
location | A CLLocationCoordinate2D coordinate. |
Overlays
– addOverlay:
- (void)addOverlay:(id<WRLDOverlay>)overlay
Add an overlay to the map.
Argument | Description |
---|---|
overlay | The WRLDOverlay object to add to the map. |
– removeOverlay:
- (void)removeOverlay:(id<WRLDOverlay>)overlay
Remove an overlay from the map.
Argument | Description |
---|---|
overlay | The WRLDOverlay object to remove from the map. |
Precaching
– precache:radius:completionHandler:
- (WRLDPrecacheOperation *)precache:(CLLocationCoordinate2D)center radius:(double)radius completionHandler:(WRLDPrecacheOperationHandler)completionHandler
Begin an operation to asynchronously precache a spherical area of the map. This allows that area to load faster in future.
Returns:An object with a cancel method to allow you to cancel the precache operation.
Argument | Description |
---|---|
center | The center of the area to precache. |
radius | The radius (in meters) of the area to precache. |
completionHandler | The block to be executed on completion or failure of the precache operation. |
Indoor Map properties
@property indoorMapDelegate
@property (nonatomic, weak, nullable) IBOutlet id<WRLDIndoorMapDelegate> indoorMapDelegate
An object implementing the WRLDIndoorMapDelegate protocol to receive events when entering or exiting an indoor map.
@property activeIndoorMap
@property (nonatomic, readonly, copy, nullable) WRLDIndoorMap *activeIndoorMap
The currently active indoor map, or nil
if currently outdoors.
@property blueSphere
@property (nonatomic, readonly, copy) WRLDBlueSphere *blueSphere
The ‘Blue Sphere’ instance for this map view.
Indoor Map methods
– enterIndoorMap:
- (BOOL)enterIndoorMap:(NSString *)indoorMapId
Enter an indoor map with the given ID.
Returns:YES if can enter given indoor map, NO otherwise.
Argument | Description |
---|---|
indoorMapId | The ID of an indoor map as an NSString. See WRLDIndoorMap for details. |
– exitIndoorMap
- (void)exitIndoorMap
Exit the current indoor map, if indoors.
– isIndoors
- (BOOL)isIndoors
Check if the map view is currently indoors.
Returns:YES if currently in an indoor map, NO otherwise.
– currentFloorIndex
- (NSInteger)currentFloorIndex
Get the index of the current active floor, relative to the ground floor.
Returns:The current floor index as an NSInteger.
– setFloorByIndex:
- (void)setFloorByIndex:(NSInteger)floorIndex
Set the currently active floor to the one corresponding to the given index.
Argument | Description |
---|---|
floorIndex | The floor index to make active as an NSInteger. |
– moveUpFloor
- (void)moveUpFloor
Move up one floor in an indoor map.
– moveDownFloor
- (void)moveDownFloor
Move down one floor in an indoor map.
– moveUpFloors:
- (void)moveUpFloors:(NSInteger)numberOfFloors
Move up multiple floors in an indoor map.
Argument | Description |
---|---|
numberOfFloors | The number of floors to move as an NSInteger. |
– moveDownFloors:
- (void)moveDownFloors:(NSInteger)numberOfFloors
Move down multiple floors in an indoor map.
Argument | Description |
---|---|
numberOfFloors | The number of floors to move as an NSInteger. |
– setExitIndoorWhenTooFarAway:
- (void)setExitIndoorWhenTooFarAway:(BOOL)exitWhenFarAway
Set if you should exit an Indoor Map when moving the camera away from it. To be used in conjunction with setIndoorCameraRestriction:NO.
Argument | Description |
---|---|
exitWhenFarAway | If YES, Indoor Map will automatically exit when moving camera away from Indoor Map. |
– expandIndoorMapView
- (void)expandIndoorMapView
Enter the expanded view of an indoor map.
– collapseIndoorMapView
- (void)collapseIndoorMapView
Collapse the expanded view of an indoor map, returning to the default view.
– setFloorInterpolation:
- (void)setFloorInterpolation:(CGFloat)floorInterpolation
Sets the interpolation value used in the expanded indoor view.
Argument | Description |
---|---|
floorInterpolation | A CGFloat between 0.0 and the number of floors in the active WRLDIndoorMap object. |
– setIndoorEntityHighlights:indoorEntityIds:color:
- (void)setIndoorEntityHighlights:(NSString *)indoorMapId indoorEntityIds:(NSArray<NSString*> *)indoorEntityIds color:(UIColor *)color
Highlights the provided indoor entities in the given indoor map.
Argument | Description |
---|---|
indoorMapId | The ID of the indoor map which contains the entity ID(s). |
indoorEntityIds | The ID(s) of the entities. |
color | The color of this highlight. |
– clearIndoorEntityHighlights:indoorEntityIds:
- (void)clearIndoorEntityHighlights:(NSString *)indoorMapId indoorEntityIds:(NSArray<NSString*> *)indoorEntityIds
Clears the highlights from entities in the given indoor map.
Argument | Description |
---|---|
indoorMapId | The ID of the indoor map which contains the entity ID(s). |
indoorEntityIds | The ID(s) of the entities. |
– clearAllIndoorEntityHighlights
- (void)clearAllIndoorEntityHighlights
Clears highlights from all indoor entities.
Indoor map entity information
– addIndoorMapEntityInformation:
- (void)addIndoorMapEntityInformation:(WRLDIndoorMapEntityInformation *)indoorMapEntityInformation
Add an indoor map entity information request.
Argument | Description |
---|---|
indoorMapEntityInformation | The WRLDIndoorMapEntityInformation object to add to the map. |
– removeIndoorMapEntityInformation:
- (void)removeIndoorMapEntityInformation:(WRLDIndoorMapEntityInformation *)indoorMapEntityInformation
Remove a WRLDIndoorMapEntityInformation from the map and destroy it.
Argument | Description |
---|---|
indoorMapEntityInformation | The WRLDIndoorMapEntityInformation object to remove from the map. |
– setMapCollapsed:
- (void)setMapCollapsed:(BOOL)isMapCollapsed
Sets whether the map view should display with vertical scaling applied so that terrain and other map features appear flattened.
Argument | Description |
---|---|
isMapCollapsed | If YES, map appears flattened; If NO, map displays with default vertical scaling. |
– createPoiService
- (WRLDPoiService *)createPoiService
The POI service.
– createMapsceneService
- (WRLDMapsceneService *)createMapsceneService
The Mapscene service.
– createRoutingService
- (WRLDRoutingService *)createRoutingService
The Routing service.
– createPointOnPath
- (WRLDPointOnPath *)createPointOnPath
The PointOnPath.
IBAdditions Methods
@property startLatitude
@property (nonatomic) IBInspectable double startLatitude
The latitude in degrees of the location that the map is initially centered on - for use inside Interface Builder only.
@property startLongitude
@property (nonatomic) IBInspectable double startLongitude
The longitude in degrees of the location that the map is initially centered on - for use inside Interface Builder only.
@property startZoomLevel
@property (nonatomic) IBInspectable double startZoomLevel
The zoom level that the map will initially be displayed with - for use inside Interface Builder only.
@property startDirection
@property (nonatomic) IBInspectable double startDirection
The heading in degrees clockwise from north of the initial map view - for use inside Interface Builder only.