Skip to main content

UIMgr (CPIK Libraries)

Contents

MapDrawer

Overview
Description A class containing methods that allow drawing on the map. To acquire a singleton reference to an instance of MapDrawer, see UIMgr.getMapDrawer().
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Class
Package com.alk.cpik.ui

Methods

Method Name Return Type Description
drawImages()
Void
Draws images on the map according to criteria specified in a MapImageSet object. No resizing or processing will be done on the image when drawn.
removeAllImages()
Void
Remove all the image sets that were previously drawn using drawImages()
removeImageSet()
Void
Remove an image set that was previously drawn using drawImages() that matches the parameters specified in the provided MapImageSet object.
setMapOrientation()
Void
Set the orientation of the 2D map view. 3D map views are always heading up.
getMapOrientation()
MapOrientation
Get the orientation of the map
viewOnMap()
Void
Reframes the currently visible map so that the stop is visible in the center of the map with the equivalent of 0.15 miles of buffer space. If applicable, in a 2D view the map zoom will be adjusted accordingly. There are no UI transitions associated with this action
setMapFrame()
Void
Redraws the guidance map so that the specified points are included in the frame.
lockToChevron()
boolean
This API will lock the guidance map to the chevron position if it exists. The map will continue to follow the chevron as the gps location changes.
mapZoom()
Void
Zooms the current map in or out, based on the supplied ZoomAction. Note that this API will only function when CoPilot is showing
getMapView()
MapViewType
CPIK 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
drawDashedLine()
Void
Draws a dashed green line on the map from the current position of the chevron to the first point given in the list. Then from the first point in the list to the second, then form the second to the third, and so on.
clearDashedLine()
Void
Clears all dashed lines from being drawn which were set using MapDrawer.DrawDashedLine(List)

MapDrawer.drawImages

Overview
Description Draws images on the map according to criteria specified in a MapImageSet object. No resizing or processing will be done on the image when drawn.

To change the image of an existing MapImageSet the old image must be deleted from the skin/users folder. If the sample code below was used the image would be saved as testImageLatLon1.png. This condition does not apply if you wish to draw a new image.

Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Note: The category name for the image that you wish to draw should only contain lower case letters. Upper case letters are not supported in this field for CoPilot version 10.4.0 and below.

Syntax

void drawImages(MapImageSet mapImageSet) throws MapDrawingException,
FileNotFoundException, IOException

Parameters

MapImageSet object containing the parameters of the image to be drawn.

Return Value

void

Sample Code

try {
  // Draw the map image set
  MapImageInfoList listOfPointsA = new MapImageInfoList();
  Bitmap categoryImage = BitmapFactory.decodeResource(getResources(), R.drawable.main_activity_alk_logo);
  MapImageSet imageSetA = new MapImageSet("testImageLatLon1", categoryImage, listOfPointsA);
  UIMgr.getMapDrawer().drawImages(imageSetA);
} catch (MapDrawingException \| IOException e) {
  e.printStackTrace();
}

MapDrawer.removeAllImages

Overview
Description Removes all the image sets that were previously drawn using drawImages().
Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void removeAllImages() throws MapDrawingException

Sample Code

try {
  // Remove all images from the map
  UIMgr.getMapDrawer().removeAllImages();
} catch (MapDrawingException e) {
  e.printStackTrace();
}

Related APIs

MapDrawer.drawImages()
MapDrawer.removeAllImages()
MapDrawer.removeImageSet()


MapDrawer.removeImageSet

Overview
Description Removes an image set that was previously drawn using drawImages() that matches the parameters specified in the provided MapImageSet object.
Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void removeImageSet(MapImageSet mapImageSetToRemove) throws MapDrawingException

Parameters

mapImageSetToRemove - object that contains the details of the map image set to remove.

Sample Code

try {
  // Remove one image set from the map
  MapImageInfoList listOfPointsA = new MapImageInfoList();
  Bitmap categoryImage = BitmapFactory.decodeResource(getResources(), R.drawable.main_activity_alk_logo);
  MapImageSet imageSetA = new MapImageSet("testImageLatLon1", categoryImage, listOfPointsA);
  UIMgr.getMapDrawer().removeImageSet(imageSetA);
}catch(MapDrawingException e){
  e.printStackTrace();
}

MapDrawer.setMapOrientation

Overview
Description Sets the orientation of the 2D map view. 3D map views are always heading up.
Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void setMapOrientation(MapOrientation mapOrientation)
(void)setMapOrientation:(enum CPMapOrientation)

Parameters

MapOrientation or enum value indicating the desired orientation.

Sample Code

// Set the map orientation to north up
UIMgr.getMapDrawer().setMapOrientation(MapDrawer.MapOrientation.NORTH_UP);
// Set the map orientation to heading up
UIMgr.getMapDrawer().setMapOrientation(MapDrawer.MapOrientation.HEADING_UP);
[[UIMgr getMapDrawer] setMapOrientation:NORTH_UP];
[[UIMgr getMapDrawer] setMapOrientation:HEADING_UP];

Related APIs

MapDrawer.getMapOrientation
MapDrawer.ViewOnMap
MapDrawer.setMapFrame
MapDrawer.lockToChevron
MapDrawer.MapZoom
MapDrawer.getMapView
MapDrawer.setMapView


MapDrawer.getMapOrientation

Overview
Description Gets the orientation of the map.
Supported on Android Since Version 9.6.0.868
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

MapOrientation getMapOrientation()
(enum CPMapOrientation)getMapOrientation

Return Value

MapOrientation enum value that indicates the current setting for the map orientation.

Sample Code

