[Mapbender-commits] r8040 - in branches/mobile/http: javascripts plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Aug 2 05:03:18 EDT 2011


Author: pschmidt
Date: 2011-08-02 02:03:18 -0700 (Tue, 02 Aug 2011)
New Revision: 8040

Added:
   branches/mobile/http/javascripts/MapTouch.js
   branches/mobile/http/javascripts/mod_coords_div_mobile.php
   branches/mobile/http/javascripts/mod_dragMapSize_mobile.php
   branches/mobile/http/javascripts/mod_featureInfoTunnel_mobile.php
   branches/mobile/http/javascripts/mod_pan_mobile.js
   branches/mobile/http/javascripts/mod_selArea_mobile.js
   branches/mobile/http/javascripts/requestGeometryConstructor_mobile.js
   branches/mobile/http/plugins/mb_mobile.js
   branches/mobile/http/plugins/mb_overview_mobile.js
Log:
Module f?\195?\188r iPad

Added: branches/mobile/http/javascripts/MapTouch.js
===================================================================
--- branches/mobile/http/javascripts/MapTouch.js	                        (rev 0)
+++ branches/mobile/http/javascripts/MapTouch.js	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,275 @@
+var defaultTouch;
+function MapTouch(map, $map, mapDom){
+    this.map = map;
+    this.$elm = $map;
+    this.elm = mapDom;
+
+    this.started = false;
+    this.startPos = 0, this.stopPos = 0;
+    this.timestamp = 0;
+    this.dblclick = false;
+    this.move = false;
+    this.pinch = false;
+    this.pinchObj = null;
+    this.activ = false;
+    defaultTouch = this;
+
+    this.activate = function() {
+        this.elm.addEventListener("touchstart", defaultTouch.startTouch, true);
+        this.elm.addEventListener("touchmove", defaultTouch.moveTouch, true);
+        this.elm.addEventListener("touchend", defaultTouch.endTouch, true);
+        this.activ = true;
+    };
+    this.activateTouchstart = function() {
+        this.elm.addEventListener("touchstart", defaultTouch.startTouch, true);
+    };
+    this.activateTouchmove = function() {
+        this.elm.addEventListener("touchmove", defaultTouch.moveTouch, true);
+    };
+    this.activateTouchend = function() {
+        this.elm.addEventListener("touchend", defaultTouch.endTouch, true);
+    };
+    this.setActivate = function() {
+        this.activ = true;
+    };
+
+
+    this.deactivate = function() {
+        this.elm.removeEventListener("touchstart", defaultTouch.startTouch, true);
+        this.elm.removeEventListener("touchmove", defaultTouch.moveTouch, true);
+        this.elm.removeEventListener("touchend", defaultTouch.endTouch, true);
+        this.activ = false;
+    };
+    this.deactivateTouchstart = function() {
+        this.elm.removeEventListener("touchstart", defaultTouch.startTouch, true);
+    };
+    this.deactivateTouchmove = function() {
+        this.elm.removeEventListener("touchmove", defaultTouch.moveTouch, true);
+    };
+    this.deactivateTouchend = function() {
+        this.elm.removeEventListener("touchend", defaultTouch.endTouch, true);
+    };
+    this.setDeactivate = function() {
+        this.activ = true;
+    };
+
+    this.isActiv = function() {
+        return this.activ;
+    }
+//
+//    this.registerObject = function(obj) {
+//        this.obj = obj;
+//        alert(this.obj);
+//    };
+
+    this.startTouch = function(event) {
+        event.preventDefault();
+        var elm = findElement(event, "");
+        if (isSingleTouch(event)) {
+            defaultTouch.startPos = new Mapbender.Point(
+                    event.touches[0].pageX - defaultTouch.$elm.offset().left,
+                    event.touches[0].pageY - defaultTouch.$elm.offset().top);
+            defaultTouch.stopPos = new Point(defaultTouch.startPos.x, defaultTouch.startPos.y);
+            var timestamp = new Date().getTime();
+            if (timestamp - defaultTouch.timestamp < 300) {
+                defaultTouch.dblclick = true;
+            }
+            defaultTouch.timestamp = timestamp;
+        } else if (isMultiTouch(event)) {
+            defaultTouch.dblclick = false;
+            defaultTouch.move = false;
+            defaultTouch.pinch = true;
+            defaultTouch.pinchObj = new Pinch(defaultTouch);
+            defaultTouch.pinchObj.pinchStart(event);
+        }
+        return true;
+    };
+    this.moveTouch = function(event) {
+        event.preventDefault();
+        var elm = findElement(event, "");
+        if (isSingleTouch(event)) {
+            defaultTouch.moveMapMove(event);
+            defaultTouch.move = true;
+        } else if(isMultiTouch(event)) {
+            defaultTouch.pinchObj.pinchRun(event);
+        }
+        return true;
+    };
+    this.endTouch = function(event) {
+        event.preventDefault();
+        var elm = findElement(event, "");
+        if (defaultTouch.dblclick) {
+            defaultTouch.zoomSingle(event);
+            defaultTouch.dblclick = false;
+        } else {
+            if (defaultTouch.move) {
+                defaultTouch.moveMapStop(event);
+                defaultTouch.move = false;
+            } else if (defaultTouch.pinch){
+                defaultTouch.pinchObj.pinchStop(event);
+                defaultTouch.pinch = false;
+            }
+        }
+        return true;
+    };
+
+    this.moveMapMove = function(event){
+        this.stopPos = new Mapbender.Point(
+                event.touches[0].pageX - this.$elm.offset().left,
+                event.touches[0].pageY - this.$elm.offset().top);
+        var dif = this.stopPos.minus(this.startPos);
+        this.map.moveMap(dif.x, dif.y);
+    };
+
+    this.moveMapStop = function(event){
+        var dif = this.stopPos.minus(this.startPos);
+        var mapCenter = new Mapbender.Point(
+                parseInt(parseInt(this.map.getWidth()) / 2),
+                parseInt(parseInt(this.map.getHeight()) / 2)
+        );
+        var center = mapCenter.minus(dif);
+        var realCenter = this.map.convertPixelToReal(center);
+        this.map.moveMap(dif.x, dif.y);
+        this.map.zoom(false, 1.0, realCenter);
+        this.startPos = null;
+        this.stopPos = null;
+    };
+
+    this.zoomSingle = function(event){
+        var pos = this.map.convertPixelToReal(this.stopPos);
+        var extentAfterZoom = this.map.calculateExtentAfterZoom(
+                true,
+                2.0,
+                pos.x,
+                pos.y
+        );
+        var newPos = this.map.convertRealToPixel(
+                pos,
+                extentAfterZoom
+        );
+        var diff = newPos.minus(this.stopPos);
+
+        var newSouthEast = this.map.convertPixelToReal(
+                (new Point(0, this.map.getHeight())).plus(diff),
+                extentAfterZoom
+        );
+        var newNorthWest = this.map.convertPixelToReal(
+                (new Point(this.map.getWidth(), 0)).plus(diff),
+                extentAfterZoom
+        );
+        var newExtent = new Mapbender.Extent(newSouthEast, newNorthWest);
+        this.map.setExtent(newExtent);
+        this.map.setMapRequest();
+    };
+
+    function findElement(event, tagName) {
+        var element = getElement(event);
+        while (element.parentNode && (!element.tagName ||
+              (element.tagName.toUpperCase() != tagName.toUpperCase()))){
+            element = element.parentNode;
+            return element;
+        }
+    }
+
+    function getElement(event) {
+        return event.target || event.srcElement;
+    }
+
+    function isSingleTouch(event) {
+        return event.touches && event.touches.length == 1;
+    }
+
+    function isMultiTouch(event) {
+        return event.touches && event.touches.length > 1;
+    }
+
+    function Pinch(mmtouch){
+        this.mmtouch = mmtouch;
+        this.scale = 1;
+
+        this.pinchStart = function(event) {
+            this.pinchCenter = new Mapbender.Point(
+                        parseInt((event.touches[0].pageX - this.mmtouch.$elm.offset().left +
+                         event.touches[1].pageX - this.mmtouch.$elm.offset().left) / 2),
+                        parseInt((event.touches[0].pageY - this.mmtouch.$elm.offset().top +
+                         event.touches[1].pageY - this.mmtouch.$elm.offset().top) / 2));
+
+            this.pos0 = new Mapbender.Point(
+                        event.touches[0].pageX - this.mmtouch.$elm.offset().left,
+                        event.touches[0].pageY - this.mmtouch.$elm.offset().top);
+            this.pos1 = new Mapbender.Point(
+                        event.touches[1].pageX - this.mmtouch.$elm.offset().left,
+                        event.touches[1].pageY - this.mmtouch.$elm.offset().top);
+            this.startDist = Math.sqrt(
+                        Math.pow(this.pos0.x - this.pos1.x, 2) +
+                        Math.pow(this.pos0.y - this.pos1.y, 2));
+        }
+
+        this.pinchRun = function(event) {
+
+            this.lastPinchCenter = new Mapbender.Point(
+                        parseInt((event.touches[0].pageX - this.mmtouch.$elm.offset().left +
+                         event.touches[1].pageX - this.mmtouch.$elm.offset().left) / 2),
+                        parseInt((event.touches[0].pageY - this.mmtouch.$elm.offset().top +
+                         event.touches[1].pageY - this.mmtouch.$elm.offset().top) / 2));
+    //        var dif = this.lastCenter.minus(this.center);
+            var pos0 = new Mapbender.Point(
+                        event.touches[0].pageX - this.mmtouch.$elm.offset().left,
+                        event.touches[0].pageY - this.mmtouch.$elm.offset().top);
+            var pos1 = new Mapbender.Point(
+                        event.touches[1].pageX - this.mmtouch.$elm.offset().left,
+                        event.touches[1].pageY - this.mmtouch.$elm.offset().top);
+            var dist = Math.sqrt(
+                        Math.pow(pos0.x - pos1.x, 2) +
+                        Math.pow(pos0.y - pos1.y, 2));
+            this.scale = dist / this.startDist;
+
+            var index = this.mmtouch.map.history.getCurrentIndex();
+            var width = parseInt(parseInt(this.mmtouch.$elm.css("width")) * this.scale);
+            var height = parseInt(parseInt(this.mmtouch.$elm.css("height")) * this.scale);
+            var leftAt = parseInt(this.lastPinchCenter.x * this.scale);
+            var topAt = parseInt(this.lastPinchCenter.y * this.scale);
+            var left = this.lastPinchCenter.x - leftAt;
+            var top = this.lastPinchCenter.y - topAt;
+            $("#" + this.mmtouch.map.elementName + "_request_" + (index) + " div img").css({
+                    position: "absolute",
+                    width: width + "px",
+                    height: height + "px",
+                    left: left + "px",
+                    top: top + "px"
+            });
+        }
+        this.pinchStop = function(event) {
+            var pos = this.mmtouch.map.convertPixelToReal(this.lastPinchCenter);
+//            var dist = this.startDist * this.scale;
+//            var isZoomIn = false;
+//            if (this.startDist - dist < 0){
+//                isZoomIn = true;
+//            }
+            var extentAfterZoom = this.mmtouch.map.calculateExtentAfterZoom(
+                    true,
+                    this.scale,
+                    pos.x,
+                    pos.y
+            );
+            var newPos = this.mmtouch.map.convertRealToPixel(
+                    pos,
+                    extentAfterZoom
+            );
+
+            var diff = newPos.minus(this.lastPinchCenter);
+
+            var newSouthEast = this.mmtouch.map.convertPixelToReal(
+                    (new Point(0, this.mmtouch.map.getHeight())).plus(diff),
+                    extentAfterZoom
+            );
+            var newNorthWest = this.mmtouch.map.convertPixelToReal(
+                    (new Point(this.mmtouch.map.getWidth(), 0)).plus(diff),
+                    extentAfterZoom
+            );
+            var newExtent = new Mapbender.Extent(newSouthEast, newNorthWest);
+            this.mmtouch.map.setExtent(newExtent);
+            this.mmtouch.map.setMapRequest();
+        }
+    }
+}
\ No newline at end of file

