Fixing adding multiple points
This commit is contained in:
parent
32bc1433b4
commit
baf41cb79d
6 changed files with 20 additions and 25 deletions
|
@ -419,7 +419,6 @@ export class InitUiElements {
|
|||
State.state.allElements.addElement(feature);
|
||||
})
|
||||
MetaTagging.addMetatags(features);
|
||||
console.log("ALL FEATURES", features);
|
||||
})
|
||||
|
||||
new ShowDataLayer(source.features, State.state.leafletMap,
|
||||
|
|
|
@ -13,27 +13,18 @@ export default class FeatureDuplicatorPerLayer implements FeatureSource {
|
|||
|
||||
|
||||
constructor(layers: { layerDef: LayerConfig }[], upstream: FeatureSource) {
|
||||
let noPassthroughts = true;
|
||||
for (const layer of layers) {
|
||||
if (layer.layerDef.passAllFeatures) {
|
||||
noPassthroughts = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.features = upstream.features.map(features => {
|
||||
const newFeatures: { feature: any, freshness: Date }[] = [];
|
||||
if(features === undefined){
|
||||
return newFeatures;
|
||||
}
|
||||
|
||||
|
||||
for (const f of features) {
|
||||
if (f.feature._matching_layer_id) {
|
||||
// Already matched previously
|
||||
// We simply add it
|
||||
newFeatures.push(f);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ export default class FeatureSourceMerger implements FeatureSource {
|
|||
private Update() {
|
||||
let all = {}; // Mapping 'id' -> {feature, freshness}
|
||||
for (const source of this._sources) {
|
||||
if(source?.features?.data === undefined){
|
||||
continue;
|
||||
}
|
||||
for (const f of source.features.data) {
|
||||
const id = f.feature.properties.id+f.feature.geometry.type+f.feature._matching_layer_id;
|
||||
const oldV = all[id];
|
||||
|
|
|
@ -4,21 +4,24 @@
|
|||
import FeatureSource from "./FeatureSource";
|
||||
import {UIEventSource} from "../UIEventSource";
|
||||
|
||||
export default class RememberingSource implements FeatureSource{
|
||||
features: UIEventSource<{feature: any, freshness: Date}[]> = new UIEventSource<{feature: any, freshness: Date}[]>([]);
|
||||
|
||||
export default class RememberingSource implements FeatureSource {
|
||||
features: UIEventSource<{ feature: any, freshness: Date }[]>;
|
||||
|
||||
constructor(source: FeatureSource) {
|
||||
const self = this;
|
||||
source.features.addCallbackAndRun(features => {
|
||||
if(features === undefined){
|
||||
return;
|
||||
const empty = [];
|
||||
this.features = source.features.map(features => {
|
||||
const oldFeatures = self.features?.data ?? empty;
|
||||
if (features === undefined) {
|
||||
return oldFeatures;
|
||||
}
|
||||
const ids = new Set<string>( features.map(f => f.feature.properties.id+f.feature.geometry.type));
|
||||
const newList = features.concat(
|
||||
self.features.data.filter(old => !ids.has(old.feature.properties.id+old.feature.geometry.type))
|
||||
)
|
||||
self.features.setData(newList);
|
||||
|
||||
// Then new ids
|
||||
const ids = new Set<string>(features.map(f => f.feature.properties.id + f.feature.geometry.type));
|
||||
// the old data
|
||||
const oldData = oldFeatures.filter(old => !ids.has(old.feature.properties.id + old.feature.geometry.type))
|
||||
return [...features, ...oldData];
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import { Utils } from "../Utils";
|
||||
|
||||
export default class Constants {
|
||||
public static vNumber = "0.2.7-rc3";
|
||||
public static vNumber = "0.2.7-rc4";
|
||||
|
||||
// The user journey states thresholds when a new feature gets unlocked
|
||||
public static userJourney = {
|
||||
|
|
|
@ -32,7 +32,6 @@ export default class ShowDataLayer {
|
|||
}
|
||||
|
||||
function update() {
|
||||
console.log("UPDATING!")
|
||||
if (features.data === undefined) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue