[fusion-commits] r3017 - in trunk: . layers/MapGuide

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Mar 8 05:07:19 PST 2018


Author: jng
Date: 2018-03-08 05:07:19 -0800 (Thu, 08 Mar 2018)
New Revision: 3017

Modified:
   trunk/
   trunk/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: trunk
===================================================================
--- trunk	2018-03-08 13:05:33 UTC (rev 3016)
+++ trunk	2018-03-08 13:07:19 UTC (rev 3017)

Property changes on: trunk
___________________________________________________________________
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: trunk/layers/MapGuide/MapGuide.js
===================================================================
--- trunk/layers/MapGuide/MapGuide.js	2018-03-08 13:05:33 UTC (rev 3016)
+++ trunk/layers/MapGuide/MapGuide.js	2018-03-08 13:07:19 UTC (rev 3017)
@@ -1556,6 +1556,7 @@
       }
       if (this.previousSelection != null)
       {
+          this.previousAttributes = null;
           this.previousSelection.clear();
       }
     },
@@ -2264,6 +2265,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;
@@ -2312,16 +2316,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) {
@@ -2360,6 +2368,7 @@
 Fusion.SimpleSelectionObject = OpenLayers.Class({
     aLayers : null,
     nLayers : 0,
+    isDeselect: false,
 
     initialize: function(featureInfoResponse, bClean)
     {
@@ -2481,6 +2490,7 @@
     {
         if (previousSelection != null && previousSelection.nLayers > 0)
         {
+            this.isDeselect = false;
             for (var prevSelIndex = 0; prevSelIndex < previousSelection.nLayers; prevSelIndex++)
             {
                 var prevSelLayer = previousSelection.aLayers[prevSelIndex];
@@ -2501,11 +2511,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
@@ -2524,6 +2535,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