Skip to content

Migration from v7 to v8

Venue and Facility types

Venue and facility terms have been renamed to Site and Building across the entire SDK. This includes, class names, interfaces, variables and methods.

Examples of classes and Interfaces

SDK v7 SDK v8
PTRVenue PTRSite
PTRFacility PTRBuilding
PTRVenueFacilityManager PTRSiteManager
PTRVenueFacilityManagerDelegate PTRSiteManagerDelegate
SDK v7 SDK v8
Venue Site
Facility Building
VenueFacilityManager SiteManager
VenueFacilityManager.Listener SiteManager.Listener

Examples of properties (across several classes)

SDK v7 SDK v8
venue site
venues sites
facility building
facilities buildings

Examples of Methods

SDK v7 SDK v8
onVenueFacilityManagerDataChanged onSiteManagerDataChanged
venueExternalIdentifier siteExternalIdentifier

Location

The local coordinate system has been removed, which means the properties x and y are no longer available. The only available coordinates are now the geo coordinates, latitude and longitude. They can be accessed through the coordinate property on iOS or directly on Android.

Other classes no longer descend from Location, like Poi. Instead, these classes now have a property named location. Example:

SDK v7 SDK v8
poi.lat poi.location.lat
SDK v7 SDK v8
poi.coordinate poi.location.coordinate

Methods that used to have arguments of type Location, have changed to LocationAware type. LocationAware is now the super class of classes like Poi. This means that passing a Poi object in these cases will still be valid, as well as passing Location objects.

Custom Annotations

On v8, the data specific to each annotation, like location and title, is set on PTRMapViewMarker(Android)/PTRMapViewAnnotation(iOS) class, and the data related to appearance is defined on a new class named PTRMapViewAnnotationLayer. Annotations with the same appearance should be added to the same layer.

Example for v7:

val annotation = PTRMapViewMarker("identifier", latitude = latitude, longitude = longitude,R.color.black,"annotation",ContextCompat.getDrawable(mapActivity,R.drawable.mark),true)

widget.addAnnotation(marker,selectedLevel)
let annotation = PTRMapViewAnnotation(coordinate: coordinate, text: Annotation Title, textColor: .red, icon: UIImage(named: icon), shouldAllowOverlap: true)

mapWidget.mapViewController.addAnnotation(annotation, forLevel: level)

Example for v8:

If you are attempting to use a custom appearance using a Layer:

val annotation = PTRMapViewMarker("marker id",
                                    latitude = latitude,
                                    longitude = longitude,
                                    color = R.color.black,
                                    icon = ContextCompat.getDrawable(mapActivity,R.drawable.mark),
                                    shouldAllowOverlap = true)

val annotationLayer = PTRMapViewAnnotationLayer("layer-id",R.color.black,"layer",ContextCompat.getDrawable(mapActivity,R.drawable.mark))

mapActivity.widget.addAnnotation(annotation,level,annotationLayer)
let mapLevel = PTRMapViewLevel(levelIndex: 0, buildingId: 1, siteId: 1)
let annotation = PTRMapViewAnnotation(identifier: id, coordinate: coordinate, mapLevel: mapLevel, text: Annotation Title)
let layer = PTRMapViewAnnotationLayer(identifier: layer_id, icon: UIImage(named: icon, textColor: .red, shouldAllowOverlap: true)

mapWidget.mapViewController.addAnnotation(annotation, toLayer: layer)

Note

Because each annotation now contains level information, you no longer need to manage the visibility of the annotations on each level. The SDK manages the visibility of the annotations based on the current displayed level.

In case you want to add annotations to the map and use the SDK’s default appearance, without a Layer, you should call:

val annotation = PTRMapViewMarker("marker id",
                                    latitude = latitude,
                                    longitude = longitude,
                                    color = R.color.black,
                                    icon = ContextCompat.getDrawable(mapActivity,R.drawable.mark),
                                    shouldAllowOverlap = true)

mapActivity.widget.addAnnotation(annotation,level)
let mapLevel = PTRMapViewLevel(levelIndex: 0, buildingId: 1, siteId: 1)
let annotation = PTRMapViewAnnotation(identifier: id, coordinate: coordinate, mapLevel: mapLevel, text: Annotation Title)

mapWidget.mapViewController.addAnnotation(annotation)

Scroll and Zoom methods

On v7, the methods provided on PTRMapViewController to scroll and zoom to a location, required the type LatLon(Android)/PTRMapViewLocatable(iOS).

widget.mapFragment.scrollToLocation(LatLon(latitude,longitude))
mapWidget.mapViewController.scrollToLocation(poi)

On v8, these APIs are more flexible and take the type GeoPoint(Android)/CLLocationCoordinate2D(iOS).

widget?.mapFragment?.scrollToLocation(LatLon(selectedPoi.latitude, selectedPoi.longitude))
mapWidget.mapViewController.scrollToCoordinate(poi.location.coordinate)

Building configuration

FacilityConfiguration class has been removed on v8. All data related to the building’s geometry like geo coordinates of the corners, center, etc, can be accessed directly on Building objects.

Example to get north latitude:

val northLatitude = building.boundingBox.northLatitude
CLLocationDegrees northLatitude = building.boundingBox.northEastCoordinate.latitude

Example to get center coordinates:

val centerCoordinate = building.geometry.enclosingCircle.center
CLLocationCoordinate2D centerCoordinate = building.geometry.enclosingCircle.center.coordinate

iOS only changes

Joystick

On v7 the joystick enabled flag is declared on PTRMapViewController.

Swift Code:

mapWidget.mapViewController.isJoystickEnabled = true

On v8, the joystick enabled flag is declared on the PTRMapWidgetConfiguration.

Swift Code:

let configuration = PTRMapWidgetConfiguration()
configuration.isJoystickEnabled = true


Last update: May 30, 2024
Back to top