Refactoring: split icons into proper layered icons, fix and rerun shops-thief

This commit is contained in:
Pieter Vander Vennet 2023-10-06 23:56:50 +02:00
parent d6cd0516bb
commit 19a760178b
307 changed files with 26845 additions and 116541 deletions

View file

@ -24,8 +24,12 @@ import {
ValidateThemeAndLayers,
} from "../Models/ThemeConfig/Conversion/Validation"
import { DesugaringContext } from "../Models/ThemeConfig/Conversion/Conversion"
import { TagRenderingConfigJson } from "../Models/ThemeConfig/Json/TagRenderingConfigJson"
import {
MinimalTagRenderingConfigJson,
TagRenderingConfigJson
} from "../Models/ThemeConfig/Json/TagRenderingConfigJson";
import Hash from "./Web/Hash"
import { QuestionableTagRenderingConfigJson } from "../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson";
export default class DetermineLayout {
private static readonly _knownImages = new Set(Array.from(licenses).map((l) => l.path))
@ -151,8 +155,8 @@ export default class DetermineLayout {
.AttachTo("maindiv")
}
private static getSharedTagRenderings(): Map<string, TagRenderingConfigJson> {
const dict = new Map<string, TagRenderingConfigJson>()
private static getSharedTagRenderings(): Map<string, QuestionableTagRenderingConfigJson> {
const dict = new Map<string, QuestionableTagRenderingConfigJson>()
for (const tagRendering of questions.tagRenderings) {
dict.set(tagRendering.id, tagRendering)
@ -163,7 +167,9 @@ export default class DetermineLayout {
private static prepCustomTheme(json: any, sourceUrl?: string, forceId?: string): LayoutConfig {
if (json.layers === undefined && json.tagRenderings !== undefined) {
const iconTr = json.mapRendering.map((mr) => mr.icon).find((icon) => icon !== undefined)
// We got fed a layer instead of a theme
const layerConfig = <LayerConfigJson>json
const iconTr: string | TagRenderingConfigJson = layerConfig.pointRendering.map((mr) => mr.marker.find(icon => icon.icon !== undefined).icon).find((i) => i !== undefined)
const icon = new TagRenderingConfig(iconTr).render.txt
json = {
id: json.id,

View file

@ -19,7 +19,7 @@ export class LastClickFeatureSource implements WritableFeatureSource {
for (let i = 0; i < (layer.presets ?? []).length; i++) {
const preset = layer.presets[i]
const tags = new ImmutableStore(TagUtils.KVtoProperties(preset.tags))
const { html } = layer.mapRendering[0].RenderIcon(tags, false, {
const { html } = layer.mapRendering[0].RenderIcon(tags, {
noSize: true,
includeBadges: false,
})

View file

@ -55,10 +55,9 @@ export class NewGeometryFromChangesFeatureSource implements WritableFeatureSourc
* @private
*/
private handleChange(change: ChangeDescription): boolean {
const backend = this._backend
const allElementStorage = this._allElementStorage
console.log("Handling pending change")
console.log("Handling pending change", change)
if (change.id > 0) {
// This is an already existing object
// In _most_ of the cases, this means that this _isn't_ a new object