Small tweaks

This commit is contained in:
Pieter Vander Vennet 2021-07-28 15:14:13 +02:00
parent 1d2d098167
commit 0ab0d159cc
6 changed files with 52 additions and 21 deletions

View file

@ -27,7 +27,9 @@ export class Changes {
private readonly previouslyCreated : OsmObject[] = []
constructor() {
this.isUploading.addCallbackAndRun(uploading => {
console.trace("Is uploading changed:", uploading)
})
}
private static createChangesetFor(csId: string,
@ -255,6 +257,9 @@ export class Changes {
console.log("Needed ids", neededIds)
OsmObject.DownloadAll(neededIds, true).addCallbackAndRunD(osmObjects => {
console.log("Got the fresh objects!", osmObjects, "pending: ", pending)
try{
const changes: {
newObjects: OsmObject[],
modifiedObjects: OsmObject[]
@ -283,6 +288,11 @@ export class Changes {
return self.isUploading.setData(false);
} // Failed - mark to try again
)
}catch(e){
console.error("Could not handle changes - probably an old, pending changeset in localstorage with an invalid format; erasing those", e)
self.pendingChanges.setData([])
self.isUploading.setData(false)
}
return true;
});

View file

@ -437,6 +437,9 @@ export class OsmWay extends OsmObject {
for (const nodeId of element.nodes) {
const node = nodeDict.get(nodeId)
if(node === undefined){
console.error("Error: node ", nodeId, "not found in ", nodeDict)
}
const cp = node.centerpoint();
this.coordinates.push(cp);
latSum = cp[0]