Added: branches/mobile/http/javascripts/mod_coords_div_mobile.php
===================================================================
--- branches/mobile/http/javascripts/mod_coords_div_mobile.php	                        (rev 0)
+++ branches/mobile/http/javascripts/mod_coords_div_mobile.php	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,93 @@
+<?php
+# $Id: mod_coords_div.php 6888 2010-09-03 14:52:08Z christoph $
+# http://www.mapbender.org/index.php/mod_coords_div.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+echo "var mod_showCoords_div_target = '".$e_target[0]."';";
+
+include '../include/dyn_js.php';
+?>
+var displayTarget = displayTarget ? displayTarget : "dependentDiv";
+
+var mod_showCoords_div_win = null;
+var mod_showCoords_div_elName = "showCoords_div";
+var mod_showCoords_div_frameName = "";
+var mod_showCoords_div_img_on = new Image(); mod_showCoords_div_img_on.src = "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
+var mod_showCoords_div_img_off = new Image(); mod_showCoords_div_img_off.src = "<?php  echo $e_src;  ?>";
+var mod_showCoords_div_img_over = new Image(); mod_showCoords_div_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
+var mod_showCoords_div_fix = "";
+var mod_showCoords_div_mapObj = null;
+
+function init_mod_showCoords_div(ind){
+	mod_showCoords_div_mapObj = getMapObjByName(mod_showCoords_div_target );
+	
+	mb_button[ind] = document.getElementById(mod_showCoords_div_elName);
+	mb_button[ind].img_over = mod_showCoords_div_img_over.src;
+	mb_button[ind].img_on = mod_showCoords_div_img_on.src;
+	mb_button[ind].img_off = mod_showCoords_div_img_off.src;
+	mb_button[ind].status = 0;
+	mb_button[ind].elName = mod_showCoords_div_elName;
+	mb_button[ind].fName = mod_showCoords_div_frameName;
+	mb_button[ind].go = mod_showCoords_div_run;
+	mb_button[ind].stop = mod_showCoords_div_disable;   
+}
+function mod_showCoords_div_run(){
+        if ($.extend(mod_showCoords_div_mapObj).defaultTouch) {
+            $.extend(mod_showCoords_div_mapObj).defaultTouch.deactivate();
+        }
+	var $map = $(mod_showCoords_div_mapObj.getDomElement());
+	$map.bind("mousemove", mod_showCoords_div_display);
+	$map.bind("click", mod_showCoords_div_click);
+}
+function mod_showCoords_div_disable(){
+	var $map = $(mod_showCoords_div_mapObj.getDomElement());
+	$map.unbind("mousemove", mod_showCoords_div_display);
+	$map.unbind("click", mod_showCoords_div_click);
+	if(document.getElementById(displayTarget)){
+		writeTag("",displayTarget,"");
+	}
+        if ($.extend(mod_showCoords_div_mapObj).defaultTouch) {
+            $.extend(mod_showCoords_div_mapObj).defaultTouch.activate();
+        }
+}
+function mod_showCoords_div_click(e){
+	var click = mod_showCoords_div_mapObj.getMousePosition(e);
+	if (click === null) {
+		return;
+	}
+	var pos = mod_showCoords_div_mapObj.convertPixelToReal(click);
+	mod_showCoords_div_fix = "Selection: " + pos.x + " / " +  pos.y;
+	mod_showCoord_write(pos.x,pos.y);
+}
+function mod_showCoords_div_display(e){
+	var click = mod_showCoords_div_mapObj.getMousePosition(e);
+	if (click === null) {
+		return;
+	}
+	var pos = makeClickPos2RealWorldPos(mod_showCoords_div_target, click.x, click.y);
+	mod_showCoord_write(pos[0],pos[1]);
+}
+function mod_showCoord_write(x,y){
+	if(document.getElementById(displayTarget)){
+		var str = x + " / " +  y;
+		if(mod_showCoords_div_fix != ""){
+			str += "<div>" + mod_showCoords_div_fix + "</div>";
+		}
+		writeTag("",displayTarget, str);
+	}
+}

