forked from MapComplete/MapComplete
Add moveLocation change description
This commit is contained in:
parent
c4590555ee
commit
0a3eb966c1
4 changed files with 38 additions and 3 deletions
|
@ -16,7 +16,7 @@ export interface ChangeDescription {
|
||||||
/**
|
/**
|
||||||
* The type of the change
|
* The type of the change
|
||||||
*/
|
*/
|
||||||
changeType: "answer" | "create" | "split" | "delete" | string
|
changeType: "answer" | "create" | "split" | "delete" | "move" | string
|
||||||
/**
|
/**
|
||||||
* THe motivation for the change, e.g. 'deleted because does not exist anymore'
|
* THe motivation for the change, e.g. 'deleted because does not exist anymore'
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,15 +3,40 @@ import OsmChangeAction from "./OsmChangeAction";
|
||||||
import {Changes} from "../Changes";
|
import {Changes} from "../Changes";
|
||||||
|
|
||||||
export default class ChangeLocationAction extends OsmChangeAction {
|
export default class ChangeLocationAction extends OsmChangeAction {
|
||||||
|
private readonly _id: number;
|
||||||
|
private readonly _newLonLat: [number, number];
|
||||||
|
private readonly _meta: { theme: string; reason: string };
|
||||||
|
|
||||||
constructor(id: string, newLonLat: [number, number], meta: {
|
constructor(id: string, newLonLat: [number, number], meta: {
|
||||||
theme: string,
|
theme: string,
|
||||||
reason: string
|
reason: string
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
|
if (!id.startsWith("node/")) {
|
||||||
|
throw "Invalid ID: only 'node/number' is accepted"
|
||||||
|
}
|
||||||
|
this._id = Number(id.substring("node/".length))
|
||||||
|
this._newLonLat = newLonLat;
|
||||||
|
this._meta = meta;
|
||||||
throw "TODO"
|
throw "TODO"
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CreateChangeDescriptions(changes: Changes): Promise<ChangeDescription[]> {
|
protected async CreateChangeDescriptions(changes: Changes): Promise<ChangeDescription[]> {
|
||||||
return Promise.resolve([]);
|
|
||||||
|
const d: ChangeDescription = {
|
||||||
|
changes: {
|
||||||
|
lat: this._newLonLat[1],
|
||||||
|
lon: this._newLonLat[0]
|
||||||
|
},
|
||||||
|
type: "node",
|
||||||
|
id: this._id, meta: {
|
||||||
|
changeType: "move",
|
||||||
|
theme: this._meta.theme,
|
||||||
|
specialMotivation: this._meta.reason
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return [d]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -750,6 +750,11 @@
|
||||||
"override": {
|
"override": {
|
||||||
"name": "Streets without etymology information"
|
"name": "Streets without etymology information"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"override": {
|
||||||
|
"name": "Parks and forests without etymology information"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"shortDescription": "What is the origin of a toponym?",
|
"shortDescription": "What is the origin of a toponym?",
|
||||||
|
|
|
@ -631,6 +631,11 @@
|
||||||
"override": {
|
"override": {
|
||||||
"name": "Straten zonder etymologische informatie"
|
"name": "Straten zonder etymologische informatie"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"override": {
|
||||||
|
"name": "Parken en bossen zonder etymologische informatie"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"shortDescription": "Wat is de oorsprong van een plaatsnaam?",
|
"shortDescription": "Wat is de oorsprong van een plaatsnaam?",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue