|
@@ -11,149 +11,248 @@ import { Location } from '../../../mol-model/location';
|
|
import { CustomProperty } from '../../../mol-model-props/common/custom-property';
|
|
import { CustomProperty } from '../../../mol-model-props/common/custom-property';
|
|
import { ColorTheme } from '../../../mol-theme/color';
|
|
import { ColorTheme } from '../../../mol-theme/color';
|
|
import { ThemeDataContext } from '../../../mol-theme/theme';
|
|
import { ThemeDataContext } from '../../../mol-theme/theme';
|
|
-import { Color } from '../../../mol-util/color';
|
|
|
|
|
|
+import { Color, ColorMap } from '../../../mol-util/color';
|
|
|
|
+import { getColorMapParams } from '../../../mol-util/color/params';
|
|
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
|
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
|
import { TableLegend } from '../../../mol-util/legend';
|
|
import { TableLegend } from '../../../mol-util/legend';
|
|
-import { iterableToArray } from '../../../mol-data/util';
|
|
|
|
|
|
+import { ObjectKeys } from '../../../mol-util/type-helpers';
|
|
|
|
|
|
-const DefaultColor = Color(0xCCCCCC);
|
|
|
|
const Description = 'Assigns colors to confal pyramids';
|
|
const Description = 'Assigns colors to confal pyramids';
|
|
-const ErrorColor = Color(0xFFA10A);
|
|
|
|
-
|
|
|
|
-type ConformerClasses = 'A' | 'B' | 'BII' | 'miB' | 'Z' | 'IC' | 'OPN' | 'SYN' | 'N';
|
|
|
|
|
|
|
|
-const ColorMapping: ReadonlyMap<ConformerClasses, Color> = new Map([
|
|
|
|
- ['A', Color(0xFFC1C1)],
|
|
|
|
- ['B', Color(0xC8CFFF)],
|
|
|
|
- ['BII', Color(0x0059DA)],
|
|
|
|
- ['miB', Color(0x3BE8FB)],
|
|
|
|
- ['Z', Color(0x01F60E)],
|
|
|
|
- ['IC', Color(0xFA5CFB)],
|
|
|
|
- ['OPN', Color(0xE90000)],
|
|
|
|
- ['SYN', Color(0xFFFF01)],
|
|
|
|
- ['N', Color(0xF2F2F2)],
|
|
|
|
-]);
|
|
|
|
|
|
+const DefaultClassColors = {
|
|
|
|
+ A: 0xFFC1C1,
|
|
|
|
+ B: 0xC8CFFF,
|
|
|
|
+ BII: 0x0059DA,
|
|
|
|
+ miB: 0x3BE8FB,
|
|
|
|
+ Z: 0x01F60E,
|
|
|
|
+ IC: 0xFA5CFB,
|
|
|
|
+ OPN: 0xE90000,
|
|
|
|
+ SYN: 0xFFFF01,
|
|
|
|
+ N: 0xF2F2F2,
|
|
|
|
+};
|
|
|
|
+const ErrorColor = Color(0xFFA10A);
|
|
|
|
|
|
-const NtCToClasses: ReadonlyMap<string, [ConformerClasses, ConformerClasses]> = new Map([
|
|
|
|
- ['NANT', ['N', 'N']],
|
|
|
|
- ['AA00', ['A', 'A']],
|
|
|
|
- ['AA02', ['A', 'A']],
|
|
|
|
- ['AA03', ['A', 'A']],
|
|
|
|
- ['AA04', ['A', 'A']],
|
|
|
|
- ['AA08', ['A', 'A']],
|
|
|
|
- ['AA09', ['A', 'A']],
|
|
|
|
- ['AA01', ['A', 'A']],
|
|
|
|
- ['AA05', ['A', 'A']],
|
|
|
|
- ['AA06', ['A', 'A']],
|
|
|
|
- ['AA10', ['A', 'A']],
|
|
|
|
- ['AA11', ['A', 'A']],
|
|
|
|
- ['AA07', ['A', 'A']],
|
|
|
|
- ['AA12', ['A', 'A']],
|
|
|
|
- ['AA13', ['A', 'A']],
|
|
|
|
- ['AB01', ['A', 'B']],
|
|
|
|
- ['AB02', ['A', 'B']],
|
|
|
|
- ['AB03', ['A', 'B']],
|
|
|
|
- ['AB04', ['A', 'B']],
|
|
|
|
- ['AB05', ['A', 'B']],
|
|
|
|
- ['BA01', ['B', 'A']],
|
|
|
|
- ['BA05', ['B', 'A']],
|
|
|
|
- ['BA09', ['B', 'A']],
|
|
|
|
- ['BA08', ['BII', 'A']],
|
|
|
|
- ['BA10', ['B', 'A']],
|
|
|
|
- ['BA13', ['BII', 'A']],
|
|
|
|
- ['BA16', ['BII', 'A']],
|
|
|
|
- ['BA17', ['BII', 'A']],
|
|
|
|
- ['BB00', ['B', 'B']],
|
|
|
|
- ['BB01', ['B', 'B']],
|
|
|
|
- ['BB17', ['B', 'B']],
|
|
|
|
- ['BB02', ['B', 'B']],
|
|
|
|
- ['BB03', ['B', 'B']],
|
|
|
|
- ['BB11', ['B', 'B']],
|
|
|
|
- ['BB16', ['B', 'B']],
|
|
|
|
- ['BB04', ['B', 'BII']],
|
|
|
|
- ['BB05', ['B', 'BII']],
|
|
|
|
- ['BB07', ['BII', 'BII']],
|
|
|
|
- ['BB08', ['BII', 'BII']],
|
|
|
|
- ['BB10', ['miB', 'miB']],
|
|
|
|
- ['BB12', ['miB', 'miB']],
|
|
|
|
- ['BB13', ['miB', 'miB']],
|
|
|
|
- ['BB14', ['miB', 'miB']],
|
|
|
|
- ['BB15', ['miB', 'miB']],
|
|
|
|
- ['BB20', ['miB', 'miB']],
|
|
|
|
- ['IC01', ['IC', 'IC']],
|
|
|
|
- ['IC02', ['IC', 'IC']],
|
|
|
|
- ['IC03', ['IC', 'IC']],
|
|
|
|
- ['IC04', ['IC', 'IC']],
|
|
|
|
- ['IC05', ['IC', 'IC']],
|
|
|
|
- ['IC06', ['IC', 'IC']],
|
|
|
|
- ['IC07', ['IC', 'IC']],
|
|
|
|
- ['OP01', ['OPN', 'OPN']],
|
|
|
|
- ['OP02', ['OPN', 'OPN']],
|
|
|
|
- ['OP03', ['OPN', 'OPN']],
|
|
|
|
- ['OP04', ['OPN', 'OPN']],
|
|
|
|
- ['OP05', ['OPN', 'OPN']],
|
|
|
|
- ['OP06', ['OPN', 'OPN']],
|
|
|
|
- ['OP07', ['OPN', 'OPN']],
|
|
|
|
- ['OP08', ['OPN', 'OPN']],
|
|
|
|
- ['OP09', ['OPN', 'OPN']],
|
|
|
|
- ['OP10', ['OPN', 'OPN']],
|
|
|
|
- ['OP11', ['OPN', 'OPN']],
|
|
|
|
- ['OP12', ['OPN', 'OPN']],
|
|
|
|
- ['OP13', ['OPN', 'OPN']],
|
|
|
|
- ['OP14', ['OPN', 'OPN']],
|
|
|
|
- ['OP15', ['OPN', 'OPN']],
|
|
|
|
- ['OP16', ['OPN', 'OPN']],
|
|
|
|
- ['OP17', ['OPN', 'OPN']],
|
|
|
|
- ['OP18', ['OPN', 'OPN']],
|
|
|
|
- ['OP19', ['OPN', 'OPN']],
|
|
|
|
- ['OP20', ['OPN', 'OPN']],
|
|
|
|
- ['OP21', ['OPN', 'OPN']],
|
|
|
|
- ['OP22', ['OPN', 'OPN']],
|
|
|
|
- ['OP23', ['OPN', 'OPN']],
|
|
|
|
- ['OP24', ['OPN', 'OPN']],
|
|
|
|
- ['OP25', ['OPN', 'OPN']],
|
|
|
|
- ['OP26', ['OPN', 'OPN']],
|
|
|
|
- ['OP27', ['OPN', 'OPN']],
|
|
|
|
- ['OP28', ['OPN', 'OPN']],
|
|
|
|
- ['OP29', ['OPN', 'OPN']],
|
|
|
|
- ['OP30', ['OPN', 'OPN']],
|
|
|
|
- ['OP31', ['OPN', 'OPN']],
|
|
|
|
- ['OPS1', ['OPN', 'OPN']],
|
|
|
|
- ['OP1S', ['OPN', 'SYN']],
|
|
|
|
- ['AAS1', ['SYN', 'A']],
|
|
|
|
- ['AB1S', ['A', 'SYN']],
|
|
|
|
- ['AB2S', ['A', 'SYN']],
|
|
|
|
- ['BB1S', ['B', 'SYN']],
|
|
|
|
- ['BB2S', ['B', 'SYN']],
|
|
|
|
- ['BBS1', ['SYN', 'B']],
|
|
|
|
- ['ZZ01', ['Z', 'Z']],
|
|
|
|
- ['ZZ02', ['Z', 'Z']],
|
|
|
|
- ['ZZ1S', ['Z', 'SYN']],
|
|
|
|
- ['ZZ2S', ['Z', 'SYN']],
|
|
|
|
- ['ZZS1', ['SYN', 'Z']],
|
|
|
|
- ['ZZS2', ['SYN', 'Z']],
|
|
|
|
-]);
|
|
|
|
|
|
+const PyramidsColors = ColorMap({
|
|
|
|
+ NANT_Upr: DefaultClassColors.N,
|
|
|
|
+ NANT_Lwr: DefaultClassColors.N,
|
|
|
|
+ AA00_Upr: DefaultClassColors.A,
|
|
|
|
+ AA00_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA02_Upr: DefaultClassColors.A,
|
|
|
|
+ AA02_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA03_Upr: DefaultClassColors.A,
|
|
|
|
+ AA03_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA04_Upr: DefaultClassColors.A,
|
|
|
|
+ AA04_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA08_Upr: DefaultClassColors.A,
|
|
|
|
+ AA08_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA09_Upr: DefaultClassColors.A,
|
|
|
|
+ AA09_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA01_Upr: DefaultClassColors.A,
|
|
|
|
+ AA01_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA05_Upr: DefaultClassColors.A,
|
|
|
|
+ AA05_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA06_Upr: DefaultClassColors.A,
|
|
|
|
+ AA06_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA10_Upr: DefaultClassColors.A,
|
|
|
|
+ AA10_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA11_Upr: DefaultClassColors.A,
|
|
|
|
+ AA11_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA07_Upr: DefaultClassColors.A,
|
|
|
|
+ AA07_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA12_Upr: DefaultClassColors.A,
|
|
|
|
+ AA12_Lwr: DefaultClassColors.A,
|
|
|
|
+ AA13_Upr: DefaultClassColors.A,
|
|
|
|
+ AA13_Lwr: DefaultClassColors.A,
|
|
|
|
+ AB01_Upr: DefaultClassColors.A,
|
|
|
|
+ AB01_Lwr: DefaultClassColors.B,
|
|
|
|
+ AB02_Upr: DefaultClassColors.A,
|
|
|
|
+ AB02_Lwr: DefaultClassColors.B,
|
|
|
|
+ AB03_Upr: DefaultClassColors.A,
|
|
|
|
+ AB03_Lwr: DefaultClassColors.B,
|
|
|
|
+ AB04_Upr: DefaultClassColors.A,
|
|
|
|
+ AB04_Lwr: DefaultClassColors.B,
|
|
|
|
+ AB05_Upr: DefaultClassColors.A,
|
|
|
|
+ AB05_Lwr: DefaultClassColors.B,
|
|
|
|
+ BA01_Upr: DefaultClassColors.B,
|
|
|
|
+ BA01_Lwr: DefaultClassColors.A,
|
|
|
|
+ BA05_Upr: DefaultClassColors.B,
|
|
|
|
+ BA05_Lwr: DefaultClassColors.A,
|
|
|
|
+ BA09_Upr: DefaultClassColors.B,
|
|
|
|
+ BA09_Lwr: DefaultClassColors.A,
|
|
|
|
+ BA08_Upr: DefaultClassColors.BII,
|
|
|
|
+ BA08_Lwr: DefaultClassColors.A,
|
|
|
|
+ BA10_Upr: DefaultClassColors.B,
|
|
|
|
+ BA10_Lwr: DefaultClassColors.A,
|
|
|
|
+ BA13_Upr: DefaultClassColors.BII,
|
|
|
|
+ BA13_Lwr: DefaultClassColors.A,
|
|
|
|
+ BA16_Upr: DefaultClassColors.BII,
|
|
|
|
+ BA16_Lwr: DefaultClassColors.A,
|
|
|
|
+ BA17_Upr: DefaultClassColors.BII,
|
|
|
|
+ BA17_Lwr: DefaultClassColors.A,
|
|
|
|
+ BB00_Upr: DefaultClassColors.B,
|
|
|
|
+ BB00_Lwr: DefaultClassColors.B,
|
|
|
|
+ BB01_Upr: DefaultClassColors.B,
|
|
|
|
+ BB01_Lwr: DefaultClassColors.B,
|
|
|
|
+ BB17_Upr: DefaultClassColors.B,
|
|
|
|
+ BB17_Lwr: DefaultClassColors.B,
|
|
|
|
+ BB02_Upr: DefaultClassColors.B,
|
|
|
|
+ BB02_Lwr: DefaultClassColors.B,
|
|
|
|
+ BB03_Upr: DefaultClassColors.B,
|
|
|
|
+ BB03_Lwr: DefaultClassColors.B,
|
|
|
|
+ BB11_Upr: DefaultClassColors.B,
|
|
|
|
+ BB11_Lwr: DefaultClassColors.B,
|
|
|
|
+ BB16_Upr: DefaultClassColors.B,
|
|
|
|
+ BB16_Lwr: DefaultClassColors.B,
|
|
|
|
+ BB04_Upr: DefaultClassColors.B,
|
|
|
|
+ BB04_Lwr: DefaultClassColors.BII,
|
|
|
|
+ BB05_Upr: DefaultClassColors.B,
|
|
|
|
+ BB05_Lwr: DefaultClassColors.BII,
|
|
|
|
+ BB07_Upr: DefaultClassColors.BII,
|
|
|
|
+ BB07_Lwr: DefaultClassColors.BII,
|
|
|
|
+ BB08_Upr: DefaultClassColors.BII,
|
|
|
|
+ BB08_Lwr: DefaultClassColors.BII,
|
|
|
|
+ BB10_Upr: DefaultClassColors.miB,
|
|
|
|
+ BB10_Lwr: DefaultClassColors.miB,
|
|
|
|
+ BB12_Upr: DefaultClassColors.miB,
|
|
|
|
+ BB12_Lwr: DefaultClassColors.miB,
|
|
|
|
+ BB13_Upr: DefaultClassColors.miB,
|
|
|
|
+ BB13_Lwr: DefaultClassColors.miB,
|
|
|
|
+ BB14_Upr: DefaultClassColors.miB,
|
|
|
|
+ BB14_Lwr: DefaultClassColors.miB,
|
|
|
|
+ BB15_Upr: DefaultClassColors.miB,
|
|
|
|
+ BB15_Lwr: DefaultClassColors.miB,
|
|
|
|
+ BB20_Upr: DefaultClassColors.miB,
|
|
|
|
+ BB20_Lwr: DefaultClassColors.miB,
|
|
|
|
+ IC01_Upr: DefaultClassColors.IC,
|
|
|
|
+ IC01_Lwr: DefaultClassColors.IC,
|
|
|
|
+ IC02_Upr: DefaultClassColors.IC,
|
|
|
|
+ IC02_Lwr: DefaultClassColors.IC,
|
|
|
|
+ IC03_Upr: DefaultClassColors.IC,
|
|
|
|
+ IC03_Lwr: DefaultClassColors.IC,
|
|
|
|
+ IC04_Upr: DefaultClassColors.IC,
|
|
|
|
+ IC04_Lwr: DefaultClassColors.IC,
|
|
|
|
+ IC05_Upr: DefaultClassColors.IC,
|
|
|
|
+ IC05_Lwr: DefaultClassColors.IC,
|
|
|
|
+ IC06_Upr: DefaultClassColors.IC,
|
|
|
|
+ IC06_Lwr: DefaultClassColors.IC,
|
|
|
|
+ IC07_Upr: DefaultClassColors.IC,
|
|
|
|
+ IC07_Lwr: DefaultClassColors.IC,
|
|
|
|
+ OP01_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP01_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP02_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP02_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP03_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP03_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP04_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP04_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP05_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP05_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP06_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP06_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP07_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP07_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP08_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP08_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP09_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP09_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP10_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP10_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP11_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP11_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP12_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP12_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP13_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP13_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP14_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP14_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP15_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP15_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP16_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP16_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP17_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP17_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP18_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP18_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP19_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP19_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP20_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP20_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP21_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP21_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP22_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP22_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP23_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP23_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP24_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP24_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP25_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP25_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP26_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP26_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP27_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP27_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP28_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP28_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP29_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP29_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP30_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP30_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP31_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP31_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OPS1_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OPS1_Lwr: DefaultClassColors.OPN,
|
|
|
|
+ OP1S_Upr: DefaultClassColors.OPN,
|
|
|
|
+ OP1S_Lwr: DefaultClassColors.SYN,
|
|
|
|
+ AAS1_Upr: DefaultClassColors.SYN,
|
|
|
|
+ AAS1_Lwr: DefaultClassColors.A,
|
|
|
|
+ AB1S_Upr: DefaultClassColors.A,
|
|
|
|
+ AB1S_Lwr: DefaultClassColors.SYN,
|
|
|
|
+ AB2S_Upr: DefaultClassColors.A,
|
|
|
|
+ AB2S_Lwr: DefaultClassColors.SYN,
|
|
|
|
+ BB1S_Upr: DefaultClassColors.B,
|
|
|
|
+ BB1S_Lwr: DefaultClassColors.SYN,
|
|
|
|
+ BB2S_Upr: DefaultClassColors.B,
|
|
|
|
+ BB2S_Lwr: DefaultClassColors.SYN,
|
|
|
|
+ BBS1_Upr: DefaultClassColors.SYN,
|
|
|
|
+ BBS1_Lwr: DefaultClassColors.B,
|
|
|
|
+ ZZ01_Upr: DefaultClassColors.Z,
|
|
|
|
+ ZZ01_Lwr: DefaultClassColors.Z,
|
|
|
|
+ ZZ02_Upr: DefaultClassColors.Z,
|
|
|
|
+ ZZ02_Lwr: DefaultClassColors.Z,
|
|
|
|
+ ZZ1S_Upr: DefaultClassColors.Z,
|
|
|
|
+ ZZ1S_Lwr: DefaultClassColors.SYN,
|
|
|
|
+ ZZ2S_Upr: DefaultClassColors.Z,
|
|
|
|
+ ZZ2S_Lwr: DefaultClassColors.SYN,
|
|
|
|
+ ZZS1_Upr: DefaultClassColors.SYN,
|
|
|
|
+ ZZS1_Lwr: DefaultClassColors.Z,
|
|
|
|
+ ZZS2_Upr: DefaultClassColors.SYN,
|
|
|
|
+ ZZS2_Lwr: DefaultClassColors.Z,
|
|
|
|
+});
|
|
|
|
+type PyramidsColors = typeof PyramidsColors;
|
|
|
|
|
|
-function getConformerColor(ntc: string, useLower: boolean): Color {
|
|
|
|
- const item = NtCToClasses.get(ntc);
|
|
|
|
- if (!item) return ErrorColor;
|
|
|
|
- return ColorMapping.get(useLower ? item[1] : item[0]) ?? ErrorColor;
|
|
|
|
-}
|
|
|
|
|
|
+export const ConfalPyramidsColorThemeParams = {
|
|
|
|
+ colors: PD.MappedStatic('default', {
|
|
|
|
+ 'default': PD.EmptyGroup(),
|
|
|
|
+ 'custom': PD.Group(getColorMapParams(PyramidsColors))
|
|
|
|
+ }),
|
|
|
|
+};
|
|
|
|
+export type ConfalPyramidsColorThemeParams = typeof ConfalPyramidsColorThemeParams;
|
|
|
|
|
|
-export const ConfalPyramidsColorThemeParams = {};
|
|
|
|
-export type ConfalPyramidsColorThemeParams = typeof ConfalPyramidsColorThemeParams
|
|
|
|
export function getConfalPyramidsColorThemeParams(ctx: ThemeDataContext) {
|
|
export function getConfalPyramidsColorThemeParams(ctx: ThemeDataContext) {
|
|
- return ConfalPyramidsColorThemeParams; // TODO return copy
|
|
|
|
|
|
+ return PD.clone(ConfalPyramidsColorThemeParams);
|
|
}
|
|
}
|
|
|
|
|
|
export function ConfalPyramidsColorTheme(ctx: ThemeDataContext, props: PD.Values<ConfalPyramidsColorThemeParams>): ColorTheme<ConfalPyramidsColorThemeParams> {
|
|
export function ConfalPyramidsColorTheme(ctx: ThemeDataContext, props: PD.Values<ConfalPyramidsColorThemeParams>): ColorTheme<ConfalPyramidsColorThemeParams> {
|
|
|
|
+ const colorMap = props.colors.name === 'default' ? PyramidsColors : props.colors.params;
|
|
|
|
+
|
|
function color(location: Location, isSecondary: boolean): Color {
|
|
function color(location: Location, isSecondary: boolean): Color {
|
|
if (CPT.isLocation(location)) {
|
|
if (CPT.isLocation(location)) {
|
|
const { pyramid, isLower } = location.data;
|
|
const { pyramid, isLower } = location.data;
|
|
- return getConformerColor(pyramid.NtC, isLower);
|
|
|
|
|
|
+ const key = pyramid.NtC + `_${isLower ? 'Lwr' : 'Upr'}` as keyof PyramidsColors;
|
|
|
|
+ return colorMap[key] ?? ErrorColor;
|
|
}
|
|
}
|
|
|
|
|
|
- return DefaultColor;
|
|
|
|
|
|
+ return ErrorColor;
|
|
}
|
|
}
|
|
|
|
|
|
return {
|
|
return {
|
|
@@ -162,12 +261,7 @@ export function ConfalPyramidsColorTheme(ctx: ThemeDataContext, props: PD.Values
|
|
color,
|
|
color,
|
|
props,
|
|
props,
|
|
description: Description,
|
|
description: Description,
|
|
- legend: TableLegend(iterableToArray(ColorMapping.entries()).map(([conformer, color]) => {
|
|
|
|
- return [conformer, color] as [string, Color];
|
|
|
|
- }).concat([
|
|
|
|
- ['Error', ErrorColor],
|
|
|
|
- ['Unknown', DefaultColor]
|
|
|
|
- ]))
|
|
|
|
|
|
+ legend: TableLegend(ObjectKeys(colorMap).map(k => [k.replace('_', ' '), colorMap[k]] as [string, Color]).concat([['Error', ErrorColor]])),
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|