[mapguide-commits] r8298 - in trunk/MgDev: . Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 9 07:11:44 PDT 2014


Author: jng
Date: 2014-07-09 07:11:44 -0700 (Wed, 09 Jul 2014)
New Revision: 8298

Modified:
   trunk/MgDev/
   trunk/MgDev/Web/src/viewerfiles/
   trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
Merged revision(s) 8297 from branches/2.6/MgDev:
#2462: Fix issue with selecting features in AJAX viewer via shift-click. The issue is that the code that processes the v2.6 QUERYMAPFEATURES response doesn't properly handle the case of appending selections via shift-click. This submission adds appending support.
........



Property changes on: trunk/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292
/sandbox/jng/convenience_apis:8263
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/v30:8212,8214,8217,8220-8221,8223-8225
/sandbox/rfc94:5099-5163
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297
/sandbox/jng/convenience_apis:8263
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/v30:8212,8214,8217,8220-8221,8223-8225
/sandbox/rfc94:5099-5163


Property changes on: trunk/MgDev/Web/src/viewerfiles
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev/Web/src/viewerfiles:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev/Web/src/viewerfiles:8288-8292
/sandbox/adsk/2.2gp/Web/src/viewerfiles:5392
/sandbox/jng/createruntimemap/Web/src/viewerfiles:7486-7555
   + /branches/2.4/MgDev/Web/src/viewerfiles:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev/Web/src/viewerfiles:8288-8292,8297
/sandbox/adsk/2.2gp/Web/src/viewerfiles:5392
/sandbox/jng/createruntimemap/Web/src/viewerfiles:7486-7555

Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2014-07-09 14:09:37 UTC (rev 8297)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2014-07-09 14:11:44 UTC (rev 8298)
@@ -3044,7 +3044,10 @@
     if(geom.indexOf("NaN") >= 0) return;
     
     var reqData = 1; //attributes
-    if (msie8plus || !msie)
+    //Only request inline selection if not appending, because we're not smart enough to know how
+    //to merge selection images together. This will cause a follow-up GETDYNAMICMAPOVERLAYIMAGE
+    //for the selection image
+    if (!append && (msie8plus || !msie))
         reqData |= 2; //inline selection
     var reqParams = "OPERATION=QUERYMAPFEATURES&VERSION=2.6.0&PERSIST=1&MAPNAME=" + encodeURIComponent(mapName) + "&SESSION=" + sessionId + "&SEQ=" + Math.random();
     reqParams += "&LAYERNAMES=" + encodeURIComponent(GetVisSelLayers()) + "&GEOMETRY=" + geom + "&SELECTIONVARIANT=" + queryVariant + "&CLIENTAGENT=" + encodeURIComponent(clientAgent);
@@ -3180,7 +3183,7 @@
                 //Check if we have attributes inline
                 var props = xmlIn.getElementsByTagName("SelectedLayer");
                 var resp = ConvertToSelectedFeatureSet(props);
-                ProcessSelectedFeatureSet(resp);
+                ProcessSelectedFeatureSet(resp, append);
             }
             else
             {
@@ -4224,16 +4227,18 @@
     return featuresByLayer;
 }
 
-function ProcessSelectedFeatureSet(resp)
+function ProcessSelectedFeatureSet(resp, append)
 {
-    selFeatures = {};
-    selBounds = null;
     if (!resp)
         return;
 
     var selLayers = document.getElementById("selLayers");
-    selLayers.length = 0;
-    GetPropertyCtrl().Clear();
+    if (!append) {
+        selFeatures = {};
+        selBounds = null;
+        selLayers.length = 0;
+        GetPropertyCtrl().Clear();
+    }
     
     //Construct layer list
     for(var layerName in resp)
@@ -4241,15 +4246,33 @@
         var opt = new Option();
         opt.text = layerName;
         opt.value = layerName;
-        
-        if(msie)
-            selLayers.add(opt);
-        else
-            selLayers.add(opt, null);
+        var bAddOption = true;
+        if (append) {
+            for (var i = 0; i < selLayers.length; i++) {
+                if (layerName == selLayers[i].value) {
+                    bAddOption = false;
+                    break;
+                }
+            }
+        }
+        if (bAddOption) {
+            if(msie)
+                selLayers.add(opt);
+            else
+                selLayers.add(opt, null);
+        }
  
         //Associates the selected features on layer
-        selFeatures[layerName] = resp[layerName];
-        
+        if (append) {
+            if (typeof(selFeatures[layerName]) == 'undefined')
+                selFeatures[layerName] = [];
+            for (var i = 0; i < resp[layerName].length; i++) {
+                var feat = resp[layerName][i];
+                selFeatures[layerName].push(feat);
+            }
+        } else {
+            selFeatures[layerName] = resp[layerName];
+        }
         //Update selection bounding box
         for (var i = 0; i < resp[layerName].length; i++)
         {



More information about the mapguide-commits mailing list