[Mapbender-commits] r3520 - branches/print_dev/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Feb 6 09:54:33 EST 2009
Author: mschulz
Date: 2009-02-06 09:54:33 -0500 (Fri, 06 Feb 2009)
New Revision: 3520
Modified:
branches/print_dev/http/classes/class_map.php
Log:
merged from trunk
Modified: branches/print_dev/http/classes/class_map.php
===================================================================
--- branches/print_dev/http/classes/class_map.php 2009-02-06 14:35:56 UTC (rev 3519)
+++ branches/print_dev/http/classes/class_map.php 2009-02-06 14:54:33 UTC (rev 3520)
@@ -46,7 +46,7 @@
public function getWidth () {
return $this->width;
}
-
+
/**
* @param $value Integer
*/
@@ -106,8 +106,39 @@
public function getExtent () {
return $this->extent;
}
+
+ /**
+ *
+ * @return Mapbender_bbox extent information
+ */
+ public function getExtentInfo () {
+ return array($this->extent->min->x, $this->extent->min->y, $this->extent->max->x, $this->extent->max->y);
+ }
/**
+ * converts the extent of the map so that the maximum extent will be displayed
+ *
+ */
+ public function calculateExtent($aMapbenderBbox) {
+ $relation_px_x = $this->getWidth() / $this->getHeight();
+ $relation_px_y = $this->getHeight() / $this->getWidth();
+ $extentx = ($aMapbenderBbox->max->x - $aMapbenderBbox->min->x);
+ $extenty = ($aMapbenderBbox->max->y - $aMapbenderBbox->min->y);
+ $centerx = $aMapbenderBbox->min->x + $extentx/2;
+ $centery = $aMapbenderBbox->min->y + $extenty/2;
+ $relation_bbox_x = $extentx / $extenty;
+ if($relation_bbox_x <= $relation_px_x){
+ $aMapbenderBbox->min->x = $centerx - $relation_px_x * $extenty / 2;
+ $aMapbenderBbox->max->x = $centerx + $relation_px_x * $extenty / 2;
+ }
+ if($relation_bbox_x > $relation_px_x){
+ $aMapbenderBbox->min->y = $centery - $relation_px_y * $extentx / 2;
+ $aMapbenderBbox->max->y = $centery + $relation_px_y * $extentx / 2;
+ }
+ $this->setExtent($aMapbenderBbox);
+ }
+
+ /**
*
* @return String EPSG code of the map.
*/
@@ -296,7 +327,6 @@
$newLayer->gui_layer_status = $currentLayer->gui_layer_status;
$newLayer->gui_layer_style = $currentLayer->gui_layer_style;
$newLayer->gui_layer_selectable = $currentLayer->gui_layer_selectable;
-
if ($this->isOverview) {
preg_match_all("/LAYERS\=([^&]*)/", $jsMapObject->mapURL[0], $resultMatrix);
$layerList = $resultMatrix[1][0];
More information about the Mapbender_commits
mailing list