[Chameleon] Splitting up a Legend widget

Carlo Tronnberg temp at chello.hu
Sun Dec 4 13:33:21 EST 2005


Hi there,

I did the same with one of my projects, adding a meta tag for the layers I 
wanted to handle separately, such as:

LAYER
    CONNECTIONTYPE postgis
    CONNECTION "user=elu password=pw dbname=db host=localhost"
    DATA "the_geom from lineup"
    FILTER "state = 'T'"
    NAME "Timed-out Stations"
    TYPE POINT
    STATUS OFF
    TRANSPARENCY ALPHA
    METADATA
            "isStation" "true"
    END
    CLASS
        STYLE
        SYMBOL 'TimeOutStation'
        COLOR 0 0 0
        OUTLINECOLOR 0 0 0
        END
    END # Class
    PROJECTION
      "init=epsg:4326"
    END
END

Using the chameleon example, I modified the "legend_template.html" file such 
as:

[leg_layer_html order=ascending opt_flag=15]
[if name=isStation oper=isnull]
  <div id='[leg_layer_name]_t'><tr bgcolor="#ffffff" ID='[leg_layer_name]'>
    <td valign="top" width="10"><input type="radio" style="margin-top:1px; 
margin-bottom:1px; height:14px;" name="my_legend" 
onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected value=1] 
CHECKED[/if] ></td>
    <td nowrap valign="top" width="18"><input type="checkbox" 
style="margin-top:1px; margin-bottom:1px; height:14px;" 
name="legendlayername[]" value="[leg_layer_name]"
    [if name=layer_status oper=eq  value=1]CHECKED[/if]
    [if name=layer_status oper=eq value=2]CHECKED[/if]></td>
    <td valign="top" align="middle" width="15"><img border="0" 
style="margin-top:0px; margin-bottom:0px; margin-right:0px;" src="[leg_icon 
width=16 height=17]"></td>
    [if name=wms_name oper=isnull]
    <td valign="top" nowrap><a href="#" 
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span 
class="label">[leg_layer_name]</span></a></td></tr>
    [/if]
    [if name=wms_name oper=isset]
    <td valign="top" nowrap><a href="#" 
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span 
class="label">[metadata name=WMS_TITLE]</span></a></td></tr>
    [/if]</div>
[/if]
[/leg_layer_html]

I duplicated the LegendTemplate widget so as to have 2 different versions of 
it in the same page (Just copy the widget and rename it...). One of them 
showing all the layers without that meta data and the other one the layers 
with it (using in my case the condition: [if name=isStation oper=isset] ).

I have a trouble though: I wish to define layers in the map file which would 
NOT be handled by the automatic layer functions in chameleon. I want to be 
able to show or hide them but NOT promote/demote or delete them. Whatever 
dynamic map modification done, these "static" layers should always be there 
on top of any other layer, even if other layers, such as WMS layers are 
added by the user. Is this feasible?

I really hope somebody can help me with this.

Greetings,

Carlo

----- Original Message ----- 
From: "Paul Spencer" <pspencer at dmsolutions.ca>
To: "Peter Kingsbury" <peter.kingsbury at gmail.com>
Cc: <chameleon at lists.maptools.org>
Sent: Sunday, December 04, 2005 16:51
Subject: Re: [Chameleon] Splitting up a Legend widget


> Peter,
>
> I've never seen this before.  The only approach I can think of is to  put 
> metadata into your layers to place them into the 'left' or  'right' side, 
> the construct two legend templates that restrict  contents based on this 
> metadata, then have two LegendTemplate widgets  that use two different 
> templates.
>
> Cheers
>
> Paul
>
> On 4-Dec-05, at 9:24 AM, Peter Kingsbury wrote:
>
>> Hi all,
>>
>> I have a mapserver whose LegendTemplate widget is currently  displaying 
>> enough layers to require a user to vertically scroll  farther than I 
>> would like.
>>
>> I am researching a method of dividing the legend up into two  halves, 
>> such that one half is displayed on either side of the  MapDTML widget 
>> which is in the center of my site.
>>
>> Is there a means of accomplishing this?
>>
>> Best regards,
>> - Peter
>>
>> _______________________________________________
>> 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