jgis 1.0.2 → 1.0.4

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/dist/2d/index.mjs CHANGED
@@ -1,43 +1,44 @@
1
- var se = Object.defineProperty, ae = Object.defineProperties;
1
+ var ae = Object.defineProperty, se = Object.defineProperties;
2
2
  var ce = Object.getOwnPropertyDescriptors;
3
3
  var B = Object.getOwnPropertySymbols;
4
4
  var ie = Object.prototype.hasOwnProperty, le = Object.prototype.propertyIsEnumerable;
5
- var V = (e, t, r) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, R = (e, t) => {
5
+ var V = (e, t, r) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, R = (e, t) => {
6
6
  for (var r in t || (t = {}))
7
7
  ie.call(t, r) && V(e, r, t[r]);
8
8
  if (B)
9
9
  for (var r of B(t))
10
10
  le.call(t, r) && V(e, r, t[r]);
11
11
  return e;
12
- }, O = (e, t) => ae(e, ce(t));
12
+ }, O = (e, t) => se(e, ce(t));
13
13
  var T = (e, t, r) => new Promise((o, n) => {
14
- var s = (i) => {
14
+ var a = (i) => {
15
15
  try {
16
16
  c(r.next(i));
17
17
  } catch (l) {
18
18
  n(l);
19
19
  }
20
- }, a = (i) => {
20
+ }, s = (i) => {
21
21
  try {
22
22
  c(r.throw(i));
23
23
  } catch (l) {
24
24
  n(l);
25
25
  }
26
- }, c = (i) => i.done ? o(i.value) : Promise.resolve(i.value).then(s, a);
26
+ }, c = (i) => i.done ? o(i.value) : Promise.resolve(i.value).then(a, s);
27
27
  c((r = r.apply(e, t)).next());
28
28
  });
29
29
  import { Map as ue, View as fe } from "ol";
30
- import { Tile as N, Vector as E } from "ol/layer";
31
- import { Vector as v, TileWMS as j, XYZ as G, ImageWMS as W } from "ol/source";
30
+ import { Tile as j, Vector as E } from "ol/layer";
31
+ import { Vector as M, TileWMS as N, XYZ as G, ImageWMS as W } from "ol/source";
32
32
  import { GeoJSON as I } from "ol/format";
33
33
  import ye from "ol/Overlay";
34
34
  import { Geometry as ge, Polygon as me, MultiPolygon as de, MultiLineString as we, LineString as he, Point as be } from "ol/geom";
35
35
  import Le from "ol/Feature";
36
36
  import "ol/extent";
37
37
  import { Style as Fe, Circle as Se, Fill as xe } from "ol/style";
38
- import { click as Me } from "ol/events/condition.js";
39
- import Pe from "ol/interaction/Select";
40
- var g = 63710088e-1, Ee = {
38
+ import { defaults as Pe } from "ol/control";
39
+ import { click as ve } from "ol/events/condition.js";
40
+ import Ee from "ol/interaction/Select";
41
+ var g = 63710088e-1, Me = {
41
42
  centimeters: g * 100,
42
43
  centimetres: g * 100,
43
44
  degrees: 360 / (2 * Math.PI),
@@ -72,7 +73,7 @@ function q(e, t, r = {}) {
72
73
  coordinates: e
73
74
  }, t, r);
74
75
  }
75
- function ve(e, t, r = {}) {
76
+ function Te(e, t, r = {}) {
76
77
  for (const n of e) {
77
78
  if (n.length < 4)
78
79
  throw new Error(
@@ -80,8 +81,8 @@ function ve(e, t, r = {}) {
80
81
  );
81
82
  if (n[n.length - 1].length !== n[0].length)
82
83
  throw new Error("First and last Position are not equivalent.");
83
- for (let s = 0; s < n[n.length - 1].length; s++)
84
- if (n[n.length - 1][s] !== n[0][s])
84
+ for (let a = 0; a < n[n.length - 1].length; a++)
85
+ if (n[n.length - 1][a] !== n[0][a])
85
86
  throw new Error("First and last Position are not equivalent.");
86
87
  }
87
88
  return H({
@@ -89,8 +90,8 @@ function ve(e, t, r = {}) {
89
90
  coordinates: e
90
91
  }, t, r);
91
92
  }
92
- function Te(e, t = "kilometers") {
93
- const r = Ee[t];
93
+ function Ie(e, t = "kilometers") {
94
+ const r = Me[t];
94
95
  if (!r)
95
96
  throw new Error(t + " units is invalid");
96
97
  return e / r;
@@ -104,7 +105,7 @@ function z(e) {
104
105
  function D(e) {
105
106
  return !isNaN(e) && e !== null && !Array.isArray(e);
106
107
  }
107
- function Ie(e) {
108
+ function pe(e) {
108
109
  if (!e)
109
110
  throw new Error("coord is required");
110
111
  if (!Array.isArray(e)) {
@@ -117,25 +118,25 @@ function Ie(e) {
117
118
  return [...e];
118
119
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
119
120
  }
120
- function pe(e, t, r, o = {}) {
121
- const n = Ie(e), s = z(n[0]), a = z(n[1]), c = z(r), i = Te(t, o.units), l = Math.asin(
122
- Math.sin(a) * Math.cos(i) + Math.cos(a) * Math.sin(i) * Math.cos(c)
123
- ), m = s + Math.atan2(
124
- Math.sin(c) * Math.sin(i) * Math.cos(a),
125
- Math.cos(i) - Math.sin(a) * Math.sin(l)
121
+ function Ae(e, t, r, o = {}) {
122
+ const n = pe(e), a = z(n[0]), s = z(n[1]), c = z(r), i = Ie(t, o.units), l = Math.asin(
123
+ Math.sin(s) * Math.cos(i) + Math.cos(s) * Math.sin(i) * Math.cos(c)
124
+ ), m = a + Math.atan2(
125
+ Math.sin(c) * Math.sin(i) * Math.cos(s),
126
+ Math.cos(i) - Math.sin(s) * Math.sin(l)
126
127
  ), x = $(m), u = $(l);
127
128
  return n[2] !== void 0 ? q([x, u, n[2]], o.properties) : q([x, u], o.properties);
128
129
  }
129
- function Ae(e, t, r = {}) {
130
- const o = r.steps || 64, n = r.properties ? r.properties : !Array.isArray(e) && e.type === "Feature" && e.properties ? e.properties : {}, s = [];
131
- for (let a = 0; a < o; a++)
132
- s.push(
133
- pe(e, t, a * -360 / o, r).geometry.coordinates
130
+ function ke(e, t, r = {}) {
131
+ const o = r.steps || 64, n = r.properties ? r.properties : !Array.isArray(e) && e.type === "Feature" && e.properties ? e.properties : {}, a = [];
132
+ for (let s = 0; s < o; s++)
133
+ a.push(
134
+ Ae(e, t, s * -360 / o, r).geometry.coordinates
134
135
  );
135
- return s.push(s[0]), ve([s], n);
136
+ return a.push(a[0]), Te([a], n);
136
137
  }
137
- function p(e) {
138
- return e.lttd && e.lgtd ? [Number(e.lgtd), Number(e.lttd)] : e.jd && e.wd ? [Number(e.jd), Number(e.wd)] : e.latitude && e.longitude ? [Number(e.longitude), Number(e.latitude)] : e.lon && e.lat ? [Number(e.lon), Number(e.lat)] : [0, 0];
138
+ function p(e, t) {
139
+ return typeof e != "object" || e === null ? null : e.lttd && e.lgtd ? [Number(e.lgtd), Number(e.lttd)] : e.jd && e.wd ? [Number(e.jd), Number(e.wd)] : e.latitude && e.longitude ? [Number(e.longitude), Number(e.latitude)] : e.lon && e.lat ? [Number(e.lon), Number(e.lat)] : null;
139
140
  }
140
141
  function U(e, t) {
141
142
  e.getLayers().getArray().forEach((o) => {
@@ -143,53 +144,53 @@ function U(e, t) {
143
144
  });
144
145
  }
145
146
  function J(e, t, r, o = !1) {
146
- const n = o ? r.style || r.getStyle(e, t) : void 0, s = o ? 999 : -1;
147
- n && typeof n.setZIndex == "function" && n.setZIndex(s), t.setStyle(n);
147
+ const n = o ? r.style || r.getStyle(e, t) : void 0, a = o ? 999 : -1;
148
+ n && typeof n.setZIndex == "function" && n.setZIndex(a), t.setStyle(n);
148
149
  }
149
- function ke(e, t, r) {
150
+ function Re(e, t, r) {
150
151
  if (!t) return;
151
152
  const o = r.time || 300;
152
- let n = Date.now(), s = !1, a = 0;
153
+ let n = Date.now(), a = !1, s = 0;
153
154
  t.running = !0;
154
155
  function c() {
155
156
  if (!t.running) return;
156
157
  const i = Date.now();
157
- i - n >= o && (s = !s, n = i, J(e, t, r, s), t.changed()), a = requestAnimationFrame(c);
158
+ i - n >= o && (a = !a, n = i, J(e, t, r, a), t.changed()), s = requestAnimationFrame(c);
158
159
  }
159
160
  c(), t.clearFlash = () => {
160
- t.running = !1, cancelAnimationFrame(a), t.setStyle(void 0);
161
+ t.running = !1, cancelAnimationFrame(s), t.setStyle(void 0);
161
162
  };
162
163
  }
163
- function Re(e, t, r) {
164
- var a, c;
164
+ function Oe(e, t, r) {
165
+ var s, c;
165
166
  if (!r) return;
166
167
  let o = p(r);
167
- const n = (c = (a = Q(e, t)) == null ? void 0 : a.getFeatures) == null ? void 0 : c.call(a);
168
+ const n = (c = (s = Q(e, t)) == null ? void 0 : s.getFeatures) == null ? void 0 : c.call(s);
168
169
  return n ? n.find(function(i) {
169
170
  const l = i.getGeometry();
170
171
  return l && l instanceof ge && typeof l.intersectsCoordinate == "function" ? l.intersectsCoordinate(o) : !1;
171
172
  }) : void 0;
172
173
  }
173
- function Oe(e, t, r) {
174
+ function ze(e, t, r) {
174
175
  const o = [];
175
176
  let n;
176
- const s = r.type || "Point";
177
+ const a = r.type || "Point";
177
178
  t.forEach((c) => {
178
- switch (s) {
179
+ switch (a) {
179
180
  case "Point":
180
181
  n = Ne(c);
181
182
  break;
182
183
  case "LineString":
183
- n = je(c);
184
+ n = Ze(c);
184
185
  break;
185
186
  case "MultiLineString":
186
- n = Ze(c);
187
+ n = _e(c);
187
188
  break;
188
189
  case "MultiPolygon":
189
- n = _e(c);
190
+ n = Ce(c);
190
191
  break;
191
192
  case "Polygon":
192
- n = Ce(c);
193
+ n = Be(c);
193
194
  break;
194
195
  }
195
196
  if (!n) return;
@@ -199,11 +200,11 @@ function Oe(e, t, r) {
199
200
  });
200
201
  i.set("layerName", e), o.push(i);
201
202
  });
202
- const a = new v();
203
- return o.length > 0 && a.addFeatures(o), a;
203
+ const s = new M();
204
+ return o.length > 0 && s.addFeatures(o), s;
204
205
  }
205
- function ze(e, t) {
206
- return t.cqlFilter && (t.cqlFilter ? t.CQL_FILTER += ` and ${t.cqlFilter}` : t.CQL_FILTER = t.cqlFilter), new j({
206
+ function je(e, t) {
207
+ return t.cqlFilter && (t.cqlFilter ? t.CQL_FILTER += ` and ${t.cqlFilter}` : t.CQL_FILTER = t.cqlFilter), new N({
207
208
  url: t.url,
208
209
  params: {
209
210
  LAYERS: t.layers,
@@ -222,23 +223,23 @@ function Ne(e) {
222
223
  if (t)
223
224
  return new be(t);
224
225
  }
225
- function je(e) {
226
+ function Ze(e) {
226
227
  return new he(e.coordinates);
227
228
  }
228
- function Ze(e) {
229
+ function _e(e) {
229
230
  return new we(e.coordinates);
230
231
  }
231
- function _e(e) {
232
+ function Ce(e) {
232
233
  return new de(e.coordinates);
233
234
  }
234
- function Ce(e) {
235
+ function Be(e) {
235
236
  return new me(e.coordinates);
236
237
  }
237
238
  function A(e, t) {
238
239
  let r = null;
239
- return t.style ? r = t.style : t.getStyle ? r = (o, n) => t.getStyle(e, o, n) : r = Be(), r;
240
+ return t.style ? r = t.style : t.getStyle ? r = (o, n) => t.getStyle(e, o, n) : r = Ve(), r;
240
241
  }
241
- function Be() {
242
+ function Ve() {
242
243
  return (t, r) => new Fe({
243
244
  image: new Se({
244
245
  radius: 5,
@@ -246,8 +247,8 @@ function Be() {
246
247
  })
247
248
  });
248
249
  }
249
- function Ve(e, t = {}) {
250
- const r = t.token || "dadcbbdb5206b626a29ca739686b3087", o = t.baseType || "img", n = t.noteType || "cia", s = new N({
250
+ function Ge(e, t = {}) {
251
+ const r = t.token || "dadcbbdb5206b626a29ca739686b3087", o = t.baseType || "img", n = t.noteType || "cia", a = new j({
251
252
  className: "tdt-base-layer",
252
253
  source: new G({
253
254
  url: `http://t0.tianditu.com/DataServer?T=${o}_w&x={x}&y={y}&l={z}&tk=${r}`,
@@ -256,8 +257,8 @@ function Ve(e, t = {}) {
256
257
  }),
257
258
  zIndex: t.zIndex || 1
258
259
  });
259
- s.set("name", "tdt-base-layer");
260
- const a = new N({
260
+ a.set("name", "tdt-base-layer");
261
+ const s = new j({
261
262
  className: "tdt-base-layer",
262
263
  source: new G({
263
264
  url: `http://t0.tianditu.com/DataServer?T=${n}_w&x={x}&y={y}&l={z}&tk=${r}`,
@@ -266,78 +267,78 @@ function Ve(e, t = {}) {
266
267
  }),
267
268
  zIndex: t.zIndex ? t.zIndex + 1 : 2
268
269
  });
269
- return a.set("name", "tdt-baseNote-layer"), e.addLayer(s), e.addLayer(a), s;
270
+ return s.set("name", "tdt-baseNote-layer"), e.addLayer(a), e.addLayer(s), a;
270
271
  }
271
272
  function X(e, t, r, o) {
272
273
  (!o || !o.type) && (o = Object.assign({}, r, o));
273
274
  const n = o.type || "Point";
274
- let s;
275
+ let a;
275
276
  switch (n) {
276
277
  case "GeoJSON":
277
- s = qe(t, r, e, o);
278
+ a = $e(t, r, e, o);
278
279
  break;
279
280
  case "Wms":
280
- s = $e(t, e, o);
281
+ a = De(t, e, o);
281
282
  break;
282
283
  case "Point":
283
284
  case "LineString":
284
285
  case "MultiLineString":
285
286
  case "Polygon":
286
287
  case "MultiPolygon":
287
- s = De(t, r, e, o);
288
+ a = Ue(t, r, e, o);
288
289
  break;
289
290
  case "Circle":
290
- s = Ue(t, r, e, o);
291
+ a = We(t, r, e, o);
291
292
  break;
292
293
  case "Overlay":
293
- s = We(t, e, o);
294
+ a = He(t, e, o);
294
295
  break;
295
296
  }
296
- return s;
297
+ return a;
297
298
  }
298
- function Ge(e, t) {
299
+ function qe(e, t) {
299
300
  Array.isArray(t) ? t.forEach((r) => {
300
301
  U(e, r);
301
302
  }) : U(e, t);
302
303
  }
303
- function qe(e, t, r, o) {
304
+ function $e(e, t, r, o) {
304
305
  console.log(typeof t, t);
305
306
  const n = new I().readFeatures(t, {
306
307
  dataProjection: "EPSG:4326",
307
308
  featureProjection: "EPSG:4326"
308
309
  // 或 'EPSG:3857',看你的地图
309
- }), s = new v();
310
- s.addFeatures(n);
311
- const a = new E({
312
- source: s,
310
+ }), a = new M();
311
+ a.addFeatures(n);
312
+ const s = new E({
313
+ source: a,
313
314
  style: A(e, o),
314
315
  zIndex: o.zIndex || 10
315
316
  });
316
- return a.set("name", e), a.set("type", "webgl"), r.addLayer(a), a;
317
+ return s.set("name", e), s.set("type", "webgl"), r.addLayer(s), s;
317
318
  }
318
- function $e(e, t, r) {
319
- const o = new N({
319
+ function De(e, t, r) {
320
+ const o = new j({
320
321
  opacity: r.opacity || 1,
321
- source: ze(e, r),
322
+ source: je(e, r),
322
323
  zIndex: r.zIndex || 10
323
324
  });
324
325
  return o.set("name", e), t.addLayer(o), o;
325
326
  }
326
- function De(e, t, r, o) {
327
+ function Ue(e, t, r, o) {
327
328
  if (!t || t.length === 0) return null;
328
329
  const n = new E({
329
- source: Oe(e, t, o),
330
+ source: ze(e, t, o),
330
331
  style: A(e, o),
331
332
  zIndex: o.zIndex || 10
332
333
  });
333
334
  return n.set("name", e), n.set("type", "webgl"), r.addLayer(n), n;
334
335
  }
335
- function Ue(e, t, r, o) {
336
- const n = p(t), s = Ae(n, o.radius, { steps: 300, units: "meters" }), a = new I().readFeature(s, {
336
+ function We(e, t, r, o) {
337
+ const n = p(t), a = ke(n, o.radius, { steps: 300, units: "meters" }), s = new I().readFeature(a, {
337
338
  dataProjection: "EPSG:4326",
338
339
  featureProjection: "EPSG:4490"
339
- }), c = new v({ wrapX: !1 });
340
- c.addFeature(a);
340
+ }), c = new M({ wrapX: !1 });
341
+ c.addFeature(s);
341
342
  const i = new E({
342
343
  source: c,
343
344
  style: A(e, o),
@@ -345,7 +346,7 @@ function Ue(e, t, r, o) {
345
346
  });
346
347
  return i.set("name", e), i.set("type", "webgl"), r.addLayer(i), i;
347
348
  }
348
- function We(e, t, r) {
349
+ function He(e, t, r) {
349
350
  const o = document.createElement("div"), n = new ye({
350
351
  element: o,
351
352
  stopEvent: !1,
@@ -353,9 +354,9 @@ function We(e, t, r) {
353
354
  });
354
355
  return n.set("name", e), n.set("type", "webgl"), t.addOverlay(n), { overlayer: n, content: o };
355
356
  }
356
- function He(e, t, r) {
357
+ function Je(e, t, r) {
357
358
  const o = new E({
358
- source: new v({ wrapX: !1 }),
359
+ source: new M({ wrapX: !1 }),
359
360
  zIndex: r.zIndex ? r.zIndex : 10,
360
361
  style: A(t, r)
361
362
  });
@@ -364,32 +365,32 @@ function He(e, t, r) {
364
365
  function Z(e, t) {
365
366
  return e.getAllLayers().find((n) => n.get("name") === t);
366
367
  }
367
- function Je(e, t, r) {
368
+ function Qe(e, t, r) {
368
369
  const o = Z(e, t);
369
370
  return o.setVisible(r), o;
370
371
  }
371
- const P = /* @__PURE__ */ new Map(), S = {}, M = {}, Qe = (e, t) => {
372
- P.has(e) && console.warn(`Map with target '${e}' already exists. Overwriting...`), P.set(e, t), S[e] && (S[e].forEach((r) => r(t)), delete S[e]), M[e] && (M[e].forEach((r) => r(t)), delete M[e]);
372
+ const v = /* @__PURE__ */ new Map(), S = {}, P = {}, Xe = (e, t) => {
373
+ v.has(e) && console.warn(`Map with target '${e}' already exists. Overwriting...`), v.set(e, t), S[e] && (S[e].forEach((r) => r(t)), delete S[e]), P[e] && (P[e].forEach((r) => r(t)), delete P[e]);
373
374
  };
374
375
  function Y(e) {
375
- const t = P.get(e);
376
- return t ? Promise.resolve(t) : (console.warn(`Map '${e}' not found. Make sure useMap() is called first.`), new Promise((r) => {
377
- M[e] = M[e] || [], M[e].push(r);
378
- }));
376
+ const t = v.get(e);
377
+ return t ? Promise.resolve(t) : new Promise((r) => {
378
+ P[e] = P[e] || [], P[e].push(r);
379
+ });
379
380
  }
380
- const Xe = (e) => {
381
- P.has(e) && (P.delete(e), delete S[e]);
381
+ const Ye = (e) => {
382
+ v.has(e) && (v.delete(e), delete S[e]);
382
383
  }, K = (e, t) => {
383
- const r = P.get(e);
384
+ const r = v.get(e);
384
385
  if (r) {
385
386
  t(r);
386
387
  return;
387
388
  }
388
389
  S[e] || (S[e] = []), S[e].push(t);
389
390
  };
390
- function Ye(e, t = {}) {
391
+ function Ke(e, t = {}) {
391
392
  if (!e && !e.target)
392
- throw new Error("请传入地图容器");
393
+ throw new Error("is not a valid element");
393
394
  arguments.length === 1 && typeof e == "object" && (t = e, e = t.target);
394
395
  const o = Object.assign({
395
396
  zoom: 10,
@@ -413,11 +414,16 @@ function Ye(e, t = {}) {
413
414
  zoom: o.zoom,
414
415
  minZoom: o.minZoom,
415
416
  maxZoom: o.maxZoom
417
+ }),
418
+ controls: Pe({
419
+ zoom: !1,
420
+ rotate: !1,
421
+ attribution: !1
416
422
  })
417
423
  });
418
424
  return n.targetId = e, n;
419
425
  }
420
- function Ke(e, t, r, o) {
426
+ function et(e, t, r, o) {
421
427
  X(e, t, r, O(R({}, o), { type: "Point" }));
422
428
  }
423
429
  function ee(e, t, r) {
@@ -438,29 +444,29 @@ function te(e, t) {
438
444
  const r = (t.extend[0] + t.extend[2]) / 2, o = (t.extend[1] + t.extend[3]) / 2;
439
445
  return ee(e, [r, o], t);
440
446
  }
441
- function et(e, t, r) {
447
+ function tt(e, t, r) {
442
448
  const o = t.getGeometry().getExtent();
443
449
  return te(e, O(R({}, r), { extend: o }));
444
450
  }
445
- function tt(e) {
451
+ function rt(e) {
446
452
  return e.getView().getProjection();
447
453
  }
448
454
  function re(e) {
449
455
  return e.getView().getZoom();
450
456
  }
451
- function rt(e, t) {
457
+ function nt(e, t) {
452
458
  e.getView().setZoom(t);
453
459
  }
454
- function nt(e, t) {
460
+ function ot(e, t) {
455
461
  e.un("click", () => {
456
462
  }), e.un("pointermove", () => {
457
- }), Xe(t);
463
+ }), Ye(t);
458
464
  }
459
465
  let F = null;
460
- function ot(e, t = {}) {
466
+ function at(e, t = {}) {
461
467
  const r = new I();
462
- F = new Pe({
463
- condition: Me,
468
+ F = new Ee({
469
+ condition: ve,
464
470
  multi: t.multi || !1,
465
471
  style: (c) => {
466
472
  if (typeof t.getStyle == "function") {
@@ -476,7 +482,7 @@ function ot(e, t = {}) {
476
482
  const o = F.getFeatures(), n = (c) => T(null, null, function* () {
477
483
  const i = (t.layers || e.getLayers().getArray()).filter((w) => {
478
484
  const h = w.getSource();
479
- return w.getVisible() && (h instanceof j || h instanceof W);
485
+ return w.getVisible() && (h instanceof N || h instanceof W);
480
486
  });
481
487
  if (i.length === 0) return;
482
488
  const l = e.getView(), m = i.map((w) => T(null, null, function* () {
@@ -507,7 +513,7 @@ function ot(e, t = {}) {
507
513
  }));
508
514
  });
509
515
  e.on("singleclick", n);
510
- const s = /* @__PURE__ */ new Set();
516
+ const a = /* @__PURE__ */ new Set();
511
517
  F.on("select", (c) => {
512
518
  const i = o.getArray();
513
519
  if (i.length > 0) {
@@ -518,24 +524,24 @@ function ot(e, t = {}) {
518
524
  layer: m.get("wms_layer_source") || F.getLayer(m),
519
525
  event: m.get("wms_event_source") || c
520
526
  }));
521
- a(l);
527
+ s(l);
522
528
  } else
523
- a(null);
529
+ s(null);
524
530
  });
525
- const a = (c) => s.forEach((i) => i(c));
531
+ const s = (c) => a.forEach((i) => i(c));
526
532
  return {
527
- onSelect: (c) => (s.add(c), () => s.delete(c)),
533
+ onSelect: (c) => (a.add(c), () => a.delete(c)),
528
534
  clear: () => {
529
- s.clear(), o.clear();
535
+ a.clear(), o.clear();
530
536
  },
531
537
  destroy: () => {
532
- e.removeInteraction(F), e.un("singleclick", n), s.clear();
538
+ e.removeInteraction(F), e.un("singleclick", n), a.clear();
533
539
  }
534
540
  };
535
541
  }
536
542
  function st(e, t = {}) {
537
543
  var x;
538
- const r = new I(), o = (x = t.debounceTime) != null ? x : 200, n = new v(), s = new E({
544
+ const r = new I(), o = (x = t.debounceTime) != null ? x : 200, n = new M(), a = new E({
539
545
  source: n,
540
546
  map: e,
541
547
  style: t.style,
@@ -545,11 +551,11 @@ function st(e, t = {}) {
545
551
  properties: { title: "JG_HOVER_LAYER" }
546
552
  // 标记一下,防止自己拾取自己
547
553
  });
548
- let a = null, c = null;
554
+ let s = null, c = null;
549
555
  const i = /* @__PURE__ */ new Set(), l = (u, w, h) => {
550
556
  const f = u[0];
551
- if (a !== f)
552
- if (a = f, n.clear(), f ? (n.addFeature(f), t.cursor !== !1 && (e.getTargetElement().style.cursor = "pointer")) : t.cursor !== !1 && (e.getTargetElement().style.cursor = ""), f) {
557
+ if (s !== f)
558
+ if (s = f, n.clear(), f ? (n.addFeature(f), t.cursor !== !1 && (e.getTargetElement().style.cursor = "pointer")) : t.cursor !== !1 && (e.getTargetElement().style.cursor = ""), f) {
553
559
  const L = {
554
560
  feature: f,
555
561
  layer: w,
@@ -564,12 +570,12 @@ function st(e, t = {}) {
564
570
  const w = u.pixel, h = u.coordinate;
565
571
  let f = !1;
566
572
  if (e.forEachFeatureAtPixel(w, (d, y) => {
567
- f || y !== s && (t.layers && !t.layers.includes(y) || (f = !0, c && clearTimeout(c), l([d], y, h)));
573
+ f || y !== a && (t.layers && !t.layers.includes(y) || (f = !0, c && clearTimeout(c), l([d], y, h)));
568
574
  }), f) return;
569
- a && (a = null, n.clear(), e.getTargetElement().style.cursor = "", i.forEach((d) => d(null))), c && clearTimeout(c);
575
+ s && (s = null, n.clear(), e.getTargetElement().style.cursor = "", i.forEach((d) => d(null))), c && clearTimeout(c);
570
576
  const b = (t.layers || e.getLayers().getArray()).filter((d) => {
571
577
  const y = d.getSource();
572
- return d.getVisible() && (y instanceof j || y instanceof W);
578
+ return d.getVisible() && (y instanceof N || y instanceof W);
573
579
  });
574
580
  b.length !== 0 && (c = setTimeout(() => T(null, null, function* () {
575
581
  const d = e.getView();
@@ -594,53 +600,53 @@ function st(e, t = {}) {
594
600
  return e.on("pointermove", m), {
595
601
  onHover: (u) => (i.add(u), () => i.delete(u)),
596
602
  clear: () => {
597
- n.clear(), a = null;
603
+ n.clear(), s = null;
598
604
  },
599
605
  destroy: () => {
600
- e.un("pointermove", m), e.removeLayer(s), i.clear(), c && clearTimeout(c);
606
+ e.un("pointermove", m), e.removeLayer(a), i.clear(), c && clearTimeout(c);
601
607
  }
602
608
  };
603
609
  }
604
- const Lt = (e, t) => {
605
- const r = Ye(e, t);
606
- Ve(r, t.baseLayers);
610
+ const St = (e, t) => {
611
+ const r = Ke(e, t);
612
+ Ge(r, t.baseLayers);
607
613
  const o = {
608
614
  targetId: e,
609
615
  instance: r,
610
616
  // 暴露原始实例以备不时之需
611
- addMarker: (n, s, a) => Ke(r, n, s, a),
612
- createLayer: (n, s, a) => X(r, n, s, a),
613
- createBlankLayer: (n, s) => He(r, n, s),
614
- visibleLayer: (n, s) => Je(r, n, s),
615
- removeLayer: (n) => Ge(r, n),
617
+ addMarker: (n, a, s) => et(r, n, a, s),
618
+ createLayer: (n, a, s) => X(r, n, a, s),
619
+ createBlankLayer: (n, a) => Je(r, n, a),
620
+ visibleLayer: (n, a) => Qe(r, n, a),
621
+ removeLayer: (n) => qe(r, n),
616
622
  getLonLat: (n) => p(n),
617
623
  getLayerByName: (n) => Z(r, n),
618
624
  getSourceByName: (n) => Q(r, n),
619
- useSelect: (n) => ot(r, n),
620
- useHover: (n) => st(r, n),
621
- queryFeature: (n, s) => Re(r, n, s),
622
- lightFeature: (n, s, a, c) => J(n, s, a, c),
623
- flashFeature: (n, s, a) => ke(n, s, a),
624
- flyTo: (n, s) => ee(r, n, s),
625
+ createSelect: (n) => at(r, n),
626
+ createHover: (n) => st(r, n),
627
+ queryFeature: (n, a) => Oe(r, n, a),
628
+ lightFeature: (n, a, s, c) => J(n, a, s, c),
629
+ flashFeature: (n, a, s) => Re(n, a, s),
630
+ flyTo: (n, a) => ee(r, n, a),
625
631
  flyToByExtent: (n) => te(r, n),
626
- flyToByFeature: (n, s) => et(r, n, s),
627
- getProjection: () => tt(r),
632
+ flyToByFeature: (n, a) => tt(r, n, a),
633
+ getProjection: () => rt(r),
628
634
  getZoom: () => re(r),
629
- setZoom: (n) => rt(r, n),
635
+ setZoom: (n) => nt(r, n),
630
636
  getMapContext: (n) => Y(n),
631
- onMapReady: (n, s) => K(n, s),
632
- destroyMap: () => nt(r, e)
637
+ onMapReady: (n, a) => K(n, a),
638
+ destroyMap: () => ot(r, e)
633
639
  };
634
- return Qe(e, o), o;
640
+ return Xe(e, o), o;
635
641
  };
636
- function Ft(e, t) {
642
+ function xt(e, t) {
637
643
  K(e, t);
638
644
  }
639
- function St(e) {
645
+ function Pt(e) {
640
646
  return Y(e);
641
647
  }
642
648
  export {
643
- St as getMapContext,
644
- Ft as onMapReady,
645
- Lt as useMap
649
+ Pt as getMapContext,
650
+ xt as onMapReady,
651
+ St as useMap
646
652
  };
@@ -27,7 +27,7 @@ export interface UseHoverResult {
27
27
  clear: () => void;
28
28
  destroy: () => void;
29
29
  }
30
- export declare function useSelect(map: Map, options?: SelectOptions): UseSelectResult;
30
+ export declare function createSelect(map: Map, options?: SelectOptions): UseSelectResult;
31
31
  export interface HoverOptions {
32
32
  /** 监听图层 */
33
33
  layers?: Layer<any, any>[];
@@ -48,7 +48,7 @@ export interface HoverEvent {
48
48
  properties: any;
49
49
  coordinate: [number, number];
50
50
  }
51
- export declare function useHover(map: Map, options?: HoverOptions): {
51
+ export declare function createHover(map: Map, options?: HoverOptions): {
52
52
  onHover: (cb: (res: HoverEvent[] | null) => void) => () => boolean;
53
53
  clear: () => void;
54
54
  destroy: () => void;