MeVisLab Toolbox Reference
SoView2DRectangle.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
15
16#pragma once
17
19#include "SoView2DLabel.h"
20
21#include <Inventor/fields/SoSFVec3f.h>
22#include <Inventor/fields/SoSFInt32.h>
23
26{
27 SO_NODE_HEADER(SoView2DRectangle);
28
29public:
30
32
37
50
53
56
59
62
68
71
74
77
84
91
93
95 static void initClass();
96
99
101 void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override;
102
104 void drawLabelText(float px, float py, float qx, float qy);
105
108 View2DEvent* ec, View2DEventPhase phase) override;
109
111 bool ignoreEvent(View2DEvent* ec) override;
112
113protected:
115 enum DragMode {DragNothing, DragAnyPoint, DragRect, DragCreateRect};
116
119 DragMode performHitTest(int dx1, int dy1, const SbVec3f& voxelPos, View2DSliceList* slicelist);
120
122 void performDrag(const SbVec3f& voxelPos, bool setStart, View2DSliceList* slicelist);
123
126 bool isSensitiveAt(const SoPointerPosition& pos) override;
127 void startPressAt(const SoPointerPosition& pos) override;
128 void dragMoveTo(const SoPointerPosition& pos) override;
129 SoPointingAction* endPress(int clickCount) override;
130 void pointerPosition(SoState*, const SoPointerPosition& pos) override;
131 void pointerLeftWindow(SoState*) override;
133
136
143
145 bool _dragx;
147 bool _dragy;
149
150 bool isSliceInMiddleOfRectangleExcludingTopAndBottom( int slice, float vz1, float vz2 ) const;
151 bool isSliceIntersectingRectangle( int slice, float vz1, float vz2 ) const;
152
155
158};
View2DEventPhase
event phase for simple extensions that grab the focus, do something (motion) and are released afterwa...
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
SoView2DInteractionExtension is base class for all SoView2DExtensions that want to support the Manage...
Allows drawing and editing of a rectangle on a SoView2D.
SoView2DRectangle()
Constructor.
bool isSensitiveAt(const SoPointerPosition &pos) override
interface forwarded from SoPointingAction:
SoSFFloat lineBlendOnto
line blend factor when on border of rectangle
bool isSliceIntersectingRectangle(int slice, float vz1, float vz2) const
SoSFInt32 labelFontSize
font size of text
SoSFFloat labelHorizontalOffset
void drawLabelText(float px, float py, float qx, float qy)
draws the label (given top-left/bottom-right positions of the rectangle on the slice)
SoSFBool selectOutside
allow selection outside of rectangle
void dragMoveTo(const SoPointerPosition &pos) override
SoSFBool shadeAllExterior
shade all exterior, also there where the slice does not cross the box.
void performDrag(const SbVec3f &voxelPos, bool setStart, View2DSliceList *slicelist)
perform drag operation (this uses members set by performHitTest)
SoSFFloat labelVerticalOffset
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
reimplemented from SoView2DExtension
DragMode _dragMode
specify drag mode
void startPressAt(const SoPointerPosition &pos) override
DragMode
type for specifying dragging mode
SoSFFloat blendInside
blend factor inside of rectangle
SbVec3f _lastWorldPos
last world position
bool evalEvent(SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
reimplemented from SoView2DExtension
bool _dragy
flag if y is dragged
SoSFFloat blendOutside
blend factor outside of rectangle
void pointerPosition(SoState *, const SoPointerPosition &pos) override
Same as below, with additional SoState argument. Be defaults simply calls the below version.
SoSFBool isUnderMouse
flag that indicated is the rectangle is under the mouse
SoSFBool cooperative
enable cooperative mode
SoSFFloat shadeExterior
shade the exterior of the rectangle
SoSFEnum labelHorizontalPosition
bool _xhigher
flags for DragAnyPoint modeinternal flag
SoSFEnum labelVerticalBoxPosition
SoSFVec3f endWorldPos
end world position of rectangle
bool isSliceInMiddleOfRectangleExcludingTopAndBottom(int slice, float vz1, float vz2) const
SoSFEnum lineStyle
line style
bool _yhigher
internal flag
SoSFFloat lineBlendInside
line blend factor when inside of rectangle
SoPointingAction * endPress(int clickCount) override
SoSFBool resetToImage
reset to 80 percent of the original image
SoSFFloat lineBlendOutside
line blend factor when outside of rectangle
static void initClass()
inventor runtime type system
bool _draggingInCooperativeMode
to remember in cooperative mode, if the rectangle is currently selected and edited
SoSFFloat blendOnto
blend factor on border of rectangle
bool _dragx
flag if x is dragged
DragMode performHitTest(int dx1, int dy1, const SbVec3f &voxelPos, View2DSliceList *slicelist)
perform hit test where the rectangle is hit, returns false if the rectangle wasn't hit at all
SoSFEnum labelHorizontalBoxPosition
bool ignoreEvent(View2DEvent *ec) override
Overwrite ignoreEvent -> ignore the "ignoreHandledEvents"-Field.
SoSFColor labelColor
text color to use
SoSFBool labelShadow
flag if text shadow should be drawn
SoSFVec3f startWorldPos
Fields.
SoSFBool allowDrag
allow dragging of the rectangle
void pointerLeftWindow(SoState *) override
Same as below, with additional SoState argument. Be defaults simply calls the below version.
SoView2D is a 2D viewer for image data.
Definition SoView2D.h:62
View2DEvent stores all information on an event on a SoView2D.
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.