24 #include <tulip/GlComposite.h>
25 #include <tulip/Color.h>
27 const float DEFAULT_GRAD_WIDTH = 6.;
29 const float MAGIG_FACTOR = (1.f / (1.3f));
47 enum AxisOrientation {HORIZONTAL_AXIS, VERTICAL_AXIS};
49 enum LabelPosition {LEFT_OR_BELOW, RIGHT_OR_ABOVE};
50 enum CaptionLabelPosition {LEFT, RIGHT, BELOW, ABOVE};
61 GlAxis(
const std::string &axisName,
const Coord &axisBaseCoord,
const float axisLength,
62 const AxisOrientation &axisOrientation,
const Color &axisColor);
91 return axisOrientation;
97 return axisGradsWidth;
103 return spaceBetweenAxisGrads;
116 return maxGraduationLabelWidth;
130 this->axisName = axisName;
136 this->axisLength = axisLength;
142 this->axisColor = axisColor;
148 this->axisGradsWidth = axisGradsWidth;
155 this->maxCaptionWidth = maxCaptionWidth;
165 virtual void updateAxis();
174 void setAxisGraduations(
const std::vector<std::string> &axisGradsLabels,
175 const LabelPosition &axisGradsLabelsPosition = LEFT_OR_BELOW);
178 void setAxisGraduationsMaxLabelWidth(
const float maxWidth) {
179 maxGraduationLabelWidth = maxWidth;
192 void addCaption(
const CaptionLabelPosition &captionPos,
const float captionHeight,
const bool captionFrame =
false,
193 const float maxCaptionWidth = 0,
const float captionOffset = 0,
const std::string caption =
"");
203 void setGradsLabelsHeight(
float height);
205 void translate(
const Coord &c);
207 float getCaptionHeight()
const;
209 void setCaptionHeight(
float height,
bool frame);
213 void buildAxisLine();
218 void computeBoundingBox();
219 virtual Coord computeCaptionCenter(
const bool captionFrame);
220 virtual void computeCaptionSize(
float height);
221 void addAxisCaption(
const Coord &captionLabelCenter,
const bool captionFrame);
223 std::string axisName;
226 AxisOrientation axisOrientation;
227 LabelPosition axisGradsPosition;
229 float axisGradsWidth;
230 float spaceBetweenAxisGrads;
233 float baseCaptionHeight;
235 std::string captionText;
236 GlLabel *captionLabel;
239 GlComposite *axisLinesComposite;
240 GlComposite *captionComposite;
241 GlComposite *gradsComposite;
242 std::vector<GlLabel*> gradsLabelsVector;
244 CaptionLabelPosition captionPosition;
245 float maxCaptionWidth;
246 float maxGraduationLabelWidth;
void setAxisName(const std::string &axisName)
Method to set the axis name.
float getSpaceBetweenAxisGrads() const
Method which returns the distance between the axis graduations.
void setAxisLength(const float axisLength)
Method to set the axis length.
std::string getAxisName() const
Method which returns the name of the axis.
void setAxisGradsWidth(const float axisGradsWidth)
Methods to set the axis graduations Width.
Color getAxisColor() const
Method which returns the color of the axis.
A base class to draw an axis with graduations.
float getAxisGradsWidth() const
Method which returns the width of the axis graduations.
float getAxisLength() const
Method which returns the length of the axis.
void setMaxCaptionWidth(const float maxCaptionWidth)
Methods to set the max caption width.
Coord getAxisBaseCoord() const
Method which returns the base coordinates of the axis.
GlSimpleEntity used to agregate other GlEntity.
AxisOrientation getAxisOrientation() const
Method which returns the orientation of the axis.
float getMaxLabelWidth() const
Method which returns the max axis graduations labels width.
float getLabelHeight() const
Method which returns the axis graduations labels height.
void setAxisColor(const Color &axisColor)
Method to set the axis color.