Package org.jmol.util
Class ColorEncoder
- java.lang.Object
-
- org.jmol.util.ColorEncoder
-
public class ColorEncoder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALT
static int
AMINO
private int[]
argbsAmino
static int[]
argbsChainAtom
static int[]
argbsChainHetero
private int[]
argbsCpk
private int[]
argbsNucleic
private int[]
argbsRoygb
private int[]
argbsRwb
private int[]
argbsShapely
static int
BGYOR
static int
BW
static int
BWR
private static java.lang.String
BYELEMENT_JMOL
static java.lang.String
BYELEMENT_PREFIX
private static java.lang.String
BYELEMENT_RASMOL
private static java.lang.String
BYRESIDUE_AMINO
private static java.lang.String
BYRESIDUE_NUCLEIC
static java.lang.String
BYRESIDUE_PREFIX
private static java.lang.String
BYRESIDUE_SHAPELY
(package private) ColorEncoder
ce
private static java.lang.String[]
colorSchemes
int
currentPalette
int
currentSegmentCount
static int
CUSTOM
static int
FRIENDLY
private static int
GRAY
float
hi
static int
HIGH
private int
ihalf
static int
INHERIT
(package private) boolean
isColorIndex
boolean
isReversed
boolean
isTranslucent
static int
JMOL
float
lo
static int
LOW
static int
NUCLEIC
private int[]
paletteBW
private int[]
paletteFriendly
private int[]
paletteWB
static int
RASMOL
private static int[]
rasmolScale
static int
RESU
static int
ROYGB
static int
RWB
java.util.Map<java.lang.String,int[]>
schemes
static int
SHAPELY
(package private) java.lang.String
thisName
(package private) int[]
thisScale
static int
USER
(package private) int[]
userScale
private Viewer
vwr
static int
WB
-
Constructor Summary
Constructors Constructor Description ColorEncoder(ColorEncoder ce, Viewer vwr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
colorIndex(float q, int segmentCount)
private static int
colorIndexRepeat(float q, int segmentCount)
int
createColorScheme(java.lang.String colorScheme, boolean defaultToRoygb, boolean isOverloaded)
private static java.lang.String
fixName(java.lang.String name)
private int[]
getAmino()
int
getArgb(float val)
int
getArgbFromPalette(float val, float lo, float hi, int palette)
int
getArgbMinMax(float val, float min, float max)
short
getColorIndex(float val)
short
getColorIndexFromPalette(float val, float lo, float hi, int palette, boolean isTranslucent)
java.util.Map<java.lang.String,java.lang.Object>
getColorKey()
java.lang.String
getColorScheme()
int[]
getColorSchemeArray(int palette)
static java.lang.String
getColorSchemeList(int[] scheme)
java.lang.String
getColorSchemeName(int i)
java.lang.String
getCurrentColorSchemeName()
private int[]
getNucleic()
private int[]
getPaletteAC()
static int[]
getPaletteAtoB(int color1, int color2, int n)
private int[]
getPaletteBW()
private int
getPaletteColorCount(int palette)
private int[]
getPaletteWB()
static int[]
getRasmolScale()
private static int
getSchemeIndex(java.lang.String colorScheme)
private int[]
getShapely()
private int
makeColorScheme(java.lang.String name, int[] scale, boolean isOverloaded)
float
quantize(float x, boolean isLowEnd)
gets the value at the color boundary for this color range fractionstatic int
quantize4(float val, float lo, float hi, int segmentCount)
void
setColorScheme(java.lang.String colorScheme, boolean isTranslucent)
void
setRange(float lo, float hi, boolean isReversed)
private void
setThisScheme(java.lang.String name, int[] scale)
void
setUserScale(int[] scale)
-
-
-
Field Detail
-
vwr
private Viewer vwr
-
GRAY
private static final int GRAY
- See Also:
- Constant Field Values
-
BYELEMENT_PREFIX
public static final java.lang.String BYELEMENT_PREFIX
- See Also:
- Constant Field Values
-
BYRESIDUE_PREFIX
public static final java.lang.String BYRESIDUE_PREFIX
- See Also:
- Constant Field Values
-
BYELEMENT_JMOL
private static final java.lang.String BYELEMENT_JMOL
- See Also:
- Constant Field Values
-
BYELEMENT_RASMOL
private static final java.lang.String BYELEMENT_RASMOL
- See Also:
- Constant Field Values
-
BYRESIDUE_SHAPELY
private static final java.lang.String BYRESIDUE_SHAPELY
- See Also:
- Constant Field Values
-
BYRESIDUE_AMINO
private static final java.lang.String BYRESIDUE_AMINO
- See Also:
- Constant Field Values
-
BYRESIDUE_NUCLEIC
private static final java.lang.String BYRESIDUE_NUCLEIC
- See Also:
- Constant Field Values
-
CUSTOM
public static final int CUSTOM
- See Also:
- Constant Field Values
-
ROYGB
public static final int ROYGB
- See Also:
- Constant Field Values
-
BGYOR
public static final int BGYOR
- See Also:
- Constant Field Values
-
JMOL
public static final int JMOL
- See Also:
- Constant Field Values
-
RASMOL
public static final int RASMOL
- See Also:
- Constant Field Values
-
SHAPELY
public static final int SHAPELY
- See Also:
- Constant Field Values
-
AMINO
public static final int AMINO
- See Also:
- Constant Field Values
-
RWB
public static final int RWB
- See Also:
- Constant Field Values
-
BWR
public static final int BWR
- See Also:
- Constant Field Values
-
LOW
public static final int LOW
- See Also:
- Constant Field Values
-
HIGH
public static final int HIGH
- See Also:
- Constant Field Values
-
BW
public static final int BW
- See Also:
- Constant Field Values
-
WB
public static final int WB
- See Also:
- Constant Field Values
-
FRIENDLY
public static final int FRIENDLY
- See Also:
- Constant Field Values
-
USER
public static final int USER
- See Also:
- Constant Field Values
-
RESU
public static final int RESU
- See Also:
- Constant Field Values
-
INHERIT
public static final int INHERIT
- See Also:
- Constant Field Values
-
ALT
public static final int ALT
- See Also:
- Constant Field Values
-
NUCLEIC
public static final int NUCLEIC
- See Also:
- Constant Field Values
-
colorSchemes
private static final java.lang.String[] colorSchemes
-
paletteBW
private int[] paletteBW
-
paletteWB
private int[] paletteWB
-
paletteFriendly
private int[] paletteFriendly
-
argbsCpk
private int[] argbsCpk
-
argbsRoygb
private int[] argbsRoygb
-
argbsRwb
private int[] argbsRwb
-
argbsShapely
private int[] argbsShapely
-
argbsAmino
private int[] argbsAmino
-
argbsNucleic
private int[] argbsNucleic
-
ihalf
private int ihalf
-
rasmolScale
private static int[] rasmolScale
-
schemes
public java.util.Map<java.lang.String,int[]> schemes
-
currentPalette
public int currentPalette
-
currentSegmentCount
public int currentSegmentCount
-
isTranslucent
public boolean isTranslucent
-
lo
public float lo
-
hi
public float hi
-
isReversed
public boolean isReversed
-
userScale
int[] userScale
-
thisScale
int[] thisScale
-
thisName
java.lang.String thisName
-
isColorIndex
boolean isColorIndex
-
ce
ColorEncoder ce
-
argbsChainAtom
public static int[] argbsChainAtom
-
argbsChainHetero
public static int[] argbsChainHetero
-
-
Constructor Detail
-
ColorEncoder
public ColorEncoder(ColorEncoder ce, Viewer vwr)
-
-
Method Detail
-
getSchemeIndex
private static final int getSchemeIndex(java.lang.String colorScheme)
-
fixName
private static final java.lang.String fixName(java.lang.String name)
-
makeColorScheme
private int makeColorScheme(java.lang.String name, int[] scale, boolean isOverloaded)
- Parameters:
name
-scale
- if null, then this is a reset.isOverloaded
- if TRUE,- Returns:
- >= 0 for a default color scheme
-
getShapely
private int[] getShapely()
-
getAmino
private int[] getAmino()
-
getNucleic
private int[] getNucleic()
-
createColorScheme
public int createColorScheme(java.lang.String colorScheme, boolean defaultToRoygb, boolean isOverloaded)
- Parameters:
colorScheme
- name or name= or name=[x......] [x......] ....defaultToRoygb
-isOverloaded
-- Returns:
- paletteID
-
setUserScale
public void setUserScale(int[] scale)
-
getColorSchemeArray
public int[] getColorSchemeArray(int palette)
-
getColorIndexFromPalette
public short getColorIndexFromPalette(float val, float lo, float hi, int palette, boolean isTranslucent)
-
getPaletteColorCount
private int getPaletteColorCount(int palette)
-
getArgbFromPalette
public int getArgbFromPalette(float val, float lo, float hi, int palette)
-
setThisScheme
private void setThisScheme(java.lang.String name, int[] scale)
-
getArgb
public int getArgb(float val)
-
getArgbMinMax
public int getArgbMinMax(float val, float min, float max)
-
getColorIndex
public short getColorIndex(float val)
-
getColorKey
public java.util.Map<java.lang.String,java.lang.Object> getColorKey()
-
getColorScheme
public java.lang.String getColorScheme()
-
setColorScheme
public void setColorScheme(java.lang.String colorScheme, boolean isTranslucent)
- Parameters:
colorScheme
-isTranslucent
-
-
setRange
public void setRange(float lo, float hi, boolean isReversed)
-
getCurrentColorSchemeName
public java.lang.String getCurrentColorSchemeName()
-
getColorSchemeName
public java.lang.String getColorSchemeName(int i)
-
getColorSchemeList
public static final java.lang.String getColorSchemeList(int[] scheme)
-
getRasmolScale
public static final int[] getRasmolScale()
-
getPaletteAC
private int[] getPaletteAC()
-
getPaletteWB
private int[] getPaletteWB()
-
getPaletteAtoB
public static int[] getPaletteAtoB(int color1, int color2, int n)
-
getPaletteBW
private int[] getPaletteBW()
-
quantize
public float quantize(float x, boolean isLowEnd)
gets the value at the color boundary for this color range fraction- Parameters:
x
-isLowEnd
-- Returns:
- quantized value
-
quantize4
public static final int quantize4(float val, float lo, float hi, int segmentCount)
-
colorIndex
private static final int colorIndex(float q, int segmentCount)
-
colorIndexRepeat
private static final int colorIndexRepeat(float q, int segmentCount)
-
-