[Chameleon] Widget Dev - legend/layers
Liz Godwin
godwinl@agr.gc.ca
Thu Apr 8 15:18:26 EDT 2004
Paul,
That did the trick! THANKS!!
Only change I had to make was that it's moURLArray, not moURLParams,
the rest worked fine.
Liz
>>> pagameba@magma.ca 04/07/04 09:58PM >>>
Liz,
great work so far :)
It sounds like you need to implement a ParseURL function in your widget
to handle the user selection and submit.
If you have named your radio buttons all the same name (let's say for
arguments sake that you named them "ActiveLayer" and the value
associated with each radio button was a layer name, then your ParseURL
function would probably look like this (not tested):
function ParseURL()
{
if (isset($this->moURLParams['ActiveLayer']) &&
$this->moURLParams['ActiveLayer'] != '')
{
for ($i=0; $i<$this->moMapObject->oMap->numlayers; $i++)
{
$oLayer = $oMap->getLayer($i);
if ($oLayer->name == $this->moURLArrayParams['ActiveLayer'])
$oLayer->set( 'status', MS_ON );
else
$oLayer->set( 'status', MS_OFF );
}
}
return true;
}
Let me know if that works for you,
Paul
Liz Godwin wrote:
> Hey,
>
> I've created my first widget....almost.
>
> In absense of an HTML Legend solution I liked, I made my own widget
> that uses Group, Layer and Class objects from a mapfile to display a
> collapsable tree view of a legend. Because of the frequency of
> layers/classes, the class list collapses under a layer also. This
> legend uses radio buttons at the moment for layer selection (only
one
> layer may be visible at a time... for now), although eventually my
> widget will define conditions for both radio button and checkbox
use.
>
> Ok... so it works mostly. That is.. my javascript to collapse the
> list at different levels works, and all levels display correctly,
with
> styling.
>
> What does not work is my layer selection. The layer visible
correctly
> makes the right radio button selected, but I am unable to change the
> layer that is visible.
> What do I need to do for this? Can I piggy back off another widget?
>
> Without any documentation yet, I am guessing as to the way to do
this.
> My guess is that there are two parts to this, 1) making sure my
radio
> buttons have the correct name and value pairs, and 2), how to handle
the
> request sent to chameleon in the post request. I looked at
LayerManager
> and it looked like I have to parse the URL to get the right request.
Do
> I use this Widget as a good example, or is it all wrong (I read a
month
> ago in the list that LayerManager is changing).?
> Where would I call a function to update the map layer status from?
>
> Hopefully you all understand what I'm trying to do, thanks for your
> help!!
>
> Liz Godwin
> _______________________________________________
> Chameleon mailing list
> Chameleon@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
>
--
-----------------------------------------------------------------
|Paul Spencer pspencer@dmsolutions.ca |
|-----------------------------------------------------------------|
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
-----------------------------------------------------------------
More information about the Chameleon
mailing list