Add special visualisation for automated actions, add missing_street-theme, various fixes

This commit is contained in:
Pieter Vander Vennet 2021-12-12 02:59:24 +01:00
parent e61c25fd6e
commit 20ec12b23c
23 changed files with 1116 additions and 690 deletions

View file

@ -82,6 +82,15 @@ export interface LayerConfigJson {
* "_max_overlap_ratio=Number(feat._max_overlap_m2)/feat.area
* ]
*
* The specified tags are evaluated lazily. E.g. if a calculated tag is only used in the popup (e.g. the number of nearby features),
* the expensive calculation will only be performed then for that feature. This avoids clogging up the contributors PC when all features are loaded.
*
* If a tag has to be evaluated strictly, use ':=' instead:
*
* [
* "_some_key:=some_javascript_expression"
* ]
*
*/
calculatedTags?: string[];

View file

@ -30,7 +30,7 @@ export default class LayerConfig extends WithContextLoader {
public readonly name: Translation;
public readonly description: Translation;
public readonly source: SourceConfig;
public readonly calculatedTags: [string, string][];
public readonly calculatedTags: [string, string, boolean][];
public readonly doNotDownload: boolean;
public readonly passAllFeatures: boolean;
public readonly isShown: TagRenderingConfig;
@ -130,7 +130,11 @@ export default class LayerConfig extends WithContextLoader {
this.calculatedTags = [];
for (const kv of json.calculatedTags) {
const index = kv.indexOf("=");
const key = kv.substring(0, index);
let key = kv.substring(0, index);
const isStrict = key.endsWith(':')
if(isStrict){
key = key.substr(0, key.length - 1)
}
const code = kv.substring(index + 1);
try {
@ -140,7 +144,7 @@ export default class LayerConfig extends WithContextLoader {
}
this.calculatedTags.push([key, code]);
this.calculatedTags.push([key, code, isStrict]);
}
}