// Print out the current map orientation
MapDrawer.MapOrientation currentOrientation = UIMgr.getMapDrawer().getMapOrientation();
if (currentOrientation == MapDrawer.MapOrientation.NORTH_UP)
  System.out.println("Current map orientation is north up");
else
  System.out.println("Current map orientation is heading up");
if([[UIMgr getMapDrawer] getMapOrientation] == HEADING_UP)
 NSLog(@"HEADING_UP");
else
 NSLog(@"NORTH_UP");

Related APIs

MapDrawer.setMapOrientation
MapDrawer.ViewOnMap
MapDrawer.setMapFrame
MapDrawer.lockToChevron
MapDrawer.MapZoom
MapDrawer.getMapView
MapDrawer.setMapView


MapDrawer.viewOnMap

Overview
Description Reframes the currently visible map so that the stop is visible in the center of the map with the equivalent of 0.15 miles of buffer space. If applicable, the map zoom will be adjusted accordingly in a 2D view. There are no UI transitions associated with this action.
Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void viewOnMap(Stop stop) throws MapDrawingException
(void)viewOnMap:(Stop*)

Parameters

Stop - The stop that should be viewed on the map.

Sample Code

try {
  // Zoom the map to Trimble Maps offices
  double latitude = 40.368420;
  double longitude = -74.655036;
  StopBuilder stopBuilder = StopBuilder.fromLatLon(new Coordinate(latitude, longitude));
  Stop stopToZoomTo = stopBuilder.setName("ALK Technologies").geocode(GeocodeSearchType.BEST_MATCH).get(0);
  UIMgr.getMapDrawer().viewOnMap(stopToZoomTo);
} catch (MapDrawingException \| GeocodingException e) {
  e.printStackTrace();
}
StopBuilder *stopBuilder = [StopBuilder fromCityAndState:@"Princeton"withState:@"NJ"];
[[UIMgr getMapDrawer] viewOnMap:[stopBuilder geocode] withError:nil];

Related APIs

MapDrawer.setMapOrientation
MapDrawer.getMapOrientation
MapDrawer.setMapFrame
MapDrawer.lockToChevron
MapDrawer.MapZoom
MapDrawer.getMapView
MapDrawer.setMapView


MapDrawer.setMapFrame

Overview
Description Redraws the guidance map so that specified points are included in the frame.
Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void setMapFrame(Coordinate pointA, Coordinate pointB) throws MapDrawingException
(void)viewOnMap:(Stop*)

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

try {
  // Set the map frame around Trimble Maps
  double latitudeA = 40.368420;
  double longitudeA = -74.655036;
  Coordinate coordA = new Coordinate(latitudeA, longitudeA);
  double latitudeB = 40.368500;
  double longitudeB = -74.655456;
  Coordinate coordB = new Coordinate(latitudeB, longitudeB);
  UIMgr.getMapDrawer().setMapFrame(coordA, coordB);
} catch (MapDrawingException e) {
  e.printStackTrace();
}
Coordinate *pointA = [[[Coordinate alloc] initWithLatLon:40.364950
withLon:-74.6525167] autorelease];
 Coordinate *pointB = [[[Coordinate alloc] initWithLatLon:40.3644833
withLon:-74.6512333] autorelease];

 [[UIMgr getMapDrawer] setMapFrame:pointA secondCorner:pointB
error:nil];

Related APIs

MapDrawer.setMapOrientation
MapDrawer.getMapOrientation
MapDrawer.ViewOnMap
MapDrawer.lockToChevron
MapDrawer.MapZoom
MapDrawer.getMapView
MapDrawer.setMapView


MapDrawer.lockToChevron

Overview
Description By default, when navigating with CoPilot the map screen will be locked to the chevron. If the user pans the map screen the lock to the chevron will be broken, this API will reestablish this lock if the chevron exists. The map will then continue to follow the chevron as the gps location changes.

Note: The chevron is the arrow or dot displayed on the map to indicate the current position.

Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

boolean lockToChevron()
[[UIMgr getMapDrawer] lockToChevron];

Return Value

Boolean value indicating if the action was successful.

Sample Code

// Lock the map to the chevron's current position
UIMgr.getMapDrawer().lockToChevron();
(void) lockToChevron

Related APIs

MapDrawer.setMapOrientation
MapDrawer.getMapOrientation
MapDrawer.ViewOnMap
MapDrawer.setMapFrame
MapDrawer.MapZoom
MapDrawer.getMapView
MapDrawer.setMapView


MapDrawer.setMapZoomLevel

Overview
Description This API will adjust the map to a defined zoom level. This function is only available when CoPilot is showing in navigation mode with the map view in one of the 2D modes.
If this API is used when 3D map is in use an exception will be returned.
Supported on Android Since Version 10.9
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik

Syntax

MapZoomLevelChangeResult setMapZoomLevel(MapZoomLevel level)

Parameters MapZoomLevel - indicating the zoom level user wants the map to zoom to

Return Values

MapZoomLevelChangeResult

Sample Code

MapZoomLevelChangeResult res = MapDrawer.setMapZoomLevel(MapDrawer.MapZoomLevel.LEVEL_7);
(enum CPMapZoomLevelChangeResult)setMapZoomLevel:(CPMapZoomLevel level)

MapDrawer.MapZoomLevelChangeResult

Overview
Description A value returned by MapDrawer.setMapZoomLevel, indicating the result of the map zoom to level action.
If setMapZoomLevel is called when 3D view types are presenting then FAILED_INVALID_MAPVIEW_TYPE will be returned.
If NA map data is present on the device, the zoom level is not supported at less than 4. If users try to do so, FAILED_INVALID_LEVEL_FOR_REGION will be returned.
Supported on Android Since Version 10.9
Supported on iOS Since Version 10.9
Type Enum
Package com.alk.cpik

