forked from MapComplete/MapComplete
Refactoring: fix statistics in onwheels theme
This commit is contained in:
parent
0f897306a0
commit
3468837e0b
10 changed files with 84 additions and 256 deletions
|
@ -1,4 +1,3 @@
|
|||
import Combine from "./Base/Combine"
|
||||
import { FixedUiElement } from "./Base/FixedUiElement"
|
||||
import BaseUIElement from "./BaseUIElement"
|
||||
import { default as FeatureTitle } from "./Popup/Title.svelte"
|
||||
|
@ -12,11 +11,9 @@ import { VariableUiElement } from "./Base/VariableUIElement"
|
|||
import { Translation } from "./i18n/Translation"
|
||||
import Translations from "./i18n/Translations"
|
||||
import OpeningHoursVisualization from "./OpeningHours/OpeningHoursVisualization"
|
||||
import StatisticsPanel from "./BigComponents/StatisticsPanel"
|
||||
import AutoApplyButton from "./Popup/AutoApplyButton"
|
||||
import { LanguageElement } from "./Popup/LanguageElement/LanguageElement"
|
||||
import SvelteUIElement from "./Base/SvelteUIElement"
|
||||
import { BBoxFeatureSourceForLayer } from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource"
|
||||
import { Feature, LineString } from "geojson"
|
||||
import { GeoOperations } from "../Logic/GeoOperations"
|
||||
import LayerConfig from "../Models/ThemeConfig/LayerConfig"
|
||||
|
@ -45,6 +42,7 @@ import {
|
|||
WebAndCommunicationSpecialVisualisations
|
||||
} from "./SpecialVisualisations/WebAndCommunicationSpecialVisualisations"
|
||||
import ClearGPSHistory from "./BigComponents/ClearGPSHistory.svelte"
|
||||
import AllFeaturesStatistics from "./Statistics/AllFeaturesStatistics.svelte"
|
||||
|
||||
export default class SpecialVisualizations {
|
||||
public static specialVisualizations: SpecialVisualization[] = SpecialVisualizations.initList()
|
||||
|
@ -407,27 +405,7 @@ export default class SpecialVisualizations {
|
|||
docs: "Show general statistics about the elements currently in view. Intended to use on the `current_view`-layer",
|
||||
args: [],
|
||||
|
||||
constr: (state) => {
|
||||
return new Combine(
|
||||
state.theme.layers
|
||||
.filter(
|
||||
(l) =>
|
||||
l.name !== null &&
|
||||
l.title &&
|
||||
state.perLayer.get(l.id) !== undefined
|
||||
)
|
||||
.map(
|
||||
(l) => {
|
||||
const fs = state.perLayer.get(l.id)
|
||||
console.log(">>>", l.id, fs)
|
||||
const bbox = state.mapProperties.bounds
|
||||
const fsBboxed = new BBoxFeatureSourceForLayer(fs, bbox)
|
||||
return new StatisticsPanel(fsBboxed)
|
||||
},
|
||||
[state.mapProperties.bounds]
|
||||
)
|
||||
)
|
||||
},
|
||||
constr: (state) => new SvelteUIElement(AllFeaturesStatistics, { state })
|
||||
},
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue