org.geotools.geometry.iso.coordinate
Class DoublePointArray

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

public class DoublePointArray
extends java.util.AbstractList<org.opengis.geometry.coordinate.Position>
implements org.opengis.geometry.coordinate.PointArray, java.io.Serializable

This implementation is a "fast" wrapper over top of a double array.

The returned DirectPositions are pure wrappers over top of the array. The number of ordinates used per each DirectPosition is based on the CRS. We start counting from the start position, in order to do subList efficiently.

Author:
Jody
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DoublePointArray(org.opengis.referencing.crs.CoordinateReferenceSystem crs, double[] array)
           
DoublePointArray(org.opengis.referencing.crs.CoordinateReferenceSystem crs, double[] array, int start, int end)
           
 
Method Summary
 boolean equals(DoublePointArray dpArray, double tol)
          Compares coodinates of DoublePointArray and allows a tolerance value in the comparison.
 boolean equals(java.lang.Object obj)
           
 org.opengis.geometry.DirectPosition get(int index)
           
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
           
 int getDimension()
           
 org.opengis.geometry.DirectPosition getDirectPosition(int index, org.opengis.geometry.DirectPosition dest)
           
 org.opengis.geometry.DirectPosition getPosition(int index, org.opengis.geometry.DirectPosition position)
           
 int hashCode()
           
 int length()
           
 java.util.List<org.opengis.geometry.coordinate.Position> positions()
           
 org.opengis.geometry.coordinate.Position set(int index, org.opengis.geometry.coordinate.Position element)
           
 void setDirectPosition(int index, org.opengis.geometry.DirectPosition position)
           
 void setPosition(int index, org.opengis.geometry.DirectPosition position)
           
 int size()
           
 java.util.List<org.opengis.geometry.coordinate.Position> subList(int fromIndex, int toIndex)
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

DoublePointArray

public DoublePointArray(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                        double[] array)

DoublePointArray

public DoublePointArray(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                        double[] array,
                        int start,
                        int end)
Method Detail

subList

public java.util.List<org.opengis.geometry.coordinate.Position> subList(int fromIndex,
                                                                        int toIndex)
Specified by:
subList in interface java.util.List<org.opengis.geometry.coordinate.Position>
Overrides:
subList in class java.util.AbstractList<org.opengis.geometry.coordinate.Position>

get

public org.opengis.geometry.DirectPosition get(int index)
Specified by:
get in interface java.util.List<org.opengis.geometry.coordinate.Position>
Specified by:
get in class java.util.AbstractList<org.opengis.geometry.coordinate.Position>

set

public org.opengis.geometry.coordinate.Position set(int index,
                                                    org.opengis.geometry.coordinate.Position element)
Specified by:
set in interface java.util.List<org.opengis.geometry.coordinate.Position>
Overrides:
set in class java.util.AbstractList<org.opengis.geometry.coordinate.Position>

size

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

getPosition

public org.opengis.geometry.DirectPosition getPosition(int index,
                                                       org.opengis.geometry.DirectPosition position)
                                                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

getCoordinateReferenceSystem

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

getDimension

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

length

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

positions

public java.util.List<org.opengis.geometry.coordinate.Position> positions()
Specified by:
positions 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>

equals

public boolean equals(DoublePointArray dpArray,
                      double tol)
Compares coodinates of DoublePointArray and allows a tolerance value in the comparison.

Parameters:
dpArray - Direct Position to compare with
tol - Epsilon tolerance value
Returns:
TRUE, if coordinates accord concording to the tolerance value, FALSE if they dont.

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.