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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 30 05:01:32 EDT 2007


Author: christoph
Date: 2007-05-30 05:01:32 -0400 (Wed, 30 May 2007)
New Revision: 1381

Modified:
   trunk/mapbender/http/javascripts/geometry.js
Log:
more JSDoc


Modified: trunk/mapbender/http/javascripts/geometry.js
===================================================================
--- trunk/mapbender/http/javascripts/geometry.js	2007-05-30 08:32:16 UTC (rev 1380)
+++ trunk/mapbender/http/javascripts/geometry.js	2007-05-30 09:01:32 UTC (rev 1381)
@@ -12,7 +12,7 @@
 
 
 /**
- * @class A class representing geometry types.
+ * @class A class representing geometry types "polygon", "line" and "point".
  *
  * @constructor
  */
@@ -38,7 +38,6 @@
 	/*
 	 * creates a new, empty Multigeometry and adds it to this GeometryArray
 	 *
-	 * @member GeometryArray
 	 * @param {String} geomType a {@link GeomType}
 	 */
 	this.addMember = function(geomType){
@@ -47,7 +46,6 @@
 	
 	this.name = nameGeometryArray;
 	this.list = [];
-	
 }
 
 GeometryArray.prototype = new List();
@@ -55,7 +53,6 @@
 /**
  * gets the j-th {link Geometry} object of the i-th {@link MultiGeometry} object
  *
- * @member GeometryArray
  * @param {Integer} i index of the MultiGeometry
  * @param {Integer} j index of the Geometry
  * @type Geometry 
@@ -67,7 +64,6 @@
 /**
  * gets the k-th Point of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
  *
- * @member GeometryArray
  * @param {Integer} i index of the MultiGeometry
  * @param {Integer} j index of the Geometry
  * @param {Integer} k index of the Point
@@ -81,7 +77,6 @@
 /**
  * gets an Array of indices; the {@link MultiGeometry} objects at these indices are equal to geom
  *
- * @member GeometryArray
  * @type Array of Integer
  * @param {MultiGeometry} geom 
  * @returns an Array of indices
@@ -97,7 +92,6 @@
 /**
  * deletes the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
  *
- * @member GeometryArray
  * @param {Integer} i index of the MultiGeometry
  * @param {Integer} j index of the Geometry
  */
