84 if (routeManager ==
null) {
85 System.err.println(
"RouteManager not initialized");
89 if (routeListener ==
null)
return;
93 routeManager.addRouteListener(routeListener);
98 routeManager.setGraphTag(
"main");
103 String currentGraphTag = routeManager.getGraphTag();
104 System.out.println(
"Current graph tag: " + currentGraphTag);
109 List<String> graphTags = routeManager.getGraphTags();
110 System.out.println(
"Available graph tags: " + graphTags);
114 Point startPoint =
new Point(10.0, 20.0);
115 Point endPoint =
new Point(50.0, 60.0);
116 LocationPoint startLocationPoint =
new LocationPoint(startPoint, 12345, 1);
117 LocationPoint endLocationPoint =
new LocationPoint(endPoint, 12345, 1);
121 RoutePath routePath = routeManager.makeRoute(startLocationPoint, endLocationPoint);
122 System.out.println(
"Route created with length: " + routePath.getLength() +
" meters");
127 List<LocationPoint> destinations =
new ArrayList<>();
128 destinations.add(
new LocationPoint(
new Point(30.0, 40.0), 12345, 1));
129 destinations.add(
new LocationPoint(
new Point(70.0, 80.0), 12345, 1));
130 List<RoutePath> routePaths = routeManager.makeRoutes(startLocationPoint, destinations);
131 System.out.println(
"Created " + routePaths.size() +
" routes");
136 routeManager.setTarget(endLocationPoint);
141 LocationPoint additionalTarget =
new LocationPoint(
new Point(90.0, 100.0), 12345, 1);
142 routeManager.addTarget(additionalTarget);
147 routeManager.cancelTarget();
152 routeManager.clearTargets();
160 for (
int i = 0; i < paths.size(); i++) {
161 RoutePath path = paths.get(i);
162 System.out.println(
"=== Route Path " + (i + 1) +
" ===");
166 double length = path.getLength();
167 System.out.println(
"Route length: " + length +
" meters");
172 List<LocationPoint> points = path.getPoints();
173 System.out.println(
"Route has " + points.size() +
" points");
174 for (
int j = 0; j < points.size(); j++) {
181 List<RouteEvent> events = path.getEvents();
182 System.out.println(
"Route has " + events.size() +
" events");
183 for (
int j = 0; j < events.size(); j++) {
190 RoutePath headPath = path.head(10.0);
191 if (headPath !=
null) {
192 System.out.println(
"Head path length: " + headPath.getLength() +
" meters");
198 RoutePath tailPath = path.tail(10.0);
199 if (tailPath !=
null) {
200 System.out.println(
"Tail path length: " + tailPath.getLength() +
" meters");
255 Point point = locationPoint.getPoint();
263 int locationId = locationPoint.getLocationId();
264 System.out.println(
"Location ID: " + locationId);
269 int sublocationId = locationPoint.getSublocationId();
270 System.out.println(
"Sublocation ID: " + sublocationId);
275 Point newPoint =
new Point(15.0, 25.0);
276 LocationPoint newLocationPoint =
new LocationPoint(newPoint, locationId, sublocationId);
277 System.out.println(
"Created new LocationPoint: " + newLocationPoint);
308 System.out.println(
"=== Advanced Routing Features ===");
310 if (routeManager ==
null) {
315 String[] graphTags = {
"main",
"elevator",
"stairs"};
317 for (String tag : graphTags) {
320 routeManager.setGraphTag(tag);
323 System.out.println(
"Routing with graph tag: " + tag);
326 Point startPoint =
new Point(0.0, 0.0);
327 Point endPoint =
new Point(100.0, 100.0);
328 LocationPoint startLocationPoint =
new LocationPoint(startPoint, 12345, 1);
329 LocationPoint endLocationPoint =
new LocationPoint(endPoint, 12345, 1);
333 RoutePath routePath = routeManager.makeRoute(startLocationPoint, endLocationPoint);
336 System.out.println(
"Route with tag '" + tag +
"' has length: " + routePath.getLength() +
" meters");
344 System.out.println(
"=== Route Planning Simulation ===");
346 if (routeManager ==
null) {
351 List<LocationPoint> targets =
new ArrayList<>();
352 targets.add(
new LocationPoint(
new Point(50.0, 50.0), 12345, 1));
353 targets.add(
new LocationPoint(
new Point(100.0, 100.0), 12345, 1));
354 targets.add(
new LocationPoint(
new Point(150.0, 150.0), 12345, 1));
358 routeManager.setTarget(targets.get(0));
361 System.out.println(
"Set target 1: " + targets.get(0));
365 }
catch (InterruptedException e) {
366 Thread.currentThread().interrupt();
371 for (
int i = 1; i < targets.size(); i++) {
372 routeManager.addTarget(targets.get(i));
373 System.out.println(
"Added target " + (i + 1) +
": " + targets.get(i));
376 }
catch (InterruptedException e) {
377 Thread.currentThread().interrupt();
384 routeManager.cancelTarget();
385 System.out.println(
"Cancelled current target");
390 }
catch (InterruptedException e) {
391 Thread.currentThread().interrupt();
396 routeManager.clearTargets();
397 System.out.println(
"Cleared all targets");