Notes from a code review with moovida.
The idea was to review some of Paul's recent work; and see if we could sort out
the relationship between tools and layers.
Feedback was mostly positive (moovida got confused by not having his code up to
date first :-P ).
Some stuff done:
Updated Interaction.getInteraction method to check the magic strings paul has
defined; in addition to the tool categories.
public static Interaction getInteraction(String layerInteraction) {
// check for deprecated ProjectBlackboardConstants
if
(layerInteraction.equals(ProjectBlackboardConstants.LAYER__EDIT_APPLICABILITY)
||
layerInteraction.equals(ProjectBlackboardConstants.LAYER__FEATURES_ADD_APPLICABILITY)
||
layerInteraction.equals(ProjectBlackboardConstants.LAYER__FEATURES_MODIFY_APPLICABILITY)
||
layerInteraction.equals(ProjectBlackboardConstants.LAYER__FEATURES_REMOVE_APPLICABILITY))
{
return Interaction.EDIT;
}
for( Interaction interaction : Interaction.values() ){
if( layerInteraction.equals( interaction.getKey() ) ){
return interaction;
}
}
return null;
}
2) Created LayerInteractionProperty so that tool enablement could check on the
layer isApplicable method
public boolean isTrue( ILayer layer, String text ) {
Interaction interaction = ILayer.Interaction.getInteraction(text);
if( interaction == null ){
return false; // unable to figure out Interaction to test
}
return layer.isApplicable(interaction);
}
3) net.refractions.udig.tool.edit/plugin.xml
Updated the edit tools to check "interaction_edit":
<enablement>
<and>
<property propertyId="FeatureStoreResourceProperty"
expectedValue=""/>
<property propertyId="InteractionProperty"
expectedValue="interaction_edit"/>
<or>
<property propertyId="GeometryType"
expectedValue="com.vividsolutions.jts.geom.MultiPolygon"/>
<property propertyId="GeometryType"
expectedValue="com.vividsolutions.jts.geom.Polygon"/>
</or>
</and>
</enablement>
4) Update the tools schema with more information to minimise warnings and make
things easier to fill in....
- cursor has the correct extension point; so you can click browse and find
cursors
- objectProperty adjusted the order of the attributes so the non deprecated
- objectProperty adjusted so you can click browse and find objectProperties
5) Updated the net.refractions.udig.ui operations schema so that things are
easier to fill in:
- objectProperty adjusted the order of the attributes so the non deprecated
- objectProperty adjusted so you can click browse and find objectProperties
The end result of which is the edit tools plugin xml has no more warnings :-)--
Jody Garnett
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel