MeVisLab Toolbox Reference
SoActionLog.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2013, 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_ACTION_LOG_H
14 #define SO_ACTION_LOG_H
15 
16 // Include base-class header.
17 #include <Inventor/nodes/SoSubNode.h>
18 // Include field headers.
19 #include <Inventor/fields/SoSFBool.h>
20 #include <Inventor/fields/SoSFString.h>
21 #include <Inventor/fields/SoSFTrigger.h>
22 #include <Inventor/sensors/SoFieldSensor.h>
23 
24 #include <string>
25 
26 // Forward declarations
27 class SoGLRenderAction;
28 class SoCallbackAction;
29 class SoGetBoundingBoxAction;
30 class SoGetMatrixAction;
31 class SoHandleEventAction;
32 class SoPickAction;
33 class SoRayPickAction;
34 class SoSearchAction;
35 class SoWriteAction;
36 
37 // Declare SoActionLog node being a subnode of a SoNode
38 class SoActionLog : public SoNode
39 {
40  // Make a typedef of the parent type to allow easier adaptation of
41  // the sourcecode if the parent node should change.
42  typedef SoNode inherited;
43 
44  // Insert sourcecode common to all subnodes of Open-Inventor.
45  SO_NODE_HEADER(SoActionLog);
46 
47  public:
48 
49  SoSFBool traceGLRender;
50  SoSFBool traceCallback;
52  SoSFBool traceGetMatrix;
53  SoSFBool traceHandleEvent;
61  SoSFBool tracePick;
62  SoSFBool traceRayPick;
63  SoSFBool traceSearch;
64  SoSFBool traceWrite;
65 
66  SoSFBool printViewerId;
67 
69  SoSFBool logToConsole;
70 
72  SoSFBool logToString;
74  SoSFString jsonLog;
75 
77  SoSFTrigger clearLog;
78 
81 
82  protected:
83 
85  ~SoActionLog() override;
86 
87  public:
88 
90  void GLRender(SoGLRenderAction *action) override;
91  void callback(SoCallbackAction *action) override;
92  void getBoundingBox(SoGetBoundingBoxAction *action) override;
93  void getMatrix(SoGetMatrixAction *action) override;
94  void handleEvent(SoHandleEventAction *action) override;
95  void pick(SoPickAction *action) override;
96  void rayPick(SoRayPickAction *action) override;
97  void search(SoSearchAction *action) override;
98  void write(SoWriteAction *action) override;
99 
101  static void initClass();
102 
103  private:
104  void addEntryToJSON(const std::string& str);
105 
106  void clearLogChangedCB(SoField* field);
107 
108  void* getViewerId(SoAction* action);
109  std::string getViewerIdEntry(SoAction* action);
110 };
111 
112 #endif // _SOACTIONLOG_H
~SoActionLog() override
Destructor.
SoSFBool traceUnknownEvent
Definition: SoActionLog.h:60
void write(SoWriteAction *action) override
SoSFBool tracePick
Definition: SoActionLog.h:61
SoSFBool traceLocation2Event
Definition: SoActionLog.h:54
SoSFBool traceEnterLeaveEvent
Definition: SoActionLog.h:58
SoSFBool traceMouseWheelEvent
Definition: SoActionLog.h:59
SoSFBool traceGetBoundingBox
Definition: SoActionLog.h:51
SoSFTrigger clearLog
clears jsonLog immediately
Definition: SoActionLog.h:77
void handleEvent(SoHandleEventAction *action) override
SoSFBool traceWrite
Definition: SoActionLog.h:64
SoSFBool logToString
flag to enable logging to jsonLog string
Definition: SoActionLog.h:72
SoSFBool traceCallback
Definition: SoActionLog.h:50
void search(SoSearchAction *action) override
SoSFBool traceRayPick
Definition: SoActionLog.h:62
void GLRender(SoGLRenderAction *action) override
Action handlers.
void pick(SoPickAction *action) override
void getMatrix(SoGetMatrixAction *action) override
SoSFBool logToConsole
flag to enable logging to console
Definition: SoActionLog.h:69
static void initClass()
Register this node with the Open Inventor runtime system.
SoSFBool traceHandleEvent
Definition: SoActionLog.h:53
SoSFBool traceSearch
Definition: SoActionLog.h:63
SoSFBool traceGLRender
Definition: SoActionLog.h:49
void callback(SoCallbackAction *action) override
SoSFBool traceKeyboardEvent
Definition: SoActionLog.h:57
void getBoundingBox(SoGetBoundingBoxAction *action) override
SoSFBool traceLocation2RefreshEvent
Definition: SoActionLog.h:55
SoActionLog()
Constructor.
SoSFBool traceMouseButtonEvent
Definition: SoActionLog.h:56
SoSFBool traceGetMatrix
Definition: SoActionLog.h:52
SoSFBool printViewerId
Definition: SoActionLog.h:66
void rayPick(SoRayPickAction *action) override
SoSFString jsonLog
contains the logged events in JSON format
Definition: SoActionLog.h:74