MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoView2DLabel.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2013, 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
15
16#pragma once
17
18#include "SoView2DSystem.h"
20
21#include <Inventor/fields/SoSFString.h>
22#include <Inventor/fields/SoSFFloat.h>
23#include <Inventor/fields/SoSFEnum.h>
24#include <Inventor/fields/SoSFInt32.h>
25#include <Inventor/fields/SoSFVec3f.h>
26#include <Inventor/fields/SoSFVec2f.h>
27#include <Inventor/SbBox.h>
28#include <DCMTree_Tag.h>
29
30
31class SoView2D;
32class View2DFont;
33
34// Constant name definitions
35
41
47
52
54{
55 SO_NODE_HEADER(SoView2DLabel);
56
57public:
63 DEPTH_IN_MM
64 };
65
73 FONT_SIZE_IN_VOXELS
74 };
75
82
84
86
89
93
98
103
106
110
114
117
120
122
124
127
128 // field for definition of background box
136
140
142 static void initClass();
143
146
147 ~SoView2DLabel() override;
148
150 void draw(View2DSliceList* dsl, View2DSlice* dslice, int slice) override;
151
152 float getDepthVisibilityBlendValue(float distance, float voxelSizeZ);
153
154protected:
155 bool getTextLocation(View2DSliceList* dsl, View2DSlice* dslice, int slice, float& alphaToUse, float& dx, float& dy,
156 int& textWidth, int& textHeight);
157
159 {
160 return false;
161 }
162
165 bool isSensitiveAt(const SoPointerPosition& pos) override;
166 void setHighlightAt(const SoPointerPosition& pos) override;
167 void unsetHighlight() override;
168 void startPressAt(const SoPointerPosition& pos) override;
169 void dragMoveTo(const SoPointerPosition& pos) override;
171
174 void pointerPosition(SoState* state, const SoPointerPosition& pos) override;
175 void pointerLeftWindow(SoState* state) override;
177
178
179private:
182
183 float getFontSizeInPixels(View2DSlice* dslice) const;
184 bool labelIsVisibleOnTimePoint(const SoView2D* const view2D) const;
185 void getVisibleDeviceArea(View2DSlice* dsl, float& minX, float& maxX, float& minY, float& maxY) const;
186
187 SbVec2f _startDragDevicePosition;
188 SbVec3f _startWorldPosition;
189 SbVec2f _startRelativePosition;
190 SbBox2f _labelBounds;
191 int _currentInteractionSlice;
192};
HorizPositionMode
@ POS_RIGHT
@ POS_LEFT
@ POS_HCENTER
VertPositionMode
@ POS_ABOVE
@ POS_BELOW
@ POS_VCENTER
TextPositioningMode
@ WORLD_COORDINATES
@ RELATIVE_TO_VIEWER
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
void pointerPosition(SoState *state, const SoPointerPosition &pos) override
Same as below, with additional SoState argument. By default, simply calls the below version.
virtual void pointerLeftWindow()
This is called when the mouse cursor leaves the window.
SoPointerPosition manages the current position of the mouse cursor.
SoView2DInteractionExtension is base class for all SoView2DExtensions that want to support the Manage...
SoSFBool drawBackground
SoSFVec2f relativeViewerPosition
SoSFEnum depthVisibilityMode
select the mode for depth visibility
SoSFBool fixZOn
Fields.
SoSFBool showLabelOnAllTimePoints
SoSFFloat depthVisibility
defines up to which distance markers are visible value is either in slices or in mm depending on the ...
SoSFBool highlighted
Set to true while the label should be highlighted, usually draws a border around the label.
SoSFColor backgroundColor
SoSFVec3f worldPosition
SoSFInt32 timePoint
bool isSensitiveAt(const SoPointerPosition &pos) override
interface forwarded from SoPointingAction:
SoSFBool isUnderMouse
SoSFEnum verticalPosition
SoSFFloat depthMinimumAlpha
void setHighlightAt(const SoPointerPosition &pos) override
void startPressAt(const SoPointerPosition &pos) override
SoSFFloat backgroundMarginBottom
bool getTextLocation(View2DSliceList *dsl, View2DSlice *dslice, int slice, float &alphaToUse, float &dx, float &dy, int &textWidth, int &textHeight)
SoSFEnum horizontalPosition
SoSFString viewerId
void dragMoveTo(const SoPointerPosition &pos) override
SoSFInt32 fontSize
SoSFFloat alpha
SoSFFloat backgroundMarginLeft
static void initClass()
inventor runtime type system
~SoView2DLabel() override
SoSFBool useDepthVisibility
enables depth visibility
SoSFFloat verticalOffset
SoSFFloat horizontalOffset
SoSFBool textShadow
SoSFBool keepCursorPositionInViewerWhenMoving
BorderMode
Border mode.
@ SHOW_BORDER_WHEN_HIGHLIGHTED
void unsetHighlight() override
depthVisibilityType
Depth visibility mode.
@ DEPTH_IN_SLICES
The depth visibility in number of slices.
SoSFString text
SoSFColor borderColor
void pointerPosition(SoState *state, const SoPointerPosition &pos) override
Update isUnderMouse.
SoSFEnum textPositioning
FontSizeMode
Font size mode.
@ FONT_SIZE_IN_PIXELS
Font size in pixels.
@ FONT_SIZE_IN_MM
Font size in mm.
SoSFFloat backgroundAlpha
SoSFFloat backgroundMarginRight
bool implementsManagedInteractionAndClassicEventHandling() const override
this node is a hybrid module providing managed interaction and classic event handling
SoSFTypedEnum< BorderMode > borderMode
Defines the border mode.
void pointerLeftWindow(SoState *state) override
Same as below, with additional SoState argument. By defaults, simply calls the below version.
float getDepthVisibilityBlendValue(float distance, float voxelSizeZ)
SoView2DLabel()
Constructor.
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
draw annotations on slice
SoSFFloat backgroundMarginTop
SoSFBool keepLabelInViewer
SoSFEnum fontSizeMode
SoView2D is a 2D viewer for image data.
Definition SoView2D.h:62
Abstract GL font drawing using FTGL.
Definition View2DFont.h:30
a list that holds all View2DSlice objects (lazily created) of a SoView2D
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
Definition View2DSlice.h:48
Target mlrange_cast(Source arg)
Generic version of checked ML casts.