Values

Android Value iOS Value Description
SUCCESS CP_ZOOM_LEVEL_CHANGE_SUCCESS Successful request, zoom level will be updated
FAILED_INVALID_MAPVIEW_TYPE CP_ZOOM_LEVEL_CHANGE_FAILED_INVALID_MAPVIEW_TYPE MapView type is currently set to 3D and this API is not compatible with 3D map view
FAILED_INVALID_LEVEL_FOR_REGION CP_ZOOM_LEVEL_CHANGE_FAILED_INVALID_LEVEL_FOR_REGION Map region limits the maximum level from which CoPilot will provide a map view

MapDrawer.MapZoomLevel

Overview
Description A value that represents zoom level for 2D map views.
Higher levels should be passed into CoPilot to zoom in further to the map. Lower levels will adjust the map view to show a greater area on the map and zoom out to a greater degree. Please note, when NA data is installed within CoPilot you are not able to zoom out higher than level 4.
Supported Since Version 10.9
Platforms Supported Android, Linux
Type Enum
Package com.alk.cpik

Values

Android Value iOS Value
LEVEL_1 CP_ZOOM_LEVEL_1
LEVEL_2 CP_ZOOM_LEVEL_2
LEVEL_3 CP_ZOOM_LEVEL_3
LEVEL_4 CP_ZOOM_LEVEL_4
LEVEL_5 CP_ZOOM_LEVEL_5
LEVEL_6 CP_ZOOM_LEVEL_6
LEVEL_7 CP_ZOOM_LEVEL_7
LEVEL_8 CP_ZOOM_LEVEL_8
LEVEL_9 CP_ZOOM_LEVEL_9
LEVEL_10 CP_ZOOM_LEVEL_10
LEVEL_11 CP_ZOOM_LEVEL_11
LEVEL_12 CP_ZOOM_LEVEL_12
LEVEL_13 CP_ZOOM_LEVEL_13
LEVEL_14 CP_ZOOM_LEVEL_14
LEVEL_15 CP_ZOOM_LEVEL_15
LEVEL_16 CP_ZOOM_LEVEL_16
LEVEL_17 CP_ZOOM_LEVEL_17
LEVEL_18 CP_ZOOM_LEVEL_18
LEVEL_19 CP_ZOOM_LEVEL_19
LEVEL_20 CP_ZOOM_LEVEL_20

MapDrawer.getZoomLevel

Overview
Description Returns the current map zoom level present within CoPilot. This will return a value from the MapDrawer.MapZoomLevel Enum. 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.
Supported on Android Since Version 10.9
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

MapZoomLevel getZoomLevel()
(enum CPMapZoomLevel) getZoomLevel

Return Values MapZoomLevel representing the current zoom level

Sample Code

// Get the current zoom level of the map

MapZoomLevel currentMapZoom = MapDrawer.getZoomLevel();
enum CPMapZoomLevel currentMapZoom = [[UIMgr getMapDrawer] getZoomLevel];

MapDrawer.mapZoom

Overview
Description Zooms the current map in or out, based on the supplied ZoomAction. Note that this API will only function when CoPilot is showing.
Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void mapZoom(ZoomAction zoomAction)
(void)mapZoom:(CPZoomAction)

Parameters

zoomAction – the object indicating the zoom action to be taken.

Sample Code

// Zoom the map in
UIMgr.getMapDrawer().mapZoom(MapDrawer.ZoomAction.ZOOM_IN);

// Zoom the map out
UIMgr.getMapDrawer().mapZoom(MapDrawer.ZoomAction.ZOOM_OUT);
[[UIMgr getMapDrawer] mapZoom:(CP_ZOOM_IN)];
[[UIMgr getMapDrawer] mapZoom:(CP_ZOOM_OUT)];

Related APIs

MapDrawer.setMapOrientation
MapDrawer.getMapOrientation
MapDrawer.ViewOnMap
MapDrawer.setMapFrame
MapDrawer.lockToChevron
MapDrawer.getMapView
MapDrawer.setMapView


MapDrawer.getMapView

Overview
Description CPIK 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.

Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

MapViewType getMapView()
(enum CPMapViewType) getMapView

Return Value

MapViewType enum value indicating the map view type that is currently visible.

Sample Code

// Get and print the current map view
MapDrawer.MapViewType currMapView = UIMgr.getMapDrawer.getMapView();
System.out.println("Current map view is:" + currMapView.toString());
CPMapViewType mapViewType = [[UIMgr getMapDrawer] getMapView];

 switch (mapViewType)
 {
 case CPMapViewType_MapViewType_Safety:
 NSLog(@"CPMapViewType_MapViewType_Safety");
 break;
 case CPMapViewType_MapViewType_3d:
 NSLog(@"CPMapViewType_MapViewType_3d");
 break;
 case CPMapViewType_MapViewType_Itinerary:
 NSLog(@"CPMapViewType_MapViewType_Itinerary");
 break;
 case CPMapViewType_MapViewType_2d_Itinerary:
 NSLog(@"CPMapViewType_MapViewType_2d_Itinerary");
 break;
 case CPMapViewType_MapViewType_2d_Safety:
 NSLog(@"CPMapViewType_MapViewType_2d_Safety");
 break;
 case CPMapViewType_MapViewType_3d_Itinerary:
 NSLog(@"CPMapViewType_MapViewType_3d_Itinerary");
 break;
 case CPMapViewType_MapViewType_3d_Safety:
 NSLog(@"CPMapViewType_MapViewType_3d_Safety");
 break;
 case CPMapViewType_MapViewType_2d:
 NSLog(@"CPMapViewType_MapViewType_2d");
 break;
 case CPMapViewType_MapViewType_2d_No_Widgets:
 NSLog(@"CPMapViewType_MapViewType_2d_No_Widgets");
 break;
 case CPMapViewType_MapViewType_3d_No_Widgets:
 NSLog(@"CPMapViewType_MapViewType_3d_No_Widgets");
 break;
 default:
 NSLog(@"CPMapViewType_Invalid");
 break;
 }

