Tulip  5.2.1
Large graphs analysis and drawing
tlp::GlAxis Class Reference

#include <GlAxis.h>

+ Inheritance diagram for tlp::GlAxis:
+ Collaboration diagram for tlp::GlAxis:

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)
 
GlSimpleEntityfindGlEntity (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 &currentPosition) 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 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 43 of file GlAxis.h.

Constructor & Destructor Documentation

◆ GlAxis()

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

◆ ~GlAxis()

tlp::GlAxis::~GlAxis ( )
override

GlAxis destructor.

Member Function Documentation

◆ addCaption()

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

◆ getAxisBaseCoord()

Coord tlp::GlAxis::getAxisBaseCoord ( ) const
inline

Method which returns the base coordinates of the axis.

Definition at line 73 of file GlAxis.h.

◆ getAxisColor()

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

Method which returns the color of the axis.

Definition at line 123 of file GlAxis.h.

◆ getAxisGradsWidth()

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

Method which returns the width of the axis graduations.

Definition at line 97 of file GlAxis.h.

◆ getAxisLength()

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

Method which returns the length of the axis.

Definition at line 79 of file GlAxis.h.

◆ getAxisName()

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

Method which returns the name of the axis.

Definition at line 85 of file GlAxis.h.

◆ getAxisOrientation()

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

Method which returns the orientation of the axis.

Definition at line 91 of file GlAxis.h.

◆ getLabelHeight()

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

Method which returns the axis graduations labels height.

Definition at line 109 of file GlAxis.h.

◆ getMaxLabelWidth()

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

Method which returns the max axis graduations labels width.

Definition at line 116 of file GlAxis.h.

◆ getSpaceBetweenAxisGrads()

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

Method which returns the distance between the axis graduations.

Definition at line 103 of file GlAxis.h.

◆ setAxisColor()

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

Method to set the axis color.

Definition at line 142 of file GlAxis.h.

◆ setAxisGradsWidth()

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

Methods to set the axis graduations Width.

Definition at line 148 of file GlAxis.h.

◆ setAxisGraduations()

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

◆ setAxisLength()

void tlp::GlAxis::setAxisLength ( const float  axisLength)
inline

Method to set the axis length.

Definition at line 136 of file GlAxis.h.

◆ setAxisName()

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

Method to set the axis name.

Definition at line 130 of file GlAxis.h.

◆ setGradsLabelsHeight()

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

◆ setMaxCaptionWidth()

void tlp::GlAxis::setMaxCaptionWidth ( const float  maxCaptionWidth)
inline

Methods to set the max caption width.

Definition at line 155 of file GlAxis.h.

◆ updateAxis()

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