Add import from notes functionality

This commit is contained in:
Pieter Vander Vennet 2022-01-12 02:31:51 +01:00
parent 2697feebe0
commit 6999a73d44
41 changed files with 545 additions and 1043 deletions

View file

@ -44,10 +44,7 @@ class OverlapFunc implements ExtraFunction {
_f(params, feat) {
return (...layerIds: string[]) => {
const result: { feat: any, overlap: number }[] = []
console.log("Calculating overlap")
const bbox = BBox.get(feat)
for (const layerId of layerIds) {
const otherLayers = params.getFeaturesWithin(layerId, bbox)
if (otherLayers === undefined) {

View file

@ -223,6 +223,12 @@ export class OsmConnection {
if ((text ?? "") !== "") {
textSuffix = "?text=" + encodeURIComponent(text)
}
if(this._dryRun){
console.warn("Dryrun enabled - not actually closing note ", id, " with text ", text)
return new Promise((ok, error) => {
ok()
});
}
return new Promise((ok, error) => {
this.auth.xhr({
method: 'POST',
@ -240,6 +246,12 @@ export class OsmConnection {
}
public reopenNote(id: number | string, text?: string): Promise<any> {
if(this._dryRun){
console.warn("Dryrun enabled - not actually reopening note ", id, " with text ", text)
return new Promise((ok, error) => {
ok()
});
}
let textSuffix = ""
if ((text ?? "") !== "") {
textSuffix = "?text=" + encodeURIComponent(text)
@ -261,6 +273,12 @@ export class OsmConnection {
}
public addCommentToNode(id: number | string, text: string): Promise<any> {
if(this._dryRun){
console.warn("Dryrun enabled - not actually adding comment ",text, "to note ", id)
return new Promise((ok, error) => {
ok()
});
}
if ((text ?? "") === "") {
throw "Invalid text!"
}