root / tags / v1_1_Build_1001 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / AtomicEvent.java @ 11984
History | View | Annotate | Download (5.11 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 com.iver.cit.gvsig.fmap; |
42 |
|
43 |
import com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent; |
44 |
import com.iver.cit.gvsig.fmap.layers.LayerEvent; |
45 |
import com.iver.cit.gvsig.fmap.layers.LegendEvent; |
46 |
import com.iver.cit.gvsig.fmap.layers.SelectionEvent; |
47 |
|
48 |
import java.util.ArrayList; |
49 |
import java.util.Iterator; |
50 |
|
51 |
|
52 |
/**
|
53 |
* Evento.
|
54 |
*/
|
55 |
public class AtomicEvent extends FMapEvent { |
56 |
private ArrayList events; |
57 |
|
58 |
/**
|
59 |
* Crea un nuevo AtomicEvent.
|
60 |
*
|
61 |
* @param fmapEvents ArrayList de FMapEvent.
|
62 |
*/
|
63 |
public AtomicEvent(ArrayList fmapEvents) { |
64 |
this.events = (ArrayList) fmapEvents.clone(); |
65 |
} |
66 |
|
67 |
/**
|
68 |
* Devuelve el FMapEvent a partir de un ?ndice.
|
69 |
*
|
70 |
* @param index ?ndice.
|
71 |
*
|
72 |
* @return FMapEvent.
|
73 |
*/
|
74 |
public FMapEvent getEvent(int index) { |
75 |
return (FMapEvent) events.get(index);
|
76 |
} |
77 |
|
78 |
/**
|
79 |
* Devuelve el n?mero de eventos.
|
80 |
*
|
81 |
* @return N?mero de eventos.
|
82 |
*/
|
83 |
public int getEventCount() { |
84 |
return events.size();
|
85 |
} |
86 |
|
87 |
/**
|
88 |
* Devuelve un vector con los eventos de leyenda.
|
89 |
*
|
90 |
* @return Vector de eventos de leyenda.
|
91 |
*/
|
92 |
public LegendEvent[] getLegendEvents() { |
93 |
ArrayList ret = new ArrayList(); |
94 |
|
95 |
for (Iterator iter = events.iterator(); iter.hasNext();) { |
96 |
FMapEvent event = (FMapEvent) iter.next(); |
97 |
|
98 |
if (event instanceof LegendEvent) { |
99 |
ret.add(event); |
100 |
} |
101 |
} |
102 |
|
103 |
return (LegendEvent[]) ret.toArray(new LegendEvent[0]); |
104 |
} |
105 |
|
106 |
/**
|
107 |
* Devuelve un vector con los eventos de colecciones de capas.
|
108 |
*
|
109 |
* @return vector con los eventos de colecciones de capas.
|
110 |
*/
|
111 |
public LayerCollectionEvent[] getLayerCollectionEvents() { |
112 |
ArrayList ret = new ArrayList(); |
113 |
|
114 |
for (Iterator iter = events.iterator(); iter.hasNext();) { |
115 |
FMapEvent event = (FMapEvent) iter.next(); |
116 |
|
117 |
if (event instanceof LayerCollectionEvent) { |
118 |
ret.add(event); |
119 |
} |
120 |
} |
121 |
|
122 |
return (LayerCollectionEvent[]) ret.toArray(new LayerCollectionEvent[0]); |
123 |
} |
124 |
|
125 |
/**
|
126 |
* Devuelve un vector con los eventos de selecci?n.
|
127 |
*
|
128 |
* @return vector de eventos de selecci?n.
|
129 |
*/
|
130 |
public SelectionEvent[] getSelectionEvents() { |
131 |
ArrayList ret = new ArrayList(); |
132 |
|
133 |
for (Iterator iter = events.iterator(); iter.hasNext();) { |
134 |
FMapEvent event = (FMapEvent) iter.next(); |
135 |
|
136 |
if (event instanceof SelectionEvent) { |
137 |
ret.add(event); |
138 |
} |
139 |
} |
140 |
|
141 |
return (SelectionEvent[]) ret.toArray(new SelectionEvent[0]); |
142 |
} |
143 |
|
144 |
/**
|
145 |
* Devuelve un vector con los eventos de extent.
|
146 |
*
|
147 |
* @return vector con los eventos de extent.
|
148 |
*/
|
149 |
public ExtentEvent[] getExtentEvents() { |
150 |
ArrayList ret = new ArrayList(); |
151 |
|
152 |
for (Iterator iter = events.iterator(); iter.hasNext();) { |
153 |
FMapEvent event = (FMapEvent) iter.next(); |
154 |
|
155 |
if (event instanceof ExtentEvent) { |
156 |
ret.add(event); |
157 |
} |
158 |
} |
159 |
|
160 |
return (ExtentEvent[]) ret.toArray(new ExtentEvent[0]); |
161 |
} |
162 |
|
163 |
/**
|
164 |
* Devuelve un vector con los eventos de capa.
|
165 |
*
|
166 |
* @return vector con los eventos de capa.
|
167 |
*/
|
168 |
public LayerEvent[] getLayerEvents() { |
169 |
ArrayList ret = new ArrayList(); |
170 |
|
171 |
for (Iterator iter = events.iterator(); iter.hasNext();) { |
172 |
FMapEvent event = (FMapEvent) iter.next(); |
173 |
|
174 |
if (event instanceof LayerEvent) { |
175 |
ret.add(event); |
176 |
} |
177 |
} |
178 |
|
179 |
return (LayerEvent[]) ret.toArray(new LayerEvent[0]); |
180 |
} |
181 |
|
182 |
/**
|
183 |
* Devuelve un vector con los eventos de color.
|
184 |
*
|
185 |
* @return vector con los eventos de color.
|
186 |
*/
|
187 |
public ColorEvent[] getColorEvents() { |
188 |
ArrayList ret = new ArrayList(); |
189 |
|
190 |
for (Iterator iter = events.iterator(); iter.hasNext();) { |
191 |
FMapEvent event = (FMapEvent) iter.next(); |
192 |
|
193 |
if (event instanceof ColorEvent) { |
194 |
ret.add(event); |
195 |
} |
196 |
} |
197 |
|
198 |
return (ColorEvent[]) ret.toArray(new ColorEvent[0]); |
199 |
} |
200 |
/**
|
201 |
* Devuelve un vector con los eventos de proyeccion.
|
202 |
*
|
203 |
* @return vector con los eventos de proyeccion.
|
204 |
*/
|
205 |
|
206 |
public ProjectionEvent[] getProjectionEvents() { |
207 |
ArrayList ret = new ArrayList(); |
208 |
|
209 |
for (Iterator iter = events.iterator(); iter.hasNext();) { |
210 |
FMapEvent event = (FMapEvent) iter.next(); |
211 |
|
212 |
if (event instanceof ProjectionEvent) { |
213 |
ret.add(event); |
214 |
} |
215 |
} |
216 |
|
217 |
return (ProjectionEvent[]) ret.toArray(new ProjectionEvent[0]); |
218 |
} |
219 |
|
220 |
} |