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.spatial;
021:
022: // J2SE direct dependencies
023: import java.util.Collection;
024: import java.util.List;
025:
026: // OpenGIS dependencies
027: import org.opengis.metadata.spatial.CellGeometry;
028: import org.opengis.metadata.spatial.Georectified;
029: import org.opengis.metadata.spatial.PixelOrientation;
030: import org.opengis.geometry.primitive.Point;
031: import org.opengis.util.InternationalString;
032:
033: // Geotools dependencies
034: import org.geotools.util.CheckedArrayList;
035:
036: /**
037: * Grid whose cells are regularly spaced in a geographic (i.e., lat / long) or map
038: * coordinate system defined in the Spatial Referencing System (SRS) so that any cell
039: * in the grid can be geolocated given its grid coordinate and the grid origin, cell spacing,
040: * and orientation indication of whether or not geographic.
041: *
042: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/spatial/GeorectifiedImpl.java $
043: * @version $Id: GeorectifiedImpl.java 25189 2007-04-17 13:23:47Z desruisseaux $
044: * @author Martin Desruisseaux
045: * @author Touraïvane
046: *
047: * @since 2.1
048: */
049: public class GeorectifiedImpl extends GridSpatialRepresentationImpl
050: implements Georectified {
051: /**
052: * Serial number for interoperability with different versions.
053: */
054: private static final long serialVersionUID = 5875851898471237138L;
055:
056: /**
057: * Indication of whether or not geographic position points are available to test the
058: * accuracy of the georeferenced grid data.
059: */
060: private boolean checkPointAvailable;
061:
062: /**
063: * Description of geographic position points used to test the accuracy of the
064: * georeferenced grid data.
065: */
066: private InternationalString checkPointDescription;
067:
068: /**
069: * Earth location in the coordinate system defined by the Spatial Reference System
070: * and the grid coordinate of the cells at opposite ends of grid coverage along two
071: * diagonals in the grid spatial dimensions. There are four corner points in a
072: * georectified grid; at least two corner points along one diagonal are required.
073: */
074: private List cornerPoints;
075:
076: /**
077: * Earth location in the coordinate system defined by the Spatial Reference System
078: * and the grid coordinate of the cell halfway between opposite ends of the grid in the
079: * spatial dimensions.
080: */
081: private Point centerPoint;
082:
083: /**
084: * Point in a pixel corresponding to the Earth location of the pixel.
085: */
086: private PixelOrientation pointInPixel;
087:
088: /**
089: * Description of the information about which grid dimensions are the spatial dimensions.
090: */
091: private InternationalString transformationDimensionDescription;
092:
093: /**
094: * Information about which grid dimensions are the spatial dimensions.
095: */
096: private Collection transformationDimensionMapping;
097:
098: /**
099: * Constructs an initially empty georectified object.
100: */
101: public GeorectifiedImpl() {
102: }
103:
104: /**
105: * Constructs a metadata entity initialized with the values from the specified metadata.
106: *
107: * @since 2.4
108: */
109: public GeorectifiedImpl(final Georectified source) {
110: super (source);
111: }
112:
113: /**
114: * Creates a georectified object initialized to the specified values.
115: */
116: public GeorectifiedImpl(final int numberOfDimensions,
117: final List axisDimensionsProperties,
118: final CellGeometry cellGeometry,
119: final boolean transformationParameterAvailable,
120: final boolean checkPointAvailable, final List cornerPoints,
121: final PixelOrientation pointInPixel) {
122: super (numberOfDimensions, axisDimensionsProperties,
123: cellGeometry, transformationParameterAvailable);
124: setCheckPointAvailable(checkPointAvailable);
125: setCornerPoints(cornerPoints);
126: setPointInPixel(pointInPixel);
127: }
128:
129: /**
130: * Indication of whether or not geographic position points are available to test the
131: * accuracy of the georeferenced grid data.
132: */
133: public boolean isCheckPointAvailable() {
134: return checkPointAvailable;
135: }
136:
137: /**
138: * Set indication of whether or not geographic position points are available to test the
139: * accuracy of the georeferenced grid data.
140: */
141: public synchronized void setCheckPointAvailable(
142: final boolean newValue) {
143: checkWritePermission();
144: checkPointAvailable = newValue;
145: }
146:
147: /**
148: * Description of geographic position points used to test the accuracy of the
149: * georeferenced grid data.
150: */
151: public InternationalString getCheckPointDescription() {
152: return checkPointDescription;
153: }
154:
155: /**
156: * Set the description of geographic position points used to test the accuracy of the
157: * georeferenced grid data.
158: */
159: public synchronized void setCheckPointDescription(
160: final InternationalString newValue) {
161: checkWritePermission();
162: checkPointDescription = newValue;
163: }
164:
165: /**
166: * Earth location in the coordinate system defined by the Spatial Reference System
167: * and the grid coordinate of the cells at opposite ends of grid coverage along two
168: * diagonals in the grid spatial dimensions. There are four corner points in a
169: * georectified grid; at least two corner points along one diagonal are required.
170: */
171: public synchronized List getCornerPoints() {
172: return cornerPoints = nonNullList(cornerPoints, Point.class);
173: }
174:
175: /**
176: * Set the corner points.
177: */
178: public synchronized void setCornerPoints(final List newValues) {
179: checkWritePermission();
180: if (cornerPoints == null) {
181: cornerPoints = new CheckedArrayList(Point.class);
182: } else {
183: cornerPoints.clear();
184: }
185: cornerPoints.addAll(newValues);
186: }
187:
188: /**
189: * Earth location in the coordinate system defined by the Spatial Reference System
190: * and the grid coordinate of the cell halfway between opposite ends of the grid in the
191: * spatial dimensions.
192: */
193: public Point getCenterPoint() {
194: return centerPoint;
195: }
196:
197: /**
198: * Set the center point.
199: */
200: public synchronized void setCenterPoint(final Point newValue) {
201: checkWritePermission();
202: centerPoint = newValue;
203: }
204:
205: /**
206: * Point in a pixel corresponding to the Earth location of the pixel.
207: */
208: public PixelOrientation getPointInPixel() {
209: return pointInPixel;
210: }
211:
212: /**
213: * Set the point in a pixel corresponding to the Earth location of the pixel.
214: */
215: public synchronized void setPointInPixel(
216: final PixelOrientation newValue) {
217: checkWritePermission();
218: pointInPixel = newValue;
219: }
220:
221: /**
222: * Description of the information about which grid dimensions are the spatial dimensions.
223: */
224: public InternationalString getTransformationDimensionDescription() {
225: return transformationDimensionDescription;
226: }
227:
228: /**
229: * Set the description of the information about which grid dimensions are the spatial dimensions.
230: */
231: public synchronized void setTransformationDimensionDescription(
232: final InternationalString newValue) {
233: checkWritePermission();
234: transformationDimensionDescription = newValue;
235: }
236:
237: /**
238: * Information about which grid dimensions are the spatial dimensions.
239: */
240: public synchronized Collection getTransformationDimensionMapping() {
241: return transformationDimensionMapping = nonNullCollection(
242: transformationDimensionMapping,
243: InternationalString.class);
244: }
245:
246: /**
247: * Set information about which grid dimensions are the spatial dimensions.
248: */
249: public synchronized void setTransformationDimensionMapping(
250: final Collection newValues) {
251: transformationDimensionMapping = copyCollection(newValues,
252: transformationDimensionMapping,
253: InternationalString.class);
254: }
255: }
|