Skip to main content

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

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


Back to the top