JTS Topology Suite version 1.12

com.vividsolutions.jts.geom
Class CoordinateSequences

java.lang.Object
  extended by com.vividsolutions.jts.geom.CoordinateSequences

public class CoordinateSequences
extends java.lang.Object

Utility functions for manipulating CoordinateSequences

Version:
1.7

Constructor Summary
CoordinateSequences()
           
 
Method Summary
static void copy(CoordinateSequence src, int srcPos, CoordinateSequence dest, int destPos, int length)
          Copies a section of a CoordinateSequence to another CoordinateSequence.
static void copyCoord(CoordinateSequence src, int srcPos, CoordinateSequence dest, int destPos)
          Copies a coordinate of a CoordinateSequence to another CoordinateSequence.
static CoordinateSequence ensureValidRing(CoordinateSequenceFactory fact, CoordinateSequence seq)
          Ensures that a CoordinateSequence forms a valid ring, returning a new closed sequence of the correct length if required.
static boolean isRing(CoordinateSequence seq)
          Tests whether a CoordinateSequence forms a valid LinearRing, by checking the sequence length and closure (whether the first and last points are identical in 2D).
static void reverse(CoordinateSequence seq)
          Reverses the coordinates in a sequence in-place.
static void swap(CoordinateSequence seq, int i, int j)
          Swaps two coordinates in a sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoordinateSequences

public CoordinateSequences()
Method Detail

reverse

public static void reverse(CoordinateSequence seq)
Reverses the coordinates in a sequence in-place.


swap

public static void swap(CoordinateSequence seq,
                        int i,
                        int j)
Swaps two coordinates in a sequence.

Parameters:
seq -
i -
j -

copy

public static void copy(CoordinateSequence src,
                        int srcPos,
                        CoordinateSequence dest,
                        int destPos,
                        int length)
Copies a section of a CoordinateSequence to another CoordinateSequence. The sequences must have the same dimension.

Parameters:
src -
srcPos -
dest -
destPos -
length -

copyCoord

public static void copyCoord(CoordinateSequence src,
                             int srcPos,
                             CoordinateSequence dest,
                             int destPos)
Copies a coordinate of a CoordinateSequence to another CoordinateSequence. The sequences must have the same dimension.

Parameters:
src -
srcPos -
dest -
destPos -

isRing

public static boolean isRing(CoordinateSequence seq)
Tests whether a CoordinateSequence forms a valid LinearRing, by checking the sequence length and closure (whether the first and last points are identical in 2D). Self-intersection is not checked.

Parameters:
seq - the sequence to test
Returns:
true if the sequence is a ring
See Also:
LinearRing

ensureValidRing

public static CoordinateSequence ensureValidRing(CoordinateSequenceFactory fact,
                                                 CoordinateSequence seq)
Ensures that a CoordinateSequence forms a valid ring, returning a new closed sequence of the correct length if required. If the input sequence is already a valid ring, it is returned without modification. If the input sequence is too short or is not closed, it is extended with one or more copies of the start point.

Parameters:
fact - the CoordinateSequenceFactory to use to create the new sequence
seq - the sequence to test
Returns:
the original sequence, if it was a valid ring, or a new sequence which is valid.

JTS Topology Suite version 1.12