UIMgr (React Native)
Contents
Note: All React Native methods are async functions.
MapDrawer
Native Module
Methods
Method Name | Return Type | Description |
---|---|---|
getMapView() | MapViewType | CPIK libraries allows the end user to view the map in a number of different views. This API will return the view that is current in use. The different options include viewing the navigation dialogue in either 2D or 3D as well as Safety or itinerary view. To set the desired view within CoPilot MapDrawer.setMapView should be used. |
setMapView() |
Void | Sets the current CoPilot navigation view to the given MapViewType |
getZoomLevel | MapZoomLevel | Returns the current map zoom level present within CoPilot. |
setMapZoomLevel | MapZoomLevelChangeResult | Adjusts the map to a defined zoom level. |
setMapFrame() |
Void | Redraws the guidance map so that the specified points are included in the frame. |
MapDrawer.setMapZoomLevel
If this API is used when 3D map is in use an exception will be returned.
Method
Syntax
MapZoomLevelChangeResult setMapZoomLevel(MapZoomLevel level)
Parameters
MapZoomLevel - The zoom level user wants the map to zoom to.
Return Values
Sample Code
const MapZoomLevel = NativeModules.MapZoomLevel;
var res = await MapDrawer.setMapZoomLevel(MapZoomLevel.LEVEL_4);
MapDrawer.getZoomLevel
Returns the current map zoom level present within CoPilot. This will return a value from the MapDrawer.MapZoomLevel native module. Level 1 denotes the highest zoomed out setting and Level 20 the most zoomed in possible.
Note: This method should only be called once the onZoomAnimationCompleted callback has been received.
Method
Syntax
constant getZoomLevel()
Parameters
None
Return Values
MapZoomLevel representing the current zoom level
Sample Code
const MapDrawer = NativeModules.MapDrawer;
var level = await MapDrawer.getZoomLevel();
MapDrawer.setMapFrame
Method
Syntax
void setMapFrame(Coordinate pointA, Coordinate pointB)
Parameters
pointA
- Coordinate object that will be used to frame the map.
pointB
- Coordinate object that will be used to frame the map.
Sample Code
var pointA = {};
var pointB = {};
pointA.latitude = 33.406163;
pointA.longitude = -104.466292;
pointB.latitude = 33.412026;
pointB.longitude = -104.206460;
MapDrawer.setMapFrame(pointA, pointB);
MapDrawer.getMapView
CPIK libraries allows the end user to view the map in a number of different views. This API will return the view that is current in use. The different options include viewing the navigation dialog in either 2D or 3D as well as Safety or Itinerary view.
To set the desired view within CoPilot, MapDrawer.setMapView should be used.
Method
Syntax
constant getMapView()
Parameters
None
Return Value
MapViewType value indicating the map view type that is currently visible.
Sample Code
const MapDrawer = NativeModules.MapDrawer;
var viewType = await MapDrawer.getMapView();
MapDrawer.setMapView
CPIK also allows for the navigation to be shown as a map only view, without any of the standard CoPilot menu widgets present. This allows a custom overlay to be drawn over CPIK libraries. These views are referred to as 2D No Widget and 3D No Widget and noted as Two_Dimensional_No_Widgets and Three_Dimensional_No_Widgets. Further examples of these views can be found within the CPIK libraries sample application.
Method
Syntax
void setMapView(constant)
Parameters
MapViewType
indicating the map view to set.
Return Value
None
Sample Code
const MapDrawer = NativeModules.MapDrawer;
const MapViewType = NativeModules.MapViewType;
MapDrawer.setMapView(MapViewType.SAFETY);
Legal: Before using the view 2D with no widgets or 2D with no widgets please be aware this can have implications to the End User License Agreement that is referenced in your contract.
UIMgr
Native Module
Methods
Method Name | Return Type | Description |
---|---|---|
showDialog(Dialog) |
Void | Shows any of the dialogs given by Dialog. |
Hooks and Callbacks
Hooks and Callbacks related to the UI can be found below. For further details on these Hooks or Callbacks please refer to the Hooks and Callbacks section of this document.
UIListener |
---|
onShowNavigationScreen |
onLeaveNavigationScreen |
onStartingPoiWizard |
onMapImageTouchEvent |
onMapImageImportStatusUpdate |
UIMgr.showDialog
Method
Syntax
void showDialog(dialog)
Parameters
dialog
- The dialog to display
Sample Code
const UIMgr = NativeModules.UIMgr;
const Dialog = NativeModules.Dialog;
UIMgr.showDialog(Dialog.MAIN_MENU);