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

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Mar 5 02:52:23 PST 2019


Author: jng
Date: 2019-03-05 02:52:23 -0800 (Tue, 05 Mar 2019)
New Revision: 3050

Modified:
   branches/fusion-mg31/
   branches/fusion-mg31/layers/MapGuide/MapGuide.js
Log:
Merged revision(s) 3049 from trunk:
Fix Google Maps offset. Don't re-define Array.find and Array.remove (the cause of so many Google Maps breakges), just have dedicated array functions for that purpose.

I can verify with this change that the (heavily watermarked, pestering me to cough up a credit card for billing) Google Maps tiles do line up with the map again.

Fixes #665
........


Index: branches/fusion-mg31
===================================================================
--- branches/fusion-mg31	2019-03-05 10:50:33 UTC (rev 3049)
+++ branches/fusion-mg31	2019-03-05 10:52:23 UTC (rev 3050)

Property changes on: branches/fusion-mg31
___________________________________________________________________
Modified: svn:mergeinfo
## -11,4 +11,4 ##
 /sandbox/robust_error_handling:2818-2825
 /sandbox/stamen:2873-2875
 /sandbox/tiling:2845-2846
-/trunk:2943-3032,3045,3047
\ No newline at end of property
+/trunk:2943-3032,3045,3047,3049
\ No newline at end of property
Modified: branches/fusion-mg31/layers/MapGuide/MapGuide.js
===================================================================
--- branches/fusion-mg31/layers/MapGuide/MapGuide.js	2019-03-05 10:50:33 UTC (rev 3049)
+++ branches/fusion-mg31/layers/MapGuide/MapGuide.js	2019-03-05 10:52:23 UTC (rev 3050)
@@ -23,6 +23,29 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+
+function arrayFind(array, searchStr) {
+    var returnArray = null;
+    for (i=0; i<array.length; i++) {
+      if (typeof(searchStr) == 'function' && typeof(searchStr.test) == 'function') {
+        if (searchStr.test(array[i])) {
+          if (!returnArray) { returnArray = [] }
+          returnArray.push(i);
+        }
+      } else {
+        if (array[i]===searchStr) {
+          if (!returnArray) { returnArray = [] }
+          returnArray.push(i);
+        }
+      }
+    }
+    return returnArray;
+}
+
+function arrayRemove(array, indexToRemove) {
+    array.splice(indexToRemove, 1);
+}
+
 /***************************************************************************
 * Class: Fusion.Layers.MapGuide
 *
@@ -2541,7 +2564,7 @@
                     // add the previously selected features for this layer
                     for (var j = 0; j < prevSelLayer.getNumFeatures(); j++)
                     {
-                        var prevSelFeatureIndexes = currentLayer.featIds.find(prevSelLayer.featIds[j]);
+                        var prevSelFeatureIndexes = arrayFind(currentLayer.featIds, prevSelLayer.featIds[j]);
                         if (prevSelFeatureIndexes == null)
                         {
                             currentLayer.addFeature(prevSelLayer.featIds[j]);
@@ -2593,7 +2616,7 @@
         var index = this.getLayerIndex(layer);
         if (index >=0 && index < this.nLayers)
         {
-            this.aLayers.remove(index);
+            arrayRemove(this.aLayers, index);
             this.nLayers--;
         } 
     },
@@ -2645,30 +2668,8 @@
         var numIndexes = featureIndexes.length;
         for (var featIndex = 0; featIndex < numIndexes; featIndex++)
         {
-            this.featIds.remove(featureIndexes[featIndex]);
+            arrayRemove(this.featIds, featureIndexes[featIndex]);
             this.nFeatures--;
         }
     }
-});
-
-Array.prototype.find = function(searchStr) {
-  var returnArray = null;
-  for (i=0; i<this.length; i++) {
-    if (typeof(searchStr) == 'function' && typeof(searchStr.test) == 'function') {
-      if (searchStr.test(this[i])) {
-        if (!returnArray) { returnArray = [] }
-        returnArray.push(i);
-      }
-    } else {
-      if (this[i]===searchStr) {
-        if (!returnArray) { returnArray = [] }
-        returnArray.push(i);
-      }
-    }
-  }
-  return returnArray;
-};
-
-Array.prototype.remove = function(indexToRemove) {
-    this.splice(indexToRemove, 1);
-};
\ No newline at end of file
+});
\ No newline at end of file



More information about the fusion-commits mailing list