MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
treesAndGraphWidget.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2017 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include "rtiMsConfig.h"
13 #include <QWidget>
14 #include <QModelIndex>
15 #include <vector>
16 #include <set>
17 
20 
21 class QVBoxLayout;
22 class QHBoxLayout;
23 class QTreeView;
24 class QAbstractItemModel;
25 class QLabel;
26 class QSignalMapper;
27 class QMenu;
28 class QAction;
29 class QString;
30 class QSplitter;
31 class QFile;
32 class QToolBar;
33 class QTextStream;
34 class DtGraphDialog;
35 
40 {
41  Q_OBJECT
42 
43 public:
44 
46  DtTreesAndGraphWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
47 
49  virtual ~DtTreesAndGraphWidget();
50 
52  virtual QSize sizeHint() const;
53 
55  {
56  // Indicates the row header should be used as the name
58  // Indicates the first column should be used as the name
60  // Indicates that rows are unnamed
62  };
63 
68  unsigned addTree(const QString& name, const QString& description,
69  QAbstractItemModel* model, DtRowNameLoc rowNameLoc, bool hideHeaders = false);
70 // unsigned addTree(const QString& name, QAbstractItemModel* model,
71 // DtRowNameLoc rowNameLoc, bool hideHeader = false);
72 
75  void initComplete();
76 
79  void enableValueGraphing(unsigned treeIndex, unsigned column,
80  const QString& units);
81 
84  void enableRateGraphing(unsigned treeIndex, unsigned column,
85  const QString& units);
86 
89  typedef std::pair<unsigned, QModelIndex> DtTreeAndModelIndex;
90 
92  void addSet(DtTreeAndModelIndex modelIndex);
93 
95  void deleteSet(DtTreeAndModelIndex modelIndex);
96 
98  void updateGraphs(double currentTime);
99 
101  void updateGraphsForTree(unsigned treeIndex, double currentTime);
102 
105  void saveGuiConfiguration(QFile& configFile);
106 
109  void loadGuiConfiguration(QFile& configFile);
110 
112  void setFederateId(const QString& federateId) { myFederateId = federateId; }
113 
115  void setFederateDescription(const QString& federateDescr) { myFederateDescription = federateDescr; }
116 
117 protected:
118 
120  void initTrees();
121 
123  void connectSignals();
124 
126  void getRowAndColNames(DtTreeAndModelIndex modelIndex, QString& rowName,
127  QString& colName);
128 
130  void enableDisableGraphOptions();
131 
133  {
135  CsvTableFormat
136  };
137 
140  void writeTreeToStream(const QTreeView* tree, QTextStream& fileStrm,
141  TableFileFormat format);
142 
143 public slots:
144 
146  void deleteDialog(QWidget* graphDialog);
147 
150  void processItemSelection(const QModelIndex& index);
151 
153  void showContextMenu(const QPoint& point);
154 
156  void graphSelectedItem();
157 
159  void graphSelectedItemRate();
160 
162  void updateSortingEnable();
163 
165  void saveTreesToFile();
166 
167  void hideToolbar();
168 private:
169 
172 
174  DtTreesAndGraphWidget &operator=(const DtTreesAndGraphWidget&);
175 protected:
176 
178  QSplitter* mySplitter;
179 
181  std::vector<QVBoxLayout*> myTreeLayouts;
182 
184  std::vector<QLabel*> myTreeLabels;
185 
187  std::vector<QHBoxLayout*> myTreeLabelLayouts;
188 
190  std::vector<QTreeView*> myTreeViews;
191 
193  std::vector<DtRowNameLoc> myTreeRowNameLocs;
194 
197  std::vector<std::map<unsigned, QString> > myTreeValGraphableCols;
198 
201  std::vector<std::map<unsigned, QString> > myTreeRateGraphableCols;
202 
205 
206  std::map<DtTreeAndModelIndex, DtGraphDialog*> myGraphByModelIndex;
207  std::map<DtGraphDialog*, DtTreeAndModelIndex> myModelIndexByGraph;
209 
212 
213  std::map<DtTreeAndModelIndex, DtGraphDialog*> myRateGraphByModelIndex;
214  std::map<DtGraphDialog*, DtTreeAndModelIndex> myModelIndexByRateGraph;
216 
218  QSignalMapper* myCloseGraphSignalMapper;
219 
221 
223  QToolBar* myToolBar;
228 
231 
233  QString myFederateId;
234 
238 
241  static const QString theTreeBreakText;
242 };

Document ID: Generated on Mon Jul 9 10:30:41 EDT 2018 from SVN revision 190224
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)