svn-gvsig-desktop / branches / dal_time_support / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / layers / operations / LayerCollection.java @ 35116
History | View | Annotate | Download (8.31 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
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 |
* Av. Blasco Ib??ez, 50
|
24 |
* 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 |
package org.gvsig.fmap.mapcontext.layers.operations; |
42 |
|
43 |
import java.awt.Graphics2D; |
44 |
|
45 |
import org.gvsig.fmap.mapcontext.ViewPort; |
46 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
47 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
48 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
49 |
import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener; |
50 |
|
51 |
|
52 |
|
53 |
/**
|
54 |
* <p>Interface with methods for a collection of layers.</p>
|
55 |
*/
|
56 |
public interface LayerCollection extends LayersVisitable { |
57 |
|
58 |
/**
|
59 |
* Value used to specify the insertion at the beginning.
|
60 |
*/
|
61 |
public final static int BEGIN = 0; |
62 |
/**
|
63 |
* Value used to specify the insertion at the end.
|
64 |
*/
|
65 |
public final static int END = 1; |
66 |
/**
|
67 |
* Value used to specify the insertion before an element.
|
68 |
*/
|
69 |
public final static int BEFORE = 2; |
70 |
/**
|
71 |
* Value used to specify the insertion after an element.
|
72 |
*/
|
73 |
public final static int AFTER = 3; |
74 |
|
75 |
/**
|
76 |
* <p>Adds a listener of events produced on a collection of layers.</p>
|
77 |
*
|
78 |
* @param listener a <code>LayerCollectionListener</code>
|
79 |
*
|
80 |
* @see #removeLayerCollectionListener(LayerCollectionListener)
|
81 |
*/
|
82 |
public void addLayerCollectionListener(LayerCollectionListener listener); |
83 |
|
84 |
/**
|
85 |
* <p>Removes a listener of events produced on a collection of layers.</p>
|
86 |
*
|
87 |
* @param listener a <code>LayerCollectionListener</code>
|
88 |
*
|
89 |
* @see #addLayerCollectionListener(LayerCollectionListener)
|
90 |
*/
|
91 |
public void removeLayerCollectionListener(LayerCollectionListener listener); |
92 |
|
93 |
/**
|
94 |
* <p>Adds a new layer to this collection.</p>
|
95 |
*
|
96 |
* @param layer the new layer
|
97 |
*
|
98 |
* @throws CancelationException any exception produced during the cancellation of the driver.
|
99 |
* @throws LoadLayerException any exception produced loading the layer.
|
100 |
*
|
101 |
* @see #removeLayer(FLayer)
|
102 |
* @see #removeLayer(int)
|
103 |
* @see #removeLayer(String)
|
104 |
*/
|
105 |
public void addLayer(FLayer layer) throws CancelationException, LoadLayerException; |
106 |
|
107 |
/**
|
108 |
* <p>Adds a new layer to this collection before or after an element if supplied,
|
109 |
* and if not at the beginning or end of the collection.</p>.</p>
|
110 |
*
|
111 |
* @param layer a FLayer to move
|
112 |
* @param group a LayerCollection in which the layer has to be moved
|
113 |
* @param where the position parameter. The valid values are:<br>
|
114 |
* 0 = BEGIN (first position)<br>
|
115 |
* 1 = END (last position)<br>
|
116 |
* 2 = BEFORE (before target layer)<br>
|
117 |
* 3 = AFTER (after target layer)<br>
|
118 |
*
|
119 |
* @param adjoiningLayer a FLayer a layer adjacent to where to insert the layer.
|
120 |
*
|
121 |
* @throws CancelationException any exception produced during the cancellation of the driver.
|
122 |
* @throws LoadLayerException any exception produced loading the layer.
|
123 |
*
|
124 |
* @see #moveTo(FLayer, LayerCollection, int, FLayer)
|
125 |
*/
|
126 |
public void addLayer(FLayer layer, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException ; |
127 |
|
128 |
/**
|
129 |
* <p>Moves a layer of the collection to another position in internal list. It doesn't consider sub-nodes of layers.</p>
|
130 |
*
|
131 |
* @param from origin position
|
132 |
* @param to destination position
|
133 |
*
|
134 |
* @throws CancelationException any exception produced during the cancellation of the driver.
|
135 |
*/
|
136 |
public void moveTo(int from, int to) throws CancelationException; |
137 |
|
138 |
/**
|
139 |
* <p>Removes a layer from this collection.</p>
|
140 |
*
|
141 |
* @param lyr a layer
|
142 |
*
|
143 |
* @throws CancelationException any exception produced during the cancellation of the driver.
|
144 |
*
|
145 |
* @see #removeLayer(int)
|
146 |
* @see #removeLayer(String)
|
147 |
* @see #addLayer(FLayer)
|
148 |
*/
|
149 |
public void removeLayer(FLayer lyr) throws CancelationException; |
150 |
|
151 |
/**
|
152 |
* <p>Removes a layer using its identifier.</p>
|
153 |
*
|
154 |
* @param idLayer layer identifier
|
155 |
*
|
156 |
* @see #removeLayer(FLayer)
|
157 |
* @see #removeLayer(String)
|
158 |
* @see #addLayer(FLayer)
|
159 |
*/
|
160 |
public void removeLayer(int idLayer); |
161 |
|
162 |
/**
|
163 |
* <p>Removes a layer using its name.</p>
|
164 |
*
|
165 |
* @param layerName the name of the layer
|
166 |
*
|
167 |
* @see #removeLayer(FLayer)
|
168 |
* @see #removeLayer(int)
|
169 |
* @see #addLayer(FLayer)
|
170 |
*/
|
171 |
public void removeLayer(String layerName); |
172 |
|
173 |
/**
|
174 |
* <p>Returns an array with all visible layers in this collection.</p>
|
175 |
*
|
176 |
* @return array with first-level visible layer nodes, or <code>null</code> if no there is no layer visible
|
177 |
*
|
178 |
* @see #setAllVisibles(boolean)
|
179 |
*/
|
180 |
public FLayer[] getVisibles(); |
181 |
|
182 |
/**
|
183 |
* <p>Returns an array with all active layers in this collection.</p>
|
184 |
*
|
185 |
* @return array with first-level active layer nodes, or <code>null</code> if no there is no layer actived
|
186 |
*
|
187 |
* @see #setAllActives(boolean)
|
188 |
*/
|
189 |
public FLayer[] getActives(); |
190 |
|
191 |
/**
|
192 |
* <p>Returns the ith-output directed son (from bottom up) of this collection.</p>
|
193 |
*
|
194 |
* @param index index of the ith-output layer in this collection.
|
195 |
*
|
196 |
* @return a layer
|
197 |
*
|
198 |
* @see #getLayer(String)
|
199 |
*/
|
200 |
public FLayer getLayer(int index); |
201 |
|
202 |
/**
|
203 |
* <p>Returns a first-level layer of this collection, using its name.</p>
|
204 |
*
|
205 |
* @param layerName name of a layer of this collection
|
206 |
*
|
207 |
* @return a layer
|
208 |
*
|
209 |
* @see #getLayer(int)
|
210 |
*/
|
211 |
public FLayer getLayer(String layerName); |
212 |
|
213 |
/**
|
214 |
* <p>Returns the number of layers that are at the first level inside this one.</p>
|
215 |
*
|
216 |
* <p>Doesn't counts the sublayers (of <code>FLayers</code> subnodes).</p>
|
217 |
*
|
218 |
* @return number >= 0 with layers that are at the same first-level
|
219 |
*
|
220 |
* @see #getLayer(int)
|
221 |
* @see #getLayer(String)
|
222 |
*/
|
223 |
public int getLayersCount(); |
224 |
|
225 |
/**
|
226 |
* <p>Changes the status of all layers to active or inactive.</p>
|
227 |
*
|
228 |
* @param active a boolean value
|
229 |
*
|
230 |
* @see #getActives()
|
231 |
*/
|
232 |
public void setAllActives(boolean active); |
233 |
|
234 |
/**
|
235 |
* <p>Changes the status of all layers to visible or invisible.</p>
|
236 |
*
|
237 |
* @param visible a boolean value
|
238 |
*
|
239 |
* @see #getVisibles()
|
240 |
*/
|
241 |
public void setAllVisibles(boolean visible); |
242 |
|
243 |
|
244 |
public void beginDraw(Graphics2D g, ViewPort viewPort); |
245 |
public void endDraw(Graphics2D g, ViewPort viewPort); |
246 |
|
247 |
/**
|
248 |
* <p>Moves a layer from this collection to another collection
|
249 |
* before or after an element if supplied,
|
250 |
* and if not at the beginning or end of the collection.</p>
|
251 |
*
|
252 |
* @param layer a FLayer to move
|
253 |
* @param group a LayerCollection in which the layer has to be moved
|
254 |
* @param where the position parameter. The valid values are:<br>
|
255 |
* 0 = BEGIN (first position)<br>
|
256 |
* 1 = END (last position)<br>
|
257 |
* 2 = BEFORE (before target layer)<br>
|
258 |
* 3 = AFTER (after target layer)<br>
|
259 |
*
|
260 |
* @param adjoiningLayer a FLayer a layer adjacent to where to insert the layer.
|
261 |
* @throws LayerNotFoundInCollectionException
|
262 |
*
|
263 |
* @see #addLayer(FLayer, int, FLayer)
|
264 |
*/
|
265 |
public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException; |
266 |
|
267 |
/**
|
268 |
* <p>Moves a layer from this collection to the end of another collection.</p>
|
269 |
*
|
270 |
* @param layer a FLayer to move
|
271 |
* @param group a LayerCollection in which the layer has to be moved
|
272 |
* @throws LayerNotFoundInCollectionException
|
273 |
*
|
274 |
*/
|
275 |
public void move(FLayer layer, LayerCollection group); |
276 |
|
277 |
|
278 |
} |