A new element now shows up directly on the map
This commit is contained in:
parent
bee2878b76
commit
32bc1433b4
5 changed files with 24 additions and 15 deletions
|
@ -317,9 +317,9 @@ export class InitUiElements {
|
||||||
|
|
||||||
State.state.locationControl
|
State.state.locationControl
|
||||||
.addCallback(() => {
|
.addCallback(() => {
|
||||||
// Close the layer selection when the map is moved
|
// Close the layer selection when the map is moved
|
||||||
// checkbox.isEnabled.setData(false);
|
// checkbox.isEnabled.setData(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
const fullScreen = new LayerControlPanel();
|
const fullScreen = new LayerControlPanel();
|
||||||
checkbox.isEnabled.addCallback(isEnabled => {
|
checkbox.isEnabled.addCallback(isEnabled => {
|
||||||
|
@ -358,7 +358,7 @@ export class InitUiElements {
|
||||||
State.state.availableBackgroundLayers, State.state.layoutToUse.map((layout: LayoutConfig) => layout.defaultBackgroundId));
|
State.state.availableBackgroundLayers, State.state.layoutToUse.map((layout: LayoutConfig) => layout.defaultBackgroundId));
|
||||||
|
|
||||||
|
|
||||||
const attr = new Attribution(State.state.locationControl, State.state.osmConnection.userDetails, State.state.layoutToUse,
|
const attr = new Attribution(State.state.locationControl, State.state.osmConnection.userDetails, State.state.layoutToUse,
|
||||||
State.state.leafletMap);
|
State.state.leafletMap);
|
||||||
const bm = new Basemap("leafletDiv",
|
const bm = new Basemap("leafletDiv",
|
||||||
State.state.locationControl,
|
State.state.locationControl,
|
||||||
|
@ -396,11 +396,10 @@ export class InitUiElements {
|
||||||
|
|
||||||
State.state.filteredLayers.setData(flayers);
|
State.state.filteredLayers.setData(flayers);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const updater = new LoadFromOverpass(state.locationControl, state.layoutToUse, state.leafletMap);
|
const updater = new LoadFromOverpass(state.locationControl, state.layoutToUse, state.leafletMap);
|
||||||
State.state.layerUpdater = updater;
|
State.state.layerUpdater = updater;
|
||||||
|
|
||||||
|
|
||||||
const source =
|
const source =
|
||||||
new FilteringFeatureSource(
|
new FilteringFeatureSource(
|
||||||
|
@ -408,10 +407,11 @@ export class InitUiElements {
|
||||||
State.state.locationControl,
|
State.state.locationControl,
|
||||||
new FeatureSourceMerger([
|
new FeatureSourceMerger([
|
||||||
new RememberingSource(new WayHandlingApplyingFeatureSource(flayers,
|
new RememberingSource(new WayHandlingApplyingFeatureSource(flayers,
|
||||||
new NoOverlapSource(flayers, new FeatureDuplicatorPerLayer(flayers, updater))
|
new NoOverlapSource(flayers, new FeatureDuplicatorPerLayer(flayers, updater))
|
||||||
)),
|
)),
|
||||||
new FeatureDuplicatorPerLayer(flayers, State.state.changes)]));
|
new FeatureDuplicatorPerLayer(flayers, State.state.changes)
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
source.features.addCallback((featuresFreshness: { feature: any, freshness: Date }[]) => {
|
source.features.addCallback((featuresFreshness: { feature: any, freshness: Date }[]) => {
|
||||||
let features = featuresFreshness.map(ff => ff.feature);
|
let features = featuresFreshness.map(ff => ff.feature);
|
||||||
|
@ -419,9 +419,10 @@ export class InitUiElements {
|
||||||
State.state.allElements.addElement(feature);
|
State.state.allElements.addElement(feature);
|
||||||
})
|
})
|
||||||
MetaTagging.addMetatags(features);
|
MetaTagging.addMetatags(features);
|
||||||
|
console.log("ALL FEATURES", features);
|
||||||
})
|
})
|
||||||
|
|
||||||
new ShowDataLayer(source.features, State.state.leafletMap,
|
new ShowDataLayer(source.features, State.state.leafletMap,
|
||||||
State.state.locationControl.map(l => l.zoom),
|
State.state.locationControl.map(l => l.zoom),
|
||||||
State.state.layoutToUse.data);
|
State.state.layoutToUse.data);
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,11 @@ export default class FeatureDuplicatorPerLayer implements FeatureSource {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let foundALayer = false;
|
||||||
for (const layer of layers) {
|
for (const layer of layers) {
|
||||||
if (layer.layerDef.overpassTags.matchesProperties(f.feature.properties)) {
|
if (layer.layerDef.overpassTags.matchesProperties(f.feature.properties)) {
|
||||||
|
foundALayer = true;
|
||||||
if (layer.layerDef.passAllFeatures) {
|
if (layer.layerDef.passAllFeatures) {
|
||||||
|
|
||||||
// We copy the feature; the "properties" field is kept identical though!
|
// We copy the feature; the "properties" field is kept identical though!
|
||||||
|
@ -58,6 +61,9 @@ export default class FeatureDuplicatorPerLayer implements FeatureSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!foundALayer){
|
||||||
|
console.error("LAYER DEDUP PANIC: no suitable layer found for ", f, JSON.stringify(f), "within layers", layers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return newFeatures;
|
return newFeatures;
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,6 @@ export class Changes implements FeatureSource{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.features.data.push({feature:geojson, freshness: new Date()});
|
|
||||||
this.features.ping();
|
|
||||||
|
|
||||||
// The basictags are COPIED, the id is included in the properties
|
// The basictags are COPIED, the id is included in the properties
|
||||||
// The tags are not yet written into the OsmObject, but this is applied onto a
|
// The tags are not yet written into the OsmObject, but this is applied onto a
|
||||||
const changes = [];
|
const changes = [];
|
||||||
|
@ -104,6 +101,10 @@ export class Changes implements FeatureSource{
|
||||||
changes.push({elementId: id, key: kv.key, value: kv.value})
|
changes.push({elementId: id, key: kv.key, value: kv.value})
|
||||||
}
|
}
|
||||||
State.state.allElements.addOrGetElement(geojson).ping();
|
State.state.allElements.addOrGetElement(geojson).ping();
|
||||||
|
|
||||||
|
this.features.data.push({feature:geojson, freshness: new Date()});
|
||||||
|
this.features.ping();
|
||||||
|
|
||||||
this.uploadAll([osmNode], changes);
|
this.uploadAll([osmNode], changes);
|
||||||
return geojson;
|
return geojson;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Utils } from "../Utils";
|
import { Utils } from "../Utils";
|
||||||
|
|
||||||
export default class Constants {
|
export default class Constants {
|
||||||
public static vNumber = "0.2.7-rc2";
|
public static vNumber = "0.2.7-rc3";
|
||||||
|
|
||||||
// The user journey states thresholds when a new feature gets unlocked
|
// The user journey states thresholds when a new feature gets unlocked
|
||||||
public static userJourney = {
|
public static userJourney = {
|
||||||
|
|
|
@ -32,6 +32,7 @@ export default class ShowDataLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
console.log("UPDATING!")
|
||||||
if (features.data === undefined) {
|
if (features.data === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue