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;
166 virtual void updateAxis();
178 void setAxisGraduations(
const std::vector<std::string> &axisGradsLabels,
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 =
"");
212 void setGradsLabelsHeight(
float height);
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;
242 GlLabel *captionLabel;
245 GlComposite *axisLinesComposite;
246 GlComposite *captionComposite;
247 GlComposite *gradsComposite;
248 std::vector<GlLabel *> gradsLabelsVector;
250 CaptionLabelPosition captionPosition;
251 float maxCaptionWidth;
252 float maxGraduationLabelWidth;