svn commit: r275 - trunk/mapbender/http/javascripts/mod_scaleHint.php

vera_schulze at osgeo.org vera_schulze at osgeo.org
Mon May 15 05:11:00 EDT 2006


Author: vera_schulze
Date: 2006-05-15 09:11:00+0000
New Revision: 275

Modified:
   trunk/mapbender/http/javascripts/mod_scaleHint.php   (contents, props changed)

Log:
Code cleaning ready

Modified: trunk/mapbender/http/javascripts/mod_scaleHint.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_scaleHint.php?view=diff&rev=275&p1=trunk/mapbender/http/javascripts/mod_scaleHint.php&p2=trunk/mapbender/http/javascripts/mod_scaleHint.php&r1=274&r2=275
==============================================================================
--- trunk/mapbender/http/javascripts/mod_scaleHint.php	(original)
+++ trunk/mapbender/http/javascripts/mod_scaleHint.php	2006-05-15 09:11:00+0000
@@ -1,6 +1,6 @@
 <?php
-#$Id: mod_scaleHint.php,v 1.9 2005/09/13 18:16:42 bjoern_heuser Exp $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_scaleHint.php,v 1.9 2005/09/13 18:16:42 bjoern_heuser Exp $
+# $Id$
+# http://www.mapbender.org/index.php/mod_scaleHint.php
 # Copyright (C) 2002 CCGIS 
 #
 # This program is free software; you can redistribute it and/or modify
@@ -22,14 +22,18 @@
 require_once("../../conf/mapbender.conf");
 $con = db_connect($DBSERVER,$OWNER,$PW);
 db_select_db(DB,$con);
-$sql = "SELECT  e_target FROM gui_element WHERE e_id = 'setScaleHint' AND fkey_gui_id = '".$gui_id."'";
-$res = db_query($sql);
+$sql = "SELECT  e_target FROM gui_element WHERE e_id = 'setScaleHint' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
 $cnt = 0;
 while($row = db_fetch_array($res)){ 
    $e_target = $row["e_target"];
    $cnt++;
 }
-if($cnt > 1){ echo "alert('mod_scaleHint: ID not unique!');";}
+if($cnt > 1){
+	echo "alert('mod_scaleHint: ID not unique!');";
+}
 $params = split(",",$e_target);
 
 echo "var mod_scaleHint_target = '".$params[0]."';";
@@ -38,25 +42,27 @@
 
 ?>
 
-
-
 mb_registerPreFunctions("mod_scaleHint_init(frameName)");
 function mod_scaleHint_init(frameName){
-   if(frameName == mod_scaleHint_target){
-      var scale = mb_getScale(frameName);
-      if(scale < mod_scaleHint_min || scale > mod_scaleHint_max){
-         if(scale < mod_scaleHint_min){var newScale = mod_scaleHint_min; }
-         if(scale > mod_scaleHint_max){var newScale = mod_scaleHint_max; }
-         var ind = getMapObjIndexByName(frameName);
-         var arrayBBox = mb_mapObj[ind].extent.split(",");
-         var x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
-         var y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
-         var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * newScale);
-         var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * newScale);
-         var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * newScale);
-         var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * newScale);
-         mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-      }
-   }
-   return true;
+	if(frameName == mod_scaleHint_target){
+		var scale = mb_getScale(frameName);
+		if(scale < mod_scaleHint_min || scale > mod_scaleHint_max){
+			if(scale < mod_scaleHint_min){
+				var newScale = mod_scaleHint_min;
+			}
+			if(scale > mod_scaleHint_max){
+				var newScale = mod_scaleHint_max;
+			}
+			var ind = getMapObjIndexByName(frameName);
+			var arrayBBox = mb_mapObj[ind].extent.split(",");
+			var x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
+			var y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
+			var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * newScale);
+			var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * newScale);
+			var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * newScale);
+			var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * newScale);
+			mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+		}
+	}
+	return true;
 }




More information about the Mapbender_commits mailing list