MeVisLab Toolbox Reference
SoPlaneDragger.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_PLANE_DRAGGER_H
14 #define SO_PLANE_DRAGGER_H
15 
17 
18 #include "SoUtilsSystem.h"
19 
20 #include <ThirdPartyWarningsDisable.h>
21 #include <Inventor/draggers/SoJackDragger.h>
22 #include <Inventor/fields/SoSFPlane.h>
23 #include <Inventor/fields/SoSFBool.h>
24 #include <Inventor/fields/SoSFColor.h>
25 #include <Inventor/nodes/SoMaterial.h>
26 #include <ThirdPartyWarningsRestore.h>
27 
28 class SoViewerProxy;
29 
31 
34 class SoPlaneDragger : public SoJackDragger
35 {
36  SO_KIT_HEADER(SoPlaneDragger);
37 
38 public:
39  // Constructor
41 
43  SoSFPlane plane;
44 
45  SoSFBool drawPlane;
47  SoSFBool enableRotation;
48 
51 
52  SoSFColor planePassivColor;
53  SoSFColor planeActiveColor;
54 
56  static void initClass();
57 
59  void fieldChanged(SoField* field=nullptr);
60 
61  void handleEvent(SoHandleEventAction *ha) override;
62 
63  void updateHighlightWithPickedPoint(SoHandleEventAction * ha);
64 
66 
67 protected:
68  ~SoPlaneDragger() override;
69 
70 private:
72  SoDrawStyle* _drawStyleP1;
74  SoPickStyle* _pickStyleTranslator;
76  SoPickStyle* _pickStyleRotator;
77 
79  SoMaterial* _planePassivMaterial;
81  SoMaterial* _planeActiveMaterial;
82 
83  SoNode* _pickSphere;
84  SoNode* _pickLineSet;
85  SoNode* _pickFaceSet;
86 
87  enum HighlightState {
88  HIGHLIGHT_NONE,
89  HIGHLIGHT_TRANSLATOR,
90  HIGHLIGHT_ROTATOR,
91  };
92 
93  void setHighlightState(HighlightState state);
94 
95  static void finishedDraggingCB(void *userData, SoDragger *dragger);
96 
97  SoSwitch* _translatorHighlightSwitch;
98  SoSwitch* _rotatorHighlightSwitch;
99  HighlightState _lastHighlightState;
100  SoViewerProxy* _lastViewerProxy;
101 };
102 
103 #endif
Defines a plane dragger that can be used to manipulate a plane (and translation+rotation)
void fieldChanged(SoField *field=nullptr)
handle field changes
SoSFBool enableMouseOverCursor
void setCursorForState()
SoSFBool drawPlane
SoSFBool enableTranslation
void updateHighlightWithPickedPoint(SoHandleEventAction *ha)
SoSFBool enableRotation
~SoPlaneDragger() override
SoSFColor planePassivColor
SoSFColor planeActiveColor
static void initClass()
inventor runtime type system
SoSFPlane plane
plane that the dragger currently represents
void handleEvent(SoHandleEventAction *ha) override
SoSFBool enableMouseOverHighlight
This class gives access to state of a viewer during scene graph traversal.
Definition: SoViewerProxy.h:30