diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js index fd40b82292..741d16e66e 100644 --- a/src/ol/geom/geometry.js +++ b/src/ol/geom/geometry.js @@ -14,15 +14,33 @@ ol.geom.GeometryType = { }; +/** + * @enum {string} + */ +ol.geom.GeometryLayout = { + XY: 'XY', + XYZ: 'XYZ', + XYM: 'XYM', + XYZM: 'XYZM' +}; + + /** * @constructor * @extends {goog.events.EventTarget} + * @param {ol.geom.GeometryLayout=} opt_layout Layout. */ -ol.geom.Geometry = function() { +ol.geom.Geometry = function(opt_layout) { goog.base(this); + /** + * @protected + * @type {ol.geom.GeometryLayout} + */ + this.layout = goog.isDef(opt_layout) ? opt_layout : ol.geom.GeometryLayout.XY; + /** * @protected * @type {number} @@ -61,6 +79,14 @@ ol.geom.Geometry.prototype.dispatchChangeEvent = function() { ol.geom.Geometry.prototype.getExtent = goog.abstractMethod; +/** + * @return {ol.geom.GeometryLayout} Layout. + */ +ol.geom.Geometry.prototype.getLayout = function() { + return this.layout; +}; + + /** * @return {number} Revision. */ @@ -69,6 +95,14 @@ ol.geom.Geometry.prototype.getRevision = function() { }; +/** + * @return {number} Stride. + */ +ol.geom.Geometry.prototype.getStride = function() { + return this.layout.length; +}; + + /** * @return {ol.geom.GeometryType} Geometry type. */