org.deegree_impl.graphics.displayelements
Class CurveWalker

java.lang.Object
  extended byorg.deegree_impl.graphics.displayelements.CurveWalker

public class CurveWalker
extends java.lang.Object

Walks along the given GM_Curve and generates positions on the line string in regular intervals (i.e. with the same distance).

Version:
$Revision: 1.2 $ $Date: 2004/05/14 07:45:44 $
Author:
Field Summary
private  int maxX
           
private  int maxY
           
private  int minX
           
private  int minY
           
 
Constructor Summary
CurveWalker(java.awt.Rectangle bounds)
           
 
Method Summary
 double[] calcDeviation(int[] start, int[] end, java.util.List points)
          Calculates the maximum deviation that points on a linestring have to the ideal line between the starting point and the end point.
 java.util.ArrayList createPositions(int[][] pos, double width)
          Determines positions on the given GM_Curve where a caption could be drawn.
static int[] findPointWithDistance(int[] p0, int[] p1, int[] p2, int d)
          Finds a point on the line between p1 and p2 that has a certain distance from point p0 (provided that there is such a point).
 double getDistance(double x1, double y1, double x2, double y2)
           
 double getDistance(int[] p1, int[] p2)
           
 double getRotation(double x1, double y1, double x2, double y2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minX

private int minX

minY

private int minY

maxX

private int maxX

maxY

private int maxY
Constructor Detail

CurveWalker

public CurveWalker(java.awt.Rectangle bounds)
Method Detail

createPositions

public java.util.ArrayList createPositions(int[][] pos,
                                           double width)
Determines positions on the given GM_Curve where a caption could be drawn. For each of this positons, three candidates are produced; one on the line, one above of it and one below.

Parameters:
pos -
Returns:
ArrayList containing Arrays of Label-objects

calcDeviation

public double[] calcDeviation(int[] start,
                              int[] end,
                              java.util.List points)
Calculates the maximum deviation that points on a linestring have to the ideal line between the starting point and the end point.

The ideal line is thought to be running from left to right, the left deviation value generally is above the line, the right value is below.

Parameters:
start - starting point of the linestring
end - end point of the linestring
points - points in between
Returns:

findPointWithDistance

public static int[] findPointWithDistance(int[] p0,
                                          int[] p1,
                                          int[] p2,
                                          int d)
Finds a point on the line between p1 and p2 that has a certain distance from point p0 (provided that there is such a point).

Parameters:
p0 - point that is used as reference point for the distance
p1 - starting point of the line
p2 - end point of the line
d - distance
Returns:

getRotation

public double getRotation(double x1,
                          double y1,
                          double x2,
                          double y2)

getDistance

public double getDistance(int[] p1,
                          int[] p2)

getDistance

public double getDistance(double x1,
                          double y1,
                          double x2,
                          double y2)