[Mapbender-commits] r7050 - in trunk/mapbender/http: classes plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Oct 18 11:22:32 EDT 2010
Author: christoph
Date: 2010-10-18 08:22:32 -0700 (Mon, 18 Oct 2010)
New Revision: 7050
Modified:
trunk/mapbender/http/classes/class_wms.php
trunk/mapbender/http/plugins/ol_wms.php
Log:
openlayers: set max extent to extent of first wms
Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php 2010-10-18 15:05:18 UTC (rev 7049)
+++ trunk/mapbender/http/classes/class_wms.php 2010-10-18 15:22:32 UTC (rev 7050)
@@ -286,9 +286,23 @@
} else {
$add_wms_string .= "visibility:false,";
}
+
+ // max extent
+ for ($i = 0; $i < count($this->objLayer[0]->layer_epsg); $i++) {
+ $rootLayerEpsg = $this->objLayer[0]->layer_epsg[$i];
+ if ($rootLayerEpsg["epsg"] === "EPSG:4326") {
+ $add_wms_string .= "maxExtent: new OpenLayers.Bounds(" .
+ $rootLayerEpsg["minx"] . "," .
+ $rootLayerEpsg["miny"] . "," .
+ $rootLayerEpsg["maxx"] . "," .
+ $rootLayerEpsg["maxy"] .
+ "),";
+ }
+ }
+
// initial transparency
$add_wms_string .= "opacity:" . strval(round($this->gui_wms_opacity/100, 2));
-
+
$add_wms_string .= "}";
$add_wms_string .= ");";
Modified: trunk/mapbender/http/plugins/ol_wms.php
===================================================================
--- trunk/mapbender/http/plugins/ol_wms.php 2010-10-18 15:05:18 UTC (rev 7049)
+++ trunk/mapbender/http/plugins/ol_wms.php 2010-10-18 15:22:32 UTC (rev 7050)
@@ -49,23 +49,6 @@
// create the first OL-layer as baselayer
$isBaseLayer = ($cnt === 0) ? true : false;
$mywms->createOlObjFromWMS( $isBaseLayer );
-
- if ($cnt === 0) {
- // set maxExtent of map to extent of the first WMS
- for ($i = 0; $i < count($mywms->objLayer[0]->layer_epsg); $i++) {
- $rootLayerEpsg = $mywms->objLayer[0]->layer_epsg[$i];
- if ($rootLayerEpsg["epsg"] === "EPSG:4326") {
- echo "console.log(ol_map.getMaxExtent());";
- echo "ol_map.setOptions({maxExtent: new OpenLayers.Bounds(" .
- $rootLayerEpsg["minx"] . "," .
- $rootLayerEpsg["miny"] . "," .
- $rootLayerEpsg["maxx"] . "," .
- $rootLayerEpsg["maxy"] .
- ")});";
- echo "console.log(ol_map.getMaxExtent());";
- }
- }
- }
$cnt++;
}
?>
More information about the Mapbender_commits
mailing list