PWMapView Class Reference

Inherits from MKMapView
Declared in PWMapView.h

Overview

A PWMapView object provides an embeddable map interface. It is similar to the one provided by the maps application but is specifically tailored to indoor maps. PWMapView subclasses MKMapView to provide a convenient interface that downloads, stores and displays indoor maps and associated points of interest (POIs). Usage of this class is optional but recommended for basic indoor map implementations.

  delegate

The delegate for the map. The PWMapViewDelegate inherits from MKMapViewDelegate.

@property (nonatomic, weak) id<PWMapViewDelegate> delegate

Declared In

PWMapView.h

  locationSharingDelegate

The location sharing delegate.

@property (nonatomic, weak) id<PWLocationSharingDelegate> locationSharingDelegate

Declared In

PWMapView.h

  campus

The PWCampus object associated with the current map. If no campus is associated with the PWMapView, the campus will be nil.

@property (nonatomic) PWCampus *campus

Declared In

PWMapView.h

  building

The PWBuilding object associated with the current map. If no building is associated with the PWMapView, the building will be nil.

@property (nonatomic) PWBuilding *building

Declared In

PWMapView.h

  currentFloor

Returns the currently displayed PWFloor object. This property may be nil if no floor is displayed. Attempts to change to the same floor are ignored. When the floor change is complete, the delegate will receive a mapView:didChangeFloor: callback.

@property (nonatomic) PWFloor *currentFloor

Declared In

PWMapView.h

  currentBuilding

Returns the currently displayed PWBuilding object. This property may be nil if no floor is displayed. Attempts to change to the same floor are ignored. When the floor change is complete, the delegate will receive a mapView:didChangeFloor: callback.

@property (nonatomic) PWBuilding *currentBuilding

Declared In

PWMapView.h

  currentRoute

The current PWRoute object plotted on the map. This property will be nil if no route is displayed.

@property (nonatomic, readonly) PWRoute *currentRoute

Declared In

PWMapView.h

  floors

@property (nonatomic, readonly, getter=getFloors) NSArray<PWFloor*> *floors

  indoorUserLocationVisible

A Boolean value indicating whether the device’s current indoor location is visible in the map view. (read-only)

@property (nonatomic, readonly, getter=isIndoorUserLocationVisible) BOOL indoorUserLocationVisible

Discussion

This property tells you whether the icon used to represent the user’s current indoor location is visible in the map view. When determining whether the current indoor location is visible, this property factors in the horizontal accuracy of the location data.

Specifically, if the rectangle represented by the user’s current location plus or minus the horizontal accuracy of that location intersects the map’s visible rectangle, this property contains the value YES.

If that location rectangle does not intersect the map’s visible rectangle, this property contains the value NO.

If the user’s indoor location cannot be determined, this property contains the value NO.

Declared In

PWMapView.h

  showsIndoorUserLocation

A Boolean value indicating whether the map should try to display the user’s indoor location. In order to display the user’s indoor location, a PWLocationManager object must be registered with the map view.

@property (nonatomic) BOOL showsIndoorUserLocation

Discussion

This property only indicates whether the map view should try to display the user’s indoor position, not whether the user’s indoor position is actually visible on the map. Setting this property to ‘YES’ causes the map view to use the specified PWLocationManager object to find the current indoor location and to try displaying it on the map. As long as this property is ‘YES’, the map view will continue to track the user’s indoor location and update it periodically. The default value of this property is ‘NO’.

Showing the user’s indoor location does not guarantee that the location is visible on the map. The user might have scrolled the map to a different point, causing the current location to be offscreen. To determine whether the user’s location is currently displayed on the map, use the indoorUserLocationVisible property.

When setting this property to NO, PWTrackingMode will be set to PWTrackingModeNone.

Declared In

PWMapView.h

  floorTransitionModeEnabled

A Boolean value indicating whether the map should hide blue dot when atmospheric pressure changes indicate a floor transition. Not recommended for most setups and disabled by default.

@property (nonatomic) BOOL floorTransitionModeEnabled

Declared In

PWMapView.h

  indoorUserLocation

The object representing the user’s current indoor location. (read-only)

@property (nonatomic, readonly) PWUserLocation *indoorUserLocation

Discussion

If blue dot smoothing is active, this property will report an interpolated position and will thus be very volatile.

Declared In

PWMapView.h

  trackingMode

The mode used to track the user’s indoor location.

@property (nonatomic) PWTrackingMode trackingMode

Discussion

