VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDynamicTerrainPageLogic.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vrvOsgQt/vrvOsgQt.h>
12 
13 #if !defined(Q_MOC_RUN)
16 #endif
17 
18 #include <matrix/vlVector.h>
19 
20 #include <QtCore/QAbstractItemModel>
21 #include <QtWidgets/QAction>
22 
23 #include <boost/shared_ptr.hpp>
24 #include <boost/enable_shared_from_this.hpp>
25 #include <boost/ptr_container/ptr_vector.hpp>
26 
27 #if !defined(Q_MOC_RUN)
28 #include <tbb/mutex.h>
29 #include <tbb/atomic.h>
30 #endif
31 
32 class QMenu;
33 
34 namespace makVrv
35 {
36  class DtDe;
37  class DtDynamicTerrainPageInterface;
38 
42  : public QAbstractItemModel
43  , public boost::enable_shared_from_this<DtDynamicTerrainPageLogic>
44  {
45  Q_OBJECT
46 
47  class QueryCallback;
48  friend class QueryCallback;
49 
50  public:
51  class FeatureRecord;
52  typedef std::vector< boost::shared_ptr<FeatureRecord> > FeatureRecordVector;
53  typedef std::list< boost::shared_ptr<FeatureRecord> > FeatureRecordList;
54 
57  static boost::shared_ptr<DtDynamicTerrainPageLogic> create(
59 
61  virtual ~DtDynamicTerrainPageLogic();
62 
64  virtual void setupContextMenu(QMenu* menu, const QModelIndex&);
65 
67  virtual void clickedOnMap(const DtVector& point);
68 
70 
71  virtual QVariant headerData(int column, Qt::Orientation, int role) const;
72  virtual QModelIndex index(int row, int column, const QModelIndex& parent) const;
73  virtual QModelIndex parent(const QModelIndex&) const;
74  virtual int rowCount(const QModelIndex& index) const;
75  virtual int columnCount(const QModelIndex& index) const;
76  virtual QVariant data(const QModelIndex& index, int role) const;
78 
81  virtual void runQuery();
82 
84  virtual void shutdown();
85 
86  signals:
87  void indexSelected(QModelIndex);
88 
89  void rowAdded(int i);
90  void rowChanged(int i);
91  void rowRemoved(int i);
92 
93  protected slots:
94  virtual void addRow(int i);
95  virtual void changeRow(int i);
96  virtual void removeRow(int i);
97 
98  protected:
100  explicit DtDynamicTerrainPageLogic(DtDe& de);
101 
103  virtual void featureAdded(const DtDynamicTerrainFeature& feature);
104 
105  virtual void updateFeature(
106  FeatureRecord* featureCallback, const DtDynamicTerrainFeature& feature);
107 
108  virtual void pagedOut(
109  std::list< boost::shared_ptr<FeatureRecord> >::iterator i);
110 
111  void ensureValidVector();
112 
113  tbb::atomic<bool> myShutdownFlag;
114 
115  typedef tbb::mutex Mutex;
116  mutable Mutex myMutex;
117 
119 
121 
126  };
127 
128  class DT_DLL_VRVOSGQT DtDynamicTerrainPageLogic::FeatureRecord
129  : public boost::enable_shared_from_this<DtDynamicTerrainPageLogic::FeatureRecord>
130  {
131  public:
132  class RequestAction;
133 
134  explicit FeatureRecord(
135  DtDe& de,
137  const boost::shared_ptr<const DtDynamicTerrainFeature>& feature);
138 
139  virtual ~FeatureRecord();
140 
141  boost::shared_ptr<const DtDynamicTerrainFeature> feature() const { return myFeature.lock(); }
142 
143  int index() const { return myIndex; }
144 
145  void setIndex(int index) { myIndex = index; }
146 
147  QVariant getData(unsigned col) const;
148 
149  void update(const DtDynamicTerrainFeature& feature);
150 
151  void setupContextMenu(QMenu* menu);
152 
153  void disconnect();
154 
155  void addDisconnector(const boost::signalslib::connection& conn);
156 
157  void addRequest(const DtDynamicTerrainChange&);
158  void clearRequests();
159 
160  private:
161  void addChange(const DtDynamicTerrainChange& change);
162 
163  void setData(unsigned col, const QVariant& value);
164 
165  DtDe& myDe;
166  //const boost::weak_ptr<DtDynamicTerrainPageLogic> myLogic;
167  const boost::weak_ptr<const DtDynamicTerrainFeature> myFeature;
168 
169  std::list<boost::signalslib::connection> myDisconnectors;
170 
171  typedef tbb::spin_mutex Mutex;
172  mutable Mutex myMutex;
173 
174  typedef std::vector<QVariant> DataContainer;
176 
177  typedef boost::ptr_vector<DtDynamicTerrainChange> Changes;
179 
180  int myIndex;
181 
182  typedef std::vector<DtDynamicTerrainWorld::RequestHandle> RequestHandles;
184  };
185 
186  class DT_DLL_VRVOSGQT DtDynamicTerrainPageLogic::FeatureRecord::RequestAction
187  : public QAction
188  {
189  Q_OBJECT
190 
191  public:
192  RequestAction(
193  const DtDynamicTerrainChange& change,
194  const boost::shared_ptr<FeatureRecord>& featureRecord,
195  QObject* parent);
196 
197  public slots:
198  void insertChangeRequest();
199  void clearRequests();
200 
201  private:
202  boost::weak_ptr<FeatureRecord> myFeatureRecord;
203 
204  boost::scoped_ptr<DtDynamicTerrainChange> myChange;
205  };
206 }
207 
208 
std::list< boost::signalslib::connection > myDisconnectors
Definition: DtDynamicTerrainPageLogic.h:169
int index() const
Definition: DtDynamicTerrainPageLogic.h:143
DtDe & myDe
Definition: DtDynamicTerrainPageLogic.h:118
boost::weak_ptr< FeatureRecord > myFeatureRecord
Definition: DtDynamicTerrainPageLogic.h:202
Queries.
Definition: DtDynamicTerrainWorld.h:174
void setIndex(int index)
Definition: DtDynamicTerrainPageLogic.h:145
boost::ptr_vector< DtDynamicTerrainChange > Changes
Definition: DtDynamicTerrainPageLogic.h:177
RequestHandles myRequestHandles
Definition: DtDynamicTerrainPageLogic.h:183
#define DT_DLL_VRVOSGQT
Definition: vrvOsgQt.h:22
Interface to a widget that displays the scene graph as a tree.
Definition: DtDynamicTerrainPageInterface.h:25
DtDynamicTerrainWorld::QueryHandle myQueryHandle
Definition: DtDynamicTerrainPageLogic.h:120
Logic for scene graph tree display widget.
Definition: DtDynamicTerrainPageLogic.h:41
Contains DLL export macros.
bool myVectorValid
Definition: DtDynamicTerrainPageLogic.h:123
const boost::weak_ptr< const DtDynamicTerrainFeature > myFeature
Definition: DtDynamicTerrainPageLogic.h:167
tbb::atomic< bool > myShutdownFlag
Definition: DtDynamicTerrainPageLogic.h:113
boost::scoped_ptr< DtDynamicTerrainChange > myChange
Definition: DtDynamicTerrainPageLogic.h:204
std::vector< boost::shared_ptr< FeatureRecord > > FeatureRecordVector
Definition: DtDynamicTerrainPageLogic.h:51
std::vector< DtDynamicTerrainWorld::RequestHandle > RequestHandles
Definition: DtDynamicTerrainPageLogic.h:182
int myIndex
Definition: DtDynamicTerrainPageLogic.h:180
Changes myChanges
Definition: DtDynamicTerrainPageLogic.h:178
Interface which abstracts the concept of a individually identifiable &quot;thing&quot; in the terrain...
Definition: DtDynamicTerrainFeature.h:83
size_t myFeatureCount
Definition: DtDynamicTerrainPageLogic.h:122
tbb::spin_mutex Mutex
Definition: DtDynamicTerrainPageLogic.h:171
Contains makVrv::DtDynamicTerrainFeature class.
Mutex myMutex
Definition: DtDynamicTerrainPageLogic.h:116
std::vector< QVariant > DataContainer
Definition: DtDynamicTerrainPageLogic.h:174
std::list< boost::shared_ptr< FeatureRecord > > FeatureRecordList
Definition: DtDynamicTerrainPageLogic.h:53
FeatureRecordList myFeatureRecordList
Definition: DtDynamicTerrainPageLogic.h:125
Contains makVrv::DtDynamicTerrainWorld class.
Command which can be given to the dynamic terrain system to perform some change.
Definition: DtDynamicTerrainChange.h:42
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DataContainer myData
Definition: DtDynamicTerrainPageLogic.h:175
tbb::mutex Mutex
Definition: DtDynamicTerrainPageLogic.h:115
FeatureRecordVector myFeatureRecordVector
Definition: DtDynamicTerrainPageLogic.h:124
boost::shared_ptr< const DtDynamicTerrainFeature > feature() const
Definition: DtDynamicTerrainPageLogic.h:141

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)