[Mapbender-commits] r4692 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Sep 25 06:45:43 EDT 2009
Author: christoph
Date: 2009-09-25 06:45:42 -0400 (Fri, 25 Sep 2009)
New Revision: 4692
Added:
trunk/mapbender/http/javascripts/mod_overview.js
trunk/mapbender/http/javascripts/mod_selArea.js
trunk/mapbender/http/javascripts/mod_zoomIn1.js
Removed:
trunk/mapbender/http/javascripts/mod_selArea.php
trunk/mapbender/http/javascripts/mod_zoomIn1.php
trunk/mapbender/http/javascripts/ovnf.php
Modified:
trunk/mapbender/http/javascripts/mod_box1.js
Log:
Modified: trunk/mapbender/http/javascripts/mod_box1.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_box1.js 2009-09-25 10:39:48 UTC (rev 4691)
+++ trunk/mapbender/http/javascripts/mod_box1.js 2009-09-25 10:45:42 UTC (rev 4692)
@@ -1,199 +1,224 @@
-/*
-* $Id$
-* 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.
-*/
+/*
+ * 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 mb_isActive = false;
-var mb_isBF = false;
-var mb_zF = false;
+Mapbender.Box = 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 (e) {
+ if (!map) {
+ return;
+ }
+ $(map.getDomElement()).mousemove(function (e) {
+ that.run(e);
+ return false;
+ });
+
+ isActive = true;
+ var click = map.getMousePosition(e);
+ startPos = new Point(click.x, click.y);
+ stopPos = new Point(click.x, click.y);
+ top = click.y;
+ left = click.y;
+ bottom = click.y;
+ right = click.x;
-var mb_offset_top = 0;
-var mb_offset_right = 0;
-var mb_offset_bottom = 0;
-var mb_offset_left = 0;
+ };
+
+ this.run = function (e) {
+ var pos = map.getMousePosition(e);
+ if (pos !== null) {
+ stopPos = pos;
+ var width = map.width;
+ var height = map.height;
-function mod_box_start(e){
- var mb_boxMapObj = getMapObjByName(mb_isBF);
- mb_isActive = true;
- mb_boxMapObj.getMousePos(e);
- mb_start_x = clickX;
- mb_start_y = clickY;
- mb_end_x = mb_start_x+1;
- mb_end_y = mb_start_y+1;
- mb_offset_left = mb_start_x;
- mb_offset_top = mb_start_y;
- mb_offset_bottom = mb_start_y;
- mb_offset_right = mb_start_x;
- mb_drawBox(mb_start_x,mb_start_y,mb_end_x,mb_end_y);
- return false;
-}
-function mod_box_run(e){
- var targetId = $.browser.msie ? window.event.srcElement.id : e.target.id;
- if(mb_isActive && targetId.substr(0, mb_isBF.length) === mb_isBF){
- var mb_boxMapObj = getMapObjByName(mb_isBF);
- var pos = mb_boxMapObj.getMousePosition(e);
- if (pos !== null) {
- var width = mb_boxMapObj.width;
- var height = mb_boxMapObj.height;
- var clickX = pos.x;
- var clickY = pos.y;
-
- if (((clickX>width) || (clickY>height) || (clickX<=0) ||(clickY<=0))){
-// isActive = false;
-// mod_box_stop(e);
+ if (startPos.x > stopPos.x) {
+ right = startPos.x;
+ left = stopPos.x;
}
- else{
- mb_end_x=clickX;
- mb_end_y=clickY;
- evalExtent();
+ else {
+ left = startPos.x;
+ right = stopPos.x;
}
- return false;
+ 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;
-}
-function mod_box_stop(e){
- mb_hideElement("l_top");
- mb_hideElement("l_left");
- mb_hideElement("l_right");
- mb_hideElement("l_bottom");
- if(mb_isActive){
- mb_isActive = false;
- return mb_setMapExtent(mb_start_x,mb_start_y,mb_end_x,mb_end_y);
- }
- mb_isActive = false;
-}
-function mb_drawBox(left,top,right,bottom){
- //Look if we have the Box elements
- var mb_boxMapObj = getMapObjByName(mb_isBF);
- if (mb_boxMapObj === null) {
- return false;
- }
- var map_el = mb_boxMapObj.getDomElement();
- if(!map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_l_top")){
- //create Box Elements
- 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.width = "0px";
- el_top.style.height = "0px";
- el_top.style.overflow = "hidden";
- el_top.style.zIndex = "10";
- el_top.style.visibility = "visible";
- el_top.style.cursor = "crosshair";
- el_top.style.backgroundColor = "#ff0000";
+ return true;
+ };
+
+ this.stop = function (e, callback) {
+ $(map.getDomElement()).unbind("mousemove");
+
+ hideElement(topNode);
+ hideElement(leftNode);
+ hideElement(rightNode);
+ hideElement(bottomNode);
- el_left = el_top.cloneNode(false);
- el_right = el_top.cloneNode(false);
- el_bottom = el_top.cloneNode(false);
- el_top.id = mb_boxMapObj.elementName+"_l_top";
- el_left.id = mb_boxMapObj.elementName+"_l_left";
- el_right.id = mb_boxMapObj.elementName+"_l_right";
- el_bottom.id = mb_boxMapObj.elementName+"_l_bottom";
+ 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);
+ el.width = Math.abs(right - left);
+ 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 = "10";
+ topNode.style.visibility = "visible";
+ topNode.style.cursor = "crosshair";
+ topNode.style.backgroundColor = color;
- map_el.appendChild(el_top);
- map_el.appendChild(el_left);
- map_el.appendChild(el_right);
- map_el.appendChild(el_bottom);
- }
- mb_arrangeBox("l_top",left,top,right,top+2);
- mb_arrangeBox("l_left",left,top,left+2,bottom);
- mb_arrangeBox("l_right",right-2,top,right,bottom);
- mb_arrangeBox("l_bottom",left,bottom-2,right,bottom);
- mb_displayElement("l_top");
- mb_displayElement("l_left");
- mb_displayElement("l_right");
- mb_displayElement("l_bottom");
-}
-function mb_arrangeBox(name, left, top, right, bottom){
- var mb_boxMapObj = getMapObjByName(mb_isBF);
- var map_el = mb_boxMapObj.getDomElement();
- var el = map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style;
- el.height = Math.abs(bottom - top);
- el.width = Math.abs(right - left);
- el.top = top + "px";
- el.left = left + "px";
-}
-function mb_displayElement(name){
- var mb_boxMapObj = getMapObjByName(mb_isBF);
- var map_el = mb_boxMapObj.getDomElement();
- map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style.visibility = "visible";
-}
-function mb_hideElement(name) {
- var mb_boxMapObj = getMapObjByName(mb_isBF);
- var map_el = mb_boxMapObj.getDomElement();
- map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_"+name).style.visibility = "hidden";
-}
-function evalExtent(){
- if(mb_start_x>mb_end_x){
- mb_offset_right=mb_start_x;
- mb_offset_left=mb_end_x;
- }
- else{
- mb_offset_left=mb_start_x;
- mb_offset_right=mb_end_x;
- }
- if(mb_start_y>mb_end_y){
- mb_offset_bottom=mb_start_y;
- mb_offset_top=mb_end_y;
- }
- else{
- mb_offset_top=mb_start_y;
- mb_offset_bottom=mb_end_y;
- }
- if((mb_start_x != mb_end_x)&&(mb_start_y != mb_end_y)){
- mb_drawBox(mb_offset_left,mb_offset_top,mb_offset_right,mb_offset_bottom);
- }
-}
-function mb_setMapExtent(x1,y1,x2,y2){
- if(x1 < x2){
- var minx = x1;
- var maxx = x2;
- }
- else{
+ 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(y1 < y2){
- var miny = y2;
- var maxy = y1;
- }
- else{
+ if(x1 < x2){
+ minx = x1;
+ maxx = x2;
+ }
+
var miny = y1;
var maxy = y2;
- }
- // area or clickpoint ?
- var ret = [];
- if((maxx - minx) > 3 && (miny - maxy) > 3){
- var posMin = makeClickPos2RealWorldPos(mb_isBF,minx,miny);
- var posMax = makeClickPos2RealWorldPos(mb_isBF,maxx,maxy);
- ret[0] = posMin[0];
- ret[1] = posMin[1];
- ret[2] = posMax[0];
- ret[3] = posMax[1];
- return ret;
- // mb_setValidClipping(posMin[0],posMin[1],posMax[0], posMax[1]);
- }
- else{
- var posMin = makeClickPos2RealWorldPos(mb_isBF,minx,miny);
- ret[0] = posMin[0];
- ret[1] = posMin[1];
- return ret;
- //zoom(mb_zF,true,1.0,pos[0], pos[1]);
- }
-}
+ if(y1 < y2){
+ miny = y2;
+ maxy = y1;
+ }
-function mod_box_setValidClipping(coords){
- if (typeof(coords) !== "undefined") {
- if(coords.length > 2){
- mb_calculateExtent(mb_zF,coords[0],coords[1],coords[2],coords[3]);
- setMapRequest(mb_zF);
+ // 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);
}
- else{
- zoom(mb_zF,true,1.0,coords[0], coords[1]);
- }
+ return posMin;
+ };
+
+ if (!domElementsExist()) {
+ createDomElements();
}
-}
+};
Added: trunk/mapbender/http/javascripts/mod_overview.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_overview.js (rev 0)
+++ trunk/mapbender/http/javascripts/mod_overview.js 2009-09-25 10:45:42 UTC (rev 4692)
@@ -0,0 +1,161 @@
+/**
+ * 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','mod_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;
+}
+options.overview_wms = parseInt(options.overview_wms, 10);
+
+if (!options.target) {
+ new Mb_exception(options.id + " needs a target.");
+ return;
+}
+
+var box;
+var map;
+
+
+Mapbender.events.initMaps.register(function () {
+
+ Mapbender.modules[options.id] = $.extend(new Mapbender.Map(
+ '',
+ options.id,
+ options.width,
+ options.height,
+ options.overview_wms
+ ), Mapbender.modules[options.id]);
+
+ 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);
+
+
+ // add select area behaviour
+ box = new Mapbender.Box({
+ target: options.id
+ });
+
+ $(map.getDomElement()).mousedown(function (e) {
+ 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;
+
+ });
+
+});
+
+//
+// update the rectangle indicating the current extent
+// of the target map after each map request
+//
+Mapbender.events.afterMapRequest.register(function () {
+ var targetMap = Mapbender.modules[options.target];
+ if (!targetMap) {
+ return;
+ }
+
+ 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);
+});
Added: trunk/mapbender/http/javascripts/mod_selArea.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_selArea.js (rev 0)
+++ trunk/mapbender/http/javascripts/mod_selArea.js 2009-09-25 10:45:42 UTC (rev 4692)
@@ -0,0 +1,81 @@
+/**
+ * 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 box;
+ var map = Mapbender.modules[options.target];
+
+ 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;
+ }
+ box = new Mapbender.Box({
+ target: options.target
+ });
+ $(map.getDomElement()).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) {
+ map.calculateExtent(extent);
+ map.setMapRequest();
+ }
+ else if (extent.constructor === Mapbender.Point) {
+ map.setCenter(extent);
+ map.setMapRequest();
+ }
+ });
+ return false;
+ });
+ },
+ stop: function () {
+ if (!map) {
+ return;
+ }
+ $(map.getDomElement())
+ .unbind("mousedown")
+ .unbind("mouseup")
+ .unbind("mousemove");
+ box = null;
+ }
+ });
+});
\ No newline at end of file
Deleted: trunk/mapbender/http/javascripts/mod_selArea.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_selArea.php 2009-09-25 10:39:48 UTC (rev 4691)
+++ trunk/mapbender/http/javascripts/mod_selArea.php 2009-09-25 10:45:42 UTC (rev 4692)
@@ -1,60 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_selArea.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");
-?>
-var mod_selArea_elName = "selArea1";
-var mod_selArea_frameName = "";
-var mod_selArea_target = "<?php echo $e_target[0]; ?>";
-
-var mod_selArea_img_on = new Image();
-mod_selArea_img_on.src = "<?php echo preg_replace("/_off/","_on",$e_src); ?>";
-var mod_selArea_img_off = new Image();
-mod_selArea_img_off.src = "<?php echo $e_src; ?>";
-var mod_selArea_img_over = new Image();
-mod_selArea_img_over.src = "<?php echo preg_replace("/_off/","_over",$e_src); ?>";
-
-function init_selArea1(ind){
- mb_button[ind] = document.getElementById(mod_selArea_elName);
- mb_button[ind].img_over = mod_selArea_img_over.src;
- mb_button[ind].img_on = mod_selArea_img_on.src;
- mb_button[ind].img_off = mod_selArea_img_off.src;
- mb_button[ind].status = 0;
- mb_button[ind].elName = mod_selArea_elName;
- mb_button[ind].fName = mod_selArea_frameName;
- mb_button[ind].go = new Function ("mod_selArea_click()");
- mb_button[ind].stop = new Function ("mod_selArea_disable()");
-}
-function mod_selArea_click(){
- var el = window.frames[mod_selArea_target].document;
- el.onmouseover = mod_selArea_init;
- el.onmousedown = mod_box_start;
- el.onmouseup = mod_box_stop;
- el.onmousemove = mod_box_run;
-}
-function mod_selArea_disable(){
- var el = window.frames[mod_selArea_target].document;
- el.onmousedown = null;
- el.onmouseup = null;
- el.onmousemove = null;
-}
-function mod_selArea_init(e){
- mb_isBF = mod_selArea_target;
- mb_zF = mod_selArea_target;
-}
Added: trunk/mapbender/http/javascripts/mod_zoomIn1.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_zoomIn1.js (rev 0)
+++ trunk/mapbender/http/javascripts/mod_zoomIn1.js 2009-09-25 10:45:42 UTC (rev 4692)
@@ -0,0 +1,44 @@
+/**
+ * Package: ZoomIn1
+ *
+ * Description:
+ * Click button, which minimizes the real world bounding box of the visible map section, doubles the scale (halfes the scale number). Image size is not affected.
+ *
+ * Files:
+ * - http/javascripts/mod_zoomIn1.php
+ *
+ * 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('gui', 'zoomIn1', 2, 1, 'zoomIn button','Zoom in',
+ * > 'img','../img/button_gray/zoomIn2_off.png','',220,10,24,24,1,
+ * > '','','','mod_zoomIn1.php','','mapframe1','',
+ * > 'http://www.mapbender.org/index.php/ZoomIn');
+ *
+ * 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
+ */
+$(this).click(function () {
+ if (!options.target
+ || !Mapbender.modules[options.target]
+ || typeof Mapbender.modules[options.target].zoom !== "function") {
+ return;
+ }
+ Mapbender.modules[options.target].zoom(true, 2.0);
+}).mouseover(function () {
+ if (options.src) {
+ this.src = options.src.replace(/_off/, "_over");
+ }
+}).mouseout(function () {
+ if (options.src) {
+ this.src = options.src;
+ }
+});
\ No newline at end of file
Deleted: trunk/mapbender/http/javascripts/mod_zoomIn1.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_zoomIn1.php 2009-09-25 10:39:48 UTC (rev 4691)
+++ trunk/mapbender/http/javascripts/mod_zoomIn1.php 2009-09-25 10:45:42 UTC (rev 4692)
@@ -1,60 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_zoomIn1.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.
-?>
-/**
- * Package: ZoomIn1
- *
- * Description:
- * Click button, which minimizes the real world bounding box of the visible map section, doubles the scale (halfes the scale number). Image size is not affected.
- *
- * Maintainer:
- * http://www.mapbender.org/User:Christoph_Baudson
- *
- * 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('gui', 'zoomIn1', 2, 1, 'zoomIn button','Zoom in',
- * > 'img','../img/button_gray/zoomIn2_off.png','',220,10,24,24,1,
- * > '','','','mod_zoomIn1.php','','mapframe1','',
- * > 'http://www.mapbender.org/index.php/ZoomIn');
- *
- * Files:
- * - http/javascripts/mod_zoomIn1.php
- *
- *
- */
-$(this).click(function () {
- if (!options.target) {
- return;
- }
- if (!Mapbender.modules[options.target]) {
- return;
- }
- Mapbender.modules[options.target].zoom(true, 2.0);
-}).mouseover(function () {
- if (options.src) {
- this.src = options.src.replace(/_off/, "_over");
- }
-}).mouseout(function () {
- if (options.src) {
- this.src = options.src;
- }
-});
\ No newline at end of file
Deleted: trunk/mapbender/http/javascripts/ovnf.php
===================================================================
--- trunk/mapbender/http/javascripts/ovnf.php 2009-09-25 10:39:48 UTC (rev 4691)
+++ trunk/mapbender/http/javascripts/ovnf.php 2009-09-25 10:45:42 UTC (rev 4692)
@@ -1,127 +0,0 @@
-<?php
-# $Id:$
-# http://www.mapbender.org/Mapbender_without_iframes
-# 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.
-
-//INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('Ingrid', 'mapframe1', 'skipWmsIfSrsNotSupported', '1', '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');
-
-?>
-if (typeof options.overview_wms === 'undefined') {
- options.overview_wms = 0;
-}
-options.overview_wms = parseInt(options.overview_wms);
-if (!options.target) {
- new Mb_exception(options.id + " needs a target.");
- return;
-}
-parent.eventInitMap.register(function () {
-
- Mapbender.modules[options.id] = $.extend(new Mapbender.Map(
- '',
- options.id,
- options.width,
- options.height,
- options.overview_wms
- ), Mapbender.modules[options.id]);
- var map = Mapbender.modules[options.id];
-
- map.skipWmsIfSrsNotSupported =
- options.skipWmsIfSrsNotSupported === 1 ? true : false;
-
- mb_mapObj.push(map);
-
- var el = map.getDomElement();
- el.onmouseover = mod_ovSetHandler;
- el.onmousedown = mod_box_start;
- el.onmouseup = mod_ovGetExtent;
- el.onmousemove = mod_box_run;
-
- var ov_extent = map.getExtentInfos();
- map.isOverview = true;
-});
-
-function mod_ovSetHandler(e){
- var targetId = $.browser.msie ? window.event.srcElement.id : e.target.id;
- if(!mb_isActive){
- mb_isBF = options.id;
- mb_zF = options.target;
- return false;
- }
- return true;
-}
-function mod_ovGetExtent(e){
- var targetId = $.browser.msie ? window.event.srcElement.id : e.target.id;
- if(targetId.substr(0, mb_isBF.length) === mb_isBF){
- mb_zF = options.target;
- mod_box_setValidClipping(mod_box_stop(e));
- return false;
- }
- return true;
-}
-
-eventAfterMapRequest.register(function () {
- var targetMapObj = Mapbender.modules[options.target];
-
- if (!targetMapObj) {
- return;
- }
- var arrayBBox = targetMapObj.extent.toString().split(",");
- var minX = parseFloat(arrayBBox[0]);
- var minY = parseFloat(arrayBBox[1]);
- var maxX = parseFloat(arrayBBox[2]);
- var maxY = parseFloat(arrayBBox[3]);
- var mapObj = Mapbender.modules[options.id];
- var pointMin = mapObj.convertRealToPixel(new Point(minX, maxY));
- var pointMax = mapObj.convertRealToPixel(new Point(maxX, minY));
- var px1 = pointMin.x;
- var py1 = pointMin.y;
- var px2 = pointMax.x;
- var py2 = pointMax.y;
-
- var tmp_mb_isBF = mb_isBF;
- var tmp_mb_zF = mb_zF;
- mb_isBF = options.id;
- mb_zF = options.target;
-
- while((px2 - px1) < 8){
- px1 -= 1;
- px2 += 1;
- }
- while((py2 - py1) < 8){
- py1 -= 1;
- py2 += 1;
- }
-
- if(px1 < 0){px1 = 1;}
- if(px1 > options.width){px1 = options.width-1;}
-
- if(py1 < 0){py1 = 1;}
- if(py1 > options.height){py1 = options.height-1;}
-
- if(px2 > options.width){px2 = options.width-1;}
- if(px2 < 0){px2 = 1;}
-
- if(py2 > options.height){py2 = options.height-1;}
- if(py2 < 0){py2 = 1;}
-
- mb_drawBox(px1,py1,px2,py2);
- mb_isBF = tmp_mb_isBF;
- mb_zF = tmp_mb_zF;
-
-});
-
-
More information about the Mapbender_commits
mailing list