2022-11-02 14:44:06 +01:00
|
|
|
import UploadTraceToOsmUI from "../BigComponents/UploadTraceToOsmUI"
|
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"
|
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 = []
|
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
|
|
|
|
return new UploadTraceToOsmUI((title) => GeoOperations.toGpx(locations, title), state, {
|
2022-10-28 04:33:05 +02:00
|
|
|
whenUploaded: async () => {
|
|
|
|
state.historicalUserLocations.features.setData([])
|
2022-11-02 14:44:06 +01:00
|
|
|
},
|
2022-10-28 04:33:05 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|