Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make shared vertices structures accessible

  • Loading branch information...
commit 4918106a22c9f7123593f134eb03fb7f9312b894 1 parent faee18b
Tim Schaub tschaub authored
Showing with 60 additions and 18 deletions.
  1. +60 −18 src/ol/layer/vectorlayer.js
78 src/ol/layer/vectorlayer.js
View
@@ -170,6 +170,27 @@ ol.layer.Vector = function(layerOptions) {
*/
this.featureCache_ = new ol.layer.FeatureCache();
+ /**
+ * TODO: this means we need to know dimension at construction
+ * @type {ol.geom.SharedVertices}
+ * @private
+ */
+ this.pointVertices_ = new ol.geom.SharedVertices();
+
+ /**
+ * TODO: this means we need to know dimension at construction
+ * @type {ol.geom.SharedVertices}
+ * @private
+ */
+ this.lineVertices_ = new ol.geom.SharedVertices();
+
+ /**
+ * TODO: this means we need to know dimension at construction
+ * @type {ol.geom.SharedVertices}
+ * @private
+ */
+ this.polygonVertices_ = new ol.geom.SharedVertices();
+
};
goog.inherits(ol.layer.Vector, ol.layer.Layer);
@@ -214,6 +235,30 @@ ol.layer.Vector.prototype.getFeaturesObject = function(opt_filter) {
/**
+ * @return {ol.geom.SharedVertices} Shared line vertices.
+ */
+ol.layer.Vector.prototype.getLineVertices = function() {
+ return this.lineVertices_;
+};
+
+
+/**
+ * @return {ol.geom.SharedVertices} Shared point vertices.
+ */
+ol.layer.Vector.prototype.getPointVertices = function() {
+ return this.pointVertices_;
+};
+
+
+/**
+ * @return {ol.geom.SharedVertices} Shared polygon vertices.
+ */
+ol.layer.Vector.prototype.getPolygonVertices = function() {
+ return this.polygonVertices_;
+};
+
+
+/**
* @param {Object.<string, ol.Feature>} features Features.
* @return {Array.<Array>} symbolizers for features.
*/
@@ -261,17 +306,14 @@ ol.layer.Vector.prototype.groupFeaturesBySymbolizerLiteral =
*/
ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
var features;
- var pointVertices = new ol.geom.SharedVertices();
- var lineVertices = new ol.geom.SharedVertices();
- var polygonVertices = new ol.geom.SharedVertices();
var lookup = {
- 'point': pointVertices,
- 'linestring': lineVertices,
- 'polygon': polygonVertices,
- 'multipoint': pointVertices,
- 'multilinstring': lineVertices,
- 'multipolygon': polygonVertices
+ 'point': this.pointVertices_,
+ 'linestring': this.lineVertices_,
+ 'polygon': this.polygonVertices_,
+ 'multipoint': this.pointVertices_,
+ 'multilinstring': this.lineVertices_,
+ 'multipolygon': this.polygonVertices_
};
var callback = function(feature, type) {
@@ -289,19 +331,19 @@ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
var transform = ol.projection.getTransform(sourceProjection, projection);
transform(
- pointVertices.coordinates,
- pointVertices.coordinates,
- pointVertices.getDimension());
+ this.pointVertices_.coordinates,
+ this.pointVertices_.coordinates,
+ this.pointVertices_.getDimension());
transform(
- lineVertices.coordinates,
- lineVertices.coordinates,
- lineVertices.getDimension());
+ this.lineVertices_.coordinates,
+ this.lineVertices_.coordinates,
+ this.lineVertices_.getDimension());
transform(
- polygonVertices.coordinates,
- polygonVertices.coordinates,
- polygonVertices.getDimension());
+ this.polygonVertices_.coordinates,
+ this.polygonVertices_.coordinates,
+ this.polygonVertices_.getDimension());
this.addFeatures(features);
};
Please sign in to comment.
Something went wrong with that request. Please try again.