gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / store / AbstractRasterDataStore.java @ 864
History | View | Annotate | Download (37.2 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.raster.impl.store; |
23 |
|
24 |
import java.awt.geom.Point2D; |
25 |
import java.awt.geom.Rectangle2D; |
26 |
import java.util.Iterator; |
27 |
import java.util.Set; |
28 |
|
29 |
import org.gvsig.fmap.dal.DataManager; |
30 |
import org.gvsig.fmap.dal.DataQuery; |
31 |
import org.gvsig.fmap.dal.DataServerExplorer; |
32 |
import org.gvsig.fmap.dal.DataSet; |
33 |
import org.gvsig.fmap.dal.DataStore; |
34 |
import org.gvsig.fmap.dal.DataStoreParameters; |
35 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
36 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
37 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
38 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
39 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
40 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
41 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
42 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
43 |
import org.gvsig.fmap.dal.coverage.grid.render.Render; |
44 |
import org.gvsig.fmap.dal.coverage.process.vector.Vectorization; |
45 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
46 |
import org.gvsig.fmap.dal.coverage.store.RasterQuery; |
47 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
48 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterFileStoreParameters; |
49 |
import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
50 |
import org.gvsig.fmap.dal.coverage.store.props.TimeSeries; |
51 |
import org.gvsig.fmap.dal.coverage.util.RasterUtils; |
52 |
import org.gvsig.fmap.dal.exception.DataException; |
53 |
import org.gvsig.fmap.dal.exception.InitializeException; |
54 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
55 |
import org.gvsig.fmap.dal.raster.CoverageSelection; |
56 |
import org.gvsig.fmap.dal.raster.CoverageStore; |
57 |
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider; |
58 |
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices; |
59 |
import org.gvsig.fmap.dal.resource.Resource; |
60 |
import org.gvsig.fmap.dal.spi.DataStoreInitializer; |
61 |
import org.gvsig.fmap.dal.spi.DataStoreProvider; |
62 |
import org.gvsig.metadata.MetadataLocator; |
63 |
import org.gvsig.metadata.MetadataManager; |
64 |
import org.gvsig.metadata.exceptions.MetadataException; |
65 |
import org.gvsig.raster.cache.tile.Tile; |
66 |
import org.gvsig.raster.cache.tile.exception.TileGettingException; |
67 |
import org.gvsig.raster.cache.tile.provider.TileListener; |
68 |
import org.gvsig.raster.impl.DefaultRasterManager; |
69 |
import org.gvsig.raster.impl.buffer.DefaultRasterQuery; |
70 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
71 |
import org.gvsig.raster.impl.grid.render.DefaultRender; |
72 |
import org.gvsig.raster.impl.process.vector.PotraceVectorization; |
73 |
import org.gvsig.raster.impl.provider.RasterProvider; |
74 |
import org.gvsig.tools.ToolsLocator; |
75 |
import org.gvsig.tools.dispose.impl.AbstractDisposable; |
76 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
77 |
import org.gvsig.tools.dynobject.DynClass; |
78 |
import org.gvsig.tools.dynobject.DynObject; |
79 |
import org.gvsig.tools.dynobject.DynObjectManager; |
80 |
import org.gvsig.tools.dynobject.DynStruct; |
81 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
82 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
83 |
import org.gvsig.tools.exception.BaseException; |
84 |
import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable; |
85 |
import org.gvsig.tools.undo.command.Command; |
86 |
import org.gvsig.tools.visitor.Visitor; |
87 |
|
88 |
/**
|
89 |
* Default implementation for RasterDataSource
|
90 |
*
|
91 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
92 |
*/
|
93 |
public abstract class AbstractRasterDataStore extends AbstractDisposable |
94 |
implements RasterDataStore, CoverageStoreProviderServices, QueryableRaster, DataStoreInitializer {
|
95 |
public static final String PERSISTENT_NAME = "AbstractRasterDataStore_Persistent"; |
96 |
public static final String PERSISTENT_DESCRIPTION = "AbstractRasterDataStore Persistent"; |
97 |
protected DefaultRasterQuery currentQuery = null; |
98 |
/**
|
99 |
* Lista de paletas asociadas a las bandas cargadas en el DataSource. Estas son calculadas
|
100 |
* en las funciones que asignan las bandas a dibujar (addDrawableBands)
|
101 |
*/
|
102 |
private ColorTable[] palette = null; |
103 |
/**
|
104 |
* Extensi?n de los datos del buffer
|
105 |
*/
|
106 |
private Extent dataExtent = null; |
107 |
/**
|
108 |
* Ancho y alto en pixeles del ?ltimo buffer asignado
|
109 |
*/
|
110 |
protected double nWidth = 0; |
111 |
protected double nHeight = 0; |
112 |
private double[] step = null; |
113 |
private Buffer lastBuffer = null; |
114 |
|
115 |
private DataManager dataManager = null; |
116 |
protected DataStoreParameters parameters = null; |
117 |
private DelegatedDynObject metadata = null; |
118 |
private RasterUtils util = null; |
119 |
private DelegateWeakReferencingObservable
|
120 |
delegateObservable = new DelegateWeakReferencingObservable(this); |
121 |
private Render render = null; |
122 |
|
123 |
public AbstractRasterDataStore() {
|
124 |
util = RasterLocator.getManager().getRasterUtils(); |
125 |
} |
126 |
|
127 |
/*
|
128 |
* (non-Javadoc)
|
129 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#queryBuffer(org.gvsig.fmap.dal.coverage.store.RasterQuery)
|
130 |
*/
|
131 |
public Buffer query(RasterQuery query) throws ProcessInterruptedException, RasterDriverException, InvalidSetViewException { |
132 |
Object[] obj = queryArray(query); |
133 |
if(obj != null && obj.length > 0 && obj[0] instanceof Buffer) |
134 |
return ((Buffer)obj[0]); |
135 |
return null; |
136 |
} |
137 |
|
138 |
|
139 |
/*
|
140 |
* (non-Javadoc)
|
141 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#query(org.gvsig.fmap.dal.coverage.store.RasterQuery)
|
142 |
*/
|
143 |
public Object[] queryArray(RasterQuery query) |
144 |
throws ProcessInterruptedException, RasterDriverException,
|
145 |
InvalidSetViewException { |
146 |
Object[] result = null; |
147 |
currentQuery = (DefaultRasterQuery)query; |
148 |
DefaultRasterQuery q = currentQuery; |
149 |
|
150 |
if(q.getDrawableBands() != null) |
151 |
setQueryDrawableBands(q.getDrawableBands()); |
152 |
else
|
153 |
setQueryAllDrawableBands(); |
154 |
|
155 |
setMemoryBuffer(q.isMemoryBuffer()); |
156 |
|
157 |
Buffer buf = null; |
158 |
if(q.getType() == DefaultRasterQuery.TYPE_ENTIRE) {
|
159 |
buf = setAreaOfInterest(); |
160 |
Extent e = getExtent(); |
161 |
buf.setDataExtent(new Rectangle2D.Double(e.getULX(), e.getULY() - (e.getMax().getY() - e.getMin().getY()), |
162 |
e.getMax().getX() - e.getMin().getX(), |
163 |
e.getMax().getY() - e.getMin().getY())); |
164 |
} |
165 |
|
166 |
if(q.getType() == DefaultRasterQuery.TYPE_COORDS) {
|
167 |
buf = setAreaOfInterest(q.getX(), q.getY(), q.getW(), q.getH()); |
168 |
buf.setDataExtent(new Rectangle2D.Double(q.getX(), q.getY(), q.getW(), q.getH())); |
169 |
} |
170 |
|
171 |
if(q.getType() == DefaultRasterQuery.TYPE_COORDS_SIZE) {
|
172 |
buf = setAreaOfInterest(q.getBBox().getULX(), q.getBBox().getULY(), q.getBBox().getLRX(), |
173 |
q.getBBox().getLRY(), q.getBufWidth(), q.getBufHeight()); |
174 |
buf.setDataExtent(new Rectangle2D.Double(q.getBBox().getULX(), q.getBBox().getULY(), |
175 |
q.getBBox().getLRX() - q.getBBox().getULX(), q.getBBox().getLRY() - q.getBBox().getULY())); |
176 |
} |
177 |
|
178 |
if(q.getType() == DefaultRasterQuery.TYPE_COORDS_SIZE_TILED) {
|
179 |
setAreaOfInterest(q.getBBox().getULX(), q.getBBox().getULY(), q.getBBox().getLRX(), |
180 |
q.getBBox().getLRY(), q.getBufWidth(), q.getBufHeight(), q.getTileListener()); |
181 |
} |
182 |
|
183 |
if(q.getType() == DefaultRasterQuery.TYPE_PX)
|
184 |
buf = setAreaOfInterest(q.getPixelX(), q.getPixelY(), q.getPixelW(), q.getPixelH()); |
185 |
|
186 |
if(q.getType() == DefaultRasterQuery.TYPE_PX_SIZE)
|
187 |
buf = setAreaOfInterest(q.getPixelX(), q.getPixelY(), q.getPixelW(), |
188 |
q.getPixelH(), q.getBufWidth(), q.getBufHeight()); |
189 |
|
190 |
result = new Object[]{buf}; |
191 |
|
192 |
if(q.getType() == DefaultRasterQuery.TYPE_ONE_TILE) {
|
193 |
if(isTiled()) {
|
194 |
try {
|
195 |
Tile t = getTile(q.getResolutionLevel(), q.getTileCol(), q.getTileRow(), q.getBBox()); |
196 |
result = t.getData(); |
197 |
} catch (TileGettingException e) {
|
198 |
throw new RasterDriverException("Problems getting the tile", e); |
199 |
} |
200 |
} else {
|
201 |
buf = setAreaOfInterest(q.getBBox().getULX(), q.getBBox().getULY(), q.getBBox().getLRX(), |
202 |
q.getBBox().getLRY(), q.getBufWidth(), q.getBufHeight()); |
203 |
buf.setDataExtent(new Rectangle2D.Double(q.getBBox().getULX(), q.getBBox().getULY(), |
204 |
q.getBBox().getLRX() - q.getBBox().getULX(), q.getBBox().getLRY() - q.getBBox().getULY())); |
205 |
result = new Object[]{buf}; |
206 |
} |
207 |
} |
208 |
|
209 |
if(q.isStoredLastBuffer())
|
210 |
lastBuffer = buf; |
211 |
else
|
212 |
lastBuffer = null;
|
213 |
q.storeLastBuffer(false);
|
214 |
|
215 |
if(result != null && result.length > 0 && result[0] instanceof Buffer) { |
216 |
((Buffer)result[0]).setStore(this); |
217 |
if(getNoDataValue() != null && getNoDataValue().isDefined()) |
218 |
((Buffer)result[0]).setNoDataValue(getNoDataValue()); |
219 |
return result;
|
220 |
} |
221 |
return null; |
222 |
} |
223 |
|
224 |
/*
|
225 |
* (non-Javadoc)
|
226 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#getAdjustedToExtent(org.gvsig.fmap.dal.coverage.datastruct.Extent)
|
227 |
*/
|
228 |
public Extent adjustToExtent(Extent e) {
|
229 |
Extent currentExtent = this.getExtent();
|
230 |
|
231 |
double minx = e.getMin().getX() < currentExtent.getMin().getX() ? currentExtent.getMin().getX() : e.getMin().getX();
|
232 |
double maxx = e.getMax().getX() > currentExtent.getMax().getX() ? currentExtent.getMax().getX() : e.getMax().getX();
|
233 |
double miny = e.getMin().getY() < currentExtent.getMin().getY() ? currentExtent.getMin().getY() : e.getMin().getY();
|
234 |
double maxy = e.getMax().getY() > currentExtent.getMax().getY() ? currentExtent.getMax().getY() : e.getMax().getY();
|
235 |
|
236 |
return new ExtentImpl(minx, maxy, maxx, miny); |
237 |
} |
238 |
|
239 |
public String getFullName() { |
240 |
return getName();
|
241 |
} |
242 |
|
243 |
/*
|
244 |
* (non-Javadoc)
|
245 |
* @see org.gvsig.fmap.dal.coverage.buffer.RasterDataSource#getLastBuffer()
|
246 |
*/
|
247 |
public Buffer getLastBuffer() { |
248 |
return lastBuffer;
|
249 |
} |
250 |
|
251 |
/*
|
252 |
* (non-Javadoc)
|
253 |
* @see org.gvsig.fmap.dal.coverage.buffer.RasterDataSource#getStep()
|
254 |
*/
|
255 |
public double[] getStep() { |
256 |
return step;
|
257 |
} |
258 |
|
259 |
|
260 |
/**
|
261 |
* Asigna el ?rea de inter?s a toda la extensi?n del raster.
|
262 |
*/
|
263 |
protected Buffer setAreaOfInterest() |
264 |
throws ProcessInterruptedException, InvalidSetViewException, RasterDriverException {
|
265 |
step = null;
|
266 |
dataExtent = getExtent(); |
267 |
return getWindow(0, 0, (int)getWidth(), (int)getHeight()); |
268 |
} |
269 |
|
270 |
/**
|
271 |
* Asigna el ?rea de interes en coordenadas del mundo real. Si las coordenadas exceden del tama?o de la imagen
|
272 |
* estas coordenadas son ajustadas el extent.
|
273 |
* @param x Coordenada X, esquina superior izquierda
|
274 |
* @param y Coordenada Y, esquina superior izquierda
|
275 |
* @param w Ancho del ?rea
|
276 |
* @param h Alto del ?rea
|
277 |
* @throws ArrayIndexOutOfBoundsException
|
278 |
* @throws InvalidSetViewException
|
279 |
*/
|
280 |
protected Buffer setAreaOfInterest(double x, double y, double w, double h) |
281 |
throws RasterDriverException, InvalidSetViewException, ProcessInterruptedException {
|
282 |
step = null;
|
283 |
dataExtent = new ExtentImpl(x, y, x + w, y - h);
|
284 |
|
285 |
Extent adjustedDataExtent = util.calculateAdjustedView(dataExtent, getAffineTransform(), getWidth(), getHeight()); |
286 |
|
287 |
return getWindow(adjustedDataExtent.getMin().getX(), adjustedDataExtent.getMax().getY(), adjustedDataExtent.width(), adjustedDataExtent.height(), currentQuery.isAdjustToExtent());
|
288 |
} |
289 |
|
290 |
public void setAreaOfInterest(double ulx, double uly, double lrx, double lry, |
291 |
int bufWidth, int bufHeight, TileListener listener) throws RasterDriverException, InvalidSetViewException, ProcessInterruptedException { |
292 |
step = null;
|
293 |
dataExtent = new ExtentImpl(ulx, uly, lrx, lry);
|
294 |
((RasterDataParameters)getParameters()).setAlphaBand(currentQuery.getAlphaBandNumber()); |
295 |
getWindow(ulx, uly, lrx, lry, bufWidth, bufHeight, listener); |
296 |
} |
297 |
|
298 |
/**
|
299 |
* Asigna el ?rea de inter?s en coordenadas del mundo real. Si las coordenadas exceden del tama?o de la imagen
|
300 |
* estas coordenadas son ajustadas el extent.
|
301 |
* @param x Coordenada X, esquina superior izquierda
|
302 |
* @param y Coordenada Y, esquina superior izquierda
|
303 |
* @param w Ancho del ?rea
|
304 |
* @param h Alto del ?rea
|
305 |
* @param bufWidth Ancho del buffer
|
306 |
* @param bufHeight Alto del buffer
|
307 |
* @return En caso de que el buffer sea mayor que el tama?o seleccionado de raster se produce supersampleo. La funci?n devuelve
|
308 |
* un array de dos elementos que representan el desplazamiento en pixels de X e Y de la esquina superior izquierda.
|
309 |
* @throws ArrayIndexOutOfBoundsException
|
310 |
* @throws InvalidSetViewException
|
311 |
*/
|
312 |
protected Buffer setAreaOfInterest(double ulx, double uly, double lrx, double lry, int bufWidth, int bufHeight) |
313 |
throws RasterDriverException, InvalidSetViewException, ProcessInterruptedException {
|
314 |
step = null;
|
315 |
dataExtent = new ExtentImpl(ulx, uly, lrx, lry);
|
316 |
Extent adjustedDataExtent = util.calculateAdjustedView(dataExtent, getAffineTransform(), getWidth(), getHeight()); |
317 |
|
318 |
//Caso 3D: La petici?n no se ajusta al ?rea y se rellena el exterior con NoData
|
319 |
if(!currentQuery.isAdjustToExtent() && !util.isInside(dataExtent, getExtent())) {
|
320 |
return requestFillingWithNoData(dataExtent, adjustedDataExtent, bufWidth, bufHeight);
|
321 |
} |
322 |
|
323 |
//Esta secci?n es para que no supersamplee el driver y pueda hacerse en el cliente
|
324 |
if(!currentQuery.isSupersamplingLoadingBuffer()) {
|
325 |
Point2D p1 = worldToRaster(new Point2D.Double(adjustedDataExtent.getULX(), adjustedDataExtent.getULY())); |
326 |
Point2D p2 = worldToRaster(new Point2D.Double(adjustedDataExtent.getLRX(), adjustedDataExtent.getLRY())); |
327 |
nWidth = Math.abs(p1.getX() - p2.getX());
|
328 |
nHeight = Math.abs(p1.getY() - p2.getY());
|
329 |
|
330 |
if(bufWidth > Math.ceil(nWidth) && bufHeight > Math.ceil(nHeight)) { |
331 |
step = calcSteps(adjustedDataExtent.getULX(), adjustedDataExtent.getULY(), adjustedDataExtent.getLRX(), adjustedDataExtent.getLRY(), nWidth, nHeight, bufWidth, bufHeight); |
332 |
return getWindow(adjustedDataExtent.getULX(), adjustedDataExtent.getULY(), adjustedDataExtent.getLRX(), adjustedDataExtent.getLRY());
|
333 |
} |
334 |
} |
335 |
return getWindow(adjustedDataExtent.getULX(), adjustedDataExtent.getULY(), adjustedDataExtent.getLRX(), adjustedDataExtent.getLRY(), bufWidth, bufHeight, true /*Siempre ajustado*/); |
336 |
} |
337 |
|
338 |
/**
|
339 |
* Asigna el ?rea de interes en coordenadas pixel. Si las coordenadas exceden del tama?o de la imagen
|
340 |
* lanza una excepci?n.
|
341 |
* @param x Coordenada X, esquina superior izquierda
|
342 |
* @param y Coordenada Y, esquina superior izquierda
|
343 |
* @param w Ancho del ?rea
|
344 |
* @param h Alto del ?rea
|
345 |
* @throws InvalidSetViewException
|
346 |
* @throws ArrayIndexOutOfBoundsException
|
347 |
*/
|
348 |
protected Buffer setAreaOfInterest(int x, int y, int w, int h) |
349 |
throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException {
|
350 |
step = null;
|
351 |
if(x > getSourceWidth() || y > getSourceHeight())
|
352 |
throw new InvalidSetViewException("Wrong parameters in setAreaOfInterest"); |
353 |
x = (x < 0) ? 0 : x; |
354 |
y = (y < 0) ? 0 : y; |
355 |
w = (w > getSourceWidth()) ? getSourceWidth() : w; |
356 |
h = (h > getSourceHeight()) ? getSourceHeight() : h; |
357 |
|
358 |
dataExtent = new ExtentImpl(rasterToWorld(new Point2D.Double(x, y)), |
359 |
rasterToWorld(new Point2D.Double(x + w, y + h))); |
360 |
return getWindow(x, y, w, h);
|
361 |
} |
362 |
|
363 |
/**
|
364 |
* Asigna el ?rea de interes en coordenadas pixel. Esta operaci?n cargar? un RasterBuffer con los datos solicitados por
|
365 |
* lo que, si al acabar hacemos getRasterBuf obtendremos la matriz de datos. Si las coordenadas exceden del tama?o
|
366 |
* de la imagen lanza una excepci?n.
|
367 |
* @param x Coordenada X, esquina superior izquierda
|
368 |
* @param y Coordenada Y, esquina superior izquierda
|
369 |
* @param w Ancho del ?rea
|
370 |
* @param h Alto del ?rea
|
371 |
* @param bufWidth Ancho del buffer
|
372 |
* @param bufHeight Alto del buffer
|
373 |
* @throws ArrayIndexOutOfBoundsException
|
374 |
*/
|
375 |
protected Buffer setAreaOfInterest(int x, int y, int w, int h, int bufWidth, int bufHeight) |
376 |
throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException {
|
377 |
step = null;
|
378 |
if(x > getSourceWidth() || y > getSourceHeight())
|
379 |
throw new InvalidSetViewException("Wrong parameters in setAreaOfInterest"); |
380 |
|
381 |
x = (x < 0) ? 0 : x; |
382 |
y = (y < 0) ? 0 : y; |
383 |
w = (w > getSourceWidth()) ? getSourceWidth() : w; |
384 |
h = (h > getSourceHeight()) ? getSourceHeight() : h; |
385 |
|
386 |
dataExtent = new ExtentImpl(rasterToWorld(new Point2D.Double(x, y)), |
387 |
rasterToWorld(new Point2D.Double(x + w, y + h))); |
388 |
|
389 |
return getWindow(x, y, w, h, bufWidth, bufHeight);
|
390 |
} |
391 |
|
392 |
|
393 |
/**
|
394 |
* Para este GeoRasterFile asigna que bandas se pintaran
|
395 |
* sobre el RasterBuf cuando se haga un update. Cada posici?n del vector es una banda
|
396 |
* del rasterBuf y el contenido de esa posici?n es la banda de la imagen que se dibujar?
|
397 |
* sobre ese RasterBuf.
|
398 |
* @param drawableBands Array con las bandas a dibujar.
|
399 |
* @return array con tantos elementos como bandas a dibujar. El valor contenido es el fichero del
|
400 |
* dataset multifichero al que corresponde la banda.
|
401 |
*/
|
402 |
private void setQueryDrawableBands(int[] drawableBands) { |
403 |
//clearDrawableBands();
|
404 |
setDrawableBands(drawableBands); |
405 |
|
406 |
int[] files = new int[drawableBands.length]; |
407 |
palette = new ColorTable[drawableBands.length];
|
408 |
|
409 |
for(int i = 0; i< drawableBands.length; i++) { |
410 |
if(drawableBands[i] < 0 || drawableBands[i] >= getBandCount()) |
411 |
continue;
|
412 |
//addDrawableBand(i, drawableBands[i]);
|
413 |
String fileName = getBands().getBand(drawableBands[i]).getFileName();
|
414 |
files[i] = getBands().getFileNumber(fileName); |
415 |
palette[i] = getColorTable(fileName); |
416 |
} |
417 |
} |
418 |
|
419 |
/**
|
420 |
* Para este GeoRasterFile asigna que bandas se pintaran
|
421 |
* sobre el RasterBuf cuando se haga un update. Cada posici?n del vector es una banda
|
422 |
* del rasterBuf y el contenido de esa posici?n es la banda de la imagen que se dibujar?
|
423 |
* sobre ese RasterBuf. Esta llamada asigna todas las bandas dibujables en su orden natural.
|
424 |
* @return array con tantos elementos como bandas a dibujar. El valor contenido es el fichero del
|
425 |
* dataset multifichero al que corresponde la banda.
|
426 |
*/
|
427 |
public int[] setQueryAllDrawableBands() { |
428 |
clearDrawableBands(); |
429 |
|
430 |
int[] list = new int[getBandCount()]; |
431 |
for(int i = 0; i< getBandCount(); i++) |
432 |
list[i] = i; |
433 |
setDrawableBands(list); |
434 |
|
435 |
int[] files = new int[getBandCount()]; |
436 |
palette = new ColorTable[getBandCount()];
|
437 |
|
438 |
for(int i = 0; i< getBandCount(); i++) { |
439 |
addDrawableBand(i, i); |
440 |
String fileName = getBands().getBand(i).getFileName();
|
441 |
files[i] = getBands().getFileNumber(fileName); |
442 |
palette[i] = getColorTable(fileName); |
443 |
} |
444 |
return files;
|
445 |
} |
446 |
|
447 |
/**
|
448 |
* M?todo que crea un buffer con la extensi?n que se ha pedido completa y sin ajustar
|
449 |
* a la extensi?n del raster. La zona que tenga informaci?n del raster se rellenara con
|
450 |
* esta y la que quede vacia se rellenar? con valores NoData. El ancho y alto del buffer corresponden
|
451 |
* a toda la zona solicitada, tanto la que cae dentro como la rellena con Nodata
|
452 |
*
|
453 |
* @param rasterBuf Buffer de salida.
|
454 |
* @throws InvalidSetViewException
|
455 |
*/
|
456 |
private Buffer requestFillingWithNoData(Extent requestExtent, Extent fitExtent, int bufWidth, int bufHeight) |
457 |
throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException {
|
458 |
double error = 0.01; |
459 |
//Upper Left
|
460 |
double distWcX = Math.abs(fitExtent.getMin().getX() - dataExtent.getMin().getX()); |
461 |
distWcX = (distWcX > error) ? distWcX : 0;
|
462 |
double distWcY = Math.abs(fitExtent.getMax().getY() - dataExtent.getMax().getY()); |
463 |
distWcY = (distWcY > error) ? distWcY : 0;
|
464 |
//Pixel inicial del buffer donde se empieza a dibujar. Redondeamos por arriba pq lo que sobra se pone NoData
|
465 |
double initPxX = Math.ceil((distWcX * bufWidth) / requestExtent.width()); |
466 |
double initPxY = Math.ceil((distWcY * bufHeight) / requestExtent.height()); |
467 |
|
468 |
//Lower Right
|
469 |
distWcX = Math.abs(fitExtent.getMax().getX() - dataExtent.getMin().getX());
|
470 |
distWcX = (distWcX > error) ? distWcX : 0;
|
471 |
distWcY = Math.abs(fitExtent.getMin().getY() - dataExtent.getMax().getY());
|
472 |
distWcY = (distWcY > error) ? distWcY : 0;
|
473 |
//Pixel final del buffer donde se dibuja. Redondeamos por abajo pq lo que sobra se pone NoData
|
474 |
double endPxX = Math.floor((distWcX * bufWidth) / requestExtent.width()); |
475 |
double endPxY = Math.floor((distWcY * bufHeight) / requestExtent.height()); |
476 |
|
477 |
int copyX = (int)Math.abs(endPxX - initPxX); |
478 |
int copyY = (int)Math.abs(endPxY - initPxY); |
479 |
|
480 |
Buffer rasterBuf = getWindow(fitExtent.getULX(), fitExtent.getULY(), fitExtent.getLRX(), fitExtent.getLRY(), copyX, copyY, true); |
481 |
Buffer buf = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], bufWidth, bufHeight, rasterBuf.getBandCount(), true); |
482 |
buf.setNoDataValue(currentQuery.getNoDataValueToFill()); |
483 |
for(int i = 0; i < buf.getBandCount(); i++) { |
484 |
switch(buf.getDataType()) {
|
485 |
case Buffer.TYPE_BYTE:buf.assign(i, |
486 |
buf.getNoDataValue().isDefined() ? buf.getNoDataValue().getValue().byteValue() : RasterLibrary.defaultByteNoDataValue); |
487 |
break;
|
488 |
case Buffer.TYPE_SHORT:buf.assign(i, |
489 |
buf.getNoDataValue().isDefined() ? buf.getNoDataValue().getValue().shortValue() : RasterLibrary.defaultShortNoDataValue); |
490 |
break;
|
491 |
case Buffer.TYPE_INT:buf.assign(i, |
492 |
buf.getNoDataValue().isDefined() ? buf.getNoDataValue().getValue().intValue() : RasterLibrary.defaultIntegerNoDataValue); |
493 |
break;
|
494 |
case Buffer.TYPE_FLOAT:buf.assign(i, |
495 |
buf.getNoDataValue().isDefined() ? buf.getNoDataValue().getValue().floatValue() : RasterLibrary.defaultFloatNoDataValue); |
496 |
break;
|
497 |
case Buffer.TYPE_DOUBLE:buf.assign(i, |
498 |
buf.getNoDataValue().isDefined() ? buf.getNoDataValue().getValue().doubleValue() : RasterLibrary.defaultDoubleNoDataValue); |
499 |
break;
|
500 |
} |
501 |
} |
502 |
|
503 |
switch(rasterBuf.getDataType()) {
|
504 |
case Buffer.TYPE_BYTE: |
505 |
for (int iBand = 0; iBand < rasterBuf.getBandCount(); iBand++) |
506 |
for (int row = 0; row < copyY; row++) |
507 |
for (int col = 0; col < copyX; col++) |
508 |
buf.setElem((int)(row + initPxY), (int)(col + initPxX), |
509 |
iBand, |
510 |
rasterBuf.getElemByte(row, col, iBand)); |
511 |
break;
|
512 |
case Buffer.TYPE_SHORT: |
513 |
case Buffer.TYPE_USHORT: |
514 |
for (int iBand = 0; iBand < rasterBuf.getBandCount(); iBand++) |
515 |
for (int row = 0; row < copyY; row++) |
516 |
for (int col = 0; col < copyX; col++) |
517 |
buf.setElem((int)(row + initPxY), (int)(col + initPxX), |
518 |
iBand, |
519 |
rasterBuf.getElemShort(row, col, iBand)); |
520 |
break;
|
521 |
case Buffer.TYPE_INT: |
522 |
for (int iBand = 0; iBand < rasterBuf.getBandCount(); iBand++) |
523 |
for (int row = 0; row < copyY; row++) |
524 |
for (int col = 0; col < copyX; col++) |
525 |
buf.setElem((int)(row + initPxY), (int)(col + initPxX), |
526 |
iBand, |
527 |
rasterBuf.getElemInt(row, col, iBand)); |
528 |
break;
|
529 |
case Buffer.TYPE_FLOAT: |
530 |
for (int iBand = 0; iBand < rasterBuf.getBandCount(); iBand++) |
531 |
for (int row = 0; row < copyY; row++) |
532 |
for (int col = 0; col < copyX; col++) |
533 |
buf.setElem((int)(row + initPxY), (int)(col + initPxX), |
534 |
iBand, |
535 |
rasterBuf.getElemFloat(row, col, iBand)); |
536 |
break;
|
537 |
case Buffer.TYPE_DOUBLE: |
538 |
for (int iBand = 0; iBand < rasterBuf.getBandCount(); iBand++) |
539 |
for (int row = 0; row < copyY; row++) |
540 |
for (int col = 0; col < copyX; col++) |
541 |
buf.setElem((int)(row + initPxY), (int)(col + initPxX), |
542 |
iBand, |
543 |
rasterBuf.getElemDouble(row, col, iBand)); |
544 |
break;
|
545 |
} |
546 |
return buf;
|
547 |
} |
548 |
|
549 |
/*
|
550 |
* (non-Javadoc)
|
551 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#getSerialInfo()
|
552 |
*/
|
553 |
public TimeSeries getTimeSerials() throws RmfSerializerException { |
554 |
if(getProvider() instanceof RasterProvider) |
555 |
return ((RasterProvider)getProvider()).getTimeSerials();
|
556 |
return null; |
557 |
} |
558 |
|
559 |
/*
|
560 |
* (non-Javadoc)
|
561 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#setSerialInfo()
|
562 |
*/
|
563 |
public void setTimeSerials(TimeSeries serialInfo) throws RmfSerializerException { |
564 |
if(getProvider() instanceof RasterProvider) |
565 |
((RasterProvider)getProvider()).setTimeSerials(serialInfo); |
566 |
} |
567 |
|
568 |
/*
|
569 |
* (non-Javadoc)
|
570 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#saveColorTableToRmf(org.gvsig.fmap.dal.coverage.store.props.ColorTable)
|
571 |
*/
|
572 |
public abstract void saveColorTableToRmf(ColorTable table) throws RmfSerializerException; |
573 |
|
574 |
|
575 |
/**
|
576 |
* Saves information about serials
|
577 |
* @param object to save
|
578 |
* @throws RmfSerializerException
|
579 |
*/
|
580 |
public abstract void saveSerialInfoToRmf(TimeSeries serialInfo) throws RmfSerializerException; |
581 |
|
582 |
/**
|
583 |
* Loads information about serials
|
584 |
* @param object to load
|
585 |
* @throws RmfSerializerException
|
586 |
*/
|
587 |
public abstract boolean loadSerialInfoFromRmf(TimeSeries serialInfo); |
588 |
|
589 |
/*
|
590 |
* (non-Javadoc)
|
591 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#createVectorizeObject(org.gvsig.fmap.dal.coverage.store.RasterDataStore)
|
592 |
*/
|
593 |
public Vectorization createVectorizeObject() throws RasterDriverException, ProcessInterruptedException { |
594 |
return new PotraceVectorization((RasterDataStore)this); |
595 |
} |
596 |
|
597 |
/*
|
598 |
* (non-Javadoc)
|
599 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#getRender()
|
600 |
*/
|
601 |
public Render getRender() {
|
602 |
if(render == null) |
603 |
render = new DefaultRender(this); |
604 |
return render;
|
605 |
} |
606 |
|
607 |
/*
|
608 |
* (non-Javadoc)
|
609 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#getRender()
|
610 |
*/
|
611 |
public void setRender(Render render) { |
612 |
this.render = render;
|
613 |
} |
614 |
|
615 |
/**
|
616 |
* Obtiene la altura de la fuente de datos.
|
617 |
* @return altura en celdas del grid.
|
618 |
*/
|
619 |
private int getSourceHeight() { |
620 |
return (int)getHeight(); |
621 |
} |
622 |
|
623 |
/**
|
624 |
* Obtiene la anchura de la fuente de datos.
|
625 |
* @return anchura en celdas del grid.
|
626 |
*/
|
627 |
private int getSourceWidth() { |
628 |
return (int)getWidth(); |
629 |
} |
630 |
|
631 |
/*
|
632 |
* (non-Javadoc)
|
633 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#isFileSupported(java.lang.String)
|
634 |
*/
|
635 |
public boolean isFileSupported(String fName) { |
636 |
return RasterLocator.getManager().isExtensionSupported(fName);
|
637 |
} |
638 |
|
639 |
/**
|
640 |
* Registers metadata definition
|
641 |
* @throws MetadataException
|
642 |
*/
|
643 |
public static void registerMetadataDefinition() throws MetadataException { |
644 |
MetadataManager manager = MetadataLocator.getMetadataManager(); |
645 |
|
646 |
if(manager == null) |
647 |
return;
|
648 |
|
649 |
if( manager.getDefinition(METADATA_DEFINITION_NAME) == null ) { |
650 |
DynStruct defnition = manager.addDefinition( |
651 |
METADATA_DEFINITION_NAME, |
652 |
METADATA_DEFINITION_NAME |
653 |
); |
654 |
defnition.extend( |
655 |
MetadataManager.METADATA_NAMESPACE, |
656 |
DataStore.METADATA_DEFINITION_NAME |
657 |
); |
658 |
} |
659 |
} |
660 |
|
661 |
/*
|
662 |
* (non-Javadoc)
|
663 |
* @see org.gvsig.fmap.dal.coverage.store.RasterDataStore#getSourceType()
|
664 |
*/
|
665 |
public int getSourceType() { |
666 |
return ((RasterProvider)getProvider()).getSourceType();
|
667 |
} |
668 |
|
669 |
//****************************************************
|
670 |
//****Implementing DataStoreImplementation methods****
|
671 |
//****************************************************
|
672 |
|
673 |
/*
|
674 |
* (non-Javadoc)
|
675 |
* @see org.gvsig.fmap.dal.impl.DataStoreImplementation#intializePhase1(org.gvsig.fmap.dal.impl.DefaultDataManager, org.gvsig.fmap.dal.DataStoreParameters)
|
676 |
*/
|
677 |
public void intializePhase1(DataManager dataManager, |
678 |
DataStoreParameters parameters) throws InitializeException {
|
679 |
DynObjectManager dynManager = ToolsLocator.getDynObjectManager(); |
680 |
|
681 |
this.metadata = (DelegatedDynObject) dynManager
|
682 |
.createDynObject( |
683 |
MetadataLocator.getMetadataManager().getDefinition(DataStore.SPATIAL_METADATA_DEFINITION_NAME) |
684 |
); |
685 |
this.dataManager = dataManager;
|
686 |
this.parameters = parameters;
|
687 |
|
688 |
} |
689 |
|
690 |
/*
|
691 |
* (non-Javadoc)
|
692 |
* @see org.gvsig.fmap.dal.impl.DataStoreImplementation#intializePhase2(org.gvsig.fmap.dal.spi.DataStoreProvider)
|
693 |
*/
|
694 |
public void intializePhase2(DataStoreProvider provider) |
695 |
throws InitializeException {
|
696 |
} |
697 |
|
698 |
/* (non-Javadoc)
|
699 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#getManager()
|
700 |
*/
|
701 |
public DataManager getManager() {
|
702 |
return this.dataManager; |
703 |
} |
704 |
|
705 |
//****************************************************
|
706 |
//*********Implementing DataStore methods*************
|
707 |
//****************************************************
|
708 |
|
709 |
/*
|
710 |
* (non-Javadoc)
|
711 |
* @see org.gvsig.fmap.dal.DataStore#getProviderName()
|
712 |
*/
|
713 |
public String getProviderName() { |
714 |
return getProvider().getFullName();
|
715 |
} |
716 |
|
717 |
/*
|
718 |
* (non-Javadoc)
|
719 |
* @see org.gvsig.fmap.dal.DataStore#refresh()
|
720 |
*/
|
721 |
public void refresh() throws DataException { |
722 |
return;
|
723 |
} |
724 |
|
725 |
/*
|
726 |
* (non-Javadoc)
|
727 |
* @see org.gvsig.fmap.dal.DataStore#getDataSet()
|
728 |
*/
|
729 |
public DataSet getDataSet() throws DataException { |
730 |
return null; |
731 |
} |
732 |
|
733 |
/*
|
734 |
* (non-Javadoc)
|
735 |
* @see org.gvsig.fmap.dal.DataStore#getDataSet(org.gvsig.fmap.dal.DataQuery)
|
736 |
*/
|
737 |
public DataSet getDataSet(DataQuery dataQuery) throws DataException { |
738 |
return null; |
739 |
} |
740 |
|
741 |
/*
|
742 |
* (non-Javadoc)
|
743 |
* @see org.gvsig.fmap.dal.DataStore#accept(org.gvsig.tools.visitor.Visitor, org.gvsig.fmap.dal.DataQuery)
|
744 |
*/
|
745 |
public void accept(Visitor visitor, DataQuery dataQuery) |
746 |
throws BaseException {
|
747 |
} |
748 |
|
749 |
/*
|
750 |
* (non-Javadoc)
|
751 |
* @see org.gvsig.fmap.dal.DataStore#getDataSet(org.gvsig.tools.observer.Observer)
|
752 |
*/
|
753 |
public void getDataSet(org.gvsig.tools.observer.Observer observer) throws DataException { |
754 |
} |
755 |
|
756 |
/*
|
757 |
* (non-Javadoc)
|
758 |
* @see org.gvsig.fmap.dal.DataStore#getDataSet(org.gvsig.fmap.dal.DataQuery, org.gvsig.tools.observer.Observer)
|
759 |
*/
|
760 |
public void getDataSet(DataQuery dataQuery, org.gvsig.tools.observer.Observer observer) throws DataException { |
761 |
} |
762 |
|
763 |
/*
|
764 |
* (non-Javadoc)
|
765 |
* @see org.gvsig.fmap.dal.DataStore#getSelection()
|
766 |
*/
|
767 |
public DataSet getSelection() throws DataException { |
768 |
return null; |
769 |
} |
770 |
|
771 |
/*
|
772 |
* (non-Javadoc)
|
773 |
* @see org.gvsig.fmap.dal.DataStore#setSelection(org.gvsig.fmap.dal.DataSet)
|
774 |
*/
|
775 |
public void setSelection(DataSet selection) throws DataException { |
776 |
} |
777 |
|
778 |
/*
|
779 |
* (non-Javadoc)
|
780 |
* @see org.gvsig.fmap.dal.DataStore#createSelection()
|
781 |
*/
|
782 |
public DataSet createSelection() throws DataException { |
783 |
return null; |
784 |
} |
785 |
|
786 |
/*
|
787 |
* (non-Javadoc)
|
788 |
* @see org.gvsig.fmap.dal.DataStore#getChildren()
|
789 |
*/
|
790 |
@SuppressWarnings("unchecked") |
791 |
public Iterator getChildren() { |
792 |
return null; |
793 |
} |
794 |
|
795 |
/*
|
796 |
* (non-Javadoc)
|
797 |
* @see org.gvsig.fmap.dal.DataStore#getExplorer()
|
798 |
*/
|
799 |
public DataServerExplorer getExplorer() throws DataException, ValidateDataParametersException { |
800 |
return null; |
801 |
} |
802 |
|
803 |
/*
|
804 |
* (non-Javadoc)
|
805 |
* @see org.gvsig.fmap.dal.DataStore#createQuery()
|
806 |
*/
|
807 |
public DataQuery createQuery() {
|
808 |
return new DefaultRasterQuery(); |
809 |
} |
810 |
|
811 |
//****************************************************
|
812 |
//*********Implementing Metadata methods*************
|
813 |
//****************************************************
|
814 |
|
815 |
/*
|
816 |
* (non-Javadoc)
|
817 |
* @see org.gvsig.metadata.Metadata#getMetadataID()
|
818 |
*/
|
819 |
public Object getMetadataID() { |
820 |
if(parameters != null && parameters instanceof RasterFileStoreParameters) |
821 |
return ((RasterFileStoreParameters)parameters).getFile();
|
822 |
if(parameters != null && parameters instanceof RasterDataParameters) |
823 |
return ((RasterDataParameters)parameters).getURI();
|
824 |
return null; |
825 |
} |
826 |
|
827 |
/*
|
828 |
* (non-Javadoc)
|
829 |
* @see org.gvsig.metadata.Metadata#getMetadataChildren()
|
830 |
*/
|
831 |
@SuppressWarnings("unchecked") |
832 |
public Set getMetadataChildren() { |
833 |
return null; |
834 |
} |
835 |
|
836 |
//****************************************************
|
837 |
//*********Implementing Disposable methods************
|
838 |
//****************************************************
|
839 |
|
840 |
/*
|
841 |
* (non-Javadoc)
|
842 |
* @see org.gvsig.tools.dispose.impl.AbstractDisposable#doDispose()
|
843 |
*/
|
844 |
public void doDispose() { |
845 |
|
846 |
} |
847 |
|
848 |
//****************************************************
|
849 |
//*********Implementing Visitable methods*************
|
850 |
//****************************************************
|
851 |
|
852 |
/*
|
853 |
* (non-Javadoc)
|
854 |
* @see org.gvsig.tools.visitor.Visitable#accept(org.gvsig.tools.visitor.Visitor)
|
855 |
*/
|
856 |
public void accept(Visitor visitor) throws BaseException { |
857 |
|
858 |
} |
859 |
|
860 |
//****************************************************
|
861 |
//****Implementing ComplexObservable methods**********
|
862 |
//****************************************************
|
863 |
|
864 |
/*
|
865 |
* (non-Javadoc)
|
866 |
* @see org.gvsig.tools.observer.ComplexObservable#disableNotifications()
|
867 |
*/
|
868 |
public void disableNotifications() { |
869 |
|
870 |
} |
871 |
|
872 |
/*
|
873 |
* (non-Javadoc)
|
874 |
* @see org.gvsig.tools.observer.ComplexObservable#enableNotifications()
|
875 |
*/
|
876 |
public void enableNotifications() { |
877 |
|
878 |
} |
879 |
|
880 |
/*
|
881 |
* (non-Javadoc)
|
882 |
* @see org.gvsig.tools.observer.ComplexObservable#beginComplexNotification()
|
883 |
*/
|
884 |
public void beginComplexNotification() { |
885 |
|
886 |
} |
887 |
|
888 |
/*
|
889 |
* (non-Javadoc)
|
890 |
* @see org.gvsig.tools.observer.ComplexObservable#endComplexNotification()
|
891 |
*/
|
892 |
public void endComplexNotification() { |
893 |
|
894 |
} |
895 |
|
896 |
//****************************************************
|
897 |
//********Implementing Observable methods*************
|
898 |
//****************************************************
|
899 |
|
900 |
/*
|
901 |
* (non-Javadoc)
|
902 |
* @see org.gvsig.tools.observer.Observable#addObserver(org.gvsig.tools.observer.Observer)
|
903 |
*/
|
904 |
public void addObserver(org.gvsig.tools.observer.Observer o) { |
905 |
|
906 |
} |
907 |
|
908 |
/*
|
909 |
* (non-Javadoc)
|
910 |
* @see org.gvsig.tools.observer.Observable#deleteObserver(org.gvsig.tools.observer.Observer)
|
911 |
*/
|
912 |
public void deleteObserver(org.gvsig.tools.observer.Observer o) { |
913 |
|
914 |
} |
915 |
|
916 |
/*
|
917 |
* (non-Javadoc)
|
918 |
* @see org.gvsig.tools.observer.Observable#deleteObservers()
|
919 |
*/
|
920 |
public void deleteObservers() { |
921 |
|
922 |
} |
923 |
|
924 |
//****************************************************
|
925 |
//********Implementing DynObject methods*************
|
926 |
//****************************************************
|
927 |
|
928 |
/*
|
929 |
* (non-Javadoc)
|
930 |
* @see org.gvsig.tools.dynobject.DynObject#getDynClass()
|
931 |
*/
|
932 |
public DynClass getDynClass() {
|
933 |
return this.metadata.getDynClass(); |
934 |
} |
935 |
|
936 |
/*
|
937 |
* (non-Javadoc)
|
938 |
* @see org.gvsig.tools.dynobject.DynObject#implement(org.gvsig.tools.dynobject.DynClass)
|
939 |
*/
|
940 |
public void implement(DynClass dynClass) { |
941 |
this.metadata.implement(dynClass);
|
942 |
} |
943 |
|
944 |
/*
|
945 |
* (non-Javadoc)
|
946 |
* @see org.gvsig.tools.dynobject.DynObject#delegate(org.gvsig.tools.dynobject.DynObject)
|
947 |
*/
|
948 |
public void delegate(DynObject dynObject) { |
949 |
this.metadata.delegate(dynObject);
|
950 |
} |
951 |
|
952 |
/*
|
953 |
* (non-Javadoc)
|
954 |
* @see org.gvsig.tools.dynobject.DynObject#getDynValue(java.lang.String)
|
955 |
*/
|
956 |
public Object getDynValue(String name) throws DynFieldNotFoundException { |
957 |
return this.metadata.getDynValue(name); |
958 |
} |
959 |
|
960 |
/*
|
961 |
* (non-Javadoc)
|
962 |
* @see org.gvsig.tools.dynobject.DynObject#setDynValue(java.lang.String, java.lang.Object)
|
963 |
*/
|
964 |
public void setDynValue(String name, Object value) throws DynFieldNotFoundException { |
965 |
this.metadata.setDynValue(name, value);
|
966 |
} |
967 |
|
968 |
/*
|
969 |
* (non-Javadoc)
|
970 |
* @see org.gvsig.tools.dynobject.DynObject#hasDynValue(java.lang.String)
|
971 |
*/
|
972 |
public boolean hasDynValue(String name) { |
973 |
return this.metadata.hasDynValue(name); |
974 |
} |
975 |
|
976 |
/*
|
977 |
* (non-Javadoc)
|
978 |
* @see org.gvsig.tools.dynobject.DynObject#invokeDynMethod(java.lang.String, org.gvsig.tools.dynobject.DynObject)
|
979 |
*/
|
980 |
public Object invokeDynMethod(String name, DynObject context) throws DynMethodException { |
981 |
return this.metadata.invokeDynMethod(this, name, context); |
982 |
} |
983 |
|
984 |
/*
|
985 |
* (non-Javadoc)
|
986 |
* @see org.gvsig.tools.dynobject.DynObject#invokeDynMethod(int, org.gvsig.tools.dynobject.DynObject)
|
987 |
*/
|
988 |
public Object invokeDynMethod(int code, DynObject context) throws DynMethodException { |
989 |
return this.metadata.invokeDynMethod(this, code, context); |
990 |
} |
991 |
|
992 |
/*
|
993 |
* (non-Javadoc)
|
994 |
* @see org.gvsig.tools.dynobject.DynObject#clear()
|
995 |
*/
|
996 |
public void clear() { |
997 |
if (metadata != null) { |
998 |
metadata.clear(); |
999 |
} |
1000 |
} |
1001 |
|
1002 |
/*
|
1003 |
* (non-Javadoc)
|
1004 |
* @see org.gvsig.fmap.dal.DataStore#getParameters()
|
1005 |
*/
|
1006 |
public DataStoreParameters getParameters() {
|
1007 |
return parameters;
|
1008 |
} |
1009 |
|
1010 |
//***********************************************************************
|
1011 |
//********Implementing CoverageStoreProviderServices methods*************
|
1012 |
//***********************************************************************
|
1013 |
|
1014 |
public CoverageSelection createDefaultCoverageSelection()
|
1015 |
throws DataException {
|
1016 |
return null; |
1017 |
} |
1018 |
|
1019 |
/*
|
1020 |
* (non-Javadoc)
|
1021 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#getCoverageStore()
|
1022 |
*/
|
1023 |
public CoverageStore getCoverageStore() {
|
1024 |
return this; |
1025 |
} |
1026 |
|
1027 |
/*
|
1028 |
* (non-Javadoc)
|
1029 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#getProvider()
|
1030 |
*/
|
1031 |
public abstract CoverageStoreProvider getProvider(); |
1032 |
|
1033 |
/*
|
1034 |
* (non-Javadoc)
|
1035 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#notifyChange(java.lang.String)
|
1036 |
*/
|
1037 |
public void notifyChange(String notification) { |
1038 |
delegateObservable |
1039 |
.notifyObservers(new DefaultCoverageStoreNotification(
|
1040 |
this, notification));
|
1041 |
} |
1042 |
|
1043 |
/*
|
1044 |
* (non-Javadoc)
|
1045 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#notifyChange(java.lang.String, org.gvsig.fmap.dal.resource.Resource)
|
1046 |
*/
|
1047 |
public void notifyChange(String arg0, Resource arg1) { |
1048 |
/*delegateObservable.notifyObservers(new DefaultFeatureStoreNotification(
|
1049 |
this, FeatureStoreNotification.RESOURCE_CHANGED));*/
|
1050 |
} |
1051 |
|
1052 |
/*
|
1053 |
* (non-Javadoc)
|
1054 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#notifyChange(java.lang.String, org.gvsig.tools.undo.command.Command)
|
1055 |
*/
|
1056 |
public void notifyChange(String notification, Command command) { |
1057 |
delegateObservable |
1058 |
.notifyObservers(new DefaultCoverageStoreNotification(
|
1059 |
this, notification, command));
|
1060 |
} |
1061 |
|
1062 |
/*
|
1063 |
* (non-Javadoc)
|
1064 |
* @see org.gvsig.fmap.dal.spi.DataStoreProviderServices#getStore()
|
1065 |
*/
|
1066 |
public DataStore getStore() {
|
1067 |
return this; |
1068 |
} |
1069 |
} |