diff --git a/Logic/FeatureSource/FeaturePipeline.ts b/Logic/FeatureSource/FeaturePipeline.ts index 53827acc54..c6329d1f3d 100644 --- a/Logic/FeatureSource/FeaturePipeline.ts +++ b/Logic/FeatureSource/FeaturePipeline.ts @@ -23,6 +23,7 @@ import TileFreshnessCalculator from "./TileFreshnessCalculator"; import FullNodeDatabaseSource from "./TiledFeatureSource/FullNodeDatabaseSource"; import MapState from "../State/MapState"; import {ElementStorage} from "../ElementStorage"; +import MetaTagging from "../MetaTagging"; /** @@ -61,6 +62,8 @@ export default class FeaturePipeline { private readonly oldestAllowedDate: Date; private readonly osmSourceZoomLevel private readonly localStorageSavers = new Map() + + private readonly newGeometryHandler : NewGeometryFromChangesFeatureSource; constructor( handleFeatureSource: (source: FeatureSourceForLayer & Tiled) => void, @@ -300,6 +303,7 @@ export default class FeaturePipeline { // Also load points/lines that are newly added. const newGeometry = new NewGeometryFromChangesFeatureSource(state.changes, state.allElements, state.osmConnection._oauth_config.url) + this.newGeometryHandler = newGeometry; newGeometry.features.addCallbackAndRun(geometries => { console.debug("New geometries are:", geometries) }) @@ -482,4 +486,14 @@ export default class FeaturePipeline { return updater; } + /** + * Inject a new point + */ + InjectNewPoint(geojson) { + this.newGeometryHandler.features.data.push({ + feature: geojson, + freshness: new Date() + }) + this.newGeometryHandler.features.ping(); + } } \ No newline at end of file diff --git a/UI/Popup/NewNoteUi.ts b/UI/Popup/NewNoteUi.ts index 7a6dc5dc8c..826737ce85 100644 --- a/UI/Popup/NewNoteUi.ts +++ b/UI/Popup/NewNoteUi.ts @@ -18,7 +18,10 @@ export default class NewNoteUi extends Toggle { isShown: UIEventSource, state: { LastClickLocation: UIEventSource<{ lat: number, lon: number }>, - osmConnection: OsmConnection, layoutToUse: LayoutConfig, featurePipeline: FeaturePipeline + osmConnection: OsmConnection, + layoutToUse: LayoutConfig, + featurePipeline: FeaturePipeline, + selectedElement: UIEventSource }) { const t = Translations.t.notes; @@ -37,7 +40,27 @@ export default class NewNoteUi extends Toggle { } txt += "\n\n #MapComplete #" + state?.layoutToUse?.id const loc = state.LastClickLocation.data; - state?.osmConnection?.openNote(loc.lat, loc.lon, txt) + const id = await state?.osmConnection?.openNote(loc.lat, loc.lon, txt) + const feature = { + type:"Feature", + geometry:{ + type:"Point", + coordinates: [loc.lon, loc.lat] + }, + properties: { + id: ""+id.id, + date_created: new Date().toISOString(), + _first_comment : txt, + comments:JSON.stringify( [{ + text: txt, + html: txt, + user: state.osmConnection?.userDetails?.data?.name, + uid: state.osmConnection?.userDetails?.data?.uid + }]), + }, + }; + state?.featurePipeline?.InjectNewPoint(feature) + state.selectedElement?.setData(feature) text.GetValue().setData("") isCreated.setData(true) }) @@ -45,7 +68,13 @@ export default class NewNoteUi extends Toggle { new Title(t.createNoteTitle), t.createNoteIntro, text, - new Combine([new Toggle(undefined, t.warnAnonymous, state?.osmConnection?.isLoggedIn).SetClass("alert"), postNote]).SetClass("flex justify-end items-center") + new Combine([new Toggle(undefined, t.warnAnonymous.SetClass("alert"), state?.osmConnection?.isLoggedIn), + new Toggle(postNote, + t.textNeeded.SetClass("alert"), + text.GetValue().map(txt => txt.length > 3) + ) + + ]).SetClass("flex justify-end items-center") ]).SetClass("flex flex-col border-2 border-black rounded-xl p-4"); diff --git a/langs/en.json b/langs/en.json index 48d4820b5c..2262d8f862 100644 --- a/langs/en.json +++ b/langs/en.json @@ -453,6 +453,7 @@ "loginToClose": "Login to close this note", "createNoteTitle": "Create a new note here", "createNote": "Create a new note", + "textNeeded": "Enter a descriptive text to create a note", "noteIsPublic": "This will be visible to everyone", "createNoteIntro": "Is something wrong or missing on the map? Create a note here. These will be checked by volunteers", "warnAnonymous": "You are not logged in. We won't be able to contact you to resolve your issue.", diff --git a/langs/layers/en.json b/langs/layers/en.json index ccd37f4537..bd38ea4aed 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -3402,6 +3402,17 @@ "question": "Who maintains this tower?", "render": "Maintained by {operator}" }, + "elevator": { + "mappings": { + "0": { + "then": "This tower has an elevator which takes visitors to the top" + }, + "1": { + "then": "This tower does not have an elevator" + } + }, + "question": "Does this tower have an elevator?" + }, "name": { "mappings": { "0": { @@ -3410,6 +3421,10 @@ }, "question": "What is the name of this tower?", "render": "This tower is called {name}" + }, + "step_count": { + "question": "How much individual steps does one have to climb to reach the top of this tower?", + "render": "This tower has {step_count} steps to reach the top" } }, "title": { diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 0bbf2c4145..ab8b2b96ae 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -3302,6 +3302,17 @@ "question": "Wie onderhoudt deze toren?", "render": "Wordt onderhouden door {operator}" }, + "elevator": { + "mappings": { + "0": { + "then": "Deze toren heeft een lift die bezoekers naar de top van de toren brengt" + }, + "1": { + "then": "Deze toren heeft geen lift" + } + }, + "question": "Heeft deze toren een lift?" + }, "name": { "mappings": { "0": { @@ -3310,6 +3321,10 @@ }, "question": "Heeft deze toren een naam?", "render": "Deze toren heet {name}" + }, + "step_count": { + "question": "Hoeveel treden moet men beklimmen op de top van de toren te bereiken?", + "render": "Deze toren heeft {step_count} traptredes" } }, "title": { diff --git a/langs/themes/en.json b/langs/themes/en.json index 2933fd553e..8627d37c14 100644 --- a/langs/themes/en.json +++ b/langs/themes/en.json @@ -1096,6 +1096,11 @@ "shortDescription": "This theme shows all (touristic) maps that OpenStreetMap knows of", "title": "A map of maps" }, + "nature": { + "description": "On this map, one can find interesting infromation for tourists and nature lovers, such as ", + "shortDescription": "A map for nature lovers, with interesting POI's", + "title": "Into nature" + }, "notes": { "description": "A note is a pin on the map with some text to indicate something wrong.

Make sure to checkout the filter view to search for users and text.", "title": "Notes on OpenStreetMap"