Overview     Modules     Class Hierarchy     Classes     Members  

A base class to draw an axis with graduations. More...

#include <GlAxis.h>

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

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, const float axisWidth=10)
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 setAxisGraduationsMaxLabelWidth (const float maxWidth)
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)
- Public Member Functions inherited from tlp::GlComposite
 GlComposite (bool deleteComponentsInDestructor=true)
 ~GlComposite ()
virtual void addLayerParent (GlLayer *layer)
virtual void removeLayerParent (GlLayer *layer)
void reset (bool deleteElems)
void addGlEntity (GlSimpleEntity *entity, const std::string &key)
void deleteGlEntity (const std::string &key, bool informTheEntity=true)
void deleteGlEntity (GlSimpleEntity *entity, bool informTheEntity=true)
std::string findKey (GlSimpleEntity *entity)
GlSimpleEntityfindGlEntity (const std::string &key)
std::map< std::string,
GlSimpleEntity * > * 
getDisplays ()
void notifyModified (GlSimpleEntity *entity)
virtual void draw (float, Camera *)
virtual void setStencil (int stencil)
virtual void acceptVisitor (GlSceneVisitor *visitor)
void setDeleteComponentsInDestructor (bool deleteComponentsInDestructor)
virtual void getXML (xmlNodePtr rootNode)
virtual void setWithXML (xmlNodePtr rootNode)
- Public Member Functions inherited from tlp::GlSimpleEntity
 GlSimpleEntity ()
virtual ~GlSimpleEntity ()
virtual void setVisible (bool visible)
bool isVisible ()
int getStencil ()
void setCheckByBoundingBoxVisitor (bool check)
bool isCheckByBoundingBoxVisitor ()
virtual BoundingBox getBoundingBox ()
void addParent (GlComposite *composite)
void removeParent (GlComposite *composite)
- Public Member Functions inherited from tlp::GlEntity
virtual ~GlEntity ()

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
GlCompositeaxisLinesComposite
GlCompositecaptionComposite
GlCompositegradsComposite
bool captionSet
LabelPosition captionPosition
float maxCaptionWidth
float maxGraduationLabelWidth
float axisWidth
- Protected Attributes inherited from tlp::GlComposite
std::map< std::string,
GlSimpleEntity * > 
elements
std::list< GlSimpleEntity * > _sortedElements
std::vector< GlLayer * > layerParents
bool deleteComponentsInDestructor
- Protected Attributes inherited from tlp::GlSimpleEntity
bool visible
int stencil
bool checkByBoundingBoxVisitor
BoundingBox boundingBox
std::vector< GlComposite * > parents

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

Enumerator:
HORIZONTAL_AXIS 
VERTICAL_AXIS 
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,
const float  axisWidth = 10 
)

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::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
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
void tlp::GlAxis::computeBoundingBox ( )
protected
virtual Coord tlp::GlAxis::computeCaptionCenter ( )
protectedvirtual
virtual void tlp::GlAxis::computeCaptionSize ( float  height)
protectedvirtual
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
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::setAxisGraduationsMaxLabelWidth ( const float  maxWidth)
inline
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::GlQuantitativeAxis, and tlp::GlNominativeAxis.

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
float tlp::GlAxis::axisWidth
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


Tulip Software by LaBRI Visualization Team    2001 - 2012