From 2850c761cf37cbcb0edcb0ce7e98cffcf842a4ef Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 25 Sep 2013 15:06:53 +0200 Subject: [PATCH] Remove use of shared vertices in geom package --- src/ol/geom/geometry.js | 30 +++------- src/ol/geom/linearring.js | 6 +- src/ol/geom/linestring.js | 86 ++++++---------------------- src/ol/geom/multilinestring.js | 22 ++----- src/ol/geom/multipoint.js | 27 ++------- src/ol/geom/multipolygon.js | 22 ++----- src/ol/geom/point.js | 43 +++----------- src/ol/geom/polygon.js | 22 +------ test/spec/ol/geom/linestring.test.js | 43 -------------- test/spec/ol/geom/point.test.js | 46 --------------- test/spec/ol/geom/polygon.test.js | 11 ---- 11 files changed, 54 insertions(+), 304 deletions(-) diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js index 383c255fa1..0d148b9bda 100644 --- a/src/ol/geom/geometry.js +++ b/src/ol/geom/geometry.js @@ -2,22 +2,13 @@ goog.provide('ol.geom.Geometry'); goog.provide('ol.geom.GeometryType'); goog.require('ol.Extent'); -goog.require('ol.geom.SharedVertices'); /** * @constructor */ -ol.geom.Geometry = function() { - - /** - * @type {ol.geom.SharedVertices} - * @protected - */ - this.vertices = null; - -}; +ol.geom.Geometry = function() {}; /** @@ -28,8 +19,7 @@ ol.geom.Geometry.prototype.dimension; /** - * Create a clone of this geometry. The clone will not be represented in any - * shared structure. + * Create a clone of this geometry. * @return {ol.geom.Geometry} The cloned geometry. */ ol.geom.Geometry.prototype.clone = function() { @@ -53,15 +43,6 @@ ol.geom.Geometry.prototype.getBounds = goog.abstractMethod; ol.geom.Geometry.prototype.getCoordinates = goog.abstractMethod; -/** - * Get the shared vertices for this geometry. - * @return {ol.geom.SharedVertices} The shared vertices. - */ -ol.geom.Geometry.prototype.getSharedVertices = function() { - return this.vertices; -}; - - /** * Get the geometry type. * @return {ol.geom.GeometryType} The geometry type. @@ -69,6 +50,13 @@ ol.geom.Geometry.prototype.getSharedVertices = function() { ol.geom.Geometry.prototype.getType = goog.abstractMethod; +/** + * Transform a geometry in place. + * @param {ol.TransformFunction} transform Transform function. + */ +ol.geom.Geometry.prototype.transform = goog.abstractMethod; + + /** * Geometry types. * diff --git a/src/ol/geom/linearring.js b/src/ol/geom/linearring.js index 5fb5e5a3ef..fb7eb418eb 100644 --- a/src/ol/geom/linearring.js +++ b/src/ol/geom/linearring.js @@ -3,7 +3,6 @@ goog.provide('ol.geom.LinearRing'); goog.require('ol.CoordinateArray'); goog.require('ol.geom.GeometryType'); goog.require('ol.geom.LineString'); -goog.require('ol.geom.SharedVertices'); @@ -12,10 +11,9 @@ goog.require('ol.geom.SharedVertices'); * @extends {ol.geom.LineString} * @param {ol.CoordinateArray} coordinates Vertex array (e.g. * [[x0, y0], [x1, y1]]). - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. */ -ol.geom.LinearRing = function(coordinates, opt_shared) { - goog.base(this, coordinates, opt_shared); +ol.geom.LinearRing = function(coordinates) { + goog.base(this, coordinates); /** * We're intentionally not enforcing that rings be closed right now. This diff --git a/src/ol/geom/linestring.js b/src/ol/geom/linestring.js index 682d474a18..82c498a822 100644 --- a/src/ol/geom/linestring.js +++ b/src/ol/geom/linestring.js @@ -2,47 +2,34 @@ goog.provide('ol.geom.LineString'); goog.require('goog.asserts'); goog.require('ol.CoordinateArray'); +goog.require('ol.extent'); goog.require('ol.geom'); goog.require('ol.geom.Geometry'); goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.SharedVertices'); /** * @constructor * @extends {ol.geom.Geometry} - * @param {ol.CoordinateArray} coordinates Vertex array (e.g. + * @param {ol.CoordinateArray} coordinates Array of coordinates (e.g. * [[x0, y0], [x1, y1]]). - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. */ -ol.geom.LineString = function(coordinates, opt_shared) { +ol.geom.LineString = function(coordinates) { goog.base(this); goog.asserts.assert(goog.isArray(coordinates[0])); - var vertices = opt_shared, - dimension; - - if (!goog.isDef(vertices)) { - dimension = coordinates[0].length; - vertices = new ol.geom.SharedVertices({dimension: dimension}); - } - /** - * @type {ol.geom.SharedVertices} - */ - this.vertices = vertices; - - /** - * @type {number} + * Array of coordinates. + * @type {ol.CoordinateArray} * @private */ - this.sharedId_ = vertices.add(coordinates); + this.coordinates_ = coordinates; /** * @type {number} */ - this.dimension = vertices.getDimension(); + this.dimension = coordinates[0].length; goog.asserts.assert(this.dimension >= 2); /** @@ -62,7 +49,9 @@ goog.inherits(ol.geom.LineString, ol.geom.Geometry); * @return {number} The vertex coordinate value. */ ol.geom.LineString.prototype.get = function(index, dim) { - return this.vertices.get(this.sharedId_, index, dim); + var coordinates = this.getCoordinates(); + goog.asserts.assert(coordinates.length > index); + return coordinates[index][dim]; }; @@ -71,17 +60,7 @@ ol.geom.LineString.prototype.get = function(index, dim) { * @return {ol.CoordinateArray} Coordinates array. */ ol.geom.LineString.prototype.getCoordinates = function() { - var count = this.getCount(); - var coordinates = new Array(count); - var vertex; - for (var i = 0; i < count; ++i) { - vertex = new Array(this.dimension); - for (var j = 0; j < this.dimension; ++j) { - vertex[j] = this.get(i, j); - } - coordinates[i] = vertex; - } - return coordinates; + return this.coordinates_; }; @@ -90,7 +69,7 @@ ol.geom.LineString.prototype.getCoordinates = function() { * @return {number} The vertex count. */ ol.geom.LineString.prototype.getCount = function() { - return this.vertices.getCount(this.sharedId_); + return this.getCoordinates().length; }; @@ -99,34 +78,12 @@ ol.geom.LineString.prototype.getCount = function() { */ ol.geom.LineString.prototype.getBounds = function() { if (goog.isNull(this.bounds_)) { - var dimension = this.dimension, - vertices = this.vertices, - id = this.sharedId_, - count = vertices.getCount(id), - start = vertices.getStart(id), - end = start + (count * dimension), - coordinates = vertices.coordinates, - minX, maxX, - minY, maxY, - x, y, i; - - minX = maxX = coordinates[start]; - minY = maxY = coordinates[start + 1]; - for (i = start + dimension; i < end; i += dimension) { - x = coordinates[i]; - y = coordinates[i + 1]; - if (x < minX) { - minX = x; - } else if (x > maxX) { - maxX = x; - } - if (y < minY) { - minY = y; - } else if (y > maxY) { - maxY = y; - } + var coordinates = this.getCoordinates(); + var extent = ol.extent.createEmpty(); + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + ol.extent.extendCoordinate(extent, coordinates[i]); } - this.bounds_ = [minX, minY, maxX, maxY]; + this.bounds_ = extent; } return this.bounds_; }; @@ -140,15 +97,6 @@ ol.geom.LineString.prototype.getType = function() { }; -/** - * Get the identifier used to mark this line in the shared vertices structure. - * @return {number} The identifier. - */ -ol.geom.LineString.prototype.getSharedId = function() { - return this.sharedId_; -}; - - /** * Calculate the distance from a coordinate to this linestring. * diff --git a/src/ol/geom/multilinestring.js b/src/ol/geom/multilinestring.js index a884e7411b..8fbf3b34e3 100644 --- a/src/ol/geom/multilinestring.js +++ b/src/ol/geom/multilinestring.js @@ -5,7 +5,6 @@ goog.require('ol.CoordinateArray'); goog.require('ol.geom.AbstractCollection'); goog.require('ol.geom.GeometryType'); goog.require('ol.geom.LineString'); -goog.require('ol.geom.SharedVertices'); @@ -13,21 +12,11 @@ goog.require('ol.geom.SharedVertices'); * @constructor * @extends {ol.geom.AbstractCollection} * @param {Array.} coordinates Coordinates array. - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. */ -ol.geom.MultiLineString = function(coordinates, opt_shared) { +ol.geom.MultiLineString = function(coordinates) { goog.base(this); goog.asserts.assert(goog.isArray(coordinates[0][0])); - var vertices = opt_shared, - dimension; - - if (!goog.isDef(vertices)) { - // try to get dimension from first vertex in first line - dimension = coordinates[0][0].length; - vertices = new ol.geom.SharedVertices({dimension: dimension}); - } - var numParts = coordinates.length; /** @@ -35,13 +24,13 @@ ol.geom.MultiLineString = function(coordinates, opt_shared) { */ this.components = new Array(numParts); for (var i = 0; i < numParts; ++i) { - this.components[i] = new ol.geom.LineString(coordinates[i], vertices); + this.components[i] = new ol.geom.LineString(coordinates[i]); } /** * @type {number} */ - this.dimension = vertices.getDimension(); + this.dimension = coordinates[0][0].length; }; goog.inherits(ol.geom.MultiLineString, ol.geom.AbstractCollection); @@ -78,14 +67,13 @@ ol.geom.MultiLineString.prototype.distanceFromCoordinate = * Create a multi-linestring geometry from an array of linestring geometries. * * @param {Array.} geometries Array of geometries. - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. * @return {ol.geom.MultiLineString} A new geometry. */ -ol.geom.MultiLineString.fromParts = function(geometries, opt_shared) { +ol.geom.MultiLineString.fromParts = function(geometries) { var count = geometries.length; var coordinates = new Array(count); for (var i = 0; i < count; ++i) { coordinates[i] = geometries[i].getCoordinates(); } - return new ol.geom.MultiLineString(coordinates, opt_shared); + return new ol.geom.MultiLineString(coordinates); }; diff --git a/src/ol/geom/multipoint.js b/src/ol/geom/multipoint.js index ce9e0c100e..0c10481599 100644 --- a/src/ol/geom/multipoint.js +++ b/src/ol/geom/multipoint.js @@ -5,7 +5,6 @@ goog.require('ol.CoordinateArray'); goog.require('ol.geom.AbstractCollection'); goog.require('ol.geom.GeometryType'); goog.require('ol.geom.Point'); -goog.require('ol.geom.SharedVertices'); @@ -13,26 +12,11 @@ goog.require('ol.geom.SharedVertices'); * @constructor * @extends {ol.geom.AbstractCollection} * @param {ol.CoordinateArray} coordinates Coordinates array. - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. */ -ol.geom.MultiPoint = function(coordinates, opt_shared) { +ol.geom.MultiPoint = function(coordinates) { goog.base(this); goog.asserts.assert(goog.isArray(coordinates[0])); - var vertices = opt_shared, - dimension; - - if (!goog.isDef(vertices)) { - // try to get dimension from first vertex - dimension = coordinates[0].length; - vertices = new ol.geom.SharedVertices({dimension: dimension}); - } - - /** - * @type {ol.geom.SharedVertices} - */ - this.vertices = vertices; - var numParts = coordinates.length; /** @@ -40,13 +24,13 @@ ol.geom.MultiPoint = function(coordinates, opt_shared) { */ this.components = new Array(numParts); for (var i = 0; i < numParts; ++i) { - this.components[i] = new ol.geom.Point(coordinates[i], vertices); + this.components[i] = new ol.geom.Point(coordinates[i]); } /** * @type {number} */ - this.dimension = vertices.getDimension(); + this.dimension = coordinates[0].length; }; goog.inherits(ol.geom.MultiPoint, ol.geom.AbstractCollection); @@ -64,14 +48,13 @@ ol.geom.MultiPoint.prototype.getType = function() { * Create a multi-point geometry from an array of point geometries. * * @param {Array.} geometries Array of geometries. - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. * @return {ol.geom.MultiPoint} A new geometry. */ -ol.geom.MultiPoint.fromParts = function(geometries, opt_shared) { +ol.geom.MultiPoint.fromParts = function(geometries) { var count = geometries.length; var coordinates = new Array(count); for (var i = 0; i < count; ++i) { coordinates[i] = geometries[i].getCoordinates(); } - return new ol.geom.MultiPoint(coordinates, opt_shared); + return new ol.geom.MultiPoint(coordinates); }; diff --git a/src/ol/geom/multipolygon.js b/src/ol/geom/multipolygon.js index be355cfd65..48601b32e3 100644 --- a/src/ol/geom/multipolygon.js +++ b/src/ol/geom/multipolygon.js @@ -5,7 +5,6 @@ goog.require('ol.CoordinateArray'); goog.require('ol.geom.AbstractCollection'); goog.require('ol.geom.GeometryType'); goog.require('ol.geom.Polygon'); -goog.require('ol.geom.SharedVertices'); @@ -14,21 +13,11 @@ goog.require('ol.geom.SharedVertices'); * @extends {ol.geom.AbstractCollection} * @param {Array.>} coordinates Coordinates * array. - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. */ -ol.geom.MultiPolygon = function(coordinates, opt_shared) { +ol.geom.MultiPolygon = function(coordinates) { goog.base(this); goog.asserts.assert(goog.isArray(coordinates[0][0][0])); - var vertices = opt_shared, - dimension; - - if (!goog.isDef(vertices)) { - // try to get dimension from first vertex in first ring of the first poly - dimension = coordinates[0][0][0].length; - vertices = new ol.geom.SharedVertices({dimension: dimension}); - } - var numParts = coordinates.length; /** @@ -36,13 +25,13 @@ ol.geom.MultiPolygon = function(coordinates, opt_shared) { */ this.components = new Array(numParts); for (var i = 0; i < numParts; ++i) { - this.components[i] = new ol.geom.Polygon(coordinates[i], vertices); + this.components[i] = new ol.geom.Polygon(coordinates[i]); } /** * @type {number} */ - this.dimension = vertices.getDimension(); + this.dimension = coordinates[0][0][0].length; }; goog.inherits(ol.geom.MultiPolygon, ol.geom.AbstractCollection); @@ -78,14 +67,13 @@ ol.geom.MultiPolygon.prototype.containsCoordinate = function(coordinate) { * Create a multi-polygon geometry from an array of polygon geometries. * * @param {Array.} geometries Array of geometries. - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. * @return {ol.geom.MultiPolygon} A new geometry. */ -ol.geom.MultiPolygon.fromParts = function(geometries, opt_shared) { +ol.geom.MultiPolygon.fromParts = function(geometries) { var count = geometries.length; var coordinates = new Array(count); for (var i = 0; i < count; ++i) { coordinates[i] = geometries[i].getCoordinates(); } - return new ol.geom.MultiPolygon(coordinates, opt_shared); + return new ol.geom.MultiPolygon(coordinates); }; diff --git a/src/ol/geom/point.js b/src/ol/geom/point.js index b65f21fc18..3682170257 100644 --- a/src/ol/geom/point.js +++ b/src/ol/geom/point.js @@ -4,42 +4,28 @@ goog.require('goog.asserts'); goog.require('ol.Coordinate'); goog.require('ol.geom.Geometry'); goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.SharedVertices'); /** * @constructor * @extends {ol.geom.Geometry} - * @param {ol.Coordinate} coordinates Coordinates array (e.g. [x, y]). - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. + * @param {ol.Coordinate} coordinates Coordinate values (e.g. [x, y]). */ -ol.geom.Point = function(coordinates, opt_shared) { +ol.geom.Point = function(coordinates) { goog.base(this); - var vertices = opt_shared, - dimension; - - if (!goog.isDef(vertices)) { - dimension = coordinates.length; - vertices = new ol.geom.SharedVertices({dimension: dimension}); - } - /** - * @type {ol.geom.SharedVertices} - */ - this.vertices = vertices; - - /** - * @type {number} + * Point coordinate values. + * @type {ol.Coordinate} * @private */ - this.sharedId_ = vertices.add([coordinates]); + this.coordinates_ = coordinates; /** * @type {number} */ - this.dimension = vertices.getDimension(); + this.dimension = coordinates.length; goog.asserts.assert(this.dimension >= 2); /** @@ -57,7 +43,7 @@ goog.inherits(ol.geom.Point, ol.geom.Geometry); * @return {number} The coordinate value. */ ol.geom.Point.prototype.get = function(dim) { - return this.vertices.get(this.sharedId_, 0, dim); + return this.getCoordinates()[dim]; }; @@ -79,11 +65,7 @@ ol.geom.Point.prototype.getBounds = function() { * @return {ol.Coordinate} Coordinates array. */ ol.geom.Point.prototype.getCoordinates = function() { - var coordinates = new Array(this.dimension); - for (var i = 0; i < this.dimension; ++i) { - coordinates[i] = this.get(i); - } - return coordinates; + return this.coordinates_; }; @@ -93,12 +75,3 @@ ol.geom.Point.prototype.getCoordinates = function() { ol.geom.Point.prototype.getType = function() { return ol.geom.GeometryType.POINT; }; - - -/** - * Get the identifier used to mark this point in the shared vertices structure. - * @return {number} The identifier. - */ -ol.geom.Point.prototype.getSharedId = function() { - return this.sharedId_; -}; diff --git a/src/ol/geom/polygon.js b/src/ol/geom/polygon.js index 2f442a56e4..995fa6dfb9 100644 --- a/src/ol/geom/polygon.js +++ b/src/ol/geom/polygon.js @@ -6,7 +6,6 @@ goog.require('ol.extent'); goog.require('ol.geom.Geometry'); goog.require('ol.geom.GeometryType'); goog.require('ol.geom.LinearRing'); -goog.require('ol.geom.SharedVertices'); @@ -21,32 +20,17 @@ goog.require('ol.geom.SharedVertices'); * @extends {ol.geom.Geometry} * @param {Array.} coordinates Array of rings. First * is outer, any remaining are inner. - * @param {ol.geom.SharedVertices=} opt_shared Shared vertices. */ -ol.geom.Polygon = function(coordinates, opt_shared) { +ol.geom.Polygon = function(coordinates) { goog.base(this); goog.asserts.assert(goog.isArray(coordinates[0][0])); - var vertices = opt_shared, - dimension; - - if (!goog.isDef(vertices)) { - // try to get dimension from first vertex in first ring - dimension = coordinates[0][0].length; - vertices = new ol.geom.SharedVertices({dimension: dimension}); - } - /** * @private * @type {ol.Coordinate} */ this.labelPoint_ = null; - /** - * @type {ol.geom.SharedVertices} - */ - this.vertices = vertices; - var numRings = coordinates.length; /** @@ -67,13 +51,13 @@ ol.geom.Polygon = function(coordinates, opt_shared) { ringCoords.reverse(); } } - this.rings[i] = new ol.geom.LinearRing(ringCoords, vertices); + this.rings[i] = new ol.geom.LinearRing(ringCoords); } /** * @type {number} */ - this.dimension = vertices.getDimension(); + this.dimension = coordinates[0][0].length; goog.asserts.assert(this.dimension >= 2); }; diff --git a/test/spec/ol/geom/linestring.test.js b/test/spec/ol/geom/linestring.test.js index 39f6ff3693..aadaccdd38 100644 --- a/test/spec/ol/geom/linestring.test.js +++ b/test/spec/ol/geom/linestring.test.js @@ -10,14 +10,6 @@ describe('ol.geom.LineString', function() { expect(line).to.be.a(ol.geom.Geometry); }); - it('accepts shared vertices', function() { - var vertices = new ol.geom.SharedVertices(); - var l1 = new ol.geom.LineString([[10, 20], [30, 40]], vertices); - var l2 = new ol.geom.LineString([[50, 60], [70, 80]], vertices); - expect(l1.getCoordinates()).to.eql([[10, 20], [30, 40]]); - expect(l2.getCoordinates()).to.eql([[50, 60], [70, 80]]); - }); - }); describe('#dimension', function() { @@ -56,42 +48,7 @@ describe('ol.geom.LineString', function() { }); - describe('#getSharedId()', function() { - - it('returns identifiers', function() { - var vertices = new ol.geom.SharedVertices(); - - var l1 = new ol.geom.LineString([[10, 20], [30, 40]], vertices); - var l2 = new ol.geom.LineString( - [[50, 60], [70, 80], [90, 100]], vertices); - - var id1 = l1.getSharedId(); - var id2 = l2.getSharedId(); - - expect(vertices.coordinates).to.eql( - [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]); - - expect(vertices.getStart(id1)).to.be(0); - expect(vertices.getCount(id1)).to.be(2); - expect(vertices.get(id1, 0, 0)).to.be(10); - expect(vertices.get(id1, 0, 1)).to.be(20); - expect(vertices.get(id1, 1, 0)).to.be(30); - expect(vertices.get(id1, 1, 1)).to.be(40); - - expect(vertices.getStart(id2)).to.be(4); - expect(vertices.getCount(id2)).to.be(3); - expect(vertices.get(id2, 0, 0)).to.be(50); - expect(vertices.get(id2, 0, 1)).to.be(60); - expect(vertices.get(id2, 1, 0)).to.be(70); - expect(vertices.get(id2, 1, 1)).to.be(80); - expect(vertices.get(id2, 2, 0)).to.be(90); - expect(vertices.get(id2, 2, 1)).to.be(100); - }); - - }); - }); goog.require('ol.geom.Geometry'); goog.require('ol.geom.LineString'); -goog.require('ol.geom.SharedVertices'); diff --git a/test/spec/ol/geom/point.test.js b/test/spec/ol/geom/point.test.js index ff3e7db02e..d72a8be839 100644 --- a/test/spec/ol/geom/point.test.js +++ b/test/spec/ol/geom/point.test.js @@ -10,16 +10,6 @@ describe('ol.geom.Point', function() { expect(point).to.be.a(ol.geom.Geometry); }); - it('accepts shared vertices', function() { - var vertices = new ol.geom.SharedVertices(); - var p1 = new ol.geom.Point([10, 20], vertices); - var p2 = new ol.geom.Point([30, 40], vertices); - var p3 = new ol.geom.Point([50, 60], vertices); - expect(p1.getCoordinates()).to.eql([10, 20]); - expect(p2.getCoordinates()).to.eql([30, 40]); - expect(p3.getCoordinates()).to.eql([50, 60]); - }); - it('throws when given with insufficient dimensions', function() { expect(function() { var point = new ol.geom.Point([1]); @@ -65,43 +55,7 @@ describe('ol.geom.Point', function() { }); - - describe('#getSharedId()', function() { - - it('returns identifiers', function() { - var vertices = new ol.geom.SharedVertices(); - - var p1 = new ol.geom.Point([10, 20], vertices); - var p2 = new ol.geom.Point([30, 40], vertices); - var p3 = new ol.geom.Point([50, 60], vertices); - - var id1 = p1.getSharedId(); - var id2 = p2.getSharedId(); - var id3 = p3.getSharedId(); - - expect(vertices.coordinates).to.eql( - [10, 20, 30, 40, 50, 60]); - - expect(vertices.getStart(id1)).to.be(0); - expect(vertices.getCount(id1)).to.be(1); - expect(vertices.get(id1, 0, 0)).to.be(10); - expect(vertices.get(id1, 0, 1)).to.be(20); - - expect(vertices.getStart(id2)).to.be(2); - expect(vertices.getCount(id2)).to.be(1); - expect(vertices.get(id2, 0, 0)).to.be(30); - expect(vertices.get(id2, 0, 1)).to.be(40); - - expect(vertices.getStart(id3)).to.be(4); - expect(vertices.getCount(id3)).to.be(1); - expect(vertices.get(id3, 0, 0)).to.be(50); - expect(vertices.get(id3, 0, 1)).to.be(60); - }); - - }); - }); goog.require('ol.geom.Geometry'); goog.require('ol.geom.Point'); -goog.require('ol.geom.SharedVertices'); diff --git a/test/spec/ol/geom/polygon.test.js b/test/spec/ol/geom/polygon.test.js index 4cac05c9e7..a13209573f 100644 --- a/test/spec/ol/geom/polygon.test.js +++ b/test/spec/ol/geom/polygon.test.js @@ -14,16 +14,6 @@ describe('ol.geom.Polygon', function() { expect(poly).to.be.a(ol.geom.Geometry); }); - it('accepts shared vertices', function() { - var vertices = new ol.geom.SharedVertices(); - var p1 = new ol.geom.Polygon([outer], vertices); - var p2 = new ol.geom.Polygon([outer, inner1], vertices); - var p3 = new ol.geom.Polygon([outer, inner2], vertices); - expect(p1.getCoordinates()).to.eql([outer]); - expect(p2.getCoordinates()).to.eql([outer, inner1]); - expect(p3.getCoordinates()).to.eql([outer, inner2]); - }); - }); describe('#rings', function() { @@ -102,4 +92,3 @@ describe('ol.geom.Polygon', function() { goog.require('ol.geom.Geometry'); goog.require('ol.geom.LinearRing'); goog.require('ol.geom.Polygon'); -goog.require('ol.geom.SharedVertices');