net.surveyos.sourceforge.jtswarped.utilities.coordinatefilters
Class DistancesBetweenCoordinatesFilter

java.lang.Object
  extended by net.surveyos.sourceforge.jtswarped.utilities.coordinatefilters.DistancesBetweenCoordinatesFilter
All Implemented Interfaces:
com.vividsolutions.jts.geom.CoordinateFilter

public class DistancesBetweenCoordinatesFilter
extends java.lang.Object
implements com.vividsolutions.jts.geom.CoordinateFilter

Provides an implementation of the CoordinateFilter interface that calculates and stored the horizontal distance from each Coordinate the filter is applied to to a predetermined Coordinate. These distances can then be retrieved in a Collection using the getDistances method of this object.


Constructor Summary
DistancesBetweenCoordinatesFilter(com.vividsolutions.jts.geom.Coordinate argDistancesTo)
          Creates a new DistancesBetweenCoordinatesFilter.
 
Method Summary
 void clearDistances()
          Clears the distances collected in this object.
 void filter(com.vividsolutions.jts.geom.Coordinate argCoordinate)
          Calculates the distance from the Coordinate passed as an argument to the predetermined Coordinate set in this object with the setDistanceToCoordinate.
 java.util.Collection getDistances()
          Returns a collection with the distances from the predetermined Coordinate to all the Coordinates this filter was applied to.
 void setDistanceToCoordinate(com.vividsolutions.jts.geom.Coordinate argCoordinate)
          Sets the Coordinate object to calculate distances to.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistancesBetweenCoordinatesFilter

public DistancesBetweenCoordinatesFilter(com.vividsolutions.jts.geom.Coordinate argDistancesTo)
Creates a new DistancesBetweenCoordinatesFilter. Distances will be calculated between Coordinates visited by the filter and the coordinate passed as an argument to this constructor. To calculate a distance to another Coordinate object, use the setDistanceToCoordinate method in this object.

Method Detail

filter

public void filter(com.vividsolutions.jts.geom.Coordinate argCoordinate)
Calculates the distance from the Coordinate passed as an argument to the predetermined Coordinate set in this object with the setDistanceToCoordinate.

Specified by:
filter in interface com.vividsolutions.jts.geom.CoordinateFilter

setDistanceToCoordinate

public void setDistanceToCoordinate(com.vividsolutions.jts.geom.Coordinate argCoordinate)
Sets the Coordinate object to calculate distances to. This will replace the Coordinate object set in the constructor of this object.


getDistances

public java.util.Collection getDistances()
Returns a collection with the distances from the predetermined Coordinate to all the Coordinates this filter was applied to. The distances will be returned in the order of visit by the filter. (The last distance in the Collection will be from the last Coordinate visited.)


clearDistances

public void clearDistances()
Clears the distances collected in this object. immediately after this method call the getDistances method in this object will return an empty Collection.