Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] DrawFeatureCommand

Hi Ugo... I've been trying to think what may be the problem and can't think of anything obvious.

I am trying to remember if there are any tricky things with the DrawCommands and don't really. It is possible that the command has bugs. Maybe look into it and let me know if you find anything.

Jesse


On 26-Aug-08, at 9:02 AM, Ugo Taddei wrote:

Hello,

I'm implementing a hovering tool. I basically let the mouse hover over a
feature and want to draw it, much like the selection tool (it's called
SelectionBoxCommand, right?).

Well, the code works all right, but for the way the feature is drawn.
Apparently it gets draw either under the found feature or it gets drawn
only to be erased by a subsequent update on the found feature (or
rather, on its bbox). As a result I see only an edge of the feature
(drawn with the symbolizers I provided).

Here's what I do:

public void mouseHovered(MapMouseEvent e) {

       Feature f;
       try {
           f = findFeature(e);
       } catch (Exception ex) {
           // TODO Auto-generated catch block
           ex.printStackTrace();
           return;
       }
       if (f == null) {
           this.command.setValid(false);
           this.context.getViewportPane().repaint();
           return;
       }

       this.command = new DrawFeatureCommand(f);
       // this.command.setColor(Color.RED);

       this.context.getViewportPane().addDrawCommand(this.command);

       Symbolizer[] symbs = new Symbolizer[] { new
StyleBuilder().createPolygonSymbolizer(Color.RED, Color.BLUE, 10) };
       this.command.setSymbolizers(symbs);

       this.command.setValid(true);
       this.context.sendASyncCommand(this.command);
       this.context.getViewportPane().repaint();

   }

//skip dispose code...

findFeature() is adapted code from examples.PickTool.java

Am I doing something wrong?

I can post the whole class and/or a screenshot, but I don't know if that
will get through the list.

Cheers,

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
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top