Table of Contents

Class Polygonizer

Namespace
NetTopologySuite.Operation.Polygonize
Assembly
NetTopologySuite.dll

Polygonizes a set of Geometrys which contain linework that represents the edges of a planar graph.

public class Polygonizer
Inheritance
Polygonizer
Inherited Members

Remarks

All types of Geometry are accepted as input; the constituent linework is extracted as the edges to be polygonized. The processed edges must be correctly noded; that is, they must only meet at their endpoints. Polygonization will accept incorrectly noded input but will not form polygons from non-noded edges, and reports them as errors.

The Polygonizer reports the follow kinds of errors:

The Polygonizer(bool) constructor allows extracting only polygons which form a valid polygonal result. The set of extracted polygons is guaranteed to be edge-disjoint. This is useful for situations where it is known that the input lines form a valid polygonal geometry (which may include holes or nested polygons).

Constructors

Polygonizer()

Creates a polygonizer that extracts all polygons.

public Polygonizer()

Polygonizer(bool)

Creates a polygonizer, specifying whether a valid polygonal geometry must be created. If the argument is true then areas may be discarded in order to ensure that the extracted geometry is a valid polygonal geometry.

public Polygonizer(bool extractOnlyPolygonal)

Parameters

extractOnlyPolygonal bool

true if a valid polygonal geometry should be extracted

Fields

AllPolys

The default polygonizer output behavior

public const bool AllPolys = false

Field Value

bool

Properties

IsCheckingRingsValid

Allows disabling the valid ring checking, to optimize situations where invalid rings are not expected.

public bool IsCheckingRingsValid { get; set; }

Property Value

bool

Remarks

The default is true

Methods

Add(Geometry)

Adds a Geometry to the linework to be polygonized. May be called multiple times. Any dimension of Geometry may be added; the constituent linework will be extracted and used

public void Add(Geometry g)

Parameters

g Geometry

A Geometry with linework to be polygonized.

Add(ICollection<Geometry>)

Adds a collection of Geometrys to be polygonized. May be called multiple times. Any dimension of Geometry may be added; the constituent linework will be extracted and used.

public void Add(ICollection<Geometry> geomList)

Parameters

geomList ICollection<Geometry>

A list of Geometrys with linework to be polygonized.

GetCutEdges()

Gets the list of cut edges found during polygonization.

public ICollection<LineString> GetCutEdges()

Returns

ICollection<LineString>

GetDangles()

Gets the list of dangling lines found during polygonization.

public ICollection<LineString> GetDangles()

Returns

ICollection<LineString>

GetGeometry()

Gets a geometry representing the polygons formed by the polygonization. If a valid polygonal geometry was extracted the result is a IPolygonal geometry.

public Geometry GetGeometry()

Returns

Geometry

A geometry containing the polygons

GetInvalidRingLines()

Gets the list of lines forming invalid rings found during polygonization.

public IList<Geometry> GetInvalidRingLines()

Returns

IList<Geometry>

GetPolygons()

Gets the list of polygons formed by the polygonization.

public ICollection<Geometry> GetPolygons()

Returns

ICollection<Geometry>