From c1d21fcbe5778abfe0aa69448bbd1bdb9e572772 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 18 Oct 2021 18:54:36 +0200 Subject: [PATCH] Rewordings on etymology theme, fix bug where data doesn't load --- Logic/FeatureSource/FeaturePipeline.ts | 25 ++++++++++++------- .../FeatureSource/TileFreshnessCalculator.ts | 1 - Logic/Web/Wikidata.ts | 2 -- assets/themes/etymology.json | 4 +-- langs/themes/en.json | 2 +- langs/themes/nl.json | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Logic/FeatureSource/FeaturePipeline.ts b/Logic/FeatureSource/FeaturePipeline.ts index ffe194043d..e8b77bb77c 100644 --- a/Logic/FeatureSource/FeaturePipeline.ts +++ b/Logic/FeatureSource/FeaturePipeline.ts @@ -28,6 +28,17 @@ import {Tiles} from "../../Models/TileRange"; import TileFreshnessCalculator from "./TileFreshnessCalculator"; +/** + * The features pipeline ties together a myriad of various datasources: + * + * - The Overpass-API + * - The OSM-API + * - Third-party geojson files, either sliced or directly. + * + * In order to truly understand this class, please have a look at the following diagram: https://cdn-images-1.medium.com/fit/c/800/618/1*qTK1iCtyJUr4zOyw4IFD7A.jpeg + * + * + */ export default class FeaturePipeline { public readonly sufficientlyZoomed: UIEventSource; @@ -110,7 +121,7 @@ export default class FeaturePipeline { handleFeatureSource(srcFiltered) self.somethingLoaded.setData(true) - self.freshnesses.get(src.layer.layerDef.id).addTileLoad(src.tileIndex, new Date()) + // We do not mark as visited here, this is the responsability of the code near the actual loader (e.g. overpassLoader and OSMApiFeatureLoader) }; @@ -190,6 +201,7 @@ export default class FeaturePipeline { markTileVisited: (tileId) => state.filteredLayers.data.forEach(flayer => { SaveTileToLocalStorageActor.MarkVisited(flayer.layerDef.id, tileId, new Date()) + self.freshnesses.get(flayer.layerDef.id).addTileLoad(tileId, new Date()) }) }) @@ -277,7 +289,6 @@ export default class FeaturePipeline { private getNeededTilesFromOsm(isSufficientlyZoomed: UIEventSource): UIEventSource { const self = this return this.state.currentBounds.map(bbox => { - console.log("Current bbox is", bbox) if (bbox === undefined) { return [] } @@ -320,18 +331,14 @@ export default class FeaturePipeline { } let zoom = state.locationControl.data.zoom if (zoom < minzoom) { + // We are zoomed out over the zoomlevel of any layer return false; } - if (zoom > 16) { - zoom = 16 - } - if (zoom < 8) { - zoom = zoom + 2 - } const range = bbox.containingTileRange(zoom) if (range.total >= 5000) { - return false + // Let's assume we don't have so much data cached + return true } const self = this; const allFreshnesses = Tiles.MapRange(range, (x, y) => self.freshnessForVisibleLayers(zoom, x, y)) diff --git a/Logic/FeatureSource/TileFreshnessCalculator.ts b/Logic/FeatureSource/TileFreshnessCalculator.ts index 6b397f5408..85ff8ae121 100644 --- a/Logic/FeatureSource/TileFreshnessCalculator.ts +++ b/Logic/FeatureSource/TileFreshnessCalculator.ts @@ -19,7 +19,6 @@ export default class TileFreshnessCalculator { return; } this.freshnesses.set(tileId, freshness) - // Do we have freshness for the neighbouring tiles? If so, we can mark the tile above as loaded too! let [z, x, y] = Tiles.tile_from_index(tileId) diff --git a/Logic/Web/Wikidata.ts b/Logic/Web/Wikidata.ts index 571d948596..111eb6e397 100644 --- a/Logic/Web/Wikidata.ts +++ b/Logic/Web/Wikidata.ts @@ -1,7 +1,6 @@ import {Utils} from "../../Utils"; import {UIEventSource} from "../UIEventSource"; - export class WikidataResponse { public readonly id: string public readonly labels: Map @@ -61,7 +60,6 @@ export class WikidataResponse { commons ) - } static extractClaims(claimsJson: any): Map> { diff --git a/assets/themes/etymology.json b/assets/themes/etymology.json index 5829b25f8b..8bff156bc4 100644 --- a/assets/themes/etymology.json +++ b/assets/themes/etymology.json @@ -9,8 +9,8 @@ "nl": "Wat is de oorsprong van een plaatsnaam?" }, "description": { - "en": "On this map, you can see what an object is named after. The streets, buildings, ... come from OpenStreetMap which got linked with Wikidata. The information comes from Wpikipedia.", - "nl": "Op deze kaart zie je waar een plaats naar is vernoemd. De straten, gebouwen, ... komen uit OpenStreetMap, waar een link naar Wikidata werd gelegd. De informatie komt uit wikipedia." + "en": "On this map, you can see what an object is named after. The streets, buildings, ... come from OpenStreetMap which got linked with Wikidata. In the popup, you'll see the Wikipedia article (if it exists) or a wikidata box of what the object is named after. If the object itself has a wikipedia page, that'll be shown too.

