Loading...
Searching...
No Matches
com.navigine.idl.java.RouteLayer Class Referenceabstract

Layer that renders a route on the map as traveled and remaining polylines. More...

+ Inheritance diagram for com.navigine.idl.java.RouteLayer:

Public Member Functions

abstract void setVisible (boolean visible)
 Shows or hides the route layer.
 
abstract boolean isVisible ()
 Returns true if the route layer is visible.
 
abstract void setTarget (RouteEndpoint target)
 Starts turn-by-turn guidance to the target from the current position.
 
abstract void setRoute (RouteEndpoint from, RouteEndpoint to)
 Builds and shows a static route between two points (no live guidance).
 
abstract void clear ()
 Cancels guidance / static route and removes polylines from the map.
 
abstract ArrayList< RouteView > routes ()
 Returns currently rendered routes. V1 exposes a single active route.
 
abstract RouteView selectedRoute ()
 Returns selected route view, or null when no route is selected.
 
abstract void selectRoute (RouteView route)
 Selects the provided route view. Pass null to clear selection.
 
abstract void addRouteLayerListener (RouteLayerListener listener)
 Adds listener for route lifecycle, progress and target reach events.
 
abstract void removeRouteLayerListener (RouteLayerListener listener)
 Removes previously added route layer listener.
 
abstract void addRouteViewListener (RouteViewListener listener)
 Adds listener for route view list, selection and tap events.
 
abstract void removeRouteViewListener (RouteViewListener listener)
 Removes previously added route view listener.
 
abstract void setTraveledColor (int color)
 Sets traveled (passed) route polyline color.
 
abstract void setRemainingColor (int color)
 Sets remaining route polyline color.
 
abstract void setWidth (float width)
 Sets route polyline width in pixels (also used as default dotted point size).
 
abstract void setRemainingStyle (RouteRemainingStyle style)
 Sets rendering style for the remaining route.
 
abstract RouteRemainingStyle remainingStyle ()
 Returns the remaining route rendering style.
 
abstract void setRemainingDashLength (float dashLength)
 Sets dash length for DASHED remaining style. Use 0 to disable dashing.
 
abstract void setRemainingGapLength (float gapLength)
 Sets gap length for DASHED remaining style. Use 0 to disable dashing.
 
abstract void setRemainingPointSize (float width, float height)
 Sets point size for DOTTED remaining style.
 
abstract void setRemainingPlacement (Placement placement)
 Sets point placement mode for DOTTED remaining style.
 
abstract void setRemainingPlacementSpacing (float spacing)
 Sets spacing between points for DOTTED + SPACED placement (pixels).
 
abstract void setRemainingPlacementMinRatio (float ratio)
 Sets minimum polyline length ratio for DOTTED placement.
 
abstract void setRemainingCollisionEnabled (boolean enabled)
 Enables or disables collision for DOTTED remaining points.
 
abstract boolean isValid ()
 

Detailed Description

Layer that renders a route on the map as traveled and remaining polylines.

Independent from UserLocationLayer: a route can be shown without a user marker, and a user marker can be shown without a route.

Location and position are taken from the SDK automatically (same pattern as UserLocationLayer).

Referenced from NavigineSdk.

Definition at line 26 of file RouteLayer.java.

Member Function Documentation

◆ addRouteLayerListener()

abstract void com.navigine.idl.java.RouteLayer.addRouteLayerListener ( RouteLayerListener listener)
abstract

Adds listener for route lifecycle, progress and target reach events.

Java code snippet:

routeLayerListener = new RouteLayerListener() {
@Override
public void onRouteChanged(RouteLayerStatus status, RouteView route) {
System.out.println("Route status: " + status);
}
@Override
public void onRouteAdvanced(RouteProgress progress) {
System.out.println("Remaining distance: " + progress.remainingDistance
+ ", time: " + progress.remainingTime + "s");
}
@Override
public void onRouteTargetReached() {
System.out.println("Route target reached");
}
};
routeLayer.addRouteLayerListener(routeLayerListener);

Kotlin code snippet:

routeLayerListener = object : RouteLayerListener {
override fun onRouteChanged(status: RouteLayerStatus, route: RouteView?) {
println("Route status: $status")
}
override fun onRouteAdvanced(progress: RouteProgress) {
println("Remaining distance: ${progress.remainingDistance}, time: ${progress.remainingTime}s")
}
override fun onRouteTargetReached() {
println("Route target reached")
}
}
routeLayer!!.addRouteLayerListener(routeLayerListener!!)

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ addRouteViewListener()

abstract void com.navigine.idl.java.RouteLayer.addRouteViewListener ( RouteViewListener listener)
abstract

Adds listener for route view list, selection and tap events.

Java code snippet:

routeViewListener = new RouteViewListener() {
@Override
public void onRouteViewsChanged() {
System.out.println("Route views changed");
}
@Override
public void onSelectedRouteChanged(RouteView route) {
System.out.println("Selected route changed");
}
@Override
public void onRouteViewTap(RouteView route) {
routeLayer.selectRoute(route);
}
};
routeLayer.addRouteViewListener(routeViewListener);

Kotlin code snippet:

routeViewListener = object : RouteViewListener {
override fun onRouteViewsChanged() {
println("Route views changed")
}
override fun onSelectedRouteChanged(route: RouteView?) {
println("Selected route changed")
}
override fun onRouteViewTap(route: RouteView) {
routeLayer!!.selectRoute(route)
}
}
routeLayer!!.addRouteViewListener(routeViewListener!!)

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ clear()

abstract void com.navigine.idl.java.RouteLayer.clear ( )
abstract

Cancels guidance / static route and removes polylines from the map.

Java code snippet:

routeLayer.clear();
System.out.println("Route layer cleared");

Kotlin code snippet:

routeLayer!!.clear()
println("Route layer cleared")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ isValid()

abstract boolean com.navigine.idl.java.RouteLayer.isValid ( )
abstract

Tells if this RouteLayer is valid or not. Any other method (except for this one) called on an invalid RouteLayer will throw java.lang.RuntimeException.

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ isVisible()

abstract boolean com.navigine.idl.java.RouteLayer.isVisible ( )
abstract

Returns true if the route layer is visible.

Java code snippet:

boolean visible = routeLayer.isVisible();
System.out.println("Route layer is visible: " + visible);

Kotlin code snippet:

val visible = routeLayer!!.isVisible
println("Route layer is visible: $visible")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ remainingStyle()

abstract RouteRemainingStyle com.navigine.idl.java.RouteLayer.remainingStyle ( )
abstract

Returns the remaining route rendering style.

Java code snippet:

RouteRemainingStyle remainingStyle = routeLayer.remainingStyle();
System.out.println("Remaining style: " + remainingStyle);

Kotlin code snippet:

val remainingStyle = routeLayer!!.remainingStyle
println("Remaining style: $remainingStyle")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ removeRouteLayerListener()

abstract void com.navigine.idl.java.RouteLayer.removeRouteLayerListener ( RouteLayerListener listener)
abstract

Removes previously added route layer listener.

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ removeRouteViewListener()

abstract void com.navigine.idl.java.RouteLayer.removeRouteViewListener ( RouteViewListener listener)
abstract

Removes previously added route view listener.

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ routes()

abstract ArrayList< RouteView > com.navigine.idl.java.RouteLayer.routes ( )
abstract

Returns currently rendered routes. V1 exposes a single active route.

Java code snippet:

List<RouteView> routes = routeLayer.routes();
System.out.println("Visible routes: " + routes.size());

Kotlin code snippet:

val routes = routeLayer!!.routes()
println("Visible routes: ${routes.size}")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ selectedRoute()

abstract RouteView com.navigine.idl.java.RouteLayer.selectedRoute ( )
abstract

Returns selected route view, or null when no route is selected.

Java code snippet:

RouteView selectedRoute = routeLayer.selectedRoute();
if (selectedRoute != null) {
System.out.println("Selected route length: " + selectedRoute.length());
}

Kotlin code snippet:

val selectedRoute = routeLayer!!.selectedRoute()
if (selectedRoute != null) {
println("Selected route length: ${selectedRoute.length()}")
}

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ selectRoute()

abstract void com.navigine.idl.java.RouteLayer.selectRoute ( RouteView route)
abstract

Selects the provided route view. Pass null to clear selection.

Parameters
routeRoute view from routes, or null.

Java code snippet:

if (!routes.isEmpty()) {
routeLayer.selectRoute(routes.get(0));
}

Kotlin code snippet:

routes.firstOrNull()?.let { routeLayer!!.selectRoute(it) }

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingCollisionEnabled()

abstract void com.navigine.idl.java.RouteLayer.setRemainingCollisionEnabled ( boolean enabled)
abstract

Enables or disables collision for DOTTED remaining points.

Java code snippet:

routeLayer.setRemainingCollisionEnabled(false);
System.out.println("Remaining collision disabled");

Kotlin code snippet:

routeLayer!!.setRemainingCollisionEnabled(false)
println("Remaining collision disabled")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingColor()

abstract void com.navigine.idl.java.RouteLayer.setRemainingColor ( int color)
abstract

Sets remaining route polyline color.

Java code snippet:

routeLayer.setRemainingColor(0xFF30AAD9);
System.out.println("Remaining color updated");

Kotlin code snippet:

