@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.
- package/.eslintrc.js +54 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +4 -0
- package/.vscode/settings.json +2 -0
- package/CHANGELOG.md +5 -1
- package/README.md +44 -0
- package/debug/app.js +26 -0
- package/debug/index.html +55 -0
- package/debug/libs/vue.global.js +16159 -0
- package/debug/my_icon.png +0 -0
- package/docs/Catolog.md +24 -0
- package/docs/Constant.md +92 -0
- package/docs/Event.md +90 -0
- package/docs/Util.md +345 -0
- package/package.json +2 -2
- package/src/constants/crs.js +42098 -42098
- package/src/constants/default_layers.js +102 -11
- package/src/constants/index.js +1 -0
- package/src/constants/layer_groups_multispectral.js +34 -0
- package/src/constants/layer_icons.js +1 -0
- package/src/gl-operations/constants.js +9 -9
- package/src/gl-operations/default_options.js +97 -97
- package/src/gl-operations/index.js +532 -520
- package/src/gl-operations/reglCommands/contours.js +27 -27
- package/src/gl-operations/reglCommands/default.js +45 -43
- package/src/gl-operations/reglCommands/hillshading.js +340 -332
- package/src/gl-operations/reglCommands/index.js +6 -6
- package/src/gl-operations/reglCommands/multiLayers.js +303 -301
- package/src/gl-operations/reglCommands/transitions.js +111 -109
- package/src/gl-operations/reglCommands/util.js +71 -71
- package/src/gl-operations/renderer.js +209 -192
- package/src/gl-operations/shaders/fragment/convertDem.js +25 -25
- package/src/gl-operations/shaders/fragment/convolutionSmooth.js +54 -54
- package/src/gl-operations/shaders/fragment/diffCalc.js +33 -33
- package/src/gl-operations/shaders/fragment/drawResult.js +46 -41
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvAmbientShadows.js +78 -78
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +59 -54
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalBaselayer.js +30 -30
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +60 -55
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvMergeAndScaleTiles.js +26 -26
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvNormals.js +25 -25
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvSmooth.js +53 -53
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvSoftShadows.js +80 -80
- package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +54 -49
- package/src/gl-operations/shaders/fragment/interpolateColor.js +65 -62
- package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +49 -46
- package/src/gl-operations/shaders/fragment/interpolateValue.js +136 -123
- package/src/gl-operations/shaders/fragment/multiAnalyze1Calc.js +35 -35
- package/src/gl-operations/shaders/fragment/multiAnalyze2Calc.js +45 -45
- package/src/gl-operations/shaders/fragment/multiAnalyze3Calc.js +53 -53
- package/src/gl-operations/shaders/fragment/multiAnalyze4Calc.js +61 -61
- package/src/gl-operations/shaders/fragment/multiAnalyze5Calc.js +69 -69
- package/src/gl-operations/shaders/fragment/multiAnalyze6Calc.js +77 -77
- package/src/gl-operations/shaders/fragment/single.js +93 -88
- package/src/gl-operations/shaders/transform.js +21 -21
- package/src/gl-operations/shaders/util/computeColor.glsl +85 -84
- package/src/gl-operations/shaders/util/getTexelValue.glsl +10 -10
- package/src/gl-operations/shaders/util/isCloseEnough.glsl +9 -9
- package/src/gl-operations/shaders/util/rgbaToFloat.glsl +17 -17
- package/src/gl-operations/shaders/vertex/double.js +16 -16
- package/src/gl-operations/shaders/vertex/multi3.js +19 -19
- package/src/gl-operations/shaders/vertex/multi4.js +22 -22
- package/src/gl-operations/shaders/vertex/multi5.js +25 -25
- package/src/gl-operations/shaders/vertex/multi6.js +28 -28
- package/src/gl-operations/shaders/vertex/single.js +13 -13
- package/src/gl-operations/shaders/vertex/singleNotTransformed.js +11 -11
- package/src/gl-operations/texture_manager.js +141 -141
- package/src/gl-operations/util.js +336 -336
- package/src/measure/index.js +14 -8
- package/src/transform.js +3 -0
- package/src/util.js +14 -6
- package/vite.config.js +58 -0
- package/dist/catchUtil.min.esm.js +0 -112833
- 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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
+
}
|