[fusion-commits] r2870 - in trunk: . layers/MapGuide widgets/Search
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Jul 30 00:22:43 PDT 2014
Author: jng
Date: 2014-07-30 00:22:43 -0700 (Wed, 30 Jul 2014)
New Revision: 2870
Modified:
trunk/
trunk/layers/MapGuide/MapGuide.js
trunk/widgets/Search/Search.php
Log:
Merged revision(s) 2869 from branches/fusion-mg26:
#624: Fix inability to select results of a search widget. The search widget is now v2.6 QUERYMAPFEATURES aware.
........
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/fusion-mg24:2560
/branches/fusion-mg26:2855
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
+ /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
Modified: trunk/layers/MapGuide/MapGuide.js
===================================================================
--- trunk/layers/MapGuide/MapGuide.js 2014-07-30 07:15:50 UTC (rev 2869)
+++ trunk/layers/MapGuide/MapGuide.js 2014-07-30 07:22:43 UTC (rev 2870)
@@ -1195,7 +1195,11 @@
//this API to allow the selection to be extended with a shift-click.
if(selText != "" && selText != null) {
- this.updateSelection(selText, zoomTo, false);
+ if (this.bUseNativeServices) {
+ this.updateMapSelection(selText, zoomTo, false, true);
+ } else {
+ this.updateSelection(selText, zoomTo, false);
+ }
}
else {
this.clearSelection();
@@ -1223,9 +1227,13 @@
Fusion.ajaxRequest(getPropertiesScript, options);
},
- updateMapSelection: function (selText, zoomTo, mergeSelection) {
+ updateMapSelection: function (selText, zoomTo, mergeSelection, returnAttributes) {
this.mapWidget._addWorker();
if (this.bUseNativeServices) {
+ var reqData = 4; //hyperlinks only
+ if (returnAttributes == true) {
+ reqData |= 1; //Attributes
+ }
//NOTE:
// This code path assumes our "2.6" or above MapGuide Server is assumed to have this particular
// issue fixed: http://trac.osgeo.org/mapguide/changeset/8288
@@ -1239,10 +1247,10 @@
selText,
null,
0, //All layers
- 4, //hyperlinks only
+ reqData,
this.selectionColor,
this.selectionImageFormat);
- var callback = OpenLayers.Function.bind(this.onNativeSelectionUpdate, this, zoomTo);
+ var callback = OpenLayers.Function.bind(this.onNativeSelectionUpdate, this, zoomTo, returnAttributes);
Fusion.oBroker.dispatchRequest(r, callback);
} else {
var sl = Fusion.getScriptLanguage();
@@ -1383,8 +1391,15 @@
}
},
- onNativeSelectionUpdate: function(zoomTo, r) {
+ onNativeSelectionUpdate: function(zoomTo, returnAttributes, r) {
//Set up the expected response text for renderSelection()
+ if (returnAttributes) { //This update requires a client-side update of selection and attribute info
+ var o = Fusion.parseJSON(r.responseText);
+ var sel = new Fusion.SimpleSelectionObject(o);
+ var attributes = this.convertExtendedFeatureInfo(o);
+ this.previousSelection = sel;
+ this.previousAttributes = attributes;
+ }
var sel = this.previousSelection;
var resp = {
hasSelection: false,
@@ -1404,6 +1419,9 @@
};
}
}
+ if (this.previousAttributes) {
+ resp.extents = this.previousAttributes.extents;
+ }
r.responseText = JSON.stringify(resp);
this.renderSelection(zoomTo, r);
this.processSelectedFeaturePropertiesNode(this.previousAttributes);
@@ -1449,8 +1467,10 @@
if (zoomTo) {
var ext = oNode.extents;
- var extents = new OpenLayers.Bounds(ext.minx, ext.miny, ext.maxx, ext.maxy);
- this.mapWidget.setExtents(extents);
+ if (ext != null) {
+ var extents = new OpenLayers.Bounds(ext.minx, ext.miny, ext.maxx, ext.maxy);
+ this.mapWidget.setExtents(extents);
+ }
}
this.drawSelection();
} else {
@@ -1933,6 +1953,10 @@
},
mergeAttributes: function(attributes, prevAttributes) {
+ if (!prevAttributes) {
+ //Nothing to merge, return original
+ return attributes;
+ }
//Start off with prevAttributes as the base
var merged = {};
merged.hasSelection = prevAttributes.hasSelection;
@@ -2241,7 +2265,4 @@
Array.prototype.remove = function(indexToRemove) {
this.splice(indexToRemove, 1);
-};
-
-
-
+};
\ No newline at end of file
Modified: trunk/widgets/Search/Search.php
===================================================================
--- trunk/widgets/Search/Search.php 2014-07-30 07:15:50 UTC (rev 2869)
+++ trunk/widgets/Search/Search.php 2014-07-30 07:22:43 UTC (rev 2870)
@@ -57,6 +57,7 @@
$resNames = array();
$resProps = array();
$matchLimit = "";
+ $features = NULL;
GetRequestParameters();
SetLocalizedFilesPath(GetLocalizationPath());
More information about the fusion-commits
mailing list