A base class to draw an axis with graduations.
More...
#include <GlAxis.h>
List of all members.
Public Types
Public Member Functions
- GlAxis (const std::string &axisName, const Coord &axisBaseCoord, const float axisLength, const AxisOrientation &axisOrientation, const Color &axisColor, const float axisWidth=10)
- virtual ~GlAxis ()
- Coord getAxisBaseCoord () const
- float getAxisLength () const
- std::string getAxisName () const
- AxisOrientation getAxisOrientation () const
- float getAxisGradsWidth () const
- float getSpaceBetweenAxisGrads () const
- float getLabelHeight () const
- float getMaxLabelWidth () const
- Color getAxisColor () const
- void setAxisName (const std::string &axisName)
- void setAxisLength (const float axisLength)
- void setAxisColor (const Color &axisColor)
- void setAxisGradsWidth (const float axisGradsWidth)
- void setMaxCaptionWidth (const float maxCaptionWidth)
- virtual void updateAxis ()
- void setAxisGraduations (const std::vector< std::string > &axisGradsLabels, const LabelPosition &axisGradsLabelsPosition=LEFT_OR_BELOW)
- void setAxisGraduationsMaxLabelWidth (const float maxWidth)
- void addCaption (const LabelPosition &captionPos, const float captionHeight, const bool captionFrame=false, const float maxCaptionWidth=0, const float captionOffset=0, const std::string caption="")
- void translate (const Coord &c)
Protected Member Functions
Protected Attributes
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
Member Enumeration Documentation
- Enumerator:
HORIZONTAL_AXIS |
|
VERTICAL_AXIS |
|
- Enumerator:
LEFT_OR_BELOW |
|
RIGHT_OR_ABOVE |
|
Constructor & Destructor Documentation
tlp::GlAxis::GlAxis |
( |
const std::string & |
axisName, |
|
|
const Coord & |
axisBaseCoord, |
|
|
const float |
axisLength, |
|
|
const AxisOrientation & |
axisOrientation, |
|
|
const Color & |
axisColor, |
|
|
const float |
axisWidth = 10 |
|
) |
| |
GlAxis constructor
- Parameters:
-
axisName | the name of the axis |
axisBaseCoord | the base coord of the axis (if the axis is horizontal, it is the the left end, if vertical it is the down end) |
axisLength | the length of the axis |
axisOrientation | the orientation of the axis, 2 possible values (HORIZONTAL_AXIS or VERTICAL_AXIS) |
axisColor | the color of the axis |
virtual tlp::GlAxis::~GlAxis |
( |
| ) |
[virtual] |
Member Function Documentation
void tlp::GlAxis::addAxisCaption |
( |
const Coord & |
captionLabelCenter, |
|
|
const bool |
captionFrame |
|
) |
| [protected] |
void tlp::GlAxis::addCaption |
( |
const LabelPosition & |
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:
-
captionPos | the 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 |
captionHeight | the caption text height |
captionFrame | if true the caption will be framed |
maxCaptionWidth | fill this parameter if you want to restrain the caption width |
captionOffset | fill this parameter if you want to fix the offset between the axis and the caption |
caption | if this parameter is filled, use this value as caption text, otherwise the caption text will be the axis name |
void tlp::GlAxis::computeBoundingBox |
( |
| ) |
[protected] |
virtual Coord tlp::GlAxis::computeCaptionCenter |
( |
| ) |
[protected, virtual] |
virtual void tlp::GlAxis::computeCaptionSize |
( |
float |
height | ) |
[protected, virtual] |
Coord tlp::GlAxis::getAxisBaseCoord |
( |
| ) |
const [inline] |
Method which returns the base coordinates of the axis
Color tlp::GlAxis::getAxisColor |
( |
| ) |
const [inline] |
Method which returns the color of the axis
float tlp::GlAxis::getAxisGradsWidth |
( |
| ) |
const [inline] |
Method which returns the width of the axis graduations
float tlp::GlAxis::getAxisLength |
( |
| ) |
const [inline] |
Method which returns the length of the axis
std::string tlp::GlAxis::getAxisName |
( |
| ) |
const [inline] |
Method which returns the name of the axis
Method which returns the orientation of the axis
float tlp::GlAxis::getLabelHeight |
( |
| ) |
const [inline] |
Method which returns the axis graduations labels height
float tlp::GlAxis::getMaxLabelWidth |
( |
| ) |
const [inline] |
Method which returns the max axis graduations labels width
float tlp::GlAxis::getSpaceBetweenAxisGrads |
( |
| ) |
const [inline] |
Method which returns the distance between the axis graduations
void tlp::GlAxis::setAxisColor |
( |
const Color & |
axisColor | ) |
[inline] |
Method to set the axis color
void tlp::GlAxis::setAxisGradsWidth |
( |
const float |
axisGradsWidth | ) |
[inline] |
Methods to set the axis graduations Width
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:
-
axisGradsLabels | the labels of the graduations, they will be equally spaced on the axis |
axisGradsLabelsPosition | the 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::setAxisGraduationsMaxLabelWidth |
( |
const float |
maxWidth | ) |
[inline] |
void tlp::GlAxis::setAxisLength |
( |
const float |
axisLength | ) |
[inline] |
Method to set the axis length
void tlp::GlAxis::setAxisName |
( |
const std::string & |
axisName | ) |
[inline] |
Method to set the axis name
void tlp::GlAxis::setMaxCaptionWidth |
( |
const float |
maxCaptionWidth | ) |
[inline] |
Methods to set the max caption width
void tlp::GlAxis::translate |
( |
const Coord & |
mouvement | ) |
[virtual] |
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
Reimplemented in tlp::GlNominativeAxis, and tlp::GlQuantitativeAxis.
Member Data Documentation
|