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) 2023 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 clearAndTraverse();
280 
283  virtual void clearAndTraverse(int domain, int subdomain);
284 
286  virtual bool iterateNode(QTreeWidgetItem* pParent, const osg::Node* pNode, bool bDrawIcon = true);
287 
288  virtual void buildContextMenu(QMenu* menu, QTreeWidgetItem* item);
289 
290  NodeObsPtr getNode(QTreeWidgetItem* item);
291 
292  virtual void displayPrevious(const std::string& query);
293  virtual void displayNext(const std::string& query);
294  virtual std::string getSearchStatusText(const std::string& query);
295 
296  virtual void resetSearchAction();
297 
304  virtual void computeFormattedNodeMaskText(unsigned int mask, QString& nodeMaskText);
305 
306  private:
307 
309  const QIcon & getNodeIcon(const osg::Node* pNode);
310  const QIcon & getDrawableIcon(const osg::Drawable* drawable);
311 
312  protected:
313 
316 
326  QIcon mySunIcon;
327  QIcon mySkyIcon;
329  QIcon myGeodeIcon;
331  QIcon myEmptyIcon;
333 
334  };
335 
340  {
341  public:
342  // CTOR
344 
346  virtual ~DtSceneGraphTreeLogicCreator();
347 
348  private:
353 
354  public:
356  static DtSceneGraphTreeLogicCreator& instance(DtDe& de);
357 
359  static void registerInstance(DtDe& de,
360  DtSceneGraphTreeLogicCreator* instance);
361 
365  protected:
367  };
368 }
369 
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:151
QIcon myGeodeIcon
Definition: DtSceneGraphTreeLogic.h:329
QIcon myGeometryIcon
Definition: DtSceneGraphTreeLogic.h:330
QTreeWidgetItem * myItem
Definition: DtSceneGraphTreeLogic.h:96
DtDe & myDe
Definition: DtSceneGraphTreeLogic.h:314
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
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:95
Contains makVrv::DtSubjectObserver class.
The DtSceneGraphTreeLogicCreator creator for the DtSceneGraphTreeLogicCreator class. Registered in vrvSt.cxx.
Definition: DtSceneGraphTreeLogic.h:339
Definition: DtSceneGraphTreeLogic.h:251
SceneGraphRoot
Definition: DtSceneGraphTreeLogic.h:242
DtExpandToLightsAction * myExpandLightNodesAction
Definition: DtSceneGraphTreeLogic.h:324
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:72
QIcon mySkyIcon
Definition: DtSceneGraphTreeLogic.h:327
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:366
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
QIcon mySunIcon
Definition: DtSceneGraphTreeLogic.h:326
DtSearchSceneGraphAction * mySearchAction
Definition: DtSceneGraphTreeLogic.h:325
DtSceneGraphTreeWidgetInterface * myWidgetInterface
Definition: DtSceneGraphTreeLogic.h:315
DtSceneGraphTreeLogic * myTree
Definition: DtSceneGraphTreeLogic.h:229
Contains DLL export macros.
Definition: DtSceneGraphTreeLogic.h:136
QIcon myCloudsIcon
Definition: DtSceneGraphTreeLogic.h:332
osg::observer_ptr< const osg::Node > myNode
Definition: DtSceneGraphTreeLogic.h:150
DtColorSubTreeAction * myColorSubTreeAction
Definition: DtSceneGraphTreeLogic.h:320
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:331
WidgetToNodeMap myWidgetToNodeMap
Definition: DtSceneGraphTreeLogic.h:317
DtRefreshNodeAction * myRefreshAction
Definition: DtSceneGraphTreeLogic.h:321
DtDrawBoundsAction * myShowAABBoxAction
Definition: DtSceneGraphTreeLogic.h:319
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:318
Definition: DtSceneGraphTreeLogic.h:247
DtExpandAllAction * myExpandAllAction
Definition: DtSceneGraphTreeLogic.h:322
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:72
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:328
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:323

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)