This directory contains comprehensive examples demonstrating how to use the Navigine SDK RouteManager across different platforms.
Overview
RouteManager is used for evaluating route paths from point to point, managing targets, and handling route events. The examples cover all available methods and properties of the RouteManager API.
Supported Platforms
Key Features Demonstrated
RouteManager Methods
addRouteListener()
/ removeRouteListener()
- Managing route listeners
setGraphTag()
/ getGraphTag()
- Setting and getting graph tags
getGraphTags()
- Getting all available graph tags
makeRoute()
- Creating routes between two points
makeRoutes()
- Creating routes to multiple destinations
setTarget()
/ addTarget()
- Setting and adding target points
cancelTarget()
/ clearTargets()
- Managing targets
RoutePath Properties and Methods
length
- Total route length in meters
points
- List of consecutive points along the route
events
- List of route events (turns, transitions)
head()
- Getting the leading segment of the route
tail()
- Getting the remaining segment of the route
RouteEvent Properties
type
- Event type (TURN_LEFT, TURN_RIGHT, TRANSITION)
value
- Angle for turns or sublocation ID for transitions
distance
- Distance from route start in meters
RouteEventType Enum Values
TURN_LEFT
- Left turn event
TURN_RIGHT
- Right turn event
TRANSITION
- Sublocation transition event
All examples demonstrate how to get all enum values using the values()
method or equivalent platform-specific approach.
RouteListener Methods
onPathsUpdated()
- Called when new routes are calculated
Example Structure
Each example follows a consistent structure:
- SDK Initialization - Setting up NavigineSdk, LocationManager, NavigationManager, and RouteManager
- Route Listener Setup - Implementing RouteListener interface
- Basic Route Operations - Creating routes, setting targets, managing graph tags
- Route Path Analysis - Working with route properties and segments
- Route Events - Handling turn and transition events
- Advanced Features - Multiple graph tags, complex routing scenarios
- Route Planning Simulation - Dynamic target management
- Cleanup - Proper resource management
Usage
Running the Examples
Dart/Flutter
cd examples/RouteManager/dart
dart route_manager_example.dart
Java
cd examples/RouteManager/java
javac RouteManagerExample.java
java RouteManagerExample
Kotlin
cd examples/RouteManager/kotlin
kotlinc RouteManagerExample.kt -include-runtime -d RouteManagerExample.jar
java -jar RouteManagerExample.jar
Objective-C
cd examples/RouteManager/objc
clang -framework Foundation -framework NavigineSDK RouteManagerExample.m -o RouteManagerExample
./RouteManagerExample
Swift
cd examples/RouteManager/swift
swift RouteManagerExample.swift
Key Concepts
Route Planning
- Routes are calculated between LocationPoints within a location
- Multiple targets can be set for complex navigation scenarios
- Graph tags allow routing on different path networks (main, elevator, stairs)
Route Events
- Turn events provide navigation instructions with angles
- Transition events indicate floor/sublocation changes
- Events are positioned along the route with distance information
Route Segmentation
- Routes can be split into head (leading) and tail (remaining) segments
- Useful for progressive navigation and route analysis
API Coverage
All examples provide 100% coverage of the RouteManager API including:
- ✅ All RouteManager methods
- ✅ All RoutePath properties and methods
- ✅ All RouteEvent properties
- ✅ All RouteEventType enum values
- ✅ All RouteListener methods
- ✅ Proper error handling and resource management
- ✅ Documentation tags for each method/property
Integration Notes
- RouteManager requires both LocationManager and NavigationManager instances
- Route listeners should be properly removed to prevent memory leaks
- Graph tags should be set before creating routes for specific path networks
- Route events provide real-time navigation guidance during route following
Platform-Specific Notes
Dart/Flutter
- Uses async/await for asynchronous operations
- Implements RouteListener as a callback function
- Properties accessed directly (e.g.,
routePath.length
)
Java
- Uses traditional threading with Thread.sleep()
- Implements RouteListener as an anonymous class
- Methods accessed via getter methods (e.g.,
routePath.getLength()
)
Kotlin
- Uses coroutines for asynchronous operations
- Implements RouteListener as an object expression
- Properties accessed directly (e.g.,
routePath.length
)
Objective-C
- Uses NSThread for timing operations
- Implements RouteListener as a protocol
- Methods accessed via getter methods (e.g.,
[routePath getLength]
)
Swift
- Uses Thread.sleep() for timing operations
- Implements RouteListener as a protocol extension
- Methods accessed via getter methods (e.g.,
routePath.getLength()
)
Documentation Tags
Each example includes documentation tags in the format [platform_ClassName_methodName]
for easy reference and documentation generation:
[dart_RouteManager_makeRoute]
[java_RoutePath_getLength]
[kotlin_RouteEvent_getType]
[objc_RouteListener_onPathsUpdated]
[swift_RouteEventType_values]
These tags help developers quickly locate specific API usage examples across all platforms.