@geops/rvf-mobility-web-component 0.1.15 → 0.1.17
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 +38 -0
- package/docutils.js +8 -2
- package/index.html +14 -2
- package/index.js +152 -78
- 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 +123 -0
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/StationDetails.tsx +32 -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 +123 -34
- 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 +59 -23
- 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 +63 -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/getFeatureInformationTitle.ts +37 -0
- package/src/utils/getLayersAsFlatArray.ts +22 -0
- package/src/utils/getLinkByDevice.ts +23 -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
|
@@ -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;
|
package/src/utils/constants.ts
CHANGED
|
@@ -9,3 +9,66 @@ export const RVF_EXTENT_3857 = transformExtent(
|
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
export const LAYER_PROP_IS_EXPORTING = "isExporting";
|
|
12
|
+
|
|
13
|
+
export const RVF_LAYERS_TITLES = {
|
|
14
|
+
auto: "Auto",
|
|
15
|
+
cargobike: "Cargobike",
|
|
16
|
+
echtzeit: "Echtzeit",
|
|
17
|
+
eroller: "E-Roller",
|
|
18
|
+
fahrrad: "Fahrrad",
|
|
19
|
+
haltestellen: "Haltestellen",
|
|
20
|
+
liniennetz: "Liniennetz",
|
|
21
|
+
mitfahrpunkte: "Mitfahrpunkte",
|
|
22
|
+
pois: "POIs",
|
|
23
|
+
sharedMobility: "Shared Mobility",
|
|
24
|
+
tarifzonen: "Tarifzonen",
|
|
25
|
+
verkaufsstellen: "Verkaufsstellen",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const RVF_LAYERS_NAMES = {
|
|
29
|
+
auto: "auto",
|
|
30
|
+
cargobike: "cargobike",
|
|
31
|
+
echtzeit: "echtzeit",
|
|
32
|
+
eroller: "e-roller",
|
|
33
|
+
fahrrad: "fahrrad",
|
|
34
|
+
haltestellen: "haltestellen",
|
|
35
|
+
liniennetz: "liniennetz",
|
|
36
|
+
mitfahrpunkte: "mitfahrpunkte",
|
|
37
|
+
pois: "pois",
|
|
38
|
+
sharedMobility: "shared mobility",
|
|
39
|
+
tarifzonen: "tarifzonen",
|
|
40
|
+
verkaufsstellen: "verkaufsstellen",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const API_REQUEST_FEATURE_TYPE = {
|
|
44
|
+
freeFloat: {
|
|
45
|
+
bike: "sharing_vehicles",
|
|
46
|
+
car: "sharing_vehicles",
|
|
47
|
+
cargoBike: "sharing_vehicles",
|
|
48
|
+
scooter: "sharing_vehicles",
|
|
49
|
+
},
|
|
50
|
+
stations: {
|
|
51
|
+
bike: "sharing_stations_bicycle",
|
|
52
|
+
car: "sharing_stations_car",
|
|
53
|
+
cargoBike: "sharing_stations_cargo_bicycle",
|
|
54
|
+
scooter: "sharing_stations_scooters_standing",
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const TITLE_BY_FEED_ID = {
|
|
59
|
+
callabike_ice: RVF_LAYERS_TITLES.fahrrad,
|
|
60
|
+
flinkster_carsharing: RVF_LAYERS_TITLES.auto,
|
|
61
|
+
"gruene-flotte_freiburg": RVF_LAYERS_TITLES.auto,
|
|
62
|
+
lastenvelo_fr: RVF_LAYERS_TITLES.cargobike,
|
|
63
|
+
naturenergie_sharing: RVF_LAYERS_TITLES.auto,
|
|
64
|
+
nextbike_df: RVF_LAYERS_TITLES.fahrrad,
|
|
65
|
+
yoio_freiburg: RVF_LAYERS_TITLES.eroller,
|
|
66
|
+
zeus_freiburg: RVF_LAYERS_TITLES.eroller,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const TITLE_BY_CATEGORY = {
|
|
70
|
+
"Bike Sharing": RVF_LAYERS_TITLES.fahrrad,
|
|
71
|
+
"Cargo Bike Sharing": RVF_LAYERS_TITLES.cargobike,
|
|
72
|
+
"Car Sharing": RVF_LAYERS_TITLES.auto,
|
|
73
|
+
"E-Scooter": RVF_LAYERS_TITLES.eroller,
|
|
74
|
+
};
|
|
@@ -4,26 +4,38 @@ import { Point } from "ol/geom";
|
|
|
4
4
|
import VectorLayer, { Options } from "ol/layer/Vector";
|
|
5
5
|
import { bbox as bboxStrategy } from "ol/loadingstrategy.js";
|
|
6
6
|
import { Cluster, Vector } from "ol/source";
|
|
7
|
-
import { Circle, Fill,
|
|
7
|
+
import { Circle, Fill, Stroke, Style, Text } from "ol/style";
|
|
8
8
|
|
|
9
|
-
// @ts-expect-error - load svg as data url
|
|
10
|
-
import bicycle from "../icons/Bike/rvf_shared_bike.svg";
|
|
11
|
-
// @ts-expect-error - load svg as data url
|
|
12
|
-
import car from "../icons/Car/rvf_shared_car.svg";
|
|
13
|
-
// @ts-expect-error - load svg as data url
|
|
14
|
-
import cargoBicycle from "../icons/CargoBike/rvf_shared_cargo_bike.svg";
|
|
15
|
-
// @ts-expect-error - load svg as data url
|
|
16
|
-
import scooter from "../icons/Scooter/rvf_shared_scooter.svg";
|
|
17
9
|
import { LAYER_PROP_IS_EXPORTING } from "./constants";
|
|
10
|
+
import { iconStyleByFormFactor } from "./createMobiDataBwWfsLayer";
|
|
18
11
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
export const getCircleStyle = (color: string) => {
|
|
13
|
+
return new Style({
|
|
14
|
+
image: new Circle({
|
|
15
|
+
declutterMode: "declutter",
|
|
16
|
+
displacement: [-12, 12],
|
|
17
|
+
fill: new Fill({
|
|
18
|
+
color: "white",
|
|
19
|
+
}),
|
|
20
|
+
radius: 9,
|
|
21
|
+
stroke: new Stroke({
|
|
22
|
+
color: color,
|
|
23
|
+
width: 1,
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
text: new Text({
|
|
27
|
+
declutterMode: "declutter",
|
|
28
|
+
fill: new Fill({
|
|
29
|
+
color: color,
|
|
30
|
+
}),
|
|
31
|
+
font: "bolder 10px arial",
|
|
32
|
+
offsetX: -12,
|
|
33
|
+
offsetY: -11,
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
24
36
|
};
|
|
25
37
|
|
|
26
|
-
function
|
|
38
|
+
function createFreeFloatMobilityLayer(
|
|
27
39
|
name: string,
|
|
28
40
|
color: string,
|
|
29
41
|
formFactor: string,
|
|
@@ -31,6 +43,8 @@ function createSharedMobilityLayer(
|
|
|
31
43
|
minZoom: 17.99,
|
|
32
44
|
},
|
|
33
45
|
): VectorLayer<Vector<Feature<Point>>> {
|
|
46
|
+
// Exemple how to get a specific form factor
|
|
47
|
+
//api.mobidata-bw.de/geoserver/MobiData-BW/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=MobiData-BW%3Asharing_vehicles&CQL_FILTER=form_factor%20%3D%20%27scooter%27&maxFeatures=20000&outputFormat=csv
|
|
34
48
|
const source = new Vector({
|
|
35
49
|
format: new GeoJSON(),
|
|
36
50
|
loader: function (extent, resolution, projection, success, failure) {
|
|
@@ -88,54 +102,7 @@ function createSharedMobilityLayer(
|
|
|
88
102
|
strategy: bboxStrategy,
|
|
89
103
|
});
|
|
90
104
|
|
|
91
|
-
const style =
|
|
92
|
-
image: new Circle({
|
|
93
|
-
declutterMode: "declutter",
|
|
94
|
-
displacement: [-12, 10],
|
|
95
|
-
fill: new Fill({
|
|
96
|
-
color: "white",
|
|
97
|
-
}),
|
|
98
|
-
radius: 10,
|
|
99
|
-
stroke: new Stroke({
|
|
100
|
-
color: color,
|
|
101
|
-
width: 2,
|
|
102
|
-
}),
|
|
103
|
-
}),
|
|
104
|
-
text: new Text({
|
|
105
|
-
declutterMode: "declutter",
|
|
106
|
-
fill: new Fill({
|
|
107
|
-
color: color,
|
|
108
|
-
}),
|
|
109
|
-
font: "bold 12px inherit",
|
|
110
|
-
offsetX: -12,
|
|
111
|
-
offsetY: -10,
|
|
112
|
-
}),
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
const iconStyleByFormFactor = {};
|
|
116
|
-
Object.entries(iconByFormFactor).forEach(([key, value]) => {
|
|
117
|
-
iconStyleByFormFactor[key] = new Style({
|
|
118
|
-
image: new Icon({
|
|
119
|
-
src: value || iconByFormFactor["scooter"],
|
|
120
|
-
width: 25,
|
|
121
|
-
}),
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// const backgroundStyle = new Style({
|
|
126
|
-
// image: new Circle({
|
|
127
|
-
// declutterMode: "declutter",
|
|
128
|
-
// displacement: [0, 0],
|
|
129
|
-
// fill: new Fill({
|
|
130
|
-
// color: "#00973c",
|
|
131
|
-
// }),
|
|
132
|
-
// radius: 12,
|
|
133
|
-
// }),
|
|
134
|
-
// stroke: new Stroke({
|
|
135
|
-
// color: "white",
|
|
136
|
-
// width: 2,
|
|
137
|
-
// }),
|
|
138
|
-
// });
|
|
105
|
+
const style = getCircleStyle(color);
|
|
139
106
|
|
|
140
107
|
const clusterSource = new Cluster({
|
|
141
108
|
distance: 40,
|
|
@@ -146,21 +113,26 @@ function createSharedMobilityLayer(
|
|
|
146
113
|
if (layer.get(LAYER_PROP_IS_EXPORTING)) {
|
|
147
114
|
return null;
|
|
148
115
|
}
|
|
149
|
-
const
|
|
116
|
+
const circleStyle = style.clone();
|
|
150
117
|
|
|
151
|
-
|
|
152
|
-
|
|
118
|
+
const featuresCount = feature.get("features").length;
|
|
119
|
+
circleStyle.getText().setText(featuresCount);
|
|
153
120
|
|
|
154
121
|
const formFactor =
|
|
155
122
|
feature.get("features")?.[0].get?.("form_factor") || "scooter";
|
|
156
123
|
|
|
157
|
-
|
|
124
|
+
const styles = [iconStyleByFormFactor[formFactor], circleStyle];
|
|
125
|
+
|
|
126
|
+
styles.forEach((style) => {
|
|
127
|
+
style.setZIndex(parseInt(getUid(feature), 10));
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return styles;
|
|
158
131
|
};
|
|
159
132
|
|
|
160
133
|
const layer = new VectorLayer({
|
|
161
134
|
// @ts-expect-error - custom properties
|
|
162
135
|
isQueryable: true,
|
|
163
|
-
name,
|
|
164
136
|
source: clusterSource,
|
|
165
137
|
style: styleFunction,
|
|
166
138
|
...layerOptions,
|
|
@@ -173,4 +145,4 @@ function createSharedMobilityLayer(
|
|
|
173
145
|
return layer;
|
|
174
146
|
}
|
|
175
147
|
|
|
176
|
-
export default
|
|
148
|
+
export default createFreeFloatMobilityLayer;
|