Chore: housekeeping

This commit is contained in:
Pieter Vander Vennet 2025-02-10 02:04:58 +01:00
parent cd9e03dd6f
commit b300fffdc5
156 changed files with 4436 additions and 1318 deletions

View file

@ -47,8 +47,10 @@ Utils.injectJsonDownloadForTests("https://www.openstreetmap.org/api/0.6/node/556
Utils.injectJsonDownloadForTests("./assets/data/editor-layer-index.json", '{"features": [] }')
it("should download the latest version", async () => {
const state = new ThemeViewState(new ThemeConfig(<any>bookcaseJson, true),
new ImmutableStore<Set<string>>(new Set()))
const state = new ThemeViewState(
new ThemeConfig(<any>bookcaseJson, true),
new ImmutableStore<Set<string>>(new Set())
)
const feature: Feature<Geometry, OsmTags> = {
type: "Feature",
id: "node/5568693115",

View file

@ -15,11 +15,11 @@ describe("GeoOperations", () => {
[3.218560377159008, 51.21499687768525],
[3.2207456783268356, 51.21499687768525],
[3.2207456783268356, 51.21600586532159],
[3.218560377159008, 51.21600586532159]
]
[3.218560377159008, 51.21600586532159],
],
],
type: "Polygon"
}
type: "Polygon",
},
}
const line: Feature<LineString> = {
type: "Feature",
@ -27,10 +27,10 @@ describe("GeoOperations", () => {
geometry: {
coordinates: [
[3.218405371672816, 51.21499091846559],
[3.2208408127450525, 51.21560173433727]
[3.2208408127450525, 51.21560173433727],
],
type: "LineString"
}
type: "LineString",
},
}
const result = GeoOperations.clipWith(line, bbox)
expect(result.length).to.equal(1)
@ -38,83 +38,50 @@ describe("GeoOperations", () => {
const clippedLine = (<Feature<LineString>>result[0]).geometry.coordinates
const expCoordinates = [
[3.2185604, 51.215029800031594],
[3.2207457, 51.21557787977764]
[3.2207457, 51.21557787977764],
]
expect(clippedLine).to.deep.equal(expCoordinates)
})
it("clipWith should contain the full feature if it is fully contained", () => {
const bbox: Feature<Polygon> = {
type: "Feature",
properties: {},
geometry: {
coordinates: [
[
[
2.1541744759711037,
51.73994420687188
],
[
2.1541744759711037,
50.31129074222787
],
[
4.53247037641421,
50.31129074222787
],
[
4.53247037641421,
51.73994420687188
],
[
2.1541744759711037,
51.73994420687188
]
]
const bbox: Feature<Polygon> = {
type: "Feature",
properties: {},
geometry: {
coordinates: [
[
[2.1541744759711037, 51.73994420687188],
[2.1541744759711037, 50.31129074222787],
[4.53247037641421, 50.31129074222787],
[4.53247037641421, 51.73994420687188],
[2.1541744759711037, 51.73994420687188],
],
type: "Polygon"
}
}
const content: Feature<Polygon> = {
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[
2.8900597545854225,
50.9035099487991
],
[
3.4872999807053873,
50.74856284865993
],
[
3.9512276563531543,
50.947206170675486
],
[
3.897902636163167,
51.25526892606362
],
[
3.188679867646016,
51.24525576870511
], [
2.8900597545854225,
50.9035099487991
]
]
],
"type": "Polygon"
}
}
const clipped = GeoOperations.clipWith(content, bbox)
expect(clipped.length).to.equal(1)
const clippedReverse = GeoOperations.clipWith(bbox, content)
expect(clippedReverse.length).to.equal(1)
],
type: "Polygon",
},
}
)
const content: Feature<Polygon> = {
type: "Feature",
properties: {},
geometry: {
coordinates: [
[
[2.8900597545854225, 50.9035099487991],
[3.4872999807053873, 50.74856284865993],
[3.9512276563531543, 50.947206170675486],
[3.897902636163167, 51.25526892606362],
[3.188679867646016, 51.24525576870511],
[2.8900597545854225, 50.9035099487991],
],
],
type: "Polygon",
},
}
const clipped = GeoOperations.clipWith(content, bbox)
expect(clipped.length).to.equal(1)
const clippedReverse = GeoOperations.clipWith(bbox, content)
expect(clippedReverse.length).to.equal(1)
})
})
})