Remove use of shared vertices in geom package

This commit is contained in:
Tim Schaub
2013-09-25 15:06:53 +02:00
parent 3349bded1c
commit 2850c761cf
11 changed files with 54 additions and 304 deletions
+5 -17
View File
@@ -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.<Array.<ol.CoordinateArray>>} 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.<ol.geom.Polygon>} 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);
};