@delta10/atlas-sdk 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -72,6 +72,7 @@ const interactions: InteractionsConfig = {
72
72
  selectable: {
73
73
  enabled: true,
74
74
  layers: ['meetbouten'],
75
+ hitTolerance: 20,
75
76
  style: {
76
77
  'circle-radius': 8,
77
78
  'circle-fill-color': 'red',
@@ -375,6 +376,7 @@ Allow users to select features from specific layers:
375
376
  selectable: {
376
377
  enabled: true,
377
378
  layers: ['meetbouten'],
379
+ hitTolerance: 20,
378
380
  style: {
379
381
  'circle-radius': 8,
380
382
  'circle-fill-color': 'red',
@@ -386,18 +388,22 @@ Allow users to select features from specific layers:
386
388
  ```
387
389
 
388
390
  ### Modify Interaction
389
- Allow users to edit existing geometries:
391
+ Allow users to edit existing geometries directly on the configured layer:
390
392
  ```typescript
391
393
  {
392
394
  modify: {
393
395
  enabled: true,
394
396
  layer: 'meetbouten',
395
- labelProperty: 'meetboutnummer' // Optional: feature property shown in the confirm/cancel overlay
397
+ labelProperty: 'meetboutnummer', // Optional: feature property shown in the confirm/cancel overlay
398
+ pixelTolerance: 20, // Optional: edit tolerance in pixels for point symbols
399
+ filter: (feature) => feature.get('editable') === true // Optional: return false to prevent editing
396
400
  }
397
401
  }
398
402
  ```
399
403
 
400
- The `labelProperty` value is read from the selected feature's `properties`. For example, if a feature has `properties: { id: '123482' }`, use `labelProperty: 'id'` to show that value in the confirmation overlay.
404
+ The `labelProperty` value is read from the modified feature's `properties`. For example, if a feature has `properties: { id: '123482' }`, use `labelProperty: 'id'` to show that value in the confirmation overlay.
405
+
406
+ The optional `filter` callback receives the OpenLayers feature and layer. Return `false` to skip that feature for editing.
401
407
 
402
408
  ### Snap Interaction
403
409
  Snap modified features to existing features:
@@ -3,11 +3,14 @@ export interface SelectableConfig {
3
3
  enabled: boolean;
4
4
  layers: string[];
5
5
  style?: StyleConfig;
6
+ hitTolerance?: number;
6
7
  }
7
8
  export interface ModifyConfig {
8
9
  enabled: boolean;
9
10
  layer: string;
10
11
  labelProperty?: string;
12
+ pixelTolerance?: number;
13
+ filter?: (feature: any, layer?: any) => boolean;
11
14
  style?: StyleConfig;
12
15
  }
13
16
  export interface SnapConfig {
@@ -1,7 +1,7 @@
1
1
  import o from "./Map.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-00ea6e03"]]);
4
+ const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1eba4e06"]]);
5
5
  export {
6
6
  e as default
7
7
  };
@@ -1,35 +1,36 @@
1
- import { defineComponent as Oe, ref as c, shallowRef as ie, computed as b, onMounted as ze, openBlock as l, createElementBlock as L, createVNode as g, unref as r, withCtx as k, createBlock as f, normalizeStyle as xe, createCommentVNode as d, Fragment as K, renderList as se, createElementVNode as m, toDisplayString as Pe, normalizeClass as re, Transition as le } from "vue";
2
- import { OlMap as Be, OlProjectionRegister as Ae, OlView as We, OlFeature as je, OlOverlay as Re } from "vue3-openlayers/map";
3
- import { OlTileLayer as ae, OlVectorLayer as Ve } from "vue3-openlayers/layers";
4
- import { OlSourceVector as Ze } from "vue3-openlayers/sources";
5
- import { OlGeomPoint as $e, OlGeomPolygon as Ge } from "vue3-openlayers/geometries";
6
- import { OlStyle as Ne } from "vue3-openlayers/styles";
7
- import { OlInteractionSelect as De, OlInteractionModify as Ue, OlInteractionSnap as Ke } from "vue3-openlayers/interactions";
1
+ import { defineComponent as je, ref as c, shallowRef as H, computed as m, onMounted as Re, openBlock as a, createElementBlock as k, createVNode as y, unref as r, withCtx as L, createBlock as f, normalizeStyle as Ze, createCommentVNode as d, Fragment as Y, renderList as re, createElementVNode as v, toDisplayString as $e, normalizeClass as se, Transition as ae } from "vue";
2
+ import { OlMap as Ge, OlProjectionRegister as Ne, OlView as De, OlFeature as Ue, OlOverlay as Ke } from "vue3-openlayers/map";
3
+ import { OlTileLayer as le, OlVectorLayer as He } from "vue3-openlayers/layers";
4
+ import { OlSourceVector as Ye } from "vue3-openlayers/sources";
5
+ import { OlGeomPoint as qe, OlGeomPolygon as Je } from "vue3-openlayers/geometries";
6
+ import { OlStyle as ce } from "vue3-openlayers/styles";
7
+ import { OlInteractionSelect as Qe, OlInteractionModify as Xe, OlInteractionSnap as Ee } from "vue3-openlayers/interactions";
8
8
  import { epsg28992 as j } from "../utils/projections.js";
9
- import Ye, { optionsFromCapabilities as qe } from "ol/source/WMTS";
10
- import He from "ol/format/WMTSCapabilities";
11
- import Je from "ol/source/TileWMS";
12
- import { Style as Y, Fill as q, Stroke as H, Circle as Qe, Text as Xe } from "ol/style";
13
- import { boundingExtent as Ee } from "ol/extent";
14
- import { unByKey as et } from "ol/Observable";
15
- import { Collection as tt } from "ol";
9
+ import et, { optionsFromCapabilities as tt } from "ol/source/WMTS";
10
+ import ot from "ol/format/WMTSCapabilities";
11
+ import nt from "ol/source/TileWMS";
12
+ import { primaryAction as it } from "ol/events/condition";
13
+ import { Style as q, Fill as J, Stroke as Q, Circle as rt, Text as st } from "ol/style";
14
+ import { boundingExtent as at } from "ol/extent";
15
+ import { unByKey as lt } from "ol/Observable";
16
+ import { Collection as ue, Feature as ct } from "ol";
16
17
  import "ol/geom";
17
- import ot from "../assets/icons/map.svg.js";
18
- import nt from "../assets/icons/layers.svg.js";
19
- import it from "../assets/icons/plus.svg.js";
20
- import st from "../assets/icons/minus.svg.js";
21
- import rt from "./panels/BaseLayers.vue.js";
22
- import lt from "./panels/Layers.vue.js";
23
- const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
18
+ import ut from "../assets/icons/map.svg.js";
19
+ import ft from "../assets/icons/layers.svg.js";
20
+ import dt from "../assets/icons/plus.svg.js";
21
+ import pt from "../assets/icons/minus.svg.js";
22
+ import mt from "./panels/BaseLayers.vue.js";
23
+ import yt from "./panels/Layers.vue.js";
24
+ const vt = { class: "map-container" }, gt = { class: "modify-overlay" }, bt = {
24
25
  key: 0,
25
26
  class: "modify-overlay-label"
26
- }, ft = { class: "bottom-left-panels" }, dt = {
27
+ }, wt = { class: "bottom-left-panels" }, ht = {
27
28
  key: 0,
28
29
  class: "layers-control"
29
- }, pt = ["aria-expanded"], mt = { class: "bottom-right-panels" }, yt = {
30
+ }, Lt = ["aria-expanded"], kt = { class: "bottom-right-panels" }, St = {
30
31
  key: 0,
31
32
  class: "base-layers-control"
32
- }, vt = ["aria-expanded"], gt = { class: "zoom-panel" }, Zt = /* @__PURE__ */ Oe({
33
+ }, Tt = ["aria-expanded"], Ft = { class: "zoom-panel" }, qt = /* @__PURE__ */ je({
33
34
  __name: "Map",
34
35
  props: {
35
36
  layers: { default: () => [] },
@@ -40,58 +41,58 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
40
41
  center: { default: () => [12e4, 487e3] }
41
42
  },
42
43
  emits: ["featureSelected", "featureDeselected", "featureModified", "mapClicked", "modifyCancelled"],
43
- setup(S, { expose: ce, emit: ue }) {
44
- const i = S, x = ue, P = c(), w = c(), J = c(), fe = c({}), R = c({}), F = c(!1), I = c(!1), _ = c(null), O = c(/* @__PURE__ */ new Set()), V = c(!1), z = c(null), h = c(null), M = c(null), B = c(null), A = c(null), C = ie(new tt([])), Z = b(() => C.value), Q = b(() => {
44
+ setup(S, { expose: fe, emit: de }) {
45
+ const i = S, z = de, P = c(), w = c(), X = c(), pe = c({}), R = c({}), _ = c(!1), x = c(!1), T = c(null), C = c(/* @__PURE__ */ new Set()), A = c(!1), I = c(null), h = c(null), F = c(null), B = c(null), V = c(null), Z = H(new ue([])), O = H(new ue([])), me = m(() => Z.value), ye = m(() => O.value), E = m(() => {
45
46
  const e = i.interactions?.modify?.labelProperty;
46
- if (!e || !M.value) return "";
47
- const t = M.value.get?.(e);
47
+ if (!e || !F.value) return "";
48
+ const t = F.value.get?.(e);
48
49
  return t == null ? "" : String(t);
49
- }), T = ie(
50
+ }), M = H(
50
51
  new globalThis.Map()
51
- ), X = new globalThis.Map(), E = /* @__PURE__ */ new WeakMap(), $ = (e, t) => {
52
+ ), ee = new globalThis.Map(), te = /* @__PURE__ */ new WeakMap(), $ = (e, t) => {
52
53
  if (!e || !t) return null;
53
- const o = `${e}|${t}`, n = X.get(o);
54
+ const o = `${e}|${t}`, n = ee.get(o);
54
55
  if (n) return n;
55
- const s = new Je({
56
+ const s = new nt({
56
57
  url: e,
57
58
  params: { LAYERS: t, TILED: !0 },
58
59
  serverType: "geoserver",
59
60
  crossOrigin: "anonymous"
60
61
  });
61
- return X.set(o, s), s;
62
+ return ee.set(o, s), s;
62
63
  }, G = (e) => {
63
64
  if (!e) return null;
64
- const t = E.get(e);
65
+ const t = te.get(e);
65
66
  if (t) return t;
66
- const o = new Ye({
67
+ const o = new et({
67
68
  ...e,
68
69
  style: e.style || "default"
69
70
  });
70
- return E.set(e, o), o;
71
+ return te.set(e, o), o;
71
72
  }, N = (e, t) => {
72
- const o = new globalThis.Map(T.value);
73
- o.set(e, t), T.value = o;
74
- }, ee = (e, t, o, n) => {
73
+ const o = new globalThis.Map(M.value);
74
+ o.set(e, t), M.value = o;
75
+ }, D = (e, t, o, n) => {
75
76
  if (!e) return;
76
- if (e instanceof Y || typeof e == "function")
77
+ if (e instanceof q || typeof e == "function")
77
78
  return e;
78
- const s = {}, a = (p) => {
79
+ const s = {}, l = (p) => {
79
80
  if (Array.isArray(p)) {
80
- const [y, ...u] = p;
81
- switch (y) {
81
+ const [g, ...u] = p;
82
+ switch (g) {
82
83
  case "get":
83
84
  return t?.getProperties()?.[u[0]] ?? null;
84
85
  case "case":
85
- for (let v = 0; v < u.length - 1; v += 2)
86
- if (a(u[v]))
87
- return a(u[v + 1]);
88
- return a(u[u.length - 1]);
86
+ for (let b = 0; b < u.length - 1; b += 2)
87
+ if (l(u[b]))
88
+ return l(u[b + 1]);
89
+ return l(u[u.length - 1]);
89
90
  case "==":
90
- return a(u[0]) === a(u[1]);
91
+ return l(u[0]) === l(u[1]);
91
92
  case "coalesce":
92
- for (const v of u) {
93
- const U = a(v);
94
- if (U != null) return U;
93
+ for (const b of u) {
94
+ const K = l(b);
95
+ if (K != null) return K;
95
96
  }
96
97
  return null;
97
98
  default:
@@ -100,32 +101,32 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
100
101
  }
101
102
  return p;
102
103
  };
103
- if (e["fill-color"] && (s.fill = new q({ color: a(e["fill-color"]) })), (e["stroke-color"] || e["stroke-width"]) && (s.stroke = new H({
104
- color: a(e["stroke-color"]) || "#3399CC",
105
- width: a(e["stroke-width"]) || 1.25
104
+ if (e["fill-color"] && (s.fill = new J({ color: l(e["fill-color"]) })), (e["stroke-color"] || e["stroke-width"]) && (s.stroke = new Q({
105
+ color: l(e["stroke-color"]) || "#3399CC",
106
+ width: l(e["stroke-width"]) || 1.25
106
107
  })), e["circle-radius"] || e["circle-fill-color"] || e["circle-stroke-color"]) {
107
- const p = a(e["circle-radius"]) || 5, y = a(e["circle-fill-color"]), u = a(e["circle-stroke-color"]) || "#3399CC", v = a(e["circle-stroke-width"]) || 1.25;
108
- s.image = new Qe({
108
+ const p = l(e["circle-radius"]) || 5, g = l(e["circle-fill-color"]), u = l(e["circle-stroke-color"]) || "#3399CC", b = l(e["circle-stroke-width"]) || 1.25;
109
+ s.image = new rt({
109
110
  radius: p,
110
- fill: y ? new q({ color: y }) : void 0,
111
- stroke: new H({ color: u, width: v })
111
+ fill: g ? new J({ color: g }) : void 0,
112
+ stroke: new Q({ color: u, width: b })
112
113
  });
113
114
  }
114
115
  if (e["text-value"]) {
115
- const p = a(e["text-value"]);
116
- p && (s.text = new Xe({
116
+ const p = l(e["text-value"]);
117
+ p && (s.text = new st({
117
118
  text: String(p),
118
- fill: new q({ color: "#000" }),
119
- stroke: new H({ color: "#fff", width: 2 })
119
+ fill: new J({ color: "#000" }),
120
+ stroke: new Q({ color: "#fff", width: 2 })
120
121
  }));
121
122
  }
122
- return new Y(s);
123
- }, de = (e) => typeof e == "function" ? e : e instanceof Y ? (t, o, n) => [e] : (t, o, n) => {
124
- const s = ee(e, t);
123
+ return new q(s);
124
+ }, ve = (e) => typeof e == "function" ? e : e instanceof q ? (t, o, n) => [e] : (t, o, n) => {
125
+ const s = D(e, t);
125
126
  return s ? [s] : void 0;
126
- }, pe = b(() => i.layers.map((e) => {
127
+ }, ge = m(() => i.layers.map((e) => {
127
128
  if (e.type === "wmts") {
128
- const t = T.value.get(e.options.identifier);
129
+ const t = M.value.get(e.options.identifier);
129
130
  return {
130
131
  type: "wmts",
131
132
  identifier: e.options.identifier,
@@ -145,15 +146,15 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
145
146
  style: e.options.style,
146
147
  styleFunction: e.options.styleFunction
147
148
  };
148
- })), W = b(() => {
149
- if (!_.value || !i.baseLayers)
149
+ })), W = m(() => {
150
+ if (!T.value || !i.baseLayers)
150
151
  return null;
151
152
  const e = i.baseLayers.find(
152
- (t) => t.options.identifier === _.value
153
+ (t) => t.options.identifier === T.value
153
154
  );
154
- return !e || e.type === "wmts" && !T.value.get(e.options.identifier) ? null : e;
155
- }), te = b(() => W.value && T.value.get(W.value.options.identifier) || null), me = b(() => (i.toggleableLayers || []).filter(
156
- (e) => O.value.has(e.options.identifier)
155
+ return !e || e.type === "wmts" && !M.value.get(e.options.identifier) ? null : e;
156
+ }), oe = m(() => W.value && M.value.get(W.value.options.identifier) || null), be = m(() => (i.toggleableLayers || []).filter(
157
+ (e) => C.value.has(e.options.identifier)
157
158
  ).map((e) => {
158
159
  if (e.type === "wms")
159
160
  return {
@@ -164,7 +165,7 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
164
165
  source: $(e.options.url, e.options.layer)
165
166
  };
166
167
  if (e.type === "wmts") {
167
- const t = T.value.get(e.options.identifier);
168
+ const t = M.value.get(e.options.identifier);
168
169
  return {
169
170
  type: "wmts",
170
171
  identifier: e.options.identifier,
@@ -183,15 +184,15 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
183
184
  ...e,
184
185
  identifier: e.options.identifier
185
186
  };
186
- })), ye = b(() => {
187
+ })), we = m(() => {
187
188
  const e = [];
188
189
  if (W.value) {
189
190
  const n = W.value;
190
191
  n.type === "wmts" ? e.push({
191
192
  type: "wmts",
192
193
  identifier: n.options.identifier,
193
- wmtsOptions: te.value,
194
- source: G(te.value),
194
+ wmtsOptions: oe.value,
195
+ source: G(oe.value),
195
196
  zIndex: 0
196
197
  }) : n.type === "wms" ? e.push({
197
198
  type: "wms",
@@ -209,54 +210,54 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
209
210
  zIndex: 0
210
211
  });
211
212
  }
212
- const t = me.value.map((n, s) => ({
213
+ const t = be.value.map((n, s) => ({
213
214
  ...n,
214
215
  zIndex: s + 10
215
- })), o = pe.value.map((n, s) => ({
216
+ })), o = ge.value.map((n, s) => ({
216
217
  ...n,
217
218
  zIndex: t.length + s + 20
218
219
  }));
219
220
  return [...e, ...t, ...o];
220
- }), ve = () => {
221
- F.value = !F.value;
222
- }, ge = () => {
223
- I.value = !I.value;
224
- }, be = (e) => {
225
- O.value.has(e) ? O.value.delete(e) : O.value.add(e);
226
- }, we = (e) => {
227
- _.value = e;
228
- }, he = () => {
221
+ }), he = () => {
222
+ _.value = !_.value;
223
+ }, Le = () => {
224
+ x.value = !x.value;
225
+ }, ke = (e) => {
226
+ C.value.has(e) ? C.value.delete(e) : C.value.add(e);
227
+ }, Se = (e) => {
228
+ T.value = e;
229
+ }, Te = () => {
229
230
  if (w.value?.view) {
230
231
  const e = w.value.view, t = e.getZoom(), o = e.getMaxZoom();
231
232
  typeof t == "number" && t < o && e.animate({ zoom: t + 1, duration: 250 });
232
233
  }
233
- }, Le = () => {
234
+ }, Fe = () => {
234
235
  if (w.value?.view) {
235
236
  const e = w.value.view, t = e.getZoom(), o = e.getMinZoom();
236
237
  typeof t == "number" && t > o && e.animate({ zoom: t - 1, duration: 250 });
237
238
  }
238
- }, D = async (e, t, o) => {
239
+ }, U = async (e, t, o) => {
239
240
  try {
240
- const s = await (await fetch(e)).text(), a = new He().read(s), p = o ? [o, "image/jpeg", "image/png"] : ["image/png", "image/jpeg"];
241
- let y = null;
241
+ const s = await (await fetch(e)).text(), l = new ot().read(s), p = o ? [o, "image/jpeg", "image/png"] : ["image/png", "image/jpeg"];
242
+ let g = null;
242
243
  for (const u of p)
243
244
  try {
244
- if (y = qe(a, {
245
+ if (g = tt(l, {
245
246
  layer: t,
246
247
  matrixSet: "EPSG:28992",
247
248
  projection: "EPSG:28992",
248
249
  format: u,
249
250
  crossOrigin: "anonymous",
250
251
  style: "default"
251
- }), y) break;
252
- } catch (v) {
253
- console.warn(`Format ${u} failed for layer ${t}:`, v);
252
+ }), g) break;
253
+ } catch (b) {
254
+ console.warn(`Format ${u} failed for layer ${t}:`, b);
254
255
  }
255
- return y && (y.style = "default"), y;
256
+ return g && (g.style = "default"), g;
256
257
  } catch (n) {
257
258
  return console.error("Failed to fetch WMTS capabilities:", n), null;
258
259
  }
259
- }, ke = (e) => {
260
+ }, Me = (e) => {
260
261
  if (!e || e.length === 0 || !w.value?.view) return;
261
262
  const t = [];
262
263
  for (const o of e)
@@ -265,30 +266,30 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
265
266
  else if (o.type === "Polygon") {
266
267
  const n = o.coordinates;
267
268
  for (const s of n)
268
- for (const a of s)
269
- t.push(a);
269
+ for (const l of s)
270
+ t.push(l);
270
271
  }
271
272
  if (t.length > 0) {
272
- const o = Ee(t);
273
+ const o = at(t);
273
274
  w.value.view.fit(o, {
274
275
  padding: [50, 50, 50, 50]
275
276
  });
276
277
  }
277
278
  };
278
- ze(async () => {
279
- if (!_.value && i.baseLayers && i.baseLayers.length > 0) {
279
+ Re(async () => {
280
+ if (!T.value && i.baseLayers && i.baseLayers.length > 0) {
280
281
  const e = i.baseLayers[0];
281
- e?.options.identifier && (_.value = e.options.identifier);
282
+ e?.options.identifier && (T.value = e.options.identifier);
282
283
  }
283
284
  await new Promise((e) => setTimeout(e, 100)), P.value?.map && P.value.map.on("singleclick", (e) => {
284
- x("mapClicked", {
285
+ z("mapClicked", {
285
286
  coordinate: e.coordinate,
286
287
  pixel: e.pixel
287
288
  });
288
289
  });
289
290
  for (const e of i.layers.filter((t) => t.type === "wmts"))
290
291
  if (e.options.url) {
291
- const t = await D(
292
+ const t = await U(
292
293
  e.options.url,
293
294
  e.options.identifier,
294
295
  e.options.format
@@ -298,7 +299,7 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
298
299
  if (i.baseLayers) {
299
300
  for (const e of i.baseLayers.filter((t) => t.type === "wmts"))
300
301
  if (e.options.url) {
301
- const t = await D(
302
+ const t = await U(
302
303
  e.options.url,
303
304
  e.options.identifier,
304
305
  e.options.format
@@ -311,7 +312,7 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
311
312
  (t) => t.type === "wmts"
312
313
  ))
313
314
  if (e.options.url) {
314
- const t = await D(
315
+ const t = await U(
315
316
  e.options.url,
316
317
  e.options.identifier,
317
318
  e.options.format
@@ -320,7 +321,7 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
320
321
  }
321
322
  }
322
323
  });
323
- const Se = b(() => {
324
+ const _e = m(() => {
324
325
  if (!i.interactions?.selectable?.layers || i.interactions.selectable.layers.length === 0)
325
326
  return;
326
327
  const e = i.interactions.selectable.layers;
@@ -329,128 +330,151 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
329
330
  const n = o.get("name");
330
331
  return e.includes(n);
331
332
  };
332
- }), _e = b(() => ee(i.interactions?.selectable?.style, void 0)), Me = (e) => {
333
- C.value && (C.value.clear(), e.selected && e.selected.length > 0 && C.value.push(e.selected[0])), x("featureSelected", e);
334
- }, Ce = (e) => {
333
+ }), xe = m(() => D(i.interactions?.selectable?.style, void 0)), Ce = (e, t, o) => i.interactions?.modify?.style ? D(i.interactions.modify.style, e) : [], Ie = (e) => {
334
+ z("featureSelected", e);
335
+ }, Oe = m(() => i.interactions?.modify?.pixelTolerance ?? 10), ze = (e) => !i.interactions?.modify?.enabled || !i.interactions.modify.layer ? null : e.map.forEachFeatureAtPixel(
336
+ e.pixel,
337
+ (t, o) => {
338
+ if (i.interactions?.modify?.filter?.(t, o) !== !1)
339
+ return t;
340
+ },
341
+ {
342
+ hitTolerance: Oe.value,
343
+ layerFilter: (t) => t?.get("name") === i.interactions?.modify?.layer
344
+ }
345
+ ) || null, Pe = (e) => {
346
+ if (!it(e) || A.value)
347
+ return !1;
348
+ const t = ze(e);
349
+ return O.value.clear(), t instanceof ct ? (O.value.push(t), !0) : !1;
350
+ }, Ae = (e) => {
335
351
  h.value = e;
336
352
  const t = e.features.getArray()[0];
337
- if (M.value = t || null, t) {
353
+ if (F.value = t || null, t) {
338
354
  const o = t.getGeometry();
339
355
  B.value = o.clone();
340
356
  const n = o.getCoordinates();
341
- z.value = n, V.value = !0, A.value = o.on("change", () => {
357
+ I.value = n, A.value = !0, V.value = o.on("change", () => {
342
358
  const s = o.getCoordinates();
343
- z.value = s;
359
+ I.value = s;
344
360
  });
345
361
  }
346
- }, Te = (e) => {
347
- h.value = e, M.value = e.features.getArray()[0] || M.value;
348
- }, oe = () => {
349
- C.value && C.value.clear();
350
- const e = J.value?.select;
362
+ }, Be = (e) => {
363
+ h.value = e, F.value = e.features.getArray()[0] || F.value;
364
+ }, ne = () => {
365
+ Z.value && Z.value.clear(), O.value && O.value.clear();
366
+ const e = X.value?.select;
351
367
  (e?.value || e)?.getFeatures?.().clear();
352
- }, Fe = () => {
368
+ }, Ve = () => {
353
369
  if (h.value) {
354
370
  const e = h.value.features.getArray();
355
- x("featureModified", { features: e });
371
+ z("featureModified", { features: e });
356
372
  }
357
- oe(), ne();
358
- }, Ie = () => {
373
+ ne(), ie();
374
+ }, We = () => {
359
375
  if (h.value && B.value) {
360
376
  const e = h.value.features.getArray()[0];
361
377
  e && e.setGeometry(B.value);
362
378
  const t = h.value.features.getArray();
363
- x("modifyCancelled", { features: t });
379
+ z("modifyCancelled", { features: t });
364
380
  }
365
- oe(), ne();
366
- }, ne = () => {
367
- V.value = !1, z.value = null, h.value = null, M.value = null, B.value = null, A.value && (et(A.value), A.value = null);
381
+ ne(), ie();
382
+ }, ie = () => {
383
+ A.value = !1, I.value = null, h.value = null, F.value = null, B.value = null, V.value && (lt(V.value), V.value = null);
368
384
  };
369
- return ce({ map: P, view: w, fitToFeatures: ke }), (e, t) => (l(), L("div", at, [
370
- g(r(Be), {
385
+ return fe({ map: P, view: w, fitToFeatures: Me }), (e, t) => (a(), k("div", vt, [
386
+ y(r(Ge), {
371
387
  ref_key: "mapRef",
372
388
  ref: P,
373
389
  style: { width: "100%", height: "100%" },
374
390
  controls: []
375
391
  }, {
376
- default: k(() => [
377
- g(r(Ae), {
392
+ default: L(() => [
393
+ y(r(Ne), {
378
394
  projectionName: r(j).name,
379
395
  projectionDef: r(j).def,
380
396
  extent: r(j).extent
381
397
  }, null, 8, ["projectionName", "projectionDef", "extent"]),
382
- g(r(We), {
398
+ y(r(De), {
383
399
  ref_key: "viewRef",
384
400
  ref: w,
385
401
  center: S.center,
386
402
  zoom: S.zoom,
387
403
  projection: r(j).name
388
404
  }, null, 8, ["center", "zoom", "projection"]),
389
- i.interactions?.selectable?.enabled ? (l(), f(r(De), {
405
+ i.interactions?.selectable?.enabled ? (a(), f(r(Qe), {
390
406
  key: 0,
391
407
  ref_key: "selectInteractionRef",
392
- ref: J,
408
+ ref: X,
393
409
  multi: !1,
394
- features: Z.value,
395
- filter: Se.value,
396
- style: xe(_e.value),
397
- onSelect: Me
398
- }, null, 8, ["features", "filter", "style"])) : d("", !0),
399
- (l(!0), L(K, null, se(ye.value, (o) => (l(), L(K, {
410
+ features: me.value,
411
+ filter: _e.value,
412
+ hitTolerance: i.interactions.selectable.hitTolerance,
413
+ style: Ze(xe.value),
414
+ onSelect: Ie
415
+ }, null, 8, ["features", "filter", "hitTolerance", "style"])) : d("", !0),
416
+ (a(!0), k(Y, null, re(we.value, (o) => (a(), k(Y, {
400
417
  key: o.identifier
401
418
  }, [
402
- o.type === "wms" && o.source ? (l(), f(r(ae), {
419
+ o.type === "wms" && o.source ? (a(), f(r(le), {
403
420
  key: 0,
404
421
  zIndex: o.zIndex,
405
422
  source: o.source
406
- }, null, 8, ["zIndex", "source"])) : o.type === "wmts" && o.source ? (l(), f(r(ae), {
423
+ }, null, 8, ["zIndex", "source"])) : o.type === "wmts" && o.source ? (a(), f(r(le), {
407
424
  key: 1,
408
425
  zIndex: o.zIndex,
409
426
  source: o.source
410
- }, null, 8, ["zIndex", "source"])) : o.type === "vector" ? (l(), f(r(Ve), {
427
+ }, null, 8, ["zIndex", "source"])) : o.type === "vector" ? (a(), f(r(He), {
411
428
  key: 2,
412
429
  zIndex: o.zIndex,
413
430
  properties: { name: o.identifier },
414
431
  ref_for: !0,
415
432
  ref: (n) => {
416
- n && (fe.value[o.identifier] = n);
433
+ n && (pe.value[o.identifier] = n);
417
434
  }
418
435
  }, {
419
- default: k(() => [
420
- o.styleFunction || o.options?.styleFunction || o.style || o.options?.style ? (l(), f(r(Ne), {
436
+ default: L(() => [
437
+ o.styleFunction || o.options?.styleFunction || o.style || o.options?.style ? (a(), f(r(ce), {
421
438
  key: 0,
422
- overrideStyleFunction: o.styleFunction || o.options?.styleFunction || de(o.style || o.options?.style)
439
+ overrideStyleFunction: o.styleFunction || o.options?.styleFunction || ve(o.style || o.options?.style)
423
440
  }, null, 8, ["overrideStyleFunction"])) : d("", !0),
424
- g(r(Ze), {
441
+ y(r(Ye), {
425
442
  ref_for: !0,
426
443
  ref: (n) => {
427
444
  n && (R.value[o.identifier] = n);
428
445
  }
429
446
  }, {
430
- default: k(() => [
431
- (l(!0), L(K, null, se(o.options?.features, (n, s) => (l(), f(r(je), {
447
+ default: L(() => [
448
+ (a(!0), k(Y, null, re(o.options?.features, (n, s) => (a(), f(r(Ue), {
432
449
  key: `${o.identifier}-${s}`,
433
450
  properties: n.properties || {}
434
451
  }, {
435
- default: k(() => [
436
- n.type === "Point" ? (l(), f(r($e), {
452
+ default: L(() => [
453
+ n.type === "Point" ? (a(), f(r(qe), {
437
454
  key: 0,
438
455
  coordinates: n.coordinates
439
456
  }, null, 8, ["coordinates"])) : d("", !0),
440
- n.type === "Polygon" ? (l(), f(r(Ge), {
457
+ n.type === "Polygon" ? (a(), f(r(Je), {
441
458
  key: 1,
442
459
  coordinates: n.coordinates
443
460
  }, null, 8, ["coordinates"])) : d("", !0)
444
461
  ]),
445
462
  _: 2
446
463
  }, 1032, ["properties"]))), 128)),
447
- i.interactions?.modify?.enabled && i.interactions.modify.layer === o.identifier && Z.value ? (l(), f(r(Ue), {
464
+ i.interactions?.modify?.enabled && i.interactions.modify.layer === o.identifier ? (a(), f(r(Xe), {
448
465
  key: 0,
449
- features: Z.value,
450
- onModifystart: Ce,
451
- onModifyend: Te
452
- }, null, 8, ["features"])) : d("", !0),
453
- i.interactions?.snap?.enabled && i.interactions?.modify?.enabled && i.interactions?.modify?.layer === o.identifier && R.value[i.interactions.snap.targetLayer]?.source ? (l(), f(r(Ke), {
466
+ features: ye.value,
467
+ condition: Pe,
468
+ pixelTolerance: i.interactions.modify.pixelTolerance,
469
+ onModifystart: Ae,
470
+ onModifyend: Be
471
+ }, {
472
+ default: L(() => [
473
+ y(r(ce), { overrideStyleFunction: Ce })
474
+ ]),
475
+ _: 1
476
+ }, 8, ["features", "pixelTolerance"])) : d("", !0),
477
+ i.interactions?.snap?.enabled && i.interactions?.modify?.enabled && i.interactions?.modify?.layer === o.identifier && R.value[i.interactions.snap.targetLayer]?.source ? (a(), f(r(Ee), {
454
478
  key: `snap-${o.identifier}-${i.interactions?.snap?.enabled}-${i.interactions?.modify?.enabled}`,
455
479
  source: R.value[i.interactions.snap.targetLayer]?.source,
456
480
  pixelTolerance: i.interactions?.snap?.pixelTolerance || 8
@@ -462,24 +486,24 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
462
486
  _: 2
463
487
  }, 1032, ["zIndex", "properties"])) : d("", !0)
464
488
  ], 64))), 128)),
465
- V.value && z.value ? (l(), f(r(Re), {
489
+ A.value && I.value ? (a(), f(r(Ke), {
466
490
  key: 1,
467
- position: z.value,
491
+ position: I.value,
468
492
  positioning: "bottom-left",
469
493
  offset: [10, -10],
470
494
  stopEvent: !0
471
495
  }, {
472
- default: k(() => [
473
- m("div", ct, [
474
- Q.value ? (l(), L("div", ut, Pe(Q.value), 1)) : d("", !0),
475
- m("div", { class: "modify-overlay-actions" }, [
476
- m("button", {
496
+ default: L(() => [
497
+ v("div", gt, [
498
+ E.value ? (a(), k("div", bt, $e(E.value), 1)) : d("", !0),
499
+ v("div", { class: "modify-overlay-actions" }, [
500
+ v("button", {
477
501
  class: "modify-btn modify-btn-cancel",
478
- onClick: Ie
502
+ onClick: We
479
503
  }, " Annuleer "),
480
- m("button", {
504
+ v("button", {
481
505
  class: "modify-btn modify-btn-ok",
482
- onClick: Fe
506
+ onClick: Ve
483
507
  }, " Bevestig ")
484
508
  ])
485
509
  ])
@@ -489,65 +513,65 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
489
513
  ]),
490
514
  _: 1
491
515
  }, 512),
492
- m("div", ft, [
493
- S.toggleableLayers && S.toggleableLayers.length > 0 ? (l(), L("div", dt, [
494
- m("button", {
495
- class: re(["iconbutton", { isActive: I.value }]),
516
+ v("div", wt, [
517
+ S.toggleableLayers && S.toggleableLayers.length > 0 ? (a(), k("div", ht, [
518
+ v("button", {
519
+ class: se(["iconbutton", { isActive: x.value }]),
496
520
  "aria-label": "Toon lagen",
497
- "aria-expanded": I.value,
498
- onClick: ge
521
+ "aria-expanded": x.value,
522
+ onClick: Le
499
523
  }, [
500
- g(r(nt))
501
- ], 10, pt),
502
- g(le, { name: "fade" }, {
503
- default: k(() => [
504
- I.value ? (l(), f(lt, {
524
+ y(r(ft))
525
+ ], 10, Lt),
526
+ y(ae, { name: "fade" }, {
527
+ default: L(() => [
528
+ x.value ? (a(), f(yt, {
505
529
  key: 0,
506
530
  toggleableLayers: S.toggleableLayers || [],
507
- visibleToggleableLayers: O.value,
508
- onToggleLayer: be
531
+ visibleToggleableLayers: C.value,
532
+ onToggleLayer: ke
509
533
  }, null, 8, ["toggleableLayers", "visibleToggleableLayers"])) : d("", !0)
510
534
  ]),
511
535
  _: 1
512
536
  })
513
537
  ])) : d("", !0)
514
538
  ]),
515
- m("div", mt, [
516
- i.baseLayers && i.baseLayers.length > 0 ? (l(), L("div", yt, [
517
- m("button", {
518
- class: re(["iconbutton", { isActive: F.value }]),
539
+ v("div", kt, [
540
+ i.baseLayers && i.baseLayers.length > 0 ? (a(), k("div", St, [
541
+ v("button", {
542
+ class: se(["iconbutton", { isActive: _.value }]),
519
543
  "aria-label": "Toon basislagen",
520
- "aria-expanded": F.value,
521
- onClick: ve
544
+ "aria-expanded": _.value,
545
+ onClick: he
522
546
  }, [
523
- g(r(ot))
524
- ], 10, vt),
525
- g(le, { name: "fade" }, {
526
- default: k(() => [
527
- F.value ? (l(), f(rt, {
547
+ y(r(ut))
548
+ ], 10, Tt),
549
+ y(ae, { name: "fade" }, {
550
+ default: L(() => [
551
+ _.value ? (a(), f(mt, {
528
552
  key: 0,
529
553
  baseLayers: i.baseLayers,
530
- selectedBaseLayerId: _.value,
531
- onSelectBaseLayer: we
554
+ selectedBaseLayerId: T.value,
555
+ onSelectBaseLayer: Se
532
556
  }, null, 8, ["baseLayers", "selectedBaseLayerId"])) : d("", !0)
533
557
  ]),
534
558
  _: 1
535
559
  })
536
560
  ])) : d("", !0),
537
- m("div", gt, [
538
- m("button", {
561
+ v("div", Ft, [
562
+ v("button", {
539
563
  class: "iconbutton",
540
564
  "aria-label": "Zoom in",
541
- onClick: he
565
+ onClick: Te
542
566
  }, [
543
- g(r(it))
567
+ y(r(dt))
544
568
  ]),
545
- m("button", {
569
+ v("button", {
546
570
  class: "iconbutton",
547
571
  "aria-label": "Zoom out",
548
- onClick: Le
572
+ onClick: Fe
549
573
  }, [
550
- g(r(st))
574
+ y(r(pt))
551
575
  ])
552
576
  ])
553
577
  ])
@@ -555,5 +579,5 @@ const at = { class: "map-container" }, ct = { class: "modify-overlay" }, ut = {
555
579
  }
556
580
  });
557
581
  export {
558
- Zt as default
582
+ qt as default
559
583
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .wrapper[data-v-7a503b81]{position:absolute;bottom:100%;right:0;padding:8px 12px;background:#fff;border-radius:4px 4px 0;box-shadow:0 2px 8px #00000026;min-width:150px;z-index:1000;margin-bottom:8px}ul[data-v-7a503b81]{list-style:none;margin:0;padding:0}.layer[data-v-7a503b81]{position:relative;display:flex;margin-bottom:4px}.layer[data-v-7a503b81]:last-child{margin-bottom:0}.layer>input[data-v-7a503b81]{position:absolute;top:6px;left:0;width:12px;height:12px;margin:0;cursor:pointer}.layer>label[data-v-7a503b81]{display:block;position:relative;width:100%;cursor:pointer;padding:3px 0 3px 18px;-webkit-user-select:none;user-select:none;font-size:14px;white-space:nowrap}.wrapper[data-v-16f7d1b3]{position:absolute;bottom:100%;left:0;padding:12px;background:#fff;border-radius:4px 4px 4px 0;box-shadow:0 2px 8px #00000026;min-width:200px;z-index:1000;margin-bottom:8px}ul[data-v-16f7d1b3]{list-style:none;margin:0;padding:0}.layer[data-v-16f7d1b3]{margin-bottom:8px}.layer[data-v-16f7d1b3]:last-child{margin-bottom:0}.layer-control[data-v-16f7d1b3]{display:flex;align-items:center;cursor:pointer;gap:8px}.layer-checkbox[data-v-16f7d1b3]{flex-shrink:0}.layer-title[data-v-16f7d1b3]{font-size:14px;font-weight:500;color:#333;line-height:1.3}.map-container[data-v-00ea6e03]{position:relative;width:100%;height:100%}.bottom-right-panels[data-v-00ea6e03]{position:absolute;z-index:1;bottom:20px;right:20px;display:flex;flex-direction:column;gap:8px}.bottom-left-panels[data-v-00ea6e03]{position:absolute;z-index:1;bottom:20px;left:20px;display:flex;flex-direction:column;gap:8px}.zoom-panel[data-v-00ea6e03],.base-layers-control[data-v-00ea6e03],.layers-control[data-v-00ea6e03]{display:flex;flex-direction:column;background:#fff;border-radius:4px;box-shadow:0 1px 4px #0003;overflow:visible;position:relative}.iconbutton[data-v-00ea6e03]{width:30px;height:30px;border:none;background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s;padding:0}.iconbutton[data-v-00ea6e03]:hover{background:#f0f0f0}.iconbutton.isActive[data-v-00ea6e03]{background:#e6f3ff}.iconbutton[data-v-00ea6e03]:not(:last-child){border-bottom:1px solid #ddd}.fade-enter-active[data-v-00ea6e03],.fade-leave-active[data-v-00ea6e03]{transition:opacity .2s ease}.fade-enter-from[data-v-00ea6e03],.fade-leave-to[data-v-00ea6e03]{opacity:0}.modify-overlay[data-v-00ea6e03]{display:flex;flex-direction:column;align-items:stretch;gap:6px;background:#fff;padding:6px;border-radius:4px;box-shadow:0 2px 8px #0003;border:1px solid #ccc}.modify-overlay-label[data-v-00ea6e03]{max-width:220px;padding:0 6px;color:#333;font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modify-overlay-actions[data-v-00ea6e03]{display:flex;gap:4px}.modify-btn[data-v-00ea6e03]{padding:6px 12px;border:none;border-radius:3px;cursor:pointer;font-size:12px;font-weight:500;transition:background-color .2s}.modify-btn-ok[data-v-00ea6e03]{background:#4caf50;color:#fff}.modify-btn-ok[data-v-00ea6e03]:hover{background:#45a049}.modify-btn-cancel[data-v-00ea6e03]{background:#f44336;color:#fff}.modify-btn-cancel[data-v-00ea6e03]:hover{background:#da190b}
1
+ .wrapper[data-v-7a503b81]{position:absolute;bottom:100%;right:0;padding:8px 12px;background:#fff;border-radius:4px 4px 0;box-shadow:0 2px 8px #00000026;min-width:150px;z-index:1000;margin-bottom:8px}ul[data-v-7a503b81]{list-style:none;margin:0;padding:0}.layer[data-v-7a503b81]{position:relative;display:flex;margin-bottom:4px}.layer[data-v-7a503b81]:last-child{margin-bottom:0}.layer>input[data-v-7a503b81]{position:absolute;top:6px;left:0;width:12px;height:12px;margin:0;cursor:pointer}.layer>label[data-v-7a503b81]{display:block;position:relative;width:100%;cursor:pointer;padding:3px 0 3px 18px;-webkit-user-select:none;user-select:none;font-size:14px;white-space:nowrap}.wrapper[data-v-16f7d1b3]{position:absolute;bottom:100%;left:0;padding:12px;background:#fff;border-radius:4px 4px 4px 0;box-shadow:0 2px 8px #00000026;min-width:200px;z-index:1000;margin-bottom:8px}ul[data-v-16f7d1b3]{list-style:none;margin:0;padding:0}.layer[data-v-16f7d1b3]{margin-bottom:8px}.layer[data-v-16f7d1b3]:last-child{margin-bottom:0}.layer-control[data-v-16f7d1b3]{display:flex;align-items:center;cursor:pointer;gap:8px}.layer-checkbox[data-v-16f7d1b3]{flex-shrink:0}.layer-title[data-v-16f7d1b3]{font-size:14px;font-weight:500;color:#333;line-height:1.3}.map-container[data-v-1eba4e06]{position:relative;width:100%;height:100%}.bottom-right-panels[data-v-1eba4e06]{position:absolute;z-index:1;bottom:20px;right:20px;display:flex;flex-direction:column;gap:8px}.bottom-left-panels[data-v-1eba4e06]{position:absolute;z-index:1;bottom:20px;left:20px;display:flex;flex-direction:column;gap:8px}.zoom-panel[data-v-1eba4e06],.base-layers-control[data-v-1eba4e06],.layers-control[data-v-1eba4e06]{display:flex;flex-direction:column;background:#fff;border-radius:4px;box-shadow:0 1px 4px #0003;overflow:visible;position:relative}.iconbutton[data-v-1eba4e06]{width:30px;height:30px;border:none;background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s;padding:0}.iconbutton[data-v-1eba4e06]:hover{background:#f0f0f0}.iconbutton.isActive[data-v-1eba4e06]{background:#e6f3ff}.iconbutton[data-v-1eba4e06]:not(:last-child){border-bottom:1px solid #ddd}.fade-enter-active[data-v-1eba4e06],.fade-leave-active[data-v-1eba4e06]{transition:opacity .2s ease}.fade-enter-from[data-v-1eba4e06],.fade-leave-to[data-v-1eba4e06]{opacity:0}.modify-overlay[data-v-1eba4e06]{display:flex;flex-direction:column;align-items:stretch;gap:6px;background:#fff;padding:6px;border-radius:4px;box-shadow:0 2px 8px #0003;border:1px solid #ccc}.modify-overlay-label[data-v-1eba4e06]{max-width:220px;padding:0 6px;color:#333;font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modify-overlay-actions[data-v-1eba4e06]{display:flex;gap:4px}.modify-btn[data-v-1eba4e06]{padding:6px 12px;border:none;border-radius:3px;cursor:pointer;font-size:12px;font-weight:500;transition:background-color .2s}.modify-btn-ok[data-v-1eba4e06]{background:#4caf50;color:#fff}.modify-btn-ok[data-v-1eba4e06]:hover{background:#45a049}.modify-btn-cancel[data-v-1eba4e06]{background:#f44336;color:#fff}.modify-btn-cancel[data-v-1eba4e06]:hover{background:#da190b}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@delta10/atlas-sdk",
3
3
  "private": false,
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"