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

@ -6,7 +6,7 @@ import { bbox } from "@turf/bbox"
export class BBox {
static global: BBox = new BBox([
[-180, -90],
[180, 90]
[180, 90],
])
readonly maxLat: number
readonly maxLon: number
@ -62,7 +62,7 @@ export class BBox {
static fromLeafletBounds(bounds) {
return new BBox([
[bounds.getWest(), bounds.getNorth()],
[bounds.getEast(), bounds.getSouth()]
[bounds.getEast(), bounds.getSouth()],
])
}
@ -101,7 +101,7 @@ export class BBox {
}
return new BBox([
[maxLon, maxLat],
[minLon, minLat]
[minLon, minLat],
])
}
@ -128,7 +128,7 @@ export class BBox {
public unionWith(other: BBox) {
return new BBox([
[Math.max(this.maxLon, other.maxLon), Math.max(this.maxLat, other.maxLat)],
[Math.min(this.minLon, other.minLon), Math.min(this.minLat, other.minLat)]
[Math.min(this.minLon, other.minLon), Math.min(this.minLat, other.minLat)],
])
}
@ -181,7 +181,7 @@ export class BBox {
return new BBox([
[lon - s / 2, lat - s / 2],
[lon + s / 2, lat + s / 2]
[lon + s / 2, lat + s / 2],
])
}
@ -238,21 +238,21 @@ export class BBox {
const lonDiff = Math.min(maxIncrease / 2, Math.abs(this.maxLon - this.minLon) * factor)
return new BBox([
[this.minLon - lonDiff, this.minLat - latDiff],
[this.maxLon + lonDiff, this.maxLat + latDiff]
[this.maxLon + lonDiff, this.maxLat + latDiff],
])
}
padAbsolute(degrees: number): BBox {
return new BBox([
[this.minLon - degrees, this.minLat - degrees],
[this.maxLon + degrees, this.maxLat + degrees]
[this.maxLon + degrees, this.maxLat + degrees],
])
}
toLngLat(): [[number, number], [number, number]] {
return [
[this.minLon, this.minLat],
[this.maxLon, this.maxLat]
[this.maxLon, this.maxLat],
]
}
@ -271,7 +271,7 @@ export class BBox {
return {
type: "Feature",
properties: properties,
geometry: this.asGeometry()
geometry: this.asGeometry(),
}
}
@ -284,9 +284,9 @@ export class BBox {
[this.maxLon, this.minLat],
[this.maxLon, this.maxLat],
[this.minLon, this.maxLat],
[this.minLon, this.minLat]
]
]
[this.minLon, this.minLat],
],
],
}
}
@ -316,7 +316,7 @@ export class BBox {
minLon,
maxLon,
minLat,
maxLat
maxLat,
}
}