forked from MapComplete/MapComplete
		
	Refactoring: use theme instead of layout in a lot of places
				
					
				
			This commit is contained in:
		
							parent
							
								
									9427083939
								
							
						
					
					
						commit
						bdc9ba52a6
					
				
					 104 changed files with 445 additions and 449 deletions
				
			
		|  | @ -1,7 +1,6 @@ | |||
| import { SpecialVisualization, SpecialVisualizationState } from "../../SpecialVisualization" | ||||
| import { UIEventSource } from "../../../Logic/UIEventSource" | ||||
| import { Feature, Geometry, LineString, Polygon } from "geojson" | ||||
| import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" | ||||
| import BaseUIElement from "../../BaseUIElement" | ||||
| import { ImportFlowArguments, ImportFlowUtils } from "./ImportFlow" | ||||
| import Translations from "../../i18n/Translations" | ||||
|  | @ -12,7 +11,7 @@ import ConflateImportFlowState from "./ConflateImportFlowState" | |||
| import { AutoAction } from "../AutoApplyButton" | ||||
| import { IndexedFeatureSource } from "../../../Logic/FeatureSource/FeatureSource" | ||||
| import { Changes } from "../../../Logic/Osm/Changes" | ||||
| import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig" | ||||
| import ThemeConfig from "../../../Models/ThemeConfig/ThemeConfig" | ||||
| import { OsmConnection } from "../../../Logic/Osm/OsmConnection" | ||||
| 
 | ||||
