geojs 1.10.1 → 1.10.2
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/geo.js +101 -9
- package/geo.lean.js +101 -9
- package/geo.lean.min.js +2 -2
- package/geo.min.js +2 -2
- package/package.json +3 -3
- package/src/canvas/quadFeature.js +9 -0
- package/src/canvas/tileLayer.js +1 -0
- package/src/map.js +3 -0
- package/src/pixelmapLayer.js +1 -0
- package/src/quadFeature.js +24 -0
- package/src/tileLayer.js +30 -0
- package/src/webgl/pixelmapFeature.js +3 -6
- package/src/webgl/quadFeature.js +13 -0
- package/src/webgl/tileLayer.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geojs",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "JavaScript Geo Visualization and Analysis Library",
|
|
5
5
|
"homepage": "https://github.com/OpenGeoscience/geojs",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"optionalDependencies": {
|
|
29
29
|
"d3": "^3.5.17",
|
|
30
|
+
"glslang-validator-prebuilt-predownloaded": "^0.0.2",
|
|
30
31
|
"hammerjs": "^2.0.8",
|
|
31
32
|
"vtk.js": "*"
|
|
32
33
|
},
|
|
@@ -53,7 +54,6 @@
|
|
|
53
54
|
"express": "^4.17.2",
|
|
54
55
|
"fs-extra": "^10.0.0",
|
|
55
56
|
"glob": "^8.0.1",
|
|
56
|
-
"glslang-validator-prebuilt": "^0.0.7",
|
|
57
57
|
"imports-loader": "^4.0.0",
|
|
58
58
|
"jaguarjs-jsdoc": "^1.0.2",
|
|
59
59
|
"jasmine-core": "^4.0.0",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"build-website-tutorials": "node tutorials/build-website.js && webpack --config webpack-website-tutorials.config.js",
|
|
136
136
|
"lint": "eslint --cache . --max-warnings=0",
|
|
137
137
|
"puglint": "pug-lint src examples",
|
|
138
|
-
"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 {} \\+",
|
|
138
|
+
"glsllint": "chmod +x node_modules/glslang-validator-prebuilt-predownloaded/bin/glslangValidator.linux; find . \\( -name '*.frag' \\) -exec sh -c 'for n; do python scripts/preprocess_glsl.py \"$n\" | node_modules/glslang-validator-prebuilt-predownloaded/bin/glslangValidator.linux --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-predownloaded/bin/glslangValidator.linux --stdin -S vert || exit 1; done' sh {} \\+",
|
|
139
139
|
"test-headless": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
|
|
140
140
|
"test-headless-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
|
|
141
141
|
"test-headed": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeFull",
|
|
@@ -138,6 +138,14 @@ var canvas_quadFeature = function (arg) {
|
|
|
138
138
|
|
|
139
139
|
var oldAlpha = context2d.globalAlpha;
|
|
140
140
|
var opacity = oldAlpha;
|
|
141
|
+
var nearestPixel = m_this.nearestPixel();
|
|
142
|
+
if (nearestPixel !== undefined) {
|
|
143
|
+
if (nearestPixel !== true && util.isNonNullFinite(nearestPixel)) {
|
|
144
|
+
const curZoom = m_this.layer().map().zoom();
|
|
145
|
+
nearestPixel = curZoom >= nearestPixel;
|
|
146
|
+
}
|
|
147
|
+
context2d.imageSmoothingEnabled = !nearestPixel;
|
|
148
|
+
}
|
|
141
149
|
$.each([m_quads.imgQuads, m_quads.vidQuads], function (listidx, quadlist) {
|
|
142
150
|
if (!quadlist) {
|
|
143
151
|
return;
|
|
@@ -193,6 +201,7 @@ var canvas_quadFeature = function (arg) {
|
|
|
193
201
|
context2d.globalAlpha = oldAlpha;
|
|
194
202
|
}
|
|
195
203
|
context2d.setTransform(1, 0, 0, 1, 0, 0);
|
|
204
|
+
context2d.imageSmoothingEnabled = true;
|
|
196
205
|
};
|
|
197
206
|
|
|
198
207
|
/**
|
package/src/canvas/tileLayer.js
CHANGED
package/src/map.js
CHANGED
|
@@ -1964,6 +1964,9 @@ var map = function (arg) {
|
|
|
1964
1964
|
return m_this;
|
|
1965
1965
|
};
|
|
1966
1966
|
|
|
1967
|
+
/* Report the current version on the map object. */
|
|
1968
|
+
this._version = require('./version');
|
|
1969
|
+
|
|
1967
1970
|
/**
|
|
1968
1971
|
* Draw a layer image to a canvas context. The layer's opacity and transform
|
|
1969
1972
|
* are applied. This is used as part of making a screenshot.
|
package/src/pixelmapLayer.js
CHANGED
package/src/quadFeature.js
CHANGED
|
@@ -47,6 +47,10 @@ var feature = require('./feature');
|
|
|
47
47
|
* call `cacheUpdate` on the data item or for all data.
|
|
48
48
|
* @property {geo.quadFeature.styleSpec} [style] Style object with default
|
|
49
49
|
* style options.
|
|
50
|
+
* @property {boolean|number} [nearestPixel] If true, image quads are
|
|
51
|
+
* rendered with near-neighbor sampling. If false, with interpolated
|
|
52
|
+
* sampling. If a number, interpolate at that zoom level or below and
|
|
53
|
+
* nearest neighbor at that zoom level or above.
|
|
50
54
|
*/
|
|
51
55
|
|
|
52
56
|
/**
|
|
@@ -106,6 +110,7 @@ var quadFeature = function (arg) {
|
|
|
106
110
|
var m_this = this,
|
|
107
111
|
s_init = this._init,
|
|
108
112
|
m_cacheQuads,
|
|
113
|
+
m_nearestPixel = arg.nearestPixel,
|
|
109
114
|
m_nextQuadId = 0,
|
|
110
115
|
m_images = [],
|
|
111
116
|
m_videos = [],
|
|
@@ -677,6 +682,25 @@ var quadFeature = function (arg) {
|
|
|
677
682
|
return null;
|
|
678
683
|
};
|
|
679
684
|
|
|
685
|
+
/**
|
|
686
|
+
* Get/Set nearestPixel value.
|
|
687
|
+
*
|
|
688
|
+
* @param {boolean|number} [val] If not specified, return the current value.
|
|
689
|
+
* If true, image quads are rendered with near-neighbor sampling. If
|
|
690
|
+
* false, with interpolated sampling. If a number, interpolate at that
|
|
691
|
+
* zoom level or below and nearest neighbor at that zoom level or above.
|
|
692
|
+
* @returns {boolean|number|this}
|
|
693
|
+
*/
|
|
694
|
+
this.nearestPixel = function (val) {
|
|
695
|
+
if (val === undefined) {
|
|
696
|
+
return m_nearestPixel;
|
|
697
|
+
} else {
|
|
698
|
+
m_nearestPixel = val;
|
|
699
|
+
m_this.modified();
|
|
700
|
+
}
|
|
701
|
+
return m_this;
|
|
702
|
+
};
|
|
703
|
+
|
|
680
704
|
/**
|
|
681
705
|
* Initialize.
|
|
682
706
|
*
|
package/src/tileLayer.js
CHANGED
|
@@ -81,6 +81,10 @@ var featureLayer = require('./featureLayer');
|
|
|
81
81
|
* any tile layers. If specified, this uses the quad defaults, so this is a
|
|
82
82
|
* ``geo.quadFeature.position`` object with, typically, an ``image`` property
|
|
83
83
|
* added to it. The quad positions are in the map gcs coordinates.
|
|
84
|
+
* @property {boolean|number} [nearestPixel] If true, image quads are
|
|
85
|
+
* rendered with near-neighbor sampling. If false, with interpolated
|
|
86
|
+
* sampling. If a number, interpolate at that zoom level or below and
|
|
87
|
+
* nearest neighbor at that zoom level or above.
|
|
84
88
|
*/
|
|
85
89
|
|
|
86
90
|
/**
|
|
@@ -228,6 +232,7 @@ var tileLayer = function (arg) {
|
|
|
228
232
|
m_reference,
|
|
229
233
|
m_exited,
|
|
230
234
|
m_lastBaseQuad,
|
|
235
|
+
m_nearestPixel = arg.nearestPixel,
|
|
231
236
|
m_this = this;
|
|
232
237
|
|
|
233
238
|
// copy the options into a private variable
|
|
@@ -1682,6 +1687,31 @@ var tileLayer = function (arg) {
|
|
|
1682
1687
|
return m_this;
|
|
1683
1688
|
};
|
|
1684
1689
|
|
|
1690
|
+
/**
|
|
1691
|
+
* Get/Set nearestPixel value.
|
|
1692
|
+
*
|
|
1693
|
+
* @param {boolean|number} [val] If not specified, return the current value.
|
|
1694
|
+
* If true, image quads are rendered with near-neighbor sampling. If
|
|
1695
|
+
* false, with interpolated sampling. If a number, interpolate at that
|
|
1696
|
+
* zoom level or below and nearest neighbor at that zoom level or above.
|
|
1697
|
+
* @param {boolean} [skipUpdate] If specifying val and this value is truthy,
|
|
1698
|
+
* don't update the layer or mark it as modified.
|
|
1699
|
+
* @returns {boolean|number|this}
|
|
1700
|
+
*/
|
|
1701
|
+
this.nearestPixel = function (val, skipUpdate) {
|
|
1702
|
+
if (val === undefined) {
|
|
1703
|
+
return m_nearestPixel;
|
|
1704
|
+
}
|
|
1705
|
+
if (m_nearestPixel !== val) {
|
|
1706
|
+
m_nearestPixel = val;
|
|
1707
|
+
if (!skipUpdate) {
|
|
1708
|
+
m_this.modified();
|
|
1709
|
+
m_this._update();
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
return m_this;
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1685
1715
|
/**
|
|
1686
1716
|
* Get/set the baseQuad.
|
|
1687
1717
|
*
|
|
@@ -134,7 +134,8 @@ var webgl_pixelmapFeature = function (arg) {
|
|
|
134
134
|
m_quadFeature = m_this.layer().createFeature('quad', {
|
|
135
135
|
selectionAPI: false,
|
|
136
136
|
gcs: m_this.gcs(),
|
|
137
|
-
visible: m_this.visible(undefined, true)
|
|
137
|
+
visible: m_this.visible(undefined, true),
|
|
138
|
+
nearestPixel: true
|
|
138
139
|
});
|
|
139
140
|
m_quadFeatureInit = false;
|
|
140
141
|
}
|
|
@@ -153,11 +154,6 @@ var webgl_pixelmapFeature = function (arg) {
|
|
|
153
154
|
prog.addUniform(lutHeight);
|
|
154
155
|
};
|
|
155
156
|
m_quadFeature._hookRenderImageQuads = (renderState, quads) => {
|
|
156
|
-
quads.forEach((quad) => {
|
|
157
|
-
if (quad.image && quad.texture && !quad.texture.nearestPixel()) {
|
|
158
|
-
quad.texture.setNearestPixel(true);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
157
|
m_lookupTable.bind(renderState, quads);
|
|
162
158
|
};
|
|
163
159
|
if (m_quadFeatureInit === false) {
|
|
@@ -188,6 +184,7 @@ var webgl_pixelmapFeature = function (arg) {
|
|
|
188
184
|
|
|
189
185
|
if (arg.quadFeature) {
|
|
190
186
|
m_quadFeature = arg.quadFeature;
|
|
187
|
+
m_quadFeature.nearestPixel(true);
|
|
191
188
|
}
|
|
192
189
|
this._init(arg);
|
|
193
190
|
return this;
|
package/src/webgl/quadFeature.js
CHANGED
|
@@ -2,6 +2,7 @@ var inherit = require('../inherit');
|
|
|
2
2
|
var registerFeature = require('../registry').registerFeature;
|
|
3
3
|
var quadFeature = require('../quadFeature');
|
|
4
4
|
var timestamp = require('../timestamp');
|
|
5
|
+
var util = require('../util');
|
|
5
6
|
|
|
6
7
|
let _memoryCheckLargestTested = 4096 * 4096;
|
|
7
8
|
|
|
@@ -364,6 +365,18 @@ var webgl_quadFeature = function (arg) {
|
|
|
364
365
|
cropsrc = {x0: 0, y0: 0, x1: 1, y1: 1}, quadcropsrc,
|
|
365
366
|
w, h, quadw, quadh;
|
|
366
367
|
|
|
368
|
+
let nearestPixel = m_this.nearestPixel();
|
|
369
|
+
if (nearestPixel !== undefined) {
|
|
370
|
+
if (nearestPixel !== true && util.isNonNullFinite(nearestPixel)) {
|
|
371
|
+
const curZoom = m_this.layer().map().zoom();
|
|
372
|
+
nearestPixel = curZoom >= nearestPixel;
|
|
373
|
+
}
|
|
374
|
+
m_quads.imgQuads.forEach((quad) => {
|
|
375
|
+
if (quad.image && quad.texture && quad.texture.nearestPixel() !== nearestPixel) {
|
|
376
|
+
quad.texture.setNearestPixel(nearestPixel);
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}
|
|
367
380
|
if (m_this._hookRenderImageQuads) {
|
|
368
381
|
m_this._hookRenderImageQuads(renderState, m_quads.imgQuads);
|
|
369
382
|
}
|
package/src/webgl/tileLayer.js
CHANGED
|
@@ -171,6 +171,7 @@ var webgl_tileLayer = function () {
|
|
|
171
171
|
*/
|
|
172
172
|
this._update = function (request) {
|
|
173
173
|
s_update.call(m_this, request);
|
|
174
|
+
m_quadFeature.nearestPixel(m_this.nearestPixel());
|
|
174
175
|
m_this._addBaseQuadToTiles(m_quadFeature, m_tiles);
|
|
175
176
|
return m_this;
|
|
176
177
|
};
|