-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename TopographicMap => SubsurfaceMap. Add global colorscale
- Loading branch information
1 parent
6147245
commit 620d90f
Showing
18 changed files
with
51 additions
and
14 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { colorTablesObj } from "@emerson-eps/color-tables"; | ||
import { ColorScale } from "@lib/utils/ColorScale"; | ||
|
||
import { formatRgb } from "culori"; | ||
|
||
function rgbStringToArray(rgbString: string): number[] | null { | ||
const match = rgbString.match(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/); | ||
if (match) { | ||
return [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10)]; | ||
} | ||
return null; | ||
} | ||
export function createContinuousColorScaleForMap(colorScale: ColorScale): colorTablesObj[] { | ||
const hexColors = colorScale.getPlotlyColorScale(); | ||
const rgbArr: [number, number, number, number][] = []; | ||
hexColors.forEach((color) => { | ||
const rgbString: string = formatRgb(color[1]) as string; | ||
const rgb = rgbStringToArray(rgbString); | ||
if (rgb) { | ||
rgbArr.push([color[0], rgb[0], rgb[1], rgb[2]]); | ||
} | ||
}); | ||
return [{ name: "Continuous", discrete: false, colors: rgbArr }]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
frontend/src/modules/TopographicMap/state.ts → frontend/src/modules/SubsurfaceMap/state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters