gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.fmap / src / main / java / org / gvsig / raster / fmap / layers / FLyrRaster.java @ 2125
History | View | Annotate | Download (10.7 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.util.ArrayList; |
30 |
import java.util.List; |
31 |
|
32 |
import org.cresques.cts.IProjection; |
33 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
34 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
35 |
import org.gvsig.fmap.dal.coverage.exception.GridException; |
36 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException; |
37 |
import org.gvsig.fmap.dal.coverage.exception.ROIException; |
38 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
39 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
40 |
import org.gvsig.fmap.dal.coverage.grid.Grid; |
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 |
* Gets the uniform resource identifier
|
63 |
* @return
|
64 |
*/
|
65 |
public String getURI(); |
66 |
|
67 |
/**
|
68 |
* Returns true if a color table exists
|
69 |
* @return
|
70 |
*/
|
71 |
public boolean existColorTable(); |
72 |
|
73 |
/**
|
74 |
* Define la ultima leyenda valida de la capa o se pone a null para que la
|
75 |
* capa busque una leyenda valida.
|
76 |
* @param ct
|
77 |
*/
|
78 |
public void setLastLegend(ColorTable ct); |
79 |
|
80 |
/**
|
81 |
* Crea el objeto renderizador de raster
|
82 |
* @return Rendering
|
83 |
*/
|
84 |
public Render getRender();
|
85 |
|
86 |
/**
|
87 |
* Gets the MapContext object
|
88 |
* @return
|
89 |
*/
|
90 |
public MapContext getMapContext();
|
91 |
|
92 |
/**
|
93 |
* Gets the full extent
|
94 |
* @return
|
95 |
*/
|
96 |
public Extent getFullRasterExtent();
|
97 |
|
98 |
/**
|
99 |
* Gets the DataStore
|
100 |
* @return
|
101 |
*/
|
102 |
public RasterDataStore getDataStore();
|
103 |
|
104 |
/**
|
105 |
* Metodo para consultar si una capa puede ser un RGB. Suponemos que es un RGB
|
106 |
* si el tipo de datos es de tipo byte y su interpretacion de color tiene
|
107 |
* asignada los tres colores.
|
108 |
* @return boolean
|
109 |
*/
|
110 |
public boolean isRGB(); |
111 |
|
112 |
/**
|
113 |
* Returns true if the drawn is going to be tiled
|
114 |
* @return
|
115 |
*/
|
116 |
public boolean isTiled(); |
117 |
|
118 |
/**
|
119 |
* Gets the regions of interest
|
120 |
* @return
|
121 |
* @throws ROIException
|
122 |
*/
|
123 |
public List<ROI> getRois() throws ROIException; |
124 |
|
125 |
/**
|
126 |
* Sets the regions of interest
|
127 |
*/
|
128 |
public void setRois(List<ROI> rois); |
129 |
|
130 |
/**
|
131 |
* Sets the files which contain the regions of interest. This method is temporal until
|
132 |
* after the refactoring of ROIs.
|
133 |
* @param file
|
134 |
* @throws RmfSerializerException
|
135 |
*/
|
136 |
public void setROIsFiles(List<File> file) throws RmfSerializerException; |
137 |
|
138 |
/**
|
139 |
* Gets the files which contain the regions of interest. This method is temporal until
|
140 |
* after the refactoring of ROIs.
|
141 |
* @return
|
142 |
* @throws RmfSerializerException
|
143 |
*/
|
144 |
public List<File> getROIsFiles() throws RmfSerializerException; |
145 |
|
146 |
/**
|
147 |
* Obtiene la proyecci?n del fichero.
|
148 |
* @return IProjection
|
149 |
*/
|
150 |
public IProjection readProjection() throws RasterDriverException; |
151 |
|
152 |
/**
|
153 |
* Gets the tile size
|
154 |
* @return
|
155 |
*/
|
156 |
public int[] getTileSize(); |
157 |
|
158 |
/**
|
159 |
* Obtiene el grid de la capa completa. Esta llamada devuelve un buffer de solo lectura
|
160 |
* @param interpolated true si se solicita un grid interpolado y false si se solicita sin interpolar.
|
161 |
* @return Grid.
|
162 |
* @throws InterruptedException
|
163 |
*/
|
164 |
public Grid getReadOnlyFullGrid(boolean interpolated) throws GridException, InterruptedException; |
165 |
|
166 |
/**
|
167 |
* Obtiene el valor NoData asociado al raster.
|
168 |
* @return double
|
169 |
*/
|
170 |
public NoData getNoDataValue();
|
171 |
|
172 |
/**
|
173 |
* Returs a string with the extension of the first file
|
174 |
*/
|
175 |
public String getFileFormat(); |
176 |
|
177 |
/**
|
178 |
* Obtiene el flag que dice si la imagen est? o no georreferenciada
|
179 |
* @return true si est? georreferenciada y false si no lo est?.
|
180 |
*/
|
181 |
public boolean isGeoreferenced(); |
182 |
|
183 |
/**
|
184 |
* Returns the number of bands of each dataset
|
185 |
* @return
|
186 |
*/
|
187 |
public int[] getBandCountFromDataset(); |
188 |
|
189 |
/**
|
190 |
* Gets the projection in well known text format
|
191 |
* @return
|
192 |
* @throws RasterDriverException
|
193 |
*/
|
194 |
public String getWktProjection() throws RasterDriverException; |
195 |
|
196 |
/**
|
197 |
* Gets the color interpretation
|
198 |
* @param band
|
199 |
* @param dataset
|
200 |
* @return
|
201 |
*/
|
202 |
public String getColorInterpretation(int band, int dataset); |
203 |
|
204 |
/**
|
205 |
* When a process is using information of this layer this variable will contain
|
206 |
* the thread ID.
|
207 |
* @param readingData
|
208 |
*/
|
209 |
public void setReadingData(String readingData); |
210 |
|
211 |
/**
|
212 |
* Sets the nodata value for this layer
|
213 |
* @param noDataValue the noDataValue to set
|
214 |
*/
|
215 |
public void setNoDataValue(NoData noDataValue); |
216 |
|
217 |
/**
|
218 |
* Sets the minimum scale visible. Lower scales won't be drawn.
|
219 |
*
|
220 |
* @param minScale the scale > 0, -1 if not defined
|
221 |
* @see #getMinScale()
|
222 |
*/
|
223 |
public void setMinScale(double minScale); |
224 |
|
225 |
/**
|
226 |
* Sets the maximum scale visible. Higher scales won't be drawn.
|
227 |
*
|
228 |
* @param maxScale the scale > 0, -1 if not defined
|
229 |
* @see #getMaxScale()
|
230 |
*/
|
231 |
public void setMaxScale(double maxScale); |
232 |
|
233 |
/**
|
234 |
* Returns the maximum scale visible. Higher scales won't be drawn.
|
235 |
*
|
236 |
* @return the maximum scale > 0, -1 if not defined
|
237 |
* @see #setMaxScale(double)
|
238 |
*/
|
239 |
public double getMaxScale(); |
240 |
|
241 |
/**
|
242 |
* Returns the minimum scale visible. Lower scales won't be drawn.
|
243 |
*
|
244 |
* @return the minimum scale > 0, -1 if not defined
|
245 |
* @see #setMinScale(double)
|
246 |
*/
|
247 |
public double getMinScale(); |
248 |
|
249 |
/**
|
250 |
* @return Returns the removeRasterFlag.
|
251 |
*/
|
252 |
public boolean isRemoveRasterFlag(); |
253 |
|
254 |
/**
|
255 |
* Asigna el valor del flag que dice si destruimos la memoria del raster
|
256 |
* al eliminarlo del TOC o no.
|
257 |
* @param removeRasterFlag The removeRasterFlag to set.
|
258 |
*/
|
259 |
public void setRemoveRasterFlag(boolean removeRasterFlag); |
260 |
|
261 |
/**
|
262 |
* Borra de la lista de listeners el que se pasa como par?metro.
|
263 |
*
|
264 |
* @param o LayerListener a borrar.
|
265 |
*
|
266 |
* @return True si ha sido correcto el borrado del Listener.
|
267 |
*/
|
268 |
public boolean removeLayerListener(LayerListener o); |
269 |
|
270 |
/**
|
271 |
* @throws ReadException
|
272 |
* @throws ReadDriverException
|
273 |
* @see com.iver.cit.gvsig.fmap.layers.LayerOperations#draw(java.awt.image.BufferedImage,
|
274 |
* java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort,
|
275 |
* com.iver.utiles.swing.threads.Cancellable)
|
276 |
*/
|
277 |
public void draw(BufferedImage image, Graphics2D g, ViewPort vp, Cancellable cancel, double scale) throws ReadException; |
278 |
|
279 |
/**
|
280 |
* Clones this layer
|
281 |
* @return
|
282 |
* @throws Exception
|
283 |
*/
|
284 |
public FLayer cloneLayer() throws Exception; |
285 |
|
286 |
/**
|
287 |
* Gets a layer which the source is a file
|
288 |
* @return
|
289 |
* @throws RasterDriverException
|
290 |
*/
|
291 |
public FLayer getFileLayer() throws RasterDriverException; |
292 |
|
293 |
/**
|
294 |
* Gets the position of the alpha band
|
295 |
* @return
|
296 |
*/
|
297 |
public int getAlphaBandNumber(); |
298 |
|
299 |
public String getName(); |
300 |
|
301 |
/**
|
302 |
* Gets the projection
|
303 |
* @return
|
304 |
*/
|
305 |
public IProjection getProjection();
|
306 |
|
307 |
/**
|
308 |
* Devuelve si es reproyectable o no la capa
|
309 |
* @return
|
310 |
*/
|
311 |
public boolean isReproyectable(); |
312 |
|
313 |
/**
|
314 |
* Recupera del raster la matriz de transformaci?n que lo situa en cualquier parte de la vista
|
315 |
* @return AffineTransform
|
316 |
*/
|
317 |
public AffineTransform getAffineTransform(); |
318 |
|
319 |
/**
|
320 |
* Obtiene la lista de transformaciones que se han ido aplicando al raster.
|
321 |
* @return Historical. Lista de AffineTransform
|
322 |
*/
|
323 |
public Historical getAffineTransformHistorical();
|
324 |
|
325 |
/**
|
326 |
* Asigna al raster la matriz de transformaci?n para situarlo en cualquier parte de la vista
|
327 |
* @param transf
|
328 |
*/
|
329 |
public void setAffineTransform(AffineTransform transf); |
330 |
|
331 |
/**
|
332 |
* Asigna al raster la matriz de transformaci?n para situarlo en cualquier parte de la vista.
|
333 |
* Esta versi?n no guarda en el historico.
|
334 |
* @param transf
|
335 |
*/
|
336 |
public void setAffineTransformWithoutHistorical(AffineTransform transf); |
337 |
|
338 |
/**
|
339 |
* Salva la georreferenciaci?n a fichero rmf.
|
340 |
* @param fName
|
341 |
* @throws RmfSerializerException
|
342 |
*/
|
343 |
public void saveGeoToRmf() throws RmfSerializerException; |
344 |
|
345 |
/**
|
346 |
* Metodo que obtiene si un punto cae dentro de los l?mites de la capa
|
347 |
* o fuera de ellos.
|
348 |
* @param p Punto a calcular
|
349 |
* @return true si est? dentro de los l?mites y false si est? fuera
|
350 |
*/
|
351 |
public boolean isInside(Point2D p); |
352 |
|
353 |
/**
|
354 |
* Returns true if this layer is remote
|
355 |
* @return
|
356 |
*/
|
357 |
public boolean isRemote(); |
358 |
|
359 |
/**
|
360 |
* Gets the attribute list
|
361 |
* <UL>
|
362 |
* <LI>Filename</LI>
|
363 |
* <LI>Filesize</LI>
|
364 |
* <LI>Width</LI>
|
365 |
* <LI>Height</LI>
|
366 |
* <LI>Bands</LI>
|
367 |
* </UL>
|
368 |
* @return ArrayList<Object>
|
369 |
*/
|
370 |
public ArrayList<Object> getAttributes(); |
371 |
|
372 |
/**
|
373 |
* Returns the full bounding box of this layer
|
374 |
* @return
|
375 |
*/
|
376 |
public Envelope getFullEnvelope();
|
377 |
|
378 |
/**
|
379 |
* Ajusta las coordenadas especificadas en el par?metro al ?rea m?xima
|
380 |
* del raster en p?xeles.
|
381 |
* @param req Punto a ajustar dentro del extener del raster
|
382 |
*/
|
383 |
public Point2D adjustWorldRequest(Point2D req); |
384 |
|
385 |
/**
|
386 |
* Adds a new file. The behavior of this function depends on
|
387 |
* the kind of provider and its implementation.
|
388 |
* @param file
|
389 |
* @throws InvalidSourceException
|
390 |
*/
|
391 |
public void addFile(String file) throws InvalidSourceException; |
392 |
|
393 |
/**
|
394 |
* Removes a file. The behavior of this function depends on
|
395 |
* the kind of provider and its implementation.
|
396 |
* @param file
|
397 |
*/
|
398 |
public void removeFile(String file); |
399 |
|
400 |
/**
|
401 |
* When this flag is true then renderice nodata value as transparent
|
402 |
* @param t
|
403 |
*/
|
404 |
public void setNoDataTransparent(boolean t); |
405 |
|
406 |
/**
|
407 |
* Sets the layer projection
|
408 |
* @param proj
|
409 |
*/
|
410 |
public void setProjection(IProjection proj, boolean persist) throws RmfSerializerException; |
411 |
|
412 |
} |