[mapguide-commits] r5916 - trunk/MgDev/Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 3 11:23:12 EDT 2011


Author: jng
Date: 2011-06-03 08:23:12 -0700 (Fri, 03 Jun 2011)
New Revision: 5916

Modified:
   trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
#1486: Return the BBOX of each feature instead of its centroid. This way we can re-use the zoom to selection logic already built into the viewer to zoom to a level that encompasses the extent of the feature.

Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2011-06-03 14:32:18 UTC (rev 5915)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2011-06-03 15:23:12 UTC (rev 5916)
@@ -4185,7 +4185,14 @@
     
     //Get the zoom component of the selected feature, and zoom to that view
     if (feat.zoom)
-        ZoomToView(feat.zoom.x, feat.zoom.y, GetFeatureZoomLevel(), true);
+    {
+        var mcsW = feat.zoom.maxx - feat.zoom.minx;
+        var mcsH = feat.zoom.maxy - feat.zoom.miny;
+        var centerX = feat.zoom.minx + mcsW / 2;
+        var centerY = feat.zoom.miny + mcsH / 2;
+        var scale = CalculateScale1(mcsW*2, mcsH*2, mapDevW, mapDevH);
+        GotoView(centerX, centerY, scale, true, true);
+    }
 }
 
 function HoverButton(eltId, description)



More information about the mapguide-commits mailing list