Class NodedSegmentString
Represents a list of contiguous line segments, and supports noding the segments. The line segments are represented by an array of Coordinates. Intended to optimize the noding of contiguous segments by reducing the number of allocated objects. ISegmentStrings can carry a context object, which is useful for preserving topological or parentage information. All noded substrings are initialized with the same context object.
For read-only applications use BasicSegmentString, which is (slightly)more lightweight.Inherited Members
Namespace: NetTopologySuite.Noding
Assembly: NetTopologySuite.dll
Syntax
public class NodedSegmentString : INodableSegmentString, ISegmentString
Constructors
| Edit this page View SourceNodedSegmentString(Coordinate[], object)
Creates an instance from a list of vertices and optional data object.
Declaration
public NodedSegmentString(Coordinate[] pts, object context)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate[] | pts | The vertices of the segment string. |
| object | context | The user-defined data of this segment string (may be null). |
NodedSegmentString(ISegmentString)
Creates a new instance from a ISegmentString.
Declaration
public NodedSegmentString(ISegmentString ss)
Parameters
| Type | Name | Description |
|---|---|---|
| ISegmentString | ss | The segment string to use. |
Properties
| Edit this page View SourceContext
Gets/Sets the user-defined data for this segment string.
Declaration
public object Context { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
Remarks
In JTS this property is called Data
Coordinates
Declaration
public Coordinate[] Coordinates { get; }
Property Value
| Type | Description |
|---|---|
| Coordinate[] |
Count
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
HasNodes
Gets a value indicating if any nodes have been added.
Declaration
public bool HasNodes { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsClosed
Declaration
public bool IsClosed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
this[int]
Declaration
public LineSegment this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Property Value
| Type | Description |
|---|---|
| LineSegment |
NodeList
Declaration
public SegmentNodeList NodeList { get; }
Property Value
| Type | Description |
|---|---|
| SegmentNodeList |
NodedCoordinates
Gets a list of coordinates with all nodes included.
Declaration
public Coordinate[] NodedCoordinates { get; }
Property Value
| Type | Description |
|---|---|
| Coordinate[] | An array of coordinates including nodes |
Methods
| Edit this page View SourceAddIntersection(LineIntersector, int, int, int)
Add an SegmentNode for intersection intIndex. An intersection that falls exactly on a vertex of the NodedSegmentString is normalized to use the higher of the two possible segmentIndexes.
Declaration
public void AddIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| LineIntersector | li | |
| int | segmentIndex | |
| int | geomIndex | |
| int | intIndex |
AddIntersection(Coordinate, int)
Declaration
public void AddIntersection(Coordinate intPt, int segmentIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | intPt | |
| int | segmentIndex |
AddIntersectionNode(Coordinate, int)
Adds an intersection node for a given point and segment to this segment string. If an intersection already exists for this exact location, the existing node will be returned.
Declaration
public SegmentNode AddIntersectionNode(Coordinate intPt, int segmentIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | intPt | The location of the intersection |
| int | segmentIndex | The index of the segment containing the intersection |
Returns
| Type | Description |
|---|---|
| SegmentNode | the intersection node for the point |
AddIntersections(LineIntersector, int, int)
Adds EdgeIntersections for one or both intersections found for a segment of an edge to the edge intersection list.
Declaration
public void AddIntersections(LineIntersector li, int segmentIndex, int geomIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| LineIntersector | li | |
| int | segmentIndex | |
| int | geomIndex |
GetCoordinate(int)
Declaration
public Coordinate GetCoordinate(int i)
Parameters
| Type | Name | Description |
|---|---|---|
| int | i |
Returns
| Type | Description |
|---|---|
| Coordinate |
GetNodedSubstrings(IEnumerable<ISegmentString>)
Gets the ISegmentStrings which result from splitting this string at node points.
Declaration
public static ReadOnlyCollection<ISegmentString> GetNodedSubstrings(IEnumerable<ISegmentString> segStrings)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ISegmentString> | segStrings | A collection of NodedSegmentStrings |
Returns
| Type | Description |
|---|---|
| ReadOnlyCollection<ISegmentString> | A collection of NodedSegmentStrings representing the substrings |
GetNodedSubstrings(IEnumerable<ISegmentString>, ICollection<ISegmentString>)
Adds the noded ISegmentStrings which result from splitting this string at node points.
Declaration
public static void GetNodedSubstrings(IEnumerable<ISegmentString> segStrings, ICollection<ISegmentString> resultEdgelist)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ISegmentString> | segStrings | A collection of NodedSegmentStrings |
| ICollection<ISegmentString> | resultEdgelist | A list which will collect the NodedSegmentStrings representing the substrings |
GetSegmentOctant(int)
Gets the octant of the segment starting at vertex index.
Declaration
public Octants GetSegmentOctant(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index of the vertex starting the segment. Must not be the last index in the vertex list |
Returns
| Type | Description |
|---|---|
| Octants | The octant of the segment at the vertex |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |