VR-Forces 4.7 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) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vrvOsgQt/vrvOsgQt.h>
12 
15 
16 #include <matrix/vlVector.h>
17 
18 #include <QtCore/QAbstractItemModel>
19 #include <QtWidgets/QAction>
20 
21 #include <boost/shared_ptr.hpp>
22 #include <boost/enable_shared_from_this.hpp>
23 #include <boost/ptr_container/ptr_vector.hpp>
24 
25 #include <tbb/mutex.h>
26 #include <tbb/atomic.h>
27 
28 class QMenu;
29 
30 namespace makVrv
31 {
32  class DtDe;
33  class DtDynamicTerrainPageInterface;
34 
38  : public QAbstractItemModel
39  , public boost::enable_shared_from_this<DtDynamicTerrainPageLogic>
40  {
41  Q_OBJECT
42 
43  class QueryCallback;
44  friend class QueryCallback;
45 
46  public:
47  class FeatureRecord;
48  typedef std::vector< boost::shared_ptr<FeatureRecord> > FeatureRecordVector;
49  typedef std::list< boost::shared_ptr<FeatureRecord> > FeatureRecordList;
50 
53  static boost::shared_ptr<DtDynamicTerrainPageLogic> create(
55 
57  virtual ~DtDynamicTerrainPageLogic();
58 
60  virtual void setupContextMenu(QMenu* menu, const QModelIndex&);
61 
63  virtual void clickedOnMap(const DtVector& point);
64 
66 
67  virtual QVariant headerData(int column, Qt::Orientation, int role) const;
68  virtual QModelIndex index(int row, int column, const QModelIndex& parent) const;
69  virtual QModelIndex parent(const QModelIndex&) const;
70  virtual int rowCount(const QModelIndex& index) const;
71  virtual int columnCount(const QModelIndex& index) const;
72  virtual QVariant data(const QModelIndex& index, int role) const;
74 
77  virtual void runQuery();
78 
80  virtual void shutdown();
81 
82  signals:
83  void indexSelected(QModelIndex);
84 
85  void rowAdded(int i);
86  void rowChanged(int i);
87  void rowRemoved(int i);
88 
89  protected slots:
90  virtual void addRow(int i);
91  virtual void changeRow(int i);
92  virtual void removeRow(int i);
93 
94  protected:
96  explicit DtDynamicTerrainPageLogic(DtDe& de);
97 
99  virtual void featureAdded(const DtDynamicTerrainFeature& feature);
100 
101  virtual void updateFeature(
102  FeatureRecord* featureCallback, const DtDynamicTerrainFeature& feature);
103 
104  virtual void pagedOut(
105  std::list< boost::shared_ptr<FeatureRecord> >::iterator i);
106 
107  void ensureValidVector();
108 
109  tbb::atomic<bool> myShutdownFlag;
110 
111  typedef tbb::mutex Mutex;
112  mutable Mutex myMutex;
113 
115 
117 
122  };
123 
124  class DT_DLL_VRVOSGQT DtDynamicTerrainPageLogic::FeatureRecord
125  : public boost::enable_shared_from_this<DtDynamicTerrainPageLogic::FeatureRecord>
126  {
127  public:
128  class RequestAction;
129 
130  explicit FeatureRecord(
131  DtDe& de,
133  const boost::shared_ptr<const DtDynamicTerrainFeature>& feature);
134 
135  virtual ~FeatureRecord();
136 
137  boost::shared_ptr<const DtDynamicTerrainFeature> feature() const { return myFeature.lock(); }
138 
139  int index() const { return myIndex; }
140 
141  void setIndex(int index) { myIndex = index; }
142 
143  QVariant getData(unsigned col) const;
144 
145  void update(const DtDynamicTerrainFeature& feature);
146 
147  void setupContextMenu(QMenu* menu);
148 
149  void disconnect();
150 
151  void addDisconnector(const boost::signals2::connection& conn);
152 
153  void addRequest(const DtDynamicTerrainChange&);
154  void clearRequests();
155 
156  private:
157  void addChange(const DtDynamicTerrainChange& change);
158 
159  void setData(unsigned col, const QVariant& value);
160 
161  DtDe& myDe;
162  //const boost::weak_ptr<DtDynamicTerrainPageLogic> myLogic;
163  const boost::weak_ptr<const DtDynamicTerrainFeature> myFeature;
164 
165  std::list<boost::signals2::connection> myDisconnectors;
166 
167  typedef tbb::spin_mutex Mutex;
168  mutable Mutex myMutex;
169 
170  typedef std::vector<QVariant> DataContainer;
172 
173  typedef boost::ptr_vector<DtDynamicTerrainChange> Changes;
175 
176  int myIndex;
177 
178  typedef std::vector<DtDynamicTerrainWorld::RequestHandle> RequestHandles;
180  };
181 
182  class DT_DLL_VRVOSGQT DtDynamicTerrainPageLogic::FeatureRecord::RequestAction
183  : public QAction
184  {
185  Q_OBJECT
186 
187  public:
188  RequestAction(
189  const DtDynamicTerrainChange& change,
190  const boost::shared_ptr<FeatureRecord>& featureRecord,
191  QObject* parent);
192 
193  public slots:
194  void insertChangeRequest();
195  void clearRequests();
196 
197  private:
198  boost::weak_ptr<FeatureRecord> myFeatureRecord;
199 
200  boost::scoped_ptr<DtDynamicTerrainChange> myChange;
201  };
202 }
203 
204 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)