LivemapController constructor

LivemapController(
  1. int id, {
  2. OnMapReadyCallback? onMapReady,
  3. OnBuildingFocusChangedCallback? onBuildingFocusChanged,
  4. OnActiveLevelChangedCallback? onActiveLevelChanged,
  5. OnPointOfInterestSelectedCallback? onPointOfInterestSelected,
  6. OnPointOfInterestUnselectedCallback? onPointOfInterestUnselected,
  7. OnStartedVpsProcessCallback? onStartedVpsProcess,
  8. OnStoppingVpsProcessCallback? onStoppingVpsProcess,
  9. OnNavigationStartedCallback? onNavigationStarted,
  10. OnNavigationStoppedCallback? onNavigationStopped,
  11. OnStateChangedCallback? onStateChanged,
  12. OnMapClickCallBack? onMapClick,
  13. OnMapLongClickCallBack? onMapLongClick,
  14. OnMarkerClickCallBack? onMarkerClick,
  15. OnVPSBadConnectionCallback? onVPSBadConnection,
  16. OnVPSNoConnectionCallback? onVPSNoConnection,
  17. OnNavigationFailedCallback? onNavigationFailed,
  18. OnNavigationInfoChangedCallback? onNavigationInfoChanged,
  19. OnArrivedAtDestinationCallback? onArrivedAtDestination,
  20. OnItineraryAddedCallback? onItineraryAdded,
  21. OnItineraryRemovedCallback? onItineraryRemoved,
  22. OnItineraryFailedCallback? onItineraryFailed,
  23. OnCameraTrackingChangedCallback? onCameraTrackingChanged,
  24. OnScanReasonChangedCallback? onScanReasonChanged,
  25. OnARViewVisibilityChangedCallback? onARViewVisibilityChanged,
})

Implementation

LivemapController(int id,
    { this.onMapReady,
      this.onBuildingFocusChanged,
      this.onActiveLevelChanged,
      this.onPointOfInterestSelected,
      this.onPointOfInterestUnselected,
      this.onStartedVpsProcess,
      this.onStoppingVpsProcess,
      this.onNavigationStarted,
      this.onNavigationStopped,
      this.onStateChanged,
      this.onMapClick,
      this.onMapLongClick,
      this.onMarkerClick,
      this.onVPSBadConnection,
      this.onVPSNoConnection,
      this.onNavigationFailed,
      this.onNavigationInfoChanged,
      this.onArrivedAtDestination,
      this.onItineraryAdded,
      this.onItineraryRemoved,
      this.onItineraryFailed,
      this.onCameraTrackingChanged,
      this.onScanReasonChanged,
      this.onARViewVisibilityChanged
      }) {
  _methodChannel = MethodChannel('MapView/$id');
  _methodChannel.setMethodCallHandler(_handleMethod);
  _coordinateEventChannel = EventChannel('CoordinateStream/$id');
  _attitudeEventChannel = EventChannel('AttitudeStream/$id');


  _onMapReadyPlatform.add((MapData mapData) {
    if (onMapReady != null) {
      final mapManager = MapManager(_methodChannel , _coordinateEventChannel, _attitudeEventChannel);
      onMapReady!(mapData, mapManager);
    }
  });

  _onBuildingFocusChangedPlatform.add((Building? building) {
    if (onBuildingFocusChanged != null) {
      onBuildingFocusChanged!(building);
    }
  });

  _onActiveLevelChangedPlatform.add((dynamic params) {
    Building building = Building.fromMap(params["building"]);
    Level level = Level.fromMap(params["level"]);
    if (onActiveLevelChanged != null) {
      onActiveLevelChanged!(building, level);
    }
  });

  _onPointOfInterestSelectedPlatform.add((PointOfInterest poi) {
    if (onPointOfInterestSelected != null) {
      onPointOfInterestSelected!(poi);
    }
  });

  _onPointOfInterestUnselectedPlatform.add((PointOfInterest poi) {
    if (onPointOfInterestUnselected != null) {
      onPointOfInterestUnselected!(poi);
    }
  });

  _onStartedVpsProcessPlatform.add((dynamic) {
    if (onStartedVpsProcess != null) {
      onStartedVpsProcess!();
    }
  });

  _onStoppingVpsProcessPlatform.add((dynamic) {
    if (onStoppingVpsProcess != null) {
      onStoppingVpsProcess!();
    }
  });

  _onNavigationStartedPlatform.add((Navigation navigation) {
    if (onNavigationStarted != null) {
      onNavigationStarted!(navigation);
    }
  });

  _onNavigationStoppedPlatform.add((dynamic) {
    if (onNavigationStopped != null) {
      onNavigationStopped!();
    }
  });

  _onStateChangedPlatform.add((VPSState state) {
    if (onStateChanged != null) {
      onStateChanged!(state);
    }
  });

  _onMapClickPlatform.add((dynamic) {
    if (onMapClick != null) {
      onMapClick!();
    }
  });

  _onMapLongClickPlatform.add((Coordinate coordinate) {
    if (onMapLongClick != null) {
      onMapLongClick!(coordinate);
    }
  });

  _onMarkerClickPlatform.add((dynamic marker) {
    String? title = marker['title'] as String?;
    Coordinate position = Coordinate.fromMap(marker['position'] as dynamic);
    if (onMarkerClick != null) {
      onMarkerClick!(title, position);
    }
  });

  _onVPSBadConnectionPlatform.add((dynamic) {
    if (onVPSBadConnection != null) {
      onVPSBadConnection!();
    }
  });

  _onVPSNoConnectionPlatform.add((dynamic) {
    if (onVPSNoConnection != null) {
      onVPSNoConnection!();
    }
  });

  _onNavigationFailedPlatform.add((String error) {
    if (onNavigationFailed != null) {
      onNavigationFailed!(error);
    }
  });

  _onNavigationInfoChangedPlatform.add((NavigationInfo info) {
    if (onNavigationInfoChanged != null) {
      onNavigationInfoChanged!(info);
    }
  });

  _onArrivedAtDestinationPlatform.add((dynamic) {
    if (onArrivedAtDestination != null) {
      onArrivedAtDestination!();
    }
  });

  _onItineraryAddedPlatform.add((Itinerary itinerary) {
    if (onItineraryAdded != null) {
      onItineraryAdded!(itinerary);
    }
  });

  _onItineraryFailedPlatform.add((String error) {
    if (onItineraryFailed != null) {
      onItineraryFailed!(error);
    }
  });

  _onItineraryRemovedPlatform.add((dynamic) {
    if (onItineraryRemoved != null) {
      onItineraryRemoved!();
    }
  });

  _onCameraTrackingChangedPlatform.add((CameraMode cameraMode) {
    if (onCameraTrackingChanged != null) {
      onCameraTrackingChanged!(cameraMode);
    }
  });

  _onScanReasonChangedPlatform.add((ScanReason scanReason) {
    if (onScanReasonChanged != null) {
      onScanReasonChanged!(scanReason);
    }
  });

  _onARViewVisibilityChangedPlatform.add((bool isVisible) {
    if (onARViewVisibilityChanged != null) {
      onARViewVisibilityChanged!(isVisible);
    }
  });
}