root / branches / v10 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / FLayer.java @ 13201
History | View | Annotate | Download (18 KB)
1 | 11946 | maquerol | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | 1100 | fjp | *
|
3 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
4 | *
|
||
5 | * This program is free software; you can redistribute it and/or
|
||
6 | * modify it under the terms of the GNU General Public License
|
||
7 | * as published by the Free Software Foundation; either version 2
|
||
8 | * of the License, or (at your option) any later version.
|
||
9 | *
|
||
10 | * This program is distributed in the hope that it will be useful,
|
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | * GNU General Public License for more details.
|
||
14 | *
|
||
15 | * You should have received a copy of the GNU General Public License
|
||
16 | * along with this program; if not, write to the Free Software
|
||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
18 | *
|
||
19 | * For more information, contact:
|
||
20 | *
|
||
21 | * Generalitat Valenciana
|
||
22 | * Conselleria d'Infraestructures i Transport
|
||
23 | 11946 | maquerol | * Av. Blasco Ib??ez, 50
|
24 | 1100 | fjp | * 46010 VALENCIA
|
25 | * SPAIN
|
||
26 | *
|
||
27 | * +34 963862235
|
||
28 | * gvsig@gva.es
|
||
29 | * www.gvsig.gva.es
|
||
30 | *
|
||
31 | * or
|
||
32 | *
|
||
33 | * IVER T.I. S.A
|
||
34 | * Salamanca 50
|
||
35 | * 46005 Valencia
|
||
36 | * Spain
|
||
37 | *
|
||
38 | * +34 963163400
|
||
39 | * dac@iver.es
|
||
40 | */
|
||
41 | 214 | fernando | package com.iver.cit.gvsig.fmap.layers; |
42 | |||
43 | 8765 | jjdelcerro | import java.awt.Graphics2D; |
44 | 10401 | fjp | import java.awt.Image; |
45 | 8765 | jjdelcerro | import java.awt.geom.Rectangle2D; |
46 | import java.awt.image.BufferedImage; |
||
47 | import java.util.List; |
||
48 | 9359 | fdiaz | import java.util.Map; |
49 | 8765 | jjdelcerro | |
50 | 9013 | caballero | import javax.print.attribute.PrintRequestAttributeSet; |
51 | 8765 | jjdelcerro | import javax.swing.ImageIcon; |
52 | |||
53 | import org.cresques.cts.ICoordTrans; |
||
54 | 11925 | maquerol | import org.cresques.cts.IProjection; |
55 | 8765 | jjdelcerro | import org.cresques.geo.Projected; |
56 | |||
57 | 651 | fernando | import com.iver.cit.gvsig.fmap.DriverException; |
58 | 6878 | cesar | import com.iver.cit.gvsig.fmap.MapContext; |
59 | 11925 | maquerol | import com.iver.cit.gvsig.fmap.MapControl; |
60 | 533 | vcaballero | import com.iver.cit.gvsig.fmap.ViewPort; |
61 | 442 | vcaballero | import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
62 | 5152 | fjp | import com.iver.cit.gvsig.fmap.edition.EditionException; |
63 | 11030 | jmvivo | import com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer; |
64 | 415 | fernando | import com.iver.utiles.XMLEntity; |
65 | 5317 | fjp | import com.iver.utiles.swing.threads.Cancellable; |
66 | 249 | vcaballero | |
67 | |||
68 | 217 | fernando | /**
|
69 | 13116 | ppiqueras | * <p>Definition of the basic methods that all kind of <a href="http://www.gvsig.gva.es/">gvSIG</a> 's layers must implement.</p>
|
70 | *
|
||
71 | * <p>This kind of layers store their data by theirself, are drawable, projectable (with a projection), can be a node of a tree of layers, and
|
||
72 | * could be editable and have a cache with previous draws. They also can be visible or not, and active or not.</p>
|
||
73 | *
|
||
74 | * <p>A layer can also store information about errors produced working with it, and have a name (kind of layer) and
|
||
75 | * a brief summary explaining what's for.</p>
|
||
76 | *
|
||
77 | * <p>Each particular implementation can add new properties, and limit or expand the functionality.</p>
|
||
78 | *
|
||
79 | * @see Projected
|
||
80 | 217 | fernando | */
|
81 | 533 | vcaballero | public interface FLayer extends Projected { |
82 | 523 | vcaballero | /**
|
83 | 13012 | ppiqueras | * <p>Returns an entity that represents this layer.</p>
|
84 | *
|
||
85 | * <p>This xml entity has elements that represent and store information about this layer.</p>
|
||
86 | 523 | vcaballero | *
|
87 | 13001 | ppiqueras | * @return an xml entity with information to the current layer
|
88 | * @throws com.iver.cit.gvsig.fmap.layers.XMLException if there is an error obtaining the object.
|
||
89 | 523 | vcaballero | */
|
90 | 1828 | fernando | XMLEntity getXMLEntity() throws XMLException;
|
91 | 214 | fernando | |
92 | 523 | vcaballero | /**
|
93 | 13058 | ppiqueras | * <p>Inserts information to this layer from an xml entity.</p>
|
94 | 13012 | ppiqueras | *
|
95 | * <p>This xml entity has elements that represent and store information about this layer.</p>
|
||
96 | 523 | vcaballero | *
|
97 | 13001 | ppiqueras | * @param xml an <code>XMLEntity</code> with the information
|
98 | 523 | vcaballero | *
|
99 | 13001 | ppiqueras | * @throws com.iver.cit.gvsig.fmap.layers.XMLException if there is an error setting the object.
|
100 | 523 | vcaballero | */
|
101 | 1056 | vcaballero | void setXMLEntity(XMLEntity xml) throws XMLException; |
102 | 442 | vcaballero | |
103 | 523 | vcaballero | /**
|
104 | 13058 | ppiqueras | * Inserts some properties to this layer.
|
105 | 2183 | fernando | *
|
106 | 13001 | ppiqueras | * @param xml an <code>XMLEntity</code> with the information
|
107 | 2183 | fernando | *
|
108 | 13001 | ppiqueras | * @throws com.iver.cit.gvsig.fmap.layers.XMLException if there is an error obtaining the object.
|
109 | 2183 | fernando | */
|
110 | void setXMLEntity03(XMLEntity xml) throws XMLException; |
||
111 | |||
112 | /**
|
||
113 | 13001 | ppiqueras | * Changes the status of the current layer to active or inactive.
|
114 | 523 | vcaballero | *
|
115 | 13001 | ppiqueras | * @param selected the boolean to be set
|
116 | 523 | vcaballero | */
|
117 | void setActive(boolean selected); |
||
118 | 214 | fernando | |
119 | 523 | vcaballero | /**
|
120 | 13201 | ppiqueras | * Returns <code>true</code> or <code>false</code> if this layer is in black or not in the <i>TOC</i>.
|
121 | 523 | vcaballero | *
|
122 | 13001 | ppiqueras | * @return <code>true</code> if this layer is active, otherwise <code>false</code>
|
123 | 523 | vcaballero | */
|
124 | boolean isActive();
|
||
125 | 214 | fernando | |
126 | 523 | vcaballero | /**
|
127 | 13001 | ppiqueras | * Sets a name to this layer.
|
128 | 523 | vcaballero | *
|
129 | 13001 | ppiqueras | * @param name the string that is to be this layer's name
|
130 | 523 | vcaballero | */
|
131 | void setName(String name); |
||
132 | 214 | fernando | |
133 | 523 | vcaballero | /**
|
134 | 13001 | ppiqueras | * Returns the name of this layer.
|
135 | 523 | vcaballero | *
|
136 | 13001 | ppiqueras | * @return an string with this layer's name
|
137 | 523 | vcaballero | */
|
138 | String getName();
|
||
139 | 214 | fernando | |
140 | 523 | vcaballero | /**
|
141 | 13001 | ppiqueras | * <p>Executes the initialization operations of this layer. This method is invoked
|
142 | * only one time during the life of this layer and just before visualize it.</p>
|
||
143 | 523 | vcaballero | *
|
144 | 13001 | ppiqueras | * @throws com.iver.cit.gvsig.fmap.drivers.DriverIOException if fails loading the layer.
|
145 | 523 | vcaballero | */
|
146 | void load() throws DriverIOException; |
||
147 | 214 | fernando | |
148 | 523 | vcaballero | /**
|
149 | 13001 | ppiqueras | * Changes the status of the current layer to visible or invisible.
|
150 | 523 | vcaballero | *
|
151 | 13001 | ppiqueras | * @param visibility the boolean to be set
|
152 | 523 | vcaballero | */
|
153 | void setVisible(boolean visibility); |
||
154 | 214 | fernando | |
155 | 523 | vcaballero | /**
|
156 | 13201 | ppiqueras | * <p>Returns <code>true</code> if this layer is visible and available.</p>
|
157 | 13001 | ppiqueras | *
|
158 | * @see #isAvailable()
|
||
159 | * @see #setAvailable(boolean)
|
||
160 | * @see #visibleRequired()
|
||
161 | 523 | vcaballero | *
|
162 | 13201 | ppiqueras | * @return <code>true</code> if this layer is visible and available, otherwise <code>false</code>
|
163 | 523 | vcaballero | */
|
164 | boolean isVisible();
|
||
165 | 214 | fernando | |
166 | 523 | vcaballero | /**
|
167 | 13001 | ppiqueras | * Returns the parent <code>FLayers</code> of this layer.
|
168 | 523 | vcaballero | *
|
169 | 13001 | ppiqueras | * @return the parent of this layer, or <code>null</code> if hasn't parent
|
170 | 523 | vcaballero | */
|
171 | public FLayers getParentLayer();
|
||
172 | 249 | vcaballero | |
173 | 884 | fernando | /**
|
174 | 13201 | ppiqueras | * <p>Returns a reference to the model of this layer, or null if this layer has no model.</p>
|
175 | 885 | fjp | *
|
176 | 13201 | ppiqueras | * @return the model of this layer
|
177 | 884 | fernando | */
|
178 | 6881 | cesar | public MapContext getMapContext();
|
179 | 884 | fernando | |
180 | 513 | fjp | /**
|
181 | 13001 | ppiqueras | * Inserts the parent <code>FLayers</code> of the layer.
|
182 | 563 | fernando | *
|
183 | 13001 | ppiqueras | * @param root a <code>FLayers</code> object
|
184 | 563 | fernando | */
|
185 | public void setParentLayer(FLayers root); |
||
186 | |||
187 | /**
|
||
188 | 13001 | ppiqueras | * Returns the full extension of the layer.
|
189 | 513 | fjp | *
|
190 | 13001 | ppiqueras | * @return location and dimension of this layer
|
191 | 513 | fjp | *
|
192 | 13001 | ppiqueras | * @throws com.iver.cit.gvsig.fmap.DriverException if fails the driver used in this method.
|
193 | 513 | fjp | */
|
194 | 651 | fernando | Rectangle2D getFullExtent() throws DriverException; |
195 | 513 | fjp | |
196 | /**
|
||
197 | 13001 | ppiqueras | * Draws the layer using a buffer.
|
198 | 513 | fjp | *
|
199 | 13001 | ppiqueras | * @param image an image used to accelerate the screen draw
|
200 | * @param g a <code>Graphics2D</code> object that will allow the 2D draw
|
||
201 | * @param viewPort the view port where the layer will be drawn
|
||
202 | 13058 | ppiqueras | * @param cancel an object thread that implements the <code>Cancellable</code> interface, and will allow to cancel the draw
|
203 | 13001 | ppiqueras | * @param scale a double value that represents the scale
|
204 | 513 | fjp | *
|
205 | 13001 | ppiqueras | * @throws com.iver.cit.gvsig.fmap.DriverException if fails the driver used in this method.
|
206 | 563 | fernando | */
|
207 | void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
||
208 | 13001 | ppiqueras | Cancellable cancel, double scale) throws DriverException; |
209 | 563 | fernando | |
210 | /**
|
||
211 | 13116 | ppiqueras | * Prints this layer according to some properties requested.
|
212 | 563 | fernando | *
|
213 | 13001 | ppiqueras | * @param g a <code>Graphics2D</code> object that will allow the 2D draw
|
214 | * @param viewPort the view port where the layer will be drawn
|
||
215 | 13058 | ppiqueras | * @param cancel an object thread that implements the <code>Cancellable</code> interface, and will allow to cancel the draw
|
216 | 13001 | ppiqueras | * @param scale a double value that represents the scale
|
217 | * @param properties a set with the settings to be applied to a whole print job and to all the docs in the print job
|
||
218 | 563 | fernando | *
|
219 | 13001 | ppiqueras | * @throws com.iver.cit.gvsig.fmap.DriverException if fails the driver used in this method.
|
220 | 513 | fjp | */
|
221 | 9013 | caballero | void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintRequestAttributeSet properties) |
222 | 653 | fernando | throws DriverException;
|
223 | 727 | fernando | |
224 | 884 | fernando | /**
|
225 | 13001 | ppiqueras | * Inserts the transformation coordinates.
|
226 | 884 | fernando | *
|
227 | 13001 | ppiqueras | * @param ct transformation coordinates
|
228 | 885 | fjp | */
|
229 | void setCoordTrans(ICoordTrans ct);
|
||
230 | |||
231 | /**
|
||
232 | 13001 | ppiqueras | * Returns the transformation coordinates.
|
233 | 885 | fjp | *
|
234 | 13001 | ppiqueras | * @return transformation coordinates
|
235 | 885 | fjp | */
|
236 | ICoordTrans getCoordTrans(); |
||
237 | |||
238 | /**
|
||
239 | 13001 | ppiqueras | * Adds a LayerListener to the listener list.
|
240 | 885 | fjp | *
|
241 | 13001 | ppiqueras | * @param o a layer listener
|
242 | 884 | fernando | *
|
243 | 13001 | ppiqueras | * @return <code>true</code> if hasn't been any problem during the insertion of the listener
|
244 | 884 | fernando | */
|
245 | 727 | fernando | public boolean addLayerListener(LayerListener o); |
246 | 13001 | ppiqueras | |
247 | /**
|
||
248 | * Returns all LayerListener listeners of this layer as an array.
|
||
249 | *
|
||
250 | * @return an array with all layer listeners associated to this layer
|
||
251 | */
|
||
252 | 5908 | caballero | public LayerListener[] getLayerListeners(); |
253 | 13001 | ppiqueras | |
254 | 884 | fernando | /**
|
255 | 13001 | ppiqueras | * Removes the LayerListener parameter from this layer.
|
256 | 884 | fernando | *
|
257 | 13001 | ppiqueras | * @param o a layer listener
|
258 | 884 | fernando | *
|
259 | 13001 | ppiqueras | * @return <code>true</code> if hasn't been any problem doing this process
|
260 | 884 | fernando | */
|
261 | 727 | fernando | public boolean removeLayerListener(LayerListener o); |
262 | 5908 | caballero | |
263 | 13001 | ppiqueras | /**
|
264 | * <p>Returns <code>true</code> or <code>false</code> if the value of scale as parameter
|
||
265 | * is within the maximum and minimum scale of this layer.</p>
|
||
266 | *
|
||
267 | * @param scale the scale > 0
|
||
268 | *
|
||
269 | * @return <code>true</code> if the scale is within the range of scales of this layer, otherwise <code>false</code>
|
||
270 | */
|
||
271 | 2531 | caballero | public boolean isWithinScale(double scale); |
272 | 5908 | caballero | |
273 | 1176 | fjp | /**
|
274 | 13001 | ppiqueras | * Returns the minimum scale visible. Lower scales won't be drawn.
|
275 | *
|
||
276 | * @return the minimum scale > 0, -1 if not defined
|
||
277 | 1176 | fjp | */
|
278 | public double getMinScale(); |
||
279 | |||
280 | /**
|
||
281 | 13001 | ppiqueras | * Returns the maximum scale visible. Higher scales won't be drawn.
|
282 | *
|
||
283 | * @return the maximum scale > 0, -1 if not defined
|
||
284 | 1176 | fjp | */
|
285 | public double getMaxScale(); |
||
286 | 5908 | caballero | |
287 | 13001 | ppiqueras | /**
|
288 | * Sets the minimum scale visible. Lower scales won't be drawn.
|
||
289 | *
|
||
290 | * @param minScale the scale > 0, -1 if not defined
|
||
291 | */
|
||
292 | 1176 | fjp | public void setMinScale(double minScale); |
293 | 13001 | ppiqueras | |
294 | /**
|
||
295 | * Sets the maximum scale visible. Higher scales won't be drawn.
|
||
296 | *
|
||
297 | * @param maxScale the scale > 0, -1 if not defined
|
||
298 | */
|
||
299 | 1176 | fjp | public void setMaxScale(double maxScale); |
300 | 13001 | ppiqueras | |
301 | /**
|
||
302 | * Changes the status of the current layer to editable or not.
|
||
303 | *
|
||
304 | * @param b the boolean to be set
|
||
305 | *
|
||
306 | * @throws com.iver.cit.gvsig.fmap.edition.EditionException if fails enabling for edition this kind of layer.
|
||
307 | */
|
||
308 | 5152 | fjp | public void setEditing(boolean b) throws EditionException; |
309 | 13001 | ppiqueras | |
310 | /**
|
||
311 | 13201 | ppiqueras | * <p>Returns <code>true</code> if this layer is editable.</p>
|
312 | 13001 | ppiqueras | *
|
313 | * @return <code>true</code> if this layer is editable, otherwise <code>false</code>
|
||
314 | */
|
||
315 | 3690 | caballero | public boolean isEditing(); |
316 | 13001 | ppiqueras | |
317 | /**
|
||
318 | 13201 | ppiqueras | * <p>Uses or not a <code>BufferedImage</code> object that represents this image.</p>
|
319 | 13001 | ppiqueras | *
|
320 | 13201 | ppiqueras | * @return <code>true</code> if uses that kind of image, otherwise <code>false</code>
|
321 | 13001 | ppiqueras | */
|
322 | 5923 | fjp | public boolean isCachingDrawnLayers(); |
323 | 13001 | ppiqueras | |
324 | 5760 | jmvivo | /**
|
325 | 13001 | ppiqueras | * <p>Set <code>true</code> if you want this layer to store an image of previous layers.
|
326 | * Then, if you perform a <code>FLayers#invalidateLayer()</code>, the system will
|
||
327 | * redraw only this layers you are requesting.</p>
|
||
328 | *
|
||
329 | * @param bCacheDrawnLayers the boolean to be set
|
||
330 | */
|
||
331 | // * <p>Another option could be store an image of each layer drawn, and call each one using something
|
||
332 | // * like "invalidate()". On having rendered, it's possible to see if it's invalidated, and if itsn't,
|
||
333 | // * paste the cached image.</p>
|
||
334 | // *
|
||
335 | // * <p> ERROR!: You can't cache that image, because if the background has changed, the antialiasing
|
||
336 | // * will affect the draw of that layer. However, it would be useful draw the cached image of each layer
|
||
337 | // * that aren't invalidated, and from that appears one of them invalidated, the rest already have to draw.
|
||
338 | // * The problem is that continues spending more memory</p>
|
||
339 | // *
|
||
340 | // * @param bCacheDrawnLayers
|
||
341 | // */
|
||
342 | 5923 | fjp | public void setCachingDrawnLayers(boolean bCacheDrawnLayers); |
343 | |||
344 | /**
|
||
345 | 13001 | ppiqueras | * Returns the image icon that will be shown in the TOC next to this layer.
|
346 | *
|
||
347 | * @return a reference to the image icon, or <code>null</code> if there isn't any
|
||
348 | 5760 | jmvivo | */
|
349 | public ImageIcon getTocImageIcon(); |
||
350 | 5802 | jaume | |
351 | /**
|
||
352 | 13001 | ppiqueras | * <p>Returns <code>true</code> or <code>false</code> if this layer appears or not in the TOC.</p>
|
353 | * <p>If doesn't appears, remains in the view and in the project.</p>
|
||
354 | *
|
||
355 | * @return
|
||
356 | 5802 | jaume | */
|
357 | boolean isInTOC();
|
||
358 | 5923 | fjp | |
359 | /**
|
||
360 | 13001 | ppiqueras | * <p>Returns <code>true</code> or <code>false</code> if this layer needs or doesn't need a repaint.
|
361 | *
|
||
362 | 5923 | fjp | * @return true if this layer need a repaint.
|
363 | */
|
||
364 | public boolean isDirty(); |
||
365 | |||
366 | /**
|
||
367 | 13001 | ppiqueras | * <p>Changes the status of this layer to dirty if needs a repaint.</p>
|
368 | *
|
||
369 | * <p>By default, all layers will be set to dirty when the extent changes. But for events like changing
|
||
370 | * its legend, or editing a layer, we could perform some optimization using the private method <code>MapContext#prepareDrawing</code> from <code>MapContext</code>.</p>
|
||
371 | *
|
||
372 | * @param dirty <code>true</code> if this layer needs a repaint
|
||
373 | 5923 | fjp | */
|
374 | public void setDirty(boolean dirty); |
||
375 | 13001 | ppiqueras | |
376 | /**
|
||
377 | 13201 | ppiqueras | * Returns the image with bands, of the drawn layers.
|
378 | 13001 | ppiqueras | *
|
379 | 13201 | ppiqueras | * @return an image with bands
|
380 | 13001 | ppiqueras | */
|
381 | 5923 | fjp | public BufferedImage getCacheImageDrawnLayers(); |
382 | |||
383 | 13001 | ppiqueras | /**
|
384 | 13201 | ppiqueras | * Sets the image with bands, for the drawn layers.
|
385 | 13001 | ppiqueras | *
|
386 | 13201 | ppiqueras | * @param cacheImageDrawnLayers an image with bands
|
387 | 13001 | ppiqueras | */
|
388 | 5923 | fjp | public void setCacheImageDrawnLayers(BufferedImage cacheImageDrawnLayers); |
389 | 6531 | jmvivo | |
390 | /**
|
||
391 | 13001 | ppiqueras | * Returns the status of this layer.
|
392 | *
|
||
393 | * @return the status stored in a <code>FLayerStatus</code> object
|
||
394 | 8765 | jjdelcerro | */
|
395 | public FLayerStatus getFLayerStatus();
|
||
396 | 13001 | ppiqueras | |
397 | 8765 | jjdelcerro | /**
|
398 | 13001 | ppiqueras | * Sets the status of this layer.
|
399 | *
|
||
400 | * @param status information of the status for this layer
|
||
401 | 8765 | jjdelcerro | */
|
402 | public void setFLayerStatus(FLayerStatus status); |
||
403 | 13001 | ppiqueras | |
404 | 8765 | jjdelcerro | /*
|
405 | * This stuff is to save error's info that causes
|
||
406 | * unavailable status.
|
||
407 | * */
|
||
408 | /**
|
||
409 | 13001 | ppiqueras | * Returns <code>true</code> if this layer is in OK status (it hasn't got errors).
|
410 | *
|
||
411 | * @return <code>true</code> if is in OK status, otherwise <code>false</code>
|
||
412 | 8765 | jjdelcerro | */
|
413 | public boolean isOk(); |
||
414 | 13001 | ppiqueras | |
415 | 8765 | jjdelcerro | /**
|
416 | 13201 | ppiqueras | * Returns the number of errors which causes this layer to be in unavailable status.
|
417 | 13001 | ppiqueras | *
|
418 | * @return number of errors >= 0
|
||
419 | 8765 | jjdelcerro | */
|
420 | public int getNumErrors(); |
||
421 | |||
422 | /**
|
||
423 | 13001 | ppiqueras | * Returns the specified error.
|
424 | *
|
||
425 | * @param i index of the error >= 0 && < <code>getNumErrors</code>
|
||
426 | *
|
||
427 | * @return a singular error
|
||
428 | 8765 | jjdelcerro | */
|
429 | public DriverException getError(int i); |
||
430 | |||
431 | /**
|
||
432 | 13001 | ppiqueras | * Adds an error reason that describes this layer's wrong status.
|
433 | *
|
||
434 | * @param error a <code>DriverException</code> with the information of the error
|
||
435 | 8765 | jjdelcerro | */
|
436 | public void addError(DriverException error); |
||
437 | |||
438 | /**
|
||
439 | 13001 | ppiqueras | * Returns a list with all layer errors.
|
440 | *
|
||
441 | * @return an <code>ArrayList</code> with the errors
|
||
442 | 8765 | jjdelcerro | */
|
443 | public List getErrors(); |
||
444 | |||
445 | /**
|
||
446 | 13001 | ppiqueras | * Changes the status of the current layer to available or not. By default it's <code>true</code>.
|
447 | *
|
||
448 | * @param the boolean to be set
|
||
449 | 6531 | jmvivo | */
|
450 | 6543 | jmvivo | public void setAvailable(boolean available); |
451 | 5923 | fjp | |
452 | 13201 | ppiqueras | /**
|
453 | * Returns the status of availability of the current layer.
|
||
454 | 6531 | jmvivo | *
|
455 | 13201 | ppiqueras | * @return <code>true</code> if the source of data is on-line, otherwise <code>false</code>
|
456 | 6531 | jmvivo | */
|
457 | 6543 | jmvivo | public boolean isAvailable(); |
458 | 6531 | jmvivo | |
459 | /**
|
||
460 | 13001 | ppiqueras | * <p>Tries recover a layer of a possible error.</p>
|
461 | * <p>If it has any problem during the load, marks the availability
|
||
462 | * to false and throws an exception.</p>
|
||
463 | 6531 | jmvivo | *
|
464 | 13001 | ppiqueras | * @throws DriverIOException if it's thrown a <code>DriverException</code> or an <code>IOException</code> during the load of this layer.
|
465 | 6531 | jmvivo | */
|
466 | public void reload() throws DriverIOException; |
||
467 | 13201 | ppiqueras | |
468 | 6531 | jmvivo | /**
|
469 | 13001 | ppiqueras | * Returns <code>true</code> if this layer has the visible status enabled.
|
470 | 6531 | jmvivo | *
|
471 | 13201 | ppiqueras | * @return <code>true</code> if visible this layer has the visible status enabled, otherwise <code>false</code>
|
472 | 6531 | jmvivo | */
|
473 | boolean visibleRequired();
|
||
474 | |||
475 | /**
|
||
476 | 13001 | ppiqueras | * Returns an string with the information of this layer.
|
477 | 6531 | jmvivo | *
|
478 | 13001 | ppiqueras | * @return the string that is to be this component's information
|
479 | 6531 | jmvivo | */
|
480 | public String getInfoString(); |
||
481 | 13201 | ppiqueras | |
482 | 6856 | fjp | /**
|
483 | 13201 | ppiqueras | * Returns the writing status of this layer.
|
484 | 13001 | ppiqueras | *
|
485 | 13201 | ppiqueras | * @return <code>true</code> if there is a writing driver for this layer, otherwise <code>false</code>
|
486 | 6856 | fjp | */
|
487 | public boolean isWritable(); |
||
488 | 13201 | ppiqueras | |
489 | 8765 | jjdelcerro | /**
|
490 | 13001 | ppiqueras | * <p>Returns a reference to an object (property) associated to this layer.</p>
|
491 | 8765 | jjdelcerro | *
|
492 | 13001 | ppiqueras | * <p>For example, you can attach a network definition to key "network" and check
|
493 | * if a layer has a network loaded using <i>getAssociatedObject("network")</i> and
|
||
494 | * that it's not null.</p>
|
||
495 | *
|
||
496 | * @param key the key associated to the property
|
||
497 | *
|
||
498 | * @return <code>null</code> if key is not found
|
||
499 | 8765 | jjdelcerro | */
|
500 | public Object getProperty(Object key); |
||
501 | 13201 | ppiqueras | |
502 | 8765 | jjdelcerro | /**
|
503 | 13001 | ppiqueras | * Insets an object as a property to this layer.
|
504 | *
|
||
505 | * @param key the key associated to the property
|
||
506 | * @param obj the property
|
||
507 | 8765 | jjdelcerro | */
|
508 | public void setProperty(Object key, Object obj); |
||
509 | 6531 | jmvivo | |
510 | 9225 | fjp | /**
|
511 | 13001 | ppiqueras | * <p>This method can be used to have a fast cloned layer.</p>
|
512 | * <p>The implementations should take care of not recreate this layer. Instead of this,
|
||
513 | * is better to use the same source (driver) and <i>deepclone</i> the legend. Exception:
|
||
514 | * the labels aren't <i>deepcloned</i> to avoid memory consumption.</p>
|
||
515 | * <p><i>Note</i>: Labels are memory consuming to speed up layers like PostGIS and so on.</p>
|
||
516 | *
|
||
517 | * @return a layer that is a clonation of this layer
|
||
518 | *
|
||
519 | * @throws java.lang.Exception any exception produced during the cloning of this layer, will be thrown.
|
||
520 | 9225 | fjp | */
|
521 | public FLayer cloneLayer() throws Exception; |
||
522 | 9359 | fdiaz | |
523 | 13001 | ppiqueras | /**
|
524 | * Returns a hash map with all new properties associated to this layer.
|
||
525 | *
|
||
526 | * @return hash table with the added properties
|
||
527 | */
|
||
528 | 9359 | fdiaz | public Map getExtendedProperties(); |
529 | 10401 | fjp | |
530 | /**
|
||
531 | 13001 | ppiqueras | * <p>Returns a new instance of ComposedLayer.</p>
|
532 | 11030 | jmvivo | *
|
533 | 13001 | ppiqueras | * <p>This allows make a single draw for a group
|
534 | * of layers with the same source.</p>
|
||
535 | 11030 | jmvivo | *
|
536 | 13001 | ppiqueras | * <p>If this operation isn't applicable for this
|
537 | * kind of layer, this method returns null.</p>
|
||
538 | *
|
||
539 | * <p>By default this operation is not supported.</p>
|
||
540 | *
|
||
541 | 11030 | jmvivo | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer
|
542 | 13001 | ppiqueras | *
|
543 | * @return a new composed layer or <code>null</code> if not supported
|
||
544 | 11030 | jmvivo | */
|
545 | 13001 | ppiqueras | public ComposedLayer newComposedLayer();
|
546 | 11030 | jmvivo | |
547 | /**
|
||
548 | 13116 | ppiqueras | * Returns the image icon that will be shown in the TOC next to this layer, according its status.
|
549 | 13001 | ppiqueras | *
|
550 | * @return the image
|
||
551 | 10401 | fjp | */
|
552 | Image getTocStatusImage();
|
||
553 | 9359 | fdiaz | |
554 | 11925 | maquerol | /**
|
555 | 13116 | ppiqueras | * Returns <code>true</code> if the projection of the layer can be changed.
|
556 | 13001 | ppiqueras | *
|
557 | 13116 | ppiqueras | * @return <code>true</code> if can be changed its projection, otherwise <code>false</code>
|
558 | 11925 | maquerol | */
|
559 | public boolean isReprojectable(); |
||
560 | |||
561 | /**
|
||
562 | 13116 | ppiqueras | * <p>Changes the projection of this layer.</p>
|
563 | 13001 | ppiqueras | * <p>This method will be overload in each kind of layer, according its specific operations</p>
|
564 | *
|
||
565 | * @param mapC object that will allow work with the image (draw, reproject, transform, store information, ...)
|
||
566 | *
|
||
567 | * @return <true> if the layer is created with the method {@link FLayers#addLayer(FLayer)}, but returns <code>false</code>
|
||
568 | * if the layer load control is passed to the reprojection method
|
||
569 | 11925 | maquerol | */
|
570 | 11937 | maquerol | public boolean reProject(MapControl mapC); |
571 | 11925 | maquerol | |
572 | /**
|
||
573 | 13001 | ppiqueras | * Inserts the projection to this layer.
|
574 | *
|
||
575 | * @param proj information about the new projection
|
||
576 | 11925 | maquerol | */
|
577 | public void setProjection(IProjection proj); |
||
578 | 214 | fernando | } |