Rename _ol_Feature_ to Feature

This commit is contained in:
Tim Schaub
2018-01-08 09:35:02 -07:00
parent 6934e148ca
commit 22fce4f97b
79 changed files with 630 additions and 630 deletions

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../src/ol/Feature.js';
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import _ol_obj_ from '../../../src/ol/obj.js';
import _ol_style_Style_ from '../../../src/ol/style/Style.js';
@@ -9,25 +9,25 @@ describe('ol.Feature', function() {
describe('constructor', function() {
it('creates a new feature', function() {
var feature = new _ol_Feature_();
expect(feature).to.be.a(_ol_Feature_);
var feature = new Feature();
expect(feature).to.be.a(Feature);
});
it('takes properties', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
foo: 'bar'
});
expect(feature.get('foo')).to.be('bar');
});
it('can store the feature\'s commonly used id', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
expect(feature.getId()).to.be('foo');
});
it('will set the default geometry', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new Point([10, 20]),
foo: 'bar'
});
@@ -41,7 +41,7 @@ describe('ol.Feature', function() {
describe('#get()', function() {
it('returns values set at construction', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
a: 'first',
b: 'second'
});
@@ -50,12 +50,12 @@ describe('ol.Feature', function() {
});
it('returns undefined for unset attributes', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
expect(feature.get('a')).to.be(undefined);
});
it('returns values set by set', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('a', 'b');
expect(feature.get('a')).to.be('b');
});
@@ -66,7 +66,7 @@ describe('ol.Feature', function() {
it('returns an object with all attributes', function() {
var point = new Point([15, 30]);
var feature = new _ol_Feature_({
var feature = new Feature({
foo: 'bar',
ten: 10,
geometry: point
@@ -83,7 +83,7 @@ describe('ol.Feature', function() {
});
it('is empty by default', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
var properties = feature.getProperties();
expect(_ol_obj_.isEmpty(properties)).to.be(true);
});
@@ -96,30 +96,30 @@ describe('ol.Feature', function() {
var point = new Point([15, 30]);
it('returns undefined for unset geometry', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
expect(feature.getGeometry()).to.be(undefined);
});
it('returns null for null geometry (constructor)', function() {
var feature = new _ol_Feature_(null);
var feature = new Feature(null);
expect(feature.getGeometry()).to.be(null);
});
it('returns null for null geometry (setGeometry())', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometry(null);
expect(feature.getGeometry()).to.be(null);
});
it('gets the geometry set at construction', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: point
});
expect(feature.getGeometry()).to.be(point);
});
it('gets any geometry set by setGeometry', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometry(point);
expect(feature.getGeometry()).to.be(point);
@@ -133,7 +133,7 @@ describe('ol.Feature', function() {
describe('#set()', function() {
it('sets values', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
a: 'first',
b: 'second'
});
@@ -143,7 +143,7 @@ describe('ol.Feature', function() {
it('can be used to set the geometry', function() {
var point = new Point([3, 4]);
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new Point([1, 2])
});
feature.set('geometry', point);
@@ -153,7 +153,7 @@ describe('ol.Feature', function() {
it('can be used to set attributes with arbitrary names', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('toString', 'string');
expect(feature.get('toString')).to.be('string');
@@ -174,13 +174,13 @@ describe('ol.Feature', function() {
var point = new Point([15, 30]);
it('sets the default geometry', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometry(point);
expect(feature.get('geometry')).to.be(point);
});
it('replaces previous default geometry', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: point
});
expect(feature.getGeometry()).to.be(point);
@@ -197,7 +197,7 @@ describe('ol.Feature', function() {
var point = new Point([15, 30]);
it('sets property where to to look at geometry', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometry(point);
expect(feature.getGeometry()).to.be(point);
@@ -214,7 +214,7 @@ describe('ol.Feature', function() {
});
it('changes property listener', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometry(point);
var point2 = new Point([1, 2]);
feature.set('altGeometry', point2);
@@ -227,7 +227,7 @@ describe('ol.Feature', function() {
});
it('can use a different geometry name', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometryName('foo');
var point = new Point([10, 20]);
feature.setGeometry(point);
@@ -239,14 +239,14 @@ describe('ol.Feature', function() {
describe('#setId()', function() {
it('sets the feature identifier', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
expect(feature.getId()).to.be(undefined);
feature.setId('foo');
expect(feature.getId()).to.be('foo');
});
it('accepts a string or number', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
expect(feature.getId()).to.be('foo');
feature.setId(2);
@@ -254,7 +254,7 @@ describe('ol.Feature', function() {
});
it('dispatches the "change" event', function(done) {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.on('change', function() {
expect(feature.getId()).to.be('foo');
done();
@@ -271,24 +271,24 @@ describe('ol.Feature', function() {
};
it('returns undefined after construction', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
expect(feature.getStyleFunction()).to.be(undefined);
});
it('returns the function passed to setStyle', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle(styleFunction);
expect(feature.getStyleFunction()).to.be(styleFunction);
});
it('does not get confused with user "styleFunction" property', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('styleFunction', 'foo');
expect(feature.getStyleFunction()).to.be(undefined);
});
it('does not get confused with "styleFunction" option', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
styleFunction: 'foo'
});
expect(feature.getStyleFunction()).to.be(undefined);
@@ -305,21 +305,21 @@ describe('ol.Feature', function() {
};
it('accepts a single style', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle(style);
var func = feature.getStyleFunction();
expect(func()).to.eql([style]);
});
it('accepts an array of styles', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle([style]);
var func = feature.getStyleFunction();
expect(func()).to.eql([style]);
});
it('accepts a style function', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
function featureStyleFunction(resolution) {
return styleFunction(this, resolution);
}
@@ -329,14 +329,14 @@ describe('ol.Feature', function() {
});
it('accepts a layer style function', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle(styleFunction);
expect(feature.getStyleFunction()).to.not.be(styleFunction);
expect(feature.getStyleFunction()(42)).to.be(42);
});
it('accepts null', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle(style);
feature.setStyle(null);
expect(feature.getStyle()).to.be(null);
@@ -344,7 +344,7 @@ describe('ol.Feature', function() {
});
it('dispatches a change event', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
var spy = sinon.spy();
feature.on('change', spy);
feature.setStyle(style);
@@ -362,7 +362,7 @@ describe('ol.Feature', function() {
};
it('returns what is passed to setStyle', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
expect(feature.getStyle()).to.be(null);
@@ -378,7 +378,7 @@ describe('ol.Feature', function() {
});
it('does not get confused with "style" option to constructor', function() {
var feature = new _ol_Feature_({
var feature = new Feature({
style: 'foo'
});
@@ -386,7 +386,7 @@ describe('ol.Feature', function() {
});
it('does not get confused with user set "style" property', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('style', 'foo');
expect(feature.getStyle()).to.be(null);
@@ -397,7 +397,7 @@ describe('ol.Feature', function() {
describe('#clone', function() {
it('correctly clones features', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setProperties({'fookey': 'fooval'});
feature.setId(1);
feature.setGeometryName('geom');
@@ -421,7 +421,7 @@ describe('ol.Feature', function() {
});
it('correctly clones features with no geometry and no style', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('fookey', 'fooval');
var clone = feature.clone();
@@ -435,7 +435,7 @@ describe('ol.Feature', function() {
it('dispatches a change event when geometry is set to null',
function() {
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new Point([0, 0])
});
var spy = sinon.spy();
@@ -451,12 +451,12 @@ describe('ol.Feature.createStyleFunction()', function() {
var style = new _ol_style_Style_();
it('creates a feature style function from a single style', function() {
var styleFunction = _ol_Feature_.createStyleFunction(style);
var styleFunction = Feature.createStyleFunction(style);
expect(styleFunction()).to.eql([style]);
});
it('creates a feature style function from an array of styles', function() {
var styleFunction = _ol_Feature_.createStyleFunction([style]);
var styleFunction = Feature.createStyleFunction([style]);
expect(styleFunction()).to.eql([style]);
});
@@ -464,13 +464,13 @@ describe('ol.Feature.createStyleFunction()', function() {
var original = function() {
return [style];
};
var styleFunction = _ol_Feature_.createStyleFunction(original);
var styleFunction = Feature.createStyleFunction(original);
expect(styleFunction).to.be(original);
});
it('throws on (some) unexpected input', function() {
expect(function() {
_ol_Feature_.createStyleFunction({bogus: 'input'});
Feature.createStyleFunction({bogus: 'input'});
}).to.throwException();
});

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js';
import EsriJSON from '../../../../src/ol/format/EsriJSON.js';
import LineString from '../../../../src/ol/geom/LineString.js';
@@ -161,7 +161,7 @@ describe('ol.format.EsriJSON', function() {
it('can read a single point feature', function() {
var feature = format.readFeature(pointEsriJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(Point);
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
@@ -170,7 +170,7 @@ describe('ol.format.EsriJSON', function() {
it('can read a single multipoint feature', function() {
var feature = format.readFeature(multiPointEsriJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(MultiPoint);
expect(geometry.getCoordinates()).to.eql([[102.0, 0.0], [103.0, 1.0]]);
@@ -179,7 +179,7 @@ describe('ol.format.EsriJSON', function() {
it('can read a single line string feature', function() {
var feature = format.readFeature(lineStringEsriJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(LineString);
expect(geometry.getCoordinates()).to.eql(
@@ -190,7 +190,7 @@ describe('ol.format.EsriJSON', function() {
it('can read a multi line string feature', function() {
var feature = format.readFeature(multiLineStringEsriJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(MultiLineString);
expect(geometry.getCoordinates()).to.eql([
@@ -203,7 +203,7 @@ describe('ol.format.EsriJSON', function() {
it('can read a single polygon feature', function() {
var feature = format.readFeature(polygonEsriJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(Polygon);
expect(geometry.getCoordinates()).to.eql([[
@@ -215,7 +215,7 @@ describe('ol.format.EsriJSON', function() {
it('can read a multi polygon feature', function() {
var feature = format.readFeature(multiPolygonEsriJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(MultiPolygon);
expect(geometry.getCoordinates()).to.eql([
@@ -282,13 +282,13 @@ describe('ol.format.EsriJSON', function() {
expect(array.length).to.be(2);
var first = array[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('LINK_ID')).to.be(573730499);
var firstGeom = first.getGeometry();
expect(firstGeom).to.be.a(LineString);
var second = array[1];
expect(second).to.be.a(_ol_Feature_);
expect(second).to.be.a(Feature);
expect(second.get('ST_NAME')).to.be('BRUNNSGATAN');
var secondGeom = second.getGeometry();
expect(secondGeom).to.be.a(LineString);
@@ -300,7 +300,7 @@ describe('ol.format.EsriJSON', function() {
expect(result.length).to.be(9);
var first = result[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('field_name')).to.be('EUDORA');
expect(first.getId()).to.be(6406);
var firstGeom = first.getGeometry();
@@ -311,7 +311,7 @@ describe('ol.format.EsriJSON', function() {
])).to.be(true);
var last = result[8];
expect(last).to.be.a(_ol_Feature_);
expect(last).to.be.a(Feature);
expect(last.get('field_name')).to.be('FEAGINS');
expect(last.getId()).to.be(6030);
var lastGeom = last.getGeometry();
@@ -744,12 +744,12 @@ describe('ol.format.EsriJSON', function() {
expect(features.length).to.be(2);
var first = features[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('foo')).to.be('bar');
expect(first.getGeometry()).to.be.a(Point);
var second = features[1];
expect(second).to.be.a(_ol_Feature_);
expect(second).to.be.a(Feature);
expect(second.get('bam')).to.be('baz');
expect(second.getGeometry()).to.be.a(LineString);
@@ -1048,7 +1048,7 @@ describe('ol.format.EsriJSON', function() {
it('writes out a feature with a different geometryName correctly',
function() {
var feature = new _ol_Feature_({'foo': 'bar'});
var feature = new Feature({'foo': 'bar'});
feature.setGeometryName('mygeom');
feature.setGeometry(new Point([5, 10]));
var esrijson = format.writeFeaturesObject([feature]);
@@ -1056,7 +1056,7 @@ describe('ol.format.EsriJSON', function() {
});
it('writes out a feature without properties correctly', function() {
var feature = new _ol_Feature_(new Point([5, 10]));
var feature = new Feature(new Point([5, 10]));
var esrijson = format.writeFeatureObject(feature);
expect(esrijson.attributes).to.eql({});
});

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js';
import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
import Circle from '../../../../src/ol/geom/Circle.js';
@@ -145,7 +145,7 @@ describe('ol.format.GeoJSON', function() {
it('can read a single point feature', function() {
var feature = format.readFeature(pointGeoJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(Point);
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
@@ -154,7 +154,7 @@ describe('ol.format.GeoJSON', function() {
it('can read a single point geometry as a feature', function() {
var feature = format.readFeature(pointGeoJSON.geometry);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(Point);
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
@@ -162,7 +162,7 @@ describe('ol.format.GeoJSON', function() {
it('can read a single line string feature', function() {
var feature = format.readFeature(lineStringGeoJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(LineString);
expect(geometry.getCoordinates()).to.eql(
@@ -173,7 +173,7 @@ describe('ol.format.GeoJSON', function() {
it('can read a single polygon feature', function() {
var feature = format.readFeature(polygonGeoJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(Polygon);
expect(geometry.getCoordinates()).to.eql([[
@@ -185,7 +185,7 @@ describe('ol.format.GeoJSON', function() {
it('can read a feature with null geometry', function() {
var feature = format.readFeature(nullGeometryGeoJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.eql(null);
expect(feature.get('prop0')).to.be('value0');
@@ -193,7 +193,7 @@ describe('ol.format.GeoJSON', function() {
it('can read a feature with id equal to 0', function() {
var feature = format.readFeature(zeroIdGeoJSON);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
expect(feature.getId()).to.be(0);
});
@@ -271,13 +271,13 @@ describe('ol.format.GeoJSON', function() {
expect(array.length).to.be(2);
var first = array[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('LINK_ID')).to.be(573730499);
var firstGeom = first.getGeometry();
expect(firstGeom).to.be.a(LineString);
var second = array[1];
expect(second).to.be.a(_ol_Feature_);
expect(second).to.be.a(Feature);
expect(second.get('ST_NAME')).to.be('BRUNNSGATAN');
var secondGeom = second.getGeometry();
expect(secondGeom).to.be.a(LineString);
@@ -297,7 +297,7 @@ describe('ol.format.GeoJSON', function() {
expect(result.length).to.be(179);
var first = result[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('name')).to.be('Afghanistan');
expect(first.getId()).to.be('AFG');
var firstGeom = first.getGeometry();
@@ -307,7 +307,7 @@ describe('ol.format.GeoJSON', function() {
.to.be(true);
var last = result[178];
expect(last).to.be.a(_ol_Feature_);
expect(last).to.be.a(Feature);
expect(last.get('name')).to.be('Zimbabwe');
expect(last.getId()).to.be('ZWE');
var lastGeom = last.getGeometry();
@@ -338,7 +338,7 @@ describe('ol.format.GeoJSON', function() {
expect(features.length).to.be(1);
var first = features[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('bam')).to.be('baz');
expect(first.getGeometry()).to.be.a(LineString);
@@ -462,12 +462,12 @@ describe('ol.format.GeoJSON', function() {
expect(features.length).to.be(2);
var first = features[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('foo')).to.be('bar');
expect(first.getGeometry()).to.be.a(Point);
var second = features[1];
expect(second).to.be.a(_ol_Feature_);
expect(second).to.be.a(Feature);
expect(second.get('bam')).to.be('baz');
expect(second.getGeometry()).to.be.a(LineString);
@@ -505,12 +505,12 @@ describe('ol.format.GeoJSON', function() {
expect(features.length).to.be(2);
var first = features[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
expect(first.get('foo')).to.be('bar');
expect(first.getGeometry()).to.be.a(Point);
var second = features[1];
expect(second).to.be.a(_ol_Feature_);
expect(second).to.be.a(Feature);
expect(second.get('bam')).to.be('baz');
expect(second.getGeometry()).to.be.a(LineString);
@@ -560,7 +560,7 @@ describe('ol.format.GeoJSON', function() {
it('writes out a feature with a different geometryName correctly',
function() {
var feature = new _ol_Feature_({'foo': 'bar'});
var feature = new Feature({'foo': 'bar'});
feature.setGeometryName('mygeom');
feature.setGeometry(new Point([5, 10]));
var geojson = format.writeFeaturesObject([feature]);
@@ -568,19 +568,19 @@ describe('ol.format.GeoJSON', function() {
});
it('writes out a feature without properties correctly', function() {
var feature = new _ol_Feature_(new Point([5, 10]));
var feature = new Feature(new Point([5, 10]));
var geojson = format.writeFeatureObject(feature);
expect(geojson.properties).to.eql(null);
});
it('writes out a feature without geometry correctly', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
var geojson = format.writeFeatureObject(feature);
expect(geojson.geometry).to.eql(null);
});
it('writes out a feature with id equal to 0 correctly', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId(0);
var geojson = format.writeFeatureObject(feature);
expect(geojson.id).to.eql(0);

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import _ol_format_GML_ from '../../../../src/ol/format/GML.js';
import GML2 from '../../../../src/ol/format/GML2.js';
import LineString from '../../../../src/ol/geom/LineString.js';
@@ -163,7 +163,7 @@ describe('ol.format.GML2', function() {
' </geometry>' +
' </layer>';
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new LineString([[1.1, 2], [3, 4.2]])
});
feature.setId(1);
@@ -194,7 +194,7 @@ describe('ol.format.GML2', function() {
' </geometry>' +
' </layer>';
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new Polygon([[[1.1, 2], [3, 4.2], [5.2, 6]]])
});
feature.setId(1);
@@ -221,7 +221,7 @@ describe('ol.format.GML2', function() {
' </geometry>' +
' </layer>';
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new Point([1.1, 2])
});
feature.setId(1);
@@ -252,7 +252,7 @@ describe('ol.format.GML2', function() {
' </geometry>' +
' </layer>';
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new MultiPoint([[1.1, 2]])
});
feature.setId(1);
@@ -283,7 +283,7 @@ describe('ol.format.GML2', function() {
' </geometry>' +
' </layer>';
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new MultiLineString([[[1.1, 2], [3, 4.2]]])
});
feature.setId(1);
@@ -318,7 +318,7 @@ describe('ol.format.GML2', function() {
' </geometry>' +
' </layer>';
var feature = new _ol_Feature_({
var feature = new Feature({
geometry: new MultiPolygon([[[[1.1, 2], [3, 4.2], [5.2, 6]]]])
});
feature.setId(1);

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import GPX from '../../../../src/ol/format/GPX.js';
import LineString from '../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
@@ -36,7 +36,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([]);
@@ -65,7 +65,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('name')).to.be('Name');
expect(f.get('cmt')).to.be('Comment');
expect(f.get('desc')).to.be('Description');
@@ -93,7 +93,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
@@ -118,7 +118,7 @@ describe('ol.format.GPX', function() {
});
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(LineString);
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
@@ -160,7 +160,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiLineString);
expect(g.getCoordinates()).to.eql([]);
@@ -189,7 +189,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('name')).to.be('Name');
expect(f.get('cmt')).to.be('Comment');
expect(f.get('desc')).to.be('Description');
@@ -216,7 +216,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiLineString);
expect(g.getCoordinates()).to.eql([[]]);
@@ -247,7 +247,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiLineString);
expect(g.getCoordinates()).to.eql([
@@ -282,7 +282,7 @@ describe('ol.format.GPX', function() {
});
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiLineString);
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
@@ -329,7 +329,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiLineString);
expect(g.getCoordinates()).to.eql([
@@ -391,7 +391,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([2, 1]);
@@ -413,7 +413,7 @@ describe('ol.format.GPX', function() {
});
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
var expectedPoint = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
@@ -438,7 +438,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([2, 1, 3]);
@@ -460,7 +460,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([2, 1, 1263115752]);
@@ -483,7 +483,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
@@ -523,7 +523,7 @@ describe('ol.format.GPX', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('magvar')).to.be(11);
expect(f.get('geoidheight')).to.be(4);
expect(f.get('name')).to.be('Name');
@@ -663,7 +663,7 @@ describe('ol.format.GPX', function() {
it('does not fail', function() {
var polygon = new Polygon(
[[[0, 0], [2, 2], [4, 0], [0, 0]]]);
var feature = new _ol_Feature_(polygon);
var feature = new Feature(polygon);
var features = [feature];
var gpx = format.writeFeaturesNode(features);
var expected =

View File

@@ -1,5 +1,5 @@
import IGC from '../../../../src/ol/format/IGC.js';
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
@@ -46,7 +46,7 @@ describe('ol.format.IGC', function() {
it('does read a feature', function() {
var feature = format.readFeature(igc);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql('LineString');
expect(geom.getCoordinates()).to.eql([
@@ -60,7 +60,7 @@ describe('ol.format.IGC', function() {
var feature = format.readFeature(igc, {
featureProjection: 'EPSG:3857'
});
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql('LineString');
@@ -93,7 +93,7 @@ describe('ol.format.IGC', function() {
var features = format.readFeatures(igc);
expect(features.length).to.eql(1);
var feature = features[0];
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql('LineString');
expect(geom.getCoordinates()).to.eql([
@@ -109,7 +109,7 @@ describe('ol.format.IGC', function() {
});
expect(features.length).to.eql(1);
var feature = features[0];
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql('LineString');

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import {find} from '../../../../src/ol/array.js';
import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
import KML from '../../../../src/ol/format/KML.js';
@@ -54,7 +54,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -101,7 +101,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getId()).to.be('foo');
});
@@ -113,12 +113,12 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getId()).to.be(undefined);
});
it('can write a Feature', function() {
var features = [new _ol_Feature_()];
var features = [new Feature()];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -132,7 +132,7 @@ describe('ol.format.KML', function() {
});
it('can write a Feature as string', function() {
var features = [new _ol_Feature_()];
var features = [new Feature()];
var node = format.writeFeatures(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -146,7 +146,7 @@ describe('ol.format.KML', function() {
});
it('can write a Feature\'s id', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
var features = [feature];
var node = format.writeFeaturesNode(features);
@@ -173,13 +173,13 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be(null);
});
it('can write feature with null geometries', function() {
var features = [new _ol_Feature_(null)];
var features = [new Feature(null)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -199,7 +199,7 @@ describe('ol.format.KML', function() {
lineString.set('tessellate', true);
lineString.set('altitudeMode', 'clampToGround');
lineString.set('unsupportedProperty', 'foo');
var features = [new _ol_Feature_(lineString)];
var features = [new Feature(lineString)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -237,7 +237,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([1, 2, 3]);
@@ -263,7 +263,7 @@ describe('ol.format.KML', function() {
});
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
@@ -285,7 +285,7 @@ describe('ol.format.KML', function() {
' </Placemark>' +
'</kml>';
var f = format.readFeature(text);
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([1, 2, 3]);
@@ -307,7 +307,7 @@ describe('ol.format.KML', function() {
var f = format.readFeature(text, {
featureProjection: 'EPSG:3857'
});
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
@@ -318,7 +318,7 @@ describe('ol.format.KML', function() {
it('can write XY Point geometries', function() {
var layout = 'XY';
var point = new Point([1, 2], layout);
var features = [new _ol_Feature_(point)];
var features = [new Feature(point)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -338,7 +338,7 @@ describe('ol.format.KML', function() {
it('can write XYZ Point geometries', function() {
var layout = 'XYZ';
var point = new Point([1, 2, 3], layout);
var features = [new _ol_Feature_(point)];
var features = [new Feature(point)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -368,7 +368,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZ';
var point = new Point([1, 2, 3], layout).transform(
'EPSG:4326', 'double');
var features = [new _ol_Feature_(point)];
var features = [new Feature(point)];
var node = format.writeFeaturesNode(features, {
featureProjection: 'double'
});
@@ -393,7 +393,7 @@ describe('ol.format.KML', function() {
it('can write XYM Point geometries', function() {
var layout = 'XYM';
var point = new Point([1, 2, 100], layout);
var features = [new _ol_Feature_(point)];
var features = [new Feature(point)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -413,7 +413,7 @@ describe('ol.format.KML', function() {
it('can write XYZM Point geometries', function() {
var layout = 'XYZM';
var point = new Point([1, 2, 3, 100], layout);
var features = [new _ol_Feature_(point)];
var features = [new Feature(point)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -445,7 +445,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
@@ -457,7 +457,7 @@ describe('ol.format.KML', function() {
it('can write XY LineString geometries', function() {
var layout = 'XY';
var lineString = new LineString([[1, 2], [3, 4]], layout);
var features = [new _ol_Feature_(lineString)];
var features = [new Feature(lineString)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -478,7 +478,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZ';
var lineString = new LineString(
[[1, 2, 3], [4, 5, 6]], layout);
var features = [new _ol_Feature_(lineString)];
var features = [new Feature(lineString)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -499,7 +499,7 @@ describe('ol.format.KML', function() {
var layout = 'XYM';
var lineString = new LineString(
[[1, 2, 100], [3, 4, 200]], layout);
var features = [new _ol_Feature_(lineString)];
var features = [new Feature(lineString)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -520,7 +520,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZM';
var lineString = new LineString(
[[1, 2, 3, 100], [4, 5, 6, 200]], layout);
var features = [new _ol_Feature_(lineString)];
var features = [new Feature(lineString)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -549,7 +549,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Polygon);
expect(g.getCoordinates()).to.eql([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]);
@@ -559,7 +559,7 @@ describe('ol.format.KML', function() {
var layout = 'XY';
var linearRing = new LinearRing(
[[1, 2], [3, 4], [1, 2]], layout);
var features = [new _ol_Feature_(linearRing)];
var features = [new Feature(linearRing)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -580,7 +580,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZ';
var linearRing = new LinearRing(
[[1, 2, 3], [4, 5, 6], [1, 2, 3]], layout);
var features = [new _ol_Feature_(linearRing)];
var features = [new Feature(linearRing)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -601,7 +601,7 @@ describe('ol.format.KML', function() {
var layout = 'XYM';
var linearRing = new LinearRing(
[[1, 2, 100], [3, 4, 200], [1, 2, 100]], layout);
var features = [new _ol_Feature_(linearRing)];
var features = [new Feature(linearRing)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -622,7 +622,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZM';
var linearRing = new LinearRing(
[[1, 2, 3, 100], [4, 5, 6, 200], [1, 2, 3, 100]], layout);
var features = [new _ol_Feature_(linearRing)];
var features = [new Feature(linearRing)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -657,7 +657,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Polygon);
expect(g.getCoordinates()).to.eql(
@@ -670,7 +670,7 @@ describe('ol.format.KML', function() {
var layout = 'XY';
var polygon = new Polygon(
[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]]], layout);
var features = [new _ol_Feature_(polygon)];
var features = [new Feature(polygon)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -695,7 +695,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZ';
var polygon = new Polygon(
[[[0, 0, 1], [0, 2, 2], [2, 2, 3], [2, 0, 4], [0, 0, 5]]], layout);
var features = [new _ol_Feature_(polygon)];
var features = [new Feature(polygon)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -722,7 +722,7 @@ describe('ol.format.KML', function() {
var layout = 'XYM';
var polygon = new Polygon(
[[[0, 0, 1], [0, 2, 1], [2, 2, 1], [2, 0, 1], [0, 0, 1]]], layout);
var features = [new _ol_Feature_(polygon)];
var features = [new Feature(polygon)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -750,7 +750,7 @@ describe('ol.format.KML', function() {
var polygon = new Polygon([
[[0, 0, 1, 1], [0, 2, 2, 1], [2, 2, 3, 1], [2, 0, 4, 1], [0, 0, 5, 1]]
], layout);
var features = [new _ol_Feature_(polygon)];
var features = [new Feature(polygon)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -797,7 +797,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Polygon);
expect(g.getCoordinates()).to.eql([
@@ -814,7 +814,7 @@ describe('ol.format.KML', function() {
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]
], layout);
var features = [new _ol_Feature_(polygon)];
var features = [new Feature(polygon)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -872,7 +872,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiPolygon);
expect(g.getCoordinates()).to.eql(
@@ -893,7 +893,7 @@ describe('ol.format.KML', function() {
var multiPolygon = new MultiPolygon(
[[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]], layout);
var features = [new _ol_Feature_(multiPolygon)];
var features = [new Feature(multiPolygon)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -944,7 +944,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiPoint);
expect(g.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
@@ -962,7 +962,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZ';
var multiPoint = new MultiPoint(
[[1, 2, 3], [4, 5, 6]], layout);
var features = [new _ol_Feature_(multiPoint)];
var features = [new Feature(multiPoint)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -1004,7 +1004,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiLineString);
expect(g.getCoordinates()).to.eql(
@@ -1027,7 +1027,7 @@ describe('ol.format.KML', function() {
var layout = 'XYZ';
var multiLineString = new MultiLineString(
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], layout);
var features = [new _ol_Feature_(multiLineString)];
var features = [new Feature(multiLineString)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -1076,7 +1076,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiPolygon);
expect(g.getCoordinates()).to.eql([
@@ -1099,7 +1099,7 @@ describe('ol.format.KML', function() {
[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]
], layout);
var features = [new _ol_Feature_(multiPolygon)];
var features = [new Feature(multiPolygon)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -1140,7 +1140,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(GeometryCollection);
expect(g.getGeometries()).to.be.empty();
@@ -1173,7 +1173,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(GeometryCollection);
var gs = g.getGeometries();
@@ -1197,7 +1197,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(GeometryCollection);
var gs = g.getGeometries();
@@ -1211,7 +1211,7 @@ describe('ol.format.KML', function() {
new LineString([[1, 2], [3, 4]]),
new Polygon([[[1, 2], [3, 4], [3, 2], [1, 2]]])
]);
var features = [new _ol_Feature_(collection)];
var features = [new Feature(collection)];
var node = format.writeFeaturesNode(features);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
@@ -1258,7 +1258,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(LineString);
});
@@ -1285,7 +1285,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(MultiLineString);
var gs = g.getLineStrings();
@@ -1340,7 +1340,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('open')).to.be(true);
expect(f.get('visibility')).to.be(false);
});
@@ -1358,7 +1358,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('address')).to.be('My address');
expect(f.get('description')).to.be('My description');
expect(f.get('name')).to.be('My name');
@@ -1375,7 +1375,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('description')).to.be('My description');
});
@@ -1389,7 +1389,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('name')).to.be('My name in CDATA');
});
@@ -1403,12 +1403,12 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('name')).to.be('My name in CDATA');
});
it('can write Feature\'s string attributes', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('address', 'My address');
feature.set('description', 'My description');
feature.set('name', 'My name');
@@ -1432,7 +1432,7 @@ describe('ol.format.KML', function() {
});
it('can write Feature\'s boolean attributes', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('open', true);
feature.set('visibility', false);
var features = [feature];
@@ -1477,7 +1477,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var extent = f.get('extent');
expect(extent).to.be.an(Array);
expect(extent).to.have.length(4);
@@ -1509,7 +1509,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('minLodPixels')).to.be(128);
expect(f.get('maxLodPixels')).to.be(2048);
expect(f.get('minFadeExtent')).to.be(0.2);
@@ -1521,7 +1521,7 @@ describe('ol.format.KML', function() {
describe('extended data', function() {
it('can write ExtendedData with no values', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('foo', null);
feature.set('bar', undefined);
var features = [feature];
@@ -1543,7 +1543,7 @@ describe('ol.format.KML', function() {
});
it('can write ExtendedData with values', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('foo', 'bar');
feature.set('aNumber', 1000);
var features = [feature];
@@ -1574,7 +1574,7 @@ describe('ol.format.KML', function() {
displayName: 'display name'
};
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('foo', pair);
var features = [feature];
@@ -1611,7 +1611,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getProperties()).to.only.have.keys(['foo', 'geometry']);
expect(f.get('foo')).to.be('bar');
});
@@ -1631,7 +1631,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getProperties()).to.only.have.keys(['foo', 'bar', 'geometry']);
expect(f.get('foo')).to.be('200');
expect(f.get('bar')).to.be(undefined);
@@ -1652,7 +1652,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('foo')).to.be('bar');
});
@@ -1671,7 +1671,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('capital')).to.be('London');
expect(f.get('population')).to.be('60000000');
});
@@ -1695,7 +1695,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('capital')).to.be('London');
expect(f.get('country')).to.be('United-Kingdom');
});
@@ -1712,7 +1712,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -1745,7 +1745,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -1824,7 +1824,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(5);
fs.forEach(function(f) {
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getId()).to.be.within(1, 5);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
@@ -1896,7 +1896,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -1932,7 +1932,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -1967,7 +1967,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -1999,7 +1999,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2036,7 +2036,7 @@ describe('ol.format.KML', function() {
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2075,7 +2075,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2112,7 +2112,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2150,7 +2150,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2203,7 +2203,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2252,7 +2252,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2281,7 +2281,7 @@ describe('ol.format.KML', function() {
});
var imageStyle = style.getImage();
imageStyle.iconImage_.size_ = [192, 144]; // sprite de 12 images(4*3)
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle([style]);
var node = format.writeFeaturesNode([feature]);
var text =
@@ -2318,7 +2318,7 @@ describe('ol.format.KML', function() {
src: 'http://foo.png'
})
});
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle([style]);
var node = format.writeFeaturesNode([feature]);
var text =
@@ -2342,7 +2342,7 @@ describe('ol.format.KML', function() {
})
})
});
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle([style]);
var node = format.writeFeaturesNode([feature]);
var text =
@@ -2369,7 +2369,7 @@ describe('ol.format.KML', function() {
})
})
});
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle([style]);
var node = format.writeFeaturesNode([feature]);
var text =
@@ -2398,7 +2398,7 @@ describe('ol.format.KML', function() {
width: 2
})
});
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle([style]);
var node = format.writeFeaturesNode([feature]);
var text =
@@ -2425,7 +2425,7 @@ describe('ol.format.KML', function() {
color: 'rgba(12, 34, 223, 0.7)'
})
});
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle([style]);
var node = format.writeFeaturesNode([feature]);
var text =
@@ -2451,9 +2451,9 @@ describe('ol.format.KML', function() {
color: 'rgba(12, 34, 223, 0.7)'
})
});
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setStyle(style);
var feature2 = new _ol_Feature_();
var feature2 = new Feature();
feature2.setStyle(style);
var node = format.writeFeaturesNode([feature, feature2]);
var text =
@@ -2506,7 +2506,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2539,7 +2539,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2580,7 +2580,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2614,7 +2614,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2648,7 +2648,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2682,7 +2682,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2715,7 +2715,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2747,7 +2747,7 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var styleFunction = f.getStyleFunction();
expect(styleFunction).not.to.be(undefined);
var styleArray = styleFunction.call(f, 0);
@@ -2780,13 +2780,13 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(2);
var f1 = fs[0];
expect(f1).to.be.an(_ol_Feature_);
expect(f1).to.be.an(Feature);
var styleFunction1 = f1.getStyleFunction();
expect(styleFunction1).not.to.be(undefined);
var styleArray1 = styleFunction1.call(f1, 0);
expect(styleArray1).to.be.an(Array);
var f2 = fs[1];
expect(f2).to.be.an(_ol_Feature_);
expect(f2).to.be.an(Feature);
var styleFunction2 = f2.getStyleFunction();
expect(styleFunction2).not.to.be(undefined);
var styleArray2 = styleFunction2.call(f2, 0);
@@ -2814,7 +2814,7 @@ describe('ol.format.KML', function() {
'</Document>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
});
it('can read a single feature from nested Document', function() {
@@ -2827,7 +2827,7 @@ describe('ol.format.KML', function() {
'</Document>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
});
it('can transform and read a single feature from a Document', function() {
@@ -2844,7 +2844,7 @@ describe('ol.format.KML', function() {
});
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
@@ -2862,9 +2862,9 @@ describe('ol.format.KML', function() {
'</Document>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(2);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
expect(fs[0].getId()).to.be('1');
expect(fs[1]).to.be.an(_ol_Feature_);
expect(fs[1]).to.be.an(Feature);
expect(fs[1].getId()).to.be('2');
});
@@ -2884,7 +2884,7 @@ describe('ol.format.KML', function() {
'</Folder>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
});
it('can read a multiple features from a Folder', function() {
@@ -2897,9 +2897,9 @@ describe('ol.format.KML', function() {
'</Folder>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(2);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
expect(fs[0].getId()).to.be('1');
expect(fs[1]).to.be.an(_ol_Feature_);
expect(fs[1]).to.be.an(Feature);
expect(fs[1].getId()).to.be('2');
});
@@ -2913,7 +2913,7 @@ describe('ol.format.KML', function() {
'</Document>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
});
it('can read features from Folders nested in Folders', function() {
@@ -2926,7 +2926,7 @@ describe('ol.format.KML', function() {
'</Folder>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
});
it('can read a single feature', function() {
@@ -2935,7 +2935,7 @@ describe('ol.format.KML', function() {
'</Placemark>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(1);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
});
it('can read features at multiple levels', function() {
@@ -2955,15 +2955,15 @@ describe('ol.format.KML', function() {
'</kml>';
var fs = format.readFeatures(text);
expect(fs).to.have.length(5);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
expect(fs[0].getId()).to.be('a');
expect(fs[1]).to.be.an(_ol_Feature_);
expect(fs[1]).to.be.an(Feature);
expect(fs[1].getId()).to.be('b');
expect(fs[2]).to.be.an(_ol_Feature_);
expect(fs[2]).to.be.an(Feature);
expect(fs[2].getId()).to.be('c');
expect(fs[3]).to.be.an(_ol_Feature_);
expect(fs[3]).to.be.an(Feature);
expect(fs[3].getId()).to.be('d');
expect(fs[4]).to.be.an(_ol_Feature_);
expect(fs[4]).to.be.an(Feature);
expect(fs[4].getId()).to.be('e');
});
@@ -2990,9 +2990,9 @@ describe('ol.format.KML', function() {
});
it('can write multiple features', function() {
var feature1 = new _ol_Feature_();
var feature1 = new Feature();
feature1.setId('1');
var feature2 = new _ol_Feature_();
var feature2 = new Feature();
feature2.setId('2');
var node = format.writeFeaturesNode([feature1, feature2]);
var text =
@@ -3034,7 +3034,7 @@ describe('ol.format.KML', function() {
expect(fs).to.be.an(Array);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getGeometry()).to.be(null);
});
@@ -3051,7 +3051,7 @@ describe('ol.format.KML', function() {
expect(fs).to.be.an(Array);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getGeometry()).to.be(null);
});
@@ -3068,7 +3068,7 @@ describe('ol.format.KML', function() {
expect(fs).to.be.an(Array);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getGeometry()).to.be(null);
});
@@ -3089,7 +3089,7 @@ describe('ol.format.KML', function() {
expect(fs).to.be.an(Array);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.getGeometry()).to.be(null);
});
@@ -3108,7 +3108,7 @@ describe('ol.format.KML', function() {
expect(fs).to.be.an(Array);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(GeometryCollection);
expect(g.getGeometries()).to.be.empty();
@@ -3125,7 +3125,7 @@ describe('ol.format.KML', function() {
expect(fs).to.be.an(Array);
expect(fs).to.have.length(1);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
expect(f.get('visibility')).to.be(undefined);
});
@@ -3145,15 +3145,15 @@ describe('ol.format.KML', function() {
var fs = format.readFeatures(kml);
expect(fs).to.be.an(Array);
expect(fs).to.have.length(5);
expect(fs[0]).to.be.an(_ol_Feature_);
expect(fs[0]).to.be.an(Feature);
expect(fs[0].getId()).to.be('a');
expect(fs[1]).to.be.an(_ol_Feature_);
expect(fs[1]).to.be.an(Feature);
expect(fs[1].getId()).to.be('b');
expect(fs[2]).to.be.an(_ol_Feature_);
expect(fs[2]).to.be.an(Feature);
expect(fs[2].getId()).to.be('c');
expect(fs[3]).to.be.an(_ol_Feature_);
expect(fs[3]).to.be.an(Feature);
expect(fs[3].getId()).to.be('d');
expect(fs[4]).to.be.an(_ol_Feature_);
expect(fs[4]).to.be.an(Feature);
expect(fs[4].getId()).to.be('e');
});
@@ -3182,7 +3182,7 @@ describe('ol.format.KML', function() {
it('creates features with heterogeneous geometry collections', function() {
// FIXME decide if we should instead create features with multiple geoms
var feature = features[0];
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(GeometryCollection);
});
@@ -3191,7 +3191,7 @@ describe('ol.format.KML', function() {
var alaska = find(features, function(feature) {
return feature.get('name') === 'Alaska';
});
expect(alaska).to.be.an(_ol_Feature_);
expect(alaska).to.be.an(Feature);
var geometry = alaska.getGeometry();
expect(geometry).to.be.an(GeometryCollection);
var components = geometry.getGeometries();

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js';
import MVT from '../../../../src/ol/format/MVT.js';
import Point from '../../../../src/ol/geom/Point.js';
@@ -36,7 +36,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
it('parses geometries correctly', function() {
var format = new MVT({
featureClass: _ol_Feature_,
featureClass: Feature,
layers: ['poi_label']
});
var geometry;
@@ -61,7 +61,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
it('parses id property', function() {
// ol.Feature
var format = new MVT({
featureClass: _ol_Feature_,
featureClass: Feature,
layers: ['building']
});
var features = format.readFeatures(data);
@@ -90,7 +90,7 @@ describe('ol.format.MVT', function() {
describe('#createFeature_', function() {
it('accepts a geometryName', function() {
var format = new MVT({
featureClass: _ol_Feature_,
featureClass: Feature,
geometryName: 'myGeom'
});
var rawFeature = {
@@ -118,7 +118,7 @@ describe('ol.format.MVT', function() {
it('detects a Polygon', function() {
var format = new MVT({
featureClass: _ol_Feature_
featureClass: Feature
});
var rawFeature = {
type: 3,
@@ -141,7 +141,7 @@ describe('ol.format.MVT', function() {
it('detects a MultiPolygon', function() {
var format = new MVT({
featureClass: _ol_Feature_
featureClass: Feature
});
var rawFeature = {
type: 3,

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import OSMXML from '../../../../src/ol/format/OSMXML.js';
import Point from '../../../../src/ol/geom/Point.js';
import LineString from '../../../../src/ol/geom/LineString.js';
@@ -49,7 +49,7 @@ describe('ol.format.OSMXML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(2);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([2, 1]);
@@ -74,12 +74,12 @@ describe('ol.format.OSMXML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(3);
var point = fs[0];
expect(point).to.be.an(_ol_Feature_);
expect(point).to.be.an(Feature);
var g = point.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([2, 1]);
var line = fs[2];
expect(line).to.be.an(_ol_Feature_);
expect(line).to.be.an(Feature);
g = line.getGeometry();
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
@@ -105,7 +105,7 @@ describe('ol.format.OSMXML', function() {
var fs = format.readFeatures(text);
expect(fs).to.have.length(3);
var line = fs[2];
expect(line).to.be.an(_ol_Feature_);
expect(line).to.be.an(Feature);
var g = line.getGeometry();
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
@@ -128,7 +128,7 @@ describe('ol.format.OSMXML', function() {
});
expect(fs).to.have.length(2);
var f = fs[0];
expect(f).to.be.an(_ol_Feature_);
expect(f).to.be.an(Feature);
var g = f.getGeometry();
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql(

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Polyline, * as polyline from '../../../../src/ol/format/Polyline.js';
import LineString from '../../../../src/ol/geom/LineString.js';
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
@@ -265,7 +265,7 @@ describe('ol.format.Polyline', function() {
it('returns the expected feature', function() {
var feature = format.readFeature(encodedFlatPoints);
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(LineString);
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
@@ -275,7 +275,7 @@ describe('ol.format.Polyline', function() {
var feature = format.readFeature(encodedFlatPoints, {
featureProjection: 'EPSG:3857'
});
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(LineString);
expect(geometry.getCoordinates()).to.eql(points3857);
@@ -290,7 +290,7 @@ describe('ol.format.Polyline', function() {
expect(features).to.be.an(Array);
expect(features).to.have.length(1);
var feature = features[0];
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(LineString);
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
@@ -303,7 +303,7 @@ describe('ol.format.Polyline', function() {
expect(features).to.be.an(Array);
expect(features).to.have.length(1);
var feature = features[0];
expect(feature).to.be.an(_ol_Feature_);
expect(feature).to.be.an(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.an(LineString);
expect(geometry.getCoordinates()).to.eql(points3857);
@@ -360,12 +360,12 @@ describe('ol.format.Polyline', function() {
describe('#writeFeature', function() {
it('returns the expected text', function() {
var feature = new _ol_Feature_(new LineString(points));
var feature = new Feature(new LineString(points));
expect(format.writeFeature(feature)).to.be(encodedFlatPoints);
});
it('transforms and returns the expected text', function() {
var feature = new _ol_Feature_(new LineString(points3857));
var feature = new Feature(new LineString(points3857));
expect(format.writeFeature(feature, {
featureProjection: 'EPSG:3857'
})).to.be(encodedFlatPoints);
@@ -376,12 +376,12 @@ describe('ol.format.Polyline', function() {
describe('#writeFeature', function() {
it('returns the expected text', function() {
var features = [new _ol_Feature_(new LineString(points))];
var features = [new Feature(new LineString(points))];
expect(format.writeFeatures(features)).to.be(encodedFlatPoints);
});
it('transforms and returns the expected text', function() {
var features = [new _ol_Feature_(new LineString(points3857))];
var features = [new Feature(new LineString(points3857))];
expect(format.writeFeatures(features, {
featureProjection: 'EPSG:3857'
})).to.be(encodedFlatPoints);

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import FeatureFormat from '../../../../src/ol/format/Feature.js';
@@ -59,7 +59,7 @@ describe('ol.format.TopoJSON', function() {
expect(features).to.have.length(1);
var feature = features[0];
expect(feature).to.be.a(_ol_Feature_);
expect(feature).to.be.a(Feature);
var geometry = feature.getGeometry();
expect(geometry).to.be.a(Polygon);
@@ -80,7 +80,7 @@ describe('ol.format.TopoJSON', function() {
expect(features).to.have.length(1);
var feature = features[0];
expect(feature).to.be.a(_ol_Feature_);
expect(feature).to.be.a(Feature);
expect(feature.getId()).to.be(0);
});
@@ -155,14 +155,14 @@ describe('ol.format.TopoJSON', function() {
expect(features.length).to.be(178);
var first = features[0];
expect(first).to.be.a(_ol_Feature_);
expect(first).to.be.a(Feature);
var firstGeom = first.getGeometry();
expect(firstGeom).to.be.a(MultiPolygon);
expect(firstGeom.getExtent()).to.eql(
[-180, -85.60903777459777, 180, 83.64513000000002]);
var last = features[177];
expect(last).to.be.a(_ol_Feature_);
expect(last).to.be.a(Feature);
var lastGeom = last.getGeometry();
expect(lastGeom).to.be.a(Polygon);
expect(lastGeom.getExtent()).to.eql([

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import GML2 from '../../../../src/ol/format/GML2.js';
import WFS from '../../../../src/ol/format/WFS.js';
import _ol_format_filter_ from '../../../../src/ol/format/filter.js';
@@ -712,7 +712,7 @@ describe('ol.format.WFS', function() {
});
it('creates the correct srsName', function() {
var format = new WFS();
var insertFeature = new _ol_Feature_({
var insertFeature = new Feature({
the_geom: new MultiLineString([[
[-5178372.1885436, 1992365.7775042],
[-4434792.7774889, 1601008.1927386],
@@ -743,7 +743,7 @@ describe('ol.format.WFS', function() {
it('creates the correct update', function() {
var format = new WFS();
var updateFeature = new _ol_Feature_();
var updateFeature = new Feature();
updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[
[-12279454, 6741885],
@@ -764,7 +764,7 @@ describe('ol.format.WFS', function() {
it('creates the correct update if geometry name is alias', function() {
var format = new WFS();
var updateFeature = new _ol_Feature_(new MultiLineString([[
var updateFeature = new Feature(new MultiLineString([[
[-12279454, 6741885],
[-12064207, 6732101],
[-11941908, 6595126],
@@ -788,7 +788,7 @@ describe('ol.format.WFS', function() {
it('creates the correct update with default featurePrefix', function() {
var format = new WFS();
var updateFeature = new _ol_Feature_();
var updateFeature = new Feature();
updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[
[-12279454, 6741885],
@@ -811,7 +811,7 @@ describe('ol.format.WFS', function() {
it('does not create an update if no fid', function() {
var format = new WFS();
var updateFeature = new _ol_Feature_();
var updateFeature = new Feature();
updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[
[-12279454, 6741885],
@@ -844,7 +844,7 @@ describe('ol.format.WFS', function() {
it('handles multiple geometries', function() {
var format = new WFS();
var updateFeature = new _ol_Feature_();
var updateFeature = new Feature();
updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[
[-12279454, 6741885],
@@ -879,14 +879,14 @@ describe('ol.format.WFS', function() {
it('creates the correct transaction body', function() {
var format = new WFS();
var insertFeature = new _ol_Feature_({
var insertFeature = new Feature({
the_geom: new MultiPoint([[1, 2]]),
foo: 'bar',
nul: null
});
insertFeature.setGeometryName('the_geom');
var inserts = [insertFeature];
var updateFeature = new _ol_Feature_({
var updateFeature = new Feature({
the_geom: new MultiPoint([[1, 2]]),
foo: 'bar',
// null value gets Property element with no Value
@@ -898,7 +898,7 @@ describe('ol.format.WFS', function() {
updateFeature.setGeometryName('the_geom');
var updates = [updateFeature];
var deleteFeature = new _ol_Feature_();
var deleteFeature = new Feature();
deleteFeature.setId('fid.37');
var deletes = [deleteFeature];
var serialized = format.writeTransaction(inserts, updates, deletes, {
@@ -949,14 +949,14 @@ describe('ol.format.WFS', function() {
it('handles the WFS version', function() {
var format = new WFS();
var insertFeature = new _ol_Feature_({
var insertFeature = new Feature({
the_geom: new LineString([[1.1, 2], [3, 4.2]]),
foo: 'bar',
nul: null
});
insertFeature.setGeometryName('the_geom');
var inserts = [insertFeature];
var updateFeature = new _ol_Feature_({
var updateFeature = new Feature({
the_geom: new LineString([[1.1, 2], [3, 4.2]]),
foo: 'bar',
// null value gets Property element with no Value
@@ -968,7 +968,7 @@ describe('ol.format.WFS', function() {
updateFeature.setGeometryName('the_geom');
var updates = [updateFeature];
var deleteFeature = new _ol_Feature_();
var deleteFeature = new Feature();
deleteFeature.setId('fid.37');
var deletes = [deleteFeature];
var serialized = format.writeTransaction(inserts, updates, deletes, {
@@ -993,14 +993,14 @@ describe('ol.format.WFS', function() {
it('do not add feature prefix twice', function() {
var format = new WFS();
var insertFeature = new _ol_Feature_({
var insertFeature = new Feature({
the_geom: new MultiPoint([[1, 2]]),
foo: 'bar',
nul: null
});
insertFeature.setGeometryName('the_geom');
var inserts = [insertFeature];
var updateFeature = new _ol_Feature_({
var updateFeature = new Feature({
the_geom: new MultiPoint([[1, 2]]),
foo: 'bar',
// null value gets Property element with no Value
@@ -1012,7 +1012,7 @@ describe('ol.format.WFS', function() {
updateFeature.setGeometryName('the_geom');
var updates = [updateFeature];
var deleteFeature = new _ol_Feature_();
var deleteFeature = new Feature();
deleteFeature.setId('fid.37');
var deletes = [deleteFeature];
var serialized = format.writeTransaction(inserts, updates, deletes, {
@@ -1036,14 +1036,14 @@ describe('ol.format.WFS', function() {
it('handles 3D in WFS 1.0.0', function() {
var format = new WFS();
var insertFeature = new _ol_Feature_({
var insertFeature = new Feature({
the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]),
foo: 'bar',
nul: null
});
insertFeature.setGeometryName('the_geom');
var inserts = [insertFeature];
var updateFeature = new _ol_Feature_({
var updateFeature = new Feature({
the_geom: new LineString([[1.1, 2, 6], [3, 4.2, 7]]),
foo: 'bar',
// null value gets Property element with no Value
@@ -1078,14 +1078,14 @@ describe('ol.format.WFS', function() {
it('handles 3D in WFS 1.1.0', function() {
var format = new WFS();
var insertFeature = new _ol_Feature_({
var insertFeature = new Feature({
the_geom: new MultiPoint([[1, 2, 3]]),
foo: 'bar',
nul: null
});
insertFeature.setGeometryName('the_geom');
var inserts = [insertFeature];
var updateFeature = new _ol_Feature_({
var updateFeature = new Feature({
the_geom: new MultiPoint([[1, 2, 3]]),
foo: 'bar',
// null value gets Property element with no Value
@@ -1247,7 +1247,7 @@ describe('ol.format.WFS', function() {
it('reads all features', function() {
expect(features.length).to.be(5);
features.forEach(function(feature) {
expect(feature instanceof _ol_Feature_).to.be(true);
expect(feature instanceof Feature).to.be(true);
});
});

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Point from '../../../../src/ol/geom/Point.js';
import WKT from '../../../../src/ol/format/WKT.js';
import {transform} from '../../../../src/ol/proj.js';
@@ -62,14 +62,14 @@ describe('ol.format.WKT', function() {
describe('#writeFeature()', function() {
it('transforms with dataProjection and featureProjection', function() {
var feature = new _ol_Feature_(
var feature = new Feature(
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857'));
var wkt = format.writeFeature(feature, {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
var gotFeature = format.readFeature(wkt);
expect(gotFeature).to.be.a(_ol_Feature_);
expect(gotFeature).to.be.a(Feature);
var got = gotFeature.getGeometry().getCoordinates();
expect(got[0]).to.roughlyEqual(1, 1e-6);
expect(got[1]).to.roughlyEqual(2, 1e-6);
@@ -101,9 +101,9 @@ describe('ol.format.WKT', function() {
it('transforms with dataProjection and featureProjection', function() {
var features = [
new _ol_Feature_(
new Feature(
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857')),
new _ol_Feature_(
new Feature(
new Point([4, 5]).transform('EPSG:4326', 'EPSG:3857'))
];
var wkt = format.writeFeatures(features, {

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Map from '../../../../src/ol/Map.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import _ol_View_ from '../../../../src/ol/View.js';
@@ -1035,7 +1035,7 @@ describe('ol.interaction.Draw', function() {
type: 'LineString'
});
map.addInteraction(draw);
feature = new _ol_Feature_(
feature = new Feature(
new LineString([[0, 0], [1, 1], [2, 0]]));
});

View File

@@ -1,5 +1,5 @@
import _ol_Collection_ from '../../../../src/ol/Collection.js';
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Map from '../../../../src/ol/Map.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import _ol_View_ from '../../../../src/ol/View.js';
@@ -34,7 +34,7 @@ describe('ol.interaction.Modify', function() {
document.body.appendChild(target);
features = [
new _ol_Feature_({
new Feature({
geometry: new Polygon([
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
])
@@ -151,7 +151,7 @@ describe('ol.interaction.Modify', function() {
describe('constructor', function() {
it('adds features to the RTree', function() {
var feature = new _ol_Feature_(
var feature = new Feature(
new Point([0, 0]));
var features = new _ol_Collection_([feature]);
var modify = new _ol_interaction_Modify_({
@@ -163,7 +163,7 @@ describe('ol.interaction.Modify', function() {
});
it('accepts feature without geometry', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
var features = new _ol_Collection_([feature]);
var modify = new _ol_interaction_Modify_({
features: features
@@ -178,7 +178,7 @@ describe('ol.interaction.Modify', function() {
});
it('accepts a source', function() {
var feature = new _ol_Feature_(
var feature = new Feature(
new Point([0, 0]));
var source = new _ol_source_Vector_({features: [feature]});
var modify = new _ol_interaction_Modify_({source: source});
@@ -225,7 +225,7 @@ describe('ol.interaction.Modify', function() {
});
it('deletes first vertex of a LineString', function() {
var lineFeature = new _ol_Feature_({
var lineFeature = new Feature({
geometry: new LineString(
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
)
@@ -261,7 +261,7 @@ describe('ol.interaction.Modify', function() {
});
it('deletes last vertex of a LineString', function() {
var lineFeature = new _ol_Feature_({
var lineFeature = new Feature({
geometry: new LineString(
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
)
@@ -297,7 +297,7 @@ describe('ol.interaction.Modify', function() {
});
it('deletes vertex of a LineString programmatically', function() {
var lineFeature = new _ol_Feature_({
var lineFeature = new Feature({
geometry: new LineString(
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
)
@@ -339,7 +339,7 @@ describe('ol.interaction.Modify', function() {
describe('vertex modification', function() {
it('keeps the third dimension', function() {
var lineFeature = new _ol_Feature_({
var lineFeature = new Feature({
geometry: new LineString(
[[0, 0, 10], [10, 20, 20], [0, 40, 30], [40, 40, 40], [40, 0, 50]]
)
@@ -382,7 +382,7 @@ describe('ol.interaction.Modify', function() {
describe('circle modification', function() {
it('changes the circle radius and center', function() {
var circleFeature = new _ol_Feature_(new Circle([10, 10], 20));
var circleFeature = new Feature(new Circle([10, 10], 20));
features.length = 0;
features.push(circleFeature);
@@ -617,7 +617,7 @@ describe('ol.interaction.Modify', function() {
});
it('updates circle segment data', function() {
var feature = new _ol_Feature_(new Circle([10, 10], 20));
var feature = new Feature(new Circle([10, 10], 20));
features.length = 0;
features.push(feature);

View File

@@ -1,5 +1,5 @@
import _ol_Collection_ from '../../../../src/ol/Collection.js';
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Map from '../../../../src/ol/Map.js';
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
@@ -36,19 +36,19 @@ describe('ol.interaction.Select', function() {
// -> foo -> bar.
var features = [];
features.push(
new _ol_Feature_({
new Feature({
geometry: geometry,
type: 'bar'
}),
new _ol_Feature_({
new Feature({
geometry: geometry,
type: 'foo'
}),
new _ol_Feature_({
new Feature({
geometry: geometry,
type: 'bar'
}),
new _ol_Feature_({
new Feature({
geometry: geometry,
type: 'foo'
}));
@@ -356,7 +356,7 @@ describe('ol.interaction.Select', function() {
var feature = e.selected[0];
var layer_ = interaction.getLayer(feature);
expect(e.selected).to.have.length(1);
expect(feature).to.be.a(_ol_Feature_);
expect(feature).to.be.a(Feature);
expect(layer_).to.be.a(_ol_layer_Vector_);
expect(layer_).to.equal(layer);
});

View File

@@ -1,5 +1,5 @@
import _ol_Collection_ from '../../../../src/ol/Collection.js';
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Map from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import Circle from '../../../../src/ol/geom/Circle.js';
@@ -56,7 +56,7 @@ describe('ol.interaction.Snap', function() {
});
it('can handle XYZ coordinates', function() {
var point = new _ol_Feature_(new Point([0, 0, 123]));
var point = new Feature(new Point([0, 0, 123]));
var snapInteraction = new _ol_interaction_Snap_({
features: new _ol_Collection_([point])
});
@@ -73,7 +73,7 @@ describe('ol.interaction.Snap', function() {
});
it('snaps to edges only', function() {
var point = new _ol_Feature_(new LineString([[-10, 0], [10, 0]]));
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
var snapInteraction = new _ol_interaction_Snap_({
features: new _ol_Collection_([point]),
pixelTolerance: 5,
@@ -91,7 +91,7 @@ describe('ol.interaction.Snap', function() {
});
it('snaps to vertices only', function() {
var point = new _ol_Feature_(new LineString([[-10, 0], [10, 0]]));
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
var snapInteraction = new _ol_interaction_Snap_({
features: new _ol_Collection_([point]),
pixelTolerance: 5,
@@ -109,7 +109,7 @@ describe('ol.interaction.Snap', function() {
});
it('snaps to circle', function() {
var circle = new _ol_Feature_(new Circle([0, 0], 10));
var circle = new Feature(new Circle([0, 0], 10));
var snapInteraction = new _ol_interaction_Snap_({
features: new _ol_Collection_([circle]),
pixelTolerance: 5
@@ -128,7 +128,7 @@ describe('ol.interaction.Snap', function() {
});
it('handle feature without geometry', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
var snapInteraction = new _ol_interaction_Snap_({
features: new _ol_Collection_([feature]),
pixelTolerance: 5,
@@ -148,7 +148,7 @@ describe('ol.interaction.Snap', function() {
});
it('handle geometry changes', function() {
var line = new _ol_Feature_(new LineString([[-10, 0], [0, 0]]));
var line = new Feature(new LineString([[-10, 0], [0, 0]]));
var snapInteraction = new _ol_interaction_Snap_({
features: new _ol_Collection_([line]),
pixelTolerance: 5,
@@ -168,7 +168,7 @@ describe('ol.interaction.Snap', function() {
});
it('handle geometry name changes', function() {
var line = new _ol_Feature_({
var line = new Feature({
geometry: new LineString([[-10, 0], [0, 0]]),
alt_geometry: new LineString([[-10, 0], [10, 0]])
});

View File

@@ -1,5 +1,5 @@
import _ol_Collection_ from '../../../../src/ol/Collection.js';
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Map from '../../../../src/ol/Map.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import _ol_View_ from '../../../../src/ol/View.js';
@@ -27,9 +27,9 @@ describe('ol.interaction.Translate', function() {
style.height = height + 'px';
document.body.appendChild(target);
source = new _ol_source_Vector_();
features = [new _ol_Feature_({
features = [new Feature({
geometry: new Point([10, -20])
}), new _ol_Feature_({
}), new Feature({
geometry: new Point([20, -30])
})];
source.addFeatures(features);

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../src/ol/Feature.js';
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import MapEvent from '../../../src/ol/MapEvent.js';
import Overlay from '../../../src/ol/Overlay.js';
@@ -197,7 +197,7 @@ describe('ol.Map', function() {
target: target,
layers: [new _ol_layer_Vector_({
source: new _ol_source_Vector_({
features: [new _ol_Feature_(new LineString([[-50, 0], [50, 0]]))]
features: [new Feature(new LineString([[-50, 0], [50, 0]]))]
})
})],
view: new _ol_View_({
@@ -219,7 +219,7 @@ describe('ol.Map', function() {
it('returns an array of found features', function() {
var features = map.getFeaturesAtPixel([50, 50]);
expect(features).to.be.an(Array);
expect(features[0]).to.be.an(_ol_Feature_);
expect(features[0]).to.be.an(Feature);
});
it('returns an array of found features with declutter: true', function() {
@@ -233,7 +233,7 @@ describe('ol.Map', function() {
map.renderSync();
var features = map.getFeaturesAtPixel([50, 50]);
expect(features).to.be.an(Array);
expect(features[0]).to.be.an(_ol_Feature_);
expect(features[0]).to.be.a(Feature);
});
it('respects options', function() {

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../../src/ol/geom/Polygon.js';
import _ol_render_canvas_TextReplay_ from '../../../../../src/ol/render/canvas/TextReplay.js';
@@ -9,7 +9,7 @@ describe('ol.render.canvas.TextReplay', function() {
it('renders polygon labels only when they fit', function() {
var replay = new _ol_render_canvas_TextReplay_(1, [-180, -90, 180, 90], 0.02, 1, true);
var geometry = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
var feature = new _ol_Feature_(geometry);
var feature = new Feature(geometry);
replay.setTextStyle(new _ol_style_Text_({
text: 'This is a long text'
@@ -30,7 +30,7 @@ describe('ol.render.canvas.TextReplay', function() {
[[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]],
[[[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]]]
]);
var feature = new _ol_Feature_(geometry);
var feature = new Feature(geometry);
replay.setTextStyle(new _ol_style_Text_({
text: 'This is a long text'

View File

@@ -1,5 +1,5 @@
import {getUid} from '../../../../../src/ol/index.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import Circle from '../../../../../src/ol/geom/Circle.js';
import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js';
import _ol_render_webgl_circlereplay_defaultshader_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js';
@@ -173,13 +173,13 @@ describe('ol.render.webgl.CircleReplay', function() {
describe('#drawReplay', function() {
var gl, context;
var feature1 = new _ol_Feature_({
var feature1 = new Feature({
geometry: new Circle([0, 0], 5000)
});
var feature2 = new _ol_Feature_({
var feature2 = new Feature({
geometry: new Circle([10, 10], 5000)
});
var feature3 = new _ol_Feature_({
var feature3 = new Feature({
geometry: new Circle([20, 20], 5000)
});
beforeEach(function() {

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import Circle from '../../../../../src/ol/geom/Circle.js';
import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../../src/ol/geom/LineString.js';
@@ -47,7 +47,7 @@ describe('ol.render.webgl.Immediate', function() {
describe('#drawFeature', function() {
var feat;
beforeEach(function() {
feat = new _ol_Feature_({
feat = new Feature({
geometry: circle
});
context.setStyle = function() {};
@@ -67,14 +67,14 @@ describe('ol.render.webgl.Immediate', function() {
});
it('does nothing if no geometry is provided', function() {
feat = new _ol_Feature_();
feat = new Feature();
context.drawFeature(feat, style);
expect(context.setStyle.called).to.be(false);
expect(context.drawGeometry.called).to.be(false);
});
it('does nothing if geometry is out of bounds', function() {
feat = new _ol_Feature_({
feat = new Feature({
geometry: new Circle([540, 540], 1)
});
context.drawFeature(feat, style);

View File

@@ -1,5 +1,5 @@
import {getUid} from '../../../../../src/ol/index.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import LineString from '../../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js';
@@ -286,13 +286,13 @@ describe('ol.render.webgl.LineStringReplay', function() {
describe('#drawReplay', function() {
var gl, context;
var feature1 = new _ol_Feature_({
var feature1 = new Feature({
geometry: new LineString([[0, 0], [500, 500]])
});
var feature2 = new _ol_Feature_({
var feature2 = new Feature({
geometry: new LineString([[0, 0], [500, 500]])
});
var feature3 = new _ol_Feature_({
var feature3 = new Feature({
geometry: new LineString([[0, 0], [500, 500]])
});
beforeEach(function() {

View File

@@ -1,5 +1,5 @@
import {getUid} from '../../../../../src/ol/index.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../../src/ol/geom/Polygon.js';
import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js';
@@ -395,13 +395,13 @@ describe('ol.render.webgl.PolygonReplay', function() {
describe('#drawReplay', function() {
var gl, context;
var feature1 = new _ol_Feature_({
var feature1 = new Feature({
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
});
var feature2 = new _ol_Feature_({
var feature2 = new Feature({
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
});
var feature3 = new _ol_Feature_({
var feature3 = new Feature({
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
});
beforeEach(function() {

View File

@@ -1,5 +1,5 @@
import {getUid} from '../../../../../src/ol/index.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import Map from '../../../../../src/ol/Map.js';
import _ol_View_ from '../../../../../src/ol/View.js';
import Point from '../../../../../src/ol/geom/Point.js';
@@ -53,7 +53,7 @@ describe('ol.renderer.canvas.Map', function() {
layer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({
features: [
new _ol_Feature_({
new Feature({
geometry: new Point([0, 0])
})
]

View File

@@ -1,5 +1,5 @@
import {getUid} from '../../../../../src/ol/index.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
@@ -29,13 +29,13 @@ describe('ol.render.canvas.ReplayGroup', function() {
beforeEach(function() {
transform = _ol_transform_.create();
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, false);
feature0 = new _ol_Feature_(new Polygon(
feature0 = new Feature(new Polygon(
[[[-90, 0], [-45, 45], [0, 0], [1, 1], [0, -45], [-90, 0]]]));
feature1 = new _ol_Feature_(new Polygon(
feature1 = new Feature(new Polygon(
[[[-90, -45], [-90, 0], [0, 0], [0, -45], [-90, -45]]]));
feature2 = new _ol_Feature_(new Polygon(
feature2 = new Feature(new Polygon(
[[[90, 45], [90, 0], [0, 0], [0, 45], [90, 45]]]));
feature3 = new _ol_Feature_(new Polygon(
feature3 = new Feature(new Polygon(
[[[-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45]]]));
fill0 = new _ol_style_Style_({
fill: new _ol_style_Fill_({color: 'black'})
@@ -229,17 +229,17 @@ describe('ol.render.canvas.ReplayGroup', function() {
});
}
});
var point = new _ol_Feature_(new Point([45, 90]));
var multipoint = new _ol_Feature_(new MultiPoint(
var point = new Feature(new Point([45, 90]));
var multipoint = new Feature(new MultiPoint(
[[45, 90], [90, 45]]));
var linestring = new _ol_Feature_(new LineString(
var linestring = new Feature(new LineString(
[[45, 90], [45, 45], [90, 45]]));
var multilinestring = new _ol_Feature_(new MultiLineString(
var multilinestring = new Feature(new MultiLineString(
[linestring.getGeometry().getCoordinates(), linestring.getGeometry().getCoordinates()]));
var polygon = feature1;
var multipolygon = new _ol_Feature_(new MultiPolygon(
var multipolygon = new Feature(new MultiPolygon(
[polygon.getGeometry().getCoordinates(), polygon.getGeometry().getCoordinates()]));
var geometrycollection = new _ol_Feature_(new GeometryCollection(
var geometrycollection = new Feature(new GeometryCollection(
[point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()]));
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, true);
_ol_renderer_vector_.renderFeature(replay, point, style, 1);

View File

@@ -1,5 +1,5 @@
import {getUid} from '../../../../../src/ol/index.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import Map from '../../../../../src/ol/Map.js';
import _ol_View_ from '../../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../../src/ol/extent.js';
@@ -66,8 +66,8 @@ describe('ol.renderer.canvas.VectorLayer', function() {
text: 'feature'
})
})];
var feature1 = new _ol_Feature_(new Point([0, 0]));
var feature2 = new _ol_Feature_(new Point([0, 0]));
var feature1 = new Feature(new Point([0, 0]));
var feature2 = new Feature(new Point([0, 0]));
feature2.setStyle(featureStyle);
var layer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({
@@ -100,7 +100,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
})
});
var feature = new _ol_Feature_(new Point([0, 0]));
var feature = new Feature(new Point([0, 0]));
var layer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({
features: [feature]
@@ -131,7 +131,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
})
});
var feature = new _ol_Feature_(new Point([0, 0]));
var feature = new Feature(new Point([0, 0]));
var layer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({
features: [feature]
@@ -163,7 +163,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
})
});
var feature = new _ol_Feature_(new Point([0, 0]));
var feature = new Feature(new Point([0, 0]));
var layer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({
features: [feature]
@@ -193,7 +193,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
renderer.replayGroup_ = replayGroup;
replayGroup.forEachFeatureAtCoordinate = function(coordinate,
resolution, rotation, hitTolerance, skippedFeaturesUids, callback) {
var feature = new _ol_Feature_();
var feature = new Feature();
callback(feature);
callback(feature);
};

View File

@@ -1,6 +1,6 @@
import {getUid, inherits} from '../../../../../src/ol/index.js';
import _ol_obj_ from '../../../../../src/ol/obj.js';
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
import Feature from '../../../../../src/ol/Feature.js';
import Map from '../../../../../src/ol/Map.js';
import TileState from '../../../../../src/ol/TileState.js';
import VectorImageTile from '../../../../../src/ol/VectorImageTile.js';
@@ -55,8 +55,8 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
text: 'feature'
})
})];
feature1 = new _ol_Feature_(new Point([1, -1]));
feature2 = new _ol_Feature_(new Point([0, 0]));
feature1 = new Feature(new Point([1, -1]));
feature2 = new Feature(new Point([0, 0]));
feature3 = new _ol_render_Feature_('Point', [1, -1], []);
feature2.setStyle(featureStyle);
var TileClass = function() {
@@ -317,7 +317,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
renderer = new _ol_renderer_canvas_VectorTileLayer_(layer);
replayGroup.forEachFeatureAtCoordinate = function(coordinate,
resolution, rotation, hitTolerance, skippedFeaturesUids, callback) {
var feature = new _ol_Feature_();
var feature = new Feature();
callback(feature);
callback(feature);
};

View File

@@ -12,7 +12,7 @@ import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
describe('ol.renderer.vector', function() {
@@ -23,7 +23,7 @@ describe('ol.renderer.vector', function() {
beforeEach(function() {
replayGroup = new _ol_render_canvas_ReplayGroup_(1);
feature = new _ol_Feature_();
feature = new Feature();
iconStyle = new _ol_style_Icon_({
src: 'http://example.com/icon.png'
});

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import LineString from '../../../../src/ol/geom/LineString.js';
import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
@@ -28,8 +28,8 @@ describe('ol.source.Cluster', function() {
var source = new _ol_source_Cluster_({
source: new _ol_source_Vector_({
features: [
new _ol_Feature_(new Point([0, 0])),
new _ol_Feature_(new Point([0, 0]))
new Feature(new Point([0, 0])),
new Feature(new Point([0, 0]))
]
})
});
@@ -50,9 +50,9 @@ describe('ol.source.Cluster', function() {
},
source: new _ol_source_Vector_({
features: [
new _ol_Feature_(new Point([0, 0])),
new _ol_Feature_(new LineString([[0, 0], [1, 1]])),
new _ol_Feature_(new Polygon(
new Feature(new Point([0, 0])),
new Feature(new LineString([[0, 0], [1, 1]])),
new Feature(new Polygon(
[[[-1, -1], [-1, 1], [1, 1], [1, -1], [-1, -1]]]))
]
})

View File

@@ -1,6 +1,6 @@
import _ol_events_ from '../../../../src/ol/events.js';
import _ol_Collection_ from '../../../../src/ol/Collection.js';
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Map from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js';
import Point from '../../../../src/ol/geom/Point.js';
@@ -16,7 +16,7 @@ describe('ol.source.Vector', function() {
var pointFeature;
var infiniteExtent;
beforeEach(function() {
pointFeature = new _ol_Feature_(new Point([0, 0]));
pointFeature = new Feature(new Point([0, 0]));
infiniteExtent = [-Infinity, -Infinity, Infinity, Infinity];
});
@@ -74,9 +74,9 @@ describe('ol.source.Vector', function() {
it('adds same id features only once', function() {
var source = new _ol_source_Vector_();
var feature1 = new _ol_Feature_();
var feature1 = new Feature();
feature1.setId('1');
var feature2 = new _ol_Feature_();
var feature2 = new Feature();
feature2.setId('1');
source.addFeature(feature1);
source.addFeature(feature2);
@@ -92,9 +92,9 @@ describe('ol.source.Vector', function() {
var features = [];
var vectorSource;
beforeEach(function() {
features.push(new _ol_Feature_(new LineString([[0, 0], [10, 10]])));
features.push(new _ol_Feature_(new Point([0, 10])));
features.push(new _ol_Feature_(new Point([10, 5])));
features.push(new Feature(new LineString([[0, 0], [10, 10]])));
features.push(new Feature(new Point([0, 10])));
features.push(new Feature(new Point([10, 5])));
vectorSource = new _ol_source_Vector_({
features: features
});
@@ -127,9 +127,9 @@ describe('ol.source.Vector', function() {
var i;
for (i = 0; i < 10; ++i) {
features[i] =
new _ol_Feature_(new Point([Math.random(), Math.random()]));
new Feature(new Point([Math.random(), Math.random()]));
}
features.push(new _ol_Feature_(null));
features.push(new Feature(null));
vectorSource = new _ol_source_Vector_({
features: features
});
@@ -269,7 +269,7 @@ describe('ol.source.Vector', function() {
});
it('keeps its index up-to-date', function() {
var feature = new _ol_Feature_(new Point([1, 1]));
var feature = new Feature(new Point([1, 1]));
vectorSource.addFeature(feature);
expect(vectorSource.getFeaturesInExtent([0, 0, 2, 2])).
to.eql([feature]);
@@ -281,13 +281,13 @@ describe('ol.source.Vector', function() {
});
it('handles features with null geometries', function() {
var feature = new _ol_Feature_(null);
var feature = new Feature(null);
vectorSource.addFeature(feature);
expect(vectorSource.getFeatures()).to.eql([feature]);
});
it('handles features with geometries changing from null', function() {
var feature = new _ol_Feature_(null);
var feature = new Feature(null);
vectorSource.addFeature(feature);
expect(vectorSource.getFeatures()).to.eql([feature]);
feature.setGeometry(new Point([1, 1]));
@@ -297,7 +297,7 @@ describe('ol.source.Vector', function() {
});
it('handles features with geometries changing to null', function() {
var feature = new _ol_Feature_(new Point([1, 1]));
var feature = new Feature(new Point([1, 1]));
vectorSource.addFeature(feature);
expect(vectorSource.getFeatures()).to.eql([feature]);
expect(vectorSource.getFeaturesInExtent([0, 0, 2, 2])).
@@ -308,7 +308,7 @@ describe('ol.source.Vector', function() {
});
it('fires a change event when setting a feature\'s property', function() {
var feature = new _ol_Feature_(new Point([1, 1]));
var feature = new Feature(new Point([1, 1]));
vectorSource.addFeature(feature);
var listener = sinon.spy();
_ol_events_.listen(vectorSource, 'change', listener);
@@ -317,7 +317,7 @@ describe('ol.source.Vector', function() {
});
it('fires a changefeature event when updating a feature', function() {
var feature = new _ol_Feature_(new Point([1, 1]));
var feature = new Feature(new Point([1, 1]));
vectorSource.addFeature(feature);
var listener = sinon.spy(function(event) {
expect(event.feature).to.be(feature);
@@ -336,14 +336,14 @@ describe('ol.source.Vector', function() {
});
it('returns a feature by id', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
source.addFeature(feature);
expect(source.getFeatureById('foo')).to.be(feature);
});
it('returns a feature by id (set after add)', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
source.addFeature(feature);
expect(source.getFeatureById('foo')).to.be(null);
feature.setId('foo');
@@ -351,14 +351,14 @@ describe('ol.source.Vector', function() {
});
it('returns null when no feature is found', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
source.addFeature(feature);
expect(source.getFeatureById('bar')).to.be(null);
});
it('returns null after removing feature', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
source.addFeature(feature);
expect(source.getFeatureById('foo')).to.be(feature);
@@ -367,7 +367,7 @@ describe('ol.source.Vector', function() {
});
it('returns null after unsetting id', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
source.addFeature(feature);
expect(source.getFeatureById('foo')).to.be(feature);
@@ -376,7 +376,7 @@ describe('ol.source.Vector', function() {
});
it('returns null after clear', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
source.addFeature(feature);
expect(source.getFeatureById('foo')).to.be(feature);
@@ -386,19 +386,19 @@ describe('ol.source.Vector', function() {
it('returns null when no features are indexed', function() {
expect(source.getFeatureById('foo')).to.be(null);
source.addFeature(new _ol_Feature_());
source.addFeature(new Feature());
expect(source.getFeatureById('foo')).to.be(null);
});
it('returns correct feature after add/remove/add', function() {
expect(source.getFeatureById('foo')).to.be(null);
var first = new _ol_Feature_();
var first = new Feature();
first.setId('foo');
source.addFeature(first);
expect(source.getFeatureById('foo')).to.be(first);
source.removeFeature(first);
expect(source.getFeatureById('foo')).to.be(null);
var second = new _ol_Feature_();
var second = new Feature();
second.setId('foo');
source.addFeature(second);
expect(source.getFeatureById('foo')).to.be(second);
@@ -406,7 +406,7 @@ describe('ol.source.Vector', function() {
it('returns correct feature after add/change', function() {
expect(source.getFeatureById('foo')).to.be(null);
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
source.addFeature(feature);
expect(source.getFeatureById('foo')).to.be(feature);
@@ -515,10 +515,10 @@ describe('ol.source.Vector', function() {
});
it('ignores features with the same id', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setId('foo');
source.addFeature(feature);
var dupe = new _ol_Feature_();
var dupe = new Feature();
dupe.setId('foo');
source.addFeature(dupe);
expect(source.getFeatures()).to.have.length(1);
@@ -526,10 +526,10 @@ describe('ol.source.Vector', function() {
});
it('allows changing feature and set the same id', function() {
var foo = new _ol_Feature_();
var foo = new Feature();
foo.setId('foo');
source.addFeature(foo);
var bar = new _ol_Feature_();
var bar = new Feature();
bar.setId('bar');
source.addFeature(bar);
bar.setId('foo');
@@ -545,7 +545,7 @@ describe('ol.source.Vector', function() {
});
it('disallows adding the same feature twice', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
source.addFeature(feature);
expect(function() {
source.addFeature(feature);
@@ -564,7 +564,7 @@ describe('ol.source.Vector', function() {
});
it('#forEachFeatureInExtent loops through all features', function() {
source.addFeatures([new _ol_Feature_(), new _ol_Feature_()]);
source.addFeatures([new Feature(), new Feature()]);
var spy = sinon.spy();
source.forEachFeatureInExtent([0, 0, 0, 0], spy);
expect(spy.callCount).to.be(2);
@@ -586,7 +586,7 @@ describe('ol.source.Vector', function() {
});
it('adding/removing features keeps the collection in sync', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
source.addFeature(feature);
expect(collection.getLength()).to.be(1);
source.removeFeature(feature);
@@ -594,7 +594,7 @@ describe('ol.source.Vector', function() {
});
it('#clear() features keeps the collection in sync', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
source.addFeatures([feature]);
expect(collection.getLength()).to.be(1);
source.clear();
@@ -606,7 +606,7 @@ describe('ol.source.Vector', function() {
});
it('keeps the source\'s features in sync with the collection', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
collection.push(feature);
expect(source.getFeatures().length).to.be(1);
collection.remove(feature);
@@ -633,7 +633,7 @@ describe('ol.source.Vector', function() {
});
it('adding/removing features keeps the collection in sync', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
source.addFeature(feature);
expect(collection.getLength()).to.be(1);
source.removeFeature(feature);
@@ -641,7 +641,7 @@ describe('ol.source.Vector', function() {
});
it('#clear() features keeps the collection in sync', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
source.addFeatures([feature]);
expect(collection.getLength()).to.be(1);
source.clear();
@@ -653,7 +653,7 @@ describe('ol.source.Vector', function() {
});
it('keeps the source\'s features in sync with the collection', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
collection.push(feature);
expect(source.getFeatures().length).to.be(1);
collection.remove(feature);

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Feature from '../../../../src/ol/Feature.js';
import Point from '../../../../src/ol/geom/Point.js';
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
@@ -194,7 +194,7 @@ describe('ol.style.Style', function() {
var style = new _ol_style_Style_();
it('creates a geometry function from a string', function() {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.set('myGeom', new Point([0, 0]));
style.setGeometry('myGeom');
expect(style.getGeometryFunction()(feature))

View File

@@ -1,4 +1,4 @@
import _ol_Feature_ from '../../../src/ol/Feature.js';
import Feature from '../../../src/ol/Feature.js';
import {defaultLoadFunction} from '../../../src/ol/VectorImageTile.js';
import VectorTile from '../../../src/ol/VectorTile.js';
import _ol_events_ from '../../../src/ol/events.js';
@@ -19,7 +19,7 @@ describe('ol.VectorTile', function() {
});
};
format.readFeatures = function(source, options) {
return [new _ol_Feature_()];
return [new Feature()];
};
var tile = new VectorTile([0, 0, 0], null, null, format);