MeVisLab Resolution Independence API
Axis.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2014, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef AXIS_H
14#define AXIS_H
15
16
18
19#include <mlModuleIncludes.h>
20#include <Inventor/SbLinear.h>
21
22class Axis {
23public:
24
31
34
36 void setAxisColors (SbVec4f c[3]);
37
39 void axisNumberingOn (bool b);
40
42 void setAxisStepSizes (float x, float y, float z);
43
45 void setAxisVisibility (bool b1, bool b2, bool b3);
46
48 void setAxisOrigin (float x, float y, float z);
49
51 void setAxisNumBias (float x, float y, float z);
52
54 void setAxisNumScale (float x, float y, float z);
55
57 void setAxisMarkerLength (float x, float y, float z);
58
60 void setAxisWingLength (float sx, float sy, float sz);
61
63 void setAxisOverScale (float sx, float sy, float sz);
64
66 void setAxisTicks (float xmi, float xma, float ymi, float yma, float zmi, float zma);
67
69 void setNumberPreAndPostFixes(const char *numPrefix1Text ,
70 const char *numPrefix2Text ,
71 const char *numPrefix3Text ,
72 const char *numPostfix1Text,
73 const char *numPostfix2Text,
74 const char *numPostfix3Text);
75
77 void setAxisTexts (const char *at0, const char *at1, const char *at2);
78
83
88
90 void setAxisEnds (float xmi, float xma, float ymi, float yma, float zmi, float zma);
91
93 void setMultiAxis (bool xy, bool xz, bool yx, bool yz, bool zx, bool zy);
94
96 void setSubTickSteps (float x, float y, float z);
97
99 void setSubTickScale (float x, float y, float z);
100
102 void subTickingOn (bool b1, bool b2, bool b3);
103
105 void drawString (const char *s, const SbVec4f& color, AxisTextAlignMode alignMode=AXIS_TEXT_ALIGN_LEFT);
106
108 void drawAxis();
109
111 void setFontSize(MLuint32 size) { _fontSize = size; }
112
113protected:
115 void drawSubLines(float axis_ori[3], float len, float step,
116 float sld[3], float ad0[3], float ad1[3],
117 const char *axisText,
118 float startTick, float endTick,
119 bool drawAxis[3],
120 int numAxis,
121 int baseAxis,
122 float numBias,
123 float numScale,
124 MLint32 recursions);
125
127 void drawLinearAxis(float axisOri[3], float aml[3], float ass[3], float awl[3],
128 const char *at[3], bool drawAxis[3], int baseAxis, MLint32 recursions=0);
129
130private:
132 bool _drawAxis[3];
133
135 bool _axisNumberingFlag;
136
138 const char *_axisTexts[3];
139
141 const char *_numberPrefixes[3];
142
144 const char *_numberPostfixes[3];
145
147 AxisTextAlignMode _axisTextAlignMode[3];
148
150 AxisTextAlignMode _axisNumberAlignMode[3];
151
153 float _axisOrigin[3];
154
156 float _axisNumBias[3];
157
159 float _axisNumScale[3];
160
162 float _axisStepSizes[3];
163
165 float _axisMarkerLength[3];
166
168 float _axisEnds[3][2];
169
171 SbVec4f _axisColors[3];
172
174 float _axisWingLength[3];
175
177 float _axisOverScale[3];
178
180 float _subTickSteps[3];
181
183 float _subTickScale[3];
184
186 bool _subTicksOn[3];
187
189 float _axisTicksExt[3][2];
190
192 bool _multiAxis[3][2];
193
195 MLint32 _fontSize;
196};
197
198#endif
A class to administrate an axis coordinate system drawable in OpenGL.
Definition Axis.h:22
void setSubTickScale(float x, float y, float z)
Set tick lengths on additional cross axis, measured in parts of axisMarkerLength.
void setFontSize(MLuint32 size)
The set size of the font, used in drawString().
Definition Axis.h:111
void setAxisNumBias(float x, float y, float z)
Set a offset added to the drawn axis numbers.
void setAxisTicks(float xmi, float xma, float ymi, float yma, float zmi, float zma)
Set start and end position of axis ticks.
void setSubTickSteps(float x, float y, float z)
Set tick distances on additional cross axis, measured in parts of axisStepSizes.
void setAxisNumScale(float x, float y, float z)
Set a scale multiplied to the drawn axis numbers.
void setAxisOverScale(float sx, float sy, float sz)
Set scale factors for base axis, so that they're longer then axis ends.
void drawAxis()
Draw axis coordinate system with current parameter set.
AxisTextAlignMode
Type selector for text alignment modes.
Definition Axis.h:26
@ AXIS_TEXT_ALIGN_RIGHT
Definition Axis.h:29
@ AXIS_TEXT_ALIGN_CENTER
Definition Axis.h:28
@ AXIS_TEXT_ALIGN_LEFT
Definition Axis.h:27
void drawString(const char *s, const SbVec4f &color, AxisTextAlignMode alignMode=AXIS_TEXT_ALIGN_LEFT)
Draws a string at the current raster position.
Axis()
Default constructor.
void axisNumberingOn(bool b)
Enable/Disable axis tick numbering for all three axis.
void subTickingOn(bool b1, bool b2, bool b3)
Set sub tick drawing for base coordinate system lines.
void setAxisEnds(float xmi, float xma, float ymi, float yma, float zmi, float zma)
Set minimum and maximum extends of all three axis.
void setAxisTexts(const char *at0, const char *at1, const char *at2)
Set description texts of the three axis.
void setAxisVisibility(bool b1, bool b2, bool b3)
Enable/Disable visibility of the three axis.
void drawSubLines(float axis_ori[3], float len, float step, float sld[3], float ad0[3], float ad1[3], const char *axisText, float startTick, float endTick, bool drawAxis[3], int numAxis, int baseAxis, float numBias, float numScale, MLint32 recursions)
Draws one axis with its additional cross axis. It also calls draw_linearAxis.
void setAxisStepSizes(float x, float y, float z)
Set distances between axis ticks.
void setAxisColors(SbVec4f c[3])
Set colors for the three axis.
void setMultiAxis(bool xy, bool xz, bool yx, bool yz, bool zx, bool zy)
Set which additional cross axis shall be drawn.
void setAxisNumberAlignModes(AxisTextAlignMode align0=AXIS_TEXT_ALIGN_LEFT, AxisTextAlignMode align1=AXIS_TEXT_ALIGN_LEFT, AxisTextAlignMode align2=AXIS_TEXT_ALIGN_LEFT)
Set texts alignment for the three axis numbering texts.
void setAxisTextAlignModes(AxisTextAlignMode align0=AXIS_TEXT_ALIGN_LEFT, AxisTextAlignMode align1=AXIS_TEXT_ALIGN_LEFT, AxisTextAlignMode align2=AXIS_TEXT_ALIGN_LEFT)
Set texts alignment for the three axis tip texts.
void setAxisWingLength(float sx, float sy, float sz)
Set length of arrow wings.
void drawLinearAxis(float axisOri[3], float aml[3], float ass[3], float awl[3], const char *at[3], bool drawAxis[3], int baseAxis, MLint32 recursions=0)
Draw the coordinate system and calls drawSubLines, so it is also called recursively.
void setAxisMarkerLength(float x, float y, float z)
Set length of axis ticks.
void setAxisOrigin(float x, float y, float z)
Set world position where axis coordinate system is drawn.
void setNumberPreAndPostFixes(const char *numPrefix1Text, const char *numPrefix2Text, const char *numPrefix3Text, const char *numPostfix1Text, const char *numPostfix2Text, const char *numPostfix3Text)
Set prefixes and postfixes to be inserted before/after each drawn number next to axis.