MeVisLab Toolbox Reference
SoView2DPlane.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#pragma once
14
16
17#include <Inventor/fields/SoSFPlane.h>
18#include <Inventor/fields/SoSFFloat.h>
19#include <Inventor/fields/SoSFVec3f.h>
20#include <Inventor/fields/SoSFBool.h>
21#include <Inventor/fields/SoSFInt32.h>
22#include <Inventor/fields/SoSFMatrix.h>
23
24class SoView2D;
25
27{
28 SO_NODE_HEADER(SoView2DPlane);
29
30public:
36
41
43
46
51
55
95
97 static void initClass();
98
101
103 void draw(View2DSliceList *dsl, View2DSlice* dslice, int slice) override;
104
107 View2DEvent* ec, View2DEventPhase phase) override;
108
110
111protected:
113 void clipLinePoint (float &p1x, float &p1y, float p2x, float p2y,
114 float x0, float x1);
115
118
121
124
126 enum HIT_MODE {NO_HIT, HIT_ROTATE, HIT_TRANSLATE, HIT_CENTER};
127
130
132 void dragMoveTo(const SbVec3f& point, View2DSliceList* slicelist);
133
137 bool isSensitiveAt(const SoPointerPosition& pos) override;
138 void startPressAt(const SoPointerPosition& pos) override;
139 void dragMoveTo(const SoPointerPosition& pos) override;
140 SoPointingAction* endPress(int clickCount) override;
142
143private:
145 SbVec3f _edge[2];
146
148 float _oldDistance;
149
151 SbVec3f _rotPos;
152
154 SbVec3f _startPos, _lastPos;
155
157 HIT_MODE _eventHitMode;
159 int _cursorShape;
160
161 SbBool _rotPosIsValid;
162};
@ ARROW
Renders an arrow tip at the endpoint.
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...
SoSFFloat translationRangeMax
maximum value for plane parameter d
SoSFBool normalOn
draw normal
SoSFFloat centerGapSize
don't draw plane around rotationAxis (only if fixedLineWidth is set), gap size in pixels
SoSFBool fixedLineWidth
use translation range for plane parameter d
SoSFBool externalRotationAxisOn
set external rotation axis
void drawNormal(View2DSliceList *dsl, View2DSlice *dslice, SbVec2f p1, SbVec2f p2)
draw a normal on the slice
SoSFInt32 normalSize
size of normal to be drawn (in pixels)
bool clipToSliceRect(SbVec2f &p1, SbVec2f &p2, View2DSlice *dslice)
clip line to device rectangle of slice, returns false if nothing is left afterwards
SoSFEnum interactionMode
interaction mode plane can be rotated or translated or both
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
reimplemented from SoView2DExtension
SoSFBool useTranslationRange
use translation range for plane parameter d
SoView2DPlane()
Constructor.
void dragMoveTo(const SoPointerPosition &pos) override
SoSFFloat translationLineFraction
Fraction of the visible line that is associated with translation (percent)
SoSFBool allowMoveExternalRotationAxis
allow to move the external rotation axis point with mouse
SoSFFloat translationRangeMin
minimum value for plane parameter d
SoSFBool useMouseCursors
use mouse cursors to indicate next interaction
SoSFVec3f externalRotationAxis
external rotation axis position
SoSFMatrix rotationDifference
Rotation between previous and current orientation.
bool isSensitiveAt(const SoPointerPosition &pos) override
static void initClass()
inventor runtime type system
bool evalEvent(SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
reimplemented from SoView2DExtension
void dragMoveTo(const SbVec3f &point, View2DSliceList *slicelist)
implement dragging, parameter is world position
SoSFFloat blendMax
maximum blend value
SoSFBool useAntiAliasing
use anti-aliasing for rendering lines
HIT_MODE _hitPlane(const SbVec3f &point, View2DSliceList *dsl, int &proposedCursorShape)
is mouse cursor on plane?
SoSFBool maskValidAndHit
gives the state of the mask, which calculated by the current mousebuttons and modifier key compared t...
SoSFFloat normalOffset
offset of the normal from the plane
void startPressAt(const SoPointerPosition &pos) override
int getCurrentCursor(SoViewerProxy *viewerProxy) override
interface forwarded from SoPointingAction:
SoSFBool shadowOn
draw shadow
void clipLinePoint(float &p1x, float &p1y, float p2x, float p2y, float x0, float x1)
clip a line and a point in 2D, returns new point in p1x,p1y
void setExternalRotationAxis(SbVec3f rotPosition)
SoSFFloat blendMin
minimum blend value
HIT_MODE
describes if we hit the line and how
SoPointingAction * endPress(int clickCount) override
void drawPlaneLine(View2DSliceList *dsl, View2DSlice *dslice, SbVec2f p1, SbVec2f p2)
draw plane line, possibly including the normal indicator
SoSFPlane plane
Fields.
SoSFEnum normalShape
shape of normal indicator
SoView2D is a 2D viewer for image data.
Definition SoView2D.h:62
This class gives access to state of a viewer during scene graph traversal.
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.