Revision 4181 org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.api/src/main/java/org/gvsig/fmap/dal/coverage/store/RasterDataStore.java

View differences:

RasterDataStore.java
24 24
import java.awt.geom.AffineTransform;
25 25
import java.awt.geom.Point2D;
26 26
import java.io.File;
27
import java.net.URI;
27 28
import java.util.List;
28 29

  
29 30
import org.cresques.cts.ICoordTrans;
30 31
import org.cresques.cts.IProjection;
32

  
31 33
import org.gvsig.compat.net.ICancellable;
32 34
import org.gvsig.fmap.dal.DataStore;
33 35
import org.gvsig.fmap.dal.DataStoreParameters;
......
61 63

  
62 64
/**
63 65
 * Interfaz que deben implementar los almacenes de datos raster.
64
 * 
66
 *
65 67
 * @author Nacho Brodin (nachobrodin@gmail.com)
66 68
 */
67
public interface RasterDataStore extends DataStore, TRasterStore, 
69
public interface RasterDataStore extends DataStore, TRasterStore,
68 70
	PyramidRasterStore, RasterStoreProperties, Histogramable {
69 71
	public static final int              RED_BAND            = 0x01;
70 72
	public static final int              GREEN_BAND          = 0x02;
71 73
	public static final int              BLUE_BAND           = 0x04;
72 74
	public static final int              ALPHA_BAND          = 0x08;
73
	
75

  
74 76
	/**
75 77
	* Tipos de raster dependiendo de su fuente
76 78
	*/
......
78 80
	public static final int              POSTGIS             = 1;
79 81
	public static final int              REMOTE              = 2;
80 82
	public static final int              MOSAIC              = 3;
81
	
83

  
82 84
	/**
83 85
	 * Actions to reload the information of a layer such as, read rmf or
84
	 * tfw files 
86
	 * tfw files
85 87
	 */
86 88
	public void reload();
87
	
89

  
88 90
	/**
89 91
	 * Gets a default band list for this provider
90 92
	 * @return
91 93
	 */
92 94
	public BandList getDefaultBandList();
93
	
95

  
94 96
	/**
95 97
	 * Gets a list of data parameters. If it doesn't have
96 98
	 * internal providers this method will return only one DataParameter
97 99
	 * @return
98 100
	 */
99 101
	public RasterDataParameters[] getDataParametersByProvider();
100
	
102

  
101 103
	/**
102 104
	 * Gets a list of sizes. If the provider doesn't have files it will return null.
103 105
	 * If the provider has one file it will return an array of one element with the
......
105 107
	 * @return
106 108
	 */
107 109
	public long[] getFileSizeByProvider();
108
	
110

  
109 111
	/**
110
	 * Gets a list of file names or URI. Each element of this array is the name of a 
111
	 * provider 
112
	 * Gets a list of file names or URI. Each element of this array is the name of a
113
	 * provider
112 114
	 * @return
113 115
	 */
114
	public String[] getURIByProvider();
115
	
116
	public URI[] getURIByProvider();
117

  
116 118
	/**
117
	 * Gets the number of bands by provider. 
119
	 * Gets the number of bands by provider.
118 120
	 * @return
119 121
	 */
120 122
	public int[] getBandCountByProvider();
121
	
123

  
122 124
	/**
123
	 * Gets a list of Metadata 
125
	 * Gets a list of Metadata
124 126
	 * @return
125 127
	 */
126 128
	public Metadata[] getMetadataByProvider();
127
	
129

  
128 130
	/**
129 131
	 * Gets the number of overviews by provider
130 132
	 * @param number of band
131 133
	 * @return
132 134
	 */
133 135
	public int[] getOverviewCountByProvider(int band) throws BandAccessException;
134
	
136

  
135 137
	/**
136 138
	 * Gets the size of a overview in one band. The result is a list of strings (WidthXHeight)
137
	 * 
139
	 *
138 140
	 * @param band
139 141
	 * @return
140 142
	 */
141 143
	public String[] getOverviewSizeByProvider(int band, int overview) throws BandAccessException;
142
	
144

  
143 145
	/**
144 146
	 * Gets a list of affine transforms
145 147
	 * @return
146 148
	 */
147 149
	public AffineTransform[] getAffineTransformByProvider();
148
	
150

  
149 151
	/**
150 152
	 * Gets the height by provider
151 153
	 * @return
152 154
	 */
153 155
	public double[] getHeightByProvider();
154
	
156

  
155 157
	/**
156 158
	 * Gets the width by provider
157 159
	 * @return
158 160
	 */
159 161
	public double[] getWidthByProvider();
160
	
162

  
161 163
	/**
162 164
	 * Gets the URI of the source. If the provider has only one band
163 165
	 * the result will be the URI. If it is multifile will have to choose
......
165 167
	 * @param band
166 168
	 * @return
167 169
	 */
168
	public String getURIByBand(int band);
169
	
170
	public URI getURIByBand(int band);
171

  
170 172
	/**
171 173
	 * Returns the number of internal providers that it has
172 174
	 * @return
173 175
	 */
174 176
	public int getProviderCount();
175
	
177

  
176 178
	/**
177
	 * Adds a new file. The behavior of this function depends on 
179
	 * Adds a new file. The behavior of this function depends on
178 180
	 * the kind of provider and its implementation.
179 181
	 * @param file
180
	 * @throws InvalidSourceException 
182
	 * @throws InvalidSourceException
181 183
	 */
182
	public void addFile(String file) throws InvalidSourceException;
183
	
184
	public void addFile(File file) throws InvalidSourceException;
185

  
184 186
	/**
185
	 * Removes a file. The behavior of this function depends on 
187
	 * Removes a file. The behavior of this function depends on
186 188
	 * the kind of provider and its implementation.
187 189
	 * @param file
188 190
	 */
189
	public void removeFile(String file);
191
	public void removeFile(File file);
190 192

  
191 193
	/**
192 194
	 * Define el valor NoData asociado al raster.
193 195
	 * @return
194 196
	 */
195 197
	public void setNoDataValue(NoData value);
196
	
198

  
197 199
	/**
198 200
	 * Obtiene el extent asignado
199 201
	 * @return	Extent
200 202
	 */
201 203
	public Extent getView();
202
	
204

  
203 205
	/**
204 206
	 * Creates a new dataset which has the same source reference
205 207
	 * @return RasterDataStore
206 208
	 */
207 209
	public RasterDataStore newDataStore();
208
	
210

  
209 211
	/**
210 212
	 * Creates a new dataset which has the same source reference but insure
211 213
	 * that the provider will be not tiled. Most of processes has to be applied
212
	 * over not tiled providers 
214
	 * over not tiled providers
213 215
	 * @return RasterDataStore
214 216
	 */
215 217
	public RasterDataStore newNotTiledDataStore();
216
	
218

  
217 219
	/**
218
	 * Obtiene el Tama?o de cada fichero de que consta el raster en bytes. 
220
	 * Obtiene el Tama?o de cada fichero de que consta el raster en bytes.
219 221
	 * @return long que representa el tama?o
220 222
	 */
221 223
	public long getFileSize();
222
	
224

  
223 225
	/**
224 226
	 * Convierte un punto desde coordenadas pixel a coordenadas del mundo.
225 227
	 * @param pt Punto a transformar
226 228
	 * @return punto transformado en coordenadas del mundo
227 229
	 */
228 230
	public Point2D rasterToWorld(Point2D pt);
229
	
231

  
230 232
	/**
231 233
	 * Convierte un punto desde del mundo a coordenadas pixel.
232 234
	 * @param pt Punto a transformar
233 235
	 * @return punto transformado en coordenadas pixel
234 236
	 */
235 237
	public Point2D worldToRaster(Point2D pt);
236
	
238

  
237 239
	/**
238
	 * Metodo que obtiene si un punto cae dentro de los l?mites de la extensi?n de la fuente de 
240
	 * Metodo que obtiene si un punto cae dentro de los l?mites de la extensi?n de la fuente de
239 241
	 * datos raster o fuera de ellos.
240 242
	 * @param p Punto a calcular
241 243
	 * @return true si est? dentro de los l?mites y false si est? fuera
242 244
	 */
243 245
	public boolean isInside(Point2D p);
244
	
246

  
245 247
	/**
246 248
	 * Returns true if the data source is tiled
247 249
	 * @return
248 250
	 */
249 251
	public boolean isTiled();
250
	
252

  
251 253
	/**
252 254
	 * Returns true if the provider has several files and all of them has the same extension
253 255
	 * @return
254 256
	 */
255 257
	public boolean isMultiFile();
256
	
258

  
257 259
	/**
258 260
	 * Returns true if the source of data is a mosaic of images
259 261
	 * @return
260 262
	 */
261 263
	public boolean isMosaic();
262
	
264

  
263 265
	/**
264 266
	 * Obtiene la matriz de transformaci?n del propio raster. Esta matriz es la
265 267
	 * encargada de convertir las coordenadas de la petici?n en coordenadas a las
......
272 274
	 * @return
273 275
	 */
274 276
	public AffineTransform getOwnAffineTransform();
275
	
277

  
276 278
	/**
277 279
	 * Obtiene la transformaci?n afin aplicada en las peticiones con coordenadas
278 280
	 * reales. Esta corresponde al producto matricial entre la transformaci?n de
......
282 284
	 * @return Matriz de la transformaci?n af?n.
283 285
	 */
284 286
	public AffineTransform getAffineTransform();
285
	
287

  
286 288
	/**
287 289
	 * Asigna una transformaci?n al raster para que se tenga en cuenta en la
288 290
	 * asignaci?n del setView. Esta asignaci?n recalcula el extent, el
......
292 294
	 * @param t Transformaci?n af?n a aplicar
293 295
	 */
294 296
	public void setAffineTransform(AffineTransform transf);
295
	
297

  
296 298
	/**
297 299
	 * Gets an object which vectorize a raster
298 300
	 * @return
299 301
	 * @throws RasterDriverException
300 302
	 * @throws ProcessInterruptedException
301
	 *         When the object Vectorization is built the raster data buffer is loaded. 
303
	 *         When the object Vectorization is built the raster data buffer is loaded.
302 304
	 *         This operation can be interrupted
303 305
	 */
304 306
	public Vectorization createVectorizeObject() throws QueryException, ProcessInterruptedException;
305
	
307

  
306 308
	/**
307 309
	 * Builds an render object using this RasterDataStore
308 310
	 * @return Render
309 311
	 */
310 312
	public Render getRender();
311
	
313

  
312 314
	/**
313 315
	 * Assigns a render object
314 316
	 * @param render
315 317
	 */
316 318
	public void setRender(Render render);
317
	
319

  
318 320
	/**
319 321
	 * Saves georeferencing information in the rmf file
320 322
	 * @throws RmfSerializerException
321 323
	 */
322 324
	public void saveGeoreferencingToRmf() throws RmfSerializerException;
323
	
325

  
324 326
	/**
325 327
	 * Saves a color table
326 328
	 * @param table
327 329
	 * @throws RmfSerializerException
328 330
	 */
329 331
	public void saveColorTableToRmf(ColorTable table) throws RmfSerializerException;
330
	
332

  
331 333
	/**
332 334
	 * Saves the geo point list to a RMF file
333 335
	 * @param pointList
334 336
	 * @throws RmfSerializerException
335 337
	 */
336 338
	public void saveGeoPointListToRmf(GeoPointList pointList) throws RmfSerializerException;
337
	
339

  
338 340
	/**
339 341
	 * Saves a list of files in the RMF file
340 342
	 * @param fileList
341 343
	 * @throws RmfSerializerException
342 344
	 */
343 345
	public void saveROIFileListToRmf(List<File> fileList) throws RmfSerializerException;
344
	
346

  
345 347
	/**
346 348
	 * Gets the list of ROI files in the RMF
347 349
	 * @return
348 350
	 * @throws RmfSerializerException
349 351
	 */
350 352
	public List<File> getROIFileListFromRmf();
351
	
353

  
352 354
	/**
353 355
	 * Tipo de fichero soportado.
354 356
	 * Devuelve true si el tipo de fichero (extension) est? soportado, si no
......
358 360
	 * @return  true si est? soportado, si no false.
359 361
		*/
360 362
	public boolean isFileSupported(String fName);
361
	
363

  
362 364
	/**
363 365
	 * Returns true if this DataStore is open and false if not
364 366
	 * @return
365 367
	 */
366 368
	public boolean isOpen();
367
	
369

  
368 370
	/**
369 371
	 * Obtiene el flag que dice si el raster est? o no georreferenciado
370 372
	 * @return true si est? georreferenciado y false si no lo est?.
371 373
	 */
372 374
	public boolean isGeoreferenced();
373
	
375

  
374 376
	/**
375 377
	 * Returns true if this data store is reproyectable or false if not
376 378
	 * @return
377 379
	 */
378 380
	public boolean isReproyectable();
379
	
381

  
380 382
	/**
381 383
	 * Consulta de si un raster tiene rotaci?n o no.
382 384
	 * @return true si tiene rotaci?n y false si no la tiene.
383 385
	 */
384 386
	public boolean isRotated();
385
	
387

  
386 388
	/**
387 389
	 * Obtiene el n?mero de overviews de una banda
388 390
	 * @return N?mero de overviews del raster.
389 391
	 */
390 392
	public int getOverviewCount(int band) throws BandAccessException, RasterDriverException;
391
	
393

  
392 394
	/**
393 395
	 * Informa de si el dataset soporta overviews o no.
394 396
	 * @return true si soporta overviews y false si no las soporta.
395 397
	 */
396 398
	public boolean overviewsSupport();
397
	
399

  
398 400
	/**
399 401
	 * Obtiene el ancho de una overview de una banda
400 402
	 * @return
......
412 414
	 * @return
413 415
	 */
414 416
	public BandList getBands();
415
		
417

  
416 418
	/**
417 419
	 * Clones this object
418 420
	 * @return RasterDataStore
419
	 * @throws CloneException 
421
	 * @throws CloneException
420 422
	 */
421 423
	public RasterDataStore cloneDataStore() throws CloneException;
422
	
424

  
423 425
	/**
424 426
	 * Gets a provider
425 427
	 * @return
426 428
	 */
427 429
	public CoverageStoreProvider getProvider();
428
	
430

  
429 431
	/**
430 432
	 * Sets a provider
431 433
	 * @return
432 434
	 */
433 435
	public void setProvider(CoverageStoreProvider prov);
434
	
436

  
435 437
	/**
436 438
	 * Deletes the cache of this layer composed by the files in the provider list
437 439
	 */
438 440
	public void deleteLayerFromCache();
439
	
441

  
440 442
	/**
441 443
	 * Sets the parameters
442 444
	 * @param p
443 445
	 */
444 446
	public void setParameters(DataStoreParameters p);
445
	
447

  
446 448
	/**
447 449
	 * Returns the source type (FILE, POSTGIS, REMOTE,...)
448 450
	 * @return
449 451
	 */
450 452
	public int getSourceType();
451
	
453

  
452 454
	/**
453 455
	 * This method will return the DataParameters if it has a simple provider behind. If it has
454
	 * a TileProvider this method will return the DataParameters used by the TileProvider.  
456
	 * a TileProvider this method will return the DataParameters used by the TileProvider.
455 457
	 * @return
456 458
	 */
457 459
	public RasterDataParameters getInternalParameters();
458
	
460

  
459 461
	/**
460 462
     * Sets the explorer
461 463
     * @param explorer
462 464
     */
463 465
    public void setExplorer(RasterDataServerExplorer explorer);
464
    
466

  
465 467
	/**
466 468
	 * Closes this data store
467 469
	 * @throws CloseException
468 470
	 */
469 471
	public void close() throws CloseException;
470
	
471
	
472

  
473

  
472 474
	//******************************************
473 475
	//***********Query methods******************
474
	
476

  
475 477
	/**
476 478
	 * Returns the last buffer loaded if the flag storeLastBuffer in the query is true
477 479
	 * @return
478 480
	 */
479 481
	public Buffer getLastBuffer();
480
	
482

  
481 483
	/**
482
	 * Gets a pixel 
484
	 * Gets a pixel
483 485
	 * @param x
484 486
	 * @param y
485 487
	 * @param band
......
489 491
	 * @throws RasterDriverException
490 492
	 */
491 493
	public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException;
492
	
494

  
493 495
	/**
494 496
	 * Makes a request to load a buffer of data. This call returns an array of results. The first
495
	 * element in the array is the buffer and the other elements are the transparency buffer, 
497
	 * element in the array is the buffer and the other elements are the transparency buffer,
496 498
	 * the legend and so on. This funtion is mainly used by the getTile call. This array contains
497
	 * all visualization properties. 
498
	 * @param query 
499
	 * all visualization properties.
500
	 * @param query
499 501
	 * @return Object[]
500 502
	 */
501 503
	public Object[] queryArray(RasterQuery query) throws ProcessInterruptedException, QueryException;
502
	
504

  
503 505
	/**
504 506
	 * Makes a request to load a buffer of data. This call returns only a buffer. This call is used
505 507
	 * by most functions because the properties are read from the datastore.
506
	 * @param query 
508
	 * @param query
507 509
	 * @return Buffer
508 510
	 */
509 511
	public Buffer query(RasterQuery query) throws ProcessInterruptedException, QueryException;
510
	
512

  
511 513
	/**
512 514
	 * Sets a tile server to create a second level of cache. This second level will be
513 515
	 * created if the cache structure is different to the current.
514 516
	 * @param tileServer
515 517
	 */
516 518
	public void setTileServer(Class<?> tileServer) throws InitializeException;
517
	
519

  
518 520
	/**
519
	 * Some sevices has neither limits nor pixel size. For instance, WebMapService 
521
	 * Some sevices has neither limits nor pixel size. For instance, WebMapService
520 522
	 * is a service of this type if the size is not fixed. Other services, like
521 523
	 * WMTS are enclosed too but in this case it will have resolution by level.
522 524
	 * This method returns true if the data source is enclosed.
523 525
	 * @return
524 526
	 */
525 527
	public boolean isRasterEnclosed();
526
	
528

  
527 529
	/**
528 530
	 * This function returns true if the image to be loaded needs a enhanced filter or
529 531
	 * doesn't. It depends on the format, number of bands, type of data and so on.
530 532
	 * @return The default value is false but each driver can change this value.
531 533
	 */
532 534
	public boolean needEnhanced();
533
	
535

  
534 536
	/**
535 537
	 * Sets the transformation
536 538
	 * @param t
537 539
	 */
538 540
	public void setCoordTrans(ICoordTrans t);
539
	
541

  
540 542
	/**
541 543
	 * Gets the information in a real point
542 544
	 * @param x
......
546 548
	 * @return
547 549
	 */
548 550
	public String getInfoByPoint(double x, double y, ICancellable cancellable) throws InfoByPointException;
549
	
551

  
550 552
	/**
551
	 * Gets the information in a pixel point. Some services need additional 
552
	 * information as the window where the request is done 
553
	 * Gets the information in a pixel point. Some services need additional
554
	 * information as the window where the request is done
553 555
	 * @param x
554 556
	 *        X Pixel position
555 557
	 * @param y
......
565 567
	 * @throws RemoteServiceException
566 568
	 */
567 569
	public String getInfoByPoint(double x, double y, Extent extent, int w, int h, ICancellable cancellable) throws InfoByPointException;
568
	
570

  
569 571
	/**
570 572
	 * Gets the list of geo points associated to this provider
571 573
	 * @return
572 574
	 */
573 575
	public GeoPointList getGeoPointList();
574
	
576

  
575 577
	/**
576 578
	 * Sets the list of geo points associated to this provider
577 579
	 */
578 580
	public void setGeoPointList(GeoPointList geoPointList);
579
	
581

  
580 582
	/**
581 583
	 * Gets the list of regions of interest
582 584
	 * @param defaultProjection
......
584 586
	 * @throws ROIException
585 587
	 */
586 588
	public List<ROI> getRois(IProjection defaultProjection) throws ROIException;
587
	
589

  
588 590
	/**
589 591
	 * Gets the list of regions of interest
590 592
	 * @param defaultProjection
......
592 594
	 * @throws ROIException
593 595
	 */
594 596
	public List<ROI> getRois(String epsg) throws ROIException;
595
	
597

  
596 598
	/**
597 599
	 * Sets the list of regions of interest
598 600
	 * @param rois
599 601
	 */
600 602
	public void setRois(List<ROI> rois);
601
	
603

  
602 604
}

Also available in: Unified diff