36 |
36 |
|
37 |
37 |
import javax.swing.JComponent;
|
38 |
38 |
|
39 |
|
import org.slf4j.Logger;
|
40 |
|
import org.slf4j.LoggerFactory;
|
41 |
|
|
42 |
39 |
import org.gvsig.editing.EditingNotification;
|
43 |
40 |
import org.gvsig.editing.EditingNotificationManager;
|
44 |
41 |
import org.gvsig.fmap.dal.exception.DataException;
|
... | ... | |
91 |
88 |
import org.gvsig.vectorediting.swing.api.EditingSwingManager;
|
92 |
89 |
import org.gvsig.vectorediting.swing.api.console.EditingConsole;
|
93 |
90 |
import org.gvsig.vectorediting.swing.impl.console.DefaultEditingConsole;
|
|
91 |
import org.slf4j.Logger;
|
|
92 |
import org.slf4j.LoggerFactory;
|
94 |
93 |
|
95 |
94 |
public class DefaultEditingContext implements EditingContext {
|
96 |
95 |
|
... | ... | |
119 |
118 |
|
120 |
119 |
private EditingServiceParameter currentParam;
|
121 |
120 |
|
122 |
|
private boolean isEditingInitialized;
|
123 |
|
|
124 |
121 |
private Behavior[] defaultBehaviors;
|
125 |
122 |
|
126 |
123 |
private LayerListener layerListener = new LayerListener() {
|
... | ... | |
187 |
184 |
|
188 |
185 |
public DefaultEditingContext(MapControl mapControl) {
|
189 |
186 |
|
190 |
|
this.isEditingInitialized = false;
|
191 |
187 |
this.mapControlReference = new WeakReference<MapControl>(mapControl);
|
192 |
188 |
this.mapContextReference =
|
193 |
189 |
new WeakReference<MapContext>(mapControl.getMapContext());
|
... | ... | |
335 |
331 |
public void layerMoving(LayerPositionEvent e)
|
336 |
332 |
throws CancelationException {
|
337 |
333 |
}
|
338 |
|
|
339 |
|
public void layerRemoved(LayerCollectionEvent e) {
|
340 |
|
FLayers layers = e.getLayers();
|
341 |
|
for (int i = 0; i < layers.getLayersCount(); i++) {
|
342 |
|
FLayer layer = layers.getLayer(i);
|
343 |
|
if (layer instanceof FLayers) {
|
344 |
|
FLayers subLayers = (FLayers) layer;
|
345 |
|
for (int j = 0; j < subLayers.getLayersCount(); j++) {
|
346 |
|
LayerCollectionEvent newEvent =
|
347 |
|
LayerCollectionEvent.createLayerRemovedEvent(subLayers.getLayer(j));
|
348 |
|
layerRemoved(newEvent);
|
349 |
|
}
|
350 |
|
} else if (layer instanceof FLyrVect) {
|
351 |
|
((FLyrVect) layer).removeLayerListener(layerListener);
|
|
334 |
|
|
335 |
public void removeLayer(FLayer layer) {
|
|
336 |
if (layer instanceof FLayers) {
|
|
337 |
FLayers layers = (FLayers) layer;
|
|
338 |
for (int i = 0; i < layers.getLayersCount(); i++) {
|
|
339 |
addLayer(layers.getLayer(i));
|
352 |
340 |
}
|
|
341 |
} else if (layer instanceof FLyrVect) {
|
|
342 |
((FLyrVect) layer).removeLayerListener(layerListener);
|
353 |
343 |
}
|
354 |
344 |
}
|
355 |
345 |
|
|
346 |
public void layerRemoved(LayerCollectionEvent e) {
|
|
347 |
removeLayer(e.getLayers());
|
|
348 |
}
|
|
349 |
|
356 |
350 |
public void layerRemoving(LayerCollectionEvent e)
|
357 |
351 |
throws CancelationException {
|
358 |
352 |
}
|
... | ... | |
428 |
422 |
return;
|
429 |
423 |
}
|
430 |
424 |
|
431 |
|
// if(!isEditingInitialized){
|
432 |
|
// try {
|
433 |
|
// addBehaviors(additionalBehaviors);
|
434 |
|
// } catch (CreateEditingBehaviorException e1) {
|
435 |
|
// logger.info("Problems adding behaviors to editing context", e1);
|
436 |
|
// getMapControl().setTool("pan");
|
437 |
|
// return;
|
438 |
|
// }
|
439 |
|
// }
|
440 |
|
|
441 |
425 |
setCurrentLayer(layer);
|
442 |
426 |
|
443 |
427 |
FeatureStore featureStore = layer.getFeatureStore();
|
... | ... | |
460 |
444 |
EditingNotification.AFTER_ENTER_EDITING_STORE, null, layer);
|
461 |
445 |
|
462 |
446 |
enableSnapping();
|
463 |
|
isEditingInitialized = true;
|
464 |
447 |
}
|
465 |
448 |
|
466 |
449 |
@SuppressWarnings({ "rawtypes", "unchecked" })
|