VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSceneGraphTreeLogic.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 #pragma once
9 
10 #include <vrvOsgQt/vrvOsgQt.h>
11 
12 #if !defined(Q_MOC_RUN)
14 #endif
15 
16 #include <osg/observer_ptr>
17 #include <osg/Node>
18 #include <osg/ShapeDrawable>
19 
20 #include <QtWidgets/QAction>
21 
22 #if !defined(Q_MOC_RUN)
23 #include <tbb/task.h>
24 #endif
25 
26 #include <vector>
27 
28 namespace osg
29 {
30  class Node;
31  class Drawable;
32  class Geode;
33 }
34 
35 class QIcon;
36 class QMenu;
37 class QTreeWidgetItem;
38 
39 namespace makVrv
40 {
41 
42  class DtDe;
43  class DtSceneGraphTreeWidgetInterface;
44  class DtSceneGraphTreeLogic;
45 
47  {
48  public:
49  virtual bool shouldExpandTo(const osg::Node* node);
50  };
51 
52  //custom actions for context menu
54  {
55  Q_OBJECT
56  public:
57  DtDrawBoundsAction(QObject* parent);
58  virtual ~DtDrawBoundsAction();
59 
60  public:
61  virtual void removeVolume();
62  virtual void setNode(const osg::Node* node);
63  virtual bool isNodeWithBV(const osg::Node* node);
64 
65  virtual void setAABoundingBoxMode();
66 
67  public slots:
68 
69  void slot_triggered(bool);
70 
71  private:
72  osg::observer_ptr<const osg::Node> myNode;
73  osg::observer_ptr<const osg::Node> myBVAttachedNode;
74  osg::observer_ptr<osg::ShapeDrawable> myBoundingVolumeDrawable;
78  };
79 
80  //custom actions for context menu
82  {
83  Q_OBJECT
84  public:
86  virtual ~DtRefreshNodeAction();
87  virtual void setNode(const osg::Node* node, QTreeWidgetItem* item);
88  virtual bool shouldExpandTo(const osg::Node* node);
89 
90  public slots:
91  void slot_triggered(bool);
92 
93  private:
94  osg::observer_ptr<const osg::Node> myNode;
97 
98  };
99 
102  {
103  Q_OBJECT
104  public:
106  DtColorSubTreeAction(QObject* parent);
107 
109  virtual ~DtColorSubTreeAction();
110 
111  public:
112 
114  virtual void setNode(osg::Node* node);
115 
117  virtual osg::Node* colorizedNode();
118 
119  public slots:
120 
122  virtual void slot_triggered(bool);
123 
124  protected:
126  virtual void unColorizeNode();
128  virtual void colorizeNode();
129 
130  protected:
131  osg::observer_ptr<osg::Node> myContextMenuNode;
132  osg::observer_ptr<osg::Node> myColorizedNode;
133  };
134 
135  //custom actions for context menu
137  {
138  Q_OBJECT
139  public:
141  virtual ~DtExpandItemAction();
142  virtual void setNode(const osg::Node* node, QTreeWidgetItem* item);
143  virtual bool shouldExpandTo(const osg::Node* node);
144  virtual void recursiveVisit(QTreeWidgetItem* item);
145 
146  public slots:
147  void slot_triggered(bool);
148 
149  protected:
150  osg::observer_ptr<const osg::Node> myNode;
153  };
154 
156  {
157  Q_OBJECT
158  public:
160  virtual bool shouldExpandTo(const osg::Node* node) { return true; };
161 
162  };
163 
165  {
166  Q_OBJECT
167  public:
169 
170  virtual bool shouldExpandTo(const osg::Node* node);
171 
172  };
173 
175  {
176  public:
178  {
179  //Do Nothing
180  }
181  virtual bool shouldExpandTo(const osg::Node* node);
182  };
183 
185  {
186  public:
188  {
189  //Do Nothing
190  }
191  virtual bool shouldExpandTo(const osg::Node* node);
192  };
193 
194  //custom actions for context menu
196  {
197  Q_OBJECT
198 
199  public:
201  virtual ~DtAddOcclusionNodeAction();
202 
203  public:
204  virtual void setNode(const osg::Node* node, QTreeWidgetItem* item);
205 
206  public slots:
207  virtual void slot_triggered(bool);
208 
209  private:
210  osg::observer_ptr<const osg::Node> myNode;
213 
214  };
215 
218  {
219  public:
221  virtual ~DtSearchSceneGraphAction();
222 
224  virtual QTreeWidgetItem* getPreviousNode(const std::string& query);
225 
227  virtual QTreeWidgetItem* getNextNode(const std::string& query);
228 
229  virtual void setSearchQuery(const std::string& query);
230 
232  virtual void search(QTreeWidgetItem* node);
233 
235  virtual void reset();
236 
238  virtual size_t getCurrentIndex();
239 
241  virtual bool hasResults(const std::string& query);
242 
244  virtual size_t getTotalResults(const std::string& query);
245 
246  private:
248  std::string mySearchQuery;
249  std::vector<QTreeWidgetItem*> mySearchResults;
250 
252  };
253 
257  {
258  public:
259  typedef osg::observer_ptr<const osg::Node> NodeObsPtr;
260  typedef std::map<QTreeWidgetItem*, NodeObsPtr> WidgetToNodeMap;
261 
262  public:
263 
265  {
277  Overlays
278  };
279 
280  protected:
281 
284 
286  virtual void init();
287 
290 
291  public:
293  virtual ~DtSceneGraphTreeLogic();
294 
295  private:
299  DtSceneGraphTreeLogic &operator=(const DtSceneGraphTreeLogic &other);
300 
301  public:
302 
304  virtual void clearAndTraverse();
305 
306  virtual void clearAndTraverse(int domain);
307 
309  virtual bool iterateNode(QTreeWidgetItem* pParent, const osg::Node* pNode, bool bDrawIcon = true);
310 
311  virtual void buildContextMenu(QMenu* menu, QTreeWidgetItem* item);
312 
313  NodeObsPtr getNode(QTreeWidgetItem* item);
314 
315  virtual void displayPrevious(const std::string& query);
316  virtual void displayNext(const std::string& query);
317  virtual std::string getSearchStatusText(const std::string& query);
318 
319  virtual void resetSearchAction();
320 
321  private:
322 
324  const QIcon & getNodeIcon(const osg::Node* pNode);
325  const QIcon & getDrawableIcon(const osg::Drawable* drawable);
326 
327  protected:
328 
331 
343  QIcon mySunIcon;
344  QIcon mySkyIcon;
346  QIcon myGeodeIcon;
348  QIcon myEmptyIcon;
350 
351  };
352 
357  {
358  public:
359  // CTOR
361 
363  virtual ~DtSceneGraphTreeLogicCreator();
364 
365  private:
370 
371  public:
373  static DtSceneGraphTreeLogicCreator& instance(DtDe& de);
374 
376  static void registerInstance(DtDe& de,
377  DtSceneGraphTreeLogicCreator* instance);
378 
382  protected:
384  };
385 }
386 
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:151
QIcon myGeodeIcon
Definition: DtSceneGraphTreeLogic.h:346
QIcon myGeometryIcon
Definition: DtSceneGraphTreeLogic.h:347
QTreeWidgetItem * myItem
Definition: DtSceneGraphTreeLogic.h:96
DtDe & myDe
Definition: DtSceneGraphTreeLogic.h:329
std::vector< QTreeWidgetItem * > mySearchResults
Definition: DtSceneGraphTreeLogic.h:249
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
QTreeWidgetItem * myItem
Definition: DtSceneGraphTreeLogic.h:212
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:95
Contains makVrv::DtSubjectObserver class.
The DtSceneGraphTreeLogicCreator creator for the DtSceneGraphTreeLogicCreator class. Registered in vrvSt.cxx.
Definition: DtSceneGraphTreeLogic.h:356
Definition: DtSceneGraphTreeLogic.h:276
SceneGraphRoot
Definition: DtSceneGraphTreeLogic.h:264
DtExpandToLightsAction * myExpandLightNodesAction
Definition: DtSceneGraphTreeLogic.h:340
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:72
QIcon mySkyIcon
Definition: DtSceneGraphTreeLogic.h:344
osg::observer_ptr< osg::Node > myContextMenuNode
Definition: DtSceneGraphTreeLogic.h:131
Definition: DtSceneGraphTreeLogic.h:273
Context menu item for colorizing the current node and all it&#39;s children.
Definition: DtSceneGraphTreeLogic.h:101
DtDe & myDe
Definition: DtSceneGraphTreeLogic.h:383
osg::observer_ptr< const osg::Node > myBVAttachedNode
Definition: DtSceneGraphTreeLogic.h:73
Definition: DtSceneGraphTreeLogic.h:81
Definition: DtSceneGraphTreeLogic.h:270
Definition: DtSceneGraphTreeLogic.h:275
#define DT_DLL_VRVOSGQT
Definition: vrvOsgQt.h:22
std::string mySearchQuery
Definition: DtSceneGraphTreeLogic.h:248
Definition: DtSceneGraphTreeLogic.h:155
Definition: DtSceneGraphTreeLogic.h:274
QIcon mySunIcon
Definition: DtSceneGraphTreeLogic.h:343
DtSearchSceneGraphAction * mySearchAction
Definition: DtSceneGraphTreeLogic.h:342
DtSceneGraphTreeWidgetInterface * myWidgetInterface
Definition: DtSceneGraphTreeLogic.h:330
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:251
Contains DLL export macros.
Definition: DtSceneGraphTreeLogic.h:136
QIcon myCloudsIcon
Definition: DtSceneGraphTreeLogic.h:349
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:150
DtColorSubTreeAction * myColorSubTreeAction
Definition: DtSceneGraphTreeLogic.h:335
QTreeWidgetItem * myItem
Definition: DtSceneGraphTreeLogic.h:152
Definition: DtSceneGraphTreeLogic.h:267
DtExpandToGeometryAction(QObject *parent, DtSceneGraphTreeLogic *tree)
Definition: DtSceneGraphTreeLogic.h:177
Definition: DtSceneGraphTreeLogic.h:271
DtExpandToOQNAction * myExpandOcclusionNodesAction
Definition: DtSceneGraphTreeLogic.h:339
Logic for scene graph tree display widget.
Definition: DtSceneGraphTreeLogic.h:256
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:94
QIcon myEmptyIcon
Definition: DtSceneGraphTreeLogic.h:348
Definition: DtSceneGraphTreeLogic.h:195
WidgetToNodeMap myWidgetToNodeMap
Definition: DtSceneGraphTreeLogic.h:332
DtRefreshNodeAction * myRefreshAction
Definition: DtSceneGraphTreeLogic.h:336
DtDrawBoundsAction * myShowAABBoxAction
Definition: DtSceneGraphTreeLogic.h:334
DtAddOcclusionNodeAction * myOcclusionNodeAction
Definition: DtSceneGraphTreeLogic.h:341
search action for scene graph tab in the terrain information panel
Definition: DtSceneGraphTreeLogic.h:217
osg::observer_ptr< osg::ShapeDrawable > myBoundingVolumeDrawable
Definition: DtSceneGraphTreeLogic.h:74
Definition: DtSceneGraphTreeLogic.h:266
Definition: DtSceneGraphTreeLogic.h:164
osg::observer_ptr< osg::Node > myColorizedNode
Definition: DtSceneGraphTreeLogic.h:132
DtDrawBoundsAction * myShowBoundsAction
Definition: DtSceneGraphTreeLogic.h:333
Definition: DtSceneGraphTreeLogic.h:269
DtExpandAllAction * myExpandAllAction
Definition: DtSceneGraphTreeLogic.h:337
std::map< QTreeWidgetItem *, NodeObsPtr > WidgetToNodeMap
Definition: DtSceneGraphTreeLogic.h:260
bool myAABoundingBoxMode
Definition: DtSceneGraphTreeLogic.h:77
Definition: DtSceneGraphTreeLogic.h:268
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:210
Definition: DtSceneGraphTreeLogic.h:174
osg::ref_ptr< osg::Texture > myTexture
Definition: DtSceneGraphTreeLogic.h:76
size_t myCurrentIndex
Definition: DtSceneGraphTreeLogic.h:247
Definition: DtSceneGraphTreeLogic.h:272
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:211
osg::ref_ptr< osg::Image > myImage
Definition: DtSceneGraphTreeLogic.h:75
osg::observer_ptr< const osg::Node > NodeObsPtr
Definition: DtSceneGraphTreeLogic.h:259
Definition: DtSceneGraphTreeLogic.h:46
virtual bool shouldExpandTo(const osg::Node *node)
Definition: DtSceneGraphTreeLogic.h:160
DtExpandToLightsAction(QObject *parent, DtSceneGraphTreeLogic *tree)
Definition: DtSceneGraphTreeLogic.h:187
Definition: DtSceneGraphTreeLogic.h:53
QIcon myFolderIcon
Definition: DtSceneGraphTreeLogic.h:345
Definition: DtSceneGraphTreeLogic.h:184
Interface to a widget that displays the scene graph as a tree.
Definition: DtSceneGraphTreeWidgetInterface.h:22
DtExpandToGeometryAction * myExpandGeometryAction
Definition: DtSceneGraphTreeLogic.h:338

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)