Finish refactoring
This commit is contained in:
parent
eff6b5bfad
commit
71285d34cd
3 changed files with 9 additions and 12 deletions
|
@ -68,13 +68,10 @@ export default class GeoJsonSource implements FeatureSourceForLayer, Tiled {
|
||||||
const self = this;
|
const self = this;
|
||||||
Utils.downloadJson(url)
|
Utils.downloadJson(url)
|
||||||
.then(json => {
|
.then(json => {
|
||||||
if(json.elements === undefined || json.elements === null){
|
if(json.features === undefined || json.features === null){
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (json.elements === [] && json.remarks.indexOf("runtime error") > 0) {
|
|
||||||
self.onFail("Runtime error (timeout)", url)
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const time = new Date();
|
const time = new Date();
|
||||||
const newFeatures: { feature: any, freshness: Date } [] = []
|
const newFeatures: { feature: any, freshness: Date } [] = []
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
|
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
|
||||||
import FeaturePipeline from "../FeatureSource/FeaturePipeline";
|
import FeaturePipeline from "../FeatureSource/FeaturePipeline";
|
||||||
import State from "../../State";
|
|
||||||
import {Tiles} from "../../Models/TileRange";
|
import {Tiles} from "../../Models/TileRange";
|
||||||
import ShowDataLayer from "../../UI/ShowDataLayer/ShowDataLayer";
|
import ShowDataLayer from "../../UI/ShowDataLayer/ShowDataLayer";
|
||||||
import {TileHierarchyAggregator} from "../../UI/ShowDataLayer/TileHierarchyAggregator";
|
import {TileHierarchyAggregator} from "../../UI/ShowDataLayer/TileHierarchyAggregator";
|
||||||
|
@ -37,13 +36,13 @@ export default class FeaturePipelineState extends MapState {
|
||||||
// Do show features indicates if the 'showDataLayer' should be shown
|
// Do show features indicates if the 'showDataLayer' should be shown
|
||||||
const doShowFeatures = source.features.map(
|
const doShowFeatures = source.features.map(
|
||||||
f => {
|
f => {
|
||||||
const z = State.state.locationControl.data.zoom
|
const z = self.locationControl.data.zoom
|
||||||
|
|
||||||
if (!source.layer.isDisplayed.data) {
|
if (!source.layer.isDisplayed.data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bounds = State.state.currentBounds.data
|
const bounds = self.currentBounds.data
|
||||||
if (bounds === undefined) {
|
if (bounds === undefined) {
|
||||||
// Map is not yet displayed
|
// Map is not yet displayed
|
||||||
return false;
|
return false;
|
||||||
|
@ -86,7 +85,7 @@ export default class FeaturePipelineState extends MapState {
|
||||||
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}, [State.state.currentBounds, source.layer.isDisplayed]
|
}, [this.currentBounds, source.layer.isDisplayed]
|
||||||
)
|
)
|
||||||
|
|
||||||
new ShowDataLayer(
|
new ShowDataLayer(
|
||||||
|
|
|
@ -6,7 +6,6 @@ import LayerConfig from "../../Models/ThemeConfig/LayerConfig";
|
||||||
import FeatureInfoBox from "../Popup/FeatureInfoBox";
|
import FeatureInfoBox from "../Popup/FeatureInfoBox";
|
||||||
import {ShowDataLayerOptions} from "./ShowDataLayerOptions";
|
import {ShowDataLayerOptions} from "./ShowDataLayerOptions";
|
||||||
import {ElementStorage} from "../../Logic/ElementStorage";
|
import {ElementStorage} from "../../Logic/ElementStorage";
|
||||||
import Hash from "../../Logic/Web/Hash";
|
|
||||||
|
|
||||||
export default class ShowDataLayer {
|
export default class ShowDataLayer {
|
||||||
|
|
||||||
|
@ -48,13 +47,13 @@ export default class ShowDataLayer {
|
||||||
this.allElements = options.allElements;
|
this.allElements = options.allElements;
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
options.leafletMap.addCallbackAndRunD(_ => {
|
options.leafletMap.addCallback(_ => {
|
||||||
self.update(options)
|
self.update(options)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
features.addCallback(_ => self.update(options));
|
features.addCallback(_ => self.update(options));
|
||||||
options.doShowLayer?.addCallbackAndRun(doShow => {
|
options.doShowLayer?.addCallback(doShow => {
|
||||||
const mp = options.leafletMap.data;
|
const mp = options.leafletMap.data;
|
||||||
if (mp == undefined) {
|
if (mp == undefined) {
|
||||||
return;
|
return;
|
||||||
|
@ -103,6 +102,8 @@ export default class ShowDataLayer {
|
||||||
leafletLayer.openPopup()
|
leafletLayer.openPopup()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.update(options)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue