Skip to content

editorGlobalsPolygonClipper

Class: PolygonClipper

Hierarchy

  • PolygonClipper

AsyncPolygonClipper

TriangulatingPolygonClipper

JstsPolygonClipper

Index

Methods

Methods

Abstract difference

difference(base: Polygon | MultiPolygon, candidates: Array‹Polygon | MultiPolygon›): MultiPolygon | PromiseMultiPolygon

Defined in src/util/polygon/PolygonClipper.ts:49

Performs the difference (NOT) operation on two polygons, meaning that the candidate is being cut out of the base polygon.

Parameters:

Name Type Description
base Polygon | MultiPolygon base polygon
candidates Array‹Polygon | MultiPolygon - candidate polygon to be cut out of the base polygon. The candidates must not intersect or touch each other.

Returns: MultiPolygon | PromiseMultiPolygon

the resulting polygons of the (base - candidate) operation. If the polygons do not intersect, the base polygon should be returned. If the candidate is bigger than the base polygon, an empty MultiPolygon must be returned


Abstract intersection

intersection(base: Polygon | MultiPolygon, candidates: Array‹Polygon | MultiPolygon›): MultiPolygon | PromiseMultiPolygon

Defined in src/util/polygon/PolygonClipper.ts:64

Performs the intersection (AND) operation on two polygons, meaning that the shared surface of base and candidates is returned

Parameters:

Name Type Description
base Polygon | MultiPolygon base polygon
candidates Array‹Polygon | MultiPolygon - candidates to be intersected with the base. the candidates must not touch or intersect each other.

Returns: MultiPolygon | PromiseMultiPolygon

the resulting polygons. If the base polygon does not intersect with any candidate polygon, an empty MultiPolygon must be returned.


Abstract multiUnion

multiUnion(polygons: Array‹Polygon | MultiPolygon›, ensuredConstraints?: string): MultiPolygon | PromiseMultiPolygon

Defined in src/util/polygon/PolygonClipper.ts:33

Unions multiple polygons into one big polygon.

Parameters:

Name Type Description
polygons Array‹Polygon | MultiPolygon - Array of polygons. Polygons will be cleansed and degenerated ones will be ignored
ensuredConstraints? string - What level of constraints the user can ensure to the algorithm with regard to the input polygons - 'touchAndOverlap' the polygons touch and may overlap each other. WARNING: very inefficient algorithm! - 'onlyTouch' polygons only touch, but do not overlap each other

Returns: MultiPolygon | PromiseMultiPolygon

the resulting union-ed polygon(s)


Abstract union

union(base: Polygon | MultiPolygon, candidates: Array‹Polygon | MultiPolygon›): MultiPolygon | PromiseMultiPolygon

Defined in src/util/polygon/PolygonClipper.ts:18

Performs a union (OR) on two polygons.

Parameters:

Name Type Description
base Polygon | MultiPolygon base polygon
candidates Array‹Polygon | MultiPolygon - An array of candidate polygons to be added to the base polygon. The candidate polygons must not touch or intersect each other, else, the implementation may throw errors or show undefined behavior.

Returns: MultiPolygon | PromiseMultiPolygon

An array with one entry, the combined base+candidates polygon. If some candidate polygons do not intersect with the base polygons, they must be ignored and not returned by the clipping algorithm.