Related APIs

MapDrawer.setMapOrientation()
MapDrawer.getMapOrientation()
MapDrawer.ViewOnMap()
MapDrawer.setMapFrame()
MapDrawer.lockToChevron()
MapDrawer.MapZoom()
MapDrawer.setMapView()


MapDrawer.setMapView

Overview
Description The CoPilot navigation view can be set to a number of different options. By using this method, you can set the navigation view in CoPilot including 2D, 3D or Itinerary. For a full list of the available views, see MapDrawer.MapViewType.

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. 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 sample application.

Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void setMapView(MapViewType mapViewType)
(void) setMapView:(CPMapViewType)

Parameters

MapViewType - enum value indicating the map view to set.

Sample Code

// Set the map view to 2D.
UIMgr.getMapDrawer().setMapView(MapDrawer.MapViewType.TWO_DIMENSIONAL);

// Set the map view to 3D.
UIMgr.getMapDrawer().setMapView(MapDrawer.MapViewType.THREE_DIMENSIONAL);

// Set the map view to itinerary view.
UIMgr.getMapDrawer().setMapView(MapDrawer.MapViewType.ITINERARY);

// Set the map view to 2D with no widgets.
UIMgr.getMapDrawer().setMapView(MapDrawer.MapViewType.TWO_DIMENSIONAL_NO_WIDGETS);

