@mapcatch/util 2.0.3 → 2.0.5-a

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.
Files changed (74) hide show
  1. package/.eslintrc.js +54 -0
  2. package/.husky/pre-commit +1 -0
  3. package/.prettierrc +4 -0
  4. package/.vscode/settings.json +2 -0
  5. package/CHANGELOG.md +5 -1
  6. package/README.md +44 -0
  7. package/debug/app.js +26 -0
  8. package/debug/index.html +55 -0
  9. package/debug/libs/vue.global.js +16159 -0
  10. package/debug/my_icon.png +0 -0
  11. package/docs/Catolog.md +24 -0
  12. package/docs/Constant.md +92 -0
  13. package/docs/Event.md +90 -0
  14. package/docs/Util.md +345 -0
  15. package/package.json +2 -2
  16. package/src/constants/crs.js +42098 -42098
  17. package/src/constants/default_layers.js +102 -11
  18. package/src/constants/index.js +1 -0
  19. package/src/constants/layer_groups_multispectral.js +34 -0
  20. package/src/constants/layer_icons.js +1 -0
  21. package/src/gl-operations/constants.js +9 -9
  22. package/src/gl-operations/default_options.js +97 -97
  23. package/src/gl-operations/index.js +532 -520
  24. package/src/gl-operations/reglCommands/contours.js +27 -27
  25. package/src/gl-operations/reglCommands/default.js +45 -43
  26. package/src/gl-operations/reglCommands/hillshading.js +340 -332
  27. package/src/gl-operations/reglCommands/index.js +6 -6
  28. package/src/gl-operations/reglCommands/multiLayers.js +303 -301
  29. package/src/gl-operations/reglCommands/transitions.js +111 -109
  30. package/src/gl-operations/reglCommands/util.js +71 -71
  31. package/src/gl-operations/renderer.js +209 -192
  32. package/src/gl-operations/shaders/fragment/convertDem.js +25 -25
  33. package/src/gl-operations/shaders/fragment/convolutionSmooth.js +54 -54
  34. package/src/gl-operations/shaders/fragment/diffCalc.js +33 -33
  35. package/src/gl-operations/shaders/fragment/drawResult.js +46 -41
  36. package/src/gl-operations/shaders/fragment/hillshading/hsAdvAmbientShadows.js +78 -78
  37. package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +59 -54
  38. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalBaselayer.js +30 -30
  39. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +60 -55
  40. package/src/gl-operations/shaders/fragment/hillshading/hsAdvMergeAndScaleTiles.js +26 -26
  41. package/src/gl-operations/shaders/fragment/hillshading/hsAdvNormals.js +25 -25
  42. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSmooth.js +53 -53
  43. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSoftShadows.js +80 -80
  44. package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +54 -49
  45. package/src/gl-operations/shaders/fragment/interpolateColor.js +65 -62
  46. package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +49 -46
  47. package/src/gl-operations/shaders/fragment/interpolateValue.js +136 -123
  48. package/src/gl-operations/shaders/fragment/multiAnalyze1Calc.js +35 -35
  49. package/src/gl-operations/shaders/fragment/multiAnalyze2Calc.js +45 -45
  50. package/src/gl-operations/shaders/fragment/multiAnalyze3Calc.js +53 -53
  51. package/src/gl-operations/shaders/fragment/multiAnalyze4Calc.js +61 -61
  52. package/src/gl-operations/shaders/fragment/multiAnalyze5Calc.js +69 -69
  53. package/src/gl-operations/shaders/fragment/multiAnalyze6Calc.js +77 -77
  54. package/src/gl-operations/shaders/fragment/single.js +93 -88
  55. package/src/gl-operations/shaders/transform.js +21 -21
  56. package/src/gl-operations/shaders/util/computeColor.glsl +85 -84
  57. package/src/gl-operations/shaders/util/getTexelValue.glsl +10 -10
  58. package/src/gl-operations/shaders/util/isCloseEnough.glsl +9 -9
  59. package/src/gl-operations/shaders/util/rgbaToFloat.glsl +17 -17
  60. package/src/gl-operations/shaders/vertex/double.js +16 -16
  61. package/src/gl-operations/shaders/vertex/multi3.js +19 -19
  62. package/src/gl-operations/shaders/vertex/multi4.js +22 -22
  63. package/src/gl-operations/shaders/vertex/multi5.js +25 -25
  64. package/src/gl-operations/shaders/vertex/multi6.js +28 -28
  65. package/src/gl-operations/shaders/vertex/single.js +13 -13
  66. package/src/gl-operations/shaders/vertex/singleNotTransformed.js +11 -11
  67. package/src/gl-operations/texture_manager.js +141 -141
  68. package/src/gl-operations/util.js +336 -336
  69. package/src/measure/index.js +14 -8
  70. package/src/transform.js +3 -0
  71. package/src/util.js +14 -6
  72. package/vite.config.js +58 -0
  73. package/dist/catchUtil.min.esm.js +0 -112833
  74. package/dist/catchUtil.min.js +0 -2922
