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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Feb 15 04:45:42 EST 2011


Author: kmq
Date: 2011-02-15 01:45:42 -0800 (Tue, 15 Feb 2011)
New Revision: 7605

Modified:
   trunk/mapbender/http/classes/class_gml2.php
   trunk/mapbender/http/javascripts/initWmcObj.php
   trunk/mapbender/http/javascripts/mod_renderGML.php
Log:
class_gml2 now exposes epsg and initWmc and RdnerGML work together to zoom to a gml that may be stored in the session

Modified: trunk/mapbender/http/classes/class_gml2.php
===================================================================
--- trunk/mapbender/http/classes/class_gml2.php	2011-02-14 17:10:23 UTC (rev 7604)
+++ trunk/mapbender/http/classes/class_gml2.php	2011-02-15 09:45:42 UTC (rev 7605)
@@ -243,6 +243,34 @@
 				$boundedBy = true;
 			}
 			if ($boundedBy) {
+				if(strtoupper($this->sepNameSpace($element[tag])) == strtoupper("box")){
+					
+					$epsgAttr = "";
+					if(isset($element['attributes'])){
+						$epsgAttr = isset($element['attributes']['srsName']) ? $element['attributes']['srsName'] : "";
+					}
+		
+					if(strstr($epsgAttr,'#') !== false){
+						// http://www.opengis.net/gml/srs/epsg.xml#4326
+						$parts = explode('#',$epsgAttr);
+						$epsg == isset($parts[1]) ? $parts[1] : "";
+					}else if (strstr($epsgAttr,':') !== false){
+						// EPSG:31466
+						// urn:ogc:def:crs:EPSG:6.5:4326 
+						$parts = explode(':',$epsgAttr);
+						$parts = array_reverse($parts);
+						 if(isset($parts[0])){
+						 	$epsg =  $parts[0];
+						}else{
+							$epsg = "";
+						}
+						new mb_exception(print_r(isset($parts[0]),true));
+						new mb_exception(print_r($epsg,true));
+					}else {
+						$epsg="";
+					}
+					$this->epsg = $epsg;
+				}
 				if(strtoupper($this->sepNameSpace($element[tag])) == strtoupper("coordinates")){
 					$this->bbox = explode(",", str_replace(",,","",str_replace(" ",",",trim($element[value]))));
 					$boundedBy=false;

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2011-02-14 17:10:23 UTC (rev 7604)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2011-02-15 09:45:42 UTC (rev 7605)
@@ -7,6 +7,8 @@
 require_once dirname(__FILE__)."/../classes/class_wmc_factory.php";
 require_once dirname(__FILE__)."/../classes/class_administration.php";
 require_once dirname(__FILE__)."/../../lib/class_GetApi.php";
+require_once(dirname(__FILE__) . "/../classes/class_bbox.php");
+require_once(dirname(__FILE__) . "/../classes/class_gml2.php");
 require_once dirname(__FILE__)."/../classes/class_elementVar.php";
 require_once(dirname(__FILE__) . "/../classes/class_tou.php");
 require_once(dirname(__FILE__)."/../classes/class_connector.php");
@@ -451,6 +453,19 @@
 $row = db_fetch_assoc($res);
 $isSessionWmcModuleLoaded = intval($row["i"]);
 
+// check if Session contains a GML, and then zoom to it
+$gml_string = Mapbender::session()->get("GML");
+if($gml_string){
+	$gml = new gml2();
+	$gml->parse_xml($gml_string);
+	$bbox = new Mapbender_bbox(
+	$gml->bbox[0],
+	$gml->bbox[1],
+	$gml->bbox[2],
+	$gml->bbox[3],
+	$epsg = $gml->epsg);
+	$wmcGetApi->mainMap->setExtent($bbox);
+}
 if (
 	count($resultObj["withoutId"]["wms"]) === 0 &&
 	count($resultObj["invalidId"]["wms"]) === 0 &&

Modified: trunk/mapbender/http/javascripts/mod_renderGML.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_renderGML.php	2011-02-14 17:10:23 UTC (rev 7604)
+++ trunk/mapbender/http/javascripts/mod_renderGML.php	2011-02-15 09:45:42 UTC (rev 7605)
@@ -25,7 +25,7 @@
 	$gml = new gml2();
 	$gml->parse_xml($gml_string);
 	$bbox = $gml->bbox;
-	echo "mb_registerInitFunctions('highlight_init()');\n";
+	echo "Mapbender.events.afterInit.register(highlight_init);\n";
 	echo "function highlight_init() {\n";
 	echo "var mf = new Array(";
 	for ($i=0; $i<count($e_target); $i++) {



More information about the Mapbender_commits mailing list