001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/ogcwebservices/wcs/describecoverage/SpatialDomain.java $
002: /*---------------- FILE HEADER ------------------------------------------
003:
004: This file is part of deegree.
005: Copyright (C) 2001-2008 by:
006: EXSE, Department of Geography, University of Bonn
007: http://www.giub.uni-bonn.de/deegree/
008: lat/lon GmbH
009: http://www.lat-lon.de
010:
011: This library is free software; you can redistribute it and/or
012: modify it under the terms of the GNU Lesser General Public
013: License as published by the Free Software Foundation; either
014: version 2.1 of the License, or (at your option) any later version.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: Contact:
026:
027: Andreas Poth
028: lat/lon GmbH
029: Aennchenstr. 19
030: 53115 Bonn
031: Germany
032: E-Mail: poth@lat-lon.de
033:
034: Prof. Dr. Klaus Greve
035: Department of Geography
036: University of Bonn
037: Meckenheimer Allee 166
038: 53115 Bonn
039: Germany
040: E-Mail: greve@giub.uni-bonn.de
041:
042:
043: ---------------------------------------------------------------------------*/
044: package org.deegree.ogcwebservices.wcs.describecoverage;
045:
046: import org.deegree.model.spatialschema.Envelope;
047: import org.deegree.model.spatialschema.EnvelopeImpl;
048: import org.deegree.model.spatialschema.Surface;
049: import org.deegree.model.spatialschema.SurfaceImpl;
050: import org.deegree.ogcwebservices.wcs.WCSException;
051:
052: /**
053: * @version $Revision: 9345 $
054: * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
055: * @author last edited by: $Author: apoth $
056: *
057: * @version 1.0. $Revision: 9345 $, $Date: 2007-12-27 08:22:25 -0800 (Thu, 27 Dec 2007) $
058: *
059: * @since 2.0
060: */
061:
062: public class SpatialDomain implements Cloneable {
063:
064: private Envelope[] envelops = null;
065:
066: private Object[] grid = new Object[0];
067:
068: private Surface[] surface = new Surface[0];
069:
070: /**
071: * @param envelops
072: */
073: public SpatialDomain(Envelope[] envelops) throws WCSException {
074: setEnvelops(envelops);
075: }
076:
077: /**
078: * @param envelops
079: * @param surface
080: */
081: public SpatialDomain(Envelope[] envelops, Surface[] surface)
082: throws WCSException {
083: setEnvelops(envelops);
084: setSurface(surface);
085: }
086:
087: /**
088: * @param envelops
089: * @param grid
090: */
091: public SpatialDomain(Envelope[] envelops, Object[] grid)
092: throws WCSException {
093: setEnvelops(envelops);
094: setGrid(grid);
095: }
096:
097: /**
098: * @param envelops
099: * @param grid
100: */
101: public SpatialDomain(Envelope[] envelops, Surface[] surface,
102: Object[] grid) throws WCSException {
103: setEnvelops(envelops);
104: setGrid(grid);
105: setSurface(surface);
106: }
107:
108: /**
109: * @return Returns the envelops.
110: *
111: */
112: public Envelope[] getEnvelops() {
113: return envelops;
114: }
115:
116: /**
117: * @param envelops The envelops to set.
118: *
119: */
120: public void setEnvelops(Envelope[] envelops) throws WCSException {
121: if (envelops == null) {
122: throw new WCSException(
123: "At least one envelop must be defined for "
124: + "a SpatialDomain!");
125: }
126: this .envelops = envelops;
127: }
128:
129: /**
130: * @return Returns the grid.
131: *
132: */
133: public Object[] getGrid() {
134: return grid;
135: }
136:
137: /**
138: * @param grid The grid to set.
139: *
140: */
141: public void setGrid(Object[] grid) {
142: if (grid == null) {
143: grid = new Object[0];
144: }
145: this .grid = grid;
146: }
147:
148: /**
149: * @return Returns the surface.
150: *
151: */
152: public Surface[] getSurface() {
153: return surface;
154: }
155:
156: /**
157: * @param surface The surface to set.
158: *
159: */
160: public void setSurface(Surface[] surface) {
161: if (surface == null) {
162: surface = new Surface[0];
163: }
164: this .surface = surface;
165: }
166:
167: /**
168: * @see java.lang.Object#clone()
169: */
170: public Object clone() {
171: try {
172: Envelope[] env = new Envelope[envelops.length];
173: for (int i = 0; i < env.length; i++) {
174: env[i] = (Envelope) ((EnvelopeImpl) envelops[i])
175: .clone();
176: }
177:
178: Surface[] surf = new Surface[surface.length];
179: for (int i = 0; i < surf.length; i++) {
180: surf[i] = (Surface) ((SurfaceImpl) surface[i]).clone();
181: }
182: return new SpatialDomain(env, surf, grid);
183: } catch (Exception e) {
184: e.printStackTrace();
185: }
186: return null;
187: }
188:
189: }
|