JSAN/JSDOC, coding standards
git-svn-id: http://svn.openlayers.org/trunk/openlayers@68 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -12,9 +12,18 @@ OpenLayers.Util=new Object();
|
|||||||
OpenLayers.Pixel = Class.create();
|
OpenLayers.Pixel = Class.create();
|
||||||
OpenLayers.Pixel.prototype = {
|
OpenLayers.Pixel.prototype = {
|
||||||
|
|
||||||
/**
|
/* @type float */
|
||||||
* @param {int} x
|
x: 0.0,
|
||||||
* @param {int} y
|
|
||||||
|
/* @type float */
|
||||||
|
y: 0.0,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*
|
||||||
|
* @param {float} x
|
||||||
|
* @param {float} y
|
||||||
*/
|
*/
|
||||||
initialize: function(x, y) {
|
initialize: function(x, y) {
|
||||||
this.x = x;
|
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() {
|
toString:function() {
|
||||||
return ("x="+this.x+",y="+this.y);
|
return ("x=" + this.x + ",y=" + this.y);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {OpenLayers.Pixel}
|
* @type OpenLayers.Pixel
|
||||||
*/
|
*/
|
||||||
copyOf:function() {
|
copyOf:function() {
|
||||||
return new OpenLayers.Pixel(this.x, this.y);
|
return new OpenLayers.Pixel(this.x, this.y);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** returns a Pixel object with the difference
|
/**
|
||||||
* between the two pixels
|
|
||||||
*
|
|
||||||
* @param {OpenLayers.Pixel} px
|
* @param {OpenLayers.Pixel} px
|
||||||
*
|
*
|
||||||
* @return {OpenLayers.Pixel}
|
* @return a Pixel object with the difference between the two pixels
|
||||||
|
* @type OpenLayers.Pixel
|
||||||
*/
|
*/
|
||||||
diff:function(px) {
|
diff:function(px) {
|
||||||
return new OpenLayers.Pixel(this.x - px.x, this.y - px.y);
|
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
|
* @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) {
|
diffABS:function(px) {
|
||||||
return new OpenLayers.Pixel(Math.abs(this.x - px.x),
|
return new OpenLayers.Pixel(Math.abs(this.x - px.x),
|
||||||
Math.abs(this.y - px.y));
|
Math.abs(this.y - px.y));
|
||||||
},
|
},
|
||||||
|
|
||||||
/** returns whether or not the two points are equal
|
/**
|
||||||
*
|
|
||||||
* @param {OpenLayers.Pixel} px
|
* @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) {
|
equal:function(px) {
|
||||||
var d = this.diff(px);
|
var d = this.diff(px);
|
||||||
return ((d.x == 0) && (d.y == 0));
|
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} x
|
||||||
* @param {int} y
|
* @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) {
|
add:function(x, y) {
|
||||||
return new OpenLayers.Pixel(this.x + x, this.y + y);
|
return new OpenLayers.Pixel(this.x + x, this.y + y);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* @type str */
|
||||||
CLASS_NAME: "OpenLayers.Pixel"
|
CLASS_NAME: "OpenLayers.Pixel"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user