Possible values are described in PWTrackingMode. It’s important to note that this property replaces the userTrackingMode property of type MKUserTrackingMode on MKMapView. Setting this value will have no effect if an indoor location manager has not been registered with the map view.

Declared In

PWMapView.h

  blueDotSmoothingEnabled

Determines whether or not blue dot smoothing is used to provide a better visual experience when displaying the user’s location.

@property (nonatomic) BOOL blueDotSmoothingEnabled

Discussion

When based on information supplied by location providers, normal blue dot behavior is “jumpy” because location updates are received several times per second (at most). This feature “conditions” the user’s reported location by first using a rolling average of the reported locations, then interpolating between average locations. This feature is turned on by default.

Declared In

PWMapView.h

  routeSnappingTolerance

Determines the route snapping behavior of the user’s displayed location.

@property (nonatomic) PWRouteSnapTolerance routeSnappingTolerance

Discussion

This value is only used while in routing mode and is used to configure the route snapping feature. The possible values of this property are as follows:

  • PWRouteSnappingOff: no route snapping will be performed at all
  • PWRouteSnapToleranceNormal: the user’s location will be “snapped” to the nearest point on the route if the route is within the horizontal accuracy of the location being used (this is the default value)
  • PWRouteSnapToleranceMedium: the user’s location will be “snapped” to the nearest point on the route if the route is within 1.5 times the horizontal accuracy of the location being used
  • PWRouteSnapToleranceHigh: the user’s location will be “snapped” to the nearest point on the route if the route is within twice (2.0 times) the horizontal accuracy of the location being used

Declared In

PWMapView.h

  pointOfInterestCustomizingEnabled

Determines whether or not the point-of-interest(PWPointOfInterest, PWCustomPointOfInterest) is able to be customized.

@property (nonatomic) BOOL pointOfInterestCustomizingEnabled

Discussion

The SDK shows all the internal annotations without asking for their annotation views by calling - mapView: viewForAnnotation:, those internal annotation types includes: PWPointOfInterest, PWCustomPointOfInterest.

If pointOfInterestCustomizingEnabled is set to YES, you are responsible to provide annotation views for the point-of-interests by implementing - mapView: viewForAnnotation:, but it will keep using the one provided by SDK if you don’t or provide an invalid one. This feature is turned off by default.

Declared In

PWMapView.h

  userTrackingBarButtonItem

A property to access the map view user tracking bar button.

@property (nonatomic) UIBarButtonItem *userTrackingBarButtonItem

Declared In

PWMapView.h

  sharedLocationDisplayName

The display name when sharing location

@property (nonatomic, strong) NSString *sharedLocationDisplayName

Declared In

PWMapView.h

  sharedLocationUserType

The user type when sharing location

@property (nonatomic, strong) NSString *sharedLocationUserType

Declared In

PWMapView.h

  trackingModeSwitchInterval

The time interval the user stays in PWTrackingModeNone mode before the map view will automatically change back to the tracking mode set by user.

@property (nonatomic) NSInteger trackingModeSwitchInterval

Discussion

Set to -1 if you don’t want enable this feature, and 10 seconds is used by default.

Declared In

PWMapView.h

  __deprecated

Determines whether or not the waypoints are displaying as dots on route lines. This feature is turned off by default.

@property (nonatomic) BOOL displayWaypointDotsOnRouteLine __deprecated

Discussion

Use PWRouteUIOptions.showJoinPoint' instead when displaying a route withnavigateWithRoute: options:`.

Declared In

PWMapView.h

  displayDebugLocationDots

For internal use only.

@property (nonatomic) BOOL displayDebugLocationDots

Declared In

PWMapView.h

  managedCompassEnabled

Managed compass is an optional capability of PWLocation that improves the user experience while viewing the map by improving the alignment of the compass heading. The managed compass takes operating system readings and processes them prior to returning it to PWMapKit – so there is no further coding required for developers once using this mode. Set to true to enable this feature (disabled by default). Note - results may vary by location, so please evaluate the performance for a given location prior to enabling this feature.

@property (nonatomic) BOOL managedCompassEnabled

Declared In

PWMapView.h

– initWithFrame:

Initializes and returns a newly allocated map view object with the specified frame rectangle.

- (instancetype)initWithFrame:(CGRect)frame

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

Return Value

A new PWMapView object.

Discussion

