Revision 5018
trunk/extensions/extCAD/src/com/iver/cit/gvsig/layers/VectorialLayerEdited.java | ||
---|---|---|
7 | 7 |
import java.awt.image.BufferedImage; |
8 | 8 |
import java.io.IOException; |
9 | 9 |
import java.util.ArrayList; |
10 |
import java.util.EmptyStackException; |
|
10 | 11 |
|
12 |
import com.iver.andami.PluginServices; |
|
13 |
import com.iver.cit.gvsig.CADExtension; |
|
14 |
import com.iver.cit.gvsig.fmap.AtomicEvent; |
|
15 |
import com.iver.cit.gvsig.fmap.AtomicEventListener; |
|
11 | 16 |
import com.iver.cit.gvsig.fmap.DriverException; |
12 | 17 |
import com.iver.cit.gvsig.fmap.ViewPort; |
13 | 18 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
... | ... | |
26 | 31 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
27 | 32 |
import com.iver.cit.gvsig.fmap.layers.LayerDrawEvent; |
28 | 33 |
import com.iver.cit.gvsig.fmap.layers.LayerDrawingListener; |
34 |
import com.iver.cit.gvsig.fmap.layers.LayerEvent; |
|
29 | 35 |
import com.iver.cit.gvsig.gui.cad.CADTool; |
30 | 36 |
import com.iver.cit.gvsig.gui.cad.CADToolAdapter; |
31 | 37 |
import com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool; |
... | ... | |
36 | 42 |
private ArrayList selectedRow = new ArrayList(); |
37 | 43 |
private Point2D lastPoint; |
38 | 44 |
private Point2D firstPoint; |
45 |
private CADTool cadtool=null; |
|
39 | 46 |
|
40 | 47 |
public VectorialLayerEdited(FLayer lyr) |
41 | 48 |
{ |
... | ... | |
350 | 357 |
return getVEA().getHandlersImage(); |
351 | 358 |
} |
352 | 359 |
public VectorialEditableAdapter getVEA(){ |
353 |
return (VectorialEditableAdapter)((FLyrVect)getLayer()).getSource(); |
|
360 |
if (((FLyrVect)getLayer()).getSource() instanceof VectorialEditableAdapter) |
|
361 |
return (VectorialEditableAdapter)((FLyrVect)getLayer()).getSource(); |
|
362 |
else |
|
363 |
return null; |
|
354 | 364 |
} |
355 | 365 |
|
356 | 366 |
public void beforeLayerDraw(LayerDrawEvent e) throws CancelationException { |
... | ... | |
397 | 407 |
if (geometry1==null || geometry2==null)return false; |
398 | 408 |
return geometry1.intersects(geometry2); |
399 | 409 |
} |
410 |
|
|
411 |
public void activationGained(LayerEvent e) { |
|
412 |
|
|
413 |
if (cadtool!=null){ |
|
414 |
CADExtension.getCADToolAdapter().setCadTool(cadtool); |
|
415 |
PluginServices.getMainFrame().setSelectedTool(cadtool.toString()); |
|
416 |
} |
|
417 |
} |
|
418 |
|
|
419 |
public void activationLost(LayerEvent e) { |
|
420 |
try{ |
|
421 |
cadtool=CADExtension.getCADTool(); |
|
422 |
}catch (EmptyStackException e1) { |
|
423 |
cadtool=new SelectionCADTool(); |
|
424 |
cadtool.init(); |
|
425 |
} |
|
426 |
|
|
427 |
} |
|
400 | 428 |
} |
Also available in: Unified diff