tlp::GlAxis(3) A base class to draw an axis with graduations.

SYNOPSIS


#include <GlAxis.h>

Inherits tlp::GlComposite.

Inherited by tlp::GlNominativeAxis, and tlp::GlQuantitativeAxis.

Public Types


enum AxisOrientation { HORIZONTAL_AXIS, VERTICAL_AXIS }

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

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


void computeBoundingBox ()

virtual Coord computeCaptionCenter ()

virtual void computeCaptionSize (float height)

void addAxisCaption (const Coord &captionLabelCenter, const bool captionFrame)

Protected Attributes


std::string axisName

Coord axisBaseCoord

float axisLength

AxisOrientation axisOrientation

Color axisColor

float axisGradsWidth

float spaceBetweenAxisGrads

float captionWidth

float captionHeight

bool captionFrame

std::string captionText

float labelHeight

float captionOffset

GlComposite * axisLinesComposite

GlComposite * captionComposite

GlComposite * gradsComposite

bool captionSet

LabelPosition captionPosition

float maxCaptionWidth

float maxGraduationLabelWidth

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

enum tlp::GlAxis::AxisOrientation

Enumerator:

HORIZONTAL_AXIS
VERTICAL_AXIS

enum tlp::GlAxis::LabelPosition

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)GlAxis constructor

Parameters:

axisName the name of the axis the base coord of the axis (if the axis is horizontal, it is the the left end, if vertical it is the down end) the length of the axis the orientation of the axis, 2 possible values (HORIZONTAL_AXIS or VERTICAL_AXIS) the color of the axis

virtual tlp::GlAxis::~GlAxis () [virtual]GlAxis destructor

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

AxisOrientation tlp::GlAxis::getAxisOrientation () const [inline]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::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]translate the composite with children

Reimplemented from tlp::GlComposite.

Reimplemented in tlp::GlNominativeAxis.

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

Coord tlp::GlAxis::axisBaseCoord [protected]

Color tlp::GlAxis::axisColor [protected]

float tlp::GlAxis::axisGradsWidth [protected]

float tlp::GlAxis::axisLength [protected]

GlComposite* tlp::GlAxis::axisLinesComposite [protected]

std::string tlp::GlAxis::axisName [protected]

AxisOrientation tlp::GlAxis::axisOrientation [protected]

GlComposite* tlp::GlAxis::captionComposite [protected]

bool tlp::GlAxis::captionFrame [protected]

float tlp::GlAxis::captionHeight [protected]

float tlp::GlAxis::captionOffset [protected]

LabelPosition tlp::GlAxis::captionPosition [protected]

bool tlp::GlAxis::captionSet [protected]

std::string tlp::GlAxis::captionText [protected]

float tlp::GlAxis::captionWidth [protected]

GlComposite* tlp::GlAxis::gradsComposite [protected]

float tlp::GlAxis::labelHeight [protected]

float tlp::GlAxis::maxCaptionWidth [protected]

float tlp::GlAxis::maxGraduationLabelWidth [protected]

float tlp::GlAxis::spaceBetweenAxisGrads [protected]

Author

Generated automatically by Doxygen for Tulip Open GL Library from the source code.