The current theming works well if you have a single attribute value that
you want to assign a different style to. It does not however work if you
want to define more complex style to feature rules using more than one
attribute (e.g. number of lanes and surface type on a road).

What would be useful is another type of style called FilterStyle. This
style would have an ordered list of StyleFilters which would have some
kind of filter, a label and a Style object to use if the filter matches
the feature. The implementation of Filter Style would loop through the
filters until one was matched and then return the style for that filter.
If no filters are matched then a default style is returned.

The StyleFilter would be an interface as shown below and there would be
an implementation that would take a Map of expected values on the feature.

public interface StyleFilter {
  boolean isMatched(Feature feature);
 
  String getLabel();
  void setLabel(String label);
 
  Style getStyle();
 
  void setStyle(Style style);
}


Obviously this new style would be a little slower than the existing
color theming so if you are filtering on one attribute stick with the
current method, if you want something more complex this new approach
will work.

I have a prototype of the rendering side working, I'll need to add a UI
panel to edit the style and also need to extend the TreeModel to display
the themes in the tree as is done for the current style. With the new
style I'd allow users to show/hide themed features as well.

Paul

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to