@mapcatch/util 2.0.3 → 2.0.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/CHANGELOG.md +5 -1
- package/dist/catchUtil.min.esm.js +4090 -3879
- package/dist/catchUtil.min.js +42 -36
- package/package.json +1 -21
- package/src/constants/default_layers.js +153 -10
- 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/index.js +14 -2
- package/src/gl-operations/reglCommands/default.js +2 -0
- package/src/gl-operations/reglCommands/hillshading.js +10 -2
- package/src/gl-operations/reglCommands/multiLayers.js +3 -1
- package/src/gl-operations/reglCommands/transitions.js +2 -0
- package/src/gl-operations/renderer.js +21 -4
- package/src/gl-operations/shaders/fragment/drawResult.js +6 -1
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +6 -1
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +6 -1
- package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +6 -1
- package/src/gl-operations/shaders/fragment/interpolateColor.js +7 -4
- package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +7 -4
- package/src/gl-operations/shaders/fragment/interpolateValue.js +18 -5
- package/src/gl-operations/shaders/fragment/single.js +6 -1
- package/src/gl-operations/shaders/util/computeColor.glsl +5 -4
- package/src/measure/index.js +14 -8
- package/src/transform.js +3 -0
|
@@ -32,6 +32,9 @@ uniform float deg2rad;
|
|
|
32
32
|
uniform float azimuth;
|
|
33
33
|
uniform float altitude;
|
|
34
34
|
|
|
35
|
+
uniform vec4 aboveColor;
|
|
36
|
+
uniform vec4 belowColor;
|
|
37
|
+
|
|
35
38
|
float getRelativeHeight(vec2 pos, float v, vec4 textureBounds) {
|
|
36
39
|
float pixelFloatValue = getTexelValue(texture, pos, littleEndian);
|
|
37
40
|
float test = step(0.0, pixelFloatValue);
|
|
@@ -76,7 +79,9 @@ void main() {
|
|
|
76
79
|
sentinelColormap,
|
|
77
80
|
scaleLength,
|
|
78
81
|
sentinelLength,
|
|
79
|
-
littleEndian
|
|
82
|
+
littleEndian,
|
|
83
|
+
aboveColor,
|
|
84
|
+
belowColor
|
|
80
85
|
);
|
|
81
86
|
|
|
82
87
|
if (enableSimpleHillshade) {
|
|
@@ -19,7 +19,9 @@ vec4 computeColor(
|
|
|
19
19
|
sampler2D sentinelColormap,
|
|
20
20
|
int scaleLength,
|
|
21
21
|
int sentinelLength,
|
|
22
|
-
bool littleEndian
|
|
22
|
+
bool littleEndian,
|
|
23
|
+
vec4 aboveColor,
|
|
24
|
+
vec4 belowColor
|
|
23
25
|
) {
|
|
24
26
|
|
|
25
27
|
// vertical texture coordinate to find color and offset
|
|
@@ -44,16 +46,15 @@ vec4 computeColor(
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
|
-
|
|
48
49
|
// Do linear interpolation using the color scale, if defined.
|
|
49
50
|
if (scaleLength > 0) {
|
|
50
51
|
// If value below color scale range, clamp to lowest color stop.
|
|
51
52
|
float scaleOffsetLowest = getTexelValue(scaleColormap, vec2(0.0, offsetRow), littleEndian);
|
|
52
53
|
float scaleOffsetHighest = getTexelValue(scaleColormap, vec2(1.0, offsetRow), littleEndian);
|
|
53
54
|
if (inputVal < scaleOffsetLowest) {
|
|
54
|
-
return
|
|
55
|
+
return belowColor;
|
|
55
56
|
} else if (inputVal > scaleOffsetHighest) {
|
|
56
|
-
return
|
|
57
|
+
return aboveColor;
|
|
57
58
|
} else {
|
|
58
59
|
for (int i = 0; i < SCALE_MAX_LENGTH; ++i) {
|
|
59
60
|
float i_f = float(i);
|
package/src/measure/index.js
CHANGED
|
@@ -160,19 +160,14 @@ class Measurement {
|
|
|
160
160
|
|
|
161
161
|
while (!triangles.length && projs.length) { // 寻找可成功分解的投影平面
|
|
162
162
|
flatCoordinates = projs.shift()
|
|
163
|
-
flatCoordinates.
|
|
163
|
+
flatCoordinates = this._reduceCoordinates(flatCoordinates)
|
|
164
164
|
let edges = []
|
|
165
165
|
flatCoordinates.forEach((coord, index) => {
|
|
166
|
-
let edge = null
|
|
167
166
|
if (index === flatCoordinates.length - 1) {
|
|
168
|
-
|
|
167
|
+
edges.push([index, 0])
|
|
169
168
|
} else {
|
|
170
|
-
|
|
169
|
+
edges.push([index, index + 1])
|
|
171
170
|
}
|
|
172
|
-
if (_.isEqual(flatCoordinates[edge[0]], flatCoordinates[edge[1]])) {
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
edges.push(edge)
|
|
176
171
|
})
|
|
177
172
|
triangles = cdt2d(flatCoordinates, edges, { exterior: false })
|
|
178
173
|
}
|
|
@@ -198,6 +193,17 @@ class Measurement {
|
|
|
198
193
|
let c = this.getDistance3D([p3, p1])
|
|
199
194
|
return Math.sqrt((a + b + c) * (a + b - c) * (a + c - b) * (b + c - a)) / 4
|
|
200
195
|
}
|
|
196
|
+
|
|
197
|
+
_reduceCoordinates (coords) { // 去重
|
|
198
|
+
for(let i = 0;i < coords.length; i++) {
|
|
199
|
+
let nextIndex = i === coords.length - 1 ? 0 : (i + 1)
|
|
200
|
+
if (_.isEqual(coords[i], coords[nextIndex])) {
|
|
201
|
+
coords.splice(i, 1)
|
|
202
|
+
i--
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return coords
|
|
206
|
+
}
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
export default Measurement
|
package/src/transform.js
CHANGED
|
@@ -11,6 +11,9 @@ import { crsList, crsTypes } from './constants'
|
|
|
11
11
|
export function getWKTString (crs) {
|
|
12
12
|
let {type, epsg_code} = crs
|
|
13
13
|
for(let i = 0;i < crsList.length;i++) {
|
|
14
|
+
if (!crsTypes[crsList[i].type]) {
|
|
15
|
+
continue
|
|
16
|
+
}
|
|
14
17
|
let typeCode = crsTypes[crsList[i].type].code
|
|
15
18
|
if (typeCode !== type) {
|
|
16
19
|
continue
|