org.geotools.renderer.label
Class LineStringCursor

java.lang.Object
  extended by org.geotools.renderer.label.LineStringCursor

public class LineStringCursor
extends java.lang.Object

Allows to move a point cursor along the path of a LineString using a curvilinear coordinate system and either absolute distances (from the start of the line) or offsets relative to the current position, to return the absolute position of the cursor as a Point, and to get the orientation of the current segment.

Author:
Andrea Aime

Constructor Summary
LineStringCursor(com.vividsolutions.jts.geom.LineString ls)
          Builds a new cursor
LineStringCursor(LineStringCursor cursor)
          Copy constructor
 
Method Summary
 double getCurrentAngle()
          Returns the current segment direction as an angle expressed in radians
 double getCurrentOrdinate()
           
 com.vividsolutions.jts.geom.Coordinate getCurrentPosition()
          Returns the Point representing the current position along the LineString
 com.vividsolutions.jts.geom.Coordinate getCurrentPosition(com.vividsolutions.jts.geom.Coordinate c)
          Returns the Point representing the current position along the LineString
 double getLabelOrientation()
          Returns the current segment direction as an angle expressed in radians
 com.vividsolutions.jts.geom.LineString getLineString()
          The linestrings wrapped by this cursor
 double getLineStringLength()
          Returns the line string length
 double getMaxAngleChange(double startOrdinate, double endOrdinate)
          Returns the maximum angle change (in radians) between two subsequent segments between the specified curvilinear coordinates.
protected  double getSegmentAngle(int segmentIdx)
           
 com.vividsolutions.jts.geom.LineString getSubLineString(double startOrdinate, double endOrdinate)
          Returns the linestring that starts and ends at the specified curvilinear coordinates.
 boolean moveRelative(double offset)
          Moves of the specified distance from the current position.
 void moveTo(double ordinate)
          Moves the current position to the
 LineStringCursor reverse()
          Returns a line string cursor based on the opposite walking direction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineStringCursor

public LineStringCursor(com.vividsolutions.jts.geom.LineString ls)
Builds a new cursor

Parameters:
ls -

LineStringCursor

public LineStringCursor(LineStringCursor cursor)
Copy constructor

Parameters:
cursor -
Method Detail

getLineStringLength

public double getLineStringLength()
Returns the line string length

Returns:

moveTo

public void moveTo(double ordinate)
Moves the current position to the

Parameters:
ordinate -

moveRelative

public boolean moveRelative(double offset)
Moves of the specified distance from the current position.

Parameters:
offset -
Returns:
true if it was possible to move to the desired offset, false if the movement stopped because the start or end of the LineString was reached

getCurrentPosition

public com.vividsolutions.jts.geom.Coordinate getCurrentPosition()
Returns the Point representing the current position along the LineString


getCurrentPosition

public com.vividsolutions.jts.geom.Coordinate getCurrentPosition(com.vividsolutions.jts.geom.Coordinate c)
Returns the Point representing the current position along the LineString


getCurrentOrdinate

public double getCurrentOrdinate()

getCurrentAngle

public double getCurrentAngle()
Returns the current segment direction as an angle expressed in radians

Returns:

getSegmentAngle

protected double getSegmentAngle(int segmentIdx)

getLabelOrientation

public double getLabelOrientation()
Returns the current segment direction as an angle expressed in radians

Returns:

getMaxAngleChange

public double getMaxAngleChange(double startOrdinate,
                                double endOrdinate)
Returns the maximum angle change (in radians) between two subsequent segments between the specified curvilinear coordinates.

Parameters:
startOrdinate -
endOrdinate -
Returns:

reverse

public LineStringCursor reverse()
Returns a line string cursor based on the opposite walking direction.

Returns:

getLineString

public com.vividsolutions.jts.geom.LineString getLineString()
The linestrings wrapped by this cursor

Returns:

getSubLineString

public com.vividsolutions.jts.geom.LineString getSubLineString(double startOrdinate,
                                                               double endOrdinate)
Returns the linestring that starts and ends at the specified curvilinear coordinates.

Parameters:
startOrdinate -
endOrdinate -
Returns:


Copyright © 1996-2010 Geotools. All Rights Reserved.