org.geotools.geometry.iso.coordinate
Class PointArrayImpl

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<org.opengis.geometry.coordinate.Position>
              extended by org.geotools.geometry.iso.coordinate.PointArrayImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<org.opengis.geometry.coordinate.Position>, java.util.Collection<org.opengis.geometry.coordinate.Position>, java.util.List<org.opengis.geometry.coordinate.Position>, java.util.RandomAccess, org.opengis.geometry.coordinate.PointArray

public class PointArrayImpl
extends java.util.ArrayList<org.opengis.geometry.coordinate.Position>
implements org.opengis.geometry.coordinate.PointArray

Many of the geometric constructs in this International Standard require the use of reference points which are organized into sequences or grids (sequences of equal length sequences). PointArray::column[1..n] : Position PointGrid::row[1..n] : PointArray The class name follows the ISO19107. It is a confusing name, since it contains an array of positions and not of points. The positions themselves contain either a direct position or a point.

Author:
Jackson Roehrig & Sanjay Jena
See Also:
Serialized Form

Nested Class Summary
 class PointArrayImpl.LineSegmentsSequence
          Class to support on-the-fly generation of LineSegments
 
Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
PointArrayImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
          Please add content; according to ISO 19117 an empty PointArray cannot exist.
PointArrayImpl(org.opengis.geometry.DirectPosition p1, org.opengis.geometry.DirectPosition p2)
           
PointArrayImpl(java.util.List<org.opengis.geometry.coordinate.Position> positions)
          Construct a new PointArray.
PointArrayImpl(org.opengis.geometry.coordinate.PointArray aPointArray)
          Creates a new PointArray based on another PointArray.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 double[] getCoordinate(int index)
          Returns the coordiantes of the Position at index
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
           
 int getDimension()
           
 org.opengis.geometry.DirectPosition getDirectPosition(int index, org.opengis.geometry.DirectPosition dest)
           
 double getDistanceSum()
          Creates the absolute length over all points in point array
 EnvelopeImpl getEnvelope()
          Creates an envelope for all points in point array
 org.opengis.geometry.coordinate.Position getFirst()
          Returns the first element
 org.opengis.geometry.coordinate.Position getLast()
          Returns the last element
 java.util.List<? extends org.opengis.geometry.coordinate.LineSegment> getLineSegments(CurveImpl parentCurve)
          Creates a LineSegment connecting the Positins p0 and p1, whereas p0 is the position at arg0 and p1 is the position at (arg0+1).
 java.util.List<org.opengis.geometry.coordinate.Position> getPointArray()
          Returns the Point array as Set of Position
 org.opengis.geometry.coordinate.Position getPosition(int index)
          Gets the position at index
 org.opengis.geometry.DirectPosition getPosition(int col, org.opengis.geometry.DirectPosition dest)
           
 int hashCode()
           
 int length()
           
 void merge(double minSpacing)
           
 java.util.List positions()
           
 boolean removePosition(org.opengis.geometry.coordinate.Position p)
          Removes the first occurrence of this position from the PointArray
 void set(int index, double[] coord)
          Sets the Coordinates of the Position at index in the PointArray
 void setDirectPosition(int index, org.opengis.geometry.DirectPosition position)
           
 void setPosition(int index, org.opengis.geometry.DirectPosition position)
           
 void split(double maxSpacing)
          This method splits the sequence of positions according to a maximum distance.
 java.lang.String toString()
           
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractCollection
containsAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Constructor Detail

PointArrayImpl

public PointArrayImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Please add content; according to ISO 19117 an empty PointArray cannot exist.

Parameters:
crs -

PointArrayImpl

public PointArrayImpl(org.opengis.geometry.DirectPosition p1,
                      org.opengis.geometry.DirectPosition p2)

PointArrayImpl

public PointArrayImpl(org.opengis.geometry.coordinate.PointArray aPointArray)
Creates a new PointArray based on another PointArray. This constructor creates new Position objects.

Parameters:
aPointArray -

PointArrayImpl

public PointArrayImpl(java.util.List<org.opengis.geometry.coordinate.Position> positions)
Construct a new PointArray. This constructor does not create new position objects.

Parameters:
positions -
Method Detail

getPointArray

public java.util.List<org.opengis.geometry.coordinate.Position> getPointArray()
Returns the Point array as Set of Position

