[udig-devel] Faster styling

Ugo Taddei ugo.taddei at iais.fraunhofer.de
Tue Mar 11 08:25:08 PDT 2008


Hello,

I've written a widget for the user to interactively change the style of
a vector layer.

The widget works as follows:

1) Mouse down on widget
2) Drag widget controls (basically changes the Rules of some Styles)
3) Mouse up (create SLD and triggers layer->setStyle)
4) Map gets updated (with some brute force; see below)

So far I'm happy with the responsiveness. (I probably could optmize here
and there, but I still need to understand udig - will I ever? - and how
eclipse works.)

Anyway, I doubt the response would be fast enough, if style creation and
setting were on mouse dragging, rather than on mouse up.

So I had a look at the javadocs, the mailing list and the code, and I'm
still trying to figure out how to get hold of a MapGraphicContext (or
the like), in order to draw directly onto the awt image.


Or perhaps a custom renderer is the way to go? (As I read from some
posting.) If so, how do I roll my own and set it? Anyone with hints,
snippets or pointers?

To finish off, a quick question: if I have a layer (and changed its
style), how do I request a refresh?

I'm doing something like
Map map = layer.getMap();
map.getRenderManager().refresh( layer, map.getBounds( null ) );

which works, but it looks neither nice nor really correct!

Thanks,

Ugo

-- 
Ugo Taddei

Fraunhofer Institut Intelligente Analyse- und Informationssysteme (FhG IAIS)
http://www.iais.fraunhofer.de
Department Knowledge Discovery - IAIS.KD -
Working Group Spatial Decision Support
http://www.iais.fraunhofer.de/kd.html
phone  (+49)2241-14-2184    fax    (+49)2241-14-2072
Schloss Birlinghoven, D-53754 Sankt Augustin, Germany
------------------------------------------------------
Visit our thematic mapping tool CommonGIS: http://www.commongis.de


More information about the udig-devel mailing list