Formatting, comments, use injected download functionality

This commit is contained in:
Pieter Vander Vennet 2021-12-13 20:51:44 +01:00
parent 7b774b2aa3
commit dc5c3461f8
7 changed files with 47 additions and 98 deletions

View file

@ -44,7 +44,7 @@ export default class PerLayerFeatureSourceSplitter {
for (const layer of layers.data) {
if (layer.layerDef.source.osmTags.matchesProperties(f.feature.properties)) {
// We have found our matching layer!
featuresPerLayer.set(layer.layerDef.id, [f])
featuresPerLayer.get(layer.layerDef.id).push(f)
if (!layer.layerDef.passAllFeatures) {
// If not 'passAllFeatures', we are done for this feature
break;

View file

@ -374,9 +374,15 @@ export class Changes {
for (const change of changes) {
const id = change.type + "/" + change.id
if (!objects.has(id)) {
// The object hasn't been seen before, so it doesn't exist yet and is newly created by its very definition
if (change.id >= 0) {
// Might be a failed fetch for simply this object
throw "Did not get an object that should be known: " + id
}
if(change.changes === undefined){
// This object is a change to a newly created object. However, we have not seen the creation changedescription yet!
throw "Not a creation of the object"
}
// This is a new object that should be created
states.set(id, "created")
console.log("Creating object for changeDescription", change)

View file

@ -7,6 +7,7 @@ import Title from "../UI/Base/Title";
import {FixedUiElement} from "../UI/Base/FixedUiElement";
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
import {CountryCoder} from "latlon2country"
import ScriptUtils from "../scripts/ScriptUtils";
export class SimpleMetaTagger {
@ -40,8 +41,7 @@ export class SimpleMetaTagger {
}
export class CountryTagger extends SimpleMetaTagger {
private static readonly coder = new CountryCoder("https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country/");
private static readonly coder = new CountryCoder("https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country", ScriptUtils.DownloadJSON);
public runningTasks: Set<any>;
constructor() {

View file

@ -36,7 +36,7 @@ export default class UserRelatedState extends ElementsState {
public installedThemes: UIEventSource<{ layout: LayoutConfig; definition: string }[]>;
constructor(layoutToUse: LayoutConfig, options:{attemptLogin : true | boolean}) {
constructor(layoutToUse: LayoutConfig, options?:{attemptLogin : true | boolean}) {
super(layoutToUse);
this.osmConnection = new OsmConnection({