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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jan 22 09:17:57 EST 2008


Author: christoph
Date: 2008-01-22 09:17:51 -0500 (Tue, 22 Jan 2008)
New Revision: 2012

Modified:
   branches/2.5/http/javascripts/geometry.js
   branches/2.5/http/javascripts/point.js
Log:
now supports three dimensional points

Modified: branches/2.5/http/javascripts/geometry.js
===================================================================
--- branches/2.5/http/javascripts/geometry.js	2008-01-22 14:06:30 UTC (rev 2011)
+++ branches/2.5/http/javascripts/geometry.js	2008-01-22 14:17:51 UTC (rev 2012)
@@ -708,8 +708,8 @@
 	 * @param {Float} x x value of the point
 	 * @param {Float} y y value of the point
 	 */	
-	this.addPointByCoordinates = function(x,y){
-		var newPoint = new Point(x,y);
+	this.addPointByCoordinates = function(x,y,z){
+		var newPoint = new Point(x,y,z);
 		this.add(newPoint);
 //		updateDist();
 	};
@@ -720,7 +720,7 @@
 	 * @param {Point} aPoint another point
 	 */	
 	this.addPoint = function(aPoint){
-		this.add(new Point(aPoint.x, aPoint.y));
+		this.add(new Point(aPoint.x, aPoint.y, aPoint.z));
 		updateDist();
 	};
 
@@ -736,7 +736,7 @@
 			for(var z = this.count(); z > i; z--){
 				this.list[z] = this.list[z-1];
 			}
-			this.list[i] = new Point(p.x, p.y);
+			this.list[i] = new Point(p.x, p.y, p.z);
 			updateDist();
 		}
 	};

Modified: branches/2.5/http/javascripts/point.js
===================================================================
--- branches/2.5/http/javascripts/point.js	2008-01-22 14:06:30 UTC (rev 2011)
+++ branches/2.5/http/javascripts/point.js	2008-01-22 14:17:51 UTC (rev 2012)
@@ -12,7 +12,7 @@
  * @param {Float} x x value of the {@link Point}
  * @param {Float} y y value of the {@link Point}
  */
- function Point(x, y){
+ function Point(x, y, z){
  	/**
  	 * x value of the {@link Point}
  	 *
@@ -27,6 +27,9 @@
 	 */
 //	this.y = parseFloat(y);
 	this.y = y;
+	
+	this.z = z;
+	
 }
 /**
  * computes the distance between a {@link Point} p and this {@link Point}
@@ -102,7 +105,12 @@
  * @type String
  */
 Point.prototype.toString = function(){
-	return "[" + this.x + ", " + this.y + "]";
+	if (typeof(this.z == "undefined")) {
+		return "[" + this.x + ", " + this.y + "]";
+	}
+	else {
+		return "[" + this.x + ", " + this.y + ", " + this.z + "]";
+	}
 }
 
 



More information about the Mapbender_commits mailing list