MeVisLab Toolbox Reference
SoView2DTransRot.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 
18 #include "SoView2DExtension.h"
19 
20 #include <Inventor/fields/SoSFRotation.h>
21 #include <Inventor/fields/SoSFFloat.h>
22 #include <Inventor/fields/SoSFVec3f.h>
23 #include <Inventor/projectors/SbSphereSheetProjector.h>
24 
25 class SoView2D;
26 
28 
30 {
31  SO_NODE_HEADER(SoView2DTransRot);
32 
33 public:
38 
40  SoSFEnum mouseFunctionWheel; // mouse wheel is handled like a key pair
44 
46  SoSFBool adaptCursorShape;
47 
49  SoSFRotation rotation;
51  SoSFVec3f translation;
52 
54  SoSFFloat fieldOfView;
55 
57  static void initClass();
58 
61 
63  bool evalEvent(SoView2D* view2d, View2DSliceList* slicelist,
64  View2DEvent* ec, View2DEventPhase phase) override;
65 
66 private:
69  void doMouseFunction (int function, View2DSliceList* slicelist, View2DEvent* ec);
70 
71  void rotate (View2DSliceList* slicelist, const SbVec2f& relMousePos,
72  float sensitivity);
73  void rotateXAxis (View2DSliceList* slicelist,const SbVec2f& newMousePos,
74  const SbVec2f& deviceSize, float sensitivity);
75  void rotateYAxis (View2DSliceList* slicelist, const SbVec2f& newMousePos,
76  const SbVec2f& deviceSize, float sensitivity);
77  void rotateZAxis (View2DSliceList* slicelist, const SbVec2f& relMousePos,
78  float sensitivity);
79  void pan (View2DSliceList* slicelist, const SbVec2f& newMousePos,
80  float sensitivity);
81  void slice (View2DSliceList* slicelist, const SbVec2f& newMousePos,
82  float sensitivity);
83  void zoom (View2DSliceList* slicelist, const SbVec2f& newMousePos,
84  const SbVec2f& deviceSize, float sensitivity);
85 
88  virtual int getSuitableCursorShape (int function);
89 
93  void doStepFunction (int function, View2DSliceList* slicelist, bool up, bool shift);
94 
95  void panXStep (View2DSliceList* slicelist, float step);
96  void panYStep (View2DSliceList* slicelist, float step);
97  void sliceStep (View2DSliceList* slicelist, float step);
98  void rotXStep (View2DSliceList* slicelist, float step);
99  void rotYStep (View2DSliceList* slicelist, float step);
100  void rotZStep (View2DSliceList* slicelist, float step);
101  void zoomStep (float offset);
102 
103 private:
105  SbSphereSheetProjector spinprojector;
107  SbVec2f lastMousePos;
109  SbVec2f deviceOrigin, deviceSize;
112  bool mouseDown;
114  bool onImage;
115 
117  unsigned _prevWheelCode;
119  int _sumWheel;
120 };
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.
SoView2DExtension Base class for all View2DExtensions used for drawing and event handling on the View...
allows to edit a rotation and translation on a SoView2D
SoSFEnum keyFunctionVertCursor
SoSFFloat fieldOfView
field of view
SoSFEnum keyFunctionHoriCursor
bool evalEvent(SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
reimplemented from SoView2DExtension
SoSFVec3f translation
translation that is edited
SoView2DTransRot()
constructor
SoSFEnum mouseFunctionButton1and2
SoSFRotation rotation
rotation that is edited
SoSFBool adaptCursorShape
set this to true if the mouse cursor shape should reflect the current function
SoSFEnum mouseFunctionButton1
define active mouse function
static void initClass()
inventor runtime system init
SoSFEnum mouseFunctionButton2
SoSFEnum keyFunctionPageKeys
SoSFEnum mouseFunctionWheel
define active key function
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