|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.model.spatialschema.GMLGeometryAdapter
public class GMLGeometryAdapter
Adapter class for converting GML geometries to deegree geometries and vice versa. Some logical problems result from
the fact that an envelope isn't a geometry according to ISO 19107 (where the deegree geometry model is based on) but
according to GML2/3 specification it is.
So if the wrap(..) method is called with an envelope a Surface will be returned representing the envelops
shape. To export an Envelope to a GML box/envelope two specialized export methods are available.
The export method(s) doesn't return a DOM element as one may expect but a StringBuffer. This is done because
the transformation from deegree geometries to GML mainly is required when a GML representation of a geometry shall be
serialized to a file or to a network connection. For both cases the string representation is required and it is
simply faster to create the string directly instead of first creating a DOM tree that after this must be serialized
to a string.
In future version geometries will be serialized to a stream.
Field Summary | |
---|---|
static CoordinateSystem |
EPSG4326
This differs from GeographiCRS.WGS84 in the identifiers (equals fails for WGS84.equals(EPSG4326)). |
Constructor Summary | |
---|---|
GMLGeometryAdapter()
|
Method Summary | |
---|---|
static java.lang.StringBuffer |
export(Geometry geometry)
Creates a GML representation from the passed Geometry . |
static java.io.PrintWriter |
export(Geometry geometry,
java.io.OutputStream os)
Writes the GML representation of the given Geometry to the given OutputStream . |
static java.io.PrintWriter |
export(Geometry geometry,
java.io.OutputStream os,
java.lang.String id)
|
static java.io.PrintWriter |
export(Geometry geometry,
java.io.PrintWriter pw)
Writes the GML representation of the given Geometry to the given PrintWriter . |
static java.io.PrintWriter |
export(Geometry geometry,
java.io.PrintWriter pw,
java.lang.String id)
|
static java.lang.StringBuffer |
export(Geometry geometry,
java.lang.String id)
|
static java.lang.StringBuffer |
exportAsBox(Envelope envelope)
creates a GML representation from the passed Envelope. |
static java.lang.StringBuffer |
exportAsEnvelope(Envelope envelope)
creates a GML representation from the passed Envelope. |
static void |
exportMultiGeometry(MultiGeometry multiGeometry,
java.io.PrintWriter pw)
Exports the given MultiGeometry as a gml:MultiGeometry element. |
static void |
exportMultiGeometry(MultiGeometry multiGeometry,
java.io.PrintWriter pw,
java.lang.String id)
Exports the given MultiGeometry as a gml:MultiGeometry element. |
static boolean |
isGeometrieSupported(java.lang.String localName)
Returns true if the given localName ! |
static boolean |
swap(Envelope env)
|
static Geometry |
wrap(org.w3c.dom.Element gml)
Deprecated. this method cannot provide default SRS information, please use wrap(Element,String) instead |
static Geometry |
wrap(org.w3c.dom.Element element,
java.lang.String srsName)
Parses the given DOM element of a GML geometry and returns a corresponding deegree Geometry object. |
static Geometry |
wrap(java.lang.String gml)
Deprecated. this method cannot provide default SRS information, please use wrap(String,String) instead |
static Geometry |
wrap(java.lang.String gml,
java.lang.String srsName)
Converts the given string representation of a GML geometry object to a corresponding deegree Geometry . |
static Envelope |
wrapBox(org.w3c.dom.Element element)
Deprecated. this method cannot provide default SRS information, please use wrapBox(Element,String)
instead |
static Envelope |
wrapBox(org.w3c.dom.Element element,
java.lang.String srsName)
Returns an instance of Envelope created from the passed gml:Box or gml:Envelope
element. |
static Surface |
wrapBoxAsSurface(org.w3c.dom.Element element,
java.lang.String srsName)
Returns a Surface created from the given gml:Box element. |
static CompositeSurface |
wrapCompositeSurface(org.w3c.dom.Element element,
java.lang.String srsName)
Returns an instance of CompositeSurface created from the passed gml:CompositeSurface
element. |
static Curve |
wrapCurveAsCurve(org.w3c.dom.Element element,
java.lang.String srsName)
Returns an instance of Curve created from the passed gml:Curve element. |
static Curve |
wrapLinearRing(org.w3c.dom.Element element,
java.lang.String srsName)
Parses the given gml:LinearRing element as a Curve . |
static Curve |
wrapLineString(org.w3c.dom.Element element,
java.lang.String srsName)
Returns a Curve instance created from the passed gml:LineString element. |
static MultiCurve |
wrapMultiCurveAsMultiCurve(org.w3c.dom.Element element,
java.lang.String srsName)
Parses the given gml:MultiCurve element as a MultiCurve . |
static MultiGeometry |
wrapMultiGeometry(org.w3c.dom.Element element,
java.lang.String srsName)
Creates an instance of MultiGeometry from the passed gml:MultiGeometry element. |
static MultiCurve |
wrapMultiLineString(org.w3c.dom.Element element,
java.lang.String srsName)
Returns a MultiCurve instance created from the passed gml:MultiLineString element. |
static MultiPoint |
wrapMultiPoint(org.w3c.dom.Element element,
java.lang.String srsName)
Returns a MultiPoint instance created from the passed gml:MultiPoint element. |
static MultiSurface |
wrapMultiPolygon(org.w3c.dom.Element element,
java.lang.String srsName)
Returns a MultiSurface instance created from the passed gml:MultiPolygon element. |
static MultiSurface |
wrapMultiSurfaceAsMultiSurface(org.w3c.dom.Element element,
java.lang.String srsName)
Parses the given gml:MultiSurface element as a MultiSurface . |
static Point |
wrapPoint(org.w3c.dom.Element element,
java.lang.String srsName)
Returns a Point instance created from the passed gml:Point element. |
static Surface |
wrapPolygon(org.w3c.dom.Element element,
java.lang.String srsName)
Parses the given gml:Polygon element as a Surface . |
static Curve |
wrapRing(org.w3c.dom.Element element,
java.lang.String srsName)
Parses the given gml:Ring element as a Curve . |
static Surface |
wrapSurfaceAsSurface(org.w3c.dom.Element element,
java.lang.String srsName)
Returns an instance of Surface created from the passed gml:Surface element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static CoordinateSystem EPSG4326
Constructor Detail |
---|
public GMLGeometryAdapter()
Method Detail |
---|
public static boolean isGeometrieSupported(java.lang.String localName)
null
or empty and matches one of the following:
localName
- name to check
public static Geometry wrap(org.w3c.dom.Element element, java.lang.String srsName) throws GeometryException
Geometry
object.
Notice that GML boxes will be converted to surfaces because in ISO 19107 envelopes are no geometries. Rings are
returned as Curve
objects.
Currently, the following geometry elements are supported:
Geometry element name (in gml namespace) |
Return type (deegree Geometry ) |
---|---|
Box/Envelope | Envelope |
CompositeSurface | CompositeSurface |
Curve | Curve |
LinearRing | Curve |
LineString | Curve |
MultiCurve | MultiCurve |
MultiGeometry | MultiGeometry |
MultiLineString | MultiCurve |
MultiPoint | MultiPoint |
MultiPolygon | MultiSurface |
MultiSurface | MultiSurface |
Point/Center | Point |
Polygon | Surface |
Ring | Curve |
Surface | Surface |
element
- gml geometry elementsrsName
- default SRS for the geometry
Geometry
instance
GeometryException
- if type unsupported or parsing / conversion failedpublic static Geometry wrap(java.lang.String gml, java.lang.String srsName) throws GeometryException, XMLParsingException
Geometry
.
Notice that GML Boxes will be converted to Surfaces because in ISO 19107 Envelopes are no geometries.
gml
- srsName
- default SRS for the geometry (may be overwritten in geometry elements)
GeometryException
XMLParsingException
wrap(Element, String)
public static Envelope wrapBox(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, InvalidGMLException, UnknownCRSException
Envelope
created from the passed gml:Box
or gml:Envelope
element.
element
- gml:Box
or gml:Envelope
elementsrsName
- default SRS for the geometry
Envelope
XMLParsingException
InvalidGMLException
UnknownCRSException
public static Curve wrapCurveAsCurve(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, UnknownCRSException
Curve
created from the passed gml:Curve
element.
element
- gml:Curve
elementsrsName
- default SRS for the geometry
XMLParsingException
GeometryException
UnknownCRSException
public static Surface wrapSurfaceAsSurface(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, UnknownCRSException
Surface
created from the passed gml:Surface
element.
element
- srsName
- default SRS for the geometry
XMLParsingException
GeometryException
UnknownCRSException
public static Point wrapPoint(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, InvalidGMLException, UnknownCRSException
Point
instance created from the passed gml:Point
element.
element
- gml:Point
elementsrsName
- default SRS for the geometry
XMLParsingException
InvalidGMLException
UnknownCRSException
public static Curve wrapLineString(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, InvalidGMLException, UnknownCRSException
Curve
instance created from the passed gml:LineString
element.
element
- gml:LineString
elementsrsName
- default SRS for the geometry
XMLParsingException
GeometryException
InvalidGMLException
UnknownCRSException
public static Surface wrapPolygon(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, InvalidGMLException, UnknownCRSException
gml:Polygon
element as a Surface
.
element
- gml:Polygon
elementsrsName
- default SRS for the geometry
XMLParsingException
GeometryException
InvalidGMLException
UnknownCRSException
public static Curve wrapLinearRing(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, InvalidGMLException, UnknownCRSException
gml:LinearRing
element as a Curve
.
element
- srsName
-
XMLParsingException
GeometryException
InvalidGMLException
UnknownCRSException
public static Curve wrapRing(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, UnknownCRSException, InvalidGMLException
gml:Ring
element as a Curve
.
element
- gml:Ring
elementsrsName
- default SRS for the geometry
XMLParsingException
GeometryException
UnknownCRSException
InvalidGMLException
public static MultiPoint wrapMultiPoint(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, InvalidGMLException, UnknownCRSException
MultiPoint
instance created from the passed gml:MultiPoint
element.
element
- gml:MultiPoint
elementsrsName
- default SRS for the geometry
XMLParsingException
InvalidGMLException
UnknownCRSException
public static MultiCurve wrapMultiLineString(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, InvalidGMLException, UnknownCRSException
MultiCurve
instance created from the passed gml:MultiLineString
element.
element
- gml:MultiLineString
elementsrsName
- default SRS for the geometry
XMLParsingException
GeometryException
InvalidGMLException
UnknownCRSException
public static MultiCurve wrapMultiCurveAsMultiCurve(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, UnknownCRSException, InvalidGMLException
gml:MultiCurve
element as a MultiCurve
.
element
- gml:MultiCurve
elementsrsName
- default SRS for the geometry
MultiCurve
instance
XMLParsingException
GeometryException
UnknownCRSException
InvalidGMLException
public static MultiSurface wrapMultiSurfaceAsMultiSurface(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, UnknownCRSException, InvalidGMLException
gml:MultiSurface
element as a MultiSurface
.
element
- gml:MultiSurface
elementsrsName
- default SRS for the geometry
MultiSurface
instance
XMLParsingException
GeometryException
UnknownCRSException
InvalidGMLException
public static MultiSurface wrapMultiPolygon(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, InvalidGMLException, UnknownCRSException
MultiSurface
instance created from the passed gml:MultiPolygon
element.
element
- gml:MultiPolygon
elementsrsName
- default SRS for the geometry
XMLParsingException
GeometryException
InvalidGMLException
UnknownCRSException
public static MultiGeometry wrapMultiGeometry(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, UnknownCRSException, GeometryException
MultiGeometry
from the passed gml:MultiGeometry
element.
element
- gml:MultiGeometry
elementsrsName
- default SRS for the geometry
XMLParsingException
GeometryException
UnknownCRSException
GeometryException
public static Surface wrapBoxAsSurface(org.w3c.dom.Element element, java.lang.String srsName) throws XMLParsingException, GeometryException, InvalidGMLException, UnknownCRSException
Surface
created from the given gml:Box
element. This method is useful because
an Envelope that would normally be created from a Box isn't a geometry in context of ISO 19107.
element
- gml:Box
elementsrsName
-
Surface
XMLParsingException
GeometryException
InvalidGMLException
UnknownCRSException
public static CompositeSurface wrapCompositeSurface(org.w3c.dom.Element element, java.lang.String srsName)
CompositeSurface
created from the passed gml:CompositeSurface
element.
TODO
element
- srsName
- default SRS for the geometry
public static java.io.PrintWriter export(Geometry geometry, java.io.OutputStream os) throws GeometryException
Geometry
to the given OutputStream
.
Currently, the Geometry
realizations are handled:
geometry
- geometry to be exportedos
- target OutputStream
PrintWriter
created from the OutputStream
GeometryException
public static java.io.PrintWriter export(Geometry geometry, java.io.OutputStream os, java.lang.String id) throws GeometryException
geometry
- os
- id
-
PrintWriter
created from the OutputStream
GeometryException
public static java.io.PrintWriter export(Geometry geometry, java.io.PrintWriter pw) throws GeometryException
Geometry
to the given PrintWriter
.
Currently, the Geometry
realizations are handled:
geometry
- geometry to be exportedpw
- target PrintWriter
PrintWriter
GeometryException
public static java.io.PrintWriter export(Geometry geometry, java.io.PrintWriter pw, java.lang.String id) throws GeometryException
geometry
- pw
- id
-
PrintWriter
GeometryException
public static java.lang.StringBuffer export(Geometry geometry) throws GeometryException
Geometry
.
geometry
-
GeometryException
public static java.lang.StringBuffer export(Geometry geometry, java.lang.String id) throws GeometryException
geometry
- id
-
GeometryException
public static java.lang.StringBuffer exportAsBox(Envelope envelope)
envelope
-
public static java.lang.StringBuffer exportAsEnvelope(Envelope envelope)
envelope
-
public static void exportMultiGeometry(MultiGeometry multiGeometry, java.io.PrintWriter pw) throws GeometryException
MultiGeometry
as a gml:MultiGeometry
element.
multiGeometry
- pw
-
GeometryException
public static void exportMultiGeometry(MultiGeometry multiGeometry, java.io.PrintWriter pw, java.lang.String id) throws GeometryException
MultiGeometry
as a gml:MultiGeometry
element.
multiGeometry
- pw
- id
-
GeometryException
@Deprecated public static Geometry wrap(java.lang.String gml) throws GeometryException, XMLParsingException
wrap(String,String)
instead
Geometry
. Notice that
GML Boxes will be converted to Surfaces because in ISO 19107 Envelopes are no geometries.
gml
-
GeometryException
XMLParsingException
@Deprecated public static Geometry wrap(org.w3c.dom.Element gml) throws GeometryException
wrap(Element,String)
instead
Currently, the following conversions are supported:
gml
-
GeometryException
- if type unsupported or conversion failed@Deprecated public static Envelope wrapBox(org.w3c.dom.Element element) throws XMLParsingException, InvalidGMLException, UnknownCRSException
wrapBox(Element,String)
instead
element
- XMLParsingException
InvalidGMLException
UnknownCRSException
public static boolean swap(Envelope env)
env
-
|
deegree 2.5 (2011/06/29 09:44 build-8-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