From 27baf53e18f2fe52bc223c3bce0d4638ae15ae70 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 16 May 2006 23:58:14 +0000 Subject: [PATCH] JSAN/JSDOC, coding standards git-svn-id: http://svn.openlayers.org/trunk/openlayers@68 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Util.js | 50 ++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 9c81b6e059..c56154a7d6 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -12,9 +12,18 @@ OpenLayers.Util=new Object(); OpenLayers.Pixel = Class.create(); OpenLayers.Pixel.prototype = { - /** - * @param {int} x - * @param {int} y + /* @type float */ + x: 0.0, + + /* @type float */ + y: 0.0, + + + /** + * @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" };