geojs 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/geo.js +88 -16
- package/geo.lean.js +88 -16
- package/geo.lean.min.js +2 -2
- package/geo.min.js +2 -2
- package/package.json +1 -1
- package/src/annotationLayer.js +27 -11
- package/src/fetchQueue.js +26 -1
- package/src/tileLayer.js +18 -2
package/package.json
CHANGED
package/src/annotationLayer.js
CHANGED
|
@@ -706,14 +706,25 @@ var annotationLayer = function (arg) {
|
|
|
706
706
|
return;
|
|
707
707
|
}
|
|
708
708
|
// make a copy of the position array to avoid mutating the original.
|
|
709
|
-
position =
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
709
|
+
position = {
|
|
710
|
+
outer: position.outer.slice(),
|
|
711
|
+
inner: (position.inner || []).map((h) => h.slice())
|
|
712
|
+
};
|
|
713
|
+
if (position.outer[position.outer.length - 1][0] === position.outer[0][0] &&
|
|
714
|
+
position.outer[position.outer.length - 1][1] === position.outer[0][1]) {
|
|
715
|
+
position.outer.splice(position.outer.length - 1, 1);
|
|
716
|
+
if (position.outer.length < 3) {
|
|
714
717
|
return;
|
|
715
718
|
}
|
|
716
719
|
}
|
|
720
|
+
position.inner.forEach((h) => {
|
|
721
|
+
if (h.length > 3 && h[h.length - 1][0] === h[0][0] && h[h.length - 1][1] === h[0][1]) {
|
|
722
|
+
h.splice(h.length - 1, 1);
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
if (!position.inner || !position.inner.length) {
|
|
726
|
+
position = position.outer;
|
|
727
|
+
}
|
|
717
728
|
break;
|
|
718
729
|
case 'marker':
|
|
719
730
|
position = data.geometry.coordinates[0].slice(0, 4);
|
|
@@ -722,15 +733,20 @@ var annotationLayer = function (arg) {
|
|
|
722
733
|
position = [feature.position()(data, data_idx)];
|
|
723
734
|
break;
|
|
724
735
|
}
|
|
725
|
-
for (i = 0; i < position.length; i += 1) {
|
|
726
|
-
position[i] = util.normalizeCoordinates(position[i]);
|
|
727
|
-
}
|
|
728
736
|
datagcs = ((data.crs && data.crs.type === 'name' && data.crs.properties &&
|
|
729
737
|
data.crs.properties.type === 'proj4' &&
|
|
730
738
|
data.crs.properties.name) ? data.crs.properties.name : gcs);
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
739
|
+
[position.outer || position].concat(position.inner || []).forEach((poslist) => {
|
|
740
|
+
for (i = 0; i < poslist.length; i += 1) {
|
|
741
|
+
poslist[i] = util.normalizeCoordinates(poslist[i]);
|
|
742
|
+
}
|
|
743
|
+
if (datagcs !== map.gcs()) {
|
|
744
|
+
const transposlist = transform.transformCoordinates(datagcs, map.gcs(), poslist);
|
|
745
|
+
for (i = 0; i < poslist.length; i += 1) {
|
|
746
|
+
poslist[i] = transposlist[i];
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
});
|
|
734
750
|
options.coordinates = position;
|
|
735
751
|
/* For each style listed in the geojsonStyleProperties object, check if
|
|
736
752
|
* is given under any of the variety of keys as a valid instance of the
|
package/src/fetchQueue.js
CHANGED
|
@@ -40,6 +40,7 @@ var fetchQueue = function (options) {
|
|
|
40
40
|
this._size = options.size || 6;
|
|
41
41
|
this._initialSize = options.initialSize || 0;
|
|
42
42
|
this._track = options.track || 600;
|
|
43
|
+
this._initialTrack = this._track;
|
|
43
44
|
this._needed = options.needed || null;
|
|
44
45
|
this._batch = false;
|
|
45
46
|
|
|
@@ -76,6 +77,30 @@ var fetchQueue = function (options) {
|
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Get/set the track size. This is used to determine when to check if
|
|
82
|
+
* entries can be discarded.
|
|
83
|
+
* @property {number} track The number of entries to track without checking
|
|
84
|
+
* for discards.
|
|
85
|
+
* @name geo.fetchQueue#track
|
|
86
|
+
*/
|
|
87
|
+
Object.defineProperty(this, 'track', {
|
|
88
|
+
get: function () { return m_this._track; },
|
|
89
|
+
set: function (n) { m_this._track = n; }
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Get/set the initial track size. Unless changed, this is the value used
|
|
94
|
+
* for track on class initialization.
|
|
95
|
+
* @property {number} initialTrack The number of entries to track without
|
|
96
|
+
* checking for discards.
|
|
97
|
+
* @name geo.fetchQueue#intitialTrack
|
|
98
|
+
*/
|
|
99
|
+
Object.defineProperty(this, 'initialTrack', {
|
|
100
|
+
get: function () { return m_this._initialTrack; },
|
|
101
|
+
set: function (n) { m_this._initialTrack = n; }
|
|
102
|
+
});
|
|
103
|
+
|
|
79
104
|
/**
|
|
80
105
|
* Get the current queue size. Read only.
|
|
81
106
|
* @property {number} length The current queue size.
|
|
@@ -157,7 +182,7 @@ var fetchQueue = function (options) {
|
|
|
157
182
|
defer.__fetchQueue._batch = m_this._batch;
|
|
158
183
|
if (atEnd) {
|
|
159
184
|
m_this._queue.push(defer);
|
|
160
|
-
} else if (!
|
|
185
|
+
} else if (!m_this._batch) {
|
|
161
186
|
m_this._queue.unshift(defer);
|
|
162
187
|
} else {
|
|
163
188
|
for (var i = 0; i < m_this._queue.length; i += 1) {
|
package/src/tileLayer.js
CHANGED
|
@@ -16,7 +16,7 @@ var featureLayer = require('./featureLayer');
|
|
|
16
16
|
* @property {function} [tilesAtZoom=null] A function that is given a zoom
|
|
17
17
|
* level and returns `{x: (num), y: (num)}` with the number of tiles at that
|
|
18
18
|
* zoom level.
|
|
19
|
-
* @property {number} [cacheSize=
|
|
19
|
+
* @property {number} [cacheSize=600] The maximum number of tiles to cache.
|
|
20
20
|
* The default is 200 if keepLower is false.
|
|
21
21
|
* @property {geo.fetchQueue} [queue] A fetch queue to use. If unspecified, a
|
|
22
22
|
* new queue is created.
|
|
@@ -193,6 +193,10 @@ var tileLayer = function (arg) {
|
|
|
193
193
|
arg = $.extend(true, {}, this.constructor.defaults, arg || {});
|
|
194
194
|
if (!arg.cacheSize) {
|
|
195
195
|
// this size should be sufficient for a 4k display
|
|
196
|
+
// where display size is (w, h), minimum tile dimension is ts, and total
|
|
197
|
+
// number of levels is ml, this is roughly
|
|
198
|
+
// sum([(math.ceil((w**2+h**2)**0.5 / (ts*2**l)) + 1) *
|
|
199
|
+
// (math.ceil(min(w, h) / (ts*2**l)) + 1) for l in range(ml)])
|
|
196
200
|
arg.cacheSize = arg.keepLower ? 600 : 200;
|
|
197
201
|
}
|
|
198
202
|
if ($.type(arg.subdomains) === 'string') {
|
|
@@ -261,6 +265,9 @@ var tileLayer = function (arg) {
|
|
|
261
265
|
});
|
|
262
266
|
this._queue._tileLayers = this._queue._tileLayers || [];
|
|
263
267
|
this._queue._tileLayers.push(m_this);
|
|
268
|
+
if (this._queue.initialTrack && this._queue.track) {
|
|
269
|
+
this._queue.track = this._queue.initialTrack * this._queue._tileLayers.length;
|
|
270
|
+
}
|
|
264
271
|
|
|
265
272
|
var m_tileOffsetValues = {};
|
|
266
273
|
|
|
@@ -310,10 +317,16 @@ var tileLayer = function (arg) {
|
|
|
310
317
|
if (m_this._queue !== queue) {
|
|
311
318
|
if (this._queue && this._queue._tileLayers && this._queue._tileLayers.indexOf(m_this) >= 0) {
|
|
312
319
|
this._queue._tileLayers.splice(this._queue._tileLayers.indexOf(m_this), 1);
|
|
320
|
+
if (this._queue.initialTrack && this._queue.track && this._queue._tileLayers.length) {
|
|
321
|
+
this._queue.track = this._queue.initialTrack * this._queue._tileLayers.length;
|
|
322
|
+
}
|
|
313
323
|
}
|
|
314
324
|
m_this._queue = queue;
|
|
315
325
|
m_this._queue._tileLayers = m_this._queue._tileLayers || [];
|
|
316
326
|
m_this._queue._tileLayers.push(m_this);
|
|
327
|
+
if (m_this._queue.initialTrack && m_this._queue.track) {
|
|
328
|
+
m_this._queue.track = m_this._queue.initialTrack * m_this._queue._tileLayers.length;
|
|
329
|
+
}
|
|
317
330
|
}
|
|
318
331
|
}
|
|
319
332
|
});
|
|
@@ -1736,6 +1749,9 @@ var tileLayer = function (arg) {
|
|
|
1736
1749
|
m_exited = true;
|
|
1737
1750
|
if (this._queue && this._queue._tileLayers && this._queue._tileLayers.indexOf(m_this) >= 0) {
|
|
1738
1751
|
this._queue._tileLayers.splice(this._queue._tileLayers.indexOf(m_this), 1);
|
|
1752
|
+
if (this._queue.initialTrack && this._queue.track && this._queue._tileLayers.length) {
|
|
1753
|
+
this._queue.track = this._queue.initialTrack * this._queue._tileLayers.length;
|
|
1754
|
+
}
|
|
1739
1755
|
}
|
|
1740
1756
|
return m_this;
|
|
1741
1757
|
};
|
|
@@ -1765,7 +1781,7 @@ tileLayer.defaults = {
|
|
|
1765
1781
|
topDown: false,
|
|
1766
1782
|
keepLower: true,
|
|
1767
1783
|
idleAfter: 'view',
|
|
1768
|
-
// cacheSize:
|
|
1784
|
+
// cacheSize: 600, // set depending on keepLower
|
|
1769
1785
|
tileRounding: Math.round,
|
|
1770
1786
|
attribution: '',
|
|
1771
1787
|
animationDuration: 0
|