Full code cleanup

This commit is contained in:
Pieter Vander Vennet 2022-01-26 21:40:38 +01:00
parent 3a4a2a2016
commit fa971ffbbf
300 changed files with 16352 additions and 19284 deletions

View file

@ -40,7 +40,7 @@ export default class DynamicGeoJsonTileSource extends DynamicTileSource {
json => {
const data = new Map<number, Set<number>>();
for (const x in json) {
if(x === "zoom"){
if (x === "zoom") {
continue
}
data.set(Number(x), new Set(json[x]))
@ -91,7 +91,7 @@ export default class DynamicGeoJsonTileSource extends DynamicTileSource {
public static RegisterWhitelist(url: string, json: any) {
const data = new Map<number, Set<number>>();
for (const x in json) {
if(x === "zoom"){
if (x === "zoom") {
continue
}
data.set(Number(x), new Set(json[x]))

View file

@ -44,11 +44,11 @@ export default class DynamicTileSource implements TileHierarchy<FeatureSourceFor
return undefined
}
const tileRange = Tiles.TileRangeBetween(zoomlevel, bounds.getNorth(), bounds.getEast(), bounds.getSouth(), bounds.getWest())
if(tileRange.total > 10000){
if (tileRange.total > 10000) {
console.error("Got a really big tilerange, bounds and location might be out of sync")
return undefined
}
const needed = Tiles.MapRange(tileRange, (x, y) => Tiles.tile_index(zoomlevel, x, y)).filter(i => !self._loadedTiles.has(i))
if (needed.length === 0) {
return undefined

View file

@ -45,8 +45,8 @@ export default class FullNodeDatabaseSource implements TileHierarchy<FeatureSour
for (const nodeId of osmWay.nodes) {
if (!this.parentWays.has(nodeId)) {
const src = new UIEventSource<OsmWay[]>([])
this.parentWays.set(nodeId,src)
const src = new UIEventSource<OsmWay[]>([])
this.parentWays.set(nodeId, src)
src.addCallback(parentWays => {
const tgs = nodesById.get(nodeId).tags
tgs ["parent_ways"] = JSON.stringify(parentWays.map(w => w.tags))

View file

@ -89,8 +89,8 @@ export default class OsmFeatureSource {
if (z > 20) {
throw "This is an absurd high zoom level"
}
if( z < 14){
if (z < 14) {
throw `Zoom ${z} is too much for OSM to handle! Use a higher zoom level!`
}