getOptimalRoutesCenterViewport method

RectType<int> getOptimalRoutesCenterViewport(
  1. List<Route> routes, {
  2. RectType<int>? screenRect,
})

Gets the highlighted items optimal center viewport given the user custom input.

The returned viewport is adjusted so all highlighted information will be visible

The user can use this as the input to centerOnArea

Parameters

  • IN routes Route list to be shown.
  • IN screenRect Screen viewport rectangle where routes should be centered. If empty, then the whole viewport will be used.

Returns

  • The adjusted viewport. The coordinates are relative to view parent screen

Throws

  • An exception if it fails.

Implementation

RectType<int> getOptimalRoutesCenterViewport(
  final List<Route> routes, {
  final RectType<int>? screenRect,
}) {
  final OperationResult resultString = objectMethod(
    _pointerId,
    'MapView',
    'getOptimalRoutesCenterViewport',
    args: <String, dynamic>{
      'routesList': RouteList.fromList(routes).pointerId,
      if (screenRect != null) 'viewRc': screenRect,
    },
  );

  return RectType<int>.fromJson(resultString['result']);
}