[Chameleon] How do you set/get what tool is active with JSAPI?
Ken Sanderson
ken at rockies.ca
Thu Jul 29 17:05:56 EDT 2004
To follow up that last email, specifically the questions about if
ZoomInPos() working or not, I noticed that as soon as I add these lines:
<!-- adding JSAPI functionality -->
<CWC2 TYPE="SharedResource" NAME="CWCJSAPI"/>
<CWC2 TYPE="CWCJSAPI" Debug="false"/>
All of the map tools stop working. Its not just the ZoomInPos() function
in JSAPI, it's the zoomin button as well. I don't even need to register
an event and nothing works. If I define an event then my event will
work, but none of the buttons work at all. Is this how its supposed to
work, if I use JSAPI do I need to rebuild the entire template?
I am also encountering the same problems with the sample:
sample_basic_jsapi.phtml.
Sorry to be spamming everyone,
Ken
-----Original Message-----
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Ken Sanderson
Sent: July 29, 2004 2:45 PM
To: chameleon at lists.maptools.org
Subject: RE: [Chameleon] How do you set/get what tool is active with
JSAPI?
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/|
-----------------------------------------------------------------
_______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/chameleon
More information about the Chameleon
mailing list