[fusion-commits] r2054 - in sandbox/jxlib-3.0: layers/MapServer/php lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Feb 3 13:57:03 EST 2010


Author: pdeschamps
Date: 2010-02-03 13:57:02 -0500 (Wed, 03 Feb 2010)
New Revision: 2054

Modified:
   sandbox/jxlib-3.0/layers/MapServer/php/RestoreState.php
   sandbox/jxlib-3.0/lib/Map.js
Log:
tweaked RestoreState to restore the layer status on restore. Added Event 
handler for map_reloaded as the LoadScaleRanges call was not fireing 
when a ma is reloaded. 


Modified: sandbox/jxlib-3.0/layers/MapServer/php/RestoreState.php
===================================================================
--- sandbox/jxlib-3.0/layers/MapServer/php/RestoreState.php	2010-02-02 19:14:26 UTC (rev 2053)
+++ sandbox/jxlib-3.0/layers/MapServer/php/RestoreState.php	2010-02-03 18:57:02 UTC (rev 2054)
@@ -5,8 +5,8 @@
 include(dirname(__FILE__).'/Common.php');
 include('../../../common/php/Utilities.php');
 
-header('Content-type: application/json');
-header('X-JSON: true');
+//header('Content-type: application/json');
+//header('X-JSON: true');
 
 isset($_POST["session"])?$szSessionID = $_POST["session"]:$szSessionID = NULL ;
 isset($_REQUEST["id"])?$loadSessionID = $_REQUEST["id"]:$loadSessionID = NULL ;
@@ -39,6 +39,19 @@
 
                 $oMap = ms_newMapObj($oReturn->loadmap);
                 checkForGMLLayers($szDestination);
+                // turn off all the layers
+                for ($i=0;$i<$oMap->numlayers;$i++){
+                    $oLayer=$oMap->GetLayer($i);
+                    $oLayer->set("status", MS_OFF);
+                    }
+                // turn on the vis layers
+                $aLayers = explode(",",$oReturn->vislayers);
+                foreach($aLayers as $szName){
+                    $oLayer = $oMap->getLayerByName($szName);
+                    if($oLayer){
+                        $oLayer->set("status", MS_ON);
+                    }
+                }
                 $oMap->save($oReturn->loadmap);
                 echo var2json($oReturn);
             }
@@ -57,6 +70,7 @@
     die("{'error':'PHP Session path is invalid.'}");
     }
 
+
 function checkForGMLLayers($szDestination){
     global $oMap;
     @$oLayer = $oMap->getLayerByName("LWEGML-Point");

Modified: sandbox/jxlib-3.0/lib/Map.js
===================================================================
--- sandbox/jxlib-3.0/lib/Map.js	2010-02-02 19:14:26 UTC (rev 2053)
+++ sandbox/jxlib-3.0/lib/Map.js	2010-02-03 18:57:02 UTC (rev 2054)
@@ -172,9 +172,10 @@
         this.registerEventID(Fusion.Event.MAP_MAPTIP_REQ_FINISHED);
         this.registerEventID(Fusion.Event.WMS_LAYER_ADDED);
         this.registerEventID(Fusion.Event.MAP_SCALE_RANGE_LOADED);
-	this.registerEventID(Fusion.Event.MAP_MAP_GROUP_LOADED);
+        this.registerEventID(Fusion.Event.MAP_MAP_GROUP_LOADED);
 
         this.registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.mapLoaded,this));
+        this.registerForEvent(Fusion.Event.MAP_RELOADED, OpenLayers.Function.bind(this.mapLoaded,this));
 
         //register for OL map extent change events
         this.oMapOL.events.register('moveend', this, this.mapExtentsChanged);



More information about the fusion-commits mailing list