cee::vis::OverlayCategoryLegend Class Reference

A color legend used to indicate the interpretation of the colors in the model. More...

Public Types

enum  TickMarksPosition {
  LEFT, RIGHT, TOP, BOTTOM,
  FOLLOW_LAYOUT
}
 Position of the legend tick marks. More...
 
enum  Direction { HORIZONTAL, VERTICAL }
 Direction of color legend bar. More...
 
- Public Types inherited from cee::vis::OverlayItem
enum  LayoutCorner {
  TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT,
  CENTER, TOP_CENTER, BOTTOM_CENTER
}
 Enumerator for the different locations/"corners" of the view. More...
 
enum  LayoutDirection { HORIZONTAL, VERTICAL, ABSOLUTE_POSITION }
 Enumerator for horizontal or vertical orientation of layout items. Describes which direction additional items should be positioned if more than one exists in the same corner. More...
 

Public Member Functions

 OverlayCategoryLegend ()
 Constructs an overlay category legend. More...
 
 OverlayCategoryLegend (Font *titleFont, Font *categoryFont)
 Constructs an overlay category legend with custom fonts. More...
 
virtual unsigned int width () const
 Returns the total width of the overlay item. More...
 
virtual unsigned int height () const
 Returns the total height of the overlay item. More...
 
virtual int priority () const
 Returns the render priority of the item. More...
 
virtual void setPriority (int priority)
 Sets render priority of the item. More...
 
void setSize (unsigned int width, unsigned int height)
 Sets the size of the legend, in pixels. More...
 
void setWidthToFitText ()
 Sets the width of the legend to fit the current text. More...
 
size_t categoryCount () const
 Returns the number of categories. More...
 
Str categoryText (size_t index) const
 Returns the text/label for the category with the given index. More...
 
Color3f categoryColor (size_t index) const
 Returns the color of the category with the given index. More...
 
void addCategory (const Str &text, Color3f color)
 Adds a category (label & color) to the legend. More...
 
void removeAllCategories ()
 Removes all categories from the legend. More...
 
Str title () const
 Returns the title of the legend. More...
 
void setTitle (const Str &title)
 Sets the title of the legend. More...
 
Color3f textColor () const
 Returns the text color. More...
 
void setTextColor (const Color3f &color)
 Sets the text color for the category labels. Also sets the border color for the category bar. More...
 
TickMarksPosition tickMarksPosition () const
 Returns if the labels are drawn on the left side, right side or automatically based on view layout. More...
 
void setTickMarksPosition (TickMarksPosition position)
 If set to true, the category colors will be drawn on the right side and the text will be right aligned on the left side. More...
 
Direction direction () const
 Returns the direction of the color legend bar. More...
 
void setDirection (Direction direction)
 Sets the direction of the color legend bar. More...
 
- Public Member Functions inherited from cee::vis::OverlayItem
bool visible () const
 Returns true if the overlay item is set to be visible. More...
 
void setVisible (bool visible)
 Sets if the overlay item should be visible or not. More...
 
int absolutePositionX () const
 Returns the x coordinate of the absolute position to use for the OverlayItem if LayoutDirection is specified as ABSOLUTE_POSITION. More...
 
int absolutePositionY () const
 Returns the y coordinate of the absolute position to use for the OverlayItem if LayoutDirection is specified as ABSOLUTE_POSITION. More...
 
void setAbsolutePosition (int x, int y)
 Sets the absolute position of the bottom left corner of the OverlayItem as an offset from the LayoutCorner of the item. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 
Inheritance diagram for cee::vis::OverlayCategoryLegend:
cee::vis::OverlayItem cee::RefCountedObject

Detailed Description

A color legend used to indicate the interpretation of the colors in the model.

For instance, a part color legend.

Any number of combinations of label and color can be specified.

See also
OverlayItem
View

Member Enumeration Documentation

Direction of color legend bar.

Enumerator
HORIZONTAL 

Draw horizontal color legend bar.

VERTICAL 

Draw vertical color legend bar.

Position of the legend tick marks.

Enumerator
LEFT 

Draw tick marks on the left side of the color legend.

RIGHT 

Draw tick marks on the right side of the color legend.

TOP 

Draw tick marks above the color legend.

BOTTOM 

Draw tick marks below the color legend.

FOLLOW_LAYOUT 

Automatically position the tick marks left or right based on the color legend's alignment in the view.

Constructor & Destructor Documentation

cee::vis::OverlayCategoryLegend::OverlayCategoryLegend ( )

Constructs an overlay category legend.

cee::vis::OverlayCategoryLegend::OverlayCategoryLegend ( Font titleFont,
Font categoryFont 
)

Constructs an overlay category legend with custom fonts.

Member Function Documentation

void cee::vis::OverlayCategoryLegend::addCategory ( const Str text,
Color3f  color 
)

Adds a category (label & color) to the legend.

cee::Color3f cee::vis::OverlayCategoryLegend::categoryColor ( size_t  index) const

Returns the color of the category with the given index.

size_t cee::vis::OverlayCategoryLegend::categoryCount ( ) const

Returns the number of categories.

cee::Str cee::vis::OverlayCategoryLegend::categoryText ( size_t  index) const

Returns the text/label for the category with the given index.

cee::vis::OverlayCategoryLegend::Direction cee::vis::OverlayCategoryLegend::direction ( ) const

Returns the direction of the color legend bar.

unsigned int cee::vis::OverlayCategoryLegend::height ( ) const
virtual

Returns the total height of the overlay item.

Implements cee::vis::OverlayItem.

int cee::vis::OverlayCategoryLegend::priority ( ) const
virtual

Returns the render priority of the item.

Implements cee::vis::OverlayItem.

void cee::vis::OverlayCategoryLegend::removeAllCategories ( )

Removes all categories from the legend.

void cee::vis::OverlayCategoryLegend::setDirection ( Direction  direction)

Sets the direction of the color legend bar.

void cee::vis::OverlayCategoryLegend::setPriority ( int  priority)
virtual

Sets render priority of the item.

The render priority determines the order in which item get rendered. Items with lower priorities get rendered first. The default priority is 10.

Implements cee::vis::OverlayItem.

void cee::vis::OverlayCategoryLegend::setSize ( unsigned int  width,
unsigned int  height 
)
virtual

Sets the size of the legend, in pixels.

Implements cee::vis::OverlayItem.

void cee::vis::OverlayCategoryLegend::setTextColor ( const Color3f color)

Sets the text color for the category labels. Also sets the border color for the category bar.

void cee::vis::OverlayCategoryLegend::setTickMarksPosition ( TickMarksPosition  position)

If set to true, the category colors will be drawn on the right side and the text will be right aligned on the left side.

void cee::vis::OverlayCategoryLegend::setTitle ( const Str title)

Sets the title of the legend.

Multiple lines can be specified by using the '\n' separator

void cee::vis::OverlayCategoryLegend::setWidthToFitText ( )

Sets the width of the legend to fit the current text.

cee::Color3f cee::vis::OverlayCategoryLegend::textColor ( ) const

Returns the text color.

cee::vis::OverlayCategoryLegend::TickMarksPosition cee::vis::OverlayCategoryLegend::tickMarksPosition ( ) const

Returns if the labels are drawn on the left side, right side or automatically based on view layout.

cee::Str cee::vis::OverlayCategoryLegend::title ( ) const

Returns the title of the legend.

unsigned int cee::vis::OverlayCategoryLegend::width ( ) const
virtual

Returns the total width of the overlay item.

Implements cee::vis::OverlayItem.