[fusion-commits] r3023 - in branches/fusion-mg31: . layers/MapGuide

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Mar 8 05:20:23 PST 2018


Author: jng
Date: 2018-03-08 05:20:23 -0800 (Thu, 08 Mar 2018)
New Revision: 3023

Modified:
   branches/fusion-mg31/
   branches/fusion-mg31/layers/MapGuide/MapGuide.js
Log:
Merged revision(s) 3007 from sandbox/adsk/3.1n:
Fix issue that Selection Panel is wrong after de-select features.
........


Index: branches/fusion-mg31
===================================================================
--- branches/fusion-mg31	2018-03-08 13:18:34 UTC (rev 3022)
+++ branches/fusion-mg31	2018-03-08 13:20:23 UTC (rev 3023)

Property changes on: branches/fusion-mg31
___________________________________________________________________
Modified: svn:mergeinfo
## -1,7 +1,7 ##
 /branches/fusion-mg24:2560
 /branches/fusion-mg26:2855,2869
 /sandbox/adsk/2.6l:2911
-/sandbox/adsk/3.1n:2925-2927,2935
+/sandbox/adsk/3.1n:2925-2927,2935,3007
 /sandbox/adsk/3.2o:2969-2972,2974,2978-2984
 /sandbox/createruntimemap:2699-2708
 /sandbox/jxlib-3.0:1957-2248
Modified: branches/fusion-mg31/layers/MapGuide/MapGuide.js
===================================================================
--- branches/fusion-mg31/layers/MapGuide/MapGuide.js	2018-03-08 13:18:34 UTC (rev 3022)
+++ branches/fusion-mg31/layers/MapGuide/MapGuide.js	2018-03-08 13:20:23 UTC (rev 3023)
@@ -1393,6 +1393,7 @@
       }
       if (this.previousSelection != null)
       {
+          this.previousAttributes = null;
           this.previousSelection.clear();
       }
     },
@@ -2025,6 +2026,9 @@
             //Nothing to merge, return original
             return attributes;
         }
+        if (!attributes.hasSelection) {
+            return prevAttributes;
+        }
         //Start off with prevAttributes as the base
         var merged = {};
         merged.hasSelection = prevAttributes.hasSelection;
@@ -2073,16 +2077,20 @@
         if (mergeSelection == true)
         {
             sel.merge(this.previousSelection);
-            attributes = this.mergeAttributes(attributes, this.previousAttributes);
+            if (sel.nLayers > 0)
+                attributes = this.mergeAttributes(attributes, this.previousAttributes);
         }
         var selText = sel.getSelectionXml();
-        this.previousSelection = sel;
         //Because the QUERYMAPFEATURES 2.6.0 response contains mostly everything we need, we cut down
         //on lots of async request ping-pong. So we can just update the selection image and notify any
         //interested parties of the new selection attributes
         if (selText != "" && selText != null) {
+            this.previousSelection = sel;
             this.previousAttributes = attributes;
-            this.updateMapSelection(selText, false, mergeSelection);
+            if (sel.isDeselect)
+                this.updateMapSelection(selText, false, false, true);
+            else
+                this.updateMapSelection(selText, false, mergeSelection);
         } else {
             //Only clear if we're not merging an empty selection
             if (mergeSelection == false) {
@@ -2121,6 +2129,7 @@
 Fusion.SimpleSelectionObject = OpenLayers.Class({
     aLayers : null,
     nLayers : 0,
+    isDeselect: false,
 
     initialize: function(featureInfoResponse)
     {
@@ -2218,6 +2227,7 @@
     {
         if (previousSelection != null && previousSelection.nLayers > 0)
         {
+            this.isDeselect = false;
             for (var prevSelIndex = 0; prevSelIndex < previousSelection.nLayers; prevSelIndex++)
             {
                 var prevSelLayer = previousSelection.aLayers[prevSelIndex];
@@ -2238,11 +2248,12 @@
                         {
                             // the feature was previously selected, so toggle it off when selected again
                             currentLayer.removeFeatures(prevSelFeatureIndexes);
+                            this.isDeselect = true;
                         }
                     }
                     if (currentLayer.featIds.length == 0)
                     {
-                        this.clear();
+                        this.removeLayer(currentLayer);
                     }
                 }
                 else
@@ -2261,6 +2272,30 @@
         }
     },
 
+    getLayerIndex : function(layer)
+    {
+        var index = -1;
+        for (var i=0; i<this.nLayers; i++)
+        {
+            if (this.aLayers[i] == layer)
+            {
+                index = i;
+                break;
+            }
+        }
+        return index;
+    },
+
+    removeLayer: function(layer)
+    {
+        var index = this.getLayerIndex(layer);
+        if (index >=0 && index < this.nLayers)
+        {
+            this.aLayers.remove(index);
+            this.nLayers--;
+        } 
+    },
+
     clear: function()
     {
         this.aLayers = [];



More information about the fusion-commits mailing list