org.deegree.geometry.io
Class WKTWriter

java.lang.Object
  extended by org.deegree.geometry.io.WKTWriter

public class WKTWriter
extends Object

Writes Geometry objects as Well-Known Text (WKT).

Version:
$Revision: 31641 $, $Date: 2011-08-24 21:24:55 +0200 (Wed, 24 Aug 2011) $
Author:
Steffen Thomas, Markus Schneider, last edited by: $Author: mschneider $

Nested Class Summary
static class WKTWriter.WKTFlag
          The flag is used to specify which geometric operations the database is capable of
 
Constructor Summary
WKTWriter(Set<WKTWriter.WKTFlag> flags, CoordinateFormatter formatter)
          Create a wkt writer with the given flags and formatter.
 
Method Summary
 void setFlags(Set<WKTWriter.WKTFlag> flags)
           
 void setFormatter(CoordinateFormatter formatter)
           
 void setLinearizedControlPoints(int linearizedControlPoints)
          Controlpoints that can be set for the linearization prozess.
 void setLinearizer(CurveLinearizer linearizer)
           
static String write(Geometry geom)
          Export the given geometry to wkt, without using any WKTWriter.WKTFlags.
static void write(Geometry geom, Writer writer)
          Export the given geometry to wkt, without using any WKTWriter.WKTFlags.
 void writeCircularString(Writer writer)
           
 void writeCompositeCurve(CompositeCurve geometry, Writer writer)
          Writes a COMPOSITE-/COMPOUND CURVE
 void writeCompositeGeometry(CompositeGeometry<GeometricPrimitive> geometry, Writer writer)
          Writes the compositeGeometry.
 void writeCurve(Curve geometry, Writer writer)
          Writes a CURVE
 void writeCurveGeometry(Curve geometry, Writer writer)
          Writes a CURVE
 void writeEnvelope(Envelope envelope, Writer writer)
          TODO also for 3D
 void writeGeometricPrimitive(GeometricPrimitive geometry, Writer writer)
          Writes a geometric primitive
 void writeGeometry(Geometry geometry, Writer writer)
           
 void writeLinearRing(LinearRing geometry, Writer writer)
          Writes a linearRing.
 void writeLineString(LineString geometry, Writer writer)
          Writes a LineString.
 void writeMultiCurve(MultiCurve<Curve> geometry, Writer writer)
          Writes a multiCurve.
 void writeMultiGeometry(MultiGeometry<? extends Geometry> geometry, Writer writer)
          Writes a multiGeometry.
 void writeMultiGeometryGeometry(MultiGeometry<? extends Geometry> geometry, Writer writer)
          Writes the multiGeometry.
 void writeMultiLineString(MultiLineString geometry, Writer writer)
          Writes the multiLineString.
 void writeMultiPoint(MultiPoint geometry, Writer writer)
          Writes the multiPoint.
 void writeMultiPolygon(MultiPolygon geometry, Writer writer)
          Writes the multiPolygon.
 void writeMultiSolid(MultiSolid geometry, Writer writer)
          Writes a multiSolid.
 void writeMultiSurface(MultiSurface<Surface> geometry, Writer writer)
          Writes a multiSurface.
 void writePoint(Point geometry, Writer writer)
          Writes the POINT
 void writePolygon(Polygon geometry, Writer writer)
          Writes the POLYGON
 void writeRing(Ring geometry, Writer writer)
          Writes a ring.
 void writeSolid(Solid geometry, Writer writer)
           
 void writeSurface(Surface geometry, Writer writer)
           
 void writeSurfaceGeometry(Surface geometry, Writer writer)
           
 void writeSurfacePatch(Surface geometry, Writer writer)
           
 void writeTin(Tin geometry, Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WKTWriter

public WKTWriter(Set<WKTWriter.WKTFlag> flags,
                 CoordinateFormatter formatter)
Create a wkt writer with the given flags and formatter.

Parameters:
flags - signaling the capabilities of this writer, if null only some geometries can be exported (all dialects are disabled).
formatter - to use, if null the default decimal formatter with 5 decimals is used.
Method Detail

setFlags

public void setFlags(Set<WKTWriter.WKTFlag> flags)
Parameters:
flags - the flags to set

setLinearizer

public void setLinearizer(CurveLinearizer linearizer)
Parameters:
linearizer -

setFormatter

public void setFormatter(CoordinateFormatter formatter)
Parameters:
formatter - the formatter to set

setLinearizedControlPoints

public void setLinearizedControlPoints(int linearizedControlPoints)
Controlpoints that can be set for the linearization prozess.

Parameters:
linearizedControlPoints - the linearizedControlPoints to set

writeGeometry

public void writeGeometry(Geometry geometry,
                          Writer writer)
                   throws IOException
Parameters:
geometry - that has to be written
writer - that is used
Throws:
IOException

writeGeometricPrimitive

public void writeGeometricPrimitive(GeometricPrimitive geometry,
                                    Writer writer)
                             throws IOException
Writes a geometric primitive

Parameters:
geometry -
writer -
Throws:
IOException

writePoint

public void writePoint(Point geometry,
                       Writer writer)
                throws IOException
Writes the POINT

Parameters:
geometry -
writer -
Throws:
IOException

writeSolid

public void writeSolid(Solid geometry,
                       Writer writer)
Parameters:
geometry -
writer -

writeSurface

public void writeSurface(Surface geometry,
                         Writer writer)
                  throws IOException
Parameters:
geometry -
writer -
Throws:
IOException

writeTin

public void writeTin(Tin geometry,
                     Writer writer)
Parameters:
geometry -

writeSurfaceGeometry

public void writeSurfaceGeometry(Surface geometry,
                                 Writer writer)
                          throws IOException
Parameters:
geometry -
writer -
Throws:
IOException

writeSurfacePatch

public void writeSurfacePatch(Surface geometry,
                              Writer writer)
                       throws IOException
Parameters:
geometry -
writer -
Throws:
IOException

writePolygon

public void writePolygon(Polygon geometry,
                         Writer writer)
                  throws IOException
Writes the POLYGON

Parameters:
geometry -
writer -
Throws:
IOException

writeCurve

public void writeCurve(Curve geometry,
                       Writer writer)
                throws IOException
Writes a CURVE

Parameters:
geometry -
writer -
Throws:
IOException

writeCompositeCurve

public void writeCompositeCurve(CompositeCurve geometry,
                                Writer writer)
                         throws IOException
Writes a COMPOSITE-/COMPOUND CURVE

Parameters:
geometry -
writer -
Throws:
IOException

writeCurveGeometry

public void writeCurveGeometry(Curve geometry,
                               Writer writer)
                        throws IOException
Writes a CURVE

Parameters:
geometry -
writer -
Throws:
IOException

writeLineString

public void writeLineString(LineString geometry,
                            Writer writer)
                     throws IOException
Writes a LineString.

Parameters:
geometry -
writer -
Throws:
IOException

writeRing

public void writeRing(Ring geometry,
                      Writer writer)
               throws IOException
Writes a ring.

Parameters:
geometry -
writer -
Throws:
IOException

writeLinearRing

public void writeLinearRing(LinearRing geometry,
                            Writer writer)
                     throws IOException
Writes a linearRing.

Parameters:
geometry -
writer -
Throws:
IOException

writeMultiGeometry

public void writeMultiGeometry(MultiGeometry<? extends Geometry> geometry,
                               Writer writer)
                        throws IOException
Writes a multiGeometry.

Parameters:
geometry -
writer -
Throws:
IOException

writeMultiSolid

public void writeMultiSolid(MultiSolid geometry,
                            Writer writer)
Writes a multiSolid.

Parameters:
geometry -
writer -

writeMultiSurface

public void writeMultiSurface(MultiSurface<Surface> geometry,
                              Writer writer)
                       throws IOException
Writes a multiSurface.

Parameters:
geometry -
writer -
Throws:
IOException

writeMultiCurve

public void writeMultiCurve(MultiCurve<Curve> geometry,
                            Writer writer)
                     throws IOException
Writes a multiCurve.

Parameters:
geometry -
writer -
Throws:
IOException

writeMultiGeometryGeometry

public void writeMultiGeometryGeometry(MultiGeometry<? extends Geometry> geometry,
                                       Writer writer)
Writes the multiGeometry.

Parameters:
geometry -
writer -

writeMultiPolygon

public void writeMultiPolygon(MultiPolygon geometry,
                              Writer writer)
                       throws IOException
Writes the multiPolygon.

Parameters:
geometry -
writer -
Throws:
IOException

writeMultiLineString

public void writeMultiLineString(MultiLineString geometry,
                                 Writer writer)
                          throws IOException
Writes the multiLineString.

Parameters:
geometry -
writer -
Throws:
IOException

writeMultiPoint

public void writeMultiPoint(MultiPoint geometry,
                            Writer writer)
                     throws IOException
Writes the multiPoint.

Parameters:
geometry -
writer -
Throws:
IOException

writeCompositeGeometry

public void writeCompositeGeometry(CompositeGeometry<GeometricPrimitive> geometry,
                                   Writer writer)
Writes the compositeGeometry.

Parameters:
geometry -
writer -

writeCircularString

public void writeCircularString(Writer writer)
                         throws IOException
Parameters:
writer -
Throws:
IOException

writeEnvelope

public void writeEnvelope(Envelope envelope,
                          Writer writer)
                   throws IOException
TODO also for 3D

Parameters:
envelope -
Throws:
IOException

write

public static String write(Geometry geom)
Export the given geometry to wkt, without using any WKTWriter.WKTFlags. The writing is done to a StringWriter, which should be handled with care.

Parameters:
geom - to export.
Returns:
a wkt String representation of the given geometry, of the emtpy string if the geometry is null

write

public static void write(Geometry geom,
                         Writer writer)
                  throws IOException,
                         NullPointerException
Export the given geometry to wkt, without using any WKTWriter.WKTFlags. The writing is done using the given writer instance, if no writer instance is given (null) a NullPointerException will be thrown.

Parameters:
geom - to export, if null the method will return.
writer - to write to.
Throws:
IOException - if an error occurs while using the writer.
NullPointerException - if the writer is null


Copyright © 2011. All Rights Reserved.