@m4l/gclick 0.3.7 → 0.3.8
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/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts +3 -2
- package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts.map +1 -1
- package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.js +16 -20
- package/components/index.d.ts +1 -0
- package/components/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/constants.d.ts +1 -0
- package/components/maps/components/GpsMap/constants.d.ts.map +1 -1
- package/components/maps/components/GpsMap/constants.js +16 -14
- package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts +2 -1
- package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts +28 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.js +111 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts +9 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.js +183 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts +112 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.js +87 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts +10 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.js +12 -0
- package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts +2 -1
- package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts +6 -2
- package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/store.js +301 -123
- package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts +191 -20
- package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/types.js +8 -0
- package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.js +93 -124
- package/components/maps/components/GpsMap/hooks/index.d.ts +3 -0
- package/components/maps/components/GpsMap/hooks/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts +12 -0
- package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.js +29 -0
- package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts +1 -4
- package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/hooks/useAutoFocus/index.js +32 -59
- package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts +4 -13
- package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts.map +1 -1
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts +7 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.js +42 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts +19 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts +12 -0
- package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.js +43 -0
- package/components/maps/components/GpsMap/index.d.ts +1 -0
- package/components/maps/components/GpsMap/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts +5 -0
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.js +20 -13
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts +4 -3
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.js +175 -120
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts +6 -0
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.js +26 -12
- package/components/maps/components/GpsMap/subcomponents/LayersContainer/subcomponents/Layer/Layer.js +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts +6 -0
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.js +38 -26
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useDatagridFiltered.js +26 -26
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useFilterAndSort/useFilterAndSort.js +27 -27
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useMaster.js +4 -4
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.js +34 -28
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.js +41 -36
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useTabFiltered.js +17 -17
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.js +16 -18
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +3 -2
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.js +136 -92
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.js +29 -23
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.js +60 -95
- package/components/maps/index.d.ts +1 -0
- package/components/maps/index.d.ts.map +1 -1
- package/index.js +143 -136
- package/package.json +3 -4
|
@@ -1,185 +1,174 @@
|
|
|
1
|
-
import { createStore as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
1
|
+
import { createStore as J } from "zustand";
|
|
2
|
+
import { immer as x } from "zustand/middleware/immer";
|
|
3
|
+
import { INTERACTION_CHANNELS as E } from "./types.js";
|
|
4
|
+
import { createDevtools as P, isValidViewportBounds as V, createViewportActionResult as u, resolveMoveToBoundsOptions as Z, getAllowedViewportMap as L, runViewportActionSafely as b, isValidViewportPoint as j, resolveSmartMoveToPointOptions as R, resolveMoveToPointOptions as D, areInteractionChannelsAvailable as C, releaseOwnedInteractionChannels as S, invalidateViewportSizeIfNeeded as O, isBoundsViewportAlreadyApplied as _, isPointViewportAlreadyApplied as M } from "./helpers/helpers.js";
|
|
5
|
+
import { runToolCommand as w, unregisterToolController as $, registerToolController as z } from "./helpers/toolControllerRegistry.js";
|
|
6
|
+
import m from "lodash-es/cloneDeep";
|
|
7
|
+
import A from "lodash-es/merge";
|
|
8
|
+
import { TILE_LAYER_OTHERS as N } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/others.js";
|
|
9
|
+
import { TILE_SORCE_GOOGLE as q } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/google.js";
|
|
10
|
+
import { TILE_LAYER_BING as k } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/bing.js";
|
|
11
|
+
import { refreshLayerDataBounds as f } from "./helpers/layerDataBounds.js";
|
|
12
|
+
import { getFeatureFromLayer as F, resolveObservableFeatureSnapTarget as G, resolveObservableFeaturePick as H, resolveObservableFeatureAnchor as W, isObservableFeatureEventEnabled as Y } from "./helpers/featureObservability.js";
|
|
13
|
+
const ue = (g, B = !1) => {
|
|
14
|
+
const I = {
|
|
15
15
|
currentMapSourceLayer: {
|
|
16
16
|
mapSourceId: "google",
|
|
17
17
|
mapSourceLayerId: "streets"
|
|
18
18
|
},
|
|
19
|
-
mapSources: [
|
|
19
|
+
mapSources: [q, k, N],
|
|
20
20
|
layersIds: [],
|
|
21
21
|
hashLayers: {},
|
|
22
22
|
autoFocusLayers: !0,
|
|
23
23
|
selectedFeature: null,
|
|
24
|
-
|
|
24
|
+
interactionOwnership: {
|
|
25
|
+
ownersByChannel: {}
|
|
26
|
+
},
|
|
27
|
+
...g
|
|
25
28
|
};
|
|
26
|
-
let
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
let h = null;
|
|
30
|
+
const p = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
31
|
+
let T = 0;
|
|
32
|
+
return J(
|
|
33
|
+
P(
|
|
34
|
+
x((s, n) => ({
|
|
35
|
+
...I,
|
|
32
36
|
mapActions: {
|
|
33
37
|
/**
|
|
34
38
|
* TODO: Documentar
|
|
35
39
|
*/
|
|
36
40
|
init: (e) => {
|
|
37
|
-
|
|
38
|
-
for (let
|
|
39
|
-
|
|
41
|
+
s((o) => {
|
|
42
|
+
for (let r = 0; r < e.length; r++)
|
|
43
|
+
o.hashLayers[e[r].layerId] = m(e[r]), f(o.hashLayers[e[r].layerId]), o.layersIds.push(e[r].layerId);
|
|
40
44
|
});
|
|
41
45
|
},
|
|
42
46
|
/**
|
|
43
47
|
* Actualiza el ref del mapa
|
|
44
48
|
*/
|
|
45
49
|
setMapRef: (e) => {
|
|
46
|
-
|
|
50
|
+
h = e;
|
|
47
51
|
},
|
|
48
52
|
/**
|
|
49
53
|
* Retorna el ref del mapa
|
|
50
54
|
*/
|
|
51
|
-
getMap: () =>
|
|
55
|
+
getMap: () => h,
|
|
52
56
|
/**
|
|
53
57
|
* Actualiza la información transversal a todas las capas.
|
|
54
58
|
*/
|
|
55
59
|
setMapData: (e) => {
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
s((o) => {
|
|
61
|
+
o.hasMapData = { ...o.hasMapData, ...e };
|
|
58
62
|
});
|
|
59
63
|
},
|
|
60
64
|
/**
|
|
61
65
|
* Modifica toda la capa, reemplanzando todo el geoJson
|
|
62
66
|
*/
|
|
63
|
-
setDataLayer: (e, r) => {
|
|
64
|
-
if (!
|
|
67
|
+
setDataLayer: (e, o, r) => {
|
|
68
|
+
if (!n().hashLayers[e])
|
|
65
69
|
throw new Error(`Layer with id ${e} not found`);
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
70
|
+
s((t) => {
|
|
71
|
+
const a = t.hashLayers[e];
|
|
72
|
+
a.geoJsonObject = o, a.dataBoundsOverride = r?.dataBoundsOverride, f(a);
|
|
69
73
|
});
|
|
70
74
|
},
|
|
71
75
|
/**
|
|
72
76
|
* Modifica la capa, mezclando el geoJson actual con el nuevo
|
|
73
77
|
*/
|
|
74
|
-
mergeDataLayer: (e, r) => {
|
|
75
|
-
if (!
|
|
78
|
+
mergeDataLayer: (e, o, r) => {
|
|
79
|
+
if (!n().hashLayers[e])
|
|
76
80
|
throw new Error(`Layer with id ${e} not found`);
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
81
|
+
s((t) => {
|
|
82
|
+
const a = t.hashLayers[e];
|
|
83
|
+
a.geoJsonObject = A(a.geoJsonObject, o), a.dataBoundsOverride = r?.dataBoundsOverride, f(a);
|
|
80
84
|
});
|
|
81
85
|
},
|
|
82
86
|
/**
|
|
83
87
|
* TODO: Documentar
|
|
84
88
|
*/
|
|
85
89
|
getFeatureIds: (e) => {
|
|
86
|
-
if (!
|
|
90
|
+
if (!n().hashLayers[e])
|
|
87
91
|
throw new Error(`Layer with id ${e} not found`);
|
|
88
|
-
const
|
|
89
|
-
return
|
|
92
|
+
const o = n().hashLayers[e]?.geoJsonObject;
|
|
93
|
+
return o && o.object.type === "Feature" ? [o.object.id] : o && o.object.type === "FeatureCollection" ? o.object.features.map((r) => r.id) : [];
|
|
90
94
|
},
|
|
91
95
|
/**
|
|
92
96
|
* TODO: Documentar
|
|
93
97
|
*/
|
|
94
|
-
setFeatureData: (e, r,
|
|
95
|
-
if (!
|
|
98
|
+
setFeatureData: (e, o, r, t, a, i) => {
|
|
99
|
+
if (!n().hashLayers[e])
|
|
96
100
|
throw new Error(`Layer with id ${e} not found`);
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
let
|
|
101
|
-
|
|
101
|
+
s((l) => {
|
|
102
|
+
if (l.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
|
|
103
|
+
const c = l.hashLayers[e].geoJsonObject?.object;
|
|
104
|
+
let d = c.features.find((y) => y.id === o);
|
|
105
|
+
d ? (d.geometry = m(r), d.properties = A(d.properties, t)) : (d = {
|
|
102
106
|
type: "Feature",
|
|
103
|
-
geometry:
|
|
104
|
-
id:
|
|
105
|
-
properties:
|
|
106
|
-
},
|
|
107
|
-
} else if (
|
|
108
|
-
const
|
|
109
|
-
|
|
107
|
+
geometry: r,
|
|
108
|
+
id: o,
|
|
109
|
+
properties: t
|
|
110
|
+
}, c.features.push(d));
|
|
111
|
+
} else if (l.hashLayers[e].geoJsonObject?.object.type === "Feature") {
|
|
112
|
+
const c = l.hashLayers[e].geoJsonObject?.object;
|
|
113
|
+
c.id = o, c.geometry = m(r), c.properties = m(t);
|
|
110
114
|
}
|
|
115
|
+
l.hashLayers[e].dataBoundsOverride = i?.dataBoundsOverride, f(l.hashLayers[e]);
|
|
111
116
|
});
|
|
112
117
|
},
|
|
113
118
|
/**
|
|
114
119
|
* TODO: Documentar
|
|
115
120
|
*/
|
|
116
|
-
removeFeature: (e,
|
|
117
|
-
if (!
|
|
121
|
+
removeFeature: (e, o) => {
|
|
122
|
+
if (!n().hashLayers[e])
|
|
118
123
|
throw new Error(`Layer with id ${e} not found`);
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
} else if (
|
|
124
|
-
const
|
|
125
|
-
|
|
124
|
+
s((r) => {
|
|
125
|
+
if (r.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
|
|
126
|
+
const t = r.hashLayers[e].geoJsonObject?.object, a = t.features.findIndex((i) => i.id === o);
|
|
127
|
+
a !== -1 && t.features.splice(a, 1);
|
|
128
|
+
} else if (r.hashLayers[e].geoJsonObject?.object.type === "Feature") {
|
|
129
|
+
const t = r.hashLayers[e].geoJsonObject?.object;
|
|
130
|
+
t.geometry = { type: "Point", coordinates: [0, 0] }, t.properties = { subType: "Marker" };
|
|
126
131
|
}
|
|
127
|
-
|
|
132
|
+
r.selectedFeature?.layerId === e && r.selectedFeature.featureId === o && (r.selectedFeature = null), f(r.hashLayers[e]);
|
|
128
133
|
});
|
|
129
134
|
},
|
|
130
135
|
/**
|
|
131
136
|
* TODO: Documentar
|
|
132
137
|
*/
|
|
133
|
-
setLayerRenderProp: (e,
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
setLayerRenderProp: (e, o) => {
|
|
139
|
+
s((r) => {
|
|
140
|
+
r.hashLayers[e].renderFeature = o;
|
|
136
141
|
});
|
|
137
142
|
},
|
|
138
143
|
/**
|
|
139
144
|
* TODO: Documentar
|
|
140
145
|
*/
|
|
141
146
|
addLayer: (e) => {
|
|
142
|
-
if (
|
|
147
|
+
if (n().hashLayers[e.layerId])
|
|
143
148
|
throw new Error(`Layer with id ${e.layerId} already exists`);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
/**
|
|
149
|
-
* TODO: Documentar
|
|
150
|
-
*/
|
|
151
|
-
addLayerDataToFeature: (e, r, o) => {
|
|
152
|
-
n((s) => {
|
|
153
|
-
if (s.hashLayers[e]) {
|
|
154
|
-
if (s.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
|
|
155
|
-
const a = (s.hashLayers[e].geoJsonObject?.object).features.find((c) => c.id === r);
|
|
156
|
-
a && (a.layerData = y(a.layerData || {}, o));
|
|
157
|
-
} else if (s.hashLayers[e].geoJsonObject?.object.type === "Feature") {
|
|
158
|
-
const t = s.hashLayers[e].geoJsonObject?.object;
|
|
159
|
-
t.layerData && (t.layerData = o);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
149
|
+
s((o) => {
|
|
150
|
+
o.hashLayers[e.layerId] = m(e), f(o.hashLayers[e.layerId]), o.layersIds.push(e.layerId), e.visible !== !1 && (o.hashLayers[e.layerId].visible = !0), e.autoFocus !== !1 && (o.hashLayers[e.layerId].autoFocus = !0), e.clusterAble && e.cluster !== !1 && (o.hashLayers[e.layerId].cluster = !0);
|
|
162
151
|
});
|
|
163
152
|
},
|
|
164
153
|
/**
|
|
165
154
|
* TODO: Documentar
|
|
166
155
|
*/
|
|
167
156
|
removeLayer: (e) => {
|
|
168
|
-
|
|
169
|
-
|
|
157
|
+
n().hashLayers[e] && s((o) => {
|
|
158
|
+
o.layersIds.splice(o.layersIds.indexOf(e), 1), delete o.hashLayers[e], o.selectedFeature?.layerId === e && (o.selectedFeature = null);
|
|
170
159
|
});
|
|
171
160
|
},
|
|
172
161
|
/**
|
|
173
162
|
* Stores external feature-selection intent so renderers can react declaratively.
|
|
174
163
|
*/
|
|
175
|
-
selectFeature: (e,
|
|
176
|
-
|
|
177
|
-
|
|
164
|
+
selectFeature: (e, o, r) => {
|
|
165
|
+
s((t) => {
|
|
166
|
+
t.selectedFeature = {
|
|
178
167
|
layerId: e,
|
|
179
|
-
featureId:
|
|
180
|
-
openPopup:
|
|
181
|
-
source:
|
|
182
|
-
requestId: (
|
|
168
|
+
featureId: o,
|
|
169
|
+
openPopup: r?.openPopup ?? !1,
|
|
170
|
+
source: r?.source ?? "external",
|
|
171
|
+
requestId: (t.selectedFeature?.requestId ?? 0) + 1
|
|
183
172
|
};
|
|
184
173
|
});
|
|
185
174
|
},
|
|
@@ -187,81 +176,270 @@ const T = (u, l) => {
|
|
|
187
176
|
* Clears external feature-selection intent.
|
|
188
177
|
*/
|
|
189
178
|
clearSelectedFeature: () => {
|
|
190
|
-
|
|
179
|
+
s((e) => {
|
|
191
180
|
e.selectedFeature = null;
|
|
192
181
|
});
|
|
193
182
|
},
|
|
183
|
+
/**
|
|
184
|
+
* Dispatches one normalized observable-feature event to registered consumers.
|
|
185
|
+
*/
|
|
186
|
+
dispatchObservableFeatureEvent: (e) => {
|
|
187
|
+
const o = n().hashLayers[e.layerId];
|
|
188
|
+
if (!Y(o, e.type))
|
|
189
|
+
return !1;
|
|
190
|
+
let r = !1;
|
|
191
|
+
return v.forEach(({ consumer: t, options: a }) => {
|
|
192
|
+
t(e), a?.captureOriginalEvent && (a.eventTypes && !a.eventTypes.includes(e.type) || (r = !0));
|
|
193
|
+
}), r;
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* Registers one observable-feature consumer callback.
|
|
197
|
+
*/
|
|
198
|
+
subscribeObservableFeatureEvents: (e, o) => {
|
|
199
|
+
T += 1;
|
|
200
|
+
const r = `observable-feature-consumer-${T}`;
|
|
201
|
+
return v.set(r, {
|
|
202
|
+
consumer: e,
|
|
203
|
+
options: o
|
|
204
|
+
}), r;
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* Removes one observable-feature consumer callback.
|
|
208
|
+
*/
|
|
209
|
+
unsubscribeObservableFeatureEvents: (e) => {
|
|
210
|
+
v.delete(e);
|
|
211
|
+
},
|
|
212
|
+
/**
|
|
213
|
+
* Resolves one normalized anchor for an observable feature.
|
|
214
|
+
*/
|
|
215
|
+
resolveObservableFeatureAnchor: (e, o, r) => {
|
|
216
|
+
const t = n().hashLayers[e];
|
|
217
|
+
if (!t)
|
|
218
|
+
return;
|
|
219
|
+
const a = F(t, o);
|
|
220
|
+
if (a)
|
|
221
|
+
return W(
|
|
222
|
+
t,
|
|
223
|
+
a,
|
|
224
|
+
r?.purpose
|
|
225
|
+
);
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* Resolves one normalized pick payload from an observable feature event.
|
|
229
|
+
*/
|
|
230
|
+
resolveObservableFeaturePick: (e, o) => {
|
|
231
|
+
const r = n().hashLayers[e.layerId];
|
|
232
|
+
if (!r)
|
|
233
|
+
return;
|
|
234
|
+
const t = F(r, e.featureId);
|
|
235
|
+
if (t)
|
|
236
|
+
return H(r, t, e, o?.purpose);
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* Resolves one normalized snap target for an observable feature.
|
|
240
|
+
*/
|
|
241
|
+
resolveObservableFeatureSnapTarget: (e, o) => {
|
|
242
|
+
const r = n().hashLayers[e];
|
|
243
|
+
if (!r)
|
|
244
|
+
return;
|
|
245
|
+
const t = F(r, o);
|
|
246
|
+
if (t)
|
|
247
|
+
return G(r, t);
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
* Atomically captures one or more interaction channels for an owner.
|
|
251
|
+
*/
|
|
252
|
+
requestInteractionCapture: (e, o) => o.length === 0 ? !0 : C(n().interactionOwnership, o, e) ? (s((r) => {
|
|
253
|
+
o.forEach((t) => {
|
|
254
|
+
r.interactionOwnership.ownersByChannel[t] = e;
|
|
255
|
+
});
|
|
256
|
+
}), !0) : !1,
|
|
257
|
+
/**
|
|
258
|
+
* Releases one or more channels for the owner that currently holds them.
|
|
259
|
+
*/
|
|
260
|
+
releaseInteractionCapture: (e, o = E.slice()) => {
|
|
261
|
+
s((r) => {
|
|
262
|
+
S(r.interactionOwnership, e, o);
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
/**
|
|
266
|
+
* Releases every channel currently owned by the given owner.
|
|
267
|
+
*/
|
|
268
|
+
releaseAllInteractionCapture: (e) => {
|
|
269
|
+
s((o) => {
|
|
270
|
+
S(
|
|
271
|
+
o.interactionOwnership,
|
|
272
|
+
e,
|
|
273
|
+
E.slice()
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Returns whether all requested channels are currently available.
|
|
279
|
+
*/
|
|
280
|
+
isInteractionAvailable: (e, o) => C(n().interactionOwnership, e, o),
|
|
281
|
+
/**
|
|
282
|
+
* Returns the current owner for the requested interaction channel.
|
|
283
|
+
*/
|
|
284
|
+
getInteractionOwner: (e) => n().interactionOwnership.ownersByChannel[e],
|
|
285
|
+
/**
|
|
286
|
+
* Invalidates the current viewport size through the host API.
|
|
287
|
+
*/
|
|
288
|
+
invalidateViewportSize: (e = {}) => {
|
|
289
|
+
const { map: o, result: r } = L(
|
|
290
|
+
h,
|
|
291
|
+
n().interactionOwnership,
|
|
292
|
+
e.ownerId
|
|
293
|
+
);
|
|
294
|
+
return o ? b(() => (o.invalidateSize(), u("success"))) : r;
|
|
295
|
+
},
|
|
296
|
+
/**
|
|
297
|
+
* Moves the viewport to one serializable point.
|
|
298
|
+
*/
|
|
299
|
+
moveToPoint: (e, o = {}) => {
|
|
300
|
+
if (!j(e))
|
|
301
|
+
return u("invalid-target");
|
|
302
|
+
const r = D(o), { map: t, result: a } = L(
|
|
303
|
+
h,
|
|
304
|
+
n().interactionOwnership,
|
|
305
|
+
r.ownerId
|
|
306
|
+
);
|
|
307
|
+
return t ? b(() => (O(t, r), M(
|
|
308
|
+
t,
|
|
309
|
+
e,
|
|
310
|
+
r.mode === "fly" ? r.zoom : void 0
|
|
311
|
+
) ? u("noop") : r.mode === "fly" ? (t.flyTo([e.lat, e.lng], r.zoom ?? t.getZoom(), {
|
|
312
|
+
animate: r.animate,
|
|
313
|
+
duration: r.duration
|
|
314
|
+
}), u("success")) : (t.panTo([e.lat, e.lng], {
|
|
315
|
+
animate: r.animate,
|
|
316
|
+
duration: r.duration
|
|
317
|
+
}), u("success")))) : a;
|
|
318
|
+
},
|
|
319
|
+
/**
|
|
320
|
+
* Uses the shared zoom heuristic to decide between pan and fly.
|
|
321
|
+
*/
|
|
322
|
+
smartMoveToPoint: (e, o = {}) => {
|
|
323
|
+
if (!j(e))
|
|
324
|
+
return u("invalid-target");
|
|
325
|
+
const r = R(o), { map: t, result: a } = L(
|
|
326
|
+
h,
|
|
327
|
+
n().interactionOwnership,
|
|
328
|
+
r.ownerId
|
|
329
|
+
);
|
|
330
|
+
return t ? b(() => {
|
|
331
|
+
O(t, r);
|
|
332
|
+
const i = r.minZoom, l = r.zoomThreshold, c = t.getZoom(), d = c >= i - l, y = d ? void 0 : Math.max(c, i);
|
|
333
|
+
return M(t, e, y) ? u("noop") : d ? (t.panTo([e.lat, e.lng], {
|
|
334
|
+
animate: r.animate,
|
|
335
|
+
duration: r.duration
|
|
336
|
+
}), u("success")) : (t.flyTo([e.lat, e.lng], y, {
|
|
337
|
+
animate: r.animate,
|
|
338
|
+
duration: r.duration
|
|
339
|
+
}), u("success"));
|
|
340
|
+
}) : a;
|
|
341
|
+
},
|
|
342
|
+
/**
|
|
343
|
+
* Moves the viewport to one serializable bounds object.
|
|
344
|
+
*/
|
|
345
|
+
moveToBounds: (e, o = {}) => {
|
|
346
|
+
if (!V(e))
|
|
347
|
+
return u("invalid-target");
|
|
348
|
+
const r = Z(o), { map: t, result: a } = L(
|
|
349
|
+
h,
|
|
350
|
+
n().interactionOwnership,
|
|
351
|
+
r.ownerId
|
|
352
|
+
);
|
|
353
|
+
return t ? b(() => {
|
|
354
|
+
if (O(t, r), _(t, e))
|
|
355
|
+
return u("noop");
|
|
356
|
+
const i = [
|
|
357
|
+
[e.southWest.lat, e.southWest.lng],
|
|
358
|
+
[e.northEast.lat, e.northEast.lng]
|
|
359
|
+
];
|
|
360
|
+
return r.mode === "fly" ? (t.flyToBounds(i, {
|
|
361
|
+
animate: r.animate,
|
|
362
|
+
duration: r.duration,
|
|
363
|
+
maxZoom: r.maxZoom,
|
|
364
|
+
padding: r.padding
|
|
365
|
+
}), u("success")) : (t.fitBounds(i, {
|
|
366
|
+
animate: r.animate,
|
|
367
|
+
maxZoom: r.maxZoom,
|
|
368
|
+
padding: r.padding
|
|
369
|
+
}), u("success"));
|
|
370
|
+
}) : a;
|
|
371
|
+
},
|
|
194
372
|
/**
|
|
195
373
|
* Registers a tool controller without forcing controller state into the
|
|
196
374
|
* reactive map store.
|
|
197
375
|
*/
|
|
198
|
-
registerToolController: (e,
|
|
199
|
-
|
|
376
|
+
registerToolController: (e, o, r = "runtime") => {
|
|
377
|
+
z(p, e, o, r);
|
|
200
378
|
},
|
|
201
379
|
/**
|
|
202
380
|
* Removes a previously registered tool controller.
|
|
203
381
|
*/
|
|
204
|
-
unregisterToolController: (e,
|
|
205
|
-
|
|
382
|
+
unregisterToolController: (e, o = "runtime") => {
|
|
383
|
+
$(p, e, o);
|
|
206
384
|
},
|
|
207
385
|
/**
|
|
208
386
|
* Delegates an external open command to the resolved tool controller.
|
|
209
387
|
*/
|
|
210
388
|
openTool: (e) => {
|
|
211
|
-
|
|
389
|
+
w(p, e, "open");
|
|
212
390
|
},
|
|
213
391
|
/**
|
|
214
392
|
* Delegates an external close command to the resolved tool controller.
|
|
215
393
|
*/
|
|
216
394
|
closeTool: (e) => {
|
|
217
|
-
|
|
395
|
+
w(p, e, "close");
|
|
218
396
|
},
|
|
219
397
|
/**
|
|
220
398
|
* Delegates an external toggle command to the resolved tool controller.
|
|
221
399
|
*/
|
|
222
400
|
toggleTool: (e) => {
|
|
223
|
-
|
|
401
|
+
w(p, e, "toggle");
|
|
224
402
|
},
|
|
225
403
|
/**
|
|
226
404
|
* TODO: Documentar
|
|
227
405
|
*/
|
|
228
|
-
setCheckedLayers: (e,
|
|
229
|
-
|
|
230
|
-
|
|
406
|
+
setCheckedLayers: (e, o, r) => {
|
|
407
|
+
s((t) => {
|
|
408
|
+
t.hashLayers[e] && (t.hashLayers[e][o] = r);
|
|
231
409
|
});
|
|
232
410
|
},
|
|
233
411
|
/**
|
|
234
412
|
* Actualizar la capa actual del mapa
|
|
235
413
|
*/
|
|
236
|
-
setCurrentMapSourceLayer: (e,
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
|
|
414
|
+
setCurrentMapSourceLayer: (e, o) => {
|
|
415
|
+
s((r) => {
|
|
416
|
+
const t = r.mapSources.find((a) => a.id === e);
|
|
417
|
+
t && t.layers.find((a) => a.id === o) && (r.currentMapSourceLayer = {
|
|
240
418
|
mapSourceId: e,
|
|
241
|
-
mapSourceLayerId:
|
|
419
|
+
mapSourceLayerId: o
|
|
242
420
|
});
|
|
243
421
|
});
|
|
244
422
|
},
|
|
245
423
|
/**
|
|
246
424
|
* TODO: Documentar
|
|
247
425
|
*/
|
|
248
|
-
setMapSourceLayerRoadOptions: (e,
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
bicyclingLayer:
|
|
253
|
-
trafficLayer:
|
|
254
|
-
transitLayer:
|
|
255
|
-
...
|
|
426
|
+
setMapSourceLayerRoadOptions: (e, o, r) => {
|
|
427
|
+
s((t) => {
|
|
428
|
+
const i = t.mapSources.find((l) => l.id === e)?.layers.find((l) => l.id === o);
|
|
429
|
+
i && (i.roadSelectedOptions = {
|
|
430
|
+
bicyclingLayer: i.roadSelectedOptions?.bicyclingLayer || !1,
|
|
431
|
+
trafficLayer: i.roadSelectedOptions?.trafficLayer || !1,
|
|
432
|
+
transitLayer: i.roadSelectedOptions?.transitLayer || !1,
|
|
433
|
+
...r
|
|
256
434
|
});
|
|
257
435
|
});
|
|
258
436
|
}
|
|
259
437
|
}
|
|
260
438
|
})),
|
|
261
|
-
{ name: `Map store: ${
|
|
439
|
+
{ name: `Map store: ${g.storeId}`, enabled: B }
|
|
262
440
|
)
|
|
263
441
|
);
|
|
264
442
|
};
|
|
265
443
|
export {
|
|
266
|
-
|
|
444
|
+
ue as createMapStore
|
|
267
445
|
};
|