Returns:
the positions

getCoordinate

public double[] getCoordinate(int index)
Returns the coordiantes of the Position at index

Parameters:
arg0 -
Returns:
double[]

getPosition

public org.opengis.geometry.coordinate.Position getPosition(int index)
Gets the position at index

Parameters:
arg0 -
Returns:
PositionImpl

getFirst

public org.opengis.geometry.coordinate.Position getFirst()
Returns the first element

Returns:
Position

getLast

public org.opengis.geometry.coordinate.Position getLast()
Returns the last element

Returns:
Position

length

public int length()
Specified by:
length in interface org.opengis.geometry.coordinate.PointArray

getDistanceSum

public double getDistanceSum()
Creates the absolute length over all points in point array

Returns:
absolute length over all points in point array

getEnvelope

public EnvelopeImpl getEnvelope()
Creates an envelope for all points in point array

Returns:
envelope for all points in point array

removePosition

public boolean removePosition(org.opengis.geometry.coordinate.Position p)
Removes the first occurrence of this position from the PointArray

Parameters:
p -
Returns:
boolean TRUE, if the Remove was successful

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection<org.opengis.geometry.coordinate.Position>

getCoordinateReferenceSystem

public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Specified by:
getCoordinateReferenceSystem in interface org.opengis.geometry.coordinate.PointArray

getPosition

public org.opengis.geometry.DirectPosition getPosition(int col,
                                                       org.opengis.geometry.DirectPosition dest)
                                                throws java.lang.IndexOutOfBoundsException
Throws:
java.lang.IndexOutOfBoundsException

setPosition

public void setPosition(int index,
                        org.opengis.geometry.DirectPosition position)
                 throws java.lang.IndexOutOfBoundsException,
                        java.lang.UnsupportedOperationException
Throws:
java.lang.IndexOutOfBoundsException
java.lang.UnsupportedOperationException

set

public void set(int index,
                double[] coord)
Sets the Coordinates of the Position at index in the PointArray

Parameters:
index -
coord -

positions

public java.util.List positions()
Specified by:
positions in interface org.opengis.geometry.coordinate.PointArray

merge

public void merge(double minSpacing)
Parameters:
minSpacing -

split

public void split(double maxSpacing)
This method splits the sequence of positions according to a maximum distance. After splitting the distance between two positions will be maxSpacing or less. The length and shape of the LineString will not be changed.

Parameters:
maxSpacing -

getLineSegments

public java.util.List<? extends org.opengis.geometry.coordinate.LineSegment> getLineSegments(CurveImpl parentCurve)
Creates a LineSegment connecting the Positins p0 and p1, whereas p0 is the position at arg0 and p1 is the position at (arg0+1). If (arg0+1) == size() then returns the LineSegment connecting the last position with the first one

Returns:
List

getDimension

public int getDimension()
Specified by:
getDimension in interface org.opengis.geometry.coordinate.PointArray

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<org.opengis.geometry.coordinate.Position>
Specified by:
hashCode in interface java.util.List<org.opengis.geometry.coordinate.Position>
Overrides:
hashCode in class java.util.AbstractList<org.opengis.geometry.coordinate.Position>

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Collection<org.opengis.geometry.coordinate.Position>
Specified by:
equals in interface java.util.List<org.opengis.geometry.coordinate.Position>
Overrides:
equals in class java.util.AbstractList<org.opengis.geometry.coordinate.Position>

getDirectPosition

public org.opengis.geometry.DirectPosition getDirectPosition(int index,
                                                             org.opengis.geometry.DirectPosition dest)
                                                      throws java.lang.IndexOutOfBoundsException
Specified by:
getDirectPosition in interface org.opengis.geometry.coordinate.PointArray
Throws:
java.lang.IndexOutOfBoundsException

setDirectPosition

public void setDirectPosition(int index,
                              org.opengis.geometry.DirectPosition position)
                       throws java.lang.IndexOutOfBoundsException,
                              java.lang.UnsupportedOperationException
Specified by:
setDirectPosition in interface org.opengis.geometry.coordinate.PointArray
Throws:
java.lang.IndexOutOfBoundsException
java.lang.UnsupportedOperationException


Copyright © 1996-2010 Geotools. All Rights Reserved.