public class KMLWriter
extends java.lang.Object
Geometry
.
The output is KML fragments which
can be substituted wherever the KML Geometry abstract element can be used.
Output elements are indented to provide a nicely-formatted representation. An output line prefix and maximum number of coordinates per line can be specified.
The Z ordinate value output can be forced to be a specific value.
The extrude
and altitudeMode
modes can be set.
If set, the corresponding sub-elements will be output.
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
ALTITUDE_MODE_ABSOLUTE |
The KML standard value
absolute for use in setAltitudeMode(String) . |
static java.lang.String |
ALTITUDE_MODE_CLAMPTOGROUND |
The KML standard value
clampToGround for use in setAltitudeMode(String) . |
static java.lang.String |
ALTITUDE_MODE_RELATIVETOGROUND |
The KML standard value
relativeToGround for use in setAltitudeMode(String) . |
Constructor | Description |
---|---|
KMLWriter() |
Creates a new writer.
|
Modifier and Type | Method | Description |
---|---|---|
void |
setAltitudeMode(java.lang.String altitudeMode) |
Sets the value output in the
altitudeMode element. |
void |
setExtrude(boolean extrude) |
Sets the flag to be output in the
extrude element. |
void |
setLinePrefix(java.lang.String linePrefix) |
Sets a tag string which is prefixed to every emitted text line.
|
void |
setMaximumCoordinatesPerLine(int maxCoordinatesPerLine) |
Sets the maximum number of coordinates to output per line.
|
void |
setPrecision(int precision) |
Sets the maximum number of decimal places to output in ordinate values.
|
void |
setTesselate(boolean tesselate) |
Sets the flag to be output in the
tesselate element. |
void |
setZ(double zVal) |
Sets the Z value to be output for all coordinates.
|
java.lang.String |
write(Geometry geom) |
Writes a
Geometry in KML format as a string. |
void |
write(Geometry geometry,
java.io.Writer writer) |
Writes the KML representation of a
Geometry to a Writer . |
void |
write(Geometry geometry,
java.lang.StringBuffer buf) |
Appends the KML representation of a
Geometry to a StringBuffer . |
static java.lang.String |
writeGeometry(Geometry geometry,
double z) |
Writes a Geometry as KML to a string, using
a specified Z value.
|
static java.lang.String |
writeGeometry(Geometry geometry,
double z,
int precision,
boolean extrude,
java.lang.String altitudeMode) |
Writes a Geometry as KML to a string, using
a specified Z value, precision, extrude flag,
and altitude mode code.
|
public static java.lang.String ALTITUDE_MODE_CLAMPTOGROUND
clampToGround
for use in setAltitudeMode(String)
.public static java.lang.String ALTITUDE_MODE_RELATIVETOGROUND
relativeToGround
for use in setAltitudeMode(String)
.public static java.lang.String ALTITUDE_MODE_ABSOLUTE
absolute
for use in setAltitudeMode(String)
.public static java.lang.String writeGeometry(Geometry geometry, double z)
geometry
- the geometry to writez
- the Z value to usepublic static java.lang.String writeGeometry(Geometry geometry, double z, int precision, boolean extrude, java.lang.String altitudeMode)
geometry
- the geometry to writez
- the Z value to useprecision
- the maximum number of decimal places to writeextrude
- the extrude flag to writealtitudeMode
- the altitude model code to writepublic void setLinePrefix(java.lang.String linePrefix)
linePrefix
- the tag stringpublic void setMaximumCoordinatesPerLine(int maxCoordinatesPerLine)
maxCoordinatesPerLine
- the maximum number of coordinates to outputpublic void setZ(double zVal)
zVal
- the Z value to outputpublic void setExtrude(boolean extrude)
extrude
element.extrude
- the extrude flag to outputpublic void setTesselate(boolean tesselate)
tesselate
element.tesselate
- the tesselate flag to outputpublic void setAltitudeMode(java.lang.String altitudeMode)
altitudeMode
element.altitudeMode
- string representing the altitude modepublic void setPrecision(int precision)
precision
- the number of decimal places to outputpublic java.lang.String write(Geometry geom)
Geometry
in KML format as a string.geom
- the geometry to writepublic void write(Geometry geometry, java.io.Writer writer) throws java.io.IOException
Geometry
to a Writer
.geometry
- the geometry to writewriter
- the Writer to write tojava.io.IOException
- if an I/O error occurredCopyright © 2018. All rights reserved.