[fusion-commits] r2005 - in trunk: layers/MapServer/php widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Dec 2 13:37:45 EST 2009


Author: pdeschamps
Date: 2009-12-02 13:37:44 -0500 (Wed, 02 Dec 2009)
New Revision: 2005

Modified:
   trunk/layers/MapServer/php/SetLayers.php
   trunk/widgets/LayerManager.js
Log:
Layer reversal issue


Modified: trunk/layers/MapServer/php/SetLayers.php
===================================================================
--- trunk/layers/MapServer/php/SetLayers.php	2009-12-02 18:36:10 UTC (rev 2004)
+++ trunk/layers/MapServer/php/SetLayers.php	2009-12-02 18:37:44 UTC (rev 2005)
@@ -65,7 +65,7 @@
 	}
 		echo "*/";
 } else {
-  echo "/* reordering layers */";
+
 	$res = $oMap->setlayersdrawingorder($layers);
 }
 
@@ -73,7 +73,7 @@
     $oMap->save($_SESSION['maps'][$mapName]);
     $oMap = ms_newMapObj($_SESSION['maps'][$mapName]);
     $newLayers = $oMap->getlayersdrawingorder();
-    echo "{success: true, layerindex: [".implode(",",$newLayers)."]}";
+    echo "{success: true, layerindex: [".implode(",",$layers)."]}";
 } else {
     echo "{success: false, layerindex: [".$_REQUEST['layerindex']."]}";
 }

Modified: trunk/widgets/LayerManager.js
===================================================================
--- trunk/widgets/LayerManager.js	2009-12-02 18:36:10 UTC (rev 2004)
+++ trunk/widgets/LayerManager.js	2009-12-02 18:37:44 UTC (rev 2005)
@@ -54,8 +54,8 @@
     currentNode: null,
     bIsDrawn: false,
     map: null,
-    bLayerChanged:false,
     initializeWidget: function(widgetTag) {
+        //console.log("initializeWidget");
         var json = widgetTag.extension;
         this.delIconSrc = json.DeleteIcon ? json.DeleteIcon[0] : 'images/icons/select-delete.png';
     
@@ -71,22 +71,18 @@
     
     mapLoaded: function() {
         this.draw();
-        this.bLayerChanged = true;
     },
-    
     layerChanged: function() {
-        this.bLayerChanged = true;
-        this.draw();
         this.updateSessionMapFile();
     },
-   mapReLoaded: function(){
-        this.bLayerChanged = false;
+    mapReLoaded: function(){
         this.draw();
    },
    /**
      * remove the dom objects representing the legend layers and groups
      */
     clear: function(node) {
+        //console.log("clear");
         while (node.childNodes.length > 0) {
           this.clear(node.childNodes[0]);
             node.destroy(node.childNodes[0]);
@@ -99,6 +95,7 @@
      * @param r Object the reponse xhr object
      */
     draw: function(r) {
+        //console.log("draw");
       if (this.mapList) {
         this.clear(this.mapList);
         this.mapList.destroy();
@@ -113,7 +110,6 @@
       //this processes the OL layers
       var map = this.getMap();
 
-      
       for (var i=0; i<map.aMaps.length; ++i) {
         var mapBlock = document.createElement('li');
         mapBlock.className = 'jxLmanMap';
@@ -139,19 +135,15 @@
     },
 
     processMapBlock: function(blockDom, map) {
+      //console.log("processMapBlock");
       var mapBlockList = document.createElement('ul');
       mapBlockList.className = 'jxLmanSet';
       mapBlockList.id = 'fusionLayerManager_'+map.getMapName();
       blockDom.appendChild(mapBlockList);
       map.layerPrefix = 'layer_';   //TODO make this unique for each block
-      mapBlockList.bLayerChanged = this.bLayerChanged;
       //this process all layers within an OL layer
       var processArray = map.aLayers;
-
-      if (map.bLayersReversed && this.bLayerChanged === false ) {
-        processArray.reverse();
-      }
-      
+    
       for (var i=0; i<processArray.length; ++i) {
         var blockItem = document.createElement('li');
         blockItem.className = 'jxLmanLayer';
@@ -235,6 +227,7 @@
   },
   
   updateLayer: function(map, ul) {
+   //console.log("updateLayer");
     //reorder the layers in the client as well as the session
     var aLayerIndex = [];
     var aIds = [];
@@ -242,9 +235,6 @@
     for (var i=0; i<nLayers; ++i) {
       aIds[i] = this.childNodes[i].id.split('_');
       var index = parseInt(aIds[i].pop());
-      if (map.bLayersReversed && ul.bLayerChanged === false) {
-        index = nLayers - (index+1);
-      }
       aLayerIndex.push(index);
       this.childNodes[i].id = '';
     }
@@ -257,9 +247,6 @@
       node.childNodes[1].checked = node.layer.isVisible()
     }
 
-    if (map.bLayersReversed && ul.bLayerChanged === false) {
-      aLayerIndex.reverse();
-    }
     map.reorderLayers(aLayerIndex);
   },
    
@@ -268,6 +255,7 @@
   },
   
   deleteLayer: function(layer, ev) {
+   // console.log("deleteLayer");
     var targetLI = (new Event(ev)).target.parentNode;
     var ul = targetLI.parentNode;
     $(targetLI).dispose();
@@ -284,6 +272,7 @@
     }
   },
   updateSessionMapFile: function(){
+   // console.log("updateSessionMapFile");
     // get map
     var map = this.getMap();
     var aMaps = map.getAllMaps();



More information about the fusion-commits mailing list