artisynth.core.renderables
Class ColorBar
java.lang.Object
artisynth.core.modelbase.ModelComponentBase
artisynth.core.modelbase.RenderableComponentBase
artisynth.core.renderables.TextComponentBase
artisynth.core.renderables.ColorBar
- All Implemented Interfaces:
- ModelComponent, RenderableComponent, java.lang.Cloneable, HasProperties, HierarchyNode, GLRenderable, GLSelectable, HasRenderProps, Renderable, Disposable, Scannable
public class ColorBar
- extends TextComponentBase
Color bar implementation, as a 2D renderable component. Allow
you to draw labels/tick marks and adjust the color scheme.
- Author:
- Antonio
Method Summary |
static RenderProps |
createDefaultRenderProps()
|
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object. |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object. |
void |
getColor(double value,
double[] rgb)
|
ColorMapBase |
getColorMap()
|
PropertyMode |
getColorMapMode()
|
VectorNd |
getLabelPositions()
|
java.util.ArrayList<java.lang.String> |
getLabels()
|
java.lang.String |
getLabelSet()
|
Rectangle |
getLocationOverride()
|
Rectangle |
getNormalizedLocation()
|
NumberFormat |
getNumberFormat()
|
java.lang.String |
getNumberFormatString()
|
int |
getRenderHints()
Returns a bit code giving rendering hints about this renderable. |
Vector2d |
getTextOffset()
|
Vector2d |
getTickFraction()
|
DoubleInterval |
getValueRange()
|
boolean |
isHorizontal()
|
void |
parseLabelSet(java.lang.String str)
|
int |
parseNext(char[] carray,
int idx,
java.util.ArrayList<java.lang.String> parsed)
|
void |
populateLabels(double minVal,
double maxVal,
int nSections)
|
void |
populateLabels(double minVal,
double maxVal,
int nSections,
NumberFormat fmt)
|
void |
render(GLRenderer renderer,
int flags)
Render this object using Open GL via the JOGL. |
void |
setColorMap(ColorMapBase colorMap)
|
void |
setColorMapMode(PropertyMode mode)
|
void |
setHorizontal(boolean set)
|
void |
setHorizontalAlignment(TextComponentBase.HorizontalAlignment hAlignment)
Sets the horizontal alignment, one of LEFT, CENTRE, RIGHT |
void |
setLabel(int idx,
java.lang.String text)
|
void |
setLabelPositions(VectorNd pos)
|
void |
setLabels(java.util.ArrayList<java.lang.String> text)
|
void |
setLabels(VectorNd tickLocs,
java.util.ArrayList<java.lang.String> labels)
|
void |
setLocationOverride(double x,
double y,
double width,
double height)
|
void |
setLocationOverride(Rectangle pos)
|
void |
setNormalizedLocation(double x,
double y,
double width,
double height)
|
void |
setNormalizedLocation(Rectangle pos)
|
void |
setNumberFormat(NumberFormat fmt)
|
void |
setNumberFormatString(java.lang.String fmt)
|
void |
setTextOffset(Vector2d offset)
|
void |
setTickFraction(Vector2d frac)
|
void |
setValueRange(double min,
double max)
|
void |
setValueRange(DoubleInterval range)
|
void |
setVerticalAlignment(TextComponentBase.VerticalAlignment vAlignment)
If bar is horizontal, then places text at supplied alignment location. |
void |
updateLabels()
|
void |
updateLabels(double minVal,
double maxVal)
|
void |
updateLabels(double minVal,
double maxVal,
NumberFormat fmt)
|
void |
updateLabels(NumberFormat fmt)
|
Methods inherited from class artisynth.core.renderables.TextComponentBase |
dispose, getFontFamily, getFontSize, getFontStyle, getHorizontalAlignment, getTextSize, getVerticalAlignment, isSelectable, numSelectionQueriesNeeded, setFont, setFontFamily, setFontSize, setFontStyle, setTextColor, setTextRenderer, setTextSize |
Methods inherited from class artisynth.core.modelbase.ModelComponentBase |
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface artisynth.core.modelbase.ModelComponent |
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences |
defaultLoc
public static Rectangle defaultLoc
defaultNormLoc
public static Rectangle defaultNormLoc
defaultTickFraction
public static Vector2d defaultTickFraction
defaultTextSize
public static double defaultTextSize
defaultTextOffset
public static Vector2d defaultTextOffset
defaultNumberFormat
public static java.lang.String defaultNumberFormat
defaultVAlignment
public static TextComponentBase.VerticalAlignment defaultVAlignment
defaultHAlignment
public static TextComponentBase.HorizontalAlignment defaultHAlignment
defaultInterval
public static DoubleInterval defaultInterval
defaultColorMap
public static ColorMapBase defaultColorMap
defaultBarDivisions
public static int defaultBarDivisions
defaultHorizontal
public static boolean defaultHorizontal
myProps
public static PropertyList myProps
ColorBar
public ColorBar()
ColorBar
public ColorBar(ColorMapBase cmap)
getAllPropertyInfo
public PropertyList getAllPropertyInfo()
- Description copied from interface:
HasProperties
- Returns a list giving static information about all properties exported by
this object.
- Specified by:
getAllPropertyInfo
in interface HasProperties
- Overrides:
getAllPropertyInfo
in class TextComponentBase
- Returns:
- static information for all exported properties
createDefaultRenderProps
public static RenderProps createDefaultRenderProps()
createRenderProps
public RenderProps createRenderProps()
- Description copied from interface:
HasRenderProps
- Factory method to create render properties appropriate to this object.
- Specified by:
createRenderProps
in interface HasRenderProps
- Overrides:
createRenderProps
in class TextComponentBase
- Returns:
- new render properties for this object
render
public void render(GLRenderer renderer,
int flags)
- Description copied from interface:
GLRenderable
- Render this object using Open GL via the JOGL.
- Specified by:
render
in interface GLRenderable
- Specified by:
render
in class RenderableComponentBase
- Parameters:
renderer
- renderer object which is used to perform the rendering. Provides pointers
to GL and GLU, along with helper functions.flags
- supplies flags that may be used to control different
aspects of the rendering. Flags are defined in GLRenderer
and currently include
GLRenderer.SELECTED
,
GLRenderer.VERTEX_COLORING
,
GLRenderer.HSV_COLOR_INTERPOLATION
,
GLRenderer.SORT_FACES
, and
GLRenderer.CLEAR_MESH_DISPLAY_LISTS
.
getRenderHints
public int getRenderHints()
- Description copied from interface:
GLRenderable
- Returns a bit code giving rendering hints about this renderable. Current
bit codes include
TRANSLUCENT
.
- Specified by:
getRenderHints
in interface GLRenderable
- Overrides:
getRenderHints
in class RenderableComponentBase
- Returns:
- bit code of rendering hints.
getNormalizedLocation
public Rectangle getNormalizedLocation()
setNormalizedLocation
public void setNormalizedLocation(Rectangle pos)
getLocationOverride
public Rectangle getLocationOverride()
setLocationOverride
public void setLocationOverride(Rectangle pos)
setLocationOverride
public void setLocationOverride(double x,
double y,
double width,
double height)
setNormalizedLocation
public void setNormalizedLocation(double x,
double y,
double width,
double height)
isHorizontal
public boolean isHorizontal()
setHorizontal
public void setHorizontal(boolean set)
getColorMap
public ColorMapBase getColorMap()
setColorMap
public void setColorMap(ColorMapBase colorMap)
getColorMapMode
public PropertyMode getColorMapMode()
setColorMapMode
public void setColorMapMode(PropertyMode mode)
getLabelPositions
public VectorNd getLabelPositions()
setLabelPositions
public void setLabelPositions(VectorNd pos)
setLabels
public void setLabels(java.util.ArrayList<java.lang.String> text)
getLabels
public java.util.ArrayList<java.lang.String> getLabels()
setLabel
public void setLabel(int idx,
java.lang.String text)
parseLabelSet
public void parseLabelSet(java.lang.String str)
parseNext
public int parseNext(char[] carray,
int idx,
java.util.ArrayList<java.lang.String> parsed)
getLabelSet
public java.lang.String getLabelSet()
setTickFraction
public void setTickFraction(Vector2d frac)
getTickFraction
public Vector2d getTickFraction()
getTextOffset
public Vector2d getTextOffset()
setTextOffset
public void setTextOffset(Vector2d offset)
setLabels
public void setLabels(VectorNd tickLocs,
java.util.ArrayList<java.lang.String> labels)
populateLabels
public void populateLabels(double minVal,
double maxVal,
int nSections,
NumberFormat fmt)
updateLabels
public void updateLabels(NumberFormat fmt)
updateLabels
public void updateLabels()
getColor
public void getColor(double value,
double[] rgb)
updateLabels
public void updateLabels(double minVal,
double maxVal,
NumberFormat fmt)
updateLabels
public void updateLabels(double minVal,
double maxVal)
populateLabels
public void populateLabels(double minVal,
double maxVal,
int nSections)
setValueRange
public void setValueRange(DoubleInterval range)
setValueRange
public void setValueRange(double min,
double max)
getValueRange
public DoubleInterval getValueRange()
setHorizontalAlignment
public void setHorizontalAlignment(TextComponentBase.HorizontalAlignment hAlignment)
- Description copied from class:
TextComponentBase
- Sets the horizontal alignment, one of
LEFT, CENTRE, RIGHT
- Overrides:
setHorizontalAlignment
in class TextComponentBase
setVerticalAlignment
public void setVerticalAlignment(TextComponentBase.VerticalAlignment vAlignment)
- If bar is horizontal, then places text at supplied alignment location.
If vertical, sets alignment of text.
- Overrides:
setVerticalAlignment
in class TextComponentBase
setNumberFormatString
public void setNumberFormatString(java.lang.String fmt)
getNumberFormatString
public java.lang.String getNumberFormatString()
setNumberFormat
public void setNumberFormat(NumberFormat fmt)
getNumberFormat
public NumberFormat getNumberFormat()