1 /*global foodev, eniro*/ 2 3 eniro.Package('maps'); 4 5 eniro.maps.Class('Point', /** @lends eniro.maps.Point.prototype */ { 6 7 /** 8 * <i>This field matches Google's API, but use getter.</i> 9 * 10 * @private 11 */ 12 x: null, 13 14 /** 15 * <i>This field matches Google's API, but use getter.</i> 16 * 17 * @private 18 */ 19 y: null, 20 21 /** 22 * Point holds an x/y value of an unspecified unit, often used for pixel 23 * coordinates. 24 * 25 * <p> 26 * Class is considered a value type. 27 * 28 * @param {number} 29 * x The x value. 30 * @param {number} 31 * y The y value. 32 * @constructs 33 */ 34 initialize: function (x, y) { 35 foodev.assert(x, 'x', 'number'); 36 foodev.assert(y, 'y', 'number'); 37 this.x = x; 38 this.y = y; 39 }, 40 41 /** 42 * Returns the x coordinate. 43 * 44 * @return {number} The x coordinate. 45 */ 46 getX: function () { 47 return this.x; 48 }, 49 50 /** 51 * Returns the y coordinate. 52 * 53 * @return {number} The y coordinate. 54 */ 55 getY: function () { 56 return this.y; 57 } 58 59 }); 60 61 eniro.maps.Point.prototype.toString = function () { 62 return this.getClassName() + '(' + this.x + ',' + this.y + ')'; 63 }; 64 65 /** 66 * Compare this instance with another instance. 67 * 68 * @param {eniro.maps.Point} 69 * other The instance to compare this instance to. 70 * 71 * @return {boolean} true If this instance is equal to the given one. 72 * @function 73 */ 74 eniro.maps.Point.prototype.equals = foodev.makeEquals(eniro.maps.Point); 75