public class WKTWriter2
extends WKTWriter
WKTWriter
that can write curved geometries using SQL Multi-Media
Extension Well-Known TextWKTReader2
Constructor and Description |
---|
WKTWriter2()
Creates a new WKTWriter with default settings
|
WKTWriter2(int outputDimension)
Creates a writer that writes
Geometry s with the given output dimension (2 or 3). |
Modifier and Type | Method and Description |
---|---|
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 String |
stringOfChar(char ch,
int count)
Returns a
String of repeated characters. |
static String |
toLineString(Coordinate p0,
Coordinate p1)
Generates the WKT for a LINESTRING specified by two
Coordinate s. |
static String |
toLineString(CoordinateSequence seq)
Generates the WKT for a LINESTRING specified by a
CoordinateSequence . |
static String |
toPoint(Coordinate p0)
Generates the WKT for a POINT specified by a
Coordinate . |
String |
write(Geometry geometry)
Converts a
Geometry to its Well-known Text representation. |
void |
write(Geometry geometry,
Writer writer)
Converts a
Geometry to its Well-known Text representation. |
String |
writeFormatted(Geometry geometry)
Same as
write , but with newlines and spaces to make the well-known text more
readable. |
void |
writeFormatted(Geometry geometry,
Writer writer)
Same as
write , but with newlines and spaces to make the well-known text more
readable. |
public WKTWriter2()
public WKTWriter2(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)public static String toPoint(Coordinate p0)
Coordinate
.p0
- the point coordinatepublic static String toLineString(CoordinateSequence seq)
CoordinateSequence
.seq
- the sequence to writepublic static String toLineString(Coordinate p0, Coordinate p1)
Coordinate
s.p0
- the first coordinatep1
- the second coordinatepublic static String stringOfChar(char ch, int count)
String
of repeated characters.ch
- the character to repeatcount
- the number of times to repeat the characterString
of characterspublic void setFormatted(boolean isFormatted)
setFormatted
in class WKTWriter
isFormatted
- true if the output is to be formattedpublic void setMaxCoordinatesPerLine(int coordsPerLine)
setMaxCoordinatesPerLine
in class WKTWriter
coordsPerLine
- the number of coordinates per line to output.public void setTab(int size)
setTab
in class WKTWriter
size
- the number of spaces to use as the tab stringIllegalArgumentException
- if the size is non-positivepublic String write(Geometry geometry)
Geometry
to its Well-known Text representation.write
in class WKTWriter
geometry
- a Geometry
to processpublic void write(Geometry geometry, Writer writer) throws IOException
Geometry
to its Well-known Text representation.write
in class WKTWriter
geometry
- a Geometry
to processIOException
public String writeFormatted(Geometry geometry)
write
, but with newlines and spaces to make the well-known text more
readable.writeFormatted
in class WKTWriter
geometry
- a Geometry
to processpublic void writeFormatted(Geometry geometry, Writer writer) throws IOException
write
, but with newlines and spaces to make the well-known text more
readable.writeFormatted
in class WKTWriter
geometry
- a Geometry
to processIOException
Copyright © 1996–2019 Geotools. All rights reserved.