[Mapbender-commits] r6759 - in trunk/mapbender/http: classes javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Aug 11 11:52:58 EDT 2010


Author: christoph
Date: 2010-08-11 15:52:58 +0000 (Wed, 11 Aug 2010)
New Revision: 6759

Modified:
   trunk/mapbender/http/classes/class_map.php
   trunk/mapbender/http/classes/class_wmc.php
   trunk/mapbender/http/classes/class_wmcToXml.php
   trunk/mapbender/http/classes/class_wms.php
   trunk/mapbender/http/javascripts/initWmcObj.php
   trunk/mapbender/http/javascripts/map.php
Log:
workaround for layer epsg of root layer

Modified: trunk/mapbender/http/classes/class_map.php
===================================================================
--- trunk/mapbender/http/classes/class_map.php	2010-08-11 09:47:36 UTC (rev 6758)
+++ trunk/mapbender/http/classes/class_map.php	2010-08-11 15:52:58 UTC (rev 6759)
@@ -677,12 +677,27 @@
 			$currentMap->wmsArray = $wmsArray;
 			
 			// EXTENT
-			$minx = $wmsArray[0]->objLayer[0]->layer_epsg[0]["minx"];
-			$miny = $wmsArray[0]->objLayer[0]->layer_epsg[0]["miny"];
-			$maxx = $wmsArray[0]->objLayer[0]->layer_epsg[0]["maxx"];
-			$maxy = $wmsArray[0]->objLayer[0]->layer_epsg[0]["maxy"];
-			$epsg = $wmsArray[0]->objLayer[0]->layer_epsg[0]["epsg"];
+			$sql = "SELECT gui_wms_epsg FROM gui_wms WHERE gui_wms_position = 0 AND fkey_gui_id = $1";
+			$v = array($appId);
+			$t = array('s');
+			$res = db_prep_query($sql, $v, $t);
+			$row = db_fetch_array($res);
+			$epsg = $row["gui_wms_epsg"];
+			$layer_epsg = $wmsArray[0]->objLayer[0]->layer_epsg;
+			$j = 0;
+			for ($i = 0; $i < count($layer_epsg); $i++) {
+				if ($layer_epsg[$i]["epsg"] === $epsg) {
+					$j = $i;
+					break;
+				}
+			}
+			$minx = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["minx"];
+			$miny = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["miny"];
+			$maxx = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["maxx"];
+			$maxy = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["maxy"];
+			$epsg = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["epsg"];
 			$mapExtent = new Mapbender_bbox($minx, $miny, $maxx, $maxy, $epsg);
+			
 			$currentMap->setExtent($mapExtent);
 			return $currentMap;			
 		}

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2010-08-11 09:47:36 UTC (rev 6758)
+++ trunk/mapbender/http/classes/class_wmc.php	2010-08-11 15:52:58 UTC (rev 6759)
@@ -1619,12 +1619,18 @@
 					$layerMaxXArray = $currentLayer["extension"]["MAXX"];
 					$layerMaxYArray = $currentLayer["extension"]["MAXY"];
 				}
+
+				$wmcExtent = $this->mainMap->getExtent();
+				$wmcEpsg = $wmcExtent->epsg;
 	
+				$found = false;
 				for ($i=0; $i < count($layerEpsgArray); $i++) {
 					$currentLayerEpsg = array();
 					$currentLayerEpsg["epsg"] = $layerEpsgArray[$i];
 
-
+					if ($currentLayerEpsg["epsg"] === $wmcEpsg) {
+						$found = true;
+					}
 					if ($layerMinXArray[$i] == 0
 						&& $layerMinYArray[$i] == 0
 						&& $layerMaxXArray[$i] == 0
@@ -1643,6 +1649,23 @@
 					}
 					array_push($wms->objLayer[0]->layer_epsg, $currentLayerEpsg);
 				}
+				if (!$found) {
+					$sourceExtent = new Mapbender_bbox(
+						$wms->objLayer[0]->layer_epsg[0]["minx"],
+						$wms->objLayer[0]->layer_epsg[0]["maxx"],
+						$wms->objLayer[0]->layer_epsg[0]["miny"],
+						$wms->objLayer[0]->layer_epsg[0]["maxy"],
+						$wms->objLayer[0]->layer_epsg[0]["epsg"]
+					);
+					$sourceExtent->transform($wmcEpsg);
+					array_push($wms->objLayer[0]->layer_epsg, array(
+						"minx" => $sourceExtent->min->x,
+						"miny" => $sourceExtent->min->y,
+						"maxx" => $sourceExtent->max->x,
+						"maxy" => $sourceExtent->max->y,
+						"epsg" => $sourceExtent->epsg
+					));
+				}
 			}			
 			// add WMS
 			array_push($wmsArray, $wms);

Modified: trunk/mapbender/http/classes/class_wmcToXml.php
===================================================================
--- trunk/mapbender/http/classes/class_wmcToXml.php	2010-08-11 09:47:36 UTC (rev 6758)
+++ trunk/mapbender/http/classes/class_wmcToXml.php	2010-08-11 15:52:58 UTC (rev 6759)
@@ -429,6 +429,7 @@
 		$layerExtensionData["gui_queryable"] = $currentLayer->gui_layer_queryable;
 		$layerExtensionData["gui_status"] = $currentLayer->gui_layer_status;
 		$layerExtensionData["layer_epsg"] = $currentLayer->layer_epsg;
+	
 		for ($i = 0; $i < count($currentWms->gui_epsg); $i++) {
 			$found = false;
 			for ($j = 0; $j < count($layerExtensionData["layer_epsg"]); $j++) {

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2010-08-11 09:47:36 UTC (rev 6758)
+++ trunk/mapbender/http/classes/class_wms.php	2010-08-11 15:52:58 UTC (rev 6759)
@@ -2405,6 +2405,7 @@
 			$this->objLayer[$layer_cnt]->gui_layer_maxscale = $row["gui_layer_maxscale"];
 			$this->objLayer[$layer_cnt]->gui_layer_style = $row["gui_layer_style"];
 			$this->objLayer[$layer_cnt]->gui_layer_wfs_featuretype = $row["gui_layer_wfs_featuretype"];
+
 			$sql = "Select * from layer_epsg where fkey_layer_id = $1 ORDER BY fkey_layer_id";
 			$v = array($layer_id);
 			$t = array('i');

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2010-08-11 09:47:36 UTC (rev 6758)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2010-08-11 15:52:58 UTC (rev 6759)
@@ -216,6 +216,7 @@
 }
 
 //workaround to have a fully merged WMS for loading
+
 $xml = $wmc->toXml();
 $wmc = new wmc();
 $wmc->createFromXml($xml);

Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php	2010-08-11 09:47:36 UTC (rev 6758)
+++ trunk/mapbender/http/javascripts/map.php	2010-08-11 15:52:58 UTC (rev 6759)
@@ -332,6 +332,9 @@
 	Mapbender.events.init.done = true;
 	Mapbender.events.init.trigger();
 
+	// workaround for Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=388714
+	//
+	// found here: http://forums.mozillazine.org/viewtopic.php?f=25&t=729435
 	$('iframe').each(function () {
 	    this.src = this.src;
 	});



More information about the Mapbender_commits mailing list