zhihao-ui 1.3.32 → 1.3.33

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.
Files changed (30) hide show
  1. package/dist/es/{BaseInfo-lEzbpRa-.js → BaseInfo-BhnEjLKF.js} +1 -1
  2. package/dist/es/{BaseItem-Ba9x8bVd.js → BaseItem-C4NJy1i4.js} +3 -3
  3. package/dist/es/{Button-BEYBRduL.js → Button-CGndQwez.js} +2 -2
  4. package/dist/es/{DatePicker-LYMSAOex.js → DatePicker-Dy1K1cJQ.js} +3 -3
  5. package/dist/es/{DetailHeader-BmAOi010.js → DetailHeader-DaabNj_4.js} +3 -3
  6. package/dist/es/{DetailSubTitle-BiVypTgw.js → DetailSubTitle-CzFZPXeE.js} +2 -2
  7. package/dist/es/{Dialog-CxVSOXNv.js → Dialog-BUW6ag1B.js} +3 -3
  8. package/dist/es/{DiyDataTable-Ccfx_x83.js → DiyDataTable-D-UZVciZ.js} +4 -4
  9. package/dist/es/{EditInfoPair-B13CtS67.js → EditInfoPair-B2f6zoGY.js} +3 -3
  10. package/dist/es/{FileWrapper-BS8tKD93.js → FileWrapper-D4IxJemr.js} +4 -4
  11. package/dist/es/{Grid-C2SGqgzr.js → Grid-DIs695lY.js} +2 -2
  12. package/dist/es/{InfoPair-Dh7Wmmxp.js → InfoPair-Ce7nDfxD.js} +3 -3
  13. package/dist/es/{Input-D2hOF2Qz.js → Input-C5X2X_YD.js} +3 -3
  14. package/dist/es/{Loading-D_TaBO77.js → Loading-BgoEv5qE.js} +2 -2
  15. package/dist/es/Map-DGFTTIAd.js +2157 -0
  16. package/dist/es/{MessageBox-jeff4H3s.js → MessageBox-DiGH5x51.js} +2 -2
  17. package/dist/es/{MoneyInput-DsPqwnRE.js → MoneyInput-D0kYiOfP.js} +8 -8
  18. package/dist/es/{PageHeadPanel-DzTiZsrm.js → PageHeadPanel-C6IdOq6I.js} +2 -2
  19. package/dist/es/{Table-DVUXl407.js → Table-B_3YA1mb.js} +5 -5
  20. package/dist/es/{ToolTips-D6btU9GM.js → ToolTips-CiQHxGrw.js} +6 -6
  21. package/dist/es/index.js +22 -22
  22. package/dist/es/{utils-BOPMDuno.js → utils-D2wHR1YB.js} +1 -1
  23. package/dist/es/{vendor-DHIg4jsE.js → vendor-D2mv9LHk.js} +1226 -1227
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/Map/function/port.d.ts +2 -2
  26. package/dist/types/components/Map/function/ship/index.d.ts +1 -0
  27. package/dist/umd/index.css +1 -1
  28. package/dist/umd/index.umd.cjs +44 -46
  29. package/package.json +1 -1
  30. package/dist/es/Map-Ch5zj0xU.js +0 -2175
@@ -44651,1411 +44651,1411 @@ class bz extends Lm {
44651
44651
  return this.postRender(this.context, e), E && w.restore(), w.imageSmoothingEnabled = !0, this.container;
44652
44652
  }
44653
44653
  }
