MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoViewportRegion.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_VIEWPORT_REGION_H
14#define SO_VIEWPORT_REGION_H
15
16
19
20#include <Inventor/fields/SoSFBool.h>
21#include <Inventor/fields/SoSFInt32.h>
22#include <Inventor/nodes/SoSeparator.h>
23#include <Inventor/nodes/SoSubNode.h>
24#include <Inventor/events/SoMouseButtonEvent.h>
25#include <Inventor/sensors/SoFieldSensor.h>
26#include <Inventor/sensors/SoNodeSensor.h>
27
28#include <Inventor/fields/SoSFVec2f.h>
29#include <Inventor/fields/SoSFEnum.h>
30#include <Inventor/nodes/SoPerspectiveCamera.h>
31
32#include "SoUtilsSystem.h"
33
36class SoRayPickAction;
38
40
41class SOUTILS_EXPORT SoViewportRegion : public SoSeparator
42{
43
45 SO_NODE_HEADER(SoViewportRegion);
46
47public:
50
52 static void initClass();
53
54 // position mode for one dimension: position and size of the overlay can be defined using two scalar values per
55 // dimension this enum defines how those two values have to be interpreted (position or size?)
57 POSITION_MODE_MIN_AND_MAX, // 2 positions are defined: left and right or lower and upper border
58 POSITION_MODE_CENTER_AND_SIZE, // 1 position and 1 size are defined: center and width or height
59 POSITION_MODE_MIN_AND_SIZE, // 1 position and 1 size are defined: left or lower border and width or height
60 POSITION_MODE_MAX_AND_SIZE // 1 position and 1 size are defined: right or upper border and width or height
61 };
62
63 // defines for one (1D-) position if it is related to the minimum (left or lower) or maximum (right or upper) border
64 // or the center of the dimension
66 REFERENCE_MODE_MIN, // related to left or lower border
67 REFERENCE_MODE_CENTER, // related to center
68 REFERENCE_MODE_MAX // related to right or upper border
69 };
70
71 // defines for one scalar whether it is defined in pixels or relative to the size of one dimension
73 DOMAIN_MODE_ABSOLUTE, // value given in pixels
74 DOMAIN_MODE_RELATIVE_TO_HEIGHT, // value given in percent (0-1) of the height
75 DOMAIN_MODE_RELATIVE_TO_WIDTH, // value given in percent (0-1) of the width
76 DOMAIN_MODE_RELATIVE_TO_MIN, // value given in percent (0-1) of the minimum of width and height
77 DOMAIN_MODE_RELATIVE_TO_MAX, // value given in percent (0-1) of the minimum of width and height
78 };
79
80 // defines, what camera is used for the rendering of the scene
87
89
92
95
98
101
104
107
110
113
116
119
122
125
128
131
134
137
140
143
146
149
152
155
158
161
164
167
170
173
176
179
182
185
188
191
194
197
199
202
205
208
211 {
212 _vprCallbackFunction = cb;
213 _vprCallbackFunctionObject = p;
214 resetViewportRegion();
215 }
216
219 {
220 _prevInVPR = SbViewportRegion(0, 0);
221 };
222
223
224protected:
227
229 SbViewVolume::ProjectionType _projType;
231
233
236
238 int getInterpretedPosition(float value, int width, int height, bool isY, ReferenceMode refMode, DomainMode domMode);
239
241 int getInterpretedSize(float value, int width, int height, DomainMode domMode);
242
245 {
246 resetViewportRegion();
247 };
248
249
250private:
251 SbBool _calcBBoxIntern;
252
253 CallbackFunctionPtr _vprCallbackFunction;
254 void* _vprCallbackFunctionObject;
255};
256
257#endif // __SoViewportRegion_H
#define SOUTILS_EXPORT
System dependent includes. Disables some compiler/linker warnings.
SbViewportRegion(* CallbackFunctionPtr)(void *, SbViewportRegion)
SoViewportRegion()
Constructor.
SoSFFloat y1
First value for viewport region definition in the y-dimension (lower border, upper border or center)
SbViewVolume::ProjectionType _projType
SoSFBool mapEventToViewport
Enable/Disable mapping of event coordinates to the viewport region.
SoSFBool forwardEvents
Enable/Disable forwarding of events to children.
SoSFBool renderDelayedPaths
Enable/Disable delayed path rendering.
SoSFEnum x2ReferenceMode
Reference for x2.
SoSFBool forwardEventsInViewportOnly
If true, only events that occurred in the viewport region will be forwarded.
int getInterpretedPosition(float value, int width, int height, bool isY, ReferenceMode refMode, DomainMode domMode)
Interprets value as position in relation to given size based on the ReferenceMode and the DomainMode.
SoSFEnum x1DomainMode
Domain of x1.
SbViewportRegion getViewportRegion(SoState *state)
Computes the ViewportRegion.
SoSFFloat borderAlpha
Alpha used for drawing the border.
SoRef< SoCamera > _insetCam
void onVPRFieldChanged(SoField *)
Called on changes of fields that may influence the viewport region definition.
SoSFFloat x2
Second value for viewport region definition in the x-dimension (width or right border)
SoSFEnum x2DomainMode
Domain of x1.
SoSFEnum yPositionMode
Define how specify the viewport region in the y-dimension.
SoSFBool autoScaleAbsoluteValuesHiDPI
Enable automatic rescaling of absolute values in high DPI rendering.
void GLRenderBelowPath(SoGLRenderAction *action) override
Reimplemented GLRenderBelowPath to render child graph with modified viewportSize.
SoSFEnum y1ReferenceMode
Reference for y1.
SoSFBool consumeEventsInViewport
Enable/Disable consumption of handled events.
SoSFBool cacheViewportRegion
Enable caching of viewport region.
ProjectionType _prevProjType
void getBoundingBox(SoGetBoundingBoxAction *action) override
Get bounding box.
SoSFFloat y2
Second value for viewport region definition in the y-dimension (height or upper border)
SoSFColor borderColor
Color used for drawing the border.
SoSFBool enableBackground
Enable/Disable drawing of a background.
SoSFBool usePreviousVP
Enable/Disable relative viewport region modification.
SoSFBool on
! Fields
SoSFEnum projectionType
Used ProjectionType.
SoSFFloat x1
First value for viewport region definition in the x-dimension (right border, left border or center)
SoSFFloat backgroundAlpha
Alpha used for drawing the background.
SoSFBool detectMouseOver
Enable/Disable mouse over detection.
SbViewportRegion _prevInVPR
SoSFEnum x1ReferenceMode
Reference for x1.
static void initClass()
Initializes this class (called on dll initialization).
SoSFEnum xPositionMode
Define how specify the viewport region in the x-dimension.
SoSFBool enableBorder
Enable/Disable drawing of a border.
int getInterpretedSize(float value, int width, int height, DomainMode domMode)
Interprets value as size in relation to given size based on the DomainMode.
SoSFBool mouseOverViewport
Indicates if the mouse is over the viewport region.
SoSFInt32 borderWidth
Width of the border.
SoSFBool useViewportRegionDefinitionCallback
Enable usage of callback function for viewport region definition.
SoSFBool modifyVP
Enable/Disable viewport region modification.
SoSFEnum y2ReferenceMode
Reference for y2.
void resetViewportRegion()
resets _prevInVPR and therfore forces recomputation of the viewport region
~SoViewportRegion() override
Destructor.
void handleEvent(SoHandleEventAction *action) override
Handle event is reimplemented to forward events with modified viewportSize.
SoSFEnum y1DomainMode
Domain of y1.
SoSFColor backgroundColor
Color used for drawing the background.
SoSFEnum y2DomainMode
Domain of y2.
@ AUTO
same type as previous camera in state
void connectViewportRegionDefinitionCallback(CallbackFunctionPtr cb, void *p)
Called by wrapper to create connection.
SoSFBool keepViewportWhileDragging
Do not change into/out of viewport while dragging (hold mouse button pressed)
Target mlrange_cast(Source arg)
Generic version of checked ML casts.