From d3ea5236ef07620f2eb79cf0169799c1401b3510 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 19 Mar 2013 22:10:13 +0100 Subject: [PATCH] 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. --- src/ol/coordinate.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ol/coordinate.js b/src/ol/coordinate.js index dcf4832038..9c979ec7ba 100644 --- a/src/ol/coordinate.js +++ b/src/ol/coordinate.js @@ -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);