Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
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="")
 
const Coord & getAxisBaseCoord () const
 
Color getAxisColor () const
 
float getAxisGradsWidth () const
 
float getAxisLength () const
 
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 ()
 
virtual void getXML (std::string &outString)=0
 
bool isVisible () const
 
virtual void setStencil (int stencil)
 
virtual void setVisible (bool visible)
 
virtual void setWithXML (const std::string &inString, unsigned int &currentPosition)=0
 

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.

Member Enumeration Documentation

◆ AxisOrientation

enum tlp::GlAxis::AxisOrientation

Definition at line 46 of file GlAxis.h.

◆ CaptionLabelPosition

enum tlp::GlAxis::CaptionLabelPosition

Definition at line 49 of file GlAxis.h.

◆ LabelPosition

enum tlp::GlAxis::LabelPosition

Definition at line 48 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()

const 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()

const 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

◆ setAxisGraduationsMaxLabelWidth()

void tlp::GlAxis::setAxisGraduationsMaxLabelWidth ( const float  maxWidth)
inline

Definition at line 181 of file GlAxis.h.

◆ 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

Member Data Documentation

◆ axisBaseCoord

Coord tlp::GlAxis::axisBaseCoord
protected

Definition at line 230 of file GlAxis.h.

◆ axisColor

Color tlp::GlAxis::axisColor
protected

Definition at line 234 of file GlAxis.h.

◆ axisGradsPosition

LabelPosition tlp::GlAxis::axisGradsPosition
protected

Definition at line 233 of file GlAxis.h.

◆ axisGradsWidth

float tlp::GlAxis::axisGradsWidth
protected

Definition at line 235 of file GlAxis.h.

◆ axisLength

float tlp::GlAxis::axisLength
protected

Definition at line 231 of file GlAxis.h.

◆ axisLinesComposite

GlComposite* tlp::GlAxis::axisLinesComposite
protected

Definition at line 245 of file GlAxis.h.

◆ axisName

std::string tlp::GlAxis::axisName
protected

Definition at line 229 of file GlAxis.h.

◆ axisOrientation

AxisOrientation tlp::GlAxis::axisOrientation
protected

Definition at line 232 of file GlAxis.h.

◆ baseCaptionHeight

float tlp::GlAxis::baseCaptionHeight
protected

Definition at line 239 of file GlAxis.h.

◆ captionComposite

GlComposite* tlp::GlAxis::captionComposite
protected

Definition at line 246 of file GlAxis.h.

◆ captionFrame

bool tlp::GlAxis::captionFrame
protected

Definition at line 240 of file GlAxis.h.

◆ captionHeight

float tlp::GlAxis::captionHeight
protected

Definition at line 238 of file GlAxis.h.

◆ captionLabel

GlLabel* tlp::GlAxis::captionLabel
protected

Definition at line 242 of file GlAxis.h.

◆ captionOffset

float tlp::GlAxis::captionOffset
protected

Definition at line 244 of file GlAxis.h.

◆ captionPosition

CaptionLabelPosition tlp::GlAxis::captionPosition
protected

Definition at line 250 of file GlAxis.h.

◆ captionSet

bool tlp::GlAxis::captionSet
protected

Definition at line 249 of file GlAxis.h.

◆ captionText

std::string tlp::GlAxis::captionText
protected

Definition at line 241 of file GlAxis.h.

◆ captionWidth

float tlp::GlAxis::captionWidth
protected

Definition at line 237 of file GlAxis.h.

◆ gradsComposite

GlComposite* tlp::GlAxis::gradsComposite
protected

Definition at line 247 of file GlAxis.h.

◆ gradsLabelsVector

std::vector<GlLabel *> tlp::GlAxis::gradsLabelsVector
protected

Definition at line 248 of file GlAxis.h.

◆ labelHeight

float tlp::GlAxis::labelHeight
protected

Definition at line 243 of file GlAxis.h.

◆ maxCaptionWidth

float tlp::GlAxis::maxCaptionWidth
protected

Definition at line 251 of file GlAxis.h.

◆ maxGraduationLabelWidth

float tlp::GlAxis::maxGraduationLabelWidth
protected

Definition at line 252 of file GlAxis.h.

◆ spaceBetweenAxisGrads

float tlp::GlAxis::spaceBetweenAxisGrads
protected

Definition at line 236 of file GlAxis.h.