Package ucar.unidata.data.gis
Class KmlUtil
java.lang.Object
ucar.unidata.data.gis.KmlUtil
DataSource for Web Map Servers
- Version:
- $Revision: 1.38 $ $Date: 2007/04/16 20:34:52 $
- Author:
- IDV development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe id attributestatic final Stringthe name attributestatic final Stringthe x attributestatic final Stringthe xunits attributestatic final Stringthe y attributestatic final Stringthe yunits attributestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringthe FlyTo tagstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringthe Playlist tagstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringthe Tour tagstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringthe Wait tagstatic final Stringstatic final Stringstatic final Stringstatic final Stringthe KML 2.2 XML namespace -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Elementballoonstyle(Element parent, String text, Color bgColor) Create a BalloonStyle elementstatic Elementballoonstyle(Element parent, String id, String text, Color bgColor) Create a BalloonStyle element wrapped in a Style elementstatic Elementcoordinates(Element parent, String coordinates) Make a coordinates elementstatic Elementdescription(Element parent, String description) Make a description element (wrapped in a CDATA structure)static ElementMake a KML Documentstatic ElementMake a KML Document Elementstatic ElementCreate a Folder elementstatic ElementCreate a Folder elementstatic ElementgroundOverlay(Element parent, String name, String description, String url, double north, double south, double east, double west) Create a GroundOverlay elementstatic ElementgroundOverlay(Element parent, String name, String description, String url, double north, double south, double east, double west, boolean visible) Create a GroundOverlay elementstatic ElementCreate an IconStyle elementstatic ElementCreate an IconStyle element enclosed in a Style elementstatic ElementCreate an IconStyle element enclosed in a Style elementstatic ElementCreate an IconStyle element enclosed in a Style elementstatic ElementMake the kml elementstatic Elementlabelstyle(Element parent, Color color, int scale) Create a LabelStyle elementstatic Elementlabelstyle(Element parent, String id, Color color, int scale) Create a LabelStyle element enclosed in a Style Elementstatic Elementlinestring(Element parent, boolean extrude, boolean tesselate, float[][] coords) Create a LineString elementstatic Elementlinestring(Element parent, boolean extrude, boolean tesselate, String coordinates) Create a LineString elementstatic ElementCreate a LineStyle elementstatic ElementmakeElement(Element parent, String tag) Make a Kml elementstatic ElementMake a text node in the parent elementstatic ElementMake a name element (wrapped in a CDATA structure)static ElementnetworkLink(Element parent, String name, String url) Make a NetworkLink elementstatic ElementSet the open flag on an elemenetstatic ElementMake a pair elementstatic double[][]parseCoordinates(String coords) Parse coordinatesstatic ElementCreate a Placemarkstatic Elementplacemark(Element parent, String name, String description, double lat, double lon, double alt, String styleUrl) Make a Placemark elementstatic Elementplacemark(Element parent, String name, String description, double lat, double lon, double alt, String[] styleUrls, boolean visible) Make a Placemark elementstatic Elementplacemark(Element parent, String name, String description, float[][] coords, Color color, int width) Make a Placemark with a Linestringstatic StringMake a point Element stringstatic Elementscreenoverlay(Element parent, String name, String iconURL, double overlayX, double overlayY, String overlayXunits, String overlayYunits, double screenX, double screenY, String screenXunits, String screenYunits) Create a ScreenOverlay Elementstatic Elementscreenoverlay(Element parent, String name, String iconURL, double overlayX, double overlayY, String overlayXunits, String overlayYunits, double screenX, double screenY, String screenXunits, String screenYunits, double sizeX, double sizeY, String sizeXunits, String sizeYunits) Create a ScreenOverlay Elementstatic ElementMake a snippet Elementstatic ElementMake a Style elementstatic ElementCreate a StyleMap for normal and highlighted stylesstatic ElementMake a styleUrl element (why isn't the s capitalized?)static ElementMake a timestamp from the datestatic StringConvert the given color to is string BGR hex representation.static ElementSet the visibility on an Element
-
Field Details
-
TAG_ALTITUDE
- See Also:
-
TAG_ALTITUDEMODE
- See Also:
-
TAG_BALLOONSTYLE
- See Also:
-
TAG_BOTTOMFOV
- See Also:
-
TAG_CAMERA
- See Also:
-
TAG_COLOR
- See Also:
-
TAG_COLORMODE
- See Also:
-
TAG_COORDINATES
- See Also:
-
TAG_DESCRIPTION
- See Also:
-
TAG_DOCUMENT
- See Also:
-
TAG_EAST
- See Also:
-
TAG_EXTRUDE
- See Also:
-
TAG_FOLDER
- See Also:
-
TAG_GROUNDOVERLAY
- See Also:
-
TAG_HEADING
- See Also:
-
TAG_HREF
- See Also:
-
TAG_ICON
- See Also:
-
TAG_ICONSTYLE
- See Also:
-
TAG_KEY
- See Also:
-
TAG_KML
- See Also:
-
TAG_LABELSTYLE
- See Also:
-
TAG_LATITUDE
- See Also:
-
TAG_LATLONBOX
- See Also:
-
TAG_LEFTFOV
- See Also:
-
TAG_LINESTRING
- See Also:
-
TAG_LINESTYLE
- See Also:
-
TAG_LINK
- See Also:
-
TAG_LONGITUDE
- See Also:
-
TAG_LOOKAT
- See Also:
-
TAG_MULTIGEOMETRY
- See Also:
-
TAG_NAME
- See Also:
-
TAG_NEAR
- See Also:
-
TAG_NETWORKLINK
- See Also:
-
TAG_NORTH
- See Also:
-
TAG_PHOTOOVERLAY
- See Also:
-
TAG_OPEN
- See Also:
-
TAG_OVERLAYXY
- See Also:
-
TAG_PAIR
- See Also:
-
TAG_PLACEMARK
- See Also:
-
TAG_POINT
- See Also:
-
TAG_RIGHTFOV
- See Also:
-
TAG_ROLL
- See Also:
-
TAG_ROTATION
- See Also:
-
TAG_SCHEMA
- See Also:
-
TAG_SCREENOVERLAY
- See Also:
-
TAG_SCREENXY
- See Also:
-
TAG_SNIPPET
- See Also:
-
TAG_SOUTH
- See Also:
-
TAG_STYLE
- See Also:
-
TAG_STYLEMAP
- See Also:
-
TAG_STYLEURL
- See Also:
-
TAG_TESSELATE
- See Also:
-
TAG_TEXT
- See Also:
-
TAG_TILT
- See Also:
-
TAG_TIMESTAMP
- See Also:
-
TAG_TOPFOV
- See Also:
-
TAG_URL
- See Also:
-
TAG_VIEWVOLUME
- See Also:
-
TAG_SCALE
- See Also:
-
TAG_VIEWBOUNDSCALE
- See Also:
-
TAG_VISIBILITY
- See Also:
-
TAG_WEST
- See Also:
-
TAG_WHEN
- See Also:
-
TAG_WIDTH
- See Also:
-
TAG_TOUR
the Tour tag- See Also:
-
TAG_PLAYLIST
the Playlist tag- See Also:
-
TAG_FLYTO
the FlyTo tag- See Also:
-
TAG_WAIT
the Wait tag- See Also:
-
ATTR_ID
the id attribute- See Also:
-
ATTR_NAME
the name attribute- See Also:
-
ATTR_X
the x attribute- See Also:
-
ATTR_Y
the y attribute- See Also:
-
ATTR_XUNITS
the xunits attribute- See Also:
-
ATTR_YUNITS
the yunits attribute- See Also:
-
XMLNS_KML2_2
the KML 2.2 XML namespace- See Also:
-
-
Constructor Details
-
KmlUtil
public KmlUtil()
-
-
Method Details
-
makeElement
Make a Kml element- Parameters:
parent- the parent elementtag- the tag name- Returns:
- the Element
-
kml
Make the kml element- Parameters:
name- the name of the element (not used)- Returns:
- the kml element
-
document
Make a KML Document- Parameters:
parent- parent Elementname- the name of the Document- Returns:
- the Document element
-
document
Make a KML Document Element- Parameters:
parent- the parent nodename- the name of the documentvisible- true if visible- Returns:
- the Document element
-
networkLink
Make a NetworkLink element- Parameters:
parent- parent nodename- name of the linkurl- link URL- Returns:
- the NetworkLink element
-
makeText
Make a text node in the parent element- Parameters:
parent- the parenttag- the tagtext- the text- Returns:
- parent with the text element (e.g.,
)text
-
visible
Set the visibility on an Element- Parameters:
parent- the parent elementvisible- true to be visible- Returns:
- the parent
-
snippet
Make a snippet Element- Parameters:
parent- the parentsnippet- the snippet text- Returns:
- the parent with the snippet
-
open
Set the open flag on an elemenet- Parameters:
parent- the parent nodeopen- true to be open- Returns:
- the parent node
-
timestamp
Make a timestamp from the date- Parameters:
parent- the parent nodedttm- the date- Returns:
- the timestamp
-
pair
Make a pair element- Parameters:
parent- the parent elementkey- the pair keystyleUrl- the pair styleUrl- Returns:
- the Pair element
-
stylemap
public static Element stylemap(Element parent, String id, String normalStyleUrl, String highlightStyleUrl) Create a StyleMap for normal and highlighted styles- Parameters:
parent- the parent elementid- the id of the StyleMapnormalStyleUrl- the styleUrl of the normal stylehighlightStyleUrl- the styleUrl of the highlighted style- Returns:
- the StyleMap element
-
styleurl
Make a styleUrl element (why isn't the s capitalized?)- Parameters:
parent- the parent elementurl- the url- Returns:
- the styleUrl element
-
style
Make a Style element- Parameters:
parent- the parent nodeid- the Style id- Returns:
- the Style element
-
iconstyle
Create an IconStyle element enclosed in a Style element- Parameters:
parent- the parent Elementid- name of the enclosing Style elementurl- the icon URL- Returns:
- the Style element enclosing the IconStyle element
-
iconstyle
Create an IconStyle element enclosed in a Style element- Parameters:
parent- the parent Elementid- name of the enclosing Style elementurl- the icon URLscale- the size scale (>= 0, 1 = normal size)- Returns:
- the Style element enclosing the IconStyle element
-
iconstyle
Create an IconStyle element enclosed in a Style element- Parameters:
parent- the parent Elementid- name of the enclosing Style elementurl- the icon URLscale- the size scale (>= 0, 1 = normal size)color- the icon color- Returns:
- the Style element enclosing the IconStyle element
-
iconstyle
Create an IconStyle element- Parameters:
parent- the parent (Style) Elementurl- the icon URLscale- the size scale (>= 0, 1 = normal size)color- the icon color- Returns:
- the IconStyle element
-
balloonstyle
Create a BalloonStyle element- Parameters:
parent- parent (Style) elementtext- the balloon textbgColor- the background color- Returns:
- the BalloonStyle element
-
balloonstyle
Create a BalloonStyle element wrapped in a Style element- Parameters:
parent- parent elementid- of the enclosing Style elementtext- the balloon textbgColor- the background color- Returns:
- the Style Element with the BalloonStyle element included
-
labelstyle
Create a LabelStyle element enclosed in a Style Element- Parameters:
parent- The parent for the styleid- the Style idcolor- the label colorscale- the label size scale- Returns:
- the Style Element enclosing the LabelStyle
-
labelstyle
Create a LabelStyle element- Parameters:
parent- The parent (Style) elementcolor- the label colorscale- the label size scale- Returns:
- the LabelStyle
-
linestyle
Create a LineStyle element- Parameters:
parent- the parent nodeid- the id for the enclosing Stylecolor- line colorwidth- line width- Returns:
- the LineStyle Element
-
linestring
public static Element linestring(Element parent, boolean extrude, boolean tesselate, String coordinates) Create a LineString element- Parameters:
parent- the parent nodeextrude- true to extrudetesselate- true to tesselatecoordinates- comma separated list of coordinates (lon1,lat1,alt1,lon2,lat2,alt2,....lonN,latN,altN)- Returns:
- the LineString element
-
linestring
public static Element linestring(Element parent, boolean extrude, boolean tesselate, float[][] coords) Create a LineString element- Parameters:
parent- the parent nodeextrude- true to extrudetesselate- true to tesselatecoords- array of coordinates (coords[lon,lat] or coords[lon,lat,alt])- Returns:
- the LineString element
-
coordinates
Make a coordinates element- Parameters:
parent- the parent nodecoordinates- the coordinates (comma separated values)- Returns:
- the coordinates element
-
name
Make a name element (wrapped in a CDATA structure)- Parameters:
parent- the parent nodename- the name text- Returns:
- the name element
-
description
Make a description element (wrapped in a CDATA structure)- Parameters:
parent- the parent nodedescription- the description- Returns:
- the description element
-
folder
Create a Folder element- Parameters:
parent- the parent nodename- the name of the folder- Returns:
- the Folder element
-
folder
Create a Folder element- Parameters:
parent- the parent nodename- the name of the foldervisible- true to be visible. (all children must be not visible if you want the folder turned off)- Returns:
- the Folder element
-
placemark
Create a Placemark- Parameters:
parent- the parent nodename- the name of the placemarkdescription- the description of the placemark- Returns:
- the Placemark element
-
point
Make a point Element string- Parameters:
lat- the point latitudelon- the point longitudealt- the point altitudestyle- the point style (not used)- Returns:
- the Point text
-
placemark
public static Element placemark(Element parent, String name, String description, double lat, double lon, double alt, String styleUrl) Make a Placemark element- Parameters:
parent- the parent nodename- the Placemark namedescription- the Placemark descriptionlat- the latitudelon- the latitudealt- the latitudestyleUrl- the styleUrl- Returns:
- the Placemark element
-
placemark
public static Element placemark(Element parent, String name, String description, double lat, double lon, double alt, String[] styleUrls, boolean visible) Make a Placemark element- Parameters:
parent- the parent nodename- the Placemark namedescription- the Placemark descriptionlat- the latitudelon- the latitudealt- the latitudestyleUrls- the array styleUrlsvisible- true for this to be showing- Returns:
- the Placemark element
-
groundOverlay
public static Element groundOverlay(Element parent, String name, String description, String url, double north, double south, double east, double west) Create a GroundOverlay element- Parameters:
parent- the parent nodename- the name of the GroundOverlaydescription- the description of the GroundOverlayurl- the URL of the overlaynorth- the north coordinatesouth- the south coordinateeast- the east coordinatewest- the west coordinate- Returns:
- the GroundOverlay
-
groundOverlay
public static Element groundOverlay(Element parent, String name, String description, String url, double north, double south, double east, double west, boolean visible) Create a GroundOverlay element- Parameters:
parent- the parent nodename- the name of the GroundOverlaydescription- the description of the GroundOverlayurl- the URL of the overlaynorth- the north coordinatesouth- the south coordinateeast- the east coordinatewest- the west coordinate- Returns:
- the GroundOverlay
-
placemark
public static Element placemark(Element parent, String name, String description, float[][] coords, Color color, int width) Make a Placemark with a Linestring- Parameters:
parent- the parent nodename- the name of the Placemarkdescription- the description of the Placemarkcoords- the line coordinatescolor- the line colorwidth- the line width- Returns:
- the Placemark
-
parseCoordinates
Parse coordinates- Parameters:
coords- the string of space separated coordinates- Returns:
- the parsed coordinates
-
toBGRHexString
Convert the given color to is string BGR hex representation. KML uses ABGR instead of RGBA- Parameters:
c- color- Returns:
- hex representation (BGR) of the Color's r,g,b values
-
screenoverlay
public static Element screenoverlay(Element parent, String name, String iconURL, double overlayX, double overlayY, String overlayXunits, String overlayYunits, double screenX, double screenY, String screenXunits, String screenYunits) Create a ScreenOverlay Element- Parameters:
parent- parent Elementname- the name of the elementiconURL- the URL of the iconoverlayX- x component of a point on the overlay imageoverlayY- y component of a point on the overlay imageoverlayXunits- units of overlayX, can be one of: fraction, pixels, or insetPixelsoverlayYunits- units of overlayY, can be one of: fraction, pixels, or insetPixelsscreenX- x component of a point on the screenscreenY- y component of a point on the screenscreenXunits- units of screenX, can be one of: fraction, pixels, or insetPixelsscreenYunits- units of screenY, can be one of: fraction, pixels, or insetPixels- Returns:
- the ScreenOverlay Element
-
screenoverlay
public static Element screenoverlay(Element parent, String name, String iconURL, double overlayX, double overlayY, String overlayXunits, String overlayYunits, double screenX, double screenY, String screenXunits, String screenYunits, double sizeX, double sizeY, String sizeXunits, String sizeYunits) Create a ScreenOverlay Element- Parameters:
parent- parent Elementname- the name of the elementiconURL- the URL of the iconoverlayX- x component of a point on the overlay imageoverlayY- y component of a point on the overlay imageoverlayXunits- units of overlayX, can be one of: fraction, pixels, or insetPixelsoverlayYunits- units of overlayY, can be one of: fraction, pixels, or insetPixelsscreenX- x component of a point on the screenscreenY- y component of a point on the screenscreenXunits- units of screenX, can be one of: fraction, pixels, or insetPixelsscreenYunits- units of screenY, can be one of: fraction, pixels, or insetPixelssizeX- the x size of the image for the screen overlay, as follows: 1 indicates to use the native dimension, 0 indicates to maintain the aspect ratio, a value of n sets the value of the dimensionsizeY- the y size of the image for the screen overlay (see sizeX)sizeXunits- units of sizeX, fraction or pixelssizeYunits- units of sizeY, fraction or pixels- Returns:
- the ScreenOverlay Element
-