[mapguide-commits] r5917 - trunk/MgDev/Web/src/mapviewerphp
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jun 3 11:23:35 EDT 2011
Author: jng
Date: 2011-06-03 08:23:35 -0700 (Fri, 03 Jun 2011)
New Revision: 5917
Modified:
trunk/MgDev/Web/src/mapviewerphp/getselectedfeatures.php
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. This is the PHP modifications
Modified: trunk/MgDev/Web/src/mapviewerphp/getselectedfeatures.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/getselectedfeatures.php 2011-06-03 15:23:12 UTC (rev 5916)
+++ trunk/MgDev/Web/src/mapviewerphp/getselectedfeatures.php 2011-06-03 15:23:35 UTC (rev 5917)
@@ -53,10 +53,12 @@
}
}
-class ZoomPoint
+class ZoomBox
{
- public $x;
- public $y;
+ public $minx;
+ public $miny;
+ public $maxx;
+ public $maxy;
}
//
@@ -196,9 +198,11 @@
$ll = $env->GetLowerLeftCoordinate();
$ur = $env->GetUpperRightCoordinate();
- $zoom = new ZoomPoint();
- $zoom->x = ($ll->GetX() + $ur->GetX()) / 2;
- $zoom->y = ($ll->GetY() + $ur->GetY()) / 2;
+ $zoom = new ZoomBox();
+ $zoom->minx = $ll->GetX();
+ $zoom->miny = $ll->GetY();
+ $zoom->maxx = $ur->GetX();
+ $zoom->maxy = $ur->GetY();
$feat->zoom = $zoom;
//FB::log("zoom: (".$zoom->x.",".$zoom->y.")");
@@ -317,9 +321,11 @@
//Add JSONified feature
if($feat->zoom != null)
{
- $xstr = number_format($feat->zoom->x, 8, '.','');
- $ystr = number_format($feat->zoom->y, 8, '.','');
- array_push($totalFeaturesOnLayer, "{\"values\" : [".join(",", $featureProperties)."], \"zoom\" : { \"x\": $xstr, \"y\": $ystr } }");
+ $minxstr = number_format($feat->zoom->minx, 8, '.','');
+ $minystr = number_format($feat->zoom->miny, 8, '.','');
+ $maxxstr = number_format($feat->zoom->maxx, 8, '.','');
+ $maxystr = number_format($feat->zoom->maxy, 8, '.','');
+ array_push($totalFeaturesOnLayer, "{\"values\" : [".join(",", $featureProperties)."], \"zoom\" : { \"minx\": $minxstr, \"miny\": $minystr, \"maxx\": $maxxstr, \"maxy\": $maxystr } }");
}
else
array_push($totalFeaturesOnLayer, "{\"values\" : [".join(",", $featureProperties)."], \"zoom\" : null }");
More information about the mapguide-commits
mailing list