root / tags / v1_0_1_RELEASE / extensions / extCAD / src / com / iver / cit / gvsig / layers / VectorialLayerEdited.java @ 9531
History | View | Annotate | Download (16.9 KB)
1 |
package com.iver.cit.gvsig.layers; |
---|---|
2 |
|
3 |
import java.awt.Graphics2D; |
4 |
import java.awt.Image; |
5 |
import java.awt.geom.Point2D; |
6 |
import java.awt.geom.Rectangle2D; |
7 |
import java.awt.image.BufferedImage; |
8 |
import java.io.IOException; |
9 |
import java.util.ArrayList; |
10 |
import java.util.EmptyStackException; |
11 |
|
12 |
import com.iver.andami.PluginServices; |
13 |
import com.iver.cit.gvsig.CADExtension; |
14 |
import com.iver.cit.gvsig.StartEditing; |
15 |
import com.iver.cit.gvsig.ViewCommandStackExtension; |
16 |
import com.iver.cit.gvsig.fmap.DriverException; |
17 |
import com.iver.cit.gvsig.fmap.ViewPort; |
18 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
19 |
import com.iver.cit.gvsig.fmap.core.Handler; |
20 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
21 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
22 |
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities; |
23 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
24 |
import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited; |
25 |
import com.iver.cit.gvsig.fmap.edition.IEditableSource; |
26 |
import com.iver.cit.gvsig.fmap.edition.IRowEdited; |
27 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
28 |
import com.iver.cit.gvsig.fmap.layers.CancelationException; |
29 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
30 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
31 |
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation; |
32 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
33 |
import com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent; |
34 |
import com.iver.cit.gvsig.fmap.layers.LayerCollectionListener; |
35 |
import com.iver.cit.gvsig.fmap.layers.LayerDrawEvent; |
36 |
import com.iver.cit.gvsig.fmap.layers.LayerDrawingListener; |
37 |
import com.iver.cit.gvsig.fmap.layers.LayerEvent; |
38 |
import com.iver.cit.gvsig.fmap.layers.LayerPositionEvent; |
39 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
40 |
import com.iver.cit.gvsig.gui.cad.CADTool; |
41 |
import com.iver.cit.gvsig.gui.cad.CADToolAdapter; |
42 |
import com.iver.cit.gvsig.gui.cad.snapping.ISnapper; |
43 |
import com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool; |
44 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
45 |
import com.vividsolutions.jts.geom.Geometry; |
46 |
|
47 |
public class VectorialLayerEdited extends DefaultLayerEdited implements LayerDrawingListener{ |
48 |
private ArrayList selectedHandler = new ArrayList(); |
49 |
private ArrayList selectedRow = new ArrayList(); |
50 |
private Point2D lastPoint; |
51 |
private Point2D firstPoint; |
52 |
private CADTool cadtool=null; |
53 |
|
54 |
private ArrayList snappers = new ArrayList(); |
55 |
private ArrayList layersToSnap = new ArrayList(); |
56 |
private Legend legend;
|
57 |
|
58 |
public VectorialLayerEdited(FLayer lyr)
|
59 |
{ |
60 |
super(lyr);
|
61 |
lyr.getMapContext().addLayerDrawingListener(this);
|
62 |
// Por defecto, siempre hacemos snapping sobre la capa en edici?n.
|
63 |
layersToSnap.add(lyr); |
64 |
} |
65 |
|
66 |
public ArrayList getSelectedHandler() { |
67 |
return selectedHandler;
|
68 |
} |
69 |
|
70 |
public ArrayList getSelectedRow() { |
71 |
return selectedRow;
|
72 |
} |
73 |
|
74 |
public void clearSelection() { |
75 |
selectedHandler.clear(); |
76 |
selectedRow.clear(); |
77 |
if (getVEA() != null) |
78 |
{ |
79 |
FBitSet selection=getVEA().getSelection(); |
80 |
selection.clear(); |
81 |
} |
82 |
} |
83 |
/**
|
84 |
* @return Returns the selectedRow.
|
85 |
*/
|
86 |
public IFeature[] getSelectedRowsCache() { |
87 |
return (IFeature[]) selectedRow.toArray(new IFeature[0]); |
88 |
} |
89 |
public void selectWithPoint(double x, double y,boolean multipleSelection){ |
90 |
firstPoint = new Point2D.Double(x, y); |
91 |
VectorialEditableAdapter vea = getVEA(); |
92 |
FBitSet selection = vea.getSelection(); |
93 |
if (!multipleSelection) {
|
94 |
clearSelection(); |
95 |
} |
96 |
// Se comprueba si se pincha en una gemometr?a
|
97 |
ViewPort vp=getLayer().getMapContext().getViewPort(); |
98 |
double tam =vp.toMapDistance(SelectionCADTool.tolerance);
|
99 |
Rectangle2D rect = new Rectangle2D.Double(firstPoint.getX() - tam, |
100 |
firstPoint.getY() - tam, tam * 2, tam * 2); |
101 |
|
102 |
String strEPSG = vp.getProjection().getAbrev().substring(5); |
103 |
IRowEdited[] feats;
|
104 |
|
105 |
try {
|
106 |
feats = vea.getFeatures(rect, strEPSG); |
107 |
selection.clear(); |
108 |
BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
109 |
Graphics2D gs = selectionImage.createGraphics();
|
110 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
111 |
Graphics2D gh = handlersImage.createGraphics();
|
112 |
for (int i = 0; i < feats.length; i++) { |
113 |
IFeature feat = (IFeature) feats[i].getLinkedRow(); |
114 |
IGeometry geom = feat.getGeometry(); |
115 |
|
116 |
if (geom.intersects(rect)) { // , 0.1)){ |
117 |
selection.set(feats[i].getIndex(), true);
|
118 |
selectedRow.add(feats[i]); |
119 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
120 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
121 |
} |
122 |
} |
123 |
vea.setSelectionImage(selectionImage); |
124 |
vea.setHandlersImage(handlersImage); |
125 |
} catch (DriverException e1) {
|
126 |
e1.printStackTrace(); |
127 |
} |
128 |
|
129 |
} |
130 |
public void selectWithSecondPoint(double x, double y) { |
131 |
VectorialEditableAdapter vea = getVEA(); |
132 |
FBitSet selection = vea.getSelection(); |
133 |
lastPoint = new Point2D.Double(x, y); |
134 |
ViewPort vp=getLayer().getMapContext().getViewPort(); |
135 |
selection.clear(); |
136 |
selectedRow.clear(); |
137 |
|
138 |
double x1;
|
139 |
double y1;
|
140 |
double w1;
|
141 |
double h1;
|
142 |
|
143 |
if (firstPoint.getX() < lastPoint.getX()) {
|
144 |
x1 = firstPoint.getX(); |
145 |
w1 = lastPoint.getX() - firstPoint.getX(); |
146 |
} else {
|
147 |
x1 = lastPoint.getX(); |
148 |
w1 = firstPoint.getX() - lastPoint.getX(); |
149 |
} |
150 |
|
151 |
if (firstPoint.getY() < lastPoint.getY()) {
|
152 |
y1 = firstPoint.getY(); |
153 |
h1 = lastPoint.getY() - firstPoint.getY(); |
154 |
} else {
|
155 |
y1 = lastPoint.getY(); |
156 |
h1 = firstPoint.getY() - lastPoint.getY(); |
157 |
} |
158 |
|
159 |
Rectangle2D rect = new Rectangle2D.Double(x1, y1, w1, h1); |
160 |
|
161 |
String strEPSG = vp.getProjection().getAbrev().substring(5); |
162 |
IRowEdited[] feats;
|
163 |
try {
|
164 |
feats = vea.getFeatures(rect, strEPSG); |
165 |
BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
166 |
Graphics2D gs = selectionImage.createGraphics();
|
167 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
168 |
Graphics2D gh = handlersImage.createGraphics();
|
169 |
for (int i = 0; i < feats.length; i++) { |
170 |
IGeometry geom = ((IFeature) feats[i].getLinkedRow()) |
171 |
.getGeometry(); |
172 |
|
173 |
if (firstPoint.getX() < lastPoint.getX()) {
|
174 |
if (rect.contains(geom.getBounds2D())) {
|
175 |
selectedRow.add(feats[i]); |
176 |
selection.set(feats[i].getIndex(), true);
|
177 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
178 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
179 |
} |
180 |
} else {
|
181 |
if (geom.intersects(rect)) { // , 0.1)){ |
182 |
selectedRow.add(feats[i]); |
183 |
selection.set(feats[i].getIndex(), true);
|
184 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
185 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
186 |
} |
187 |
} |
188 |
} |
189 |
vea.setSelectionImage(selectionImage); |
190 |
vea.setHandlersImage(handlersImage); |
191 |
} catch (DriverException e) {
|
192 |
e.printStackTrace(); |
193 |
} |
194 |
|
195 |
} |
196 |
public void selectInsidePolygon(IGeometry polygon) { |
197 |
VectorialEditableAdapter vea = getVEA(); |
198 |
FBitSet selection = vea.getSelection(); |
199 |
ViewPort vp=getLayer().getMapContext().getViewPort(); |
200 |
selection.clear(); |
201 |
selectedRow.clear(); |
202 |
Rectangle2D rect = polygon.getBounds2D();
|
203 |
|
204 |
String strEPSG = vp.getProjection().getAbrev().substring(5); |
205 |
IRowEdited[] feats;
|
206 |
try {
|
207 |
feats = vea.getFeatures(rect, strEPSG); |
208 |
BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
209 |
Graphics2D gs = selectionImage.createGraphics();
|
210 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
211 |
Graphics2D gh = handlersImage.createGraphics();
|
212 |
for (int i = 0; i < feats.length; i++) { |
213 |
IGeometry geom = ((IFeature) feats[i].getLinkedRow()) |
214 |
.getGeometry(); |
215 |
if (contains(polygon,geom)) {
|
216 |
selectedRow.add(feats[i]); |
217 |
selection.set(feats[i].getIndex(), true);
|
218 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
219 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
220 |
} |
221 |
} |
222 |
vea.setSelectionImage(selectionImage); |
223 |
vea.setHandlersImage(handlersImage); |
224 |
} catch (DriverException e) {
|
225 |
e.printStackTrace(); |
226 |
} |
227 |
} |
228 |
|
229 |
public void selectCrossPolygon(IGeometry polygon) { |
230 |
VectorialEditableAdapter vea = getVEA(); |
231 |
FBitSet selection = vea.getSelection(); |
232 |
ViewPort vp=getLayer().getMapContext().getViewPort(); |
233 |
selection.clear(); |
234 |
selectedRow.clear(); |
235 |
Rectangle2D rect = polygon.getBounds2D();
|
236 |
|
237 |
String strEPSG = vp.getProjection().getAbrev().substring(5); |
238 |
IRowEdited[] feats;
|
239 |
try {
|
240 |
feats = vea.getFeatures(rect, strEPSG); |
241 |
BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
242 |
Graphics2D gs = selectionImage.createGraphics();
|
243 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
244 |
Graphics2D gh = handlersImage.createGraphics();
|
245 |
for (int i = 0; i < feats.length; i++) { |
246 |
IGeometry geom = ((IFeature) feats[i].getLinkedRow()) |
247 |
.getGeometry(); |
248 |
if (contains(polygon,geom) || intersects(polygon,geom)) {
|
249 |
selectedRow.add(feats[i]); |
250 |
selection.set(feats[i].getIndex(), true);
|
251 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
252 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
253 |
} |
254 |
} |
255 |
vea.setSelectionImage(selectionImage); |
256 |
vea.setHandlersImage(handlersImage); |
257 |
} catch (DriverException e) {
|
258 |
e.printStackTrace(); |
259 |
} |
260 |
} |
261 |
|
262 |
public void selectOutPolygon(IGeometry polygon) { |
263 |
VectorialEditableAdapter vea = getVEA(); |
264 |
FBitSet selection = vea.getSelection(); |
265 |
ViewPort vp=getLayer().getMapContext().getViewPort(); |
266 |
selection.clear(); |
267 |
selectedRow.clear(); |
268 |
|
269 |
try {
|
270 |
BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
271 |
Graphics2D gs = selectionImage.createGraphics();
|
272 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
273 |
Graphics2D gh = handlersImage.createGraphics();
|
274 |
for (int i = 0; i < vea.getRowCount(); i++) { |
275 |
IRowEdited rowEd=(IRowEdited)vea.getRow(i); |
276 |
IGeometry geom = ((IFeature)rowEd.getLinkedRow()) |
277 |
.getGeometry(); |
278 |
if (!contains(polygon,geom) && !intersects(polygon,geom)) {
|
279 |
selectedRow.add(rowEd); |
280 |
selection.set(rowEd.getIndex(), true);
|
281 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
282 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
283 |
} |
284 |
} |
285 |
vea.setSelectionImage(selectionImage); |
286 |
vea.setHandlersImage(handlersImage); |
287 |
} catch (DriverIOException e) {
|
288 |
e.printStackTrace(); |
289 |
} catch (IOException e) { |
290 |
e.printStackTrace(); |
291 |
} |
292 |
} |
293 |
public void selectAll() { |
294 |
VectorialEditableAdapter vea = getVEA(); |
295 |
FBitSet selection = vea.getSelection(); |
296 |
ViewPort vp=getLayer().getMapContext().getViewPort(); |
297 |
selection.clear(); |
298 |
selectedRow.clear(); |
299 |
try {
|
300 |
BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
301 |
Graphics2D gs = selectionImage.createGraphics();
|
302 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
303 |
Graphics2D gh = handlersImage.createGraphics();
|
304 |
for (int i = 0; i < vea.getRowCount(); i++) { |
305 |
IRowEdited rowEd=(IRowEdited)vea.getRow(i); |
306 |
IGeometry geom = ((IFeature)rowEd.getLinkedRow()) |
307 |
.getGeometry(); |
308 |
selectedRow.add(rowEd); |
309 |
selection.set(rowEd.getIndex(), true);
|
310 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
311 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
312 |
} |
313 |
vea.setSelectionImage(selectionImage); |
314 |
vea.setHandlersImage(handlersImage); |
315 |
} catch (DriverIOException e) {
|
316 |
e.printStackTrace(); |
317 |
} catch (IOException e) { |
318 |
e.printStackTrace(); |
319 |
} |
320 |
} |
321 |
|
322 |
public void refreshSelectionCache(Point2D firstPoint,CADToolAdapter cta){ |
323 |
VectorialEditableAdapter vea = getVEA(); |
324 |
FBitSet selection = vea.getSelection(); |
325 |
double min = java.lang.Double.MAX_VALUE;
|
326 |
// Cogemos las entidades seleccionadas
|
327 |
clearSelection(); |
328 |
ViewPort vp=getLayer().getMapContext().getViewPort(); |
329 |
BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
330 |
Graphics2D gs = selectionImage.createGraphics();
|
331 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
332 |
Graphics2D gh = handlersImage.createGraphics();
|
333 |
for (int i = selection.nextSetBit(0); i >= 0; i = selection |
334 |
.nextSetBit(i + 1)) {
|
335 |
Handler[] handlers = null; |
336 |
|
337 |
DefaultRowEdited dre = null;
|
338 |
try {
|
339 |
dre = (DefaultRowEdited)(vea.getRow(i)); |
340 |
IFeature feat=(DefaultFeature)dre.getLinkedRow(); |
341 |
IGeometry geom=feat.getGeometry(); |
342 |
handlers = geom.getHandlers(IGeometry.SELECTHANDLER); |
343 |
selectedRow.add(dre); |
344 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
345 |
drawHandlers(geom.cloneGeometry(),gh,vp); |
346 |
// y miramos los handlers de cada entidad seleccionada
|
347 |
min = cta.getMapControl().getViewPort() |
348 |
.toMapDistance(SelectionCADTool.tolerance); |
349 |
for (int j = 0; j < handlers.length; j++) { |
350 |
Point2D handlerPoint = handlers[j].getPoint();
|
351 |
double distance = firstPoint.distance(handlerPoint);
|
352 |
if (distance <= min) {
|
353 |
min = distance; |
354 |
selectedHandler.add(handlers[j]); |
355 |
} |
356 |
} |
357 |
} catch (DriverIOException e) {
|
358 |
e.printStackTrace(); |
359 |
} catch (IOException e) { |
360 |
e.printStackTrace(); |
361 |
} |
362 |
} |
363 |
vea.setSelectionImage(selectionImage); |
364 |
vea.setHandlersImage(handlersImage); |
365 |
} |
366 |
|
367 |
public void drawHandlers(IGeometry geom, Graphics2D gs, ViewPort vp) { |
368 |
if (!(getLayer() instanceof FLyrAnnotation)){ |
369 |
Handler[] handlers = geom.getHandlers(IGeometry.SELECTHANDLER); |
370 |
FGraphicUtilities.DrawHandlers(gs, vp.getAffineTransform(), handlers); |
371 |
} |
372 |
} |
373 |
public Image getSelectionImage(){ |
374 |
return getVEA().getSelectionImage();
|
375 |
} |
376 |
public Image getHandlersImage() { |
377 |
return getVEA().getHandlersImage();
|
378 |
} |
379 |
public VectorialEditableAdapter getVEA(){
|
380 |
if (((FLyrVect)getLayer()).getSource() instanceof VectorialEditableAdapter) |
381 |
return (VectorialEditableAdapter)((FLyrVect)getLayer()).getSource();
|
382 |
else
|
383 |
return null; |
384 |
} |
385 |
|
386 |
public void beforeLayerDraw(LayerDrawEvent e) throws CancelationException { |
387 |
if (((FLyrVect) getLayer()).getSource() instanceof VectorialEditableAdapter) { |
388 |
VectorialEditableAdapter vea = (VectorialEditableAdapter) ((FLyrVect) getLayer()) |
389 |
.getSource(); |
390 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
391 |
BufferedImage selectionImage = new BufferedImage( |
392 |
vp.getImageWidth(), vp.getImageHeight(), |
393 |
BufferedImage.TYPE_INT_ARGB);
|
394 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), |
395 |
vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB);
|
396 |
Graphics2D gs = selectionImage.createGraphics();
|
397 |
Graphics2D gh = handlersImage.createGraphics();
|
398 |
for (int i = 0; i < selectedRow.size(); i++) { |
399 |
IFeature feat = (IFeature) ((IRowEdited) selectedRow.get(i)) |
400 |
.getLinkedRow(); |
401 |
IGeometry geom = feat.getGeometry(); |
402 |
geom.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol); |
403 |
drawHandlers(geom.cloneGeometry(), gh, vp); |
404 |
} |
405 |
vea.setSelectionImage(selectionImage); |
406 |
vea.setHandlersImage(handlersImage); |
407 |
} |
408 |
} |
409 |
|
410 |
public void afterLayerDraw(LayerDrawEvent e) throws CancelationException { |
411 |
} |
412 |
|
413 |
public void beforeGraphicLayerDraw(LayerDrawEvent e) throws CancelationException { |
414 |
} |
415 |
|
416 |
public void afterLayerGraphicDraw(LayerDrawEvent e) throws CancelationException { |
417 |
} |
418 |
private static boolean contains(IGeometry g1,IGeometry g2) { |
419 |
Geometry geometry1=g1.toJTSGeometry(); |
420 |
Geometry geometry2=g2.toJTSGeometry(); |
421 |
if (geometry1==null || geometry2==null)return false; |
422 |
return geometry1.contains(geometry2);
|
423 |
} |
424 |
private static boolean intersects(IGeometry g1,IGeometry g2) { |
425 |
Geometry geometry1=g1.toJTSGeometry(); |
426 |
Geometry geometry2=g2.toJTSGeometry(); |
427 |
if (geometry1==null || geometry2==null)return false; |
428 |
return geometry1.intersects(geometry2);
|
429 |
} |
430 |
|
431 |
public void activationGained(LayerEvent e) { |
432 |
if (ViewCommandStackExtension.csd!=null){ |
433 |
ViewCommandStackExtension.csd.setModel(((IEditableSource) ((FLyrVect)getLayer()).getSource()) |
434 |
.getCommandRecord()); |
435 |
} |
436 |
|
437 |
if (cadtool!=null){ |
438 |
CADExtension.getCADToolAdapter().setCadTool(cadtool); |
439 |
PluginServices.getMainFrame().setSelectedTool(cadtool.toString()); |
440 |
StartEditing.startCommandsApplicable(null,(FLyrVect)getLayer());
|
441 |
CADExtension.initFocus(); |
442 |
} |
443 |
|
444 |
} |
445 |
|
446 |
public void activationLost(LayerEvent e) { |
447 |
try{
|
448 |
cadtool=CADExtension.getCADTool(); |
449 |
}catch (EmptyStackException e1) { |
450 |
cadtool=new SelectionCADTool();
|
451 |
cadtool.init(); |
452 |
} |
453 |
|
454 |
} |
455 |
|
456 |
public ArrayList getSnappers() { |
457 |
return snappers;
|
458 |
} |
459 |
|
460 |
public ArrayList getLayersToSnap() { |
461 |
return layersToSnap;
|
462 |
} |
463 |
|
464 |
public void setLayersToSnap(ArrayList layersToSnap) { |
465 |
this.layersToSnap = layersToSnap;
|
466 |
|
467 |
} |
468 |
|
469 |
public void setSelectionCache(ArrayList selectedRowAux) { |
470 |
clearSelection(); |
471 |
VectorialEditableAdapter vea=getVEA(); |
472 |
FBitSet selection=vea.getSelection(); |
473 |
selectedRow.addAll(selectedRowAux); |
474 |
for (int i = 0;i < selectedRow.size(); i++) { |
475 |
IRowEdited edRow = (IRowEdited) selectedRow.get(i); |
476 |
selection.set(edRow.getIndex()); |
477 |
} |
478 |
} |
479 |
|
480 |
public void setLegend(Legend legend) { |
481 |
this.legend=legend;
|
482 |
} |
483 |
public Legend getLegend() {
|
484 |
return legend;
|
485 |
} |
486 |
} |