[fusion-commits] r1789 - trunk/layers/MapServer

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Feb 13 17:29:18 EST 2009


Author: pdeschamps
Date: 2009-02-13 17:29:18 -0500 (Fri, 13 Feb 2009)
New Revision: 1789

Modified:
   trunk/layers/MapServer/MapServer.js
Log:
added tweaks for maptips


Modified: trunk/layers/MapServer/MapServer.js
===================================================================
--- trunk/layers/MapServer/MapServer.js	2009-02-13 22:28:02 UTC (rev 1788)
+++ trunk/layers/MapServer/MapServer.js	2009-02-13 22:29:18 UTC (rev 1789)
@@ -41,6 +41,7 @@
     mapMetadataKeys: null,
     layerMetadataKeys: null,
     oMaptip:null,
+    bMapTipFired: false,
 
     //the map file
     sMapFile: null,
@@ -783,41 +784,49 @@
     },
 
     getMapTip: function(oMapTips){
-        //console.log("MAPSERVER:getMapTip");
-        var pos = this.mapWidget.pixToGeo(oMapTips.oCurrentPosition.x, oMapTips.oCurrentPosition.y);
-        var dfGeoTolerance = this.mapWidget.pixToGeoMeasure(oMapTips.nTolerance);
-        var minx = pos.x-dfGeoTolerance;
-        var miny = pos.y-dfGeoTolerance;
-        var maxx = pos.x+dfGeoTolerance;
-        var maxy = pos.y+dfGeoTolerance;
-        var geometry = 'POLYGON(('+ minx + ' ' + miny + ', ' + minx + ' ' + maxy + ', ' + maxx + ' ' + maxy + ', ' + maxx + ' ' + miny + ', ' + minx + ' ' + miny + '))';
-        var selectionType = "INTERSECTS";
+        if(this.bMapTipFired == false){
+            //console.log("MAPSERVER:getMapTip");
+            var pos = this.mapWidget.pixToGeo(oMapTips.oCurrentPosition.x, oMapTips.oCurrentPosition.y);
+            var dfGeoTolerance = this.mapWidget.pixToGeoMeasure(oMapTips.nTolerance);
+            var minx = pos.x-dfGeoTolerance;
+            var miny = pos.y-dfGeoTolerance;
+            var maxx = pos.x+dfGeoTolerance;
+            var maxy = pos.y+dfGeoTolerance;
+            var geometry = 'POLYGON(('+ minx + ' ' + miny + ', ' + minx + ' ' + maxy + ', ' + maxx + ' ' + maxy + ', ' + maxx + ' ' + miny + ', ' + minx + ' ' + miny + '))';
+            var selectionType = "INTERSECTS";
 
-        var loadmapScript = '/layers/'+ this.arch + '/php/Maptip.php';
-        var params = {
-            'mapname': this._sMapname,
-            'session': this.getSessionID(),
-            'spatialfilter': geometry,
-            'maxfeatures': 0, //zero means select all features
-            'variant': selectionType,
-            'layer': oMapTips.aLayers[0] || '',
-            'textfield': oMapTips.textField || '',
-            'customURL': oMapTips.customURL || ''
+            var loadmapScript = '/layers/'+ this.arch + '/php/Maptip.php';
+            var params = {
+                'mapname': this._sMapname,
+                'session': this.getSessionID(),
+                'spatialfilter': geometry,
+                'maxfeatures': 0, //zero means select all features
+                'variant': selectionType,
+                'layer': oMapTips.aLayers || '',
+                'textfield': oMapTips.aTextFields || '',
+                'label': oMapTips.aLabels || '',
+                'customURL': oMapTips.aCustomURL || ''
+            }
+            var parseMapTip = this.parseMapTip.bind(this);
+            this.bMapTipFired = true;
+            var ajaxOptions = {
+                onSuccess: function(response){
+                        eval("rjson=" + response.responseText);
+                        parseMapTip(rjson);
+                        },
+                        parameters: params};
+            Fusion.ajaxRequest(loadmapScript, ajaxOptions);
         }
-        var parseMapTip = this.parseMapTip.bind(this);
-        var ajaxOptions = {
-            onSuccess: function(response){
-                    eval("rjson=" + response.responseText);
-                    parseMapTip(rjson);
-                    },
-                    parameters: params};
-        Fusion.ajaxRequest(loadmapScript, ajaxOptions);
     },
     
     parseMapTip: function(json){
-        this.oMaptip = {};
-        this.oMaptip.t = json.mapTipText;
-        this.oMaptip.h = json.mapTipLink;
+        this.bMapTipFired = false;
+        this.oMaptip = {};       
+        this.oMaptip.t = json.maptips;
+        this.oMaptip.h = json.url;
+        // mapserver only
+        this.oMaptip.l= json.label;
+        
         this.mapWidget.triggerEvent(Fusion.Event.MAP_MAPTIP_REQ_FINISHED, this.oMaptip);
     }
 });



More information about the fusion-commits mailing list