Make code prettier
This updates ESLint and our shared eslint-config-openlayers to use Prettier. Most formatting changes were automatically applied with this:
npm run lint -- --fix
A few manual changes were required:
* In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
* In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason. While editing this, I reworked `ExampleBuilder` to be a class.
* In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
@@ -1,40 +1,96 @@
|
||||
import {linearRingContainsXY} from '../../../../../src/ol/geom/flat/contains.js';
|
||||
|
||||
|
||||
describe('ol.geom.flat.contains', function() {
|
||||
|
||||
describe('with simple data', function() {
|
||||
|
||||
describe('ol.geom.flat.contains', function () {
|
||||
describe('with simple data', function () {
|
||||
const flatCoordinatesSimple = [0, 0, 1, 0, 1, 1, 0, 1];
|
||||
const flatCoordinatesNonSimple = [0, 0, 4, 0, 4, 3, 1, 3, 1, 2, 3, 2, 3, 1, 2, 1, 2, 4, 0, 4];
|
||||
const flatCoordinatesNonSimple = [
|
||||
0,
|
||||
0,
|
||||
4,
|
||||
0,
|
||||
4,
|
||||
3,
|
||||
1,
|
||||
3,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
4,
|
||||
0,
|
||||
4,
|
||||
];
|
||||
|
||||
describe('ol.geom.flat.contains.linearRingContainsXY', function() {
|
||||
|
||||
it('returns true for point inside a simple polygon', function() {
|
||||
expect(linearRingContainsXY(
|
||||
flatCoordinatesSimple, 0, flatCoordinatesSimple.length, 2, 0.5, 0.5)).to.be(true);
|
||||
describe('ol.geom.flat.contains.linearRingContainsXY', function () {
|
||||
it('returns true for point inside a simple polygon', function () {
|
||||
expect(
|
||||
linearRingContainsXY(
|
||||
flatCoordinatesSimple,
|
||||
0,
|
||||
flatCoordinatesSimple.length,
|
||||
2,
|
||||
0.5,
|
||||
0.5
|
||||
)
|
||||
).to.be(true);
|
||||
});
|
||||
|
||||
it('returns false for point outside a simple polygon', function() {
|
||||
expect(linearRingContainsXY(
|
||||
flatCoordinatesSimple, 0, flatCoordinatesSimple.length, 2, 1.5, 1.5)).to.be(false);
|
||||
it('returns false for point outside a simple polygon', function () {
|
||||
expect(
|
||||
linearRingContainsXY(
|
||||
flatCoordinatesSimple,
|
||||
0,
|
||||
flatCoordinatesSimple.length,
|
||||
2,
|
||||
1.5,
|
||||
1.5
|
||||
)
|
||||
).to.be(false);
|
||||
});
|
||||
|
||||
it('returns true for point inside a non-simple polygon', function() {
|
||||
expect(linearRingContainsXY(
|
||||
flatCoordinatesNonSimple, 0, flatCoordinatesNonSimple.length, 2, 1, 1)).to.be(true);
|
||||
it('returns true for point inside a non-simple polygon', function () {
|
||||
expect(
|
||||
linearRingContainsXY(
|
||||
flatCoordinatesNonSimple,
|
||||
0,
|
||||
flatCoordinatesNonSimple.length,
|
||||
2,
|
||||
1,
|
||||
1
|
||||
)
|
||||
).to.be(true);
|
||||
});
|
||||
|
||||
it('returns true for point inside an overlap of a non-simple polygon', function() {
|
||||
expect(linearRingContainsXY(
|
||||
flatCoordinatesNonSimple, 0, flatCoordinatesNonSimple.length, 2, 1.5, 2.5)).to.be(true);
|
||||
it('returns true for point inside an overlap of a non-simple polygon', function () {
|
||||
expect(
|
||||
linearRingContainsXY(
|
||||
flatCoordinatesNonSimple,
|
||||
0,
|
||||
flatCoordinatesNonSimple.length,
|
||||
2,
|
||||
1.5,
|
||||
2.5
|
||||
)
|
||||
).to.be(true);
|
||||
});
|
||||
|
||||
it('returns false for a point inside a hole of a non-simple polygon', function() {
|
||||
expect(linearRingContainsXY(
|
||||
flatCoordinatesNonSimple, 0, flatCoordinatesNonSimple.length, 2, 2.5, 1.5)).to.be(false);
|
||||
it('returns false for a point inside a hole of a non-simple polygon', function () {
|
||||
expect(
|
||||
linearRingContainsXY(
|
||||
flatCoordinatesNonSimple,
|
||||
0,
|
||||
flatCoordinatesNonSimple.length,
|
||||
2,
|
||||
2.5,
|
||||
1.5
|
||||
)
|
||||
).to.be(false);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user