forked from MapComplete/MapComplete
Chore: reformat all files with prettier
This commit is contained in:
parent
5757ae5dea
commit
d008dcb54d
214 changed files with 8926 additions and 8196 deletions
|
@ -1,34 +1,48 @@
|
|||
import ImportFlow from "./ImportFlow";
|
||||
import {ConflateFlowArguments} from "./ConflateImportButtonViz";
|
||||
import {SpecialVisualizationState} from "../../SpecialVisualization";
|
||||
import {Feature, LineString, Polygon} from "geojson";
|
||||
import {Store, UIEventSource} from "../../../Logic/UIEventSource";
|
||||
import {Tag} from "../../../Logic/Tags/Tag";
|
||||
import OsmChangeAction from "../../../Logic/Osm/Actions/OsmChangeAction";
|
||||
import ReplaceGeometryAction from "../../../Logic/Osm/Actions/ReplaceGeometryAction";
|
||||
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 {Changes} from "../../../Logic/Osm/Changes";
|
||||
import {FeatureSource, IndexedFeatureSource} from "../../../Logic/FeatureSource/FeatureSource";
|
||||
import FullNodeDatabaseSource from "../../../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource";
|
||||
import {OsmConnection} from "../../../Logic/Osm/OsmConnection";
|
||||
import ImportFlow from "./ImportFlow"
|
||||
import { ConflateFlowArguments } from "./ConflateImportButtonViz"
|
||||
import { SpecialVisualizationState } from "../../SpecialVisualization"
|
||||
import { Feature, LineString, Polygon } from "geojson"
|
||||
import { Store, UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import { Tag } from "../../../Logic/Tags/Tag"
|
||||
import OsmChangeAction from "../../../Logic/Osm/Actions/OsmChangeAction"
|
||||
import ReplaceGeometryAction from "../../../Logic/Osm/Actions/ReplaceGeometryAction"
|
||||
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 { Changes } from "../../../Logic/Osm/Changes"
|
||||
import { FeatureSource, IndexedFeatureSource } from "../../../Logic/FeatureSource/FeatureSource"
|
||||
import FullNodeDatabaseSource from "../../../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource"
|
||||
import { OsmConnection } from "../../../Logic/Osm/OsmConnection"
|
||||
|
||||
export default class ConflateImportFlowState extends ImportFlow<ConflateFlowArguments> {
|
||||
|
||||
public readonly originalFeature: Feature
|
||||
private readonly action: OsmChangeAction & { getPreview?(): Promise<FeatureSource>; newElementId?: string };
|
||||
constructor(state: SpecialVisualizationState, originalFeature: Feature<LineString | Polygon>, args: ConflateFlowArguments, tagsToApply: Store<Tag[]>, originalFeatureTags: UIEventSource<Record<string, string>>, idOfFeatureToReplaceGeometry: string) {
|
||||
private readonly action: OsmChangeAction & {
|
||||
getPreview?(): Promise<FeatureSource>
|
||||
newElementId?: string
|
||||
}
|
||||
constructor(
|
||||
state: SpecialVisualizationState,
|
||||
originalFeature: Feature<LineString | Polygon>,
|
||||
args: ConflateFlowArguments,
|
||||
tagsToApply: Store<Tag[]>,
|
||||
originalFeatureTags: UIEventSource<Record<string, string>>,
|
||||
idOfFeatureToReplaceGeometry: string
|
||||
) {
|
||||
super(state, args, tagsToApply, originalFeatureTags)
|
||||
this.originalFeature = originalFeature
|
||||
this.action = ConflateImportFlowState.createAction(originalFeature, args, state, idOfFeatureToReplaceGeometry, tagsToApply)
|
||||
|
||||
this.action = ConflateImportFlowState.createAction(
|
||||
originalFeature,
|
||||
args,
|
||||
state,
|
||||
idOfFeatureToReplaceGeometry,
|
||||
tagsToApply
|
||||
)
|
||||
}
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
public GetPreview(): Promise<FeatureSource>{
|
||||
public GetPreview(): Promise<FeatureSource> {
|
||||
return this.action.getPreview()
|
||||
}
|
||||
|
||||
|
@ -43,18 +57,19 @@ export default class ConflateImportFlowState extends ImportFlow<ConflateFlowArgu
|
|||
this.state.selectedElement.setData(this.state.indexedFeatures.featuresById.data.get(newId))
|
||||
}
|
||||
|
||||
public static createAction(feature: Feature<LineString | Polygon>,
|
||||
args: ConflateFlowArguments,
|
||||
state: {
|
||||
osmConnection: OsmConnection,
|
||||
layout: LayoutConfig;
|
||||
changes: Changes;
|
||||
indexedFeatures: IndexedFeatureSource,
|
||||
fullNodeDatabase?: FullNodeDatabaseSource
|
||||
},
|
||||
idOfFeatureToReplaceGeometry,
|
||||
tagsToApply: Store<Tag[]>
|
||||
): OsmChangeAction & { getPreview?(): Promise<FeatureSource>; newElementId?: string } {
|
||||
public static createAction(
|
||||
feature: Feature<LineString | Polygon>,
|
||||
args: ConflateFlowArguments,
|
||||
state: {
|
||||
osmConnection: OsmConnection
|
||||
layout: LayoutConfig
|
||||
changes: Changes
|
||||
indexedFeatures: IndexedFeatureSource
|
||||
fullNodeDatabase?: FullNodeDatabaseSource
|
||||
},
|
||||
idOfFeatureToReplaceGeometry,
|
||||
tagsToApply: Store<Tag[]>
|
||||
): OsmChangeAction & { getPreview?(): Promise<FeatureSource>; newElementId?: string } {
|
||||
const nodesMustMatch = args.snap_onto_layers
|
||||
?.split(";")
|
||||
?.map((tag, i) => TagUtils.Tag(tag, "TagsSpec for import button " + i))
|
||||
|
@ -69,7 +84,6 @@ export default class ConflateImportFlowState extends ImportFlow<ConflateFlowArgu
|
|||
mergeConfigs.push(mergeConfig)
|
||||
}
|
||||
|
||||
|
||||
return new ReplaceGeometryAction(
|
||||
state,
|
||||
GeoOperations.removeOvernoding(feature),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue