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>}
|
||||
*/
|
||||
|
||||
+1
-10
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user