svn-gvsig-desktop / trunk / extensions / extCAD / src / com / iver / cit / gvsig / EditingExtension.java @ 4475
History | View | Annotate | Download (2.79 KB)
1 |
package com.iver.cit.gvsig; |
---|---|
2 |
|
3 |
import com.iver.andami.PluginServices; |
4 |
import com.iver.andami.plugins.Extension; |
5 |
import com.iver.cit.gvsig.fmap.FMap; |
6 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
7 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
8 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
9 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
10 |
import com.iver.cit.gvsig.gui.View; |
11 |
import com.iver.cit.gvsig.layers.VectorialLayerEdited; |
12 |
import com.iver.cit.gvsig.project.ProjectView; |
13 |
|
14 |
/**
|
15 |
* DOCUMENT ME!
|
16 |
*
|
17 |
* @author Vicente Caballero Navarro
|
18 |
*/
|
19 |
public class EditingExtension implements Extension { |
20 |
/**
|
21 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
22 |
*/
|
23 |
public void inicializar() { |
24 |
} |
25 |
|
26 |
/**
|
27 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
28 |
*/
|
29 |
public void execute(String s) { |
30 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
31 |
.getActiveView(); |
32 |
|
33 |
View vista = (View) f; |
34 |
ProjectView model = vista.getModel(); |
35 |
FMap mapa = model.getMapContext(); |
36 |
FLayers layers = mapa.getLayers(); |
37 |
if (s.equals("CANCELEDITING")) { |
38 |
EditionManager editionManager = CADExtension.getEditionManager(); |
39 |
|
40 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
41 |
vista.hideConsole(); |
42 |
if (layers.getLayer(i) instanceof FLyrVect |
43 |
&& layers.getLayer(i).isEditing()) { |
44 |
FLyrVect lv = (FLyrVect) layers.getLayer(i); |
45 |
// stopEditing(lv);
|
46 |
// VectorialEditableAdapter vea = (VectorialEditableAdapter) ((FLyrVect) layers
|
47 |
// .getLayer(i)).getSource();
|
48 |
// lv.setSource(vea.getOriginalAdapter());
|
49 |
VectorialLayerEdited lyrEdited = (VectorialLayerEdited) editionManager.getLayerEdited(lv); |
50 |
lyrEdited.clearSelection(); |
51 |
lv.setEditing(false);
|
52 |
return;
|
53 |
} |
54 |
} |
55 |
} else if (s.equals("SHOWGRID")) { |
56 |
CADExtension.getCADToolAdapter().setMapControl(vista.getMapControl()); |
57 |
CADExtension.getCADToolAdapter().setGrid(true);
|
58 |
} else if (s.equals("HIDEGRID")) { |
59 |
CADExtension.getCADToolAdapter().setMapControl(vista.getMapControl()); |
60 |
CADExtension.getCADToolAdapter().setGrid(false);
|
61 |
} else if (s.equals("SETADJUSTGRID")) { |
62 |
CADExtension.getCADToolAdapter().setMapControl(vista.getMapControl()); |
63 |
CADExtension.getCADToolAdapter().setAdjustGrid(true);
|
64 |
} else if (s.equals("NOTADJUSTGRID")) { |
65 |
CADExtension.getCADToolAdapter().setMapControl(vista.getMapControl()); |
66 |
CADExtension.getCADToolAdapter().setAdjustGrid(false);
|
67 |
} |
68 |
|
69 |
PluginServices.getMainFrame().enableControls(); |
70 |
|
71 |
} |
72 |
|
73 |
/**
|
74 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
75 |
*/
|
76 |
public boolean isEnabled() { |
77 |
return true; |
78 |
} |
79 |
|
80 |
/**
|
81 |
* @see com.iver.andami.plugins.Extension#isVisible()
|
82 |
*/
|
83 |
public boolean isVisible() { |
84 |
if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
|
85 |
return true; |
86 |
else
|
87 |
return false; |
88 |
|
89 |
} |
90 |
} |