001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/ogcwebservices/wcs/describecoverage/SpatialDomain.java $ 002 package org.deegree.ogcwebservices.wcs.describecoverage; 003 004 import org.deegree.model.spatialschema.Envelope; 005 import org.deegree.model.spatialschema.EnvelopeImpl; 006 import org.deegree.model.spatialschema.Surface; 007 import org.deegree.model.spatialschema.SurfaceImpl; 008 import org.deegree.ogcwebservices.wcs.WCSException; 009 010 /** 011 * @version $Revision: 6259 $ 012 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a> 013 * @author last edited by: $Author: bezema $ 014 * 015 * @version 1.0. $Revision: 6259 $, $Date: 2007-03-20 10:15:15 +0100 (Di, 20 Mär 2007) $ 016 * 017 * @since 2.0 018 */ 019 020 public class SpatialDomain implements Cloneable { 021 022 private Envelope[] envelops = null; 023 024 private Object[] grid = new Object[0]; 025 026 private Surface[] surface = new Surface[0]; 027 028 029 /** 030 * @param envelops 031 */ 032 public SpatialDomain(Envelope[] envelops) throws WCSException { 033 setEnvelops(envelops); 034 } 035 036 /** 037 * @param envelops 038 * @param surface 039 */ 040 public SpatialDomain(Envelope[] envelops, Surface[] surface) throws WCSException { 041 setEnvelops(envelops); 042 setSurface(surface); 043 } 044 045 /** 046 * @param envelops 047 * @param grid 048 */ 049 public SpatialDomain(Envelope[] envelops, Object[] grid) throws WCSException { 050 setEnvelops(envelops); 051 setGrid(grid); 052 } 053 054 /** 055 * @param envelops 056 * @param grid 057 */ 058 public SpatialDomain(Envelope[] envelops, Surface[] surface, Object[] grid) 059 throws WCSException { 060 setEnvelops(envelops); 061 setGrid(grid); 062 setSurface(surface); 063 } 064 065 /** 066 * @return Returns the envelops. 067 * 068 */ 069 public Envelope[] getEnvelops() { 070 return envelops; 071 } 072 073 /** 074 * @param envelops The envelops to set. 075 * 076 */ 077 public void setEnvelops(Envelope[] envelops) throws WCSException { 078 if (envelops == null) { 079 throw new WCSException("At least one envelop must be defined for " 080 + "a SpatialDomain!"); 081 } 082 this.envelops = envelops; 083 } 084 085 /** 086 * @return Returns the grid. 087 * 088 */ 089 public Object[] getGrid() { 090 return grid; 091 } 092 093 /** 094 * @param grid The grid to set. 095 * 096 */ 097 public void setGrid(Object[] grid) { 098 if (grid == null) { 099 grid = new Object[0]; 100 } 101 this.grid = grid; 102 } 103 104 /** 105 * @return Returns the surface. 106 * 107 */ 108 public Surface[] getSurface() { 109 return surface; 110 } 111 112 /** 113 * @param surface The surface to set. 114 * 115 */ 116 public void setSurface(Surface[] surface) { 117 if (surface == null) { 118 surface = new Surface[0]; 119 } 120 this.surface = surface; 121 } 122 123 124 /** 125 * @see java.lang.Object#clone() 126 */ 127 public Object clone() { 128 try { 129 Envelope[] env = new Envelope[envelops.length]; 130 for (int i = 0; i < env.length; i++) { 131 env[i] = (Envelope)((EnvelopeImpl)envelops[i]).clone(); 132 } 133 134 Surface[] surf = new Surface[surface.length]; 135 for (int i = 0; i < surf.length; i++) { 136 surf[i] = (Surface)((SurfaceImpl)surface[i]).clone(); 137 } 138 return new SpatialDomain( env, surf, grid ); 139 } catch(Exception e) { 140 e.printStackTrace(); 141 } 142 return null; 143 } 144 145 } 146 /* ******************************************************************** 147 Changes to this class. What the people have been up to: 148 $Log$ 149 Revision 1.3 2006/12/03 21:20:48 poth 150 code formatting 151 152 Revision 1.2 2005/01/18 22:08:55 poth 153 no message 154 155 Revision 1.4 2004/07/14 06:52:48 ap 156 no message 157 158 Revision 1.3 2004/06/28 06:26:52 ap 159 no message 160 161 Revision 1.2 2004/05/25 07:19:13 ap 162 no message 163 164 Revision 1.1 2004/05/24 06:54:39 ap 165 no message 166 167 168 ********************************************************************** */