2023-03-28 05:13:48 +02:00
|
|
|
import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization"
|
|
|
|
import { UIEventSource } from "../../Logic/UIEventSource"
|
2023-04-20 18:58:31 +02:00
|
|
|
import { GeoOperations } from "../../Logic/GeoOperations"
|
2023-09-27 22:21:35 +02:00
|
|
|
import Constants from "../../Models/Constants"
|
2024-01-11 02:20:57 +01:00
|
|
|
import SvelteUIElement from "../Base/SvelteUIElement"
|
|
|
|
import UploadTraceToOsmUI from "../BigComponents/UploadTraceToOsmUI.svelte"
|
2022-10-28 04:33:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrapper around 'UploadTraceToOsmUI'
|
|
|
|
*/
|
|
|
|
export class UploadToOsmViz implements SpecialVisualization {
|
|
|
|
funcName = "upload_to_osm"
|
2022-11-02 14:44:06 +01:00
|
|
|
docs =
|
|
|
|
"Uploads the GPS-history as GPX to OpenStreetMap.org; clears the history afterwards. The actual feature is ignored."
|
|
|
|
args = []
|
2023-09-27 22:21:35 +02:00
|
|
|
needsUrls = [Constants.osmAuthConfig.url]
|
2022-10-28 04:33:05 +02:00
|
|
|
|
2023-03-28 05:13:48 +02:00
|
|
|
constr(
|
|
|
|
state: SpecialVisualizationState,
|
2023-06-02 08:42:08 +02:00
|
|
|
_: UIEventSource<Record<string, string>>,
|
|
|
|
__: string[]
|
2023-03-28 05:13:48 +02:00
|
|
|
) {
|
2023-04-20 18:58:31 +02:00
|
|
|
const locations = state.historicalUserLocations.features.data
|
2024-01-11 02:20:57 +01:00
|
|
|
return new SvelteUIElement(UploadTraceToOsmUI, {
|
|
|
|
state,
|
2024-02-20 13:33:38 +01:00
|
|
|
trace: (title: string) => GeoOperations.toGpx(locations, title),
|
2022-10-28 04:33:05 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|