@geops/rvf-mobility-web-component 0.1.66 → 0.1.67
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 +8 -0
- package/index.js +72 -72
- package/package.json +1 -1
- package/src/MapsetLayer/MapsetLayer.tsx +33 -12
- package/src/MobilityMap/MobilityMapAttributes.ts +14 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@geops/rvf-mobility-web-component",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
4
|
"description": "Web components for rvf in the domains of mobility and logistics.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.67",
|
|
6
6
|
"homepage": "https://rvf-mobility-web-component-geops.vercel.app/",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "index.js",
|
|
@@ -18,7 +18,9 @@ function MapsetLayer(props?: Partial<MapsetLayerOptions>) {
|
|
|
18
18
|
map,
|
|
19
19
|
mapsetbbox,
|
|
20
20
|
mapsetplanid,
|
|
21
|
+
mapsettags,
|
|
21
22
|
mapsettenants,
|
|
23
|
+
mapsettimestamp,
|
|
22
24
|
mapseturl,
|
|
23
25
|
setMapsetLayer,
|
|
24
26
|
} = useMapContext();
|
|
@@ -27,34 +29,53 @@ function MapsetLayer(props?: Partial<MapsetLayerOptions>) {
|
|
|
27
29
|
if (!baseLayer || !map) {
|
|
28
30
|
return null;
|
|
29
31
|
}
|
|
32
|
+
|
|
33
|
+
let bbox = undefined;
|
|
34
|
+
if (mapsetbbox) {
|
|
35
|
+
bbox = mapsetbbox?.split(",").map((coord) => {
|
|
36
|
+
return Number(coord.trim());
|
|
37
|
+
});
|
|
38
|
+
if (
|
|
39
|
+
bbox.length === 4 &&
|
|
40
|
+
!bbox.some((coord) => {
|
|
41
|
+
return Number.isNaN(coord);
|
|
42
|
+
})
|
|
43
|
+
) {
|
|
44
|
+
bbox = transformExtent(bbox, "EPSG:3857", "EPSG:4326");
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
bbox = transformExtent(
|
|
48
|
+
map.getView()?.calculateExtent(map.getSize()),
|
|
49
|
+
"EPSG:3857",
|
|
50
|
+
"EPSG:4326",
|
|
51
|
+
);
|
|
52
|
+
}
|
|
30
53
|
return new MtbMapsetLayer({
|
|
31
54
|
apiKey: apikey,
|
|
32
|
-
bbox
|
|
33
|
-
mapsetbbox?.split(",").map((coord) => {
|
|
34
|
-
return Number(coord.trim());
|
|
35
|
-
}) ||
|
|
36
|
-
transformExtent(
|
|
37
|
-
map.getView()?.calculateExtent(map.getSize()),
|
|
38
|
-
"EPSG:3857",
|
|
39
|
-
"EPSG:4326",
|
|
40
|
-
),
|
|
55
|
+
bbox,
|
|
41
56
|
mapseturl: mapseturl || undefined,
|
|
42
57
|
name: LAYER_NAME_MAPSET,
|
|
43
58
|
planId: mapsetplanid ?? undefined,
|
|
59
|
+
tags: mapsettags?.split(",").map((t) => {
|
|
60
|
+
return t.trim();
|
|
61
|
+
}),
|
|
44
62
|
tenants: mapsettenants?.split(",").map((t) => {
|
|
45
63
|
return t.trim();
|
|
46
64
|
}),
|
|
65
|
+
timestamp: mapsettimestamp || new Date().toISOString(), // Load only standard plan
|
|
47
66
|
zoom: map.getView().getZoom(),
|
|
48
67
|
...(props || {}),
|
|
49
68
|
});
|
|
50
69
|
}, [
|
|
51
|
-
apikey,
|
|
52
70
|
baseLayer,
|
|
53
71
|
map,
|
|
54
72
|
mapsetbbox,
|
|
55
|
-
|
|
56
|
-
mapsetplanid,
|
|
73
|
+
apikey,
|
|
57
74
|
mapseturl,
|
|
75
|
+
mapsetplanid,
|
|
76
|
+
mapsettags,
|
|
77
|
+
mapsettenants,
|
|
78
|
+
mapsettimestamp,
|
|
58
79
|
props,
|
|
59
80
|
]);
|
|
60
81
|
|
|
@@ -42,7 +42,9 @@ export type MobilityMapAttributeName =
|
|
|
42
42
|
| "mapset"
|
|
43
43
|
| "mapsetbbox"
|
|
44
44
|
| "mapsetplanid"
|
|
45
|
+
| "mapsettags"
|
|
45
46
|
| "mapsettenants"
|
|
47
|
+
| "mapsettimestamp"
|
|
46
48
|
| "mapseturl"
|
|
47
49
|
| "mapsurl"
|
|
48
50
|
| "maxextent"
|
|
@@ -181,7 +183,7 @@ where:
|
|
|
181
183
|
},
|
|
182
184
|
mapset: {
|
|
183
185
|
defaultValue: "false",
|
|
184
|
-
description: `Add the mapset layer to the map. This layer will display mapset plans on the map.`,
|
|
186
|
+
description: `Add the mapset layer to the map. This layer will display mapset plans on the map. By default, it will load only the standard plans valid at the current time.`,
|
|
185
187
|
public: true,
|
|
186
188
|
type: "boolean",
|
|
187
189
|
},
|
|
@@ -192,12 +194,21 @@ where:
|
|
|
192
194
|
public: false,
|
|
193
195
|
},
|
|
194
196
|
mapsetplanid: {
|
|
195
|
-
description:
|
|
197
|
+
description:
|
|
198
|
+
"The id of the mapset plan to display. Mostly for debugging purposes.",
|
|
196
199
|
public: false,
|
|
197
200
|
},
|
|
201
|
+
mapsettags: {
|
|
202
|
+
description: `The ${geopsMapsetApiLink} tags to get the plans from.`,
|
|
203
|
+
public: true,
|
|
204
|
+
},
|
|
198
205
|
mapsettenants: {
|
|
199
206
|
defaultValue: "rvf",
|
|
200
|
-
description: `The ${geopsMapsetApiLink} tenant to get the
|
|
207
|
+
description: `The ${geopsMapsetApiLink} tenant to get the plans from.`,
|
|
208
|
+
public: false,
|
|
209
|
+
},
|
|
210
|
+
mapsettimestamp: {
|
|
211
|
+
description: `The ${geopsMapsetApiLink} timestamp used to load valid standard plan. If not defined it will use the current time.`,
|
|
201
212
|
public: false,
|
|
202
213
|
},
|
|
203
214
|
mapseturl: {
|