[Mapbender-commits] r6420 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jun 23 08:29:17 EDT 2010


Author: christoph
Date: 2010-06-23 12:29:17 +0000 (Wed, 23 Jun 2010)
New Revision: 6420

Added:
   trunk/mapbender/http/plugins/ol_panel.js
   trunk/mapbender/http/plugins/ol_setExtent.php
Modified:
   trunk/mapbender/http/plugins/ol_measureLine.js
   trunk/mapbender/http/plugins/ol_navigationHistory.js
Log:


Modified: trunk/mapbender/http/plugins/ol_measureLine.js
===================================================================
--- trunk/mapbender/http/plugins/ol_measureLine.js	2010-06-23 12:28:19 UTC (rev 6419)
+++ trunk/mapbender/http/plugins/ol_measureLine.js	2010-06-23 12:29:17 UTC (rev 6420)
@@ -42,10 +42,10 @@
 		} else {
 			out += "measure: " + measure.toFixed(3) + " square" + units;
 		}
-		console.log( out );
+//		console.log( out );
         };
 	var deactivateConflictingControls = function() {
-		console.log('deactivating');
+//		console.log('deactivating');
 	};
 
 	// style the sketch fancy

Modified: trunk/mapbender/http/plugins/ol_navigationHistory.js
===================================================================
--- trunk/mapbender/http/plugins/ol_navigationHistory.js	2010-06-23 12:28:19 UTC (rev 6419)
+++ trunk/mapbender/http/plugins/ol_navigationHistory.js	2010-06-23 12:29:17 UTC (rev 6420)
@@ -29,13 +29,22 @@
  * and Simplified BSD license.  
  * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
  */
+ 
+var $navigationHistory = $(this);
+
 var ol_map = Mapbender.modules[options.target[0]];
 ol_map.mapbenderEvents.layersAdded.register(function () {
-	var nav = new OpenLayers.Control.NavigationHistory();
+	var nav = new OpenLayers.Control.NavigationHistory({
+		div: $navigationHistory.get(0)
+	});
 	ol_map.addControl(nav);
-	panel = new OpenLayers.Control.Panel({
-		position: new OpenLayers.Pixel(50, 0)	
+	
+	Mapbender.events.afterInit.register(function () {
+		nav.clear();
 	});
-        panel.addControls([nav.next, nav.previous]);
-        ol_map.addControl(panel);
+	$navigationHistory.mapbender({
+		control: nav,
+		buttons: [nav.next, nav.previous] 
+	});
 });
+

Added: trunk/mapbender/http/plugins/ol_panel.js
===================================================================
--- trunk/mapbender/http/plugins/ol_panel.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/ol_panel.js	2010-06-23 12:29:17 UTC (rev 6420)
@@ -0,0 +1,62 @@
+/**
+ * Package: ol_panel
+ *
+ * Description:
+ * 
+ * 
+ * Files:
+ *  - http/plugins/ol_panel.js
+ *
+ * SQL:
+ *
+ * Help:
+ * http://www.mapbender.org/ol_panel
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Christoph_Baudson
+ * 
+ * License:
+ * Copyright (c) 2009, Open Source Geospatial Foundation
+ * This program is dual licensed under the GNU General Public License 
+ * and Simplified BSD license.  
+ * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+ */
+
+var $panel = $(this);
+
+var PanelApi = function () {
+//	var panel = new OpenLayers.Control.Panel({
+//		div: $panel.get(0)	
+//	});
+
+	var panel = new OpenLayers.Control.Panel({
+//		div: $("<div></div>").css({
+//			position: "absolute",
+//			top: "30px",
+//			left: "30px"
+//		}).appendTo("body").get(0)
+		div: $panel.get(0)
+	});
+	
+	var map = options.$target.eq(0).mapbender();
+	map.mapbenderEvents.mapReady.register(function() {
+		var controls = options.controls.split(",");
+		$(controls).each(function () {
+			var $node = $("#" + this);
+			if ($node.size() > 0) {
+				var module = $node.mapbender();
+				if (module.buttons) {
+					panel.addControls(module.buttons);
+				}
+			}
+		});
+		map.addControl(panel);
+		if (options.horizontal) {
+			$(panel.div).children().each(function () {
+				$(this).css("float", "left");
+			});
+		}
+	});
+};
+
+$panel.mapbender(new PanelApi());
\ No newline at end of file

Added: trunk/mapbender/http/plugins/ol_setExtent.php
===================================================================
--- trunk/mapbender/http/plugins/ol_setExtent.php	                        (rev 0)
+++ trunk/mapbender/http/plugins/ol_setExtent.php	2010-06-23 12:29:17 UTC (rev 6420)
@@ -0,0 +1,22 @@
+
+options.$target.each(function () {
+	var map = $(this).mapbender();
+	if (map && map.zoomToExtent) {
+		var coordinates = '<?php echo Mapbender::session()->get("mb_myBBOX") ?>';
+		var c = coordinates.split(",");
+		if (c.length === 4) {
+			var b =	new OpenLayers.Bounds();
+			b.extend(new OpenLayers.LonLat(
+				parseFloat(c[0], 10),
+				parseFloat(c[1], 10)
+			));
+			b.extend(new OpenLayers.LonLat(
+				parseFloat(c[2], 10),
+				parseFloat(c[3], 10)
+			));
+			map.mapbenderEvents.mapReady.register(function () {
+				map.zoomToExtent(b);
+			});
+		}
+	}			
+});



More information about the Mapbender_commits mailing list