44654
- const ec = {
44654
+ class wz {
44655
+ constructor() {
44656
+ this.dataProjection = void 0, this.defaultFeatureProjection = void 0, this.featureClass = /** @type {FeatureToFeatureClass<FeatureType>} */
44657
+ Hr, this.supportedMediaTypes = null;
44658
+ }
44655
44659
  /**
44656
- * Triggered upon feature draw start
44657
- * @event DrawEvent#drawstart
44658
- * @api
44660
+ * Adds the data projection to the read options.
44661
+ * @param {Document|Element|Object|string} source Source.
44662
+ * @param {ReadOptions} [options] Options.
44663
+ * @return {ReadOptions|undefined} Options.
44664
+ * @protected
44659
44665
  */
44660
- DRAWSTART: "drawstart",
44666
+ getReadOptions(e, n) {
44667
+ if (n) {
44668
+ let i = n.dataProjection ? En(n.dataProjection) : this.readProjection(e);
44669
+ n.extent && i && i.getUnits() === "tile-pixels" && (i = En(i), i.setWorldExtent(n.extent)), n = {
44670
+ dataProjection: i,
44671
+ featureProjection: n.featureProjection
44672
+ };
44673
+ }
44674
+ return this.adaptOptions(n);
44675
+ }
44661
44676
  /**
44662
- * Triggered upon feature draw end
44663
- * @event DrawEvent#drawend
44664
- * @api
44677
+ * Sets the `dataProjection` on the options, if no `dataProjection`
44678
+ * is set.
44679
+ * @param {WriteOptions|ReadOptions|undefined} options
44680
+ * Options.
44681
+ * @protected
44682
+ * @return {WriteOptions|ReadOptions|undefined}
44683
+ * Updated options.
44665
44684
  */
44666
- DRAWEND: "drawend",
44685
+ adaptOptions(e) {
44686
+ return Object.assign(
44687
+ {
44688
+ dataProjection: this.dataProjection,
44689
+ featureProjection: this.defaultFeatureProjection,
44690
+ featureClass: this.featureClass
44691
+ },
44692
+ e
44693
+ );
44694
+ }
44667
44695
  /**
44668
- * Triggered upon feature draw abortion
44669
- * @event DrawEvent#drawabort
44670
- * @api
44696
+ * @abstract
44697
+ * @return {Type} The format type.
44671
44698
  */
44672
- DRAWABORT: "drawabort"
44673
- };
44674
- class tc extends Lr {
44699
+ getType() {
44700
+ return je();
44701
+ }
44675
44702
  /**
44676
- * @param {DrawEventType} type Type.
44677
- * @param {Feature} feature The feature drawn.
44703
+ * Read a single feature from a source.
44704
+ *
44705
+ * @abstract
44706
+ * @param {Document|Element|Object|string} source Source.
44707
+ * @param {ReadOptions} [options] Read options.
44708
+ * @return {FeatureType|Array<FeatureType>} Feature.
44678
44709
  */
44679
- constructor(e, n) {
44680
- super(e), this.feature = n;
44710
+ readFeature(e, n) {
44711
+ return je();
44681
44712
  }
44682
- }
44683
- function wz(t, e) {
44684
- const n = [];
44685
- for (let i = 0; i < e.length; ++i) {
44686
- const s = e[i].getGeometry();
44687
- WE(t, s, n);
44713
+ /**
44714
+ * Read all features from a source.
44715
+ *
44716
+ * @abstract
44717
+ * @param {Document|Element|ArrayBuffer|Object|string} source Source.
44718
+ * @param {ReadOptions} [options] Read options.
44719
+ * @return {Array<FeatureType>} Features.
44720
+ */
44721
+ readFeatures(e, n) {
44722
+ return je();
44688
44723
  }
44689
- return n;
44690
- }
44691
- function nc(t, e) {
44692
- return Qr(t[0], t[1], e[0], e[1]);
44693
- }
44694
- function aa(t, e) {
44695
- const n = t.length;
44696
- return e < 0 ? t[e + n] : e >= n ? t[e - n] : t[e];
44697
- }
44698
- function ic(t, e, n) {
44699
- let i, r;
44700
- e < n ? (i = e, r = n) : (i = n, r = e);
44701
- const s = Math.ceil(i), o = Math.floor(r);
44702
- if (s > o) {
44703
- const l = la(t, i), u = la(t, r);
44704
- return nc(l, u);
44724
+ /**
44725
+ * Read a single geometry from a source.
44726
+ *
44727
+ * @abstract
44728
+ * @param {Document|Element|Object|string} source Source.
44729
+ * @param {ReadOptions} [options] Read options.
44730
+ * @return {import("../geom/Geometry.js").default} Geometry.
44731
+ */
44732
+ readGeometry(e, n) {
44733
+ return je();
44705
44734
  }
44706
- let a = 0;
44707
- if (i < s) {
44708
- const l = la(t, i), u = aa(t, s);
44709
- a += nc(l, u);
44735
+ /**
44736
+ * Read the projection from a source.
44737
+ *
44738
+ * @abstract
44739
+ * @param {Document|Element|Object|string} source Source.
44740
+ * @return {import("../proj/Projection.js").default|undefined} Projection.
44741
+ */
44742
+ readProjection(e) {
44743
+ return je();
44710
44744
  }
44711
- if (o < r) {
44712
- const l = aa(t, o), u = la(t, r);
44713
- a += nc(l, u);
44745
+ /**
44746
+ * Encode a feature in this format.
44747
+ *
44748
+ * @abstract
44749
+ * @param {Feature} feature Feature.
44750
+ * @param {WriteOptions} [options] Write options.
44751
+ * @return {string|ArrayBuffer} Result.
44752
+ */
44753
+ writeFeature(e, n) {
44754
+ return je();
44714
44755
  }
44715
- for (let l = s; l < o - 1; ++l) {
44716
- const u = aa(t, l), c = aa(t, l + 1);
44717
- a += nc(u, c);
44756
+ /**
44757
+ * Encode an array of features in this format.
44758
+ *
44759
+ * @abstract
44760
+ * @param {Array<Feature>} features Features.
44761
+ * @param {WriteOptions} [options] Write options.
44762
+ * @return {string|ArrayBuffer} Result.
44763
+ */
44764
+ writeFeatures(e, n) {
44765
+ return je();
44718
44766
  }
44719
- return a;
44720
- }
44721
- function WE(t, e, n) {
44722
- if (e instanceof Tr) {
44723
- rc(t, e.getCoordinates(), !1, n);
44724
- return;
44767
+ /**
44768
+ * Write a single geometry in this format.
44769
+ *
44770
+ * @abstract
44771
+ * @param {import("../geom/Geometry.js").default} geometry Geometry.
44772
+ * @param {WriteOptions} [options] Write options.
44773
+ * @return {string|ArrayBuffer} Result.
44774
+ */
44775
+ writeGeometry(e, n) {
44776
+ return je();
44725
44777
  }
44726
- if (e instanceof iu) {
44727
- const i = e.getCoordinates();
44728
- for (let r = 0, s = i.length; r < s; ++r)
44729
- rc(t, i[r], !1, n);
44730
- return;
44778
+ }
44779
+ function B_(t, e, n) {
44780
+ const i = n ? En(n.featureProjection) : null, r = n ? En(n.dataProjection) : null;
44781
+ let s = t;
44782
+ if (i && r && !yc(i, r)) {
44783
+ e && (s = /** @type {T} */
44784
+ t.clone());
44785
+ const o = e ? i : r, a = e ? r : i;
44786
+ o.getUnits() === "tile-pixels" ? s.transform(o, a) : s.applyTransform(Aa(o, a));
44731
44787
  }
44732
- if (e instanceof os) {
44733
- const i = e.getCoordinates();
44734
- for (let r = 0, s = i.length; r < s; ++r)
44735
- rc(t, i[r], !0, n);
44736
- return;
44788
+ if (e && n && /** @type {WriteOptions} */
44789
+ n.decimals !== void 0) {
44790
+ const o = Math.pow(
44791
+ 10,
44792
+ /** @type {WriteOptions} */
44793
+ n.decimals
44794
+ ), a = function(l) {
44795
+ for (let u = 0, c = l.length; u < c; ++u)
44796
+ l[u] = Math.round(l[u] * o) / o;
44797
+ return l;
44798
+ };
44799
+ s === t && (s = /** @type {T} */
44800
+ t.clone()), s.applyTransform(a);
44737
44801
  }
44738
- if (e instanceof ru) {
44739
- const i = e.getCoordinates();
44740
- for (let r = 0, s = i.length; r < s; ++r) {
44741
- const o = i[r];
44742
- for (let a = 0, l = o.length; a < l; ++a)
44743
- rc(t, o[a], !0, n);
44744
- }
44745
- return;
44802
+ return s;
44803
+ }
44804
+ class Ez extends wz {
44805
+ constructor() {
44806
+ super();
44746
44807
  }
44747
- if (e instanceof td) {
44748
- const i = e.getGeometries();
44749
- for (let r = 0; r < i.length; ++r)
44750
- WE(t, i[r], n);
44751
- return;
44808
+ /**
44809
+ * @return {import("./Feature.js").Type} Format.
44810
+ * @override
44811
+ */
44812
+ getType() {
44813
+ return "text";
44752
44814
  }
44753
- }
44754
- const nf = { index: -1, endIndex: NaN };
44755
- function Ez(t, e, n, i) {
44756
- const r = t[0], s = t[1];
44757
- let o = 1 / 0, a = -1, l = NaN;
44758
- for (let d = 0; d < e.targets.length; ++d) {
44759
- const h = e.targets[d], p = h.coordinates;
44760
- let f = 1 / 0, m;
44761
- for (let _ = 0; _ < p.length - 1; ++_) {
44762
- const y = p[_], w = p[_ + 1], E = VE(r, s, y, w);
44763
- E.squaredDistance < f && (f = E.squaredDistance, m = _ + E.along);
44764
- }
44765
- f < o && (o = f, h.ring && e.targetIndex === d && (h.endIndex > h.startIndex ? m < h.startIndex && (m += p.length) : h.endIndex < h.startIndex && m > h.startIndex && (m -= p.length)), l = m, a = d);
44815
+ /**
44816
+ * Read the feature from the source.
44817
+ *
44818
+ * @param {Document|Element|Object|string} source Source.
44819
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
44820
+ * @return {import("../Feature.js").default} Feature.
44821
+ * @api
44822
+ * @override
44823
+ */
44824
+ readFeature(e, n) {
44825
+ return this.readFeatureFromText(
44826
+ ec(e),
44827
+ this.adaptOptions(n)
44828
+ );
44766
44829
  }
44767
- const u = e.targets[a];
44768
- let c = u.ring;
44769
- if (e.targetIndex === a && c) {
44770
- const d = la(
44771
- u.coordinates,
44772
- l
44773
- ), h = n.getPixelFromCoordinate(d);
44774
- Mw(h, e.startPx) > i && (c = !1);
44830
+ /**
44831
+ * @abstract
44832
+ * @param {string} text Text.
44833
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
44834
+ * @protected
44835
+ * @return {import("../Feature.js").default} Feature.
44836
+ */
44837
+ readFeatureFromText(e, n) {
44838
+ return je();
44775
44839
  }
44776
- if (c) {
44777
- const d = u.coordinates, h = d.length, p = u.startIndex, f = l;
44778
- if (p < f) {
44779
- const m = ic(
44780
- d,
44781
- p,
44782
- f
44783
- );
44784
- ic(
44785
- d,
44786
- p,
44787
- f - h
44788
- ) < m && (l -= h);
44789
- } else {
44790
- const m = ic(
44791
- d,
44792
- p,
44793
- f
44794
- );
44795
- ic(
44796
- d,
44797
- p,
44798
- f + h
44799
- ) < m && (l += h);
44800
- }
44801
- }
44802
- return nf.index = a, nf.endIndex = l, nf;
44803
- }
44804
- function rc(t, e, n, i) {
44805
- const r = t[0], s = t[1];
44806
- for (let o = 0, a = e.length - 1; o < a; ++o) {
44807
- const l = e[o], u = e[o + 1], c = VE(r, s, l, u);
44808
- if (c.squaredDistance === 0) {
44809
- const d = o + c.along;
44810
- i.push({
44811
- coordinates: e,
44812
- ring: n,
44813
- startIndex: d,
44814
- endIndex: d
44815
- });
44816
- return;
44817
- }
44818
- }
44819
- }
44820
- const rf = { along: 0, squaredDistance: 0 };
44821
- function VE(t, e, n, i) {
44822
- const r = n[0], s = n[1], o = i[0], a = i[1], l = o - r, u = a - s;
44823
- let c = 0, d = r, h = s;
44824
- return (l !== 0 || u !== 0) && (c = qt(((t - r) * l + (e - s) * u) / (l * l + u * u), 0, 1), d += l * c, h += u * c), rf.along = c, rf.squaredDistance = Xd(Qr(t, e, d, h), 10), rf;
44825
- }
44826
- function la(t, e) {
44827
- const n = t.length;
44828
- let i = Math.floor(e);
44829
- const r = e - i;
44830
- i >= n ? i -= n : i < 0 && (i += n);
44831
- let s = i + 1;
44832
- s >= n && (s -= n);
44833
- const o = t[i], a = o[0], l = o[1], u = t[s], c = u[0] - a, d = u[1] - l;
44834
- return [a + c * r, l + d * r];
44835
- }
44836
- class ZW extends tl {
44837
44840
  /**
44838
- * @param {Options} options Options.
44841
+ * Read the features from the source.
44842
+ *
44843
+ * @param {Document|Element|Object|string} source Source.
44844
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
44845
+ * @return {Array<import("../Feature.js").default>} Features.
44846
+ * @api
44847
+ * @override
44839
44848
  */
44840
- constructor(e) {
44841
- const n = (
44842
- /** @type {import("./Pointer.js").Options} */
44843
- e
44849
+ readFeatures(e, n) {
44850
+ return this.readFeaturesFromText(
44851
+ ec(e),
44852
+ this.adaptOptions(n)
44844
44853
  );
44845
- n.stopDown || (n.stopDown = qa), super(n), this.on, this.once, this.un, this.shouldHandle_ = !1, this.downPx_ = null, this.downTimeout_, this.lastDragTime_, this.pointerType_, this.freehand_ = !1, this.source_ = e.source ? e.source : null, this.features_ = e.features ? e.features : null, this.snapTolerance_ = e.snapTolerance ? e.snapTolerance : 12, this.type_ = /** @type {import("../geom/Geometry.js").Type} */
44846
- e.type, this.mode_ = Sz(this.type_), this.stopClick_ = !!e.stopClick, this.minPoints_ = e.minPoints ? e.minPoints : this.mode_ === "Polygon" ? 3 : 2, this.maxPoints_ = this.mode_ === "Circle" ? 2 : e.maxPoints ? e.maxPoints : 1 / 0, this.finishCondition_ = e.finishCondition ? e.finishCondition : Ma, this.geometryLayout_ = e.geometryLayout ? e.geometryLayout : "XY";
44847
- let i = e.geometryFunction;
44848
- if (!i) {
44849
- const r = this.mode_;
44850
- if (r === "Circle")
44851
- i = (s, o, a) => {
44852
- const l = o || new uh([NaN, NaN]), u = Hi(s[0]), c = Iw(
44853
- u,
44854
- Hi(s[s.length - 1])
44855
- );
44856
- return l.setCenterAndRadius(
44857
- u,
44858
- Math.sqrt(c),
44859
- this.geometryLayout_
44860
- ), l;
44861
- };
44862
- else {
44863
- let s;
44864
- r === "Point" ? s = zs : r === "LineString" ? s = Tr : r === "Polygon" && (s = os), i = (o, a, l) => (a ? r === "Polygon" ? o[0].length ? a.setCoordinates(
44865
- [o[0].concat([o[0][0]])],
44866
- this.geometryLayout_
44867
- ) : a.setCoordinates([], this.geometryLayout_) : a.setCoordinates(o, this.geometryLayout_) : a = new s(o, this.geometryLayout_), a);
44868
- }
44869
- }
44870
- this.geometryFunction_ = i, this.dragVertexDelay_ = e.dragVertexDelay !== void 0 ? e.dragVertexDelay : 500, this.finishCoordinate_ = null, this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchCoords_ = null, this.sketchLine_ = null, this.sketchLineCoords_ = null, this.squaredClickTolerance_ = e.clickTolerance ? e.clickTolerance * e.clickTolerance : 36, this.overlay_ = new GB({
44871
- source: new KB({
44872
- useSpatialIndex: !1,
44873
- wrapX: e.wrapX ? e.wrapX : !1
44874
- }),
44875
- style: e.style ? e.style : Cz(),
44876
- updateWhileInteracting: !0
44877
- }), this.geometryName_ = e.geometryName, this.condition_ = e.condition ? e.condition : Bm, this.freehandCondition_, e.freehand ? this.freehandCondition_ = Eg : this.freehandCondition_ = e.freehandCondition ? e.freehandCondition : DE, this.traceCondition_, this.setTrace(e.trace || !1), this.traceState_ = { active: !1 }, this.traceSource_ = e.traceSource || e.source || null, this.addChangeListener(bg.ACTIVE, this.updateState_);
44878
44854
  }
44879
44855
  /**
44880
- * Toggle tracing mode or set a tracing condition.
44881
- *
44882
- * @param {boolean|import("../events/condition.js").Condition} trace A boolean to toggle tracing mode or an event
44883
- * condition that will be checked when a feature is clicked to determine if tracing should be active.
44856
+ * @abstract
44857
+ * @param {string} text Text.
44858
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
44859
+ * @protected
44860
+ * @return {Array<import("../Feature.js").default>} Features.
44884
44861
  */
44885
- setTrace(e) {
44886
- let n;
44887
- e ? e === !0 ? n = Eg : n = e : n = fY, this.traceCondition_ = n;
44862
+ readFeaturesFromText(e, n) {
44863
+ return je();
44888
44864
  }
44889
44865
  /**
44890
- * Remove the interaction from its current map and attach it to the new map.
44891
- * Subclasses may set up event handlers to get notified about changes to
44892
- * the map here.
44893
- * @param {import("../Map.js").default} map Map.
44866
+ * Read the geometry from the source.
44867
+ *
44868
+ * @param {Document|Element|Object|string} source Source.
44869
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
44870
+ * @return {import("../geom/Geometry.js").default} Geometry.
44871
+ * @api
44894
44872
  * @override
44895
44873
  */
44896
- setMap(e) {
44897
- super.setMap(e), this.updateState_();
44874
+ readGeometry(e, n) {
44875
+ return this.readGeometryFromText(
44876
+ ec(e),
44877
+ this.adaptOptions(n)
44878
+ );
44898
44879
  }
44899
44880
  /**
44900
- * Get the overlay layer that this interaction renders sketch features to.
44901
- * @return {VectorLayer} Overlay layer.
44902
- * @api
44881
+ * @abstract
44882
+ * @param {string} text Text.
44883
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
44884
+ * @protected
44885
+ * @return {import("../geom/Geometry.js").default} Geometry.
44903
44886
  */
44904
- getOverlay() {
44905
- return this.overlay_;
44887
+ readGeometryFromText(e, n) {
44888
+ return je();
44906
44889
  }
44907
44890
  /**
44908
- * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may actually draw or finish the drawing.
44909
- * @param {import("../MapBrowserEvent.js").default} event Map browser event.
44910
- * @return {boolean} `false` to stop event propagation.
44891
+ * Read the projection from the source.
44892
+ *
44893
+ * @param {Document|Element|Object|string} source Source.
44894
+ * @return {import("../proj/Projection.js").default|undefined} Projection.
44911
44895
  * @api
44912
44896
  * @override
44913
44897
  */
44914
- handleEvent(e) {
44915
- e.originalEvent.type === Ge.CONTEXTMENU && e.originalEvent.preventDefault(), this.freehand_ = this.mode_ !== "Point" && this.freehandCondition_(e);
44916
- let n = e.type === xt.POINTERMOVE, i = !0;
44917
- return !this.freehand_ && this.lastDragTime_ && e.type === xt.POINTERDRAG && (Date.now() - this.lastDragTime_ >= this.dragVertexDelay_ ? (this.downPx_ = e.pixel, this.shouldHandle_ = !this.freehand_, n = !0) : this.lastDragTime_ = void 0, this.shouldHandle_ && this.downTimeout_ !== void 0 && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0)), this.freehand_ && e.type === xt.POINTERDRAG && this.sketchFeature_ !== null ? (this.addToDrawing_(e.coordinate), i = !1) : this.freehand_ && e.type === xt.POINTERDOWN ? i = !1 : n && this.getPointerCount() < 2 ? (i = e.type === xt.POINTERMOVE, i && this.freehand_ ? (this.handlePointerMove_(e), this.shouldHandle_ && e.originalEvent.preventDefault()) : (e.originalEvent.pointerType === "mouse" || e.type === xt.POINTERDRAG && this.downTimeout_ === void 0) && this.handlePointerMove_(e)) : e.type === xt.DBLCLICK && (i = !1), super.handleEvent(e) && i;
44898
+ readProjection(e) {
44899
+ return this.readProjectionFromText(ec(e));
44918
44900
  }
44919
44901
  /**
44920
- * Handle pointer down events.
44921
- * @param {import("../MapBrowserEvent.js").default} event Event.
44922
- * @return {boolean} If the event was consumed.
44923
- * @override
44902
+ * @param {string} text Text.
44903
+ * @protected
44904
+ * @return {import("../proj/Projection.js").default|undefined} Projection.
44924
44905
  */
44925
- handleDownEvent(e) {
44926
- return this.shouldHandle_ = !this.freehand_, this.freehand_ ? (this.downPx_ = e.pixel, this.finishCoordinate_ || this.startDrawing_(e.coordinate), !0) : this.condition_(e) ? (this.lastDragTime_ = Date.now(), this.downTimeout_ = setTimeout(() => {
44927
- this.handlePointerMove_(
44928
- new Vr(
44929
- xt.POINTERMOVE,
44930
- e.map,
44931
- e.originalEvent,
44932
- !1,
44933
- e.frameState
44934
- )
44935
- );
44936
- }, this.dragVertexDelay_), this.downPx_ = e.pixel, !0) : (this.lastDragTime_ = void 0, !1);
44906
+ readProjectionFromText(e) {
44907
+ return this.dataProjection;
44937
44908
  }
44938
44909
  /**
44939
- * @private
44910
+ * Encode a feature as a string.
44911
+ *
44912
+ * @param {import("../Feature.js").default} feature Feature.
44913
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
44914
+ * @return {string} Encoded feature.
44915
+ * @api
44916
+ * @override
44940
44917
  */
44941
- deactivateTrace_() {
44942
- this.traceState_ = { active: !1 };
44918
+ writeFeature(e, n) {
44919
+ return this.writeFeatureText(e, this.adaptOptions(n));
44943
44920
  }
44944
44921
  /**
44945
- * Activate or deactivate trace state based on a browser event.
44946
- * @param {import("../MapBrowserEvent.js").default} event Event.
44947
- * @private
44922
+ * @abstract
44923
+ * @param {import("../Feature.js").default} feature Features.
44924
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
44925
+ * @protected
44926
+ * @return {string} Text.
44948
44927
  */
44949
- toggleTraceState_(e) {
44950
- if (!this.traceSource_ || !this.traceCondition_(e))
44951
- return;
44952
- if (this.traceState_.active) {
44953
- this.deactivateTrace_();
44954
- return;
44955
- }
44956
- const n = this.getMap(), i = n.getCoordinateFromPixel([
44957
- e.pixel[0] - this.snapTolerance_,
44958
- e.pixel[1] + this.snapTolerance_
44959
- ]), r = n.getCoordinateFromPixel([
44960
- e.pixel[0] + this.snapTolerance_,
44961
- e.pixel[1] - this.snapTolerance_
44962
- ]), s = ig([i, r]), o = this.traceSource_.getFeaturesInExtent(s);
44963
- if (o.length === 0)
44964
- return;
44965
- const a = wz(e.coordinate, o);
44966
- a.length && (this.traceState_ = {
44967
- active: !0,
44968
- startPx: e.pixel.slice(),
44969
- targets: a,
44970
- targetIndex: -1
44971
- });
44928
+ writeFeatureText(e, n) {
44929
+ return je();
44972
44930
  }
44973
44931
  /**
44974
- * @param {TraceTarget} target The trace target.
44975
- * @param {number} endIndex The new end index of the trace.
44976
- * @private
44932
+ * Encode an array of features as string.
44933
+ *
44934
+ * @param {Array<import("../Feature.js").default>} features Features.
44935
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
44936
+ * @return {string} Encoded features.
44937
+ * @api
44938
+ * @override
44977
44939
  */
44978
- addOrRemoveTracedCoordinates_(e, n) {
44979
- const i = e.startIndex <= e.endIndex, r = e.startIndex <= n;
44980
- i === r ? i && n > e.endIndex || !i && n < e.endIndex ? this.addTracedCoordinates_(e, e.endIndex, n) : (i && n < e.endIndex || !i && n > e.endIndex) && this.removeTracedCoordinates_(n, e.endIndex) : (this.removeTracedCoordinates_(e.startIndex, e.endIndex), this.addTracedCoordinates_(e, e.startIndex, n));
44940
+ writeFeatures(e, n) {
44941
+ return this.writeFeaturesText(e, this.adaptOptions(n));
44981
44942
  }
44982
44943
  /**
44983
- * @param {number} fromIndex The start index.
44984
- * @param {number} toIndex The end index.
44985
- * @private
44944
+ * @abstract
44945
+ * @param {Array<import("../Feature.js").default>} features Features.
44946
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
44947
+ * @protected
44948
+ * @return {string} Text.
44986
44949
  */
44987
- removeTracedCoordinates_(e, n) {
44988
- if (e === n)
44989
- return;
44990
- let i = 0;
44991
- if (e < n) {
44992
- const r = Math.ceil(e);
44993
- let s = Math.floor(n);
44994
- s === n && (s -= 1), i = s - r + 1;
44995
- } else {
44996
- const r = Math.floor(e);
44997
- let s = Math.ceil(n);
44998
- s === n && (s += 1), i = r - s + 1;
44999
- }
45000
- i > 0 && this.removeLastPoints_(i);
44950
+ writeFeaturesText(e, n) {
44951
+ return je();
45001
44952
  }
45002
44953
  /**
45003
- * @param {TraceTarget} target The trace target.
45004
- * @param {number} fromIndex The start index.
45005
- * @param {number} toIndex The end index.
45006
- * @private
44954
+ * Write a single geometry.
44955
+ *
44956
+ * @param {import("../geom/Geometry.js").default} geometry Geometry.
44957
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
44958
+ * @return {string} Geometry.
44959
+ * @api
44960
+ * @override
45007
44961
  */
45008
- addTracedCoordinates_(e, n, i) {
45009
- if (n === i)
45010
- return;
45011
- const r = [];
45012
- if (n < i) {
45013
- const s = Math.ceil(n);
45014
- let o = Math.floor(i);
45015
- o === i && (o -= 1);
45016
- for (let a = s; a <= o; ++a)
45017
- r.push(aa(e.coordinates, a));
45018
- } else {
45019
- const s = Math.floor(n);
45020
- let o = Math.ceil(i);
45021
- o === i && (o += 1);
45022
- for (let a = s; a >= o; --a)
45023
- r.push(aa(e.coordinates, a));
45024
- }
45025
- r.length && this.appendCoordinates(r);
44962
+ writeGeometry(e, n) {
44963
+ return this.writeGeometryText(e, this.adaptOptions(n));
45026
44964
  }
45027
44965
  /**
45028
- * Update the trace.
45029
- * @param {import("../MapBrowserEvent.js").default} event Event.
45030
- * @private
44966
+ * @abstract
44967
+ * @param {import("../geom/Geometry.js").default} geometry Geometry.
44968
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
44969
+ * @protected
44970
+ * @return {string} Text.
45031
44971
  */
45032
- updateTrace_(e) {
45033
- const n = this.traceState_;
45034
- if (!n.active || n.targetIndex === -1 && Mw(n.startPx, e.pixel) < this.snapTolerance_)
45035
- return;
45036
- const i = Ez(
45037
- e.coordinate,
45038
- n,
45039
- this.getMap(),
45040
- this.snapTolerance_
45041
- );
45042
- if (n.targetIndex !== i.index) {
45043
- if (n.targetIndex !== -1) {
45044
- const l = n.targets[n.targetIndex];
45045
- this.removeTracedCoordinates_(l.startIndex, l.endIndex);
45046
- }
45047
- const a = n.targets[i.index];
45048
- this.addTracedCoordinates_(
45049
- a,
45050
- a.startIndex,
45051
- i.endIndex
45052
- );
45053
- } else {
45054
- const a = n.targets[n.targetIndex];
45055
- this.addOrRemoveTracedCoordinates_(a, i.endIndex);
45056
- }
45057
- n.targetIndex = i.index;
45058
- const r = n.targets[n.targetIndex];
45059
- r.endIndex = i.endIndex;
45060
- const s = la(
45061
- r.coordinates,
45062
- r.endIndex
45063
- ), o = this.getMap().getPixelFromCoordinate(s);
45064
- e.coordinate = s, e.pixel = [Math.round(o[0]), Math.round(o[1])];
44972
+ writeGeometryText(e, n) {
44973
+ return je();
44974
+ }
44975
+ }
44976
+ function ec(t) {
44977
+ return typeof t == "string" ? t : "";
44978
+ }
44979
+ function Y_(t, e, n, i, r, s) {
44980
+ r !== void 0 ? (r = r, s = s !== void 0 ? s : 0) : (r = [], s = 0);
44981
+ let o = e;
44982
+ for (; o < n; ) {
44983
+ const a = t[o++];
44984
+ r[s++] = t[o++], r[s++] = a;
44985
+ for (let l = 2; l < i; ++l)
44986
+ r[s++] = t[o++];
45065
44987
  }
44988
+ return r.length = s, r;
44989
+ }
44990
+ class ZW extends Ez {
45066
44991
  /**
45067
- * Handle pointer up events.
45068
- * @param {import("../MapBrowserEvent.js").default} event Event.
45069
- * @return {boolean} If the event was consumed.
45070
- * @override
44992
+ * @param {Options} [options] Optional configuration object.
45071
44993
  */
45072
- handleUpEvent(e) {
45073
- let n = !0;
45074
- if (this.getPointerCount() === 0) {
45075
- this.downTimeout_ && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0), this.handlePointerMove_(e);
45076
- const i = this.traceState_.active;
45077
- if (this.toggleTraceState_(e), this.shouldHandle_) {
45078
- const r = !this.finishCoordinate_;
45079
- r && this.startDrawing_(e.coordinate), !r && this.freehand_ ? this.finishDrawing() : !this.freehand_ && (!r || this.mode_ === "Point") && (this.atFinish_(e.pixel, i) ? this.finishCondition_(e) && this.finishDrawing() : this.addToDrawing_(e.coordinate)), n = !1;
45080
- } else this.freehand_ && this.abortDrawing();
45081
- }
45082
- return !n && this.stopClick_ && e.preventDefault(), n;
44994
+ constructor(e) {
44995
+ super(), e = e || {}, this.dataProjection = En("EPSG:4326"), this.factor_ = e.factor ? e.factor : 1e5, this.geometryLayout_ = e.geometryLayout ? e.geometryLayout : "XY";
45083
44996
  }
45084
44997
  /**
45085
- * Handle move events.
45086
- * @param {import("../MapBrowserEvent.js").default} event A move event.
45087
- * @private
44998
+ * @protected
44999
+ * @param {string} text Text.
45000
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
45001
+ * @return {import("../Feature.js").default} Feature.
45002
+ * @override
45088
45003
  */
45089
- handlePointerMove_(e) {
45090
- if (this.pointerType_ = e.originalEvent.pointerType, this.downPx_ && (!this.freehand_ && this.shouldHandle_ || this.freehand_ && !this.shouldHandle_)) {
45091
- const n = this.downPx_, i = e.pixel, r = n[0] - i[0], s = n[1] - i[1], o = r * r + s * s;
45092
- if (this.shouldHandle_ = this.freehand_ ? o > this.squaredClickTolerance_ : o <= this.squaredClickTolerance_, !this.shouldHandle_)
45093
- return;
45094
- }
45095
- if (!this.finishCoordinate_) {
45096
- this.createOrUpdateSketchPoint_(e.coordinate.slice());
45097
- return;
45098
- }
45099
- this.updateTrace_(e), this.modifyDrawing_(e.coordinate);
45004
+ readFeatureFromText(e, n) {
45005
+ const i = this.readGeometryFromText(e, n);
45006
+ return new Hr(i);
45100
45007
  }
45101
45008
  /**
45102
- * Determine if an event is within the snapping tolerance of the start coord.
45103
- * @param {import("../pixel.js").Pixel} pixel Pixel.
45104
- * @param {boolean} [tracing] Drawing in trace mode (only stop if at the starting point).
45105
- * @return {boolean} The event is within the snapping tolerance of the start.
45106
- * @private
45009
+ * @param {string} text Text.
45010
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
45011
+ * @protected
45012
+ * @return {Array<Feature>} Features.
45013
+ * @override
45107
45014
  */
45108
- atFinish_(e, n) {
45109
- let i = !1;
45110
- if (this.sketchFeature_) {
45111
- let r = !1, s = [this.finishCoordinate_];
45112
- const o = this.mode_;
45113
- if (o === "Point")
45114
- i = !0;
45115
- else if (o === "Circle")
45116
- i = this.sketchCoords_.length === 2;
45117
- else if (o === "LineString")
45118
- r = !n && this.sketchCoords_.length > this.minPoints_;
45119
- else if (o === "Polygon") {
45120
- const a = (
45121
- /** @type {PolyCoordType} */
45122
- this.sketchCoords_
45123
- );
45124
- r = a[0].length > this.minPoints_, s = [
45125
- a[0][0],
45126
- a[0][a[0].length - 2]
45127
- ], n ? s = [a[0][0]] : s = [
45128
- a[0][0],
45129
- a[0][a[0].length - 2]
45130
- ];
45131
- }
45132
- if (r) {
45133
- const a = this.getMap();
45134
- for (let l = 0, u = s.length; l < u; l++) {
45135
- const c = s[l], d = a.getPixelFromCoordinate(c), h = e[0] - d[0], p = e[1] - d[1], f = this.freehand_ ? 1 : this.snapTolerance_;
45136
- if (i = Math.sqrt(h * h + p * p) <= f, i) {
45137
- this.finishCoordinate_ = c;
45138
- break;
45139
- }
45140
- }
45141
- }
45142
- }
45143
- return i;
45015
+ readFeaturesFromText(e, n) {
45016
+ return [this.readFeatureFromText(e, n)];
45144
45017
  }
45145
45018
  /**
45146
- * @param {import("../coordinate").Coordinate} coordinates Coordinate.
45147
- * @private
45019
+ * @param {string} text Text.
45020
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
45021
+ * @protected
45022
+ * @return {import("../geom/Geometry.js").default} Geometry.
45023
+ * @override
45148
45024
  */
45149
- createOrUpdateSketchPoint_(e) {
45150
- this.sketchPoint_ ? this.sketchPoint_.getGeometry().setCoordinates(e) : (this.sketchPoint_ = new Hr(new zs(e)), this.updateSketchFeatures_());
45025
+ readGeometryFromText(e, n) {
45026
+ const i = jl(this.geometryLayout_), r = Sz(e, i, this.factor_);
45027
+ Y_(r, 0, r.length, i, r);
45028
+ const s = Xr(
45029
+ r,
45030
+ 0,
45031
+ r.length,
45032
+ i
45033
+ ), o = new Tr(s, this.geometryLayout_);
45034
+ return B_(
45035
+ o,
45036
+ !1,
45037
+ this.adaptOptions(n)
45038
+ );
45151
45039
  }
45152
45040
  /**
45153
- * @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
45154
- * @private
45041
+ * @param {import("../Feature.js").default<LineString>} feature Features.
45042
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
45043
+ * @protected
45044
+ * @return {string} Text.
45045
+ * @override
45155
45046
  */
45156
- createOrUpdateCustomSketchLine_(e) {
45157
- this.sketchLine_ || (this.sketchLine_ = new Hr());
45158
- const n = e.getLinearRing(0);
45159
- let i = this.sketchLine_.getGeometry();
45160
- i ? (i.setFlatCoordinates(
45161
- n.getLayout(),
45162
- n.getFlatCoordinates()
45163
- ), i.changed()) : (i = new Tr(
45164
- n.getFlatCoordinates(),
45165
- n.getLayout()
45166
- ), this.sketchLine_.setGeometry(i));
45047
+ writeFeatureText(e, n) {
45048
+ const i = e.getGeometry();
45049
+ if (i)
45050
+ return this.writeGeometryText(i, n);
45051
+ throw new Error("Expected `feature` to have a geometry");
45167
45052
  }
45168
45053
  /**
45169
- * Start the drawing.
45170
- * @param {import("../coordinate.js").Coordinate} start Start coordinate.
45171
- * @private
45054
+ * @param {Array<import("../Feature.js").default<LineString>>} features Features.
45055
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
45056
+ * @protected
45057
+ * @return {string} Text.
45058
+ * @override
45172
45059
  */
45173
- startDrawing_(e) {
45174
- const n = this.getMap().getView().getProjection(), i = jl(this.geometryLayout_);
45175
- for (; e.length < i; )
45176
- e.push(0);
45177
- this.finishCoordinate_ = e, this.mode_ === "Point" ? this.sketchCoords_ = e.slice() : this.mode_ === "Polygon" ? (this.sketchCoords_ = [[e.slice(), e.slice()]], this.sketchLineCoords_ = this.sketchCoords_[0]) : this.sketchCoords_ = [e.slice(), e.slice()], this.sketchLineCoords_ && (this.sketchLine_ = new Hr(new Tr(this.sketchLineCoords_)));
45178
- const r = this.geometryFunction_(
45179
- this.sketchCoords_,
45180
- void 0,
45181
- n
45182
- );
45183
- this.sketchFeature_ = new Hr(), this.geometryName_ && this.sketchFeature_.setGeometryName(this.geometryName_), this.sketchFeature_.setGeometry(r), this.updateSketchFeatures_(), this.dispatchEvent(
45184
- new tc(ec.DRAWSTART, this.sketchFeature_)
45185
- );
45060
+ writeFeaturesText(e, n) {
45061
+ return this.writeFeatureText(e[0], n);
45186
45062
  }
45187
45063
  /**
45188
- * Modify the drawing.
45189
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
45190
- * @private
45064
+ * @param {LineString} geometry Geometry.
45065
+ * @param {import("./Feature.js").WriteOptions} [options] Write options.
45066
+ * @protected
45067
+ * @return {string} Text.
45068
+ * @override
45191
45069
  */
45192
- modifyDrawing_(e) {
45193
- const n = this.getMap(), i = this.sketchFeature_.getGeometry(), r = n.getView().getProjection(), s = jl(this.geometryLayout_);
45194
- let o, a;
45195
- for (; e.length < s; )
45196
- e.push(0);
45197
- this.mode_ === "Point" ? a = this.sketchCoords_ : this.mode_ === "Polygon" ? (o = /** @type {PolyCoordType} */
45198
- this.sketchCoords_[0], a = o[o.length - 1], this.atFinish_(n.getPixelFromCoordinate(e)) && (e = this.finishCoordinate_.slice())) : (o = this.sketchCoords_, a = o[o.length - 1]), a[0] = e[0], a[1] = e[1], this.geometryFunction_(
45199
- /** @type {!LineCoordType} */
45200
- this.sketchCoords_,
45201
- i,
45202
- r
45203
- ), this.sketchPoint_ && this.sketchPoint_.getGeometry().setCoordinates(e), i.getType() === "Polygon" && this.mode_ !== "Polygon" ? this.createOrUpdateCustomSketchLine_(
45204
- /** @type {Polygon} */
45205
- i
45206
- ) : this.sketchLineCoords_ && this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_), this.updateSketchFeatures_();
45070
+ writeGeometryText(e, n) {
45071
+ e = /** @type {LineString} */
45072
+ B_(e, !0, this.adaptOptions(n));
45073
+ const i = e.getFlatCoordinates(), r = e.getStride();
45074
+ return Y_(i, 0, i.length, r, i), Cz(i, r, this.factor_);
45075
+ }
45076
+ }
45077
+ function Cz(t, e, n) {
45078
+ n = n || 1e5;
45079
+ let i;
45080
+ const r = new Array(e);
45081
+ for (i = 0; i < e; ++i)
45082
+ r[i] = 0;
45083
+ for (let s = 0, o = t.length; s < o; )
45084
+ for (i = 0; i < e; ++i, ++s) {
45085
+ const a = t[s], l = a - r[i];
45086
+ r[i] = a, t[s] = l;
45087
+ }
45088
+ return Tz(t, n);
45089
+ }
45090
+ function Sz(t, e, n) {
45091
+ n = n || 1e5;
45092
+ let i;
45093
+ const r = new Array(e);
45094
+ for (i = 0; i < e; ++i)
45095
+ r[i] = 0;
45096
+ const s = xz(t, n);
45097
+ for (let o = 0, a = s.length; o < a; )
45098
+ for (i = 0; i < e; ++i, ++o)
45099
+ r[i] += s[o], s[o] = r[i];
45100
+ return s;
45101
+ }
45102
+ function Tz(t, e) {
45103
+ e = e || 1e5;
45104
+ for (let n = 0, i = t.length; n < i; ++n)
45105
+ t[n] = Math.round(t[n] * e);
45106
+ return Rz(t);
45107
+ }
45108
+ function xz(t, e) {
45109
+ e = e || 1e5;
45110
+ const n = Iz(t);
45111
+ for (let i = 0, r = n.length; i < r; ++i)
45112
+ n[i] /= e;
45113
+ return n;
45114
+ }
45115
+ function Rz(t) {
45116
+ for (let e = 0, n = t.length; e < n; ++e) {
45117
+ const i = t[e];
45118
+ t[e] = i < 0 ? ~(i << 1) : i << 1;
45119
+ }
45120
+ return Mz(t);
45121
+ }
45122
+ function Iz(t) {
45123
+ const e = kz(t);
45124
+ for (let n = 0, i = e.length; n < i; ++n) {
45125
+ const r = e[n];
45126
+ e[n] = r & 1 ? ~(r >> 1) : r >> 1;
45127
+ }
45128
+ return e;
45129
+ }
45130
+ function Mz(t) {
45131
+ let e = "";
45132
+ for (let n = 0, i = t.length; n < i; ++n)
45133
+ e += Pz(t[n]);
45134
+ return e;
45135
+ }
45136
+ function kz(t) {
45137
+ const e = [];
45138
+ let n = 0, i = 0;
45139
+ for (let r = 0, s = t.length; r < s; ++r) {
45140
+ const o = t.charCodeAt(r) - 63;
45141
+ n |= (o & 31) << i, o < 32 ? (e.push(n), n = 0, i = 0) : i += 5;
45207
45142
  }
45143
+ return e;
45144
+ }
45145
+ function Pz(t) {
45146
+ let e, n = "";
45147
+ for (; t >= 32; )
45148
+ e = (32 | t & 31) + 63, n += String.fromCharCode(e), t >>= 5;
45149
+ return e = t + 63, n += String.fromCharCode(e), n;
45150
+ }
45151
+ class Dz extends bz {
45208
45152
  /**
45209
- * Add a new coordinate to the drawing.
45210
- * @param {!PointCoordType} coordinate Coordinate
45211
- * @return {Feature<import("../geom/SimpleGeometry.js").default>} The sketch feature.
45212
- * @private
45153
+ * @param {import("../../layer/VectorImage.js").default} layer Vector image layer.
45213
45154
  */
45214
- addToDrawing_(e) {
45215
- const n = this.sketchFeature_.getGeometry(), i = this.getMap().getView().getProjection();
45216
- let r, s;
45217
- const o = this.mode_;
45218
- return o === "LineString" || o === "Circle" ? (this.finishCoordinate_ = e.slice(), s = /** @type {LineCoordType} */
45219
- this.sketchCoords_, s.length >= this.maxPoints_ && (this.freehand_ ? s.pop() : r = !0), s.push(e.slice()), this.geometryFunction_(s, n, i)) : o === "Polygon" && (s = /** @type {PolyCoordType} */
45220
- this.sketchCoords_[0], s.length >= this.maxPoints_ && (this.freehand_ ? s.pop() : r = !0), s.push(e.slice()), r && (this.finishCoordinate_ = s[0]), this.geometryFunction_(this.sketchCoords_, n, i)), this.createOrUpdateSketchPoint_(e.slice()), this.updateSketchFeatures_(), r ? this.finishDrawing() : this.sketchFeature_;
45155
+ constructor(e) {
45156
+ super(e), this.vectorRenderer_ = new xE(e), this.layerImageRatio_ = e.getImageRatio(), this.coordinateToVectorPixelTransform_ = ki(), this.renderedPixelToCoordinateTransform_ = null;
45221
45157
  }
45222
45158
  /**
45223
- * @param {number} n The number of points to remove.
45159
+ * Clean up.
45160
+ * @override
45224
45161
  */
45225
- removeLastPoints_(e) {
45226
- if (!this.sketchFeature_)
45227
- return;
45228
- const n = this.sketchFeature_.getGeometry(), i = this.getMap().getView().getProjection(), r = this.mode_;
45229
- for (let s = 0; s < e; ++s) {
45230
- let o;
45231
- if (r === "LineString" || r === "Circle") {
45232
- if (o = /** @type {LineCoordType} */
45233
- this.sketchCoords_, o.splice(-2, 1), o.length >= 2) {
45234
- this.finishCoordinate_ = o[o.length - 2].slice();
45235
- const a = this.finishCoordinate_.slice();
45236
- o[o.length - 1] = a, this.createOrUpdateSketchPoint_(a);
45237
- }
45238
- this.geometryFunction_(o, n, i), n.getType() === "Polygon" && this.sketchLine_ && this.createOrUpdateCustomSketchLine_(
45239
- /** @type {Polygon} */
45240
- n
45241
- );
45242
- } else if (r === "Polygon") {
45243
- o = /** @type {PolyCoordType} */
45244
- this.sketchCoords_[0], o.splice(-2, 1);
45245
- const a = this.sketchLine_.getGeometry();
45246
- if (o.length >= 2) {
45247
- const l = o[o.length - 2].slice();
45248
- o[o.length - 1] = l, this.createOrUpdateSketchPoint_(l);
45249
- }
45250
- a.setCoordinates(o), this.geometryFunction_(this.sketchCoords_, n, i);
45251
- }
45252
- if (o.length === 1) {
45253
- this.abortDrawing();
45254
- break;
45255
- }
45256
- }
45257
- this.updateSketchFeatures_();
45162
+ disposeInternal() {
45163
+ this.vectorRenderer_.dispose(), super.disposeInternal();
45258
45164
  }
45259
45165
  /**
45260
- * Remove last point of the feature currently being drawn. Does not do anything when
45261
- * drawing POINT or MULTI_POINT geometries.
45262
- * @api
45166
+ * Asynchronous layer level hit detection.
45167
+ * @param {import("../../pixel.js").Pixel} pixel Pixel.
45168
+ * @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
45169
+ * @override
45263
45170
  */
45264
- removeLastPoint() {
45265
- this.removeLastPoints_(1);
45171
+ getFeatures(e) {
45172
+ if (!this.vectorRenderer_)
45173
+ return Promise.resolve([]);
45174
+ const n = an(
45175
+ this.coordinateToVectorPixelTransform_,
45176
+ an(this.renderedPixelToCoordinateTransform_, e.slice())
45177
+ );
45178
+ return this.vectorRenderer_.getFeatures(n);
45266
45179
  }
45267
45180
  /**
45268
- * Stop drawing and add the sketch feature to the target layer.
45269
- * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is
45270
- * dispatched before inserting the feature.
45271
- * @return {Feature<import("../geom/SimpleGeometry.js").default>|null} The drawn feature.
45272
- * @api
45181
+ * Perform action necessary to get the layer rendered after new fonts have loaded
45182
+ * @override
45273
45183
  */
45274
- finishDrawing() {
45275
- const e = this.abortDrawing_();
45276
- if (!e)
45277
- return null;
45278
- let n = this.sketchCoords_;
45279
- const i = e.getGeometry(), r = this.getMap().getView().getProjection();
45280
- return this.mode_ === "LineString" ? (n.pop(), this.geometryFunction_(n, i, r)) : this.mode_ === "Polygon" && (n[0].pop(), this.geometryFunction_(n, i, r), n = i.getCoordinates()), this.type_ === "MultiPoint" ? e.setGeometry(
45281
- new ch([
45282
- /** @type {PointCoordType} */
45283
- n
45284
- ])
45285
- ) : this.type_ === "MultiLineString" ? e.setGeometry(
45286
- new iu([
45287
- /** @type {LineCoordType} */
45288
- n
45289
- ])
45290
- ) : this.type_ === "MultiPolygon" && e.setGeometry(
45291
- new ru([
45292
- /** @type {PolyCoordType} */
45293
- n
45294
- ])
45295
- ), this.dispatchEvent(new tc(ec.DRAWEND, e)), this.features_ && this.features_.push(e), this.source_ && this.source_.addFeature(e), e;
45184
+ handleFontsChanged() {
45185
+ this.vectorRenderer_.handleFontsChanged();
45296
45186
  }
45297
45187
  /**
45298
- * Stop drawing without adding the sketch feature to the target layer.
45299
- * @return {Feature<import("../geom/SimpleGeometry.js").default>|null} The sketch feature (or null if none).
45300
- * @private
45188
+ * Determine whether render should be called.
45189
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
45190
+ * @return {boolean} Layer is ready to be rendered.
45191
+ * @override
45301
45192
  */
45302
- abortDrawing_() {
45303
- this.finishCoordinate_ = null;
45304
- const e = this.sketchFeature_;
45305
- return this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchLine_ = null, this.overlay_.getSource().clear(!0), this.deactivateTrace_(), e;
45193
+ prepareFrame(e) {
45194
+ const n = e.pixelRatio, i = e.viewState, r = i.resolution, s = e.viewHints, o = this.vectorRenderer_;
45195
+ let a = e.extent;
45196
+ this.layerImageRatio_ !== 1 && (a = a.slice(0), B6(a, this.layerImageRatio_));
45197
+ const l = ot(a) / r, u = ln(a) / r;
45198
+ if (!s[dn.ANIMATING] && !s[dn.INTERACTING] && !Ao(a)) {
45199
+ o.useContainer(null, null);
45200
+ const c = o.context, d = e.layerStatesArray[e.layerIndex], h = Object.assign({}, d, { opacity: 1 }), p = (
45201
+ /** @type {import("../../Map.js").FrameState} */
45202
+ Object.assign({}, e, {
45203
+ extent: a,
45204
+ size: [l, u],
45205
+ viewState: (
45206
+ /** @type {import("../../View.js").State} */
45207
+ Object.assign({}, e.viewState, {
45208
+ rotation: 0
45209
+ })
45210
+ ),
45211
+ layerStatesArray: [h],
45212
+ layerIndex: 0,
45213
+ declutter: null
45214
+ })
45215
+ ), f = this.getLayer().getDeclutter();
45216
+ f && (p.declutter = {
45217
+ [f]: new Pm(9)
45218
+ });
45219
+ let m = !0;
45220
+ const _ = new XB(
45221
+ a,
45222
+ r,
45223
+ n,
45224
+ c.canvas,
45225
+ function(y) {
45226
+ o.prepareFrame(p) && o.replayGroupChanged && (o.clipping = !1, o.renderFrame(p, null) && (o.renderDeclutter(p), o.renderDeferred(p), m = !1), y());
45227
+ }
45228
+ );
45229
+ _.addEventListener(Ge.CHANGE, () => {
45230
+ if (_.getState() !== Le.LOADED)
45231
+ return;
45232
+ this.image = m ? null : _;
45233
+ const y = _.getPixelRatio(), w = yz(_.getResolution()) * n / y;
45234
+ this.renderedResolution = w, this.coordinateToVectorPixelTransform_ = cr(
45235
+ this.coordinateToVectorPixelTransform_,
45236
+ l / 2,
45237
+ u / 2,
45238
+ 1 / w,
45239
+ -1 / w,
45240
+ 0,
45241
+ -i.center[0],
45242
+ -i.center[1]
45243
+ );
45244
+ }), _.load();
45245
+ }
45246
+ return this.image && (this.renderedPixelToCoordinateTransform_ = e.pixelToCoordinateTransform.slice()), !!this.image;
45306
45247
  }
45307
45248
  /**
45308
- * Stop drawing without adding the sketch feature to the target layer.
45309
- * @api
45249
+ * @override
45310
45250
  */
45311
- abortDrawing() {
45312
- const e = this.abortDrawing_();
45313
- e && this.dispatchEvent(new tc(ec.DRAWABORT, e));
45251
+ preRender() {
45314
45252
  }
45315
45253
  /**
45316
- * Append coordinates to the end of the geometry that is currently being drawn.
45317
- * This can be used when drawing LineStrings or Polygons. Coordinates will
45318
- * either be appended to the current LineString or the outer ring of the current
45319
- * Polygon. If no geometry is being drawn, a new one will be created.
45320
- * @param {!LineCoordType} coordinates Linear coordinates to be appended to
45321
- * the coordinate array.
45322
- * @api
45254
+ * @override
45323
45255
  */
45324
- appendCoordinates(e) {
45325
- const n = this.mode_, i = !this.sketchFeature_;
45326
- i && this.startDrawing_(e[0]);
45327
- let r;
45328
- if (n === "LineString" || n === "Circle")
45329
- r = /** @type {LineCoordType} */
45330
- this.sketchCoords_;
45331
- else if (n === "Polygon")
45332
- r = this.sketchCoords_ && this.sketchCoords_.length ? (
45333
- /** @type {PolyCoordType} */
45334
- this.sketchCoords_[0]
45335
- ) : [];
45336
- else
45337
- return;
45338
- i && r.shift(), r.pop();
45339
- for (let o = 0; o < e.length; o++)
45340
- this.addToDrawing_(e[o]);
45341
- const s = e[e.length - 1];
45342
- this.sketchFeature_ = this.addToDrawing_(s), this.modifyDrawing_(s);
45343
- }
45344
- /**
45345
- * Initiate draw mode by starting from an existing geometry which will
45346
- * receive new additional points. This only works on features with
45347
- * `LineString` geometries, where the interaction will extend lines by adding
45348
- * points to the end of the coordinates array.
45349
- * This will change the original feature, instead of drawing a copy.
45350
- *
45351
- * The function will dispatch a `drawstart` event.
45352
- *
45353
- * @param {!Feature<LineString>} feature Feature to be extended.
45354
- * @api
45355
- */
45356
- extend(e) {
45357
- const i = e.getGeometry();
45358
- this.sketchFeature_ = e, this.sketchCoords_ = i.getCoordinates();
45359
- const r = this.sketchCoords_[this.sketchCoords_.length - 1];
45360
- this.finishCoordinate_ = r.slice(), this.sketchCoords_.push(r.slice()), this.sketchPoint_ = new Hr(new zs(r)), this.updateSketchFeatures_(), this.dispatchEvent(
45361
- new tc(ec.DRAWSTART, this.sketchFeature_)
45362
- );
45256
+ postRender() {
45363
45257
  }
45364
45258
  /**
45365
- * Redraw the sketch features.
45366
- * @private
45367
45259
  */
45368
- updateSketchFeatures_() {
45369
- const e = [];
45370
- this.sketchFeature_ && e.push(this.sketchFeature_), this.sketchLine_ && e.push(this.sketchLine_), this.sketchPoint_ && e.push(this.sketchPoint_);
45371
- const n = this.overlay_.getSource();
45372
- n.clear(!0), n.addFeatures(e);
45260
+ renderDeclutter() {
45373
45261
  }
45374
45262
  /**
45375
- * @private
45263
+ * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
45264
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
45265
+ * @param {number} hitTolerance Hit tolerance in pixels.
45266
+ * @param {import("../vector.js").FeatureCallback<T>} callback Feature callback.
45267
+ * @param {Array<import("../Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
45268
+ * @return {T|undefined} Callback result.
45269
+ * @template T
45270
+ * @override
45376
45271
  */
45377
- updateState_() {
45378
- const e = this.getMap(), n = this.getActive();
45379
- (!e || !n) && this.abortDrawing(), this.overlay_.setMap(n ? e : null);
45380
- }
45381
- }
45382
- function Cz() {
45383
- const t = c$();
45384
- return function(e, n) {
45385
- return t[e.getGeometry().getType()];
45386
- };
45387
- }
45388
- function Sz(t) {
45389
- switch (t) {
45390
- case "Point":
45391
- case "MultiPoint":
45392
- return "Point";
45393
- case "LineString":
45394
- case "MultiLineString":
45395
- return "LineString";
45396
- case "Polygon":
45397
- case "MultiPolygon":
45398
- return "Polygon";
45399
- case "Circle":
45400
- return "Circle";
45401
- default:
45402
- throw new Error("Invalid type: " + t);
45272
+ forEachFeatureAtCoordinate(e, n, i, r, s) {
45273
+ return this.vectorRenderer_ ? this.vectorRenderer_.forEachFeatureAtCoordinate(
45274
+ e,
45275
+ n,
45276
+ i,
45277
+ r,
45278
+ s
45279
+ ) : super.forEachFeatureAtCoordinate(
45280
+ e,
45281
+ n,
45282
+ i,
45283
+ r,
45284
+ s
45285
+ );
45403
45286
  }
45404
45287
  }
45405
- class Tz {
45406
- constructor() {
45407
- this.dataProjection = void 0, this.defaultFeatureProjection = void 0, this.featureClass = /** @type {FeatureToFeatureClass<FeatureType>} */
45408
- Hr, this.supportedMediaTypes = null;
45409
- }
45288
+ class qW extends Am {
45410
45289
  /**
45411
- * Adds the data projection to the read options.
45412
- * @param {Document|Element|Object|string} source Source.
45413
- * @param {ReadOptions} [options] Options.
45414
- * @return {ReadOptions|undefined} Options.
45415
- * @protected
45290
+ * @param {Options<VectorSourceType, FeatureType>} [options] Options.
45416
45291
  */
45417
- getReadOptions(e, n) {
45418
- if (n) {
45419
- let i = n.dataProjection ? En(n.dataProjection) : this.readProjection(e);
45420
- n.extent && i && i.getUnits() === "tile-pixels" && (i = En(i), i.setWorldExtent(n.extent)), n = {
45421
- dataProjection: i,
45422
- featureProjection: n.featureProjection
45423
- };
45424
- }
45425
- return this.adaptOptions(n);
45292
+ constructor(e) {
45293
+ e = e || {};
45294
+ const n = Object.assign({}, e);
45295
+ delete n.imageRatio, super(n), this.imageRatio_ = e.imageRatio !== void 0 ? e.imageRatio : 1;
45426
45296
  }
45427
45297
  /**
45428
- * Sets the `dataProjection` on the options, if no `dataProjection`
45429
- * is set.
45430
- * @param {WriteOptions|ReadOptions|undefined} options
45431
- * Options.
45432
- * @protected
45433
- * @return {WriteOptions|ReadOptions|undefined}
45434
- * Updated options.
45298
+ * @return {number} Ratio between rendered extent size and viewport extent size.
45435
45299
  */
45436
- adaptOptions(e) {
45437
- return Object.assign(
45438
- {
45439
- dataProjection: this.dataProjection,
45440
- featureProjection: this.defaultFeatureProjection,
45441
- featureClass: this.featureClass
45442
- },
45443
- e
45444
- );
45300
+ getImageRatio() {
45301
+ return this.imageRatio_;
45445
45302
  }
45446
45303
  /**
45447
- * @abstract
45448
- * @return {Type} The format type.
45304
+ * @override
45449
45305
  */
45450
- getType() {
45451
- return je();
45306
+ createRenderer() {
45307
+ return new Dz(this);
45452
45308
  }
45309
+ }
45310
+ const tc = {
45453
45311
  /**
45454
- * Read a single feature from a source.
45455
- *
45456
- * @abstract
45457
- * @param {Document|Element|Object|string} source Source.
45458
- * @param {ReadOptions} [options] Read options.
45459
- * @return {FeatureType|Array<FeatureType>} Feature.
45312
+ * Triggered upon feature draw start
45313
+ * @event DrawEvent#drawstart
45314
+ * @api
45460
45315
  */
45461
- readFeature(e, n) {
45462
- return je();
45463
- }
45316
+ DRAWSTART: "drawstart",
45464
45317
  /**
45465
- * Read all features from a source.
45466
- *
45467
- * @abstract
45468
- * @param {Document|Element|ArrayBuffer|Object|string} source Source.
45469
- * @param {ReadOptions} [options] Read options.
45470
- * @return {Array<FeatureType>} Features.
45318
+ * Triggered upon feature draw end
45319
+ * @event DrawEvent#drawend
45320
+ * @api
45471
45321
  */
45472
- readFeatures(e, n) {
45473
- return je();
45474
- }
45322
+ DRAWEND: "drawend",
45475
45323
  /**
45476
- * Read a single geometry from a source.
45477
- *
45478
- * @abstract
45479
- * @param {Document|Element|Object|string} source Source.
45480
- * @param {ReadOptions} [options] Read options.
45481
- * @return {import("../geom/Geometry.js").default} Geometry.
45324
+ * Triggered upon feature draw abortion
45325
+ * @event DrawEvent#drawabort
45326
+ * @api
45482
45327
  */
45483
- readGeometry(e, n) {
45484
- return je();
45485
- }
45328
+ DRAWABORT: "drawabort"
45329
+ };
45330
+ class nc extends Lr {
45486
45331
  /**
45487
- * Read the projection from a source.
45488
- *
45489
- * @abstract
45490
- * @param {Document|Element|Object|string} source Source.
45491
- * @return {import("../proj/Projection.js").default|undefined} Projection.
45332
+ * @param {DrawEventType} type Type.
45333
+ * @param {Feature} feature The feature drawn.
45492
45334
  */
45493
- readProjection(e) {
45494
- return je();
45335
+ constructor(e, n) {
45336
+ super(e), this.feature = n;
45495
45337
  }
45496
- /**
45497
- * Encode a feature in this format.
45498
- *
45499
- * @abstract
45500
- * @param {Feature} feature Feature.
45501
- * @param {WriteOptions} [options] Write options.
45502
- * @return {string|ArrayBuffer} Result.
45503
- */
45504
- writeFeature(e, n) {
45505
- return je();
45338
+ }
45339
+ function Oz(t, e) {
45340
+ const n = [];
45341
+ for (let i = 0; i < e.length; ++i) {
45342
+ const s = e[i].getGeometry();
45343
+ WE(t, s, n);
45506
45344
  }
45507
- /**
45508
- * Encode an array of features in this format.
45509
- *
45510
- * @abstract
45511
- * @param {Array<Feature>} features Features.
45512
- * @param {WriteOptions} [options] Write options.
45513
- * @return {string|ArrayBuffer} Result.
45514
- */
45515
- writeFeatures(e, n) {
45516
- return je();
45345
+ return n;
45346
+ }
45347
+ function ic(t, e) {
45348
+ return Qr(t[0], t[1], e[0], e[1]);
45349
+ }
45350
+ function aa(t, e) {
45351
+ const n = t.length;
45352
+ return e < 0 ? t[e + n] : e >= n ? t[e - n] : t[e];
45353
+ }
45354
+ function rc(t, e, n) {
45355
+ let i, r;
45356
+ e < n ? (i = e, r = n) : (i = n, r = e);
45357
+ const s = Math.ceil(i), o = Math.floor(r);
45358
+ if (s > o) {
45359
+ const l = la(t, i), u = la(t, r);
45360
+ return ic(l, u);
45517
45361
  }
45518
- /**
45519
- * Write a single geometry in this format.
45520
- *
45521
- * @abstract
45522
- * @param {import("../geom/Geometry.js").default} geometry Geometry.
45523
- * @param {WriteOptions} [options] Write options.
45524
- * @return {string|ArrayBuffer} Result.
45525
- */
45526
- writeGeometry(e, n) {
45527
- return je();
45362
+ let a = 0;
45363
+ if (i < s) {
45364
+ const l = la(t, i), u = aa(t, s);
45365
+ a += ic(l, u);
45366
+ }
45367
+ if (o < r) {
45368
+ const l = aa(t, o), u = la(t, r);
45369
+ a += ic(l, u);
45370
+ }
45371
+ for (let l = s; l < o - 1; ++l) {
45372
+ const u = aa(t, l), c = aa(t, l + 1);
45373
+ a += ic(u, c);
45528
45374
  }
45375
+ return a;
45529
45376
  }
45530
- function B_(t, e, n) {
45531
- const i = n ? En(n.featureProjection) : null, r = n ? En(n.dataProjection) : null;
45532
- let s = t;
45533
- if (i && r && !yc(i, r)) {
45534
- e && (s = /** @type {T} */
45535
- t.clone());
45536
- const o = e ? i : r, a = e ? r : i;
45537
- o.getUnits() === "tile-pixels" ? s.transform(o, a) : s.applyTransform(Aa(o, a));
45377
+ function WE(t, e, n) {
45378
+ if (e instanceof Tr) {
45379
+ sc(t, e.getCoordinates(), !1, n);
45380
+ return;
45538
45381
  }
45539
- if (e && n && /** @type {WriteOptions} */
45540
- n.decimals !== void 0) {
45541
- const o = Math.pow(
45542
- 10,
45543
- /** @type {WriteOptions} */
45544
- n.decimals
45545
- ), a = function(l) {
45546
- for (let u = 0, c = l.length; u < c; ++u)
45547
- l[u] = Math.round(l[u] * o) / o;
45548
- return l;
45549
- };
45550
- s === t && (s = /** @type {T} */
45551
- t.clone()), s.applyTransform(a);
45382
+ if (e instanceof iu) {
45383
+ const i = e.getCoordinates();
45384
+ for (let r = 0, s = i.length; r < s; ++r)
45385
+ sc(t, i[r], !1, n);
45386
+ return;
45387
+ }
45388
+ if (e instanceof os) {
45389
+ const i = e.getCoordinates();
45390
+ for (let r = 0, s = i.length; r < s; ++r)
45391
+ sc(t, i[r], !0, n);
45392
+ return;
45393
+ }
45394
+ if (e instanceof ru) {
45395
+ const i = e.getCoordinates();
45396
+ for (let r = 0, s = i.length; r < s; ++r) {
45397
+ const o = i[r];
45398
+ for (let a = 0, l = o.length; a < l; ++a)
45399
+ sc(t, o[a], !0, n);
45400
+ }
45401
+ return;
45402
+ }
45403
+ if (e instanceof td) {
45404
+ const i = e.getGeometries();
45405
+ for (let r = 0; r < i.length; ++r)
45406
+ WE(t, i[r], n);
45407
+ return;
45552
45408
  }
45553
- return s;
45554
45409
  }
45555
- class xz extends Tz {
45556
- constructor() {
45557
- super();
45410
+ const nf = { index: -1, endIndex: NaN };
45411
+ function Az(t, e, n, i) {
45412
+ const r = t[0], s = t[1];
45413
+ let o = 1 / 0, a = -1, l = NaN;
45414
+ for (let d = 0; d < e.targets.length; ++d) {
45415
+ const h = e.targets[d], p = h.coordinates;
45416
+ let f = 1 / 0, m;
45417
+ for (let _ = 0; _ < p.length - 1; ++_) {
45418
+ const y = p[_], w = p[_ + 1], E = VE(r, s, y, w);
45419
+ E.squaredDistance < f && (f = E.squaredDistance, m = _ + E.along);
45420
+ }
45421
+ f < o && (o = f, h.ring && e.targetIndex === d && (h.endIndex > h.startIndex ? m < h.startIndex && (m += p.length) : h.endIndex < h.startIndex && m > h.startIndex && (m -= p.length)), l = m, a = d);
45558
45422
  }
45559
- /**
45560
- * @return {import("./Feature.js").Type} Format.
45561
- * @override
45562
- */
45563
- getType() {
45564
- return "text";
45423
+ const u = e.targets[a];
45424
+ let c = u.ring;
45425
+ if (e.targetIndex === a && c) {
45426
+ const d = la(
45427
+ u.coordinates,
45428
+ l
45429
+ ), h = n.getPixelFromCoordinate(d);
45430
+ Mw(h, e.startPx) > i && (c = !1);
45565
45431
  }
45566
- /**
45567
- * Read the feature from the source.
45568
- *
45569
- * @param {Document|Element|Object|string} source Source.
45570
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45571
- * @return {import("../Feature.js").default} Feature.
45572
- * @api
45573
- * @override
45574
- */
45575
- readFeature(e, n) {
45576
- return this.readFeatureFromText(
45577
- sc(e),
45578
- this.adaptOptions(n)
45579
- );
45432
+ if (c) {
45433
+ const d = u.coordinates, h = d.length, p = u.startIndex, f = l;
45434
+ if (p < f) {
45435
+ const m = rc(
45436
+ d,
45437
+ p,
45438
+ f
45439
+ );
45440
+ rc(
45441
+ d,
45442
+ p,
45443
+ f - h
45444
+ ) < m && (l -= h);
45445
+ } else {
45446
+ const m = rc(
45447
+ d,
45448
+ p,
45449
+ f
45450
+ );
45451
+ rc(
45452
+ d,
45453
+ p,
45454
+ f + h
45455
+ ) < m && (l += h);
45456
+ }
45580
45457
  }
45581
- /**
45582
- * @abstract
45583
- * @param {string} text Text.
45584
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45585
- * @protected
45586
- * @return {import("../Feature.js").default} Feature.
45587
- */
45588
- readFeatureFromText(e, n) {
45589
- return je();
45458
+ return nf.index = a, nf.endIndex = l, nf;
45459
+ }
45460
+ function sc(t, e, n, i) {
45461
+ const r = t[0], s = t[1];
45462
+ for (let o = 0, a = e.length - 1; o < a; ++o) {
45463
+ const l = e[o], u = e[o + 1], c = VE(r, s, l, u);
45464
+ if (c.squaredDistance === 0) {
45465
+ const d = o + c.along;
45466
+ i.push({
45467
+ coordinates: e,
45468
+ ring: n,
45469
+ startIndex: d,
45470
+ endIndex: d
45471
+ });
45472
+ return;
45473
+ }
45590
45474
  }
45475
+ }
45476
+ const rf = { along: 0, squaredDistance: 0 };
45477
+ function VE(t, e, n, i) {
45478
+ const r = n[0], s = n[1], o = i[0], a = i[1], l = o - r, u = a - s;
45479
+ let c = 0, d = r, h = s;
45480
+ return (l !== 0 || u !== 0) && (c = qt(((t - r) * l + (e - s) * u) / (l * l + u * u), 0, 1), d += l * c, h += u * c), rf.along = c, rf.squaredDistance = Xd(Qr(t, e, d, h), 10), rf;
45481
+ }
45482
+ function la(t, e) {
45483
+ const n = t.length;
45484
+ let i = Math.floor(e);
45485
+ const r = e - i;
45486
+ i >= n ? i -= n : i < 0 && (i += n);
45487
+ let s = i + 1;
45488
+ s >= n && (s -= n);
45489
+ const o = t[i], a = o[0], l = o[1], u = t[s], c = u[0] - a, d = u[1] - l;
45490
+ return [a + c * r, l + d * r];
45491
+ }
45492
+ class JW extends tl {
45591
45493
  /**
45592
- * Read the features from the source.
45593
- *
45594
- * @param {Document|Element|Object|string} source Source.
45595
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45596
- * @return {Array<import("../Feature.js").default>} Features.
45597
- * @api
45598
- * @override
45494
+ * @param {Options} options Options.
45599
45495
  */
45600
- readFeatures(e, n) {
45601
- return this.readFeaturesFromText(
45602
- sc(e),
45603
- this.adaptOptions(n)
45496
+ constructor(e) {
45497
+ const n = (
45498
+ /** @type {import("./Pointer.js").Options} */
45499
+ e
45604
45500
  );
45501
+ n.stopDown || (n.stopDown = qa), super(n), this.on, this.once, this.un, this.shouldHandle_ = !1, this.downPx_ = null, this.downTimeout_, this.lastDragTime_, this.pointerType_, this.freehand_ = !1, this.source_ = e.source ? e.source : null, this.features_ = e.features ? e.features : null, this.snapTolerance_ = e.snapTolerance ? e.snapTolerance : 12, this.type_ = /** @type {import("../geom/Geometry.js").Type} */
45502
+ e.type, this.mode_ = Fz(this.type_), this.stopClick_ = !!e.stopClick, this.minPoints_ = e.minPoints ? e.minPoints : this.mode_ === "Polygon" ? 3 : 2, this.maxPoints_ = this.mode_ === "Circle" ? 2 : e.maxPoints ? e.maxPoints : 1 / 0, this.finishCondition_ = e.finishCondition ? e.finishCondition : Ma, this.geometryLayout_ = e.geometryLayout ? e.geometryLayout : "XY";
45503
+ let i = e.geometryFunction;
45504
+ if (!i) {
45505
+ const r = this.mode_;
45506
+ if (r === "Circle")
45507
+ i = (s, o, a) => {
45508
+ const l = o || new uh([NaN, NaN]), u = Hi(s[0]), c = Iw(
45509
+ u,
45510
+ Hi(s[s.length - 1])
45511
+ );
45512
+ return l.setCenterAndRadius(
45513
+ u,
45514
+ Math.sqrt(c),
45515
+ this.geometryLayout_
45516
+ ), l;
45517
+ };
45518
+ else {
45519
+ let s;
45520
+ r === "Point" ? s = zs : r === "LineString" ? s = Tr : r === "Polygon" && (s = os), i = (o, a, l) => (a ? r === "Polygon" ? o[0].length ? a.setCoordinates(
45521
+ [o[0].concat([o[0][0]])],
45522
+ this.geometryLayout_
45523
+ ) : a.setCoordinates([], this.geometryLayout_) : a.setCoordinates(o, this.geometryLayout_) : a = new s(o, this.geometryLayout_), a);
45524
+ }
45525
+ }
45526
+ this.geometryFunction_ = i, this.dragVertexDelay_ = e.dragVertexDelay !== void 0 ? e.dragVertexDelay : 500, this.finishCoordinate_ = null, this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchCoords_ = null, this.sketchLine_ = null, this.sketchLineCoords_ = null, this.squaredClickTolerance_ = e.clickTolerance ? e.clickTolerance * e.clickTolerance : 36, this.overlay_ = new GB({
45527
+ source: new KB({
45528
+ useSpatialIndex: !1,
45529
+ wrapX: e.wrapX ? e.wrapX : !1
45530
+ }),
45531
+ style: e.style ? e.style : Lz(),
45532
+ updateWhileInteracting: !0
45533
+ }), this.geometryName_ = e.geometryName, this.condition_ = e.condition ? e.condition : Bm, this.freehandCondition_, e.freehand ? this.freehandCondition_ = Eg : this.freehandCondition_ = e.freehandCondition ? e.freehandCondition : DE, this.traceCondition_, this.setTrace(e.trace || !1), this.traceState_ = { active: !1 }, this.traceSource_ = e.traceSource || e.source || null, this.addChangeListener(bg.ACTIVE, this.updateState_);
45605
45534
  }
45606
45535
  /**
45607
- * @abstract
45608
- * @param {string} text Text.
45609
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45610
- * @protected
45611
- * @return {Array<import("../Feature.js").default>} Features.
45612
- */
45613
- readFeaturesFromText(e, n) {
45614
- return je();
45615
- }
45616
- /**
45617
- * Read the geometry from the source.
45536
+ * Toggle tracing mode or set a tracing condition.
45618
45537
  *
45619
- * @param {Document|Element|Object|string} source Source.
45620
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45621
- * @return {import("../geom/Geometry.js").default} Geometry.
45622
- * @api
45623
- * @override
45624
- */
45625
- readGeometry(e, n) {
45626
- return this.readGeometryFromText(
45627
- sc(e),
45628
- this.adaptOptions(n)
45629
- );
45630
- }
45631
- /**
45632
- * @abstract
45633
- * @param {string} text Text.
45634
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45635
- * @protected
45636
- * @return {import("../geom/Geometry.js").default} Geometry.
45538
+ * @param {boolean|import("../events/condition.js").Condition} trace A boolean to toggle tracing mode or an event
45539
+ * condition that will be checked when a feature is clicked to determine if tracing should be active.
45637
45540
  */
45638
- readGeometryFromText(e, n) {
45639
- return je();
45541
+ setTrace(e) {
45542
+ let n;
45543
+ e ? e === !0 ? n = Eg : n = e : n = fY, this.traceCondition_ = n;
45640
45544
  }
45641
45545
  /**
45642
- * Read the projection from the source.
45643
- *
45644
- * @param {Document|Element|Object|string} source Source.
45645
- * @return {import("../proj/Projection.js").default|undefined} Projection.
45646
- * @api
45546
+ * Remove the interaction from its current map and attach it to the new map.
45547
+ * Subclasses may set up event handlers to get notified about changes to
45548
+ * the map here.
45549
+ * @param {import("../Map.js").default} map Map.
45647
45550
  * @override
45648
45551
  */
45649
- readProjection(e) {
45650
- return this.readProjectionFromText(sc(e));
45651
- }
45652
- /**
45653
- * @param {string} text Text.
45654
- * @protected
45655
- * @return {import("../proj/Projection.js").default|undefined} Projection.
45656
- */
45657
- readProjectionFromText(e) {
45658
- return this.dataProjection;
45552
+ setMap(e) {
45553
+ super.setMap(e), this.updateState_();
45659
45554
  }
45660
45555
  /**
45661
- * Encode a feature as a string.
45662
- *
45663
- * @param {import("../Feature.js").default} feature Feature.
45664
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45665
- * @return {string} Encoded feature.
45556
+ * Get the overlay layer that this interaction renders sketch features to.
45557
+ * @return {VectorLayer} Overlay layer.
45666
45558
  * @api
45667
- * @override
45668
- */
45669
- writeFeature(e, n) {
45670
- return this.writeFeatureText(e, this.adaptOptions(n));
45671
- }
45672
- /**
45673
- * @abstract
45674
- * @param {import("../Feature.js").default} feature Features.
45675
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45676
- * @protected
45677
- * @return {string} Text.
45678
45559
  */
45679
- writeFeatureText(e, n) {
45680
- return je();
45560
+ getOverlay() {
45561
+ return this.overlay_;
45681
45562
  }
45682
45563
  /**
45683
- * Encode an array of features as string.
45684
- *
45685
- * @param {Array<import("../Feature.js").default>} features Features.
45686
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45687
- * @return {string} Encoded features.
45564
+ * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may actually draw or finish the drawing.
45565
+ * @param {import("../MapBrowserEvent.js").default} event Map browser event.
45566
+ * @return {boolean} `false` to stop event propagation.
45688
45567
  * @api
45689
45568
  * @override
45690
45569
  */
45691
- writeFeatures(e, n) {
45692
- return this.writeFeaturesText(e, this.adaptOptions(n));
45570
+ handleEvent(e) {
45571
+ e.originalEvent.type === Ge.CONTEXTMENU && e.originalEvent.preventDefault(), this.freehand_ = this.mode_ !== "Point" && this.freehandCondition_(e);
45572
+ let n = e.type === xt.POINTERMOVE, i = !0;
45573
+ return !this.freehand_ && this.lastDragTime_ && e.type === xt.POINTERDRAG && (Date.now() - this.lastDragTime_ >= this.dragVertexDelay_ ? (this.downPx_ = e.pixel, this.shouldHandle_ = !this.freehand_, n = !0) : this.lastDragTime_ = void 0, this.shouldHandle_ && this.downTimeout_ !== void 0 && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0)), this.freehand_ && e.type === xt.POINTERDRAG && this.sketchFeature_ !== null ? (this.addToDrawing_(e.coordinate), i = !1) : this.freehand_ && e.type === xt.POINTERDOWN ? i = !1 : n && this.getPointerCount() < 2 ? (i = e.type === xt.POINTERMOVE, i && this.freehand_ ? (this.handlePointerMove_(e), this.shouldHandle_ && e.originalEvent.preventDefault()) : (e.originalEvent.pointerType === "mouse" || e.type === xt.POINTERDRAG && this.downTimeout_ === void 0) && this.handlePointerMove_(e)) : e.type === xt.DBLCLICK && (i = !1), super.handleEvent(e) && i;
45693
45574
  }
45694
45575
  /**
45695
- * @abstract
45696
- * @param {Array<import("../Feature.js").default>} features Features.
45697
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45698
- * @protected
45699
- * @return {string} Text.
45576
+ * Handle pointer down events.
45577
+ * @param {import("../MapBrowserEvent.js").default} event Event.
45578
+ * @return {boolean} If the event was consumed.
45579
+ * @override
45700
45580
  */
45701
- writeFeaturesText(e, n) {
45702
- return je();
45581
+ handleDownEvent(e) {
45582
+ return this.shouldHandle_ = !this.freehand_, this.freehand_ ? (this.downPx_ = e.pixel, this.finishCoordinate_ || this.startDrawing_(e.coordinate), !0) : this.condition_(e) ? (this.lastDragTime_ = Date.now(), this.downTimeout_ = setTimeout(() => {
45583
+ this.handlePointerMove_(
45584
+ new Vr(
45585
+ xt.POINTERMOVE,
45586
+ e.map,
45587
+ e.originalEvent,
45588
+ !1,
45589
+ e.frameState
45590
+ )
45591
+ );
45592
+ }, this.dragVertexDelay_), this.downPx_ = e.pixel, !0) : (this.lastDragTime_ = void 0, !1);
45703
45593
  }
45704
45594
  /**
45705
- * Write a single geometry.
45706
- *
45707
- * @param {import("../geom/Geometry.js").default} geometry Geometry.
45708
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45709
- * @return {string} Geometry.
45710
- * @api
45711
- * @override
45595
+ * @private
45712
45596
  */
45713
- writeGeometry(e, n) {
45714
- return this.writeGeometryText(e, this.adaptOptions(n));
45597
+ deactivateTrace_() {
45598
+ this.traceState_ = { active: !1 };
45715
45599
  }
45716
45600
  /**
45717
- * @abstract
45718
- * @param {import("../geom/Geometry.js").default} geometry Geometry.
45719
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45720
- * @protected
45721
- * @return {string} Text.
45601
+ * Activate or deactivate trace state based on a browser event.
45602
+ * @param {import("../MapBrowserEvent.js").default} event Event.
45603
+ * @private
45722
45604
  */
45723
- writeGeometryText(e, n) {
45724
- return je();
45725
- }
45726
- }
45727
- function sc(t) {
45728
- return typeof t == "string" ? t : "";
45729
- }
45730
- function Y_(t, e, n, i, r, s) {
45731
- r !== void 0 ? (r = r, s = s !== void 0 ? s : 0) : (r = [], s = 0);
45732
- let o = e;
45733
- for (; o < n; ) {
45734
- const a = t[o++];
45735
- r[s++] = t[o++], r[s++] = a;
45736
- for (let l = 2; l < i; ++l)
45737
- r[s++] = t[o++];
45605
+ toggleTraceState_(e) {
45606
+ if (!this.traceSource_ || !this.traceCondition_(e))
45607
+ return;
45608
+ if (this.traceState_.active) {
45609
+ this.deactivateTrace_();
45610
+ return;
45611
+ }
45612
+ const n = this.getMap(), i = n.getCoordinateFromPixel([
45613
+ e.pixel[0] - this.snapTolerance_,
45614
+ e.pixel[1] + this.snapTolerance_
45615
+ ]), r = n.getCoordinateFromPixel([
45616
+ e.pixel[0] + this.snapTolerance_,
45617
+ e.pixel[1] - this.snapTolerance_
45618
+ ]), s = ig([i, r]), o = this.traceSource_.getFeaturesInExtent(s);
45619
+ if (o.length === 0)
45620
+ return;
45621
+ const a = Oz(e.coordinate, o);
45622
+ a.length && (this.traceState_ = {
45623
+ active: !0,
45624
+ startPx: e.pixel.slice(),
45625
+ targets: a,
45626
+ targetIndex: -1
45627
+ });
45738
45628
  }
45739
- return r.length = s, r;
45740
- }
45741
- class qW extends xz {
45742
45629
  /**
45743
- * @param {Options} [options] Optional configuration object.
45630
+ * @param {TraceTarget} target The trace target.
45631
+ * @param {number} endIndex The new end index of the trace.
45632
+ * @private
45744
45633
  */
45745
- constructor(e) {
45746
- super(), e = e || {}, this.dataProjection = En("EPSG:4326"), this.factor_ = e.factor ? e.factor : 1e5, this.geometryLayout_ = e.geometryLayout ? e.geometryLayout : "XY";
45634
+ addOrRemoveTracedCoordinates_(e, n) {
45635
+ const i = e.startIndex <= e.endIndex, r = e.startIndex <= n;
45636
+ i === r ? i && n > e.endIndex || !i && n < e.endIndex ? this.addTracedCoordinates_(e, e.endIndex, n) : (i && n < e.endIndex || !i && n > e.endIndex) && this.removeTracedCoordinates_(n, e.endIndex) : (this.removeTracedCoordinates_(e.startIndex, e.endIndex), this.addTracedCoordinates_(e, e.startIndex, n));
45747
45637
  }
45748
45638
  /**
45749
- * @protected
45750
- * @param {string} text Text.
45751
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45752
- * @return {import("../Feature.js").default} Feature.
45753
- * @override
45639
+ * @param {number} fromIndex The start index.
45640
+ * @param {number} toIndex The end index.
45641
+ * @private
45754
45642
  */
45755
- readFeatureFromText(e, n) {
45756
- const i = this.readGeometryFromText(e, n);
45757
- return new Hr(i);
45643
+ removeTracedCoordinates_(e, n) {
45644
+ if (e === n)
45645
+ return;
45646
+ let i = 0;
45647
+ if (e < n) {
45648
+ const r = Math.ceil(e);
45649
+ let s = Math.floor(n);
45650
+ s === n && (s -= 1), i = s - r + 1;
45651
+ } else {
45652
+ const r = Math.floor(e);
45653
+ let s = Math.ceil(n);
45654
+ s === n && (s += 1), i = r - s + 1;
45655
+ }
45656
+ i > 0 && this.removeLastPoints_(i);
45758
45657
  }
45759
45658
  /**
45760
- * @param {string} text Text.
45761
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45762
- * @protected
45763
- * @return {Array<Feature>} Features.
45764
- * @override
45659
+ * @param {TraceTarget} target The trace target.
45660
+ * @param {number} fromIndex The start index.
45661
+ * @param {number} toIndex The end index.
45662
+ * @private
45765
45663
  */
45766
- readFeaturesFromText(e, n) {
45767
- return [this.readFeatureFromText(e, n)];
45664
+ addTracedCoordinates_(e, n, i) {
45665
+ if (n === i)
45666
+ return;
45667
+ const r = [];
45668
+ if (n < i) {
45669
+ const s = Math.ceil(n);
45670
+ let o = Math.floor(i);
45671
+ o === i && (o -= 1);
45672
+ for (let a = s; a <= o; ++a)
45673
+ r.push(aa(e.coordinates, a));
45674
+ } else {
45675
+ const s = Math.floor(n);
45676
+ let o = Math.ceil(i);
45677
+ o === i && (o += 1);
45678
+ for (let a = s; a >= o; --a)
45679
+ r.push(aa(e.coordinates, a));
45680
+ }
45681
+ r.length && this.appendCoordinates(r);
45768
45682
  }
45769
45683
  /**
45770
- * @param {string} text Text.
45771
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
45772
- * @protected
45773
- * @return {import("../geom/Geometry.js").default} Geometry.
45774
- * @override
45775
- */
45776
- readGeometryFromText(e, n) {
45777
- const i = jl(this.geometryLayout_), r = Iz(e, i, this.factor_);
45778
- Y_(r, 0, r.length, i, r);
45779
- const s = Xr(
45780
- r,
45781
- 0,
45782
- r.length,
45783
- i
45784
- ), o = new Tr(s, this.geometryLayout_);
45785
- return B_(
45786
- o,
45787
- !1,
45788
- this.adaptOptions(n)
45684
+ * Update the trace.
45685
+ * @param {import("../MapBrowserEvent.js").default} event Event.
45686
+ * @private
45687
+ */
45688
+ updateTrace_(e) {
45689
+ const n = this.traceState_;
45690
+ if (!n.active || n.targetIndex === -1 && Mw(n.startPx, e.pixel) < this.snapTolerance_)
45691
+ return;
45692
+ const i = Az(
45693
+ e.coordinate,
45694
+ n,
45695
+ this.getMap(),
45696
+ this.snapTolerance_
45789
45697
  );
45698
+ if (n.targetIndex !== i.index) {
45699
+ if (n.targetIndex !== -1) {
45700
+ const l = n.targets[n.targetIndex];
45701
+ this.removeTracedCoordinates_(l.startIndex, l.endIndex);
45702
+ }
45703
+ const a = n.targets[i.index];
45704
+ this.addTracedCoordinates_(
45705
+ a,
45706
+ a.startIndex,
45707
+ i.endIndex
45708
+ );
45709
+ } else {
45710
+ const a = n.targets[n.targetIndex];
45711
+ this.addOrRemoveTracedCoordinates_(a, i.endIndex);
45712
+ }
45713
+ n.targetIndex = i.index;
45714
+ const r = n.targets[n.targetIndex];
45715
+ r.endIndex = i.endIndex;
45716
+ const s = la(
45717
+ r.coordinates,
45718
+ r.endIndex
45719
+ ), o = this.getMap().getPixelFromCoordinate(s);
45720
+ e.coordinate = s, e.pixel = [Math.round(o[0]), Math.round(o[1])];
45790
45721
  }
45791
45722
  /**
45792
- * @param {import("../Feature.js").default<LineString>} feature Features.
45793
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45794
- * @protected
45795
- * @return {string} Text.
45723
+ * Handle pointer up events.
45724
+ * @param {import("../MapBrowserEvent.js").default} event Event.
45725
+ * @return {boolean} If the event was consumed.
45796
45726
  * @override
45797
45727
  */
45798
- writeFeatureText(e, n) {
45799
- const i = e.getGeometry();
45800
- if (i)
45801
- return this.writeGeometryText(i, n);
45802
- throw new Error("Expected `feature` to have a geometry");
45728
+ handleUpEvent(e) {
45729
+ let n = !0;
45730
+ if (this.getPointerCount() === 0) {
45731
+ this.downTimeout_ && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0), this.handlePointerMove_(e);
45732
+ const i = this.traceState_.active;
45733
+ if (this.toggleTraceState_(e), this.shouldHandle_) {
45734
+ const r = !this.finishCoordinate_;
45735
+ r && this.startDrawing_(e.coordinate), !r && this.freehand_ ? this.finishDrawing() : !this.freehand_ && (!r || this.mode_ === "Point") && (this.atFinish_(e.pixel, i) ? this.finishCondition_(e) && this.finishDrawing() : this.addToDrawing_(e.coordinate)), n = !1;
45736
+ } else this.freehand_ && this.abortDrawing();
45737
+ }
45738
+ return !n && this.stopClick_ && e.preventDefault(), n;
45803
45739
  }
45804
45740
  /**
45805
- * @param {Array<import("../Feature.js").default<LineString>>} features Features.
45806
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45807
- * @protected
45808
- * @return {string} Text.
45809
- * @override
45741
+ * Handle move events.
45742
+ * @param {import("../MapBrowserEvent.js").default} event A move event.
45743
+ * @private
45810
45744
  */
45811
- writeFeaturesText(e, n) {
45812
- return this.writeFeatureText(e[0], n);
45745
+ handlePointerMove_(e) {
45746
+ if (this.pointerType_ = e.originalEvent.pointerType, this.downPx_ && (!this.freehand_ && this.shouldHandle_ || this.freehand_ && !this.shouldHandle_)) {
45747
+ const n = this.downPx_, i = e.pixel, r = n[0] - i[0], s = n[1] - i[1], o = r * r + s * s;
45748
+ if (this.shouldHandle_ = this.freehand_ ? o > this.squaredClickTolerance_ : o <= this.squaredClickTolerance_, !this.shouldHandle_)
45749
+ return;
45750
+ }
45751
+ if (!this.finishCoordinate_) {
45752
+ this.createOrUpdateSketchPoint_(e.coordinate.slice());
45753
+ return;
45754
+ }
45755
+ this.updateTrace_(e), this.modifyDrawing_(e.coordinate);
45813
45756
  }
45814
45757
  /**
45815
- * @param {LineString} geometry Geometry.
45816
- * @param {import("./Feature.js").WriteOptions} [options] Write options.
45817
- * @protected
45818
- * @return {string} Text.
45819
- * @override
45758
+ * Determine if an event is within the snapping tolerance of the start coord.
45759
+ * @param {import("../pixel.js").Pixel} pixel Pixel.
45760
+ * @param {boolean} [tracing] Drawing in trace mode (only stop if at the starting point).
45761
+ * @return {boolean} The event is within the snapping tolerance of the start.
45762
+ * @private
45820
45763
  */
45821
- writeGeometryText(e, n) {
45822
- e = /** @type {LineString} */
45823
- B_(e, !0, this.adaptOptions(n));
45824
- const i = e.getFlatCoordinates(), r = e.getStride();
45825
- return Y_(i, 0, i.length, r, i), Rz(i, r, this.factor_);
45826
- }
45827
- }
45828
- function Rz(t, e, n) {
45829
- n = n || 1e5;
45830
- let i;
45831
- const r = new Array(e);
45832
- for (i = 0; i < e; ++i)
45833
- r[i] = 0;
45834
- for (let s = 0, o = t.length; s < o; )
45835
- for (i = 0; i < e; ++i, ++s) {
45836
- const a = t[s], l = a - r[i];
45837
- r[i] = a, t[s] = l;
45764
+ atFinish_(e, n) {
45765
+ let i = !1;
45766
+ if (this.sketchFeature_) {
45767
+ let r = !1, s = [this.finishCoordinate_];
45768
+ const o = this.mode_;
45769
+ if (o === "Point")
45770
+ i = !0;
45771
+ else if (o === "Circle")
45772
+ i = this.sketchCoords_.length === 2;
45773
+ else if (o === "LineString")
45774
+ r = !n && this.sketchCoords_.length > this.minPoints_;
45775
+ else if (o === "Polygon") {
45776
+ const a = (
45777
+ /** @type {PolyCoordType} */
45778
+ this.sketchCoords_
45779
+ );
45780
+ r = a[0].length > this.minPoints_, s = [
45781
+ a[0][0],
45782
+ a[0][a[0].length - 2]
45783
+ ], n ? s = [a[0][0]] : s = [
45784
+ a[0][0],
45785
+ a[0][a[0].length - 2]
45786
+ ];
45787
+ }
45788
+ if (r) {
45789
+ const a = this.getMap();
45790
+ for (let l = 0, u = s.length; l < u; l++) {
45791
+ const c = s[l], d = a.getPixelFromCoordinate(c), h = e[0] - d[0], p = e[1] - d[1], f = this.freehand_ ? 1 : this.snapTolerance_;
45792
+ if (i = Math.sqrt(h * h + p * p) <= f, i) {
45793
+ this.finishCoordinate_ = c;
45794
+ break;
45795
+ }
45796
+ }
45797
+ }
45838
45798
  }
45839
- return Mz(t, n);
45840
- }
45841
- function Iz(t, e, n) {
45842
- n = n || 1e5;
45843
- let i;
45844
- const r = new Array(e);
45845
- for (i = 0; i < e; ++i)
45846
- r[i] = 0;
45847
- const s = kz(t, n);
45848
- for (let o = 0, a = s.length; o < a; )
45849
- for (i = 0; i < e; ++i, ++o)
45850
- r[i] += s[o], s[o] = r[i];
45851
- return s;
45852
- }
45853
- function Mz(t, e) {
45854
- e = e || 1e5;
45855
- for (let n = 0, i = t.length; n < i; ++n)
45856
- t[n] = Math.round(t[n] * e);
45857
- return Pz(t);
45858
- }
45859
- function kz(t, e) {
45860
- e = e || 1e5;
45861
- const n = Dz(t);
45862
- for (let i = 0, r = n.length; i < r; ++i)
45863
- n[i] /= e;
45864
- return n;
45865
- }
45866
- function Pz(t) {
45867
- for (let e = 0, n = t.length; e < n; ++e) {
45868
- const i = t[e];
45869
- t[e] = i < 0 ? ~(i << 1) : i << 1;
45870
- }
45871
- return Oz(t);
45872
- }
45873
- function Dz(t) {
45874
- const e = Az(t);
45875
- for (let n = 0, i = e.length; n < i; ++n) {
45876
- const r = e[n];
45877
- e[n] = r & 1 ? ~(r >> 1) : r >> 1;
45878
- }
45879
- return e;
45880
- }
45881
- function Oz(t) {
45882
- let e = "";
45883
- for (let n = 0, i = t.length; n < i; ++n)
45884
- e += Lz(t[n]);
45885
- return e;
45886
- }
45887
- function Az(t) {
45888
- const e = [];
45889
- let n = 0, i = 0;
45890
- for (let r = 0, s = t.length; r < s; ++r) {
45891
- const o = t.charCodeAt(r) - 63;
45892
- n |= (o & 31) << i, o < 32 ? (e.push(n), n = 0, i = 0) : i += 5;
45799
+ return i;
45893
45800
  }
45894
- return e;
45895
- }
45896
- function Lz(t) {
45897
- let e, n = "";
45898
- for (; t >= 32; )
45899
- e = (32 | t & 31) + 63, n += String.fromCharCode(e), t >>= 5;
45900
- return e = t + 63, n += String.fromCharCode(e), n;
45901
- }
45902
- class Fz extends bz {
45903
45801
  /**
45904
- * @param {import("../../layer/VectorImage.js").default} layer Vector image layer.
45802
+ * @param {import("../coordinate").Coordinate} coordinates Coordinate.
45803
+ * @private
45905
45804
  */
45906
- constructor(e) {
45907
- super(e), this.vectorRenderer_ = new xE(e), this.layerImageRatio_ = e.getImageRatio(), this.coordinateToVectorPixelTransform_ = ki(), this.renderedPixelToCoordinateTransform_ = null;
45805
+ createOrUpdateSketchPoint_(e) {
45806
+ this.sketchPoint_ ? this.sketchPoint_.getGeometry().setCoordinates(e) : (this.sketchPoint_ = new Hr(new zs(e)), this.updateSketchFeatures_());
45908
45807
  }
45909
45808
  /**
45910
- * Clean up.
45911
- * @override
45809
+ * @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
45810
+ * @private
45912
45811
  */
45913
- disposeInternal() {
45914
- this.vectorRenderer_.dispose(), super.disposeInternal();
45812
+ createOrUpdateCustomSketchLine_(e) {
45813
+ this.sketchLine_ || (this.sketchLine_ = new Hr());
45814
+ const n = e.getLinearRing(0);
45815
+ let i = this.sketchLine_.getGeometry();
45816
+ i ? (i.setFlatCoordinates(
45817
+ n.getLayout(),
45818
+ n.getFlatCoordinates()
45819
+ ), i.changed()) : (i = new Tr(
45820
+ n.getFlatCoordinates(),
45821
+ n.getLayout()
45822
+ ), this.sketchLine_.setGeometry(i));
45915
45823
  }
45916
45824
  /**
45917
- * Asynchronous layer level hit detection.
45918
- * @param {import("../../pixel.js").Pixel} pixel Pixel.
45919
- * @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
45920
- * @override
45825
+ * Start the drawing.
45826
+ * @param {import("../coordinate.js").Coordinate} start Start coordinate.
45827
+ * @private
45921
45828
  */
45922
- getFeatures(e) {
45923
- if (!this.vectorRenderer_)
45924
- return Promise.resolve([]);
45925
- const n = an(
45926
- this.coordinateToVectorPixelTransform_,
45927
- an(this.renderedPixelToCoordinateTransform_, e.slice())
45829
+ startDrawing_(e) {
45830
+ const n = this.getMap().getView().getProjection(), i = jl(this.geometryLayout_);
45831
+ for (; e.length < i; )
45832
+ e.push(0);
45833
+ this.finishCoordinate_ = e, this.mode_ === "Point" ? this.sketchCoords_ = e.slice() : this.mode_ === "Polygon" ? (this.sketchCoords_ = [[e.slice(), e.slice()]], this.sketchLineCoords_ = this.sketchCoords_[0]) : this.sketchCoords_ = [e.slice(), e.slice()], this.sketchLineCoords_ && (this.sketchLine_ = new Hr(new Tr(this.sketchLineCoords_)));
45834
+ const r = this.geometryFunction_(
45835
+ this.sketchCoords_,
45836
+ void 0,
45837
+ n
45838
+ );
45839
+ this.sketchFeature_ = new Hr(), this.geometryName_ && this.sketchFeature_.setGeometryName(this.geometryName_), this.sketchFeature_.setGeometry(r), this.updateSketchFeatures_(), this.dispatchEvent(
45840
+ new nc(tc.DRAWSTART, this.sketchFeature_)
45928
45841
  );
45929
- return this.vectorRenderer_.getFeatures(n);
45930
45842
  }
45931
45843
  /**
45932
- * Perform action necessary to get the layer rendered after new fonts have loaded
45933
- * @override
45844
+ * Modify the drawing.
45845
+ * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
45846
+ * @private
45847
+ */
45848
+ modifyDrawing_(e) {
45849
+ const n = this.getMap(), i = this.sketchFeature_.getGeometry(), r = n.getView().getProjection(), s = jl(this.geometryLayout_);
45850
+ let o, a;
45851
+ for (; e.length < s; )
45852
+ e.push(0);
45853
+ this.mode_ === "Point" ? a = this.sketchCoords_ : this.mode_ === "Polygon" ? (o = /** @type {PolyCoordType} */
45854
+ this.sketchCoords_[0], a = o[o.length - 1], this.atFinish_(n.getPixelFromCoordinate(e)) && (e = this.finishCoordinate_.slice())) : (o = this.sketchCoords_, a = o[o.length - 1]), a[0] = e[0], a[1] = e[1], this.geometryFunction_(
45855
+ /** @type {!LineCoordType} */
45856
+ this.sketchCoords_,
45857
+ i,
45858
+ r
45859
+ ), this.sketchPoint_ && this.sketchPoint_.getGeometry().setCoordinates(e), i.getType() === "Polygon" && this.mode_ !== "Polygon" ? this.createOrUpdateCustomSketchLine_(
45860
+ /** @type {Polygon} */
45861
+ i
45862
+ ) : this.sketchLineCoords_ && this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_), this.updateSketchFeatures_();
45863
+ }
45864
+ /**
45865
+ * Add a new coordinate to the drawing.
45866
+ * @param {!PointCoordType} coordinate Coordinate
45867
+ * @return {Feature<import("../geom/SimpleGeometry.js").default>} The sketch feature.
45868
+ * @private
45934
45869
  */
45935
- handleFontsChanged() {
45936
- this.vectorRenderer_.handleFontsChanged();
45870
+ addToDrawing_(e) {
45871
+ const n = this.sketchFeature_.getGeometry(), i = this.getMap().getView().getProjection();
45872
+ let r, s;
45873
+ const o = this.mode_;
45874
+ return o === "LineString" || o === "Circle" ? (this.finishCoordinate_ = e.slice(), s = /** @type {LineCoordType} */
45875
+ this.sketchCoords_, s.length >= this.maxPoints_ && (this.freehand_ ? s.pop() : r = !0), s.push(e.slice()), this.geometryFunction_(s, n, i)) : o === "Polygon" && (s = /** @type {PolyCoordType} */
45876
+ this.sketchCoords_[0], s.length >= this.maxPoints_ && (this.freehand_ ? s.pop() : r = !0), s.push(e.slice()), r && (this.finishCoordinate_ = s[0]), this.geometryFunction_(this.sketchCoords_, n, i)), this.createOrUpdateSketchPoint_(e.slice()), this.updateSketchFeatures_(), r ? this.finishDrawing() : this.sketchFeature_;
45937
45877
  }
45938
45878
  /**
45939
- * Determine whether render should be called.
45940
- * @param {import("../../Map.js").FrameState} frameState Frame state.
45941
- * @return {boolean} Layer is ready to be rendered.
45942
- * @override
45879
+ * @param {number} n The number of points to remove.
45943
45880
  */
45944
- prepareFrame(e) {
45945
- const n = e.pixelRatio, i = e.viewState, r = i.resolution, s = e.viewHints, o = this.vectorRenderer_;
45946
- let a = e.extent;
45947
- this.layerImageRatio_ !== 1 && (a = a.slice(0), B6(a, this.layerImageRatio_));
45948
- const l = ot(a) / r, u = ln(a) / r;
45949
- if (!s[dn.ANIMATING] && !s[dn.INTERACTING] && !Ao(a)) {
45950
- o.useContainer(null, null);
45951
- const c = o.context, d = e.layerStatesArray[e.layerIndex], h = Object.assign({}, d, { opacity: 1 }), p = (
45952
- /** @type {import("../../Map.js").FrameState} */
45953
- Object.assign({}, e, {
45954
- extent: a,
45955
- size: [l, u],
45956
- viewState: (
45957
- /** @type {import("../../View.js").State} */
45958
- Object.assign({}, e.viewState, {
45959
- rotation: 0
45960
- })
45961
- ),
45962
- layerStatesArray: [h],
45963
- layerIndex: 0,
45964
- declutter: null
45965
- })
45966
- ), f = this.getLayer().getDeclutter();
45967
- f && (p.declutter = {
45968
- [f]: new Pm(9)
45969
- });
45970
- let m = !0;
45971
- const _ = new XB(
45972
- a,
45973
- r,
45974
- n,
45975
- c.canvas,
45976
- function(y) {
45977
- o.prepareFrame(p) && o.replayGroupChanged && (o.clipping = !1, o.renderFrame(p, null) && (o.renderDeclutter(p), o.renderDeferred(p), m = !1), y());
45881
+ removeLastPoints_(e) {
45882
+ if (!this.sketchFeature_)
45883
+ return;
45884
+ const n = this.sketchFeature_.getGeometry(), i = this.getMap().getView().getProjection(), r = this.mode_;
45885
+ for (let s = 0; s < e; ++s) {
45886
+ let o;
45887
+ if (r === "LineString" || r === "Circle") {
45888
+ if (o = /** @type {LineCoordType} */
45889
+ this.sketchCoords_, o.splice(-2, 1), o.length >= 2) {
45890
+ this.finishCoordinate_ = o[o.length - 2].slice();
45891
+ const a = this.finishCoordinate_.slice();
45892
+ o[o.length - 1] = a, this.createOrUpdateSketchPoint_(a);
45978
45893
  }
45979
- );
45980
- _.addEventListener(Ge.CHANGE, () => {
45981
- if (_.getState() !== Le.LOADED)
45982
- return;
45983
- this.image = m ? null : _;
45984
- const y = _.getPixelRatio(), w = yz(_.getResolution()) * n / y;
45985
- this.renderedResolution = w, this.coordinateToVectorPixelTransform_ = cr(
45986
- this.coordinateToVectorPixelTransform_,
45987
- l / 2,
45988
- u / 2,
45989
- 1 / w,
45990
- -1 / w,
45991
- 0,
45992
- -i.center[0],
45993
- -i.center[1]
45894
+ this.geometryFunction_(o, n, i), n.getType() === "Polygon" && this.sketchLine_ && this.createOrUpdateCustomSketchLine_(
45895
+ /** @type {Polygon} */
45896
+ n
45994
45897
  );
45995
- }), _.load();
45898
+ } else if (r === "Polygon") {
45899
+ o = /** @type {PolyCoordType} */
45900
+ this.sketchCoords_[0], o.splice(-2, 1);
45901
+ const a = this.sketchLine_.getGeometry();
45902
+ if (o.length >= 2) {
45903
+ const l = o[o.length - 2].slice();
45904
+ o[o.length - 1] = l, this.createOrUpdateSketchPoint_(l);
45905
+ }
45906
+ a.setCoordinates(o), this.geometryFunction_(this.sketchCoords_, n, i);
45907
+ }
45908
+ if (o.length === 1) {
45909
+ this.abortDrawing();
45910
+ break;
45911
+ }
45996
45912
  }
45997
- return this.image && (this.renderedPixelToCoordinateTransform_ = e.pixelToCoordinateTransform.slice()), !!this.image;
45913
+ this.updateSketchFeatures_();
45998
45914
  }
45999
45915
  /**
46000
- * @override
45916
+ * Remove last point of the feature currently being drawn. Does not do anything when
45917
+ * drawing POINT or MULTI_POINT geometries.
45918
+ * @api
46001
45919
  */
46002
- preRender() {
45920
+ removeLastPoint() {
45921
+ this.removeLastPoints_(1);
46003
45922
  }
46004
45923
  /**
46005
- * @override
45924
+ * Stop drawing and add the sketch feature to the target layer.
45925
+ * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is
45926
+ * dispatched before inserting the feature.
45927
+ * @return {Feature<import("../geom/SimpleGeometry.js").default>|null} The drawn feature.
45928
+ * @api
46006
45929
  */
46007
- postRender() {
45930
+ finishDrawing() {
45931
+ const e = this.abortDrawing_();
45932
+ if (!e)
45933
+ return null;
45934
+ let n = this.sketchCoords_;
45935
+ const i = e.getGeometry(), r = this.getMap().getView().getProjection();
45936
+ return this.mode_ === "LineString" ? (n.pop(), this.geometryFunction_(n, i, r)) : this.mode_ === "Polygon" && (n[0].pop(), this.geometryFunction_(n, i, r), n = i.getCoordinates()), this.type_ === "MultiPoint" ? e.setGeometry(
45937
+ new ch([
45938
+ /** @type {PointCoordType} */
45939
+ n
45940
+ ])
45941
+ ) : this.type_ === "MultiLineString" ? e.setGeometry(
45942
+ new iu([
45943
+ /** @type {LineCoordType} */
45944
+ n
45945
+ ])
45946
+ ) : this.type_ === "MultiPolygon" && e.setGeometry(
45947
+ new ru([
45948
+ /** @type {PolyCoordType} */
45949
+ n
45950
+ ])
45951
+ ), this.dispatchEvent(new nc(tc.DRAWEND, e)), this.features_ && this.features_.push(e), this.source_ && this.source_.addFeature(e), e;
46008
45952
  }
46009
45953
  /**
45954
+ * Stop drawing without adding the sketch feature to the target layer.
45955
+ * @return {Feature<import("../geom/SimpleGeometry.js").default>|null} The sketch feature (or null if none).
45956
+ * @private
46010
45957
  */
46011
- renderDeclutter() {
45958
+ abortDrawing_() {
45959
+ this.finishCoordinate_ = null;
45960
+ const e = this.sketchFeature_;
45961
+ return this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchLine_ = null, this.overlay_.getSource().clear(!0), this.deactivateTrace_(), e;
46012
45962
  }
46013
45963
  /**
46014
- * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
46015
- * @param {import("../../Map.js").FrameState} frameState Frame state.
46016
- * @param {number} hitTolerance Hit tolerance in pixels.
46017
- * @param {import("../vector.js").FeatureCallback<T>} callback Feature callback.
46018
- * @param {Array<import("../Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
46019
- * @return {T|undefined} Callback result.
46020
- * @template T
46021
- * @override
45964
+ * Stop drawing without adding the sketch feature to the target layer.
45965
+ * @api
46022
45966
  */
46023
- forEachFeatureAtCoordinate(e, n, i, r, s) {
46024
- return this.vectorRenderer_ ? this.vectorRenderer_.forEachFeatureAtCoordinate(
46025
- e,
46026
- n,
46027
- i,
46028
- r,
46029
- s
46030
- ) : super.forEachFeatureAtCoordinate(
46031
- e,
46032
- n,
46033
- i,
46034
- r,
46035
- s
46036
- );
45967
+ abortDrawing() {
45968
+ const e = this.abortDrawing_();
45969
+ e && this.dispatchEvent(new nc(tc.DRAWABORT, e));
46037
45970
  }
46038
- }
46039
- class JW extends Am {
46040
45971
  /**
46041
- * @param {Options<VectorSourceType, FeatureType>} [options] Options.
45972
+ * Append coordinates to the end of the geometry that is currently being drawn.
45973
+ * This can be used when drawing LineStrings or Polygons. Coordinates will
45974
+ * either be appended to the current LineString or the outer ring of the current
45975
+ * Polygon. If no geometry is being drawn, a new one will be created.
45976
+ * @param {!LineCoordType} coordinates Linear coordinates to be appended to
45977
+ * the coordinate array.
45978
+ * @api
46042
45979
  */
46043
- constructor(e) {
46044
- e = e || {};
46045
- const n = Object.assign({}, e);
46046
- delete n.imageRatio, super(n), this.imageRatio_ = e.imageRatio !== void 0 ? e.imageRatio : 1;
45980
+ appendCoordinates(e) {
45981
+ const n = this.mode_, i = !this.sketchFeature_;
45982
+ i && this.startDrawing_(e[0]);
45983
+ let r;
45984
+ if (n === "LineString" || n === "Circle")
45985
+ r = /** @type {LineCoordType} */
45986
+ this.sketchCoords_;
45987
+ else if (n === "Polygon")
45988
+ r = this.sketchCoords_ && this.sketchCoords_.length ? (
45989
+ /** @type {PolyCoordType} */
45990
+ this.sketchCoords_[0]
45991
+ ) : [];
45992
+ else
45993
+ return;
45994
+ i && r.shift(), r.pop();
45995
+ for (let o = 0; o < e.length; o++)
45996
+ this.addToDrawing_(e[o]);
45997
+ const s = e[e.length - 1];
45998
+ this.sketchFeature_ = this.addToDrawing_(s), this.modifyDrawing_(s);
46047
45999
  }
46048
46000
  /**
46049
- * @return {number} Ratio between rendered extent size and viewport extent size.
46001
+ * Initiate draw mode by starting from an existing geometry which will
46002
+ * receive new additional points. This only works on features with
46003
+ * `LineString` geometries, where the interaction will extend lines by adding
46004
+ * points to the end of the coordinates array.
46005
+ * This will change the original feature, instead of drawing a copy.
46006
+ *
46007
+ * The function will dispatch a `drawstart` event.
46008
+ *
46009
+ * @param {!Feature<LineString>} feature Feature to be extended.
46010
+ * @api
46050
46011
  */
46051
- getImageRatio() {
46052
- return this.imageRatio_;
46012
+ extend(e) {
46013
+ const i = e.getGeometry();
46014
+ this.sketchFeature_ = e, this.sketchCoords_ = i.getCoordinates();
46015
+ const r = this.sketchCoords_[this.sketchCoords_.length - 1];
46016
+ this.finishCoordinate_ = r.slice(), this.sketchCoords_.push(r.slice()), this.sketchPoint_ = new Hr(new zs(r)), this.updateSketchFeatures_(), this.dispatchEvent(
46017
+ new nc(tc.DRAWSTART, this.sketchFeature_)
46018
+ );
46053
46019
  }
46054
46020
  /**
46055
- * @override
46021
+ * Redraw the sketch features.
46022
+ * @private
46056
46023
  */
46057
- createRenderer() {
46058
- return new Fz(this);
46024
+ updateSketchFeatures_() {
46025
+ const e = [];
46026
+ this.sketchFeature_ && e.push(this.sketchFeature_), this.sketchLine_ && e.push(this.sketchLine_), this.sketchPoint_ && e.push(this.sketchPoint_);
46027
+ const n = this.overlay_.getSource();
46028
+ n.clear(!0), n.addFeatures(e);
46029
+ }
46030
+ /**
46031
+ * @private
46032
+ */
46033
+ updateState_() {
46034
+ const e = this.getMap(), n = this.getActive();
46035
+ (!e || !n) && this.abortDrawing(), this.overlay_.setMap(n ? e : null);
46036
+ }
46037
+ }
46038
+ function Lz() {
46039
+ const t = c$();
46040
+ return function(e, n) {
46041
+ return t[e.getGeometry().getType()];
46042
+ };
46043
+ }
46044
+ function Fz(t) {
46045
+ switch (t) {
46046
+ case "Point":
46047
+ case "MultiPoint":
46048
+ return "Point";
46049
+ case "LineString":
46050
+ case "MultiLineString":
46051
+ return "LineString";
46052
+ case "Polygon":
46053
+ case "MultiPolygon":
46054
+ return "Polygon";
46055
+ case "Circle":
46056
+ return "Circle";
46057
+ default:
46058
+ throw new Error("Invalid type: " + t);
46059
46059
  }
46060
46060
  }
46061
46061
  var QW = {
@@ -47494,62 +47494,61 @@ as(Um, {
47494
47494
  Ve.mount(new aW());
47495
47495
  Ve.mount(Um, Hm);
47496
47496
  export {
47497
- $W as $,
47498
- qW as A,
47499
- Hr as B,
47500
- GB as C,
47501
- KB as D,
47497
+ Ha as $,
47498
+ Hr as A,
47499
+ GB as B,
47500
+ KB as C,
47501
+ wo as D,
47502
47502
  DW as E,
47503
47503
  Io as F,
47504
- wo as G,
47505
- Eu as H,
47506
- GW as I,
47507
- oh as J,
47508
- JW as K,
47504
+ Eu as G,
47505
+ GW as H,
47506
+ oh as I,
47507
+ qW as J,
47508
+ uh as K,
47509
47509
  Tr as L,
47510
47510
  HW as M,
47511
- uh as N,
47511
+ cY as N,
47512
47512
  jW as O,
47513
47513
  zs as P,
47514
- cY as Q,
47515
- ZW as R,
47514
+ JW as Q,
47515
+ E6 as R,
47516
47516
  WW as S,
47517
47517
  KW as T,
47518
- E6 as U,
47518
+ Ct as U,
47519
47519
  Ur as V,
47520
- Ct as W,
47520
+ K6 as W,
47521
47521
  XW as X,
47522
- K6 as Y,
47523
- Gs as Z,
47524
- ch as _,
47522
+ Gs as Y,
47523
+ ch as Z,
47524
+ $W as _,
47525
47525
  Ne as a,
47526
- Ha as a0,
47527
- Zi as a1,
47528
- Cr as a2,
47529
- Py as a3,
47530
- Wn as a4,
47531
- Fg as a5,
47532
- gW as a6,
47533
- AW as a7,
47534
- yW as a8,
47535
- OW as a9,
47536
- IW as aa,
47537
- kW as ab,
47538
- MW as ac,
47539
- ZD as ad,
47540
- Ve as ae,
47541
- Sa as af,
47542
- _W as ag,
47543
- PW as ah,
47544
- wW as ai,
47545
- QW as aj,
47546
- bW as ak,
47547
- mW as al,
47548
- DR as am,
47549
- $s as an,
47550
- pW as ao,
47551
- pd as ap,
47552
- fW as aq,
47526
+ Zi as a0,
47527
+ Cr as a1,
47528
+ Py as a2,
47529
+ Wn as a3,
47530
+ Fg as a4,
47531
+ gW as a5,
47532
+ AW as a6,
47533
+ yW as a7,
47534
+ OW as a8,
47535
+ IW as a9,
47536
+ kW as aa,
47537
+ MW as ab,
47538
+ ZD as ac,
47539
+ Ve as ad,
47540
+ Sa as ae,
47541
+ _W as af,
47542
+ PW as ag,
47543
+ wW as ah,
47544
+ QW as ai,
47545
+ bW as aj,
47546
+ mW as ak,
47547
+ DR as al,
47548
+ $s as am,
47549
+ pW as an,
47550
+ pd as ao,
47551
+ fW as ap,
47553
47552
  xo as b,
47554
47553
  TW as c,
47555
47554
  vW as d,
@@ -47566,13 +47565,13 @@ export {
47566
47565
  Ji as o,
47567
47566
  BW as p,
47568
47567
  lY as q,
47569
- xY as r,
47570
- j6 as s,
47568
+ j6 as r,
47569
+ zW as s,
47571
47570
  YW as t,
47572
- zW as u,
47573
- Tm as v,
47574
- tr as w,
47575
- Jd as x,
47576
- So as y,
47577
- Zp as z
47571
+ Tm as u,
47572
+ tr as v,
47573
+ Jd as w,
47574
+ So as x,
47575
+ Zp as y,
47576
+ ZW as z
47578
47577
  };