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

Federica De Martin federica.demartin at gmail.com
Wed Oct 8 05:11:46 EDT 2008


Thank you Normand, for the help with UpdateMap widget; I had to change some
part of the functions, because I use Xml Legend but now everything works!

Now I was trying to get the MapSize widget working in jsapi mode. This is
what I've done:
- I replace the folder of the Mapsize widget with the one of chameleon 2.6
- I added in the cwcjsapi.js file the code:
    MAP_SIZE_CHANGED = gnLastEventId ++;
- I added in the UpdateMap.php the code:
    //change map size
    if (isset( $HTTP_FORM_VARS["SET_MAP_WIDTH"]) &&
        isset($HTTP_FORM_VARS["SET_MAP_HEIGHT"]))
    {
        include("widgets/MapSize/MapSize.widget.php");
        $oWidget = new MapSize();
        $oWidget->InitDefaults();
        $oWidget->SetMap($oMapSession);
        $oWidget->SetURL($oHttpFormVars, $HTTP_FORM_VARS);
        $_SESSION["gszCurrentState"] = $oMapSession->saveState();
    }

I thougt that this changes were enough but if I use the map size widget the
map keeps on loading and I have to restart the application;
Do you know if there are other files that has to be changed to make the
MapSize (jsapi mode) work?

Thanks, Federica


2008/10/6 Normand Savard <nsavard at mapgears.com>

> 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);
> }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20081008/9395ff4e/attachment.html


More information about the Chameleon mailing list