You can help contribute too!Zoom in enough and all streets will show up. You can click one and a Wikidata-search box will popup. With a few clicks, you can add an etymology link. Note that you need a free OpenStreetMap account to do this.", + "nl": "Op deze kaart zie je waar een plaats naar is vernoemd. De straten, gebouwen, ... komen uit OpenStreetMap, waar een link naar Wikidata werd gelegd. In de popup zie je het Wikipedia-artikel van hetgeen naarwaar het vernoemd is of de Wikidata-box.

Je kan zelf ook meehelpen!Als je ver inzoomt, krijg je alle straten te zien. Klik je een straat aan, dan krijg je een zoekfunctie waarmee je snel een nieuwe link kan leggen. Je hebt hiervoor een gratis OpenStreetMap account nodig." }, "language": [ "en", diff --git a/langs/themes/en.json b/langs/themes/en.json index c0bd581ab0..8bf77665be 100644 --- a/langs/themes/en.json +++ b/langs/themes/en.json @@ -669,7 +669,7 @@ "title": "Drinking Water" }, "etymology": { - "description": "On this map, you can see what an object is named after. The streets, buildings, ... come from OpenStreetMap which got linked with Wikidata. The information comes from Wpikipedia.", + "description": "On this map, you can see what an object is named after. The streets, buildings, ... come from OpenStreetMap which got linked with Wikidata. In the popup, you'll see the Wikipedia article (if it exists) or a wikidata box of what the object is named after. If the object itself has a wikipedia page, that'll be shown too.

You can help contribute too!Zoom in enough and all streets will show up. You can click one and a Wikidata-search box will popup. With a few clicks, you can add an etymology link. Note that you need a free OpenStreetMap account to do this.", "layers": { "1": { "override": { diff --git a/langs/themes/nl.json b/langs/themes/nl.json index 988d2c41f3..291fe34627 100644 --- a/langs/themes/nl.json +++ b/langs/themes/nl.json @@ -550,7 +550,7 @@ "title": "Drinkwaterpunten" }, "etymology": { - "description": "Op deze kaart zie je waar een plaats naar is vernoemd. De straten, gebouwen, ... komen uit OpenStreetMap, waar een link naar Wikidata werd gelegd. De informatie komt uit wikipedia.", + "description": "Op deze kaart zie je waar een plaats naar is vernoemd. De straten, gebouwen, ... komen uit OpenStreetMap, waar een link naar Wikidata werd gelegd. In de popup zie je het Wikipedia-artikel van hetgeen naarwaar het vernoemd is of de Wikidata-box.

Je kan zelf ook meehelpen!Als je ver inzoomt, krijg je alle straten te zien. Klik je een straat aan, dan krijg je een zoekfunctie waarmee je snel een nieuwe link kan leggen. Je hebt hiervoor een gratis OpenStreetMap account nodig.", "layers": { "1": { "override": {