001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: * (C) 2004, Institut de Recherche pour le Développement
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * This package contains documentation from OpenGIS specifications.
018: * OpenGIS consortium's work is fully acknowledged here.
019: */
020: package org.geotools.metadata.iso.extent;
021:
022: // J2SE direct dependencies
023: import javax.units.Unit;
024:
025: // OpenGIS dependencies
026: import org.opengis.metadata.extent.VerticalExtent;
027: import org.opengis.referencing.crs.VerticalCRS;
028: import org.opengis.referencing.datum.VerticalDatum;
029:
030: // Geotools dependencies
031: import org.geotools.metadata.iso.MetadataEntity;
032:
033: /**
034: * Vertical domain of dataset.
035: *
036: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/extent/VerticalExtentImpl.java $
037: * @version $Id: VerticalExtentImpl.java 25385 2007-04-29 18:23:14Z desruisseaux $
038: * @author Martin Desruisseaux
039: * @author Touraïvane
040: *
041: * @since 2.1
042: */
043: public class VerticalExtentImpl extends MetadataEntity implements
044: VerticalExtent {
045: /**
046: * Serial number for interoperability with different versions.
047: */
048: private static final long serialVersionUID = -3214554246909844079L;
049:
050: /**
051: * The lowest vertical extent contained in the dataset.
052: */
053: private Double minimumValue;
054:
055: /**
056: * The highest vertical extent contained in the dataset.
057: */
058: private Double maximumValue;
059:
060: /**
061: * Provides information about the vertical coordinate reference system to
062: * which the maximum and minimum elevation values are measured. The CRS
063: * identification includes unit of measure.
064: */
065: private VerticalCRS verticalCRS;
066:
067: /**
068: * Constructs an initially empty vertical extent.
069: */
070: public VerticalExtentImpl() {
071: }
072:
073: /**
074: * Constructs a metadata entity initialized with the values from the specified metadata.
075: *
076: * @since 2.4
077: */
078: public VerticalExtentImpl(final VerticalExtent source) {
079: super (source);
080: }
081:
082: /**
083: * Creates a vertical extent initialized to the specified values.
084: *
085: * @since 2.4
086: */
087: public VerticalExtentImpl(final Double minimumValue,
088: final Double maximumValue, final VerticalCRS verticalCRS) {
089: setMinimumValue(minimumValue);
090: setMaximumValue(maximumValue);
091: setVerticalCRS(verticalCRS);
092: }
093:
094: /**
095: * Creates a vertical extent initialized to the specified values.
096: *
097: * @deprecated Use {@link #VerticalExtentImpl(Double,Double,VerticalCRS)} instead.
098: */
099: public VerticalExtentImpl(final double minimumValue,
100: final double maximumValue, final Unit unit,
101: final VerticalDatum verticalDatum) {
102: setMinimumValue(new Double(minimumValue));
103: setMaximumValue(new Double(maximumValue));
104: setUnit(unit);
105: setVerticalDatum(verticalDatum);
106: }
107:
108: /**
109: * Returns the lowest vertical extent contained in the dataset.
110: */
111: public Double getMinimumValue() {
112: return minimumValue;
113: }
114:
115: /**
116: * Set the lowest vertical extent contained in the dataset.
117: */
118: public synchronized void setMinimumValue(final Double newValue) {
119: checkWritePermission();
120: minimumValue = newValue;
121: }
122:
123: /**
124: * Returns the highest vertical extent contained in the dataset.
125: */
126: public Double getMaximumValue() {
127: return maximumValue;
128: }
129:
130: /**
131: * Set the highest vertical extent contained in the dataset.
132: */
133: public synchronized void setMaximumValue(final Double newValue) {
134: checkWritePermission();
135: maximumValue = newValue;
136: }
137:
138: /**
139: * Provides information about the vertical coordinate reference system to
140: * which the maximum and minimum elevation values are measured. The CRS
141: * identification includes unit of measure.
142: *
143: * @since 2.4
144: */
145: public VerticalCRS getVerticalCRS() {
146: return verticalCRS;
147: }
148:
149: /**
150: * Set the information about the vertical coordinate reference system to
151: * which the maximum and minimum elevation values are measured.
152: *
153: * @since 2.4
154: */
155: public synchronized void setVerticalCRS(final VerticalCRS newValue) {
156: checkWritePermission();
157: verticalCRS = newValue;
158: }
159:
160: /**
161: * Returns the vertical units used for vertical extent information.
162: * Examples: metres, feet, millimetres, hectopascals.
163: * <p>
164: * This convenience method get the unit from the {@linkplain #getVerticalCRS vertical CRS},
165: * if any.
166: */
167: public Unit getUnit() {
168: return (verticalCRS != null) ? verticalCRS
169: .getCoordinateSystem().getAxis(0).getUnit() : null;
170: }
171:
172: /**
173: * Set the vertical units used for vertical extent information.
174: * Examples: metres, feet, millimetres, hectopascals.
175: *
176: * @deprecated Use {@link #setVerticalCRS} instead.
177: */
178: public void setUnit(final Unit newValue) {
179: throw new UnsupportedOperationException(
180: "Use setVerticalCRS instead.");
181: }
182:
183: /**
184: * Provides information about the origin from which the
185: * maximum and minimum elevation values are measured.
186: * <p>
187: * @deprecated Use {@link #getVerticalCRS} instead.
188: */
189: public VerticalDatum getVerticalDatum() {
190: return (verticalCRS != null) ? (VerticalDatum) verticalCRS
191: .getDatum() : null;
192: }
193:
194: /**
195: * Set information about the origin from which the
196: * maximum and minimum elevation values are measured.
197: *
198: * @deprecated Use {@link #setVerticalCRS} instead.
199: */
200: public void setVerticalDatum(final VerticalDatum newValue) {
201: throw new UnsupportedOperationException(
202: "Use setVerticalCRS instead.");
203: }
204: }
|