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

de.micromata.opengis.kml.v_2_2_0.gx.LatLonQuad 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.gx;

import de.micromata.opengis.kml.v_2_2_0.AbstractObject;
import de.micromata.opengis.kml.v_2_2_0.Coordinate;
import de.micromata.opengis.kml.v_2_2_0.CoordinatesConverter;
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;


/**
 * gx:LatLonQuad
 * 

* Allows non-rectangular quadrilateral ground overlays. *

*

* If a third value is inserted into any tuple (representing altitude) it will be ignored. * Altitude is set using altitude and altitudeMode (or gx:altitudeMode) extending * GroundOverlay. Allowed altitude modes are absolute, clampToGround, and clampToSeaFloor. *

*

* Specifies the coordinates of the four corner points of a quadrilateral defining * the overlay area. Exactly four coordinate tuples have to be provided, each consisting * of floating point values for longitude and latitude. Insert a space between tuples. * Do not include spaces within a tuple. The coordinates must be specified in counter-clockwise * order with the first coordinate corresponding to the lower-left corner of the overlayed * image. The shape described by these corners must be convex. *

* * Syntax: *
<GroundOverlay id="ID">
 *   ...
 *   <Icon>...</Icon>
 *   <altitude>0</altitude>
 *   <altitudeMode>clampToGround</altitudeMode>                   <!-- or absolute -->
 *          <!-- can substitute <gx:altitudeMode>clampToSeaFloor</gx:altitudeMode> -->
 * 
 *   <gx:LatLonQuad>
 *     <coordinates>...</coordinates>              <!-- four lon,lat tuples -->
 *   </gx:LatLonQuad>
 * </GroundOverlay>
* * Extends: * * * Contained By: * * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LatLonQuadType", propOrder = { "coordinates" }) @XmlRootElement(name = "LatLonQuad", namespace = "http://www.google.com/kml/ext/2.2") public class LatLonQuad extends AbstractObject implements Cloneable { /** * 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; public LatLonQuad() { super(); } /** * * */ 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)+((coordinates == null)? 0 :coordinates.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 LatLonQuad) == false) { return false; } LatLonQuad other = ((LatLonQuad) obj); if (coordinates == null) { if (other.coordinates!= null) { return false; } } else { if (coordinates.equals(other.coordinates) == 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 LatLonQuad 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 LatLonQuad 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 LatLonQuad addToCoordinates(final String coordinates) { this.getCoordinates().add(new Coordinate(coordinates)); return this; } /** * * */ @Obvious @Override public void setObjectSimpleExtension(final List objectSimpleExtension) { super.setObjectSimpleExtension(objectSimpleExtension); } @Obvious @Override public LatLonQuad addToObjectSimpleExtension(final Object objectSimpleExtension) { super.getObjectSimpleExtension().add(objectSimpleExtension); return this; } /** * fluent setter * * * @param coordinates * required parameter */ public LatLonQuad withCoordinates(final List coordinates) { this.setCoordinates(coordinates); return this; } @Obvious @Override public LatLonQuad withObjectSimpleExtension(final List objectSimpleExtension) { super.withObjectSimpleExtension(objectSimpleExtension); return this; } @Obvious @Override public LatLonQuad withId(final String id) { super.withId(id); return this; } @Obvious @Override public LatLonQuad withTargetId(final String targetId) { super.withTargetId(targetId); return this; } /** * Creates a new instance of {@link List}{{@link Coordinate} 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 LatLonQuad clone() { LatLonQuad copy; copy = ((LatLonQuad) super.clone()); copy.coordinates = new ArrayList((getCoordinates().size())); for (Coordinate iter: coordinates) { copy.coordinates.add(iter.clone()); } return copy; } }