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

de.micromata.opengis.kml.v_2_2_0.LineString 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 de.micromata.opengis.kml.v_2_2_0.annotations.Obvious;
import jakarta.xml.bind.annotation.*;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

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


/**
 * {@code }
 * 

* Defines a connected set of line segments. Use {@code {@code }} to specify the color, * color mode, and width of the line. When a LineString is extruded, the line is extended * to the ground, forming a polygon that looks somewhat like a wall or fence. For extruded * LineStrings, the line itself uses the current LineStyle, and the extrusion uses * the current PolyStyle. See the KML Tutorial for examples of LineStrings (or paths). *

* * Syntax: *
<LineString id="ID">
 *   <!-- specific to LineString -->
 *   <extrude>0</extrude>                   <!-- boolean -->
 *   <tessellate>0</tessellate>             <!-- boolean -->
 *   <altitudeMode>clampToGround</altitudeMode> 
 *       <!-- kml:altitudeModeEnum: clampToGround, relativeToGround, or absolute -->
 *         <!-- or, substitute gx:altitudeMode: clampToSeaFloor, relativeToSeaFloor -->
 * 			<!-- or, substitute gx:altitudeMode: clampToSeaFloor, relativeToSeaFloor -->
 *   <coordinates>...</coordinates>         <!-- lon,lat[,alt] -->
 * </LineString>
* * Extends: * * * Contained By: * * * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LineStringType", propOrder = { "extrude", "tessellate", "altitudeMode", "coordinates", "lineStringSimpleExtension", "lineStringObjectExtension" }) @XmlRootElement(name = "LineString", namespace = "http://www.opengis.net/kml/2.2") public class LineString extends Geometry implements Cloneable { /** * {@code } *

* Boolean value. Specifies whether to connect the LineString to the ground. To extrude * a LineString, the altitude mode must be either relativeToGround, relativeToSeaFloor, * or absolute. The vertices in the LineString are extruded toward the center of the * Earth's sphere. *

*

* Boolean value. Specifies whether to connect the LinearRing to the ground. To extrude * this geometry, the altitude mode must be either relativeToGround, relativeToSeaFloor, * or absolute. Only the vertices of the LinearRing are extruded, not the center of * the geometry. The vertices are extruded toward the center of the Earth's sphere. *

*

* Boolean value. Specifies whether to connect the Polygon to the ground. To extrude * a Polygon, the altitude mode must be either relativeToGround, relativeToSeaFloor, * or absolute. Only the vertices are extruded, not the geometry itself (for example, * a rectangle turns into a box with five faces. The vertices of the Polygon are extruded * toward the center of the Earth's sphere. *

*

* Boolean value. Specifies whether to connect the point to the ground with a line. * To extrude a Point, the value for altitudeMode must be either relativeToGround, * relativeToSeaFloor, or absolute. The point is extruded toward the center of the * Earth's sphere. *

* * * */ @XmlElement(defaultValue = "0") @XmlJavaTypeAdapter(BooleanConverter.class) protected Boolean extrude; /** * {@code } *

* Boolean value. Specifies whether to allow the LineString to follow the terrain. * To enable tessellation, the altitude mode must be clampToGround or clampToSeaFloor. * Very large LineStrings should enable tessellation so that they follow the curvature * of the earth (otherwise, they may go underground and be hidden). *

*

* Boolean value. Specifies whether to allow the LinearRing to follow the terrain. * To enable tessellation, the value for altitudeMode must be clampToGround or clampToSeaFloor. * Very large LinearRings should enable tessellation so that they follow the curvature * of the earth (otherwise, they may go underground and be hidden). *

*

* Boolean value. Specifies whether to allow the Polygon to follow the terrain. To * enable tessellation, the Polygon must have an altitude mode of clampToGround or * clampToSeaFloor. Very large Polygons should enable tessellation so that they follow * the curvature of the earth (otherwise, they may go underground and be hidden). *

* * * */ @XmlElement(defaultValue = "0") @XmlJavaTypeAdapter(BooleanConverter.class) protected Boolean tessellate; /** * AltitudeMode *

* clampToGround, relativeToGround, absolute *

* * See Also: * See LookAt and {@code } * * * */ @XmlElement(defaultValue = "clampToGround") protected AltitudeMode altitudeMode; /** * coordinates (required) *

* A single tuple consisting of floating point values for longitude, latitude, and * altitude (in that order). Longitude and latitude values are in degrees, where longitude * gteq −180 and lteq 180 latitude gteq −90 and lteq 90 altitude values (optional) are in meters * above sea level *

*

* Do not include spaces between the three values that describe a coordinate. *

*

* Two or more coordinate tuples, each consisting of floating point values for longitude, * latitude, and altitude. The altitude component is optional. Insert a space between * tuples. Do not include spaces within a tuple. *

* * * */ @XmlElement(namespace = "http://www.opengis.net/kml/2.2", type = String.class) @XmlJavaTypeAdapter(CoordinatesConverter.class) protected List coordinates; @XmlElement(name = "LineStringSimpleExtensionGroup") @XmlSchemaType(name = "anySimpleType") protected List lineStringSimpleExtension; /** * {@code } *

* This is an abstract base class and cannot be used directly in a KML file. It provides * the id attribute, which allows unique identification of a KML element, and the targetId * attribute, which is used to reference objects that have already been loaded into * Google Earth. The id attribute must be assigned if the Update mechanism is to * be used. *

* * Syntax: *
<!-- abstract element; do not create -->
     * <!-- Object id="ID" targetId="NCName" -->
     * <!-- /Object> -->
* * * */ @XmlElement(name = "LineStringObjectExtensionGroup") protected List lineStringObjectExtension; public LineString() { super(); } /** * * @return * possible object is * {@link Boolean} * */ public Boolean isExtrude() { return extrude; } /** * * * @param value * allowed object is * {@link Boolean} * */ public void setExtrude(Boolean value) { this.extrude = value; } /** * * @return * possible object is * {@link Boolean} * */ public Boolean isTessellate() { return tessellate; } /** * * * @param value * allowed object is * {@link Boolean} * */ public void setTessellate(Boolean value) { this.tessellate = value; } /** * * * @return * possible object is * {@code <}{@link Object}{@code >} * {@code <}{@link de.micromata.opengis.kml.v_2_2_0.AltitudeMode}{@code >} * * */ public AltitudeMode getAltitudeMode() { return altitudeMode; } /** * * * @param value * allowed object is * {@code <}{@link Object}{@code >} * {@code <}{@link de.micromata.opengis.kml.v_2_2_0.AltitudeMode}{@code >} * * */ public void setAltitudeMode(AltitudeMode value) { this.altitudeMode = value; } /** * * */ public List getLineStringSimpleExtension() { if (lineStringSimpleExtension == null) { lineStringSimpleExtension = new ArrayList(); } return this.lineStringSimpleExtension; } /** * * */ public List getLineStringObjectExtension() { if (lineStringObjectExtension == null) { lineStringObjectExtension = new ArrayList(); } return this.lineStringObjectExtension; } /** * * */ public List getCoordinates() { if (coordinates == null) { coordinates = new ArrayList(); } return coordinates; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = ((prime*result)+((extrude == null)? 0 :extrude.hashCode())); result = ((prime*result)+((tessellate == null)? 0 :tessellate.hashCode())); result = ((prime*result)+((altitudeMode == null)? 0 :altitudeMode.hashCode())); result = ((prime*result)+((coordinates == null)? 0 :coordinates.hashCode())); result = ((prime*result)+((lineStringSimpleExtension == null)? 0 :lineStringSimpleExtension.hashCode())); result = ((prime*result)+((lineStringObjectExtension == null)? 0 :lineStringObjectExtension.hashCode())); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (super.equals(obj) == false) { return false; } if ((obj instanceof LineString) == false) { return false; } LineString other = ((LineString) obj); if (extrude == null) { if (other.extrude!= null) { return false; } } else { if (extrude.equals(other.extrude) == false) { return false; } } if (tessellate == null) { if (other.tessellate!= null) { return false; } } else { if (tessellate.equals(other.tessellate) == false) { return false; } } if (altitudeMode == null) { if (other.altitudeMode!= null) { return false; } } else { if (altitudeMode.equals(other.altitudeMode) == false) { return false; } } if (coordinates == null) { if (other.coordinates!= null) { return false; } } else { if (coordinates.equals(other.coordinates) == false) { return false; } } if (lineStringSimpleExtension == null) { if (other.lineStringSimpleExtension!= null) { return false; } } else { if (lineStringSimpleExtension.equals(other.lineStringSimpleExtension) == false) { return false; } } if (lineStringObjectExtension == null) { if (other.lineStringObjectExtension!= null) { return false; } } else { if (lineStringObjectExtension.equals(other.lineStringObjectExtension) == false) { return false; } } return true; } public void setCoordinates(final List coordinates) { this.coordinates = coordinates; } /** * add a value to the coordinates property collection * * @param longitude * required parameter * @param latitude * required parameter * @return * true (as general contract of Collection.add). */ public LineString addToCoordinates(final double longitude, final double latitude) { this.getCoordinates().add(new Coordinate(longitude, latitude)); return this; } /** * add a value to the coordinates property collection * * @param longitude * required parameter * @param latitude * required parameter * @param altitude * required parameter * @return * true (as general contract of Collection.add). */ public LineString addToCoordinates(final double longitude, final double latitude, final double altitude) { this.getCoordinates().add(new Coordinate(longitude, latitude, altitude)); return this; } /** * add a value to the coordinates property collection * * @param coordinates * required parameter * @return * true (as general contract of Collection.add). */ public LineString addToCoordinates(final String coordinates) { this.getCoordinates().add(new Coordinate(coordinates)); return this; } /** * * * @param lineStringSimpleExtension * Objects of the following type are allowed in the list: {@link Object} */ public void setLineStringSimpleExtension(final List lineStringSimpleExtension) { this.lineStringSimpleExtension = lineStringSimpleExtension; } /** * add a value to the lineStringSimpleExtension property collection * * @param lineStringSimpleExtension * Objects of the following type are allowed in the list: {@link Object} * @return * true (as general contract of Collection.add). */ public LineString addToLineStringSimpleExtension(final Object lineStringSimpleExtension) { this.getLineStringSimpleExtension().add(lineStringSimpleExtension); return this; } /** * * * @param lineStringObjectExtension * Objects of the following type are allowed in the list: {@link AbstractObject} */ public void setLineStringObjectExtension(final List lineStringObjectExtension) { this.lineStringObjectExtension = lineStringObjectExtension; } /** * add a value to the lineStringObjectExtension property collection * * @param lineStringObjectExtension * Objects of the following type are allowed in the list: {@link AbstractObject} * @return * true (as general contract of Collection.add). */ public LineString addToLineStringObjectExtension(final AbstractObject lineStringObjectExtension) { this.getLineStringObjectExtension().add(lineStringObjectExtension); return this; } /** * * */ @Obvious @Override public void setObjectSimpleExtension(final List objectSimpleExtension) { super.setObjectSimpleExtension(objectSimpleExtension); } @Obvious @Override public LineString addToObjectSimpleExtension(final Object objectSimpleExtension) { super.getObjectSimpleExtension().add(objectSimpleExtension); return this; } /** * * */ @Obvious @Override public void setGeometrySimpleExtension(final List geometrySimpleExtension) { super.setGeometrySimpleExtension(geometrySimpleExtension); } @Obvious @Override public LineString addToGeometrySimpleExtension(final Object geometrySimpleExtension) { super.getGeometrySimpleExtension().add(geometrySimpleExtension); return this; } /** * * */ @Obvious @Override public void setGeometryObjectExtension(final List geometryObjectExtension) { super.setGeometryObjectExtension(geometryObjectExtension); } @Obvious @Override public LineString addToGeometryObjectExtension(final AbstractObject geometryObjectExtension) { super.getGeometryObjectExtension().add(geometryObjectExtension); return this; } /** * fluent setter * * * @param extrude * required parameter */ public LineString withExtrude(final Boolean extrude) { this.setExtrude(extrude); return this; } /** * fluent setter * * * @param tessellate * required parameter */ public LineString withTessellate(final Boolean tessellate) { this.setTessellate(tessellate); return this; } /** * fluent setter * * * @param altitudeMode * required parameter */ public LineString withAltitudeMode(final AltitudeMode altitudeMode) { this.setAltitudeMode(altitudeMode); return this; } /** * fluent setter * * * @param coordinates * required parameter */ public LineString withCoordinates(final List coordinates) { this.setCoordinates(coordinates); return this; } /** * fluent setter * * * @param lineStringSimpleExtension * required parameter */ public LineString withLineStringSimpleExtension(final List lineStringSimpleExtension) { this.setLineStringSimpleExtension(lineStringSimpleExtension); return this; } /** * fluent setter * * * @param lineStringObjectExtension * required parameter */ public LineString withLineStringObjectExtension(final List lineStringObjectExtension) { this.setLineStringObjectExtension(lineStringObjectExtension); return this; } @Obvious @Override public LineString withObjectSimpleExtension(final List objectSimpleExtension) { super.withObjectSimpleExtension(objectSimpleExtension); return this; } @Obvious @Override public LineString withId(final String id) { super.withId(id); return this; } @Obvious @Override public LineString withTargetId(final String targetId) { super.withTargetId(targetId); return this; } @Obvious @Override public LineString withGeometrySimpleExtension(final List geometrySimpleExtension) { super.withGeometrySimpleExtension(geometrySimpleExtension); return this; } @Obvious @Override public LineString withGeometryObjectExtension(final List geometryObjectExtension) { super.withGeometryObjectExtension(geometryObjectExtension); return this; } /** * Creates a new instance of {@link List}{@code <}{@link Coordinate}{@code >} and set it to this.coordinates. * * This method is a short version for: * {@code * List newValue = new List(); * this.setCoordinates(newValue); } * * */ public List createAndSetCoordinates() { List newValue = new ArrayList(); this.setCoordinates(newValue); return newValue; } @Override public LineString clone() { LineString copy; copy = ((LineString) super.clone()); copy.coordinates = new ArrayList((getCoordinates().size())); for (Coordinate iter: coordinates) { copy.coordinates.add(iter.clone()); } copy.lineStringSimpleExtension = new ArrayList((getLineStringSimpleExtension().size())); for (Object iter: lineStringSimpleExtension) { copy.lineStringSimpleExtension.add(iter); } copy.lineStringObjectExtension = new ArrayList((getLineStringObjectExtension().size())); for (AbstractObject iter: lineStringObjectExtension) { copy.lineStringObjectExtension.add(iter.clone()); } return copy; } }