public class Kml
extends java.lang.Object
implements java.lang.Cloneable
A basic
The
The root element of a KML file. This element is required. It follows the xml declaration at the beginning of the file. The hint attribute is used as a signal to Google Earth to display the file as celestial data.
Syntax:<kml xmlns="http://www.opengis.net/kml/2.2" hint="target=sky"> ... </kml>| Modifier and Type | Field and Description |
|---|---|
protected Feature |
feature
|
protected java.lang.String |
hint |
protected java.util.List<AbstractObject> |
kmlObjectExtension
|
protected java.util.List<java.lang.Object> |
kmlSimpleExtension |
protected NetworkLinkControl |
networkLinkControl
|
| Constructor and Description |
|---|
Kml() |
| Modifier and Type | Method and Description |
|---|---|
Kml |
addToKmlObjectExtension(AbstractObject kmlObjectExtension)
add a value to the kmlObjectExtension property collection
|
Kml |
addToKmlSimpleExtension(java.lang.Object kmlSimpleExtension)
add a value to the kmlSimpleExtension property collection
|
Kml |
clone() |
Document |
createAndSetDocument()
Creates a new instance of
Document and set it to feature. |
Folder |
createAndSetFolder()
Creates a new instance of
Folder and set it to feature. |
GroundOverlay |
createAndSetGroundOverlay()
Creates a new instance of
GroundOverlay and set it to feature. |
NetworkLink |
createAndSetNetworkLink()
Creates a new instance of
NetworkLink and set it to feature. |
NetworkLinkControl |
createAndSetNetworkLinkControl()
Creates a new instance of
NetworkLinkControl and set it to networkLinkControl. |
PhotoOverlay |
createAndSetPhotoOverlay()
Creates a new instance of
PhotoOverlay and set it to feature. |
Placemark |
createAndSetPlacemark()
Creates a new instance of
Placemark and set it to feature. |
ScreenOverlay |
createAndSetScreenOverlay()
Creates a new instance of
ScreenOverlay and set it to feature. |
Tour |
createAndSetTour()
Creates a new instance of
Tour and set it to feature. |
boolean |
equals(java.lang.Object obj) |
Feature |
getFeature() |
java.lang.String |
getHint() |
java.util.List<AbstractObject> |
getKmlObjectExtension() |
java.util.List<java.lang.Object> |
getKmlSimpleExtension() |
NetworkLinkControl |
getNetworkLinkControl() |
int |
hashCode() |
boolean |
marshal()
Java to KML
The object graph is printed to the console.
|
boolean |
marshal(org.xml.sax.ContentHandler contenthandler)
Java to KML
The object graph is marshalled to a Contenthandler object.
|
boolean |
marshal(java.io.File filename)
Java to KML
The object graph is marshalled to a File object.
|
boolean |
marshal(java.io.OutputStream outputstream)
Java to KML
The object graph is marshalled to an OutputStream object.
|
boolean |
marshal(java.io.Writer writer)
Java to KML
The object graph is marshalled to a Writer object.
|
boolean |
marshalAsKmz(java.lang.String name,
Kml... additionalFiles) |
void |
setFeature(Feature value) |
void |
setHint(java.lang.String value) |
void |
setKmlObjectExtension(java.util.List<AbstractObject> kmlObjectExtension) |
void |
setKmlSimpleExtension(java.util.List<java.lang.Object> kmlSimpleExtension) |
void |
setNetworkLinkControl(NetworkLinkControl value) |
static Kml |
unmarshal(java.io.File file)
KML to Java
KML given as a file object is transformed into a graph of Java objects.
|
static Kml |
unmarshal(java.io.File file,
boolean validate)
KML to Java
KML given as a file object is transformed into a graph of Java objects.
|
static Kml |
unmarshal(java.io.InputStream content)
KML to Java
Similar to the other unmarshal methods
with the exception that it transforms a InputStream into a graph of Java objects.
|
static Kml |
unmarshal(java.lang.String content)
KML to Java
Similar to the other unmarshal methods
with the exception that it transforms a String into a graph of Java objects.
|
static Kml[] |
unmarshalFromKmz(java.io.File file)
KMZ to Java
Similar to the other unmarshal methods
with the exception that it transforms a KMZ-file into a graph of Java objects.
|
Kml |
withFeature(Feature feature)
fluent setter
|
Kml |
withHint(java.lang.String hint)
fluent setter
|
Kml |
withKmlObjectExtension(java.util.List<AbstractObject> kmlObjectExtension)
fluent setter
|
Kml |
withKmlSimpleExtension(java.util.List<java.lang.Object> kmlSimpleExtension)
fluent setter
|
Kml |
withNetworkLinkControl(NetworkLinkControl networkLinkControl)
fluent setter
|
protected NetworkLinkControl networkLinkControl
Controls the behavior of files fetched by a
<NetworkLinkControl> <minRefreshPeriod>0</minRefreshPeriod> <!-- float --> <maxSessionLength>-1</maxSessionLength> <!-- float --> <cookie>...</cookie> <!-- string --> <message>...</message> <!-- string --> <linkName>...</linkName> <!-- string --> <linkDescription>...</linkDescription> <!-- string --> <linkSnippet maxLines="2">...</linkSnippet> <!-- string --> <expires>...</expires> <!-- kml:dateTime --> <Update>...</Update> <!-- Change,Create,Delete --> <AbstractView>...</AbstractView> <!-- LookAt or Camera --> </NetworkLinkControl>See Also:
protected Feature feature
This is an abstract element and cannot be used directly in a KML file. The following diagram shows how some of a Feature's elements appear in Google Earth.
Syntax:<!-- abstract element; do not create -->
<!-- Feature id="ID" --> <!-- Document,Folder,
NetworkLink,Placemark,
GroundOverlay,PhotoOverlay,ScreenOverlay -->
<name>...</name> <!-- string -->
<visibility>1</visibility> <!-- boolean -->
<open>0</open> <!-- boolean -->
<atom:author>...<atom:author> <!-- xmlns:atom -->
<atom:link>...</atom:link> <!-- xmlns:atom -->
<address>...</address> <!-- string -->
<xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal -->
<phoneNumber>...</phoneNumber> <!-- string -->
<Snippet maxLines="2">...</Snippet> <!-- string -->
<description>...</description> <!-- string -->
<AbstractView>...</AbstractView> <!-- Camera or LookAt -->
<TimePrimitive>...</TimePrimitive> <!-- TimeStamp or TimeSpan -->
<styleUrl>...</styleUrl> <!-- anyURI -->
<StyleSelector>...</StyleSelector>
<Region>...</Region>
<Metadata>...</Metadata> <!-- deprecated in KML 2.2 -->
<ExtendedData>...</ExtendedData> <!-- new in KML 2.2 -->
<-- /Feature -->
Extends:protected java.util.List<java.lang.Object> kmlSimpleExtension
protected java.util.List<AbstractObject> kmlObjectExtension
protected java.lang.String hint
public NetworkLinkControl getNetworkLinkControl()
NetworkLinkControlnetworkLinkControlpublic void setNetworkLinkControl(NetworkLinkControl value)
value - allowed object is
NetworkLinkControlnetworkLinkControlpublic Feature getFeature()
<Container
<GroundOverlay
<NetworkLink
<Folder
<PhotoOverlay
<Document
<Tour
<ScreenOverlay
<Feature
<Placemark
<Overlayfeaturepublic void setFeature(Feature value)
value - allowed object is
<Container
<GroundOverlay
<NetworkLink
<Folder
<PhotoOverlay
<Document
<Tour
<ScreenOverlay
<Feature
<Placemark
<Overlayfeaturepublic java.util.List<java.lang.Object> getKmlSimpleExtension()
kmlSimpleExtensionpublic java.util.List<AbstractObject> getKmlObjectExtension()
kmlObjectExtensionpublic java.lang.String getHint()
Stringhintpublic void setHint(java.lang.String value)
value - allowed object is
Stringhintpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic NetworkLinkControl createAndSetNetworkLinkControl()
NetworkLinkControl and set it to networkLinkControl.
This method is a short version for:
NetworkLinkControl networkLinkControl = new NetworkLinkControl();
this.setNetworkLinkControl(networkLinkControl); public Tour createAndSetTour()
Tour and set it to feature.
This method is a short version for:
Tour tour = new Tour();
this.setFeature(tour); public ScreenOverlay createAndSetScreenOverlay()
ScreenOverlay and set it to feature.
This method is a short version for:
ScreenOverlay screenOverlay = new ScreenOverlay();
this.setFeature(screenOverlay); public PhotoOverlay createAndSetPhotoOverlay()
PhotoOverlay and set it to feature.
This method is a short version for:
PhotoOverlay photoOverlay = new PhotoOverlay();
this.setFeature(photoOverlay); public GroundOverlay createAndSetGroundOverlay()
GroundOverlay and set it to feature.
This method is a short version for:
GroundOverlay groundOverlay = new GroundOverlay();
this.setFeature(groundOverlay); public NetworkLink createAndSetNetworkLink()
NetworkLink and set it to feature.
This method is a short version for:
NetworkLink networkLink = new NetworkLink();
this.setFeature(networkLink); public Folder createAndSetFolder()
Folder and set it to feature.
This method is a short version for:
Folder folder = new Folder();
this.setFeature(folder); public Document createAndSetDocument()
Document and set it to feature.
This method is a short version for:
Document document = new Document();
this.setFeature(document); public Placemark createAndSetPlacemark()
Placemark and set it to feature.
This method is a short version for:
Placemark placemark = new Placemark();
this.setFeature(placemark); public void setKmlSimpleExtension(java.util.List<java.lang.Object> kmlSimpleExtension)
kmlSimpleExtension - kmlSimpleExtensionpublic Kml addToKmlSimpleExtension(java.lang.Object kmlSimpleExtension)
kmlSimpleExtension - Objects of the following type are allowed in the list: Objectpublic void setKmlObjectExtension(java.util.List<AbstractObject> kmlObjectExtension)
kmlObjectExtension - kmlObjectExtensionpublic Kml addToKmlObjectExtension(AbstractObject kmlObjectExtension)
kmlObjectExtension - Objects of the following type are allowed in the list: AbstractObjectpublic Kml withNetworkLinkControl(NetworkLinkControl networkLinkControl)
networkLinkControl - required parametersetNetworkLinkControl(NetworkLinkControl)public Kml withFeature(Feature feature)
feature - required parametersetFeature(Feature)public Kml withKmlSimpleExtension(java.util.List<java.lang.Object> kmlSimpleExtension)
kmlSimpleExtension - required parameter#setKmlSimpleExtension(Listpublic Kml withKmlObjectExtension(java.util.List<AbstractObject> kmlObjectExtension)
kmlObjectExtension - required parameter#setKmlObjectExtension(List) public Kml withHint(java.lang.String hint)
hint - required parametersetHint(String)public boolean marshal(java.io.OutputStream outputstream)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionmarshalKmz(String, Kml...)public boolean marshal(java.io.Writer writer)
marshalKmz(String, Kml...)public boolean marshal(org.xml.sax.ContentHandler contenthandler)
https://jaxb.dev.java.net/faq/
http://code.google.com/p/javaapiforkml/issues/detail?id=7
The object is not saved as a zipped .kmz file.marshalKmz(String, Kml...)public boolean marshal()
public boolean marshal(java.io.File filename)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionmarshalKmz(String, Kml...)public boolean marshalAsKmz(@NotNull
java.lang.String name,
Kml... additionalFiles)
throws java.io.IOException
java.io.IOExceptionpublic static Kml unmarshal(java.io.File file, boolean validate)
public static Kml unmarshal(java.io.File file)
public static Kml unmarshal(java.lang.String content)
public static Kml unmarshal(java.io.InputStream content)
public static Kml[] unmarshalFromKmz(@NotNull java.io.File file) throws java.io.IOException
java.io.IOExceptionpublic Kml clone()
clone in class java.lang.ObjectCopyright © 2014 Micromata GmbH. All Rights Reserved.