[Mapbender-commits] r2539 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jun 23 11:58:18 EDT 2008


Author: christoph
Date: 2008-06-23 11:58:18 -0400 (Mon, 23 Jun 2008)
New Revision: 2539

Modified:
   trunk/mapbender/http/php/mod_WMSpreferences.php
   trunk/mapbender/http/php/mod_addWmsFromFeatureInfo.php
   trunk/mapbender/http/php/mod_editElements.php
   trunk/mapbender/http/php/mod_map1.php
   trunk/mapbender/http/php/mod_treefolderClient.php
   trunk/mapbender/http/php/system.php
Log:


Modified: trunk/mapbender/http/php/mod_WMSpreferences.php
===================================================================
--- trunk/mapbender/http/php/mod_WMSpreferences.php	2008-06-23 15:57:43 UTC (rev 2538)
+++ trunk/mapbender/http/php/mod_WMSpreferences.php	2008-06-23 15:58:18 UTC (rev 2539)
@@ -106,6 +106,27 @@
 var ind = window.opener.getMapObjIndexByName(mod_WMSpreferences_target1);
 var my = window.opener.mb_mapObj[ind];
 
+ function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
+	if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
+		upper = mb_mapObj[mapObj_ind].wms[indexA];
+		mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
+		mb_mapObj[mapObj_ind].wms[indexB] = upper;
+		var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
+		var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
+		var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
+		mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
+		mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
+		mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
+		mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
+		mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
+		mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
+		return true;
+	}
+	else {
+		return false;
+	}
+}
+
  
 
 // Opacity version

Modified: trunk/mapbender/http/php/mod_addWmsFromFeatureInfo.php
===================================================================
--- trunk/mapbender/http/php/mod_addWmsFromFeatureInfo.php	2008-06-23 15:57:43 UTC (rev 2538)
+++ trunk/mapbender/http/php/mod_addWmsFromFeatureInfo.php	2008-06-23 15:58:18 UTC (rev 2539)
@@ -23,6 +23,56 @@
 
 echo "var mod_target = '".$e_target[0]."';";
 ?>
+function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
+	if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
+		upper = mb_mapObj[mapObj_ind].wms[indexA];
+		mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
+		mb_mapObj[mapObj_ind].wms[indexB] = upper;
+		var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
+		var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
+		var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
+		mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
+		mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
+		mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
+		mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
+		mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
+		mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
+		return true;
+	}
+	else {
+		return false;
+	}
+}
+
+
+function mb_wmsMoveByIndex(mapObj_ind, fromIndex, toIndex) {
+	if (fromIndex != toIndex && fromIndex >= 0 && fromIndex < mb_mapObj[mapObj_ind].wms.length && toIndex >= 0 && toIndex < mb_mapObj[mapObj_ind].wms.length) {
+		var changed = false;
+		var i;
+		var result;
+		if (fromIndex > toIndex) {
+			for (i = fromIndex; i > toIndex ; i--) {
+				result = mb_swapWmsByIndex(mapObj_ind, i-1, i);
+				if (result === true) {
+					changed = true;
+				}
+			}
+		}
+		else {
+			for (i = fromIndex; i < toIndex ; i++) {
+				result = mb_swapWmsByIndex(mapObj_ind, i, i+1);
+				if (result === true) {
+					changed = true;
+				}
+			}
+		}
+		return changed;
+	}
+	else {
+		return false;
+	}
+}
+
 function addWmsFromFeatureInfo(pointer_name, version) {
 	mb_registerloadWmsSubFunctions("addWmsFromInfo_pos()");
 	var mywms = pointer_name; 
@@ -55,5 +105,4 @@
 		mb_wmsMoveByIndex(getMapObjIndexByName(mod_target), mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1, mod_addWmsFromFeatureInfo_position-1);
 	}
 	eventAfterLoadWMS.unregister("addWmsFromInfo_pos()");
-//	mb_removeFunctionFromArray("mb_loadWmsSubFunctions", "addWmsFromInfo_pos()");	
 }
\ No newline at end of file

Modified: trunk/mapbender/http/php/mod_editElements.php
===================================================================
--- trunk/mapbender/http/php/mod_editElements.php	2008-06-23 15:57:43 UTC (rev 2538)
+++ trunk/mapbender/http/php/mod_editElements.php	2008-06-23 15:58:18 UTC (rev 2539)
@@ -466,6 +466,12 @@
 	   echo "<input type='button' class='' name='' value='delete' onclick='thisDelete()'> \n";
 	   echo "<input type='button' class='' name='' value='show' onclick='thisShow()'> \n";
 	   echo "<input type='button' class='' name='' value='sql' onclick='thisExport()'> \n";
+	   echo	"<input type='button' class='' name='' value='arrange' " .
+	   		"onclick='window.open(\"mod_editApplication.php?" . SID . "&" .
+	   		"guiID=" . $_SESSION["mb_user_gui"] . "&" .
+	   		"editApplicationId=" . $guiList1 . "\", " .
+	   		"\"edit application\", " .
+	   		"\"width=500,height=500,dependent\");'> \n";
 	   echo "</div>\n";
 	   echo "<input type='hidden'  name='guiList1' value='".$guiList1."' >\n";
 	   echo "<input type='hidden'  name='guiId' value='".$guiId."' >\n";

Modified: trunk/mapbender/http/php/mod_map1.php
===================================================================
--- trunk/mapbender/http/php/mod_map1.php	2008-06-23 15:57:43 UTC (rev 2538)
+++ trunk/mapbender/http/php/mod_map1.php	2008-06-23 15:58:18 UTC (rev 2539)
@@ -48,15 +48,74 @@
 echo "var mod_map1_height = '".$e_height."';\n";
 echo "</script>\n";
 ?>
+<!--
+<script type='text/javascript' src='../extensions/jquery-1.2.6.min.js'></script>
+<script type='text/javascript' src='../extensions/jquery.mousewheel.min.js'></script>
+<script type='text/javascript' src='../extensions/jqjson.js'></script>
+-->
 <script type="text/javascript">
 <!--
 
+var mapTimeout;
+var	sum_delta = 0;
+var lastTimestamp;
+var lastScrollPositionX;
+var lastScrollPositionY;
+
 function init () {
+	
 	parent.eventInitMap.register(function init_mod_map1(){
 		parent.mb_registerMapObj('mapframe1', 'maps', null,mod_map1_width, mod_map1_height);
+		
+		parent.$(document, window.frames['mapframe1']).mousewheel(function (event, delta) {
+			if (sum_delta == 0) {
+				mapTimeout = setTimeout(function () {
+						lastScrollPositionX=event.pageX;
+						lastScrollPositionY=event.pageY;
+						mousewheelZoom();	
+					}, 
+					100);
+			}
+			sum_delta = sum_delta + (delta);
+			var currentTime = new Date();
+			lastTimestamp = currentTime.getTime();
+			
+			return false;
+		});
 	});
 }
 
+function mousewheelZoom () {
+	var currentTime = new Date();
+
+	if (currentTime.getTime() - lastTimestamp > 200) {
+				
+		var ind = parent.getMapObjIndexByName('mapframe1');			
+		var pos = parent.makeClickPos2RealWorldPos("mapframe1", lastScrollPositionX, lastScrollPositionY);
+				
+		if (sum_delta > 0) {
+			parent.zoom("mapframe1", true, Math.pow(parent.mapbender.zoomMousewheel, sum_delta), pos[0],pos[1]);
+		}
+		else {
+			parent.zoom("mapframe1", false, Math.pow(parent.mapbender.zoomMousewheel, -sum_delta), pos[0], pos[1]);
+		}
+		
+		var newPosX =  parent.parent.mb_mapObj[ind].width - lastScrollPositionX;
+		var newPosY =  parent.parent.mb_mapObj[ind].height - lastScrollPositionY;
+				
+		var posAfterZoom = parent.makeClickPos2RealWorldPos("mapframe1", newPosX, newPosY);
+		parent.zoom('mapframe1', false, 1.0, posAfterZoom[0], posAfterZoom[1]); 
+		
+		sum_delta = 0;
+		clearTimeout(mapTimeout);
+	}
+	else {
+		mapTimeout = setTimeout(function () {
+				mousewheelZoom(sum_delta);	
+			}, 
+			100);
+	}
+}
 // -->
 </script>
 </head>

Modified: trunk/mapbender/http/php/mod_treefolderClient.php
===================================================================
--- trunk/mapbender/http/php/mod_treefolderClient.php	2008-06-23 15:57:43 UTC (rev 2538)
+++ trunk/mapbender/http/php/mod_treefolderClient.php	2008-06-23 15:58:18 UTC (rev 2539)
@@ -204,12 +204,22 @@
 		cBox[ind]['layer'] = array_layer;
 	}
 }
+function mb_getLayerObjByName(fname,wms_id,layer_name){
+	var ind = parent.getMapObjIndexByName(fname);
+	var wmsInd = parent.getWMSIndexById(fname,wms_id);
+	var t = parent.mb_mapObj[ind].wms[wmsInd];
+	for(var i=0; i < t.objLayer.length; i++){
+		if(t.objLayer[i].layer_name == layer_name){
+			return t.objLayer[i];
+		}
+	}
+}
 function checkLayer(){
 	var checkit;
 	for(var i=0; i<cBox.length; i++){
 		checkit = true;
 		for(var j=0; j<cBox[i]['wms'].length;j++){
-			var obj = parent.mb_getLayerObjByName(treetarget,cBox[i]['wms'][j],cBox[i]['layer'][j]);
+			var obj = mb_getLayerObjByName(treetarget,cBox[i]['wms'][j],cBox[i]['layer'][j]);
 			if(obj){
 				if(obj.gui_layer_visible == '0' || obj.gui_layer_visible == 0){
 					checkit = false;

Modified: trunk/mapbender/http/php/system.php
===================================================================
--- trunk/mapbender/http/php/system.php	2008-06-23 15:57:43 UTC (rev 2538)
+++ trunk/mapbender/http/php/system.php	2008-06-23 15:58:18 UTC (rev 2539)
@@ -32,4 +32,6 @@
 #
 # available log levels 
 #
-define("LOG_LEVEL_LIST", "off,error,warning,notice,all");
\ No newline at end of file
+define("LOG_LEVEL_LIST", "off,error,warning,notice,all");
+
+define("ZOOM_MOUSEWHEEL", "1.1");
\ No newline at end of file



More information about the Mapbender_commits mailing list