Skip to main content

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

Well the DrawFeatureCommand "should" work. However becareful in both cases that the performance is acceptable. For big features it can be a problem. Not that I should say anything.

Jesse

On 26-Aug-08, at 1:48 PM, Ugo Taddei wrote:

Hi Jesse,

I'm trying with the SelectionBoxCommand now and the results are better,
if still strange, nevertheless.

I can "select" the geometry and highlight them, but some geometries
simply won't be drawn with the highlight!

The code is somewhat different:
this.command2 = new SelectionBoxCommand();

LiteShape shp = new LiteShape(
 f.getDefaultGeometry(),
 this.context.getMap().getViewportModel().worldToScreenTransform(),
 false);
this.command2.setShape(shp);

Haven't understood why (some complex and large geoms are drawn, some
simple ones aren't).

Anyway, thanks.

Ugo

Jesse Eichar wrote:
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

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel





--
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