Rename _ol_geom_LineString_ to LineString
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import _ol_geom_Geometry_ from '../../../../src/ol/geom/Geometry.js';
|
||||
import _ol_geom_GeometryCollection_ from '../../../../src/ol/geom/GeometryCollection.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
var line, multi, point, poly;
|
||||
beforeEach(function() {
|
||||
point = new Point([10, 20]);
|
||||
line = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
line = new LineString([[10, 20], [30, 40]]);
|
||||
poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
||||
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||
});
|
||||
@@ -57,7 +57,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
|
||||
it('returns a collection of geometries', function() {
|
||||
var point = new Point([10, 20]);
|
||||
var line = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
var line = new LineString([[10, 20], [30, 40]]);
|
||||
var poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
||||
var multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
expect(geometries).to.be.an(Array);
|
||||
expect(geometries).to.have.length(3);
|
||||
expect(geometries[0]).to.be.a(Point);
|
||||
expect(geometries[1]).to.be.a(_ol_geom_LineString_);
|
||||
expect(geometries[1]).to.be.a(LineString);
|
||||
expect(geometries[2]).to.be.a(_ol_geom_Polygon_);
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
|
||||
it('has a working clone method', function() {
|
||||
var point = new Point([10, 20]);
|
||||
var line = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
var line = new LineString([[10, 20], [30, 40]]);
|
||||
var poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
||||
var multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||
var clone = multi.clone();
|
||||
@@ -106,7 +106,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
|
||||
it('returns the bounding extent', function() {
|
||||
var point = new Point([10, 2]);
|
||||
var line = new _ol_geom_LineString_([[1, 20], [30, 40]]);
|
||||
var line = new LineString([[1, 20], [30, 40]]);
|
||||
var multi = new _ol_geom_GeometryCollection_([point, line]);
|
||||
var extent = multi.getExtent();
|
||||
expect(extent[0]).to.be(1);
|
||||
@@ -123,7 +123,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
point = new Point([5, 20]);
|
||||
line = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
line = new LineString([[10, 20], [30, 40]]);
|
||||
poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
||||
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||
});
|
||||
@@ -152,7 +152,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
var line, multi, point, poly;
|
||||
beforeEach(function() {
|
||||
point = new Point([10, 20]);
|
||||
line = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
line = new LineString([[10, 20], [30, 40]]);
|
||||
poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
||||
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||
});
|
||||
@@ -177,7 +177,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
it('scales a collection', function() {
|
||||
var geom = new _ol_geom_GeometryCollection_([
|
||||
new Point([-1, -2]),
|
||||
new _ol_geom_LineString_([[0, 0], [1, 2]])
|
||||
new LineString([[0, 0], [1, 2]])
|
||||
]);
|
||||
geom.scale(10);
|
||||
var geometries = geom.getGeometries();
|
||||
@@ -188,7 +188,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
it('accepts sx and sy', function() {
|
||||
var geom = new _ol_geom_GeometryCollection_([
|
||||
new Point([-1, -2]),
|
||||
new _ol_geom_LineString_([[0, 0], [1, 2]])
|
||||
new LineString([[0, 0], [1, 2]])
|
||||
]);
|
||||
geom.scale(2, 3);
|
||||
var geometries = geom.getGeometries();
|
||||
@@ -199,7 +199,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
it('accepts an anchor', function() {
|
||||
var geom = new _ol_geom_GeometryCollection_([
|
||||
new Point([-1, -2]),
|
||||
new _ol_geom_LineString_([[0, 0], [1, 2]])
|
||||
new LineString([[0, 0], [1, 2]])
|
||||
]);
|
||||
geom.scale(10, 15, [-1, -2]);
|
||||
var geometries = geom.getGeometries();
|
||||
@@ -214,7 +214,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
var line, multi, point;
|
||||
beforeEach(function() {
|
||||
point = new Point([10, 20]);
|
||||
line = new _ol_geom_LineString_([[10, 20], [30, 40]]);
|
||||
line = new LineString([[10, 20], [30, 40]]);
|
||||
multi = new _ol_geom_GeometryCollection_([point, line]);
|
||||
});
|
||||
|
||||
@@ -223,7 +223,7 @@ describe('ol.geom.GeometryCollection', function() {
|
||||
|
||||
var geometries = multi.getGeometries();
|
||||
expect(geometries[0]).to.be.a(Point);
|
||||
expect(geometries[1]).to.be.a(_ol_geom_LineString_);
|
||||
expect(geometries[1]).to.be.a(LineString);
|
||||
|
||||
var coords = geometries[0].getCoordinates();
|
||||
expect(coords[0]).to.roughlyEqual(1113194.90, 1e-2);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
|
||||
|
||||
describe('ol.geom.LineString', function() {
|
||||
|
||||
it('can be constructed with a null geometry', function() {
|
||||
expect(function() {
|
||||
return new _ol_geom_LineString_(null);
|
||||
return new LineString(null);
|
||||
}).not.to.throwException();
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_([]);
|
||||
lineString = new LineString([]);
|
||||
});
|
||||
|
||||
it('defaults to layout XY', function() {
|
||||
@@ -50,7 +50,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_([[1, 2], [3, 4]]);
|
||||
lineString = new LineString([[1, 2], [3, 4]]);
|
||||
});
|
||||
|
||||
it('has the expected layout', function() {
|
||||
@@ -111,7 +111,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_([[1, 2, 3], [4, 5, 6]]);
|
||||
lineString = new LineString([[1, 2, 3], [4, 5, 6]]);
|
||||
});
|
||||
|
||||
it('has the expected layout', function() {
|
||||
@@ -156,7 +156,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_(
|
||||
lineString = new LineString(
|
||||
[[1, 2, 3], [4, 5, 6]], 'XYM');
|
||||
});
|
||||
|
||||
@@ -202,7 +202,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_([[1, 2, 3, 4], [5, 6, 7, 8]]);
|
||||
lineString = new LineString([[1, 2, 3, 4], [5, 6, 7, 8]]);
|
||||
});
|
||||
|
||||
it('has the expected layout', function() {
|
||||
@@ -246,21 +246,21 @@ describe('ol.geom.LineString', function() {
|
||||
describe('#scale()', function() {
|
||||
|
||||
it('scales a linestring', function() {
|
||||
var geom = new _ol_geom_LineString_([[-10, -20], [10, 20]]);
|
||||
var geom = new LineString([[-10, -20], [10, 20]]);
|
||||
geom.scale(10);
|
||||
var coordinates = geom.getCoordinates();
|
||||
expect(coordinates).to.eql([[-100, -200], [100, 200]]);
|
||||
});
|
||||
|
||||
it('accepts sx and sy', function() {
|
||||
var geom = new _ol_geom_LineString_([[-10, -20], [10, 20]]);
|
||||
var geom = new LineString([[-10, -20], [10, 20]]);
|
||||
geom.scale(2, 3);
|
||||
var coordinates = geom.getCoordinates();
|
||||
expect(coordinates).to.eql([[-20, -60], [20, 60]]);
|
||||
});
|
||||
|
||||
it('accepts an anchor', function() {
|
||||
var geom = new _ol_geom_LineString_([[-10, -20], [10, 20]]);
|
||||
var geom = new LineString([[-10, -20], [10, 20]]);
|
||||
geom.scale(3, 2, [10, 20]);
|
||||
var coordinates = geom.getCoordinates();
|
||||
expect(coordinates).to.eql([[-50, -60], [10, 20]]);
|
||||
@@ -272,7 +272,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_(
|
||||
lineString = new LineString(
|
||||
[[0, 0], [1.5, 1], [3, 3], [5, 1], [6, 3.5], [7, 5]]);
|
||||
});
|
||||
|
||||
@@ -308,7 +308,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
it('returns a simplified geometry', function() {
|
||||
var simplified = lineString.simplify(1);
|
||||
expect(simplified).to.be.an(_ol_geom_LineString_);
|
||||
expect(simplified).to.be.an(LineString);
|
||||
expect(simplified.getCoordinates()).to.eql(
|
||||
[[0, 0], [3, 3], [5, 1], [7, 5]]);
|
||||
});
|
||||
@@ -331,7 +331,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
it('returns the expectedResult', function() {
|
||||
var simplifiedGeometry = lineString.getSimplifiedGeometry(1);
|
||||
expect(simplifiedGeometry).to.be.an(_ol_geom_LineString_);
|
||||
expect(simplifiedGeometry).to.be.an(LineString);
|
||||
expect(simplifiedGeometry.getCoordinates()).to.eql(
|
||||
[[0, 0], [3, 3], [5, 1], [7, 5]]);
|
||||
});
|
||||
@@ -384,7 +384,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_(
|
||||
lineString = new LineString(
|
||||
[[1, 2, 3], [4, 5, 6]], 'XYM');
|
||||
});
|
||||
|
||||
@@ -413,7 +413,7 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
var lineString;
|
||||
beforeEach(function() {
|
||||
lineString = new _ol_geom_LineString_([
|
||||
lineString = new LineString([
|
||||
[0, 0, 0, 0],
|
||||
[1, -1, 2, 1],
|
||||
[2, -2, 4, 2],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_geom_LineString_ from '../../../../src/ol/geom/LineString.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_MultiLineString_ from '../../../../src/ol/geom/MultiLineString.js';
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('can append line strings', function() {
|
||||
multiLineString.appendLineString(
|
||||
new _ol_geom_LineString_([[1, 2], [3, 4]]));
|
||||
new LineString([[1, 2], [3, 4]]));
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2], [3, 4]]]);
|
||||
multiLineString.appendLineString(
|
||||
new _ol_geom_LineString_([[5, 6], [7, 8]]));
|
||||
new LineString([[5, 6], [7, 8]]));
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
});
|
||||
@@ -168,11 +168,11 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('can return individual line strings', function() {
|
||||
var lineString0 = multiLineString.getLineString(0);
|
||||
expect(lineString0).to.be.an(_ol_geom_LineString_);
|
||||
expect(lineString0).to.be.an(LineString);
|
||||
expect(lineString0.getLayout()).to.be('XYM');
|
||||
expect(lineString0.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
|
||||
var lineString1 = multiLineString.getLineString(1);
|
||||
expect(lineString1).to.be.an(_ol_geom_LineString_);
|
||||
expect(lineString1).to.be.an(LineString);
|
||||
expect(lineString1.getLayout()).to.be('XYM');
|
||||
expect(lineString1.getCoordinates()).to.eql([[7, 8, 9], [10, 11, 12]]);
|
||||
});
|
||||
@@ -344,8 +344,8 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('sets the line strings', function() {
|
||||
var multiLineString = new _ol_geom_MultiLineString_(null);
|
||||
var lineString1 = new _ol_geom_LineString_([[1, 2], [3, 4]]);
|
||||
var lineString2 = new _ol_geom_LineString_([[5, 6], [7, 8]]);
|
||||
var lineString1 = new LineString([[1, 2], [3, 4]]);
|
||||
var lineString2 = new LineString([[5, 6], [7, 8]]);
|
||||
multiLineString.setLineStrings([lineString1, lineString2]);
|
||||
expect(multiLineString.getFlatCoordinates()).to.eql(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
|
||||
Reference in New Issue
Block a user