Allow geometries to use a shared vertex array

The ol.geom.SharedVertices structure represents a flattened array of vertex coordinates.  This is intended to support optimal WebGL rendering.
This commit is contained in:
Tim Schaub
2013-03-02 18:39:24 +01:00
parent bdfa2cc88c
commit b52d283641
23 changed files with 1086 additions and 217 deletions

View File

@@ -1,15 +1,23 @@
goog.require('ol.Extent');
goog.provide('ol.geom.Coordinate');
goog.provide('ol.geom.CoordinateArray');
goog.provide('ol.geom.Geometry');
goog.provide('ol.geom.GeometryType');
goog.require('ol.Extent');
goog.require('ol.geom.SharedVertices');
/**
* @constructor
*/
ol.geom.Geometry = function() {};
ol.geom.Geometry = function() {
/**
* @type {ol.geom.SharedVertices}
* @protected
*/
this.vertices = null;
};
/**
@@ -26,6 +34,21 @@ ol.geom.Geometry.prototype.dimension;
ol.geom.Geometry.prototype.getBounds = goog.abstractMethod;
/**
* @return {Array} The GeoJSON style coordinates array for the geometry.
*/
ol.geom.Geometry.prototype.getCoordinates = goog.abstractMethod;
/**
* Get the shared vertices for this geometry.
* @return {ol.geom.SharedVertices} The shared vertices.
*/
ol.geom.Geometry.prototype.getSharedVertices = function() {
return this.vertices;
};
/**
* Get the geometry type.
* @return {ol.geom.GeometryType} The geometry type.
@@ -33,18 +56,6 @@ ol.geom.Geometry.prototype.getBounds = goog.abstractMethod;
ol.geom.Geometry.prototype.getType = goog.abstractMethod;
/**
* @typedef {Array.<number>}
*/
ol.geom.Coordinate;
/**
* @typedef {Array.<ol.geom.Coordinate>}
*/
ol.geom.CoordinateArray;
/**
* @enum {string}
*/