Skip to content

Commit 4a024fb

Browse files
shruthiraiShruthi Rai
and
Shruthi Rai
authoredJun 28, 2022
Legend for 3d map layer (equinor#1084)
* adding legend for 3d map layer * add legend * add color map function * legend for 3d map layer * remove extra code * removed color map function * modified legend range Co-authored-by: Shruthi Rai <[email protected]>
1 parent cd19b4d commit 4a024fb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

‎react/src/lib/components/DeckGLMap/layers/terrain/map3DLayer.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { load } from "@loaders.gl/core";
1414
import { Vector3 } from "@math.gl/core";
1515
import { getModelMatrix } from "../utils/layerTools";
1616
import { isEqual } from "lodash";
17+
import { ContinuousLegendDataType } from "../../components/ColorLegend";
1718

1819
type MeshType = {
1920
attributes: {
@@ -378,7 +379,6 @@ export default class Map3DLayer extends CompositeLayer<
378379

379380
const isMesh =
380381
typeof this.props.mesh !== "undefined" && this.props.mesh !== "";
381-
382382
const layer = new TerrainMapLayer(
383383
this.getSubLayerProps<
384384
TerrainMapLayerData,
@@ -404,6 +404,22 @@ export default class Map3DLayer extends CompositeLayer<
404404
);
405405
return [layer];
406406
}
407+
408+
getLegendData(): ContinuousLegendDataType {
409+
const colorRange = this.props.colorMapRange;
410+
const propertyRange =
411+
this.props.propertyTexture && this.props.propertyValueRange;
412+
const meshRange = this.props.mesh && this.props.meshValueRange;
413+
const legendRange = colorRange || propertyRange || meshRange;
414+
415+
return {
416+
discrete: false,
417+
valueRange: legendRange,
418+
colorName: this.props.colorMapName,
419+
title: "Map3dLayer",
420+
colorMapFunction: this.props.colorMapFunction,
421+
};
422+
}
407423
}
408424

409425
Map3DLayer.layerName = "Map3DLayer";

0 commit comments

Comments
 (0)
Please sign in to comment.