[Mapbender-commits] r5416 - branches/2.6/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 25 04:35:52 EST 2010


Author: christoph
Date: 2010-01-25 04:35:52 -0500 (Mon, 25 Jan 2010)
New Revision: 5416

Modified:
   branches/2.6/http/javascripts/mod_changeEPSG.php
Log:


Modified: branches/2.6/http/javascripts/mod_changeEPSG.php
===================================================================
--- branches/2.6/http/javascripts/mod_changeEPSG.php	2010-01-25 09:35:21 UTC (rev 5415)
+++ branches/2.6/http/javascripts/mod_changeEPSG.php	2010-01-25 09:35:52 UTC (rev 5416)
@@ -55,6 +55,20 @@
 		};
 		srsArray.push(currentSrs);
 	}
+	for (var i = 0; i < wms.length; i++) {
+		var ext = wms[i].getBoundingBoxBySrs(mb_mapObj[0].epsg);
+		if (ext === null) {
+			continue;
+		}
+		var currentSrs = {
+			"wms" : wms[i].wms_id,
+			"epsg" : mb_mapObj[0].epsg,
+			"extent" : ext.toString(),
+			"width" : mb_mapObj[0].width,
+			"height" : mb_mapObj[0].height
+		};
+		srsArray.push(currentSrs);
+	}
 
 	var req = new Mapbender.Ajax.Request({
 		"method":"changeEpsg",
@@ -70,10 +84,50 @@
 		}
 		
 		var newExtent = obj;
-		
+		var mapObjNames = [];
 		for(var i = 0; i < newExtent.length; i++) {
+			if (newExtent[i].frameName) {
+				mapObjNames.push(newExtent[i].frameName);
+			}
+		}
+		for(var i = 0; i < newExtent.length; i++) {
+			if (newExtent[i].wms) {
+				for (var j = 0; j < wms.length; j++) {
+					if (wms[j].wms_id == newExtent[i].wms) {
+						wms[j].setBoundingBoxBySrs(
+							newExtent[i].newSrs,
+							new Extent(
+								parseFloat(newExtent[i].minx),
+								parseFloat(newExtent[i].miny),
+								parseFloat(newExtent[i].maxx),
+								parseFloat(newExtent[i].maxy)
+							)
+						);
+					}
+				}
+						
+				for (var k = 0; k < mapObjNames.length; k++) {
+					var map = getMapObjByName(mapObjNames[k]);
+					for (var j = 0; j < map.wms.length; j++) {
+						if (map.wms[j].wms_id == newExtent[i].wms) {
+							map.wms[j].setBoundingBoxBySrs(
+								newExtent[i].newSrs,
+								new Extent(
+									parseFloat(newExtent[i].minx),
+									parseFloat(newExtent[i].miny),
+									parseFloat(newExtent[i].maxx),
+									parseFloat(newExtent[i].maxy)
+								)
+							);
+						}
+						break;
+					}
+				}
+				continue;
+			}
+			
+			var mainMap = null;
 			if(newExtent[i].frameName == myTarget){
-
 				var ind = getMapObjIndexByName(myTarget);
 				
 				for(var ii = 0; ii < mb_mapObj[ind].mb_MapHistoryObj.length; ii++) {
@@ -93,7 +147,8 @@
 					);
 					mb_mapObj[ind].setSrs({
 						srs: newExtent[i].newSrs,
-						extent: newExt
+						extent: newExt,
+						displayWarning: false
 					});
 				}
 				else{
@@ -104,25 +159,27 @@
 							parseFloat(newExtent[i].miny),
 							parseFloat(newExtent[i].maxx),
 							parseFloat(newExtent[i].maxy)
-						)
+						),
+						displayWarning: false
 					});
 				}
 			}
 			else {
-				var ind = getMapObjIndexByName(newExtent[i].frameName);
-				mb_mapObj[ind].setSrs({
+				mainMap = getMapObjByName(newExtent[i].frameName);
+				mainMap.setSrs({
 					srs: newExtent[i].newSrs,
 					extent: new Extent(
 						parseFloat(newExtent[i].minx),
 						parseFloat(newExtent[i].miny),
 						parseFloat(newExtent[i].maxx),
 						parseFloat(newExtent[i].maxy)
-					)
+					),
+					displayWarning: true
 				});
 			}
-			setMapRequest(newExtent[i].frameName);
+			setTimeout(function () {
+				mainMap.setMapRequest();
+			}, 200);
 		}
-
-
 	});
-});
\ No newline at end of file
+});



More information about the Mapbender_commits mailing list