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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon May 21 05:55:05 EDT 2007


Author: christoph
Date: 2007-05-21 05:55:05 -0400 (Mon, 21 May 2007)
New Revision: 1328

Modified:
   trunk/mapbender/http/javascripts/point.js
Log:
added JSDoc

Modified: trunk/mapbender/http/javascripts/point.js
===================================================================
--- trunk/mapbender/http/javascripts/point.js	2007-05-21 09:54:09 UTC (rev 1327)
+++ trunk/mapbender/http/javascripts/point.js	2007-05-21 09:55:05 UTC (rev 1328)
@@ -4,35 +4,96 @@
 * License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
 */
 //http://www.mapbender.org/index.php/point.js
-function Point(x, y){
+
+/**
+ * @class A class representing a two-dimensional point.
+ *
+ * @constructor
+ */
+ function Point(x, y){
 	this.x = parseFloat(x);
 	this.y = parseFloat(y);
 }
-
+/**
+ * computes the distance between a {@link Point} p and this {@link Point}
+ *
+ * @member Point
+ * @param {Point} p 
+ * @return {Float} the distance between the two points
+ */
 Point.prototype.dist = function(p){
 	return Math.sqrt(Math.pow(this.y-p.y,2) + Math.pow(this.x-p.x,2)) ;
 }
+/**
+ * checks if the coordinates of this {@link Point} match the coordinates of a {@link Point} p
+ *
+ * @member Point
+ * @param {Point} p 
+ * @return {Boolean} true if the two points are equal; elso false
+ */
 Point.prototype.equals = function(p){
 	if (this.x == p.x && this.y == p.y) {return true;}
 	return false;
 }
+/**
+ * subtracts a {@link Point} p from this {@link Point}
+ *
+ * @member Point
+ * @param {Point} p 
+ * @return a new {Point} with the difference of the two points
+ */
 Point.prototype.minus = function(p){
 	return new Point(this.x-p.x, this.y-p.y);
 }
+/**
+ * adds this {@link Point} to a {@link Point} p
+ *
+ * @member Point
+ * @param {Point} p 
+ * @return a new {Point} with the sum of the two points
+ */
 Point.prototype.plus = function(p){
 	return new Point(this.x+p.x, this.y+p.y);
 }
+/**
+ * divides this {@link Point} by a scalar c
+ *
+ * @member Point
+ * @param {Float} c divisor
+ * @return a new {Point} divided by c
+ */
 Point.prototype.dividedBy = function(c){
-	if (c != 0) {return new Point(this.x/c, this.y/c);}
+	if (c != 0) {
+		return new Point(this.x/c, this.y/c);
+	}
 	var e = new Mb_exception("Point.dividedBy: Division by zero");
 	return false;
 }
+/**
+ * multiplies this {@link Point} by a scalar c
+ *
+ * @member Point
+ * @param {Float} c factor
+ * @return a new {Point} multiplied by c
+ */
 Point.prototype.times = function(c){
 	return new Point(this.x*c, this.y*c);
 }
+/**
+ * rounds the coordinates to numOfDigits digits
+ *
+ * @member Point
+ * @return a new {Point} rounded to numOfDigits
+ * @type Point
+ */
 Point.prototype.round = function(numOfDigits){
 	return new Point(roundToDigits(this.x, numOfDigits), roundToDigits(this.y, numOfDigits));
 }
+/**
+ * @member Point
+ * @returns a {String} representation of this Point
+ * @type String
+ */
 Point.prototype.toString = function(){
 	return "(" + this.x + ", " + this.y + ")";
 }



More information about the Mapbender_commits mailing list