Added: branches/mobile/http/javascripts/mod_dragMapSize_mobile.php
===================================================================
--- branches/mobile/http/javascripts/mod_dragMapSize_mobile.php	                        (rev 0)
+++ branches/mobile/http/javascripts/mod_dragMapSize_mobile.php	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,287 @@
+<?php
+# $Id: mod_dragMapSize.php 6673 2010-08-02 13:52:19Z christoph $
+# http://www.mapbender.org/index.php/mod_dragMapSize.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+echo "var mod_dragMapSize_target = '".$e_target[0]."';";
+?>
+var mod_dragMapSize_offset  = 15;
+var mod_dragMapSize_active  = false;
+var isTouchable = false;
+var isMainTouchActiv = false;
+try {document.createEvent("TouchEvent"); isTouchable = true; } catch(e){}
+
+eventInit.register(function () {
+	mod_dragMapSize_init();
+});
+
+eventAfterMapRequest.register(function () {
+	mod_dragMapSize_arrange()
+});
+
+function mod_dragMapSize_init(){
+    var el = document.getElementById("dragMapSize_Mobile");
+    if (isTouchable) {
+        $('.ui-icon').css({width:'30px',height:'30px'});
+        el.addEventListener("mousedown", mod_dragMapSize_touchOn, true);
+        el.addEventListener("mouseup", mod_dragMpaSize_touchOff, true);
+        el.addEventListener("touchstart", mod_dragMapSize_touchOn, true);
+    } else {
+//        $('.ui-icon').css({width:'30px',height:'30px'});
+        el.onmousedown = mod_dragMapSize_down;
+    }
+    $(el).hover(function () {
+                    $(this).addClass("ui-state-hover");
+            },
+            function () {
+                    $(this).removeClass("ui-state-hover");
+            }
+    );
+    mod_dragMapSize_arrange();
+}
+
+function mod_dragMapSize_arrange(){
+	var left = parseInt(document.getElementById(mod_dragMapSize_target).style.left, 10) +
+                        parseInt(document.getElementById(mod_dragMapSize_target).style.width, 10) +
+                        mod_dragMapSize_offset -
+                        (parseInt(document.getElementById('dragMapSize_Mobile').style.width, 10)/2);
+	var top = parseInt(document.getElementById(mod_dragMapSize_target).style.top, 10) +
+                        parseInt(document.getElementById(mod_dragMapSize_target).style.height, 10) +
+                        mod_dragMapSize_offset -
+                        (parseInt(document.getElementById('dragMapSize_Mobile').style.height, 10)/2);
+	mb_arrangeElement('','dragMapSize_Mobile' , left, top);
+}
+function mod_dragMapSize_touchOn(e){
+
+    body.addEventListener("touchstart", mod_dragMapSize_touch_down, true);
+    body.addEventListener("touchmove", mod_dragMapSize_touch_drag, true);
+    body.addEventListener("touchend", mod_dragMapSize_touch_up, true);
+    mod_dragMapSize_touch_down(e);
+}
+function mod_dragMpaSize_touchOff(e){
+    body.removeEventListener("touchstart", mod_dragMapSize_touch_down, true);
+    body.removeEventListener("touchmove", mod_dragMapSize_touch_drag, true);
+    body.removeEventListener("touchend", mod_dragMapSize_touch_up, true);
+}
+
+function mod_dragMapSize_touch_down(e){
+    e.preventDefault();
+    var elm = findElement(e, "");
+    if(mod_dragMapSize_active == false && isSingleTouch(e)){
+
+        mb_start_x = e.touches[0].pageX;
+        mb_start_y = e.touches[0].pageY;
+        mb_end_x = mb_start_x;
+        mb_end_y = mb_start_y;
+
+        mod_dragMapSize_active = true;
+
+        //create a div that catches all mouse interactions
+        var dragElement = document.getElementById("dragMapSize_Mobile");
+        $('.ui-state-active').css({width:'30px',height:'30px'});
+        $(dragElement).addClass("ui-state-active");
+        var mouseCatcher = dragElement.parentNode.appendChild(document.createElement('div'));
+        mouseCatcher.setAttribute("id", "dragMapSize_helper");
+        mouseCatcher.style.position = "absolute";
+        mouseCatcher.style.cursor = "move";
+        mouseCatcher.style.width = "200px";
+        mouseCatcher.style.height = "200px";
+        mouseCatcher.style.zIndex = 160;
+        if($.browser.msie)
+                mouseCatcher.style.background = "url(../img/transparent.gif)";
+        mouseCatcher.style.left=(mb_start_x-parseInt(mouseCatcher.style.width)) + "px";
+        mouseCatcher.style.top=(mb_start_x-parseInt(mouseCatcher.style.height)) + "px";
+    }
+    return true;
+}
+
+function mod_dragMapSize_touch_drag(e){
+    e.preventDefault();
+    var elm = findElement(e, "");
+    if(mod_dragMapSize_active && isSingleTouch(e)){
+//        var x, y;
+        mb_end_x = e.touches[0].pageX;
+        mb_end_y = e.touches[0].pageY;
+        var dif_x = mb_end_x - (parseInt(document.getElementById('dragMapSize_Mobile').style.width)/2);
+        var dif_y = mb_end_y - (parseInt(document.getElementById('dragMapSize_Mobile').style.height)/2);
+        mb_arrangeElement('', "dragMapSize_Mobile", dif_x, dif_y);
+        var mouseCatcher = document.getElementById("dragMapSize_helper");
+        mb_arrangeElement('', "dragMapSize_helper", mb_end_x-parseInt(mouseCatcher.style.width), mb_end_y-parseInt(mouseCatcher.style.height));
+    }
+}
+
+function mod_dragMapSize_touch_up(e){
+    e.preventDefault();
+    var elm = findElement(e, "");
+    body.removeEventListener("touchstart", mod_dragMapSize_touch_down, true);
+    body.removeEventListener("touchmove", mod_dragMapSize_touch_drag, true);
+    body.removeEventListener("touchend", mod_dragMapSize_touch_up, true);
+//    if (isMainTouchActiv) {
+//            $.extend(Mapbender.modules.mobile_Map).defaultTouch.activate();
+//    }
+
+//    if (isSingleTouch(e)) {
+//        mb_end_x = e.touches[0].pageX;
+//        mb_end_y = e.touches[0].pageY;
+
+
+        var dragElement = document.getElementById("dragMapSize_Mobile");
+        $(dragElement).removeClass("ui-state-active");
+
+        var mouseCatcher = document.getElementById("dragMapSize_helper");
+        mouseCatcher.parentNode.removeChild(mouseCatcher);
+
+        mod_dragMapSize_active = false;
+
+        targetObject = getMapObjByName(mod_dragMapSize_target);
+        var dif_x = (parseFloat(mb_end_x) - parseFloat(mb_start_x));
+        var dif_y = (parseFloat(mb_end_y) - parseFloat(mb_start_y));
+
+        if(parseFloat(targetObject.width) + parseFloat(dif_x)<0 ||
+            parseFloat(targetObject.height) + parseFloat(dif_y)<0){
+
+            var dif_x = mb_start_x - (parseInt(document.getElementById('dragMapSize_Mobile').style.width) / 2);
+            var dif_y = mb_start_y - (parseInt(document.getElementById('dragMapSize_Mobile').style.height) / 2);
+            mb_arrangeElement('', "dragMapSize_Mobile", dif_x, dif_y);
+            return true;
+        }
+
+        var newX = (parseFloat(targetObject.width) + parseFloat(dif_x));
+        var newY = (parseFloat(targetObject.height) + parseFloat(dif_y));
+        var pos =  makeClickPos2RealWorldPos(mod_dragMapSize_target, newX, newY);
+        targetObject.setWidth(targetObject.getWidth() + parseFloat(dif_x));
+        targetObject.setHeight(targetObject.getHeight() + parseFloat(dif_y));
+
+        var mybbox = targetObject.getExtent().split(",");
+        if (typeof mybbox !== "object" || mybbox.length !== 4) {
+                return;
+        }
+        targetObject.setExtent(mybbox[0], pos[1], pos[0], mybbox[3]);
+        targetObject.setMapRequest();
+        eventResizeMap.trigger();
+//    }
+    return true;
+}
+
+function findElement(event, tagName) {
+    var element = getElement(event);
+    while (element.parentNode && (!element.tagName ||
+          (element.tagName.toUpperCase() != tagName.toUpperCase()))){
+        element = element.parentNode;
+        return element;
+    }
+}
+
+function getElement(event) {
+    return event.target || event.srcElement;
+}
+
+function isSingleTouch(event) {
+    return event.touches && event.touches.length == 1;
+}
+
+function isMultiTouch(event) {
+    return event.touches && event.touches.length > 1;
+}
+
+function mod_dragMapSize_down(e){
+	if(mod_dragMapSize_active == false){
+                document.onmouseup = mod_dragMapSize_up;
+                document.onmousemove = mod_dragMapSize_drag;
+                mb_getMousePos(e);
+                mb_start_x = clickX;
+                mb_start_y = clickY;
+                mb_end_x = clickX;
+                mb_end_y = clickY;
+		mod_dragMapSize_active = true;
+
+		//create a div that catches all mouse interactions
+		var dragElement = document.getElementById("dragMapSize_Mobile");
+//                $('.ui-state-active').css({width:'30px',height:'30px'});
+		$(dragElement).addClass("ui-state-active");
+		var mouseCatcher = dragElement.parentNode.appendChild(document.createElement('div'));
+		mouseCatcher.setAttribute("id", "dragMapSize_helper");
+		mouseCatcher.style.position = "absolute";
+		mouseCatcher.style.cursor = "move";
+		mouseCatcher.style.width = "500px";
+		mouseCatcher.style.height = "500px";
+		mouseCatcher.style.zIndex = 160;
+		if($.browser.msie)
+			mouseCatcher.style.background = "url(../img/transparent.gif)";
+		mouseCatcher.style.left=(mb_start_x-parseInt(mouseCatcher.style.width)) + "px";
+		mouseCatcher.style.top=(mb_start_x-parseInt(mouseCatcher.style.height)) + "px";
+
+		return false;
+	}
+}
+
+function mod_dragMapSize_up(e){
+        mb_getMousePos(e);
+        mb_end_x = clickX;
+        mb_end_y = clickY;
+        document.onmouseup = null;
+        document.onmousemove = null;
+	var dragElement = document.getElementById("dragMapSize_Mobile");
+	$(dragElement).removeClass("ui-state-active");
+
+	var mouseCatcher = document.getElementById("dragMapSize_helper");
+	mouseCatcher.parentNode.removeChild(mouseCatcher);
+
+	mod_dragMapSize_active = false;
+
+	targetObject = getMapObjByName(mod_dragMapSize_target);
+	var dif_x = (parseFloat(mb_end_x) - parseFloat(mb_start_x));
+	var dif_y = (parseFloat(mb_end_y) - parseFloat(mb_start_y));
+	if(parseFloat(targetObject.width) + parseFloat(dif_x)<0 ||
+		parseFloat(targetObject.height) + parseFloat(dif_y)<0)
+	{
+		var dif_x = mb_start_x - (parseInt(document.getElementById('dragMapSize_Mobile').style.width) / 2);
+		var dif_y = mb_start_y - (parseInt(document.getElementById('dragMapSize_Mobile').style.height) / 2);
+		mb_arrangeElement('', "dragMapSize_Mobile", dif_x, dif_y);
+		return;
+	}
+	var newX = (parseFloat(targetObject.width) + parseFloat(dif_x));
+	var newY = (parseFloat(targetObject.height) + parseFloat(dif_y));
+	var pos =  makeClickPos2RealWorldPos(mod_dragMapSize_target, newX, newY);
+	targetObject.setWidth(targetObject.getWidth() + parseFloat(dif_x));
+	targetObject.setHeight(targetObject.getHeight() + parseFloat(dif_y));
+
+	var mybbox = targetObject.getExtent().split(",");
+	if (typeof mybbox !== "object" || mybbox.length !== 4) {
+		return;
+	}
+	targetObject.setExtent(mybbox[0], pos[1], pos[0], mybbox[3]);
+	targetObject.setMapRequest();
+	eventResizeMap.trigger();
+}
+
+function mod_dragMapSize_drag(e){
+	if(mod_dragMapSize_active){
+            var x, y;
+            if (!e)
+            e = window.event;
+            mb_getMousePos(e);
+            x = clickX;
+            y = clickY;
+            var dif_x = x - (parseInt(document.getElementById('dragMapSize_Mobile').style.width)/2);
+            var dif_y = y - (parseInt(document.getElementById('dragMapSize_Mobile').style.height)/2);
+            mb_arrangeElement('', "dragMapSize_Mobile", dif_x, dif_y);
+            mb_arrangeElement('', "dragMapSize_helper", x-250, y-250);
+	}
+}
+

Added: branches/mobile/http/javascripts/mod_featureInfoTunnel_mobile.php
===================================================================
--- branches/mobile/http/javascripts/mod_featureInfoTunnel_mobile.php	                        (rev 0)
+++ branches/mobile/http/javascripts/mod_featureInfoTunnel_mobile.php	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,192 @@
+<?php
+# $Id: mod_featureInfoTunnel.php 7663 2011-02-28 12:44:13Z verenadiewald $
+# http://www.mapbender.org/index.php/mod_featureInfoTunnel.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+//defaults for element vars
+?>
+
+if(typeof(featureInfoLayerPopup)==='undefined')
+	var featureInfoLayerPopup = 'false';
+if(typeof(featureInfoPopupHeight)==='undefined')
+	var featureInfoPopupHeight = '200';
+if(typeof(featureInfoPopupWidth)==='undefined')
+	var featureInfoPopupWidth = '270';
+if(typeof(featureInfoPopupPosition)==='undefined')
+	var featureInfoPopupPosition = 'center';
+if(typeof(featureInfoNoResultPopup)==='undefined')
+	var featureInfoNoResultPopup = 'false';		
+
+var mod_featureInfoTunnel_elName = "featureInfoTunnel";
+var mod_featureInfoTunnel_frameName = "";
+var mod_featureInfoTunnel_target = "<?php echo $e_target[0]; ?>";
+var mod_featureInfoTunnel_map = null;
+
+var mod_featureInfoTunnel_img_on = new Image(); mod_featureInfoTunnel_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
+var mod_featureInfoTunnel_img_off = new Image(); mod_featureInfoTunnel_img_off.src ="<?php  echo $e_src;  ?>";
+var mod_featureInfoTunnel_img_over = new Image(); mod_featureInfoTunnel_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
+
+function init_featureInfoTunnel(ind){
+	mod_featureInfoTunnel_map = getMapObjByName(mod_featureInfoTunnel_target);
+        if ($.extend(mod_featureInfoTunnel_map).defaultTouch) {
+            $.extend(mod_featureInfoTunnel_map).defaultTouch.deactivate();
+        }
+	mb_button[ind] = document.getElementById(mod_featureInfoTunnel_elName);
+	mb_button[ind].img_over = mod_featureInfoTunnel_img_over.src;
+	mb_button[ind].img_on = mod_featureInfoTunnel_img_on.src;
+	mb_button[ind].img_off = mod_featureInfoTunnel_img_off.src;
+	mb_button[ind].status = 0;
+	mb_button[ind].elName = mod_featureInfoTunnel_elName;
+	mb_button[ind].fName = mod_featureInfoTunnel_frameName;
+	mb_button[ind].go = new Function ("mod_featureInfoTunnel_click()");
+	mb_button[ind].stop = new Function ("mod_featureInfoTunnel_disable()");
+	
+}
+function mod_featureInfoTunnel_click(){   
+	var domNode = mod_featureInfoTunnel_map.getDomElement();
+	if (domNode) {
+		$(domNode).bind("click", mod_featureInfoTunnel_event);
+	}
+	mod_featureInfoTunnel_map.getDomElement().style.cursor = "help";
+
+}
+function mod_featureInfoTunnel_disable(){
+	var domNode = mod_featureInfoTunnel_map.getDomElement();
+	if (domNode) {
+		$(domNode).unbind("click", mod_featureInfoTunnel_event);
+	}
+	
+	mod_featureInfoTunnel_map.getDomElement().style.cursor = "default";
+        
+        if ($.extend(mod_featureInfoTunnel_map).defaultTouch) {
+            $.extend(mod_featureInfoTunnel_map).defaultTouch.activate();
+        }
+}
+
+function removeProgressWheel () {
+	$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").empty();
+	$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").css("visibility","hidden");
+}
+
+function mod_featureInfoTunnel_event(e){
+	eventBeforeFeatureInfo.trigger({"fName":mod_featureInfoTunnel_target});
+	
+	//create progress wheel element
+	var map_el = mod_featureInfoTunnel_map.getDomElement();
+	if (!map_el.ownerDocument.getElementById(mod_featureInfoTunnel_map.elementName + "_progressWheel")) {
+		//create progress wheel element
+
+		var $div = $("<div id='" + mod_featureInfoTunnel_map.elementName + "_progressWheel'></div>");
+		map_el.appendChild($div.get(0));
+	}
+
+	var point = mod_featureInfoTunnel_map.getMousePosition(e);
+	var path = '../extensions/ext_featureInfoTunnel.php';
+	
+//TODO that code should go to featureInfo Redirect module
+	var ind = getMapObjIndexByName(mod_featureInfoTunnel_target);
+	if(document.getElementById("FeatureInfoRedirect")){
+		//fill the frames
+		for(var i=0; i<mod_featureInfoTunnel_map.wms.length; i++){
+			var req = mod_featureInfoTunnel_map.wms[i].getFeatureInfoRequest(mb_mapObj[ind], point);
+			if(req)
+				window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfoTunnel_map.wms[i].wms_id).src = path+"?url="+escape(req);
+		}
+	}
+	else{
+		urls = mod_featureInfoTunnel_map.getFeatureInfoRequests(point);
+		if(urls){
+			for(var i=0;i<urls.length;i++){
+				(function () {
+					var currentMapObjWidth = point.x;   
+					var currentMapObjHeight = point.y;
+					$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").html("<img src='../img/indicator_wheel.gif'/>");
+					$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").css({
+						position: "absolute",
+						top: currentMapObjHeight,
+						left: currentMapObjWidth,
+						visibility: "visible",
+						zIndex: 100
+					});
+					window.setTimeout("removeProgressWheel()", 10000);
+					var currentRequest = urls[i];
+					var cnt = i;
+					if(featureInfoPopupPosition.length == 2 && !isNaN(featureInfoPopupPosition[0]) && !isNaN(featureInfoPopupPosition[1])) {
+						var dialogPosition = [];
+						dialogPosition[0] = featureInfoPopupPosition[0]+cnt*25;
+						dialogPosition[1] = featureInfoPopupPosition[1]+cnt*25;
+					}
+					else {
+						var dialogPosition = featureInfoPopupPosition;
+					}
+					$(".fiResultFrame").remove();
+          
+					mb_ajax_post(path, {'url':currentRequest},function(js_code,status){
+						if(js_code){
+							if(featureInfoLayerPopup == 'true') {
+								$("<div><iframe frameborder=0 class='fiResultFrame' id='featureInfo_"+ i + "' style='width:100%;height:100%;' src='" + path + "?url=" + encodeURIComponent(currentRequest) + "'></iframe></div>").dialog({
+									bgiframe: true,
+									autoOpen: true,
+									title: '<?php echo _mb("Information");?>',
+									modal: false,
+									width:parseInt(featureInfoPopupWidth, 10),
+									height:parseInt(featureInfoPopupHeight, 10),
+									position:dialogPosition,
+// This is a workaround if dialogs don't have the appropriate height
+//									height: 450,
+//									open: function(){
+//										$(this).css({
+//											"height": parseInt(featureInfoPopupHeight, 10)+ "px"
+//										});
+//									},
+									close: function() {
+										$(this).remove();
+									}
+								});
+								
+								$(".noResultFound").dialog("close");
+							}
+							else{
+								window.open(path+"?url=" + encodeURIComponent(currentRequest), "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+							}
+						}
+						
+						if(featureInfoNoResultPopup == 'true' && featureInfoLayerPopup == 'true') {
+							if($(".fiResultFrame").size() === 0) {
+								$(".noResultFound").dialog("close");
+								$("<div class='noResultFound'><?php echo _mb("No result");?></div>").dialog({
+									bgiframe: true,
+									title: "<?php echo _mb("Information");?>",
+									autoOpen: true,
+									modal: false,
+									width:300,
+									height:200,
+									position:[600,200]
+								});
+							}
+						}	
+						removeProgressWheel();
+					});
+				}());
+			}
+		}
+		else
+			alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
+	}	
+}

Added: branches/mobile/http/javascripts/mod_pan_mobile.js
===================================================================
--- branches/mobile/http/javascripts/mod_pan_mobile.js	                        (rev 0)
+++ branches/mobile/http/javascripts/mod_pan_mobile.js	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,124 @@
+/**
+ * Package: selArea
+ *
+ * Description:
+ * Zoom by rectangle
+ *
+ * Files:
+ *  - http/javascripts/mod_selArea.js
+ *
+ * SQL:
+ * > <SQL for element>
+ * >
+ * > <SQL for element var>
+ *
+ * Help:
+ * http://www.mapbender.org/SelArea1
+ *
+ * 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 that = this;
+
+Mapbender.events.init.register(function () {
+
+	var mb_panActive = false;
+	var startPos, stopPos;
+	var map = Mapbender.modules[options.target];
+        var isTouchable = false;
+        var touch;
+        try {
+            document.createEvent("TouchEvent");
+            isTouchable = true;
+        } catch(e){}
+
+	var button = new Mapbender.Button({
+		domElement: that,
+		over: options.src.replace(/_off/, "_over"),
+		on: options.src.replace(/_off/, "_on"),
+		off: options.src,
+		name: options.id,
+		go: function () {
+			if (!map) {
+				new Mb_exception(options.id + ": " +
+					options.target + " is not a map!");
+				return;
+			}
+                        if(isTouchable) {
+                            $(map.getDomElement()).css("cursor", "crosshair");
+
+                            if ($.extend(map).defaultTouch) {
+                                $.extend(map).defaultTouch.deactivate();
+                            }
+                            touch = new MapTouch(map, $(map.getDomElement()), map.getDomElement());
+                            touch.activate();
+                        } else {
+                            $(map.getDomElement())
+                                    .css("cursor", "move")
+                                    .mousedown(function (e) {
+                                    mb_panActive = true;
+                                    startPos = map.getMousePosition(e);
+                                    stopPos = new Point(startPos);
+                                    return false;
+                            }).mousemove(function (e) {
+                                    if (!mb_panActive) {
+                                            return false;
+                                    }
+                                    stopPos = map.getMousePosition(e);
+                                    var dif = stopPos.minus(startPos);
+                                    map.moveMap(dif.x, dif.y);
+                                    if (!$.browser.msie){
+                                            return true;
+                                    }
+                                    return false;
+                            }).mouseup(function (e) {
+                                    if (!mb_panActive) {
+                                            return false;
+                                    }
+                                    if (!map) {
+                                            return false;
+                                    }
+                                    mb_panActive = false;
+                                    var dif = stopPos.minus(startPos);
+                                    var widthHeight = new Mapbender.Point(
+                                            map.getWidth(),
+                                            map.getHeight()
+                                    );
+                                    var center = widthHeight.times(0.5).minus(dif);
+                                    var realCenter = map.convertPixelToReal(center);
+                                    map.moveMap();
+                                    map.zoom(false, 1.0, realCenter);
+                                    return false;
+                            });
+                        }
+		},
+		stop: function () {
+			if (!map) {
+				return false;
+			}
+                        if(isTouchable) {
+                            $(map.getDomElement()).css("cursor", "default");
+                            touch.deactivate();
+                            touch = null;
+                            mb_panActive = false;
+                            if ($.extend(map).defaultTouch) {
+                                $.extend(map).defaultTouch.activate();
+                            }
+                        } else {
+                                    $(map.getDomElement())
+                                            .css("cursor", "default")
+                                            .unbind("mousedown")
+                                            .unbind("mouseup")
+                                            .unbind("mousemove");
+                                    mb_panActive = false;
+                        }
+		}
+	});
+});

Added: branches/mobile/http/javascripts/mod_selArea_mobile.js
===================================================================
--- branches/mobile/http/javascripts/mod_selArea_mobile.js	                        (rev 0)
+++ branches/mobile/http/javascripts/mod_selArea_mobile.js	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,204 @@
+/**
+ * Package: selArea
+ *
+ * Description:
+ * Zoom by rectangle
+ * 
+ * Files:
+ *  - http/javascripts/mod_selArea.js
+ *
+ * SQL:
+ * > <SQL for element> 
+ * > 
+ * > <SQL for element var> 
+ *
+ * Help:
+ * http://www.mapbender.org/SelArea1
+ *
+ * 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 that = this;
+
+
+Mapbender.events.init.register(function () {
+    var touch;
+    var box;
+    var map = Mapbender.modules[options.target];
+    var isTouchable = false;
+    try {
+        document.createEvent("TouchEvent");
+        isTouchable = true;
+    } catch(e){}
+    var button = new Mapbender.Button({
+        domElement: that,
+        over: options.src.replace(/_off/, "_over"),
+        on: options.src.replace(/_off/, "_on"),
+        off: options.src,
+        name: options.id,
+        go: function () {
+            if (!map) {
+                new Mb_exception(options.id + ": " +
+                    options.target + " is not a map!");
+                return;
+            }
+            if(isTouchable) {
+                $(map.getDomElement()).css("cursor", "crosshair");
+
+                if ($.extend(map).defaultTouch) {
+                    $.extend(map).defaultTouch.deactivate();
+                }
+                box = new Mapbender.BoxMobile({
+                    target: options.target
+                });
+                touch = new selAreaTouch(map,$(map.getDomElement()), map.getDomElement(), box);
+                touch.activate();
+            } else {
+                box = new Mapbender.Box({
+                    target: options.target
+                });
+
+                $(map.getDomElement()).css(
+                    "cursor", "crosshair"
+                    ).mousedown(function (e) {
+                    box.start(e);
+                    return false;
+                }).mouseup(function (e) {
+                    box.stop(e, function (extent) {
+                        if (typeof extent === "undefined") {
+                            return false;
+                        }
+                        if (extent.constructor === Mapbender.Extent) {
+                            var xt = map.calculateExtent(extent);
+                            map.setMapRequest();
+                        }
+                        else if (extent.constructor === Mapbender.Point) {
+                            map.setCenter(extent);
+                            map.setMapRequest();
+                        }
+                    });
+                    return false;
+                });
+            }
+        },
+        stop: function () {
+            if (!map) {
+                return;
+            }
+            if(isTouchable) {
+                $(map.getDomElement()).css("cursor", "default");
+                touch.deactivate();
+                touch = null;
+                box = null;
+                if ($.extend(map).defaultTouch) {
+                    $.extend(map).defaultTouch.activate();
+                }
+            } else {
+                $(map.getDomElement())
+                .css("cursor", "default")
+                .unbind("mousedown")
+                .unbind("mouseup")
+                .unbind("mousemove");
+                box = null;
+            }
+        }
+    });
+    function selAreaTouch(map, $map, mapDom, box){
+        this.map = map;
+        this.$elm = $map;
+        this.elm = mapDom;
+        this.box = box;
+        this.startPos = null;
+        this.activate = function() {
+            this.elm.addEventListener("touchstart", touch.startTouch, true);
+            this.elm.addEventListener("touchmove", touch.moveTouch, true);
+            this.elm.addEventListener("touchend", touch.endTouch, true);
+        }
+        this.deactivate = function() {
+            this.elm.removeEventListener("touchstart", touch.startTouch, true);
+            this.elm.removeEventListener("touchmove", touch.moveTouch, true);
+            this.elm.removeEventListener("touchend", touch.endTouch, true);
+        }
+        this.startTouch = function(event) {
+            event.preventDefault();
+            var elm = findElement(event, "");
+            if (isSingleTouch(event)) {
+                touch.startPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                var stopPos = new Point(touch.startPos.x, touch.startPos.y);
+                touch.box.start(touch.startPos, stopPos);
+            } else if (isMultiTouch(event)) {
+                var startPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                var stopPos = new Point(
+                    event.touches[1].pageX - touch.$elm.offset().left,
+                    event.touches[1].pageY - touch.$elm.offset().top);
+                touch.box.start(startPos, stopPos);
+            }
+            return true;
+        }
+        this.moveTouch = function(event) {
+            event.preventDefault();
+            var elm = findElement(event, "");
+            if (isSingleTouch(event)) {
+                var stopPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                touch.box.run(touch.startPos, stopPos);
+            } else if (isMultiTouch(event)) {
+                var startPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                var stopPos = new Point(
+                    event.touches[1].pageX - touch.$elm.offset().left,
+                    event.touches[1].pageY - touch.$elm.offset().top);
+                touch.box.run(startPos, stopPos);
+            }
+            return true;
+        }
+        this.endTouch = function(event) {
+            return touch.box.stop(function (extent) {
+                if (typeof extent === "undefined") {
+                    return false;
+                }
+                if (extent.constructor === Mapbender.Extent) {
+                    var xt = touch.map.calculateExtent(extent);
+                    touch.map.setMapRequest();
+                }
+                else if (extent.constructor === Mapbender.Point) {
+                    touch.map.setCenter(extent);
+                    touch.map.setMapRequest();
+                }
+            });
+        }
+
+        function findElement(event, tagName) {
+            var element = getElement(event);
+            while (element.parentNode && (!element.tagName ||
+                (element.tagName.toUpperCase() != tagName.toUpperCase()))){
+                element = element.parentNode;
+                return element;
+            }
+        }
+        function getElement(event) {
+            return event.target || event.srcElement;
+        }
+        function isSingleTouch (event) {
+            return event.touches && event.touches.length == 1;
+        }
+        function isMultiTouch(event) {
+            return event.touches && event.touches.length > 1;
+        }
+    }
+});
+
+

Added: branches/mobile/http/javascripts/requestGeometryConstructor_mobile.js
===================================================================
--- branches/mobile/http/javascripts/requestGeometryConstructor_mobile.js	                        (rev 0)
+++ branches/mobile/http/javascripts/requestGeometryConstructor_mobile.js	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,435 @@
+/* 
+* $Id: requestGeometryConstructor.js 1882 2007-12-03 09:01:24Z verenadiewald $
+* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
+*/
+//http://www.mapbender.org/index.php/requestGeometryConstructor.js
+
+/**
+ * @class A class representing a constructor for a geometry/WFS request.
+ *
+ * @constructor
+ * @param {String} geomType type of the {@link RequestGeometryConstructor}
+ * @param {String} geomType target of the {@link RequestGeometryConstructor}
+ */
+function RequestGeometryConstructor(geomTarget){
+    /**
+ 	 * geomTarget target of the {@link RequestGeometryConstructor}
+	 *
+	 * @type String
+	 */
+    this.geomTarget = geomTarget;
+
+    var that = this;
+    var ind = getMapObjIndexByName(this.geomTarget);
+    var myMapObj = mb_mapObj[ind];
+    var map_el = myMapObj.getDomElement();
+
+    var box;
+    var touch;
+    var isTouchable = false;
+    try {
+        document.createEvent("TouchEvent");
+        isTouchable = true;
+    } catch(e){}
+	
+	
+    if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_request_geometry_polygon")){
+
+        //create Box Elements
+        var el_top = map_el.ownerDocument.createElement("div");
+        el_top.style.position = "absolute";
+        el_top.style.top = "0px";
+        el_top.style.left = "0px";
+        el_top.style.zIndex = "500";
+        el_top.style.fontSize = "10px";
+        el_top.id = myMapObj.elementName+"_request_geometry_polygon";
+        map_el.appendChild(el_top);
+    }
+	
+    if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_measure_display")){
+        //create Box Elements
+        var el_top = map_el.ownerDocument.createElement("div");
+        el_top.style.position = "absolute";
+        el_top.style.top = "0px";
+        el_top.style.left = "0px";
+        el_top.style.zIndex = "510";
+        el_top.id = myMapObj.elementName+"_measure_display";
+        map_el.appendChild(el_top);
+    }
+
+	
+    this.getGeometry = function(queryType,callbackFunction){
+        var target = this.geomTarget;
+        s = new Snapping(this.geomTarget);
+        callback = callbackFunction;
+		
+        var ind = getMapObjIndexByName(target);
+        var el = mb_mapObj[ind].getDomElement();
+        $(el).unbind("mousedown")
+        .unbind("mouseover")
+        .unbind("mouseup")
+        .unbind("mousemove");
+        if (queryType == "point") {
+            if ($.extend(myMapObj).defaultTouch) {
+                $.extend(myMapObj).defaultTouch.deactivate();
+            }
+            queryGeom = new Geometry(geomType.point);
+            $(el).mousedown(function (e) {
+                realWorldPos = mapToReal(target,myMapObj.getMousePosition(e));
+                queryGeom.addPoint(realWorldPos);
+                callback(target, queryGeom);
+                $(el).unbind("mousedown")
+                .unbind("mouseover")
+                .unbind("mouseup")
+                .unbind("mousemove");
+                queryGeom = null;
+                if ($.extend(myMapObj).defaultTouch) {
+                    $.extend(myMapObj).defaultTouch.activate();
+                }
+            });
+        }
+        else if (queryType == "polygon") {
+            if ($.extend(myMapObj).defaultTouch) {
+                $.extend(myMapObj).defaultTouch.deactivate();
+            }
+            queryGeom = new Geometry(geomType.polygon);
+            if(isTouchable){
+                $(el).mousedown(function (e) {
+                    wfsSpatialRequestStart(e);
+                })
+            } else {
+                $(el).mousedown(function (e) {
+                    wfsSpatialRequestStart(e);
+                }).mousemove(function (e) {
+                    wfsSpatialRequestRun(e);
+                });
+            }
+            
+        }
+        else if (queryType == "rectangle") {
+            if(isTouchable) {
+                if ($.extend(myMapObj).defaultTouch) {
+                    $.extend(myMapObj).defaultTouch.deactivate();
+                }
+                box = new Mapbender.BoxMobile({
+                    target: geomTarget
+                });
+                touch = new selAreaTouch(myMapObj,$(myMapObj.getDomElement()), myMapObj.getDomElement(), box);
+                touch.activate();
+                queryGeom = new Geometry(geomType.line);
+//                $(el).mousedown(function (e) {
+//                    box.start(e);
+//                    return false;
+//                }).mouseup(function (e) {
+//                    var targetMap = Mapbender.modules[that.geomTarget];
+//                    if (!targetMap) {
+//                        return false;
+//                    }
+//                    box.stop(e, function (extent) {
+//                        if (typeof extent === "undefined") {
+//                            return false;
+//                        }
+//                        if (extent.constructor === Mapbender.Extent) {
+//                            queryGeom = new Geometry(geomType.line);
+//                            queryGeom.addPoint(extent.min);
+//                            queryGeom.addPoint(extent.max);
+//                            queryGeom.close();
+//                            callback(that.geomTarget,queryGeom);
+//
+//                            $(el)
+//                            .css("cursor", "default")
+//                            .unbind("mousedown")
+//                            .unbind("mouseup")
+//                            .unbind("mousemove");
+//                            box = null;
+//
+//                        }
+//                    });
+//                    return false;
+//
+//                });
+            } else {
+                box = new Mapbender.Box({
+                    target: geomTarget
+                });
+                queryGeom = new Geometry(geomType.line);
+                $(el).mousedown(function (e) {
+                    box.start(e);
+                    return false;
+                }).mouseup(function (e) {
+                    var targetMap = Mapbender.modules[that.geomTarget];
+                    if (!targetMap) {
+                        return false;
+                    }
+                    box.stop(e, function (extent) {
+                        if (typeof extent === "undefined") {
+                            return false;
+                        }
+                        if (extent.constructor === Mapbender.Extent) {
+                            queryGeom = new Geometry(geomType.line);
+                            queryGeom.addPoint(extent.min);
+                            queryGeom.addPoint(extent.max);
+                            queryGeom.close();
+                            callback(that.geomTarget,queryGeom);
+
+                            $(el)
+                            .css("cursor", "default")
+                            .unbind("mousedown")
+                            .unbind("mouseup")
+                            .unbind("mousemove");
+                            box = null;
+
+                        }
+                    });
+                    return false;
+
+                });
+            }
+                    
+        }
+        else if (queryType == "extent") {
+            queryGeom = new Geometry(geomType.line);
+            var ind = getMapObjIndexByName(target);
+            var p0 = mapToReal(target, new Point(0,0));
+            var p1 = mapToReal(target, new Point(mb_mapObj[ind].width,mb_mapObj[ind].height));
+            queryGeom.addPoint(p0);
+            queryGeom.addPoint(p1);
+            callback(target, queryGeom);
+            $(el).unbind("mousedown")
+            .unbind("mouseover")
+            .unbind("mouseup")
+            .unbind("mousemove");
+
+            queryGeom = null;
+        }
+		
+    }
+	
+    var s;
+    var callback;
+	
+    var wfsSpatialRequestStart = function(e){
+        this.geomTarget = geomTarget;
+        var that = this;
+        var realWorldPos;
+        if(isTouchable) {
+            if (queryGeom.count() >= 3) {
+            var pos = myMapObj.getMousePosition(e);
+                s.check(pos);
+            }
+        }
+        if (s.isSnapped() == true) {
+            realWorldPos = s.getSnappedPoint();
+            s.clean();
+        }
+        else {
+            realWorldPos = mapToReal(that.geomTarget,myMapObj.getMousePosition(e));
+        }
+        queryGeom.addPoint(realWorldPos);
+	
+        if (queryGeom.count() == 1) {
+            s.add(queryGeom.get(0));
+        }
+        if (s.isSnapped() && queryGeom.count() >= 3 && queryGeom.get(-1).equals(queryGeom.get(0))) {
+            queryGeom.close();
+            callback(that.geomTarget,queryGeom);
+            writeTag(myMapObj.frameName, myMapObj.elementName+"_request_geometry_polygon", "");
+            writeTag(myMapObj.frameName, myMapObj.elementName+"_measure_display", "");
+            var ind = getMapObjIndexByName("mapframe1");
+            var el = mb_mapObj[ind].getDomElement();
+            $(el).unbind("mousedown")
+            .unbind("mouseover")
+            .unbind("mouseup")
+            .unbind("mousemove");
+            queryGeom = null;
+            if ($.extend(myMapObj).defaultTouch) {
+                $.extend(myMapObj).defaultTouch.activate();
+            }
+            return;
+        }
+        drawDashedLineExt();
+    }
+	
+    var wfsSpatialRequestRun = function(e){
+        this.geomTarget = geomTarget;
+        var that = this;
+        if (queryGeom.count() >= 3) {
+            var pos = myMapObj.getMousePosition(e);
+            s.check(pos);
+        }
+    }
+	
+    var drawDashedLineExt = function(e){
+        this.geomTarget = geomTarget;
+        var that = this;
+        var ind = getMapObjIndexByName(that.geomTarget);
+        var str_mPoints = "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='"+mb_mapObj[ind].width+"' height='0'></div>";
+        str_mPoints += "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='0' height='"+mb_mapObj[ind].height+"'></div>";
+        if (queryGeom != null) {
+            for(var i=0; i<queryGeom.count(); i++){
+                var pos = realToMap(that.geomTarget,queryGeom.get(i));
+                str_mPoints += "<div style='font-size:1px;position:absolute;top:"+(pos.y-2)+"px;left:"+(pos.x-2)+"px;width:3px;height:3px;background-color:#ff0000'></div>";
+            }
+            if(queryGeom.count()>1){
+                for(var k=1; k<queryGeom.count(); k++){
+                    var pos0 = realToMap(that.geomTarget,queryGeom.get(k));
+                    var pos1 = realToMap(that.geomTarget,queryGeom.get(k-1));
+                    str_mPoints += evaluateDashesExt(pos1,pos0,k);
+                }
+            }
+        }
+        writeTag(myMapObj.frameName, myMapObj.elementName+"_request_geometry_polygon", str_mPoints);
+    }
+	
+    var evaluateDashesExt = function(p1,p0,count){
+        this.geomTarget = geomTarget;
+        var that = this;
+        var ind = getMapObjIndexByName(that.geomTarget);
+        var str_dashedLine = "";
+        var d = p0.dist(p1);
+        var n = Math.round(d);
+        var s =  p0.minus(p1).dividedBy(n);
+        for(var i=1; i<n; i++){
+            var currPoint = p1.plus(s.times(i)).minus(new Point(2,2)).round(0);
+            if(currPoint.x >= 0 && currPoint.x <= mb_mapObj[ind].width && currPoint.y >= 0 && currPoint.y <= mb_mapObj[ind].height){
+                str_dashedLine += "<div style='font-size:1px;position:absolute;top:"+currPoint.y+"px;left:"+currPoint.x+"px;width:3px;height:3px;background-color:#ff0000'></div>";
+            }
+        }
+        return str_dashedLine;
+    }
+	
+    var selAreaExtInit = function(e){
+        mb_isBF = that.geomTarget;
+        mb_zF = that.geomTarget;
+    }
+	
+    var selAreaExtGet = function(e){
+        selAreaExtSetValidClipping(mod_box_stop(e));
+        mb_isBF = that.geomTarget;
+        mb_zF = that.geomTarget;
+    }
+	
+    var selAreaExtSetValidClipping = function(coords){
+        this.geomTarget = geomTarget;
+        var that = this;
+        if (queryGeom != null) {
+            queryGeom.addPoint(new Point(coords[0],coords[1]));
+            queryGeom.addPoint(new Point(coords[2],coords[3]));
+			
+            if(queryGeom.count() == 2){
+                callback(that.geomTarget,queryGeom);
+                var ind = getMapObjIndexByName("mapframe1");
+                var el = mb_mapObj[ind].getDomElement();
+                $(el).unbind("mousedown")
+                .unbind("mouseover")
+                .unbind("mouseup")
+                .unbind("mousemove");
+                queryGeom = null;
+            }
+            else{
+                callback(that.geomTarget,queryGeom);
+            }
+        }
+    }
+
+    function selAreaTouch(map, $map, mapDom, box){
+        this.map = map;
+        this.$elm = $map;
+        this.elm = mapDom;
+        this.box = box;
+        this.startPos = null;
+        this.activate = function() {
+            this.elm.addEventListener("touchstart", touch.startTouch, true);
+            this.elm.addEventListener("touchmove", touch.moveTouch, true);
+            this.elm.addEventListener("touchend", touch.endTouch, true);
+        }
+        this.deactivate = function() {
+            this.elm.removeEventListener("touchstart", touch.startTouch, true);
+            this.elm.removeEventListener("touchmove", touch.moveTouch, true);
+            this.elm.removeEventListener("touchend", touch.endTouch, true);
+        }
+        this.startTouch = function(event) {
+            event.preventDefault();
+            var elm = findElement(event, "");
+            if (isSingleTouch(event)) {
+                touch.startPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                var stopPos = new Point(touch.startPos.x, touch.startPos.y);
+                touch.box.start(touch.startPos, stopPos);
+            } else if (isMultiTouch(event)) {
+                var startPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                var stopPos = new Point(
+                    event.touches[1].pageX - touch.$elm.offset().left,
+                    event.touches[1].pageY - touch.$elm.offset().top);
+                touch.box.start(startPos, stopPos);
+            }
+            return true;
+        }
+        this.moveTouch = function(event) {
+            event.preventDefault();
+            var elm = findElement(event, "");
+            if (isSingleTouch(event)) {
+                var stopPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                touch.box.run(touch.startPos, stopPos);
+            } else if (isMultiTouch(event)) {
+                var startPos = new Point(
+                    event.touches[0].pageX - touch.$elm.offset().left,
+                    event.touches[0].pageY - touch.$elm.offset().top);
+                var stopPos = new Point(
+                    event.touches[1].pageX - touch.$elm.offset().left,
+                    event.touches[1].pageY - touch.$elm.offset().top);
+                touch.box.run(startPos, stopPos);
+            }
+            return true;
+        }
+        this.endTouch = function(event) {
+            box = null;
+            touch.deactivate();
+            if ($.extend(myMapObj).defaultTouch) {
+                $.extend(myMapObj).defaultTouch.activate();
+            }
+            return touch.box.stop(
+                function (extent) {
+                    if (typeof extent === "undefined") {
+                        return false;
+                    }
+                    if (extent.constructor === Mapbender.Extent) {
+                        queryGeom = new Geometry(geomType.line);
+                        queryGeom.addPoint(extent.min);
+                        queryGeom.addPoint(extent.max);
+                        queryGeom.close();
+                        callback(that.geomTarget,queryGeom);
+                    }
+                }
+            );
+            touch.box = null;
+            touch = null;
+        }
+
+        function findElement(event, tagName) {
+            var element = getElement(event);
+            while (element.parentNode && (!element.tagName ||
+                (element.tagName.toUpperCase() != tagName.toUpperCase()))){
+                element = element.parentNode;
+                return element;
+            }
+        }
+        function getElement(event) {
+            return event.target || event.srcElement;
+        }
+        function isSingleTouch (event) {
+            return event.touches && event.touches.length == 1;
+        }
+        function isMultiTouch(event) {
+            return event.touches && event.touches.length > 1;
+        }
+    }
+}
+
+

Added: branches/mobile/http/plugins/mb_mobile.js
===================================================================
--- branches/mobile/http/plugins/mb_mobile.js	                        (rev 0)
+++ branches/mobile/http/plugins/mb_mobile.js	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,13 @@
+//var defaultTouch = null;
+
+eventInit.register(function () {
+    try {
+        var map = Mapbender.modules[options.target];
+        var defaultTouch = new MapTouch(map, $(map.getDomElement()), map.getDomElement());
+        defaultTouch.activate();
+        $.extend(map, {defaultTouch: defaultTouch});
+        return true;
+    } catch (e) {
+        return false;
+    }
+});
\ No newline at end of file

Added: branches/mobile/http/plugins/mb_overview_mobile.js
===================================================================
--- branches/mobile/http/plugins/mb_overview_mobile.js	                        (rev 0)
+++ branches/mobile/http/plugins/mb_overview_mobile.js	2011-08-02 09:03:18 UTC (rev 8040)
@@ -0,0 +1,494 @@
+/**
+ * Package: Overview
+ *
+ * Description:
+ * Use the overview map to navigate the main map window. You can select a new 
+ * rectangle in the overview map, the details will be displayed in the main 
+ * map window. Recenter the main map window section by just clicking a new 
+ * position in the overview map (the scale will not change). 
+ * 
+ * Files:
+ *  - http/javascripts/mod_overview.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 ('<app_id>','overview',
+ * > 2,1,'OverviewFrame','Overview','div','','',15,25,150,150,2,
+ * > 'overflow:hidden;',
+ * > '<div id="overview_maps" style="position:absolute;left:0px;right:0px;"></div>',
+ * > 'div','../plugins/mb_overview.js','mod_box1.js','mapframe1','mapframe1',
+ * > 'http://www.mapbender.org/index.php/Overview');
+ * > 
+ * > INSERT INTO gui_element_vars (fkey_gui_id, fkey_e_id, var_name, 
+ * > var_value, context, var_type) VALUES ('<app_id>', 'overview', 
+ * > 'overview_wms', '0', 'wms that shows up as overview' ,'var');
+ * >
+ * > INSERT INTO gui_element_vars (fkey_gui_id, fkey_e_id, var_name, 
+ * > var_value, context, var_type) VALUES ('<app_id>', 'overview', 
+ * > 'skipWmsIfSrsNotSupported', '0', 
+ * > 'if set to 1, it skips the WMS request if the current SRS is not supported by the WMS; if set to 0, the WMS is always queried. Default is 0, because of backwards compatibility' ,
+ * > 'var');
+ *
+ * Help:
+ * http://www.mapbender.org/Overview
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Christoph_Baudson
+ * 
+ * Parameters:
+ * overview_wms                - wms that shows up as overview
+ * skipWmsIfSrsNotSupported    - *[optional]* if set to 1, it skips the WMS 
+ * 			request if the current SRS is not supported by the WMS; if set 
+ * 			to 0, the WMS is always queried. Default is 0, because of 
+ * 			backwards compatibility
+ *
+ * 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
+ */
+
+if (typeof options.overview_wms === "undefined") {
+	options.overview_wms = 0;	
+}
+
+if (typeof options.enable_mouse === "undefined") {
+	options.enable_mouse = 1;	
+}
+options.overview_wms = parseInt(options.overview_wms, 10);
+
+if (!options.target) {
+	new Mb_exception(options.id + " needs a target.");
+	return;
+}
+
+var box;
+var map;
+var $this = $(this);
+
+Mapbender.events.initMaps.register(function () {
+        var touch;
+	var isTouchable = false;
+        try {document.createEvent("TouchEvent"); isTouchable = true; } catch(e){}
+	$this.data("isMap", true);
+
+	$this.mapbender(new Mapbender.Map({
+		id: options.id, 
+		width: options.width, 
+		height: options.height, 
+		wms: wms,
+		wmsIndexOverview: options.overview_wms
+		
+	})); 
+
+	map = Mapbender.modules[options.id];
+	map.isOverview = true;
+
+	map.skipWmsIfSrsNotSupported = 
+		options.skipWmsIfSrsNotSupported === 1 ? true : false;
+
+	//
+	// this line is for backwards compatibility
+	//
+	mb_mapObj.push(map);
+
+	
+	if (isTouchable) {
+            box = new Mapbender.BoxMobile({target: options.id});
+            touch = new mapTouch(map,$(map.getDomElement()), map.getDomElement(), box);
+            touch.activate();
+        } else {
+            // add select area behaviour
+            box = new Mapbender.Box({
+                    target: options.id
+            });
+            $(map.getDomElement()).mousedown(function (e) {
+                    if (options.enable_mouse == '0') {
+                            return false;
+                    }
+                    box.start(e);
+                    return false;
+            }).mouseup(function (e) {
+                    var targetMap = Mapbender.modules[options.target];
+                    if (!targetMap) {
+                            return false;
+                    }
+                    box.stop(e, function (extent) {
+                            if (typeof extent === "undefined") {
+                                    return false;
+                            }
+                            if (extent.constructor === Mapbender.Extent) {
+                                    targetMap.calculateExtent(extent);
+                                    targetMap.setMapRequest();
+                            }
+                            else if (extent.constructor === Mapbender.Point) {
+                                    targetMap.setCenter(extent);
+                                    targetMap.setMapRequest();
+                            }
+                    });
+                    return false;
+            });
+        }
+
+	// if the setBackground module is active,
+	// the overview wms might be hidden.
+	// so we activate it here.
+	var ovWmsArray = map.wms; 
+	if (typeof ovWmsArray !== "object" || ovWmsArray.length === 0) { 
+		return; 
+	} 
+	ovWmsArray[0].gui_wms_visible = 1;
+
+        function mapTouch(map, $map, mapDom, box){
+            this.map = map;
+            this.$elm = $map;
+            this.elm = mapDom;
+            this.box = box;
+            this.activate = function() {
+                this.elm.addEventListener("touchstart", touch.startTouch, true);
+                this.elm.addEventListener("touchmove", touch.moveTouch, true);
+                this.elm.addEventListener("touchend", touch.endTouch, true);
+            }
+            this.deactivate = function() {
+                this.elm.removeEventListener("touchstart", touch.startTouch, true);
+                this.elm.removeEventListener("touchmove", touch.moveTouch, true);
+                this.elm.removeEventListener("touchend", touch.endTouch, true);
+            }
+            this.startTouch = function(event) {
+                if (options.enable_mouse == '0') {
+                        return false;
+                }
+                event.preventDefault();
+                var elm = findElement(event, "");
+                if (isSingleTouch(event)) {
+                    touch.startPos = new Point(
+                        event.touches[0].pageX - touch.$elm.offset().left,
+                        event.touches[0].pageY - touch.$elm.offset().top);
+                    var stopPos = new Point(touch.startPos.x, touch.startPos.y);
+                    touch.box.start(touch.startPos, stopPos);
+                } else if (isMultiTouch(event)) {
+                    var startPos = new Point(
+                        event.touches[0].pageX - touch.$elm.offset().left,
+                        event.touches[0].pageY - touch.$elm.offset().top);
+                    var stopPos = new Point(
+                        event.touches[1].pageX - touch.$elm.offset().left,
+                        event.touches[1].pageY - touch.$elm.offset().top);
+                    touch.box.start(startPos, stopPos);
+                }
+                return true;
+            }
+            this.moveTouch = function(event) {
+                event.preventDefault();
+                var elm = findElement(event, "");
+                if (isSingleTouch(event)) {
+                    var stopPos = new Point(
+                        event.touches[0].pageX - touch.$elm.offset().left,
+                        event.touches[0].pageY - touch.$elm.offset().top);
+                    touch.box.run(touch.startPos, stopPos);
+                } else if (isMultiTouch(event)) {
+                    var startPos = new Point(
+                        event.touches[0].pageX - touch.$elm.offset().left,
+                        event.touches[0].pageY - touch.$elm.offset().top);
+                    var stopPos = new Point(
+                        event.touches[1].pageX - touch.$elm.offset().left,
+                        event.touches[1].pageY - touch.$elm.offset().top);
+                    touch.box.run(startPos, stopPos);
+                }
+                return true;
+            }
+            this.endTouch = function(event) {
+                var targetMap = Mapbender.modules[options.target];
+                if (!targetMap) {
+                        return false;
+                }
+                return touch.box.stop(function (extent) {
+                        if (typeof extent === "undefined") {
+                                return false;
+                        }
+                        if (extent.constructor === Mapbender.Extent) {
+                                targetMap.calculateExtent(extent);
+                                targetMap.setMapRequest();
+                        }
+                        else if (extent.constructor === Mapbender.Point) {
+                                targetMap.setCenter(extent);
+                                targetMap.setMapRequest();
+                        }
+                });
+            }
+        }
+
+        function findElement(event, tagName) {
+            var element = getElement(event);
+            while (element.parentNode && (!element.tagName ||
+                (element.tagName.toUpperCase() != tagName.toUpperCase()))){
+                element = element.parentNode;
+                return element;
+            }
+        }
+        function getElement(event) {
+            return event.target || event.srcElement;
+        }
+        function isSingleTouch (event) {
+            return event.touches && event.touches.length == 1;
+        }
+        function isMultiTouch(event) {
+            return event.touches && event.touches.length > 1;
+        }
+});
+
+//
+// update the rectangle indicating the current extent 
+// of the target map after each map request in the target
+//
+Mapbender.events.init.register(function () {
+	options.$target.mapbender(function () {
+		var targetMap = this;
+		targetMap.events.afterMapRequest.register(function () {
+		
+			var min = map.convertRealToPixel(targetMap.extent.min);
+			var max = map.convertRealToPixel(targetMap.extent.max);
+			
+			if (min.x < 0) {
+				min.x = 0;
+			}
+			if (max.x > map.getWidth()) {
+				max.x = map.getWidth();
+			}
+			if (min.y > map.getHeight()) {
+				min.y = map.getHeight();
+			}
+			if (max.y < 0) {
+				max.y = 0;
+			}
+			var diffX = max.x - min.x;
+			if (diffX < 8) {
+				var centerX = 0.5 * (max.x + min.x);
+				min.x = centerX - 4;
+				max.x = centerX + 4;
+			}
+			var diffY = min.y - max.y;
+			if (diffY < 8) {
+				var centerY = 0.5 * (max.y + min.y);
+				min.y = centerY + 4;
+				max.y = centerY - 4;
+			}
+			var extent = new Mapbender.Extent(min, max);
+		
+			box.draw(extent);
+		});
+	});
+});
+//
+//Mapbender.BoxMobile = function (options) {
+//    var map = (typeof options.target !== "undefined") ?
+//    getMapObjByName(options.target) : null;
+//
+//    var color = (typeof options.color !== "undefined") ?
+//    options.color : "#ff0000";
+//
+//    var isActive = false;
+//    var top = 0;
+//    var topSuffix = "_l_top";
+//    var topNode;
+//    var left = 0;
+//    var leftSuffix = "_l_left";
+//    var leftNode;
+//    var bottom = 0;
+//    var bottomSuffix = "_l_bottom";
+//    var bottomNode;
+//    var right = 0;
+//    var rightSuffix = "_l_right";
+//    var rightNode;
+//
+//    var startPos = null;
+//    var stopPos = null;
+//
+//    var exists = false;
+//    var that = this;
+//
+//    this.start = function (pos) {
+//        startPos = pos;
+//        stopPos = new Point(startPos.x, startPos.y);
+//        isActive = true;
+//        top = startPos.y;
+//        left = startPos.y;
+//        bottom = startPos.y;
+//        right = startPos.x;
+//        return true;
+//    };
+//
+//    this.run = function (pos) {
+//        if (pos !== null) {
+//            stopPos = pos;
+//            var width = map.width;
+//            var height = map.height;
+//
+//            if (startPos.x > stopPos.x) {
+//                right = startPos.x;
+//                left = stopPos.x;
+//            }
+//            else {
+//                left = startPos.x;
+//                right = stopPos.x;
+//            }
+//            if (startPos.y > stopPos.y) {
+//                bottom = startPos.y;
+//                top = stopPos.y;
+//            }
+//            else {
+//                top = startPos.y;
+//                bottom = stopPos.y;
+//            }
+//
+//            if (!startPos.equals(stopPos)) {
+//                this.draw();
+//            }
+//        }
+//        return true;
+//    };
+//
+//    this.stop = function (callback) {
+//        hideElement(topNode);
+//        hideElement(leftNode);
+//        hideElement(rightNode);
+//        hideElement(bottomNode);
+//
+//        if (isActive) {
+//            isActive = false;
+//            if (typeof callback === "function") {
+//                return callback(getExtent());
+//            }
+//            return getExtent();
+//        }
+//        isActive = false;
+//    };
+//
+//    var arrangeBox = function (node, left, top, right, bottom) {
+//        var el = node.style;
+//        el.height = Math.abs(bottom - top) + "px";
+//        el.width = Math.abs(right - left) + "px";
+//        el.top = top + "px";
+//        el.left = left + "px";
+//    };
+//
+//    var displayElement = function (node) {
+//        node.style.visibility = "visible";
+//    };
+//
+//    var hideElement = function (node) {
+//        node.style.visibility = "hidden";
+//    };
+//
+//    var domElementsExist = function () {
+//        if (!map) {
+//            return;
+//        }
+//        return map.getDomElement(
+//            ).ownerDocument.getElementById(
+//            map.elementName + topSuffix
+//            ) !== null;
+//    };
+//
+//    var createDomElements = function () {
+//        if (!map) {
+//            return;
+//        }
+//        var map_el = map.getDomElement();
+//        topNode = map_el.ownerDocument.createElement("div");
+//        topNode.style.position = "absolute";
+//        topNode.style.top = "0px";
+//        topNode.style.left = "0px";
+//        topNode.style.width = "0px";
+//        topNode.style.height = "0px";
+//        topNode.style.overflow = "hidden";
+//        //		topNode.style.zIndex = parseInt(map_el.style.zIndex, 10) + 1;
+//        topNode.style.zIndex = 100;
+//        topNode.style.visibility = "visible";
+//        topNode.style.cursor = "crosshair";
+//        topNode.style.backgroundColor = color;
+//
+//        leftNode = topNode.cloneNode(false);
+//        rightNode = topNode.cloneNode(false);
+//        bottomNode = topNode.cloneNode(false);
+//
+//        topNode.id = map.elementName + topSuffix;
+//        leftNode.id = map.elementName + leftSuffix;
+//        rightNode.id = map.elementName + rightSuffix;
+//        bottomNode.id = map.elementName + bottomSuffix;
+//
+//        map_el.appendChild(topNode);
+//        map_el.appendChild(leftNode);
+//        map_el.appendChild(rightNode);
+//        map_el.appendChild(bottomNode);
+//
+//        exists = true;
+//    };
+//
+//    this.draw = function (extent) {
+//        if (!map) {
+//            return;
+//        }
+//        if (typeof extent === "object"
+//            && extent.constructor === Mapbender.Extent) {
+//
+//            left = extent.min.x;
+//            right = extent.max.x;
+//            bottom = extent.min.y;
+//            top = extent.max.y;
+//        }
+//
+//        arrangeBox(topNode, left, top, right, top + 2);
+//        arrangeBox(leftNode, left, top, left + 2, bottom);
+//        arrangeBox(rightNode, right - 2, top, right, bottom);
+//        arrangeBox(bottomNode, left, bottom - 2, right, bottom);
+//        displayElement(topNode);
+//        displayElement(leftNode);
+//        displayElement(rightNode);
+//        displayElement(bottomNode);
+//    };
+//
+//    var getExtent = function () {
+//        if (!map) {
+//            return null;
+//        }
+//        var x1 = startPos.x;
+//        var x2 = stopPos.x;
+//        var y1 = startPos.y;
+//        var y2 = stopPos.y;
+//
+//        var minx = x2;
+//        var maxx = x1;
+//        if(x1 < x2){
+//            minx = x1;
+//            maxx = x2;
+//        }
+//
+//        var miny = y1;
+//        var maxy = y2;
+//        if(y1 < y2){
+//            miny = y2;
+//            maxy = y1;
+//        }
+//
+//        // area or clickpoint ?
+//        var posMin = map.convertPixelToReal(new Point(minx,miny));
+//        if((maxx - minx) > 3 && (miny - maxy) > 3){
+//            var posMax = map.convertPixelToReal(new Point(maxx,maxy));
+//            return new Mapbender.Extent(posMin, posMax);
+//        }
+//        return posMin;
+//    };
+//
+//    if (!domElementsExist()) {
+//        createDomElements();
+//    }
+//    else {
+//        topNode = document.getElementById(map.elementName + topSuffix);
+//        leftNode = document.getElementById(map.elementName + leftSuffix);
+//        rightNode = document.getElementById(map.elementName + rightSuffix);
+//        bottomNode = document.getElementById(map.elementName + bottomSuffix);
+//    }
+//};



More information about the Mapbender_commits mailing list