Some tweaks

This commit is contained in:
Pieter Vander Vennet 2022-09-14 14:43:14 +02:00
parent 27ccce70c0
commit 739275f8a1
6 changed files with 79 additions and 285 deletions

View file

@ -7,7 +7,6 @@ import {BBox} from "../Logic/BBox";
import Minimap from "../UI/Base/Minimap";
import AvailableBaseLayers from "../Logic/Actors/AvailableBaseLayers";
import {Utils} from "../Utils";
import {FixedUiElement} from "../UI/Base/FixedUiElement";
export interface PngMapCreatorOptions{
readonly divId: string; readonly width: number; readonly height: number; readonly scaling?: 1 | number,
@ -61,7 +60,6 @@ export class PngMapCreator {
// Lets first init the minimap and wait for all background tiles to load
const minimap = await this.createAndLoadMinimap()
const state = this._state
const freediv = this._options.divId
const dummyMode = this._options.dummyMode ?? false
console.log("Dummy mode is", dummyMode)
return new Promise<string | Blob>(resolve => {
@ -99,10 +97,9 @@ export class PngMapCreator {
state: undefined,
})
})
await Utils.waitFor(2500)
await Utils.waitFor(10000)
}
minimap.TakeScreenshot(format).then(result => {
new FixedUiElement("Done!").AttachTo(freediv)
return resolve(result);
})
})

View file

@ -9,6 +9,9 @@ import "../assets/templates/Ubuntu-M-normal.js"
import "../assets/templates/Ubuntu-L-normal.js"
import "../assets/templates/UbuntuMono-B-bold.js"
import {parseSVG, makeAbsolute} from 'svg-path-parser';
import {And} from "../Logic/Tags/And";
import {Tag} from "../Logic/Tags/Tag";
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
class SvgToPdfInternals {
private readonly doc: jsPDF;
@ -578,8 +581,19 @@ export class SvgToPdf {
throw "Theme not found:" + params["theme"] + ". Use theme: to define which theme to use. "
}
layout.widenFactor = 0
layout.overpassTimeout = 180
layout.overpassTimeout = 600
layout.defaultBackgroundId = params["background"] ?? layout.defaultBackgroundId
for (const paramsKey in params) {
if (paramsKey.startsWith("layer-")) {
const layerName = paramsKey.substring("layer-".length)
const key = params[paramsKey].toLowerCase().trim()
const layer = layout.layers.find(l => l.id === layerName)
if (key === "force") {
console.log("Forcing minzoom of layer",layer.id)
layer.minzoom = 0
}
}
}
const zoom = Number(params["zoom"] ?? params["z"] ?? 14);
const state = new FeaturePipelineState(layout)
@ -608,7 +622,7 @@ export class SvgToPdf {
isDisplayed
)
if (key === "force") {
layer.layerDef.minzoom = zoom
layer.layerDef.minzoom = 0
}
}
}