From aac736eba82652c86b0d3a369ad5a2e7ccdd9460 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 24 Aug 2022 02:28:41 +0200 Subject: [PATCH] Revert "Improve typing" This reverts commit 4d783aae45712c1f2445ae20a8e7d7f8e0e63a53. --- Logic/Osm/OsmObject.ts | 16 +++++----------- Models/OsmFeature.ts | 7 +------ assets/themes/postboxes/postboxes.json | 2 +- .../OSM/Actions/RelationSplitHandler.spec.ts | 2 +- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Logic/Osm/OsmObject.ts b/Logic/Osm/OsmObject.ts index 1483628bf..0dd967bb0 100644 --- a/Logic/Osm/OsmObject.ts +++ b/Logic/Osm/OsmObject.ts @@ -3,7 +3,6 @@ import * as polygon_features from "../../assets/polygon-features.json"; import {Store, UIEventSource} from "../UIEventSource"; import {BBox} from "../BBox"; import * as OsmToGeoJson from "osmtogeojson"; -import {NodeId, OsmId, OsmTags, RelationId, WayId} from "../../Models/OsmFeature"; export abstract class OsmObject { @@ -39,12 +38,10 @@ export abstract class OsmObject { throw "Backend URL must begin with http" } this.backendURL = url; + this.DownloadObject("id/5") } - public static DownloadObject(id: NodeId, forceRefresh?: boolean ): Store ; - public static DownloadObject(id: WayId, forceRefresh?: boolean ): Store ; - public static DownloadObject(id: RelationId, forceRefresh?: boolean ): Store ; - public static DownloadObject(id: OsmId, forceRefresh: boolean = false): Store { + public static DownloadObject(id: string, forceRefresh: boolean = false): Store { let src: UIEventSource; if (OsmObject.objectCache.has(id)) { src = OsmObject.objectCache.get(id) @@ -54,14 +51,14 @@ export abstract class OsmObject { return src; } } else { - src = UIEventSource.FromPromise(OsmObject.DownloadObjectAsync( id)) + src = UIEventSource.FromPromise(OsmObject.DownloadObjectAsync(id)) } OsmObject.objectCache.set(id, src); return src; } - static async DownloadPropertiesOf(id: OsmId): Promise { + static async DownloadPropertiesOf(id: string): Promise { const splitted = id.split("/"); const idN = Number(splitted[1]); if (idN < 0) { @@ -73,10 +70,7 @@ export abstract class OsmObject { return rawData.elements[0].tags } - static async DownloadObjectAsync(id: NodeId): Promise; - static async DownloadObjectAsync(id: WayId): Promise; - static async DownloadObjectAsync(id: RelationId): Promise; - static async DownloadObjectAsync(id: OsmId): Promise{ + static async DownloadObjectAsync(id: string): Promise { const splitted = id.split("/"); const type = splitted[0]; const idN = Number(splitted[1]); diff --git a/Models/OsmFeature.ts b/Models/OsmFeature.ts index 10aad78bc..4753287ca 100644 --- a/Models/OsmFeature.ts +++ b/Models/OsmFeature.ts @@ -1,9 +1,4 @@ import {Feature, Geometry} from "@turf/turf"; -export type RelationId = `relation/${number}` -export type WayId = `way/${number}` -export type NodeId = `node/${number}` -export type OsmId = NodeId | WayId | RelationId - -export type OsmTags = Record & {id: OsmId} +export type OsmTags = Record & {id: string} export type OsmFeature = Feature \ No newline at end of file diff --git a/assets/themes/postboxes/postboxes.json b/assets/themes/postboxes/postboxes.json index 8442d88fe..e1e657953 100644 --- a/assets/themes/postboxes/postboxes.json +++ b/assets/themes/postboxes/postboxes.json @@ -41,7 +41,7 @@ "maxZoom": 14, "minNeededElements": 100 }, - "credits": "nicolelaine", + "credits": "nicolelaine" "layers": [ "postboxes", "postoffices", diff --git a/test/Logic/OSM/Actions/RelationSplitHandler.spec.ts b/test/Logic/OSM/Actions/RelationSplitHandler.spec.ts index 8a5d44268..3fa54a139 100644 --- a/test/Logic/OSM/Actions/RelationSplitHandler.spec.ts +++ b/test/Logic/OSM/Actions/RelationSplitHandler.spec.ts @@ -604,7 +604,7 @@ describe("RelationSplitHandler", () => { "should split turn restrictions (split of https://www.openstreetmap.org/way/143298912)", async () => { - const relation: OsmRelation = await OsmObject.DownloadObjectAsync("relation/4374576") + const relation: OsmRelation = await OsmObject.DownloadObjectAsync("relation/4374576") const originalNodeIds = [ 1407529979,