svn commit: r824 - trunk/mapbender/http/javascripts/wfs.js

christoph at osgeo.org christoph at osgeo.org
Mon Nov 20 03:19:23 EST 2006


Author: christoph
Date: 2006-11-20 08:19:23+0000
New Revision: 824

Modified:
   trunk/mapbender/http/javascripts/wfs.js

Log:
added element var 'useCheckboxForHighlighting'

Modified: trunk/mapbender/http/javascripts/wfs.js
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/wfs.js?view=diff&rev=824&p1=trunk/mapbender/http/javascripts/wfs.js&p2=trunk/mapbender/http/javascripts/wfs.js&r1=823&r2=824
==============================================================================
--- trunk/mapbender/http/javascripts/wfs.js	(original)
+++ trunk/mapbender/http/javascripts/wfs.js	2006-11-20 08:19:23+0000
@@ -21,7 +21,6 @@
 var usemap = "";
 var mod_usemap_radius = 10;
 var mod_usemap_line_tolerance = 5;
-var useCheckboxForHighlighting = true;
 var highlight = new Highlight(mb_wfs_targets, highlight_tag_id);
 
 if (parseInt(useUsemap) == 1) {
@@ -33,6 +32,73 @@
 	mb_registerInitFunctions('highlight.paint()');
 }
 
+	function calculateVisibleDash (p0, p1, width, height) {
+		if (p0.x > p1.x) {var p_temp = p0; p0 = p1; p1 = p_temp; p_temp = null;}
+		var p = p0; var q = p1; var m; 
+		if (p1.x != p0.x) {
+			m = -(p1.y-p0.y)/(p1.x-p0.x); 
+			if (p0.x < width && p1.x > 0 && !(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height) ) {
+				if (p0.x < 0) {
+					var iy = p0.y - m*(0-p0.x);
+					if (iy > 0 && iy < height) p = new Point(0, iy);
+					else if (iy > height) {
+					    var ix = p0.x+((p0.y - height)/m);
+					    if (ix > 0 && ix < width) p = new Point(ix, height); else return false;
+					}
+					else if (iy < 0) {
+					    var ix = p0.x+(p0.y/m);
+					    if (ix > 0 && ix < width) p = new Point(ix, 0); else return false;
+					}
+					else return false;
+				}
+				else if (p0.y >= 0 && p0.y <= height) {p = p0;}
+				else if (p0.y < 0) {
+				    var ix = p0.x+(p0.y/m);
+				    if (ix > 0 && ix < width) p = new Point(ix, 0); else return false;
+				}
+				else if (p0.y > height && m > 0) {
+				    var ix = p0.x+((p0.y - height)/m);
+				    if (ix > 0 && ix < width) p = new Point(ix, height); else return false;
+				}
+				else return false;
+				if (p1.x > width) {
+					var iy = p1.y - m*(width-p1.x);
+					if (iy > 0 && iy < height) {q = new Point(width, iy);}
+					else if (iy < 0) {
+					    var ix = p0.x+(p0.y/m);
+					    if (ix > 0 && ix < width) q = new Point(ix, 0); else return false;
+					}
+					else if (iy > height) {
+					    var ix = p0.x+((p0.y - height)/m);
+					    if (ix > 0 && ix < width) q = new Point(ix, height); else return false;
+					}
+					else return false;
+				}
+				else if (p1.y >= 0 && p1.y <= height) {q = p1;}
+				else if (p1.y < 0) {
+				    var ix = p1.x+(p1.y/m);
+				    if (ix > 0 && ix < width) q = new Point(ix, 0); else return false;
+				}
+				else if (p1.y > height) {
+				    var ix = p1.x+((p1.y- height)/m);
+				    if (ix > 0 && ix < width) q = new Point(ix, height); else return false;
+				}
+			}
+			else return false;
+		}
+		else {
+			if (!(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height)) {
+				if (p0.y < 0) {p = new Point(p0.x, 0);}
+				else if (p0.y > height) {p = new Point(p0.x, height);}
+				else p = p0;
+				if (p1.y < 0) {q = new Point(p0.x, 0);}
+				else if (p1.y > height) {q = new Point(p0.x, height);}
+				else q = p1;
+			}
+			else return false;
+		}
+		return new Array(new Point(Math.round(q.x), Math.round(q.y)), new Point(Math.round(p.x), Math.round(p.y)));
+	}
 /*
 if (useExtentIsSet()) {
 	mb_registerSubFunctions("mb_setwfsrequest_extent()");




More information about the Mapbender_commits mailing list