@@ -1,109 +1,111 @@
1
- import vertSingle from '../shaders/vertex/single.js'
2
- import vertDouble from '../shaders/vertex/double.js'
3
-
4
- import fragInterpolateColor from '../shaders/fragment/interpolateColor.js'
5
- import fragInterpolateColorOnly from '../shaders/fragment/interpolateColorOnly.js'
6
- import fragInterpolateValue from '../shaders/fragment/interpolateValue.js'
7
-
8
- import * as util from '../util'
9
-
10
- /**
11
- * The DrawCommand output by this function interpolates, for each pixel, between two values, one
12
- * from `textureA` and one from `textureB`. The same color scale / sentinel values are applied to
13
- * both.
14
- */
15
- export function createDrawTileInterpolateValueCommand (
16
- regl,
17
- commonConfig,
18
- fragMacros
19
- ) {
20
- return regl({
21
- ...commonConfig,
22
- vert: vertDouble,
23
- frag: util.defineMacros(fragInterpolateValue, fragMacros),
24
- uniforms: {
25
- ...commonConfig.uniforms,
26
- scaleLength: regl.prop('scaleLength'),
27
- sentinelLength: regl.prop('sentinelLength'),
28
- scaleColormap: regl.prop('scaleColormap'),
29
- sentinelColormap: regl.prop('sentinelColormap'),
30
- textureA: (_, { textureA }) => textureA,
31
- textureB: (_, { textureB }) => textureB,
32
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
33
- },
34
- attributes: {
35
- ...commonConfig.attributes,
36
- texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
37
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
38
- }
39
- })
40
- }
41
-
42
- /**
43
- * The behavior of this DrawCommand is similar to the one above, except that pixels from `textureA`
44
- * are colorized with one color scale / set of sentinel values, while pixels from `textureB` use a
45
- * different color scale / set of sentinel values.
46
- */
47
- export function createDrawTileInterpolateColorCommand (
48
- regl,
49
- commonConfig,
50
- fragMacros
51
- ) {
52
- return regl({
53
- ...commonConfig,
54
- vert: vertDouble,
55
- frag: util.defineMacros(fragInterpolateColor, fragMacros),
56
- uniforms: {
57
- ...commonConfig.uniforms,
58
- scaleLengthA: regl.prop('scaleLengthA'),
59
- sentinelLengthA: regl.prop('sentinelLengthA'),
60
- scaleColormapA: regl.prop('scaleColormapA'),
61
- sentinelColormapA: regl.prop('sentinelColormapA'),
62
- scaleLengthB: regl.prop('scaleLengthB'),
63
- sentinelLengthB: regl.prop('sentinelLengthB'),
64
- scaleColormapB: regl.prop('scaleColormapB'),
65
- sentinelColormapB: regl.prop('sentinelColormapB'),
66
- textureA: (_, { textureA }) => textureA,
67
- textureB: (_, { textureB }) => textureB,
68
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
69
- },
70
- attributes: {
71
- ...commonConfig.attributes,
72
- texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
73
- texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
74
- }
75
- })
76
- }
77
-
78
- /**
79
- * The behavior of this DrawCommand is similar to the one above, except that the pixel values
80
- * are the same. Only the colorscale changes.
81
- */
82
- export function createDrawTileInterpolateColorOnlyCommand (
83
- regl,
84
- commonConfig,
85
- fragMacros
86
- ) {
87
- return regl({
88
- ...commonConfig,
89
- vert: vertSingle,
90
- frag: util.defineMacros(fragInterpolateColorOnly, fragMacros),
91
- uniforms: {
92
- ...commonConfig.uniforms,
93
- scaleLengthA: regl.prop('scaleLengthA'),
94
- sentinelLengthA: regl.prop('sentinelLengthA'),
95
- scaleColormapA: regl.prop('scaleColormapA'),
96
- sentinelColormapA: regl.prop('sentinelColormapA'),
97
- scaleLengthB: regl.prop('scaleLengthB'),
98
- sentinelLengthB: regl.prop('sentinelLengthB'),
99
- scaleColormapB: regl.prop('scaleColormapB'),
100
- sentinelColormapB: regl.prop('sentinelColormapB'),
101
- texture: (_, { texture }) => texture,
102
- interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
103
- },
104
- attributes: {
105
- ...commonConfig.attributes,
106
- texCoord: (_, { textureBounds }) => util.getTexCoordVerticesTriangleStripQuad(textureBounds)
107
- }
108
- })
109
- }
1
+ import vertSingle from '../shaders/vertex/single.js'
2
+ import vertDouble from '../shaders/vertex/double.js'
3
+
4
+ import fragInterpolateColor from '../shaders/fragment/interpolateColor.js'
5
+ import fragInterpolateColorOnly from '../shaders/fragment/interpolateColorOnly.js'
6
+ import fragInterpolateValue from '../shaders/fragment/interpolateValue.js'
7
+
8
+ import * as util from '../util'
9
+
10
+ /**
11
+ * The DrawCommand output by this function interpolates, for each pixel, between two values, one
12
+ * from `textureA` and one from `textureB`. The same color scale / sentinel values are applied to
13
+ * both.
14
+ */
15
+ export function createDrawTileInterpolateValueCommand (
16
+ regl,
17
+ commonConfig,
18
+ fragMacros
19
+ ) {
20
+ return regl({
21
+ ...commonConfig,
22
+ vert: vertDouble,
23
+ frag: util.defineMacros(fragInterpolateValue, fragMacros),
24
+ uniforms: {
25
+ ...commonConfig.uniforms,
26
+ scaleLength: regl.prop('scaleLength'),
27
+ sentinelLength: regl.prop('sentinelLength'),
28
+ scaleColormap: regl.prop('scaleColormap'),
29
+ sentinelColormap: regl.prop('sentinelColormap'),
30
+ aboveColor: regl.prop('aboveColor'),
31
+ belowColor: regl.prop('belowColor'),
32
+ textureA: (_, { textureA }) => textureA,
33
+ textureB: (_, { textureB }) => textureB,
34
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
35
+ },
36
+ attributes: {
37
+ ...commonConfig.attributes,
38
+ texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
39
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
40
+ }
41
+ })
42
+ }
43
+
44
+ /**
45
+ * The behavior of this DrawCommand is similar to the one above, except that pixels from `textureA`
46
+ * are colorized with one color scale / set of sentinel values, while pixels from `textureB` use a
47
+ * different color scale / set of sentinel values.
48
+ */
49
+ export function createDrawTileInterpolateColorCommand (
50
+ regl,
51
+ commonConfig,
52
+ fragMacros
53
+ ) {
54
+ return regl({
55
+ ...commonConfig,
56
+ vert: vertDouble,
57
+ frag: util.defineMacros(fragInterpolateColor, fragMacros),
58
+ uniforms: {
59
+ ...commonConfig.uniforms,
60
+ scaleLengthA: regl.prop('scaleLengthA'),
61
+ sentinelLengthA: regl.prop('sentinelLengthA'),
62
+ scaleColormapA: regl.prop('scaleColormapA'),
63
+ sentinelColormapA: regl.prop('sentinelColormapA'),
64
+ scaleLengthB: regl.prop('scaleLengthB'),
65
+ sentinelLengthB: regl.prop('sentinelLengthB'),
66
+ scaleColormapB: regl.prop('scaleColormapB'),
67
+ sentinelColormapB: regl.prop('sentinelColormapB'),
68
+ textureA: (_, { textureA }) => textureA,
69
+ textureB: (_, { textureB }) => textureB,
70
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
71
+ },
72
+ attributes: {
73
+ ...commonConfig.attributes,
74
+ texCoordA: (_, { textureBoundsA }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsA),
75
+ texCoordB: (_, { textureBoundsB }) => util.getTexCoordVerticesTriangleStripQuad(textureBoundsB)
76
+ }
77
+ })
78
+ }
79
+
80
+ /**
81
+ * The behavior of this DrawCommand is similar to the one above, except that the pixel values
82
+ * are the same. Only the colorscale changes.
83
+ */
84
+ export function createDrawTileInterpolateColorOnlyCommand (
85
+ regl,
86
+ commonConfig,
87
+ fragMacros
88
+ ) {
89
+ return regl({
90
+ ...commonConfig,
91
+ vert: vertSingle,
92
+ frag: util.defineMacros(fragInterpolateColorOnly, fragMacros),
93
+ uniforms: {
94
+ ...commonConfig.uniforms,
95
+ scaleLengthA: regl.prop('scaleLengthA'),
96
+ sentinelLengthA: regl.prop('sentinelLengthA'),
97
+ scaleColormapA: regl.prop('scaleColormapA'),
98
+ sentinelColormapA: regl.prop('sentinelColormapA'),
99
+ scaleLengthB: regl.prop('scaleLengthB'),
100
+ sentinelLengthB: regl.prop('sentinelLengthB'),
101
+ scaleColormapB: regl.prop('scaleColormapB'),
102
+ sentinelColormapB: regl.prop('sentinelColormapB'),
103
+ texture: (_, { texture }) => texture,
104
+ interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
105
+ },
106
+ attributes: {
107
+ ...commonConfig.attributes,
108
+ texCoord: (_, { textureBounds }) => util.getTexCoordVerticesTriangleStripQuad(textureBounds)
109
+ }
110
+ })
111
+ }
@@ -1,71 +1,71 @@
1
- import vertSingle from '../shaders/vertex/single.js'
2
-
3
- import fragConvertDem from '../shaders/fragment/convertDem.js'
4
-
5
- import * as util from '../util'
6
-
7
- const littleEndian = util.machineIsLittleEndian()
8
-
9
- /**
10
- * The object generated by this function should be merged into the DrawConfig for each Regl
11
- * command in the application.
12
- */
13
- export function getCommonDrawConfiguration (
14
- tileSize,
15
- nodataValue
16
- ) {
17
- return {
18
- uniforms: {
19
- nodataValue,
20
- littleEndian,
21
- transformMatrix: ({ viewportWidth, viewportHeight }) => (
22
- util.getTransformMatrix(viewportWidth, viewportHeight)
23
- )
24
- },
25
- attributes: {
26
- position: (_, { canvasCoordinates }) => {
27
- const [left, top] = canvasCoordinates
28
- const [right, bottom] = [left + tileSize, top + tileSize]
29
- return [
30
- [left, top ],
31
- [right, top ],
32
- [left, bottom],
33
- [right, bottom]
34
- ]
35
- }
36
- },
37
- // We don't need the depth buffer for 2D drawing. Leaving it enabled (and failing to clear it
38
- // between draw calls) results in visual artifacts.
39
- depth: { enable: false },
40
- primitive: 'triangle strip',
41
- count: 4,
42
- viewport: (_, { canvasSize: [width, height] }) => ({ width, height })
43
- }
44
- }
45
-
46
- /**
47
- * The command output by this function converts a tile in DEM format
48
- * to float32 packed as rgba.
49
- */
50
- export function createConvertDemCommand (
51
- regl,
52
- commonConfig
53
- ) {
54
- return regl({
55
- ...commonConfig,
56
- vert: vertSingle,
57
- frag: fragConvertDem,
58
- depth: {
59
- enable: false
60
- },
61
- uniforms: {
62
- ...commonConfig.uniforms,
63
- texture: (_, { texture }) => texture
64
- },
65
- attributes: {
66
- ...commonConfig.attributes,
67
- texCoord: [[0, 1], [1, 1], [0, 0], [1, 0]]
68
- },
69
- framebuffer: regl.prop('fbo')
70
- })
71
- }
1
+ import vertSingle from '../shaders/vertex/single.js'
2
+
3
+ import fragConvertDem from '../shaders/fragment/convertDem.js'
4
+
5
+ import * as util from '../util'
6
+
7
+ const littleEndian = util.machineIsLittleEndian()
8
+
9
+ /**
10
+ * The object generated by this function should be merged into the DrawConfig for each Regl
11
+ * command in the application.
12
+ */
13
+ export function getCommonDrawConfiguration (
14
+ tileSize,
15
+ nodataValue
16
+ ) {
17
+ return {
18
+ uniforms: {
19
+ nodataValue,
20
+ littleEndian,
21
+ transformMatrix: ({ viewportWidth, viewportHeight }) => (
22
+ util.getTransformMatrix(viewportWidth, viewportHeight)
23
+ )
24
+ },
25
+ attributes: {
26
+ position: (_, { canvasCoordinates }) => {
27
+ const [left, top] = canvasCoordinates
28
+ const [right, bottom] = [left + tileSize, top + tileSize]
29
+ return [
30
+ [left, top ],
31
+ [right, top ],
32
+ [left, bottom],
33
+ [right, bottom]
34
+ ]
35
+ }
36
+ },
37
+ // We don't need the depth buffer for 2D drawing. Leaving it enabled (and failing to clear it
38
+ // between draw calls) results in visual artifacts.
39
+ depth: { enable: false },
40
+ primitive: 'triangle strip',
41
+ count: 4,
42
+ viewport: (_, { canvasSize: [width, height] }) => ({ width, height })
43
+ }
44
+ }
45
+
46
+ /**
47
+ * The command output by this function converts a tile in DEM format
48
+ * to float32 packed as rgba.
49
+ */
50
+ export function createConvertDemCommand (
51
+ regl,
52
+ commonConfig
53
+ ) {
54
+ return regl({
55
+ ...commonConfig,
56
+ vert: vertSingle,
57
+ frag: fragConvertDem,
58
+ depth: {
59
+ enable: false
60
+ },
61
+ uniforms: {
62
+ ...commonConfig.uniforms,
63
+ texture: (_, { texture }) => texture
64
+ },
65
+ attributes: {
66
+ ...commonConfig.attributes,
67
+ texCoord: [[0, 1], [1, 1], [0, 0], [1, 0]]
68
+ },
69
+ framebuffer: regl.prop('fbo')
70
+ })
71
+ }