com.vividsolutions.jump.algorithm
Class LocatePoint

java.lang.Object
  extended by com.vividsolutions.jump.algorithm.LocatePoint

public class LocatePoint
extends java.lang.Object

Provides various ways of computing the actual value of a point a given length along a line.


Constructor Summary
LocatePoint(com.vividsolutions.jts.geom.LineString line, double length)
           
 
Method Summary
 int getIndex()
          Returns the index of the segment containing the computed point
 com.vividsolutions.jts.geom.Coordinate getPoint()
           
static com.vividsolutions.jts.geom.Coordinate pointAlongLine(com.vividsolutions.jts.geom.LineString line, double length)
          Computes the Coordinate of the point a given length along a LineString.
static com.vividsolutions.jts.geom.Coordinate pointAlongSegment(com.vividsolutions.jts.geom.Coordinate p0, com.vividsolutions.jts.geom.Coordinate p1, double length)
          Computes the location of a point a given length along a line segment.
static com.vividsolutions.jts.geom.Coordinate pointAlongSegment(com.vividsolutions.jts.geom.LineSegment seg, double length)
          Computes the location of a point a given length along a LineSegment.
static com.vividsolutions.jts.geom.Coordinate pointAlongSegmentByFraction(com.vividsolutions.jts.geom.Coordinate p0, com.vividsolutions.jts.geom.Coordinate p1, double frac)
          Computes the location of a point a given length along a line segment.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocatePoint

public LocatePoint(com.vividsolutions.jts.geom.LineString line,
                   double length)
Method Detail

pointAlongSegment

public static com.vividsolutions.jts.geom.Coordinate pointAlongSegment(com.vividsolutions.jts.geom.LineSegment seg,
                                                                       double length)
Computes the location of a point a given length along a LineSegment. If the length exceeds the length of the line segment the last point of the segment is returned. If the length is negative the first point of the segment is returned.

Parameters:
seg - the line segment
length - the length to the desired point
Returns:
the Coordinate of the desired point

pointAlongSegment

public static com.vividsolutions.jts.geom.Coordinate pointAlongSegment(com.vividsolutions.jts.geom.Coordinate p0,
                                                                       com.vividsolutions.jts.geom.Coordinate p1,
                                                                       double length)
Computes the location of a point a given length along a line segment. If the length exceeds the length of the line segment the last point of the segment is returned. If the length is negative the first point of the segment is returned.

Parameters:
p0 - the first point of the line segment
p1 - the last point of the line segment
length - the length to the desired point
Returns:
the Coordinate of the desired point

pointAlongSegmentByFraction

public static com.vividsolutions.jts.geom.Coordinate pointAlongSegmentByFraction(com.vividsolutions.jts.geom.Coordinate p0,
                                                                                 com.vividsolutions.jts.geom.Coordinate p1,
                                                                                 double frac)
Computes the location of a point a given length along a line segment. If the length exceeds the length of the line segment the last point of the segment is returned. If the length is negative the first point of the segment is returned.

Parameters:
p0 - the first point of the line segment
p1 - the last point of the line segment
length - the length to the desired point
Returns:
the Coordinate of the desired point

pointAlongLine

public static com.vividsolutions.jts.geom.Coordinate pointAlongLine(com.vividsolutions.jts.geom.LineString line,
                                                                    double length)
Computes the Coordinate of the point a given length along a LineString.

Parameters:
line -
length -
Returns:

getPoint

public com.vividsolutions.jts.geom.Coordinate getPoint()

getIndex

public int getIndex()
Returns the index of the segment containing the computed point