org.geotools.renderer.label
Class LineStringCursor

Object
  extended by LineStringCursor

public class LineStringCursor
extends 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
Module:
modules/library/render (gt-render.jar)

Constructor Summary
LineStringCursor(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()
           
 Coordinate getCurrentPosition()
          Returns the Point representing the current position along the LineString
 Coordinate getCurrentPosition(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
 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)
           
 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineStringCursor

public LineStringCursor(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 Coordinate getCurrentPosition()
Returns the Point representing the current position along the LineString


getCurrentPosition

public Coordinate getCurrentPosition(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 LineString getLineString()
The linestrings wrapped by this cursor

Returns:

getSubLineString

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

Parameters:
startOrdinate -
endOrdinate -
Returns:


Copyright © 1996-2009 Geotools. All Rights Reserved.