forked from MapComplete/MapComplete
Immediately load and show the selected feature
This commit is contained in:
parent
c3b6353259
commit
cd4a2608a2
5 changed files with 8 additions and 14 deletions
|
@ -2,6 +2,7 @@ import FeatureSource from "./FeatureSource";
|
||||||
import {UIEventSource} from "../UIEventSource";
|
import {UIEventSource} from "../UIEventSource";
|
||||||
import LayerConfig from "../../Customizations/JSON/LayerConfig";
|
import LayerConfig from "../../Customizations/JSON/LayerConfig";
|
||||||
import Loc from "../../Models/Loc";
|
import Loc from "../../Models/Loc";
|
||||||
|
import Hash from "../Web/Hash";
|
||||||
|
|
||||||
export default class FilteringFeatureSource implements FeatureSource {
|
export default class FilteringFeatureSource implements FeatureSource {
|
||||||
public features: UIEventSource<{ feature: any; freshness: Date }[]> = new UIEventSource<{ feature: any; freshness: Date }[]>([]);
|
public features: UIEventSource<{ feature: any; freshness: Date }[]> = new UIEventSource<{ feature: any; freshness: Date }[]>([]);
|
||||||
|
@ -34,7 +35,7 @@ export default class FilteringFeatureSource implements FeatureSource {
|
||||||
const newFeatures = features.filter(f => {
|
const newFeatures = features.filter(f => {
|
||||||
const layerId = f.feature._matching_layer_id;
|
const layerId = f.feature._matching_layer_id;
|
||||||
|
|
||||||
if(selectedElement.data !== undefined && selectedElement.data?.id === f.feature.id){
|
if(selectedElement.data?.id === f.feature.id || f.feature.id === Hash.hash.data){
|
||||||
// This is the selected object - it gets a free pass even if zoom is not sufficient
|
// This is the selected object - it gets a free pass even if zoom is not sufficient
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,7 @@ export default class OsmApiFeatureSource implements FeatureSource {
|
||||||
public readonly name: string = "OsmApiFeatureSource";
|
public readonly name: string = "OsmApiFeatureSource";
|
||||||
private readonly loadedTiles: Set<string> = new Set<string>();
|
private readonly loadedTiles: Set<string> = new Set<string>();
|
||||||
|
|
||||||
constructor(location: UIEventSource<Loc>) {
|
constructor() {
|
||||||
/* const self = this
|
|
||||||
location.addCallback(_ => {
|
|
||||||
self.loadArea()
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +20,7 @@ export default class OsmApiFeatureSource implements FeatureSource {
|
||||||
// Newly added point - not yet in OSM
|
// Newly added point - not yet in OSM
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.debug("Downloading", id, "from the OSM-API")
|
||||||
OsmObject.DownloadObject(id, (element, meta) => {
|
OsmObject.DownloadObject(id, (element, meta) => {
|
||||||
const geojson = element.asGeoJson();
|
const geojson = element.asGeoJson();
|
||||||
geojson.id = geojson.properties.id;
|
geojson.id = geojson.properties.id;
|
||||||
|
|
|
@ -95,9 +95,7 @@ export default class MetaTagging {
|
||||||
|
|
||||||
const f = (featuresPerLayer, feature: any) => {
|
const f = (featuresPerLayer, feature: any) => {
|
||||||
try {
|
try {
|
||||||
const result = func(feature);
|
feature.properties[key] =func(feature);
|
||||||
console.debug("Calculated tag with code ", code, " returned ", result)
|
|
||||||
feature.properties[key] =result;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Could not calculate a metatag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features")
|
console.error("Could not calculate a metatag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features")
|
||||||
}
|
}
|
||||||
|
@ -114,7 +112,7 @@ export default class MetaTagging {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const relations = params.memberships.get(feature.properties.id)
|
const relations = params.memberships?.get(feature.properties.id) ?? []
|
||||||
ExtraFunction.FullPatchFeature(params.featuresPerLayer, relations, feature);
|
ExtraFunction.FullPatchFeature(params.featuresPerLayer, relations, feature);
|
||||||
try {
|
try {
|
||||||
for (const f of functions) {
|
for (const f of functions) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Utils } from "../Utils";
|
||||||
|
|
||||||
export default class Constants {
|
export default class Constants {
|
||||||
|
|
||||||
public static vNumber = "0.7.2a";
|
public static vNumber = "0.7.2b";
|
||||||
|
|
||||||
// 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 = {
|
||||||
|
|
2
State.ts
2
State.ts
|
@ -220,7 +220,7 @@ export default class State {
|
||||||
|
|
||||||
this.allElements = new ElementStorage();
|
this.allElements = new ElementStorage();
|
||||||
this.changes = new Changes();
|
this.changes = new Changes();
|
||||||
this.osmApiFeatureSource = new OsmApiFeatureSource(this.locationControl)
|
this.osmApiFeatureSource = new OsmApiFeatureSource()
|
||||||
|
|
||||||
new PendingChangesUploader(this.changes, this.selectedElement);
|
new PendingChangesUploader(this.changes, this.selectedElement);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue