Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.fmap / src / main / java / org / gvsig / raster / fmap / layers / FLyrRaster.java @ 4181

History | View | Annotate | Download (10.4 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.fmap.layers;
23

    
24
import java.awt.Graphics2D;
25
import java.awt.geom.AffineTransform;
26
import java.awt.geom.Point2D;
27
import java.awt.image.BufferedImage;
28
import java.io.File;
29
import java.net.URI;
30
import java.util.ArrayList;
31
import java.util.List;
32

    
33
import org.cresques.cts.IProjection;
34

    
35
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
36
import org.gvsig.fmap.dal.coverage.datastruct.NoData;
37
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
38
import org.gvsig.fmap.dal.coverage.exception.ROIException;
39
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
40
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException;
41
import org.gvsig.fmap.dal.coverage.grid.render.Render;
42
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
43
import org.gvsig.fmap.dal.coverage.store.props.ColorTable;
44
import org.gvsig.fmap.dal.coverage.util.Historical;
45
import org.gvsig.fmap.dal.exception.ReadException;
46
import org.gvsig.fmap.geom.primitive.Envelope;
47
import org.gvsig.fmap.mapcontext.MapContext;
48
import org.gvsig.fmap.mapcontext.ViewPort;
49
import org.gvsig.fmap.mapcontext.layers.FLayer;
50
import org.gvsig.fmap.mapcontext.layers.LayerListener;
51
import org.gvsig.raster.roi.ROI;
52
import org.gvsig.tools.task.Cancellable;
53

    
54
/**
55
 * All kind of raster layers should implement this interface.
56
 *
57
 * @author Nacho Brodin (nachobrodin@gmail.com)
58
 */
59
@SuppressWarnings("deprecation")
60
public interface FLyrRaster extends FLayer {
61
        /**
62
         * Sets the layer as initialized. That's implies that the layer has
63
         * the right filters and is opened,
64
         * @param initialized
65
         */
66
        public void setLayerInitialized(boolean initialized);
67

    
68
        /**
69
         * Gets the uniform resource identifier
70
         * @return
71
         */
72
        public URI getURI();
73

    
74
        /**
75
         * Returns true if a color table exists
76
         * @return
77
         */
78
        public boolean existColorTable();
79

    
80
        /**
81
         * Define la ultima leyenda valida de la capa o se pone a null para que la
82
         * capa busque una leyenda valida.
83
         * @param ct
84
         */
85
        public void setLastLegend(ColorTable ct);
86

    
87
        /**
88
         * Crea el objeto renderizador de raster
89
         * @return Rendering
90
         */
91
        public Render getRender();
92

    
93
        /**
94
         * Gets the MapContext object
95
         * @return
96
         */
97
        public MapContext getMapContext();
98

    
99
        /**
100
         * Gets the full extent
101
         * @return
102
         */
103
        public Extent getFullRasterExtent();
104

    
105
        /**
106
         * Gets the DataStore
107
         * @return
108
         */
109
        public RasterDataStore getDataStore();
110

    
111
        /**
112
         * Metodo para consultar si una capa puede ser un RGB. Suponemos que es un RGB
113
         * si el tipo de datos es de tipo byte y su interpretacion de color tiene
114
         * asignada los tres colores.
115
         * @return boolean
116
         */
117
        public boolean isRGB();
118

    
119
        /**
120
         * Returns true if the drawn is going to be tiled
121
         * @return
122
         */
123
        public boolean isTiled();
124

    
125
        /**
126
         * Gets the regions of interest
127
         * @return
128
         * @throws ROIException
129
         */
130
        public List<ROI> getRois() throws ROIException;
131

    
132
        /**
133
         * Sets the regions of interest
134
         */
135
        public void setRois(List<ROI> rois);
136

    
137
        /**
138
         * Sets the files which contain the regions of interest. This method is temporal until
139
         * after the refactoring of ROIs.
140
         * @param file
141
         * @throws RmfSerializerException
142
         */
143
        public void setROIsFiles(List<File> file) throws RmfSerializerException;
144

    
145
        /**
146
         * Gets the files which contain the regions of interest. This method is temporal until
147
         * after the refactoring of ROIs.
148
         * @return
149
         * @throws RmfSerializerException
150
         */
151
        public List<File> getROIsFiles() throws RmfSerializerException;
152

    
153
        /**
154
         * Obtiene la proyecci?n del fichero.
155
         * @return IProjection
156
         */
157
        public IProjection readProjection() throws RasterDriverException;
158

    
159
        /**
160
         * Gets the tile size
161
         * @return
162
         */
163
        public int[] getTileSize();
164

    
165
        /**
166
         * Obtiene el valor NoData asociado al raster.
167
         * @return double
168
         */
169
        public NoData getNoDataValue();
170

    
171
        /**
172
         * Returs a string with the extension of the first file
173
         */
174
        public String getFileFormat();
175

    
176
        /**
177
         * Obtiene el flag que dice si la imagen est? o no georreferenciada
178
         * @return true si est? georreferenciada y false si no lo est?.
179
         */
180
        public boolean isGeoreferenced();
181

    
182
        /**
183
         * Returns the number of bands of each dataset
184
         * @return
185
         */
186
        public int[] getBandCountFromDataset();
187

    
188
        /**
189
         * Gets the projection in well known text format
190
         * @return
191
         * @throws RasterDriverException
192
         */
193
        public String getWktProjection() throws RasterDriverException;
194

    
195
        /**
196
         * Gets the color interpretation
197
         * @param band
198
         * @param dataset
199
         * @return
200
         */
201
        public String getColorInterpretation(int band, int dataset);
202

    
203
        /**
204
         * When a process is using information of this layer this variable will contain
205
         * the thread ID.
206
         * @param readingData
207
         */
208
        public void setReadingData(String readingData);
209

    
210
        /**
211
         * Sets the nodata value for this layer
212
         * @param noDataValue the noDataValue to set
213
         */
214
        public void setNoDataValue(NoData noDataValue);
215

    
216
        /**
217
         * Sets the minimum scale visible. Lower scales won't be drawn.
218
         *
219
         * @param minScale the scale > 0, -1 if not defined
220
         * @see #getMinScale()
221
         */
222
        public void setMinScale(double minScale);
223

    
224
        /**
225
         * Sets the maximum scale visible. Higher scales won't be drawn.
226
         *
227
         * @param maxScale the scale > 0, -1 if not defined
228
         * @see #getMaxScale()
229
         */
230
        public void setMaxScale(double maxScale);
231

    
232
        /**
233
         * Returns the maximum scale visible. Higher scales won't be drawn.
234
         *
235
         * @return the maximum scale > 0, -1 if not defined
236
         * @see #setMaxScale(double)
237
         */
238
        public double getMaxScale();
239

    
240
        /**
241
         * Returns the minimum scale visible. Lower scales won't be drawn.
242
         *
243
         * @return the minimum scale > 0, -1 if not defined
244
         * @see #setMinScale(double)
245
         */
246
        public double getMinScale();
247

    
248
        /**
249
         * @return Returns the removeRasterFlag.
250
         */
251
        public boolean isRemoveRasterFlag();
252

    
253
        /**
254
         * Asigna el valor del flag que dice si destruimos la memoria del raster
255
         * al eliminarlo del TOC o  no.
256
         * @param removeRasterFlag The removeRasterFlag to set.
257
         */
258
        public void setRemoveRasterFlag(boolean removeRasterFlag);
259

    
260
        /**
261
         * Borra de la lista de listeners el que se pasa como par?metro.
262
         *
263
         * @param o LayerListener a borrar.
264
         *
265
         * @return True si ha sido correcto el borrado del Listener.
266
         */
267
        public boolean removeLayerListener(LayerListener o);
268

    
269
        /**
270
         * @throws ReadException
271
         * @throws ReadDriverException
272
         * @see com.iver.cit.gvsig.fmap.layers.LayerOperations#draw(java.awt.image.BufferedImage,
273
         *                 java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort,
274
         *                 com.iver.utiles.swing.threads.Cancellable)
275
         */
276
        public void draw(BufferedImage image, Graphics2D g, ViewPort vp, Cancellable cancel, double scale) throws ReadException;
277

    
278
        /**
279
         * Clones this layer
280
         * @return
281
         * @throws Exception
282
         */
283
        public FLayer cloneLayer() throws Exception;
284

    
285
        /**
286
         * Gets a layer which the source is a file
287
         * @return
288
         * @throws RasterDriverException
289
         */
290
        public FLayer getFileLayer() throws RasterDriverException;
291

    
292
        /**
293
         * Gets the position of the alpha band
294
         * @return
295
         */
296
        public int getAlphaBandNumber();
297

    
298
        public String getName();
299

    
300
        /**
301
         * Gets the projection
302
         * @return
303
         */
304
        public IProjection getProjection();
305

    
306
        /**
307
         * Devuelve si es reproyectable o no la capa
308
         * @return
309
         */
310
        public boolean isReproyectable();
311

    
312
        /**
313
         * Recupera del raster la matriz de transformaci?n que lo situa en cualquier parte de la vista
314
         * @return AffineTransform
315
         */
316
        public AffineTransform getAffineTransform();
317

    
318
        /**
319
         * Obtiene la lista de transformaciones que se han ido aplicando al raster.
320
         * @return Historical. Lista de AffineTransform
321
         */
322
        public Historical getAffineTransformHistorical();
323

    
324
        /**
325
         * Asigna al raster la matriz de transformaci?n para situarlo en cualquier parte de la vista
326
         * @param transf
327
         */
328
        public void setAffineTransform(AffineTransform transf);
329

    
330
        /**
331
         * Asigna al raster la matriz de transformaci?n para situarlo en cualquier parte de la vista.
332
         * Esta versi?n no guarda en el historico.
333
         * @param transf
334
         */
335
        public void setAffineTransformWithoutHistorical(AffineTransform transf);
336

    
337
        /**
338
         * Salva la georreferenciaci?n a fichero rmf.
339
         * @param fName
340
         * @throws RmfSerializerException
341
         */
342
        public void saveGeoToRmf() throws RmfSerializerException;
343

    
344
        /**
345
         * Metodo que obtiene si un punto cae dentro de los l?mites de la capa
346
         * o fuera de ellos.
347
         * @param p Punto a calcular
348
         * @return true si est? dentro de los l?mites y false si est? fuera
349
         */
350
        public boolean isInside(Point2D p);
351

    
352
        /**
353
         * Returns true if this layer is remote
354
         * @return
355
         */
356
        public boolean isRemote();
357

    
358
        /**
359
         * Gets the attribute list
360
         * <UL>
361
         * <LI>Filename</LI>
362
         * <LI>Filesize</LI>
363
         * <LI>Width</LI>
364
         * <LI>Height</LI>
365
         * <LI>Bands</LI>
366
         * </UL>
367
         * @return ArrayList<Object>
368
         */
369
        public ArrayList<Object> getAttributes();
370

    
371
        /**
372
         * Returns the full bounding box of this layer
373
         * @return
374
         */
375
        public Envelope getFullEnvelope();
376

    
377
        /**
378
         * Ajusta las coordenadas especificadas en el par?metro al ?rea m?xima
379
         * del raster en p?xeles.
380
         * @param req Punto a ajustar dentro del extener del raster
381
         */
382
        public Point2D adjustWorldRequest(Point2D req);
383

    
384
        /**
385
         * Adds a new file. The behavior of this function depends on
386
         * the kind of provider and its implementation.
387
         * @param file
388
         * @throws InvalidSourceException
389
         */
390
        public void addFile(File file) throws InvalidSourceException;
391

    
392
        /**
393
         * Removes a file. The behavior of this function depends on
394
         * the kind of provider and its implementation.
395
         * @param file
396
         */
397
        public void removeFile(File file);
398

    
399
        /**
400
         * When this flag is true then renderice nodata value as transparent
401
         * @param t
402
         */
403
        public void setNoDataTransparent(boolean t);
404

    
405
        /**
406
         * Sets the layer projection
407
         * @param proj
408
         */
409
        public void setProjection(IProjection proj, boolean persist) throws RmfSerializerException;
410

    
411
}