JSAN/JSDOC, coding standards

git-svn-id: http://svn.openlayers.org/trunk/openlayers@68 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-16 23:58:14 +00:00
parent a06bc351e4
commit 27baf53e18

View File

@@ -12,9 +12,18 @@ OpenLayers.Util=new Object();
OpenLayers.Pixel = Class.create();
OpenLayers.Pixel.prototype = {
/* @type float */
x: 0.0,
/* @type float */
y: 0.0,
/**
* @param {int} x
* @param {int} y
* @constructor
*
* @param {float} x
* @param {float} y
*/
initialize: function(x, y) {
this.x = x;
@@ -22,65 +31,64 @@ OpenLayers.Pixel.prototype = {
},
/**
* @return {str} ex: "x=200,y=242"
* @return string representation of Pixel, ex: "x=200.4,y=242.2"
* @type str
*/
toString:function() {
return ("x="+this.x+",y="+this.y);
return ("x=" + this.x + ",y=" + this.y);
},
/**
* @return {OpenLayers.Pixel}
* @type OpenLayers.Pixel
*/
copyOf:function() {
return new OpenLayers.Pixel(this.x, this.y);
},
/** returns a Pixel object with the difference
* between the two pixels
*
/**
* @param {OpenLayers.Pixel} px
*
* @return {OpenLayers.Pixel}
* @return a Pixel object with the difference between the two pixels
* @type OpenLayers.Pixel
*/
diff:function(px) {
return new OpenLayers.Pixel(this.x - px.x, this.y - px.y);
},
/** returns a Pixel object with the absolute difference
* between the two pixels
*
/**
* @param {OpenLayers.Pixel} px
*
* @return {OpenLayers.Pixel}
* @return a Pixel object with the absolute difference between the two pixels
* @type OpenLayers.Pixel
*/
diffABS:function(px) {
return new OpenLayers.Pixel(Math.abs(this.x - px.x),
Math.abs(this.y - px.y));
},
/** returns whether or not the two points are equal
*
/**
* @param {OpenLayers.Pixel} px
*
* @return {bool}
* @return whether or not the point passed in as parameter is equal to this
* @type bool
*/
equal:function(px) {
var d = this.diff(px);
return ((d.x == 0) && (d.y == 0));
},
/** Return a new Pixel with this pixel's x&y augmented by
* the int values passed in.
*
/**
* @param {int} x
* @param {int} y
*
* @return {OpenLayers.Pixel}
* @return a new Pixel with this pixel's x&y augmented by the int values passed in.
* @type OpenLayers.Pixel
*/
add:function(x, y) {
return new OpenLayers.Pixel(this.x + x, this.y + y);
},
/* @type str */
CLASS_NAME: "OpenLayers.Pixel"
};