diff --git a/src/ol/geom/abstractcollection.js b/src/ol/geom/abstractcollection.js
index 933f55e946..590b3cd15a 100644
--- a/src/ol/geom/abstractcollection.js
+++ b/src/ol/geom/abstractcollection.js
@@ -14,11 +14,6 @@ goog.require('ol.geom.Geometry');
ol.geom.AbstractCollection = function() {
goog.base(this);
- /**
- * @type {number}
- */
- this.dimension;
-
/**
* @type {Array.
}
*/
diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js
index f23b9eb782..189f347421 100644
--- a/src/ol/geom/geometry.js
+++ b/src/ol/geom/geometry.js
@@ -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());
};
diff --git a/src/ol/geom/geometrycollection.js b/src/ol/geom/geometrycollection.js
index 71e96e7cfb..4cdee57aed 100644
--- a/src/ol/geom/geometrycollection.js
+++ b/src/ol/geom/geometrycollection.js
@@ -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);
diff --git a/src/ol/geom/linestring.js b/src/ol/geom/linestring.js
index 25eec36673..b992d5c490 100644
--- a/src/ol/geom/linestring.js
+++ b/src/ol/geom/linestring.js
@@ -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;
};
diff --git a/src/ol/geom/multilinestring.js b/src/ol/geom/multilinestring.js
index 8fbf3b34e3..756f1fb0cf 100644
--- a/src/ol/geom/multilinestring.js
+++ b/src/ol/geom/multilinestring.js
@@ -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);
diff --git a/src/ol/geom/multipoint.js b/src/ol/geom/multipoint.js
index 0c10481599..fe8f75d971 100644
--- a/src/ol/geom/multipoint.js
+++ b/src/ol/geom/multipoint.js
@@ -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);
diff --git a/src/ol/geom/multipolygon.js b/src/ol/geom/multipolygon.js
index 48601b32e3..45c5e20cf4 100644
--- a/src/ol/geom/multipolygon.js
+++ b/src/ol/geom/multipolygon.js
@@ -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);
diff --git a/src/ol/geom/point.js b/src/ol/geom/point.js
index e06ff70a4f..2b349c84c2 100644
--- a/src/ol/geom/point.js
+++ b/src/ol/geom/point.js
@@ -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;
};
diff --git a/src/ol/geom/polygon.js b/src/ol/geom/polygon.js
index a0953e1417..b1ec7d68a2 100644
--- a/src/ol/geom/polygon.js
+++ b/src/ol/geom/polygon.js
@@ -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);
diff --git a/src/ol/renderer/canvas/canvasvectorrenderer.js b/src/ol/renderer/canvas/canvasvectorrenderer.js
index 1e4543f446..14252a439d 100644
--- a/src/ol/renderer/canvas/canvasvectorrenderer.js
+++ b/src/ol/renderer/canvas/canvasvectorrenderer.js
@@ -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) {
diff --git a/test/spec/ol/geom/geometrycollection.test.js b/test/spec/ol/geom/geometrycollection.test.js
index 014fd39b8a..010e5b2b5e 100644
--- a/test/spec/ol/geom/geometrycollection.test.js
+++ b/test/spec/ol/geom/geometrycollection.test.js
@@ -36,25 +36,6 @@ describe('ol.geom.GeometryCollection', function() {
});
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var point = new ol.geom.Point([10, 20]);
- var line = new ol.geom.LineString([[10, 20], [30, 40]]);
- var poly = new ol.geom.Polygon([outer, inner1, inner2]);
- var multi = new ol.geom.GeometryCollection([point, line, poly]);
- expect(multi.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var multi = new ol.geom.GeometryCollection([
- new ol.geom.Point([30, 40, 50])
- ]);
- expect(multi.dimension).to.be(3);
- });
-
- });
-
describe('#clone()', function() {
it('has a working clone method', function() {
diff --git a/test/spec/ol/geom/linearring.test.js b/test/spec/ol/geom/linearring.test.js
index 341e688ae6..42fba0a33f 100644
--- a/test/spec/ol/geom/linearring.test.js
+++ b/test/spec/ol/geom/linearring.test.js
@@ -11,20 +11,6 @@ describe('ol.geom.LinearRing', function() {
});
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
- expect(ring.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var ring = new ol.geom.LinearRing([[10, 20, 30], [40, 50, 60]]);
- expect(ring.dimension).to.be(3);
- });
-
- });
-
describe('#getCoordinates()', function() {
it('is an array', function() {
diff --git a/test/spec/ol/geom/linestring.test.js b/test/spec/ol/geom/linestring.test.js
index 11f59ff13f..5cf4f65885 100644
--- a/test/spec/ol/geom/linestring.test.js
+++ b/test/spec/ol/geom/linestring.test.js
@@ -12,20 +12,6 @@ describe('ol.geom.LineString', function() {
});
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var line = new ol.geom.LineString([[10, 20], [30, 40]]);
- expect(line.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var line = new ol.geom.LineString([[10, 20, 30], [40, 50, 60]]);
- expect(line.dimension).to.be(3);
- });
-
- });
-
describe('#getBounds()', function() {
it('returns the bounding extent', function() {
diff --git a/test/spec/ol/geom/multilinestring.test.js b/test/spec/ol/geom/multilinestring.test.js
index 571b038175..b619813149 100644
--- a/test/spec/ol/geom/multilinestring.test.js
+++ b/test/spec/ol/geom/multilinestring.test.js
@@ -12,13 +12,6 @@ describe('ol.geom.MultiLineString', function() {
expect(multi).to.be.a(ol.geom.Geometry);
});
- it('throws when given with insufficient dimensions', function() {
- expect(function() {
- var multi = new ol.geom.MultiLineString([1]);
- multi = multi; // suppress gjslint warning about unused variable
- }).to.throwException();
- });
-
});
describe('#components', function() {
@@ -36,24 +29,6 @@ describe('ol.geom.MultiLineString', function() {
});
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var multi = new ol.geom.MultiLineString([
- [[10, 20], [30, 40]],
- [[20, 30], [40, 50]]]);
- expect(multi.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var multi = new ol.geom.MultiLineString([
- [[10, 20, 30], [30, 40, 50]],
- [[20, 30, 40], [40, 50, 60]]]);
- expect(multi.dimension).to.be(3);
- });
-
- });
-
describe('#getBounds()', function() {
it('returns the bounding extent', function() {
diff --git a/test/spec/ol/geom/multipoint.test.js b/test/spec/ol/geom/multipoint.test.js
index dd54c094c0..772186250b 100644
--- a/test/spec/ol/geom/multipoint.test.js
+++ b/test/spec/ol/geom/multipoint.test.js
@@ -10,13 +10,6 @@ describe('ol.geom.MultiPoint', function() {
expect(multi).to.be.a(ol.geom.Geometry);
});
- it('throws when given with insufficient dimensions', function() {
- expect(function() {
- var multi = new ol.geom.MultiPoint([1]);
- multi = multi; // suppress gjslint warning about unused variable
- }).to.throwException();
- });
-
});
describe('#components', function() {
@@ -32,20 +25,6 @@ describe('ol.geom.MultiPoint', function() {
});
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var multi = new ol.geom.MultiPoint([[10, 20], [30, 40]]);
- expect(multi.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var multi = new ol.geom.MultiPoint([[10, 20, 30], [30, 40, 50]]);
- expect(multi.dimension).to.be(3);
- });
-
- });
-
describe('#getBounds()', function() {
it('returns the bounding extent', function() {
diff --git a/test/spec/ol/geom/multipolygon.test.js b/test/spec/ol/geom/multipolygon.test.js
index 2cd118e0ed..e667427d0b 100644
--- a/test/spec/ol/geom/multipolygon.test.js
+++ b/test/spec/ol/geom/multipolygon.test.js
@@ -41,22 +41,6 @@ describe('ol.geom.MultiPolygon', function() {
});
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var multi = new ol.geom.MultiPolygon([
- [outer1, inner1a, inner1b],
- [outer2]]);
- expect(multi.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var multi = new ol.geom.MultiPolygon([[[[10, 20, 30], [40, 50, 60]]]]);
- expect(multi.dimension).to.be(3);
- });
-
- });
-
describe('#getBounds()', function() {
it('returns the bounding extent', function() {
diff --git a/test/spec/ol/geom/point.test.js b/test/spec/ol/geom/point.test.js
index 32992e7809..48b5a7f1e6 100644
--- a/test/spec/ol/geom/point.test.js
+++ b/test/spec/ol/geom/point.test.js
@@ -10,27 +10,6 @@ describe('ol.geom.Point', function() {
expect(point).to.be.a(ol.geom.Geometry);
});
- it('throws when given with insufficient dimensions', function() {
- expect(function() {
- var point = new ol.geom.Point([1]);
- point = point; // suppress gjslint warning about unused variable
- }).to.throwException();
- });
-
- });
-
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var point = new ol.geom.Point([10, 20]);
- expect(point.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var point = new ol.geom.Point([10, 20, 30]);
- expect(point.dimension).to.be(3);
- });
-
});
describe('#getBounds()', function() {
diff --git a/test/spec/ol/geom/polygon.test.js b/test/spec/ol/geom/polygon.test.js
index 30209d4277..b895d27482 100644
--- a/test/spec/ol/geom/polygon.test.js
+++ b/test/spec/ol/geom/polygon.test.js
@@ -51,20 +51,6 @@ describe('ol.geom.Polygon', function() {
});
- describe('#dimension', function() {
-
- it('can be 2', function() {
- var poly = new ol.geom.Polygon([outer, inner1, inner2]);
- expect(poly.dimension).to.be(2);
- });
-
- it('can be 3', function() {
- var poly = new ol.geom.Polygon([[[10, 20, 30], [40, 50, 60]]]);
- expect(poly.dimension).to.be(3);
- });
-
- });
-
describe('#getBounds()', function() {
it('returns the bounding extent', function() {
diff --git a/test/spec/ol/parser/kml.test.js b/test/spec/ol/parser/kml.test.js
index 3a3d104abb..30e2ab1e47 100644
--- a/test/spec/ol/parser/kml.test.js
+++ b/test/spec/ol/parser/kml.test.js
@@ -15,7 +15,6 @@ describe('ol.parser.KML', function() {
var geom = obj.features[0].getGeometry();
expect(obj.features[0].getId()).to.eql('KML.Polygon');
expect(geom instanceof ol.geom.Polygon).to.be.ok();
- expect(geom.dimension).to.eql(3);
done();
});
});
@@ -28,7 +27,6 @@ describe('ol.parser.KML', function() {
expect(obj.features.length).to.eql(2);
var geom = obj.features[0].getGeometry();
expect(geom instanceof ol.geom.LineString).to.be.ok();
- expect(geom.dimension).to.eql(3);
geom = obj.features[1].getGeometry();
expect(geom instanceof ol.geom.LineString).to.be.ok();
done();
@@ -43,7 +41,6 @@ describe('ol.parser.KML', function() {
expect(obj.features.length).to.eql(1);
var geom = obj.features[0].getGeometry();
expect(geom instanceof ol.geom.Point).to.be.ok();
- expect(geom.dimension).to.eql(3);
done();
});
});