offset static method

Geometry offset(
  1. {required Geometry geometry,
  2. required double distance,
  3. required GeometryOffsetType offsetType,
  4. required double bevelRatio,
  5. required double flattenError}
)

Creates an offset version of the input geometry.

The offset operation creates a geometry that is a constant distance from the input geometry. It is similar to buffering, but produces a one-sided result. If distance > 0, then the offset geometry is constructed to the right of the input geometry, otherwise it is constructed to the left. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counterclockwise. So the "right side" of a simple polygon is always its inside. The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be from the input curve before it is beveled.

Parameters:

  • geometry — A geometry object.
  • distance — The offset distance for the new geometry.
  • offsetType — The offset type the resulting geometry.
  • bevelRatio — The ratio used to produce a bevel join instead of a miter join (used only when the offset type is Miter).
  • flattenError — The maximum distance of the resulting segments compared to the true circular arc (used only when the offset type if round).

Return Value: The offset geometry object.

Implementation

static Geometry offset(
    {required Geometry geometry,
    required double distance,
    required GeometryOffsetType offsetType,
    required double bevelRatio,
    required double flattenError}) {
  _initializeArcGISEnvironmentIfNeeded();
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_offset(geometry._handle, distance,
        offsetType.coreValue, bevelRatio, flattenError, errorHandler);
  });
  return Geometry._fromHandle(objectHandle)!;
}