@geops/rvf-mobility-web-component 0.1.10 → 0.1.11
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 +33 -0
- package/docutils.js +198 -0
- package/index.html +48 -217
- package/index.js +627 -87
- package/input.css +11 -1
- package/jest-setup.js +3 -2
- package/package.json +4 -3
- package/scripts/dev.mjs +1 -1
- package/search.html +38 -69
- package/src/GeolocationButton/GeolocationButton.tsx +6 -5
- package/src/LayerTree/LayerTree.tsx +44 -0
- package/src/LayerTree/TreeItem/TreeItem.tsx +145 -0
- package/src/LayerTree/TreeItem/index.tsx +1 -0
- package/src/LayerTree/TreeItemContainer/TreeItemContainer.tsx +16 -0
- package/src/LayerTree/TreeItemContainer/index.tsx +1 -0
- package/src/LayerTree/index.tsx +1 -0
- package/src/LayerTree/layersTreeContext.ts +4 -0
- package/src/LayerTree/layersTreeReducer.ts +156 -0
- package/src/Map/Map.tsx +1 -0
- package/src/MobilityMap/MobilityMap.tsx +10 -9
- package/src/MobilityMap/index.css +0 -13
- package/src/RealtimeLayer/RealtimeLayer.tsx +1 -1
- package/src/RvfButton/RvfButton.tsx +28 -21
- package/src/RvfExportMenu/RvfExportMenu.tsx +95 -0
- package/src/RvfExportMenu/index.tsx +1 -0
- package/src/RvfExportMenuButton/RvfExportMenuButton.tsx +27 -0
- package/src/RvfExportMenuButton/index.tsx +1 -0
- package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +29 -0
- package/src/RvfFeatureDetails/index.tsx +1 -0
- package/src/RvfIconButton/RvfIconButton.tsx +35 -0
- package/src/RvfIconButton/index.tsx +1 -0
- package/src/RvfMobilityMap/RvfMobilityMap.tsx +117 -83
- package/src/RvfMobilityMap/index.css +0 -13
- package/src/RvfModal/RvfModal.tsx +52 -0
- package/src/RvfModal/index.tsx +1 -0
- package/src/RvfPoisLayer/RvfPoisLayer.tsx +39 -0
- package/src/RvfPoisLayer/index.tsx +1 -0
- package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +88 -0
- package/src/RvfSharedMobilityLayerGroup/index.tsx +1 -0
- package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +137 -0
- package/src/RvfSingleClickListener/index.tsx +1 -0
- package/src/RvfZoomButtons/RvfZoomButtons.tsx +36 -29
- package/src/Search/Search.tsx +11 -9
- package/src/SingleClickListener/index.tsx +1 -1
- package/src/StationsLayer/StationsLayer.tsx +0 -1
- package/src/StopsSearch/StopsSearch.tsx +38 -6
- package/src/TopicMenu/TopicMenu.tsx +143 -0
- package/src/TopicMenu/index.tsx +1 -0
- package/src/icons/Cancel/Cancel.tsx +21 -0
- package/src/icons/Cancel/cancel.svg +7 -0
- package/src/icons/Cancel/index.tsx +1 -0
- package/src/icons/Download/Download.tsx +20 -0
- package/src/icons/Download/download.svg +15 -0
- package/src/icons/Download/index.tsx +1 -0
- package/src/icons/Elevator/Elevator.tsx +1 -1
- package/src/icons/Menu/Menu.tsx +32 -0
- package/src/icons/Menu/index.tsx +1 -0
- package/src/icons/Menu/menu.svg +9 -0
- package/src/utils/constants.ts +9 -0
- package/src/utils/createMobiDataBwWfsLayer.ts +120 -0
- package/src/utils/exportPdf.ts +677 -0
- package/src/utils/hooks/useRvfContext.tsx +37 -0
- package/src/utils/hooks/useUpdatePermalink.tsx +2 -9
- package/tailwind.config.mjs +41 -0
- package/src/RvfSharedMobilityLayer/RvfSharedMobilityLayer.tsx +0 -147
- package/src/RvfSharedMobilityLayer/index.tsx +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Map } from "ol";
|
|
2
|
+
import { Group } from "ol/layer";
|
|
3
|
+
|
|
4
|
+
import LayerTree from "../LayerTree";
|
|
5
|
+
import { SelectionType } from "../LayerTree/TreeItem/TreeItem";
|
|
6
|
+
|
|
7
|
+
function TopicMenu({ map }: { map: Map }) {
|
|
8
|
+
const layers = map
|
|
9
|
+
.getLayers()
|
|
10
|
+
.getArray()
|
|
11
|
+
.filter((layer) => {
|
|
12
|
+
return !layer.get("isNotInLayerTree");
|
|
13
|
+
})
|
|
14
|
+
.map((layer) => {
|
|
15
|
+
return {
|
|
16
|
+
childItems:
|
|
17
|
+
(layer as Group)
|
|
18
|
+
?.getLayers?.()
|
|
19
|
+
.getArray()
|
|
20
|
+
.map((subLayer) => {
|
|
21
|
+
return {
|
|
22
|
+
childItems: [],
|
|
23
|
+
id: (Math.random() + 1).toString(36).substring(7),
|
|
24
|
+
isControlChecked: subLayer.getVisible(),
|
|
25
|
+
layer: subLayer,
|
|
26
|
+
selectionType: SelectionType.CHECKBOX,
|
|
27
|
+
title: subLayer.get("title"),
|
|
28
|
+
};
|
|
29
|
+
}) || [],
|
|
30
|
+
id: (Math.random() + 1).toString(36).substring(7),
|
|
31
|
+
isControlChecked: layer.getVisible(),
|
|
32
|
+
layer,
|
|
33
|
+
selectionType: SelectionType.CHECKBOX,
|
|
34
|
+
title: layer.get("title"),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// const readyLayers = [
|
|
39
|
+
// {
|
|
40
|
+
// childItems: layers.map((layer) => {
|
|
41
|
+
// return {
|
|
42
|
+
// ...layer,
|
|
43
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
44
|
+
// };
|
|
45
|
+
// }),
|
|
46
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
47
|
+
// isCollapsedOnControlClick: true,
|
|
48
|
+
// isControlChecked: true,
|
|
49
|
+
// selectionType: SelectionType.RADIO,
|
|
50
|
+
// title: "Topic 1",
|
|
51
|
+
// },
|
|
52
|
+
// {
|
|
53
|
+
// childItems: layers.map((layer) => {
|
|
54
|
+
// return {
|
|
55
|
+
// ...layer,
|
|
56
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
57
|
+
// };
|
|
58
|
+
// }),
|
|
59
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
60
|
+
// isCollapsedOnControlClick: true,
|
|
61
|
+
// selectionType: SelectionType.RADIO,
|
|
62
|
+
// title: "Topic 2",
|
|
63
|
+
// },
|
|
64
|
+
// {
|
|
65
|
+
// childItems: layers.map((layer) => {
|
|
66
|
+
// return {
|
|
67
|
+
// ...layer,
|
|
68
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
69
|
+
// isControlChecked: false,
|
|
70
|
+
// selectionType: SelectionType.RADIO,
|
|
71
|
+
// };
|
|
72
|
+
// }),
|
|
73
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
74
|
+
// isCollapsedOnControlClick: true,
|
|
75
|
+
// selectionType: SelectionType.RADIO,
|
|
76
|
+
// title: "Topic 3",
|
|
77
|
+
// },
|
|
78
|
+
// ];
|
|
79
|
+
|
|
80
|
+
// readyLayers[0].childItems[0].childItems = layers.map((layer, idx) => {
|
|
81
|
+
// return {
|
|
82
|
+
// ...layer,
|
|
83
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
84
|
+
// isControlChecked: idx === 0,
|
|
85
|
+
// selectionType: SelectionType.RADIO,
|
|
86
|
+
// };
|
|
87
|
+
// });
|
|
88
|
+
|
|
89
|
+
// readyLayers[1].childItems[0].childItems = layers.map((layer, idx) => {
|
|
90
|
+
// return {
|
|
91
|
+
// ...layer,
|
|
92
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
93
|
+
// isControlChecked: idx === 0,
|
|
94
|
+
// selectionType: SelectionType.RADIO,
|
|
95
|
+
// };
|
|
96
|
+
// });
|
|
97
|
+
|
|
98
|
+
// readyLayers[0].childItems[1].childItems = layers.map((layer) => {
|
|
99
|
+
// return {
|
|
100
|
+
// ...layer,
|
|
101
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
102
|
+
// selectionType: SelectionType.CHECKBOX,
|
|
103
|
+
// };
|
|
104
|
+
// });
|
|
105
|
+
|
|
106
|
+
// readyLayers[0].childItems[1].childItems[0].childItems = layers.map(
|
|
107
|
+
// (layer) => {
|
|
108
|
+
// return {
|
|
109
|
+
// ...layer,
|
|
110
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
111
|
+
// selectionType: SelectionType.CHECKBOX,
|
|
112
|
+
// };
|
|
113
|
+
// },
|
|
114
|
+
// );
|
|
115
|
+
|
|
116
|
+
// readyLayers[2].childItems[0].childItems = layers.map((layer) => {
|
|
117
|
+
// return {
|
|
118
|
+
// ...layer,
|
|
119
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
120
|
+
// isControlChecked: false,
|
|
121
|
+
// selectionType: SelectionType.RADIO,
|
|
122
|
+
// };
|
|
123
|
+
// });
|
|
124
|
+
|
|
125
|
+
// readyLayers[2].childItems[1].childItems = layers.map((layer) => {
|
|
126
|
+
// return {
|
|
127
|
+
// ...layer,
|
|
128
|
+
// id: (Math.random() + 1).toString(36).substring(7),
|
|
129
|
+
// isControlChecked: false,
|
|
130
|
+
// selectionType: SelectionType.RADIO,
|
|
131
|
+
// };
|
|
132
|
+
// });
|
|
133
|
+
|
|
134
|
+
// console.log("READY LAYERS", readyLayers);
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<div className="max-h-80 overflow-scroll bg-white medium:w-largeMenu large:w-mediumMenu">
|
|
138
|
+
<LayerTree layers={layers} />
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default TopicMenu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./TopicMenu";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function Cancel({ ...props }) {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
height="24px"
|
|
5
|
+
version="1.1"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
width="24px"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
<g>
|
|
12
|
+
<path
|
|
13
|
+
d="M5.29289322,5.29289322 C5.68341751,4.90236893 6.31658249,4.90236893 6.70710678,5.29289322 L12,10.585 L17.2928932,5.29289322 C17.6533772,4.93240926 18.2206082,4.90467972 18.6128994,5.20970461 L18.7071068,5.29289322 C19.0976311,5.68341751 19.0976311,6.31658249 18.7071068,6.70710678 L13.415,12 L18.7071068,17.2928932 C19.0675907,17.6533772 19.0953203,18.2206082 18.7902954,18.6128994 L18.7071068,18.7071068 C18.3165825,19.0976311 17.6834175,19.0976311 17.2928932,18.7071068 L12,13.415 L6.70710678,18.7071068 C6.34662282,19.0675907 5.77939176,19.0953203 5.38710056,18.7902954 L5.29289322,18.7071068 C4.90236893,18.3165825 4.90236893,17.6834175 5.29289322,17.2928932 L10.585,12 L5.29289322,6.70710678 C4.93240926,6.34662282 4.90467972,5.77939176 5.20970461,5.38710056 Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
></path>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default Cancel;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>iconfont/cancel</title>
|
|
4
|
+
<g id="iconfont/cancel" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<path d="M5.29289322,5.29289322 C5.68341751,4.90236893 6.31658249,4.90236893 6.70710678,5.29289322 L12,10.585 L17.2928932,5.29289322 C17.6533772,4.93240926 18.2206082,4.90467972 18.6128994,5.20970461 L18.7071068,5.29289322 C19.0976311,5.68341751 19.0976311,6.31658249 18.7071068,6.70710678 L13.415,12 L18.7071068,17.2928932 C19.0675907,17.6533772 19.0953203,18.2206082 18.7902954,18.6128994 L18.7071068,18.7071068 C18.3165825,19.0976311 17.6834175,19.0976311 17.2928932,18.7071068 L12,13.415 L6.70710678,18.7071068 C6.34662282,19.0675907 5.77939176,19.0953203 5.38710056,18.7902954 L5.29289322,18.7071068 C4.90236893,18.3165825 4.90236893,17.6834175 5.29289322,17.2928932 L10.585,12 L5.29289322,6.70710678 C4.93240926,6.34662282 4.90467972,5.77939176 5.20970461,5.38710056 Z" id="Combined-Shape" fill="#000000" fill-rule="nonzero"></path>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Cancel";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function Download({ ...props }) {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
height="24px"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
width="24px"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
{...props}
|
|
9
|
+
>
|
|
10
|
+
<g>
|
|
11
|
+
<path
|
|
12
|
+
d="M21,16 C21.5522847,16 22,16.4477153 22,17 L22,20 C22,21.6568542 20.6568542,23 19,23 L5,23 C3.34314575,23 2,21.6568542 2,20 L2,17 C2,16.4477153 2.44771525,16 3,16 C3.55228475,16 4,16.4477153 4,17 L4,20 C4,20.5522847 4.44771525,21 5,21 L19,21 C19.5522847,21 20,20.5522847 20,20 L20,17 C20,16.4477153 20.4477153,16 21,16 Z M12,1 C12.5522847,1 13,1.44771525 13,2 L13,13.585 L15.2928932,11.2928932 C15.6533772,10.9324093 16.2206082,10.9046797 16.6128994,11.2097046 L16.7071068,11.2928932 C17.0976311,11.6834175 17.0976311,12.3165825 16.7071068,12.7071068 L12.7071068,16.7071068 C12.6786405,16.7355731 12.6484659,16.7623312 12.6167501,16.787214 C12.6098424,16.7927155 12.602603,16.7982466 12.5953066,16.8036654 C12.5711307,16.8215099 12.546275,16.8382813 12.5206602,16.8539326 C12.5086131,16.8613931 12.4963944,16.8685012 12.4840621,16.8753288 C12.4642939,16.8862061 12.4438914,16.8966234 12.4230991,16.9063462 C12.4060985,16.914321 12.3887956,16.9218036 12.371336,16.9287745 C12.3515792,16.9366843 12.3317977,16.9438775 12.3117364,16.9504533 C12.2968513,16.9552713 12.2814633,16.9599023 12.265993,16.9641549 C12.2444365,16.9701664 12.2227461,16.9753602 12.2007941,16.9798348 C12.1833753,16.9832978 12.165949,16.9863719 12.1484669,16.9889822 C12.1003621,16.9962388 12.0506203,17 12,17 L12.0852242,16.996384 C12.0679231,16.997855 12.050591,16.9988772 12.0332468,16.9994506 L12,17 C11.9888734,17 11.9777892,16.9998183 11.9667503,16.9994576 C11.9497336,16.9989053 11.9317345,16.9978436 11.9137692,16.9962979 C11.892114,16.9944666 11.8714753,16.9920328 11.8510388,16.9889807 C11.834051,16.9863719 11.8166247,16.9832978 11.7992742,16.9797599 C11.7772539,16.9753602 11.7555635,16.9701664 11.7341604,16.964279 C11.7185367,16.9599023 11.7031487,16.9552713 11.6878575,16.9502619 C11.6682023,16.9438775 11.6484208,16.9366843 11.6289415,16.928896 C11.6112044,16.9218036 11.5939015,16.914321 11.5767785,16.9063266 C11.5561086,16.8966234 11.5357061,16.8862061 11.515723,16.8751242 C11.5036056,16.8685012 11.4913869,16.8613931 11.4792912,16.8540045 C11.453725,16.8382813 11.4288693,16.8215099 11.4048407,16.8036865 C11.3656744,16.774687 11.3282873,16.7425008 11.2928932,16.7071068 L11.3832499,16.787214 C11.3515341,16.7623312 11.3213595,16.7355731 11.2928932,16.7071068 L7.29289322,12.7071068 C6.90236893,12.3165825 6.90236893,11.6834175 7.29289322,11.2928932 C7.68341751,10.9023689 8.31658249,10.9023689 8.70710678,11.2928932 L11,13.585 L11,2 C11,1.48716416 11.3860402,1.06449284 11.8833789,1.00672773 Z"
|
|
13
|
+
fill="currentColor"
|
|
14
|
+
></path>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default Download;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
height="24px"
|
|
3
|
+
version="1.1"
|
|
4
|
+
viewBox="0 0 24 24"
|
|
5
|
+
width="24px"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<g
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M21,16 C21.5522847,16 22,16.4477153 22,17 L22,20 C22,21.6568542 20.6568542,23 19,23 L5,23 C3.34314575,23 2,21.6568542 2,20 L2,17 C2,16.4477153 2.44771525,16 3,16 C3.55228475,16 4,16.4477153 4,17 L4,20 C4,20.5522847 4.44771525,21 5,21 L19,21 C19.5522847,21 20,20.5522847 20,20 L20,17 C20,16.4477153 20.4477153,16 21,16 Z M12,1 C12.5522847,1 13,1.44771525 13,2 L13,13.585 L15.2928932,11.2928932 C15.6533772,10.9324093 16.2206082,10.9046797 16.6128994,11.2097046 L16.7071068,11.2928932 C17.0976311,11.6834175 17.0976311,12.3165825 16.7071068,12.7071068 L12.7071068,16.7071068 C12.6786405,16.7355731 12.6484659,16.7623312 12.6167501,16.787214 C12.6098424,16.7927155 12.602603,16.7982466 12.5953066,16.8036654 C12.5711307,16.8215099 12.546275,16.8382813 12.5206602,16.8539326 C12.5086131,16.8613931 12.4963944,16.8685012 12.4840621,16.8753288 C12.4642939,16.8862061 12.4438914,16.8966234 12.4230991,16.9063462 C12.4060985,16.914321 12.3887956,16.9218036 12.371336,16.9287745 C12.3515792,16.9366843 12.3317977,16.9438775 12.3117364,16.9504533 C12.2968513,16.9552713 12.2814633,16.9599023 12.265993,16.9641549 C12.2444365,16.9701664 12.2227461,16.9753602 12.2007941,16.9798348 C12.1833753,16.9832978 12.165949,16.9863719 12.1484669,16.9889822 C12.1003621,16.9962388 12.0506203,17 12,17 L12.0852242,16.996384 C12.0679231,16.997855 12.050591,16.9988772 12.0332468,16.9994506 L12,17 C11.9888734,17 11.9777892,16.9998183 11.9667503,16.9994576 C11.9497336,16.9989053 11.9317345,16.9978436 11.9137692,16.9962979 C11.892114,16.9944666 11.8714753,16.9920328 11.8510388,16.9889807 C11.834051,16.9863719 11.8166247,16.9832978 11.7992742,16.9797599 C11.7772539,16.9753602 11.7555635,16.9701664 11.7341604,16.964279 C11.7185367,16.9599023 11.7031487,16.9552713 11.6878575,16.9502619 C11.6682023,16.9438775 11.6484208,16.9366843 11.6289415,16.928896 C11.6112044,16.9218036 11.5939015,16.914321 11.5767785,16.9063266 C11.5561086,16.8966234 11.5357061,16.8862061 11.515723,16.8751242 C11.5036056,16.8685012 11.4913869,16.8613931 11.4792912,16.8540045 C11.453725,16.8382813 11.4288693,16.8215099 11.4048407,16.8036865 C11.3656744,16.774687 11.3282873,16.7425008 11.2928932,16.7071068 L11.3832499,16.787214 C11.3515341,16.7623312 11.3213595,16.7355731 11.2928932,16.7071068 L7.29289322,12.7071068 C6.90236893,12.3165825 6.90236893,11.6834175 7.29289322,11.2928932 C7.68341751,10.9023689 8.31658249,10.9023689 8.70710678,11.2928932 L11,13.585 L11,2 C11,1.48716416 11.3860402,1.06449284 11.8833789,1.00672773 Z"
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
></path>
|
|
14
|
+
</g>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Download";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SVGProps } from "preact/compat";
|
|
2
|
+
|
|
3
|
+
function Menu(props: SVGProps<SVGSVGElement>) {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
fill="currentColor"
|
|
7
|
+
height="24px"
|
|
8
|
+
version="1.1"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
width="24px"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<g>
|
|
15
|
+
<path
|
|
16
|
+
d="M3,7 L21,7 C21.552,7 22,6.552 22,6 C22,5.448 21.552,5 21,5 L3,5 C2.448,5 2,5.448 2,6 C2,6.552 2.448,7 3,7"
|
|
17
|
+
fill="currentColor"
|
|
18
|
+
></path>
|
|
19
|
+
<path
|
|
20
|
+
d="M3,19 L21,19 C21.552,19 22,18.552 22,18 C22,17.448 21.552,17 21,17 L3,17 C2.448,17 2,17.448 2,18 C2,18.552 2.448,19 3,19"
|
|
21
|
+
fill="currentColor"
|
|
22
|
+
></path>
|
|
23
|
+
<path
|
|
24
|
+
d="M3,13 L21,13 C21.552,13 22,12.552 22,12 C22,11.448 21.552,11 21,11 L3,11 C2.448,11 2,11.448 2,12 C2,12.552 2.448,13 3,13"
|
|
25
|
+
fill="currentColor"
|
|
26
|
+
></path>
|
|
27
|
+
</g>
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default Menu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Menu";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>iconfont/menue</title>
|
|
4
|
+
<g id="iconfont/menue" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<path d="M3,7 L21,7 C21.552,7 22,6.552 22,6 C22,5.448 21.552,5 21,5 L3,5 C2.448,5 2,5.448 2,6 C2,6.552 2.448,7 3,7" id="Fill-1" fill="#000000"></path>
|
|
6
|
+
<path d="M3,19 L21,19 C21.552,19 22,18.552 22,18 C22,17.448 21.552,17 21,17 L3,17 C2.448,17 2,17.448 2,18 C2,18.552 2.448,19 3,19" id="Fill-3" fill="#000000"></path>
|
|
7
|
+
<path d="M3,13 L21,13 C21.552,13 22,12.552 22,12 C22,11.448 21.552,11 21,11 L3,11 C2.448,11 2,11.448 2,12 C2,12.552 2.448,13 3,13" id="Fill-5" fill="#000000"></path>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Feature, getUid } from "ol";
|
|
2
|
+
import { GeoJSON } from "ol/format";
|
|
3
|
+
import { Point } from "ol/geom";
|
|
4
|
+
import VectorLayer, { Options } from "ol/layer/Vector";
|
|
5
|
+
import { bbox as bboxStrategy } from "ol/loadingstrategy.js";
|
|
6
|
+
import { Vector } from "ol/source";
|
|
7
|
+
import { Circle, Fill, Stroke, Style, Text } from "ol/style";
|
|
8
|
+
|
|
9
|
+
function createMobiDataBwWfsLayer(
|
|
10
|
+
name: string,
|
|
11
|
+
color: string,
|
|
12
|
+
layerOptions: Options = {
|
|
13
|
+
minZoom: 17.99,
|
|
14
|
+
},
|
|
15
|
+
): VectorLayer<Vector<Feature<Point>>> {
|
|
16
|
+
const source = new Vector({
|
|
17
|
+
format: new GeoJSON(),
|
|
18
|
+
strategy: bboxStrategy,
|
|
19
|
+
url: function (extent) {
|
|
20
|
+
return (
|
|
21
|
+
"https://api.mobidata-bw.de/geoserver/MobiData-BW/" +
|
|
22
|
+
name +
|
|
23
|
+
"/ows" +
|
|
24
|
+
"?service=WFS&" +
|
|
25
|
+
"version=1.1.0&request=GetFeature&typename=" +
|
|
26
|
+
"MobiData-BW:" +
|
|
27
|
+
name +
|
|
28
|
+
"&" +
|
|
29
|
+
"outputFormat=application/json&srsname=EPSG:3857&" +
|
|
30
|
+
"bbox=" +
|
|
31
|
+
extent.join(",") +
|
|
32
|
+
",EPSG:3857"
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const style = new Style({
|
|
37
|
+
image: new Circle({
|
|
38
|
+
declutterMode: "declutter",
|
|
39
|
+
displacement: [10, 10],
|
|
40
|
+
fill: new Fill({
|
|
41
|
+
color: "white",
|
|
42
|
+
}),
|
|
43
|
+
radius: 10,
|
|
44
|
+
stroke: new Stroke({
|
|
45
|
+
color: color,
|
|
46
|
+
width: 2,
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
text: new Text({
|
|
50
|
+
declutterMode: "declutter",
|
|
51
|
+
fill: new Fill({
|
|
52
|
+
color: color,
|
|
53
|
+
}),
|
|
54
|
+
font: "bold 12px inherit",
|
|
55
|
+
offsetX: 10,
|
|
56
|
+
offsetY: -10,
|
|
57
|
+
// stroke: new Stroke({ color: "black", width: 1 }),
|
|
58
|
+
// text: ["to-string", ["get", "num_vehicles_available"]],
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const styleFunction = (feature) => {
|
|
63
|
+
const clone = style.clone();
|
|
64
|
+
clone.getText().setText(feature.get("num_vehicles_available")?.toString());
|
|
65
|
+
const isFreeFloat = !feature.get("num_vehicles_available")?.toString();
|
|
66
|
+
if (isFreeFloat) {
|
|
67
|
+
(clone.getImage() as Circle).setRadius(6);
|
|
68
|
+
}
|
|
69
|
+
clone.setZIndex(parseInt(getUid(feature), 10));
|
|
70
|
+
return [
|
|
71
|
+
clone,
|
|
72
|
+
// new Style({
|
|
73
|
+
// text: new Text({
|
|
74
|
+
// fill: new Fill({ color: color }),
|
|
75
|
+
// offsetY: 15,
|
|
76
|
+
// stroke: new Stroke({ color: "white", width: 2 }),
|
|
77
|
+
// text: feature.get("form_factor") || name,
|
|
78
|
+
// }),
|
|
79
|
+
// }),
|
|
80
|
+
];
|
|
81
|
+
};
|
|
82
|
+
const layer = new VectorLayer({
|
|
83
|
+
// @ts-expect-error - custom properties
|
|
84
|
+
isQueryable: true,
|
|
85
|
+
name,
|
|
86
|
+
// declutter: true,
|
|
87
|
+
source: source,
|
|
88
|
+
...layerOptions,
|
|
89
|
+
// style: (feature) => {
|
|
90
|
+
// console.log("feature", feature);
|
|
91
|
+
// style
|
|
92
|
+
// .getText()
|
|
93
|
+
// .setText(feature.get("num_vehicles_available").toString());
|
|
94
|
+
// return style;
|
|
95
|
+
// },
|
|
96
|
+
|
|
97
|
+
// style: {
|
|
98
|
+
// "circle-fill-color": "white",
|
|
99
|
+
// "circle-radius": 15,
|
|
100
|
+
// "circle-stroke-color": color,
|
|
101
|
+
// "circle-stroke-width": 2,
|
|
102
|
+
// // "fill-color": "rgba(100,100,100,0.25)",
|
|
103
|
+
// // "stroke-color": "white",
|
|
104
|
+
// // "stroke-width": 0.75,
|
|
105
|
+
// // "text-background-fill-color": "black",
|
|
106
|
+
// "text-fill-color": color,
|
|
107
|
+
// "text-font": "bold 12px sans-serif",
|
|
108
|
+
// "text-stroke-color": color,
|
|
109
|
+
// "text-value": ["to-string", ["get", "num_vehicles_available"]],
|
|
110
|
+
// },
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
source.on("addfeature", function (event) {
|
|
114
|
+
const feature = event.feature;
|
|
115
|
+
feature.setStyle(styleFunction);
|
|
116
|
+
});
|
|
117
|
+
return layer;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default createMobiDataBwWfsLayer;
|