Remove dimension property from geometries
This was only necessary when using the shared vertices structure.
This commit is contained in:
@@ -14,11 +14,6 @@ goog.require('ol.geom.Geometry');
|
||||
ol.geom.AbstractCollection = function() {
|
||||
goog.base(this);
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension;
|
||||
|
||||
/**
|
||||
* @type {Array.<ol.geom.Geometry>}
|
||||
*/
|
||||
|
||||
@@ -12,21 +12,12 @@ goog.require('ol.TransformFunction');
|
||||
ol.geom.Geometry = function() {};
|
||||
|
||||
|
||||
/**
|
||||
* The dimension of this geometry (2 or 3).
|
||||
* @type {number}
|
||||
*/
|
||||
ol.geom.Geometry.prototype.dimension;
|
||||
|
||||
|
||||
/**
|
||||
* Create a clone of this geometry.
|
||||
* @return {ol.geom.Geometry} The cloned geometry.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.clone = function() {
|
||||
var clone = new this.constructor(this.getCoordinates());
|
||||
clone.dimension = this.dimension;
|
||||
return clone;
|
||||
return new this.constructor(this.getCoordinates());
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,20 +23,6 @@ ol.geom.GeometryCollection = function(geometries) {
|
||||
*/
|
||||
this.components = geometries;
|
||||
|
||||
var dimension = 0;
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
if (goog.isDef(dimension)) {
|
||||
dimension = geometries[i].dimension;
|
||||
} else {
|
||||
goog.asserts.assert(dimension == geometries[i].dimension);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = dimension;
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.GeometryCollection, ol.geom.AbstractCollection);
|
||||
|
||||
|
||||
@@ -26,12 +26,6 @@ ol.geom.LineString = function(coordinates) {
|
||||
*/
|
||||
this.coordinates_ = coordinates;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = coordinates[0].length;
|
||||
goog.asserts.assert(this.dimension >= 2);
|
||||
|
||||
/**
|
||||
* @type {ol.Extent}
|
||||
* @private
|
||||
@@ -119,11 +113,10 @@ ol.geom.LineString.prototype.distanceFromCoordinate = function(coordinate) {
|
||||
*/
|
||||
ol.geom.LineString.prototype.transform = function(transform) {
|
||||
var coordinates = this.getCoordinates();
|
||||
var dimension = this.dimension;
|
||||
var coord;
|
||||
for (var i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||
coord = coordinates[i];
|
||||
transform(coord, coord, dimension);
|
||||
transform(coord, coord, coord.length);
|
||||
}
|
||||
this.bounds_ = null;
|
||||
};
|
||||
|
||||
@@ -27,11 +27,6 @@ ol.geom.MultiLineString = function(coordinates) {
|
||||
this.components[i] = new ol.geom.LineString(coordinates[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = coordinates[0][0].length;
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.MultiLineString, ol.geom.AbstractCollection);
|
||||
|
||||
|
||||
@@ -27,11 +27,6 @@ ol.geom.MultiPoint = function(coordinates) {
|
||||
this.components[i] = new ol.geom.Point(coordinates[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = coordinates[0].length;
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.MultiPoint, ol.geom.AbstractCollection);
|
||||
|
||||
|
||||
@@ -28,11 +28,6 @@ ol.geom.MultiPolygon = function(coordinates) {
|
||||
this.components[i] = new ol.geom.Polygon(coordinates[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = coordinates[0][0][0].length;
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.MultiPolygon, ol.geom.AbstractCollection);
|
||||
|
||||
|
||||
@@ -22,12 +22,6 @@ ol.geom.Point = function(coordinates) {
|
||||
*/
|
||||
this.coordinates_ = coordinates;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = coordinates.length;
|
||||
goog.asserts.assert(this.dimension >= 2);
|
||||
|
||||
/**
|
||||
* @type {ol.Extent}
|
||||
* @private
|
||||
@@ -82,6 +76,6 @@ ol.geom.Point.prototype.getType = function() {
|
||||
*/
|
||||
ol.geom.Point.prototype.transform = function(transform) {
|
||||
var coordinates = this.getCoordinates();
|
||||
transform(coordinates, coordinates, this.dimension);
|
||||
transform(coordinates, coordinates, coordinates.length);
|
||||
this.bounds_ = null;
|
||||
};
|
||||
|
||||
@@ -54,12 +54,6 @@ ol.geom.Polygon = function(coordinates) {
|
||||
this.rings[i] = new ol.geom.LinearRing(ringCoords);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = coordinates[0][0].length;
|
||||
goog.asserts.assert(this.dimension >= 2);
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.Polygon, ol.geom.Geometry);
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ ol.renderer.canvas.VectorRenderer.prototype.renderLineStringFeatures_ =
|
||||
function(features, symbolizer) {
|
||||
|
||||
var context = this.context_,
|
||||
i, ii, feature, id, currentSize, geometry, components, j, jj, line, dim,
|
||||
i, ii, feature, id, currentSize, geometry, components, j, jj, line,
|
||||
k, kk, vec, strokeSize;
|
||||
|
||||
context.globalAlpha = symbolizer.opacity;
|
||||
@@ -197,7 +197,6 @@ ol.renderer.canvas.VectorRenderer.prototype.renderLineStringFeatures_ =
|
||||
}
|
||||
for (j = 0, jj = components.length; j < jj; ++j) {
|
||||
line = components[j];
|
||||
dim = line.dimension;
|
||||
for (k = 0, kk = line.getCount(); k < kk; ++k) {
|
||||
vec = [line.get(k, 0), line.get(k, 1), 0];
|
||||
goog.vec.Mat4.multVec3(this.transform_, vec, vec);
|
||||
@@ -347,7 +346,7 @@ ol.renderer.canvas.VectorRenderer.prototype.renderPolygonFeatures_ =
|
||||
fillOpacity = symbolizer.fillOpacity,
|
||||
globalAlpha,
|
||||
i, ii, geometry, components, j, jj, poly,
|
||||
rings, numRings, ring, dim, k, kk, vec, feature;
|
||||
rings, numRings, ring, k, kk, vec, feature;
|
||||
|
||||
if (strokeColor) {
|
||||
context.strokeStyle = strokeColor;
|
||||
@@ -384,7 +383,6 @@ ol.renderer.canvas.VectorRenderer.prototype.renderPolygonFeatures_ =
|
||||
}
|
||||
for (j = 0, jj = components.length; j < jj; ++j) {
|
||||
poly = components[j];
|
||||
dim = poly.dimension;
|
||||
rings = poly.rings;
|
||||
numRings = rings.length;
|
||||
if (numRings > 0) {
|
||||
|
||||
Reference in New Issue
Block a user