| export interface ConflateFlowArguments extends ImportFlowArguments { | ||||
|  | @ -47,7 +46,7 @@ export default class ConflateImportButtonViz implements SpecialVisualization, Au | |||
|         feature: Feature<Geometry, { [name: string]: any }>, | ||||
|         state: { | ||||
|             osmConnection: OsmConnection | ||||
|             layout: LayoutConfig | ||||
|             theme: ThemeConfig | ||||
|             changes: Changes | ||||
|             indexedFeatures: IndexedFeatureSource | ||||
|         }, | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import { GeoOperations } from "../../../Logic/GeoOperations" | |||
| import { TagUtils } from "../../../Logic/Tags/TagUtils" | ||||
| import { MergePointConfig } from "../../../Logic/Osm/Actions/CreateWayWithPointReuseAction" | ||||
| import { And } from "../../../Logic/Tags/And" | ||||
| import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig" | ||||
| import ThemeConfig from "../../../Models/ThemeConfig/ThemeConfig" | ||||
| import { Changes } from "../../../Logic/Osm/Changes" | ||||
| import { FeatureSource, IndexedFeatureSource } from "../../../Logic/FeatureSource/FeatureSource" | ||||
| import FullNodeDatabaseSource from "../../../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource" | ||||
|  | @ -61,7 +61,7 @@ export default class ConflateImportFlowState extends ImportFlow<ConflateFlowArgu | |||
|         args: ConflateFlowArguments, | ||||
|         state: { | ||||
|             osmConnection: OsmConnection | ||||
|             layout: LayoutConfig | ||||
|             theme: ThemeConfig | ||||
|             changes: Changes | ||||
|             indexedFeatures: IndexedFeatureSource | ||||
|             fullNodeDatabase?: FullNodeDatabaseSource | ||||
|  | @ -88,7 +88,7 @@ export default class ConflateImportFlowState extends ImportFlow<ConflateFlowArgu | |||
|             GeoOperations.removeOvernoding(feature), | ||||
|             idOfFeatureToReplaceGeometry, | ||||
|             { | ||||
|                 theme: state.layout.id, | ||||
|                 theme: state.theme.id, | ||||
|                 newTags: tagsToApply.data, | ||||
|             } | ||||
|         ) | ||||
|  |  | |||
|  | @ -174,7 +174,7 @@ export default abstract class ImportFlow<ArgT extends ImportFlowArguments> { | |||
|                     return { error: t.hasBeenImported } | ||||
|                 } | ||||
| 
 | ||||
|                 if (!state.layout.official && !isTesting) { | ||||
|                 if (!state.theme.official && !isTesting) { | ||||
|                     // Unofficial theme - imports not allowed
 | ||||
|                     return { | ||||
|                         error: t.officialThemesOnly, | ||||
|  | @ -183,7 +183,7 @@ export default abstract class ImportFlow<ArgT extends ImportFlowArguments> { | |||
|                 } | ||||
| 
 | ||||
|                 if (this.targetLayer === undefined) { | ||||
|                     const e = `Target layer not defined: error in import button for theme: ${this.state.layout.id}: layer ${this.args.targetLayer} not found` | ||||
|                     const e = `Target layer not defined: error in import button for theme: ${this.state.theme.id}: layer ${this.args.targetLayer} not found` | ||||
|                     console.error(e) | ||||
|                     return { error: new Translation({ "*": e }) } | ||||
|                 } | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|   // The following variables are used for the map | ||||
|   const targetLayers: LayerConfig[] = args.targetLayer | ||||
|     .split(" ") | ||||
|     .map((tl) => state.layout.layers.find((l) => l.id === tl)) | ||||
|     .map((tl) => state.theme.layers.find((l) => l.id === tl)) | ||||
|   const snapToLayers: string[] | undefined = | ||||
|     args.snap_onto_layers?.split(",")?.map((l) => l.trim()) ?? [] | ||||
|   const maxSnapDistance: number = Number(args.max_snap_distance ?? 25) ?? 25 | ||||
|  |  | |||
|  | @ -63,7 +63,7 @@ export class PointImportFlowState extends ImportFlow<PointImportFlowArguments> { | |||
|         } | ||||
| 
 | ||||
|         const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, { | ||||
|             theme: this.state.layout.id, | ||||
|             theme: this.state.theme.id, | ||||
|             changeType: "import", | ||||
|             snapOnto: <OsmWay>snapOnto, | ||||
|             specialMotivation: specialMotivation, | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import { FixedUiElement } from "../../Base/FixedUiElement" | |||
| import WayImportFlow from "./WayImportFlow.svelte" | ||||
| import WayImportFlowState, { WayImportFlowArguments } from "./WayImportFlowState" | ||||
| import { Utils } from "../../../Utils" | ||||
| import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig" | ||||
| import ThemeConfig from "../../../Models/ThemeConfig/ThemeConfig" | ||||
| import { Changes } from "../../../Logic/Osm/Changes" | ||||
| import { IndexedFeatureSource } from "../../../Logic/FeatureSource/FeatureSource" | ||||
| import FullNodeDatabaseSource from "../../../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource" | ||||
|  | @ -87,7 +87,7 @@ export default class WayImportButtonViz implements AutoAction, SpecialVisualizat | |||
|     public async applyActionOn( | ||||
|         feature: Feature, | ||||
|         state: { | ||||
|             layout: LayoutConfig | ||||
|             theme: ThemeConfig | ||||
|             changes: Changes | ||||
|             indexedFeatures: IndexedFeatureSource | ||||
|             fullNodeDatabase: FullNodeDatabaseSource | ||||
|  |  | |||
|  | @ -32,7 +32,7 @@ | |||
|   ShowDataLayer.showMultipleLayers( | ||||
|     map, | ||||
|     new StaticFeatureSource([importFlow.originalFeature]), | ||||
|     state.layout.layers, | ||||
|     state.theme.layers, | ||||
|     { zoomToFeatures: false } | ||||
|   ) | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ import { TagUtils } from "../../../Logic/Tags/TagUtils" | |||
| import { OsmCreateAction, PreviewableAction } from "../../../Logic/Osm/Actions/OsmChangeAction" | ||||
| import { FeatureSource, IndexedFeatureSource } from "../../../Logic/FeatureSource/FeatureSource" | ||||
| import CreateMultiPolygonWithPointReuseAction from "../../../Logic/Osm/Actions/CreateMultiPolygonWithPointReuseAction" | ||||
| import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig" | ||||
| import ThemeConfig from "../../../Models/ThemeConfig/ThemeConfig" | ||||
| import { Changes } from "../../../Logic/Osm/Changes" | ||||
| import FullNodeDatabaseSource from "../../../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource" | ||||
| 
 | ||||
|  | @ -52,7 +52,7 @@ export default class WayImportFlowState extends ImportFlow<WayImportFlowArgument | |||
|         feature: Feature<LineString | Polygon>, | ||||
|         args: WayImportFlowArguments, | ||||
|         state: { | ||||
|             layout: LayoutConfig | ||||
|             theme: ThemeConfig | ||||
|             changes: Changes | ||||
|             indexedFeatures: IndexedFeatureSource | ||||
|             fullNodeDatabase?: FullNodeDatabaseSource | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue