setPolygon method
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>, Pointer<Void>),
int Function(Pointer<Void>, Pointer<Void>)
>('navigine_sdk_flutter_PolygonMapObject_setPolygon__Polygon'));
final _polygonHandle = navigine_sdk_flutter_LocationPolygon_ToFfi(polygon);
final _handle = this.handle;
final __resultHandle = _setPolygonFfi(_handle, _polygonHandle);
navigine_sdk_flutter_LocationPolygon_ReleaseFfiHandle(_polygonHandle);
final _result = navigine_sdk_flutter_bool_FromFfi(__resultHandle);
navigine_sdk_flutter_bool_ReleaseFfiHandle(__resultHandle);
return _result;
}