Revision 142 org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingContext.java
DefaultEditingContext.java | ||
---|---|---|
99 | 99 |
} |
100 | 100 |
|
101 | 101 |
public void activateService(String name) { |
102 |
if (mapControl != null && mapControl.hasTool("VectorEditing")) {
|
|
102 |
if (getMapControl() != null && getMapControl().hasTool("VectorEditing")) {
|
|
103 | 103 |
CompoundBehavior editingCompoundBehavior = |
104 | 104 |
getEditingCompoundBehavior(); |
105 |
mapControl.setTool("VectorEditing");
|
|
105 |
getMapControl().setTool("VectorEditing");
|
|
106 | 106 |
EditingBehavior editingBehavior = getEditingBehavior(); |
107 | 107 |
editingCompoundBehavior.setDrawnBehavior( |
108 | 108 |
EditingCompoundBehavior.EDITING_INDEX, true); |
... | ... | |
131 | 131 |
addBehaviors(additionalBehaviors); |
132 | 132 |
} catch (CreateEditingBehaviorException e1) { |
133 | 133 |
logger.info("Problems adding behaviors to editing context", e1); |
134 |
mapControl.setTool("pan");
|
|
134 |
getMapControl().setTool("pan");
|
|
135 | 135 |
return; |
136 | 136 |
} |
137 | 137 |
|
... | ... | |
148 | 148 |
return; |
149 | 149 |
} |
150 | 150 |
|
151 |
layer.getFeatureStore().addObserver(mapControl);
|
|
151 |
layer.getFeatureStore().addObserver(getMapControl());
|
|
152 | 152 |
|
153 | 153 |
addLayerListeners(); |
154 | 154 |
|
... | ... | |
162 | 162 |
EditingBehavior editingBehavior; |
163 | 163 |
EditingCompoundBehavior editingCompoundBehavior; |
164 | 164 |
|
165 |
if (!mapControl.hasTool("VectorEditing")) {
|
|
165 |
if (!getMapControl().hasTool("VectorEditing")) {
|
|
166 | 166 |
|
167 | 167 |
editingBehavior = new DefaultEditingBehavior(this); |
168 | 168 |
editingCompoundBehavior = |
... | ... | |
179 | 179 |
behaviors[i + 1] = additionalBehavior[i]; |
180 | 180 |
} |
181 | 181 |
|
182 |
mapControl.addBehavior("VectorEditing", behaviors);
|
|
182 |
getMapControl().addBehavior("VectorEditing", behaviors);
|
|
183 | 183 |
|
184 | 184 |
} else { |
185 |
mapControl
|
|
185 |
getMapControl()
|
|
186 | 186 |
.addBehavior("VectorEditing", editingCompoundBehavior); |
187 | 187 |
} |
188 | 188 |
|
... | ... | |
195 | 195 |
editingBehavior.cleanBehavior(); |
196 | 196 |
} |
197 | 197 |
|
198 |
mapControl.setTool("VectorEditing");
|
|
198 |
getMapControl().setTool("VectorEditing");
|
|
199 | 199 |
showConsole(); |
200 | 200 |
} |
201 | 201 |
|
202 |
public MapControl getMapControl() { |
|
203 |
return mapControl; |
|
204 |
} |
|
205 |
|
|
202 | 206 |
private void discardChanges(FLyrVect layer) throws EndEditingException { |
203 | 207 |
FeatureStore featureStore = layer.getFeatureStore(); |
204 | 208 |
try { |
... | ... | |
253 | 257 |
getMapControl().setTool("pan"); |
254 | 258 |
|
255 | 259 |
FeatureStore featureStore = layer.getFeatureStore(); |
256 |
featureStore.deleteObserver(mapControl);
|
|
260 |
featureStore.deleteObserver(getMapControl());
|
|
257 | 261 |
|
258 | 262 |
} |
259 | 263 |
|
... | ... | |
280 | 284 |
|
281 | 285 |
} |
282 | 286 |
|
283 |
mapControl.getCanceldraw().setCanceled(true);
|
|
287 |
getMapControl().getCanceldraw().setCanceled(true);
|
|
284 | 288 |
int option; |
285 | 289 |
EditingSwingManager swingManager = |
286 | 290 |
EditingSwingLocator.getSwingManager(); |
287 | 291 |
|
288 | 292 |
if (layer.isWritable()) { |
289 | 293 |
option = |
290 |
swingManager.showPanelSaveOrDiscard(mapControl,
|
|
294 |
swingManager.showPanelSaveOrDiscard(getMapControl(),
|
|
291 | 295 |
layer.getName()); |
292 | 296 |
} else { |
293 | 297 |
option = |
294 |
swingManager.showPanelExportOrDiscard(mapControl,
|
|
298 |
swingManager.showPanelExportOrDiscard(getMapControl(),
|
|
295 | 299 |
layer.getName()); |
296 | 300 |
} |
297 | 301 |
|
... | ... | |
338 | 342 |
EditingCompoundBehavior editingCompoundBehavior; |
339 | 343 |
|
340 | 344 |
CompoundBehavior compoundBehavior = |
341 |
(CompoundBehavior) mapControl.getMapTool("VectorEditing");
|
|
345 |
(CompoundBehavior) getMapControl().getMapTool("VectorEditing");
|
|
342 | 346 |
|
343 | 347 |
if (compoundBehavior instanceof EditingCompoundBehavior) { |
344 | 348 |
editingCompoundBehavior = |
... | ... | |
353 | 357 |
} |
354 | 358 |
} |
355 | 359 |
|
356 |
public MapControl getMapControl() { |
|
357 |
return this.mapControl; |
|
358 |
} |
|
359 |
|
|
360 | 360 |
private void hideConsole() { |
361 | 361 |
isShowConsole = false; |
362 | 362 |
getDockConsole().setVisible(false); |
... | ... | |
374 | 374 |
|
375 | 375 |
private void addLayerListeners() { |
376 | 376 |
|
377 |
MapContext context = mapControl.getMapContext();
|
|
377 |
MapContext context = getMapControl().getMapContext();
|
|
378 | 378 |
FLayers layers = context.getLayers(); |
379 | 379 |
|
380 | 380 |
// Add LayerListener to existing layers. |
Also available in: Unified diff