[udig-devel] EditToolConfigurationHelper and the concept of "advanced tools"

Jody Garnett jgarnett at refractions.net
Tue Mar 25 15:01:28 PDT 2008


I am writing up documentation today; and got to the stage where I am 
looking at the use of EditToolConfigurationHelper - this class is used 
by AbstractEditTool as almost a small scripting language.

There is a preference you can throw in uDig to enable "Advanced Tools"; 
if this setting is true EditToolConfiguration helper will see a few more 
behaviours - let me use an example.
- In normal mode the PointTool is used to create new points
- In advanced mode the PointTool can create points and move them around

To explain this I took the existing implementation of PointTool and 
isolated only behaviours for "normal" mode:
> helper.add( new DrawCreateVertexSnapAreaBehaviour());
>
> helper.startMutualExclusiveList();
> helper.add(new StartEditingBehaviour(ShapeType.POINT));
> helper.stopMutualExclusiveList();
>
> helper.add( new AcceptBehaviour() );
> helper.add( new SetSnapSizeBehaviour());
> helper.done();
And only the behaviours for advanced mode:
> helper.add( new DrawCreateVertexSnapAreaBehaviour());
> ...
> helper.add( new CursorControlBehaviour( .. ));
>
> helper.startMutualExclusiveList();
>   helper.add( new SelectVertexOnMouseDownBehaviour() );
>   helper.add( new SelectVertexBehaviour() );
>   helper.add( new SelectFeatureBehaviour( ... ));        
> helper.stopMutualExclusiveList();
>
> helper.add( new MoveVertexBehaviour() );
> helper.add( new AcceptBehaviour() );
> helper.add( new SetSnapSizeBehaviour());
> helper.done();
The result is way easier to understand than the original (so much so I 
won't even list it in email). The question for me is this...
- should we kill normal mode? And just go with advanced .. I feel the 
advanced switch was introduced to minimize the amount of debugging 
needed for release
- should we have two methods?  initEventBehaviours and 
initAdvancedEventBehaviours? by default one can call the other.

Jody


More information about the udig-devel mailing list