[fusion-commits] r1456 - in trunk: MapGuide lib widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Aug 12 15:58:28 EDT 2008


Author: madair
Date: 2008-08-12 15:58:27 -0400 (Tue, 12 Aug 2008)
New Revision: 1456

Modified:
   trunk/MapGuide/MapGuide.js
   trunk/lib/Map.js
   trunk/widgets/Select.js
   trunk/widgets/SelectPolygon.js
   trunk/widgets/SelectRadius.js
Log:
closes #101: restore computed properties to query;  
selection widgets can now add a <ComputeMetadata>true</ComputeMetadata> element in their extension

Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js	2008-08-12 19:03:25 UTC (rev 1455)
+++ trunk/MapGuide/MapGuide.js	2008-08-12 19:58:27 UTC (rev 1456)
@@ -790,6 +790,7 @@
             'mapname': this._sMapname,
             'session': this.getSessionID(),
             'spatialfilter': options.geometry || '',
+            'computed': options.computed || '',
             'queryHiddenLayers': options.queryHiddenLayers || '',
             'maxfeatures': options.maxFeatures || 0, //zero means select all features
             'layers': options.layers || '',

Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js	2008-08-12 19:03:25 UTC (rev 1455)
+++ trunk/lib/Map.js	2008-08-12 19:58:27 UTC (rev 1456)
@@ -1132,6 +1132,19 @@
                 this.aElements[i][j] = o[layerName].values[i][j];
             }
         }
+        
+        //loop over all features in the metadata array
+        for (var i=0; i<o[layerName].metadata.length; i++) {
+          var featureMetadata = o[layerName].metadata[i];
+          var dim = featureMetadata[0];   //nothing to do with this one
+          var bbox = featureMetadata[1];
+          var center = featureMetadata[2];
+          var area = featureMetadata[3];
+          var length = featureMetadata[4];
+          this.area += parseFloat(area);
+          this.distance += parseFloat(length);
+        }
+        
         /*
         var iElement=0;
         while(oValueCollection) 

Modified: trunk/widgets/Select.js
===================================================================
--- trunk/widgets/Select.js	2008-08-12 19:03:25 UTC (rev 1455)
+++ trunk/widgets/Select.js	2008-08-12 19:58:27 UTC (rev 1456)
@@ -64,6 +64,10 @@
                            (json.QueryActiveLayer[0] == 'true' ||
                             json.QueryActiveLayer[0] == '1')) ? true : false;
         
+        this.bComputeMetadata = (json.ComputeMetadata &&
+                           (json.ComputeMetadata[0] == 'true' ||
+                            json.ComputeMetadata[0] == '1')) ? true : false;
+        
         if (this.bActiveOnly) {
             this.getMap().registerForEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED, OpenLayers.Function.bind(this.enable, this));
         }
@@ -162,6 +166,7 @@
         options.geometry = 'POLYGON(('+ sMin.x + ' ' +  sMin.y + ', ' +  sMax.x + ' ' +  sMin.y + ', ' + sMax.x + ' ' +  sMax.y + ', ' + sMin.x + ' ' +  sMax.y + ', ' + sMin.x + ' ' +  sMin.y + '))';
         options.selectionType = this.selectionType;
         options.maxFeatures = this.maxFeatures;
+        options.computed = this.bComputeMetadata;
 
         if (this.bActiveOnly) {
             var layer = this.getMap().getActiveLayer();

Modified: trunk/widgets/SelectPolygon.js
===================================================================
--- trunk/widgets/SelectPolygon.js	2008-08-12 19:03:25 UTC (rev 1455)
+++ trunk/widgets/SelectPolygon.js	2008-08-12 19:58:27 UTC (rev 1456)
@@ -50,6 +50,10 @@
         if (json.Tolerance && (parseInt(json.Tolerance[0]) > 0)) {
             nTolerance = parseInt(json.Tolerance[0]);
         }
+        this.bComputeMetadata = (json.ComputeMetadata &&
+                           (json.ComputeMetadata[0] == 'true' ||
+                            json.ComputeMetadata[0] == '1')) ? true : false;
+        
         this.polygon = new Fusion.Tool.Canvas.Polygon();
     },
     
@@ -184,6 +188,7 @@
         var options = {};
         options.geometry = wkt;
         options.selectionType = "inside";
+        options.computed = this.bComputeMetadata;
 
         if (this.bActiveOnly) {
             var layer = this.getMap().getActiveLayer();

Modified: trunk/widgets/SelectRadius.js
===================================================================
--- trunk/widgets/SelectRadius.js	2008-08-12 19:03:25 UTC (rev 1455)
+++ trunk/widgets/SelectRadius.js	2008-08-12 19:58:27 UTC (rev 1456)
@@ -55,7 +55,11 @@
         }
 
         this.defaultRadius = json.DefaultRadius ? parseInt(json.DefaultRadius[0]) : this.defaultRadius;
+        this.bComputeMetadata = (json.ComputeMetadata &&
+                           (json.ComputeMetadata[0] == 'true' ||
+                            json.ComputeMetadata[0] == '1')) ? true : false;
         
+        
         var container = json.RadiusTooltipContainer ? json.RadiusTooltipContainer[0] : '';
         if (container != '') {
             this.radiusTip = $(container);
@@ -248,6 +252,7 @@
         var options = {};
         options.geometry = wkt;
         options.selectionType = this.selectionType;
+        options.computed = this.bComputeMetadata;
 
         if (this.bActiveOnly) {
             var layer = this.getMap().getActiveLayer();



More information about the fusion-commits mailing list