[Mapbender-commits] r5482 - in branches/2.6: conf http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Feb 4 04:44:10 EST 2010


Author: christoph
Date: 2010-02-04 04:44:08 -0500 (Thu, 04 Feb 2010)
New Revision: 5482

Modified:
   branches/2.6/conf/session.conf
   branches/2.6/http/javascripts/mod_changeEPSG.php
   branches/2.6/http/javascripts/mod_setBBOX1.php
Log:
EPSG beim Einstieg mitgeben srs (derzeit), im trunk mb_myBBOXEpsg (siehe session.conf) 

Modified: branches/2.6/conf/session.conf
===================================================================
--- branches/2.6/conf/session.conf	2010-02-02 11:08:12 UTC (rev 5481)
+++ branches/2.6/conf/session.conf	2010-02-04 09:44:08 UTC (rev 5482)
@@ -4,6 +4,7 @@
 $_SESSION["mb_user_name"] = $name;
 $_SESSION["mb_user_ip"] =  $_SERVER['REMOTE_ADDR'];
 $_SESSION["mb_myBBOX"] = $_REQUEST["mb_myBBOX"];
+$_SESSION["mb_myBBOXEpsg"] = $_REQUEST["mb_myBBOXEpsg"];
 $_SESSION["mb_myKml"] = $_REQUEST["kml_id"];
 $_SESSION["mb_myPOI"] = $_REQUEST["mb_myPOI"];
 $_SESSION["mb_myPOI2SCALE"] = $_REQUEST["mb_myPOI2SCALE"];

Modified: branches/2.6/http/javascripts/mod_changeEPSG.php
===================================================================
--- branches/2.6/http/javascripts/mod_changeEPSG.php	2010-02-02 11:08:12 UTC (rev 5481)
+++ branches/2.6/http/javascripts/mod_changeEPSG.php	2010-02-04 09:44:08 UTC (rev 5482)
@@ -35,15 +35,23 @@
 });
 
 function mod_changeEPSG_setBox(){
+	var myEpsg = mb_mapObj[0].epsg;
+	if (arguments.length === 1) {
+		myEpsg = arguments[0];
+	}
 	$("#"+myId+" option").each(function () {
-		if (this.value == mb_mapObj[0].epsg) {
+		if (this.value == myEpsg) {
 			isEPSG = true;
 			$(this).attr("selected", "selected");
 		}
 	});
 }
 
-$("#"+myId).change(function () {
+function mod_changeEPSG () {
+	var callback;
+	if (arguments.length > 0 && typeof arguments[0] === "function") {
+		callback = arguments[0];
+	}
 	var srsArray = [];
 	for (var i = 0; i < mb_mapObj.length; i++) {
 		var currentSrs = {
@@ -178,8 +186,20 @@
 				});
 			}
 			setTimeout(function () {
-				mainMap.setMapRequest();
+				if (typeof callback === "function") {
+					callback();
+				}
+				else {
+					for (var k = 0; k < mapObjNames.length; k++) {
+						var map = getMapObjByName(mapObjNames[k]);
+						map.setMapRequest();
+					}
+				}
 			}, 200);
 		}
 	});
+};
+
+$("#"+myId).change(function () {
+	mod_changeEPSG();
 });

Modified: branches/2.6/http/javascripts/mod_setBBOX1.php
===================================================================
--- branches/2.6/http/javascripts/mod_setBBOX1.php	2010-02-02 11:08:12 UTC (rev 5481)
+++ branches/2.6/http/javascripts/mod_setBBOX1.php	2010-02-04 09:44:08 UTC (rev 5482)
@@ -18,18 +18,59 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-echo "var mod_setBBOX_target = '".$e_target[0]."';";
+
+echo "var targetString = '".implode(",", $e_target)."';";
 ?>
-eventInit.register(function () {
-	mod_setBBOX_init();
+eventAfterInit.register(function () {
+	var targetArray = targetString.split(",");
+	var bboxString = "<?php echo $_SESSION["mb_myBBOX"] ?>";
+	var srs = "<?php echo $_SESSION["mb_myBBOXEpsg"] ?>";
+	var performTransformation = 
+		("<?php 
+			echo $_SESSION["mb_myBBOXEpsg_transform"] 
+		?>" === "1") ? true : false;
+		
+	var map = getMapObjByName(targetArray[0]);
+	if (typeof map === "object" && srs !== "" && srs !== map.epsg) {
+
+		mod_changeEPSG_setBox(srs);
+		mod_changeEPSG(function () {
+			setBbox(targetArray, bboxString);
+		});
+	}
+	else {
+		setBbox(targetArray, bboxString);
+	}
+
 });
-function mod_setBBOX_init(){
-	var my_target = mod_setBBOX_target.split(",");
-	var myBBOX = "<?php echo $_SESSION['mb_myBBOX'] ?>";
-	for(var i=0; i<my_target.length; i++){
-		if(myBBOX != ""){
-			var coord = myBBOX.split(","); 
-			mb_calculateExtent(my_target[i],parseFloat(coord[0]),parseFloat(coord[1]),parseFloat(coord[2]),parseFloat(coord[3]));
+
+var setBbox = function (targetArray, bboxString) { 
+
+	for (var i = 0; i < targetArray.length; i++) {
+		var currentTarget = targetArray[i];
+	
+		var mapObj = getMapObjByName(currentTarget);
+		if (mapObj === null) {
+			var e = new Mb_exception("setBBOX: unknown map object: " + currentTarget);
+			return;
 		}
+	
+		if (bboxString === "") {
+			var e = new Mb_exception("setBBOX: no bounding box found.");
+		}
+		else {
+			var coord = bboxString.split(","); 
+			var newExtent = new Extent(
+				parseFloat(coord[0]),
+				parseFloat(coord[1]),
+				parseFloat(coord[2]),
+				parseFloat(coord[3])
+			);
+		}
+		if (i === 0 && newExtent) {
+			mapObj.calculateExtent(newExtent);		
+		}
+		mapObj.setMapRequest();	
 	}
-}
+};
+



More information about the Mapbender_commits mailing list