Merge master
This commit is contained in:
commit
e7cecc26d9
72 changed files with 12282 additions and 720 deletions
|
@ -114,27 +114,42 @@ export default class Constants {
|
|||
* These are the values that are allowed to use as 'backdrop' icon for a map pin
|
||||
*/
|
||||
private static readonly _defaultPinIcons = [
|
||||
"pin",
|
||||
"square",
|
||||
"circle",
|
||||
"none",
|
||||
"pin",
|
||||
"person",
|
||||
"plus",
|
||||
"ring",
|
||||
"star",
|
||||
"teardrop",
|
||||
"triangle",
|
||||
"checkmark",
|
||||
"clock",
|
||||
"close",
|
||||
"crosshair",
|
||||
"help",
|
||||
"home",
|
||||
"invalid",
|
||||
"location",
|
||||
"location_empty",
|
||||
"location_locked",
|
||||
"note",
|
||||
"resolved",
|
||||
"ring",
|
||||
"scissors",
|
||||
"teardrop",
|
||||
"teardrop_with_hole_green",
|
||||
"triangle",
|
||||
"brick_wall_square",
|
||||
"brick_wall_round",
|
||||
"gps_arrow",
|
||||
"checkmark",
|
||||
"help",
|
||||
"clock",
|
||||
"invalid",
|
||||
"close",
|
||||
"invalid",
|
||||
"heart",
|
||||
"heart_outline",
|
||||
"confirm",
|
||||
"direction",
|
||||
"not_found",
|
||||
"mastodon",
|
||||
"party",
|
||||
"addSmall",
|
||||
|
||||
] as const
|
||||
public static readonly defaultPinIcons: string[] = <any>Constants._defaultPinIcons
|
||||
|
||||
|
|
|
@ -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[]
|
||||
|
@ -1016,6 +1017,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")
|
||||
|
@ -1105,6 +1107,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'")
|
||||
}
|
||||
|
@ -1409,13 +1413,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,
|
||||
|
|
|
@ -506,7 +506,7 @@ export interface LayerConfigJson {
|
|||
* If the way is part of a relation, MapComplete will attempt to update this relation as well
|
||||
* question: Should the contributor be able to split ways using this layer?
|
||||
* iftrue: enable the 'split-roads'-component
|
||||
* iffalse: don't enable the split-roads componenet
|
||||
* iffalse: don't enable the split-roads component
|
||||
* ifunset: don't enable the split-roads component
|
||||
* group: editing
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ export interface IconConfigJson {
|
|||
/**
|
||||
* question: What icon should be used?
|
||||
* type: icon
|
||||
* suggestions: return ["pin","square","circle","checkmark","clock","close","crosshair","help","home","invalid","location","location_empty","location_locked","note","resolved","ring","scissors","teardrop","teardrop_with_hole_green","triangle"].map(i => ({if: "value="+i, then: i, icon: i}))
|
||||
* suggestions: return Constants.defaultPinIcons.map(i => ({if: "value="+i, then: i, icon: i}))
|
||||
*/
|
||||
icon: string | MinimalTagRenderingConfigJson | { builtin: string; override: any }
|
||||
/**
|
||||
|
|
|
@ -79,23 +79,7 @@ export default class PointRenderingConfig extends WithContextLoader {
|
|||
}
|
||||
})
|
||||
|
||||
if (json.marker === undefined && json.label === undefined) {
|
||||
throw `At ${context}: A point rendering should define at least an marker or a label`
|
||||
}
|
||||
|
||||
if (json["markers"]) {
|
||||
throw `At ${context}.markers: detected a field 'markerS' in pointRendering. It is written as a singular case`
|
||||
}
|
||||
if (json.marker && !Array.isArray(json.marker)) {
|
||||
throw `At ${context}.marker: the marker in a pointRendering should be an array`
|
||||
}
|
||||
if (this.location.size == 0) {
|
||||
throw (
|
||||
"A pointRendering should have at least one 'location' to defined where it should be rendered. (At " +
|
||||
context +
|
||||
".location)"
|
||||
)
|
||||
}
|
||||
this.marker = (json.marker ?? []).map((m) => new IconConfig(<any>m))
|
||||
if (json.css !== undefined) {
|
||||
this.cssDef = this.tr("css", undefined)
|
||||
|
|
|
@ -370,20 +370,9 @@ export default class TagRenderingConfig {
|
|||
let iconClass = commonSize
|
||||
if (!!mapping.icon) {
|
||||
if (typeof mapping.icon === "string" && mapping.icon !== "") {
|
||||
let stripped = mapping.icon
|
||||
if (stripped.endsWith(".svg")) {
|
||||
stripped = stripped.substring(0, stripped.length - 4)
|
||||
}
|
||||
if (Constants.defaultPinIcons.indexOf(stripped) >= 0) {
|
||||
icon = "./assets/svg/" + mapping.icon
|
||||
if (!icon.endsWith(".svg")) {
|
||||
icon += ".svg"
|
||||
}
|
||||
} else {
|
||||
icon = mapping.icon
|
||||
}
|
||||
icon = mapping.icon.trim()
|
||||
} else if (mapping.icon["path"]) {
|
||||
icon = mapping.icon["path"]
|
||||
icon = mapping.icon["path"].trim()
|
||||
iconClass = mapping.icon["class"] ?? iconClass
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue