Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: UDIG 1.2.M2, UDIG 1.2.M3, UDIG 1.2.M4, UDIG 1.2.M5
-
Fix Version/s: UDIG 1.4.1
-
Component/s: application, tools and editing
-
Labels:None
-
Environment:XP, jre1.6.0_07
Description
The first geometry I draw after selecting a layer in the layer view is not created. The shape is drawn on the screen but when another action is made, the shape disappears. Every subsequent geom drawn behaves normally.
If I select another layer, the same happens: first geom gives error, subsequent geoms work correctly. Similarly, if I click back to the original layer, the same issue occurs.
AcceptChangesBehaviour uses isCreatingNewFeature(handler)
The issue is that isCreatingNewFeature() Returns false when creating the first geom after selecting a layer (meaning that the EditManager still has an edit feature that hasn't been cleared).
If we put something like:
((EditManager)handler.getContext().getEditManager()).setEditFeature(null, null);
into a listener for the layers panel, it would solve the problem.
CLASS: net.refractions.udig.project.ui.internal.MapEditor
FIX: insert at line 980:
((EditManager)getMap().getEditManager()).setEditFeature(null, null);
This clears the editfeature when a new layer is selected.
In other words, replace:
if( layer.getMap()==getMap()
&& getMap().getEditManager().getSelectedLayer() != layer){
SelectLayerCommand selectLayerCommand = new SelectLayerCommand(layer);
with:
if( layer.getMap()==getMap()
&& getMap().getEditManager().getSelectedLayer() != layer){
((EditManager)getMap().getEditManager()).setEditFeature(null, null);
SelectLayerCommand selectLayerCommand = new SelectLayerCommand(layer);
Luke.