Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] ModalTool Change Listener


i want to listen editing tools like  , Polygon , LineTool ….. . User can draw shapes free by mouse , but we need to enter coordinates by hand  relative to first point . 
for example while editing via  polygon tool 

relative to previous point :  first point  11 (x0), 12 (y0) ( exact point location )    second point :   x0 + 100 , y0 + 50 
entering coord relative by angle :  first point  11 (x0), 12 (y0) ( exact point location )    second point :  sin 30 *  x0 + cos 30 * y0 

I'm developing a view to enter these coords ,  if user enters coords and types enter, entered coords will be added currently editing shape.  that s why i want to known when  a edit tool enabled  , so that i can enable or disable text boxes to enter coordinates and can show view if necessary .  
i ll need a few more views for my application depends on existing and custom tools .

i ve found a workaround , when a  modal tool activates  , it runs  a command so map change event fires :).

On Apr 20, 2012, at 3:57 PM, Jody Garnett wrote:

Can I ask why you want to do this? It will help me figure out how we should fix it … normally the tools are "driving" the application (you know registering listeners, changing the cursor, proving a context menu, taking over the selection the map advertises, etc…)

if we are forced to listen to the tools enable and disable then perhaps you have discovered a new responsibility for the tools?

So yes please tell me more :-)

If ToolLifecycleListener is expected to be called then we should be able to make a fix; perhaps you could check in ToolManager with a debugger and spot where we should fire the event from?

-- 
Jody Garnett

On Monday, 16 April 2012 at 11:41 PM, omur yavuz wrote:

I've read my previous mail again and its slipshod, apoligies.

I want to catch whenever active modal tool changes , smth like

ApplicationGIS.getToolManager().addChangeListener(IToolChangeListener);
IToolChangeListener {
activeToolChanged(Event evt) ;
}

Looks like there is no implementation like this. so i tried to listen specific tools lifecycle ;

ApplicationGIS.getToolManager().findTool("......polygonEdit").addListener(new ToolLifecycleListener(){

public void changed(ToolLifecycleEvent event) {
// TODO Auto-generated method stub
bla bla bla
}
})

but changed method is not being called when edit tool activated or deactivated.

can you give me an advice plz :)

On Apr 16, 2012, at 4:22 PM, omur yavuz wrote:

I ve got a problem with modal tools :). i want to listen modal tool selection change and activate my viewport based selection of the tool. For example
i ll make myviewpart only polygon tool and line tool selected . i tried several methods to do ;

1) Listening Balackboard : its working to listen edit state , i can catch starting editing but can't handle switching to another tool like zoom
2) listening tool lifecycle : added IToolLifecycleListener , workbench didn't call change event after i clicked tool.

can you give me an advice ?

_______________________________________________
User-friendly Desktop Internet GIS (uDig)

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


Back to the top