@geops/rvf-mobility-web-component 0.1.55 → 0.1.56
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/docutils.js +21 -6
- package/index.js +72 -60
- package/package.json +1 -1
- package/src/MobilityMap/MobilityMapAttributes.ts +22 -10
- package/src/RvfExportMenu/RvfExportMenu.tsx +3 -3
- package/src/RvfMobilityMap/RvfMobilityMap.tsx +1 -1
- package/src/utils/exportPdf.ts +3 -5
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.56",
|
|
6
6
|
"homepage": "https://rvf-mobility-web-component-geops.vercel.app/",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "index.js",
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
// const geopsMapsApiLink = `<a href="https://developer.geops.io/apis/maps">geOps Maps API</a>`;
|
|
14
14
|
// const geopsStopsApiLink = `<a href="https://developer.geops.io/apis/stops">geOps Stops API</a>`;
|
|
15
15
|
const geopsMocoApiLink = `<a href="https://geops.com/en/solution/disruption-information">geOps MOCO API</a>`;
|
|
16
|
-
const geopsRealtimeApiLink = `<a href="https://developer.geops.io/apis/realtime">geOps Realtime API</a>`;
|
|
16
|
+
// const geopsRealtimeApiLink = `<a href="https://developer.geops.io/apis/realtime">geOps Realtime API</a>`;
|
|
17
17
|
|
|
18
18
|
export interface WebComponentAttributeDoc {
|
|
19
19
|
defaultValue?: string;
|
|
@@ -125,14 +125,26 @@ const attrs: MobilityMapAttributes = {
|
|
|
125
125
|
The layers available are : ${LAYERS_WITH_LINK}.<br/>
|
|
126
126
|
Definition for a layer :
|
|
127
127
|
<pre style="font-size: 12px; overflow: auto;">{
|
|
128
|
-
liniennetz: {
|
|
129
|
-
link: {
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
"liniennetz": {
|
|
129
|
+
"link": {
|
|
130
|
+
"href": "https://www.rvf.de/fahrtinfo/netzplan",
|
|
131
|
+
"show": true,
|
|
132
|
+
"text": "Zu den Liniennetzplänen"
|
|
132
133
|
},
|
|
133
|
-
title: "Liniennetzpläne"
|
|
134
|
+
"title": "Liniennetzpläne"
|
|
134
135
|
}
|
|
135
|
-
</pre>}
|
|
136
|
+
</pre>}
|
|
137
|
+
<br/>
|
|
138
|
+
where:
|
|
139
|
+
<ul style="list-style-type: disc; padding-left: 20px;">
|
|
140
|
+
<li><i>link</i> defined a external link displayed at the bottom of the detail view</li>
|
|
141
|
+
<ul style="list-style-type: disc; padding-left: 40px;">
|
|
142
|
+
<li><i>href</i> is the target of the link. The <i>href</i> can be template, for example for the meldungen layer you can use {{id}} to insert the id of the notification in the url.</li
|
|
143
|
+
<li><i>text</i> is the text display as a link</li>
|
|
144
|
+
<li><i>show</i> show/hide the link in the details view</li>
|
|
145
|
+
</ul>
|
|
146
|
+
<li><i>title</i> is the title of the layer used in the details view header and in the layer tree, if not defined the layer name will be used.</li>
|
|
147
|
+
</ul>`,
|
|
136
148
|
},
|
|
137
149
|
layertree: {
|
|
138
150
|
defaultValue: "true",
|
|
@@ -168,7 +180,7 @@ const attrs: MobilityMapAttributes = {
|
|
|
168
180
|
// "Commas separated list of mots to display on the Realtime layer.<br/>Ex: rail,bus,coach,foot,tram,subway,gondola,funicular,ferry,car .",
|
|
169
181
|
},
|
|
170
182
|
notification: {
|
|
171
|
-
defaultValue: "
|
|
183
|
+
defaultValue: "true",
|
|
172
184
|
description: `Add the notification layer to the map. This layer will display informations about disruptions on the network. Data comes from
|
|
173
185
|
our ${geopsMocoApiLink} .`,
|
|
174
186
|
type: "boolean",
|
|
@@ -183,7 +195,7 @@ const attrs: MobilityMapAttributes = {
|
|
|
183
195
|
},
|
|
184
196
|
notificationurl: {
|
|
185
197
|
defaultValue: "https://moco.geops.io/api/v2/",
|
|
186
|
-
description: `The ${geopsMocoApiLink} url to use.`,
|
|
198
|
+
description: null, // `The ${geopsMocoApiLink} url to use.`,
|
|
187
199
|
},
|
|
188
200
|
permalink: {
|
|
189
201
|
defaultValue: "false",
|
|
@@ -203,7 +215,7 @@ const attrs: MobilityMapAttributes = {
|
|
|
203
215
|
},
|
|
204
216
|
realtime: {
|
|
205
217
|
defaultValue: "true",
|
|
206
|
-
description:
|
|
218
|
+
description: null, //`Add the realtime layer to the map. Data comes from the ${geopsRealtimeApiLink} .`,
|
|
207
219
|
type: "boolean",
|
|
208
220
|
},
|
|
209
221
|
realtimebboxparameters: {
|
|
@@ -3,7 +3,7 @@ import { memo, useId, useState } from "preact/compat";
|
|
|
3
3
|
import RvfCheckbox from "../RvfCheckbox";
|
|
4
4
|
import RvfSelect from "../RvfSelect";
|
|
5
5
|
import Button from "../ui/Button";
|
|
6
|
-
import { LAYER_PROP_IS_EXPORTING } from "../utils/constants";
|
|
6
|
+
import { LAYER_PROP_IS_EXPORTING, RVF_EXTENT_3857 } from "../utils/constants";
|
|
7
7
|
import exportPdf from "../utils/exportPdf";
|
|
8
8
|
import getAllLayers from "../utils/getAllLayers";
|
|
9
9
|
import useMapContext from "../utils/hooks/useMapContext";
|
|
@@ -66,6 +66,8 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
66
66
|
map,
|
|
67
67
|
{ format },
|
|
68
68
|
{
|
|
69
|
+
maxExtent: useMaxExtent ? RVF_EXTENT_3857 : undefined,
|
|
70
|
+
|
|
69
71
|
onAfter: (mapp, layers) => {
|
|
70
72
|
if (
|
|
71
73
|
realtimeLayer &&
|
|
@@ -78,7 +80,6 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
78
80
|
});
|
|
79
81
|
mapp.set(LAYER_PROP_IS_EXPORTING, false);
|
|
80
82
|
},
|
|
81
|
-
|
|
82
83
|
onBefore: (mapp, layers) => {
|
|
83
84
|
mapp.set(LAYER_PROP_IS_EXPORTING, true);
|
|
84
85
|
if (realtimeLayer) {
|
|
@@ -91,7 +92,6 @@ function RvfExportMenu({ ...props }: RvfExportMenuButtonProps) {
|
|
|
91
92
|
layer.set(LAYER_PROP_IS_EXPORTING, true);
|
|
92
93
|
});
|
|
93
94
|
},
|
|
94
|
-
useMaxExtent,
|
|
95
95
|
},
|
|
96
96
|
);
|
|
97
97
|
setTimeout(() => {
|
|
@@ -703,7 +703,7 @@ function RvfMobilityMap(props: RvfMobilityMapProps) {
|
|
|
703
703
|
hasLayerTree={hasLayerTree}
|
|
704
704
|
hasPrint={hasPrint}
|
|
705
705
|
hasRealtime={hasRealtime}
|
|
706
|
-
hasSearch={false}
|
|
706
|
+
hasSearch={false} // The search could be in the overlay but we decide to put it in the toolbar for better UX
|
|
707
707
|
hasShare={hasShare}
|
|
708
708
|
/>
|
|
709
709
|
</Overlay>
|
package/src/utils/exportPdf.ts
CHANGED
|
@@ -4,8 +4,6 @@ import { Map } from "ol";
|
|
|
4
4
|
import { getBottomRight, getTopLeft } from "ol/extent";
|
|
5
5
|
import View from "ol/View";
|
|
6
6
|
|
|
7
|
-
import { RVF_EXTENT_3857 } from "./constants";
|
|
8
|
-
|
|
9
7
|
import type { jsPDFOptions } from "jspdf";
|
|
10
8
|
import type { Coordinate } from "ol/coordinate";
|
|
11
9
|
import type { Extent } from "ol/extent";
|
|
@@ -532,12 +530,12 @@ export interface CopyrightExportOptions {
|
|
|
532
530
|
|
|
533
531
|
export interface MapExportOptions {
|
|
534
532
|
copyrightOptions?: CopyrightExportOptions;
|
|
533
|
+
maxExtent?: number[];
|
|
535
534
|
onAfter?: (map: Map, layers: BaseLayer[]) => void;
|
|
536
535
|
onBefore?: (map: Map, layers: BaseLayer[]) => void;
|
|
537
536
|
pixelRatio?: number;
|
|
538
537
|
text?: string;
|
|
539
538
|
useCopyright?: boolean;
|
|
540
|
-
useMaxExtent?: boolean;
|
|
541
539
|
usePlaceholder?: boolean;
|
|
542
540
|
}
|
|
543
541
|
|
|
@@ -547,11 +545,11 @@ async function exportPdf(
|
|
|
547
545
|
mapExportOptions: MapExportOptions = {},
|
|
548
546
|
): Promise<boolean> {
|
|
549
547
|
const {
|
|
548
|
+
maxExtent,
|
|
550
549
|
onAfter,
|
|
551
550
|
onBefore,
|
|
552
551
|
pixelRatio = 3,
|
|
553
552
|
useCopyright = true,
|
|
554
|
-
useMaxExtent = false,
|
|
555
553
|
usePlaceholder = true,
|
|
556
554
|
} = mapExportOptions;
|
|
557
555
|
|
|
@@ -560,7 +558,7 @@ async function exportPdf(
|
|
|
560
558
|
const size = sizePt.map((n) => {
|
|
561
559
|
return (n * 96) / 72;
|
|
562
560
|
});
|
|
563
|
-
const extent =
|
|
561
|
+
const extent = maxExtent;
|
|
564
562
|
|
|
565
563
|
// Save current pixel ratio
|
|
566
564
|
const actualPixelRatio = window.devicePixelRatio;
|