[Mapbender-commits] r1995 - branches/2.5/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 21 03:30:51 EST 2008


Author: christoph
Date: 2008-01-21 03:30:50 -0500 (Mon, 21 Jan 2008)
New Revision: 1995

Modified:
   branches/2.5/http/javascripts/geometry.js
Log:
bug fix in MultiGeometry.toString (missing bracket)

bug fix in Canvas.drawGeometry (used diameter instead of radius)

added function setDiameter in Canvas

Modified: branches/2.5/http/javascripts/geometry.js
===================================================================
--- branches/2.5/http/javascripts/geometry.js	2008-01-20 15:52:04 UTC (rev 1994)
+++ branches/2.5/http/javascripts/geometry.js	2008-01-21 08:30:50 UTC (rev 1995)
@@ -628,7 +628,7 @@
 };
 
 MultiGeometry.prototype.toStringWithoutProperties = function () {
-	var str = "{\"type\": \"Feature\", \"geometry\": ";
+	var str = "{\"type\": \"Feature\", ";
 
 	var epsg = this.getEpsg();
 	if (epsg) {
@@ -643,7 +643,8 @@
 		}		
 		str += this.get(i).toString();
 	}
-	str += "}";
+// this closing curly bracket is added in toString()
+//	str += "}";
 	
 	return str;
 };
@@ -654,7 +655,7 @@
  */
 MultiGeometry.prototype.getEpsg = function () {
 	if (this.count() > 0) {
-		return this.get(0).getEpsg;
+		return this.get(0).getEpsg();
 	}
 	return false;
 }
@@ -1116,8 +1117,15 @@
 				var p = realToMap(mapframe, currentGeom.get(0));
 				var px = p.x;
 				var py = p.y;
-				if (px + diameter < mapframeWidth && px - diameter > 0 &&
-					py + diameter < mapframeHeight && py - diameter > 0) {
+				var radius = diameter/2;
+				if ((px - radius < mapframeWidth && px + radius > 0 &&
+					py - radius < mapframeHeight && py + radius > 0) ||
+					(p.dist(new Point(0,0)) < radius || 
+					 p.dist(new Point(mapframeWidth, mapframeHeight)) < radius ||
+					 p.dist(new Point(0,mapframeHeight)) < radius || 
+					 p.dist(new Point(mapframeWidth, 0)) < radius
+					)
+				) {
 					// if the point contains a link to an icon, display the icon
 					if (poiIcon) {
 						displayIcon(poiIcon, px, py);
@@ -1180,6 +1188,10 @@
 		return canvas;
 	};
 	
+	this.setDiameter = function (px) {
+		diameter = px;
+	}
+	
 	/**
 	 * draws a circle with {@link jsGraphics}.
 	 *



More information about the Mapbender_commits mailing list