centerOnCoordinates method

void centerOnCoordinates(
  1. Coordinates coords, {
  2. int zoomLevel = -1,
  3. Point<int>? screenPosition,
  4. GemAnimation? animation,
  5. double? mapAngle,
  6. double? viewAngle,
  7. double slippyZoomLevel = -1.0,
})

Center the WGS coordinates on the screen coordinates.

Parameters

  • IN coords Coordinates
  • IN zoomLevel Zoom level (Use -1 for automatic selection)
  • IN screenPosition Screen position where the coordinates should project (default uses the specified cursor coordinates). The coordinates are relative to the parent view screen.
  • IN animation Specifies the animation to be used by the operation.
  • IN mapAngle Map rotation angle in the range 0.0 - 360.0 degrees (Use double.infinity for automatic selection).
  • IN viewAngle MapView angle in the range -90.0 - 90.0 degrees (Use double.infinity for automatic selection).

Throws

  • An exception if it fails.

Implementation

void centerOnCoordinates(
  final Coordinates coords, {
  final int zoomLevel = -1,
  final Point<int>? screenPosition,
  final GemAnimation? animation,
  double? mapAngle,
  double? viewAngle,
  final double slippyZoomLevel = -1.0,
}) {
  if (viewAngle != null && (viewAngle - viewAngle.toInt() == 0)) {
    viewAngle -= 0.0000000001;
  }
  if (mapAngle != null && (mapAngle - mapAngle.toInt() == 0)) {
    mapAngle -= 0.0000000001;
  }
  objectMethod(
    _pointerId,
    'MapView',
    'centerOnCoordinates',
    args: <String, Object>{
      'coords': coords,
      'zoomLevel': zoomLevel,
      'slippyZoomLevel': slippyZoomLevel,
      if (screenPosition != null) 'xy': XyType<int>.fromPoint(screenPosition),
      if (animation != null) 'animation': animation,
      if (mapAngle != null) 'mapAngle': mapAngle,
      if (viewAngle != null) 'viewAngle': viewAngle,
    },
  );
}