MeVisLab Toolbox Reference
SoPicking.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_PICKING_H
14 #define SO_PICKING_H
15 
16 
18 
19 #include <Inventor/nodes/SoSelection.h>
20 #include <Inventor/fields/SoSFTrigger.h>
21 #include <Inventor/fields/SoSFBool.h>
22 #include <Inventor/fields/SoSFEnum.h>
23 #include <Inventor/fields/SoSFVec3f.h>
24 #include <Inventor/fields/SoSFColor.h>
25 #include <Inventor/fields/SoSFVec4f.h>
26 #include <Inventor/fields/SoSFFloat.h>
27 #include <Inventor/fields/SoSFInt32.h>
28 #include <Inventor/fields/SoSFString.h>
29 #include <Inventor/fields/SoSFEnum.h>
30 #include <Inventor/fields/SoSFPath.h>
31 #include <Inventor/actions/SoCallbackAction.h>
32 
33 #include <SoInteractionNode.h>
34 
35 class SoNodeSensor;
36 class SoDataSensor;
37 class SoHandleEventAction;
38 
40 {
41  SO_NODE_HEADER(SoPicking);
42 
43  friend class SoPickingPickAction;
44 
45 public:
46 
49 
51  static void initClass();
52 
55  SoSFVec3f objectLocal;
56  SoSFVec3f objectWorld;
57  SoSFVec3f normalLocal;
58  SoSFVec3f normalWorld;
59  SoSFVec3f textureLocal3;
60  SoSFVec3f textureWorld3;
61  SoSFVec4f textureLocal4;
62  SoSFVec4f textureWorld4;
63  SoSFBool pointPicked;
64 
66  SoSFColor diffuseColor;
67 
69  SoSFPath pickedPath;
70 
71  SoSFBool highlighted;
72  SoSFBool buttonPressed;
73  SoSFInt32 clickCount;
74 
75  SoSFBool enabled;
79  SoSFEnum cursorShape;
80  SoSFString actionID;
81 
82  SoSFBool highlighted2;
83  SoSFBool buttonPressed2;
84  SoSFInt32 clickCount2;
85 
86  SoSFBool enabled2;
89  SoSFEnum cursorShape2;
90  SoSFString actionID2;
91 
92  SoSFBool highlighted3;
93  SoSFBool buttonPressed3;
94  SoSFInt32 clickCount3;
95 
96  SoSFBool enabled3;
99  SoSFEnum cursorShape3;
100  SoSFString actionID3;
101 
103 
104 protected:
106 
108  void pointerPosition(const SoPointerPosition& pos) override;
109 
112  void pointerLeftWindow() override;
113 
114 private:
116  void _updatePickedPoint(SoHandleEventAction *action);
117 
118  void _updateActionID(SoField* field = nullptr);
119  void _updateActionEnabled(SoField* field = nullptr);
120 
121  void _updateActionID2(SoField* field = nullptr);
122  void _updateActionEnabled2(SoField* field = nullptr);
123 
124  void _updateActionID3(SoField* field = nullptr);
125  void _updateActionEnabled3(SoField* field = nullptr);
126 
127  void _updateContinouslyCalled(SoField* field = nullptr);
128 
129  SoPointingAction* _pickPointAction;
130  SoPointingAction* _pickPointAction2;
131  SoPointingAction* _pickPointAction3;
132 
133  // Used as userData for postTailCallback
134  struct PickingHelper {
135  SbColor diffuseColor;
136  int materialIndex;
137  };
138  static SoCallbackAction::Response postTailCallback(void *userData,
139  SoCallbackAction *action,
140  const SoNode *node);
141 };
142 
143 #endif
144 
SoInteractionNode is the base class for normal interaction nodes in OpenInventor that handle their in...
void pointerPosition(SoState *state, const SoPointerPosition &pos) override
Same as below, with additional SoState argument. By default, simply calls the below version.
virtual void pointerLeftWindow()
This is called when the mouse cursor leaves the window.
SoSFBool updateWhileDragging2
Definition: SoPicking.h:87
void pointerLeftWindow() override
This is called when the mouse cursor leaves the window.
SoSFEnum cursorShape
Definition: SoPicking.h:79
SoSFVec3f objectWorld
Definition: SoPicking.h:56
SoSFVec3f objectLocal
Definition: SoPicking.h:55
SoSFInt32 clickCount3
Definition: SoPicking.h:94
SoSFVec3f normalWorld
Definition: SoPicking.h:58
SoSFBool enableColorPicking
Definition: SoPicking.h:65
SoSFBool highlighted
Definition: SoPicking.h:71
SoSFBool pointPicked
Definition: SoPicking.h:63
SoSFInt32 clickCount
Definition: SoPicking.h:73
SoSFBool performPreClickTest
Definition: SoPicking.h:77
SoSFEnum cursorShape2
Definition: SoPicking.h:89
SoSFBool updateContinuously
Definition: SoPicking.h:78
SoSFVec3f textureLocal3
Definition: SoPicking.h:59
SoSFBool performPreClickTest3
Definition: SoPicking.h:98
SoSFVec3f normalLocal
Definition: SoPicking.h:57
SoSFPath pickedPath
Definition: SoPicking.h:69
SoSFBool enabled2
Definition: SoPicking.h:86
SoSFBool updateWhileDragging3
Definition: SoPicking.h:97
SoSFString actionID3
Definition: SoPicking.h:100
SoSFBool buttonPressed
Definition: SoPicking.h:72
friend class SoPickingPickAction
Definition: SoPicking.h:43
SoSFString actionID
Definition: SoPicking.h:80
SoSFVec3f textureWorld3
Definition: SoPicking.h:60
SoSFVec4f textureLocal4
Definition: SoPicking.h:61
SoSFEnum cursorShape3
Definition: SoPicking.h:99
SoPicking()
Constructor.
SoSFVec4f textureWorld4
Definition: SoPicking.h:62
SoSFBool buttonPressed2
Definition: SoPicking.h:83
SoSFString actionID2
Definition: SoPicking.h:90
SoSFBool updateWhileDragging
Definition: SoPicking.h:76
SoSFBool highlighted3
Definition: SoPicking.h:92
void pointerPosition(const SoPointerPosition &pos) override
this is called for every mouse move
SoSFBool enabled
Definition: SoPicking.h:75
SoSFBool buttonPressed3
Definition: SoPicking.h:93
SoSFBool enablePathPicking
Definition: SoPicking.h:68
SoSFColor diffuseColor
Definition: SoPicking.h:66
static void initClass()
Initializes this class.
SoSFBool performPreClickTest2
Definition: SoPicking.h:88
SoSFInt32 clickCount2
Definition: SoPicking.h:84
SoSFBool highlighted2
Definition: SoPicking.h:82
SoSFBool enabled3
Definition: SoPicking.h:96
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.