[udig-devel] Modal tool deactivation

Damjan Šavko damjan.savd at gmail.com
Mon Aug 28 02:36:06 PDT 2006


Hello Jesse, I used your way of drawing to the ViewportPane (*
context.getViewportPane().repaint()*) and now things are working corectly
also in RC3 version. But now I need to ask you another thing. I want to draw
a series of shapes without knowing the number apriori (like in a loop). How
do I remove them then? Is there a way to tell the Viewport to remove all the
DrawShapeCommands or do I have to keep all the pointers to those draw
commands(in a Vector maybe) and remove them in a loop?

Thanks


Damjan Šavko


On 8/9/06, Jesse Eichar <jeichar at refractions.net> wrote:
>
> HI
> Interesting.  That should still work.  I usually do the disabling slightly
> differently:
>
>     rect =3D new Rectangle(e.x - 10, e.y -10, 10, 10);
>             dsc =3D context.getDrawFactory().createDrawShapeCommand(rect,
> java.awt.Color.GREEN, 1, 1);
>             dsc.setShape(rect);
>             dsc.setValid (true);
>             context.sendASyncCommand(dsc);
> and
>             dsc.setValid(false);
>     *context.getViewportPane().repaint();*
>
> I really can't see any reason this doesn't work since it is used by the
> zoom and all the edit tools.
>
> Jesse
>
> On 9-Aug-06, at 1:45 AM, Damjan Šavko wrote:
>
> ------=_Part_22162_21138779.1155113144237
> Content-Type: text/plain; charset=WINDOWS-1252; format=flowed
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: inline
>
>
> OK Jesse. Would you happen to know if the problem with using the
> DrawShapeCommand-s in RC2 is also a bug or did something change from M7 to
> RC2?
>
> From last mail:
>
>
> Also I've noticed that my drawing tools are acting very strange. To draw
> on
> the map I use the folowing commands:
>
> rect =3D new Rectangle(e.x - 10, e.y -10, 10, 10);
>             dsc =3D context.getDrawFactory().createDrawShapeCommand(rect,
> java.awt.Color.GREEN, 1, 1);
>             dsc.setShape(rect);
>             dsc.setValid (true);
>             context.sendASyncCommand(dsc);
> and
>             dsc.setValid(false);
>             context.sendASyncCommand(dsc);
> to erase.
>
> Do you know what were the changes from uDigM7 to uDigRC2 that caused my
> plugins to stop working?
>
>
>
> Damjan =8Aavko
>
>
>
> On 8/8/06, Jesse Eichar <jeichar at refractions.net> wrote:
>
>
> Hi
> I'm just created a new Issue:  UDIG 958.  You can add yourself as a
> watcher so that you will be notified when it is closed.  I will try to cl=
> ose
>
> the issue very soon.
>
> Jesse
>
> On 8-Aug-06, at 3:54 AM, Damjan =8Aavko wrote:
>
> OK, I've done some more testing and I think there is a bug in uDig-RC2.
> After you select a modal tool, you cannot deselect it. It keeps on being
> selected. The only way to deselect it is to choose another modal tool.
>
> Hope it helps.
>
> Damjan =8Aavko
>
>
> On 8/8/06, Damjan =8Aavko <damjan.savd at gmail.com> wrote:
>
>
> Hi, I' ve started moving my plugins to uDig-RC2 (SDK) from uDig-M7(SDK)
> and I've been having some troubles. The trick you showed me to deactiva=
> te a
>
> tool in the toolbar:  ApplicationGIS.getToolManager ().getTool (
> toolID,categoryID).run();  doesn't do the trick anymore. Instead of
> turning the button off it turns it on (although is already on) throwing=
>
>  the
>
> tool in an endless loop.
> Also I've noticed that my drawing tools are acting very strange. To dra=
> w
>
> on the map I use the folowing commands:
>
> rect =3D new Rectangle(e.x - 10, e.y -10, 10, 10);
>             dsc =3D context.getDrawFactory().createDrawShapeCommand(rec=
> t,
>
> java.awt.Color.GREEN, 1, 1);
>             dsc.setShape(rect);
>             dsc.setValid (true);
>             context.sendASyncCommand(dsc);
> and
>             dsc.setValid(false);
>             context.sendASyncCommand(dsc);
> to erase.
>
> Do you know what were the changes from uDigM7 to uDigRC2 that caused my
> plugins to stop working?
>
> Thanks.
>
> Damjan =8Aavko
>
>
>
> On 7/21/06, Jesse Eichar < jeichar at refractions.net > wrote:
>
>
> The reason it works is because when you press the button the run
> methods is executed.  So basically you need to simulate a button pres=
> s...
>
> which calling run does.
> Jesse
>
> On 21-Jul-06, at 2:10 AM, Damjan =8Aavko wrote:
>
> Bingo Jesse! That really did the trick. I would have never thought to
> use the run() method inside a modal tool. I still don't know why that=
>  works
>
> but I don't really care that much :)
>
> Another thing: I can get the category ID by
> ApplicationGIS.getToolManager().getActiveCategory().getId() but I
> cannot do the same with tool ID. There is no
> ApplicationGIS.getToolManager().getActiveTool().getId().
> Anyway that's not such a big problem, it would've been just a bit mor=
> e
>
> elegant.
>
> Thanks a lot!
>
> Damjan
>
>
>
> On 7/20/06, Jesse Eichar <jeichar at refractions.net> wrote:
>
>
> Hi
>
> The following snippet can be added to you setActiveMethod():
>
> Display.getCurrent().asyncExec(new Runnable(){
>         public void run(){
>                 ApplicationGIS.getToolManager().getTool(toolID).run=
>
> ();
>
>
>         }
> }
>
> I haven't actually tested this situation so let me know how it goes=
>
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20060828/1cb8d009/attachment.html


More information about the udig-devel mailing list