setPolygon method

  1. @override
bool setPolygon(
  1. LocationPolygon polygon
)
override

Method is used to specify the source polygon of the object. polygon Metrics coordinates of the polygon LocationPolygon. Returns true if success, false otherwise.

Example:

// Set polygon geometry
List<Point> points = [
 Point(100.0, 200.0),
 Point(150.0, 250.0),
 Point(200.0, 200.0),
 Point(150.0, 150.0),
];
Polygon metricPolygon = Polygon(points);
LocationPolygon polygon = LocationPolygon(metricPolygon, 1, 0);
bool success = _polygonMapObject!.setPolygon(polygon);
print("Set polygon with ${points.length} points: $success");

Implementation

@override
bool setPolygon(LocationPolygon polygon) {
    final _setPolygonFfi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
        Uint8 Function(Pointer<Void>, LocationPolygonNative),
        int Function(Pointer<Void>, LocationPolygonNative)
      >('navigine_sdk_flutter_PolygonMapObject_setPolygon__Polygon'));
    final __resultHandle = _setPolygonFfi(this.ptr, LocationPolygonImpl.toNative(polygon));
    final _result = (__resultHandle != 0);
    exception.checkCallResult();
    return _result;
}