Skip to content

Commit

Permalink
Use valueRange as default color range, if omitted. (equinor#880)
Browse files Browse the repository at this point in the history
* Use valueRange as default color range, if omitted.

Fixes equinor#876.

* Use valueRange as default color range, if omitted.

Fixes equinor#876.

* Use value range as default color map range for 3D maps.

Also fixed property readout calculation for 3D maps.

Co-authored-by: Havard Bjerke <[email protected]>
Co-authored-by: Shadab Khan <[email protected]>
  • Loading branch information
3 people authored Mar 14, 2022
1 parent a4d9f3c commit 94f0b6f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const layersDefaultProps: Record<string, unknown> = {
pickable: true,
visible: true,
valueRange: { type: "array", value: [0, 1] },
colorMapRange: { type: "array", value: [0, 1] },
colorMapRange: { type: "array" },
valueDecoder: {
rgbScaler: [1, 1, 1],
// By default, scale the [0, 256*256*256-1] decoded values to [0, 1]
Expand Down Expand Up @@ -75,7 +75,6 @@ export const layersDefaultProps: Record<string, unknown> = {
// Bounding box of the terrain image, [minX, minY, maxX, maxY] in world coordinates
bounds: { type: "array", value: null, false: true, compare: true },
propertyValueRange: { type: "array", value: [0, 1] },
colorMapRange: { type: "array", value: [0, 1] },
rotDeg: 0,
contours: [-1.0, -1.0],
// If contour lines should follow depth or properties.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const defaultProps = {
contours: [-1, -1],
colorMapName: "",
propertyValueRange: [0.0, 1.0],
colorMapRange: [0.0, 1.0],
isReadoutDepth: false,
isContoursDepth: true,
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
Expand Down Expand Up @@ -185,8 +184,8 @@ export default class TerrainMapLayer extends SimpleMeshLayer<
let value = (r + g + b) * (isPropertyReadout ? floatScaler : 1.0);

if (isPropertyReadout) {
// Remap the [0, 1] decoded value to colorMapRange.
const [min, max] = this.props.colorMapRange;
// Remap the [0, 1] decoded value to property value range.
const [min, max] = this.props.propertyValueRange;
value = value * (max - min) + min;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ const meshMapLayer = {
contours: [0, 50.0],
isContoursDepth: true,
colorMapName: "Physics",
colorMapRange: [2782, 3513],
};
export const KhMapMesh = MinimalTemplate.bind({});
KhMapMesh.args = {
Expand Down

0 comments on commit 94f0b6f

Please sign in to comment.