MAK RTIspy API Documentation for HLA Evolved
treesAndGraphWidget.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2013 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
6 #ifndef treesAndGraphWidget_H_
7 #define treesAndGraphWidget_H_
8 
9 #include "rtiMsConfig.h"
10 #include <QtGui/QWidget>
11 #include <QModelIndex>
12 #include <vector>
13 #include <set>
14 
17 
18 class QVBoxLayout;
19 class QHBoxLayout;
20 class QTreeView;
21 class QAbstractItemModel;
22 class QLabel;
23 class QSignalMapper;
24 class QMenu;
25 class QAction;
26 class QString;
27 class QSplitter;
28 class QFile;
29 class QToolBar;
30 class QTextStream;
31 class DtGraphDialog;
32 
37 {
38  Q_OBJECT
39 
40 public:
41 
43  DtTreesAndGraphWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
44 
46  virtual ~DtTreesAndGraphWidget();
47 
49  virtual QSize sizeHint() const;
50 
52  {
53  // Indicates the row header should be used as the name
55  // Indicates the first column should be used as the name
57  // Indicates that rows are unnamed
59  };
60 
65  unsigned addTree(const QString& name, const QString& description,
66  QAbstractItemModel* model, DtRowNameLoc rowNameLoc, bool hideHeaders = false);
67 // unsigned addTree(const QString& name, QAbstractItemModel* model,
68 // DtRowNameLoc rowNameLoc, bool hideHeader = false);
69 
72  void initComplete();
73 
76  void enableValueGraphing(unsigned treeIndex, unsigned column,
77  const QString& units);
78 
81  void enableRateGraphing(unsigned treeIndex, unsigned column,
82  const QString& units);
83 
86  typedef std::pair<unsigned, QModelIndex> DtTreeAndModelIndex;
87 
89  void addSet(DtTreeAndModelIndex modelIndex);
90 
92  void deleteSet(DtTreeAndModelIndex modelIndex);
93 
95  void updateGraphs(double currentTime);
96 
98  void updateGraphsForTree(unsigned treeIndex, double currentTime);
99 
102  void saveGuiConfiguration(QFile& configFile);
103 
106  void loadGuiConfiguration(QFile& configFile);
107 
109  void setFederateId(const QString& federateId) { myFederateId = federateId; }
110 
112  void setFederateDescription(const QString& federateDescr) { myFederateDescription = federateDescr; }
113 
114 protected:
115 
117  void initTrees();
118 
120  void connectSignals();
121 
123  void getRowAndColNames(DtTreeAndModelIndex modelIndex, QString& rowName,
124  QString& colName);
125 
127  void enableDisableGraphOptions();
128 
130  {
132  CsvTableFormat
133  };
134 
137  void writeTreeToStream(const QTreeView* tree, QTextStream& fileStrm,
138  TableFileFormat format);
139 
140 public slots:
141 
143  void deleteDialog(QWidget* graphDialog);
144 
147  void processItemSelection(const QModelIndex& index);
148 
150  void showContextMenu(const QPoint& point);
151 
153  void graphSelectedItem();
154 
156  void graphSelectedItemRate();
157 
159  void updateSortingEnable();
160 
162  void saveTreesToFile();
163 
164  void hideToolbar();
165 private:
166 
169 
171  DtTreesAndGraphWidget &operator=(const DtTreesAndGraphWidget&);
172 protected:
173 
175  QSplitter* mySplitter;
176 
178  std::vector<QVBoxLayout*> myTreeLayouts;
179 
181  std::vector<QLabel*> myTreeLabels;
182 
184  std::vector<QHBoxLayout*> myTreeLabelLayouts;
185 
187  std::vector<QTreeView*> myTreeViews;
188 
190  std::vector<DtRowNameLoc> myTreeRowNameLocs;
191 
194  std::vector<std::map<unsigned, QString> > myTreeValGraphableCols;
195 
198  std::vector<std::map<unsigned, QString> > myTreeRateGraphableCols;
199 
202 
203  std::map<DtTreeAndModelIndex, DtGraphDialog*> myGraphByModelIndex;
204  std::map<DtGraphDialog*, DtTreeAndModelIndex> myModelIndexByGraph;
206 
209 
210  std::map<DtTreeAndModelIndex, DtGraphDialog*> myRateGraphByModelIndex;
211  std::map<DtGraphDialog*, DtTreeAndModelIndex> myModelIndexByRateGraph;
213 
215  QSignalMapper* myCloseGraphSignalMapper;
216 
218 
220  QToolBar* myToolBar;
225 
228 
230  QString myFederateId;
231 
235 
238  static const QString theTreeBreakText;
239 };
240 
241 #endif // treesAndGraphWidget_H_
242 

Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (www.mak.com)