public class Kml extends Object implements 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 String |
hint |
protected List<AbstractObject> |
kmlObjectExtension
|
protected List<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(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(Object obj) |
Feature |
getFeature() |
String |
getHint() |
List<AbstractObject> |
getKmlObjectExtension() |
List<Object> |
getKmlSimpleExtension() |
NetworkLinkControl |
getNetworkLinkControl() |
int |
hashCode() |
boolean |
marshal()
Java to KML
The object graph is printed to the console.
|
boolean |
marshal(ContentHandler contenthandler)
Java to KML
The object graph is marshalled to a Contenthandler object.
|
boolean |
marshal(File filename)
Java to KML
The object graph is marshalled to a File object.
|
boolean |
marshal(OutputStream outputstream)
Java to KML
The object graph is marshalled to an OutputStream object.
|
boolean |
marshal(Writer writer)
Java to KML
The object graph is marshalled to a Writer object.
|
boolean |
marshalAsKmz(String name,
Kml... additionalFiles) |
void |
setFeature(Feature value) |
void |
setHint(String value) |
void |
setKmlObjectExtension(List<AbstractObject> kmlObjectExtension) |
void |
setKmlSimpleExtension(List<Object> kmlSimpleExtension) |
void |
setNetworkLinkControl(NetworkLinkControl value) |
static Kml |
unmarshal(File file)
KML to Java
KML given as a file object is transformed into a graph of Java objects.
|
static Kml |
unmarshal(File file,
boolean validate)
KML to Java
KML given as a file object is transformed into a graph of Java objects.
|
static Kml |
unmarshal(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(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(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(String hint)
fluent setter
|
Kml |
withKmlObjectExtension(List<AbstractObject> kmlObjectExtension)
fluent setter
|
Kml |
withKmlSimpleExtension(List<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 List<AbstractObject> kmlObjectExtension
protected 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 List<AbstractObject> getKmlObjectExtension()
kmlObjectExtensionpublic 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(List<Object> kmlSimpleExtension)
kmlSimpleExtension - kmlSimpleExtensionpublic Kml addToKmlSimpleExtension(Object kmlSimpleExtension)
kmlSimpleExtension - Objects of the following type are allowed in the list: Objectpublic void setKmlObjectExtension(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(List<Object> kmlSimpleExtension)
kmlSimpleExtension - required parameter#setKmlSimpleExtension(Listpublic Kml withKmlObjectExtension(List<AbstractObject> kmlObjectExtension)
kmlObjectExtension - required parameter#setKmlObjectExtension(List) public Kml withHint(String hint)
hint - required parametersetHint(String)public boolean marshal(OutputStream outputstream) throws FileNotFoundException
FileNotFoundExceptionmarshalKmz(String, Kml...)public boolean marshal(Writer writer)
marshalKmz(String, Kml...)public boolean marshal(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(File filename) throws FileNotFoundException
FileNotFoundExceptionmarshalKmz(String, Kml...)public boolean marshalAsKmz(@NotNull
String name,
Kml... additionalFiles)
throws IOException
IOExceptionpublic static Kml unmarshal(File file, boolean validate)
public static Kml unmarshal(File file)
public static Kml unmarshal(String content)
public static Kml unmarshal(InputStream content)
public static Kml[] unmarshalFromKmz(@NotNull File file) throws IOException
IOExceptionCopyright © 2014 Micromata GmbH. All rights reserved.