@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.
Files changed (80) hide show
  1. package/.github/CODEOWNERS +37 -0
  2. package/.github/workflows/conventional-pr-title.yml +36 -0
  3. package/CHANGELOG.md +55 -0
  4. package/README.md +3 -1
  5. package/doc/package.json +5 -5
  6. package/doc/src/app/components/GeopsMobilityDoc.tsx +19 -0
  7. package/docutils.js +198 -0
  8. package/index.html +48 -217
  9. package/index.js +683 -91
  10. package/input.css +15 -1
  11. package/jest-setup.js +3 -2
  12. package/package.json +9 -8
  13. package/scripts/dev.mjs +1 -1
  14. package/search.html +38 -69
  15. package/src/GeolocationButton/GeolocationButton.tsx +6 -17
  16. package/src/LayerTree/LayerTree.tsx +44 -0
  17. package/src/LayerTree/TreeItem/TreeItem.tsx +145 -0
  18. package/src/LayerTree/TreeItem/index.tsx +1 -0
  19. package/src/LayerTree/TreeItemContainer/TreeItemContainer.tsx +16 -0
  20. package/src/LayerTree/TreeItemContainer/index.tsx +1 -0
  21. package/src/LayerTree/index.tsx +1 -0
  22. package/src/LayerTree/layersTreeContext.ts +4 -0
  23. package/src/LayerTree/layersTreeReducer.ts +156 -0
  24. package/src/Map/Map.tsx +57 -12
  25. package/src/MobilityMap/MobilityMap.tsx +22 -9
  26. package/src/MobilityMap/index.css +0 -13
  27. package/src/RealtimeLayer/RealtimeLayer.tsx +1 -1
  28. package/src/RvfButton/RvfButton.tsx +45 -0
  29. package/src/RvfButton/index.tsx +1 -0
  30. package/src/RvfExportMenu/RvfExportMenu.tsx +95 -0
  31. package/src/RvfExportMenu/index.tsx +1 -0
  32. package/src/RvfExportMenuButton/RvfExportMenuButton.tsx +27 -0
  33. package/src/RvfExportMenuButton/index.tsx +1 -0
  34. package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +29 -0
  35. package/src/RvfFeatureDetails/index.tsx +1 -0
  36. package/src/RvfIconButton/RvfIconButton.tsx +35 -0
  37. package/src/RvfIconButton/index.tsx +1 -0
  38. package/src/RvfMobilityMap/RvfMobilityMap.tsx +132 -52
  39. package/src/RvfMobilityMap/index.css +0 -13
  40. package/src/RvfModal/RvfModal.tsx +52 -0
  41. package/src/RvfModal/index.tsx +1 -0
  42. package/src/RvfPoisLayer/RvfPoisLayer.tsx +39 -0
  43. package/src/RvfPoisLayer/index.tsx +1 -0
  44. package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +88 -0
  45. package/src/RvfSharedMobilityLayerGroup/index.tsx +1 -0
  46. package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +137 -0
  47. package/src/RvfSingleClickListener/index.tsx +1 -0
  48. package/src/RvfZoomButtons/RvfZoomButtons.tsx +73 -0
  49. package/src/RvfZoomButtons/index.tsx +1 -0
  50. package/src/Search/Search.tsx +11 -9
  51. package/src/SingleClickListener/index.tsx +1 -1
  52. package/src/StationsLayer/StationsLayer.tsx +0 -1
  53. package/src/StopsSearch/StopsSearch.tsx +38 -6
  54. package/src/TopicMenu/TopicMenu.tsx +143 -0
  55. package/src/TopicMenu/index.tsx +1 -0
  56. package/src/icons/Cancel/Cancel.tsx +21 -0
  57. package/src/icons/Cancel/cancel.svg +7 -0
  58. package/src/icons/Cancel/index.tsx +1 -0
  59. package/src/icons/Download/Download.tsx +20 -0
  60. package/src/icons/Download/download.svg +15 -0
  61. package/src/icons/Download/index.tsx +1 -0
  62. package/src/icons/Elevator/Elevator.tsx +1 -1
  63. package/src/icons/Geolocation/Geolocation.tsx +21 -0
  64. package/src/icons/Geolocation/index.tsx +1 -0
  65. package/src/icons/Menu/Menu.tsx +32 -0
  66. package/src/icons/Menu/index.tsx +1 -0
  67. package/src/icons/Menu/menu.svg +9 -0
  68. package/src/icons/Minus/Minus.tsx +19 -0
  69. package/src/icons/Minus/index.tsx +1 -0
  70. package/src/icons/Minus/minus.svg +7 -0
  71. package/src/icons/Plus/Plus.tsx +19 -0
  72. package/src/icons/Plus/index.tsx +1 -0
  73. package/src/icons/Plus/plus.svg +7 -0
  74. package/src/index.tsx +2 -0
  75. package/src/utils/constants.ts +9 -0
  76. package/src/utils/createMobiDataBwWfsLayer.ts +120 -0
  77. package/src/utils/exportPdf.ts +677 -0
  78. package/src/utils/hooks/useRvfContext.tsx +37 -0
  79. package/src/utils/hooks/useUpdatePermalink.tsx +2 -9
  80. 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;