[Mapbender-commits] r6113 - branches/3_dev/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun May 9 11:54:31 EDT 2010


Author: astrid_emde
Date: 2010-05-09 11:54:30 -0400 (Sun, 09 May 2010)
New Revision: 6113

Added:
   branches/3_dev/http/plugins/mb_navigation.js
Log:
taken from trunk for templet_basic

Added: branches/3_dev/http/plugins/mb_navigation.js
===================================================================
--- branches/3_dev/http/plugins/mb_navigation.js	                        (rev 0)
+++ branches/3_dev/http/plugins/mb_navigation.js	2010-05-09 15:54:30 UTC (rev 6113)
@@ -0,0 +1,101 @@
+/**
+ * Package: mb_navigation
+ *
+ * Description:
+ * Adds navigation arrows on top of the map
+ * 
+ * Files:
+ *  - http/plugins/mb_navigation.js
+ *
+ * SQL:
+ * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, 
+ * > e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, 
+ * > e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, 
+ * > e_mb_mod, e_target, e_requires, e_url) VALUES('<appId>','mb_navigation',
+ * > 2,1,'Adds navigation arrows on top of the map','Navigation','div','','',
+ * > NULL ,NULL ,NULL ,NULL ,NULL ,'','','div','../plugins/mb_navigation.js',
+ * > '','mapframe1','mapframe1','http://www.mapbender.org/Navigation');
+ *
+ * Help:
+ * http://www.mapbender.org/Navigation
+ *
+ * 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 iconDim = 16;
+var iconOffset = 10;
+var $this = $(this);
+
+Mapbender.events.init.register(function () {
+	options.$target.each(function () {
+		var $target = $(this);
+		var id = $target.attr("id");
+
+		var positionArrow = function ($domElement, direction) {
+			var top, left;
+			switch (direction) {
+				case "n":
+					top = (
+						iconOffset
+					) + "px";
+					left = (iconOffset + iconDim) + "px";
+					break;
+				case "s":
+					top = (iconOffset + 2*iconDim) + "px";
+					left = (iconOffset + iconDim) + "px";
+					break;
+				case "w":
+					top = (iconOffset + iconDim) + "px";
+					left = (iconOffset + iconDim/2) + "px"
+					break;
+				case "e":
+					top = (iconOffset + iconDim) + "px";
+					left = (iconOffset + iconDim*1.5) + "px"
+					break;
+			}
+			$domElement.css({
+				top: top,
+				left: left,
+				position:"absolute",
+				zIndex: 1000
+			});
+		};
+		
+		var directionArray = ["n", "e", "s", "w"];
+		for (i in directionArray) {
+			(function () {
+				var dir = directionArray[i];
+				var $arrow = $("<span title='" + dir.toUpperCase() + "' " + 
+					"id='" + id + "_" + dir + "' class=" + 
+					"'ui-icon ui-corner-all ui-state-default ui-icon-triangle-1-" + dir + 
+					"'></span>"
+				).click(function (e) {
+					$target.mapbender(function () {
+						this.pan(dir);
+					});
+					return false;
+				}).mouseover(function () {
+					$(this).addClass("ui-state-hover");
+					return true;
+				}).mouseout(function () {
+					$(this).removeClass("ui-state-hover");
+					return true;
+				}).appendTo($target);
+				positionArrow($arrow, dir);
+				
+				$target.mapbender(function () {
+					this.events.dimensionsChanged.register(function () {
+						positionArrow($arrow, dir);
+					});
+				});
+			})();
+		}
+	});
+});



More information about the Mapbender_commits mailing list