org.deegree_impl.model.geometry
Class JTSAdapter

java.lang.Object
  extended byorg.deegree_impl.model.geometry.JTSAdapter

public class JTSAdapter
extends java.lang.Object

Adapter between deegree-GM_Objects and JTS-Geometry objects.

Please note that the generated deegree-objects use null as CS_CoordinateSystem!

Version:
$Revision: 1.10 $ $Date: 2004/03/12 15:56:47 $
Author:
Markus Schneider

Field Summary
private static com.vividsolutions.jts.geom.GeometryFactory jtsFactory
           
private static PrecisionModel pm
           
 
Constructor Summary
JTSAdapter()
           
 
Method Summary
private static GM_Position[] createGMPositions(LineString line)
          Converts a LineString to an array of GM_Positions.
private static LineString export(GM_Curve curve)
          Converts a GM_Curve to a LineString.
private static MultiLineString export(GM_MultiCurve multi)
          Converts a GM_MultiCurve to a MultiLineString.
private static MultiPoint export(GM_MultiPoint gmMultiPoint)
          Converts a GM_MultiPoint to a MultiPoint.
private static GeometryCollection export(GM_MultiPrimitive multi)
          Converts a GM_MultiPrimitive to a GeometryCollection.
private static MultiPolygon export(GM_MultiSurface msurface)
          Converts a GM_MultiSurface to a MultiPolygon.
static Geometry export(GM_Object gmObject)
          Converts a GM_Object to a corresponding JTS-Geometry object.
private static Point export(GM_Point gmPoint)
          Converts a GM_Point to a Point.
private static LinearRing export(GM_Position[] positions)
          Converts an array of GM_Positions to a LinearRing.
private static Polygon export(GM_Surface surface)
          Converts a GM_Surface to a Polygon.
static GM_Object wrap(Geometry geometry)
          Converts a JTS-Geometry object to a corresponding GM_Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pm

private static PrecisionModel pm

jtsFactory

private static com.vividsolutions.jts.geom.GeometryFactory jtsFactory
Constructor Detail

JTSAdapter

public JTSAdapter()
Method Detail

export

public static Geometry export(GM_Object gmObject)
                       throws GM_Exception
Converts a GM_Object to a corresponding JTS-Geometry object.

Currently, the following conversions are supported:

  • GM_Point -> Point
  • GM_MultiPoint -> MultiPoint
  • GM_Curve -> LineString
  • GM_MultiCurve -> MultiLineString
  • GM_Surface -> Polygon
  • GM_MultiSurface -> MultiPolygon
  • GM_MultiPrimitive -> GeometryCollection

Parameters:
gmObject - the object to be converted
Returns:
the corresponding JTS-Geometry object
Throws:
GM_Exception - if type unsupported or conversion failed

wrap

public static GM_Object wrap(Geometry geometry)
                      throws GM_Exception
Converts a JTS-Geometry object to a corresponding GM_Object.

Currently, the following conversions are supported:

  • Point -> GM_Point
  • MultiPoint -> GM_MultiPoint
  • LineString -> GM_Curve
  • MultiLineString -> GM_MultiCurve
  • Polygon -> GM_Surface
  • MultiPolygon -> GM_MultiSurface
  • GeometryCollection -> GM_MultiPrimitive

Parameters:
geometry - the JTS-Geometry to be converted
Returns:
the corresponding GM_Object
Throws:
GM_Exception - if type unsupported or conversion failed

export

private static Point export(GM_Point gmPoint)
Converts a GM_Point to a Point.

Parameters:
gmPoint - point to be converted
Returns:
the corresponding Point object

export

private static MultiPoint export(GM_MultiPoint gmMultiPoint)
Converts a GM_MultiPoint to a MultiPoint.

Parameters:
gmMultiPoint - multipoint to be converted
Returns:
the corresponding MultiPoint object

export

private static LineString export(GM_Curve curve)
                          throws GM_Exception
Converts a GM_Curve to a LineString.

Parameters:
curve - GM_Curve to be converted
Returns:
the corresponding LineString object
Throws:
GM_Exception

export

private static MultiLineString export(GM_MultiCurve multi)
                               throws GM_Exception
Converts a GM_MultiCurve to a MultiLineString.

Parameters:
multi - GM_MultiCurve to be converted
Returns:
the corresponding MultiLineString object
Throws:
GM_Exception

export

private static LinearRing export(GM_Position[] positions)
Converts an array of GM_Positions to a LinearRing.

Parameters:
positions - an array of GM_Positions
Returns:
the corresponding LinearRing object

export

private static Polygon export(GM_Surface surface)
Converts a GM_Surface to a Polygon.

Currently, the GM_Surface _must_ contain exactly one patch!

Parameters:
surface - a GM_Surface
Returns:
the corresponding Polygon object

export

private static MultiPolygon export(GM_MultiSurface msurface)
Converts a GM_MultiSurface to a MultiPolygon.

Currently, the contained GM_Surface _must_ have exactly one patch!

Parameters:
msurface - a GM_MultiSurface
Returns:
the corresponding MultiPolygon object

export

private static GeometryCollection export(GM_MultiPrimitive multi)
                                  throws GM_Exception
Converts a GM_MultiPrimitive to a GeometryCollection.

Parameters:
multi - a GM_MultiPrimtive
Returns:
the corresponding GeometryCollection object
Throws:
GM_Exception

createGMPositions

private static GM_Position[] createGMPositions(LineString line)
Converts a LineString to an array of GM_Positions.

Parameters:
line - a LineString object
Returns:
the corresponding array of GM_Positions