MeVisLab Toolbox Reference
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

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 Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. More...
 

Public Member Functions

 ~StylePalette () override
 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 chargetLineStyleName (LineStyle lst) const
 Get name of line style lst.
 
const chargetMarkerTypeName (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.
 
void addStateToTree (TreeNode *parent) const override
 Attach the object state as children of the given parent node.
 
void readStateFromTree (TreeNode *parent) override
 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.
 
StylePalettedeepCopy () const override
 Set addStateToTree version number that can be accessed via getAddStateVersion()
 
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)
 
- Public Member Functions inherited from ml::Base
 Base ()
 Constructor.
 
virtual ~Base ()
 Destructor.
 
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
 Check if this object's type is equal to or derived from one of the types given in the argument.
 
virtual bool isRefCountedBase () const
 Returns if the instance is derived from RefCountedBase.
 
virtual std::string detailString () const
 Return a string describing this object.
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class.
 
virtual std::string persistentState () const
 Returns a string describing the object's internal state.
 
virtual void setPersistentState (const std::string &state)
 Restores the object's internal state from a string that had been previously generated using persistentState().
 
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Write the objects state to the data stream object.
 
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Read the objects state from the data stream object.
 

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 44 of file mlStylePalette.h.

Member Enumeration Documentation

◆ LineStyle

Line style constants.

Enumerator
lstNone 
lstSolid 
lstDashed 
lstDotted 
lstNumLineStyles 

Definition at line 64 of file mlStylePalette.h.

◆ MarkerType

Marker type constants.

Enumerator
mktNone 
mktDot 
mktAsterisk 
mktCircle 
mktSquare 
mktTriangle 
mktPlus 
mktCross 
mktNumMarkerTypes 
mktDash 

Special marker type used for error bars.

Definition at line 73 of file mlStylePalette.h.

Constructor & Destructor Documentation

◆ StylePalette() [1/3]

ml::StylePalette::StylePalette ( )

◆ StylePalette() [2/3]

ml::StylePalette::StylePalette ( MLssize_t numStyles)

◆ StylePalette() [3/3]

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

◆ ~StylePalette()

ml::StylePalette::~StylePalette ( )
override

Destructor.

Member Function Documentation

◆ addStateToTree()

void ml::StylePalette::addStateToTree ( TreeNode * parent) const
overridevirtual

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

Reimplemented from ml::Base.

◆ clear()

void ml::StylePalette::clear ( )
protected

Deallocate style definition arrays.

◆ clone()

virtual StylePalette * ml::StylePalette::clone ( ) const
inlinevirtual

Create a clone of the StylePalette.

Definition at line 183 of file mlStylePalette.h.

◆ copyStylesFrom()

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

Copy style palette from palette.

◆ deepCopy()

StylePalette * ml::StylePalette::deepCopy ( ) const
inlineoverridevirtual

Set addStateToTree version number that can be accessed via getAddStateVersion()

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 184 of file mlStylePalette.h.

◆ dumpStyles()

void ml::StylePalette::dumpStyles ( )

Dump current style definitions to cout.

◆ getAntiAlias()

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

◆ getAutoStyleIndex()

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].

◆ getColor() [1/2]

Vector3 ml::StylePalette::getColor ( MLssize_t index) const

◆ getColor() [2/2]

void ml::StylePalette::getColor ( MLssize_t index,
float & r,
float & g,
float & b ) const

◆ getLineStyle()

LineStyle ml::StylePalette::getLineStyle ( MLssize_t index) const

◆ getLineStyleName()

const char * ml::StylePalette::getLineStyleName ( LineStyle lst) const
inline

Get name of line style lst.

Definition at line 156 of file mlStylePalette.h.

References mlrange_cast().

◆ getLineWidth()

int ml::StylePalette::getLineWidth ( MLssize_t index) const

◆ getMarkerSize()

int ml::StylePalette::getMarkerSize ( MLssize_t index) const

◆ getMarkerType()

MarkerType ml::StylePalette::getMarkerType ( MLssize_t index) const

◆ getMarkerTypeName()

const char * ml::StylePalette::getMarkerTypeName ( MarkerType mkt) const
inline

Get name of marker type mkt.

Definition at line 161 of file mlStylePalette.h.

References mlrange_cast().

◆ getName()

std::string ml::StylePalette::getName ( MLssize_t index) const

◆ getNumStyles()

MLssize_t ml::StylePalette::getNumStyles ( ) const
inline

Definition at line 102 of file mlStylePalette.h.

◆ getReservedEntries()

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

Definition at line 138 of file mlStylePalette.h.

◆ getStyleIndexForName()

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.

◆ init()

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

Allocate style definition arrays.

◆ ML_SET_ADDSTATE_VERSION()

ml::StylePalette::ML_SET_ADDSTATE_VERSION ( 0 )

Sets addState version number.

◆ operator=()

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

Assignment operator.

◆ readStateFromTree()

void ml::StylePalette::readStateFromTree ( TreeNode * parent)
overridevirtual

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

Reimplemented from ml::Base.

◆ setAntiAlias()

void ml::StylePalette::setAntiAlias ( MLssize_t index,
bool aa )

◆ setColor() [1/2]

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

◆ setColor() [2/2]

void ml::StylePalette::setColor ( MLssize_t index,
float r,
float g,
float b )
inline

Definition at line 110 of file mlStylePalette.h.

References setColor().

Referenced by setColor().

◆ setColorDefaults()

void ml::StylePalette::setColorDefaults ( )

Set color default values.

◆ setLineStyle()

void ml::StylePalette::setLineStyle ( MLssize_t index,
LineStyle lst )

◆ setLineWidth()

void ml::StylePalette::setLineWidth ( MLssize_t index,
int lw )

◆ setMarkerSize()

void ml::StylePalette::setMarkerSize ( MLssize_t index,
int ms )

◆ setMarkerType()

void ml::StylePalette::setMarkerType ( MLssize_t index,
MarkerType mkt )

◆ setMonoDefaults()

void ml::StylePalette::setMonoDefaults ( )

Set monochrome default values.

◆ setName()

void ml::StylePalette::setName ( MLssize_t index,
const std::string & n )

◆ setNumStyles()

void ml::StylePalette::setNumStyles ( MLssize_t newNumStyles)

◆ setReservedEntries()

void ml::StylePalette::setReservedEntries ( MLssize_t reserved)

Member Data Documentation

◆ defaultNumStyles

const int ml::StylePalette::defaultNumStyles
static

Default number of styles (=12)

Definition at line 96 of file mlStylePalette.h.

◆ lineStyleNames

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

Name constants for line styles.

Definition at line 90 of file mlStylePalette.h.

◆ markerTypeNames

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

Name constants for marker types.

Definition at line 93 of file mlStylePalette.h.


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