[Chameleon] How do you set/get what tool is active with JSAPI?

Ken Sanderson ken at rockies.ca
Thu Jul 29 16:45:16 EDT 2004


Thanks for the reply. Still struggling with the best approach and how to
go about it.

I could put a check in my click function that uses what you provided
below, and then use the cooresponding JSAPI function to do the action.
So for example:

if (document.forms[0].NAV_CMD.value == "ZOOM_IN"){
  oMap.ZoomInPos( goCWCJSAPI.mouseclick[0], goCWCJSAPI.mouseclick[1] );
}

I can do that for ZOOM_OUT, ZOOM_IN, and RECENTER. ZOOM_IN might be
tricky as I have to handle the rectangle drawing as well, but I think
doable. How would you do this for QUERY though, I don't see a JSAPI
method for that? Also do the functions like ZoomInPos() currently work?
I have them implimented, no errors, but also nothing happens.

Are there any other options that I should be looking at? Really all I
want is to add my own tool that will give me the coords from the map to
use in my own script.

Thanks again,

Ken

-----Original Message-----
From: Paul Spencer [mailto:pagameba at magma.ca] 
Sent: July 29, 2004 1:06 PM
To: Ken Sanderson
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] How do you set/get what tool is active with
JSAPI?


There isn't really a mechanism in the CWC JSAPI for determining which 
tool is active, but you can check:

if (document.forms[0].NAV_CMD.value == "ZOOM_IN")
{
}

Cheers,

Paul

Ken Sanderson wrote:

> Hello. I have been getting a bit of a JSAPI script to work, pretty 
> basic at this point, but if I can get the basic to work then after 
> that its all javascript and php unrelated to Chameleon, so simple is 
> good.
> 
> One thing I noticed in the JSAPI docs is that at the end it still 
> references goCWCApp as the application object, but it should be 
> goCWCJSAPI. Also mouseclick[#] as mentioned under the MOUSE_CLICKED 
> example is not a property of oMap, it's a property of the application,

> which is goCWCJSAPI. So it should be goCWCJSAPI.mouseclick[0].
> 
> On to my question. I have my little script working for mouse click on 
> the map. It pops up an alert box that gives me the geographic coords 
> of the place clicked. The problem I have is that I cant find a way to 
> set or retrieve what tool is currently active. I only want my script 
> to function if my tool is the one that's currently active, if zoomin 
> is selected then the map should zoomin as per normal.
> 
> How can I interface with the tools in this manner?
> 
> Thanks,
> 
> Ken
> Miistakis
> 
> 
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           pspencer at dmsolutions.ca   |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------




More information about the Chameleon mailing list