@openremote/or-map 1.8.0-snapshot.20250725074716 → 1.8.0-snapshot.20250725120000
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/@types/maplibre-gl-geocoder.d.ts +2 -2
- package/README.md +113 -113
- package/dist/umd/index.bundle.js +915 -915
- package/dist/umd/index.bundle.js.map +1 -1
- package/dist/umd/index.js +915 -915
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.orbundle.js +974 -974
- package/dist/umd/index.orbundle.js.map +1 -1
- package/lib/index.js +519 -39
- package/lib/mapbox-url-utils.js +66 -1
- package/lib/mapwidget.js +885 -1
- package/lib/markers/or-map-marker-asset.js +178 -1
- package/lib/markers/or-map-marker.js +335 -80
- package/lib/or-map-asset-card.js +167 -18
- package/lib/style.js +242 -235
- package/lib/util.js +100 -1
- package/package.json +8 -8
package/lib/style.js
CHANGED
|
@@ -1,235 +1,242 @@
|
|
|
1
|
-
import{css
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
--internal-or-map-
|
|
9
|
-
--internal-or-map-
|
|
10
|
-
--internal-or-map-marker-
|
|
11
|
-
--internal-or-map-marker-
|
|
12
|
-
--internal-or-map-marker-
|
|
13
|
-
--internal-or-map-marker-
|
|
14
|
-
--internal-or-map-marker-
|
|
15
|
-
--internal-or-map-marker-
|
|
16
|
-
--internal-or-map-marker-
|
|
17
|
-
--internal-or-map-marker-
|
|
18
|
-
--internal-or-map-marker-
|
|
19
|
-
--internal-or-map-marker-
|
|
20
|
-
--internal-or-map-marker-
|
|
21
|
-
--internal-or-map-marker-
|
|
22
|
-
--internal-or-map-marker-
|
|
23
|
-
--internal-or-map-marker-
|
|
24
|
-
--internal-or-map-marker-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.maplibregl-ctrl-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
--or-icon-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.or-map-marker .marker-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
--or-
|
|
176
|
-
--or-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
text-align: right;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
1
|
+
import { css, unsafeCSS } from "lit";
|
|
2
|
+
import { DefaultColor1, DefaultColor2, DefaultColor3, DefaultColor4, DefaultColor5, DefaultHeaderHeight } from "@openremote/core";
|
|
3
|
+
export const markerColorVar = "--internal-or-map-marker-color";
|
|
4
|
+
export const markerActiveColorVar = "--internal-or-map-marker-active-color";
|
|
5
|
+
// language=CSS
|
|
6
|
+
export const style = css `
|
|
7
|
+
:host {
|
|
8
|
+
--internal-or-map-width: var(--or-map-width, 100%);
|
|
9
|
+
--internal-or-map-min-height: var(--or-map-min-height, 300px);
|
|
10
|
+
--internal-or-map-marker-transform: var(--or-map-marker-transform, translate(-16px, -29px));
|
|
11
|
+
--internal-or-map-marker-width: var(--or-map-marker-width, 32px);
|
|
12
|
+
--internal-or-map-marker-height: var(--or-map-marker-height, 32px);
|
|
13
|
+
--internal-or-map-marker-color: var(--or-map-marker-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
|
|
14
|
+
--internal-or-map-marker-stroke: var(--or-map-marker-stroke, none);
|
|
15
|
+
--internal-or-map-marker-icon-color: var(--or-map-marker-icon-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
|
|
16
|
+
--internal-or-map-marker-icon-stroke: var(--or-map-marker-icon-stroke, none);
|
|
17
|
+
--internal-or-map-marker-icon-width: var(--or-map-marker-icon-width, 16px);
|
|
18
|
+
--internal-or-map-marker-icon-height: var(--or-map-marker-icon-height, 16px);
|
|
19
|
+
--internal-or-map-marker-icon-transform: var(--or-map-marker-icon-transform, translate(-50%, -14px));
|
|
20
|
+
--internal-or-map-marker-active-transform: var(--or-map-marker-active-transform, translate(-24px, -44px));
|
|
21
|
+
--internal-or-map-marker-active-width: var(--or-map-marker-active-width, 48px);
|
|
22
|
+
--internal-or-map-marker-active-height: var(--or-map-marker-active-height, 48px);
|
|
23
|
+
--internal-or-map-marker-active-color: var(--or-map-marker-active-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
|
|
24
|
+
--internal-or-map-marker-active-stroke: var(--or-map-marker-active-stroke, 2px);
|
|
25
|
+
--internal-or-map-marker-icon-active-color: var(--or-map-marker-icon-active-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
|
|
26
|
+
--internal-or-map-marker-icon-active-stroke: var(--or-map-marker-icon-active-stroke, none);
|
|
27
|
+
--internal-or-map-marker-icon-active-width: var(--or-map-marker-icon-active-width, 24px);
|
|
28
|
+
--internal-or-map-marker-icon-active-height: var(--or-map-marker-icon-active-height, 24px);
|
|
29
|
+
--internal-or-map-marker-icon-active-transform: var(--or-map-marker-icon-active-transform, translate(-50%, -20px));
|
|
30
|
+
display: block;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
|
|
33
|
+
min-height: var(--internal-or-map-min-height);
|
|
34
|
+
width: var(--internal-or-map-width);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
canvas {
|
|
38
|
+
outline: none !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([hidden]) {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
slot {
|
|
46
|
+
display: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#container {
|
|
50
|
+
position: relative;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#map {
|
|
56
|
+
position: absolute;
|
|
57
|
+
left: 0;
|
|
58
|
+
right: 0;
|
|
59
|
+
top: 0;
|
|
60
|
+
bottom: 0;
|
|
61
|
+
}
|
|
62
|
+
.mapboxgl-ctrl-geocoder,
|
|
63
|
+
.maplibregl-ctrl-geocoder--input {
|
|
64
|
+
width: calc(100% - 20px)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Prevents overflow from elements outside the map component (like menu overlays). See #1844 */
|
|
68
|
+
.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right {
|
|
69
|
+
z-index: 1;
|
|
70
|
+
}
|
|
71
|
+
.leaflet-marker-icon, .maplibregl-marker, .mapboxgl-marker {
|
|
72
|
+
pointer-events: none !important;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.or-map-marker {
|
|
76
|
+
position: absolute; /* This makes mapboxJS behave like mapboxGL */
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.or-map-marker.active {
|
|
80
|
+
z-index: 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.marker-container {
|
|
84
|
+
position: relative;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
transform: var(--internal-or-map-marker-transform);
|
|
87
|
+
--or-icon-fill: var(--internal-or-map-marker-color);
|
|
88
|
+
--or-icon-width: var(--internal-or-map-marker-width);
|
|
89
|
+
--or-icon-height: var(--internal-or-map-marker-height);
|
|
90
|
+
--or-icon-stroke: var(--internal-or-map-marker-stroke);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.or-map-marker.active .marker-container {
|
|
94
|
+
transform: var(--internal-or-map-marker-active-transform);
|
|
95
|
+
--or-icon-fill: var(--internal-or-map-marker-active-color);
|
|
96
|
+
--or-icon-width: var(--internal-or-map-marker-active-width);
|
|
97
|
+
--or-icon-height: var(--internal-or-map-marker-active-height);
|
|
98
|
+
--or-icon-stroke: var(--internal-or-map-marker-active-stroke);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.or-map-marker.interactive .marker-container {
|
|
102
|
+
pointer-events: all;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.or-map-marker-default.interactive .marker-container {
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
--or-icon-pointer-events: visible;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.or-map-marker .marker-icon {
|
|
111
|
+
position: absolute;
|
|
112
|
+
left: 50%;
|
|
113
|
+
top: 50%;
|
|
114
|
+
z-index: 1000;
|
|
115
|
+
--or-icon-fill: var(--internal-or-map-marker-icon-color);
|
|
116
|
+
--or-icon-stroke: var(--internal-or-map-marker-icon-stroke);
|
|
117
|
+
--or-icon-width: var(--internal-or-map-marker-icon-width);
|
|
118
|
+
--or-icon-height: var(--internal-or-map-marker-icon-height);
|
|
119
|
+
transform: var(--internal-or-map-marker-icon-transform);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.or-map-marker.active .marker-icon {
|
|
123
|
+
transform: var(--internal-or-map-marker-icon-active-transform);
|
|
124
|
+
--or-icon-fill: var(--internal-or-map-marker-icon-active-color);
|
|
125
|
+
--or-icon-stroke: var(--internal-or-map-marker-icon-active-stroke);
|
|
126
|
+
--or-icon-width: var(--internal-or-map-marker-icon-active-width);
|
|
127
|
+
--or-icon-height: var(--internal-or-map-marker-icon-active-height);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
#openremote {
|
|
131
|
+
position: absolute;
|
|
132
|
+
bottom: 25px;
|
|
133
|
+
right: 5px;
|
|
134
|
+
height: 20px;
|
|
135
|
+
width: 20px;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#openremote img {
|
|
140
|
+
height: 20px;
|
|
141
|
+
width: 20px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@media only screen and (max-width: 640px) {
|
|
145
|
+
#openremote {
|
|
146
|
+
bottom: 40px;
|
|
147
|
+
right: 12px;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
`;
|
|
151
|
+
export const mapAssetCardStyle = css `
|
|
152
|
+
:host {
|
|
153
|
+
--internal-or-map-asset-card-header-color: var(--or-map-asset-card-header-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));
|
|
154
|
+
--internal-or-map-asset-card-header-text-color: var(--or-map-asset-card-header-text-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
|
|
155
|
+
--internal-or-map-asset-card-header-height: var(--or-map-asset-card-header-height, calc(${unsafeCSS(DefaultHeaderHeight)} - 10px));
|
|
156
|
+
--internal-or-map-asset-card-background-color: var(--or-map-asset-card-background-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));
|
|
157
|
+
--internal-or-map-asset-card-background-text-color: var(--or-map-asset-card-background-text-color, var(--or-app-color3, ${unsafeCSS(DefaultColor3)}));
|
|
158
|
+
--internal-or-map-asset-card-separator-color: var(--or-map-asset-card-separator-color, var(--or-app-color2, ${unsafeCSS(DefaultColor2)}));
|
|
159
|
+
|
|
160
|
+
display: block;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#card-container {
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
height: 100%;
|
|
167
|
+
background-color: var(--internal-or-map-asset-card-background-color);
|
|
168
|
+
-webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
169
|
+
-moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
170
|
+
box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
#header {
|
|
174
|
+
height: var(--internal-or-map-asset-card-header-height);
|
|
175
|
+
background-color: var(--internal-or-map-asset-card-header-color);
|
|
176
|
+
line-height: var(--internal-or-map-asset-card-header-height);
|
|
177
|
+
border-bottom: 1px solid ${unsafeCSS(DefaultColor5)};
|
|
178
|
+
text-align: center;
|
|
179
|
+
color: var(--internal-or-map-asset-card-header-text-color);
|
|
180
|
+
--or-icon-fill: var(--internal-or-map-asset-card-header-text-color);
|
|
181
|
+
--or-icon-width: 20px;
|
|
182
|
+
--or-icon-height: 20px;
|
|
183
|
+
z-index: 99999;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#header > or-icon {
|
|
187
|
+
margin-right: 5px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
#title {
|
|
191
|
+
font-weight: 500;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
#attribute-list {
|
|
195
|
+
flex: 1;
|
|
196
|
+
color: var(--internal-or-map-asset-card-background-text-color);
|
|
197
|
+
padding: 10px 20px;
|
|
198
|
+
overflow: auto;
|
|
199
|
+
font-size: 14px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
ul {
|
|
203
|
+
list-style-type: none;
|
|
204
|
+
margin: 0;
|
|
205
|
+
padding: 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
li {
|
|
209
|
+
display: flex;
|
|
210
|
+
line-height: 30px;
|
|
211
|
+
}
|
|
212
|
+
li.highlighted {
|
|
213
|
+
font-weight: bold;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.attribute-name {
|
|
217
|
+
flex: 1;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.attribute-value {
|
|
221
|
+
overflow: hidden;
|
|
222
|
+
padding-left: 20px;
|
|
223
|
+
text-align: right;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
#footer {
|
|
227
|
+
height: var(--internal-or-map-asset-card-header-height);
|
|
228
|
+
border-top: 1px solid var(--internal-or-map-asset-card-separator-color);
|
|
229
|
+
text-align: right;
|
|
230
|
+
padding: 5px 12px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media only screen and (min-width: 40em){
|
|
234
|
+
#card-container {
|
|
235
|
+
height: 400px; /* fallback for IE */
|
|
236
|
+
height: max-content;
|
|
237
|
+
max-height: calc(100vh - 150px);
|
|
238
|
+
min-height: 134px;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`;
|
|
242
|
+
//# sourceMappingURL=style.js.map
|
package/lib/util.js
CHANGED
|
@@ -1 +1,100 @@
|
|
|
1
|
-
import{LngLat
|
|
1
|
+
import { LngLat, LngLatBounds } from "maplibre-gl";
|
|
2
|
+
import { AssetModelUtil } from "@openremote/model";
|
|
3
|
+
export function getLngLat(lngLatLike) {
|
|
4
|
+
if (!lngLatLike) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (lngLatLike instanceof LngLat) {
|
|
8
|
+
return lngLatLike;
|
|
9
|
+
}
|
|
10
|
+
if (lngLatLike.lat) {
|
|
11
|
+
if (lngLatLike.lon) {
|
|
12
|
+
return { lng: lngLatLike.lon, lat: lngLatLike.lat };
|
|
13
|
+
}
|
|
14
|
+
return { lng: lngLatLike.lng, lat: lngLatLike.lat };
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(lngLatLike)) {
|
|
17
|
+
return { lng: lngLatLike[0], lat: lngLatLike[1] };
|
|
18
|
+
}
|
|
19
|
+
if (lngLatLike.coordinates && Array.isArray(lngLatLike.coordinates) && lngLatLike.coordinates.length >= 2) {
|
|
20
|
+
return getLngLat(lngLatLike.coordinates);
|
|
21
|
+
}
|
|
22
|
+
if (lngLatLike.attributes) {
|
|
23
|
+
// This is an asset
|
|
24
|
+
const locationAttribute = lngLatLike.attributes["location" /* WellknownAttributes.LOCATION */];
|
|
25
|
+
if (!locationAttribute) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (locationAttribute.value) {
|
|
29
|
+
return getLngLat(locationAttribute.value);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (lngLatLike.value) {
|
|
34
|
+
return getLngLat(lngLatLike.value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function getGeoJSONPoint(lngLat) {
|
|
38
|
+
if (!lngLat) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return Array.isArray(lngLat) ? { type: "Point", coordinates: lngLat } : { type: "Point", coordinates: [lngLat.hasOwnProperty("lng") ? lngLat.lng : lngLat.lon, lngLat.lat] };
|
|
42
|
+
}
|
|
43
|
+
export function getLngLatBounds(lngLatBoundsLike) {
|
|
44
|
+
if (lngLatBoundsLike) {
|
|
45
|
+
if (lngLatBoundsLike instanceof LngLatBounds) {
|
|
46
|
+
return lngLatBoundsLike;
|
|
47
|
+
}
|
|
48
|
+
const arr = lngLatBoundsLike;
|
|
49
|
+
if (arr.length === 2) {
|
|
50
|
+
const sw = getLngLat(arr[0]);
|
|
51
|
+
const ne = getLngLat(arr[1]);
|
|
52
|
+
if (sw && ne) {
|
|
53
|
+
return new LngLatBounds(sw, ne);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (arr.length === 4) {
|
|
57
|
+
return new LngLatBounds([arr[0], arr[1], arr[2], arr[3]]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function getLatLngBounds(lngLatBoundsLike) {
|
|
62
|
+
const lngLatBounds = getLngLatBounds(lngLatBoundsLike);
|
|
63
|
+
if (lngLatBounds) {
|
|
64
|
+
return L.latLngBounds(lngLatBounds.getNorthEast(), lngLatBounds.getSouthWest());
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function getMarkerIconAndColorFromAssetType(type, configOverrideSettings) {
|
|
68
|
+
if (!type) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const descriptor = typeof (type) === "string" ? AssetModelUtil.getAssetDescriptor(type) : type;
|
|
72
|
+
const icon = descriptor && descriptor.icon ? descriptor.icon : "help-circle";
|
|
73
|
+
let colour = descriptor && descriptor.colour ? descriptor.colour : undefined;
|
|
74
|
+
if (configOverrideSettings) {
|
|
75
|
+
if (configOverrideSettings.markerConfig) {
|
|
76
|
+
const colourConfig = configOverrideSettings.markerConfig;
|
|
77
|
+
const attrVal = configOverrideSettings.currentValue;
|
|
78
|
+
if (colourConfig.type === "range" && colourConfig.ranges && typeof attrVal === "number") {
|
|
79
|
+
const ranges = colourConfig.ranges;
|
|
80
|
+
// see in what range the attrVal fits and if not, what the setting for the highest range is
|
|
81
|
+
const colourFromRange = ranges.sort((a, b) => b.min - a.min).find(r => attrVal >= r.min) || ranges.reduce((a, b) => (b.min > a.min) ? a : b);
|
|
82
|
+
colour = colourFromRange.colour || undefined;
|
|
83
|
+
}
|
|
84
|
+
else if (colourConfig.type === "boolean") {
|
|
85
|
+
const value = !!attrVal + "";
|
|
86
|
+
colour = colourConfig[value];
|
|
87
|
+
}
|
|
88
|
+
else if (colourConfig.type === "string") {
|
|
89
|
+
const value = attrVal + "";
|
|
90
|
+
colour = colourConfig[value];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// todo icon override
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
color: colour,
|
|
97
|
+
icon: icon
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=util.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openremote/or-map",
|
|
3
|
-
"version": "1.8.0-snapshot.
|
|
3
|
+
"version": "1.8.0-snapshot.20250725120000",
|
|
4
4
|
"description": "Displays s vector or raster map",
|
|
5
5
|
"customElements": "custom-elements.json",
|
|
6
6
|
"main": "dist/umd/index.bundle.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"license": "AGPL-3.0-or-later",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@maplibre/maplibre-gl-geocoder": "^1.5.0",
|
|
23
|
-
"@openremote/core": "1.8.0-snapshot.
|
|
24
|
-
"@openremote/model": "1.8.0-snapshot.
|
|
25
|
-
"@openremote/or-icon": "1.8.0-snapshot.
|
|
26
|
-
"@openremote/or-mwc-components": "1.8.0-snapshot.
|
|
27
|
-
"@openremote/or-translate": "1.8.0-snapshot.
|
|
28
|
-
"@openremote/rest": "1.8.0-snapshot.
|
|
23
|
+
"@openremote/core": "1.8.0-snapshot.20250725120000",
|
|
24
|
+
"@openremote/model": "1.8.0-snapshot.20250725120000",
|
|
25
|
+
"@openremote/or-icon": "1.8.0-snapshot.20250725120000",
|
|
26
|
+
"@openremote/or-mwc-components": "1.8.0-snapshot.20250725120000",
|
|
27
|
+
"@openremote/or-translate": "1.8.0-snapshot.20250725120000",
|
|
28
|
+
"@openremote/rest": "1.8.0-snapshot.20250725120000",
|
|
29
29
|
"@polymer/polymer": "^3.3.1",
|
|
30
30
|
"@types/mapbox": "^1.6.42",
|
|
31
31
|
"lit": "^2.0.2",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"maplibre-gl": "^4.1.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@openremote/util": "1.8.0-snapshot.
|
|
36
|
+
"@openremote/util": "1.8.0-snapshot.20250725120000",
|
|
37
37
|
"@types/geojson": "^7946.0.7"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|