PTV Navigator Remote Interface Documentation
Variables

AddPolygon

Variables

final int MSG_RI_ADD_POLYGON = 910

Detailed Description

Draws a polygon onto the map

The polygon has to be given as a double array of latitude, longitude values for every point of the polygon.

The "Tag" field describes a string identifier for one or multiple polygons. Multiple polygons can have the same tag. The tag is used in MSG_RI_REMOVE_POLYGON to identify which polygons should be removed. If no tag is given, the polygon will get a default tag (to remove these tags, also omit the tag in MSG_RI_REMOVE_POLYGON).

The "Color" field is an integer representing the color of the polygon (in ARGB format).

The "ImageName" field can be used to show an image inside the polygon. If no image is wanted, do not send an "ImageName" bundle field.

See also:
To grant the navigator access to the image that should be set, the "ImageName" must be filled with the uri of the image file generated by a FileProvider(needed for Android >= 10). The steps to grant a permission is as following:
  • Create an xml file in the res/xml folder of your project and list all directories in your app namespace that should be able to be accessed from outside, see the res/xml/filepaths.xml file in this project as an example.
  • Add a FileProvider to the manifest file (in the application section). Set the android:resource to above created xml file

<provider android:name="androidx.core.content.FileProvider" android:authorities="com.ptvag.navigation.ritest.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths"></meta-data> </provider>

Sending bundle:

KeyValueTypeInfo
Tag Tag for the polyline, will be used as an identifier for later removal of the polyline, optional, if not set, a default tag will be set String
Coordinates A double array of latitude, longitude values for each point of the polyline (mandatory) String
ImageName An image, given as a file provider path that can be shown inside of the polygon(optional) String
Color The color of the polyline as ARGB integer (optional, if not set, color will be 0) Double

Returned error codes:

RI_ERROR_NONE if everything is ok.
RI_ERROR_RI_DISABLED if the Remote Interface service is disabled and/or not licensed.
RI_ERROR_NOT_INITIALIZED if the Remote Interface service is not initialized yet.
RI_ERROR_INVALID_PARAMETER if one of the input variables are not correct.
RI_ERROR_FILE_ACCESS if the image cannot be accessed.
RI_ERROR_NO_LICENSE if the navigator has no valid license.


© PTV Logistics 2024 Generated on Tue May 27 2025 16:37:35 for PTV Navigator Remote Interface Documentation by doxygen 1.7.3