@3clear/basegis 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,253 @@
1
+ import b from "leaflet";
2
+ import { r as R } from "./pixi-vendor-BFDHT3Bf.js";
3
+ function O(p, t) {
4
+ for (var d = 0; d < t.length; d++) {
5
+ const l = t[d];
6
+ if (typeof l != "string" && !Array.isArray(l)) {
7
+ for (const _ in l)
8
+ if (_ !== "default" && !(_ in p)) {
9
+ const f = Object.getOwnPropertyDescriptor(l, _);
10
+ f && Object.defineProperty(p, _, f.get ? f : {
11
+ enumerable: !0,
12
+ get: () => l[_]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(p, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var m = { exports: {} }, x;
20
+ function P() {
21
+ return x || (x = 1, (function(p) {
22
+ (function(t) {
23
+ p.exports = t(b, R);
24
+ })(function(t, d) {
25
+ var l = t.Point.prototype._round, _ = function() {
26
+ return this;
27
+ };
28
+ function f(e, i, n) {
29
+ var r = d.VERSION < "7" ? e.plugins.interaction : e.events;
30
+ i ? r.destroy() : n || (r.autoPreventDefault = !1);
31
+ }
32
+ function w(e) {
33
+ var i = e.getMaxZoom(), n = e.getMinZoom();
34
+ return i === 1 / 0 ? n + 8 : (i + n) / 2;
35
+ }
36
+ var s = {
37
+ options: {
38
+ // @option padding: Number = 0.1
39
+ // How much to extend the clip area around the map view (relative to its size)
40
+ // e.g. 0.1 would be 10% of map view in each direction
41
+ padding: 0.1,
42
+ // @option forceCanvas: Boolean = false
43
+ // Force use of a 2d-canvas
44
+ forceCanvas: !1,
45
+ // @option doubleBuffering: Boolean = false
46
+ // Help to prevent flicker when refreshing display on some devices (e.g. iOS devices)
47
+ // It is ignored if rendering is done with 2d-canvas
48
+ doubleBuffering: !1,
49
+ // @option resolution: Number = 1
50
+ // Resolution of the renderer canvas
51
+ resolution: t.Browser.retina ? 2 : 1,
52
+ // @option projectionZoom(map: map): Number
53
+ // return the layer projection zoom level
54
+ projectionZoom: w,
55
+ // @option destroyInteractionManager: Boolean = false
56
+ // Destroy PIXI EventSystem
57
+ destroyInteractionManager: !1,
58
+ // @option
59
+ // Customize PIXI EventSystem autoPreventDefault property
60
+ // This option is ignored if destroyInteractionManager is set
61
+ autoPreventDefault: !0,
62
+ // @option resolution: Boolean = false
63
+ // Enables drawing buffer preservation
64
+ preserveDrawingBuffer: !1,
65
+ // @option resolution: Boolean = true
66
+ // Clear the canvas before the new render pass
67
+ clearBeforeRender: !0,
68
+ // @option shouldRedrawOnMove(e: moveEvent): Boolean
69
+ // filter move events that should trigger a layer redraw
70
+ shouldRedrawOnMove: function() {
71
+ return !1;
72
+ }
73
+ },
74
+ initialize: function(e, i, n) {
75
+ t.setOptions(this, n), t.stamp(this), this._drawCallback = e, this._pixiContainer = i, this._rendererOptions = {
76
+ resolution: this.options.resolution,
77
+ antialias: !0,
78
+ forceCanvas: this.options.forceCanvas,
79
+ preserveDrawingBuffer: this.options.preserveDrawingBuffer,
80
+ clearBeforeRender: this.options.clearBeforeRender
81
+ }, d.VERSION < "6" ? this._rendererOptions.transparent = !0 : this._rendererOptions.backgroundAlpha = 0, this._doubleBuffering = d.utils.isWebGLSupported() && !this.options.forceCanvas && this.options.doubleBuffering;
82
+ },
83
+ _setMap: function() {
84
+ },
85
+ _setContainerStyle: function() {
86
+ },
87
+ _addContainer: function() {
88
+ this.getPane().appendChild(this._container);
89
+ },
90
+ _setEvents: function() {
91
+ },
92
+ onAdd: function(e) {
93
+ if (this._setMap(e), !this._container) {
94
+ var i = this._container = t.DomUtil.create("div", "leaflet-pixi-overlay");
95
+ i.style.position = "absolute", this._renderer = d.autoDetectRenderer(this._rendererOptions), f(
96
+ this._renderer,
97
+ this.options.destroyInteractionManager,
98
+ this.options.autoPreventDefault
99
+ ), i.appendChild(this._renderer.view), this._zoomAnimated && (t.DomUtil.addClass(i, "leaflet-zoom-animated"), this._setContainerStyle()), this._doubleBuffering && (this._auxRenderer = d.autoDetectRenderer(this._rendererOptions), f(
100
+ this._auxRenderer,
101
+ this.options.destroyInteractionManager,
102
+ this.options.autoPreventDefault
103
+ ), i.appendChild(this._auxRenderer.view), this._renderer.view.style.position = "absolute", this._auxRenderer.view.style.position = "absolute");
104
+ }
105
+ this._addContainer(), this._setEvents();
106
+ var n = this._map;
107
+ this._initialZoom = this.options.projectionZoom(n), this._wgsOrigin = t.latLng([0, 0]), this._wgsInitialShift = n.project(this._wgsOrigin, this._initialZoom), this._mapInitialZoom = n.getZoom();
108
+ var r = this;
109
+ this.utils = {
110
+ latLngToLayerPoint: function(a, o) {
111
+ o = o === void 0 ? r._initialZoom : o;
112
+ var u = n.project(t.latLng(a), o);
113
+ return u;
114
+ },
115
+ layerPointToLatLng: function(a, o) {
116
+ o = o === void 0 ? r._initialZoom : o;
117
+ var u = t.point(a);
118
+ return n.unproject(u, o);
119
+ },
120
+ getScale: function(a) {
121
+ return a === void 0 ? n.getZoomScale(n.getZoom(), r._initialZoom) : n.getZoomScale(a, r._initialZoom);
122
+ },
123
+ getRenderer: function() {
124
+ return r._renderer;
125
+ },
126
+ getContainer: function() {
127
+ return r._pixiContainer;
128
+ },
129
+ getMap: function() {
130
+ return r._map;
131
+ }
132
+ }, this._update({ type: "add" });
133
+ },
134
+ onRemove: function() {
135
+ t.DomUtil.remove(this._container);
136
+ },
137
+ getEvents: function() {
138
+ var e = {
139
+ zoom: this._onZoom,
140
+ move: this._onMove,
141
+ moveend: this._update
142
+ };
143
+ return this._zoomAnimated && (e.zoomanim = this._onAnimZoom), e;
144
+ },
145
+ _onZoom: function() {
146
+ this._updateTransform(this._map.getCenter(), this._map.getZoom());
147
+ },
148
+ _onAnimZoom: function(e) {
149
+ this._updateTransform(e.center, e.zoom);
150
+ },
151
+ _onMove: function(e) {
152
+ this.options.shouldRedrawOnMove(e) && this._update(e);
153
+ },
154
+ _updateTransform: function(e, i) {
155
+ var n = this._map.getZoomScale(i, this._zoom), r = this._map.getSize().multiplyBy(0.5 + this.options.padding), a = this._map.project(this._center, i), o = r.multiplyBy(-n).add(a).subtract(this._map._getNewPixelOrigin(e, i));
156
+ t.Browser.any3d ? t.DomUtil.setTransform(this._container, o, n) : t.DomUtil.setPosition(this._container, o);
157
+ },
158
+ _redraw: function(e, i) {
159
+ this._disableLeafletRounding();
160
+ var n = this._map.getZoomScale(this._zoom, this._initialZoom), r = this._map.latLngToLayerPoint(this._wgsOrigin)._subtract(this._wgsInitialShift.multiplyBy(n))._subtract(e);
161
+ this._pixiContainer.scale.set(n), this._pixiContainer.position.set(r.x, r.y), this._drawCallback(this.utils, i), this._enableLeafletRounding();
162
+ },
163
+ _update: function(e) {
164
+ if (!(this._map._animatingZoom && this._bounds)) {
165
+ var i = this.options.padding, n = this._map.getSize(), r = this._map.containerPointToLayerPoint(n.multiplyBy(-i)).round();
166
+ if (this._bounds = new t.Bounds(r, r.add(n.multiplyBy(1 + i * 2)).round()), this._center = this._map.getCenter(), this._zoom = this._map.getZoom(), this._doubleBuffering) {
167
+ var a = this._renderer;
168
+ this._renderer = this._auxRenderer, this._auxRenderer = a;
169
+ }
170
+ var o = this._renderer.view, u = this._bounds, v = this._container, h = u.getSize();
171
+ if (!this._renderer.size || this._renderer.size.x !== h.x || this._renderer.size.y !== h.y) {
172
+ if (this._renderer.gl && (this._renderer.resolution = this.options.resolution, this._renderer.rootRenderTarget && (this._renderer.rootRenderTarget.resolution = this.options.resolution)), this._renderer.resize(h.x, h.y), o.style.width = h.x + "px", o.style.height = h.y + "px", this._renderer.gl) {
173
+ var g = this._renderer.gl;
174
+ if (g.drawingBufferWidth !== this._renderer.width) {
175
+ var y = this.options.resolution * g.drawingBufferWidth / this._renderer.width;
176
+ this._renderer.resolution = y, this._renderer.rootRenderTarget && (this._renderer.rootRenderTarget.resolution = y), this._renderer.resize(h.x, h.y);
177
+ }
178
+ }
179
+ this._renderer.size = h;
180
+ }
181
+ if (this._doubleBuffering) {
182
+ var c = this;
183
+ requestAnimationFrame(function() {
184
+ c._redraw(u.min, e), c._renderer.gl.finish(), o.style.visibility = "visible", c._auxRenderer.view.style.visibility = "hidden", t.DomUtil.setPosition(v, u.min);
185
+ });
186
+ } else
187
+ this._redraw(u.min, e), t.DomUtil.setPosition(v, u.min);
188
+ }
189
+ },
190
+ _disableLeafletRounding: function() {
191
+ t.Point.prototype._round = _;
192
+ },
193
+ _enableLeafletRounding: function() {
194
+ t.Point.prototype._round = l;
195
+ },
196
+ redraw: function(e) {
197
+ return this._map && (this._disableLeafletRounding(), this._drawCallback(this.utils, e), this._enableLeafletRounding()), this;
198
+ },
199
+ _destroy: function() {
200
+ this._renderer.destroy(!0), this._doubleBuffering && this._auxRenderer.destroy(!0);
201
+ },
202
+ destroy: function() {
203
+ this.remove(), this._destroy();
204
+ }
205
+ };
206
+ t.version >= "1" ? t.PixiOverlay = t.Layer.extend(s) : (t.Map.prototype.getZoomScale = function(e, i) {
207
+ var n = this.options.crs;
208
+ return i = i === void 0 ? this._zoom : i, n.scale(e) / n.scale(i);
209
+ }, t.DomUtil.setTransform = function(e, i, n) {
210
+ var r = i || new t.Point(0, 0);
211
+ e.style[t.DomUtil.TRANSFORM] = (t.Browser.ie3d ? "translate(" + r.x + "px," + r.y + "px)" : "translate3d(" + r.x + "px," + r.y + "px,0)") + (n ? " scale(" + n + ")" : "");
212
+ }, s.includes = t.Mixin.Events, s.addTo = function(e) {
213
+ return e.addLayer(this), this;
214
+ }, s._setMap = function(e) {
215
+ this._map = e, this._zoomAnimated = e._zoomAnimated;
216
+ }, s._setContainerStyle = function() {
217
+ var e = this;
218
+ [
219
+ "-webkit-transform-origin",
220
+ "-ms-transform-origin",
221
+ "transform-origin"
222
+ ].forEach(function(i) {
223
+ e._container.style[i] = "0 0";
224
+ });
225
+ }, s._addContainer = function() {
226
+ this._map.getPanes()[this.options.pane || "overlayPane"].appendChild(this._container);
227
+ }, s._setEvents = function() {
228
+ var e = this.getEvents();
229
+ for (var i in e)
230
+ this._map.on(i, e[i], this);
231
+ }, s.onRemove = function() {
232
+ var e = this._container.parentNode;
233
+ e && e.removeChild(this._container);
234
+ var i = this.getEvents();
235
+ for (var n in i)
236
+ this._map.off(n, i[n], this);
237
+ this._map = null;
238
+ }, s.destroy = function() {
239
+ var e = this._map || this._mapToAdd;
240
+ e && e.removeLayer(this), this._destroy();
241
+ }, t.PixiOverlay = t.Class.extend(s)), t.pixiOverlay = function(e, i, n) {
242
+ return t.Browser.canvas ? new t.PixiOverlay(e, i, n) : null;
243
+ };
244
+ });
245
+ })(m)), m.exports;
246
+ }
247
+ var C = P();
248
+ const S = /* @__PURE__ */ O({
249
+ __proto__: null
250
+ }, [C]);
251
+ export {
252
+ S as L
253
+ };