## com.vividsolutions.jts.noding
Class NodedSegmentString

    java.lang.Object
      com.vividsolutions.jts.noding.NodedSegmentString

All Implemented Interfaces:
  NodableSegmentString, SegmentString

public class NodedSegmentString
extends java.lang.Object
implements NodableSegmentString

Represents a list of contiguous line segments, and supports noding the segments. The line segments are represented by an array of `Coordinate`s. Intended to optimize the noding of contiguous segments by reducing the number of allocated objects. SegmentStrings can carry a context object, which is useful for preserving topological or parentage information. All noded substrings are initialized with the same context object.

Version:
  1.7

Constructor Summary
`NodedSegmentString(Coordinate[] pts, java.lang.Object data)` Creates a new segment string from a list of vertices.

Method Summary
`void` `addIntersection(Coordinate intPt, int segmentIndex)` Adds an intersection node for a given point and segment to this segment string.
`void` `addIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex)` Add an SegmentNode for intersection intIndex.
`SegmentNode` `addIntersectionNode(Coordinate intPt, int segmentIndex)` Adds an intersection node for a given point and segment to this segment string.
`void` `addIntersections(LineIntersector li, int segmentIndex, int geomIndex)` Adds EdgeIntersections for one or both intersections found for a segment of an edge to the edge intersection list.
`Coordinate` `getCoordinate(int i)`
`Coordinate[]` `getCoordinates()`
`java.lang.Object` `getData()` Gets the user-defined data for this segment string.
`static java.util.List` `getNodedSubstrings(java.util.Collection segStrings)`
`static void` `getNodedSubstrings(java.util.Collection segStrings, java.util.Collection resultEdgelist)`
`SegmentNodeList` `getNodeList()`
`int` `getSegmentOctant(int index)` Gets the octant of the segment starting at vertex `index`.
`boolean` `isClosed()`
`void` `setData(java.lang.Object data)` Sets the user-defined data for this segment string.
`int` `size()`
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NodedSegmentString

    public NodedSegmentString(Coordinate[] pts,
                              java.lang.Object data)

  Creates a new segment string from a list of vertices.

Parameters:
  `pts` - the vertices of the segment string
  `data` - the user-defined data of this segment string (may be null)

Method Detail

### getNodedSubstrings

    public static java.util.List getNodedSubstrings(java.util.Collection segStrings)

  Parameters:
    `segStrings` - a Collection of NodedSegmentStrings
  Returns:
    a Collection of NodedSegmentStrings representing the substrings

### getNodedSubstrings

    public static void getNodedSubstrings(java.util.Collection segStrings,
                                          java.util.Collection resultEdgelist)

  Parameters:
    `segStrings` - a Collection of NodedSegmentStrings
    `resultEdgelist` - a List which will collect the NodedSegmentStrings representing the substrings

### getData

    public java.lang.Object getData()

  Gets the user-defined data for this segment string.

  Specified by:
    `getData` in interface `SegmentString`
  Returns:
    the user-defined data

### setData

    public void setData(java.lang.Object data)

  Sets the user-defined data for this segment string.

  Specified by:
    `setData` in interface `SegmentString`
  Parameters:
    `data` - an Object containing user-defined data

### getNodeList

    public SegmentNodeList getNodeList()

### size

    public int size()

  Specified by:
    `size` in interface `SegmentString`

### getCoordinate

    public Coordinate getCoordinate(int i)

  Specified by:
    `getCoordinate` in interface `SegmentString`

### getCoordinates

    public Coordinate[] getCoordinates()

  Specified by:
    `getCoordinates` in interface `SegmentString`

### isClosed

    public boolean isClosed()

  Specified by:
    `isClosed` in interface `SegmentString`

### getSegmentOctant

    public int getSegmentOctant(int index)

  Gets the octant of the segment starting at vertex `index`.

  Parameters:
    `index` - the index of the vertex starting the segment. Must not be the last index in the vertex list
  Returns:
    the octant of the segment at the vertex

### addIntersections

    public void addIntersections(LineIntersector li,
                                 int segmentIndex,
                                 int geomIndex)

  Adds EdgeIntersections for one or both intersections found for a segment of an edge to the edge intersection list.

### addIntersection

    public void addIntersection(LineIntersector li,
                                int segmentIndex,
                                int geomIndex,
                                int intIndex)

  Add an SegmentNode for intersection intIndex. An intersection that falls exactly on a vertex of the SegmentString is normalized to use the higher of the two possible segmentIndexes

### addIntersection

    public void addIntersection(Coordinate intPt,
                                int segmentIndex)

  Adds an intersection node for a given point and segment to this segment string.

  Specified by:
    `addIntersection` in interface `NodableSegmentString`
  Parameters:
    `intPt` - the location of the intersection
    `segmentIndex` - the index of the segment containing the intersection

### addIntersectionNode

    public SegmentNode addIntersectionNode(Coordinate intPt,
                                           int segmentIndex)

  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.

  Parameters:
    `intPt` - the location of the intersection
    `segmentIndex` - the index of the segment containing the intersection
  Returns:
    the intersection node for the point

### toString

    public java.lang.String toString()