After initialization you can set building property or call setBuilding: animated: onCompletion: to display the building on the map. If you choose to load with setBuilding: animated: onCompletion: you will get result from the completion block once it’s done. In both cases, the delegate will receive a mapView:didFinishLoadingBuilding:error: callback.

Declared In

PWMapView.h

– setBuilding:animated:onCompletion:

Allows you to change the building displayed in the map view to the specified building identifier.

- (void)setBuilding:(PWBuilding *)building animated:(BOOL)animated onCompletion:(void ( ^ ) ( NSError *error ))completion

Parameters

building

The building to load into the PWMapView.

animated

Animate the camera zoom into the PWMapView.

completion

A block to indicate if the building is successfully displayed or not.

Discussion

Proper use of this method will kick off by fetching the building data, points of interest and assets and display the building indoor map. This data will then be cached and displayed in the PWMapView.

Declared In

PWMapView.h

– setCampus:animated:onCompletion:

Allows you to change the campus displayed in the map view to the specified campus identifier

- (void)setCampus:(PWCampus *)campus animated:(BOOL)animated onCompletion:(void ( ^ ) ( NSError *error ))completion

Parameters

campus

The campus to load into the ‘PWMapView’

animated

Animate the camera zoom into the PWMapView.

completion

A block to indicate if the building is successfully displayed or not.

Declared In

PWMapView.h

– setTrackingMode:animated:

Sets the mode used to track the user’s indoor location with optional animation. This method will have no effect if an indoor location manager has not been registered with the map view.

- (void)setTrackingMode:(PWTrackingMode)trackingMode animated:(BOOL)animated

Parameters

trackingMode

The mode used to track the user’s location. Possible values are described in PWTrackingMode.

animated

If YES, the new mode is animated; otherwise, it is not. This parameter affects only tracking mode changes. Changes to the user’s indoor location or heading are always animated.

Discussion

Setting the tracking mode to PWTrackingModeFollow or PWTrackingModeFollowWithHeading causes the map view to center the map on that location. If the map is zoomed out, the map view automatically zooms in on the user’s indoor location, effectively changing the current visible region.

Declared In

PWMapView.h

– registerLocationManager:

Register an indoor location manager provider with the map view. This location provider is started immediately and used when modifying the indoorUserTrackingMode.

- (void)registerLocationManager:(id<PWLocationManager>)locationManager

Parameters

locationManager

The location manager to register with the map view. The location manager must conform to the PWLocationManager protocol.

Declared In

PWMapView.h

– unregisterLocationManager

Unregister any indoor location manager that is registered with the map view.

- (void)unregisterLocationManager

Discussion

If the user’s location is being displayed, it will not be hidden.

Declared In

PWMapView.h

– navigateWithRoute:

Load a PWRoute object into the map view. This method will plot a basic route line on the map view. The route object must not be nil.

- (void)navigateWithRoute:(PWRoute *)route

Parameters

route

The PWRoute object to display in the map view.

Declared In

PWMapView.h

– navigateWithRoute:options:

Load a PWRoute object into the map view with specified color for the paths. This method will plot a basic route line on the map view. The route object must not be nil.

- (void)navigateWithRoute:(PWRoute *)route options:(PWRouteUIOptions *)options

Parameters

route

The PWRoute object to display in the map view.

options

The PWRouteUIOptions object to custom the color of route path, the junction type of line, etc.

Declared In

PWMapView.h

– setRouteManeuver:

Highlight the specified PWRouteInstruction on the map. If needed, this will change the current floor to the floor of the instruction.

- (void)setRouteManeuver:(PWRouteInstruction *)instruction

Parameters

instruction

The PWRouteInstruction to display.

Discussion

This method will not reposition the map to display the instruction

Declared In

PWMapView.h

– setRouteManeuver:animated:

Display the specified PWRouteInstruction on the map and animates to its position. If needed, this will change the current floor to the required floor for the instruction.

- (void)setRouteManeuver:(PWRouteInstruction *)instruction animated:(BOOL)animated

Parameters

instruction

The PWRouteInstruction to display.

animated

Specify YES if you want the map view to animate the transition to the new instruction.

Declared In

PWMapView.h

– currentRouteInstruction

Returns the current PWRouteInstruction being highlighted. If no route is displayed, this method will return nil.

- (PWRouteInstruction *)currentRouteInstruction

Return Value

The current PWRouteInstruction. Can be nil if no PWRoute is loaded or if turn-by-turn routing is not being used.

Declared In

PWMapView.h

– cancelRouting

Cancel the route displayed in the map view. This method will remove the route from the map view and set the PWRoute property to nil.

- (void)cancelRouting

Declared In

PWMapView.h

– startSharingUserLocation

Starts sharing the user’s current location

- (void)startSharingUserLocation

Declared In

PWMapView.h

– startRetrievingSharedLocations

Starts retrieving other user’s shared locations

- (void)startRetrievingSharedLocations

Declared In

PWMapView.h

– stopSharingUserLocation

Stops sharing the user’s current location

- (void)stopSharingUserLocation

Declared In

PWMapView.h

– stopRetrievingSharedLocations

Stops retrieving other user’s shared locations

- (void)stopRetrievingSharedLocations

Declared In

PWMapView.h

– setCenterCoordinate:zoomLevel:animated:

Positions the map to the supplied center coordinate with the given zoom level and optional animation. (Deprecated: Use setCamera:animated:, setRegion:animated:, setVisibleMapRect:animated: or setVisibleMapRect:edgePadding:animated: instead, since v3.2.0)

- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(NSUInteger)zoomLevel animated:(BOOL)animated

Parameters

centerCoordinate

A CLLocationCoordinate2D object representing the latitude and longitude the map should zoom to.

zoomLevel

An NSUInteger value representing the zoom level the map should zoom to.

animated

A BOOL property to determine whether the change of map’s center should be animated or not.

Declared In

PWMapView.h

– setFloor:

A convenient method to set current floor, it’s working exactly the same as setCurrentFloor:. (Deprecated: Use currentFloor instead, since v3.2.0)

- (void)setFloor:(PWFloor *)floor

Parameters

floor

A PWFloor object you want to set.

Declared In

PWMapView.h

– startUpdatingHeading

Starts heading updates. (Deprecated: Create your own CLLocationManager for heading service, since v3.2.0)

- (void)startUpdatingHeading

Declared In

PWMapView.h

– stopUpdatingHeading

Stops heading updates. (Deprecated: Create your own CLLocationManager for heading service, since v3.2.0)

- (void)stopUpdatingHeading

Declared In

PWMapView.h

– navigateToCustomLocation:

Repositions the map’s view to a custom location. (Deprecated: Use setCamera:animated: or setCenter:animated: instead, since v3.2.0)

- (void)navigateToCustomLocation:(PWCustomLocation *)location

Parameters

location

A custom location reference where the map should navigate to.

Declared In

PWMapView.h

– navigateToPointOfInterest:

Repositions the map’s view to an specific point-of-interest. (Deprecated: Use setCamera:animated: or setCenter:animated: instead, since v3.2.0)

- (void)navigateToPointOfInterest:(PWPointOfInterest *)poi

Parameters

poi

A point-of-interest reference where the map should navigate to.

Declared In

PWMapView.h

– viewForPointOfInterest:

Returns the annotation view of a PointOfInterest. (Deprecated: Use viewForAnnotation: or setCenter:animated: instead, since v3.2.0)

- (PWBuildingAnnotationView *)viewForPointOfInterest:(PWPointOfInterest *)poi

Parameters

poi

The point-of-interest. This parameter must not be nil.

Declared In

PWMapView.h

– showPointsOfInterest:

Displays the array of Points of Interest, causing the map view to zoom in/out to contain all of the points of interest. (Deprecated: Use showAnnotations:animated: instead, since v3.2.0)

- (void)showPointsOfInterest:(NSArray *)pois

Parameters

pois

An array of PWPointOfInterest objects that should be displayed on the map.

Declared In

PWMapView.h

– selectPointOfInterest:animated:

Selects a PointOfInterest on the map. (Deprecated: Use selectAnnotations:animated: instead, since v3.2.0)

- (void)selectPointOfInterest:(PWPointOfInterest *)poi animated:(BOOL)animated

Parameters

poi

A PointOfInterest to select on the map.

animated

A BOOL property to determine whether the change of map’s region should be animated or not.

Declared In

PWMapView.h

– deselectPointOfInterest:animated:

Deselects a PointOfInterest on the map. If the POI is not selected, this method does nothing (Deprecated: Use deselectAnnotations:animated: instead, since v3.2.0)

- (void)deselectPointOfInterest:(PWPointOfInterest *)poi animated:(BOOL)animated

Parameters

poi

A PointOfInterest to deselect on the map.

animated

A BOOL property to determine whether the change of map’s region should be animated or not.

Declared In

PWMapView.h

– getFloorById:

- (PWFloor *)getFloorById:(NSInteger)floorID