Tulip  4.6.0
Better Visualization Through Research
tlp::GlAxis Class Reference

#include <GlAxis.h>

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

List of all members.

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

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

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

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 72 of file GlAxis.h.

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

Method which returns the color of the axis.

Definition at line 122 of file GlAxis.h.

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

Method which returns the width of the axis graduations.

Definition at line 96 of file GlAxis.h.

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

Method which returns the length of the axis.

Definition at line 78 of file GlAxis.h.

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

Method which returns the name of the axis.

Definition at line 84 of file GlAxis.h.

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

Method which returns the orientation of the axis.

Definition at line 90 of file GlAxis.h.

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

Method which returns the axis graduations labels height.

Definition at line 108 of file GlAxis.h.

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

Method which returns the max axis graduations labels width.

Definition at line 115 of file GlAxis.h.

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

Method which returns the distance between the axis graduations.

Definition at line 102 of file GlAxis.h.

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

Method to set the axis color.

Definition at line 141 of file GlAxis.h.

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

Methods to set the axis graduations Width.

Definition at line 147 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 135 of file GlAxis.h.

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

Method to set the axis name.

Definition at line 129 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 154 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

 All Classes Files Functions Variables Enumerations Enumerator Properties