forked from MapComplete/MapComplete
Further development of split-road feature; refactoring of change-handling
This commit is contained in:
parent
dc4cdda3b5
commit
96ecded0b9
37 changed files with 967 additions and 568 deletions
|
@ -13,6 +13,8 @@ import Loc from "../../Models/Loc";
|
|||
import GeoJsonSource from "./GeoJsonSource";
|
||||
import MetaTaggingFeatureSource from "./MetaTaggingFeatureSource";
|
||||
import RegisteringFeatureSource from "./RegisteringFeatureSource";
|
||||
import {Changes} from "../Osm/Changes";
|
||||
import ChangeApplicator from "./ChangeApplicator";
|
||||
|
||||
export default class FeaturePipeline implements FeatureSource {
|
||||
|
||||
|
@ -21,10 +23,10 @@ export default class FeaturePipeline implements FeatureSource {
|
|||
public readonly name = "FeaturePipeline"
|
||||
|
||||
constructor(flayers: UIEventSource<{ isDisplayed: UIEventSource<boolean>, layerDef: LayerConfig }[]>,
|
||||
changes: Changes,
|
||||
updater: FeatureSource,
|
||||
fromOsmApi: FeatureSource,
|
||||
layout: UIEventSource<LayoutConfig>,
|
||||
newPoints: FeatureSource,
|
||||
locationControl: UIEventSource<Loc>,
|
||||
selectedElement: UIEventSource<any>) {
|
||||
|
||||
|
@ -40,13 +42,16 @@ export default class FeaturePipeline implements FeatureSource {
|
|||
new MetaTaggingFeatureSource(allLoadedFeatures,
|
||||
new FeatureDuplicatorPerLayer(flayers,
|
||||
new RegisteringFeatureSource(
|
||||
updater)
|
||||
new ChangeApplicator(
|
||||
updater, changes
|
||||
))
|
||||
)), layout));
|
||||
|
||||
const geojsonSources: FeatureSource [] = GeoJsonSource
|
||||
.ConstructMultiSource(flayers.data, locationControl)
|
||||
.map(geojsonSource => {
|
||||
let source = new RegisteringFeatureSource(new FeatureDuplicatorPerLayer(flayers, geojsonSource));
|
||||
let source = new RegisteringFeatureSource(new FeatureDuplicatorPerLayer(flayers,
|
||||
new ChangeApplicator(geojsonSource, changes)));
|
||||
if(!geojsonSource.isOsmCache){
|
||||
source = new MetaTaggingFeatureSource(allLoadedFeatures, source, updater.features);
|
||||
}
|
||||
|
@ -54,25 +59,19 @@ export default class FeaturePipeline implements FeatureSource {
|
|||
});
|
||||
|
||||
const amendedLocalStorageSource =
|
||||
new RememberingSource(new RegisteringFeatureSource(new FeatureDuplicatorPerLayer(flayers, new LocalStorageSource(layout))
|
||||
new RememberingSource(new RegisteringFeatureSource(new FeatureDuplicatorPerLayer(flayers,new ChangeApplicator( new LocalStorageSource(layout), changes))
|
||||
));
|
||||
|
||||
newPoints = new MetaTaggingFeatureSource(allLoadedFeatures,
|
||||
new FeatureDuplicatorPerLayer(flayers,
|
||||
new RegisteringFeatureSource(newPoints)));
|
||||
|
||||
const amendedOsmApiSource = new RememberingSource(
|
||||
new MetaTaggingFeatureSource(allLoadedFeatures,
|
||||
new FeatureDuplicatorPerLayer(flayers,
|
||||
|
||||
new RegisteringFeatureSource(fromOsmApi))));
|
||||
new RegisteringFeatureSource(new ChangeApplicator(fromOsmApi, changes)))));
|
||||
|
||||
const merged =
|
||||
new FeatureSourceMerger([
|
||||
amendedOverpassSource,
|
||||
amendedOsmApiSource,
|
||||
amendedLocalStorageSource,
|
||||
newPoints,
|
||||
...geojsonSources
|
||||
]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue