[mapguide-commits] r9035 - in branches/3.1/MgDev: . Web/src/viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Sep 19 06:05:28 PDT 2016
Author: jng
Date: 2016-09-19 06:05:28 -0700 (Mon, 19 Sep 2016)
New Revision: 9035
Modified:
branches/3.1/MgDev/
branches/3.1/MgDev/Web/src/viewerfiles/
branches/3.1/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
Merged revision(s) 9034 from trunk/MgDev:
#2737: Fix selected features being added in append mode (SHIFT key pressed) when selecting a selected features. Previously (circa pre-2.6), this would de-select that particular feature, but with the introduction of the improved QUERYMAPFEATURES, this action would add the feature to the selection regardless.
To fix this, we add a selKey property to each selected feature and when we're selecting with append mode, we check if an existing feature with that selection key (matching the selection key we're about to include) exists, if so we remove the feature from the current selection set instead of including the feature
........
Property changes on: branches/3.1/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,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942,9019-9020
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996,9000,9004-9006,9010,9018-9021
+ /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,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942,9019-9020
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996,9000,9004-9006,9010,9018-9021,9034
Property changes on: branches/3.1/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,8297
/sandbox/adsk/2.2gp/Web/src/viewerfiles:5392
/sandbox/adsk/3.0m/Web/src/viewerfiles:8607
/sandbox/jng/createruntimemap/Web/src/viewerfiles:7486-7555
/sandbox/jng/v30/Web/src/viewerfiles:8226-8227
+ /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/adsk/3.0m/Web/src/viewerfiles:8607
/sandbox/jng/createruntimemap/Web/src/viewerfiles:7486-7555
/sandbox/jng/v30/Web/src/viewerfiles:8226-8227
/trunk/MgDev/Web/src/viewerfiles:9034
Modified: branches/3.1/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- branches/3.1/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2016-09-19 12:55:58 UTC (rev 9034)
+++ branches/3.1/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2016-09-19 13:05:28 UTC (rev 9035)
@@ -3182,7 +3182,7 @@
{
//Check if we have attributes inline
var props = xmlIn.getElementsByTagName("SelectedLayer");
- var resp = ConvertToSelectedFeatureSet(props);
+ var resp = ConvertToSelectedFeatureSet(props, xmlIn, append);
ProcessSelectedFeatureSet(resp, append);
}
else
@@ -4197,20 +4197,42 @@
var selFeatures = {};
var selBounds = null;
-function ConvertToSelectedFeatureSet(layerEls)
+function GetSelectedLayerElement(selLayerEls, layerId)
{
+ for (var i = 0; i < selLayerEls.length; i++) {
+ var selLayerEl = selLayerEls[i];
+ if (selLayerEl.getAttribute("id") == layerId) {
+ return selLayerEl;
+ }
+ }
+ return null;
+}
+
+function ConvertToSelectedFeatureSet(layerEls, xmlIn, append)
+{
var featuresByLayer = {};
+ //Unfortunately, Selection does not model the selection set
+ //in a way that we can attach selection keys without breaking
+ //the API, so we have no choice but to re-parse the XML selection
+ //again
+ var selLayerEls = xmlIn.getElementsByTagName("Layer");
+ //assert: selLayerEls.length == layerEls.length
for (var i = 0; i < layerEls.length; i++)
{
var layerEl = layerEls[i];
+ var layerId = layerEl.getAttribute("id");
+ var selLayerEl = GetSelectedLayerElement(selLayerEls, layerId);
+ var selFeatEls = selLayerEl.getElementsByTagName("ID");
var layerName = layerEl.getAttribute("name");
if (!featuresByLayer[layerName])
featuresByLayer[layerName] = [];
var featEls = layerEl.getElementsByTagName("Feature");
+ var selLayer = selection.layers.getItem(layerId);
+ //assert: selFeatEls.length == featEls.legnth
for (var j = 0; j < featEls.length; j++)
{
- var feat = { values: [] };
+ var feat = { /* INTERNAL_API */ selKey: ((msie && !msie10plus) ? selFeatEls[j].text : selFeatEls[j].textContent), values: [] };
var featEl = featEls[j];
var bounds = featEl.getElementsByTagName("Bounds")[0];
var bbox = ((msie && !msie10plus) ? bounds.text : bounds.textContent).split(" ");
@@ -4275,7 +4297,21 @@
selFeatures[layerName] = [];
for (var i = 0; i < resp[layerName].length; i++) {
var feat = resp[layerName][i];
- selFeatures[layerName].push(feat);
+ var selIndex = -1;
+ for (var j = 0; j < selFeatures[layerName].length; j++) {
+ var selFeat = selFeatures[layerName][j];
+ if (selFeat.selKey == feat.selKey) {
+ selIndex = j;
+ break;
+ }
+ }
+ //In append mode, if we find an existing selected feature with
+ //the same selection key, remove it instead of adding on.
+ if (selIndex >= 0) {
+ selFeatures[layerName].splice(selIndex, 1);
+ } else {
+ selFeatures[layerName].push(feat);
+ }
}
} else {
selFeatures[layerName] = resp[layerName];
More information about the mapguide-commits
mailing list