84 if (navigationManager ==
null) {
85 System.err.println(
"NavigationManager not initialized");
91 navigationManager.addPositionListener(positionListener);
96 navigationManager.startLogRecording();
103 navigationManager.addCheckPoint(locationPoint);
109 navigationManager.addLocationMeasurement(globalPoint, 5.0f,
"gps");
114 navigationManager.stopLogRecording();
271 if (locationManager ==
null) {
272 System.err.println(
"LocationManager not initialized");
281 public void onLocationLoaded(
Location location) {
282 System.out.println(
"Location loaded for navigation");
283 if (location !=
null) {
286 locationManager.setLocationId(location.
getId());
294 public void onLocationUploaded(
int locationId) {
295 System.out.println(
"Location uploaded: " + locationId);
301 public void onLocationFailed(
int locationId, Error error) {
302 System.err.println(
"Failed to load location " + locationId +
": " + error.getMessage());
306 locationManager.addLocationListener(locationListener);
311 locationManager.setLocationId(12345);
316 int currentLocationId = locationManager.getLocationId();
317 System.out.println(
"Current location ID: " + currentLocationId);
322 locationManager.setLocationUpdateInterval(300);
327 locationManager.commitChanges();
335 System.out.println(
"=== Advanced Navigation Features ===");
338 Point[] checkPoints = {
340 new Point(10.0, 10.0),
341 new Point(20.0, 20.0),
342 new Point(30.0, 30.0)
345 for (
int i = 0; i < checkPoints.length; i++) {
349 navigationManager.addCheckPoint(locationPoint);
351 System.out.println(
"Added check point " + (i + 1) +
": " + locationPoint);
361 String[] providers = {
"gps",
"network",
"fused"};
363 for (
int i = 0; i < measurements.length; i++) {
366 navigationManager.addLocationMeasurement(measurements[i], 3.0f + i, providers[i % providers.length]);
368 System.out.println(
"Added measurement " + (i + 1) +
" with provider: " + providers[i % providers.length]);
376 System.out.println(
"=== Position Tracking Simulation ===");
380 navigationManager.startLogRecording();
384 for (
int i = 0; i < 5; i++) {
385 double lat = 55.7558 + (i * 0.001);
386 double lon = 37.6176 + (i * 0.001);
391 navigationManager.addLocationMeasurement(globalPoint, 2.0f,
"simulated");
394 System.out.println(
"Simulated position " + (i + 1) +
": " + globalPoint);
398 }
catch (InterruptedException e) {
399 Thread.currentThread().interrupt();
406 navigationManager.stopLogRecording();