forked from MapComplete/MapComplete
Housekeeping: formatting
This commit is contained in:
parent
9d53a45f9a
commit
1528dfaae1
168 changed files with 3332 additions and 4560 deletions
|
|
@ -565,25 +565,39 @@ class PostvalidateTheme extends DesugaringStep<LayoutConfigJson> {
|
|||
|
||||
convert(json: LayoutConfigJson, context: ConversionContext): LayoutConfigJson {
|
||||
for (const l of json.layers) {
|
||||
const layer = <LayerConfigJson> l
|
||||
const basedOn = <string> layer["_basedOn"]
|
||||
const layer = <LayerConfigJson>l
|
||||
const basedOn = <string>layer["_basedOn"]
|
||||
const basedOnDef = this._state.sharedLayers.get(basedOn)
|
||||
if(!basedOn){
|
||||
if (!basedOn) {
|
||||
continue
|
||||
}
|
||||
if(layer["name"] === null){
|
||||
if (layer["name"] === null) {
|
||||
continue
|
||||
}
|
||||
const sameBasedOn = <LayerConfigJson[]> json.layers.filter(l => l["_basedOn"] === layer["_basedOn"] && l["id"] !== layer.id)
|
||||
const minZoomAll = Math.min(...sameBasedOn.map(sbo => sbo.minzoom))
|
||||
const sameBasedOn = <LayerConfigJson[]>(
|
||||
json.layers.filter(
|
||||
(l) => l["_basedOn"] === layer["_basedOn"] && l["id"] !== layer.id
|
||||
)
|
||||
)
|
||||
const minZoomAll = Math.min(...sameBasedOn.map((sbo) => sbo.minzoom))
|
||||
|
||||
const sameNameDetected = sameBasedOn.some( same => JSON.stringify(layer["name"]) === JSON.stringify(same["name"]))
|
||||
if(!sameNameDetected){
|
||||
const sameNameDetected = sameBasedOn.some(
|
||||
(same) => JSON.stringify(layer["name"]) === JSON.stringify(same["name"])
|
||||
)
|
||||
if (!sameNameDetected) {
|
||||
// The name is unique, so it'll won't be confusing
|
||||
continue
|
||||
}
|
||||
if(minZoomAll < layer.minzoom){
|
||||
context.err("There are multiple layers based on "+basedOn+". The layer with id "+layer.id+" has a minzoom of "+layer.minzoom+", and has a name set. Another similar layer has a lower minzoom. As such, the layer selection might show 'zoom in to see features' even though some of the features are already visible. Set `\"name\": null` for this layer and eventually remove the 'name':null for the other layer.")
|
||||
if (minZoomAll < layer.minzoom) {
|
||||
context.err(
|
||||
"There are multiple layers based on " +
|
||||
basedOn +
|
||||
". The layer with id " +
|
||||
layer.id +
|
||||
" has a minzoom of " +
|
||||
layer.minzoom +
|
||||
", and has a name set. Another similar layer has a lower minzoom. As such, the layer selection might show 'zoom in to see features' even though some of the features are already visible. Set `\"name\": null` for this layer and eventually remove the 'name':null for the other layer."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -907,8 +907,12 @@ class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJson> {
|
|||
)
|
||||
}
|
||||
|
||||
if(json.icon?.["size"]){
|
||||
context.enters("icon","size").err("size is not a valid attribute. Did you mean 'class'? Class can be one of `small`, `medium` or `large`")
|
||||
if (json.icon?.["size"]) {
|
||||
context
|
||||
.enters("icon", "size")
|
||||
.err(
|
||||
"size is not a valid attribute. Did you mean 'class'? Class can be one of `small`, `medium` or `large`"
|
||||
)
|
||||
}
|
||||
|
||||
if (json.freeform) {
|
||||
|
|
|
|||
|
|
@ -82,5 +82,5 @@ export default interface LineRenderingConfigJson {
|
|||
* suggestions: [{if: "./assets/png/oneway.png", then: "Show a oneway error"}]
|
||||
* type: image
|
||||
*/
|
||||
imageAlongWay?: {if: TagConfigJson, then: string}[] | string
|
||||
imageAlongWay?: { if: TagConfigJson; then: string }[] | string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,15 @@ export default interface PointRenderingConfigJson {
|
|||
* multianswer: true
|
||||
* suggestions: return [{if: "value=point",then: "Show an icon for point (node) objects"},{if: "value=centroid",then: "Show an icon for line or polygon (way) objects at their centroid location"}, {if: "value=start",then: "Show an icon for line (way) objects at the start"},{if: "value=end",then: "Show an icon for line (way) object at the end"},{if: "value=projected_centerpoint",then: "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons"}, ,{if: "value=polygon_centroid",then: "Show an icon at a polygon centroid (but not if it is a way)"}]
|
||||
*/
|
||||
location: ("point" | "centroid" | "start" | "end" | "projected_centerpoint" | "polygon_centroid" | string)[]
|
||||
location: (
|
||||
| "point"
|
||||
| "centroid"
|
||||
| "start"
|
||||
| "end"
|
||||
| "projected_centerpoint"
|
||||
| "polygon_centroid"
|
||||
| string
|
||||
)[]
|
||||
|
||||
/**
|
||||
* The marker for an element.
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ export default class LayerConfig extends WithContextLoader {
|
|||
new Link(
|
||||
Utils.runningFromConsole
|
||||
? "<img src='https://mapcomplete.org/assets/svg/statistics.svg' height='18px'>"
|
||||
: new SvelteUIElement(Statistics, {class: "w-4 h-4 mr-2"}),
|
||||
: new SvelteUIElement(Statistics, { class: "w-4 h-4 mr-2" }),
|
||||
"https://taginfo.openstreetmap.org/keys/" + values.key + "#values",
|
||||
true
|
||||
),
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
public readonly fill: TagRenderingConfig
|
||||
public readonly fillColor: TagRenderingConfig
|
||||
public readonly leftRightSensitive: boolean
|
||||
public readonly imageAlongWay: { if?: TagsFilter, then: string }[]
|
||||
public readonly imageAlongWay: { if?: TagsFilter; then: string }[]
|
||||
|
||||
constructor(json: LineRenderingConfigJson, context: string) {
|
||||
super(json, context)
|
||||
|
|
@ -33,15 +33,13 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
for (let i = 0; i < json.imageAlongWay.length; i++) {
|
||||
const imgAlong = json.imageAlongWay[i]
|
||||
const ctx = context + ".imageAlongWay[" + i + "]"
|
||||
if(!imgAlong.then.endsWith(".png")){
|
||||
if (!imgAlong.then.endsWith(".png")) {
|
||||
throw "An imageAlongWay should always be a PNG image"
|
||||
}
|
||||
this.imageAlongWay.push(
|
||||
{
|
||||
if: TagUtils.Tag(imgAlong.if, ctx),
|
||||
then: imgAlong.then,
|
||||
},
|
||||
)
|
||||
this.imageAlongWay.push({
|
||||
if: TagUtils.Tag(imgAlong.if, ctx),
|
||||
then: imgAlong.then,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,10 +38,16 @@ export default class PointRenderingConfig extends WithContextLoader {
|
|||
"start",
|
||||
"end",
|
||||
"projected_centerpoint",
|
||||
"polygon_centroid"
|
||||
"polygon_centroid",
|
||||
])
|
||||
public readonly location: Set<
|
||||
"point" | "centroid" | "start" | "end" | "projected_centerpoint" | "polygon_centroid" | string
|
||||
| "point"
|
||||
| "centroid"
|
||||
| "start"
|
||||
| "end"
|
||||
| "projected_centerpoint"
|
||||
| "polygon_centroid"
|
||||
| string
|
||||
>
|
||||
|
||||
public readonly marker: IconConfig[]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue