Tulip  4.0.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
tlp::GlAxis Class Reference

#include <GlAxis.h>

Inherits tlp::GlComposite.

Public Types

enum  AxisOrientation { HORIZONTAL_AXIS, VERTICAL_AXIS }
 
enum  CaptionLabelPosition { LEFT, RIGHT, BELOW, ABOVE }
 
enum  LabelPosition { LEFT_OR_BELOW, RIGHT_OR_ABOVE }
 

Public Member Functions

 GlAxis (const std::string &axisName, const Coord &axisBaseCoord, const float axisLength, const AxisOrientation &axisOrientation, const Color &axisColor)
 
virtual ~GlAxis ()
 
void addCaption (const CaptionLabelPosition &captionPos, const float captionHeight, const bool captionFrame=false, const float maxCaptionWidth=0, const float captionOffset=0, const std::string caption="")
 
Coord getAxisBaseCoord () const
 
Color getAxisColor () const
 
float getAxisGradsWidth () const
 
float getAxisLength () const
 
std::string getAxisName () const
 
AxisOrientation getAxisOrientation () const
 
float getCaptionHeight () const
 
float getLabelHeight () const
 
float getMaxLabelWidth () const
 
float getSpaceBetweenAxisGrads () const
 
void setAxisColor (const Color &axisColor)
 
void setAxisGradsWidth (const float axisGradsWidth)
 
void setAxisGraduations (const std::vector< std::string > &axisGradsLabels, const LabelPosition &axisGradsLabelsPosition=LEFT_OR_BELOW)
 
void setAxisGraduationsMaxLabelWidth (const float maxWidth)
 
void setAxisLength (const float axisLength)
 
void setAxisName (const std::string &axisName)
 
void setCaptionHeight (float height, bool frame)
 
void setGradsLabelsHeight (float height)
 
void setMaxCaptionWidth (const float maxCaptionWidth)
 
void translate (const Coord &c)
 
virtual void updateAxis ()
 
- Public Member Functions inherited from tlp::GlComposite
 GlComposite (bool deleteComponentsInDestructor=true)
 
 ~GlComposite ()
 
void addGlEntity (GlSimpleEntity *entity, const std::string &key)
 
void deleteGlEntity (const std::string &key, bool informTheEntity=true)
 
void deleteGlEntity (GlSimpleEntity *entity, bool informTheEntity=true)
 
GlSimpleEntityfindGlEntity (const std::string &key)
 
std::string findKey (GlSimpleEntity *entity)
 
const std::map< std::string,
GlSimpleEntity * > & 
getGlEntities () const
 
virtual void getXML (std::string &outString)
 
void reset (bool deleteElems)
 
void setDeleteComponentsInDestructor (bool deleteComponentsInDestructor)
 
virtual void setStencil (int stencil)
 
virtual void setWithXML (const std::string &inString, unsigned int &currentPosition)
 
- Public Member Functions inherited from tlp::GlSimpleEntity
 GlSimpleEntity ()
 
virtual ~GlSimpleEntity ()
 
virtual void draw (float lod, Camera *camera)=0
 
virtual BoundingBox getBoundingBox ()
 
int getStencil ()
 
bool isVisible () const
 
virtual void setVisible (bool visible)
 

Protected Member Functions

void addAxisCaption (const Coord &captionLabelCenter, const bool captionFrame)
 
void computeBoundingBox ()
 
virtual Coord computeCaptionCenter (const bool captionFrame)
 
virtual void computeCaptionSize (float height)
 

Protected Attributes

Coord axisBaseCoord
 
Color axisColor
 
LabelPosition axisGradsPosition
 
float axisGradsWidth
 
float axisLength
 
GlCompositeaxisLinesComposite
 
std::string axisName
 
AxisOrientation axisOrientation
 
float baseCaptionHeight
 
GlCompositecaptionComposite
 
bool captionFrame
 
float captionHeight
 
GlLabelcaptionLabel
 
float captionOffset
 
CaptionLabelPosition captionPosition
 
bool captionSet
 
std::string captionText
 
float captionWidth
 
GlCompositegradsComposite
 
std::vector< GlLabel * > gradsLabelsVector
 
float labelHeight
 
float maxCaptionWidth
 
float maxGraduationLabelWidth
 
float spaceBetweenAxisGrads
 
- Protected Attributes inherited from tlp::GlComposite
std::list< GlSimpleEntity * > _sortedElements
 
bool deleteComponentsInDestructor
 
std::map< std::string,
GlSimpleEntity * > 
elements
 
std::vector< GlLayer * > layerParents
 
- Protected Attributes inherited from tlp::GlSimpleEntity
BoundingBox boundingBox
 
std::vector< GlComposite * > parents
 
int stencil
 
bool visible
 

Detailed Description

A base class to draw an axis with graduations.

This class allow to render an axis with graduations. This class is there for code factorisation and should not be used directly. Use derivated classes instead : GlQuantitativeAxis for a numerical graduated axis and GlNominativeAxis for a string graduated axis

Definition at line 42 of file GlAxis.h.

