Re: Map refresh slower at bigger scale - Update Map without submit

View: New views
9 Messages — Rating Filter:   Alert me  

Re: Map refresh slower at bigger scale - Update Map without submit

by Federica De Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

<<< I write again beacuse I cannot see my message - Hope this isn't a problem >>>

Hi everybody,
Thank you. I 've changed something in my mapfile but finally the more useful change has been the modify of the DATA statemen. Instead of an SQL with many joins I reduced it to an essential SQL, so I renounced the query tool of chameleon and wrote specific MyOnQuery function for my data.
Now I want to remove the submit in the "UpdateMap" button that slows down the use of the application. I use Chameleon 2.4 with some inserts from 2.6 rc1; I tried using the UpdateMap widget from 2.6 rc1 but it doesn't work as I read in the Chameleon archive. Is there a way to make "UpdateMap" button work without submitting the page?

Thank you in advance,
Federica

_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

Re: Map refresh slower at bigger scale - Update Map without submit

by nsavard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Federica De Martin wrote:

> <<< I write again beacuse I cannot see my message - Hope this isn't a
> problem >>>
>
> Hi everybody,
> Thank you. I 've changed something in my mapfile but finally the more useful
> change has been the modify of the DATA statemen. Instead of an SQL with many
> joins I reduced it to an essential SQL, so I renounced the query tool of
> chameleon and wrote specific MyOnQuery function for my data.
> Now I want to remove the submit in the "UpdateMap" button that slows down
> the use of the application. I use Chameleon 2.4 with some inserts from 2.6
> rc1; I tried using the UpdateMap widget from 2.6 rc1 but it doesn't work as
> I read in the Chameleon archive. Is there a way to make "UpdateMap" button
> work without submitting the page?
>
> Thank you in advance,
> Federica
>
>  
Federica,

You can use the JSAPI mode.  I don't know if all you your widgets will
work.  It depends on how complex is your application.

You need to add this two lines in your template:
<cwc2 type="cwcjsapi" debug="false"/>
<cwc2 type="SharedResource" name="CWCJSAPI"/>


More info on jsapi mode:
http://chameleon-tiki.maptools.org/tiki-index.php?page=CWCJSAPI

_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

Re: Map refresh slower at bigger scale - Update Map without submit

by Federica De Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 can use the JSAPI mode.  I don't know if all you your widgets will work.  It depends on how complex is your application.

You need to add this two lines in your template:
<cwc2 type="cwcjsapi" debug="false"/>
<cwc2 type="SharedResource" name="CWCJSAPI"/>


More info on jsapi mode:
http://chameleon-tiki.maptools.org/tiki-index.php?page=CWCJSAPI



_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

Re: Map refresh slower at bigger scale - Update Map without submit

by nsavard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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);
}


_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

Re: Map refresh slower at bigger scale - Update Map without submit

by Federica De Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
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);
}




_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

Re: Map refresh slower at bigger scale - Update Map without submit

by nsavard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Federica De Martin wrote:

> 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?
>
>  
Federica,

I suggest to use the latest version of Chameleon and this is the one in
CVS.  There are a number of fixes that don't appear in the tarball 2.6.  
See:

http://chameleon.maptools.org/index.phtml?page=cvs.html

Norm

_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

Re: Map refresh slower at bigger scale - Update Map without submit

by Federica De Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you Normand,
I downloaded the last version of chameleon with cvs but I haven't found any difference with the files in chameleon 2.6 rc1, in the three files I modified. Can you suggest me the other files that need to be changed? ... because I don't want to update directly all the application...

Federica

2008/10/8 Normand Savard <nsavard@...>
Federica De Martin wrote:
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?

 
Federica,

I suggest to use the latest version of Chameleon and this is the one in CVS.  There are a number of fixes that don't appear in the tarball 2.6.  See:

http://chameleon.maptools.org/index.phtml?page=cvs.html

Norm



_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

Re: Map refresh slower at bigger scale - Update Map without submit

by nsavard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Federica De Martin wrote:
> Thank you Normand,
> I downloaded the last version of chameleon with cvs but I haven't found any
> difference with the files in chameleon 2.6 rc1, in the three files I
> modified. Can you suggest me the other files that need to be changed? ...
> because I don't want to update directly all the application...
>
>  
Federica,

I thought I had committed the changes.  Sorry.

Add the "if" clause in myOnLoad() function of the main template.


<script language="JavaScript" type="text/javascript">
function myOnLoad()
{
  CWC2OnLoadFunction()

  if(typeof goCWCJSAPI != "undefined")
  {
    goCWCJSAPI.RegisterEvent(MAP_SIZE_CHANGED, "LayerAdjustSize");
  }

}
</script>

Than I the following code in sample.js:
/**
*
* called to position the keymap when the map image is resized
*/
function KeyMapWComputeKeyMapPosition()
{
    if (document.layers) //Netscape 4.x
    {
        gKeyMapWhspc = document.images['keymapFrameTL'].x;
        gKeyMapWvspc = document.images['keymapFrameTL'].y;
    }
    else
    {
        gKeyMapWhspc = CWCDHTML_FindObjectPosX(
document.getElementById('keymapFrameTL'));
        gKeyMapWvspc = CWCDHTML_FindObjectPosY(
document.getElementById('keymapFrameTL'));
    }

    gKeyMapWhspc+=1;
    gKeyMapWvspc+=1;

}


/**
* {$szJsFunctionName}
* called to position the keymap when the map image is resized
* It also position the background image layer and the zoom layers.
*/
function KeyMapWPositionKeyMapDHTML()
{
    KeyMapWComputeKeyMapPosition();

    var oLayer = CWCDHTML_GetLayer("KeyMapLayerDiv");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("KeyMapLayerBG");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMapBoxLeft");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMapBoxRight");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMapBoxTop");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMapBoxBottom");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxLeft");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxRight");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxTop");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;

    var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxBottom");
    oLayer.left = gKeyMapWhspc;
    oLayer.top = gKeyMapWvspc;
}

function LayerAdjustSize()
{
    LayerSetSizeInit();
    // Set the KeyMap position based on the ReferenceLayer
    KeyMapWPositionKeyMapDHTML();
}

I attached the modified files, the widget definition and UpdateMap.php
just in case.

Norm







_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon

mapsize.tgz (46K) Download Attachment

Re: Map refresh slower at bigger scale - Update Map without submit

by Federica De Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you Normand,

Finally I've discovered that what i need to make the MapSize Widget work was the MapDhtml upated up to 2.6 version beyond the UpdateMap.php and the cwcjsapi.js files. I hope that there will be no problem with the use of other widgets, like maptips, because I will have to add them in the application in future.

Chameleon Archive is lately not browsable; hope you recive this message.
Federica


2008/10/8 Normand Savard <nsavard@...>
Federica De Martin wrote:
Thank you Normand,

I downloaded the last version of chameleon with cvs but I haven't found any
difference with the files in chameleon 2.6 rc1, in the three files I
modified. Can you suggest me the other files that need to be changed? ...
because I don't want to update directly all the application...

 
Federica,

I thought I had committed the changes.  Sorry.

Add the "if" clause in myOnLoad() function of the main template.


<script language="JavaScript" type="text/javascript">
function myOnLoad()
{
 CWC2OnLoadFunction()

 if(typeof goCWCJSAPI != "undefined")
 {
  goCWCJSAPI.RegisterEvent(MAP_SIZE_CHANGED, "LayerAdjustSize");
 }

}
</script>

Than I the following code in sample.js:
/**
*
* called to position the keymap when the map image is resized
*/
function KeyMapWComputeKeyMapPosition()
{
  if (document.layers) //Netscape 4.x
  {
      gKeyMapWhspc = document.images['keymapFrameTL'].x;
      gKeyMapWvspc = document.images['keymapFrameTL'].y;
  }
  else
  {
      gKeyMapWhspc = CWCDHTML_FindObjectPosX(
document.getElementById('keymapFrameTL'));
      gKeyMapWvspc = CWCDHTML_FindObjectPosY(
document.getElementById('keymapFrameTL'));
  }

  gKeyMapWhspc+=1;
  gKeyMapWvspc+=1;

}


/**
* {$szJsFunctionName}
* called to position the keymap when the map image is resized
* It also position the background image layer and the zoom layers.
*/
function KeyMapWPositionKeyMapDHTML()
{
  KeyMapWComputeKeyMapPosition();

  var oLayer = CWCDHTML_GetLayer("KeyMapLayerDiv");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("KeyMapLayerBG");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMapBoxLeft");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMapBoxRight");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMapBoxTop");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMapBoxBottom");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxLeft");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxRight");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxTop");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;

  var oLayer = CWCDHTML_GetLayer("zKeyMap2BoxBottom");
  oLayer.left = gKeyMapWhspc;
  oLayer.top = gKeyMapWvspc;
}

function LayerAdjustSize()
{
  LayerSetSizeInit();
  // Set the KeyMap position based on the ReferenceLayer
  KeyMapWPositionKeyMapDHTML();
}

I attached the modified files, the widget definition and UpdateMap.php just in case.

Norm







_______________________________________________
Chameleon mailing list
Chameleon@...
http://lists.maptools.org/mailman/listinfo/chameleon