Rename _ol_geom_GeometryCollection_ to GeometryCollection

This commit is contained in:
Tim Schaub
2017-12-14 08:59:35 -07:00
parent 87e665d60e
commit 4ea0af87df
11 changed files with 71 additions and 71 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ import _ol_asserts_ from '../asserts.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js'; import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import _ol_geom_GeometryCollection_ from '../geom/GeometryCollection.js'; import GeometryCollection from '../geom/GeometryCollection.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.js'; import MultiLineString from '../geom/MultiLineString.js';
import MultiPoint from '../geom/MultiPoint.js'; import MultiPoint from '../geom/MultiPoint.js';
@@ -99,7 +99,7 @@ _ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function(
function(geometry) { function(geometry) {
return _ol_format_GeoJSON_.readGeometry_(geometry, opt_options); return _ol_format_GeoJSON_.readGeometry_(geometry, opt_options);
}); });
return new _ol_geom_GeometryCollection_(geometries); return new GeometryCollection(geometries);
}; };
+4 -4
View File
@@ -14,7 +14,7 @@ import _ol_color_ from '../color.js';
import _ol_format_Feature_ from '../format/Feature.js'; import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_format_XSD_ from '../format/XSD.js'; import _ol_format_XSD_ from '../format/XSD.js';
import _ol_geom_GeometryCollection_ from '../geom/GeometryCollection.js'; import GeometryCollection from '../geom/GeometryCollection.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js'; import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js'; import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
@@ -911,7 +911,7 @@ _ol_format_KML_.readMultiGeometry_ = function(node, objectStack) {
return null; return null;
} }
if (geometries.length === 0) { if (geometries.length === 0) {
return new _ol_geom_GeometryCollection_(geometries); return new GeometryCollection(geometries);
} }
/** @type {ol.geom.Geometry} */ /** @type {ol.geom.Geometry} */
var multiGeometry; var multiGeometry;
@@ -948,12 +948,12 @@ _ol_format_KML_.readMultiGeometry_ = function(node, objectStack) {
multiGeometry.setPolygons(geometries); multiGeometry.setPolygons(geometries);
_ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries); _ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries);
} else if (type == _ol_geom_GeometryType_.GEOMETRY_COLLECTION) { } else if (type == _ol_geom_GeometryType_.GEOMETRY_COLLECTION) {
multiGeometry = new _ol_geom_GeometryCollection_(geometries); multiGeometry = new GeometryCollection(geometries);
} else { } else {
_ol_asserts_.assert(false, 37); // Unknown geometry type found _ol_asserts_.assert(false, 37); // Unknown geometry type found
} }
} else { } else {
multiGeometry = new _ol_geom_GeometryCollection_(geometries); multiGeometry = new GeometryCollection(geometries);
} }
return /** @type {ol.geom.Geometry} */ (multiGeometry); return /** @type {ol.geom.Geometry} */ (multiGeometry);
}; };
+3 -3
View File
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js'; import _ol_format_TextFeature_ from '../format/TextFeature.js';
import _ol_geom_GeometryCollection_ from '../geom/GeometryCollection.js'; import GeometryCollection from '../geom/GeometryCollection.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js'; import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js'; import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
@@ -386,7 +386,7 @@ _ol_format_WKT_.prototype.writeFeaturesText = function(features, opt_options) {
for (var i = 0, ii = features.length; i < ii; ++i) { for (var i = 0, ii = features.length; i < ii; ++i) {
geometries.push(features[i].getGeometry()); geometries.push(features[i].getGeometry());
} }
var collection = new _ol_geom_GeometryCollection_(geometries); var collection = new GeometryCollection(geometries);
return this.writeGeometryText(collection, opt_options); return this.writeGeometryText(collection, opt_options);
}; };
@@ -671,7 +671,7 @@ _ol_format_WKT_.Parser.prototype.parseGeometry_ = function() {
this.layout_ = this.parseGeometryLayout_(); this.layout_ = this.parseGeometryLayout_();
if (geomType == _ol_geom_GeometryType_.GEOMETRY_COLLECTION.toUpperCase()) { if (geomType == _ol_geom_GeometryType_.GEOMETRY_COLLECTION.toUpperCase()) {
var geometries = this.parseGeometryCollectionText_(); var geometries = this.parseGeometryCollectionText_();
return new _ol_geom_GeometryCollection_(geometries); return new GeometryCollection(geometries);
} else { } else {
var parser = _ol_format_WKT_.Parser.GeometryParser_[geomType]; var parser = _ol_format_WKT_.Parser.GeometryParser_[geomType];
var ctor = _ol_format_WKT_.Parser.GeometryConstructor_[geomType]; var ctor = _ol_format_WKT_.Parser.GeometryConstructor_[geomType];
+27 -27
View File
@@ -18,7 +18,7 @@ import _ol_obj_ from '../obj.js';
* @param {Array.<ol.geom.Geometry>=} opt_geometries Geometries. * @param {Array.<ol.geom.Geometry>=} opt_geometries Geometries.
* @api * @api
*/ */
var _ol_geom_GeometryCollection_ = function(opt_geometries) { var GeometryCollection = function(opt_geometries) {
Geometry.call(this); Geometry.call(this);
@@ -31,7 +31,7 @@ var _ol_geom_GeometryCollection_ = function(opt_geometries) {
this.listenGeometriesChange_(); this.listenGeometriesChange_();
}; };
inherits(_ol_geom_GeometryCollection_, Geometry); inherits(GeometryCollection, Geometry);
/** /**
@@ -39,7 +39,7 @@ inherits(_ol_geom_GeometryCollection_, Geometry);
* @private * @private
* @return {Array.<ol.geom.Geometry>} Cloned geometries. * @return {Array.<ol.geom.Geometry>} Cloned geometries.
*/ */
_ol_geom_GeometryCollection_.cloneGeometries_ = function(geometries) { GeometryCollection.cloneGeometries_ = function(geometries) {
var clonedGeometries = []; var clonedGeometries = [];
var i, ii; var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) { for (i = 0, ii = geometries.length; i < ii; ++i) {
@@ -52,7 +52,7 @@ _ol_geom_GeometryCollection_.cloneGeometries_ = function(geometries) {
/** /**
* @private * @private
*/ */
_ol_geom_GeometryCollection_.prototype.unlistenGeometriesChange_ = function() { GeometryCollection.prototype.unlistenGeometriesChange_ = function() {
var i, ii; var i, ii;
if (!this.geometries_) { if (!this.geometries_) {
return; return;
@@ -68,7 +68,7 @@ _ol_geom_GeometryCollection_.prototype.unlistenGeometriesChange_ = function() {
/** /**
* @private * @private
*/ */
_ol_geom_GeometryCollection_.prototype.listenGeometriesChange_ = function() { GeometryCollection.prototype.listenGeometriesChange_ = function() {
var i, ii; var i, ii;
if (!this.geometries_) { if (!this.geometries_) {
return; return;
@@ -87,8 +87,8 @@ _ol_geom_GeometryCollection_.prototype.listenGeometriesChange_ = function() {
* @override * @override
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.clone = function() { GeometryCollection.prototype.clone = function() {
var geometryCollection = new _ol_geom_GeometryCollection_(null); var geometryCollection = new GeometryCollection(null);
geometryCollection.setGeometries(this.geometries_); geometryCollection.setGeometries(this.geometries_);
return geometryCollection; return geometryCollection;
}; };
@@ -97,7 +97,7 @@ _ol_geom_GeometryCollection_.prototype.clone = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_geom_GeometryCollection_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) { GeometryCollection.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
return minSquaredDistance; return minSquaredDistance;
} }
@@ -114,7 +114,7 @@ _ol_geom_GeometryCollection_.prototype.closestPointXY = function(x, y, closestPo
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_geom_GeometryCollection_.prototype.containsXY = function(x, y) { GeometryCollection.prototype.containsXY = function(x, y) {
var geometries = this.geometries_; var geometries = this.geometries_;
var i, ii; var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) { for (i = 0, ii = geometries.length; i < ii; ++i) {
@@ -129,7 +129,7 @@ _ol_geom_GeometryCollection_.prototype.containsXY = function(x, y) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_geom_GeometryCollection_.prototype.computeExtent = function(extent) { GeometryCollection.prototype.computeExtent = function(extent) {
createOrUpdateEmpty(extent); createOrUpdateEmpty(extent);
var geometries = this.geometries_; var geometries = this.geometries_;
for (var i = 0, ii = geometries.length; i < ii; ++i) { for (var i = 0, ii = geometries.length; i < ii; ++i) {
@@ -144,15 +144,15 @@ _ol_geom_GeometryCollection_.prototype.computeExtent = function(extent) {
* @return {Array.<ol.geom.Geometry>} Geometries. * @return {Array.<ol.geom.Geometry>} Geometries.
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.getGeometries = function() { GeometryCollection.prototype.getGeometries = function() {
return _ol_geom_GeometryCollection_.cloneGeometries_(this.geometries_); return GeometryCollection.cloneGeometries_(this.geometries_);
}; };
/** /**
* @return {Array.<ol.geom.Geometry>} Geometries. * @return {Array.<ol.geom.Geometry>} Geometries.
*/ */
_ol_geom_GeometryCollection_.prototype.getGeometriesArray = function() { GeometryCollection.prototype.getGeometriesArray = function() {
return this.geometries_; return this.geometries_;
}; };
@@ -160,7 +160,7 @@ _ol_geom_GeometryCollection_.prototype.getGeometriesArray = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_geom_GeometryCollection_.prototype.getSimplifiedGeometry = function(squaredTolerance) { GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTolerance) {
if (this.simplifiedGeometryRevision != this.getRevision()) { if (this.simplifiedGeometryRevision != this.getRevision()) {
_ol_obj_.clear(this.simplifiedGeometryCache); _ol_obj_.clear(this.simplifiedGeometryCache);
this.simplifiedGeometryMaxMinSquaredTolerance = 0; this.simplifiedGeometryMaxMinSquaredTolerance = 0;
@@ -188,7 +188,7 @@ _ol_geom_GeometryCollection_.prototype.getSimplifiedGeometry = function(squaredT
} }
} }
if (simplified) { if (simplified) {
var simplifiedGeometryCollection = new _ol_geom_GeometryCollection_(null); var simplifiedGeometryCollection = new GeometryCollection(null);
simplifiedGeometryCollection.setGeometriesArray(simplifiedGeometries); simplifiedGeometryCollection.setGeometriesArray(simplifiedGeometries);
this.simplifiedGeometryCache[key] = simplifiedGeometryCollection; this.simplifiedGeometryCache[key] = simplifiedGeometryCollection;
return simplifiedGeometryCollection; return simplifiedGeometryCollection;
@@ -204,7 +204,7 @@ _ol_geom_GeometryCollection_.prototype.getSimplifiedGeometry = function(squaredT
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.getType = function() { GeometryCollection.prototype.getType = function() {
return _ol_geom_GeometryType_.GEOMETRY_COLLECTION; return _ol_geom_GeometryType_.GEOMETRY_COLLECTION;
}; };
@@ -213,7 +213,7 @@ _ol_geom_GeometryCollection_.prototype.getType = function() {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.intersectsExtent = function(extent) { GeometryCollection.prototype.intersectsExtent = function(extent) {
var geometries = this.geometries_; var geometries = this.geometries_;
var i, ii; var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) { for (i = 0, ii = geometries.length; i < ii; ++i) {
@@ -228,7 +228,7 @@ _ol_geom_GeometryCollection_.prototype.intersectsExtent = function(extent) {
/** /**
* @return {boolean} Is empty. * @return {boolean} Is empty.
*/ */
_ol_geom_GeometryCollection_.prototype.isEmpty = function() { GeometryCollection.prototype.isEmpty = function() {
return this.geometries_.length === 0; return this.geometries_.length === 0;
}; };
@@ -237,7 +237,7 @@ _ol_geom_GeometryCollection_.prototype.isEmpty = function() {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.rotate = function(angle, anchor) { GeometryCollection.prototype.rotate = function(angle, anchor) {
var geometries = this.geometries_; var geometries = this.geometries_;
for (var i = 0, ii = geometries.length; i < ii; ++i) { for (var i = 0, ii = geometries.length; i < ii; ++i) {
geometries[i].rotate(angle, anchor); geometries[i].rotate(angle, anchor);
@@ -250,7 +250,7 @@ _ol_geom_GeometryCollection_.prototype.rotate = function(angle, anchor) {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.scale = function(sx, opt_sy, opt_anchor) { GeometryCollection.prototype.scale = function(sx, opt_sy, opt_anchor) {
var anchor = opt_anchor; var anchor = opt_anchor;
if (!anchor) { if (!anchor) {
anchor = getCenter(this.getExtent()); anchor = getCenter(this.getExtent());
@@ -268,16 +268,16 @@ _ol_geom_GeometryCollection_.prototype.scale = function(sx, opt_sy, opt_anchor)
* @param {Array.<ol.geom.Geometry>} geometries Geometries. * @param {Array.<ol.geom.Geometry>} geometries Geometries.
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.setGeometries = function(geometries) { GeometryCollection.prototype.setGeometries = function(geometries) {
this.setGeometriesArray( this.setGeometriesArray(
_ol_geom_GeometryCollection_.cloneGeometries_(geometries)); GeometryCollection.cloneGeometries_(geometries));
}; };
/** /**
* @param {Array.<ol.geom.Geometry>} geometries Geometries. * @param {Array.<ol.geom.Geometry>} geometries Geometries.
*/ */
_ol_geom_GeometryCollection_.prototype.setGeometriesArray = function(geometries) { GeometryCollection.prototype.setGeometriesArray = function(geometries) {
this.unlistenGeometriesChange_(); this.unlistenGeometriesChange_();
this.geometries_ = geometries; this.geometries_ = geometries;
this.listenGeometriesChange_(); this.listenGeometriesChange_();
@@ -289,7 +289,7 @@ _ol_geom_GeometryCollection_.prototype.setGeometriesArray = function(geometries)
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.applyTransform = function(transformFn) { GeometryCollection.prototype.applyTransform = function(transformFn) {
var geometries = this.geometries_; var geometries = this.geometries_;
var i, ii; var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) { for (i = 0, ii = geometries.length; i < ii; ++i) {
@@ -306,7 +306,7 @@ _ol_geom_GeometryCollection_.prototype.applyTransform = function(transformFn) {
* @override * @override
* @api * @api
*/ */
_ol_geom_GeometryCollection_.prototype.translate = function(deltaX, deltaY) { GeometryCollection.prototype.translate = function(deltaX, deltaY) {
var geometries = this.geometries_; var geometries = this.geometries_;
var i, ii; var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) { for (i = 0, ii = geometries.length; i < ii; ++i) {
@@ -319,8 +319,8 @@ _ol_geom_GeometryCollection_.prototype.translate = function(deltaX, deltaY) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_geom_GeometryCollection_.prototype.disposeInternal = function() { GeometryCollection.prototype.disposeInternal = function() {
this.unlistenGeometriesChange_(); this.unlistenGeometriesChange_();
Geometry.prototype.disposeInternal.call(this); Geometry.prototype.disposeInternal.call(this);
}; };
export default _ol_geom_GeometryCollection_; export default GeometryCollection;
+5 -5
View File
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js';
import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
import Circle from '../../../../src/ol/geom/Circle.js'; import Circle from '../../../../src/ol/geom/Circle.js';
import _ol_geom_GeometryCollection_ from '../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js'; import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
@@ -414,7 +414,7 @@ describe('ol.format.GeoJSON', function() {
}); });
var geometryCollection = format.readGeometry(str); var geometryCollection = format.readGeometry(str);
expect(geometryCollection).to.be.an(_ol_geom_GeometryCollection_); expect(geometryCollection).to.be.an(GeometryCollection);
var array = geometryCollection.getGeometries(); var array = geometryCollection.getGeometries();
expect(array.length).to.be(2); expect(array.length).to.be(2);
expect(array[0]).to.be.a(Point); expect(array[0]).to.be.a(Point);
@@ -729,13 +729,13 @@ describe('ol.format.GeoJSON', function() {
}); });
it('encodes geometry collection', function() { it('encodes geometry collection', function() {
var collection = new _ol_geom_GeometryCollection_([ var collection = new GeometryCollection([
new Point([10, 20]), new Point([10, 20]),
new LineString([[30, 40], [50, 60]]) new LineString([[30, 40], [50, 60]])
]); ]);
var geojson = format.writeGeometry(collection); var geojson = format.writeGeometry(collection);
var got = format.readGeometry(geojson); var got = format.readGeometry(geojson);
expect(got).to.be.an(_ol_geom_GeometryCollection_); expect(got).to.be.an(GeometryCollection);
var gotGeometries = got.getGeometries(); var gotGeometries = got.getGeometries();
var geometries = collection.getGeometries(); var geometries = collection.getGeometries();
expect(geometries.length).to.equal(gotGeometries.length); expect(geometries.length).to.equal(gotGeometries.length);
@@ -770,7 +770,7 @@ describe('ol.format.GeoJSON', function() {
}); });
it('transforms and encodes geometry collection', function() { it('transforms and encodes geometry collection', function() {
var collection = new _ol_geom_GeometryCollection_([ var collection = new GeometryCollection([
new Point([2, 3]), new Point([2, 3]),
new LineString([[3, 2], [2, 1]]) new LineString([[3, 2], [2, 1]])
]); ]);
+9 -9
View File
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_array_ from '../../../../src/ol/array.js'; import _ol_array_ from '../../../../src/ol/array.js';
import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
import _ol_format_KML_ from '../../../../src/ol/format/KML.js'; import _ol_format_KML_ from '../../../../src/ol/format/KML.js';
import _ol_geom_GeometryCollection_ from '../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js'; import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
@@ -1144,7 +1144,7 @@ describe('ol.format.KML', function() {
var f = fs[0]; var f = fs[0];
expect(f).to.be.an(_ol_Feature_); expect(f).to.be.an(_ol_Feature_);
var g = f.getGeometry(); var g = f.getGeometry();
expect(g).to.be.an(_ol_geom_GeometryCollection_); expect(g).to.be.an(GeometryCollection);
expect(g.getGeometries()).to.be.empty(); expect(g.getGeometries()).to.be.empty();
}); });
@@ -1177,7 +1177,7 @@ describe('ol.format.KML', function() {
var f = fs[0]; var f = fs[0];
expect(f).to.be.an(_ol_Feature_); expect(f).to.be.an(_ol_Feature_);
var g = f.getGeometry(); var g = f.getGeometry();
expect(g).to.be.an(_ol_geom_GeometryCollection_); expect(g).to.be.an(GeometryCollection);
var gs = g.getGeometries(); var gs = g.getGeometries();
expect(gs).to.have.length(4); expect(gs).to.have.length(4);
expect(gs[0]).to.be.an(Point); expect(gs[0]).to.be.an(Point);
@@ -1201,14 +1201,14 @@ describe('ol.format.KML', function() {
var f = fs[0]; var f = fs[0];
expect(f).to.be.an(_ol_Feature_); expect(f).to.be.an(_ol_Feature_);
var g = f.getGeometry(); var g = f.getGeometry();
expect(g).to.be.an(_ol_geom_GeometryCollection_); expect(g).to.be.an(GeometryCollection);
var gs = g.getGeometries(); var gs = g.getGeometries();
expect(gs).to.have.length(1); expect(gs).to.have.length(1);
expect(gs[0]).to.be.an(_ol_geom_GeometryCollection_); expect(gs[0]).to.be.an(GeometryCollection);
}); });
it('can write GeometryCollection geometries', function() { it('can write GeometryCollection geometries', function() {
var collection = new _ol_geom_GeometryCollection_([ var collection = new GeometryCollection([
new Point([1, 2]), new Point([1, 2]),
new LineString([[1, 2], [3, 4]]), new LineString([[1, 2], [3, 4]]),
new Polygon([[[1, 2], [3, 4], [3, 2], [1, 2]]]) new Polygon([[[1, 2], [3, 4], [3, 2], [1, 2]]])
@@ -3112,7 +3112,7 @@ describe('ol.format.KML', function() {
var f = fs[0]; var f = fs[0];
expect(f).to.be.an(_ol_Feature_); expect(f).to.be.an(_ol_Feature_);
var g = f.getGeometry(); var g = f.getGeometry();
expect(g).to.be.an(_ol_geom_GeometryCollection_); expect(g).to.be.an(GeometryCollection);
expect(g.getGeometries()).to.be.empty(); expect(g.getGeometries()).to.be.empty();
}); });
@@ -3186,7 +3186,7 @@ describe('ol.format.KML', function() {
var feature = features[0]; var feature = features[0];
expect(feature).to.be.an(_ol_Feature_); expect(feature).to.be.an(_ol_Feature_);
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
expect(geometry).to.be.an(_ol_geom_GeometryCollection_); expect(geometry).to.be.an(GeometryCollection);
}); });
it('creates a Point and a MultiPolygon for Alaska', function() { it('creates a Point and a MultiPolygon for Alaska', function() {
@@ -3195,7 +3195,7 @@ describe('ol.format.KML', function() {
}); });
expect(alaska).to.be.an(_ol_Feature_); expect(alaska).to.be.an(_ol_Feature_);
var geometry = alaska.getGeometry(); var geometry = alaska.getGeometry();
expect(geometry).to.be.an(_ol_geom_GeometryCollection_); expect(geometry).to.be.an(GeometryCollection);
var components = geometry.getGeometries(); var components = geometry.getGeometries();
expect(components).to.have.length(2); expect(components).to.have.length(2);
expect(components[0]).to.be.an(Point); expect(components[0]).to.be.an(Point);
+13 -13
View File
@@ -1,5 +1,5 @@
import Geometry from '../../../../src/ol/geom/Geometry.js'; import Geometry from '../../../../src/ol/geom/Geometry.js';
import _ol_geom_GeometryCollection_ from '../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js';
@@ -17,11 +17,11 @@ describe('ol.geom.GeometryCollection', function() {
point = new Point([10, 20]); point = new Point([10, 20]);
line = new LineString([[10, 20], [30, 40]]); line = new LineString([[10, 20], [30, 40]]);
poly = new Polygon([outer, inner1, inner2]); poly = new Polygon([outer, inner1, inner2]);
multi = new _ol_geom_GeometryCollection_([point, line, poly]); multi = new GeometryCollection([point, line, poly]);
}); });
it('creates a geometry collection from an array of geometries', function() { it('creates a geometry collection from an array of geometries', function() {
expect(multi).to.be.a(_ol_geom_GeometryCollection_); expect(multi).to.be.a(GeometryCollection);
expect(multi).to.be.a(Geometry); expect(multi).to.be.a(Geometry);
}); });
@@ -59,7 +59,7 @@ describe('ol.geom.GeometryCollection', function() {
var point = new Point([10, 20]); var point = new Point([10, 20]);
var line = new LineString([[10, 20], [30, 40]]); var line = new LineString([[10, 20], [30, 40]]);
var poly = new Polygon([outer, inner1, inner2]); var poly = new Polygon([outer, inner1, inner2]);
var multi = new _ol_geom_GeometryCollection_([point, line, poly]); var multi = new GeometryCollection([point, line, poly]);
var geometries = multi.getGeometries(); var geometries = multi.getGeometries();
expect(geometries).to.be.an(Array); expect(geometries).to.be.an(Array);
@@ -77,7 +77,7 @@ describe('ol.geom.GeometryCollection', function() {
var point = new Point([10, 20]); var point = new Point([10, 20]);
var line = new LineString([[10, 20], [30, 40]]); var line = new LineString([[10, 20], [30, 40]]);
var poly = new Polygon([outer, inner1, inner2]); var poly = new Polygon([outer, inner1, inner2]);
var multi = new _ol_geom_GeometryCollection_([point, line, poly]); var multi = new GeometryCollection([point, line, poly]);
var clone = multi.clone(); var clone = multi.clone();
expect(clone).to.not.be(multi); expect(clone).to.not.be(multi);
var geometries = clone.getGeometries(); var geometries = clone.getGeometries();
@@ -89,7 +89,7 @@ describe('ol.geom.GeometryCollection', function() {
it('does a deep clone', function() { it('does a deep clone', function() {
var point = new Point([30, 40]); var point = new Point([30, 40]);
var originalGeometries = [point]; var originalGeometries = [point];
var multi = new _ol_geom_GeometryCollection_(originalGeometries); var multi = new GeometryCollection(originalGeometries);
var clone = multi.clone(); var clone = multi.clone();
var clonedGeometries = clone.getGeometries(); var clonedGeometries = clone.getGeometries();
expect(clonedGeometries).not.to.be(originalGeometries); expect(clonedGeometries).not.to.be(originalGeometries);
@@ -107,7 +107,7 @@ describe('ol.geom.GeometryCollection', function() {
it('returns the bounding extent', function() { it('returns the bounding extent', function() {
var point = new Point([10, 2]); var point = new Point([10, 2]);
var line = new LineString([[1, 20], [30, 40]]); var line = new LineString([[1, 20], [30, 40]]);
var multi = new _ol_geom_GeometryCollection_([point, line]); var multi = new GeometryCollection([point, line]);
var extent = multi.getExtent(); var extent = multi.getExtent();
expect(extent[0]).to.be(1); expect(extent[0]).to.be(1);
expect(extent[2]).to.be(30); expect(extent[2]).to.be(30);
@@ -125,7 +125,7 @@ describe('ol.geom.GeometryCollection', function() {
point = new Point([5, 20]); point = new Point([5, 20]);
line = new LineString([[10, 20], [30, 40]]); line = new LineString([[10, 20], [30, 40]]);
poly = new Polygon([outer, inner1, inner2]); poly = new Polygon([outer, inner1, inner2]);
multi = new _ol_geom_GeometryCollection_([point, line, poly]); multi = new GeometryCollection([point, line, poly]);
}); });
it('returns true for intersecting point', function() { it('returns true for intersecting point', function() {
@@ -154,7 +154,7 @@ describe('ol.geom.GeometryCollection', function() {
point = new Point([10, 20]); point = new Point([10, 20]);
line = new LineString([[10, 20], [30, 40]]); line = new LineString([[10, 20], [30, 40]]);
poly = new Polygon([outer, inner1, inner2]); poly = new Polygon([outer, inner1, inner2]);
multi = new _ol_geom_GeometryCollection_([point, line, poly]); multi = new GeometryCollection([point, line, poly]);
}); });
it('fires a change event', function() { it('fires a change event', function() {
@@ -175,7 +175,7 @@ describe('ol.geom.GeometryCollection', function() {
describe('#scale()', function() { describe('#scale()', function() {
it('scales a collection', function() { it('scales a collection', function() {
var geom = new _ol_geom_GeometryCollection_([ var geom = new GeometryCollection([
new Point([-1, -2]), new Point([-1, -2]),
new LineString([[0, 0], [1, 2]]) new LineString([[0, 0], [1, 2]])
]); ]);
@@ -186,7 +186,7 @@ describe('ol.geom.GeometryCollection', function() {
}); });
it('accepts sx and sy', function() { it('accepts sx and sy', function() {
var geom = new _ol_geom_GeometryCollection_([ var geom = new GeometryCollection([
new Point([-1, -2]), new Point([-1, -2]),
new LineString([[0, 0], [1, 2]]) new LineString([[0, 0], [1, 2]])
]); ]);
@@ -197,7 +197,7 @@ describe('ol.geom.GeometryCollection', function() {
}); });
it('accepts an anchor', function() { it('accepts an anchor', function() {
var geom = new _ol_geom_GeometryCollection_([ var geom = new GeometryCollection([
new Point([-1, -2]), new Point([-1, -2]),
new LineString([[0, 0], [1, 2]]) new LineString([[0, 0], [1, 2]])
]); ]);
@@ -215,7 +215,7 @@ describe('ol.geom.GeometryCollection', function() {
beforeEach(function() { beforeEach(function() {
point = new Point([10, 20]); point = new Point([10, 20]);
line = new LineString([[10, 20], [30, 40]]); line = new LineString([[10, 20], [30, 40]]);
multi = new _ol_geom_GeometryCollection_([point, line]); multi = new GeometryCollection([point, line]);
}); });
it('transforms all geometries', function() { it('transforms all geometries', function() {
+2 -2
View File
@@ -1,5 +1,5 @@
import Circle from '../../../../../src/ol/geom/Circle.js'; import Circle from '../../../../../src/ol/geom/Circle.js';
import _ol_geom_GeometryCollection_ from '../../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../../src/ol/geom/LineString.js'; import LineString from '../../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js'; import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
@@ -138,7 +138,7 @@ describe('ol.render.canvas.Immediate', function() {
var linestring = new LineString([[1, 2], [3, 4]]); var linestring = new LineString([[1, 2], [3, 4]]);
var polygon = new Polygon([[[1, 2], [3, 4], [5, 6], [1, 2]]]); var polygon = new Polygon([[[1, 2], [3, 4], [5, 6], [1, 2]]]);
var geometry = new _ol_geom_GeometryCollection_([point, linestring, polygon]); var geometry = new GeometryCollection([point, linestring, polygon]);
context.drawGeometry(geometry); context.drawGeometry(geometry);
expect(context.drawGeometryCollection.calledOnce).to.be(true); expect(context.drawGeometryCollection.calledOnce).to.be(true);
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Circle from '../../../../../src/ol/geom/Circle.js'; import Circle from '../../../../../src/ol/geom/Circle.js';
import _ol_geom_GeometryCollection_ from '../../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../../src/ol/geom/LineString.js'; import LineString from '../../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js'; import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
@@ -86,7 +86,7 @@ describe('ol.render.webgl.Immediate', function() {
describe('#drawGeometryCollection', function() { describe('#drawGeometryCollection', function() {
var geomColl; var geomColl;
beforeEach(function() { beforeEach(function() {
geomColl = new _ol_geom_GeometryCollection_([circle, point, multiPoint, geomColl = new GeometryCollection([circle, point, multiPoint,
line, multiLine, polygon, multiPolygon]); line, multiLine, polygon, multiPolygon]);
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import {getUid} from '../../../../../src/ol/index.js'; import {getUid} from '../../../../../src/ol/index.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import _ol_geom_GeometryCollection_ from '../../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../../src/ol/geom/LineString.js'; import LineString from '../../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js'; import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
@@ -239,7 +239,7 @@ describe('ol.render.canvas.ReplayGroup', function() {
var polygon = feature1; var polygon = feature1;
var multipolygon = new _ol_Feature_(new MultiPolygon( var multipolygon = new _ol_Feature_(new MultiPolygon(
[polygon.getGeometry().getCoordinates(), polygon.getGeometry().getCoordinates()])); [polygon.getGeometry().getCoordinates(), polygon.getGeometry().getCoordinates()]));
var geometrycollection = new _ol_Feature_(new _ol_geom_GeometryCollection_( var geometrycollection = new _ol_Feature_(new GeometryCollection(
[point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()])); [point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()]));
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, true); replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, true);
_ol_renderer_vector_.renderFeature(replay, point, style, 1); _ol_renderer_vector_.renderFeature(replay, point, style, 1);
+2 -2
View File
@@ -4,7 +4,7 @@
import _ol_Sphere_ from '../../../src/ol/Sphere.js'; import _ol_Sphere_ from '../../../src/ol/Sphere.js';
import _ol_format_WKT_ from '../../../src/ol/format/WKT.js'; import _ol_format_WKT_ from '../../../src/ol/format/WKT.js';
import _ol_geom_GeometryCollection_ from '../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../src/ol/geom/LineString.js'; import LineString from '../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../src/ol/geom/MultiLineString.js';
import MultiPoint from '../../../src/ol/geom/MultiPoint.js'; import MultiPoint from '../../../src/ol/geom/MultiPoint.js';
@@ -154,7 +154,7 @@ describe('ol.Sphere.getLength()', function() {
options: {projection: 'EPSG:4326'}, options: {projection: 'EPSG:4326'},
length: 2 * 4407939.124914191 length: 2 * 4407939.124914191
}, { }, {
geometry: new _ol_geom_GeometryCollection_([ geometry: new GeometryCollection([
new LineString([ new LineString([
[115, -32], [115, -32],
[131, -22], [131, -22],