MeVisLab Resolution Independence API
Loading...
Searching...
No Matches
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
23{
24public:
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, const char* numPrefix2Text, const char* numPrefix3Text,
70 const char* numPostfix1Text, const char* numPostfix2Text, const char* numPostfix3Text);
71
73 void setAxisTexts(const char* at0, const char* at1, const char* at2);
74
79
84
86 void setAxisEnds(float xmi, float xma, float ymi, float yma, float zmi, float zma);
87
89 void setMultiAxis(bool xy, bool xz, bool yx, bool yz, bool zx, bool zy);
90
92 void setSubTickSteps(float x, float y, float z);
93
95 void setSubTickScale(float x, float y, float z);
96
98 void subTickingOn(bool b1, bool b2, bool b3);
99
101 void drawString(const char* s, const SbVec4f& color, AxisTextAlignMode alignMode = AXIS_TEXT_ALIGN_LEFT);
102
104 void drawAxis();
105
107 void setFontSize(MLuint32 size)
108 {
109 _fontSize = size;
110 }
111
112protected:
114 void drawSubLines(float axis_ori[3], float len, float step, float sld[3], float ad0[3], float ad1[3],
115 const char* axisText, float startTick, float endTick, bool drawAxis[3], int numAxis, int baseAxis,
116 float numBias, float numScale, MLint32 recursions);
117
119 void drawLinearAxis(float axisOri[3], float aml[3], float ass[3], float awl[3], const char* at[3], bool drawAxis[3],
120 int baseAxis, MLint32 recursions = 0);
121
122private:
124 bool _drawAxis[3];
125
127 bool _axisNumberingFlag;
128
130 const char* _axisTexts[3];
131
133 const char* _numberPrefixes[3];
134
136 const char* _numberPostfixes[3];
137
139 AxisTextAlignMode _axisTextAlignMode[3];
140
142 AxisTextAlignMode _axisNumberAlignMode[3];
143
145 float _axisOrigin[3];
146
148 float _axisNumBias[3];
149
151 float _axisNumScale[3];
152
154 float _axisStepSizes[3];
155
157 float _axisMarkerLength[3];
158
160 float _axisEnds[3][2];
161
163 SbVec4f _axisColors[3];
164
166 float _axisWingLength[3];
167
169 float _axisOverScale[3];
170
172 float _subTickSteps[3];
173
175 float _subTickScale[3];
176
178 bool _subTicksOn[3];
179
181 float _axisTicksExt[3][2];
182
184 bool _multiAxis[3][2];
185
187 MLint32 _fontSize;
188};
189
190#endif
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:107
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.