Constructor & Destructor Documentation

tlp::GlAxis::GlAxis ( const std::string &  axisName,
const Coord &  axisBaseCoord,
const float  axisLength,
const AxisOrientation &  axisOrientation,
const Color &  axisColor 
)

GlAxis constructor.

Parameters
axisNamethe name of the axis
axisBaseCoordthe base coord of the axis (if the axis is horizontal, it is the the left end, if vertical it is the down end)
axisLengththe length of the axis
axisOrientationthe orientation of the axis, 2 possible values (HORIZONTAL_AXIS or VERTICAL_AXIS)
axisColorthe color of the axis
virtual tlp::GlAxis::~GlAxis ( )
virtual

GlAxis destructor.

Member Function Documentation

void tlp::GlAxis::addCaption ( const CaptionLabelPosition &  captionPos,
const float  captionHeight,
const bool  captionFrame = false,
const float  maxCaptionWidth = 0,
const float  captionOffset = 0,
const std::string  caption = "" 
)

Method which adds a caption to the axis. No need to call updateAxis after calling this method.

Parameters
captionPosthe relative position of the caption. Two possible values : LEFT_OR_BELOW (if the axis is vertical, caption will be below of the axis, otherwise on the left) or RIGHT_OR_ABOVE
captionHeightthe caption text height
captionFrameif true the caption will be framed
maxCaptionWidthfill this parameter if you want to restrain the caption width
captionOffsetfill this parameter if you want to fix the offset between the axis and the caption
captionif this parameter is filled, use this value as caption text, otherwise the caption text will be the axis name
Coord tlp::GlAxis::getAxisBaseCoord ( ) const
inline

Method which returns the base coordinates of the axis.

Definition at line 71 of file GlAxis.h.

Color tlp::GlAxis::getAxisColor ( ) const
inline

Method which returns the color of the axis.

Definition at line 121 of file GlAxis.h.

float tlp::GlAxis::getAxisGradsWidth ( ) const
inline

Method which returns the width of the axis graduations.

Definition at line 95 of file GlAxis.h.

float tlp::GlAxis::getAxisLength ( ) const
inline

Method which returns the length of the axis.

Definition at line 77 of file GlAxis.h.

std::string tlp::GlAxis::getAxisName ( ) const
inline

Method which returns the name of the axis.

Definition at line 83 of file GlAxis.h.

AxisOrientation tlp::GlAxis::getAxisOrientation ( ) const
inline

Method which returns the orientation of the axis.

Definition at line 89 of file GlAxis.h.

float tlp::GlAxis::getLabelHeight ( ) const
inline

Method which returns the axis graduations labels height.

Definition at line 107 of file GlAxis.h.

float tlp::GlAxis::getMaxLabelWidth ( ) const
inline

Method which returns the max axis graduations labels width.

Definition at line 114 of file GlAxis.h.

float tlp::GlAxis::getSpaceBetweenAxisGrads ( ) const
inline

Method which returns the distance between the axis graduations.

Definition at line 101 of file GlAxis.h.

void tlp::GlAxis::setAxisColor ( const Color &  axisColor)
inline

Method to set the axis color.

Definition at line 140 of file GlAxis.h.

void tlp::GlAxis::setAxisGradsWidth ( const float  axisGradsWidth)
inline

Methods to set the axis graduations Width.

Definition at line 146 of file GlAxis.h.

void tlp::GlAxis::setAxisGraduations ( const std::vector< std::string > &  axisGradsLabels,
const LabelPosition &  axisGradsLabelsPosition = LEFT_OR_BELOW 
)

Method to set the axis graduations. No need to call updateAxis after calling this method.

Parameters
axisGradsLabelsthe labels of the graduations, they will be equally spaced on the axis
axisGradsLabelsPositionthe relative position of the axis graduations label. Two possible values : LEFT_OR_BELOW (if the axis is horizontal, labels will be on the left of the axis, otherwise below) or RIGHT_OR_ABOVE
void tlp::GlAxis::setAxisLength ( const float  axisLength)
inline

Method to set the axis length.

Definition at line 134 of file GlAxis.h.

void tlp::GlAxis::setAxisName ( const std::string &  axisName)
inline

Method to set the axis name.

Definition at line 128 of file GlAxis.h.

void tlp::GlAxis::setGradsLabelsHeight ( float  height)

Method to set the axis graduations labels size.

This method can be used if you want axis with same labels size

Parameters
heightthe height for labels
void tlp::GlAxis::setMaxCaptionWidth ( const float  maxCaptionWidth)
inline

Methods to set the max caption width.

Definition at line 153 of file GlAxis.h.

void tlp::GlAxis::translate ( const Coord &  mouvement)
virtual

translate the composite with children

Reimplemented from tlp::GlComposite.

virtual void tlp::GlAxis::updateAxis ( )
virtual

Method to update the axis drawing.

It has to be called when one (ore more) of the setters methods above has been used This method erase the whole axis drawing and redraw the axis line and the caption (if any) The axis graduations have to be reset by calling setAxisGraduations