forked from MapComplete/MapComplete
Studio: small improvements after selftesting, icons reusing HeroIcons can now be colored as well
This commit is contained in:
parent
003430131b
commit
8f036f6045
45 changed files with 10960 additions and 288 deletions
|
@ -24,6 +24,7 @@ import { ConversionContext } from "./ConversionContext"
|
|||
import * as eli from "../../../assets/editor-layer-index.json"
|
||||
import { AvailableRasterLayers } from "../../RasterLayers"
|
||||
import Back from "../../../assets/svg/Back.svelte"
|
||||
import PointRenderingConfigJson from "../Json/PointRenderingConfigJson"
|
||||
|
||||
class ValidateLanguageCompleteness extends DesugaringStep<LayoutConfig> {
|
||||
private readonly _languages: string[]
|
||||
|
@ -1012,6 +1013,7 @@ export class PrevalidateLayer extends DesugaringStep<LayerConfigJson> {
|
|||
*/
|
||||
private readonly _path: string
|
||||
private readonly _studioValidations: boolean
|
||||
private readonly _validatePointRendering = new ValidatePointRendering()
|
||||
|
||||
constructor(path: string, isBuiltin, doesImageExist, studioValidations) {
|
||||
super("Runs various checks against common mistakes for a layer", [], "PrevalidateLayer")
|
||||
|
@ -1101,6 +1103,8 @@ export class PrevalidateLayer extends DesugaringStep<LayerConfigJson> {
|
|||
context.enter("pointRendering").err("There are no pointRenderings at all...")
|
||||
}
|
||||
|
||||
json.pointRendering?.forEach((pr,i) => this._validatePointRendering.convert(pr, context.enters("pointeRendering", i)))
|
||||
|
||||
if (json["mapRendering"]) {
|
||||
context.enter("mapRendering").err("This layer has a legacy 'mapRendering'")
|
||||
}
|
||||
|
@ -1405,13 +1409,40 @@ export class ValidateLayerConfig extends DesugaringStep<LayerConfigJson> {
|
|||
}
|
||||
}
|
||||
|
||||
class ValidatePointRendering extends DesugaringStep<PointRenderingConfigJson> {
|
||||
constructor() {
|
||||
super("Various checks for pointRenderings", [], "ValidatePOintRendering")
|
||||
}
|
||||
|
||||
convert(json: PointRenderingConfigJson, context: ConversionContext): PointRenderingConfigJson {
|
||||
if (json.marker === undefined && json.label === undefined) {
|
||||
context.err(`A point rendering should define at least an marker or a label`)
|
||||
}
|
||||
|
||||
if (json["markers"]) {
|
||||
context.enter("markers").err(`Detected a field 'markerS' in pointRendering. It is written as a singular case`)
|
||||
}
|
||||
if (json.marker && !Array.isArray(json.marker)) {
|
||||
context.enter("marker").err(
|
||||
"The marker in a pointRendering should be an array"
|
||||
)
|
||||
}
|
||||
if (json.location.length == 0) {
|
||||
context.enter("location").err (
|
||||
"A pointRendering should have at least one 'location' to defined where it should be rendered. "
|
||||
)
|
||||
}
|
||||
return json
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
export class ValidateLayer extends Conversion<
|
||||
LayerConfigJson,
|
||||
{ parsed: LayerConfig; raw: LayerConfigJson }
|
||||
> {
|
||||
private readonly _skipDefaultLayers: boolean
|
||||
private readonly _prevalidation: PrevalidateLayer
|
||||
|
||||
constructor(
|
||||
path: string,
|
||||
isBuiltin: boolean,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue