MeVisLabToolboxReference
ml::StylePalette Class Reference

Base object class StylePalette for providing a collection of colors, line styles and marker types. More...

#include <mlStylePalette.h>

Inheritance diagram for ml::StylePalette:
ml::Base

List of all members.

Public Types

enum  LineStyle {
  lstNone = 0, lstSolid, lstDashed, lstDotted,
  lstNumLineStyles
}
 Line style constants. More...
enum  MarkerType {
  mktNone = 0, mktDot, mktAsterisk, mktCircle,
  mktSquare, mktTriangle, mktPlus, mktCross,
  mktNumMarkerTypes, mktDash = -1
}
 Marker type constants. More...

Public Member Functions

virtual ~StylePalette ()
 Destructor.
StylePaletteoperator= (const StylePalette &palette)
 Assignment operator.
MLssize_t getAutoStyleIndex (MLssize_t n)
 Get index for automatic style n (>= 1).
void copyStylesFrom (const StylePalette &palette)
 Copy style palette from palette.
void setColorDefaults ()
 Set color default values.
void setMonoDefaults ()
 Set monochrome default values.
const char * getLineStyleName (LineStyle lst) const
 Get name of line style lst.
const char * getMarkerTypeName (MarkerType mkt) const
 Get name of marker type mkt.
void dumpStyles ()
 Dump current style definitions to cout.
bool getStyleIndexForName (const std::string curveTitle, std::vector< MLssize_t > &indices)
 Get style indices using name, writes all matching indices into vector, returns true if at least one was found.
virtual void addStateToTree (TreeNode *parent) const
 Attach the object state as children of the given parent node.
virtual void readStateFromTree (TreeNode *parent)
 Read the object state from the children of the given parent node.
 ML_SET_ADDSTATE_VERSION (0)
 Sets addState version number.
virtual StylePaletteclone () const
 Create a clone of the StylePalette.
virtual StylePalettedeepCopy () const
 Creates a deep copy of the given object.
Constructors
 StylePalette ()
 StylePalette (MLssize_t numStyles)
 StylePalette (const StylePalette &palette)
Get/set total number of styles
MLssize_t getNumStyles () const
void setNumStyles (MLssize_t newNumStyles)
Get and set the color for given index.
Vector3 getColor (MLssize_t index) const
void getColor (MLssize_t index, float &r, float &g, float &b) const
void setColor (MLssize_t index, const Vector3 &color)
void setColor (MLssize_t index, float r, float g, float b)
Get and set style for given index (range = [1..numStyles])
LineStyle getLineStyle (MLssize_t index) const
void setLineStyle (MLssize_t index, LineStyle lst)
int getLineWidth (MLssize_t index) const
void setLineWidth (MLssize_t index, int lw)
Get and set the type for given index.
MarkerType getMarkerType (MLssize_t index) const
void setMarkerType (MLssize_t index, MarkerType mkt)
int getMarkerSize (MLssize_t index) const
void setMarkerSize (MLssize_t index, int ms)
Get and set anti aliasing for a given index.
bool getAntiAlias (MLssize_t index) const
void setAntiAlias (MLssize_t index, bool aa)
Get and set the name for a given index.
std::string getName (MLssize_t index) const
void setName (MLssize_t index, const std::string &n)
Get/set number of reserved entries
MLssize_t getReservedEntries () const
void setReservedEntries (MLssize_t reserved)

Static Public Attributes

static const char *const lineStyleNames [lstNumLineStyles]
 Name constants for line styles.
static const char *const markerTypeNames [mktNumMarkerTypes]
 Name constants for marker types.
static const int defaultNumStyles
 Default number of styles (=12)

Protected Member Functions

void clear ()
 Deallocate style definition arrays.
void init (MLssize_t numStyles)
 Allocate style definition arrays.

Detailed Description

Base object class StylePalette for providing a collection of colors, line styles and marker types.

Definition at line 48 of file mlStylePalette.h.


Member Enumeration Documentation

Line style constants.

Enumerator:
lstNone 
lstSolid 
lstDashed 
lstDotted 
lstNumLineStyles 

Definition at line 68 of file mlStylePalette.h.

Marker type constants.

Enumerator:
mktNone 
mktDot 
mktAsterisk 
mktCircle 
mktSquare 
mktTriangle 
mktPlus 
mktCross 
mktNumMarkerTypes 
mktDash 

Special marker type used for error bars.

Definition at line 77 of file mlStylePalette.h.


Constructor & Destructor Documentation

ml::StylePalette::StylePalette ( )
ml::StylePalette::StylePalette ( MLssize_t  numStyles)
ml::StylePalette::StylePalette ( const StylePalette palette)
virtual ml::StylePalette::~StylePalette ( ) [virtual]

Destructor.


Member Function Documentation

virtual void ml::StylePalette::addStateToTree ( TreeNode parent) const [virtual]

Attach the object state as children of the given parent node.

Reimplemented from ml::Base.

void ml::StylePalette::clear ( ) [protected]

Deallocate style definition arrays.

virtual StylePalette* ml::StylePalette::clone ( void  ) const [inline, virtual]

Create a clone of the StylePalette.

Definition at line 187 of file mlStylePalette.h.

void ml::StylePalette::copyStylesFrom ( const StylePalette palette)

Copy style palette from palette.

virtual StylePalette* ml::StylePalette::deepCopy ( ) const [inline, virtual]

Creates a deep copy of the given object.

The default implementation returns a NULL pointer and has to be overloaded by derived classes. It can be used to clone Base objects without knowledge of the exact type of object.

Reimplemented from ml::Base.

Definition at line 188 of file mlStylePalette.h.

void ml::StylePalette::dumpStyles ( )

Dump current style definitions to cout.

bool ml::StylePalette::getAntiAlias ( MLssize_t  index) const
MLssize_t ml::StylePalette::getAutoStyleIndex ( MLssize_t  n)

Get index for automatic style n (>= 1).

Automatic styles cycle through indices in range [1..numStyles-reservedEntries].

void ml::StylePalette::getColor ( MLssize_t  index,
float &  r,
float &  g,
float &  b 
) const
Vector3 ml::StylePalette::getColor ( MLssize_t  index) const
LineStyle ml::StylePalette::getLineStyle ( MLssize_t  index) const
const char* ml::StylePalette::getLineStyleName ( LineStyle  lst) const [inline]

Get name of line style lst.

Definition at line 160 of file mlStylePalette.h.

int ml::StylePalette::getLineWidth ( MLssize_t  index) const
int ml::StylePalette::getMarkerSize ( MLssize_t  index) const
MarkerType ml::StylePalette::getMarkerType ( MLssize_t  index) const
const char* ml::StylePalette::getMarkerTypeName ( MarkerType  mkt) const [inline]

Get name of marker type mkt.

Definition at line 165 of file mlStylePalette.h.

std::string ml::StylePalette::getName ( MLssize_t  index) const
MLssize_t ml::StylePalette::getNumStyles ( ) const [inline]

Definition at line 106 of file mlStylePalette.h.

MLssize_t ml::StylePalette::getReservedEntries ( ) const [inline]

Definition at line 142 of file mlStylePalette.h.

bool ml::StylePalette::getStyleIndexForName ( const std::string  curveTitle,
std::vector< MLssize_t > &  indices 
)

Get style indices using name, writes all matching indices into vector, returns true if at least one was found.

void ml::StylePalette::init ( MLssize_t  numStyles) [protected]

Allocate style definition arrays.

ml::StylePalette::ML_SET_ADDSTATE_VERSION ( )

Sets addState version number.

StylePalette& ml::StylePalette::operator= ( const StylePalette palette)

Assignment operator.

virtual void ml::StylePalette::readStateFromTree ( TreeNode parent) [virtual]

Read the object state from the children of the given parent node.

Reimplemented from ml::Base.

void ml::StylePalette::setAntiAlias ( MLssize_t  index,
bool  aa 
)
void ml::StylePalette::setColor ( MLssize_t  index,
float  r,
float  g,
float  b 
) [inline]

Definition at line 114 of file mlStylePalette.h.

References setColor().

Referenced by setColor().

void ml::StylePalette::setColor ( MLssize_t  index,
const Vector3 color 
)
void ml::StylePalette::setColorDefaults ( )

Set color default values.

void ml::StylePalette::setLineStyle ( MLssize_t  index,
LineStyle  lst 
)
void ml::StylePalette::setLineWidth ( MLssize_t  index,
int  lw 
)
void ml::StylePalette::setMarkerSize ( MLssize_t  index,
int  ms 
)
void ml::StylePalette::setMarkerType ( MLssize_t  index,
MarkerType  mkt 
)
void ml::StylePalette::setMonoDefaults ( )

Set monochrome default values.

void ml::StylePalette::setName ( MLssize_t  index,
const std::string &  n 
)
void ml::StylePalette::setNumStyles ( MLssize_t  newNumStyles)
void ml::StylePalette::setReservedEntries ( MLssize_t  reserved)

Member Data Documentation

Default number of styles (=12)

Definition at line 100 of file mlStylePalette.h.

const char* const ml::StylePalette::lineStyleNames[lstNumLineStyles] [static]

Name constants for line styles.

Definition at line 94 of file mlStylePalette.h.

const char* const ml::StylePalette::markerTypeNames[mktNumMarkerTypes] [static]

Name constants for marker types.

Definition at line 97 of file mlStylePalette.h.


The documentation for this class was generated from the following file: