svn commit: r652 - trunk/mapbender/http/javascripts/mod_resize_mapsize.php
marko at osgeo.org
marko at osgeo.org
Thu Jul 13 13:08:11 EDT 2006
Author: marko
Date: 2006-07-13 17:08:11+0000
New Revision: 652
Added:
trunk/mapbender/http/javascripts/mod_resize_mapsize.php
Log:
the new rezie_mapsize module
Added: trunk/mapbender/http/javascripts/mod_resize_mapsize.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_resize_mapsize.php?view=auto&rev=652
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/javascripts/mod_resize_mapsize.php 2006-07-13 17:08:11+0000
@@ -0,0 +1,123 @@
+<?php
+# $Id:
+# Created on 12.07.2006/07:32:08
+# Copyright (C) 2002 CCGIS
+
+
+# Projekt: mapbender
+# File: mod_resize_mapsize.php
+#
+# 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("../../conf/mapbender.conf");
+$gui_id = $_REQUEST["gui_id"];
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+$sqltarget = "SELECT e_target FROM gui_element WHERE e_id = 'resizeMapsize' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sqltarget, $v, $t);
+while($row = db_fetch_array($res)){
+ $e_target = $row["e_target"];
+}
+
+$sql = "SELECT e_left, e_top FROM gui_element WHERE e_id = '".$e_target."' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
+while($row = db_fetch_array($res)){
+ $e_left = $row["e_left"];
+ $e_top = $row["e_top"];
+}
+
+$sqllegend = "SELECT e_width FROM gui_element WHERE e_id = 'legend' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sqllegend, $v, $t);
+while($row = db_fetch_array($res)){
+ $leg_e_width = $row["e_width"];
+}
+
+?>
+
+var map_frame = "<?php echo $e_target ?>";
+var map_frame_left = "<?php echo $e_left ?>";
+var map_frame_top = "<?php echo $e_top ?>";
+var legend_width = "<?php echo $leg_e_width ?>";
+
+function frameWidth() {
+ if (window.innerWidth) return window.innerWidth;
+ else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
+ else return 0;
+}
+
+function frameHeight() {
+ if (window.innerHeight)return window.innerHeight;
+ else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
+ else return 0;
+}
+
+function adjustDimension(){
+ var ind = getMapObjIndexByName(map_frame);
+ var mapheight = frameHeight() - <?php echo $e_top ?> - 45;
+ var mapwidth = frameWidth() - map_frame_left - legend_width - 30 ;
+ var pos = makeClickPos2RealWorldPos(map_frame,mapwidth,mapheight);
+ var coords = mb_mapObj[ind].extent.split(",");
+
+ mb_mapObj[ind].extent = coords[0] + "," + pos[1] + "," + pos[0] + "," + coords[3];
+ mb_mapObj[ind].width = mapwidth;
+ mb_mapObj[ind].height = mapheight;
+ document.getElementById(map_frame).style.width = mb_mapObj[ind].width;
+ document.getElementById(map_frame).style.height = mb_mapObj[ind].height;
+ window.frames[map_frame].document.getElementById("maps").style.width = mb_mapObj[ind].width;
+ window.frames[map_frame].document.getElementById("maps").style.height = mb_mapObj[ind].height;
+ zoomFull();
+}
+
+function zoomFull(){
+ var ind = this.getMapObjIndexByName("<?php echo $e_target; ?>");
+ var arrayThemen = new Array();
+ var arrayThemen = mb_mapObj[ind].wms[0].objLayer[0].layer_name;
+ this.Layer0 = arrayThemen;
+ this.width = mb_mapObj[ind].width;
+ this.height = mb_mapObj[ind].height;
+ this.epsg = wms[0].gui_wms_epsg;
+ var arrayExt = new Array();
+ var frameName = "<?php echo $e_target; ?>"
+ var exts = setExtent(width,height,epsg);
+ arrayExt = exts.split(",");
+ mb_repaint(frameName,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
+}
+
+function rebuild() {
+ if (width_temp != frameWidth() || height_temp != frameHeight()) window.setTimeout('adjustDimension()', 500);
+}
+
+function control(){
+ adjustDimension();
+ if (!window.width_temp && window.innerWidth) {
+ window.onresize = rebuild;
+ width_temp = frameWidth();
+ height_temp = frameHeight();
+}
+
+if (!window.width_temp && document.body && document.body.offsetWidth) {
+ window.onresize = rebuild;
+ width_temp = frameWidth();
+ height_temp = frameHeight();
+}
+}
+window.setTimeout('control()', 3000);
\ No newline at end of file
More information about the Mapbender_commits
mailing list