rotate static method

Geometry rotate(
  1. {required Geometry geometry,
  2. required double angle,
  3. ArcGISPoint? origin}
)

Rotates the geometry by the specified angle of rotation around the provided origin point.

The angle of rotation is used in the form of the modulo of 360 degrees; for example rotating by 540 degrees is equivalent to rotating the geometry by 180 degrees. A positive value corresponds to a counterclockwise rotation.

The GeometryType of the returned geometry is the same as the input geometry, except for an input Envelope which returns a Polygon result.

If the origin ArcGISPoint has a different SpatialReference to that of the geometry parameter, the point will be reprojected before the geometry is rotated, using the default transformation.

Rotating an ArcGISPoint using the same location for the origin parameter returns an ArcGISPoint with the same values as the input.

Supports true curves.

Parameters:

  • geometry — The geometry to rotate.
  • angle — The angle by which to rotate the geometry, counterclockwise, in degrees.
  • origin — The center of rotation. If null, or Geometry.isEmpty is true, the center of the extent of the given geometry is used.

Return Value: A new geometry constructed by rotating the input geometry by the specified angle of rotation around the provided origin point.

Implementation

static Geometry rotate(
    {required Geometry geometry,
    required double angle,
    ArcGISPoint? origin}) {
  _initializeArcGISEnvironmentIfNeeded();
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_rotate(geometry._handle, angle,
        origin?._handle ?? ffi.nullptr, errorHandler);
  });
  return Geometry._fromHandle(objectHandle)!;
}