[fusion-commits] r3016 - trunk/layers/MapGuide

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


Author: jng
Date: 2018-03-08 05:05:33 -0800 (Thu, 08 Mar 2018)
New Revision: 3016

Modified:
   trunk/layers/MapGuide/MapGuide.js
Log:
Back out r3013

There seems to be a pre-existing solution to this that wasn't merged in, give that a try.

Modified: trunk/layers/MapGuide/MapGuide.js
===================================================================
--- trunk/layers/MapGuide/MapGuide.js	2018-03-08 13:01:46 UTC (rev 3015)
+++ trunk/layers/MapGuide/MapGuide.js	2018-03-08 13:05:33 UTC (rev 3016)
@@ -2101,16 +2101,6 @@
                     var selLayer = selLayers[i];
                     var selFeatures = selLayer.Feature || [];
                     var layerName = selLayer["@name"];
-                    var layerId = selLayer["@id"];
-                    var featids = [];
-                    for (var l = 0; l < efi.FeatureInformation.FeatureSet.Layer.length; l++) {
-                        var selClass = efi.FeatureInformation.FeatureSet.Layer[l];
-                        if (selClass["@id"] == layerId) {
-                            for (var j = 0; j < selClass.Class.ID.length; j++) {
-                                featids.push(selClass.Class.ID[j]);
-                            }
-                        }
-                    }
                     if (!result[layerName]) {
                         if (selLayer.LayerMetadata) {
                             var layerMeta = selLayer.LayerMetadata;
@@ -2125,7 +2115,6 @@
                             }
                         }
                         result[layerName] = {
-                            layerId: layerId,
                             metadata: [],  //NOTE: Probably a defect, but regular code path is putting blank string arrays here too
                             metadatanames: ["dimension", "bbox", "center", "area", "length"],
                             numelements: selFeatures.length,
@@ -2132,8 +2121,7 @@
                             propertynames: pnames,
                             propertytypes: ptypes,
                             propertyvalues: pvals,
-                            values: [],
-                            featids: featids
+                            values: []
                         };
                         layerNames.push(layerName);
                     }
@@ -2182,16 +2170,6 @@
                     var selLayer = selLayers[i];
                     var selFeatures = selLayer.Feature || [];
                     var layerName = selLayer["@name"];
-                    var layerId = selLayer["@id"];
-                    var featids = [];
-                    for (var l = 0; l < efi.FeatureInformation.FeatureSet[0].Layer.length; l++) {
-                        var selClass = efi.FeatureInformation.FeatureSet[0].Layer[l];
-                        if (selClass["@id"][0] == layerId[0]) {
-                            for (var j = 0; j < selClass.Class[0].ID.length; j++) {
-                                featids.push(selClass.Class[0].ID[j]);
-                            }
-                        }
-                    }
                     if (!result[layerName]) {
                         if (selLayer.LayerMetadata) {
                             var layerMeta = selLayer.LayerMetadata[0];
@@ -2206,7 +2184,6 @@
                             }
                         }
                         result[layerName] = {
-                            layerId: layerId,
                             metadata: [],  //NOTE: Probably a defect, but regular code path is putting blank string arrays here too
                             metadatanames: ["dimension", "bbox", "center", "area", "length"],
                             numelements: selFeatures.length,
@@ -2213,8 +2190,7 @@
                             propertynames: pnames,
                             propertytypes: ptypes,
                             propertyvalues: pvals,
-                            values: [],
-                            featids: featids
+                            values: []
                         };
                         layerNames.push(layerName);
                     }
@@ -2283,7 +2259,7 @@
         //this.processSelectedFeatureInfo(r, false);
     },
 
-    mergeAttributes: function(attributes, prevAttributes, prevRemovals) {
+    mergeAttributes: function(attributes, prevAttributes) {
         if (!prevAttributes) {
             //Nothing to merge, return original
             return attributes;
@@ -2300,7 +2276,7 @@
         //Expand extents
         if (!merged.extents && attributes.extents) {
             merged.extents = attributes.extents;
-        } else {    
+        } else {
             if (attributes.extents) {
                 if (attributes.extents.minx < merged.extents.minx)
                     merged.extents.minx = attributes.extents.minx;
@@ -2315,45 +2291,16 @@
         //Bring in attributes
         for (var i = 0; i < attributes.layers.length; i++) {
             var layerName = attributes.layers[i][0];
-            var layerId = merged[layerName].layerId[0];
             if (typeof(merged[layerName]) == 'undefined') {
                 merged.layers.push(attributes.layers[i]);
                 merged[layerName] = attributes[layerName];
             } else {
-                var newFeatIds = attributes[layerName].featids;
                 var newValues = attributes[layerName].values;
                 for (var v = 0; v < newValues.length; v++) {
-                    var bAddThis = true;
-                    //Only add if these ids are not on the removal list
-                    if (prevRemovals[layerId]) {
-                        if (prevRemovals[layerId].removed.indexOf(newFeatIds[v]) >= 0) {
-                            bAddThis = false;
-                        }
-                    }
-                    if (bAddThis) {
-                        merged[layerName].featids.push(newFeatIds[v]);
-                        merged[layerName].values.push(newValues[v]);
-                        merged[layerName].numelements++;
-                    }
+                    merged[layerName].values.push(newValues[v]);
+                    merged[layerName].numelements++;
                 }
             }
-            //Trim off attributes at indices indicated by the previous feature key merge
-            if (prevRemovals[layerId]) {
-                var removeIndices = [];
-                for (var j = 0; j < prevRemovals[layerId].removed.length; j++) {
-                    var fid = prevRemovals[layerId].removed[j];
-                    var idx = merged[layerName].featids.indexOf(fid);
-                    if (idx >= 0) {
-                        removeIndices.push(idx);
-                    }
-                }
-                removeIndices.reverse();
-                for (var j = 0; j < removeIndices.length; j++) {
-                    var removeIndex = removeIndices[j];
-                    merged[layerName].numelements--;
-                    merged[layerName].values.splice(removeIndex, 1);
-                }
-            }
         }
         return merged;
     },
@@ -2364,8 +2311,8 @@
         var attributes = this.convertExtendedFeatureInfo(o);
         if (mergeSelection == true)
         {
-            var removals = sel.merge(this.previousSelection);
-            attributes = this.mergeAttributes(attributes, this.previousAttributes, removals);
+            sel.merge(this.previousSelection);
+            attributes = this.mergeAttributes(attributes, this.previousAttributes);
         }
         var selText = sel.getSelectionXml();
         this.previousSelection = sel;
@@ -2532,7 +2479,6 @@
 
     merge : function(previousSelection)
     {
-        var removals = {};
         if (previousSelection != null && previousSelection.nLayers > 0)
         {
             for (var prevSelIndex = 0; prevSelIndex < previousSelection.nLayers; prevSelIndex++)
@@ -2539,14 +2485,8 @@
             {
                 var prevSelLayer = previousSelection.aLayers[prevSelIndex];
 
-                var layerName = prevSelLayer.getName();
-                if (!removals[layerName]) {
-                    removals[layerName] = {
-                        removed: []
-                    }
-                }
                 // find the previously selected layer name in the current selection
-                var currentLayer = this.getLayerByName(layerName);
+                var currentLayer = this.getLayerByName(prevSelLayer.getName());
                 if (currentLayer != null)
                 {
                     // add the previously selected features for this layer
@@ -2563,14 +2503,6 @@
                             currentLayer.removeFeatures(prevSelFeatureIndexes);
                         }
                     }
-                    // Any feat ids in the prev selection not in the new one, record their indices so we
-                    // can trim off attributes at those indices
-                    for (var k = 0; k < prevSelLayer.featIds.length; k++) {
-                        var fid = prevSelLayer.featIds[k];
-                        if (currentLayer.featIds.indexOf(fid) < 0) {
-                            removals[layerName].removed.push(fid);
-                        }
-                    }
                     if (currentLayer.featIds.length == 0)
                     {
                         this.clear();
@@ -2590,7 +2522,6 @@
                 }
             }
         }
-        return removals;
     },
 
     clear: function()



More information about the fusion-commits mailing list