[udig-devel] Methods to write a Tool

Jesse Eichar jeichar.w at gmail.com
Fri May 16 02:02:05 PDT 2008


Hi,

There are 3 different types of tool extension points.

1.  Modal Tool (usually extends SimpleTool) - A tool for actively  
interacting with the map it is enabled only when it is selected  
(enabled).  IE Edit tools or info tools
2.  Action Tool (usually extends AbstractActionTool) - Essentially a  
button in the toolbar
3.  Background Tool (usually extends AbstractTool) - This runs in the  
background all the time and reacts mainly to mouse events.

I think you want Action Tool.

Both ActionTools and Modal tools can be put in the main toolbar, on  
views and action tools will also be placed in the menubar.

For setting the projection of the layer:

There are 2 interfaces for most model elements.  One is for read/only  
and the other permits read/write.  The reason for this is to push  
you(developers) to use commands to interact with the model so that  
undo and redo actions will work.  So you can create a MapCommand and  
cast your layer to its Layer interface and call setCRS.

First check the existing Commands by checking the type Hierarchy on  
UndoableCommand and MapCommand.
Here it is:  SetLayerCRSCommand

Jesse

On 16-May-08, at 10:44 AM, gaghi wrote:

>
> Hi, as you can see i messed up. What i wanted to do, in beginning,  
> was do
> some work, declared in my class method, after a click on my icon in  
> the
> toolbar, but without tracking any event cause i didn't need it. At  
> this
> point it seems that writing a tool is strictly linked to the events.  
> Or
> not?am i wrong again?
> However i'm moving to a 'view oriented' solution, even to manage  
> more easily
> the actions.
> Just for close this thread (and to open much others :) ), is there a  
> way to
> launch a kind of plugin from a button in the toolbar although the  
> mouse
> events are not important?
> One last question: i wasn't able to find the right way, do you know  
> how to
> set a projection for a layer?
>
> Thank you.
>
> Gabriele Lipari
> -- 
> View this message in context: http://www.nabble.com/basic-methods-to-write-a-udig-plugin-tp17123664p17270177.html
> Sent from the udig-devel mailing list archive at Nabble.com.
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel



More information about the udig-devel mailing list