Refactoring: split NameSuggestionIndex into parts

This commit is contained in:
Pieter Vander Vennet 2025-04-27 22:54:51 +02:00
parent 4899065fc4
commit cf7e005fd1
5 changed files with 103 additions and 139 deletions

View file

@ -1,16 +1,11 @@
import { DesugaringStep } from "./Conversion"
import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson"
import { LayerConfigJson } from "../Json/LayerConfigJson"
import {
MappingConfigJson,
QuestionableTagRenderingConfigJson,
} from "../Json/QuestionableTagRenderingConfigJson"
import { MappingConfigJson, QuestionableTagRenderingConfigJson } from "../Json/QuestionableTagRenderingConfigJson"
import { ConversionContext } from "./ConversionContext"
import { Translation } from "../../../UI/i18n/Translation"
import { TagUtils } from "../../../Logic/Tags/TagUtils"
import Validators from "../../../UI/InputElement/Validators"
import { CheckTranslation } from "./Validation"
import NameSuggestionIndex from "../../../Logic/Web/NameSuggestionIndex"
export class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJson> {
private readonly _layerConfig: LayerConfigJson
@ -195,21 +190,7 @@ export class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJso
)
}
}
if (
this._layerConfig?.source?.["osmTags"] &&
NameSuggestionIndex.supportedTypes.indexOf(<any>json.freeform.key) >= 0
) {
const tags = TagUtils.TagD(this._layerConfig?.source?.["osmTags"])?.usedTags()
/* const suggestions = nameSuggestionIndexBundled.getSuggestionsFor(json.freeform.key, tags)
if (suggestions === undefined) {
context
.enters("freeform", "type")
.err(
"No entry found in the 'Name Suggestion Index'. None of the 'osmSource'-tags match an entry in the NSI.\n\tOsmSource-tags are " +
tags.map((t) => new Tag(t.key, t.value).asHumanString()).join(" ; ")
)
}*/
} else if (json.freeform["type"] === "nsi") {
if (json.freeform["type"] === "nsi") {
context
.enters("freeform", "type")
.warn(