[Chameleon] Map refresh slower at bigger scale - Update Map without submit

Normand Savard nsavard at mapgears.com
Mon Oct 6 10:03:01 EDT 2008


Federica De Martin wrote:
>  Thank you for the answer,
> I already use the JSAPI mode with the chameleon 2.4 but the UpdateMap button
> always submit the page.
> Then I tried using the Update widget of chameleon 2.6 and I discovered that
> it doesn't work (doesn't do anything).
> I don't know if there is a misconfiguration i my template or somewhere else,
> any suggestion about this?
>
>
>   
Federica,

You need to add some Javascript in your legend template and sample.js.

Norm

main application template:
<cwc2 type="LegendTemplate" visible="true" embedded="true" 
template="legend_template_jsapi.html" popupstyleresource="TextButtons" 
popupwidth="500" popupheight="400" status="false" menubar="false"/>

legend_template_jsapi.html

[leg_layer_html order=ascending opt_flag=15]
  <tr bgcolor="#ffffff">
    <td><input type="radio" name="my_legend" 
onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected 
value=1] CHECKED[/if] ></td>
    <td align="center" width=20><input type="checkbox" 
name="legendlayername[]" value="[leg_layer_name]" 
onclick="ChangeLayerStatus('[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><img src="[leg_icon width=20 height=18]" width="20" height="20"</td>
    [if name=wms_name oper=isnull]
    <td><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><a href="#" 
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span 
class="label">[metadata name=WMS_TITLE]</span></a></td>
  </tr>
    [/if]
[/leg_layer_html]



sample.js:

function ChangeLayerStatus(szLayerName)
{
    if(typeof goCWCJSAPI == "undefined")
    {
        return false;
    }

    szStatus = goCWCJSAPI.oMap.GetLayerByName(szLayerName).GetStatus();
    if(szStatus == "ON")
    {
        szNewStatus = "OFF";
    }
    else
    {
        szNewStatus = "ON";
    }

    goCWCJSAPI.oMap.GetLayerByName(szLayerName).SetStatus(szNewStatus);
}




More information about the Chameleon mailing list