[udig-devel] Faster styling

Jody Garnett jgarnett at refractions.net
Tue Mar 11 09:39:16 PDT 2008


Ugo Taddei wrote:
> 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)
>   
Sounds fun! You will find some of the earlier style configuration pages 
worked in a similar manner; at
the time rendering was so slow we placed "Apply" and "Cancel" buttons 
into the mix. I am looking forward
to experimenting with your widget.
> 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.)
>   
I really should do a breakout IRC session with people that are learning; 
there are really only two ideas
I expect would be new to people (#1 Blackboard #2 IAdaptable). There are 
some interesting uses of
eclipse technologies (like EMF) but you can sneak up on those as you 
need them.
> 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.
>   
So far only two and a half things can draw onto the map:
- #1 a tool; it actually does so by scheduling a command that is drawn 
each time the screen is refreshed
- #2 a renderer; draws whenever the viewport model changes (or if the 
data itself changes)
- #2.5 mapgraphic - actually this is just a renderer that happens to not 
have any data to listen to
> 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?
>   
There is a tutorial (from the commercial training course) you can 
review; on all three method listed above.
> To finish off, a quick question: if I have a layer (and changed its style), how do I request a refresh?
>   
I would place the new style on the style blackboard and let the layer 
figure it out.
Jody


More information about the udig-devel mailing list