Tulip
5.2.1
Large graphs analysis and drawing
|
#include <GlAxis.h>
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) | |
~GlAxis () override | |
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) override |
virtual void | updateAxis () |
Public Member Functions inherited from tlp::GlComposite | |
GlComposite (bool deleteComponentsInDestructor=true) | |
~GlComposite () override | |
void | addGlEntity (GlSimpleEntity *entity, const std::string &key) |
void | deleteGlEntity (const std::string &key, bool informTheEntity=true) |
void | deleteGlEntity (GlSimpleEntity *entity, bool informTheEntity=true) |
GlSimpleEntity * | findGlEntity (const std::string &key) |
std::string | findKey (GlSimpleEntity *entity) |
const std::map< std::string, GlSimpleEntity * > & | getGlEntities () const |
void | getXML (std::string &outString) override |
void | reset (bool deleteElems) |
void | setDeleteComponentsInDestructor (bool deleteComponentsInDestructor) |
void | setStencil (int stencil) override |
void | setWithXML (const std::string &inString, unsigned int ¤tPosition) override |
void | translate (const Coord &mouvement) override |
Public Member Functions inherited from tlp::GlSimpleEntity | |
GlSimpleEntity () | |
~GlSimpleEntity () override | |
virtual void | draw (float lod, Camera *camera)=0 |
virtual BoundingBox | getBoundingBox () |
int | getStencil () |
bool | isVisible () const |
virtual void | setVisible (bool visible) |
Protected Attributes | |
Coord | axisBaseCoord |
Color | axisColor |
LabelPosition | axisGradsPosition |
float | axisGradsWidth |
float | axisLength |
GlComposite * | axisLinesComposite |
std::string | axisName |
AxisOrientation | axisOrientation |
float | baseCaptionHeight |
GlComposite * | captionComposite |
bool | captionFrame |
float | captionHeight |
GlLabel * | captionLabel |
float | captionOffset |
CaptionLabelPosition | captionPosition |
bool | captionSet |
std::string | captionText |
float | captionWidth |
GlComposite * | gradsComposite |
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 |
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
tlp::GlAxis::GlAxis | ( | const std::string & | axisName, |
const Coord & | axisBaseCoord, | ||
const float | axisLength, | ||
const AxisOrientation & | axisOrientation, | ||
const Color & | axisColor | ||
) |
GlAxis constructor.
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 |
|
override |
GlAxis destructor.
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.
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 |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
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.
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 |
|
inline |
|
inline |
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
height | the height for labels |
|
inline |
|
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