Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SliceScaleBar.h
Go to the documentation of this file.
1
2//
3// SliceScaleBar utility class
4//
5// Mike Heck, VSG Inc, December 2011
6//
8
10//
11// This class is part of the Open Inventor Medical utility library.
12//
13// The medical utility classes are provided as a prebuilt library named
14// "fei_inventor_medical", that can be used directly in an Open Inventor
15// application. The classes in the prebuilt library are documented and
16// supported by Thermo Fisher Scientific. These classes are also provided as source code.
17//
18// Please see $OIVHOME/include/Medical/InventorMedical.h for the full text.
19//
21
22#ifndef _SLICE_SCALE_BAR_H
23#define _SLICE_SCALE_BAR_H
24
26
33
34class SoAction;
35class SoDrawStyle;
36class SoFont;
37class SoLineSet;
38class SoMaterial;
39class SoSeparator;
40class SoText2;
41class SoTranslation;
43class SoNodeSensor;
44
90
92
93public:
94
97
106
113
120
123
126
129
133 HORIZONTAL = 0,
135 VERTICAL = 1
136 };
137
141 LEFT = 0,
143 BOTTOM = 0,
145 CENTER = 1,
147 RIGHT = 2,
149 TOP = 2
150 };
151
154
156 static void initClass();
157
159 static void exitClass();
160
161private:
163 virtual ~SliceScaleBar();
164
166 void buildSceneGraph();
167
169 void computeEndPoints( SbVec3f& p0, SbVec3f& p1 );
170
171 SoRef<SoSeparator> m_lineSep;
172 SoRef<SoLineSet> m_axisLineSet;
173 SoRef<SoVertexProperty> m_vertProp;
174
175 SoRef<SoSeparator> m_textSep;
176 SoRef<SoTranslation> m_labelPos;
177 SoRef<SoFont> m_labelFont;
178 SoRef<SoText2> m_labelText;
179
180 // TODO: Add title and labels
181 //SoRef<SoFont> m_fontNode;
182
183 bool m_fieldsChanged; // Set when fields have changed
184 float m_ndcLength; // Same as length field if not tracked
185 SbVec3f m_p0; // Current end-points in NDC
186 SbVec3f m_p1; // (they depend on orientation and alignment)
187
188 int m_tickLenPix; // Target tick line length in pixels
189 float m_tickLenNdc; // Tick line length in NDC (depends on viewport)
190 SbVec2i32 m_winSizePix; // Window size in pixels
191 SbVec2f m_pixelPerNdc; // Converts 1 ndc unit to pixels (but not a coordinate)
192
193 SoNodeSensor* m_sensor; // Monitors changes to our fields
194 static void sensorCB( void* data, SoSensor* sensor );
195
196 static void staticCB( void* data, SoAction* action ); // Called during traversal
197 void renderCB( SoAction* action );
198
199 void resetLines(); // Remove all lines
200 void addLine( SbVec3f& p0, SbVec3f& p1 ); // Add a new line (e.g. tick)
201
202 void updateAxis(); // Recreate/reposition axis geometry
203};
204
205#endif
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
2D vector class.
Definition SbVec.h:76
2D vector class.
Definition SbVec.h:517
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
SoSFString label
Label (default is empty string).
SoSFVec2f position
Position in normalized screen coordinates (-1 to 1).
static void initClass()
Initialize the class.
static void exitClass()
Finish using the class.
Alignment
Scale bar alignment.
SoSFEnum alignment
Scale bar alignment (default is CENTER).
SoSFFloat length
Length in normalized screen coordinates (-1 to 1) if not tracking, else length in 3D world coordinate...
SoSFEnum orientation
Scale bar orientation (default is HORIZONTAL).
Orientation
Scale bar orientation.
SliceScaleBar()
Constructor.
SoSFNode trackedCamera
Tracked camera (default is null).
SoSFInt32 numTickIntervals
Number of tick intervals (default is 0).
Abstract base class for all actions.
Definition SoAction.h:132
Annotation group node.
Node that defines the style to use when rendering.
Node that defines font name, size, and type for text.
Definition SoFont.h:303
Polyline shape node.
Definition SoLineSet.h:190
Surface material definition node.
Definition SoMaterial.h:186
Sensor class that can be attached to Open Inventor nodes.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a a node.
Definition SoSFNode.h:97
Field containing a string.
Definition SoSFString.h:117
Field containing a two-dimensional vector.
Definition SoSFVec2f.h:78
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:97
Group node that saves and restores traversal state.
Screen-aligned 2D text shape node.
Definition SoText2.h:194
Node representing a 3D translation.
Vertex property node.
#define INVENTORMEDICAL_API
Definition port.h:388