deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.framework.util
Class GeometryUtils

java.lang.Object
  extended by org.deegree.framework.util.GeometryUtils

public class GeometryUtils
extends java.lang.Object

Version:
$Revision: 6251 $, $Date: 2007-03-19 16:59:28 +0100 (Mo, 19 Mrz 2007) $
Author:
Andreas Poth, last edited by: $Author: poth $

Constructor Summary
GeometryUtils()
           
 
Method Summary
static Curve calcCircleCoordinates(Position center, double r, int nSeg, Position startPosition, Position endPosition, CoordinateSystem crs)
           
static Curve createCurveParallel(double distance, Curve curve)
           
static double distance(double xx, double yy, double xx_, double yy_)
           
static double distance(Position p1, Position p2)
           
static Geometry ensureClockwise(Geometry geom)
           
static double getArc(double p0x, double p0y, double p1x, double p1y, double p2x, double p2y)
           
static
<T> CollectionUtils.Mapper<T,T>
getMover(double x, double y)
           
static Position intersection(Position startPoint1, Position endPoint1, Position startPoint2, Position endPoint2)
           
static Curve invertOrder(Curve curve)
           
static Surface invertOrder(Surface surface)
           
static boolean isClockwise(Surface surface)
           
static boolean isLeft(double p0x, double p0y, double p1x, double p1y, double p2x, double p2y)
           
static
<T> T
move(T geom, double x, double y)
           
static Point vectorByAngle(Point a1, Point a2, double l, double alpha, boolean useAbsoluteAngle)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometryUtils

public GeometryUtils()
Method Detail

distance

public static double distance(Position p1,
                              Position p2)
Parameters:
p1 -
p2 -
Returns:
distance between two 2D positions

distance

public static double distance(double xx,
                              double yy,
                              double xx_,
                              double yy_)
Parameters:
xx -
yy -
xx_ -
yy_ -
Returns:
distance between two points

move

public static <T> T move(T geom,
                         double x,
                         double y)
Type Parameters:
T -
Parameters:
geom -
x -
y -
Returns:
moves 2D geometries only (will discard any z values

getMover

public static <T> CollectionUtils.Mapper<T,T> getMover(double x,
                                                       double y)
Type Parameters:
T -
Parameters:
x -
y -
Returns:
a move mapper wrapper

invertOrder

public static Surface invertOrder(Surface surface)
                           throws GeometryException
Parameters:
surface -
Returns:
surface with inverted order of vertices
Throws:
GeometryException

invertOrder

public static Curve invertOrder(Curve curve)
                         throws GeometryException
Parameters:
curve -
Returns:
curve with inverted order of vertices for each segment
Throws:
GeometryException

isClockwise

public static boolean isClockwise(Surface surface)
Parameters:
surface -
Returns:
true if an array of passed Position forms a clockwise orientated ring

ensureClockwise

public static Geometry ensureClockwise(Geometry geom)
                                throws GeometryException
Parameters:
geom -
Returns:
surface or multi surface with guaranteed clockwise vertices orientation
Throws:
GeometryException

createCurveParallel

public static Curve createCurveParallel(double distance,
                                        Curve curve)
                                 throws GeometryException
Parameters:
distance - if distance is < 0 left parallel will be created
curve -
Returns:
parallel curve with distance.
Throws:
GeometryException

intersection

public static Position intersection(Position startPoint1,
                                    Position endPoint1,
                                    Position startPoint2,
                                    Position endPoint2)
Parameters:
startPoint1 -
endPoint1 -
startPoint2 -
endPoint2 -
Returns:
intersection coordinates between to lines (not line segments!!!). This means the intersection point may not lies between passed start- and end-points

vectorByAngle

public static Point vectorByAngle(Point a1,
                                  Point a2,
                                  double l,
                                  double alpha,
                                  boolean useAbsoluteAngle)
Parameters:
a1 - the first point
a2 - the second point
l - the length of the segment starting from the second point
alpha - the angle that the a1-a2 segment makes the following segment
Returns:
the point found at length l from a2 and which (connected with a2) forms an angle of alpha to a1a2.

calcCircleCoordinates

public static Curve calcCircleCoordinates(Position center,
                                          double r,
                                          int nSeg,
                                          Position startPosition,
                                          Position endPosition,
                                          CoordinateSystem crs)
                                   throws GeometryException
Parameters:
center -
r -
noOfPos -
startPosition -
endPosition -
Returns:
Throws:
GeometryException

getArc

public static double getArc(double p0x,
                            double p0y,
                            double p1x,
                            double p1y,
                            double p2x,
                            double p2y)
Parameters:
p0x -
p0y -
p1x -
p1y -
p2x -
p2y -
Returns:
arc between two line segments where p0x/p0y is common point of both segments

isLeft

public static boolean isLeft(double p0x,
                             double p0y,
                             double p1x,
                             double p1y,
                             double p2x,
                             double p2y)
Parameters:
p0x -
p0y -
p1x -
p1y -
p2x -
p2y -
Returns:
true if p2x/p2y is left of the line defined by p0x/p0y p1x/p1y

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org