MeVisLab Toolbox Reference
SoAxis.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, 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 SO_AXIS_H
14 #define SO_AXIS_H
15 
17 
18 // Draw a user configurable axis coordinate system in Open Inventor.
19 //
20 // This class permits to instantiate an axis object which
21 // can be configured to draw a coordinate system with up to 3
22 // axis, arrows at the axis ends, ticks to subdivide the axis,
23 // as well as axis extends, -descriptions, -numbering etc.
24 
25 #include <ThirdPartyWarningsDisable.h>
26 #include <Inventor/nodes/SoShape.h>
27 
28 #include <Inventor/fields/SoSFTrigger.h>
29 #include <Inventor/fields/SoSFBool.h>
30 #include <Inventor/fields/SoSFVec3f.h>
31 #include <Inventor/fields/SoSFFloat.h>
32 #include <Inventor/fields/SoSFColor.h>
33 #include <Inventor/fields/SoSFUInt32.h>
34 #include <Inventor/fields/SoSFString.h>
35 #include <Inventor/fields/SoSFEnum.h>
36 #include <ThirdPartyWarningsRestore.h>
37 #include <SoSFMLImage.h>
38 class SoFieldSensor;
39 class SoNodeSensor;
40 class SoDataSensor;
41 
42 #include "Axis.h"
43 
44 class SoAxis : public SoShape
45 {
46  SO_NODE_HEADER(SoAxis);
47 
48  public:
50  SoAxis();
51 
55  SoSFTrigger adjustSettings;
56 
64 
66  SoSFBool axisOn;
67 
71  SoSFVec3f axisVolumeSize;
72 
74  SoSFUInt32 axisFontSize;
75 
77  SoSFBool axis1Visibility;
78 
80  SoSFBool axis2Visibility;
81 
83  SoSFBool axis3Visibility;
84 
86  SoSFBool axisNumberingOn;
87 
89  SoSFBool axisSubTickingOn;
90 
93  SoSFBool multiAxisXY;
94  SoSFBool multiAxisXZ;
95  SoSFBool multiAxisYX;
96  SoSFBool multiAxisYZ;
97  SoSFBool multiAxisZX;
98  SoSFBool multiAxisZY;
100 
103  SoSFString axis1Text;
104  SoSFString axis2Text;
105  SoSFString axis3Text;
107 
110  SoSFString numPrefix1Text;
111  SoSFString numPrefix2Text;
112  SoSFString numPrefix3Text;
113  SoSFString numPostfix1Text;
114  SoSFString numPostfix2Text;
115  SoSFString numPostfix3Text;
117 
127 
129  SoSFVec3f axisStepSizes;
130 
132  SoSFVec3f axisOrigin;
133 
135  SoSFVec3f axisMinEnds;
136 
138  SoSFVec3f axisMaxEnds;
139 
141  SoSFVec3f axisMarkerLength;
142 
144  SoSFVec3f axisTicksMin;
145 
147  SoSFVec3f axisTicksMax;
148 
150  SoSFVec3f axisNumBias;
151 
153  SoSFVec3f axisNumScale;
154 
156  // white (1,1,1) and opaque (1).
158  SoSFColor axis1Color;
159  SoSFFloat axis1Transparency;
161 
163  // white (1,1,1) and opaque (1).
165  SoSFColor axis2Color;
166  SoSFFloat axis2Transparency;
168 
170  // white (1,1,1) and opaque (1).
172  SoSFColor axis3Color;
173  SoSFFloat axis3Transparency;
175 
177  // white (1,1,1) and opaque (1).
179  SoSFColor boxColor;
180  SoSFFloat boxTransparency;
182 
184  SoSFBool boxOn;
185 
187  SoSFVec3f axisWingLength;
188 
191  SoSFVec3f axisOverScale;
192 
195  SoSFVec3f axisSubTickSteps;
196 
199  SoSFVec3f axisSubTickScales;
200 
203 
206  void generatePrimitives(SoAction *) override {};
207  void GLRender(SoGLRenderAction *action) override;
208  void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center) override;
210 
212  static void initClass();
213 
214  protected:
216  ~SoAxis() override;
217 
219  virtual void _adjustSettings();
220 
222  void _triggerChanged(SoField* field);
223 
225  void _autoAdjustSettingsChanged(SoField* field);
226 
228  void _inputImageChanged(SoField* field);
229 
231  void drawBox();
232 
235 
238  SbString _text1, _text2, _text3;
240 
247 };
248 
249 #endif
A class to administrate an axis coordinate system drawable in OpenGL.
Definition: Axis.h:22
Definition: SoAxis.h:45
SoSFFloat axis1Transparency
Definition: SoAxis.h:159
SoSFString axis3Text
Definition: SoAxis.h:105
SoSFBool axisOn
Enables/disables drawing of the coordinate system. Default is True.
Definition: SoAxis.h:66
SoSFBool axis3Visibility
Enables/Disables visibility of axis 3. Default is True.
Definition: SoAxis.h:83
SoSFBool multiAxisZX
Definition: SoAxis.h:97
static void initClass()
Initializes this class.
SoSFVec3f axisMinEnds
The start values foer each axis. Default is (-1,-1,-1).
Definition: SoAxis.h:135
SoSFVec3f axisMarkerLength
The size of the axis ticks. Default is (0,0,0).
Definition: SoAxis.h:141
SoSFVec3f axisWingLength
Size the arrows at the end of each axis. Defaut is (0.5, 0.5, 0.5).
Definition: SoAxis.h:187
SoSFVec3f axisNumBias
Values to be added to axis numbers. Default is (0,0,0).
Definition: SoAxis.h:150
void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center) override
SoSFString numPrefix1Text
Text to be inserted/appended before/after axis numberings, defaults are "".
Definition: SoAxis.h:110
SoSFVec3f axisVolumeSize
Field which is used as volume size input.
Definition: SoAxis.h:71
SoSFVec3f axisOverScale
Factor which makes the axis longer to be sure that arrows are not at position of last tick.
Definition: SoAxis.h:191
SoSFString numPrefix2Text
Definition: SoAxis.h:111
SoSFBool axis2Visibility
Enables/Disables visibility of axis 2. Default is True.
Definition: SoAxis.h:80
SoSFTrigger adjustSettings
If this field is triggered then the current axisVolumeSize field is used to set a sensible axis setti...
Definition: SoAxis.h:55
void _autoAdjustSettingsChanged(SoField *field)
called if autoAdjustSettings or axisVolumeSize changes:
SoSFString numPostfix3Text
Definition: SoAxis.h:115
SoSFColor axis1Color
Definition: SoAxis.h:158
SoSFUInt32 axisFontSize
Selects fonts size for axis annotation. Default is 0.
Definition: SoAxis.h:74
SoSFColor boxColor
Definition: SoAxis.h:179
SoAxis()
Constructor.
SoSFVec3f axisOrigin
The world position of the axis origin. Default is (0,0,0).
Definition: SoAxis.h:132
SoSFEnum axisNumber3AlignMode
Definition: SoAxis.h:125
SoSFColor axis2Color
Definition: SoAxis.h:165
virtual void _adjustSettings()
Adjust all settings to volume size field.
SoSFEnum axisText3AlignMode
Definition: SoAxis.h:122
SoSFEnum axisNumber2AlignMode
Definition: SoAxis.h:124
SoSFVec3f axisNumScale
Axis numbers are multiplied with these values. Default is (1,1,1).
Definition: SoAxis.h:153
SoSFBool axisSubTickingOn
Enables/Disables drawing of subticks. Default is True.
Definition: SoAxis.h:89
SbString _numPrefix2
Definition: SoAxis.h:244
SoSFBool multiAxisZY
Definition: SoAxis.h:98
SoSFBool axis1Visibility
Enables/Disables visibility of axis 1. Default is True.
Definition: SoAxis.h:77
SoSFVec3f axisTicksMin
Position of the first axis tick. Default is (0,0,0).
Definition: SoAxis.h:144
SoSFString numPostfix1Text
Definition: SoAxis.h:113
SoSFEnum axisNumber1AlignMode
Definition: SoAxis.h:123
SoSFBool multiAxisYX
Definition: SoAxis.h:95
SoSFString axis2Text
Definition: SoAxis.h:104
SoSFBool boxOn
Enables/disables box drawing. Default is False.
Definition: SoAxis.h:184
SbString _text1
Text buffer for axis title text.
Definition: SoAxis.h:238
SoSFVec3f axisSubTickSteps
Subdivision of distance between ticks to determine smaller ticks between.
Definition: SoAxis.h:195
SoSFString numPostfix2Text
Definition: SoAxis.h:114
SbString _numPostfix2
Definition: SoAxis.h:245
SoSFFloat axis3Transparency
Definition: SoAxis.h:173
SbString _numPrefix3
Definition: SoAxis.h:244
SoSFBool axisNumberingOn
Enables/Disables numbering of axis ticks. Default is True.
Definition: SoAxis.h:86
void _inputImageChanged(SoField *field)
called if inputImage changes:
void _triggerChanged(SoField *field)
Method called by _fieldChangedCB when the trigger field is changed.
SoSFBool autoAdjustSettings
If TRUE all changes of the node automatically cause setting of sensible axis settings from it.
Definition: SoAxis.h:63
SoSFMLImage inputImage
Pointer to input image field.
Definition: SoAxis.h:202
SoSFVec3f axisTicksMax
Position of the last axis tick. Default is (1,1,1).
Definition: SoAxis.h:147
SoSFBool multiAxisXZ
Definition: SoAxis.h:94
SoSFVec3f axisStepSizes
Determines distances between axis ticks. Default is (1,1,1).
Definition: SoAxis.h:129
Axis _axis
Instance of Axis for drawing.
Definition: SoAxis.h:234
SoSFString axis1Text
Text to be drawn at axis ends.
Definition: SoAxis.h:103
SbString _numPostfix1
Definition: SoAxis.h:245
SoSFEnum axisText1AlignMode
Type selector for text alignments, default is TEXT_ALIGN_LEFT.
Definition: SoAxis.h:120
SoSFColor axis3Color
Definition: SoAxis.h:172
SbString _text2
Definition: SoAxis.h:238
SoSFVec3f axisSubTickScales
Tick lengthes multiplied with this scale factors result to size of subticks.
Definition: SoAxis.h:199
void generatePrimitives(SoAction *) override
Action behaviour to be implemented.
Definition: SoAxis.h:206
SoSFString numPrefix3Text
Definition: SoAxis.h:112
SbString _numPostfix3
Definition: SoAxis.h:245
SoSFVec3f axisMaxEnds
The end values of each axis. Default is (1,1,1).
Definition: SoAxis.h:138
SoSFFloat boxTransparency
Definition: SoAxis.h:180
SoSFEnum axisText2AlignMode
Definition: SoAxis.h:121
~SoAxis() override
Destructor.
SbString _text3
Definition: SoAxis.h:238
SoSFBool multiAxisYZ
Definition: SoAxis.h:96
SbString _numPrefix1
Prefixes and postfixes for axis numbers; also highly useful to format number locations next to axis.
Definition: SoAxis.h:244
SoSFBool multiAxisXY
Definition: SoAxis.h:93
void drawBox()
Draw the box.
void GLRender(SoGLRenderAction *action) override
SoSFFloat axis2Transparency
Definition: SoAxis.h:166
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
Definition: SoSFMLImage.h:70