Optionally extend ol.Coordinate to the third dimension

We continue to inherit from goog.math.Vec2 instead of goog.math.Vec3
because goog.math.Vec2 better represents a position in space, with
appropriate functionality, whereas goog.math.Vec3 represents a direction
and magnitude.
This commit is contained in:
Tom Payne
2013-03-19 22:10:13 +01:00
parent 4fe67f09c0
commit d3ea5236ef

View File

@@ -19,9 +19,17 @@ ol.CoordinateFormatType;
* @extends {goog.math.Vec2}
* @param {number} x X.
* @param {number} y Y.
* @param {number=} opt_z Z.
*/
ol.Coordinate = function(x, y) {
ol.Coordinate = function(x, y, opt_z) {
goog.base(this, x, y);
/**
* @type {number}
*/
this.z = opt_z || 0;
};
goog.inherits(ol.Coordinate, goog.math.Vec2);