Add layout and stride to ol.geom.Geometry

This commit is contained in:
Tom Payne
2013-11-07 10:03:01 +01:00
parent 61a217e8dd
commit 4260283497
+35 -1
View File
@@ -14,15 +14,33 @@ ol.geom.GeometryType = {
}; };
/**
* @enum {string}
*/
ol.geom.GeometryLayout = {
XY: 'XY',
XYZ: 'XYZ',
XYM: 'XYM',
XYZM: 'XYZM'
};
/** /**
* @constructor * @constructor
* @extends {goog.events.EventTarget} * @extends {goog.events.EventTarget}
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
*/ */
ol.geom.Geometry = function() { ol.geom.Geometry = function(opt_layout) {
goog.base(this); goog.base(this);
/**
* @protected
* @type {ol.geom.GeometryLayout}
*/
this.layout = goog.isDef(opt_layout) ? opt_layout : ol.geom.GeometryLayout.XY;
/** /**
* @protected * @protected
* @type {number} * @type {number}
@@ -61,6 +79,14 @@ ol.geom.Geometry.prototype.dispatchChangeEvent = function() {
ol.geom.Geometry.prototype.getExtent = goog.abstractMethod; ol.geom.Geometry.prototype.getExtent = goog.abstractMethod;
/**
* @return {ol.geom.GeometryLayout} Layout.
*/
ol.geom.Geometry.prototype.getLayout = function() {
return this.layout;
};
/** /**
* @return {number} Revision. * @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. * @return {ol.geom.GeometryType} Geometry type.
*/ */