geojs 1.6.3 → 1.6.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 +12 -0
- package/README.md +14 -9
- package/geo.js +132 -117
- package/geo.lean.js +132 -117
- package/geo.lean.min.js +2 -2
- package/geo.min.js +2 -2
- package/package.json +6 -8
- package/src/annotation.js +9 -5
- package/src/annotationLayer.js +3 -3
- package/src/camera.js +5 -5
- package/src/choroplethFeature.js +1 -1
- package/src/domRenderer.js +2 -1
- package/src/featureLayer.js +1 -1
- package/src/fileReader.js +2 -2
- package/src/imageTile.js +2 -1
- package/src/isolineFeature.js +1 -1
- package/src/layer.js +4 -2
- package/src/map.js +17 -15
- package/src/mapInteractor.js +17 -17
- package/src/markerFeature.js +2 -2
- package/src/meshFeature.js +1 -1
- package/src/osmLayer.js +2 -0
- package/src/pointFeature.js +1 -1
- package/src/registry.js +2 -2
- package/src/svg/svgRenderer.js +3 -3
- package/src/tileCache.js +1 -1
- package/src/tileLayer.js +10 -10
- package/src/trackFeature.js +19 -19
- package/src/transform.js +8 -9
- package/src/typedef.js +2 -0
- package/src/ui/sliderWidget.js +1 -1
- package/src/util/clustering.js +3 -3
- package/src/util/color.js +1 -1
- package/src/util/common.js +4 -4
- package/src/util/throttle.js +1 -1
- package/src/webgl/markerFeature.js +1 -1
- package/src/webgl/pointFeature.js +1 -1
- package/src/webgl/webglRenderer.js +1 -0
package/src/trackFeature.js
CHANGED
|
@@ -10,24 +10,24 @@ var util = require('./util');
|
|
|
10
10
|
* @extends geo.feature.spec
|
|
11
11
|
* @property {geo.geoPosition|function} [position] Position of the data.
|
|
12
12
|
* Default is (data).
|
|
13
|
-
* @property {
|
|
13
|
+
* @property {number|function} [time] Time of the data. Default is `(data).t`.
|
|
14
14
|
* @property {object|function} [track] Tracks from the data. Default is
|
|
15
15
|
* (data). Typically, the data is an array of tracks, each of which is an
|
|
16
16
|
* array of points, each of which has a position and time. The position and
|
|
17
17
|
* time functions are called for each point as `position(trackPoint,
|
|
18
18
|
* pointIndex, trackEntry, trackEntryIndex)`.
|
|
19
|
-
* @property {
|
|
19
|
+
* @property {number|null} [startTime=null] Start time. Used for styling. If
|
|
20
20
|
* `null`, this is the duration before the end time if `duration` is not
|
|
21
21
|
* `null` and the minimum time in any track if `duration` is `null`.
|
|
22
|
-
* @property {
|
|
23
|
-
* the track head. If `null` and either of `startTime` or `duration` are
|
|
22
|
+
* @property {number} [endTime=null] End time. Used for styling and position
|
|
23
|
+
* of the track head. If `null` and either of `startTime` or `duration` are
|
|
24
24
|
* `null`, this is the maximum time in any track.
|
|
25
|
-
* @property {
|
|
25
|
+
* @property {number} [duration=null] Duration between start and end times.
|
|
26
26
|
* Ignored if both start and end times are specified.
|
|
27
|
-
* @property {
|
|
28
|
-
* specified, the track head is rendered as text. If `undefined` a marker
|
|
29
|
-
* used instead. If `null` or an empty string (`''`), neither a marker
|
|
30
|
-
* text is used.
|
|
27
|
+
* @property {number|function} [text] Text to use for the head of the track.
|
|
28
|
+
* If specified, the track head is rendered as text. If `undefined` a marker
|
|
29
|
+
* is used instead. If `null` or an empty string (`''`), neither a marker
|
|
30
|
+
* nor text is used.
|
|
31
31
|
* @property {geo.trackFeature.styleSpec} [style] Style object with default
|
|
32
32
|
* style options.
|
|
33
33
|
* @property {geo.lineFeature.styleSpec} [pastStyle] Style object with
|
|
@@ -168,7 +168,7 @@ var trackFeature = function (arg) {
|
|
|
168
168
|
* Calculate an interpolated position given a time. If the time is outside
|
|
169
169
|
* the range of a track, the first or last point is returned.
|
|
170
170
|
*
|
|
171
|
-
* @param {
|
|
171
|
+
* @param {number} time The time to compute a position array for.
|
|
172
172
|
* @param {string|geo.transform|null} [gcs] `undefined` to use the feature
|
|
173
173
|
* gcs, `null` to use the map gcs, or any other transform. This transform
|
|
174
174
|
* is used for the interpolation; the results are still in feature gcs.
|
|
@@ -275,8 +275,8 @@ var trackFeature = function (arg) {
|
|
|
275
275
|
m_tracks.textFunc = m_this.style.get('text');
|
|
276
276
|
['past', 'current', 'future'].forEach(key => {
|
|
277
277
|
m_lineFeatures[key]
|
|
278
|
-
.style(m_this[key + 'Style']())
|
|
279
278
|
.style(m_this.style())
|
|
279
|
+
.style(m_this[key + 'Style']())
|
|
280
280
|
.line(m_this.style('track'))
|
|
281
281
|
.gcs(m_this.gcs())
|
|
282
282
|
.data(data)
|
|
@@ -571,11 +571,11 @@ var trackFeature = function (arg) {
|
|
|
571
571
|
/**
|
|
572
572
|
* Get/Set time accessor.
|
|
573
573
|
*
|
|
574
|
-
* @param {
|
|
574
|
+
* @param {number} [val] If not specified, return the current time accessor.
|
|
575
575
|
* If specified, use this for the time accessor and return `this`. If a
|
|
576
576
|
* function is given, this is called with `(vertexElement, vertexIndex,
|
|
577
577
|
* dataElement, dataIndex)`.
|
|
578
|
-
* @returns {
|
|
578
|
+
* @returns {number|function|this} The current time or this feature.
|
|
579
579
|
*/
|
|
580
580
|
this.time = function (val) {
|
|
581
581
|
if (val === undefined) {
|
|
@@ -636,8 +636,8 @@ var trackFeature = function (arg) {
|
|
|
636
636
|
/**
|
|
637
637
|
* Get or set the start time.
|
|
638
638
|
*
|
|
639
|
-
* @param {
|
|
640
|
-
* @returns {
|
|
639
|
+
* @param {number|null} [val] If specified, the new start time.
|
|
640
|
+
* @returns {number|null|this} If set, the instance. Otherwise, the current
|
|
641
641
|
* start time value.
|
|
642
642
|
*/
|
|
643
643
|
this.startTime = function (val) {
|
|
@@ -654,8 +654,8 @@ var trackFeature = function (arg) {
|
|
|
654
654
|
/**
|
|
655
655
|
* Get or set the end time.
|
|
656
656
|
*
|
|
657
|
-
* @param {
|
|
658
|
-
* @returns {
|
|
657
|
+
* @param {number|null} [val] If specified, the new end time.
|
|
658
|
+
* @returns {number|null|this} If set, the instance. Otherwise, the current
|
|
659
659
|
* end time value.
|
|
660
660
|
*/
|
|
661
661
|
this.endTime = function (val) {
|
|
@@ -672,8 +672,8 @@ var trackFeature = function (arg) {
|
|
|
672
672
|
/**
|
|
673
673
|
* Get or set the duration.
|
|
674
674
|
*
|
|
675
|
-
* @param {
|
|
676
|
-
* @returns {
|
|
675
|
+
* @param {number|null} [val] If specified, the new duration.
|
|
676
|
+
* @returns {number|null|this} If set, the instance. Otherwise, the current
|
|
677
677
|
* duration.
|
|
678
678
|
*/
|
|
679
679
|
this.duration = function (val) {
|
package/src/transform.js
CHANGED
|
@@ -330,11 +330,12 @@ transform.lookup = function (projection) {
|
|
|
330
330
|
*
|
|
331
331
|
* @param {string} srcPrj The source projection.
|
|
332
332
|
* @param {string} tgtPrj The destination projection.
|
|
333
|
-
* @param {geoPosition|geoPosition[]|number[]} coordinates An array of
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
* @param {number} numberOfComponents For flat arrays, either 2 or 3.
|
|
337
|
-
* @returns {geoPosition|geoPosition[]|number[]} The transformed
|
|
333
|
+
* @param {geo.geoPosition|geo.geoPosition[]|number[]} coordinates An array of
|
|
334
|
+
* coordinate objects. These may be in object or array form, or a flat
|
|
335
|
+
* array.
|
|
336
|
+
* @param {number} [numberOfComponents] For flat arrays, either 2 or 3.
|
|
337
|
+
* @returns {geo.geoPosition|geo.geoPosition[]|number[]} The transformed
|
|
338
|
+
* coordinates.
|
|
338
339
|
*/
|
|
339
340
|
transform.transformCoordinates = function (srcPrj, tgtPrj, coordinates, numberOfComponents) {
|
|
340
341
|
'use strict';
|
|
@@ -385,10 +386,10 @@ transform.transformCoordinates = function (srcPrj, tgtPrj, coordinates, numberOf
|
|
|
385
386
|
* components per coordinate. The array is modified in place.
|
|
386
387
|
*
|
|
387
388
|
* @param {transform} trans The transformation object.
|
|
388
|
-
* @param {geoPosition[]|number[]} coordinates An array of coordinate
|
|
389
|
+
* @param {geo.geoPosition[]|number[]} coordinates An array of coordinate
|
|
389
390
|
* objects or a flat array.
|
|
390
391
|
* @param {number} numberOfComponents For flat arrays, either 2 or 3.
|
|
391
|
-
* @returns {geoPosition[]|number[]} The transformed coordinates
|
|
392
|
+
* @returns {geo.geoPosition[]|number[]} The transformed coordinates
|
|
392
393
|
*/
|
|
393
394
|
transform.transformCoordinatesArray = function (trans, coordinates, numberOfComponents) {
|
|
394
395
|
var i, count, offset, xAcc, yAcc, zAcc, writer, output, projPoint,
|
|
@@ -654,8 +655,6 @@ transform.affineInverse = function (def, coords) {
|
|
|
654
655
|
* @param {object} [ellipsoid=proj4.WGS84] An object with at least `a` and one
|
|
655
656
|
* of `b`, `f`, or `rf` (1 / `f`) -- this works with proj4 ellipsoid
|
|
656
657
|
* definitions.
|
|
657
|
-
* @param {number} [maxIterations=100] Maximum number of iterations to use
|
|
658
|
-
* to test convergence.
|
|
659
658
|
* @returns {number} The distance in meters (or whatever units the ellipsoid
|
|
660
659
|
* was specified in.
|
|
661
660
|
*/
|
package/src/typedef.js
CHANGED
package/src/ui/sliderWidget.js
CHANGED
|
@@ -203,7 +203,7 @@ var sliderWidget = function (arg) {
|
|
|
203
203
|
* Respond to a mouse event on the widget.
|
|
204
204
|
*
|
|
205
205
|
* @param {d3Event} evt The event on the widget.
|
|
206
|
-
* @param {boolean} trans Truthy for an animated transition.
|
|
206
|
+
* @param {boolean} [trans] Truthy for an animated transition.
|
|
207
207
|
*/
|
|
208
208
|
function respond(evt, trans) {
|
|
209
209
|
var z = m_yscale.invert(d3.mouse(svg.node())[1]),
|
package/src/util/clustering.js
CHANGED
|
@@ -18,7 +18,7 @@ var $ = require('jquery');
|
|
|
18
18
|
*
|
|
19
19
|
* @param {geo.util.ClusterGroup} group The source cluster group
|
|
20
20
|
* @param {number} zoom The zoom level of the current node
|
|
21
|
-
* @param {object[]} children An array of ClusterTrees or point objects
|
|
21
|
+
* @param {object[]} [children] An array of ClusterTrees or point objects
|
|
22
22
|
*/
|
|
23
23
|
function ClusterTree(group, zoom, children) {
|
|
24
24
|
this._group = group;
|
|
@@ -136,8 +136,8 @@ ClusterTree.prototype.coords = function () {
|
|
|
136
136
|
* @class
|
|
137
137
|
* @alias geo.util.ClusterGroup
|
|
138
138
|
* @param {object} opts An options object
|
|
139
|
-
* @param {number} maxZoom The maximum zoom level to calculate.
|
|
140
|
-
* @param {number} radius Size of clustering at zoom 0 in point gcs.
|
|
139
|
+
* @param {number} [opts.maxZoom] The maximum zoom level to calculate.
|
|
140
|
+
* @param {number} [opts.radius] Size of clustering at zoom 0 in point gcs.
|
|
141
141
|
*/
|
|
142
142
|
function C(opts) {
|
|
143
143
|
|
package/src/util/color.js
CHANGED
|
@@ -59,7 +59,7 @@ var colorName = require('color-name');
|
|
|
59
59
|
/**
|
|
60
60
|
* @typedef {object} geo.util.cssColorConversionRecord
|
|
61
61
|
* @property {string} name The name of the color conversion.
|
|
62
|
-
* @property {
|
|
62
|
+
* @property {RegExp} regex A regex that, if it matches the color string, will
|
|
63
63
|
* cause the process function to be invoked.
|
|
64
64
|
* @property {function} process A function that takes (`color`, `match`) with
|
|
65
65
|
* the original color string and the results of matching the regex using
|
package/src/util/common.js
CHANGED
|
@@ -128,7 +128,7 @@ var util = {
|
|
|
128
128
|
* Check if an object an HTMLVideoElement element that is loaded.
|
|
129
129
|
*
|
|
130
130
|
* @param {object} vid An object that might be an HTMLVideoElement.
|
|
131
|
-
* @param {boolean} [allowFailedVideo] If `true`, an
|
|
131
|
+
* @param {boolean} [allowFailedVideo] If `true`, an video element that has
|
|
132
132
|
* a source and has failed to load is also considered 'ready' in the
|
|
133
133
|
* sense that it isn't expected to change to a better state.
|
|
134
134
|
* @returns {boolean} `true` if this is a video that is ready.
|
|
@@ -525,7 +525,7 @@ var util = {
|
|
|
525
525
|
* var map = geo.map($.extend(results.map, {clampZoom: false}));
|
|
526
526
|
* map.createLayer('osm', results.layer);
|
|
527
527
|
*
|
|
528
|
-
* @param {string}
|
|
528
|
+
* @param {string?} node DOM selector for the map container.
|
|
529
529
|
* @param {number} width Width of the whole map contents in pixels.
|
|
530
530
|
* @param {number} height Height of the whole map contents in pixels.
|
|
531
531
|
* @param {number} [tileWidth] If an osm or tile layer is going to be used,
|
|
@@ -967,7 +967,7 @@ var util = {
|
|
|
967
967
|
*/
|
|
968
968
|
escapeUnicodeHTML: function (text) {
|
|
969
969
|
return text.replace(/./g, function (k) {
|
|
970
|
-
var code = k.charCodeAt();
|
|
970
|
+
var code = k.charCodeAt(0);
|
|
971
971
|
if (code < 127) {
|
|
972
972
|
return k;
|
|
973
973
|
}
|
|
@@ -1026,7 +1026,7 @@ var util = {
|
|
|
1026
1026
|
* stored as local base64 urls.
|
|
1027
1027
|
*
|
|
1028
1028
|
* @param {string} css The css to parse for urls.
|
|
1029
|
-
* @param {jQuery.selector|
|
|
1029
|
+
* @param {jQuery.selector|HTMLElement} styleElem The element that receives
|
|
1030
1030
|
* the css text after dereferencing or the DOM element that has style
|
|
1031
1031
|
* that will be updated.
|
|
1032
1032
|
* @param {jQuery.Deferred} styleDefer A Deferred to resolve once
|
package/src/util/throttle.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* unspecified, callback will be executed one final time after the last
|
|
44
44
|
* throttled-function call. (After the throttled-function has not been
|
|
45
45
|
* called for `delay` milliseconds, the internal counter is reset)
|
|
46
|
-
* @param {function} callback A function to be executed after `delay`
|
|
46
|
+
* @param {function} [callback] A function to be executed after `delay`
|
|
47
47
|
* milliseconds. The `this` context and all arguments are passed through,
|
|
48
48
|
* as-is, to `callback` when the throttled-function is executed.
|
|
49
49
|
* @param {function} [accumulator] A function to be executed (synchronously)
|
|
@@ -98,7 +98,7 @@ var webgl_markerFeature = function (arg) {
|
|
|
98
98
|
/**
|
|
99
99
|
* Create and style the data needed to render the markers.
|
|
100
100
|
*
|
|
101
|
-
@param {boolean} onlyStyle if true, use the existing geometry and just
|
|
101
|
+
@param {boolean} [onlyStyle] if true, use the existing geometry and just
|
|
102
102
|
* recalculate the style.
|
|
103
103
|
*/
|
|
104
104
|
function createGLMarkers(onlyStyle) {
|
|
@@ -78,7 +78,7 @@ var webgl_pointFeature = function (arg) {
|
|
|
78
78
|
/**
|
|
79
79
|
* Create and style the data needed to render the points.
|
|
80
80
|
*
|
|
81
|
-
* @param {boolean} onlyStyle if true, use the existing geometry and just
|
|
81
|
+
* @param {boolean} [onlyStyle] if true, use the existing geometry and just
|
|
82
82
|
* recalculate the style.
|
|
83
83
|
*/
|
|
84
84
|
function createGLPoints(onlyStyle) {
|
|
@@ -319,6 +319,7 @@ webglRenderer.supported = function () {
|
|
|
319
319
|
var canvas, ctx, exts; // eslint-disable-line no-unused-vars
|
|
320
320
|
try {
|
|
321
321
|
canvas = document.createElement('canvas');
|
|
322
|
+
/** @type {WebGLRenderingContext} */
|
|
322
323
|
ctx = (canvas.getContext('webgl') ||
|
|
323
324
|
canvas.getContext('experimental-webgl'));
|
|
324
325
|
/* getSupportExtensions will throw an exception if the context isn't
|