JoinPolygons
Namespace: Digi21.DigiNG.Entities
Assembly: Digi21.DigiNG
Returns the polygon resulting from the union of the areas enclosed by two entities.
public static Polygon JoinPolygons(Entity a, Entity b)
Parameters
| Parameter | Description |
|---|---|
a |
A closed line (ReadOnlyLine) or polygon (ReadOnlyPolygon). |
b |
A closed line (ReadOnlyLine) or polygon (ReadOnlyPolygon). |
The parameters are not modified.
Return value
A new Polygon, belonging to no drawing file. The method splits both entities (outer boundaries and holes) at their intersections, removes duplicate sections (shared sides) and builds topology from the remaining sections. The outer boundary encloses the area not inside any other, and the holes are that area's holes.
The polygon takes its codes from the resulting boundary's first line, which may come from a or b.
Exceptions
| Exception | When |
|---|---|
Exception |
a or b is neither a line nor a polygon. The message says “first entity” even when the invalid entity is b. |
Exception |
The union forms more than one enclosed area that is not inside another; for example, if a and b do not touch. |
Exception |
Topological analysis finds duplicate points or single-point arcs, or there is insufficient data to build topology. |
NullReferenceException |
a or b is null. |
Example
Read the Polygon example.