@geops/rvf-mobility-web-component 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/docutils.js +8 -2
- package/index.html +14 -2
- package/index.js +162 -75
- package/package.json +2 -1
- package/src/RealtimeLayer/RealtimeLayer.tsx +2 -0
- package/src/RvfExportMenu/RvfExportMenu.tsx +12 -1
- package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +25 -4
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/FloatingVehiclesDetails.tsx +53 -0
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/index.tsx +1 -0
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/RvfSharedMobilityDetails.tsx +129 -0
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/StationDetails.tsx +24 -0
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/index.tsx +1 -0
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/index.tsx +1 -0
- package/src/RvfLineNetworkPlanLayer/RvfLineNetworkPlanLayer.tsx +2 -0
- package/src/RvfMobilityMap/RvfMobilityMap.tsx +107 -26
- package/src/RvfOverlayHeader/RvfOverlayHeader.tsx +1 -1
- package/src/RvfPoisLayer/RvfPoisLayer.tsx +2 -0
- package/src/RvfSelectedFeatureHighlightLayer/RvfSelectedFeatureHighlightLayer.tsx +64 -0
- package/src/RvfSelectedFeatureHighlightLayer/index.tsx +1 -0
- package/src/RvfSellingPointsLayer/RvfSellingPointsLayer.tsx +2 -0
- package/src/RvfShare/RvfShare.tsx +1 -1
- package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +50 -18
- package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +2 -10
- package/src/RvfTarifZonenLayer/RvfTarifZonenLayer.tsx +2 -0
- package/src/RvfTopics/RvfTopics.tsx +40 -8
- package/src/StationsLayer/StationsLayer.tsx +2 -0
- package/src/icons/Bike/rvf_shared_bike.svg +2 -2
- package/src/icons/Car/rvf_shared_car.svg +3 -3
- package/src/icons/CargoBike/rvf_shared_cargo_bike.svg +3 -3
- package/src/icons/Scooter/rvf_shared_scooter.svg +2 -2
- package/src/index.tsx +4 -0
- package/src/logos/callabike_logo.png +0 -0
- package/src/logos/flinkster_logo.png +0 -0
- package/src/logos/gruene_flotte_logo.png +0 -0
- package/src/logos/logo_frelo_web_rgb.png +0 -0
- package/src/logos/natur_energie_logo.png +0 -0
- package/src/logos/yoio_logo.png +0 -0
- package/src/logos/zeus_logo.png +0 -0
- package/src/utils/applyInitialLayerVisibility.ts +41 -0
- package/src/utils/constants.ts +30 -0
- package/src/utils/{createSharedMobilityLayer.ts → createFreeFloatMobilityLayer.ts} +41 -69
- package/src/utils/createMobiDataBwWfsLayer.ts +108 -67
- package/src/utils/exportPdf.ts +1 -4
- package/src/utils/getLayersAsFlatArray.ts +22 -0
- package/src/utils/getLinkByDevice.ts +28 -0
- package/src/utils/getPermalinkParameters.ts +27 -0
- package/src/utils/hooks/useInitialLayersVisiblity.tsx +28 -0
- package/src/utils/hooks/useMapContext.tsx +2 -0
- package/src/utils/hooks/useUpdatePermalink.tsx +44 -11
|
@@ -3,6 +3,7 @@ import { MaplibreStyleLayerOptions } from "mobility-toolbox-js/ol/layers/Maplibr
|
|
|
3
3
|
import { memo } from "preact/compat";
|
|
4
4
|
import { useEffect, useMemo } from "preact/hooks";
|
|
5
5
|
|
|
6
|
+
import { RVF_LAYERS_NAMES } from "../utils/constants";
|
|
6
7
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
7
8
|
import useRvfContext from "../utils/hooks/useRvfContext";
|
|
8
9
|
|
|
@@ -19,6 +20,7 @@ function RvfPoisLayer(props: MaplibreStyleLayerOptions) {
|
|
|
19
20
|
return metadata?.["mapset.filter"] === "mapset_poi";
|
|
20
21
|
},
|
|
21
22
|
maplibreLayer: baseLayer,
|
|
23
|
+
name: RVF_LAYERS_NAMES.pois,
|
|
22
24
|
visible: false,
|
|
23
25
|
...(props || {}),
|
|
24
26
|
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import VectorLayer from "ol/layer/Vector";
|
|
2
|
+
import { Vector } from "ol/source";
|
|
3
|
+
import { Circle, Stroke, Style } from "ol/style";
|
|
4
|
+
import { useEffect, useMemo } from "preact/hooks";
|
|
5
|
+
|
|
6
|
+
import useMapContext from "../utils/hooks/useMapContext";
|
|
7
|
+
import useRvfContext from "../utils/hooks/useRvfContext";
|
|
8
|
+
|
|
9
|
+
function SingleClickListener() {
|
|
10
|
+
const { baseLayer, map } = useMapContext();
|
|
11
|
+
const { selectedFeature } = useRvfContext();
|
|
12
|
+
|
|
13
|
+
const layer = useMemo(() => {
|
|
14
|
+
const layer = new VectorLayer({
|
|
15
|
+
source: new Vector(),
|
|
16
|
+
style: new Style({
|
|
17
|
+
image: new Circle({
|
|
18
|
+
fill: null,
|
|
19
|
+
radius: 15,
|
|
20
|
+
stroke: new Stroke({
|
|
21
|
+
color: "red",
|
|
22
|
+
width: 3,
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
return layer;
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const vectorTileFeature = selectedFeature?.get("vectorTileFeature");
|
|
32
|
+
selectedFeature?.set("selected", true);
|
|
33
|
+
if (selectedFeature) {
|
|
34
|
+
const feature = selectedFeature.clone();
|
|
35
|
+
feature.setStyle(null);
|
|
36
|
+
layer.getSource().addFeature(feature);
|
|
37
|
+
if (vectorTileFeature) {
|
|
38
|
+
console.log(vectorTileFeature);
|
|
39
|
+
baseLayer?.mapLibreMap.setFeatureState(vectorTileFeature, {
|
|
40
|
+
hover: true,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return () => {
|
|
45
|
+
layer?.getSource().clear();
|
|
46
|
+
selectedFeature?.set("selected", false);
|
|
47
|
+
if (vectorTileFeature) {
|
|
48
|
+
baseLayer?.mapLibreMap?.setFeatureState(vectorTileFeature, {
|
|
49
|
+
hover: false,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}, [baseLayer?.mapLibreMap, layer, selectedFeature]);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
layer?.setMap(map);
|
|
57
|
+
return () => {
|
|
58
|
+
layer?.setMap(null);
|
|
59
|
+
};
|
|
60
|
+
}, [layer, map]);
|
|
61
|
+
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
export default SingleClickListener;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./RvfSelectedFeatureHighlightLayer";
|
|
@@ -6,6 +6,7 @@ import { useEffect, useMemo } from "preact/hooks";
|
|
|
6
6
|
import Automat from "../icons/Automat";
|
|
7
7
|
import InPerson from "../icons/InPerson";
|
|
8
8
|
import Video from "../icons/Video";
|
|
9
|
+
import { RVF_LAYERS_NAMES } from "../utils/constants";
|
|
9
10
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
10
11
|
import useRvfContext from "../utils/hooks/useRvfContext";
|
|
11
12
|
|
|
@@ -24,6 +25,7 @@ function RvfSellingPointsLayer(props: MaplibreStyleLayerOptions) {
|
|
|
24
25
|
return metadata?.["general.filter"] === "selling_points";
|
|
25
26
|
},
|
|
26
27
|
maplibreLayer: baseLayer,
|
|
28
|
+
name: RVF_LAYERS_NAMES.verkaufsstellen,
|
|
27
29
|
...(props || {}),
|
|
28
30
|
|
|
29
31
|
title: (
|
|
@@ -16,7 +16,7 @@ function RvfShare({
|
|
|
16
16
|
const { map } = useMapContext();
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
|
-
<div className={twMerge("flex flex-col gap-
|
|
19
|
+
<div className={twMerge("flex flex-col gap-6 " + className)} {...props}>
|
|
20
20
|
<a
|
|
21
21
|
className="flex items-center gap-2"
|
|
22
22
|
href={`mailto:?subject=Karte&body=${window?.location.href}`}
|
|
@@ -4,7 +4,6 @@ import { MaplibreStyleLayer } from "mobility-toolbox-js/ol";
|
|
|
4
4
|
import { Feature } from "ol";
|
|
5
5
|
import { Point } from "ol/geom";
|
|
6
6
|
import { Group, Vector } from "ol/layer";
|
|
7
|
-
import { unByKey } from "ol/Observable";
|
|
8
7
|
import { Cluster } from "ol/source";
|
|
9
8
|
import VectorSource from "ol/source/Vector";
|
|
10
9
|
import { memo } from "preact/compat";
|
|
@@ -15,8 +14,9 @@ import Car from "../icons/Car";
|
|
|
15
14
|
import CargoBike from "../icons/CargoBike";
|
|
16
15
|
import Ride from "../icons/Ride";
|
|
17
16
|
import Scooter from "../icons/Scooter";
|
|
17
|
+
import { API_REQUEST_FEATURE_TYPE, RVF_LAYERS_NAMES } from "../utils/constants";
|
|
18
|
+
import createFreeFloatMobilityLayer from "../utils/createFreeFloatMobilityLayer";
|
|
18
19
|
import createMobiDataBwWfsLayer from "../utils/createMobiDataBwWfsLayer";
|
|
19
|
-
import createFreeFloatMobilityLayer from "../utils/createSharedMobilityLayer";
|
|
20
20
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
21
21
|
import useRvfContext from "../utils/hooks/useRvfContext";
|
|
22
22
|
|
|
@@ -38,10 +38,19 @@ function RvfSharedMobilityLayerGroup(props: GroupOptions) {
|
|
|
38
38
|
return metadata?.["rvf.filter"] === "bike";
|
|
39
39
|
},
|
|
40
40
|
maplibreLayer: baseLayer,
|
|
41
|
+
maxZoom: 18,
|
|
41
42
|
}),
|
|
42
|
-
createMobiDataBwWfsLayer(
|
|
43
|
-
|
|
43
|
+
createMobiDataBwWfsLayer(
|
|
44
|
+
API_REQUEST_FEATURE_TYPE.stations.bike,
|
|
45
|
+
"green",
|
|
46
|
+
),
|
|
47
|
+
createFreeFloatMobilityLayer(
|
|
48
|
+
API_REQUEST_FEATURE_TYPE.freeFloat.bike,
|
|
49
|
+
"green",
|
|
50
|
+
"bike",
|
|
51
|
+
),
|
|
44
52
|
],
|
|
53
|
+
name: RVF_LAYERS_NAMES.fahrrad,
|
|
45
54
|
title: (
|
|
46
55
|
<div className="flex items-center justify-between gap-2">
|
|
47
56
|
Fahrrad
|
|
@@ -58,10 +67,19 @@ function RvfSharedMobilityLayerGroup(props: GroupOptions) {
|
|
|
58
67
|
return metadata?.["rvf.filter"] === "car";
|
|
59
68
|
},
|
|
60
69
|
maplibreLayer: baseLayer,
|
|
70
|
+
maxZoom: 18,
|
|
61
71
|
}),
|
|
62
|
-
createMobiDataBwWfsLayer(
|
|
63
|
-
|
|
72
|
+
createMobiDataBwWfsLayer(
|
|
73
|
+
API_REQUEST_FEATURE_TYPE.stations.car,
|
|
74
|
+
"green",
|
|
75
|
+
),
|
|
76
|
+
createFreeFloatMobilityLayer(
|
|
77
|
+
API_REQUEST_FEATURE_TYPE.freeFloat.car,
|
|
78
|
+
"green",
|
|
79
|
+
"car",
|
|
80
|
+
),
|
|
64
81
|
],
|
|
82
|
+
name: RVF_LAYERS_NAMES.auto,
|
|
65
83
|
title: (
|
|
66
84
|
<div className="flex items-center justify-between gap-2">
|
|
67
85
|
Auto
|
|
@@ -78,10 +96,19 @@ function RvfSharedMobilityLayerGroup(props: GroupOptions) {
|
|
|
78
96
|
return metadata?.["rvf.filter"] === "cargo_bike";
|
|
79
97
|
},
|
|
80
98
|
maplibreLayer: baseLayer,
|
|
99
|
+
maxZoom: 18,
|
|
81
100
|
}),
|
|
82
|
-
createMobiDataBwWfsLayer(
|
|
83
|
-
|
|
101
|
+
createMobiDataBwWfsLayer(
|
|
102
|
+
API_REQUEST_FEATURE_TYPE.stations.cargoBike,
|
|
103
|
+
"green",
|
|
104
|
+
),
|
|
105
|
+
createFreeFloatMobilityLayer(
|
|
106
|
+
API_REQUEST_FEATURE_TYPE.freeFloat.cargoBike,
|
|
107
|
+
"green",
|
|
108
|
+
"cargo_bike",
|
|
109
|
+
),
|
|
84
110
|
],
|
|
111
|
+
name: RVF_LAYERS_NAMES.cargobike,
|
|
85
112
|
title: (
|
|
86
113
|
<div className="flex items-center justify-between gap-2">
|
|
87
114
|
Cargobike
|
|
@@ -100,9 +127,19 @@ function RvfSharedMobilityLayerGroup(props: GroupOptions) {
|
|
|
100
127
|
// },
|
|
101
128
|
// maplibreLayer: baseLayer,
|
|
102
129
|
// }),
|
|
103
|
-
|
|
104
|
-
|
|
130
|
+
|
|
131
|
+
// https://www.mobidata-bw.de/dataset/escootch
|
|
132
|
+
createMobiDataBwWfsLayer(
|
|
133
|
+
API_REQUEST_FEATURE_TYPE.stations.scooter,
|
|
134
|
+
"green",
|
|
135
|
+
),
|
|
136
|
+
createFreeFloatMobilityLayer(
|
|
137
|
+
API_REQUEST_FEATURE_TYPE.freeFloat.scooter,
|
|
138
|
+
"green",
|
|
139
|
+
"scooter",
|
|
140
|
+
),
|
|
105
141
|
],
|
|
142
|
+
name: RVF_LAYERS_NAMES.eroller,
|
|
106
143
|
title: (
|
|
107
144
|
<div className="flex items-center justify-between gap-2">
|
|
108
145
|
E-Roller
|
|
@@ -117,6 +154,7 @@ function RvfSharedMobilityLayerGroup(props: GroupOptions) {
|
|
|
117
154
|
return metadata?.["rvf.filter"] === "hitchhiking";
|
|
118
155
|
},
|
|
119
156
|
maplibreLayer: baseLayer,
|
|
157
|
+
name: RVF_LAYERS_NAMES.mitfahrpunkte,
|
|
120
158
|
title: (
|
|
121
159
|
<div className="flex items-center justify-between gap-2">
|
|
122
160
|
Mitfahrpunkte
|
|
@@ -134,14 +172,14 @@ function RvfSharedMobilityLayerGroup(props: GroupOptions) {
|
|
|
134
172
|
sharingHitchHiking,
|
|
135
173
|
],
|
|
136
174
|
...props,
|
|
137
|
-
});
|
|
175
|
+
} as GroupOptions);
|
|
138
176
|
}, [baseLayer, props]);
|
|
139
177
|
|
|
140
178
|
// Reload features every minute
|
|
141
179
|
useEffect(() => {
|
|
142
180
|
const interval = window.setInterval(() => {
|
|
143
181
|
group.getLayers().forEach((layer: Group) => {
|
|
144
|
-
layer.getLayers().forEach((layer: MaplibreStyleLayer | Vector) => {
|
|
182
|
+
layer.getLayers?.().forEach((layer: MaplibreStyleLayer | Vector) => {
|
|
145
183
|
const source = layer.getSource();
|
|
146
184
|
source?.refresh();
|
|
147
185
|
|
|
@@ -167,15 +205,9 @@ function RvfSharedMobilityLayerGroup(props: GroupOptions) {
|
|
|
167
205
|
if (!map || !group) {
|
|
168
206
|
return;
|
|
169
207
|
}
|
|
170
|
-
|
|
171
|
-
const key = map.on("moveend", () => {
|
|
172
|
-
console.log("ZOOM", map.getView().getZoom());
|
|
173
|
-
});
|
|
174
|
-
|
|
175
208
|
map.addLayer(group);
|
|
176
209
|
|
|
177
210
|
return () => {
|
|
178
|
-
unByKey(key);
|
|
179
211
|
map.removeLayer(group);
|
|
180
212
|
};
|
|
181
213
|
}, [map, group]);
|
|
@@ -110,16 +110,8 @@ function SingleClickListener() {
|
|
|
110
110
|
setSelectedFeature(null);
|
|
111
111
|
setSelectedFeatures([]);
|
|
112
112
|
} else {
|
|
113
|
-
|
|
114
|
-
features
|
|
115
|
-
if (feature.get("features")) {
|
|
116
|
-
feats.push(...feature.get("features"));
|
|
117
|
-
} else {
|
|
118
|
-
feats.push(feature);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
setSelectedFeatures(feats);
|
|
122
|
-
setSelectedFeature(feats[0]);
|
|
113
|
+
setSelectedFeatures(features);
|
|
114
|
+
setSelectedFeature(features[0]);
|
|
123
115
|
}
|
|
124
116
|
},
|
|
125
117
|
[
|
|
@@ -3,6 +3,7 @@ import { MaplibreStyleLayerOptions } from "mobility-toolbox-js/ol/layers/Maplibr
|
|
|
3
3
|
import { memo } from "preact/compat";
|
|
4
4
|
import { useEffect, useMemo } from "preact/hooks";
|
|
5
5
|
|
|
6
|
+
import { RVF_LAYERS_NAMES } from "../utils/constants";
|
|
6
7
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
7
8
|
import useRvfContext from "../utils/hooks/useRvfContext";
|
|
8
9
|
|
|
@@ -20,6 +21,7 @@ function RvfTarifZonenLayer(props: MaplibreStyleLayerOptions) {
|
|
|
20
21
|
return metadata?.["rvf.filter"] === "zones";
|
|
21
22
|
},
|
|
22
23
|
maplibreLayer: baseLayer,
|
|
24
|
+
name: RVF_LAYERS_NAMES.tarifzonen,
|
|
23
25
|
...(props || {}),
|
|
24
26
|
});
|
|
25
27
|
}, [baseLayer, props]);
|
|
@@ -2,27 +2,42 @@ import { getUid } from "ol";
|
|
|
2
2
|
import { Group } from "ol/layer";
|
|
3
3
|
import BaseLayer from "ol/layer/Base";
|
|
4
4
|
import { JSX, PreactDOMAttributes } from "preact";
|
|
5
|
-
import { memo } from "preact/compat";
|
|
5
|
+
import { memo, useEffect, useMemo, useState } from "preact/compat";
|
|
6
6
|
|
|
7
7
|
import RvfLayerTree from "../RvfLayerTree";
|
|
8
8
|
import { SelectionType } from "../RvfLayerTree/TreeItem/TreeItem";
|
|
9
|
+
import getLayersAsFlatArray from "../utils/getLayersAsFlatArray";
|
|
9
10
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
10
11
|
|
|
12
|
+
export interface RvfLayerTreeConfig {
|
|
13
|
+
childItems: RvfLayerTreeConfig[];
|
|
14
|
+
id: string;
|
|
15
|
+
isControlChecked: boolean;
|
|
16
|
+
layer: BaseLayer;
|
|
17
|
+
revision: number;
|
|
18
|
+
selectionType: SelectionType;
|
|
19
|
+
title: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
export type RvfTopicsProps = {} & JSX.HTMLAttributes<HTMLDivElement> &
|
|
12
23
|
PreactDOMAttributes;
|
|
13
24
|
|
|
14
|
-
const getConfigForLayer = (
|
|
25
|
+
const getConfigForLayer = (
|
|
26
|
+
layer: BaseLayer,
|
|
27
|
+
revision: number,
|
|
28
|
+
): RvfLayerTreeConfig => {
|
|
15
29
|
return {
|
|
16
30
|
childItems:
|
|
17
31
|
(layer as Group)
|
|
18
32
|
?.getLayers?.()
|
|
19
33
|
.getArray()
|
|
20
34
|
.map((subLayer) => {
|
|
21
|
-
return getConfigForLayer(subLayer);
|
|
35
|
+
return getConfigForLayer(subLayer, revision);
|
|
22
36
|
}) || [],
|
|
23
37
|
id: getUid(layer),
|
|
24
38
|
isControlChecked: layer.getVisible(),
|
|
25
39
|
layer,
|
|
40
|
+
revision,
|
|
26
41
|
selectionType: SelectionType.CHECKBOX,
|
|
27
42
|
title: layer.get("title"),
|
|
28
43
|
};
|
|
@@ -30,13 +45,30 @@ const getConfigForLayer = (layer: BaseLayer) => {
|
|
|
30
45
|
|
|
31
46
|
function RvfTopics(props: RvfTopicsProps) {
|
|
32
47
|
const { map } = useMapContext();
|
|
48
|
+
const [revision, setRevision] = useState(0);
|
|
49
|
+
|
|
50
|
+
const layers: RvfLayerTreeConfig[] = useMemo(() => {
|
|
51
|
+
const config =
|
|
52
|
+
map
|
|
53
|
+
?.getLayers()
|
|
54
|
+
.getArray()
|
|
55
|
+
.map((layer) => {
|
|
56
|
+
return getConfigForLayer(layer, revision);
|
|
57
|
+
}) || [];
|
|
58
|
+
return config;
|
|
59
|
+
}, [map, revision]);
|
|
33
60
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.getArray()
|
|
37
|
-
.
|
|
38
|
-
|
|
61
|
+
// Force update of config when a layers`s visibility changes progammatically
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const layers = getLayersAsFlatArray(map.getLayers().getArray());
|
|
64
|
+
layers.forEach((layer) => {
|
|
65
|
+
layer.on("change:visible", () => {
|
|
66
|
+
setRevision((prev) => {
|
|
67
|
+
return prev + 1;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
39
70
|
});
|
|
71
|
+
}, [map]);
|
|
40
72
|
|
|
41
73
|
return <RvfLayerTree layers={layers} {...props} />;
|
|
42
74
|
}
|
|
@@ -3,6 +3,7 @@ import { MaplibreStyleLayerOptions } from "mobility-toolbox-js/ol/layers/Maplibr
|
|
|
3
3
|
import { memo } from "preact/compat";
|
|
4
4
|
import { useEffect, useMemo } from "preact/hooks";
|
|
5
5
|
|
|
6
|
+
import { RVF_LAYERS_NAMES } from "../utils/constants";
|
|
6
7
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
7
8
|
|
|
8
9
|
function StationsLayer(props: MaplibreStyleLayerOptions) {
|
|
@@ -17,6 +18,7 @@ function StationsLayer(props: MaplibreStyleLayerOptions) {
|
|
|
17
18
|
return metadata?.["tralis.variable"] === "station";
|
|
18
19
|
},
|
|
19
20
|
maplibreLayer: baseLayer,
|
|
21
|
+
name: RVF_LAYERS_NAMES.haltestellen,
|
|
20
22
|
...(props || {}),
|
|
21
23
|
});
|
|
22
24
|
}, [baseLayer, props]);
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<path d="M12.82383728,1c6.53012848,0,11.82383728,5.29371262,11.82383728,11.82384109,0,6.53011703-5.2937088,11.82384109-11.82383728,11.82384109-6.53012085,0-11.82383728-5.29372406-11.82383728-11.82384109C1,6.29371262,6.29371643,1,12.82383728,1M12.82383728,0C5.75274658,0,0,5.7527504,0,12.82384109c0,7.07108688,5.75274658,12.82384109,12.82383728,12.82384109s12.82383728-5.75275421,12.82383728-12.82384109C25.64767456,5.7527504,19.89492798,0,12.82383728,0h0Z" style="fill: #f7f4f4;"/>
|
|
8
8
|
</g>
|
|
9
9
|
<g id="verkehrstraeger_verkehrstraeger-rad-2px" data-name="verkehrstraeger/verkehrstraeger-rad-2px">
|
|
10
|
-
<path id="Fill-1" d="
|
|
11
|
-
<path d="
|
|
10
|
+
<path id="Fill-1" d="M9.25954019,11.68411861h1.42560034c.39346563,0,.7128-.31933437.7128-.7128s-.31933437-.71280017-.7128-.71280017h-1.42560034c-.01354324,0-.02494789.00712816-.03777838.00784091-.37493282.02067123-.67502162.32503686-.67502162.70495926,0,.39346563.31933437.7128.7128.7128" style="fill: #fff; fill-rule: evenodd;"/>
|
|
11
|
+
<path d="M17.81325035,18.40129001c-.48076172,0-.95668945-.11733398-1.41547852-.34936523-.37792969-.19160156-.70883789-.45395508-.98349609-.77958984-.49350586-.5840332-.75454102-1.28408203-.75454102-2.02456055,0-.88989258.36870117-1.71518555,1.03886719-2.32426758l-.5550293-1.04501953-3.77006836,2.11464844-.50756836.29267578c.07514648.39506836.12172852.68071289.12172852.96196289,0,1.73891602-1.41459961,3.15351563-3.15351563,3.15351563-.11953125,0-.23422852-.01625977-.34848633-.03251953-1.62817383-.2175293-2.8050293-1.55522461-2.8050293-3.12099609,0-.41660156.08129883-.82397461.24169922-1.20981445.49174805-1.18081055,1.63476562-1.94370117,2.91181641-1.94370117.48032227,0,.95712891.11777344,1.41591797.35068359.34672852.1762207.65039062.40605469.90263672.6824707l.56162109-.27597656,3.69667969-2.13398438-.82353516-1.53413086c-.04042969-.07119141-.05844727-.15029297-.06987305-.21137695l-.01582031-.09667969c-.03999023-.32739258.16567383-.63632812.478125-.71938477l1.37197266-.36782227c.06064453-.01669922.11821289-.02460938.1753418-.02460938.29707031,0,.55898437.20083008.63588867.48867188.05976563.22280273-.0074707.45834961-.17973633.62973633-.09404297.09404297-.18500977.15029297-.28608398.17709961l-.50317383.13491211.65302734,1.26650391,1.0125,1.75341797c.39287109-.07382813.67631836-.11953125.95361328-.11953125,1.74331055.00703125,3.15351563,1.42075195,3.15351563,3.15351563,0,.03251953-.00439453.0637207-.00922852.09448242-.10283203,1.75166016-1.47963867,3.0590332-3.14428711,3.0590332ZM16.36173667,14.13551853c-.25136719.32651367-.38452148.71103516-.38452148,1.11225586,0,.51943359.22719727,1.01865234.62314453,1.36977539.33969727.30058594.77036133.46625977,1.21289062.46625977.20566406,0,.41835938-.03955078.63149414-.11821289l.5203125-.29970703c.43769531-.35771484.68422852-.87319336.68422852-1.41811523,0-.59545898-.29355469-1.15708008-.78530273-1.50292969-.31245117-.21796875-.67587891-.33310547-1.05073242-.33310547-.03691406,0-.07250977.00483398-.10854492.00966797l-.07954102.01098633-.01801758.07646484.7668457,1.32890625c.12612305.21796875.11381836.48603516-.03164063.69916992-.06108398.08964844-.12963867.15512695-.20917969.20039063-.08085938.04746094-.17226563.07382813-.27905273.08085937h-.00703125c-.28740234,0-.49790039-.12041016-.61435547-.32167969l-.82177734-1.42470703-.04921875.0637207ZM7.83414878,13.41173923c-1.0125,0-1.83603516.82353516-1.83603516,1.83603516s.82353516,1.83603516,1.83603516,1.83603516,1.83603516-.82353516,1.83603516-1.83603516c0-.03911133-.00527344-.07734375-.01054687-.11557617l-.01054687-.07954102-.0769043-.01977539-1.50380859.86879883c-.10063477.05756836-.21445312.08833008-.32915039.08833008-.23510742,0-.45351563-.12612305-.57128906-.32958984-.18149414-.31420898-.07338867-.71850586.24169922-.90087891l1.52358398-.8793457c-.31948242-.3375-.70136719-.46845703-1.09907227-.46845703Z" style="fill: #fff; fill-rule: evenodd;"/>
|
|
12
12
|
</g>
|
|
13
13
|
</g>
|
|
14
14
|
</g>
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
<path d="M12.82384109,1c6.53012085,0,11.82383728,5.29371643,11.82383728,11.82383728,0,6.53013611-5.29371643,11.82385254-11.82383728,11.82385254-6.53012848,0-11.82384109-5.29371643-11.82384109-11.82385254C1,6.29371643,6.29371262,1,12.82384109,1M12.82384109,0C5.7527504,0,0,5.75274658,0,12.82383728s5.7527504,12.82385254,12.82384109,12.82385254,12.82383728-5.75276184,12.82383728-12.82385254S19.89493179,0,12.82384109,0h0Z" style="fill: #f7f4f4;"/>
|
|
8
8
|
</g>
|
|
9
9
|
<g id="verkehrstraeger_verkehrstraeger-auto-2px" data-name="verkehrstraeger/verkehrstraeger-auto-2px">
|
|
10
|
-
<path id="Fill-1" d="
|
|
11
|
-
<path id="Fill-7" d="M8.
|
|
12
|
-
<path id="Fill-11" d="M18.
|
|
10
|
+
<path id="Fill-1" d="M16.71183851,14.25236615c.35769603,0,.648.29030397.648.648s-.29030397.648-.648.648-.648-.29030397-.648-.648.29030397-.648.648-.648" style="fill: #fff; fill-rule: evenodd;"/>
|
|
11
|
+
<path id="Fill-7" d="M8.93583851,14.25236615c-.35769603,0-.648.29030397-.648.648s.29030397.648.648.648.648-.29030397.648-.648-.29030397-.648-.648-.648" style="fill: #fff; fill-rule: evenodd;"/>
|
|
12
|
+
<path id="Fill-11" d="M18.00783851,13.60436615v3.24c0,.35769603-.29030397.648-.648.648h-1.26943176v-.65059181c0-.35316005-.28382444-.6382804-.63504032-.64540819h-.03952792v-.00259181h-5.15289609c-.35769603,0-.648.29030397-.648.648v.65059181h-1.32710391c-.35769603,0-.648-.29030397-.648-.648v-3.24l.28187996-.648.27021604-.6194879.743904.37195192.221616.110808.1095121.04859988c.14968797.0583201.30909584.0881281.46979994.0881281h6.17414392l.12052792-.00583189c.15940757-.01490416.31492866-.05896805.45878474-.13089609l.22161539-.110808.75751241-.37843207.26438338.62596805.27410422.648ZM8.93583851,10.62745424l.50932785-1.16964004c.10303226-.23652001.33631203-.38944805.59421619-.38944805h5.62140012c.26049566,0,.49507196.15552001.59680769.39592804l.45424814,1.074384.25142432.5955121-.25142432.12571185-.80092804.40046402h-6.17414392l-.80092804-.40046402-.22615199-.11275186.22615199-.51969603ZM19.30383851,11.01236615h-.9849603l-.27345534-.648-.59421588-1.40486399c-.30391191-.719928-1.00958437-1.18713601-1.79042432-1.18713601h-5.62140012c-.77371216,0-1.47355211.458784-1.782,1.16769603l-.62013601,1.42430397-.28252807.648h-1.01087996c-.35769599,0-.648.29030397-.648.648s.29030401.648.648.648h.44647201l-.28188004.648-.05702396.13089578c-.07063198.16264826-.10756801.33890446-.10756801.51710422v3.24c0,1.07373573.87026396,1.944,1.944,1.944h1.32710391l.09655211-.00323946c.6706799-.04989702,1.1994482-.60976799,1.19879994-1.29600062h3.88346402c.00064826.71927978.58060794,1.29924007,1.29664826,1.29924007h1.26943176c1.07373573,0,1.944-.87026427,1.944-1.944v-3.24c0-.17366377-.03499255-.34473573-.10238461-.50479218l-.06026303-.14320782-.27410422-.648h.43675186c.35769603,0,.648-.29030397.648-.648s-.29030397-.648-.648-.648h0Z" style="fill: #fff; fill-rule: evenodd;"/>
|
|
13
13
|
</g>
|
|
14
14
|
</g>
|
|
15
15
|
</g>
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
<path d="M14.00622177,1c7.18314362,0,13.00623322,5.82308197,13.00623322,13.00622177,0,7.18314362-5.8230896,13.00623322-13.00623322,13.00623322-7.1831398,0-13.00622177-5.8230896-13.00622177-13.00623322C1,6.82308197,6.82308197,1,14.00622177,1M14.00622177,0C6.28316116,0,0,6.28316116,0,14.00622177s6.28316116,14.00623322,14.00622177,14.00623322,14.00623322-6.28317261,14.00623322-14.00623322S21.72928238,0,14.00622177,0h0Z" style="fill: #f7f4f4;"/>
|
|
8
8
|
</g>
|
|
9
9
|
<g id="Group-9">
|
|
10
|
-
<path id="Fill-1" d="M6.
|
|
11
|
-
<path d="
|
|
12
|
-
<path d="
|
|
10
|
+
<path id="Fill-1" d="M6.784509,13.90291161h1.4256c.35354867,0,.6343919-.26231042.68999035-.60017761.00641507-.03777838.02280965-.07270543.02280965-.11262239,0-.22880887-.11476098-.42269035-.28226873-.55313265-.11333548-.08838725-.24876718-.14754961-.40273204-.15396486-.00926641-.00071275-.01782007-.00570233-.02779922-.00570233h-1.4256c-.39346572,0-.71280008.3193342-.71280008.71279983,0,.04561929.01781998.08482317.02566081.12830422.06272636.33002627.33929277.58449578.68713928.58449578" style="fill: #fff; fill-rule: evenodd;"/>
|
|
11
|
+
<path d="M18.90206812,20.62062811c-.64204102,0-1.24848633-.24873047-1.70771484-.70048828-.26015625-.25532227-.4574707-.57041016-.58623047-.93603516-.09887695-.28168945-.14677734-.54492188-.14677734-.80419922,0-.24741211.04526367-.50141602.13798828-.77695313.29707031-.87890625,1.05161133-1.50380859,1.96962891-1.63037109.14238281-.02021484.23554687-.03339844.33310547-.03339844.53833008,0,1.0546875.18061523,1.49282227.52294922.60249023.46889648.94790039,1.16806641.94790039,1.91777344,0,.20170898-.03164062.41044922-.10019531.65610352-.29487305,1.05073242-1.25727539,1.78461914-2.34052734,1.78461914ZM18.90206812,17.05666327c-.61918945,0-1.12324219.50405273-1.12324219,1.12324219s.50405273,1.12324219,1.12324219,1.12324219,1.12324219-.50405273,1.12324219-1.12324219-.50405273-1.12324219-1.12324219-1.12324219Z" style="fill: #fff; fill-rule: evenodd;"/>
|
|
12
|
+
<path d="M8.31652125,20.68303045c-.21401367,0-.43681641-.02416992-.66225586-.07250977-1.44360352-.30893555-2.49125977-1.60488281-2.49125977-3.08144531,0-.89033203.37001953-1.71694336,1.04238281-2.3277832.24609375-.22368164.51767578-.40429688.80771484-.53657227.36694336-.16743164.76420898-.26015625,1.18081055-.27597656l.12260742-.01318359c.44208984,0,.8784668.09624023,1.29682617.28564453.62270508.28168945,1.1465332.77739258,1.47612305,1.39614258l.56645508-.10810547-.68686523-2.77338867-.45-1.67827148-.18457031-.00615234-.58007812.15556641c-.05581055.01494141-.11337891.02285156-.17094727.02285156-.29750977,0-.55898438-.20083008-.63588867-.48867188-.09404297-.35068359.11469727-.71279297.46582031-.80683594l1.37680664-.36914062c.05537109-.01494141.1125-.02241211.17006836-.02241211.03164063,0,.06240234.00219727.09316406.0065918.21269531.02680664.39946289.16611328.4996582.3730957l.05493164.10854492.15864258.59458008,1.04414063.03999023h7.87324219l.10854492.02329102c.31904297.05493164.55019531.32211914.55019531.63544922l-.02241211.11557617c.00483398.06416016.00703125.13974609-.01274414.21577148l-.65522461,2.44379883c-.04174805.15512695-.14326172.29047852-.28564453.38144531-.12832031.07426758-.18061523.1059082-.24169922.12260742l-6.75087891,1.80922852.26323242,1.19223633c.09404297.35068359-.11469727.71235352-.46582031.80639648-.05625.01538086-.11381836.02285156-.17138672.02285156-.29707031,0-.55854492-.20083008-.63544922-.48867188l-.30146484-1.12543945-.56557617.09492188-.04614258.01230469.01274414.10283203c.00571289,1.22124023-.64204102,2.2855957-1.68442383,2.83666992-.47285156.24960937-.96503906.37617188-1.46337891.37617188ZM8.31652125,15.69304022c-.77080078,0-1.46293945.49130859-1.7230957,1.22299805-.07470703.20830078-.11293945.4144043-.11293945.61303711,0,.53085937.23686523,1.03754883.64951172,1.39042969.34145508.29179687.75146484.44604492,1.18652344.44604492.41088867,0,.80419922-.13974609,1.13686523-.40473633.36474609-.29003906.60336914-.70180664.67236328-1.1597168l.01186523-.08129883-1.43964844.38583984c-.05581055.01494141-.11337891.02285156-.17094727.02285156-.29750977,0-.55898438-.20126953-.63588867-.48911133-.04570312-.16962891-.02241211-.34716797.06591797-.4996582.08789062-.15249023.22983398-.26147461.39990234-.30673828l1.43701172-.38496094-.05229492-.06459961c-.29179687-.36035156-.70224609-.59589844-1.15620117-.66357422-.10107422-.01494141-.18325195-.02680664-.26894531-.02680664ZM12.96637476,15.54186834l2.89467773-.71938477,3.58110352-.95976562.2043457-.65874023.19116211-.71279297-1.70947266-.06811523h-5.9972168l.83540039,3.11879883Z" style="fill: #fff; fill-rule: evenodd;"/>
|
|
13
13
|
</g>
|
|
14
14
|
</g>
|
|
15
15
|
</g>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<path d="M12.82384109,1c6.53012085,0,11.82383728,5.29371643,11.82383728,11.82384491,0,6.53012085-5.29371643,11.82382965-11.82383728,11.82382965-6.53012848,0-11.82384109-5.2937088-11.82384109-11.82382965C1,6.29371643,6.29371262,1,12.82384109,1M12.82384109,0C5.7527504,0,0,5.75275421,0,12.82384491c0,7.07108307,5.7527504,12.82382965,12.82384109,12.82382965s12.82383728-5.75274658,12.82383728-12.82382965C25.64767838,5.75275421,19.89493179,0,12.82384109,0h0Z" style="fill: #f7f4f4;"/>
|
|
8
8
|
</g>
|
|
9
9
|
<g id="Group-5">
|
|
10
|
-
<path d="
|
|
11
|
-
<path d="M18.
|
|
10
|
+
<path d="M18.64085918,18.24216413l-.93076172-3.47475586c-.09360352-.34848633-.45087891-.55722656-.80288086-.46274414-.34892578.09360352-.55634766.45395508-.46274414.80244141l.93076172,3.47387695c.04482422.16918945.15336914.31025391.30498047.39770508.10107422.05844727.21313477.08833008.32651367.08833008.05712891,0,.11425781-.0074707.17050781-.02285156.16918945-.04482422.31025391-.15336914.39814453-.30498047.08745117-.15161133.11074219-.32827148.06547852-.49702148Z" style="fill: #fff; fill-rule: evenodd;"/>
|
|
11
|
+
<path d="M18.1513084,8.25778913c-.07602539-.28608398-.33618164-.48603516-.63237305-.48603516-.05712891,0-.11425781.0074707-.22719727.03779297l-4.44902344,1.19179687c-.34892578.09360352-.55722656.45351563-.46362305.80244141.07558594.28300781.33530273.48076172.63105469.48076172.04526367,0,.0909668-.00439453.17138672-.01757812l1.80791016-.47241211.4855957,1.81186523.1340332.41748047-1.98413086,3.43608398-.2746582.54711914h-2.43676758c-.04350586-.17446289-.11030273-.35244141-.2034668-.54316406-.08393555-.16918945-.18764648-.33178711-.30805664-.48383789-.51943359-.65390625-1.2862793-1.02919922-2.10454102-1.02919922-1.48666992,0-2.69648438,1.20981445-2.69648438,2.69648437s1.20981445,2.69648438,2.69648438,2.69648438c1.01206055,0,1.93051758-.56777344,2.39589844-1.48227539.10458984-.20698242.17797852-.40341797.15380859-.54404297h2.69604492c.25927734,0,.59238281-.12172852.72685547-.35375977l1.81186523-3.13857422.77651367-1.37592773c.08745117-.15117187.11118164-.32783203.06591797-.49746094l-.67192383-2.50751953,1.43569336-.38452148c.16918945-.04482422.31025391-.15336914.39770508-.30498047.08789062-.15161133.11118164-.32827148.06547852-.49702148ZM6.91141582,16.64738874c0-.3234375.11381836-.63017578.32915039-.88637695.06416016-.0769043.13710938-.1472168.21533203-.20786133.24785156-.19116211.53920898-.29179687.84155273-.29179687.3019043,0,.59326172.10063477.84155273.29179687.16391602.1265625.29663086.28212891.38759766.45395508h-1.17509766c-.36123047,0-.65522461.29399414-.65522461.65522461s.29399414.65522461.65522461.65522461h1.15576172c-.0984375.17753906-.23642578.33266602-.40297852.45307617-.24038086.17182617-.51943359.26279297-.80683594.26279297-.2878418,0-.56689453-.0909668-.80639648-.26279297-.08789062-.0637207-.17006836-.14106445-.25048828-.23642578-.21533203-.25664062-.32915039-.56337891-.32915039-.88681641Z" style="fill: #fff; fill-rule: evenodd;"/>
|
|
12
12
|
</g>
|
|
13
13
|
</g>
|
|
14
14
|
</g>
|
package/src/index.tsx
CHANGED
|
@@ -13,15 +13,19 @@ register(
|
|
|
13
13
|
"extent",
|
|
14
14
|
"maxextent",
|
|
15
15
|
"geolocation",
|
|
16
|
+
"layers",
|
|
17
|
+
"layertree",
|
|
16
18
|
"mapsurl",
|
|
17
19
|
"mots",
|
|
18
20
|
"notification",
|
|
19
21
|
"notificationat",
|
|
20
22
|
"notificationurl",
|
|
21
23
|
"notificationbeforelayerid",
|
|
24
|
+
"print",
|
|
22
25
|
"realtime",
|
|
23
26
|
"realtimeUrl",
|
|
24
27
|
"search",
|
|
28
|
+
"share",
|
|
25
29
|
"tenant",
|
|
26
30
|
"zoom",
|
|
27
31
|
"permalink",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Group } from "ol/layer";
|
|
2
|
+
import BaseLayer from "ol/layer/Base";
|
|
3
|
+
|
|
4
|
+
const applyInitialLayerVisibility = (
|
|
5
|
+
layersAttrValue: string,
|
|
6
|
+
layer: BaseLayer,
|
|
7
|
+
) => {
|
|
8
|
+
const isPermalinkable = !!layer.get("name");
|
|
9
|
+
const hasLayersAttribute =
|
|
10
|
+
isPermalinkable &&
|
|
11
|
+
!!(layersAttrValue !== null && layersAttrValue !== undefined);
|
|
12
|
+
|
|
13
|
+
if (hasLayersAttribute) {
|
|
14
|
+
const names = (layersAttrValue && layersAttrValue.split(",")) || [];
|
|
15
|
+
const name = layer.get("name");
|
|
16
|
+
const shouldBeVisible = names.includes(name);
|
|
17
|
+
if (layer.getVisible() !== shouldBeVisible) {
|
|
18
|
+
layer.setVisible(shouldBeVisible);
|
|
19
|
+
|
|
20
|
+
if ((layer as Group).getLayers) {
|
|
21
|
+
(layer as Group)
|
|
22
|
+
.getLayers()
|
|
23
|
+
.getArray()
|
|
24
|
+
.forEach((subLayer) => {
|
|
25
|
+
subLayer.setVisible(shouldBeVisible);
|
|
26
|
+
// applyInitialLayerVisibility(layersAttrValue, subLayer);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if ((layer as Group).getLayers) {
|
|
32
|
+
(layer as Group)
|
|
33
|
+
.getLayers()
|
|
34
|
+
.getArray()
|
|
35
|
+
.forEach((subLayer) => {
|
|
36
|
+
// subLayer.setVisible(false);
|
|
37
|
+
applyInitialLayerVisibility(layersAttrValue, subLayer);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export default applyInitialLayerVisibility;
|