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 };
Definition: treesAndGraphWidget.h:61
TableFileFormat
Definition: treesAndGraphWidget.h:132
Shows detailed statistics, presented as both trees and running graphs which can be populated from the...
Definition: treesAndGraphWidget.h:39
void setFederateDescription(const QString &federateDescr)
Sets the federate description text.
Definition: treesAndGraphWidget.h:115
DtRowNameLoc
Definition: treesAndGraphWidget.h:54
std::map< DtGraphDialog *, DtTreeAndModelIndex > myModelIndexByGraph
Maps between a graphed model index and the graph dialog that is displaying it.
Definition: treesAndGraphWidget.h:207
std::pair< unsigned, QModelIndex > DtTreeAndModelIndex
Type which pairs the tree index and QModelIndex to uniquely identify an index across all trees in the...
Definition: treesAndGraphWidget.h:89
std::vector< DtRowNameLoc > myTreeRowNameLocs
The row name location for the tree.
Definition: treesAndGraphWidget.h:193
std::map< DtGraphDialog *, DtTreeAndModelIndex > myModelIndexByRateGraph
Maps between a graphed model index and the graph dialog that is displaying its rate.
Definition: treesAndGraphWidget.h:214
std::map< DtTreeAndModelIndex, DtGraphDialog * > myGraphByModelIndex
Maps between a graphed model index and the graph dialog that is displaying it.
Definition: treesAndGraphWidget.h:206
DtTreeAndModelIndex myCurrentModelIndex
The model index for which to display the context menu.
Definition: treesAndGraphWidget.h:230
A dialog containing a graph of a single series of data.
Definition: graphDialog.h:21
QString myFederateDescription
Detailed description of this federate.
Definition: treesAndGraphWidget.h:237
QAction * mySaveToFileAction
The context menu and toolbar and their actions.
Definition: treesAndGraphWidget.h:226
std::map< DtTreeAndModelIndex, DtGraphDialog * > myRateGraphByModelIndex
Maps between a graphed model index and the graph dialog that is displaying its rate.
Definition: treesAndGraphWidget.h:213
std::vector< QLabel * > myTreeLabels
Labels for each tree.
Definition: treesAndGraphWidget.h:184
QAction * myGraphItemAction
The context menu and toolbar and their actions.
Definition: treesAndGraphWidget.h:224
std::vector< std::map< unsigned, QString > > myTreeRateGraphableCols
The columns for which the rate can be graphed and the units to be displayed on the y axis...
Definition: treesAndGraphWidget.h:201
QString myFederateId
Identifying text for the current federate.
Definition: treesAndGraphWidget.h:233
std::vector< std::map< unsigned, QString > > myTreeValGraphableCols
The columns for which the value can be graphed and the units to be displayed on the y axis...
Definition: treesAndGraphWidget.h:197
static const QString theTreeBreakText
Indicates the end of one tree&#39;s configuration data and the start of the next in a GUI config file...
Definition: treesAndGraphWidget.h:241
Definition: treesAndGraphWidget.h:57
Definition: treesAndGraphWidget.h:59
std::vector< QTreeView * > myTreeViews
The tree view for each tree.
Definition: treesAndGraphWidget.h:190
#define DT_DLL_ASSISTANTAPP
Definition: rtiMsConfig.h:122
QSplitter * mySplitter
Main layout.
Definition: treesAndGraphWidget.h:178
Definition: treesAndGraphWidget.h:134
QSignalMapper * myCloseGraphSignalMapper
Maps signals from graph dialog close events.
Definition: treesAndGraphWidget.h:218
void setFederateId(const QString &federateId)
Sets the federate identification text.
Definition: treesAndGraphWidget.h:112
QToolBar * myToolBar
The context menu and toolbar and their actions.
Definition: treesAndGraphWidget.h:223
std::vector< QHBoxLayout * > myTreeLabelLayouts
Layouts for each tree label.
Definition: treesAndGraphWidget.h:187
QMenu * myContextMenu
The context menu and toolbar and their actions.
Definition: treesAndGraphWidget.h:222
std::vector< QVBoxLayout * > myTreeLayouts
Layouts for each tree.
Definition: treesAndGraphWidget.h:181
QAction * myGraphRateAction
The context menu and toolbar and their actions.
Definition: treesAndGraphWidget.h:225

Document ID: Generated on Thu May 11 15:55:32 EDT 2023 from SVN revision 254743
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)