geojs 1.6.0 → 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/.github/workflows/main.yml +4 -4
- package/.nvmrc +1 -0
- package/CHANGELOG.md +34 -0
- package/README.md +14 -9
- package/geo.js +1987 -1910
- package/geo.lean.js +1985 -1908
- package/geo.lean.min.js +3 -3
- package/geo.min.js +6 -6
- package/package.json +14 -19
- package/src/annotation.js +9 -5
- package/src/annotationLayer.js +9 -5
- 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 +4 -0
- package/src/pointFeature.js +1 -1
- package/src/registry.js +2 -2
- package/src/svg/svgRenderer.js +3 -3
- package/src/tile.js +1 -1
- 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/colorLegendWidget.styl +1 -1
- 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/vtkjs/pointFeature.js +1 -1
- package/src/webgl/markerFeature.js +1 -1
- package/src/webgl/pointFeature.js +1 -1
- package/src/webgl/quadFeatureColor.vert +0 -1
- package/src/webgl/webglRenderer.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geojs",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "JavaScript Geo Visualization and Analysis Library",
|
|
5
5
|
"homepage": "https://github.com/OpenGeoscience/geojs",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"optionalDependencies": {
|
|
28
28
|
"d3": "^3.5.17",
|
|
29
29
|
"hammerjs": "^2.0.8",
|
|
30
|
-
"vtk.js": "
|
|
30
|
+
"vtk.js": "*"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "^7.16.5",
|
|
34
34
|
"@babel/plugin-proposal-class-properties": "^7.16.5",
|
|
35
35
|
"@babel/preset-env": "^7.16.5",
|
|
36
|
+
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
36
37
|
"babel-loader": "^8.2.3",
|
|
37
38
|
"babel-plugin-istanbul": "^6.1.1",
|
|
38
39
|
"bootstrap": "^3.4.1",
|
|
@@ -41,22 +42,18 @@
|
|
|
41
42
|
"colorbrewer": "^1.5.1",
|
|
42
43
|
"css-loader": "^6.5.1",
|
|
43
44
|
"docco": "^0.9.1",
|
|
44
|
-
"eslint": "^
|
|
45
|
+
"eslint": "^7.12.1",
|
|
45
46
|
"eslint-config-semistandard": "^16.0.0",
|
|
46
47
|
"eslint-config-standard": "^16.0.3",
|
|
47
48
|
"eslint-plugin-import": "^2.25.3",
|
|
48
49
|
"eslint-plugin-node": "^11.1.0",
|
|
49
|
-
"eslint-plugin-promise": "^
|
|
50
|
-
"eslint-plugin-standard": "^5.0.0",
|
|
50
|
+
"eslint-plugin-promise": "^5.0.0",
|
|
51
51
|
"expose-loader": "^3.1.0",
|
|
52
52
|
"express": "^4.17.2",
|
|
53
|
-
"forever": "^4.0.1",
|
|
54
53
|
"fs-extra": "^10.0.0",
|
|
55
54
|
"glob": "^7.2.0",
|
|
56
55
|
"glslang-validator-prebuilt": "0.0.6",
|
|
57
56
|
"imports-loader": "^3.1.1",
|
|
58
|
-
"istanbul-combine": "^0.3.0",
|
|
59
|
-
"istanbul-instrumenter-loader": "^3.0.1",
|
|
60
57
|
"jaguarjs-jsdoc": "^1.0.2",
|
|
61
58
|
"jasmine-core": "^4.0.0",
|
|
62
59
|
"js-yaml": "^4.1.0",
|
|
@@ -64,7 +61,7 @@
|
|
|
64
61
|
"jsdoc-autoprivate": "0.0.1",
|
|
65
62
|
"jsonlint-mod": "^1.7.6",
|
|
66
63
|
"jstransformer-markdown-it": "^2.0.0",
|
|
67
|
-
"karma": "^6.3.
|
|
64
|
+
"karma": "^6.3.13",
|
|
68
65
|
"karma-chrome-launcher": "^3.1.0",
|
|
69
66
|
"karma-coverage": "^2.1.0",
|
|
70
67
|
"karma-firefox-launcher": "^2.1.2",
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
"karma-jasmine-html-reporter": "^1.7.0",
|
|
73
70
|
"karma-sinon": "^1.0.5",
|
|
74
71
|
"karma-sourcemap-loader": "^0.3.8",
|
|
75
|
-
"karma-spec-reporter": "^0.0.
|
|
72
|
+
"karma-spec-reporter": "^0.0.33",
|
|
76
73
|
"karma-webpack": "^5.0.0",
|
|
77
74
|
"nib": "^1.1.2",
|
|
78
75
|
"pako": "^2.0.4",
|
|
@@ -81,18 +78,18 @@
|
|
|
81
78
|
"pug-load": "^3.0.0",
|
|
82
79
|
"raw-body": "^2.4.2",
|
|
83
80
|
"resemblejs": "^4.0.0",
|
|
84
|
-
"semantic-release": "^
|
|
81
|
+
"semantic-release": "^19.0.2",
|
|
85
82
|
"serve-index": "^1.9.1",
|
|
86
83
|
"shader-loader": "^1.3.1",
|
|
87
|
-
"sinon": "^
|
|
84
|
+
"sinon": "^13.0.1",
|
|
88
85
|
"string-replace-webpack-plugin": "^0.1.3",
|
|
89
86
|
"style-loader": "^3.3.1",
|
|
90
87
|
"stylus": "^0.56.0",
|
|
91
88
|
"stylus-loader": "^6.2.0",
|
|
92
|
-
"terser-webpack-plugin": "^5.3.
|
|
89
|
+
"terser-webpack-plugin": "^5.3.1",
|
|
93
90
|
"touch-emulator": "^1.0.0",
|
|
94
91
|
"typeface-lato": "^1.1.13",
|
|
95
|
-
"webpack": "^5.
|
|
92
|
+
"webpack": "^5.68.0",
|
|
96
93
|
"webpack-cli": "^4.9.1",
|
|
97
94
|
"webpack-merge": "^5.8.0"
|
|
98
95
|
},
|
|
@@ -148,18 +145,16 @@
|
|
|
148
145
|
"ci-clean": "git clean -fxd dist -e dist/data jsdoc/tmpl jsdoc/static images lcov",
|
|
149
146
|
"ci": "npm run ci-build && npm run ci-test",
|
|
150
147
|
"ci-build": "bash -c '(webpack --config webpack.config.js & webpack --config webpack-lean.config.js & npm run docs & npm run get-data-files & npm run lint & npm run puglint & npm run glsllint & npm run build-examples & npm run build-tutorials & wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n)'",
|
|
151
|
-
"ci-
|
|
148
|
+
"ci-build-wait": "bash -c '(webpack --config webpack.config.js & webpack --config webpack-lean.config.js & npm run docs & npm run get-data-files & npm run lint & npm run puglint & npm run glsllint & npm run build-examples & npm run build-tutorials & wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && FAIL=0 || FAIL=1; wait; [ \"$FAIL\" == \"0\" ])'",
|
|
149
|
+
"ci-test": "npm run test-headless && npm run test-webglheadless && npm run test-headed && npm run test-tutorials",
|
|
152
150
|
"ci-xvfb": "npm run ci-clean && npm run ci-build && TEST_SAVE_IMAGE='all' xvfb-run -s '-ac -screen 0 1280x1024x24' npm run ci-test",
|
|
153
151
|
"start": "karma start karma.conf.js",
|
|
154
|
-
"combine-coverage": "istanbul-combine -d dist/cobertura -r cobertura 'dist/coverage/json/**/coverage-final.json'",
|
|
155
152
|
"examples": "node examples/build.js && webpack --config webpack-examples.config.js && node tutorials/build.js && webpack --config webpack-tutorials.config.js && node ./tests/runners/server.js --host \"${HOST-}\" --port ${PORT-8082} --dist",
|
|
156
|
-
"start-test": "node examples/build.js; forever start ./tests/runners/server.js",
|
|
157
|
-
"stop-test": "forever stop ./tests/runners/server.js",
|
|
158
153
|
"docs": "jsdoc --pedantic -d dist/apidocs -r src package.json -c jsdoc.conf.json",
|
|
159
154
|
"website": "cd website && npx hexo server",
|
|
160
155
|
"setup-website": "cd website && npm install",
|
|
161
156
|
"build-website": "npm run ci-build && npm run ci-build-website",
|
|
162
|
-
"ci-build-website": "cp -a dist/built/. website/source/built && bash -c '(npm run build-website-examples & npm run build-website-tutorials & wait -n && wait -n)' && cd dist &&
|
|
157
|
+
"ci-build-website": "cp -a dist/built/. website/source/built && bash -c '(npm run build-website-examples & npm run build-website-tutorials & wait -n && wait -n)' && cd dist && cp -ar data ../website/source/. && rm -rf ../website/source/data/tiles && rm -rf ../website/source/data/tiles.tgz && rm -rf ../website/source/data/base-images && rm -rf ../website/source/data/base-images.tgz && cp -ar apidocs/. ../website/source/apidocs && cd ../website && npm install && rm -f db.json && npx hexo generate",
|
|
163
158
|
"prepublishOnly": "webpack --config webpack.config.js && webpack --config webpack-lean.config.js && cp dist/built/*.js .",
|
|
164
159
|
"semantic-release": "semantic-release"
|
|
165
160
|
},
|
package/src/annotation.js
CHANGED
|
@@ -145,7 +145,7 @@ var annotation = function (type, args) {
|
|
|
145
145
|
/**
|
|
146
146
|
* Get or set the name of this annotation.
|
|
147
147
|
*
|
|
148
|
-
* @param {string|undefined} arg If `undefined`, return the name, otherwise
|
|
148
|
+
* @param {string|undefined} [arg] If `undefined`, return the name, otherwise
|
|
149
149
|
* change it. When setting the name, the value is trimmed of
|
|
150
150
|
* whitespace. The name will not be changed to an empty string.
|
|
151
151
|
* @returns {this|string} The current name or this annotation.
|
|
@@ -293,7 +293,7 @@ var annotation = function (type, args) {
|
|
|
293
293
|
/**
|
|
294
294
|
* Get or set the state of this annotation.
|
|
295
295
|
*
|
|
296
|
-
* @param {string|undefined} arg If `undefined`, return the state,
|
|
296
|
+
* @param {string|undefined} [arg] If `undefined`, return the state,
|
|
297
297
|
* otherwise change it. This should be one of the
|
|
298
298
|
* {@link geo.annotation.state} values.
|
|
299
299
|
* @returns {this|string} The current state or this annotation.
|
|
@@ -352,7 +352,7 @@ var annotation = function (type, args) {
|
|
|
352
352
|
* `'remove'` if the annotation should be removed, falsy to not update
|
|
353
353
|
* anything.
|
|
354
354
|
*/
|
|
355
|
-
this.processAction = function () {
|
|
355
|
+
this.processAction = function (evt) {
|
|
356
356
|
return undefined;
|
|
357
357
|
};
|
|
358
358
|
|
|
@@ -1081,8 +1081,8 @@ var annotation = function (type, args) {
|
|
|
1081
1081
|
*
|
|
1082
1082
|
* @param {object} m_this The current annotation instance.
|
|
1083
1083
|
* @param {function} s_actions The parent actions method.
|
|
1084
|
-
* @param {string}
|
|
1085
|
-
* the current state.
|
|
1084
|
+
* @param {string|undefined} state The state to return actions for. Defaults
|
|
1085
|
+
* to the current state.
|
|
1086
1086
|
* @param {string} name The name of this annotation.
|
|
1087
1087
|
* @param {Array} originalArgs arguments to original call
|
|
1088
1088
|
* @returns {geo.actionRecord[]} A list of actions.
|
|
@@ -1183,6 +1183,10 @@ function continuousVerticesProcessAction(m_this, evt, name) {
|
|
|
1183
1183
|
* @property {geo.polygonFeature.styleSpec} [editStyle] The style to apply to a
|
|
1184
1184
|
* rectangle in edit mode.
|
|
1185
1185
|
*/
|
|
1186
|
+
/*
|
|
1187
|
+
* @typedef {object} geo.rectangleAnnotation.subspec
|
|
1188
|
+
* @typedef {geo.annotation.spec | geo.rectangleAnnotation.subspec} geo.rectangleAnnotation.spec
|
|
1189
|
+
*/
|
|
1186
1190
|
|
|
1187
1191
|
/**
|
|
1188
1192
|
* Rectangle annotation class.
|
package/src/annotationLayer.js
CHANGED
|
@@ -399,11 +399,13 @@ var annotationLayer = function (arg) {
|
|
|
399
399
|
* @param {geo.annotation} annotation The annotation to add.
|
|
400
400
|
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
|
|
401
401
|
* gcs, `null` to use the map gcs, or any other transform.
|
|
402
|
+
* @param {boolean} [update] If `false`, don't update the layer after adding
|
|
403
|
+
* the annotation.
|
|
402
404
|
* @returns {this} The current layer.
|
|
403
405
|
* @fires geo.event.annotation.add_before
|
|
404
406
|
* @fires geo.event.annotation.add
|
|
405
407
|
*/
|
|
406
|
-
this.addAnnotation = function (annotation, gcs) {
|
|
408
|
+
this.addAnnotation = function (annotation, gcs, update) {
|
|
407
409
|
var pos = $.inArray(annotation, m_annotations);
|
|
408
410
|
if (pos < 0) {
|
|
409
411
|
m_this.geoTrigger(geo_event.annotation.add_before, {
|
|
@@ -418,8 +420,10 @@ var annotationLayer = function (arg) {
|
|
|
418
420
|
annotation._coordinates(transform.transformCoordinates(
|
|
419
421
|
gcs, map.gcs(), annotation._coordinates()));
|
|
420
422
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
+
if (update !== false) {
|
|
424
|
+
m_this.modified();
|
|
425
|
+
m_this.draw();
|
|
426
|
+
}
|
|
423
427
|
m_this.geoTrigger(geo_event.annotation.add, {
|
|
424
428
|
annotation: annotation
|
|
425
429
|
});
|
|
@@ -431,7 +435,7 @@ var annotationLayer = function (arg) {
|
|
|
431
435
|
* Remove an annotation from the layer.
|
|
432
436
|
*
|
|
433
437
|
* @param {geo.annotation} annotation The annotation to remove.
|
|
434
|
-
* @param {boolean} update If `false`, don't update the layer after removing
|
|
438
|
+
* @param {boolean} [update] If `false`, don't update the layer after removing
|
|
435
439
|
* the annotation.
|
|
436
440
|
* @returns {boolean} `true` if an annotation was removed.
|
|
437
441
|
* @fires geo.event.annotation.remove
|
|
@@ -603,7 +607,7 @@ var annotationLayer = function (arg) {
|
|
|
603
607
|
* Return the current set of annotations as a geojson object. Alternately,
|
|
604
608
|
* add a set of annotations from a geojson object.
|
|
605
609
|
*
|
|
606
|
-
* @param {string|
|
|
610
|
+
* @param {string|object|File} [geojson] If present, add annotations based on
|
|
607
611
|
* the given geojson object. If `undefined`, return the current
|
|
608
612
|
* annotations as geojson. This may be a JSON string, a javascript
|
|
609
613
|
* object, or a File object.
|
package/src/camera.js
CHANGED
|
@@ -502,7 +502,7 @@ var camera = function (spec) {
|
|
|
502
502
|
* Project a vector from world space into viewport (display) space. The
|
|
503
503
|
* resulting vector always has the last component (`w`) equal to 1.
|
|
504
504
|
*
|
|
505
|
-
* @param {
|
|
505
|
+
* @param {vec3|vec4} point The point in world coordinates.
|
|
506
506
|
* @returns {vec4} The point in display coordinates.
|
|
507
507
|
*/
|
|
508
508
|
this.worldToDisplay4 = function (point) {
|
|
@@ -518,7 +518,7 @@ var camera = function (spec) {
|
|
|
518
518
|
* Project a vector from viewport (display) space into world space. The
|
|
519
519
|
* resulting vector always has the last component (`w`) equal to 1.
|
|
520
520
|
*
|
|
521
|
-
* @param {
|
|
521
|
+
* @param {vec3|vec4} point The point in display coordinates.
|
|
522
522
|
* @returns {vec4} The point in world space coordinates.
|
|
523
523
|
*/
|
|
524
524
|
this.displayToWorld4 = function (point) {
|
|
@@ -788,7 +788,7 @@ var camera = function (spec) {
|
|
|
788
788
|
/**
|
|
789
789
|
* Represent a glmatrix as a pretty-printed string.
|
|
790
790
|
* @param {mat4} mat A 4 x 4 matrix.
|
|
791
|
-
* @param {number} prec The number of decimal places.
|
|
791
|
+
* @param {number} [prec] The number of decimal places.
|
|
792
792
|
* @returns {string}
|
|
793
793
|
*/
|
|
794
794
|
this.ppMatrix = function (mat, prec) {
|
|
@@ -862,7 +862,7 @@ var camera = function (spec) {
|
|
|
862
862
|
|
|
863
863
|
/**
|
|
864
864
|
* Supported projection types.
|
|
865
|
-
* @enum
|
|
865
|
+
* @enum {boolean}
|
|
866
866
|
*/
|
|
867
867
|
camera.projection = {
|
|
868
868
|
perspective: true,
|
|
@@ -872,7 +872,7 @@ camera.projection = {
|
|
|
872
872
|
/**
|
|
873
873
|
* Default camera clipping bounds. Some features and renderers may rely on the
|
|
874
874
|
* far clip value being more positive than the near clip value.
|
|
875
|
-
* @enum
|
|
875
|
+
* @enum {number}
|
|
876
876
|
*/
|
|
877
877
|
camera.clipbounds = {
|
|
878
878
|
perspective: {
|
package/src/choroplethFeature.js
CHANGED
|
@@ -185,7 +185,7 @@ var choroplethFeature = function (arg) {
|
|
|
185
185
|
/**
|
|
186
186
|
* Add a geojson polygon feature to the current layer.
|
|
187
187
|
*
|
|
188
|
-
* @param {geojsonFeature} feature A geojson parsed feature.
|
|
188
|
+
* @param {geo.geojsonFeature} feature A geojson parsed feature.
|
|
189
189
|
* @param {geo.geoColor} fillColor The fill color for the feature.
|
|
190
190
|
* @returns {geo.polygonFeature}
|
|
191
191
|
*/
|
package/src/domRenderer.js
CHANGED
|
@@ -38,9 +38,10 @@ var domRenderer = function (arg) {
|
|
|
38
38
|
/**
|
|
39
39
|
* Initialize.
|
|
40
40
|
*
|
|
41
|
+
* @param {object} [arg] Optional arguments.
|
|
41
42
|
* @returns {this}
|
|
42
43
|
*/
|
|
43
|
-
this._init = function () {
|
|
44
|
+
this._init = function (arg) {
|
|
44
45
|
var layer = m_this.layer().node();
|
|
45
46
|
|
|
46
47
|
if (!m_this.canvas() && layer && layer.length) {
|
package/src/featureLayer.js
CHANGED
|
@@ -109,7 +109,7 @@ var featureLayer = function (arg) {
|
|
|
109
109
|
/**
|
|
110
110
|
* Get/Set drawables.
|
|
111
111
|
*
|
|
112
|
-
* @param {geo.feature[]} val A list of features, or unspecified to return
|
|
112
|
+
* @param {geo.feature[]} [val] A list of features, or unspecified to return
|
|
113
113
|
* the current feature list. If a list is provided, features are added or
|
|
114
114
|
* removed as needed.
|
|
115
115
|
* @returns {geo.feature[]|this} The current features associated with the
|
package/src/fileReader.js
CHANGED
|
@@ -6,7 +6,7 @@ var object = require('./object');
|
|
|
6
6
|
* Object specification for a fileReader.
|
|
7
7
|
*
|
|
8
8
|
* @typedef {object} geo.fileReader.spec
|
|
9
|
-
* @property {geo.featureLayer} layer The target feature layer.
|
|
9
|
+
* @property {geo.featureLayer} [layer] The target feature layer.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -15,7 +15,7 @@ var object = require('./object');
|
|
|
15
15
|
* @class
|
|
16
16
|
* @alias geo.fileReader
|
|
17
17
|
* @extends geo.object
|
|
18
|
-
* @param {geo.fileReader.spec} arg
|
|
18
|
+
* @param {geo.fileReader.spec} [arg]
|
|
19
19
|
* @returns {geo.fileReader}
|
|
20
20
|
*/
|
|
21
21
|
var fileReader = function (arg) {
|
package/src/imageTile.js
CHANGED
|
@@ -11,7 +11,8 @@ var tile = require('./tile');
|
|
|
11
11
|
* @property {object} [size] The size of each tile.
|
|
12
12
|
* @property {number} [size.x=256] Width in pixels.
|
|
13
13
|
* @property {number} [size.y=256] Height in pixels.
|
|
14
|
-
* @property {string} [crossDomain='anonymous'] Image CORS attribute.
|
|
14
|
+
* @property {string} [crossDomain='anonymous'] Image CORS attribute. This is
|
|
15
|
+
* used for the `crossorigin` property when loading images.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
/**
|
package/src/isolineFeature.js
CHANGED
|
@@ -657,7 +657,7 @@ var isolineFeature = function (arg) {
|
|
|
657
657
|
* the generated labels. The viewport calculation is conservative, as the
|
|
658
658
|
* map could be rotated, changed size, or have other modifications.
|
|
659
659
|
*
|
|
660
|
-
* @returns {
|
|
660
|
+
* @returns {this}
|
|
661
661
|
*/
|
|
662
662
|
this._updateLabelPositions = function () {
|
|
663
663
|
var last = m_lastLabelPositions;
|
package/src/layer.js
CHANGED
|
@@ -291,7 +291,7 @@ var layer = function (arg) {
|
|
|
291
291
|
/**
|
|
292
292
|
* Get root node of the layer.
|
|
293
293
|
*
|
|
294
|
-
* @returns {
|
|
294
|
+
* @returns {HTMLDivElement}
|
|
295
295
|
*/
|
|
296
296
|
this.node = function () {
|
|
297
297
|
return m_node;
|
|
@@ -579,9 +579,11 @@ var layer = function (arg) {
|
|
|
579
579
|
* Update layer.
|
|
580
580
|
*
|
|
581
581
|
* This is a stub that should be subclassed.
|
|
582
|
+
*
|
|
583
|
+
* @param {object} [arg] An object, possibly with an ``event`` key and value.
|
|
582
584
|
* @returns {this}
|
|
583
585
|
*/
|
|
584
|
-
this._update = function () {
|
|
586
|
+
this._update = function (arg) {
|
|
585
587
|
return m_this;
|
|
586
588
|
};
|
|
587
589
|
|
package/src/map.js
CHANGED
|
@@ -517,7 +517,7 @@ var map = function (arg) {
|
|
|
517
517
|
* view center. Rotation mostly ignores `clampBoundsX`, as the behavior
|
|
518
518
|
* feels peculiar otherwise.
|
|
519
519
|
*
|
|
520
|
-
* @param {number} rotation Absolute angle in radians (positive is
|
|
520
|
+
* @param {number} [rotation] Absolute angle in radians (positive is
|
|
521
521
|
* clockwise).
|
|
522
522
|
* @param {object} [origin] If specified, rotate about this origin.
|
|
523
523
|
* @param {geo.geoPosition} origin.geo The gcs coordinates of the
|
|
@@ -830,7 +830,7 @@ var map = function (arg) {
|
|
|
830
830
|
* coordinate to convert.
|
|
831
831
|
* @param {string|geo.transform|null} [gcs] Output gcs. `undefined` to use
|
|
832
832
|
* the interface gcs, `null` to use the map gcs, or any other transform.
|
|
833
|
-
* @returns {geo.geoPosition|geoPosition[]} GCS space coordinates.
|
|
833
|
+
* @returns {geo.geoPosition|geo.geoPosition[]} GCS space coordinates.
|
|
834
834
|
*/
|
|
835
835
|
this.displayToGcs = function (c, gcs) {
|
|
836
836
|
c = m_this.displayToWorld(c); // done via camera
|
|
@@ -954,9 +954,10 @@ var map = function (arg) {
|
|
|
954
954
|
/**
|
|
955
955
|
* Initialize the map.
|
|
956
956
|
*
|
|
957
|
+
* @param {object} [arg] Optional arguments.
|
|
957
958
|
* @returns {this} The map object.
|
|
958
959
|
*/
|
|
959
|
-
this._init = function () {
|
|
960
|
+
this._init = function (arg) {
|
|
960
961
|
|
|
961
962
|
if (m_node === undefined || m_node === null) {
|
|
962
963
|
throw new Error('Map require DIV node');
|
|
@@ -1296,7 +1297,7 @@ var map = function (arg) {
|
|
|
1296
1297
|
y: p[1]
|
|
1297
1298
|
}, null, true, true);
|
|
1298
1299
|
} else {
|
|
1299
|
-
m_center = m_this.gcsToWorld({x: p[0], y: p[1]}, null
|
|
1300
|
+
m_center = m_this.gcsToWorld({x: p[0], y: p[1]}, null);
|
|
1300
1301
|
m_this.zoom(p[2], m_transition.zoomOrigin, true);
|
|
1301
1302
|
}
|
|
1302
1303
|
m_this.rotation(p[3], undefined, true);
|
|
@@ -1494,7 +1495,7 @@ var map = function (arg) {
|
|
|
1494
1495
|
* @param {number} rotation The requested rotation in clockwise radians.
|
|
1495
1496
|
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
|
|
1496
1497
|
* gcs, `null` to use the map gcs, or any other transform.
|
|
1497
|
-
* @param {boolean} ignoreDiscreteZoom If `true`, ignore the `discreteZoom`
|
|
1498
|
+
* @param {boolean} [ignoreDiscreteZoom] If `true`, ignore the `discreteZoom`
|
|
1498
1499
|
* option when determining the new view.
|
|
1499
1500
|
* @param {boolean} [ignoreClampBounds] If `true` and `clampBoundsX` or
|
|
1500
1501
|
* `clampBoundsY` is set, allow the bounds to be less clamped.
|
|
@@ -1728,11 +1729,11 @@ var map = function (arg) {
|
|
|
1728
1729
|
* @param {boolean|null} [opts.attribution=null] If `null` or unspecified,
|
|
1729
1730
|
* include the attribution only if all layers are used. If false, never
|
|
1730
1731
|
* include the attribution. If `true`, always include it.
|
|
1731
|
-
* @param {
|
|
1732
|
+
* @param {HTMLElement[]|string[]} [opts.html] A list of additional HTML
|
|
1732
1733
|
* elements, selectors, or jQuery elements to render on top of the map.
|
|
1733
1734
|
* These are rendered in order, with the last one topmost.
|
|
1734
|
-
* @returns {
|
|
1735
|
-
* either a data URL or an `HTMLCanvasElement` with the result.
|
|
1735
|
+
* @returns {jQueryDeferred} A jQuery Deferred object. The done function
|
|
1736
|
+
* receives either a data URL or an `HTMLCanvasElement` with the result.
|
|
1736
1737
|
* @fires geo.event.screenshot.ready
|
|
1737
1738
|
*/
|
|
1738
1739
|
this.screenshot = function (layers, type, encoderOptions, opts) {
|
|
@@ -1916,7 +1917,7 @@ var map = function (arg) {
|
|
|
1916
1917
|
/**
|
|
1917
1918
|
* Return the nearest valid zoom level to the requested zoom.
|
|
1918
1919
|
* @param {number} zoom A zoom level to adjust to current settings
|
|
1919
|
-
* @param {boolean} ignoreDiscreteZoom If `true`, ignore the `discreteZoom`
|
|
1920
|
+
* @param {boolean} [ignoreDiscreteZoom] If `true`, ignore the `discreteZoom`
|
|
1920
1921
|
* option when determining the new view.
|
|
1921
1922
|
* @returns {number} The zoom level clamped to the allowed zoom range and
|
|
1922
1923
|
* with other settings applied.
|
|
@@ -1960,10 +1961,11 @@ var map = function (arg) {
|
|
|
1960
1961
|
* Draw a layer image to a canvas context. The layer's opacity and transform
|
|
1961
1962
|
* are applied. This is used as part of making a screenshot.
|
|
1962
1963
|
*
|
|
1963
|
-
* @param {
|
|
1964
|
+
* @param {CanvasRenderingContext2D} context The 2d canvas context to draw
|
|
1965
|
+
* into.
|
|
1964
1966
|
* @param {number} opacity The opacity in the range [0, 1].
|
|
1965
1967
|
* @param {object} elem A jQuery element that might have a transform.
|
|
1966
|
-
* @param {
|
|
1968
|
+
* @param {HTMLImageElement} img The image or canvas to draw to the canvas.
|
|
1967
1969
|
* @param {string} [mixBlendMode] the mix-blend-mode used to add this layer.
|
|
1968
1970
|
* @private
|
|
1969
1971
|
*/
|
|
@@ -2155,12 +2157,12 @@ var map = function (arg) {
|
|
|
2155
2157
|
* Return a valid rotation angle.
|
|
2156
2158
|
*
|
|
2157
2159
|
* @param {number} rotation Proposed rotation.
|
|
2158
|
-
* @param {boolean} ignoreRotationFunc If truthy and rotations are allowed,
|
|
2160
|
+
* @param {boolean} [ignoreRotationFunc] If truthy and rotations are allowed,
|
|
2159
2161
|
* allow any rotation. Otherwise, the rotation is passed through the
|
|
2160
2162
|
* `allowRotation` function.
|
|
2161
|
-
* @param {boolean} noRangeLimit If falsy, ensure that the rotation is in
|
|
2162
|
-
* range [0, 2*PI). If it is very close to zero, it is snapped to
|
|
2163
|
-
* If true, the rotation can have any value.
|
|
2163
|
+
* @param {boolean} [noRangeLimit] If falsy, ensure that the rotation is in
|
|
2164
|
+
* the range [0, 2*PI). If it is very close to zero, it is snapped to
|
|
2165
|
+
* zero. If true, the rotation can have any value.
|
|
2164
2166
|
* @returns {number} the validated rotation
|
|
2165
2167
|
* @private
|
|
2166
2168
|
*/
|
package/src/mapInteractor.js
CHANGED
|
@@ -2037,26 +2037,26 @@ var mapInteractor = function (args) {
|
|
|
2037
2037
|
* map in pixels relative to the map's div.
|
|
2038
2038
|
* @param {geo.screenPosition} [options.center] The position of a touch
|
|
2039
2039
|
* event center relative to the window.
|
|
2040
|
-
* @param {string} [button] One of `left`, `middle`, or `right` for
|
|
2041
|
-
* events.
|
|
2042
|
-
* @param {string} [modifiers] A space-separated list of metakeys
|
|
2043
|
-
* down on mouse events.
|
|
2044
|
-
* @param {geo.screenPosition} [wheelDelta] The amount the wheel
|
|
2045
|
-
* both directions for wheel events. One step is often 20 units
|
|
2046
|
-
*
|
|
2047
|
-
* @param {number} [wheelMode] The wheel delta mode. See
|
|
2040
|
+
* @param {string} [options.button] One of `left`, `middle`, or `right` for
|
|
2041
|
+
* mouse events.
|
|
2042
|
+
* @param {string} [options.modifiers] A space-separated list of metakeys
|
|
2043
|
+
* that are down on mouse events.
|
|
2044
|
+
* @param {geo.screenPosition} [options.wheelDelta] The amount the wheel
|
|
2045
|
+
* moved in both directions for wheel events. One step is often 20 units
|
|
2046
|
+
* of movement.
|
|
2047
|
+
* @param {number} [options.wheelMode] The wheel delta mode. See
|
|
2048
2048
|
* https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent .
|
|
2049
|
-
* @param {boolean} [touch] `truthy` if this is a touch event.
|
|
2050
|
-
* @param {number} [rotation] Touch event rotation in degrees.
|
|
2051
|
-
* @param {number} [scale] Touch event scale. Initial events should
|
|
2052
|
-
* scale of 1; subsequent events should increase or decrease this
|
|
2053
|
-
* simulate spread and pinch actions.
|
|
2054
|
-
* @param {number[]} [pointers] A list of pointer numbers involved in
|
|
2055
|
-
* touch event. Pointers are number from one up, so `[1]` is the first
|
|
2049
|
+
* @param {boolean} [options.touch] `truthy` if this is a touch event.
|
|
2050
|
+
* @param {number} [options.rotation] Touch event rotation in degrees.
|
|
2051
|
+
* @param {number} [options.scale] Touch event scale. Initial events should
|
|
2052
|
+
* have a scale of 1; subsequent events should increase or decrease this
|
|
2053
|
+
* to simulate spread and pinch actions.
|
|
2054
|
+
* @param {number[]} [options.pointers] A list of pointer numbers involved in
|
|
2055
|
+
* a touch event. Pointers are number from one up, so `[1]` is the first
|
|
2056
2056
|
* touch point, `[1, 2]` are two touch points, and `[2]` is when the first
|
|
2057
2057
|
* point was released but the second is still touching.
|
|
2058
|
-
* @param {string} [pointerType] `mouse` if this is a mouse action
|
|
2059
|
-
* than a touch action.
|
|
2058
|
+
* @param {string} [options.pointerType] `mouse` if this is a mouse action
|
|
2059
|
+
* rather than a touch action.
|
|
2060
2060
|
* @returns {mapInteractor}
|
|
2061
2061
|
*/
|
|
2062
2062
|
this.simulateEvent = function (type, options) {
|
package/src/markerFeature.js
CHANGED
|
@@ -442,7 +442,7 @@ markerFeature.primitiveShapes = pointFeature.primitiveShapes;
|
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
444
|
* Marker symbols
|
|
445
|
-
* @enum
|
|
445
|
+
* @enum {number}
|
|
446
446
|
*/
|
|
447
447
|
markerFeature.symbols = {
|
|
448
448
|
// for circle (alias ellipse), the symbolValue is the ratio of the minor to
|
|
@@ -499,7 +499,7 @@ markerFeature.symbols = {
|
|
|
499
499
|
|
|
500
500
|
/**
|
|
501
501
|
* Marker scale modes
|
|
502
|
-
* @enum
|
|
502
|
+
* @enum {number}
|
|
503
503
|
*/
|
|
504
504
|
markerFeature.scaleMode = {
|
|
505
505
|
none: 0,
|
package/src/meshFeature.js
CHANGED
|
@@ -21,7 +21,7 @@ var feature = require('./feature');
|
|
|
21
21
|
* of these properties can be functions, which get passed `data`.
|
|
22
22
|
*
|
|
23
23
|
* @typedef {object} geo.meshFeature.meshSpec
|
|
24
|
-
* @property {number[]|
|
|
24
|
+
* @property {number[]|Array.<number[]>} [elements] If specified, a list of
|
|
25
25
|
* indices into the data array that form elements. If this is an array of
|
|
26
26
|
* arrays, each subarray must have at least either 3 values for triangular
|
|
27
27
|
* elements or 4 values for square elements. If this is a single array,
|
package/src/osmLayer.js
CHANGED
|
@@ -13,6 +13,8 @@ var quadFeature = require('./quadFeature');
|
|
|
13
13
|
* specified, use this as the layer opacity.
|
|
14
14
|
* @property {string} [source] If specified, use the predefined tile source
|
|
15
15
|
* (see {@link geo.osmLayer.tileSources}).
|
|
16
|
+
* @property {string} [crossDomain='anonymous'] Image CORS attribute. This is
|
|
17
|
+
* used for the `crossorigin` property when loading images.
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -44,6 +46,8 @@ var osmLayer = function (arg) {
|
|
|
44
46
|
this.constructor.defaults,
|
|
45
47
|
osmLayer.tileSources[this.constructor.defaults.source] || {},
|
|
46
48
|
osmLayer.tileSources[arg.source] || {},
|
|
49
|
+
// don't name the layer based on the source
|
|
50
|
+
{name: ''},
|
|
47
51
|
arg);
|
|
48
52
|
tileLayer.call(this, arg);
|
|
49
53
|
|
package/src/pointFeature.js
CHANGED
package/src/registry.js
CHANGED
|
@@ -60,7 +60,7 @@ util.registerRenderer = function (name, func) {
|
|
|
60
60
|
* @param {geo.layer} layer The layer associated with the renderer.
|
|
61
61
|
* @param {HTMLCanvasElement} [canvas] A canvas object to share between
|
|
62
62
|
* renderers.
|
|
63
|
-
* @param {object} options Options for the new renderer.
|
|
63
|
+
* @param {object} [options] Options for the new renderer.
|
|
64
64
|
* @returns {geo.renderer|null} The new renderer or null if no such name is
|
|
65
65
|
* registered.
|
|
66
66
|
*/
|
|
@@ -83,7 +83,7 @@ util.createRenderer = function (name, layer, canvas, options) {
|
|
|
83
83
|
*
|
|
84
84
|
* @alias geo.checkRenderer
|
|
85
85
|
* @param {string|null} name Name of the desired renderer.
|
|
86
|
-
* @param {boolean} noFallback If truthy, don't recommend a fallback.
|
|
86
|
+
* @param {boolean} [noFallback] If truthy, don't recommend a fallback.
|
|
87
87
|
* @returns {string|null|false} The name of the renderer that should be used
|
|
88
88
|
* or false if no valid renderer can be determined.
|
|
89
89
|
*/
|
package/src/svg/svgRenderer.js
CHANGED
|
@@ -484,10 +484,10 @@ var svgRenderer = function (arg) {
|
|
|
484
484
|
* Create a new feature element from an object that describes the feature
|
|
485
485
|
* attributes. To be called from feature classes only.
|
|
486
486
|
*
|
|
487
|
-
* @param {object} arg
|
|
487
|
+
* @param {object} arg
|
|
488
488
|
* @param {string} arg.id A unique string identifying the feature.
|
|
489
489
|
* @param {array} arg.data Array of data objects used in a d3 data method.
|
|
490
|
-
* @param {function} [
|
|
490
|
+
* @param {function} [arg.dataIndex] A function that returns a unique id for
|
|
491
491
|
* each data element. This is passed to the data access function.
|
|
492
492
|
* @param {object} arg.style An object with style values or functions.
|
|
493
493
|
* @param {object} arg.attributes An object containing element attributes.
|
|
@@ -500,7 +500,7 @@ var svgRenderer = function (arg) {
|
|
|
500
500
|
* attributes and styles set when new. If falsy, features always have
|
|
501
501
|
* attributes and styles updated.
|
|
502
502
|
* @param {boolean} [arg.sortByZ] If truthy, sort features by the `d.zIndex`.
|
|
503
|
-
* @param {string} [parentId] If set, the group ID of the parent element.
|
|
503
|
+
* @param {string} [arg.parentId] If set, the group ID of the parent element.
|
|
504
504
|
* @returns {this}
|
|
505
505
|
*/
|
|
506
506
|
this._drawFeatures = function (arg) {
|
package/src/tile.js
CHANGED
|
@@ -144,7 +144,7 @@ var tile = function (spec) {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* Return a unique string representation of the given tile
|
|
147
|
+
* Return a unique string representation of the given tile usable as a hash
|
|
148
148
|
* key. Possibly extend later to include url information to make caches
|
|
149
149
|
* aware of the tile source.
|
|
150
150
|
*
|
package/src/tileCache.js
CHANGED
|
@@ -55,7 +55,7 @@ var tileCache = function (options) {
|
|
|
55
55
|
* Remove a tile from the cache.
|
|
56
56
|
*
|
|
57
57
|
* @param {string|geo.tile} tile The tile or its hash.
|
|
58
|
-
* @returns {
|
|
58
|
+
* @returns {boolean} `true` if a tile was removed.
|
|
59
59
|
*/
|
|
60
60
|
this.remove = function (tile) {
|
|
61
61
|
var hash = typeof tile === 'string' ? tile : tile.toString();
|