Package gov.nasa.worldwind.ogc.kml.impl
Class KMLUtil
- java.lang.Object
-
- gov.nasa.worldwind.ogc.kml.impl.KMLUtil
-
public class KMLUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringKML_FRACTIONstatic java.lang.StringKML_INSET_PIXELSstatic java.lang.StringKML_PIXELS
-
Constructor Summary
Constructors Constructor Description KMLUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ShapeAttributesassembleInteriorAttributes(ShapeAttributes attrs, KMLPolyStyle style)static ShapeAttributesassembleLineAttributes(ShapeAttributes attrs, KMLLineStyle style)static PositioncomputeAltitude(Globe globe, Position position, java.lang.String altitudeMode)Create aPosition, taking into account an altitude mode.static java.util.List<Position>computeAltitude(Globe globe, java.util.List<? extends Position> positions, java.lang.String altitudeMode)Compute the altitude of each position in a list, based on altitude mode.static intconvertAltitudeMode(java.lang.String altMode, int defaultAltMode)static SectorcreateSectorFromLatLonBox(KMLAbstractLatLonBoxType box)Creates aSectorfrom aKMLAbstractLatLonBoxType'snorth,south,east, andwestcoordinates.static voidgetPositions(Globe globe, KMLAbstractGeometry geometry, java.util.List<Position> positions)Get all of the positions that make up aKMLAbstractGeometry.static booleanisHighlightStyleState(KMLAbstractSubStyle subStyle)Indicate whether a specified sub-style has the "highlight" style-state field.static java.lang.StringkmlUnitsToWWUnits(java.lang.String units)Translate a KML units string ("pixels", "insetPixels", or "fraction") into the corresponding WW unit constant (AVKey.PIXELS,AVKey.INSET_PIXELS, orAVKey.FRACTION.static java.util.List<LatLon>rotateSector(Globe globe, Sector sector, Angle rotation)Rotate the corners of a sector around a normal vector through the sector centroid.static java.lang.StringwwUnitsToKMLUnits(java.lang.String units)Translate a WorldWind units constant (AVKey.PIXELS,AVKey.INSET_PIXELS, orAVKey.FRACTIONto the corresponding KML unit string ("pixels", "insetPixels", or "fraction").
-
-
-
Field Detail
-
KML_PIXELS
public static final java.lang.String KML_PIXELS
- See Also:
- Constant Field Values
-
KML_FRACTION
public static final java.lang.String KML_FRACTION
- See Also:
- Constant Field Values
-
KML_INSET_PIXELS
public static final java.lang.String KML_INSET_PIXELS
- See Also:
- Constant Field Values
-
-
Method Detail
-
assembleLineAttributes
public static ShapeAttributes assembleLineAttributes(ShapeAttributes attrs, KMLLineStyle style)
-
assembleInteriorAttributes
public static ShapeAttributes assembleInteriorAttributes(ShapeAttributes attrs, KMLPolyStyle style)
-
isHighlightStyleState
public static boolean isHighlightStyleState(KMLAbstractSubStyle subStyle)
Indicate whether a specified sub-style has the "highlight" style-state field.- Parameters:
subStyle- the sub-style to test. May be null, in which case this method returns false.- Returns:
- true if the sub-style has the "highlight" field, otherwise false.
-
convertAltitudeMode
public static int convertAltitudeMode(java.lang.String altMode, int defaultAltMode)
-
kmlUnitsToWWUnits
public static java.lang.String kmlUnitsToWWUnits(java.lang.String units)
Translate a KML units string ("pixels", "insetPixels", or "fraction") into the corresponding WW unit constant (AVKey.PIXELS,AVKey.INSET_PIXELS, orAVKey.FRACTION.- Parameters:
units- KML units to translate.- Returns:
- WW units, or null if the argument is not a valid KML unit.
-
wwUnitsToKMLUnits
public static java.lang.String wwUnitsToKMLUnits(java.lang.String units)
Translate a WorldWind units constant (AVKey.PIXELS,AVKey.INSET_PIXELS, orAVKey.FRACTIONto the corresponding KML unit string ("pixels", "insetPixels", or "fraction").- Parameters:
units- WorldWind units to translate.- Returns:
- KML units, or null if the argument is not a valid WW unit.
-
createSectorFromLatLonBox
public static Sector createSectorFromLatLonBox(KMLAbstractLatLonBoxType box)
Creates aSectorfrom aKMLAbstractLatLonBoxType'snorth,south,east, andwestcoordinates. This returnsnullif any of these coordinates are unspecified.- Parameters:
box- a box who's coordinates define aSector.- Returns:
- the
Sectorthat bounds the specifiedbox'scoordinates. - Throws:
java.lang.IllegalArgumentException- if theboxisnull.
-
getPositions
public static void getPositions(Globe globe, KMLAbstractGeometry geometry, java.util.List<Position> positions)
Get all of the positions that make up aKMLAbstractGeometry. If the geometry contains other geometries, this method collects all the points from all of the geometries.- Parameters:
globe- Globe to use to determine altitude above terrain.geometry- Geometry to collect positions from.positions- Placemark positions will be added to this list.
-
computeAltitude
public static java.util.List<Position> computeAltitude(Globe globe, java.util.List<? extends Position> positions, java.lang.String altitudeMode)
Compute the altitude of each position in a list, based on altitude mode.- Parameters:
globe- Globe to use to determine altitude above terrain.positions- Positions to compute altitude for.altitudeMode- A KML altitude mode string.- Returns:
- A new list of positions with altitudes set based on
altitudeMode.
-
computeAltitude
public static Position computeAltitude(Globe globe, Position position, java.lang.String altitudeMode)
Create aPosition, taking into account an altitude mode.- Parameters:
globe- Globe to use to determine altitude above terrain.position- Position to evaluate.altitudeMode- A KML altitude mode string.- Returns:
- New Position.
-
rotateSector
public static java.util.List<LatLon> rotateSector(Globe globe, Sector sector, Angle rotation)
Rotate the corners of a sector around a normal vector through the sector centroid.- Parameters:
globe- Globe to use to compute rotated positions.sector- Sector to rotate.rotation- Rotation angle. Positive angles produce counterclockwise rotation.- Returns:
- List of rotated corners.
-
-