// Set the map view to 3D with no widgets.
UIMgr.getMapDrawer().setMapView(MapDrawer.MapViewType.THREE_DIMENSIONAL_NO_WIDGETS);
[[UIMgr getMapDrawer] setMapView:CPMapViewType_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.


MapDrawer.drawDashedLine

Overview
Description Draws a dashed green line on the map from the current position of the chevron to the first point given in the list. Then from the first point in the list to the second, form the second to the third, and so on.
Supported on Android Since Version 9.6.0.1320
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void drawDashedLine(List<Coordinate> coordList)

Parameters

coordList – The list of coordinates between which to draw the dashed line

Return Value

void

Sample Code

// Draw a dashed line from the chevron to an arbitrary point
{
  double latitude = 40.368420;
  double longitude = -74.655036;
  Coordinate coordA = new Coordinate(latitude, longitude);
  List<Coordinate> coordList = new ArrayList<Coordinate>();
  coordList.add(coordA);
  UIMgr.getMapDrawer().drawDashedLine(coordList);
}
// Draw a dashed line from the chevron to the start of the route
{
  Coordinate coordA = RouteMgr.getSnappedPositionOfStop(0);
  List<Coordinate> coordList = new ArrayList<Coordinate>();
  coordList.add(coordA);
  UIMgr.getMapDrawer().drawDashedLine(coordList);
}
// Draw a dashed line from the chevron to a point to the start of the route
{
  double latitude = 40.368420;
  double longitude = -74.655036;
  Coordinate coordA = new Coordinate(latitude, longitude);
  Coordinate coordB = RouteMgr.getSnappedPositionOfStop(0);
  List<Coordinate> coordList = new ArrayList<Coordinate>();
  coordList.add(coordA);
  coordList.add(coordB);
  UIMgr.getMapDrawer().drawDashedLine(coordList);
}

Related APIs

MapDrawer.ClearDashedLine()


MapDrawer.clearDashedLine

Overview
Description Clears all dashed lines from being drawn that were set using MapDrawer.DrawDashedLine(List).
Supported on Android Since Version 9.6.0.1320
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void clearDashedLine()

Sample Code

// Clear all dashed lines being drawn
UIMgr.getMapDrawer().clearDashedLine();
System.out.println("All dash lines are cleared");

MapViewType

Overview
Description An Enum value that represents the options available for the navigational views within CoPilot.
Supported on Android Since Version 9.6.0.867
Type Enum
Package com.alk.cpik.ui

Values

Value Description
INVALID Invalid view type, usually indicating that CoPilot service is in some invalid state.
SAFETY Safety View
TWO_DIMENSIONAL CoPilot 2D Map View
THREE_DIMENSIONAL CoPilot 3D Map View
ITINERARY CoPilot Itinerary View
TWO_DIMENSIONAL_ITINERARY_SPLIT CoPilot 2D and Itinerary split view. Only valid on tablet layouts. (Please note this Value is not supported in CoPilot V10)
TWO_DIMENSIONAL_SAFETY_SPLIT CoPilot 2D and Safety split view. Only valid on tablet layouts.
THREE_DIMENSIONAL_ITINERARY_SPLIT CoPilot 3D and Itinerary split view. Only valid on tablet layouts. (Please note this Value is not supported in CoPilot V10)
THREE_DIMENSIONAL_SAFETY_SPLIT CoPilot 3D and Safety split view. Only valid on tablet layouts.
TWO_DIMENSIONAL_NO_WIDGETS CoPilot 2D view with no widgets. (Map only, no buttons, menus or labels)
THREE_DIMENSIONAL_NO_WIDGETS CoPilot 3D view with no widgets. (Map only, no buttons, menus or labels)

CPMapViewType

Overview
Description An Enum value that represents the options available for the navigational views within CoPilot.
Supported on iOS Since Version 10.9
Type Enum
Package com.alk.cpik.ui

Values

Value Description
CPMAPVIEWTYPE_Error Invalid view type, usually indicating that CoPilot service is in some invalid state.
CPMAPVIEWTYPE_SAFETY Safety View
CPMAPVIEWTYPE_2d CoPilot 2D Map View
CPMAPVIEWTYPE_3d CoPilot 3D Map View
CPMAPVIEWTYPE_Itinerary CoPilot Itinerary View
CPMAPVIEWTYPE_2d_Itinerary CoPilot 2D and Itinerary split view. Only valid on tablet layouts. (Please note this Value is not supported in CoPilot V10)
CPMAPVIEWTYPE_2d_Safety CoPilot 2D and Safety split view. Only valid on tablet layouts.
CPMAPVIEWTYPE_3d_Itinerary CoPilot 3D and Itinerary split view. Only valid on tablet layouts. (Please note this Value is not supported in CoPilot V10)
CPMAPVIEWTYPE_3d_Safety CoPilot 3D and Safety split view. Only valid on tablet layouts.
CPMAPVIEWTYPE_2d_No_Widgets CoPilot 2D view with no widgets. (Map only, no buttons, menus or labels)
CPMAPVIEWTYPE_3d_No_Widgets CoPilot 3D view with no widgets. (Map only, no buttons, menus or labels)

ZoomAction

Overview
Description An Enum value that represents a zooming action.
Supported on Android Since Version 9.6.0.867
Type Enum
Package com.alk.cpik.ui

Values

Value Description
ZOOM_IN Zoom in
ZOOM_OUT Zoom out

CPZoomAction

Overview
Description An Enum value that represents a zooming action.
Supported on iOS Since Version 10.9
Type Enum
Package com.alk.cpik.ui

Values

Value Description
CP_ZOOM_IN Zoom in
CP_ZOOM_OUT Zoom out

MapOrientation

Overview
Description An Enum value that represents the possible map orientations for CoPilot navigation view when in 2D mode. When in 3D mode, only Heading up is supported
Supported on Android Since Version 9.6.0.867
Type Enum
Package com.alk.cpik.ui

Values

Value Description
HEADING_UP Heading Up orientation.
NORTH_UP North Up orientation.

CPMapOrientation

Overview
Description An Enum value that represents the possible map orientations for CoPilot navigation view when in 2D mode. When in 3D mode, only Heading up is supported
Supported on iOS Since Version 10.9
Type Enum
Package com.alk.cpik.ui

Values

Value Description
HEADING_UP Heading Up orientation.
NORTH_UP North Up orientation.

MapImageInfo

Overview
Description A class that contains information about a specific map image.
Supported on Android Since Version 9.6.0.1271
Type Class
Package com.alk.cpik.ui

Public Constructors

Method Name Description
MapImageInfo(int id, Coordinate coordinate) Construct a MapImageInfo object

Methods

Method Name Return type Description
getID()
int
Returns the ID of the point
getCoordinate()
Coordinate
Returns the Coordinate of the point

MapImageInfoList

Overview
Description A list of MapImageInfo objects.
Supported on Android Since Version 9.6.0.1271
Type Class
Package com.alk.cpik.ui

Public Constructors

Method Name Description
MapImageInfoList() Construct a new MapImageInfoList that will contain an array of MapImageInfo objects.

Methods

None


MapImageImportStatus

Overview
Description Enum that represents the result of a call to MapDrawer.drawImages(MapImageSet).
Supported on Android Since Version 9.6.0.1271
Type Enum
Package com.alk.cpik.ui

Values

Value Description
SUCCESS Indicates that a previous call to MapDrawer.drawImages(MapImageSet) was successful.
FAILURE Indicates that a previous call to MapDrawer.drawImages(MapImageSet) was unsuccessful.

MapImageSet

Overview
Description A class that contains parameters that describe a specific image set.
Supported on Android Since Version 9.6.0.867
Type Class
Package com.alk.cpik.ui

Public Constructors

Method Name Description
MapImageSet (String setName, Bitmap setImage, MapImageInfoList listOfMapImages) throws InvalidParameterException Constructor for a new image set. All parameters are final an can not be changed.

Methods

Method Name Return Type Description
getName()
String
Retrieve the name of the image set that was created in the constructor.
getImage()
Bitmap
Retrieve the Bitmap of the image that was supplied in the constructor.
getMapImageInfoList()
MapImageInfoList
Retrieve the MapImageInfoList used to construct this set.

MapImageSet

Overview
Description Constructor for a MapImageSet object.
Supported on Android Since Version 9.6.0.1271
Type Method
Package com.alk.cpik.ui

Syntax

MapImageSet (String setName, Bitmap setImage, MapImageInfoList listOfMapImages) throws InvalidParameterException

Parameters

setName – String object that represents the name of the set.

setImage – Bitmap object of the image for this set.

listOfMapImages – MapImageInfoList object that contains a list of Coordinate objects where this image set should be drawn.

Sample Code

String categoryName = "testImageSetName";
//Bitmap image required to show on the map
Bitmap categoryImage = BitmapFactory.decodeResource(getResources(),R.drawable.main_activity_alk_logo);

double latitude = 40.368420;
double longitude = -74.655036;
//get the coordinates to add in the MapImageInfoList
Coordinate pointA = new Coordinate(latitude, longitude);
MapImageInfoList listOfPointsA = new MapImageInfoList();

int imageInfoID = 1;
listOfPointsA.add(new MapImageInfo(imageInfoID, pointA));

MapImageSet imageSetA = new MapImageSet(categoryName, categoryImage, listOfPointsA);

try {
  // draw the image
  UIMgr.getMapDrawer().drawImages(imageSetA);
} catch (MapDrawingException | IOException e) {
  e.printStackTrace();
}

MapImageSet.getName

Overview
Description Retrieves the name of the image set that was created in the constructor.
Supported on Android Since Version 9.6.0.867
Type Method
Package com.alk.cpik.ui

Syntax

String getName()

Return Value

String object containing the name of the set.


MapImageSet.getImage

Overview
Description Retrieves the Bitmap of the image that was supplied in the constructor.
Supported on Android Since Version 9.6.0.867
Type Method
Package com.alk.cpik.ui

Syntax

Bitmap getImage()

Parameters

None

Return Value

Bitmap of the image.

Sample Code

String imageSetName = "testImageSetName";
//Bitmap image required to show on the map
Bitmap categoryImage = BitmapFactory.decodeResource(getResources(), R.drawable.main_activity_alk_logo);

double latitude = 40.368420;
double longitude = -74.655036;
//get the coordinates to add in the MapImageInfoList
Coordinate pointA = new Coordinate(latitude, longitude);
MapImageInfoList listOfPointsA = new MapImageInfoList();

int imageInfoID = 1;
listOfPointsA.add(new MapImageInfo(imageInfoID, pointA));

MapImageSet imageSetA = new MapImageSet(imageSetName, categoryImage, listOfPointsA);

try {
  // draw the image
  UIMgr.getMapDrawer().drawImages(imageSetA);
} catch (MapDrawingException \| IOException e) {
  e.printStackTrace();
}

// printing the information
Bitmap Image = imageSetA.getImage();
if (Image != null)
  System.out.println("Bitmap Image is found.");
else
  System.out.println("Bitmap Image is not found.");

Related APIs MapImageSet.GetName()


MapImageSet.getMapImageInfoList

Overview
Description Retrieves the MapImageInfoList used to construct this set.
Supported on Android Since Version 9.6.0.1271
Type Method
Package com.alk.cpik.ui

Syntax

MapImageInfoList getMapImageInfoList()

Return Value

The MapImageInfoList that was given in the constructor.

Sample Code

String imageSetName = "testImageSetName";
//Bitmap image required to show on the map
Bitmap categoryImage = BitmapFactory.decodeResource(getResources(),R.drawable.main_activity_alk_logo);

double latitude = 40.368420;
double longitude = -74.655036;
//get the coordinates to add in the MapImageInfoList
Coordinate pointA = new Coordinate(latitude, longitude);
MapImageInfoList listOfPointsA = new MapImageInfoList();

int imageInfoID = 1;
listOfPointsA.add(new MapImageInfo(imageInfoID, pointA));

MapImageSet imageSetA = new MapImageSet(imageSetName, categoryImage, listOfPointsA);

try {
  // draw the image
  UIMgr.getMapDrawer().drawImages(imageSetA);
} catch (MapDrawingException \| IOException e) {
  e.printStackTrace();
}

MapImageInfoList mapImageInfoList = imageSetA.getMapImageInfoList();
for (MapImageInfo mapInfo : mapImageInfoList)
  System.out.println("MapImageInfo coordinates " + mapInfo.getCoordinate());

Related APIs

MapImageSet.GetName() MapImageSet.getImage()


UIMgr

Overview
Description A class with a static method to open a requested CoPilot dialog (ex: the map).
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Class
Package com.alk.cpik.ui

Methods

Method Name Return Type Description
showDialog(Dialog)
Void
Shows any of the dialogs given by the enum.
setPOIDisplaySetting(POIDisplayType)
Void
Displays points of interest (POIs) on maps.
getPOIDisplaySetting()
POIDisplayType
Returns how CoPilot is displaying POIs, if at all.
setInfoLeftBarSetting(SideBarDisplayType)
Void
Sets the info for left-side bar on the navigation dialog.
getInfoLeftBarSetting()
SideBarDisplayType
Returns the left bar’s current config setting.
setInfoRightBarSetting(SideBarDisplayType)
Void
Sets the info for right-side bar on the navigation dialog.
setCustomNavMessageText(String message)
Void
Sets the message to be displayed in a custom navigation banner.
getInfoRightBarSetting()
SideBarDisplayType
Returns the right bar’s current config setting.
getMapDrawer()
MapDrawer
Gets the single instance of the MapDrawer class.

UIMgr.showDialog

Overview
Description It is possible to call certain dialogs to the forefront of the CPIK application. This API shows any of the dialogs given by the enum Dialog. When this call is made, CoPilot will close any currently open dialogs to the navigation screen, then open the selected dialog. When the back button is used following this request, CoPilot will go to the navigation dialog.
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void showDialog(Dialog dlg) throws CopilotException
+(void) showDialog:(enum CPDialog)

Parameters

dialog - An enum indicating the dialog to display

Sample Code

// Show the map navigation dialog
try {
  UIMgr.showDialog(UIMgr.Dialog.MAP_NAVIGATION_VIEW);
} catch (CopilotException e) {
  e.printStackTrace();
}
[UIMgr showDialog:CPMapNavigationView];

UIMgr.setPOIDisplaySetting

Overview
Description Displays places of interest (POIs) on maps.
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void setPOIDisplaySetting(POIDisplayType value) throws CopilotException
+(void) setPOIDisplaySetting:(enum CPPOIDisplayType)

Parameters

value – The setting to be used for when to display POIs on the map.

Sample Code

// Set POIs to display only when stopped
try {
  UIMgr.setPOIDisplaySetting(UIMgr.POIDisplayType.WHEN_STOPPED);
} catch (CopilotException e) {
  e.printStackTrace();
}
[UIMgr setPOIDisplaySetting:WHEN_STOPPED];

UIMgr.getPOIDisplaySetting

Overview
Description Returns how CoPilot is to display POIs, if at all.
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

POIDisplayType getPOIDisplaySetting()
+(enum CPPOIDisplayType) getPOIDisplaySetting

Return Value

POIDisplayType that is currently being used to display POIs

Sample Code

try {
  // Print the current POI display setting
  UIMgr.POIDisplayType displayType = UIMgr.getPOIDisplaySetting();
  switch (displayType) {
    case NEVER:
    System.out.println("POIs are never displayed.");
    break;
    case WHEN_STOPPED:
    System.out.println("POIs are only displayed when stopped");
    break;
    case ALWAYS:
    System.out.println("POIs are always displayed");
    break;
    default:
    break;
  }
} catch (CopilotException e) {
  e.printStackTrace();
}
enum CPPOIDisplayType type = [UIMgr getPOIDisplaySetting];

UIMgr.setInfoLeftBarSetting

Overview
Description Sets the info displayed in the left-side bar on the navigation dialog.
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void setInfoLeftBarSetting(SideBarDisplay value) throws CopilotException
enum CPPOIDisplayType type = [UIMgr getPOIDisplaySetting];

Parameters

value – What to display in CoPilot’s left side bar

Sample Code

// Set the left info bar to display the current lat/lon
try {
  UIMgr.setInfoLeftBarSetting(UIMgr.SideBarDisplayType.LAT_LON);
} catch (CopilotException e) {
  e.printStackTrace();
}
[UIMgr setInfoLeftBarSetting:LAT_LON];

Related APIs

UIMgr.getInfoLeftBarSetting() UIMgr.setInfoRightBarSetting() UIMgr.getInfoRightBarSetting()


UIMgr.setInfoRightBarSetting

Overview
Description Sets the info displayed in the right-side bar on the navigation dialog.
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

void setInfoRightBarSetting(SideBarDisplayType)
+(void) setInfoRightBarSetting:(enum CPSideBarDisplayType)

Parameters

value – What to display in CoPilot’s left side bar

Sample Code

// Set the right info bar to display the current elevation
try {
  UIMgr.setInfoRightBarSetting(UIMgr.SideBarDisplayType.ELEVATION);
} catch (CopilotException e) {
  e.printStackTrace();
}
[UIMgr setInfoRightBarSetting:ELEVATION];

Related APIs

UIMgr. setInfoLeftBarSetting() UIMgr. getInfoLeftBarSetting() UIMgr. getInfoRightBarSetting()


UIMgr.getInfoLeftBarSetting

Overview
Description Returns the left bar’s current config setting.
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

SideBarDisplayType getInfoLeftBarSetting()
+(enum CPSideBarDisplayType) getInfoLeftBarSetting

Return Value

SideBarDisplayType that is currently being displayed in the left side bar

Sample Code

// Print what is currently being displayed in the left info bar
try {
  UIMgr.SideBarDisplayType currLeft = UIMgr.getInfoLeftBarSetting();
  System.out.println(currLeft.toString() + " is currently being displayed in the left info bar");
} catch (CopilotException e) {
  e.printStackTrace();
}
enum CPSideBarDisplayType type = [UIMgr getInfoLeftBarSetting];

Related APIs

UIMgr.setInfoLeftBarSetting() UIMgr.setInfoRightBarSetting() UIMgr.getInfoRightBarSetting()


UIMgr.getInfoRightBarSetting

Overview
Description Returns the right bar’s current config setting.
Supported on Android Since Version 9.6.0.821
Supported on iOS Since Version Android, Linux
Type Method
Package com.alk.cpik.ui

Syntax

SideBarDisplayType getInfoRightBarSetting() throws CopilotException
+(CPSideBarDisplayType) getInfoRightBarSetting

Return Value

SideBarDisplayType that is currently being displayed in the right info bar

Sample Code

// Print what is currently being displayed in the right info bar
try {
  UIMgr.SideBarDisplayType currRight = UIMgr.getInfoRightBarSetting();
  System.out.println(currRight.toString() + " is currently being displayed in the right info bar");
} catch (CopilotException e) {
  e.printStackTrace();
}
enum CPSideBarDisplayType type = [UIMgr getInfoRightBarSetting];

Related APIs

UIMgr.setInfoLeftBarSetting() UIMgr.getInfoLeftBarSetting() UIMgr.setInfoRightBarSetting()


UIMgr.setCustomInfoBarAText

Overview
Description Sets custom text to be displayed by any info bar that is set to display the information in info bar “A”. The information includes a title, label and units. If you do not wish to display one of these fields, pass null or an empty string. The label and unit fields will be forced to uppercase by the CoPilot UI. For this information to appear, you must use CopilotMgr.setConfigurationSetting to set ConfigurationSetting.INFO_BAR_LEFT or ConfigurationSetting.INFO_BAR_RIGHT to ConfigurationSetting.INFO_BAR_DISPLAY_CUSTOM_A.
Supported on Android, iOS, and Linux Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

public static void setCustomInfoBarAText(String title, String label, String units)

Parameters

title - The title string that will appear at the top of the dashboard widget. Pass an empty string or null if you do not want this field displayed. This text will be forced to uppercase by the CoPilot UI. label - The label string that will appear as the primary text in the dashboard widget. Pass an empty string or null if you do not want this field displayed. units - The unit string that will appear after the label string in the dashboard widget. Pass empty string or null if you do not want this field displayed. This text will be forced to uppercase by the CoPilot UI.

Sample Code

UIMgr.setCustomInfoBarAText("TitleA", "LabelA", "UnitsA");	CopilotMgr.setConfigurationSetting(ConfigurationSetting.create(ConfigurationSetting.INFO_BAR_LEFT, ConfigurationSetting.INFO_BAR_DISPLAY_CUSTOM_A));

set-custom-infobar-a-text

Related APIs

  • CopilotMgr.setConfigurationSetting
  • ConfigurationSetting.INFO_BAR_LEFT
  • ConfigurationSetting.INFO_BAR_RIGHT
  • ConfigurationSetting.INFO_BAR_DISPLAY_CUSTOM_A

UIMgr.setCustomInfoBarBText

Overview
Description Sets custom text to be displayed by any info bar that is set to display the information in info bar “B”. The information includes a title, label and units. If you do not wish to display one of these fields, pass null or an empty string. The label and unit fields will be forced to uppercase by the CoPilot UI. For this information to appear, you must use CopilotMgr.setConfigurationSetting to set ConfigurationSetting.INFO_BAR_LEFT or ConfigurationSetting.INFO_BAR_RIGHT to ConfigurationSetting.INFO_BAR_DISPLAY_CUSTOM_B.
Supported on Android, iOS, and Linux Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

public static void setCustomInfoBarBText(String title, String label, String units)

Parameters

title - The title string that will appear at the top of the dashboard widget. Pass an empty string or null if you do not want this field displayed. This text will be forced to uppercase by the CoPilot UI.

label - The label string that will appear as the primary text in the dashboard widget. Pass an empty string or null if you do not want this field displayed.

units - The unit string that will appear after the label string in the dashboard widget. Pass empty string or null if you do not want this field displayed. This text will be forced to uppercase by the CoPilot UI.

Sample Code

UIMgr.setCustomInfoBarBText("TitleB", "LabelB", "UnitsB");	CopilotMgr.setConfigurationSetting(ConfigurationSetting.create(ConfigurationSetting.INFO_BAR_LEFT, ConfigurationSetting.INFO_BAR_DISPLAY_CUSTOM_B));

set-custom-infobar-b-text

Related APIs

CopilotMgr.setConfigurationSetting ConfigurationSetting.INFO_BAR_LEFT ConfigurationSetting.INFO_BAR_RIGHT ConfigurationSetting.INFO_BAR_DISPLAY_CUSTOM_A


UIMgr.getMapDrawer

Overview
Description Gets the single instance of the MapDrawer class.
Supported on Android Since Version 9.6.0.867
Supported on iOS Since Version 10.9
Type Method
Package com.alk.cpik.ui

Syntax

MapDrawer getMapDrawer()
+(MapDrawer*) getMapDrawer

Return Value

MapDrawer object if CoPilot service is started, or null if it has not been started.

Sample Code

// Get a reference to the singleton map drawer
MapDrawer singletonMapDrawer = UIMgr.getMapDrawer();
System.out.println("MapDrawer MapOrientation " + singletonMapDrawer.getMapOrientation().toString());
System.out.println("MapDrawer MapView " + singletonMapDrawer.getMapView().toString());
System.out.println("MapDrawer MapZoomLevel " + singletonMapDrawer.getZoomLevel());
MapDrawer *singletonMapDrawer = [UIMgr getMapDrawer];

Dialog

Overview
Description An enum of dialogs that can be called to the forefront of the CPIK application.
Supported on Android Since Version 9.6.0.821
Type Enum
Package com.alk.cpik.ui

Values

Value Description
MAP_NAVIGATION_VIEW Map Navigation dialog. This screen is the main navigation view where directions and the map are shown.
MAIN_MENU Main menu dialog. When calling the main menu, the settings options will be available to the user through the UI.
DRIVING_MENU Driving menu dialog. To show the driving menu, which includes a limited number of navigational view options.
FEATURES_AND_UPGRADES Features and upgrades. This will bring CoPilot to the “in-app” purchase screen.
ALTERNATE_ROUTE_DIALOG Shows the alternate route preview screen. This needs to be called only after the user receives the route information for at least one route by listening on onRouteCalculation. This value is not supported in CoPilot V10
PREVIEW_TRIP_PLAN_DIALOG Shows a trip preview within the PLAN view.
PREVIEW_TRIP_MAP_DIALOG Shows a trip preview within the MAP view.
PREVIEW_TRIP_MAP_NO_WIDGET_DIALOG Shows a trip preview within the MAP view without widgets (map only—no buttons, menus or labels.) Only available when there are 2 or more stops.
SETTINGS_MENU The settings menu.

POIDisplayType

Overview
Description Specifies when to display POIs on the map.
Supported on Android Since Version 9.6.0.821
Type Enum
Package com.alk.cpik.ui

Values

Value Description
NEVER Never display POIs on the map
WHEN_STOPPED Display POIs when stopped
DRIVING_MENU Display POIs all the time

SideBarDisplayType

Overview
Description Specifies which map type CoPilot is displaying.
Supported on Android Since Version 9.6.0.821
Type Enum
Package com.alk.cpik.ui

Values

Value Description
ELEVATION Display current elevation.
ESTIMATED_TRAVEL_TIME Display estimated travel time.
HEADING Display current heading.
SPEED Display current speed.
ESTIMATED_TIME_ARRIVAL Display estimated time of arrival.
DISTANCE Display distance to destination.

Hooks and Callbacks

Hooks and Callbacks related to the UI can be found below.

UIListener
onShowNavigationScreen
onLeaveNavigationScreen
onStartingPoiWizard
onMapImageTouchEvent
onMapImageImportStatusUpdate
Last updated April 24, 2024.