Package gov.nasa.worldwind.ogc.kml.impl
Class KMLExportUtil
- java.lang.Object
-
- gov.nasa.worldwind.ogc.kml.impl.KMLExportUtil
-
public class KMLExportUtil extends java.lang.ObjectCollection of utilities methods for generating KML.
-
-
Constructor Summary
Constructors Constructor Description KMLExportUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidexportAttributesAsKML(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String styleType, ShapeAttributes attributes)Export ShapeAttributes as KML Pair element in a StyleMap.static voidexportBoundaryAsLinearRing(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.Iterable<? extends LatLon> boundary, java.lang.Double altitude)Export the boundary of a polygon as a KML LinearRing.static voidexportDimension(javax.xml.stream.XMLStreamWriter xmlWriter, Size dimension, java.lang.String tagName)Export aSizeas a KML element.static voidexportOffset(javax.xml.stream.XMLStreamWriter xmlWriter, Offset offset, java.lang.String tagName)Export anOffsetas a KML element.static java.lang.StringkmlAltitudeMode(int altitudeMode)Convert a WorldWind altitude mode to a KML altitude mode.static java.lang.StringkmlBoolean(boolean value)Convert a boolean to binary string "1" or "0".static java.lang.StringstripHexPrefix(java.lang.String hexString)Strip the "0X" prefix from a hex string.
-
-
-
Method Detail
-
kmlAltitudeMode
public static java.lang.String kmlAltitudeMode(int altitudeMode)
Convert a WorldWind altitude mode to a KML altitude mode.- Parameters:
altitudeMode- Altitude mode to convert.- Returns:
- The KML altitude mode that corresponds to
altitudeMode. - Throws:
java.lang.IllegalArgumentException- IfaltitudeModeis not a valid WorldWind altitude mode.
-
exportAttributesAsKML
public static void exportAttributesAsKML(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String styleType, ShapeAttributes attributes) throws javax.xml.stream.XMLStreamException, java.io.IOExceptionExport ShapeAttributes as KML Pair element in a StyleMap. This method assumes that the StyleMap tag has already been written; it writes the Pair tag.- Parameters:
xmlWriter- Writer to receive the Style element.styleType- The type of style: normal or highlight. Value should match eitherKMLConstants.NORMALorKMLConstants.HIGHLIGHTattributes- Attributes to export. The method takes no action if this parameter is null.- Throws:
javax.xml.stream.XMLStreamException- if exception occurs writing XML.java.io.IOException- if exception occurs exporting data.
-
exportOffset
public static void exportOffset(javax.xml.stream.XMLStreamWriter xmlWriter, Offset offset, java.lang.String tagName) throws javax.xml.stream.XMLStreamExceptionExport anOffsetas a KML element.- Parameters:
xmlWriter- Writer to receive the Style element.offset- The offset to export. Ifoffsetis null, nothing is written to the stream.tagName- The name of the KML tag to create.- Throws:
javax.xml.stream.XMLStreamException- if exception occurs writing XML.
-
exportDimension
public static void exportDimension(javax.xml.stream.XMLStreamWriter xmlWriter, Size dimension, java.lang.String tagName) throws javax.xml.stream.XMLStreamExceptionExport aSizeas a KML element.- Parameters:
xmlWriter- Writer to receive the Style element.dimension- The dimension to export. Ifdimensionis null, nothing is written to the stream.tagName- The name of the KML tag to create.- Throws:
javax.xml.stream.XMLStreamException- if exception occurs writing XML.
-
stripHexPrefix
public static java.lang.String stripHexPrefix(java.lang.String hexString)
Strip the "0X" prefix from a hex string.- Parameters:
hexString- String to manipulate.- Returns:
- The portion of
hexStringafter the 0X. For example: "0X00FF00" => "00FF00". If the string does not begin with 0X,hexStringis returned. The comparison is not case sensitive.
-
exportBoundaryAsLinearRing
public static void exportBoundaryAsLinearRing(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.Iterable<? extends LatLon> boundary, java.lang.Double altitude) throws javax.xml.stream.XMLStreamExceptionExport the boundary of a polygon as a KML LinearRing.- Parameters:
xmlWriter- Writer to receive generated XML.boundary- Boundary to export.altitude- Altitude of the points in the ring.- Throws:
javax.xml.stream.XMLStreamException- if exception occurs writing XML.
-
kmlBoolean
public static java.lang.String kmlBoolean(boolean value)
Convert a boolean to binary string "1" or "0".- Parameters:
value- Value to convert.- Returns:
- "1" if
valueis true, otherwise "0".
-
-