Class KMLUtil


  • public class KMLUtil
    extends java.lang.Object
    • Constructor Detail

      • KMLUtil

        public KMLUtil()
    • Method Detail

      • 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, or AVKey.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, or AVKey.FRACTION to 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 a Sector from a KMLAbstractLatLonBoxType's north, south, east, and west coordinates. This returns null if any of these coordinates are unspecified.
        Parameters:
        box - a box who's coordinates define a Sector.
        Returns:
        the Sector that bounds the specified box's coordinates.
        Throws:
        java.lang.IllegalArgumentException - if the box is null.
      • getPositions

        public static void getPositions​(Globe globe,
                                        KMLAbstractGeometry geometry,
                                        java.util.List<Position> positions)
        Get all of the positions that make up a KMLAbstractGeometry. 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 a Position, 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.