forked from MapComplete/MapComplete
		
	Fix: build, some metatagging errors
This commit is contained in:
		
							parent
							
								
									df7b0f84db
								
							
						
					
					
						commit
						0d529e7cca
					
				
					 6 changed files with 13 additions and 22 deletions
				
			
		|  | @ -1,14 +0,0 @@ | |||
| { | ||||
|   "id": "matchpoint", | ||||
|   "description": "The default rendering for a locationInput which snaps onto another object", | ||||
|   "source": "special", | ||||
|   "mapRendering": [ | ||||
|     { | ||||
|       "location": [ | ||||
|         "point", | ||||
|         "centroid" | ||||
|       ], | ||||
|       "icon": "./assets/svg/crosshair-empty.svg" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
|  | @ -23,7 +23,7 @@ | |||
|     "osmTags": "amenity=recycling" | ||||
|   }, | ||||
|   "calculatedTags": [ | ||||
|     "_waste_amount=Object.values(Object.keys(feat.properties).filter((key) => key.startsWith('recycling:')).reduce((cur, key) => { return Object.assign(cur, { [key]: feat.properties[key] })}, {})).reduce((n, x) => n + (x == \"yes\"), 0);" | ||||
|     "_waste_amount=Object.keys(feat.properties).filter(key => key.startsWith('recycling:')).filter(k => feat.properties[k] === 'yes').length" | ||||
|   ], | ||||
|   "minzoom": 10, | ||||
|   "title": { | ||||
|  | @ -1569,4 +1569,4 @@ | |||
|     "enableRelocation": true, | ||||
|     "enableImproveAccuracy": true | ||||
|   } | ||||
| } | ||||
| } | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ | |||
|     } | ||||
|   }, | ||||
|   "calculatedTags": [ | ||||
|     "_enclosing=feat.enclosingFeatures('school').map(f => f.feat.properties.id)", | ||||
|     "_enclosing=enclosingFeatures(feat)('school').map(f => f.feat.properties.id)", | ||||
|     "_is_enclosed=feat.properties._enclosing != '[]'" | ||||
|   ], | ||||
|   "isShown": { | ||||
|  |  | |||
|  | @ -424,11 +424,12 @@ class LayerOverviewUtils extends Script { | |||
|         ] | ||||
|         for (const layer of themeFile.layers) { | ||||
|             const l = <LayerConfigJson>layer | ||||
|             const id = l.id.replace(/[^a-zA-Z0-9_]/g, "_") | ||||
|             const code = l.calculatedTags ?? [] | ||||
| 
 | ||||
|             allCode.push( | ||||
|                 "   public metaTaggging_for_" + | ||||
|                     l.id + | ||||
|                     id + | ||||
|                     "(feat: Feature, helperFunctions: Record<ExtraFuncType, (feature: Feature) => Function>) {" | ||||
|             ) | ||||
|             allCode.push("      const {" + ExtraFunctions.types.join(", ") + "} = helperFunctions") | ||||
|  | @ -446,7 +447,7 @@ class LayerOverviewUtils extends Script { | |||
|                             " ) " | ||||
|                     ) | ||||
|                 } else { | ||||
|                     attributeName = attributeName.substring(0, attributeName.length - 2).trim() | ||||
|                     attributeName = attributeName.substring(0, attributeName.length - 1).trim() | ||||
|                     allCode.push("      feat.properties['" + attributeName + "'] = " + expression) | ||||
|                 } | ||||
|             } | ||||
|  | @ -463,6 +464,9 @@ class LayerOverviewUtils extends Script { | |||
|     } | ||||
| 
 | ||||
|     private extractJavascriptCodeForLayer(l: LayerConfigJson, targetPath?: string) { | ||||
|         if (!l) { | ||||
|             return // Probably a bootstrapping run
 | ||||
|         } | ||||
|         let importPath = "../../../" | ||||
|         if (targetPath) { | ||||
|             const l = targetPath.split("/") | ||||
|  | @ -478,7 +482,7 @@ class LayerOverviewUtils extends Script { | |||
|         } | ||||
|         const allCode = [ | ||||
|             `import { Utils } from "${importPath}Utils"`, | ||||
|             `/** This code is autogenerated - do not edit. Edit ./assets/layers/${l.id}/${l.id}.json instead */`, | ||||
|             `/** This code is autogenerated - do not edit. Edit ./assets/layers/${l?.id}/${l?.id}.json instead */`, | ||||
|             "export class ThemeMetaTagging {", | ||||
|             "   public static readonly themeName = " + JSON.stringify(l.id), | ||||
|             "", | ||||
|  |  | |||
|  | @ -316,7 +316,9 @@ export default class MetaTagging { | |||
|         helpers: Record<ExtraFuncType, (feature: Feature) => Function> | ||||
|     ): (feature: Feature, tags: UIEventSource<Record<string, any>>) => boolean { | ||||
|         if (MetaTagging.metataggingObject) { | ||||
|             const funcName = "metaTaggging_for_" + layer.id | ||||
|             const id = layer.id.replace(/[^a-zA-Z0-9_]/g, "_") | ||||
| 
 | ||||
|             const funcName = "metaTaggging_for_" + id | ||||
|             if (typeof MetaTagging.metataggingObject[funcName] !== "function") { | ||||
|                 console.log(MetaTagging.metataggingObject) | ||||
|                 throw ( | ||||
|  |  | |||
|  | @ -37,7 +37,6 @@ export default class Constants { | |||
|         "split_point", | ||||
|         "split_road", | ||||
|         "current_view", | ||||
|         "matchpoint", | ||||
|         "import_candidate", | ||||
|         "usersettings", | ||||
|     ] as const | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue