[Mapbender-commits] r1389 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed May 30 08:09:56 EDT 2007
Author: christoph
Date: 2007-05-30 08:09:56 -0400 (Wed, 30 May 2007)
New Revision: 1389
Modified:
trunk/mapbender/http/javascripts/point.js
Log:
more JSDoc
Modified: trunk/mapbender/http/javascripts/point.js
===================================================================
--- trunk/mapbender/http/javascripts/point.js 2007-05-30 12:09:34 UTC (rev 1388)
+++ trunk/mapbender/http/javascripts/point.js 2007-05-30 12:09:56 UTC (rev 1389)
@@ -9,17 +9,28 @@
* @class A class representing a two-dimensional point.
*
* @constructor
+ * @param {Float} x x value of the {@link Point}
+ * @param {Float} y y value of the {@link Point}
*/
function Point(x, y){
+ /**
+ * x value of the {@link Point}
+ *
+ * @type Float
+ */
this.x = parseFloat(x);
+ /**
+ * y value of the {@link Point}
+ *
+ * @type Float
+ */
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
+ * @param {Point} p the distance between this {@link Point} and the {@link Point} p is computed.
+ * @return {Float} the distance between the two {@link Point} objects.
*/
Point.prototype.dist = function(p){
return Math.sqrt(Math.pow(this.y-p.y,2) + Math.pow(this.x-p.x,2)) ;
@@ -27,7 +38,6 @@
/**
* 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
*/
@@ -38,9 +48,8 @@
/**
* 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
+ * @return a new {@link Point} with the difference of the two points
*/
Point.prototype.minus = function(p){
return new Point(this.x-p.x, this.y-p.y);
@@ -48,9 +57,8 @@
/**
* 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
+ * @return a new {@link Point} with the sum of the two points
*/
Point.prototype.plus = function(p){
return new Point(this.x+p.x, this.y+p.y);
@@ -58,9 +66,8 @@
/**
* divides this {@link Point} by a scalar c
*
- * @member Point
* @param {Float} c divisor
- * @return a new {Point} divided by c
+ * @return a new {@link Point} divided by c
*/
Point.prototype.dividedBy = function(c){
if (c != 0) {
@@ -72,9 +79,8 @@
/**
* multiplies this {@link Point} by a scalar c
*
- * @member Point
* @param {Float} c factor
- * @return a new {Point} multiplied by c
+ * @return a new {@link Point} multiplied by c
*/
Point.prototype.times = function(c){
return new Point(this.x*c, this.y*c);
@@ -82,15 +88,14 @@
/**
* rounds the coordinates to numOfDigits digits
*
- * @member Point
- * @return a new {Point} rounded to numOfDigits
+ * @param numOfDigits the coordinate will be rounded to numOfDigits digits
+ * @return a new {@link Point} rounded to numOfDigits digits
* @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
*/
@@ -101,7 +106,9 @@
//------------------------------------------------------------------------
// possible improvement: point has flag: map OR real. additional functions: toReal, toMap
-
+/**
+ * @ignore
+ */
function mapToReal(frameName, aPoint) {
var v;
if (typeof(mb_mapObj) == 'object') v = makeClickPos2RealWorldPos(frameName, aPoint.x, aPoint.y);
@@ -109,6 +116,9 @@
else alert('where am i?');
return new Point(v[0], v[1]);
}
+/**
+ * @ignore
+ */
function realToMap(frameName, aPoint) {
var v;
if (typeof(mb_mapObj) == 'object') {
@@ -122,6 +132,9 @@
}
return new Point(v[0], v[1]);
}
+/**
+ * @ignore
+ */
function mb_calcExtent(frameName, min, max) {
var ind;
if (typeof(mb_mapObj) == 'object') {
@@ -153,6 +166,9 @@
}
mb_mapObj[ind].extent = new_min.x +","+ new_min.y +","+ new_max.x +","+ new_max.y;
}
+/**
+ * @ignore
+ */
function roundToDigits(aFloat, numberOfDigits) {
return Math.round(aFloat*Math.pow(10, parseInt(numberOfDigits)))/Math.pow(10, parseInt(numberOfDigits));
}
More information about the Mapbender_commits
mailing list