23 #include <tulip/GlComposite.h>
24 #include <tulip/Color.h>
26 const float DEFAULT_GRAD_WIDTH = 6.;
28 const float MAGIG_FACTOR = (1.f / (1.3f));
46 enum AxisOrientation { HORIZONTAL_AXIS, VERTICAL_AXIS };
48 enum LabelPosition { LEFT_OR_BELOW, RIGHT_OR_ABOVE };
49 enum CaptionLabelPosition { LEFT, RIGHT, BELOW, ABOVE };
62 GlAxis(
const std::string &axisName,
const Coord &axisBaseCoord,
const float axisLength,
63 const AxisOrientation &axisOrientation,
const Color &axisColor);
92 return axisOrientation;
98 return axisGradsWidth;
104 return spaceBetweenAxisGrads;
117 return maxGraduationLabelWidth;
131 this->axisName = axisName;
137 this->axisLength = axisLength;
143 this->axisColor = axisColor;
149 this->axisGradsWidth = axisGradsWidth;
156 this->maxCaptionWidth = maxCaptionWidth;
179 const LabelPosition &axisGradsLabelsPosition = LEFT_OR_BELOW);
181 void setAxisGraduationsMaxLabelWidth(
const float maxWidth) {
182 maxGraduationLabelWidth = maxWidth;
200 void addCaption(
const CaptionLabelPosition &captionPos,
const float captionHeight,
201 const bool captionFrame =
false,
const float maxCaptionWidth = 0,
202 const float captionOffset = 0,
const std::string caption =
"");
214 void translate(
const Coord &c)
override;
216 float getCaptionHeight()
const;
218 void setCaptionHeight(
float height,
bool frame);
221 void buildAxisLine();
224 void computeBoundingBox();
225 virtual Coord computeCaptionCenter(
const bool captionFrame);
226 virtual void computeCaptionSize(
float height);
227 void addAxisCaption(
const Coord &captionLabelCenter,
const bool captionFrame);
229 std::string axisName;
232 AxisOrientation axisOrientation;
233 LabelPosition axisGradsPosition;
235 float axisGradsWidth;
236 float spaceBetweenAxisGrads;
239 float baseCaptionHeight;
241 std::string captionText;
248 std::vector<GlLabel *> gradsLabelsVector;
250 CaptionLabelPosition captionPosition;
251 float maxCaptionWidth;
252 float maxGraduationLabelWidth;
A base class to draw an axis with graduations.
Color getAxisColor() const
Method which returns the color of the axis.
void setAxisGradsWidth(const float axisGradsWidth)
Methods to set the axis graduations Width.
float getAxisGradsWidth() const
Method which returns the width of the axis graduations.
void setAxisLength(const float axisLength)
Method to set the axis length.
const Coord & getAxisBaseCoord() const
Method which returns the base coordinates of the axis.
float getAxisLength() const
Method which returns the length of the axis.
AxisOrientation getAxisOrientation() const
Method which returns the orientation of the axis.
GlAxis(const std::string &axisName, const Coord &axisBaseCoord, const float axisLength, const AxisOrientation &axisOrientation, const Color &axisColor)
GlAxis constructor.
void setMaxCaptionWidth(const float maxCaptionWidth)
Methods to set the max caption width.
void setGradsLabelsHeight(float height)
Method to set the axis graduations labels size.
void 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.
void 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.
virtual void updateAxis()
Method to update the axis drawing.
float getMaxLabelWidth() const
Method which returns the max axis graduations labels width.
void setAxisName(const std::string &axisName)
Method to set the axis name.
float getLabelHeight() const
Method which returns the axis graduations labels height.
float getSpaceBetweenAxisGrads() const
Method which returns the distance between the axis graduations.
~GlAxis() override
GlAxis destructor.
const std::string & getAxisName() const
Method which returns the name of the axis.
void setAxisColor(const Color &axisColor)
Method to set the axis color.
GlSimpleEntity used to aggregate other GlEntity.
Create a label into Tulip 3D engine.