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 @ 5462
History | View | Annotate | Download (20.1 KB)
1 | 2443 | nbrodin | /* 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.io.File; |
||
25 | 4436 | fdiaz | import java.net.URI; |
26 | 2443 | nbrodin | import java.util.Iterator; |
27 | import java.util.List; |
||
28 | import java.util.Set; |
||
29 | |||
30 | import org.cresques.cts.ICoordTrans; |
||
31 | 4436 | fdiaz | |
32 | 2443 | nbrodin | import org.gvsig.fmap.dal.DataManager; |
33 | import org.gvsig.fmap.dal.DataQuery; |
||
34 | import org.gvsig.fmap.dal.DataServerExplorer; |
||
35 | import org.gvsig.fmap.dal.DataSet; |
||
36 | import org.gvsig.fmap.dal.DataStore; |
||
37 | import org.gvsig.fmap.dal.DataStoreParameters; |
||
38 | import org.gvsig.fmap.dal.coverage.RasterLocator; |
||
39 | import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
||
40 | import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
||
41 | import org.gvsig.fmap.dal.coverage.datastruct.DatasetBand; |
||
42 | import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
||
43 | import org.gvsig.fmap.dal.coverage.datastruct.GeoPointList; |
||
44 | import org.gvsig.fmap.dal.coverage.exception.BandNotFoundInListException; |
||
45 | import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
||
46 | import org.gvsig.fmap.dal.coverage.exception.QueryException; |
||
47 | import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
||
48 | import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
||
49 | import org.gvsig.fmap.dal.coverage.grid.render.Render; |
||
50 | import org.gvsig.fmap.dal.coverage.process.vector.Vectorization; |
||
51 | import org.gvsig.fmap.dal.coverage.store.RasterDataServerExplorer; |
||
52 | import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
||
53 | import org.gvsig.fmap.dal.coverage.store.RasterQuery; |
||
54 | import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
||
55 | import org.gvsig.fmap.dal.coverage.store.parameter.RasterFileStoreParameters; |
||
56 | import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
||
57 | import org.gvsig.fmap.dal.coverage.store.props.Metadata; |
||
58 | import org.gvsig.fmap.dal.coverage.store.props.TimeSeries; |
||
59 | import org.gvsig.fmap.dal.exception.DataException; |
||
60 | import org.gvsig.fmap.dal.exception.InitializeException; |
||
61 | import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
||
62 | import org.gvsig.fmap.dal.raster.CoverageSelection; |
||
63 | import org.gvsig.fmap.dal.raster.CoverageStore; |
||
64 | import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider; |
||
65 | import org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices; |
||
66 | import org.gvsig.fmap.dal.resource.Resource; |
||
67 | import org.gvsig.fmap.dal.spi.DataStoreInitializer; |
||
68 | import org.gvsig.fmap.dal.spi.DataStoreProvider; |
||
69 | import org.gvsig.metadata.MetadataLocator; |
||
70 | import org.gvsig.metadata.MetadataManager; |
||
71 | import org.gvsig.metadata.exceptions.MetadataException; |
||
72 | import org.gvsig.raster.impl.DefaultRasterManager; |
||
73 | import org.gvsig.raster.impl.buffer.DefaultRasterQuery; |
||
74 | import org.gvsig.raster.impl.datastruct.BandListImpl; |
||
75 | import org.gvsig.raster.impl.datastruct.DatasetBandImpl; |
||
76 | import org.gvsig.raster.impl.datastruct.ExtentImpl; |
||
77 | import org.gvsig.raster.impl.grid.render.DefaultRender; |
||
78 | import org.gvsig.raster.impl.process.vector.PotraceVectorization; |
||
79 | import org.gvsig.raster.impl.provider.AbstractRasterProvider; |
||
80 | import org.gvsig.raster.impl.provider.RasterProvider; |
||
81 | import org.gvsig.raster.impl.provider.RemoteRasterProvider; |
||
82 | import org.gvsig.tools.ToolsLocator; |
||
83 | import org.gvsig.tools.dispose.impl.AbstractDisposable; |
||
84 | import org.gvsig.tools.dynobject.DelegatedDynObject; |
||
85 | import org.gvsig.tools.dynobject.DynClass; |
||
86 | import org.gvsig.tools.dynobject.DynObject; |
||
87 | import org.gvsig.tools.dynobject.DynObjectManager; |
||
88 | import org.gvsig.tools.dynobject.DynStruct; |
||
89 | import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
||
90 | import org.gvsig.tools.dynobject.exception.DynMethodException; |
||
91 | import org.gvsig.tools.exception.BaseException; |
||
92 | import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable; |
||
93 | import org.gvsig.tools.undo.command.Command; |
||
94 | import org.gvsig.tools.visitor.Visitor; |
||
95 | |||
96 | /**
|
||
97 | * Default implementation for RasterDataSource
|
||
98 | 4181 | fdiaz | *
|
99 | 2443 | nbrodin | * @author Nacho Brodin (nachobrodin@gmail.com)
|
100 | */
|
||
101 | 4181 | fdiaz | public abstract class AbstractRasterDataStore extends AbstractDisposable |
102 | 2443 | nbrodin | implements RasterDataStore, CoverageStoreProviderServices, QueryableRaster, DataStoreInitializer {
|
103 | public static final String PERSISTENT_NAME = "AbstractRasterDataStore_Persistent"; |
||
104 | public static final String PERSISTENT_DESCRIPTION = "AbstractRasterDataStore Persistent"; |
||
105 | // private Logger log = LoggerFactory.getLogger(AbstractRasterDataStore.class);
|
||
106 | protected DefaultRasterQuery currentQuery = null; |
||
107 | protected BandListImpl storeBandList = null; |
||
108 | protected RasterProvider provider = null; |
||
109 | protected Metadata metadata = null; |
||
110 | 4181 | fdiaz | |
111 | 2443 | nbrodin | /**
|
112 | * Lista de paletas asociadas a las bandas cargadas en el DataSource. Estas son calculadas
|
||
113 | * en las funciones que asignan las bandas a dibujar (addDrawableBands)
|
||
114 | */
|
||
115 | private ColorTable[] palette = null; |
||
116 | |||
117 | /**
|
||
118 | * Ancho y alto en pixeles del ?ltimo buffer asignado
|
||
119 | */
|
||
120 | protected double nWidth = 0; |
||
121 | protected double nHeight = 0; |
||
122 | private Buffer lastBuffer = null; |
||
123 | 4181 | fdiaz | |
124 | 2443 | nbrodin | private DataManager dataManager = null; |
125 | protected DataStoreParameters parameters = null; |
||
126 | private DelegatedDynObject dynobj = null; |
||
127 | 4181 | fdiaz | private DelegateWeakReferencingObservable
|
128 | 2443 | nbrodin | delegateObservable = new DelegateWeakReferencingObservable(this); |
129 | private Render render = null; |
||
130 | protected RasterDataServerExplorer explorer = null; |
||
131 | 4181 | fdiaz | |
132 | 2443 | nbrodin | public BandList getDefaultBandList() {
|
133 | if(storeBandList == null) { |
||
134 | initializeBandList(); |
||
135 | } |
||
136 | return storeBandList;
|
||
137 | } |
||
138 | 4181 | fdiaz | |
139 | 2443 | nbrodin | public void initializeBandList() { |
140 | if(provider != null) { |
||
141 | storeBandList = new BandListImpl();
|
||
142 | storeBandList.clear(); |
||
143 | for(int i = 0; i < provider.getBandCount(); i++) { |
||
144 | try {
|
||
145 | int dataType = provider.getDataType()[i];
|
||
146 | 4436 | fdiaz | String filename;
|
147 | URI uriByBand = provider.getURIByBand(i);
|
||
148 | if("FILE".equalsIgnoreCase(uriByBand.getScheme())){ |
||
149 | 4597 | fdiaz | filename = new File(uriByBand).getAbsolutePath(); |
150 | 4436 | fdiaz | } else {
|
151 | filename = uriByBand.toString(); |
||
152 | } |
||
153 | DatasetBand band = new DatasetBandImpl(filename,
|
||
154 | 4181 | fdiaz | provider.getBandPositionByProvider(i), |
155 | dataType, |
||
156 | 2443 | nbrodin | provider.getBandCount()); |
157 | storeBandList.addBand(band, i); |
||
158 | } catch(BandNotFoundInListException ex) {
|
||
159 | //No a?adimos la banda
|
||
160 | } |
||
161 | } |
||
162 | |||
163 | int[] drawableBands = new int[storeBandList.getBandCount()]; |
||
164 | for (int i = 0; i < storeBandList.getBandCount(); i++) { |
||
165 | drawableBands[i] = i; |
||
166 | } |
||
167 | |||
168 | storeBandList.setDrawableBands(drawableBands); |
||
169 | } |
||
170 | } |
||
171 | 4181 | fdiaz | |
172 | 2443 | nbrodin | public Buffer query(RasterQuery query) throws ProcessInterruptedException, QueryException { |
173 | Object[] obj = queryArray(query); |
||
174 | if(obj != null && obj.length > 0 && obj[0] instanceof Buffer) |
||
175 | return ((Buffer)obj[0]); |
||
176 | return null; |
||
177 | } |
||
178 | 4181 | fdiaz | |
179 | 2443 | nbrodin | /**
|
180 | * <UL>Tasks to do in the <code>Datastore</code>
|
||
181 | * <LI>Check parameters and adjust them to not exceed the window size</LI>
|
||
182 | * <LI>Build the band list to draw</LI>
|
||
183 | * <LI>Create the buffers (RO or RW) and set them in the <code>RasterQuery</code> object</LI>
|
||
184 | * <LI>Calculate steps when supersampling is applied</LI>
|
||
185 | * </UL>
|
||
186 | */
|
||
187 | public Object[] queryArray(RasterQuery query) |
||
188 | throws ProcessInterruptedException, QueryException {
|
||
189 | Object[] result = null; |
||
190 | currentQuery = (DefaultRasterQuery)query; |
||
191 | DefaultRasterQuery q = currentQuery; |
||
192 | 4181 | fdiaz | |
193 | 2443 | nbrodin | if(isTiled() || provider instanceof RemoteRasterProvider) |
194 | q.dontBuildBuffer(); |
||
195 | 4181 | fdiaz | |
196 | 2443 | nbrodin | Buffer buf = null; |
197 | 4181 | fdiaz | |
198 | 2443 | nbrodin | if(q.requestHasShift()) {
|
199 | //TODO: Sin probar
|
||
200 | FramedBufferResampling framedBufferResampling = new FramedBufferResampling(q, this); |
||
201 | 4181 | fdiaz | buf = framedBufferResampling.query(provider); |
202 | 2443 | nbrodin | } else {
|
203 | q.calculateParameters(this);
|
||
204 | try {
|
||
205 | if(q.isReadOnly() && !isTiled())
|
||
206 | buf = q.getBufferForProviders(); |
||
207 | else
|
||
208 | buf = ((AbstractRasterProvider)provider).getDataSet(q); |
||
209 | } catch (RasterDriverException e) {
|
||
210 | throw new QueryException("Error getting data", e); |
||
211 | } |
||
212 | 4181 | fdiaz | |
213 | 2443 | nbrodin | if(q.isSupersamplingOptionActive() && q.isSupersamplingTheRequest()) {
|
214 | buf = buf.getAdjustedWindow(q.getBufWidth(), q.getBufHeight(), Buffer.INTERPOLATION_NearestNeighbour);
|
||
215 | } |
||
216 | } |
||
217 | if(buf != null) |
||
218 | buf.setDataExtent(q.getAdjustedRequestBoundingBox().toRectangle2D()); |
||
219 | result = new Object[]{buf}; |
||
220 | 4181 | fdiaz | |
221 | 2443 | nbrodin | if(q.isStoredLastBuffer())
|
222 | lastBuffer = buf; |
||
223 | else
|
||
224 | lastBuffer = null;
|
||
225 | q.storeLastBuffer(false);
|
||
226 | 4181 | fdiaz | |
227 | 2443 | nbrodin | if(result != null && result.length > 0 && result[0] instanceof Buffer) { |
228 | ((Buffer)result[0]).setStore(this); |
||
229 | if(getNoDataValue() != null && getNoDataValue().isDefined()) |
||
230 | ((Buffer)result[0]).setNoDataValue(getNoDataValue()); |
||
231 | return result;
|
||
232 | } |
||
233 | return null; |
||
234 | } |
||
235 | 4181 | fdiaz | |
236 | 2443 | nbrodin | public Extent adjustToExtent(Extent e) {
|
237 | Extent currentExtent = this.getExtent();
|
||
238 | 4181 | fdiaz | |
239 | 2443 | nbrodin | double minx = e.getMin().getX() < currentExtent.getMin().getX() ? currentExtent.getMin().getX() : e.getMin().getX();
|
240 | double maxx = e.getMax().getX() > currentExtent.getMax().getX() ? currentExtent.getMax().getX() : e.getMax().getX();
|
||
241 | double miny = e.getMin().getY() < currentExtent.getMin().getY() ? currentExtent.getMin().getY() : e.getMin().getY();
|
||
242 | double maxy = e.getMax().getY() > currentExtent.getMax().getY() ? currentExtent.getMax().getY() : e.getMax().getY();
|
||
243 | 4181 | fdiaz | |
244 | 2443 | nbrodin | return new ExtentImpl(minx, maxy, maxx, miny); |
245 | } |
||
246 | 4181 | fdiaz | |
247 | 2443 | nbrodin | public String getFullName() { |
248 | return getName();
|
||
249 | } |
||
250 | |||
251 | public Buffer getLastBuffer() { |
||
252 | return lastBuffer;
|
||
253 | } |
||
254 | 4181 | fdiaz | |
255 | 2443 | nbrodin | public TimeSeries getTimeSerials() throws RmfSerializerException { |
256 | if(getProvider() instanceof RasterProvider) |
||
257 | return ((RasterProvider)getProvider()).getTimeSerials();
|
||
258 | return null; |
||
259 | } |
||
260 | |||
261 | public void setTimeSerials(TimeSeries serialInfo) throws RmfSerializerException { |
||
262 | if(getProvider() instanceof RasterProvider) |
||
263 | 4181 | fdiaz | ((RasterProvider)getProvider()).setTimeSerials(serialInfo); |
264 | 2443 | nbrodin | } |
265 | 4181 | fdiaz | |
266 | 2443 | nbrodin | public abstract void saveColorTableToRmf(ColorTable table) throws RmfSerializerException; |
267 | 4181 | fdiaz | |
268 | 2443 | nbrodin | public abstract void saveGeoPointListToRmf(GeoPointList pointList) throws RmfSerializerException; |
269 | 4181 | fdiaz | |
270 | 2443 | nbrodin | public abstract void saveROIFileListToRmf(List<File> fileList) throws RmfSerializerException; |
271 | 4181 | fdiaz | |
272 | 2443 | nbrodin | /**
|
273 | * Saves information about serials
|
||
274 | 4436 | fdiaz | * @param serialInfo object to save
|
275 | 2443 | nbrodin | * @throws RmfSerializerException
|
276 | */
|
||
277 | public abstract void saveSerialInfoToRmf(TimeSeries serialInfo) throws RmfSerializerException; |
||
278 | 4181 | fdiaz | |
279 | 2443 | nbrodin | /**
|
280 | * Loads information about serials
|
||
281 | 4436 | fdiaz | * @param serialInfo
|
282 | * @return true if work correctly
|
||
283 | 2443 | nbrodin | * @throws RmfSerializerException
|
284 | */
|
||
285 | public abstract boolean loadSerialInfoFromRmf(TimeSeries serialInfo); |
||
286 | 4181 | fdiaz | |
287 | 2443 | nbrodin | public Vectorization createVectorizeObject() throws QueryException, ProcessInterruptedException { |
288 | return new PotraceVectorization((RasterDataStore)this); |
||
289 | } |
||
290 | 4181 | fdiaz | |
291 | 2443 | nbrodin | public Render getRender() {
|
292 | if(render == null) |
||
293 | render = new DefaultRender(this); |
||
294 | return render;
|
||
295 | } |
||
296 | 4181 | fdiaz | |
297 | 2443 | nbrodin | public void setRender(Render render) { |
298 | this.render = render;
|
||
299 | } |
||
300 | |||
301 | public boolean isFileSupported(String fName) { |
||
302 | return RasterLocator.getManager().getProviderServices().isExtensionSupported(fName);
|
||
303 | } |
||
304 | 4181 | fdiaz | |
305 | 2443 | nbrodin | /**
|
306 | * Registers metadata definition
|
||
307 | * @throws MetadataException
|
||
308 | */
|
||
309 | public static void registerMetadataDefinition() throws MetadataException { |
||
310 | MetadataManager manager = MetadataLocator.getMetadataManager(); |
||
311 | 4181 | fdiaz | |
312 | 2443 | nbrodin | if(manager == null) |
313 | return;
|
||
314 | 4181 | fdiaz | |
315 | 2443 | nbrodin | if( manager.getDefinition(METADATA_DEFINITION_NAME) == null ) { |
316 | DynStruct defnition = manager.addDefinition( |
||
317 | METADATA_DEFINITION_NAME, |
||
318 | 4181 | fdiaz | METADATA_DEFINITION_NAME |
319 | 2443 | nbrodin | ); |
320 | defnition.extend( |
||
321 | 4181 | fdiaz | MetadataManager.METADATA_NAMESPACE, |
322 | 2443 | nbrodin | DataStore.METADATA_DEFINITION_NAME |
323 | ); |
||
324 | } |
||
325 | } |
||
326 | |||
327 | public int getSourceType() { |
||
328 | return ((RasterProvider)getProvider()).getSourceType();
|
||
329 | } |
||
330 | 4181 | fdiaz | |
331 | 2443 | nbrodin | //****************************************************
|
332 | //****Implementing DataStoreImplementation methods****
|
||
333 | //****************************************************
|
||
334 | |||
335 | public void intializePhase1(DataManager dataManager, |
||
336 | DataStoreParameters parameters) throws InitializeException {
|
||
337 | DynObjectManager dynManager = ToolsLocator.getDynObjectManager(); |
||
338 | |||
339 | this.dynobj = (DelegatedDynObject) dynManager
|
||
340 | 4181 | fdiaz | .createDynObject( |
341 | 2443 | nbrodin | MetadataLocator.getMetadataManager().getDefinition(DataStore.SPATIAL_METADATA_DEFINITION_NAME) |
342 | ); |
||
343 | this.dataManager = dataManager;
|
||
344 | this.parameters = parameters;
|
||
345 | |||
346 | } |
||
347 | |||
348 | public void intializePhase2(DataStoreProvider provider) |
||
349 | throws InitializeException {
|
||
350 | setProvider((RasterProvider)provider); |
||
351 | } |
||
352 | 4181 | fdiaz | |
353 | 2443 | nbrodin | public DataManager getManager() {
|
354 | return this.dataManager; |
||
355 | 4181 | fdiaz | } |
356 | 2443 | nbrodin | |
357 | //****************************************************
|
||
358 | //*********Implementing DataStore methods*************
|
||
359 | //****************************************************
|
||
360 | |||
361 | public String getProviderName() { |
||
362 | return getProvider().getFullName();
|
||
363 | } |
||
364 | 4181 | fdiaz | |
365 | 2443 | nbrodin | public void refresh() throws DataException { |
366 | return;
|
||
367 | } |
||
368 | |||
369 | public DataSet getDataSet() throws DataException { |
||
370 | RasterQuery query = DefaultRasterManager.getInstance().createQuery(); |
||
371 | query.setSupersamplingOption(false);
|
||
372 | query.setAreaOfInterest(); |
||
373 | int[] bands = new int[getBandCount()]; |
||
374 | for (int i = 0; i < bands.length; i++) { |
||
375 | bands[i] = i; |
||
376 | } |
||
377 | query.setDrawableBands(bands); |
||
378 | return getDataSet(query);
|
||
379 | } |
||
380 | |||
381 | public DataSet getDataSet(DataQuery dataQuery) throws DataException { |
||
382 | if(dataQuery instanceof RasterQuery) { |
||
383 | Object[] obj = null; |
||
384 | try {
|
||
385 | obj = queryArray((RasterQuery)dataQuery); |
||
386 | } catch (ProcessInterruptedException e) {
|
||
387 | throw new RasterDriverException("", e); |
||
388 | } catch (QueryException e) {
|
||
389 | throw new RasterDriverException(e.getMessage(), e); |
||
390 | } |
||
391 | if(obj != null && obj.length > 0 && obj[0] instanceof Buffer) |
||
392 | return (Buffer)obj[0]; |
||
393 | } |
||
394 | return null; |
||
395 | } |
||
396 | |||
397 | public void accept(Visitor visitor, DataQuery dataQuery) |
||
398 | throws BaseException {
|
||
399 | } |
||
400 | |||
401 | public void getDataSet(org.gvsig.tools.observer.Observer observer) throws DataException { |
||
402 | RasterQuery query = DefaultRasterManager.getInstance().createQuery(); |
||
403 | query.setSupersamplingOption(false);
|
||
404 | query.setAreaOfInterest(); |
||
405 | int[] bands = new int[getBandCount()]; |
||
406 | for (int i = 0; i < bands.length; i++) { |
||
407 | bands[i] = i; |
||
408 | } |
||
409 | query.setDrawableBands(bands); |
||
410 | getDataSet(query, observer); |
||
411 | } |
||
412 | |||
413 | public void getDataSet(DataQuery dataQuery, org.gvsig.tools.observer.Observer observer) throws DataException { |
||
414 | if(dataQuery instanceof RasterQuery) { |
||
415 | Object[] obj = null; |
||
416 | try {
|
||
417 | obj = queryArray((RasterQuery)dataQuery); |
||
418 | } catch (ProcessInterruptedException e) {
|
||
419 | } catch (QueryException e) {
|
||
420 | throw new RasterDriverException(e.getMessage(), e); |
||
421 | } |
||
422 | if(obj != null && obj.length > 0 && obj[0] instanceof Buffer) |
||
423 | observer.update(this, obj[0]); |
||
424 | } |
||
425 | } |
||
426 | |||
427 | public DataSet getSelection() throws DataException { |
||
428 | return null; |
||
429 | } |
||
430 | |||
431 | public void setSelection(DataSet selection) throws DataException { |
||
432 | } |
||
433 | |||
434 | public DataSet createSelection() throws DataException { |
||
435 | return null; |
||
436 | } |
||
437 | |||
438 | public Iterator<?> getChildren() { |
||
439 | return null; |
||
440 | } |
||
441 | |||
442 | public DataServerExplorer getExplorer() throws DataException, ValidateDataParametersException { |
||
443 | return explorer;
|
||
444 | } |
||
445 | 4181 | fdiaz | |
446 | 2443 | nbrodin | /**
|
447 | * Sets the explorer
|
||
448 | * @param explorer
|
||
449 | */
|
||
450 | public void setExplorer(RasterDataServerExplorer explorer) { |
||
451 | this.explorer = explorer;
|
||
452 | } |
||
453 | 4181 | fdiaz | |
454 | 2443 | nbrodin | public DataQuery createQuery() {
|
455 | return new DefaultRasterQuery(); |
||
456 | } |
||
457 | 4181 | fdiaz | |
458 | 2443 | nbrodin | //****************************************************
|
459 | //*********Implementing Metadata methods*************
|
||
460 | //****************************************************
|
||
461 | 4181 | fdiaz | |
462 | 2443 | nbrodin | public Object getMetadataID() { |
463 | if(parameters != null && parameters instanceof RasterFileStoreParameters) |
||
464 | return ((RasterFileStoreParameters)parameters).getFile();
|
||
465 | if(parameters != null && parameters instanceof RasterDataParameters) |
||
466 | return ((RasterDataParameters)parameters).getURI();
|
||
467 | return null; |
||
468 | } |
||
469 | |||
470 | public Set<?> getMetadataChildren() { |
||
471 | return null; |
||
472 | } |
||
473 | 4181 | fdiaz | |
474 | 2443 | nbrodin | //****************************************************
|
475 | //*********Implementing Disposable methods************
|
||
476 | //****************************************************
|
||
477 | 4181 | fdiaz | |
478 | 2443 | nbrodin | public void doDispose() { |
479 | 4181 | fdiaz | |
480 | 2443 | nbrodin | } |
481 | 4181 | fdiaz | |
482 | 2443 | nbrodin | //****************************************************
|
483 | //*********Implementing Visitable methods*************
|
||
484 | //****************************************************
|
||
485 | 4181 | fdiaz | |
486 | 2443 | nbrodin | public void accept(Visitor visitor) throws BaseException { |
487 | 4181 | fdiaz | |
488 | 2443 | nbrodin | } |
489 | 4181 | fdiaz | |
490 | 2443 | nbrodin | //****************************************************
|
491 | //****Implementing ComplexObservable methods**********
|
||
492 | //****************************************************
|
||
493 | 4181 | fdiaz | |
494 | 2443 | nbrodin | public void disableNotifications() { |
495 | 4181 | fdiaz | |
496 | 2443 | nbrodin | } |
497 | |||
498 | public void enableNotifications() { |
||
499 | 4181 | fdiaz | |
500 | 2443 | nbrodin | } |
501 | |||
502 | public void beginComplexNotification() { |
||
503 | 4181 | fdiaz | |
504 | 2443 | nbrodin | } |
505 | |||
506 | public void endComplexNotification() { |
||
507 | 4181 | fdiaz | |
508 | 2443 | nbrodin | } |
509 | 4181 | fdiaz | |
510 | 2443 | nbrodin | //****************************************************
|
511 | //********Implementing Observable methods*************
|
||
512 | //****************************************************
|
||
513 | 4181 | fdiaz | |
514 | 2443 | nbrodin | public void addObserver(org.gvsig.tools.observer.Observer o) { |
515 | 4181 | fdiaz | |
516 | 2443 | nbrodin | } |
517 | |||
518 | public void deleteObserver(org.gvsig.tools.observer.Observer o) { |
||
519 | 4181 | fdiaz | |
520 | 2443 | nbrodin | } |
521 | |||
522 | public void deleteObservers() { |
||
523 | 4181 | fdiaz | |
524 | 2443 | nbrodin | } |
525 | 4181 | fdiaz | |
526 | 2443 | nbrodin | //****************************************************
|
527 | //********Implementing DynObject methods*************
|
||
528 | //****************************************************
|
||
529 | 4181 | fdiaz | |
530 | 2443 | nbrodin | public DynClass getDynClass() {
|
531 | return this.dynobj.getDynClass(); |
||
532 | } |
||
533 | |||
534 | public void implement(DynClass dynClass) { |
||
535 | this.dynobj.implement(dynClass);
|
||
536 | } |
||
537 | |||
538 | public void delegate(DynObject dynObject) { |
||
539 | this.dynobj.delegate(dynObject);
|
||
540 | } |
||
541 | |||
542 | public Object getDynValue(String name) throws DynFieldNotFoundException { |
||
543 | return this.dynobj.getDynValue(name); |
||
544 | } |
||
545 | |||
546 | public void setDynValue(String name, Object value) throws DynFieldNotFoundException { |
||
547 | this.dynobj.setDynValue(name, value);
|
||
548 | } |
||
549 | |||
550 | public boolean hasDynValue(String name) { |
||
551 | return this.dynobj.hasDynValue(name); |
||
552 | } |
||
553 | |||
554 | public Object invokeDynMethod(String name, DynObject context) throws DynMethodException { |
||
555 | return this.dynobj.invokeDynMethod(this, name, context); |
||
556 | } |
||
557 | |||
558 | public Object invokeDynMethod(int code, DynObject context) throws DynMethodException { |
||
559 | return this.dynobj.invokeDynMethod(this, code, context); |
||
560 | } |
||
561 | |||
562 | public void clear() { |
||
563 | if (dynobj != null) { |
||
564 | dynobj.clear(); |
||
565 | } |
||
566 | } |
||
567 | 4181 | fdiaz | |
568 | 2443 | nbrodin | public DataStoreParameters getParameters() {
|
569 | return parameters;
|
||
570 | } |
||
571 | 4181 | fdiaz | |
572 | 2443 | nbrodin | //***********************************************************************
|
573 | //********Implementing CoverageStoreProviderServices methods*************
|
||
574 | //***********************************************************************
|
||
575 | |||
576 | public CoverageSelection createDefaultCoverageSelection()
|
||
577 | throws DataException {
|
||
578 | return null; |
||
579 | } |
||
580 | |||
581 | public CoverageStore getCoverageStore() {
|
||
582 | return this; |
||
583 | } |
||
584 | |||
585 | public abstract CoverageStoreProvider getProvider(); |
||
586 | |||
587 | public void notifyChange(String notification) { |
||
588 | delegateObservable |
||
589 | .notifyObservers(new DefaultCoverageStoreNotification(
|
||
590 | this, notification));
|
||
591 | } |
||
592 | |||
593 | public void notifyChange(String arg0, Resource arg1) { |
||
594 | /*delegateObservable.notifyObservers(new DefaultFeatureStoreNotification(
|
||
595 | this, FeatureStoreNotification.RESOURCE_CHANGED));*/
|
||
596 | } |
||
597 | |||
598 | public void notifyChange(String notification, Command command) { |
||
599 | delegateObservable |
||
600 | .notifyObservers(new DefaultCoverageStoreNotification(
|
||
601 | this, notification, command));
|
||
602 | } |
||
603 | |||
604 | public DataStore getStore() {
|
||
605 | return this; |
||
606 | } |
||
607 | 5462 | llmarques | |
608 | 2443 | nbrodin | public void close() { |
609 | if(lastBuffer != null) { |
||
610 | lastBuffer.dispose(); |
||
611 | } |
||
612 | } |
||
613 | 4181 | fdiaz | |
614 | 2443 | nbrodin | protected void finalize() throws Throwable { |
615 | currentQuery = null;
|
||
616 | if(palette != null) { |
||
617 | for (int i = 0; i < palette.length; i++) { |
||
618 | palette[i] = null;
|
||
619 | } |
||
620 | palette = null;
|
||
621 | } |
||
622 | lastBuffer = null;
|
||
623 | dataManager = null;
|
||
624 | parameters = null;
|
||
625 | metadata = null;
|
||
626 | delegateObservable = null;
|
||
627 | render = null;
|
||
628 | super.finalize();
|
||
629 | } |
||
630 | } |