VR-Forces 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) 2025 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 
196  {
197  public:
199  virtual ~DtSearchSceneGraphAction();
200 
202  virtual QTreeWidgetItem* getPreviousNode(const std::string& query);
203 
205  virtual QTreeWidgetItem* getNextNode(const std::string& query);
206 
207  virtual void setSearchQuery(const std::string& query);
208 
210  virtual void search(QTreeWidgetItem* node);
211 
213  virtual void reset();
214 
216  virtual size_t getCurrentIndex();
217 
219  virtual bool hasResults(const std::string& query);
220 
222  virtual size_t getTotalResults(const std::string& query);
223 
224  private:
226  std::string mySearchQuery;
227  std::vector<QTreeWidgetItem*> mySearchResults;
228 
230  };
231 
235  {
236  public:
237  typedef osg::observer_ptr<const osg::Node> NodeObsPtr;
238  typedef std::map<QTreeWidgetItem*, NodeObsPtr> WidgetToNodeMap;
239 
240  public:
241 
243  {
252  Overlays
253  };
254 
255  protected:
256 
259 
261  virtual void init();
262 
265 
266  public:
268  virtual ~DtSceneGraphTreeLogic();
269 
270  private:
274  DtSceneGraphTreeLogic &operator=(const DtSceneGraphTreeLogic &other);
275 
276  public:
277 
279  virtual void onDeactivate();
280 
282  virtual void clearAndTraverse();
283 
286  virtual void clearAndTraverse(int domain, int subdomain);
287 
289  virtual bool iterateNode(QTreeWidgetItem* pParent, const osg::Node* pNode, bool bDrawIcon = true);
290 
291  virtual void buildContextMenu(QMenu* menu, QTreeWidgetItem* item);
292 
294  virtual void setVisualizeNodeBounds(bool enable);
295 
297  virtual void setVisualizeLods(bool enable);
298 
300  virtual void onSelectTreeItem(QTreeWidgetItem* item);
301 
302  NodeObsPtr getNode(QTreeWidgetItem* item);
303 
304  virtual void displayPrevious(const std::string& query);
305  virtual void displayNext(const std::string& query);
306  virtual std::string getSearchStatusText(const std::string& query);
307 
308  virtual void resetSearchAction();
309 
316  virtual void computeFormattedNodeMaskText(unsigned int mask, QString& nodeMaskText);
317 
318  protected:
319 
321  virtual bool nodePathHasCameraParent(const osg::NodePath& nodePath) const;
322 
324  virtual const osg::Matrix computeNodeBoundsWorldMatrix(const osg::Node* node) const;
325 
327  virtual void visualizeNode(const osg::Node* node);
328 
330  virtual void visualizeLods(const osg::Node* node, const osg::Matrix& localToWorldMatrix,
331  const float boundsRadius);
332 
339  virtual void visualizeLod(const osg::LOD* lod, unsigned int lodIndex,
340  const osg::Matrix& localToWorldMatrix, const float boundsRadius,
341  const float brightness);
342 
344  virtual void removeVisulizationForNodeBounds();
345 
347  virtual void removeVisulizationForLods();
348 
349  private:
350 
352  const QIcon & getNodeIcon(const osg::Node* pNode);
353  const QIcon & getDrawableIcon(const osg::Drawable* drawable);
354 
355  protected:
356 
359 
369  QIcon mySunIcon;
370  QIcon mySkyIcon;
372  QIcon myGeodeIcon;
374  QIcon myEmptyIcon;
376 
379  unsigned int myVisualizeLodsCount;
380  };
381 
386  {
387  public:
388  // CTOR
390 
392  virtual ~DtSceneGraphTreeLogicCreator();
393 
394  private:
399 
400  public:
402  static DtSceneGraphTreeLogicCreator& instance(DtDe& de);
403 
405  static void registerInstance(DtDe& de,
406  DtSceneGraphTreeLogicCreator* instance);
407 
411  protected:
413  };
414 }
415 
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:151
QIcon myGeodeIcon
Definition: DtSceneGraphTreeLogic.h:372
QIcon myGeometryIcon
Definition: DtSceneGraphTreeLogic.h:373
QTreeWidgetItem * myItem
Definition: DtSceneGraphTreeLogic.h:96
DtDe & myDe
Definition: DtSceneGraphTreeLogic.h:357
std::vector< QTreeWidgetItem * > mySearchResults
Definition: DtSceneGraphTreeLogic.h:227
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
bool myVisualizeLods
Definition: DtSceneGraphTreeLogic.h:378
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:95
Contains makVrv::DtSubjectObserver class.
The DtSceneGraphTreeLogicCreator creator for the DtSceneGraphTreeLogicCreator class. Registered in vrvSt.cxx.
Definition: DtSceneGraphTreeLogic.h:385
Definition: DtSceneGraphTreeLogic.h:251
SceneGraphRoot
Definition: DtSceneGraphTreeLogic.h:242
DtExpandToLightsAction * myExpandLightNodesAction
Definition: DtSceneGraphTreeLogic.h:367
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:72
QIcon mySkyIcon
Definition: DtSceneGraphTreeLogic.h:370
bool myVisualizeNodeBounds
Definition: DtSceneGraphTreeLogic.h:377
osg::observer_ptr< osg::Node > myContextMenuNode
Definition: DtSceneGraphTreeLogic.h:131
Context menu item for colorizing the current node and all it&#39;s children.
Definition: DtSceneGraphTreeLogic.h:101
DtDe & myDe
Definition: DtSceneGraphTreeLogic.h:412
osg::observer_ptr< const osg::Node > myBVAttachedNode
Definition: DtSceneGraphTreeLogic.h:73
Definition: DtSceneGraphTreeLogic.h:81
Definition: DtSceneGraphTreeLogic.h:248
#define DT_DLL_VRVOSGQT
Definition: vrvOsgQt.h:22
std::string mySearchQuery
Definition: DtSceneGraphTreeLogic.h:226
Definition: DtSceneGraphTreeLogic.h:155
unsigned int myVisualizeLodsCount
Definition: DtSceneGraphTreeLogic.h:379
QIcon mySunIcon
Definition: DtSceneGraphTreeLogic.h:369
DtSearchSceneGraphAction * mySearchAction
Definition: DtSceneGraphTreeLogic.h:368
DtSceneGraphTreeWidgetInterface * myWidgetInterface
Definition: DtSceneGraphTreeLogic.h:358
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:229
Contains DLL export macros.
Definition: DtSceneGraphTreeLogic.h:136
QIcon myCloudsIcon
Definition: DtSceneGraphTreeLogic.h:375
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:150
DtColorSubTreeAction * myColorSubTreeAction
Definition: DtSceneGraphTreeLogic.h:363
QTreeWidgetItem * myItem
Definition: DtSceneGraphTreeLogic.h:152
Definition: DtSceneGraphTreeLogic.h:245
DtExpandToGeometryAction(QObject *parent, DtSceneGraphTreeLogic *tree)
Definition: DtSceneGraphTreeLogic.h:177
Definition: DtSceneGraphTreeLogic.h:249
Logic for scene graph tree display widget.
Definition: DtSceneGraphTreeLogic.h:234
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:94
QIcon myEmptyIcon
Definition: DtSceneGraphTreeLogic.h:374
WidgetToNodeMap myWidgetToNodeMap
Definition: DtSceneGraphTreeLogic.h:360
DtRefreshNodeAction * myRefreshAction
Definition: DtSceneGraphTreeLogic.h:364
DtDrawBoundsAction * myShowAABBoxAction
Definition: DtSceneGraphTreeLogic.h:362
search action for scene graph tab in the terrain information panel
Definition: DtSceneGraphTreeLogic.h:195
osg::observer_ptr< osg::ShapeDrawable > myBoundingVolumeDrawable
Definition: DtSceneGraphTreeLogic.h:74
Definition: DtSceneGraphTreeLogic.h:244
Definition: DtSceneGraphTreeLogic.h:164
osg::observer_ptr< osg::Node > myColorizedNode
Definition: DtSceneGraphTreeLogic.h:132
DtDrawBoundsAction * myShowBoundsAction
Definition: DtSceneGraphTreeLogic.h:361
Definition: DtSceneGraphTreeLogic.h:247
DtExpandAllAction * myExpandAllAction
Definition: DtSceneGraphTreeLogic.h:365
std::map< QTreeWidgetItem *, NodeObsPtr > WidgetToNodeMap
Definition: DtSceneGraphTreeLogic.h:238
bool myAABoundingBoxMode
Definition: DtSceneGraphTreeLogic.h:77
Definition: DtSceneGraphTreeLogic.h:246
Definition: DtSceneGraphTreeLogic.h:174
osg::ref_ptr< osg::Texture > myTexture
Definition: DtSceneGraphTreeLogic.h:76
size_t myCurrentIndex
Definition: DtSceneGraphTreeLogic.h:225
Definition: DtSceneGraphTreeLogic.h:250
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:76
osg::ref_ptr< osg::Image > myImage
Definition: DtSceneGraphTreeLogic.h:75
osg::observer_ptr< const osg::Node > NodeObsPtr
Definition: DtSceneGraphTreeLogic.h:237
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:371
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:366

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)