All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.micromata.opengis.kml.v_2_2_0.ExtendedData Maven / Gradle / Ivy

Go to download

This is JavaAPIforKMml, Micromata's library for use with applications that want to parse, generate and operate on KML. It is an implementation of the OGC KML 2.2 standard. It is written entirely in Java and makes heavy use of JAXB.

There is a newer version: 3.0.4
Show newest version

package de.micromata.opengis.kml.v_2_2_0;

import jakarta.xml.bind.annotation.*;
import org.w3c.dom.Element;

import java.util.ArrayList;
import java.util.List;


/**
 * {@code }
 * 

* Adding untyped data/value pairs using the {@code } element (basic) Declaring new typed * fields using the {@code } element and then instancing them using the {@code } * element (advanced) Referring to XML elements defined in other namespaces by referencing * the external namespace within the KML file (basic) *

*

* Allows you to add custom data to a KML file. This data can be (1) data that references * an external XML schema, (2) untyped data/value pairs, or (3) typed data. A given * KML Feature can contain a combination of these types of custom data. *

*

* For more information, see Adding Custom Data in "Topics in KML." *

*

* The ExtendedData element offers three techniques for adding custom data to a KML * Feature (NetworkLink, Placemark, GroundOverlay, PhotoOverlay, ScreenOverlay, Document, * Folder). These techniques are *

*

* These techniques can be combined within a single KML file or Feature for different * pieces of data. *

* * Syntax: *
<ExtendedData>                       
<Data name="string">
  <displayName>...</displayName>    <!-- string -->
   <value>...</value>                <!-- string -->
</Data> * <SchemaData schemaUrl="anyURI">
<SimpleData name=""> ... </SimpleData>   <!-- string -->
</SchemaData> * <namespace_prefix:other>...</namespace_prefix:other> * </ExtendedData>
* * Contained By: * * * See Also: * Schema * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ExtendedDataType", propOrder = { "data", "schemaData", "any" }) @XmlRootElement(name = "ExtendedData", namespace = "http://www.opengis.net/kml/2.2") public class ExtendedData implements Cloneable { /** * {@code } *

* Creates an untyped name/value pair. The name can have two versions: name and displayName. * The name attribute is used to identify the data pair within the KML file. The displayName * element is used when a properly formatted name, with spaces and HTML formatting, * is displayed in Google Earth. In the {@code } element of {@code }, the notation * $[name:displayName] is replaced with {@code }. If you substitute the value * of the name attribute of the {@code } element in this format (for example, $[holeYardage], * the attribute value is replaced with {@code }. By default, the Placemark's balloon * displays the name/value pairs associated with it. *

* * * */ @XmlElement(name = "Data") protected List data; /** * {@code } *

* The {@code } can be a full URL, a reference to a Schema ID defined in an external * KML file, or a reference to a Schema ID defined in the same KML file. All of the * following specifications are acceptable: *

*

* The Schema element is always a child of Document. The ExtendedData element is a * child of the Feature that contains the custom data. *

*

* This element is used in conjunction with {@code } to add typed custom data to a * KML Feature. The Schema element (identified by the schemaUrl attribute) declares * the custom data type. The actual data objects ("instances" of the custom data) are * defined using the SchemaData element. *

* * * */ @XmlElement(name = "SchemaData") protected List schemaData; @XmlAnyElement(lax = true) protected List any; public ExtendedData() { super(); } /** * * */ public List getData() { if (data == null) { data = new ArrayList(); } return this.data; } /** * * */ public List getSchemaData() { if (schemaData == null) { schemaData = new ArrayList(); } return this.schemaData; } /** * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } @Override public int hashCode() { final int prime = 31; int result = 1; result = ((prime*result)+((data == null)? 0 :data.hashCode())); result = ((prime*result)+((schemaData == null)? 0 :schemaData.hashCode())); result = ((prime*result)+((any == null)? 0 :any.hashCode())); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if ((obj instanceof ExtendedData) == false) { return false; } ExtendedData other = ((ExtendedData) obj); if (data == null) { if (other.data!= null) { return false; } } else { if (data.equals(other.data) == false) { return false; } } if (schemaData == null) { if (other.schemaData!= null) { return false; } } else { if (schemaData.equals(other.schemaData) == false) { return false; } } if (any == null) { if (other.any!= null) { return false; } } else { if (any.equals(other.any) == false) { return false; } } return true; } /** * Creates a new instance of {@link Data} and adds it to data. * This method is a short version for: * {@code * Data data = new Data(); * this.getData().add(data); } * * * @param value * required parameter */ public Data createAndAddData(final String value) { Data newValue = new Data(value); this.getData().add(newValue); return newValue; } /** * Creates a new instance of {@link SchemaData} and adds it to schemaData. * This method is a short version for: * {@code * SchemaData schemaData = new SchemaData(); * this.getSchemaData().add(schemaData); } * * */ public SchemaData createAndAddSchemaData() { SchemaData newValue = new SchemaData(); this.getSchemaData().add(newValue); return newValue; } /** * * * @param data * Objects of the following type are allowed in the list: {@link Data} */ public void setData(final List data) { this.data = data; } /** * add a value to the data property collection * * @param data * Objects of the following type are allowed in the list: {@link Data} * @return * true (as general contract of Collection.add). */ public ExtendedData addToData(final Data data) { this.getData().add(data); return this; } /** * * * @param schemaData * Objects of the following type are allowed in the list: {@link SchemaData} */ public void setSchemaData(final List schemaData) { this.schemaData = schemaData; } /** * add a value to the schemaData property collection * * @param schemaData * Objects of the following type are allowed in the list: {@link SchemaData} * @return * true (as general contract of Collection.add). */ public ExtendedData addToSchemaData(final SchemaData schemaData) { this.getSchemaData().add(schemaData); return this; } /** * * * @param any * Objects of the following type are allowed in the list: {@link Object}{@link Element} */ public void setAny(final List any) { this.any = any; } /** * add a value to the any property collection * * @param any * Objects of the following type are allowed in the list: {@link Object}{@link Element} * @return * true (as general contract of Collection.add). */ public ExtendedData addToAny(final Object any) { this.getAny().add(any); return this; } /** * fluent setter * * * @param data * required parameter */ public ExtendedData withData(final List data) { this.setData(data); return this; } /** * fluent setter * * * @param schemaData * required parameter */ public ExtendedData withSchemaData(final List schemaData) { this.setSchemaData(schemaData); return this; } /** * fluent setter * * * @param any * required parameter */ public ExtendedData withAny(final List any) { this.setAny(any); return this; } @Override public ExtendedData clone() { ExtendedData copy; try { copy = ((ExtendedData) super.clone()); } catch (CloneNotSupportedException _x) { throw new InternalError((_x.toString())); } copy.data = new ArrayList((getData().size())); for (Data iter: data) { copy.data.add(iter.clone()); } copy.schemaData = new ArrayList((getSchemaData().size())); for (SchemaData iter: schemaData) { copy.schemaData.add(iter.clone()); } copy.any = new ArrayList((getAny().size())); for (Object iter: any) { copy.any.add(iter); } return copy; } }