1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,2062 @@ |
1 |
+'use strict'; |
|
2 |
+ |
|
3 |
+function __$strToBlobUri(str, mime, isBinary) {try {return window.URL.createObjectURL(new Blob([Uint8Array.from(str.split('').map(function(c) {return c.charCodeAt(0)}))], {type: mime}));} catch (e) {return "data:" + mime + (isBinary ? ";base64," : ",") + str;}} |
|
4 |
+L.SVG.Tile = L.SVG.extend({ |
|
5 |
+ |
|
6 |
+ initialize: function (tileCoord, tileSize, options) { |
|
7 |
+ L.SVG.prototype.initialize.call(this, options); |
|
8 |
+ this._tileCoord = tileCoord; |
|
9 |
+ this._size = tileSize; |
|
10 |
+ |
|
11 |
+ this._initContainer(); |
|
12 |
+ this._container.setAttribute('width', this._size.x); |
|
13 |
+ this._container.setAttribute('height', this._size.y); |
|
14 |
+ this._container.setAttribute('viewBox', [0, 0, this._size.x, this._size.y].join(' ')); |
|
15 |
+ |
|
16 |
+ this._layers = {}; |
|
17 |
+ }, |
|
18 |
+ |
|
19 |
+ getCoord: function() { |
|
20 |
+ return this._tileCoord; |
|
21 |
+ }, |
|
22 |
+ |
|
23 |
+ getContainer: function() { |
|
24 |
+ return this._container; |
|
25 |
+ }, |
|
26 |
+ |
|
27 |
+ onAdd: L.Util.falseFn, |
|
28 |
+ |
|
29 |
+ addTo: function(map) { |
|
30 |
+ this._map = map; |
|
31 |
+ if (this.options.interactive) { |
|
32 |
+ for (var i in this._layers) { |
|
33 |
+ var layer = this._layers[i]; |
|
34 |
+ // By default, Leaflet tiles do not have pointer events. |
|
35 |
+ layer._path.style.pointerEvents = 'auto'; |
|
36 |
+ this._map._targets[L.stamp(layer._path)] = layer; |
|
37 |
+ } |
|
38 |
+ } |
|
39 |
+ }, |
|
40 |
+ |
|
41 |
+ removeFrom: function (map) { |
|
42 |
+ if (this.options.interactive) { |
|
43 |
+ for (var i in this._layers) { |
|
44 |
+ var layer = this._layers[i]; |
|
45 |
+ delete this._map._targets[L.stamp(layer._path)]; |
|
46 |
+ } |
|
47 |
+ } |
|
48 |
+ delete this._map; |
|
49 |
+ }, |
|
50 |
+ |
|
51 |
+ _initContainer: function() { |
|
52 |
+ L.SVG.prototype._initContainer.call(this); |
|
53 |
+ var rect = L.SVG.create('rect'); |
|
54 |
+ }, |
|
55 |
+ |
|
56 |
+ /// TODO: Modify _initPath to include an extra parameter, a group name |
|
57 |
+ /// to order symbolizers by z-index |
|
58 |
+ |
|
59 |
+ _addPath: function (layer) { |
|
60 |
+ this._rootGroup.appendChild(layer._path); |
|
61 |
+ this._layers[L.stamp(layer)] = layer; |
|
62 |
+ }, |
|
63 |
+ |
|
64 |
+ _updateIcon: function (layer) { |
|
65 |
+ var path = layer._path = L.SVG.create('image'), |
|
66 |
+ icon = layer.options.icon, |
|
67 |
+ options = icon.options, |
|
68 |
+ size = L.point(options.iconSize), |
|
69 |
+ anchor = options.iconAnchor || |
|
70 |
+ size && size.divideBy(2, true), |
|
71 |
+ p = layer._point.subtract(anchor); |
|
72 |
+ path.setAttribute('x', p.x); |
|
73 |
+ path.setAttribute('y', p.y); |
|
74 |
+ path.setAttribute('width', size.x + 'px'); |
|
75 |
+ path.setAttribute('height', size.y + 'px'); |
|
76 |
+ path.setAttribute('href', options.iconUrl); |
|
77 |
+ } |
|
78 |
+}); |
|
79 |
+ |
|
80 |
+ |
|
81 |
+L.svg.tile = function(tileCoord, tileSize, opts){ |
|