Revision 4181 org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/provider/RasterProvider.java

View differences:

RasterProvider.java
24 24
import java.awt.Image;
25 25
import java.awt.geom.AffineTransform;
26 26
import java.awt.geom.Point2D;
27
import java.io.File;
28
import java.net.URI;
27 29

  
28 30
import org.cresques.cts.IProjection;
31

  
29 32
import org.gvsig.compat.net.ICancellable;
30 33
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
31 34
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
......
57 60
/**
58 61
 * This interface have to be implemented by a raster data source. Is used by a store to
59 62
 * provide services from a specific source.
60
 * 
63
 *
61 64
 * @author Nacho Brodin (nachobrodin@gmail.com)
62 65
 *
63 66
 */
64 67
public interface RasterProvider extends CoverageStoreProvider, Histogramable {
65
	
68

  
66 69
	public void reload();
67
	
70

  
68 71
	/**
69 72
	 * Gets a list of sizes. If the provider doesn't have files it will return null.
70 73
	 * If the provider has one file it will return an array of one element with the
......
72 75
	 * @return
73 76
	 */
74 77
	public long[] getFileSizeByProvider();
75
	
78

  
76 79
	/**
77
	 * Gets a list of file names or URI. Each element of this array is the name of a 
78
	 * provider 
80
	 * Gets a list of file names or URI. Each element of this array is the name of a
81
	 * provider
79 82
	 * @return
80 83
	 */
81
	public String[] getURIByProvider();
82
	
84
	public URI[] getURIByProvider();
85

  
83 86
	/**
84 87
	 * Gets the URI of the first provider.
85
	 * @return String 
88
	 * @return String
86 89
	 *         File name or URI
87 90
	 */
88
	public String getURIOfFirstProvider();
89
	
91
	public URI getURIOfFirstProvider();
92

  
90 93
	/**
91
	 * Gets the number of bands by provider. 
94
	 * Gets the number of bands by provider.
92 95
	 * @return
93 96
	 */
94 97
	public int[] getBandCountByProvider();
95
	
98

  
96 99
	/**
97 100
	 * Selecting a number of band this function returns the number of band
98 101
	 * inside the file. If this provider has only one file the result
......
101 104
	 * @return
102 105
	 */
103 106
	public int getBandPositionByProvider(int band);
104
	
107

  
105 108
	/**
106 109
	 * Returns the number of internal providers that it has
107 110
	 * @return
108 111
	 */
109 112
	public int getInternalProviderCount();
110
	
113

  
111 114
	/**
112 115
	 * Gets the internal provider of the i position
113 116
	 * @param i
114 117
	 * @return
115 118
	 */
116 119
	public RasterProvider getInternalProvider(int i);
117
	
120

  
118 121
	/**
119 122
	 * Gets the URI of the source. If the provider has only one band
120 123
	 * the result will be the URI. If it is multifile will have to choose
......
122 125
	 * @param band
123 126
	 * @return
124 127
	 */
125
	public String getURIByBand(int band);
126
	
128
	public URI getURIByBand(int band);
129

  
127 130
	/**
128 131
	 * Gets the uniform resource identifier
129 132
	 * @return
130 133
	 */
131
	public String getURI();
132
	
134
	public URI getURI();
135

  
133 136
	/**
134 137
	 * Gets the number of subdatasets
135 138
	 * @return
136 139
	 */
137 140
	public int getSubdatasetCount();
138
	
141

  
139 142
	/**
140
	 * Adds a new file. The behavior of this function depends on 
143
	 * Adds a new file. The behavior of this function depends on
141 144
	 * the kind of provider and its implementation.
142 145
	 * @param file
143
	 * @throws InvalidSourceException 
146
	 * @throws InvalidSourceException
144 147
	 */
145
	public void addFile(String file) throws InvalidSourceException;
146
	
148
	public void addFile(File file) throws InvalidSourceException;
149

  
147 150
	/**
148
	 * Removes a file. The behavior of this function depends on 
151
	 * Removes a file. The behavior of this function depends on
149 152
	 * the kind of provider and its implementation.
150 153
	 * @param file
151 154
	 */
152
	public void removeFile(String file);
153
	
155
	public void removeFile(File file);
156

  
154 157
	/**
155 158
	 * Obtiene el n?mero de bandas del raster
156 159
	 * @return N?mero de bandas
157 160
	 */
158 161
	public int getBandCount();
159
	
162

  
160 163
	/**
161 164
	 * Obtiene el tipo de dato por banda
162 165
	 * @return tipo de dato por banda
163 166
	 */
164 167
	public int[] getDataType();
165
	
168

  
166 169
	/**
167 170
	 * Obtiene la altura del raster en p?xeles.
168 171
	 * @return altura
......
174 177
	 * @return anchura
175 178
	 */
176 179
	public double getWidth();
177
	
180

  
178 181
	/**
179 182
	 * Devuelve si el Dataset es reproyectable
180 183
	 * @return
181 184
	 */
182 185
	public boolean isReproyectable();
183
	
186

  
184 187
	/**
185 188
	 * Returns true if this raster has rotation and false if don't
186 189
	 */
187 190
	public boolean isRotated();
188
	
191

  
189 192
	/**
190 193
	 * Returns true if this provider is open and false if don't
191 194
	 * @return
192 195
	 */
193 196
	public boolean isOpen();
194
	
197

  
195 198
	/**
196 199
	 * Returns true if this provider supports time.
197 200
	 * @return
198 201
	 */
199 202
	public boolean isTimeSupported();
200
	
203

  
201 204
	/**
202 205
	 * Returns true if the provider support tiles
203 206
	 * @return
204 207
	 */
205 208
	public boolean isTiled();
206
	
209

  
207 210
	/**
208 211
	 * Informa de si el dataset soporta overviews o no.
209 212
	 * @return true si soporta overviews y false si no las soporta.
210 213
	 */
211 214
	public boolean isOverviewsSupported();
212
	
215

  
213 216
	/**
214 217
	 * Obtiene el n?mero de overviews de una banda
215 218
	 * @return
......
228 231
	 */
229 232
	public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException;
230 233

  
231
	
234

  
232 235
	/**
233 236
	 * Informa de si el punto en coordenadas del mundo real pasado por par?metro cae dentro del
234 237
	 * raster o fuera. Para este calculo cogeremos el punto a averiguar si est? dentro del raster
......
238 241
	 * @return true si el punto est? dentro y false si est? fuera.
239 242
	 */
240 243
	public boolean isInside(Point2D p);
241
	
244

  
242 245
	/**
243 246
	 * Gets the nodata value.
244 247
	 * @return
245 248
	 */
246 249
	public NoData getNoDataValue();
247
	
250

  
248 251
	/**
249 252
	 * Gets statistics of this provider
250 253
	 * @return MultiFileStatistics
251 254
	 */
252 255
	public Statistics getStatistics();
253
	
256

  
254 257
	/**
255
	 * Sets the statistics of this provider. Be careful using this method. 
256
	 * Statistics shouldn't be assigned unless you had cloned this provider. 
257
	 * @throws RmfSerializerException 
258
	 * Sets the statistics of this provider. Be careful using this method.
259
	 * Statistics shouldn't be assigned unless you had cloned this provider.
260
	 * @throws RmfSerializerException
258 261
	 */
259 262
	public void setStatistics(Statistics stats) throws RmfSerializerException;
260
	
263

  
261 264
	/**
262 265
	 * Obtiene el extent del raster.
263 266
	 * @return Extent
264 267
	 */
265 268
	public Extent getExtent();
266
	
269

  
267 270
	/**
268
	 * Gets the suffix of the source file 
271
	 * Gets the suffix of the source file
269 272
	 * @return
270 273
	 */
271 274
	public String getFileSuffix();
272
	
275

  
273 276
	/**
274 277
	 * Este es el extent sobre el que se ajusta una petici?n para que esta no
275 278
	 * exceda el extent m?ximo del raster. Para un raster sin rotar ser? igual al
......
280 283
	 * @return Extent
281 284
	 */
282 285
	public Extent getExtentWithoutRot();
283
	
286

  
284 287
	/**
285 288
	 * Obtiene la matriz de transformaci?n del propio raster. Esta matriz es la
286 289
	 * encargada de convertir las coordenadas de la petici?n en coordenadas a las
......
293 296
	 * @return
294 297
	 */
295 298
	public AffineTransform getOwnAffineTransform();
296
	
299

  
297 300
	/**
298 301
	 * Obtiene la transformaci?n afin aplicada en las peticiones con coordenadas
299 302
	 * reales. Esta corresponde al producto matricial entre la transformaci?n de
......
303 306
	 * @return Matriz de la transformaci?n af?n.
304 307
	 */
305 308
	public AffineTransform getAffineTransform();
306
	
309

  
307 310
	/**
308 311
	 * Sets the provider projection
309 312
	 * @return IProjection
310 313
	 */
311 314
	public IProjection getProjection();
312
	
315

  
313 316
	/**
314 317
	 * Gets the provider projection
315 318
	 * @return IProjection
316 319
	 */
317 320
	public void setProjection(IProjection proj, boolean persist) throws RmfSerializerException;
318
	
321

  
319 322
	/**
320 323
	 * Obtiene el extent asignado
321 324
	 * @return	Extent
322 325
	 */
323 326
	public Extent getView();
324
	
327

  
325 328
	/**
326 329
	 * Gets a DatasetMetadata object
327 330
	 * @return
328 331
	 */
329 332
	public Metadata getMetadata();
330
	
333

  
331 334
	/**
332 335
	 * Gets the object with the color interpretation by band
333 336
	 * @return ColorInterpretation
334 337
	 */
335 338
	public ColorInterpretation getColorInterpretation();
336
	
339

  
337 340
	/**
338 341
	 * Assigns the object with the color interpretation by band
339 342
	 * @param ci
340 343
	 */
341 344
	public void setColorInterpretation(ColorInterpretation ci);
342
	
345

  
343 346
	/**
344 347
	 * Define el objeto paleta. Si se define null quiere decir que no tiene paleta
345 348
	 * para su visualizaci?n.
346 349
	 * @param value
347 350
	 */
348 351
	public void setColorTable(ColorTable value);
349
	
352

  
350 353
	/**
351 354
	 * Gets the {@link ColorTable} or null if the raster
352 355
	 * does not have
353 356
	 * @return
354 357
	 */
355 358
	public ColorTable getColorTable();
356
	
359

  
357 360
	/**
358 361
	 * Gets the legend as a image. The store could not have implemented this method .
359
	 * This is useful above all for WMS but whatever raster layer 
362
	 * This is useful above all for WMS but whatever raster layer
360 363
	 * could return a legend as image.
361 364
	 * @return
362 365
	 */
363 366
	public Image getImageLegend();
364
	
367

  
365 368
	/**
366 369
	 * Obtiene el estado de transparencia a partir de los estados de transparencia de todos
367
	 * los ficheros que lo componen. Si varios de los ficheros que lo componen tienen banda de 
370
	 * los ficheros que lo componen. Si varios de los ficheros que lo componen tienen banda de
368 371
	 * transparencia estas tendr?n que ser mezcladas sobre una banda de transparencia ?nica.
369 372
	 * @return Objeto FileTransparency con el estado de transparencia
370 373
	 */
371 374
	public Transparency getTransparency();
372
	
375

  
373 376
	/**
374 377
	 * Cierra los raster asociados.
375 378
	 */
376 379
	public void close();
377
	
380

  
378 381
	/**
379 382
	 * Convierte un punto desde coordenadas pixel a coordenadas del mundo.
380 383
	 * @param pt Punto a transformar
381 384
	 * @return punto transformado en coordenadas del mundo
382 385
	 */
383 386
	public Point2D rasterToWorld(Point2D pt);
384
	
387

  
385 388
	/**
386 389
	 * Convierte un punto desde del mundo a coordenadas pixel.
387 390
	 * @param pt Punto a transformar
388 391
	 * @return punto transformado en coordenadas pixel
389 392
	 */
390 393
	public Point2D worldToRaster(Point2D pt);
391
	
394

  
392 395
	/**
393 396
	 * Asigna una transformaci?n al raster para que se tenga en cuenta en la
394 397
	 * asignaci?n del setView. Esta asignaci?n recalcula el extent, el
......
398 401
	 * @param t Transformaci?n af?n a aplicar
399 402
	 */
400 403
	public void setAffineTransform(AffineTransform t);
401
	
404

  
402 405
	/**
403 406
	 * Gets the pixel size
404 407
	 * @return
405 408
	 */
406 409
	public double getCellSize();
407
	
410

  
408 411
	/**
409 412
	 * Obtiene el tama?o de pixel en X
410 413
	 * @return tama?o de pixel en X
......
416 419
	 * @return tama?o de pixel en Y
417 420
	 */
418 421
	public double getPixelSizeY();
419
	
422

  
420 423
	/**
421 424
	 * Obtiene el valor del raster en la coordenada que se le pasa.
422 425
	 * El valor ser? Double, Int, Byte, etc. dependiendo del tipo de
......
428 431
	public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException;
429 432

  
430 433
	/**
431
	 * Obtiene la proyecci?n asociada al raster. Como todos los dataset del 
434
	 * Obtiene la proyecci?n asociada al raster. Como todos los dataset del
432 435
	 * multiDataset deben tener la misma proyecci?n obtenemos esta del primer
433 436
	 * dataset.
434 437
	 * @return Proyecci?n en formato cadena
435 438
	 * @throws RasterDriverException
436 439
	 */
437 440
	public String getWktProjection() throws RasterDriverException;
438
	
441

  
439 442
	/**
440 443
	 * Sets the nodata value
441 444
	 * @return
442 445
	 */
443 446
	public void setNoDataValue(NoData value);
444
	
447

  
445 448
	/**
446 449
	 * Obtiene el flag que dice si el raster est? o no georreferenciado
447 450
	 * @return true si est? georreferenciado y false si no lo est?.
448 451
	 */
449 452
	public boolean isGeoreferenced();
450
	
453

  
451 454
	/**
452 455
	 * Returns true if the provider has several files and all of them has the same extension
453 456
	 * @return
454 457
	 */
455 458
	public boolean isMultiFile();
456
	
459

  
457 460
	/**
458 461
	 * Returns true if the source of data is a mosaic of images
459 462
	 * @return
460 463
	 */
461 464
	public boolean isMosaic();
462
	
465

  
463 466
	/**
464 467
	 * Deletes the cache of this layer composed by the files in the provider list
465 468
	 */
466 469
	public void deleteLayerFromCache();
467
	
470

  
468 471
	/**
469 472
	 * Clone this RasterProvider
470 473
	 * @return
471 474
	 */
472 475
	public RasterProvider cloneProvider() throws CloneException;
473
	
476

  
474 477
	/**
475 478
	 * Returs the DataParameters
476 479
	 * @return
477 480
	 */
478 481
	public RasterDataParameters getDataParameters();
479
	
482

  
480 483
	/**
481 484
	 * Reads a complete block of data and returns an tridimensional array of the right type. This function is useful
482
	 * to read a file very fast without setting a view. 
485
	 * to read a file very fast without setting a view.
483 486
	 * @deprecated This method is only used to generate statistics. The statistics have to change the way in
484 487
	 * which are calculated. Then this function will be eliminated.
485 488
	 */
486 489
	public Object readBlock(int pos, int blockHeight, double scale)
487 490
		throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException;
488 491

  
489
	
492

  
490 493
	/**
491 494
	 * Carga un objecto desde un serializador usando el tipo del mismo objeto pasado por parametro.
492 495
	 * Usa value para iniciar dicho serializador
......
496 499
	 * @throws RmfSerializerException
497 500
	 */
498 501
	public Object loadObjectFromRmf(Class<?> class1, Object value) throws RmfSerializerException;
499
	
502

  
500 503
	/**
501 504
	 * Guarda en el RMF el objecto actual en caso de que exista un serializador para el.
502 505
	 * El tipo del objeto se especifica en el parametro class1.
503 506
	 * Esto nos puede permitir poder poner a null un valor y encontrar su serializador.
504 507
	 * @param class1
505 508
	 * @param value
506
	 * @throws RmfSerializerException 
509
	 * @throws RmfSerializerException
507 510
	 */
508 511
	public void saveObjectToRmf(Class<?> class1, Object value) throws RmfSerializerException;
509
	
512

  
510 513
	/**
511 514
	 * Sets the status information using other provider of the same type. The first action
512 515
	 * of this method should be to check the type of the parameter.
513 516
	 * @param provider
514 517
	 */
515 518
	public void setStatus(RasterProvider provider);
516
	
519

  
517 520
	/**
518 521
	 * Gets the information in a real point
519 522
	 * @param x
520 523
	 * @param y
521 524
	 * @return
522
	 * @throws RemoteServiceException 
525
	 * @throws RemoteServiceException
523 526
	 */
524 527
	public String getInfoByPoint(double x, double y, ICancellable cancellable) throws InfoByPointException;
525
	
528

  
526 529
	/**
527
	 * Gets the information in a pixel point. Some services need additional 
528
	 * information as the window where the request is done 
530
	 * Gets the information in a pixel point. Some services need additional
531
	 * information as the window where the request is done
529 532
	 * @param x
530 533
	 *        X Pixel position
531 534
	 * @param y
......
541 544
	 * @throws RemoteServiceException
542 545
	 */
543 546
	public String getInfoByPoint(int x, int y, Extent bbox, int w, int h, ICancellable cancellable) throws InfoByPointException;
544
	
547

  
545 548
	/**
546 549
	 * Gets the tile cache data server
547 550
	 * @return
548 551
	 */
549 552
	public TileServer getTileServer();
550
	
553

  
551 554
	/**
552
	 * Some services neither has limits nor pixel size. For instance, WebMapService 
555
	 * Some services neither has limits nor pixel size. For instance, WebMapService
553 556
	 * is a service of this type if the size is not fixed. Other services, like
554 557
	 * WMTS are enclosed too but in this case it will have resolution by level.
555 558
	 * This method returns true if the data source is enclosed.
556 559
	 * @return
557 560
	 */
558 561
	public boolean isRasterEnclosed();
559
	
562

  
560 563
	/**
561 564
	 * Gets the rmf file path. This method will have to be redefined by providers
562 565
	 * with a different path
563 566
	 * @return
564 567
	 */
565
	public String getRMFFile();
566
	
568
	public File getRMFFile();
569

  
567 570
	/**
568 571
	 * Selects the subdataset.
569 572
	 */
570 573
	public void selectSubdataset();
571
	
574

  
572 575
	/**
573 576
	 * Gets the list of supported formats
574 577
	 * @return
575 578
	 */
576 579
	public String[] getFormatList();
577
	
580

  
578 581
	/**
579 582
	 * Returns the source type (FILE, POSTGIS, REMOTE,...)
580 583
	 * @return
581 584
	 */
582 585
	public int getSourceType();
583
	
586

  
584 587
	/**
585 588
	 * This function returns true if the image to be loaded needs a enhanced filter or
586 589
	 * doesn't. It depends on the format, number of bands, type of data and so on.
587 590
	 * @return The default value is false but each driver can change this value.
588 591
	 */
589 592
	public boolean needEnhanced();
590
	
593

  
591 594
	/**
592 595
	 * Gets the time serial information
593 596
	 * @return
594
	 * @throws RmfSerializerException 
597
	 * @throws RmfSerializerException
595 598
	 */
596 599
	public TimeSeries getTimeSerials() throws RmfSerializerException;
597
	
600

  
598 601
	/**
599 602
	 * Sets the time serial information
600
	 * @throws RmfSerializerException 
603
	 * @throws RmfSerializerException
601 604
	 */
602 605
	public void setTimeSerials(TimeSeries serialInfo) throws RmfSerializerException;
603 606

  
......
605 608
	 * Gets the set of data selected in the {@link RasterQuery}
606 609
	 * @param q
607 610
	 * @return
608
	 * @throws RasterDriverException 
609
	 * @throws ProcessInterruptedException 
611
	 * @throws RasterDriverException
612
	 * @throws ProcessInterruptedException
610 613
	 */
611 614
	public Buffer getDataSet(SpiRasterQuery query) throws ProcessInterruptedException, RasterDriverException;
612
	
615

  
613 616
	/**
614 617
	 * Gets the list of geo points associated to this provider
615 618
	 * @return
616 619
	 */
617 620
	public GeoPointList getGeoPointList();
618
	
621

  
619 622
	/**
620 623
	 * Sets the list of geo points associated to this provider
621 624
	 */
622 625
	public void setGeoPointList(GeoPointList geoPointList);
623
	
626

  
624 627
}

Also available in: Unified diff