[Mapbender-commits] r3686 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Mar 12 13:00:58 EDT 2009


Author: christoph
Date: 2009-03-12 13:00:58 -0400 (Thu, 12 Mar 2009)
New Revision: 3686

Modified:
   trunk/mapbender/http/javascripts/ovnf.php
Log:
http://trac.osgeo.org/mapbender/ticket/395

Modified: trunk/mapbender/http/javascripts/ovnf.php
===================================================================
--- trunk/mapbender/http/javascripts/ovnf.php	2009-03-12 17:00:45 UTC (rev 3685)
+++ trunk/mapbender/http/javascripts/ovnf.php	2009-03-12 17:00:58 UTC (rev 3686)
@@ -24,6 +24,9 @@
 if (typeof(overview_wms) === 'undefined')overview_wms = 0;
 overview_wms = parseInt(overview_wms);
 
+var mod_overview_width = <?php echo $e_width; ?>;
+var mod_overview_height = <?php echo $e_height; ?>;
+
 mb_registerMapObj('', 'overview', overview_wms ,<?php echo $e_width; ?>, <?php echo $e_height; ?>);
 parent.eventInitMap.register(function init_overview(){
 		var ind = getMapObjIndexByName('overview');
@@ -48,3 +51,50 @@
 	mod_box_setValidClipping(mod_box_stop(e));
 }
 
+eventAfterMapRequest.register(function () {
+	var targetMapObj = getMapObjByName(mod_overview_target);
+	
+	if (!targetMapObj) {
+		return;
+	}
+	var arrayBBox = targetMapObj.extent.split(",");
+	var minX = parseFloat(arrayBBox[0]);
+	var minY = parseFloat(arrayBBox[1]);
+	var maxX = parseFloat(arrayBBox[2]);
+	var maxY = parseFloat(arrayBBox[3]);
+	var mapObj = getMapObjByName("overview");
+	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;
+
+	mb_isBF = "overview";
+	mb_zF = mod_overview_target;
+	
+	while((px2 - px1) < 8){
+		px1 -= 1;
+		px2 += 1;
+	}
+	while((py2 - py1) < 8){
+		py1 -= 1;
+		py2 += 1;
+	}
+	
+	if(px1 < 0){px1 = 1;}
+	if(px1 > mod_overview_width){px1 = mod_overview_width-1;}
+
+	if(py1 < 0){py1 = 1;}
+	if(py1 > mod_overview_height){py1 = mod_overview_height-1;}
+
+	if(px2 > mod_overview_width){px2 = mod_overview_width-1;}
+	if(px2 < 0){px2 = 1;}
+
+	if(py2 > mod_overview_height){py2 = mod_overview_height-1;}
+	if(py2 < 0){py2 = 1;}
+
+	mb_drawBox(px1,py1,px2,py2);
+});
+
+



More information about the Mapbender_commits mailing list