routeLayer!!.setRemainingColor(0xFF30AAD9.toInt())
println("Remaining color updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingDashLength()

abstract void com.navigine.idl.java.RouteLayer.setRemainingDashLength ( float dashLength)
abstract

Sets dash length for DASHED remaining style. Use 0 to disable dashing.

Java code snippet:

routeLayer.setRemainingDashLength(0.5f);
System.out.println("Remaining dash length updated");

Kotlin code snippet:

routeLayer!!.setRemainingDashLength(0.5f)
println("Remaining dash length updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingGapLength()

abstract void com.navigine.idl.java.RouteLayer.setRemainingGapLength ( float gapLength)
abstract

Sets gap length for DASHED remaining style. Use 0 to disable dashing.

Java code snippet:

routeLayer.setRemainingGapLength(0.4f);
System.out.println("Remaining gap length updated");

Kotlin code snippet:

routeLayer!!.setRemainingGapLength(0.4f)
println("Remaining gap length updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingPlacement()

abstract void com.navigine.idl.java.RouteLayer.setRemainingPlacement ( Placement placement)
abstract

Sets point placement mode for DOTTED remaining style.

Java code snippet:

routeLayer.setRemainingPlacement(Placement.SPACED);
System.out.println("Remaining placement updated");

Kotlin code snippet:

routeLayer!!.setRemainingPlacement(Placement.SPACED)
println("Remaining placement updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingPlacementMinRatio()

abstract void com.navigine.idl.java.RouteLayer.setRemainingPlacementMinRatio ( float ratio)
abstract

Sets minimum polyline length ratio for DOTTED placement.

Java code snippet:

routeLayer.setRemainingPlacementMinRatio(0.0f);
System.out.println("Remaining placement min ratio updated");

Kotlin code snippet:

routeLayer!!.setRemainingPlacementMinRatio(0.0f)
println("Remaining placement min ratio updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingPlacementSpacing()

abstract void com.navigine.idl.java.RouteLayer.setRemainingPlacementSpacing ( float spacing)
abstract

Sets spacing between points for DOTTED + SPACED placement (pixels).

Java code snippet:

routeLayer.setRemainingPlacementSpacing(8.0f);
System.out.println("Remaining placement spacing updated");

Kotlin code snippet:

routeLayer!!.setRemainingPlacementSpacing(8.0f)
println("Remaining placement spacing updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingPointSize()

abstract void com.navigine.idl.java.RouteLayer.setRemainingPointSize ( float width,
float height )
abstract

Sets point size for DOTTED remaining style.

Java code snippet:

routeLayer.setRemainingPointSize(8.0f, 8.0f);
System.out.println("Remaining point size updated");

Kotlin code snippet:

routeLayer!!.setRemainingPointSize(8.0f, 8.0f)
println("Remaining point size updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRemainingStyle()

abstract void com.navigine.idl.java.RouteLayer.setRemainingStyle ( RouteRemainingStyle style)
abstract

Sets rendering style for the remaining route.

Java code snippet:

routeLayer.setRemainingStyle(RouteRemainingStyle.DOTTED);
System.out.println("Remaining style set to DOTTED");

Kotlin code snippet:

routeLayer!!.setRemainingStyle(RouteRemainingStyle.DOTTED)
println("Remaining style set to DOTTED")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setRoute()

abstract void com.navigine.idl.java.RouteLayer.setRoute ( RouteEndpoint from,
RouteEndpoint to )
abstract

Builds and shows a static route between two points (no live guidance).

Parameters
fromRoute start endpoint.
toRoute finish endpoint.

Java code snippet:

routeLayer.setRoute(from, to);
System.out.println("Static route applied");

Kotlin code snippet:

routeLayer!!.setRoute(from, to)
println("Static route applied")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setTarget()

abstract void com.navigine.idl.java.RouteLayer.setTarget ( RouteEndpoint target)
abstract

Starts turn-by-turn guidance to the target from the current position.

Parameters
targetDestination endpoint. Route and progress are updated automatically.

Java code snippet:

routeLayer.setTarget(to);
System.out.println("Guidance target applied");

Kotlin code snippet:

routeLayer!!.setTarget(to)
println("Guidance target applied")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setTraveledColor()

abstract void com.navigine.idl.java.RouteLayer.setTraveledColor ( int color)
abstract

Sets traveled (passed) route polyline color.

Java code snippet:

routeLayer.setTraveledColor(0xB4787878);
System.out.println("Traveled color updated");

Kotlin code snippet:

routeLayer!!.setTraveledColor(0xB4787878.toInt())
println("Traveled color updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setVisible()

abstract void com.navigine.idl.java.RouteLayer.setVisible ( boolean visible)
abstract

Shows or hides the route layer.

Java code snippet:

routeLayer.setVisible(true);
System.out.println("Route layer set visible");

Kotlin code snippet:

routeLayer!!.setVisible(true)
println("Route layer set visible")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.

◆ setWidth()

abstract void com.navigine.idl.java.RouteLayer.setWidth ( float width)
abstract

Sets route polyline width in pixels (also used as default dotted point size).

Java code snippet:

routeLayer.setWidth(8.0f);
System.out.println("Route width updated");

Kotlin code snippet:

routeLayer!!.setWidth(8.0f)
println("Route width updated")

Reimplemented in com.navigine.idl.java.internal.RouteLayerBinding.


The documentation for this class was generated from the following file: