@open-pioneer/measurement 0.1.0
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 +15 -0
- package/LICENSE +202 -0
- package/Measurement.d.ts +24 -0
- package/Measurement.js +153 -0
- package/Measurement.js.map +1 -0
- package/MeasurementController.d.ts +65 -0
- package/MeasurementController.js +273 -0
- package/MeasurementController.js.map +1 -0
- package/README.md +65 -0
- package/_virtual/_virtual-pioneer-module_react-hooks.js +7 -0
- package/_virtual/_virtual-pioneer-module_react-hooks.js.map +1 -0
- package/i18n/de.yaml +9 -0
- package/i18n/en.yaml +9 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/measurement.css +41 -0
- package/measurement.css.map +1 -0
- package/package.json +38 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @open-pioneer/measurement
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- cd43c02: Initial release
|
|
8
|
+
- 3c0d1b1: Initial release.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [bb2f27a]
|
|
13
|
+
- Updated dependencies [182da1c]
|
|
14
|
+
- @open-pioneer/map@0.1.0
|
|
15
|
+
- @open-pioneer/react-utils@0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/Measurement.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CommonComponentProps } from "@open-pioneer/react-utils";
|
|
2
|
+
import { StyleLike } from "ol/style/Style";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
/**
|
|
5
|
+
* This is for special properties of the Measurement.
|
|
6
|
+
*/
|
|
7
|
+
export interface MeasurementProps extends CommonComponentProps {
|
|
8
|
+
/**
|
|
9
|
+
* The id of the map.
|
|
10
|
+
*/
|
|
11
|
+
mapId: string;
|
|
12
|
+
/**
|
|
13
|
+
* The style for the active drawing feature's geometry.
|
|
14
|
+
*/
|
|
15
|
+
activeFeatureStyle?: StyleLike;
|
|
16
|
+
/**
|
|
17
|
+
* The style for the finished drawn feature's geometry.
|
|
18
|
+
*/
|
|
19
|
+
finishedFeatureStyle?: StyleLike;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `Measurement` component can be used in an app to switch between distance and area measurements and to delete all current measurements.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Measurement: FC<MeasurementProps>;
|
package/Measurement.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Box, Text, FormControl, HStack, FormLabel, Select, Button } from '@open-pioneer/chakra-integration';
|
|
3
|
+
import { useMapModel } from '@open-pioneer/map';
|
|
4
|
+
import { useCommonComponentProps } from '@open-pioneer/react-utils';
|
|
5
|
+
import { Style, Stroke, Fill, Circle } from 'ol/style';
|
|
6
|
+
import { useIntl } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
7
|
+
import { useState, useEffect } from 'react';
|
|
8
|
+
import { MeasurementController } from './MeasurementController.js';
|
|
9
|
+
|
|
10
|
+
const Measurement = (props) => {
|
|
11
|
+
const intl = useIntl();
|
|
12
|
+
const { mapId, activeFeatureStyle, finishedFeatureStyle } = props;
|
|
13
|
+
const { containerProps } = useCommonComponentProps("measurement", props);
|
|
14
|
+
const [selectedMeasurement, setMeasurement] = useState("distance");
|
|
15
|
+
const label = (id) => intl.formatMessage({ id });
|
|
16
|
+
const mapState = useMapModel(mapId);
|
|
17
|
+
const controller = useController(mapState.map, intl);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
controller?.setActiveFeatureStyle(activeFeatureStyle ?? getDefaultActiveFeatureStyle());
|
|
20
|
+
}, [controller, activeFeatureStyle]);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
controller?.setFinishedFeatureStyle(
|
|
23
|
+
finishedFeatureStyle ?? getDefaultFinishedFeatureStyle()
|
|
24
|
+
);
|
|
25
|
+
}, [controller, finishedFeatureStyle]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!controller) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
controller.startMeasurement(selectedMeasurement);
|
|
31
|
+
return () => {
|
|
32
|
+
controller.stopMeasurement();
|
|
33
|
+
};
|
|
34
|
+
}, [controller, selectedMeasurement]);
|
|
35
|
+
function changeMeasurement(measurementType) {
|
|
36
|
+
if (measurementType === "distance" || measurementType === "area") {
|
|
37
|
+
setMeasurement(measurementType);
|
|
38
|
+
} else {
|
|
39
|
+
throw new Error(`Unexpected measurement type: '${measurementType}'.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function removeMeasurements() {
|
|
43
|
+
controller?.clearMeasurements();
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ jsxs(Box, { ...containerProps, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Text, { width: "340px", mb: 3, children: intl.formatMessage({ id: "measurementInfoText" }) }),
|
|
47
|
+
/* @__PURE__ */ jsx(FormControl, { mb: 4, alignItems: "center", children: /* @__PURE__ */ jsxs(HStack, { mb: 2, children: [
|
|
48
|
+
/* @__PURE__ */ jsx(FormLabel, { mb: 1, children: label("measurementLabel") }),
|
|
49
|
+
/* @__PURE__ */ jsxs(
|
|
50
|
+
Select,
|
|
51
|
+
{
|
|
52
|
+
value: selectedMeasurement,
|
|
53
|
+
onChange: (e) => changeMeasurement(e.target.value),
|
|
54
|
+
className: "measurement-select",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx("option", { value: "distance", children: label("distance") }),
|
|
57
|
+
/* @__PURE__ */ jsx("option", { value: "area", children: label("area") })
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }) }),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
Button,
|
|
64
|
+
{
|
|
65
|
+
padding: 2,
|
|
66
|
+
className: "measurement-delete-button",
|
|
67
|
+
onClick: removeMeasurements,
|
|
68
|
+
width: "100%",
|
|
69
|
+
children: label("deleteMeasurementLabel")
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
function useController(map, intl) {
|
|
75
|
+
const [controller, setController] = useState(void 0);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!map) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const controller2 = new MeasurementController(map.olMap, {
|
|
81
|
+
getContinueMessage() {
|
|
82
|
+
return intl.formatMessage({ id: "tooltips.continue" });
|
|
83
|
+
},
|
|
84
|
+
getHelpMessage() {
|
|
85
|
+
return intl.formatMessage({ id: "tooltips.help" });
|
|
86
|
+
},
|
|
87
|
+
formatNumber(value) {
|
|
88
|
+
return intl.formatNumber(value, {
|
|
89
|
+
maximumFractionDigits: 2
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
setController(controller2);
|
|
94
|
+
return () => {
|
|
95
|
+
controller2.destroy();
|
|
96
|
+
setController(void 0);
|
|
97
|
+
};
|
|
98
|
+
}, [map, intl]);
|
|
99
|
+
return controller;
|
|
100
|
+
}
|
|
101
|
+
function getDefaultActiveFeatureStyle() {
|
|
102
|
+
return [
|
|
103
|
+
new Style({
|
|
104
|
+
stroke: new Stroke({
|
|
105
|
+
color: "#fff",
|
|
106
|
+
lineDash: [10, 10],
|
|
107
|
+
width: 5
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
new Style({
|
|
111
|
+
fill: new Fill({
|
|
112
|
+
color: "rgba(0,0,0,0.15)"
|
|
113
|
+
}),
|
|
114
|
+
stroke: new Stroke({
|
|
115
|
+
color: "rgba(0, 0, 0, 0.7)",
|
|
116
|
+
lineDash: [10, 10],
|
|
117
|
+
width: 3
|
|
118
|
+
}),
|
|
119
|
+
image: new Circle({
|
|
120
|
+
radius: 5,
|
|
121
|
+
stroke: new Stroke({
|
|
122
|
+
color: "rgba(0, 0, 0, 0.7)",
|
|
123
|
+
width: 2
|
|
124
|
+
}),
|
|
125
|
+
fill: new Fill({
|
|
126
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
function getDefaultFinishedFeatureStyle() {
|
|
133
|
+
return [
|
|
134
|
+
new Style({
|
|
135
|
+
stroke: new Stroke({
|
|
136
|
+
color: "#fff",
|
|
137
|
+
width: 5
|
|
138
|
+
})
|
|
139
|
+
}),
|
|
140
|
+
new Style({
|
|
141
|
+
stroke: new Stroke({
|
|
142
|
+
color: "#0b96fc",
|
|
143
|
+
width: 3
|
|
144
|
+
}),
|
|
145
|
+
fill: new Fill({
|
|
146
|
+
color: "rgba(11,150,252,0.15)"
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { Measurement };
|
|
153
|
+
//# sourceMappingURL=Measurement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Measurement.js","sources":["Measurement.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n Button,\n FormControl,\n FormLabel,\n HStack,\n Select,\n Text\n} from \"@open-pioneer/chakra-integration\";\nimport { MapModel, useMapModel } from \"@open-pioneer/map\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { Circle as CircleStyle, Fill, Stroke, Style } from \"ol/style\";\nimport { StyleLike } from \"ol/style/Style\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useEffect, useState } from \"react\";\nimport { MeasurementController, MeasurementType } from \"./MeasurementController\";\n\n/**\n * This is for special properties of the Measurement.\n */\nexport interface MeasurementProps extends CommonComponentProps {\n /**\n * The id of the map.\n */\n mapId: string;\n\n /**\n * The style for the active drawing feature's geometry.\n */\n activeFeatureStyle?: StyleLike;\n\n /**\n * The style for the finished drawn feature's geometry.\n */\n finishedFeatureStyle?: StyleLike;\n}\n\n/**\n * The `Measurement` component can be used in an app to switch between distance and area measurements and to delete all current measurements.\n */\nexport const Measurement: FC<MeasurementProps> = (props) => {\n const intl = useIntl();\n\n const { mapId, activeFeatureStyle, finishedFeatureStyle } = props;\n const { containerProps } = useCommonComponentProps(\"measurement\", props);\n const [selectedMeasurement, setMeasurement] = useState<MeasurementType>(\"distance\");\n const label = (id: string) => intl.formatMessage({ id: id });\n\n const mapState = useMapModel(mapId);\n const controller = useController(mapState.map, intl);\n\n // Synchronize styles with controller\n useEffect(() => {\n controller?.setActiveFeatureStyle(activeFeatureStyle ?? getDefaultActiveFeatureStyle());\n }, [controller, activeFeatureStyle]);\n useEffect(() => {\n controller?.setFinishedFeatureStyle(\n finishedFeatureStyle ?? getDefaultFinishedFeatureStyle()\n );\n }, [controller, finishedFeatureStyle]);\n\n // Start / Stop measurement on selection change\n useEffect(() => {\n if (!controller) {\n return;\n }\n\n controller.startMeasurement(selectedMeasurement);\n return () => {\n controller.stopMeasurement();\n };\n }, [controller, selectedMeasurement]);\n\n function changeMeasurement(measurementType: string) {\n if (measurementType === \"distance\" || measurementType === \"area\") {\n setMeasurement(measurementType);\n } else {\n throw new Error(`Unexpected measurement type: '${measurementType}'.`);\n }\n }\n\n function removeMeasurements() {\n controller?.clearMeasurements();\n }\n\n return (\n <Box {...containerProps}>\n <Text width=\"340px\" mb={3}>\n {intl.formatMessage({ id: \"measurementInfoText\" })}\n </Text>\n <FormControl mb={4} alignItems=\"center\">\n <HStack mb={2}>\n <FormLabel mb={1}>{label(\"measurementLabel\")}</FormLabel>\n <Select\n value={selectedMeasurement}\n onChange={(e) => changeMeasurement(e.target.value)}\n className=\"measurement-select\"\n >\n <option value={\"distance\"}>{label(\"distance\")}</option>\n <option value={\"area\"}>{label(\"area\")}</option>\n </Select>\n </HStack>\n </FormControl>\n <Button\n padding={2}\n className=\"measurement-delete-button\"\n onClick={removeMeasurements}\n width=\"100%\"\n >\n {label(\"deleteMeasurementLabel\")}\n </Button>\n </Box>\n );\n};\n\n/** Creates a MeasurementController instance for the given map. */\nfunction useController(map: MapModel | undefined, intl: PackageIntl) {\n const [controller, setController] = useState<MeasurementController | undefined>(undefined);\n useEffect(() => {\n if (!map) {\n return;\n }\n\n const controller = new MeasurementController(map.olMap, {\n getContinueMessage() {\n return intl.formatMessage({ id: \"tooltips.continue\" });\n },\n getHelpMessage() {\n return intl.formatMessage({ id: \"tooltips.help\" });\n },\n formatNumber(value) {\n return intl.formatNumber(value, {\n maximumFractionDigits: 2\n });\n }\n });\n setController(controller);\n return () => {\n controller.destroy();\n setController(undefined);\n };\n }, [map, intl]);\n return controller;\n}\n\nfunction getDefaultActiveFeatureStyle() {\n return [\n new Style({\n stroke: new Stroke({\n color: \"#fff\",\n lineDash: [10, 10],\n width: 5\n })\n }),\n new Style({\n fill: new Fill({\n color: \"rgba(0,0,0,0.15)\"\n }),\n stroke: new Stroke({\n color: \"rgba(0, 0, 0, 0.7)\",\n lineDash: [10, 10],\n width: 3\n }),\n image: new CircleStyle({\n radius: 5,\n stroke: new Stroke({\n color: \"rgba(0, 0, 0, 0.7)\",\n width: 2\n }),\n fill: new Fill({\n color: \"rgba(255, 255, 255, 0.2)\"\n })\n })\n })\n ];\n}\n\nfunction getDefaultFinishedFeatureStyle() {\n return [\n new Style({\n stroke: new Stroke({\n color: \"#fff\",\n width: 5\n })\n }),\n new Style({\n stroke: new Stroke({\n color: \"#0b96fc\",\n width: 3\n }),\n fill: new Fill({\n color: \"rgba(11,150,252,0.15)\"\n })\n })\n ];\n}\n"],"names":["controller","CircleStyle"],"mappings":";;;;;;;;;AA2Ca,MAAA,WAAA,GAAoC,CAAC,KAAU,KAAA;AACxD,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AAErB,EAAA,MAAM,EAAE,KAAA,EAAO,kBAAoB,EAAA,oBAAA,EAAyB,GAAA,KAAA,CAAA;AAC5D,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,eAAe,KAAK,CAAA,CAAA;AACvE,EAAA,MAAM,CAAC,mBAAA,EAAqB,cAAc,CAAA,GAAI,SAA0B,UAAU,CAAA,CAAA;AAClF,EAAA,MAAM,QAAQ,CAAC,EAAA,KAAe,KAAK,aAAc,CAAA,EAAE,IAAQ,CAAA,CAAA;AAE3D,EAAM,MAAA,QAAA,GAAW,YAAY,KAAK,CAAA,CAAA;AAClC,EAAA,MAAM,UAAa,GAAA,aAAA,CAAc,QAAS,CAAA,GAAA,EAAK,IAAI,CAAA,CAAA;AAGnD,EAAA,SAAA,CAAU,MAAM;AACZ,IAAY,UAAA,EAAA,qBAAA,CAAsB,kBAAsB,IAAA,4BAAA,EAA8B,CAAA,CAAA;AAAA,GACvF,EAAA,CAAC,UAAY,EAAA,kBAAkB,CAAC,CAAA,CAAA;AACnC,EAAA,SAAA,CAAU,MAAM;AACZ,IAAY,UAAA,EAAA,uBAAA;AAAA,MACR,wBAAwB,8BAA+B,EAAA;AAAA,KAC3D,CAAA;AAAA,GACD,EAAA,CAAC,UAAY,EAAA,oBAAoB,CAAC,CAAA,CAAA;AAGrC,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,IAAI,CAAC,UAAY,E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AAA;AAAA,SACV,CAAA;AAAA,OACJ,CAAA;AAAA,KACJ,CAAA;AAAA,GACL,CAAA;AACJ,CAAA;AAEA,SAAS,8BAAiC,GAAA;AACtC,EAAO,OAAA;AAAA,IACH,IAAI,KAAM,CAAA;AAAA,MACN,MAAA,EAAQ,IAAI,MAAO,CAAA;AAAA,QACf,KAAO,EAAA,MAAA;AAAA,QACP,KAAO,EAAA,CAAA;AAAA,OACV,CAAA;AAAA,KACJ,CAAA;AAAA,IACD,IAAI,KAAM,CAAA;AAAA,MACN,MAAA,EAAQ,IAAI,MAAO,CAAA;AAAA,QACf,KAAO,EAAA,SAAA;AAAA,QACP,KAAO,EAAA,CAAA;AAAA,OACV,CAAA;AAAA,MACD,IAAA,EAAM,IAAI,IAAK,CAAA;AAAA,QACX,KAAO,EAAA,uBAAA;AAAA,OACV,CAAA;AAAA,KACJ,CAAA;AAAA,GACL,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import Feature from "ol/Feature";
|
|
2
|
+
import OlMap from "ol/Map";
|
|
3
|
+
import { Vector as VectorLayer } from "ol/layer";
|
|
4
|
+
import { Vector as VectorSource } from "ol/source";
|
|
5
|
+
import { StyleLike } from "ol/style/Style";
|
|
6
|
+
export type MeasurementType = "area" | "distance";
|
|
7
|
+
export interface Messages {
|
|
8
|
+
getContinueMessage(): string;
|
|
9
|
+
getHelpMessage(): string;
|
|
10
|
+
formatNumber(value: number): string;
|
|
11
|
+
}
|
|
12
|
+
export declare class MeasurementController {
|
|
13
|
+
private olMap;
|
|
14
|
+
private messages;
|
|
15
|
+
private activeFeatureStyle;
|
|
16
|
+
/**
|
|
17
|
+
* The layer rendering the measurement "features".
|
|
18
|
+
*/
|
|
19
|
+
private layer;
|
|
20
|
+
/**
|
|
21
|
+
* Source of {@link layer}.
|
|
22
|
+
*/
|
|
23
|
+
private source;
|
|
24
|
+
/**
|
|
25
|
+
* Stores the current `Draw` interaction.
|
|
26
|
+
*/
|
|
27
|
+
private draw;
|
|
28
|
+
/**
|
|
29
|
+
* Currently drawn feature.
|
|
30
|
+
*/
|
|
31
|
+
private sketch;
|
|
32
|
+
/**
|
|
33
|
+
* The help tooltip element.
|
|
34
|
+
*/
|
|
35
|
+
private helpTooltip;
|
|
36
|
+
/**
|
|
37
|
+
* The current measurement tooltip (if any).
|
|
38
|
+
*/
|
|
39
|
+
private measureTooltip;
|
|
40
|
+
/**
|
|
41
|
+
* Overlays/Tooltip containing the tooltip for finished drawings.
|
|
42
|
+
*/
|
|
43
|
+
private overlayTooltips;
|
|
44
|
+
/**
|
|
45
|
+
* Keeps track of registered event handlers.
|
|
46
|
+
*/
|
|
47
|
+
private resources;
|
|
48
|
+
constructor(olMap: OlMap, messages: Messages);
|
|
49
|
+
destroy(): void;
|
|
50
|
+
/** Returns the vector layer used for finished features. */
|
|
51
|
+
getVectorLayer(): VectorLayer<VectorSource<Feature<import("ol/geom/Geometry").default>>>;
|
|
52
|
+
/** Updates the style used for finished features. */
|
|
53
|
+
setFinishedFeatureStyle(style: StyleLike): void;
|
|
54
|
+
/** Updates the style used for active measurements. */
|
|
55
|
+
setActiveFeatureStyle(style: StyleLike): void;
|
|
56
|
+
/** Removes all finished measurements. */
|
|
57
|
+
clearMeasurements(): void;
|
|
58
|
+
/** Starts measuring using the provided type. */
|
|
59
|
+
startMeasurement(type: MeasurementType): void;
|
|
60
|
+
/** Stops the current measuring started by `startMeasurement`. */
|
|
61
|
+
stopMeasurement(): void;
|
|
62
|
+
private createMeasureTooltip;
|
|
63
|
+
private createHelpTooltip;
|
|
64
|
+
private handlePointerMove;
|
|
65
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { unByKey } from 'ol/Observable';
|
|
2
|
+
import Overlay from 'ol/Overlay';
|
|
3
|
+
import { Polygon, LineString } from 'ol/geom';
|
|
4
|
+
import Draw from 'ol/interaction/Draw';
|
|
5
|
+
import { Vector as Vector$1 } from 'ol/layer';
|
|
6
|
+
import { Vector } from 'ol/source';
|
|
7
|
+
import { getArea, getLength } from 'ol/sphere';
|
|
8
|
+
import { toFunction } from 'ol/style/Style';
|
|
9
|
+
import { TOPMOST_LAYER_Z } from '@open-pioneer/map';
|
|
10
|
+
|
|
11
|
+
class MeasurementController {
|
|
12
|
+
olMap;
|
|
13
|
+
messages;
|
|
14
|
+
activeFeatureStyle;
|
|
15
|
+
/**
|
|
16
|
+
* The layer rendering the measurement "features".
|
|
17
|
+
*/
|
|
18
|
+
layer;
|
|
19
|
+
/**
|
|
20
|
+
* Source of {@link layer}.
|
|
21
|
+
*/
|
|
22
|
+
source;
|
|
23
|
+
/**
|
|
24
|
+
* Stores the current `Draw` interaction.
|
|
25
|
+
*/
|
|
26
|
+
draw = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Currently drawn feature.
|
|
29
|
+
*/
|
|
30
|
+
sketch = void 0;
|
|
31
|
+
/**
|
|
32
|
+
* The help tooltip element.
|
|
33
|
+
*/
|
|
34
|
+
helpTooltip;
|
|
35
|
+
/**
|
|
36
|
+
* The current measurement tooltip (if any).
|
|
37
|
+
*/
|
|
38
|
+
measureTooltip;
|
|
39
|
+
/**
|
|
40
|
+
* Overlays/Tooltip containing the tooltip for finished drawings.
|
|
41
|
+
*/
|
|
42
|
+
overlayTooltips = [];
|
|
43
|
+
/**
|
|
44
|
+
* Keeps track of registered event handlers.
|
|
45
|
+
*/
|
|
46
|
+
resources = [];
|
|
47
|
+
constructor(olMap, messages) {
|
|
48
|
+
this.olMap = olMap;
|
|
49
|
+
this.messages = messages;
|
|
50
|
+
const source = this.source = new Vector();
|
|
51
|
+
this.layer = new Vector$1({
|
|
52
|
+
source
|
|
53
|
+
});
|
|
54
|
+
this.layer.setZIndex(TOPMOST_LAYER_Z);
|
|
55
|
+
olMap.addLayer(this.layer);
|
|
56
|
+
const pointerMoveKey = olMap.on("pointermove", this.handlePointerMove.bind(this));
|
|
57
|
+
this.resources.push({
|
|
58
|
+
destroy() {
|
|
59
|
+
unByKey(pointerMoveKey);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const mouseOutHandler = () => {
|
|
63
|
+
this.helpTooltip.element.classList.add("hidden");
|
|
64
|
+
};
|
|
65
|
+
olMap.getViewport().addEventListener("mouseout", mouseOutHandler);
|
|
66
|
+
this.resources.push({
|
|
67
|
+
destroy() {
|
|
68
|
+
olMap.getViewport().removeEventListener("mouseout", mouseOutHandler);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
this.helpTooltip = this.createHelpTooltip();
|
|
72
|
+
}
|
|
73
|
+
destroy() {
|
|
74
|
+
this.stopMeasurement();
|
|
75
|
+
for (const resource of this.resources) {
|
|
76
|
+
resource.destroy();
|
|
77
|
+
}
|
|
78
|
+
this.resources = [];
|
|
79
|
+
this.helpTooltip.destroy();
|
|
80
|
+
this.measureTooltip?.destroy();
|
|
81
|
+
for (const tooltip of this.overlayTooltips) {
|
|
82
|
+
tooltip.destroy();
|
|
83
|
+
}
|
|
84
|
+
this.overlayTooltips = [];
|
|
85
|
+
this.olMap.removeLayer(this.layer);
|
|
86
|
+
this.layer.dispose();
|
|
87
|
+
this.source.dispose();
|
|
88
|
+
}
|
|
89
|
+
/** Returns the vector layer used for finished features. */
|
|
90
|
+
getVectorLayer() {
|
|
91
|
+
return this.layer;
|
|
92
|
+
}
|
|
93
|
+
/** Updates the style used for finished features. */
|
|
94
|
+
setFinishedFeatureStyle(style) {
|
|
95
|
+
this.layer.setStyle(style);
|
|
96
|
+
}
|
|
97
|
+
/** Updates the style used for active measurements. */
|
|
98
|
+
setActiveFeatureStyle(style) {
|
|
99
|
+
const styleFunction = toFunction(style);
|
|
100
|
+
this.activeFeatureStyle = (feature, ...args) => {
|
|
101
|
+
const ft = feature?.getGeometry()?.getType();
|
|
102
|
+
if (ft === "Polygon" || ft === "LineString" || ft === "Point") {
|
|
103
|
+
return styleFunction(feature, ...args);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
this.draw?.getOverlay().setStyle(this.activeFeatureStyle);
|
|
107
|
+
}
|
|
108
|
+
/** Removes all finished measurements. */
|
|
109
|
+
clearMeasurements() {
|
|
110
|
+
this.source.clear();
|
|
111
|
+
for (const tooltip of this.overlayTooltips) {
|
|
112
|
+
tooltip.destroy();
|
|
113
|
+
}
|
|
114
|
+
this.overlayTooltips = [];
|
|
115
|
+
}
|
|
116
|
+
/** Starts measuring using the provided type. */
|
|
117
|
+
startMeasurement(type) {
|
|
118
|
+
if (this.draw) {
|
|
119
|
+
throw new Error("Internal error: another measurement interaction is still active.");
|
|
120
|
+
}
|
|
121
|
+
const geometryType = type === "area" ? "Polygon" : "LineString";
|
|
122
|
+
const draw = this.draw = new Draw({
|
|
123
|
+
source: this.source,
|
|
124
|
+
type: geometryType,
|
|
125
|
+
style: this.activeFeatureStyle
|
|
126
|
+
});
|
|
127
|
+
this.olMap.addInteraction(draw);
|
|
128
|
+
let measureTooltip;
|
|
129
|
+
let changeListenerKey = void 0;
|
|
130
|
+
draw.on("drawstart", (evt) => {
|
|
131
|
+
measureTooltip = this.measureTooltip = this.createMeasureTooltip();
|
|
132
|
+
const sketch = this.sketch = evt.feature;
|
|
133
|
+
if (!sketch) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
let tooltipCoord;
|
|
137
|
+
changeListenerKey = sketch.getGeometry()?.on("change", (evt2) => {
|
|
138
|
+
const geom = evt2.target;
|
|
139
|
+
const projection = this.olMap.getView().getProjection();
|
|
140
|
+
let output = "";
|
|
141
|
+
if (geom instanceof Polygon) {
|
|
142
|
+
output = formatArea(geom, projection, this.messages);
|
|
143
|
+
tooltipCoord = geom.getInteriorPoint().getCoordinates() || null;
|
|
144
|
+
} else if (geom instanceof LineString) {
|
|
145
|
+
output = formatLength(geom, projection, this.messages);
|
|
146
|
+
tooltipCoord = geom.getLastCoordinate() || null;
|
|
147
|
+
}
|
|
148
|
+
if (measureTooltip) {
|
|
149
|
+
measureTooltip.element.innerHTML = output;
|
|
150
|
+
if (tooltipCoord) {
|
|
151
|
+
measureTooltip?.overlay.setPosition(tooltipCoord);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
draw.on("drawend", () => {
|
|
157
|
+
if (measureTooltip) {
|
|
158
|
+
const classes = measureTooltip.element.classList;
|
|
159
|
+
classes.remove("measurement-active-tooltip");
|
|
160
|
+
classes.add("measurement-finished-tooltip");
|
|
161
|
+
measureTooltip.overlay.setOffset([0, -7]);
|
|
162
|
+
this.overlayTooltips.push(measureTooltip);
|
|
163
|
+
this.measureTooltip = measureTooltip = void 0;
|
|
164
|
+
}
|
|
165
|
+
this.sketch = void 0;
|
|
166
|
+
if (changeListenerKey) {
|
|
167
|
+
unByKey(changeListenerKey);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
draw.on("drawabort", () => {
|
|
171
|
+
if (measureTooltip) {
|
|
172
|
+
measureTooltip.destroy();
|
|
173
|
+
this.measureTooltip = measureTooltip = void 0;
|
|
174
|
+
}
|
|
175
|
+
this.sketch = void 0;
|
|
176
|
+
if (changeListenerKey) {
|
|
177
|
+
unByKey(changeListenerKey);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/** Stops the current measuring started by `startMeasurement`. */
|
|
182
|
+
stopMeasurement() {
|
|
183
|
+
if (this.draw) {
|
|
184
|
+
this.olMap.removeInteraction(this.draw);
|
|
185
|
+
this.draw.abortDrawing();
|
|
186
|
+
this.draw.dispose();
|
|
187
|
+
this.draw = void 0;
|
|
188
|
+
}
|
|
189
|
+
this.sketch = void 0;
|
|
190
|
+
this.measureTooltip?.destroy();
|
|
191
|
+
this.measureTooltip = void 0;
|
|
192
|
+
}
|
|
193
|
+
createMeasureTooltip() {
|
|
194
|
+
const element = document.createElement("div");
|
|
195
|
+
element.className = "measurement-tooltip measurement-active-tooltip";
|
|
196
|
+
const overlay = new Overlay({
|
|
197
|
+
element,
|
|
198
|
+
offset: [0, -15],
|
|
199
|
+
positioning: "bottom-center",
|
|
200
|
+
stopEvent: false,
|
|
201
|
+
insertFirst: false
|
|
202
|
+
});
|
|
203
|
+
const olMap = this.olMap;
|
|
204
|
+
olMap.addOverlay(overlay);
|
|
205
|
+
return {
|
|
206
|
+
overlay,
|
|
207
|
+
element,
|
|
208
|
+
destroy() {
|
|
209
|
+
olMap.removeOverlay(overlay);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
createHelpTooltip() {
|
|
214
|
+
const element = document.createElement("div");
|
|
215
|
+
element.className = "measurement-tooltip hidden";
|
|
216
|
+
const overlay = new Overlay({
|
|
217
|
+
element,
|
|
218
|
+
offset: [15, 0],
|
|
219
|
+
positioning: "center-left"
|
|
220
|
+
});
|
|
221
|
+
const olMap = this.olMap;
|
|
222
|
+
olMap.addOverlay(overlay);
|
|
223
|
+
return {
|
|
224
|
+
overlay,
|
|
225
|
+
element,
|
|
226
|
+
destroy() {
|
|
227
|
+
olMap.removeOverlay(overlay);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
handlePointerMove(evt) {
|
|
232
|
+
if (evt.dragging) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const tooltip = this.helpTooltip;
|
|
236
|
+
const helpMessage = getHelpMessage(this.messages, this.sketch);
|
|
237
|
+
tooltip.element.textContent = helpMessage;
|
|
238
|
+
tooltip.overlay.setPosition(evt.coordinate);
|
|
239
|
+
tooltip.element.classList.remove("hidden");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function getHelpMessage(messages, sketch) {
|
|
243
|
+
if (sketch) {
|
|
244
|
+
const geom = sketch.getGeometry();
|
|
245
|
+
if (geom instanceof Polygon || geom instanceof LineString) {
|
|
246
|
+
return messages.getContinueMessage();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return messages.getHelpMessage();
|
|
250
|
+
}
|
|
251
|
+
function formatArea(polygon, projection, messages) {
|
|
252
|
+
const area = getArea(polygon, { projection });
|
|
253
|
+
let output;
|
|
254
|
+
if (area >= 1e6) {
|
|
255
|
+
output = `${messages.formatNumber(area / 1e6)} km<sup>2</sup>`;
|
|
256
|
+
} else {
|
|
257
|
+
output = `${messages.formatNumber(area)} m<sup>2</sup>`;
|
|
258
|
+
}
|
|
259
|
+
return output;
|
|
260
|
+
}
|
|
261
|
+
function formatLength(line, projection, messages) {
|
|
262
|
+
const length = getLength(line, { projection });
|
|
263
|
+
let output;
|
|
264
|
+
if (length >= 1e3) {
|
|
265
|
+
output = `${messages.formatNumber(length / 1e3)} km`;
|
|
266
|
+
} else {
|
|
267
|
+
output = `${messages.formatNumber(length)} m`;
|
|
268
|
+
}
|
|
269
|
+
return output;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export { MeasurementController };
|
|
273
|
+
//# sourceMappingURL=MeasurementController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasurementController.js","sources":["MeasurementController.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Resource } from \"@open-pioneer/core\";\nimport Feature from \"ol/Feature\";\nimport OlMap from \"ol/Map\";\nimport MapBrowserEvent from \"ol/MapBrowserEvent\";\nimport { unByKey } from \"ol/Observable\";\nimport Overlay from \"ol/Overlay\";\nimport { Coordinate } from \"ol/coordinate\";\nimport { EventsKey } from \"ol/events\";\nimport { LineString, Polygon } from \"ol/geom\";\nimport Draw from \"ol/interaction/Draw\";\nimport { Vector as VectorLayer } from \"ol/layer\";\nimport { Vector as VectorSource } from \"ol/source\";\nimport { getArea, getLength } from \"ol/sphere\";\nimport { Projection } from \"ol/proj\";\nimport { StyleFunction, StyleLike, toFunction as toStyleFunction } from \"ol/style/Style\";\nimport { TOPMOST_LAYER_Z } from \"@open-pioneer/map\";\n\nexport type MeasurementType = \"area\" | \"distance\";\n\nexport interface Messages {\n getContinueMessage(): string;\n getHelpMessage(): string;\n formatNumber(value: number): string;\n}\n\nexport class MeasurementController {\n private olMap: OlMap;\n private messages: Messages;\n private activeFeatureStyle: StyleFunction | undefined;\n\n /**\n * The layer rendering the measurement \"features\".\n */\n private layer: VectorLayer<VectorSource>;\n\n /**\n * Source of {@link layer}.\n */\n private source: VectorSource;\n\n /**\n * Stores the current `Draw` interaction.\n */\n private draw: Draw | undefined = undefined;\n\n /**\n * Currently drawn feature.\n */\n private sketch: Feature | undefined = undefined;\n\n /**\n * The help tooltip element.\n */\n private helpTooltip: Tooltip;\n\n /**\n * The current measurement tooltip (if any).\n */\n private measureTooltip: Tooltip | undefined;\n\n /**\n * Overlays/Tooltip containing the tooltip for finished drawings.\n */\n private overlayTooltips: Tooltip[] = [];\n\n /**\n * Keeps track of registered event handlers.\n */\n private resources: Resource[] = [];\n\n constructor(olMap: OlMap, messages: Messages) {\n this.olMap = olMap;\n this.messages = messages;\n const source = (this.source = new VectorSource());\n this.layer = new VectorLayer({\n source\n });\n this.layer.setZIndex(TOPMOST_LAYER_Z);\n olMap.addLayer(this.layer);\n\n const pointerMoveKey = olMap.on(\"pointermove\", this.handlePointerMove.bind(this));\n this.resources.push({\n destroy() {\n unByKey(pointerMoveKey);\n }\n });\n\n const mouseOutHandler = () => {\n this.helpTooltip.element.classList.add(\"hidden\");\n };\n olMap.getViewport().addEventListener(\"mouseout\", mouseOutHandler);\n this.resources.push({\n destroy() {\n olMap.getViewport().removeEventListener(\"mouseout\", mouseOutHandler);\n }\n });\n\n this.helpTooltip = this.createHelpTooltip();\n }\n\n destroy() {\n this.stopMeasurement();\n\n // Cleanup registered event handlers etc.\n for (const resource of this.resources) {\n resource.destroy();\n }\n this.resources = [];\n\n // Cleanup tooltips\n this.helpTooltip.destroy();\n this.measureTooltip?.destroy();\n for (const tooltip of this.overlayTooltips) {\n tooltip.destroy();\n }\n this.overlayTooltips = [];\n\n // Cleanup layer\n this.olMap.removeLayer(this.layer);\n this.layer.dispose();\n this.source.dispose();\n }\n\n /** Returns the vector layer used for finished features. */\n getVectorLayer() {\n return this.layer;\n }\n\n /** Updates the style used for finished features. */\n setFinishedFeatureStyle(style: StyleLike) {\n this.layer.setStyle(style);\n }\n\n /** Updates the style used for active measurements. */\n setActiveFeatureStyle(style: StyleLike) {\n const styleFunction = toStyleFunction(style);\n this.activeFeatureStyle = (feature, ...args) => {\n const ft = feature?.getGeometry()?.getType();\n if (ft === \"Polygon\" || ft === \"LineString\" || ft === \"Point\") {\n return styleFunction(feature, ...args);\n }\n };\n // Update style on current draw instance (if any)\n this.draw?.getOverlay().setStyle(this.activeFeatureStyle);\n }\n\n /** Removes all finished measurements. */\n clearMeasurements() {\n this.source.clear();\n for (const tooltip of this.overlayTooltips) {\n tooltip.destroy();\n }\n this.overlayTooltips = [];\n }\n\n /** Starts measuring using the provided type. */\n startMeasurement(type: MeasurementType) {\n if (this.draw) {\n throw new Error(\"Internal error: another measurement interaction is still active.\");\n }\n\n const geometryType = type === \"area\" ? \"Polygon\" : \"LineString\";\n const draw = (this.draw = new Draw({\n source: this.source,\n type: geometryType,\n style: this.activeFeatureStyle\n }));\n this.olMap.addInteraction(draw);\n\n let measureTooltip: Tooltip | undefined;\n let changeListenerKey: EventsKey | undefined = undefined;\n draw.on(\"drawstart\", (evt) => {\n measureTooltip = this.measureTooltip = this.createMeasureTooltip();\n\n // set sketch\n const sketch = (this.sketch = evt.feature);\n if (!sketch) {\n return;\n }\n\n let tooltipCoord: Coordinate | undefined;\n changeListenerKey = sketch.getGeometry()?.on(\"change\", (evt) => {\n const geom = evt.target;\n const projection = this.olMap.getView().getProjection();\n\n let output = \"\";\n if (geom instanceof Polygon) {\n output = formatArea(geom, projection, this.messages);\n tooltipCoord = geom.getInteriorPoint().getCoordinates() || null;\n } else if (geom instanceof LineString) {\n output = formatLength(geom, projection, this.messages);\n tooltipCoord = geom.getLastCoordinate() || null;\n }\n\n if (measureTooltip) {\n measureTooltip.element.innerHTML = output;\n if (tooltipCoord) {\n measureTooltip?.overlay.setPosition(tooltipCoord);\n }\n }\n });\n });\n\n draw.on(\"drawend\", () => {\n if (measureTooltip) {\n // Make the tooltip (which was previously following the mouse)\n // static instead, next to the feature (last known overlay coordinate).\n const classes = measureTooltip.element.classList;\n classes.remove(\"measurement-active-tooltip\");\n classes.add(\"measurement-finished-tooltip\");\n measureTooltip.overlay.setOffset([0, -7]);\n\n this.overlayTooltips.push(measureTooltip);\n this.measureTooltip = measureTooltip = undefined;\n }\n\n // unset sketch\n this.sketch = undefined;\n if (changeListenerKey) {\n unByKey(changeListenerKey);\n }\n });\n\n draw.on(\"drawabort\", () => {\n if (measureTooltip) {\n measureTooltip.destroy();\n this.measureTooltip = measureTooltip = undefined;\n }\n\n this.sketch = undefined;\n if (changeListenerKey) {\n unByKey(changeListenerKey);\n }\n });\n }\n\n /** Stops the current measuring started by `startMeasurement`. */\n stopMeasurement() {\n if (this.draw) {\n this.olMap.removeInteraction(this.draw);\n this.draw.abortDrawing();\n this.draw.dispose();\n this.draw = undefined;\n }\n\n this.sketch = undefined;\n this.measureTooltip?.destroy();\n this.measureTooltip = undefined;\n }\n\n private createMeasureTooltip(): Tooltip {\n const element = document.createElement(\"div\");\n element.className = \"measurement-tooltip measurement-active-tooltip\";\n\n const overlay = new Overlay({\n element: element,\n offset: [0, -15],\n positioning: \"bottom-center\",\n stopEvent: false,\n insertFirst: false\n });\n\n const olMap = this.olMap;\n olMap.addOverlay(overlay);\n return {\n overlay,\n element,\n destroy() {\n olMap.removeOverlay(overlay);\n }\n };\n }\n\n private createHelpTooltip(): Tooltip {\n const element = document.createElement(\"div\");\n element.className = \"measurement-tooltip hidden\";\n\n const overlay = new Overlay({\n element: element,\n offset: [15, 0],\n positioning: \"center-left\"\n });\n\n const olMap = this.olMap;\n olMap.addOverlay(overlay);\n return {\n overlay,\n element,\n destroy() {\n olMap.removeOverlay(overlay);\n }\n };\n }\n\n private handlePointerMove(evt: MapBrowserEvent<UIEvent>) {\n if (evt.dragging) {\n return;\n }\n\n const tooltip = this.helpTooltip;\n const helpMessage = getHelpMessage(this.messages, this.sketch);\n tooltip.element.textContent = helpMessage;\n tooltip.overlay.setPosition(evt.coordinate);\n tooltip.element.classList.remove(\"hidden\");\n }\n}\n\n/** Represents a tooltip rendered on the OpenLayers map. */\ninterface Tooltip extends Resource {\n overlay: Overlay;\n element: HTMLDivElement;\n}\n\nfunction getHelpMessage(messages: Messages, sketch: Feature | undefined) {\n if (sketch) {\n const geom = sketch.getGeometry();\n if (geom instanceof Polygon || geom instanceof LineString) {\n return messages.getContinueMessage();\n }\n }\n return messages.getHelpMessage();\n}\n\nfunction formatArea(polygon: Polygon, projection: Projection, messages: Messages) {\n const area = getArea(polygon, { projection });\n let output;\n if (area >= 1000000) {\n output = `${messages.formatNumber(area / 1000000)} km<sup>2</sup>`;\n } else {\n output = `${messages.formatNumber(area)} m<sup>2</sup>`;\n }\n return output;\n}\n\nfunction formatLength(line: LineString, projection: Projection, messages: Messages) {\n const length = getLength(line, { projection });\n let output;\n if (length >= 1000) {\n output = `${messages.formatNumber(length / 1000)} km`;\n } else {\n output = `${messages.formatNumber(length)} m`;\n }\n return output;\n}\n"],"names":["VectorSource","VectorLayer","toStyleFunction","evt"],"mappings":";;;;;;;;;;AA2BO,MAAM,qBAAsB,CAAA;AAAA,EACvB,KAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAyB,GAAA,KAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKzB,MAA8B,GAAA,KAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAK9B,WAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,cAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,kBAA6B,EAAC,CAAA;AAAA;AAAA;AA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A,GAAS,CAAG,EAAA,QAAA,CAAS,YAAa,CAAA,IAAI,CAAC,CAAA,cAAA,CAAA,CAAA;AAAA,GAC3C;AACA,EAAO,OAAA,MAAA,CAAA;AACX,CAAA;AAEA,SAAS,YAAA,CAAa,IAAkB,EAAA,UAAA,EAAwB,QAAoB,EAAA;AAChF,EAAA,MAAM,MAAS,GAAA,SAAA,CAAU,IAAM,EAAA,EAAE,YAAY,CAAA,CAAA;AAC7C,EAAI,IAAA,MAAA,CAAA;AACJ,EAAA,IAAI,UAAU,GAAM,EAAA;AAChB,IAAA,MAAA,GAAS,CAAG,EAAA,QAAA,CAAS,YAAa,CAAA,MAAA,GAAS,GAAI,CAAC,CAAA,GAAA,CAAA,CAAA;AAAA,GAC7C,MAAA;AACH,IAAA,MAAA,GAAS,CAAG,EAAA,QAAA,CAAS,YAAa,CAAA,MAAM,CAAC,CAAA,EAAA,CAAA,CAAA;AAAA,GAC7C;AACA,EAAO,OAAA,MAAA,CAAA;AACX;;;;"}
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @open-pioneer/measurement
|
|
2
|
+
|
|
3
|
+
This package provides a UI component that allows the user to perform area and distance measurements on the map.
|
|
4
|
+
|
|
5
|
+
The UI contains a dropdown to switch between distance and area measurements and a button to delete all current measurements. The measurement unit is automatically selected appropriately.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
To integrate the measurement in your app, insert the following snippet and reference a map ID:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Measurement mapId="map_id" />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Configuring feature styles
|
|
16
|
+
|
|
17
|
+
To configure the style of the features drawn on the map, configure the optional `activeFeatureStyle` (for features that are currently being drawn) or `finishedFeatureStyle` (for completed features) properties:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Measurement mapId="map_id" activeFeatureStyle={...} finishedFeatureStyle={...} />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Both properties support arbitrary OpenLayers [`StyleLike`](https://openlayers.org/en/latest/apidoc/module-ol_style_Style.html#~StyleLike) values: you can configure either a single [Style](https://openlayers.org/en/latest/apidoc/module-ol_style_Style.html) instance, an array of them or a function computing such values.
|
|
24
|
+
|
|
25
|
+
As an example, the following configuration will render completed features using black color and active ones using red color:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Fill, Stroke, Style } from "ol/style";
|
|
29
|
+
import { Measurement } from "@open-pioneer/measurement";
|
|
30
|
+
|
|
31
|
+
const BLACK_STYLE = new Style({
|
|
32
|
+
stroke: new Stroke({
|
|
33
|
+
color: "black",
|
|
34
|
+
width: 5
|
|
35
|
+
}),
|
|
36
|
+
fill: new Fill({
|
|
37
|
+
color: "rgba(0, 0, 0, 0.25)"
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const RED_STYLE = new Style({
|
|
42
|
+
stroke: new Stroke({
|
|
43
|
+
color: "red",
|
|
44
|
+
width: 5
|
|
45
|
+
}),
|
|
46
|
+
fill: new Fill({
|
|
47
|
+
color: "rgba(255, 0, 0, 0.25)"
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
function AppUI() {
|
|
52
|
+
return (
|
|
53
|
+
// ...
|
|
54
|
+
<Measurement
|
|
55
|
+
mapId={MAP_ID}
|
|
56
|
+
activeFeatureStyle={RED_STYLE}
|
|
57
|
+
finishedFeatureStyle={BLACK_STYLE}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
Apache-2.0 (see `LICENSE` file)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useIntlInternal } from '@open-pioneer/runtime/react-integration';
|
|
2
|
+
|
|
3
|
+
const PACKAGE_NAME = "@open-pioneer/measurement";
|
|
4
|
+
const useIntl = /*@__PURE__*/ useIntlInternal.bind(undefined, PACKAGE_NAME);
|
|
5
|
+
|
|
6
|
+
export { useIntl };
|
|
7
|
+
//# sourceMappingURL=_virtual-pioneer-module_react-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_virtual-pioneer-module_react-hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/i18n/de.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
messages:
|
|
2
|
+
measurementLabel: "Modus"
|
|
3
|
+
distance: "Strecke"
|
|
4
|
+
area: "Fläche"
|
|
5
|
+
deleteMeasurementLabel: "Messungen löschen"
|
|
6
|
+
measurementInfoText: "Klicken Sie in die Karte, um eine Messung zu beginnen."
|
|
7
|
+
tooltips:
|
|
8
|
+
help: "Klicken, um mit der Messung zu beginnen."
|
|
9
|
+
continue: "Doppelt klicken, um die Messung zu beenden."
|
package/i18n/en.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
messages:
|
|
2
|
+
measurementLabel: "Mode"
|
|
3
|
+
distance: "Distance"
|
|
4
|
+
area: "Area"
|
|
5
|
+
deleteMeasurementLabel: "Delete measurements"
|
|
6
|
+
measurementInfoText: "Click in the map to start a measurement."
|
|
7
|
+
tooltips:
|
|
8
|
+
help: "Click to start measuring."
|
|
9
|
+
continue: "Double click to end the measurement."
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Measurement, type MeasurementProps } from "./Measurement";
|
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/measurement.css
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.measurement-tooltip {
|
|
2
|
+
position: relative;
|
|
3
|
+
background: rgba(255, 255, 255, 0.8);
|
|
4
|
+
border-radius: 4px;
|
|
5
|
+
color: black;
|
|
6
|
+
padding: 4px 8px;
|
|
7
|
+
opacity: 1;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
cursor: default;
|
|
11
|
+
user-select: none;
|
|
12
|
+
font-weight: bold;
|
|
13
|
+
}
|
|
14
|
+
.measurement-active-tooltip {
|
|
15
|
+
background: rgba(0, 0, 0, 0.9);
|
|
16
|
+
border-radius: 4px;
|
|
17
|
+
border-color: rgba(0, 0, 0, 0.9);
|
|
18
|
+
opacity: 0.9;
|
|
19
|
+
color: white;
|
|
20
|
+
}
|
|
21
|
+
.measurement-finished-tooltip {
|
|
22
|
+
background-color: rgba(76, 179, 255, 0.9);
|
|
23
|
+
color: black;
|
|
24
|
+
border: 1px solid white;
|
|
25
|
+
}
|
|
26
|
+
.measurement-active-tooltip:before,
|
|
27
|
+
.measurement-finished-tooltip:before {
|
|
28
|
+
border-top: 6px solid rgba(0, 0, 0, 0.9);
|
|
29
|
+
border-right: 6px solid transparent;
|
|
30
|
+
border-left: 6px solid transparent;
|
|
31
|
+
content: "";
|
|
32
|
+
position: absolute;
|
|
33
|
+
bottom: -6px;
|
|
34
|
+
margin-left: -7px;
|
|
35
|
+
left: 50%;
|
|
36
|
+
}
|
|
37
|
+
.measurement-finished-tooltip:before {
|
|
38
|
+
border-top-color: #4cb3ff;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*# sourceMappingURL=measurement.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["measurement.css"],"names":[],"mappings":"AAAA;IACI,kBAAkB;IAClB,oCAAoC;IACpC,kBAAkB;IAClB,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,mBAAmB;IACnB,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,iBAAiB;AACrB;AACA;IACI,8BAA8B;IAC9B,kBAAkB;IAClB,gCAAgC;IAChC,YAAY;IACZ,YAAY;AAChB;AACA;IACI,yCAAyC;IACzC,YAAY;IACZ,uBAAuB;AAC3B;AACA;;IAEI,wCAAwC;IACxC,mCAAmC;IACnC,kCAAkC;IAClC,WAAW;IACX,kBAAkB;IAClB,YAAY;IACZ,iBAAiB;IACjB,SAAS;AACb;AACA;IACI,yBAAyB;AAC7B","file":"measurement.css","sourcesContent":[".measurement-tooltip {\n position: relative;\n background: rgba(255, 255, 255, 0.8);\n border-radius: 4px;\n color: black;\n padding: 4px 8px;\n opacity: 1;\n white-space: nowrap;\n font-size: 12px;\n cursor: default;\n user-select: none;\n font-weight: bold;\n}\n.measurement-active-tooltip {\n background: rgba(0, 0, 0, 0.9);\n border-radius: 4px;\n border-color: rgba(0, 0, 0, 0.9);\n opacity: 0.9;\n color: white;\n}\n.measurement-finished-tooltip {\n background-color: rgba(76, 179, 255, 0.9);\n color: black;\n border: 1px solid white;\n}\n.measurement-active-tooltip:before,\n.measurement-finished-tooltip:before {\n border-top: 6px solid rgba(0, 0, 0, 0.9);\n border-right: 6px solid transparent;\n border-left: 6px solid transparent;\n content: \"\";\n position: absolute;\n bottom: -6px;\n margin-left: -7px;\n left: 50%;\n}\n.measurement-finished-tooltip:before {\n border-top-color: #4cb3ff;\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "@open-pioneer/measurement",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@open-pioneer/chakra-integration": "^1.1.0",
|
|
8
|
+
"@open-pioneer/runtime": "^1.1.0",
|
|
9
|
+
"ol": "^8.2.0",
|
|
10
|
+
"react": "^18.2.0",
|
|
11
|
+
"classnames": "^2.3.2",
|
|
12
|
+
"@open-pioneer/map": "^0.1.0",
|
|
13
|
+
"@open-pioneer/react-utils": "^0.1.0"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": "./package.json",
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./index.js",
|
|
19
|
+
"types": "./index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./measurement.css": "./measurement.css"
|
|
22
|
+
},
|
|
23
|
+
"openPioneerFramework": {
|
|
24
|
+
"styles": "./measurement.css",
|
|
25
|
+
"services": [],
|
|
26
|
+
"i18n": {
|
|
27
|
+
"languages": [
|
|
28
|
+
"en",
|
|
29
|
+
"de"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"ui": {
|
|
33
|
+
"references": []
|
|
34
|
+
},
|
|
35
|
+
"properties": [],
|
|
36
|
+
"packageFormatVersion": "1.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|