Revision 38790
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/StartEditing.java | ||
---|---|---|
11 | 11 |
import org.gvsig.andami.messages.Messages; |
12 | 12 |
import org.gvsig.andami.messages.NotificationManager; |
13 | 13 |
import org.gvsig.andami.plugins.Extension; |
14 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
15 | 14 |
import org.gvsig.app.ApplicationLocator; |
16 |
import org.gvsig.app.extension.ProjectExtension; |
|
17 | 15 |
import org.gvsig.app.project.documents.view.ViewDocument; |
18 | 16 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
19 | 17 |
import org.gvsig.editing.gui.cad.CADTool; |
... | ... | |
21 | 19 |
import org.gvsig.fmap.dal.exception.ReadException; |
22 | 20 |
import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException; |
23 | 21 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
22 |
import org.gvsig.fmap.mapcontext.layers.LayerEvent; |
|
24 | 23 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
25 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
26 | 24 |
import org.gvsig.fmap.mapcontrol.MapControl; |
27 | 25 |
import org.gvsig.utils.console.jedit.KeywordMap; |
28 | 26 |
import org.gvsig.utils.console.jedit.Token; |
... | ... | |
104 | 102 |
PluginServices.getText(this, "warning_title"), |
105 | 103 |
JOptionPane.WARNING_MESSAGE); |
106 | 104 |
} |
105 |
|
|
106 |
// This line also enables the spatial cache for snapping: |
|
107 | 107 |
lv.setEditing(true); |
108 |
|
|
108 | 109 |
lv.getFeatureStore().addObserver(mapControl); |
109 | 110 |
startCommandsApplicable(vista, lv); |
110 |
vista.repaintMap(); |
|
111 |
|
|
112 |
// vista.repaintMap(); |
|
113 |
// ---------------------------- |
|
114 |
// this forces a true repaint: |
|
115 |
forceMapRepaint(mapControl, lv); |
|
111 | 116 |
|
112 | 117 |
} catch (StartEditionLayerException e) { |
113 | 118 |
|
... | ... | |
125 | 130 |
} |
126 | 131 |
} |
127 | 132 |
|
133 |
|
|
134 |
/** |
|
135 |
* @param mapControl |
|
136 |
* @param lv |
|
137 |
*/ |
|
138 |
private void forceMapRepaint(MapControl mc, FLyrVect lv) { |
|
139 |
|
|
140 |
lv.drawValueChanged( |
|
141 |
LayerEvent.createDrawValuesChangedEvent(lv, "")); |
|
142 |
|
|
143 |
/* |
|
144 |
* |
|
145 |
* |
|
146 |
* Alternative: force small change of extent: |
|
147 |
* |
|
148 |
Envelope env = mc.getViewPort().getAdjustedEnvelope(); |
|
149 |
Point uc = env.getUpperCorner(); |
|
150 |
double len = env.getLength(0); |
|
151 |
uc.setX(uc.getX() + len * 0.0001); |
|
152 |
env.setUpperCorner(uc); |
|
153 |
mc.getViewPort().setEnvelope(env); |
|
154 |
|
|
155 |
* |
|
156 |
* Alternative (?) |
|
157 |
* |
|
158 |
* mc.invalidate(); |
|
159 |
* |
|
160 |
*/ |
|
161 |
|
|
162 |
} |
|
163 |
|
|
128 | 164 |
// private void registerKeyStrokes() { |
129 | 165 |
// JComponent theComponent = vista.getConsolePanel().getTxt(); |
130 | 166 |
// |
Also available in: Unified diff