geojs 1.5.0 → 1.6.3
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 +26 -5
- package/geo.js +82956 -86701
- package/geo.lean.js +70006 -64329
- package/geo.lean.min.js +28 -41
- package/geo.min.js +30 -47
- package/package.json +63 -79
- package/src/annotationLayer.js +20 -16
- package/src/canvas/heatmapFeature.js +2 -2
- package/src/choroplethFeature.js +3 -3
- package/src/feature.js +4 -4
- package/src/geojsonReader.js +5 -4
- package/src/index.js +1 -1
- package/src/isolineFeature.js +4 -4
- package/src/lineFeature.js +4 -4
- package/src/map.js +2 -2
- package/src/mapInteractor.js +3 -0
- package/src/markerFeature.js +8 -8
- package/src/object.js +1 -3
- package/src/osmLayer.js +5 -3
- package/src/pixelmapFeature.js +1 -1
- package/src/pointFeature.js +1 -1
- package/src/polygonFeature.js +4 -4
- package/src/registry.js +1 -1
- package/src/svg/svgRenderer.js +3 -0
- package/src/svg/vectorFeature.js +1 -1
- package/src/tile.js +1 -1
- package/src/tileLayer.js +4 -4
- package/src/trackFeature.js +12 -12
- package/src/transform.js +11 -10
- package/src/ui/colorLegendWidget.js +6 -6
- package/src/ui/colorLegendWidget.styl +1 -1
- package/src/ui/legendWidget.js +3 -3
- package/src/ui/sliderWidget.js +4 -4
- package/src/util/common.js +9 -8
- package/src/util/mockVGL.js +2 -2
- package/src/util/throttle.js +3 -3
- package/src/vendor.js +0 -2
- package/src/vtkjs/pointFeature.js +1 -1
- package/src/vtkjs/vtkjsRenderer.js +3 -0
- package/src/webgl/layer.js +1 -1
- package/src/webgl/markerFeature.js +4 -4
- package/src/webgl/meshColored.js +3 -3
- package/src/webgl/pointFeature.js +11 -11
- package/src/webgl/polygonFeature.js +3 -3
- package/src/webgl/quadFeatureColor.vert +0 -1
- package/src/webgl/webglRenderer.js +1 -2
- package/src/polyfills.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geojs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "JavaScript Geo Visualization and Analysis Library",
|
|
5
5
|
"homepage": "https://github.com/OpenGeoscience/geojs",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -13,107 +13,92 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"color-name": "^1.1.4",
|
|
16
|
-
"earcut": "^2.2.
|
|
16
|
+
"earcut": "^2.2.3",
|
|
17
17
|
"gl-mat3": "^2.0.0",
|
|
18
18
|
"gl-mat4": "^1.2.0",
|
|
19
19
|
"gl-vec3": "^1.1.3",
|
|
20
20
|
"gl-vec4": "^1.0.1",
|
|
21
|
-
"jquery": "^3.
|
|
21
|
+
"jquery": "^3.6.0",
|
|
22
22
|
"kdbush": "^3.0.0",
|
|
23
23
|
"mousetrap": "^1.6.5",
|
|
24
|
-
"proj4": "2.
|
|
24
|
+
"proj4": "^2.7.5",
|
|
25
25
|
"vgl": "0.3.11"
|
|
26
26
|
},
|
|
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
|
-
"@
|
|
34
|
-
"babel-
|
|
35
|
-
"babel-
|
|
36
|
-
"
|
|
37
|
-
"babel-
|
|
38
|
-
"babel-
|
|
39
|
-
"babel-preset-env": "^1.7.0",
|
|
33
|
+
"@babel/core": "^7.16.5",
|
|
34
|
+
"@babel/plugin-proposal-class-properties": "^7.16.5",
|
|
35
|
+
"@babel/preset-env": "^7.16.5",
|
|
36
|
+
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
37
|
+
"babel-loader": "^8.2.3",
|
|
38
|
+
"babel-plugin-istanbul": "^6.1.1",
|
|
40
39
|
"bootstrap": "^3.4.1",
|
|
41
40
|
"bootswatch": "^3.4.1",
|
|
42
|
-
"codemirror": "^5.
|
|
43
|
-
"colorbrewer": "1.
|
|
44
|
-
"css-loader": "^
|
|
45
|
-
"docco": "^0.
|
|
46
|
-
"eslint": "^
|
|
47
|
-
"eslint-config-semistandard": "^
|
|
48
|
-
"eslint-config-standard": "^
|
|
49
|
-
"eslint-plugin-import": "^2.
|
|
50
|
-
"eslint-plugin-node": "^
|
|
51
|
-
"eslint-plugin-promise": "^
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"forever": "^0.15.2",
|
|
57
|
-
"fs-extra": "^7.0.0",
|
|
58
|
-
"glob": "^7.1.6",
|
|
41
|
+
"codemirror": "^5.65.0",
|
|
42
|
+
"colorbrewer": "^1.5.1",
|
|
43
|
+
"css-loader": "^6.5.1",
|
|
44
|
+
"docco": "^0.9.1",
|
|
45
|
+
"eslint": "^7.12.1",
|
|
46
|
+
"eslint-config-semistandard": "^16.0.0",
|
|
47
|
+
"eslint-config-standard": "^16.0.3",
|
|
48
|
+
"eslint-plugin-import": "^2.25.3",
|
|
49
|
+
"eslint-plugin-node": "^11.1.0",
|
|
50
|
+
"eslint-plugin-promise": "^5.0.0",
|
|
51
|
+
"expose-loader": "^3.1.0",
|
|
52
|
+
"express": "^4.17.2",
|
|
53
|
+
"fs-extra": "^10.0.0",
|
|
54
|
+
"glob": "^7.2.0",
|
|
59
55
|
"glslang-validator-prebuilt": "0.0.6",
|
|
60
|
-
"imports-loader": "^
|
|
56
|
+
"imports-loader": "^3.1.1",
|
|
61
57
|
"istanbul-combine": "^0.3.0",
|
|
62
|
-
"istanbul-instrumenter-loader": "^3.0.1",
|
|
63
58
|
"jaguarjs-jsdoc": "^1.0.2",
|
|
64
|
-
"jasmine-core": "^
|
|
65
|
-
"js-yaml": "^
|
|
66
|
-
"jsdoc": "^3.6.
|
|
59
|
+
"jasmine-core": "^4.0.0",
|
|
60
|
+
"js-yaml": "^4.1.0",
|
|
61
|
+
"jsdoc": "^3.6.7",
|
|
67
62
|
"jsdoc-autoprivate": "0.0.1",
|
|
68
|
-
"jsonlint-mod": "^1.7.
|
|
63
|
+
"jsonlint-mod": "^1.7.6",
|
|
69
64
|
"jstransformer-markdown-it": "^2.0.0",
|
|
70
|
-
"karma": "^3.
|
|
71
|
-
"karma-chrome-launcher": "^
|
|
72
|
-
"karma-coverage": "^
|
|
73
|
-
"karma-firefox-launcher": "^1.
|
|
74
|
-
"karma-jasmine": "^
|
|
75
|
-
"karma-jasmine-html-reporter": "^1.
|
|
76
|
-
"karma-
|
|
77
|
-
"karma-
|
|
78
|
-
"karma-
|
|
79
|
-
"karma-
|
|
80
|
-
"karma-spec-reporter": "^0.0.32",
|
|
81
|
-
"karma-webpack": "^3.0.5",
|
|
65
|
+
"karma": "^6.3.11",
|
|
66
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
67
|
+
"karma-coverage": "^2.1.0",
|
|
68
|
+
"karma-firefox-launcher": "^2.1.2",
|
|
69
|
+
"karma-jasmine": "^4.0.1",
|
|
70
|
+
"karma-jasmine-html-reporter": "^1.7.0",
|
|
71
|
+
"karma-sinon": "^1.0.5",
|
|
72
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
73
|
+
"karma-spec-reporter": "^0.0.33",
|
|
74
|
+
"karma-webpack": "^5.0.0",
|
|
82
75
|
"nib": "^1.1.2",
|
|
83
|
-
"pako": "^
|
|
84
|
-
"
|
|
85
|
-
"pug": "^
|
|
86
|
-
"pug-lint": "^2.4.0",
|
|
76
|
+
"pako": "^2.0.4",
|
|
77
|
+
"pug": "^3.0.2",
|
|
78
|
+
"pug-lint": "^2.6.0",
|
|
87
79
|
"pug-load": "^3.0.0",
|
|
88
|
-
"raw-body": "^2.
|
|
89
|
-
"resemblejs": "^
|
|
90
|
-
"semantic-release": "^
|
|
80
|
+
"raw-body": "^2.4.2",
|
|
81
|
+
"resemblejs": "^4.0.0",
|
|
82
|
+
"semantic-release": "^19.0.2",
|
|
91
83
|
"serve-index": "^1.9.1",
|
|
92
84
|
"shader-loader": "^1.3.1",
|
|
93
|
-
"sinon": "^
|
|
85
|
+
"sinon": "^12.0.1",
|
|
94
86
|
"string-replace-webpack-plugin": "^0.1.3",
|
|
95
|
-
"style-loader": "^
|
|
96
|
-
"stylus": "^0.
|
|
97
|
-
"stylus-loader": "^
|
|
87
|
+
"style-loader": "^3.3.1",
|
|
88
|
+
"stylus": "^0.56.0",
|
|
89
|
+
"stylus-loader": "^6.2.0",
|
|
90
|
+
"terser-webpack-plugin": "^5.3.0",
|
|
98
91
|
"touch-emulator": "^1.0.0",
|
|
99
|
-
"typeface-lato": "^
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"webpack": "^
|
|
103
|
-
"webpack-merge": "^4.2.2"
|
|
92
|
+
"typeface-lato": "^1.1.13",
|
|
93
|
+
"webpack": "^5.66.0",
|
|
94
|
+
"webpack-cli": "^4.9.1",
|
|
95
|
+
"webpack-merge": "^5.8.0"
|
|
104
96
|
},
|
|
105
97
|
"release": {
|
|
106
98
|
"plugins": [
|
|
107
99
|
"@semantic-release/commit-analyzer",
|
|
108
100
|
"@semantic-release/release-notes-generator",
|
|
109
101
|
"@semantic-release/npm",
|
|
110
|
-
[
|
|
111
|
-
"@semantic-release/changelog",
|
|
112
|
-
{
|
|
113
|
-
"changelogFile": "CHANGELOG.md",
|
|
114
|
-
"changelogTitle": "# GeoJS Change Log"
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
102
|
[
|
|
118
103
|
"@semantic-release/github",
|
|
119
104
|
{
|
|
@@ -148,31 +133,30 @@
|
|
|
148
133
|
"lint": "eslint --cache . --max-warnings=0",
|
|
149
134
|
"puglint": "pug-lint src examples",
|
|
150
135
|
"glsllint": "find . \\( -name '*.frag' \\) -exec sh -c 'for n; do python scripts/preprocess_glsl.py \"$n\" | node_modules/glslang-validator-prebuilt/bin/glslangValidator --stdin -S frag || exit 1; done' sh {} \\+ && find . \\( -name '*.vert' \\) -exec sh -c 'for n; do python scripts/preprocess_glsl.py \"$n\" | node_modules/glslang-validator-prebuilt/bin/glslangValidator --stdin -S vert || exit 1; done' sh {} \\+",
|
|
151
|
-
"test-headless": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch
|
|
152
|
-
"test-headless-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch
|
|
136
|
+
"test-headless": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
|
|
137
|
+
"test-headless-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
|
|
153
138
|
"test-headed": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeFull",
|
|
154
139
|
"tets-headed-all": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeFull,FirefoxWithProxy",
|
|
155
140
|
"test-headed-xvfb": "GEOJS_TEST_CASE=tests/test-headed.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers ChromeFull",
|
|
156
141
|
"test-webglheadless": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
|
|
157
142
|
"test-webglheadless-all": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
|
|
158
|
-
"test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch
|
|
159
|
-
"test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch
|
|
143
|
+
"test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
|
|
144
|
+
"test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
|
|
160
145
|
"get-data-files": "node scripts/datastore.js dist/data",
|
|
161
146
|
"ci-clean": "git clean -fxd dist -e dist/data jsdoc/tmpl jsdoc/static images lcov",
|
|
162
147
|
"ci": "npm run ci-build && npm run ci-test",
|
|
163
|
-
"ci-build": "(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)",
|
|
164
|
-
"ci-
|
|
148
|
+
"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)'",
|
|
149
|
+
"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\" ])'",
|
|
150
|
+
"ci-test": "npm run test-headless && npm run test-webglheadless && npm run test-headed && npm run test-tutorials && npm run combine-coverage",
|
|
165
151
|
"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",
|
|
166
152
|
"start": "karma start karma.conf.js",
|
|
167
153
|
"combine-coverage": "istanbul-combine -d dist/cobertura -r cobertura 'dist/coverage/json/**/coverage-final.json'",
|
|
168
154
|
"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",
|
|
169
|
-
"start-test": "node examples/build.js; forever start ./tests/runners/server.js",
|
|
170
|
-
"stop-test": "forever stop ./tests/runners/server.js",
|
|
171
155
|
"docs": "jsdoc --pedantic -d dist/apidocs -r src package.json -c jsdoc.conf.json",
|
|
172
156
|
"website": "cd website && npx hexo server",
|
|
173
157
|
"setup-website": "cd website && npm install",
|
|
174
158
|
"build-website": "npm run ci-build && npm run ci-build-website",
|
|
175
|
-
"ci-build-website": "cp -a dist/built/. website/source/built && (npm run build-website-examples & npm run build-website-tutorials & wait) && cd dist &&
|
|
159
|
+
"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",
|
|
176
160
|
"prepublishOnly": "webpack --config webpack.config.js && webpack --config webpack-lean.config.js && cp dist/built/*.js .",
|
|
177
161
|
"semantic-release": "semantic-release"
|
|
178
162
|
},
|
package/src/annotationLayer.js
CHANGED
|
@@ -91,19 +91,19 @@ var annotationLayer = function (arg) {
|
|
|
91
91
|
m_keyHandler;
|
|
92
92
|
|
|
93
93
|
var geojsonStyleProperties = {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
closed: {dataType: 'boolean', keys: ['closed', 'close']},
|
|
95
|
+
fill: {dataType: 'boolean', keys: ['fill']},
|
|
96
|
+
fillColor: {dataType: 'color', keys: ['fillColor', 'fill-color', 'marker-color', 'fill']},
|
|
97
|
+
fillOpacity: {dataType: 'opacity', keys: ['fillOpacity', 'fill-opacity']},
|
|
98
|
+
lineCap: {dataType: 'text', keys: ['lineCap', 'line-cap']},
|
|
99
|
+
lineJoin: {dataType: 'text', keys: ['lineJoin', 'line-join']},
|
|
100
|
+
radius: {dataType: 'positive', keys: ['radius']},
|
|
101
|
+
scaled: {dataType: 'booleanOrNumber', keys: ['scaled']},
|
|
102
|
+
stroke: {dataType: 'boolean', keys: ['stroke']},
|
|
103
|
+
strokeColor: {dataType: 'color', keys: ['strokeColor', 'stroke-color', 'stroke']},
|
|
104
|
+
strokeOffset: {dataType: 'number', keys: ['strokeOffset', 'stroke-offset']},
|
|
105
|
+
strokeOpacity: {dataType: 'opacity', keys: ['strokeOpacity', 'stroke-opacity']},
|
|
106
|
+
strokeWidth: {dataType: 'positive', keys: ['strokeWidth', 'stroke-width']}
|
|
107
107
|
};
|
|
108
108
|
var textFeatureDataTypes = {
|
|
109
109
|
offset: 'coordinate2',
|
|
@@ -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
|
});
|
|
@@ -84,7 +84,7 @@ var canvas_heatmapFeature = function (arg) {
|
|
|
84
84
|
gaussian = m_this.style('gaussian');
|
|
85
85
|
scale = m_this.style('scaleWithZoom');
|
|
86
86
|
if (scale) {
|
|
87
|
-
|
|
87
|
+
const zoom = this.layer().map().zoom();
|
|
88
88
|
scale = Math.pow(2, zoom);
|
|
89
89
|
r *= scale;
|
|
90
90
|
blur *= scale;
|
|
@@ -306,7 +306,7 @@ var canvas_heatmapFeature = function (arg) {
|
|
|
306
306
|
this._renderOnCanvas = function (context2d, map) {
|
|
307
307
|
|
|
308
308
|
if (m_renderTime.timestamp() < m_this.buildTime().timestamp()) {
|
|
309
|
-
|
|
309
|
+
const starttime = Date.now();
|
|
310
310
|
var data = m_this.data() || [],
|
|
311
311
|
radius = m_this.style('radius') + m_this.style('blurRadius'),
|
|
312
312
|
binned = m_this.binned(),
|
package/src/choroplethFeature.js
CHANGED
|
@@ -209,8 +209,8 @@ var choroplethFeature = function (arg) {
|
|
|
209
209
|
newFeature
|
|
210
210
|
.polygon(function (d) {
|
|
211
211
|
return {
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
outer: d.coordinates[0],
|
|
213
|
+
inner: d.coordinates[1] // undefined but ok
|
|
214
214
|
};
|
|
215
215
|
})
|
|
216
216
|
.position(function (d) {
|
|
@@ -220,7 +220,7 @@ var choroplethFeature = function (arg) {
|
|
|
220
220
|
};
|
|
221
221
|
})
|
|
222
222
|
.style({
|
|
223
|
-
|
|
223
|
+
fillColor: fillColor
|
|
224
224
|
});
|
|
225
225
|
|
|
226
226
|
return newFeature;
|
package/src/feature.js
CHANGED
|
@@ -423,10 +423,10 @@ var feature = function (arg) {
|
|
|
423
423
|
this._handleBrush = function (brush) {
|
|
424
424
|
let corners = [brush.gcs.lowerLeft, brush.gcs.lowerRight, brush.gcs.upperRight, brush.gcs.upperLeft];
|
|
425
425
|
if (m_this.layer()) {
|
|
426
|
-
|
|
426
|
+
const map = m_this.layer().map();
|
|
427
427
|
corners = transform.transformCoordinates(map.gcs(), map.ingcs(), corners);
|
|
428
428
|
}
|
|
429
|
-
|
|
429
|
+
const search = m_this.polygonSearch(corners);
|
|
430
430
|
|
|
431
431
|
feature.eventID += 1;
|
|
432
432
|
search.index.forEach(function (idx, i) {
|
|
@@ -451,10 +451,10 @@ var feature = function (arg) {
|
|
|
451
451
|
this._handleBrushend = function (brush) {
|
|
452
452
|
let corners = [brush.gcs.lowerLeft, brush.gcs.lowerRight, brush.gcs.upperRight, brush.gcs.upperLeft];
|
|
453
453
|
if (m_this.layer()) {
|
|
454
|
-
|
|
454
|
+
const map = m_this.layer().map();
|
|
455
455
|
corners = transform.transformCoordinates(map.gcs(), map.ingcs(), corners);
|
|
456
456
|
}
|
|
457
|
-
|
|
457
|
+
const search = m_this.polygonSearch(corners);
|
|
458
458
|
|
|
459
459
|
feature.eventID += 1;
|
|
460
460
|
search.index.forEach(function (idx, i) {
|
package/src/geojsonReader.js
CHANGED
|
@@ -324,7 +324,8 @@ var geojsonReader = function (arg) {
|
|
|
324
324
|
reject(new Error('Failed to parse GeoJSON'));
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
|
-
let features,
|
|
327
|
+
let features, feature;
|
|
328
|
+
const allFeatures = [];
|
|
328
329
|
|
|
329
330
|
try {
|
|
330
331
|
features = m_this._featureArray(object);
|
|
@@ -334,7 +335,7 @@ var geojsonReader = function (arg) {
|
|
|
334
335
|
}
|
|
335
336
|
|
|
336
337
|
// process points
|
|
337
|
-
points = features.filter(f => f.geometry.type === 'Point');
|
|
338
|
+
const points = features.filter(f => f.geometry.type === 'Point');
|
|
338
339
|
if (points.length) {
|
|
339
340
|
feature = m_this.layer().createFeature('point');
|
|
340
341
|
if (feature) {
|
|
@@ -358,7 +359,7 @@ var geojsonReader = function (arg) {
|
|
|
358
359
|
}
|
|
359
360
|
|
|
360
361
|
// process lines
|
|
361
|
-
lines = features.filter(f => f.geometry.type === 'LineString');
|
|
362
|
+
const lines = features.filter(f => f.geometry.type === 'LineString');
|
|
362
363
|
if (lines.length) {
|
|
363
364
|
feature = m_this.layer().createFeature('line');
|
|
364
365
|
if (feature) {
|
|
@@ -383,7 +384,7 @@ var geojsonReader = function (arg) {
|
|
|
383
384
|
}
|
|
384
385
|
|
|
385
386
|
// process polygons
|
|
386
|
-
polygons = features.filter(f => f.geometry.type === 'Polygon');
|
|
387
|
+
const polygons = features.filter(f => f.geometry.type === 'Polygon');
|
|
387
388
|
if (polygons.length) {
|
|
388
389
|
feature = m_this.layer().createFeature('polygon');
|
|
389
390
|
if (feature) {
|
package/src/index.js
CHANGED
package/src/isolineFeature.js
CHANGED
|
@@ -872,13 +872,13 @@ var isolineFeature = function (arg) {
|
|
|
872
872
|
*/
|
|
873
873
|
isolineFeature.rotationFunction = function (mode, map) {
|
|
874
874
|
var functionList = {
|
|
875
|
-
|
|
875
|
+
higher: function (d) {
|
|
876
876
|
return d.rotation;
|
|
877
877
|
},
|
|
878
|
-
|
|
878
|
+
lower: function (d) {
|
|
879
879
|
return d.rotation + Math.PI;
|
|
880
880
|
},
|
|
881
|
-
|
|
881
|
+
map: function (d) {
|
|
882
882
|
var r = d.rotation,
|
|
883
883
|
rt = util.wrapAngle(r, true);
|
|
884
884
|
if (rt > Math.PI / 2 || rt < -Math.PI / 2) {
|
|
@@ -886,7 +886,7 @@ isolineFeature.rotationFunction = function (mode, map) {
|
|
|
886
886
|
}
|
|
887
887
|
return r;
|
|
888
888
|
},
|
|
889
|
-
|
|
889
|
+
screen: function (d) {
|
|
890
890
|
var r = d.rotation,
|
|
891
891
|
rt = util.wrapAngle(r + map.rotation(), true);
|
|
892
892
|
if (rt > Math.PI / 2 || rt < -Math.PI / 2) {
|
package/src/lineFeature.js
CHANGED
|
@@ -313,8 +313,8 @@ var lineFeature = function (arg) {
|
|
|
313
313
|
if (p.y > max.y) { max.y = p.y; }
|
|
314
314
|
});
|
|
315
315
|
m_this._updatePointSearchInfo();
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
const scale = map.unitsPerPixel(map.zoom());
|
|
317
|
+
let i, j, record, u, v, r;
|
|
318
318
|
for (i = 0; i < m_pointSearchInfo.length; i += 1) {
|
|
319
319
|
record = m_pointSearchInfo[i];
|
|
320
320
|
if (!record.max ||
|
|
@@ -342,7 +342,7 @@ var lineFeature = function (arg) {
|
|
|
342
342
|
(strokeWidthFunc(line[record[j].i], record[j].i, data[i], i) <= 0 && strokeWidthFunc(line[record[j].j], record[j].j, data[i], i) <= 0)) {
|
|
343
343
|
continue;
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
const dist0 = util.distanceToPolygon2d(u, poly),
|
|
346
346
|
dist1 = util.distanceToPolygon2d(v, poly);
|
|
347
347
|
if ((dist0 > -r * scale && dist0 < r * scale) || (dist1 > -r * scale && dist1 < r & scale) || dist0 * dist1 < 0) {
|
|
348
348
|
partial = true;
|
|
@@ -354,7 +354,7 @@ var lineFeature = function (arg) {
|
|
|
354
354
|
}
|
|
355
355
|
// if a point of the polygon is near the line formed by u-v, this is
|
|
356
356
|
// also partial
|
|
357
|
-
|
|
357
|
+
const r2scaled = r * r * scale * scale;
|
|
358
358
|
for (let k = 0; k < poly.outer.length && !partial; k += 1) {
|
|
359
359
|
partial = util.distance2dToLineSquared(poly.outer[k], u, v) < r2scaled;
|
|
360
360
|
}
|
package/src/map.js
CHANGED
|
@@ -214,7 +214,7 @@ var map = function (arg) {
|
|
|
214
214
|
* existing requestAnimationFrame. By using a property of window,
|
|
215
215
|
* tests can override this if needed. */
|
|
216
216
|
if (queue.length && queue[0] !== m_animationQueue[0]) {
|
|
217
|
-
window['cancelAnimationFrame'](m_animationQueue[0]);
|
|
217
|
+
window['cancelAnimationFrame'](m_animationQueue[0]); // eslint-disable-line dot-notation
|
|
218
218
|
}
|
|
219
219
|
for (var i = queue.length ? 1 : 0; i < m_animationQueue.length; i += 1) {
|
|
220
220
|
queue.push(m_animationQueue[i]);
|
|
@@ -1897,7 +1897,7 @@ var map = function (arg) {
|
|
|
1897
1897
|
* explicitly using window.requestAnimationFrame, we prevent the
|
|
1898
1898
|
* stripping of 'window' off of the reference and allow our tests to
|
|
1899
1899
|
* override this if needed. */
|
|
1900
|
-
m_animationQueue.push(window['requestAnimationFrame'](processAnimationFrame));
|
|
1900
|
+
m_animationQueue.push(window['requestAnimationFrame'](processAnimationFrame)); // eslint-disable-line dot-notation
|
|
1901
1901
|
}
|
|
1902
1902
|
var pos = m_animationQueue.indexOf(callback, 1);
|
|
1903
1903
|
if (pos >= 0) {
|
package/src/mapInteractor.js
CHANGED
package/src/markerFeature.js
CHANGED
|
@@ -111,11 +111,11 @@ var markerFeature = function (arg) {
|
|
|
111
111
|
pts = m_this.data().map(function (d, i) {
|
|
112
112
|
var pt = position(d, i);
|
|
113
113
|
|
|
114
|
-
let
|
|
115
|
-
|
|
114
|
+
let swz = scaleWithZoom(d, i);
|
|
115
|
+
const r = radius(d, i),
|
|
116
116
|
s = strokeWidth(d, i),
|
|
117
117
|
so = Math.sign(strokeOffset(d, i));
|
|
118
|
-
|
|
118
|
+
const rwiths = r + s * (so + 1) / 2, // radius with stroke
|
|
119
119
|
rwos = r + s * (so - 1) / 2; // radius without stroke
|
|
120
120
|
swz = markerFeature.scaleMode[swz] || (swz >= 1 && swz <= 3 ? swz : 0);
|
|
121
121
|
switch (swz) {
|
|
@@ -155,7 +155,7 @@ var markerFeature = function (arg) {
|
|
|
155
155
|
*/
|
|
156
156
|
this._approximateMaxRadius = function (zoom) {
|
|
157
157
|
m_this._updateRangeTree();
|
|
158
|
-
|
|
158
|
+
const zoomFactor = Math.pow(2, zoom);
|
|
159
159
|
return Math.max(m_maxFixedRadius + m_maxZoomStroke * zoomFactor, m_maxZoomRadius * zoomFactor);
|
|
160
160
|
};
|
|
161
161
|
|
|
@@ -344,10 +344,10 @@ var markerFeature = function (arg) {
|
|
|
344
344
|
var d = data[i];
|
|
345
345
|
let p = m_this.position()(d, i);
|
|
346
346
|
let rad = radius(data[i], i),
|
|
347
|
-
swz = scaleWithZoom(data[i], i)
|
|
348
|
-
|
|
347
|
+
swz = scaleWithZoom(data[i], i);
|
|
348
|
+
const so = strokeOffset(data[i], i),
|
|
349
349
|
s = swz ? strokeWidth(data[i], i) : 0;
|
|
350
|
-
|
|
350
|
+
const rwos = rad + s * (so - 1) / 2; // radius without stroke
|
|
351
351
|
swz = markerFeature.scaleMode[swz] || (swz >= 1 && swz <= 3 ? swz : 0);
|
|
352
352
|
rad = rwos + s;
|
|
353
353
|
switch (swz) {
|
|
@@ -363,7 +363,7 @@ var markerFeature = function (arg) {
|
|
|
363
363
|
}
|
|
364
364
|
if (rad) {
|
|
365
365
|
p = map.gcsToDisplay(p, fgcs);
|
|
366
|
-
|
|
366
|
+
const dist = util.distanceToPolygon2d(p, poly);
|
|
367
367
|
if (dist >= rad || (dist >= 0 && opts.partial === 'center') || (dist >= -rad && opts.partial && opts.partial !== 'center')) {
|
|
368
368
|
found.push(d);
|
|
369
369
|
ifound.push(i);
|
package/src/object.js
CHANGED
|
@@ -166,9 +166,7 @@ var object = function () {
|
|
|
166
166
|
* the handler that was passed to the function.
|
|
167
167
|
*/
|
|
168
168
|
this.geoOnce = function (event, handler) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
wrapper = function (args) {
|
|
169
|
+
const wrapper = function (args) {
|
|
172
170
|
m_this.geoOff(event, wrapper);
|
|
173
171
|
handler.call(m_this, args);
|
|
174
172
|
};
|
package/src/osmLayer.js
CHANGED
|
@@ -44,6 +44,8 @@ var osmLayer = function (arg) {
|
|
|
44
44
|
this.constructor.defaults,
|
|
45
45
|
osmLayer.tileSources[this.constructor.defaults.source] || {},
|
|
46
46
|
osmLayer.tileSources[arg.source] || {},
|
|
47
|
+
// don't name the layer based on the source
|
|
48
|
+
{name: ''},
|
|
47
49
|
arg);
|
|
48
50
|
tileLayer.call(this, arg);
|
|
49
51
|
|
|
@@ -93,7 +95,7 @@ var osmLayer = function (arg) {
|
|
|
93
95
|
*/
|
|
94
96
|
this.source = function (source) {
|
|
95
97
|
if (source === undefined) {
|
|
96
|
-
for (
|
|
98
|
+
for (const key in osmLayer.tileSources) {
|
|
97
99
|
if (osmLayer.tileSources[key].url === m_this.url()) {
|
|
98
100
|
return key;
|
|
99
101
|
}
|
|
@@ -126,13 +128,13 @@ osmLayer.defaults = $.extend({}, tileLayer.defaults, {
|
|
|
126
128
|
/* Stamen's website (http://maps.stamen.com) as of 2019-08-28 says that the
|
|
127
129
|
* maps they host may be used free of charge. For http access, use a url like
|
|
128
130
|
* http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png */
|
|
129
|
-
|
|
131
|
+
const StamenAttribution = 'Map tiles by <a href="http://stamen.com">Stamen ' +
|
|
130
132
|
'Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">' +
|
|
131
133
|
'CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap' +
|
|
132
134
|
'</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.';
|
|
133
135
|
|
|
134
136
|
/* Per Carto's website regarding basemap attribution: https://carto.com/help/working-with-data/attribution/#basemaps */
|
|
135
|
-
|
|
137
|
+
const CartoAttribution = '<a href="https://carto.com"> Carto</a> ' + 'Contributors <a href="https://www.openstreetmap.org/"> OpenStreetMap</a>';
|
|
136
138
|
|
|
137
139
|
/**
|
|
138
140
|
* This is a list of known tile sources. It can be added to via
|
package/src/pixelmapFeature.js
CHANGED
|
@@ -47,7 +47,7 @@ var util = require('./util');
|
|
|
47
47
|
* @property {object[]} mappedColors This has one entry for each distinct index
|
|
48
48
|
* value. Each entry has `first` and `last` with the first and last pixel
|
|
49
49
|
* locations where that index occurs. Note that last is the inclusive value
|
|
50
|
-
* of the location (so its maximum possible value is `size -1`).
|
|
50
|
+
* of the location (so its maximum possible value is `size - 1`).
|
|
51
51
|
*/
|
|
52
52
|
|
|
53
53
|
/**
|
package/src/pointFeature.js
CHANGED
|
@@ -443,7 +443,7 @@ var pointFeature = function (arg) {
|
|
|
443
443
|
rad += hasstroke ? strokeWidth(data[i], i) : 0;
|
|
444
444
|
if (rad) {
|
|
445
445
|
p = map.gcsToDisplay(p, fgcs);
|
|
446
|
-
|
|
446
|
+
const dist = util.distanceToPolygon2d(p, poly);
|
|
447
447
|
if (dist >= rad || (dist >= 0 && opts.partial === 'center') || (dist >= -rad && opts.partial && opts.partial !== 'center')) {
|
|
448
448
|
found.push(d);
|
|
449
449
|
ifound.push(i);
|
package/src/polygonFeature.js
CHANGED
|
@@ -113,7 +113,7 @@ var polygonFeature = function (arg) {
|
|
|
113
113
|
* `outer` and `inner` if it has any coordinates, or is `undefined`.
|
|
114
114
|
*/
|
|
115
115
|
function getCoordinates(data, posFunc, polyFunc) {
|
|
116
|
-
|
|
116
|
+
const fcs = m_this.gcs(),
|
|
117
117
|
mapgcs = m_this.layer().map().gcs();
|
|
118
118
|
data = data || m_this.data();
|
|
119
119
|
posFunc = posFunc || m_this.style.get('position');
|
|
@@ -121,7 +121,7 @@ var polygonFeature = function (arg) {
|
|
|
121
121
|
var coordinates = data.map(function (d, i) {
|
|
122
122
|
var poly = polyFunc(d, i);
|
|
123
123
|
if (!poly) {
|
|
124
|
-
return;
|
|
124
|
+
return undefined;
|
|
125
125
|
}
|
|
126
126
|
var outer, inner, range, coord, j, x, y, mapouter, mapinner, maprange;
|
|
127
127
|
|
|
@@ -350,9 +350,9 @@ var polygonFeature = function (arg) {
|
|
|
350
350
|
let inside, partial;
|
|
351
351
|
// do something similar to the line's polygonSearch
|
|
352
352
|
for (let r = -1; r < coord.mapinner.length && !partial; r += 1) {
|
|
353
|
-
|
|
353
|
+
const record = r < 0 ? coord.mapouter : coord.mapinner[r];
|
|
354
354
|
for (let i = 0, len = record.length, j = len - 1; i < len; j = i, i += 1) {
|
|
355
|
-
|
|
355
|
+
const dist0 = util.distanceToPolygon2d(record[i], poly),
|
|
356
356
|
dist1 = util.distanceToPolygon2d(record[j], poly);
|
|
357
357
|
if (dist0 * dist1 < 0) {
|
|
358
358
|
partial = true;
|
package/src/registry.js
CHANGED
|
@@ -216,7 +216,7 @@ util.registerFeature = function (category, name, func, capabilities) {
|
|
|
216
216
|
*/
|
|
217
217
|
util.createFeature = function (name, layer, renderer, arg) {
|
|
218
218
|
var category = renderer.api(),
|
|
219
|
-
options = {
|
|
219
|
+
options = {layer: layer, renderer: renderer};
|
|
220
220
|
if (category in features && name in features[category]) {
|
|
221
221
|
if (arg !== undefined) {
|
|
222
222
|
$.extend(true, options, arg);
|