Remove dimension property from geometries

This was only necessary when using the shared vertices structure.
This commit is contained in:
Tim Schaub
2013-09-25 16:51:34 +02:00
parent 563918d58d
commit 1aa83e133b
19 changed files with 5 additions and 216 deletions
-5
View File
@@ -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
View File
@@ -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());
};
-14
View File
@@ -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);
+1 -8
View File
@@ -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;
};
-5
View File
@@ -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);
-5
View File
@@ -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);
-5
View File
@@ -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);
+1 -7
View File
@@ -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;
};
-6
View File
@@ -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);