|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vividsolutions.jts.io.WKTWriter
public class WKTWriter
Writes the Well-Known Text representation of a Geometry
.
The Well-Known Text format is defined in the
OGC
Simple Features Specification for SQL.
See WKTReader
for a formal specification of the format syntax.
The WKTWriter
outputs coordinates rounded to the precision
model. Only the maximum number of decimal places
necessary to represent the ordinates to the required precision will be
output.
The SFS WKT spec does not define a special tag for LinearRing
s.
Under the spec, rings are output as LINESTRING
s.
In order to allow precisely specifying constructed geometries,
JTS also supports a non-standard LINEARRING
tag which is used
to output LinearRings.
WKTReader
Constructor Summary | |
---|---|
WKTWriter()
Creates a new WKTWriter with default settings |
|
WKTWriter(int outputDimension)
Creates a writer that writes Geometry s with
the given output dimension (2 or 3). |
Method Summary | |
---|---|
void |
setFormatted(boolean isFormatted)
Sets whether the output will be formatted. |
void |
setMaxCoordinatesPerLine(int coordsPerLine)
Sets the maximum number of coordinates per line written in formatted output. |
void |
setTab(int size)
Sets the tab size to use for indenting. |
static java.lang.String |
stringOfChar(char ch,
int count)
Returns a String of repeated characters. |
static java.lang.String |
toLineString(Coordinate p0,
Coordinate p1)
Generates the WKT for a 2-point LineString . |
static java.lang.String |
toLineString(CoordinateSequence seq)
Generates the WKT for a N-point LineString . |
static java.lang.String |
toPoint(Coordinate p0)
Generates the WKT for a Point . |
java.lang.String |
write(Geometry geometry)
Converts a Geometry to its Well-known Text representation. |
void |
write(Geometry geometry,
java.io.Writer writer)
Converts a Geometry to its Well-known Text representation. |
java.lang.String |
writeFormatted(Geometry geometry)
Same as write , but with newlines and spaces to make the
well-known text more readable. |
void |
writeFormatted(Geometry geometry,
java.io.Writer writer)
Same as write , but with newlines and spaces to make the
well-known text more readable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WKTWriter()
public WKTWriter(int outputDimension)
Geometry
s with
the given output dimension (2 or 3).
If the specified output dimension is 3, the Z value
of coordinates will be written if it is present
(i.e. if it is not Double.NaN
).
outputDimension
- the coordinate dimension to output (2 or 3)Method Detail |
---|
public static java.lang.String toPoint(Coordinate p0)
Point
.
p0
- the point coordinate
public static java.lang.String toLineString(CoordinateSequence seq)
LineString
.
seq
- the sequence to outpout
public static java.lang.String toLineString(Coordinate p0, Coordinate p1)
LineString
.
p0
- the first coordinatep1
- the second coordinate
public static java.lang.String stringOfChar(char ch, int count)
String
of repeated characters.
ch
- the character to repeatcount
- the number of times to repeat the character
String
of characterspublic void setFormatted(boolean isFormatted)
isFormatted
- true if the output is to be formattedpublic void setMaxCoordinatesPerLine(int coordsPerLine)
coordsPerLine
- the number of coordinates per line to output.public void setTab(int size)
size
- the number of spaces to use as the tab string
java.lang.IllegalArgumentException
- if the size is non-positivepublic java.lang.String write(Geometry geometry)
Geometry
to its Well-known Text representation.
geometry
- a Geometry
to process
public void write(Geometry geometry, java.io.Writer writer) throws java.io.IOException
Geometry
to its Well-known Text representation.
geometry
- a Geometry
to process
java.io.IOException
public java.lang.String writeFormatted(Geometry geometry)
write
, but with newlines and spaces to make the
well-known text more readable.
geometry
- a Geometry
to process
public void writeFormatted(Geometry geometry, java.io.Writer writer) throws java.io.IOException
write
, but with newlines and spaces to make the
well-known text more readable.
geometry
- a Geometry
to process
java.io.IOException
|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |