Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.deegree.framework.xml
Class GeometryUtils

    java.lang.Object
      org.deegree.framework.xml.GeometryUtils

    public class GeometryUtils

extends Object

Utility methods for handling geometries within XSLT transformations

Version:
  $Revision: 19257 $, $Date: 2009-08-19 16:07:10 +0200 (Mi, 19. Aug 2009) $
Author:
  Andreas Poth, last edited by: $Author: mschneider $

Constructor Summary
`GeometryUtils()`

Method Summary
`static double` | `calcArea(Node node)`
`static double` | `calcOuterBoundaryLength(Node node)`
`static double` | `getCentroidX(Node node, String targetCRS)` returns the X coordinate of the centroid of the geometry represented by the passed Node
`static double` | `getCentroidY(Node node, String targetCRS)` returns the y coordinate of the centroid of the geometry represented by the passed Node
`static String` | `getCurveCoordinates(Node node)` Searches for a gml:poslist, gml:pos or gml:coordinates and creates a String from them.
`static String` | `getEnvelopeFromGeometry(Node node)`
`static String` | `getPolygonCoordinatesFromEnvelope(Node node)`
`static String` | `getPolygonInnerRing(Node node, int index, String sourceCRS, String targetCRS)`
`static String` | `getPolygonOuterRing(Node node, String sourceCRS, String targetCRS)` returns the coordinates of the out ring of a polygon as comma separated list.
`static String` | `toGML2Coordinates(String input, int dimension)` Transforms the string contents of a GML 3.1.1-style `gml:posList` into a GML 2.1-style `gml:coordinates` element.

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

### getPolygonCoordinatesFromEnvelope

    public static String getPolygonCoordinatesFromEnvelope(Node node)

  Parameters:
    `node` - (an Element) describing an envelope to get the coordinates from.
  Returns:
    the coordinates from the envelope separated by ','. Or the empty String if an error occurred.

### getEnvelopeFromGeometry

    public static String getEnvelopeFromGeometry(Node node)

  Parameters:
    `node` - (an Element) describing a geometry from which the bbox (envelope) will be returned.
  Returns:
    the coordinates from the bbox of the geometry separated by ','. Or the empty String if an error occurred.

### getPolygonOuterRing

    public static String getPolygonOuterRing(Node node,
                                             String sourceCRS,
                                             String targetCRS)

  returns the coordinates of the out ring of a polygon as comma separated list. The coordinate tuples are separated by a blank. If required the polygon will first transformed to the target CRS

  Parameters:
    `node` -
    `sourceCRS` -
    `targetCRS` -
  Returns:
    the coordinates of the out ring of a polygon as comma separated list, or the empty String if an exception occurred in the extracting/transforming process.

### getPolygonInnerRing

    public static String getPolygonInnerRing(Node node,
                                             int index,
                                             String sourceCRS,
                                             String targetCRS)

  Parameters:
    `node` -
    `index` -
    `sourceCRS` -
    `targetCRS` -
  Returns:
    the inner ring of the given polyong / surface found in the node or the empty String otherwise.

### calcArea

    public static double calcArea(Node node)

  Parameters:
    `node` - to extract the geometry from
  Returns:
    the area of the geometry inside the node or -1 if the given geometry node does not contain a surface or multi surface, or an exception occurred while extracting the geometry.

### calcOuterBoundaryLength

    public static double calcOuterBoundaryLength(Node node)

  Parameters:
    `node` - to extract the geometry from from which the length of the outerboundary will be calculated
  Returns:
    the length outerboundary of the geometry inside the node or 0 if the given geometry node does not contain a surface or multi surface, or an exception occurred while extracting the geometry.

### getCentroidX

    public static double getCentroidX(Node node,
                                      String targetCRS)

  returns the X coordinate of the centroid of the geometry represented by the passed Node

  Parameters:
    `node` - to calculate the centroid from.
    `targetCRS` - of resulting centroid, may be null
  Returns:
    the x coordinate of the (transformed) centroid or -1 if it could not be calculated.

### getCentroidY

    public static double getCentroidY(Node node,
                                      String targetCRS)

  returns the y coordinate of the centroid of the geometry represented by the passed Node

  Parameters:
    `node` - to calculate the centroid from.
    `targetCRS` - of resulting centroid, may be null
  Returns:
    the y coordinate of the (transformed) centroid or -1 if it could not be calculated.

### getCurveCoordinates

    public static String getCurveCoordinates(Node node)

  Searches for a gml:poslist, gml:pos or gml:coordinates and creates a String from them.

  Parameters:
    `node` - to get the coordinates from
  Returns:
    A string representation of the coordinates found, or the emtpy string if not.

### toGML2Coordinates

    public static String toGML2Coordinates(String input,
                                           int dimension)

  Transforms the string contents of a GML 3.1.1-style `gml:posList` into a GML 2.1-style `gml:coordinates` element.

  Parameters:
    `input` - coordinates string that separates all number using withspace characters
    `dimension` -
  Returns:
    translated coordinates string, with a "," between each coordinate and a " " between each ordinate of a coordinate

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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