@@ -108,7 +102,6 @@
 /**
  * deletes the k-th {@link Point} of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
  *
- * @member GeometryArray
  * @param {Integer} i index of the MultiGeometry
  * @param {Integer} j index of the Geometry
  * @param {Integer} k index of the Point
@@ -121,7 +114,6 @@
 /**
  * closes the current {@link MultiGeometry}. Calls {@link Geometry#close}.
  *
- * @member GeometryArray
  */
 GeometryArray.prototype.close = function(){
 	if (!this.get(-1).get(-1).close()) {
@@ -131,12 +123,12 @@
 		if (this.get(-1).get(-1).count() === 0) {this.get(-1).del(-1);}
 		if (this.get(-1).count() === 0) {this.del(-1);}
 	}
+	
 };
 
 /**
  * deletes all {@link Point} objects of this {@link GeometryArray} that equal point
  *
- * @member GeometryArray
  * @param {Point} point
  */
 GeometryArray.prototype.delAllPointsLike = function(point){
@@ -159,7 +151,6 @@
 /**
  * updates all {@link Point} objects of this {@link GeometryArray} that equal oldP to newP
  *
- * @member GeometryArray
  * @param {Point} oldP
  * @param {Point} newP
  */
@@ -183,7 +174,6 @@
 	/*
 	 * creates a new, empty {@link Geometry} object and adds it to this {@link MultiGeometry}
 	 *
-	 * @member MultiGeometry
 	 */
 	this.addGeometry = function(){
 		this.add(new Geometry(this.geomType));
@@ -193,7 +183,6 @@
 	 * deletes the {@link Geometry} object at index i; -1 refers to the last {@link Geometry object in the list
 	 * overwrites the del function of {@link List}.
 	 *
-	 * @member MultiGeometry
 	 * @param {Integer} i index
 	 */
 	this.del = function(i){
@@ -221,7 +210,6 @@
 /**
  * updates all {@link Point} objects of this {@link MultiGeometry} that equal oldP to newP
  *
- * @member MultiGeometry
  * @param {Point} oldP
  * @param {Point} newP
  */
@@ -234,7 +222,6 @@
 /**
  * gets the bounding box of this {@link MultiGeometry}
  *
- * @member MultiGeometry
  * @return the bounding box
  * @type Array of two Point objects
  */
@@ -254,7 +241,6 @@
 /**
  * gets the center of the bounding box of this {@link MultiGeometry}.
  *
- * @member MultiGeometry
  * @return the center of the bounding box
  * @type Point
  */
@@ -268,7 +254,6 @@
 /**
  * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
  *
- * @member MultiGeometry
  * @return number of points
  * @type Integer
  */
@@ -283,7 +268,6 @@
 /**
  * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
  *
- * @member MultiGeometry
  * @return number of points
  * @type Integer
  */
@@ -294,7 +278,6 @@
 /**
  * compares this {@link MultiGeometry} object with the {@link MultiGeometry} object multigeom.
  *
- * @member MultiGeometry
  * @param {MultiGeometry} multigeom another multigeometry
  * @return true if he multigeometries match; else false 
  * @type Boolean
@@ -312,7 +295,6 @@
 /**
  * deletes the j-th {@link Point} object of the i-th {@link Geometry} object of this {@link MultiGeometry} object.
  *
- * @member MultiGeometry
  * @param {Integer} i geometry index
  * @param {Integer} j point index
  * @return true if the deletion succeded; else false.
@@ -338,7 +320,6 @@
 	 * deletes the {@link Point} object at index i; -1 refers to the last {@link Point} object in the list
 	 * overwrites the del function of {@link List}.
 	 *
-	 * @member Geometry
 	 * @param {Integer} i index
 	 */
 	this.del = function(i){
@@ -366,7 +347,6 @@
 	/**
 	 * adds a {@link Point} object to this {@link Geometry} object.
 	 *
-	 * @member Geometry
 	 * @param {Float} x x value of the point
 	 * @param {Float} y y value of the point
 	 */	
@@ -378,7 +358,6 @@
 	/**
 	 * adds a {@link Point} object to this {@link Geometry} object.
 	 *
-	 * @member Geometry
 	 * @param {Point} aPoint another point
 	 */	
 	this.addPoint = function(aPoint){
@@ -389,7 +368,6 @@
 	/**
 	 * inserts a {@link Point} object at index i of this {@link Geometry} object.
 	 *
-	 * @member Geometry
 	 * @param {Point} p another point
 	 * @param {Integer} i index
 	 */	
@@ -408,7 +386,6 @@
 	 * Overwrites the {@link Point) object at index i with the {@link Point} object p.
 	 *
 	 * @private
-	 * @member Geometry
 	 * @param {Point} p another point
 	 * @param {Integer} i index
 	 */	
@@ -426,7 +403,6 @@
 	 * Updates the {@link Geometry#dist} and {@link Geometry#totaldist}
 	 *
 	 * @private
-	 * @member Geometry
 	 */	
 	var updateDist = function(){
 		dist[0] = 0;		
@@ -439,7 +415,6 @@
 	/**
 	 * gets the distance between the last and last but one point of this {@link Geometry}.
 	 *
-	 * @member Geometry
 	 * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
 	 * @return the distance
 	 * @type Float
@@ -454,7 +429,6 @@
 	/**
 	 * gets the length of the outer rim of this {@link Geometry}.
 	 *
-	 * @member Geometry
 	 * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
 	 * @return the distance
 	 * @type Float
@@ -468,7 +442,6 @@
 	/**
 	 * closes this {@link Geometry}. 
 	 *
-	 * @member Geometry
 	 * @return true if the geometry could be closed; otherwise false
 	 * @type Boolean
 	 */	
@@ -490,7 +463,6 @@
 	/**
 	 * checks if this {@link Geometry} has been closed. 
 	 *
-	 * @member Geometry
 	 * @return true if the geometry is closed; otherwise false
 	 * @type Boolean
 	 */	
@@ -514,7 +486,6 @@
 /**
  * gets the bounding box of this {@link Geometry}
  *
- * @member Geometry
  * @return the bounding box
  * @type Array of two Point objects
  */
@@ -536,7 +507,6 @@
 /**
  * updates all {@link Point} objects of this {@link Geometry} that equal oldP to newP
  *
- * @member Geometry
  * @param {Point} oldP
  * @param {Point} newP
  */
@@ -557,7 +527,6 @@
 /**
  * compares this {@link Geometry} object with the {@link Geometry} object geom point by point.
  *
- * @member Geometry
  * @param {Geometry} geom another geometry
  * @return true if he geometries match; else false 
  * @type Boolean
@@ -582,7 +551,6 @@
 	/**
 	 * returns the number of elements of this {@link Wfs_element} object.
 	 *
-	 * @member Wfs_element
 	 * @return the number of elements
 	 * @type Integer
 	 */
@@ -593,7 +561,6 @@
 	/**
 	 * returns the name of the element at index i.
 	 *
-	 * @member Wfs_element
 	 * @param {Integer} i index
 	 * @return the name
 	 * @type String
@@ -606,7 +573,6 @@
 	/**
 	 * returns the value of the element at index i.
 	 *
-	 * @member Wfs_element
 	 * @param {Integer} i index
 	 * @return the value
 	 */
@@ -618,7 +584,6 @@
 	/**
 	 * appends a new element with a given name. If an element with this name exists, it is overwritten.
 	 *
-	 * @member Wfs_element
 	 * @param {String} aName the name of the new element
 	 * @param {String} aValue the value of the new element
 	 */
@@ -632,7 +597,6 @@
 	/**
 	 * checks if an index is valid
 	 *
-	 * @member Wfs_element
 	 * @private
 	 * @param {Integer} i an index
 	 * @return true if the index is valid; otherwise false
@@ -651,7 +615,6 @@
 /**
  * gets the index of the element with a given name.
  *
- * @member Wfs_element
  * @param {String} elementName a name
  * @return the index of the element; if no element with this name exists, false
  * @type Integer, Boolean
@@ -666,7 +629,6 @@
 /**
  * gets the value of the element with a given name.
  *
- * @member Wfs_element
  * @param {String} elementName a name
  * @return the value of the element; if no element with this name exists, false
  * @type String, Boolean
@@ -696,7 +658,6 @@
 	/**
 	 * draws the geometry of the canvas
 	 *
-	 * @member Canvas
 	 * @private
 	 * @param {String} t geometry type
 	 * @param {MultiGeometry} g a MultiGeometry object
@@ -731,7 +692,6 @@
 	/**
 	 * checks if the MultiGeometry's bounding box width and height is smaller than minWidth
 	 *
-	 * @member Canvas
 	 * @private
 	 * @param {MultiGeometry} g a MultiGeometry object
 	 */
@@ -748,7 +708,6 @@
 	/**
 	 * draws a circle with {@link jsGraphics}.
 	 *
-	 * @member Canvas
 	 * @private
 	 * @param {Float} x x value of the center
 	 * @param {Float} y y value of the center
@@ -763,7 +722,6 @@
 	/**
 	 * draws a polyline with {@link jsGraphics}.
 	 *
-	 * @member Canvas
 	 * @private
 	 * @param {Array} x_array array of x values
 	 * @param {Array} y_array array of y values
@@ -777,9 +735,8 @@
 	/**
 	 * gets the jsGraphics.
 	 *
-	 * @member Canvas
 	 * @private
-	 * @return teh jsGraphics
+	 * @return the jsGraphics
 	 * @type jsGraphics
 	 */
 	this.getCanvas = function(){
@@ -801,8 +758,6 @@
 
 /**
  * cleans the canvas by emptying the canvas {@link DivTag}.
- *
- * @member Canvas
  */
 Canvas.prototype.clean = function () {
 	this.canvasDivTag.clean();
@@ -811,7 +766,6 @@
 /**
  * paints all geometries.
  *
- * @member Canvas
  * @param {GeometryArray} gA the geometries that will be drawn
  */
 Canvas.prototype.paint = function(gA) {
@@ -856,7 +810,6 @@
 	/**
 	 * removes a {@link MultiGeometry} object from the geometry Array
 	 *
-	 * @member Highlight
 	 * @param {MultiGeometry} m a MultiGeometry
 	 * @param {String} color a color
 	 */	
@@ -875,7 +828,6 @@
 	/**
 	 * adds a {@link MultiGeometry} object to the geometry Array
 	 *
-	 * @member Highlight
 	 * @param {MultiGeometry} m a MultiGeometry
 	 * @param {String} color the color of the highlight
 	 */	
@@ -889,7 +841,6 @@
 	/**
 	 * removes all MultiGeometries.
 	 *
-	 * @member Highlight
 	 */	
 	this.clean = function() {
 		if (gA.count() > 0) {
@@ -901,7 +852,6 @@
 	/**
 	 * displays the highlight
 	 *
-	 * @member Highlight
 	 */	
 	this.paint = function() {
 		for (var i=0; i < canvas.length; i++) {
@@ -928,9 +878,26 @@
 // ----------------------------------------------------------------------------------------------------
 // Snapping
 // ----------------------------------------------------------------------------------------------------
-
+/**
+ * @class a {@link Snapping} object stores is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
+ *
+ * @constructor
+ * @requires GeometryArray
+ * @requires Highlight
+ * @param {String} aTarget name of the mapframe where snapping occurs
+ * @param {String} aTolerance Snapping is activated if the mouse is 
+ *                 within aTolerance pixel distance to the reference point.
+ * @param {String} aColor apparently deprecated?
+ * @param {Integer} aZIndex the z-Index of the {@link jsGraphics} generated by {@link Highlight}.
+ */
 function Snapping(aTarget, aTolerance, aColor, aZIndex){
 
+	/**
+	 * draws a circle to highlight the snapped point.
+	 * 
+	 * @param {Point} center the snapped point.
+	 * @param {Integer} radius radius of the circular highlight.
+	 */
 	this.draw = function(center,radius){ 
 		mG = new MultiGeometry(geomType.point);
 		mG.addGeometry();
@@ -969,13 +936,44 @@
 		min_i = -1;
 	};
 	
+	/**
+	 * @private
+	 */
 	var tolerance = (typeof(aTolerance) == 'undefined') ? 10 : aTolerance;
+
+	/**
+	 * @private
+	 */
 	var zIndex = (typeof(aZIndex) == 'undefined') ? 50 : aZIndex;
+
+	/**
+	 * @private
+	 */
 	var coord = []; 
+
+	/**
+	 * @private
+	 */
 	var min_i = -1;
+
+	/**
+	 * @private
+	 */
 	var target = aTarget;
+
+	/**
+	 * @private
+	 */
 	var lineWidth = 2;
+
+	/**
+	 * @private
+	 */
 	var style = {"position":"absolute", "top":"0px", "left":"0px", "z-index":zIndex};
+
+	/**
+	 * @private
+	 */
 	var highlight = new Highlight([target], "snapping"+Math.round(Math.random()*Math.pow(10,10)), style, lineWidth);
 }
 
@@ -999,6 +997,15 @@
 	}
 };
 
+/**
+ * Stores the points which will have the snapping property. 
+ * 
+ * @param {GeometryArray} geom all points of geom will be stored. May also be a 
+ *                             {@link MultiGeometry} or {@link Geometry}.
+ * @param {Point} point this point is excluded. Useful when moving a point of a 
+ *                      geometry; you don't want to snap against the point you
+ *                      move. Optional.
+ */
 Snapping.prototype.store = function(geom, point){
 	this.resetPoints();
 	this.resetIndexOfNearestNeighbour();
@@ -1028,19 +1035,39 @@
 	}
 };
 
+/**
+ * Determines whether a point is within snapping distance to the mouse cursor
+ * 
+ * @return true if a point is within snapping distance; else false
+ * @type Boolean
+ */
 Snapping.prototype.isSnapped = function(){ 
 	if (this.getNearestNeighbour() !== false) {return true;}
 	return false;
 };
 
-Snapping.prototype.getSnappedPoint = function(geom){
+/**
+ * Returns the point that is within snapping distance and closest to the mouse cursor.
+ * 
+ * @return the point (if there is any); else false
+ * @type Point
+ */
+Snapping.prototype.getSnappedPoint = function(){
 	return this.getNearestNeighbour();
 };
 
+/**
+ * Adds the point to the stored points with snapping property.
+ * 
+ * @param {Point} point which receives snapping property.
+ */
 Snapping.prototype.add = function(aPoint){ 
 	this.addPoint(aPoint);
 };
 
+/**
+ * Removes the highlight.
+ */
 Snapping.prototype.clean = function(){
 	this.cleanHighlight();
 };
@@ -1051,6 +1078,9 @@
 // misc. functions
 // ----------------------------------------------------------------------------------------------------
 
+/**
+ * @ignore
+ */
 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; var ix; var iy;
@@ -1119,6 +1149,9 @@
 	return [new Point(Math.round(q.x), Math.round(q.y)), new Point(Math.round(p.x), Math.round(p.y))];
 }
 
+/**
+ * @ignore
+ */
 function objString (a){
 	var z = "";
 	



More information about the Mapbender_commits mailing list