generalize static method

Geometry generalize({
  1. required Geometry geometry,
  2. required double maxDeviation,
  3. required bool removeDegenerateParts,
})

Generalizes the given geometry by removing vertices based on the Douglas-Poiker algorithm.

ArcGISPoint and Multipoint geometries are left unchanged. Envelope is converted to a Polygon and then generalized.

Supports true curves as input, producing a densified curve as output where applicable.

Parameters:

  • geometry — A geometry object.
  • maxDeviation — The maximum distance that the generalized geometry can deviate from the original, in the same units as the geometry's spatial reference system.
  • removeDegenerateParts — True if degenerate parts of the resulting geometry that are undesired for drawing are removed, false otherwise.

Return Value: The geometry object that represents the generalization of the input geometry.

Implementation

static Geometry generalize({
  required Geometry geometry,
  required double maxDeviation,
  required bool removeDegenerateParts,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_generalize(
      geometry._handle,
      maxDeviation,
      removeDegenerateParts,
      errorHandler,
    );
  });
  return Geometry._fromHandle(
    objectHandle,
  )!;
}