@geops/rvf-mobility-web-component 0.1.9 → 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/.github/CODEOWNERS +37 -0
- package/.github/workflows/conventional-pr-title.yml +36 -0
- package/CHANGELOG.md +55 -0
- package/README.md +3 -1
- package/doc/package.json +5 -5
- package/doc/src/app/components/GeopsMobilityDoc.tsx +19 -0
- package/docutils.js +198 -0
- package/index.html +48 -217
- package/index.js +683 -91
- package/input.css +15 -1
- package/jest-setup.js +3 -2
- package/package.json +9 -8
- package/scripts/dev.mjs +1 -1
- package/search.html +38 -69
- package/src/GeolocationButton/GeolocationButton.tsx +6 -17
- 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 +57 -12
- package/src/MobilityMap/MobilityMap.tsx +22 -9
- package/src/MobilityMap/index.css +0 -13
- package/src/RealtimeLayer/RealtimeLayer.tsx +1 -1
- package/src/RvfButton/RvfButton.tsx +45 -0
- package/src/RvfButton/index.tsx +1 -0
- 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 +132 -52
- 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 +73 -0
- package/src/RvfZoomButtons/index.tsx +1 -0
- 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/Geolocation/Geolocation.tsx +21 -0
- package/src/icons/Geolocation/index.tsx +1 -0
- 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/icons/Minus/Minus.tsx +19 -0
- package/src/icons/Minus/index.tsx +1 -0
- package/src/icons/Minus/minus.svg +7 -0
- package/src/icons/Plus/Plus.tsx +19 -0
- package/src/icons/Plus/index.tsx +1 -0
- package/src/icons/Plus/plus.svg +7 -0
- package/src/index.tsx +2 -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 +60 -8
|
@@ -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;
|