VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
uiGraphDataWidget.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2024 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
6 #pragma once
7 
12 
13 #include <QtGui/QColor>
14 #include <QtCore/QPointF>
15 #include <QtCore/QVector>
16 #include <QtWidgets/QTableWidget>
17 
18 class DtPlotPicker;
19 class QwtPlot;
20 class QwtPlotCurve;
21 class QFrame;
22 class QToolButton;
23 class QVBoxLayout;
24 class QHBoxLayout;
25 class DtRangeProbEntry;
26 class DtEntityType;
27 class QListWidgetItem;
28 class QDoubleValidator;
29 class DtRwReal;
30 class QLabel;
31 class QListWidget;
32 class QLineEdit;
35 class QAbstractButton;
36 class QRadioButton;
37 class QPushButton;
38 
39 namespace makVrf
40 {
41  class DtEnumerationSelectionWidget;
42 }
43 
45 {
46 public:
47  DtSizedTableWidget(QWidget* p) : QTableWidget(p), myMinimumHeight(64) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); };
48  virtual ~DtSizedTableWidget() override {};
49 
50  virtual void setMinimumHeight(int i) { myMinimumHeight = i; update(); };
51 
52  virtual QSize sizeHint() const override { return QSize(QTableWidget::sizeHint().width(), myMinimumHeight); };
53 
54 
55 
56 protected:
57  int myMinimumHeight;
58 };
59 
61 {
62  Q_OBJECT
63  Q_PROPERTY(QColor PlotPenColor MEMBER myPlotPenColor USER true)
64 
65 public:
66  DtUiGraphDataWidgetProperties() : QWidget(nullptr), myPlotPenColor(Qt::black)
67  {
68  setObjectName("DtUiGraphDataWidget");
69  }
70 
72 };
73 
75 {
76  Q_OBJECT
77 
78 protected:
79  struct PlotData
80  {
81  QwtPlotCurve* curve = nullptr;
82  QVector<QPointF> points;
83  std::vector<int> columns;
84  QColor color;
85  std::vector<DtRangeProbEntry*> entries;
86  };
87 
88  struct ModifiedData
89  {
92  double oldData;
93  double newData;
94  };
95 
96 public:
97 
100 
102  virtual ~DtUiGraphDataWidget() override;
103 
109  virtual void initControls(QWidget* widget,bool displayMultiRow = false,bool useCustomValues = false,unsigned int startingColorIndex = 0);
110  virtual bool hasRange(const DtString&) const;
111  virtual bool isRangeType() const;
112  virtual void setPlotPenColor(const QColor&);
113  virtual void createNewRangeTableForSelectedItem(double maxRange, double value);
114  virtual void createBasicCoefficientTable(const DtString&);
115  virtual void plotLineSelected(const DtString&);
117  virtual void plotRemainingItems();
118  virtual void replotGraph();
119  virtual void removeDataEntry(const DtString& key);
120  virtual void addCommonEntry(const DtString&, const std::vector<DtRangeProbEntry*>&,QString & displayName, bool plotCoefficientImmediately = false);
121  virtual DtRangeProbEntry* getEntry(const DtString& key);
122  virtual DtRangeProbEntry* cloneEntry(const DtString& existingKey);
123  virtual void updateDataKey(const QString& displayName, const DtString& key, std::vector<DtReaderWriter*>& values);
124 
125  virtual void clearGraphData();
126  virtual void clearPlotLines();
127  virtual void clearDataTypes();
128  virtual void setupEntriesFrom(const std::vector<DtReaderWriter*>&);
129  virtual bool replotAllNotAtMaximumRange();
131  virtual void setupGraphDataFor(const DtString&);
133  virtual QString graphDataTitle() const;
134  virtual void setGraphDataTitle(const QString&);
135  virtual void plot(const DtString&, const QString& displayName, DtDetectionPrbRangeLookupEntry*);
136  virtual void plot(const DtString&, const QString& displayName, DtDetectionPrbRangeCalcEntry*);
137 
138  virtual void setMultipleLinesPerGraph(bool b);
139  virtual bool multiLinesPerGraph() const;
140 
141  virtual void setFromParameters(const std::vector<DtReaderWriter*>& parentRw) override;
142 
143 protected:
144  virtual void createControls(QWidget* parent) override;
145  virtual void sendUpdate();
146 
147  virtual QVector<QPointF> updateDataFor(QLineEdit*, DtDetectionPrbRangeLookupEntry*, std::vector<int>& columns);
148  virtual void setupGraphDataFor(DtDetectionPrbRangeLookupEntry*, const DtString& key, int row = 0);
149  virtual QVector<QPointF> getPlotPoints(DtDetectionPrbRangeLookupEntry*, std::vector<int>& columns) const;
150 
151  virtual double getProbability(double range, DtRangeProbEntry* entry) const;
152 
153  virtual QVector<QPointF> updateDataFor(QLineEdit*, DtDetectionPrbRangeCalcEntry*);
154  virtual void setupGraphDataFor(DtDetectionPrbRangeCalcEntry*, const DtString& key, int row = 0);
155  virtual QVector<QPointF> getPlotPoints(DtDetectionPrbRangeCalcEntry*) const;
156  virtual void addNewRangeEntry(double range);
157  virtual void addNewRangeEntry(PlotData& pd, double range, const DtString& name = "probability");
158 
159 
160  virtual QString newRangeWindowLabel() const;
161 
162  virtual double findMaximumRange() const;
163 
164  virtual void graphLineColorChanged(const QColor& oldColor, const QColor& newColor);
165 
166  virtual void addPlotLine(const DtString& key, const QString& displayName, const QVector<QPointF>& points, DtRangeProbEntry* entry);
167 
168  virtual double minimumRange(DtDetectionPrbRangeLookupEntry* entry) const;
169  virtual double maximumRange(DtDetectionPrbRangeCalcEntry* entry) const;
170  virtual double maximumRange(DtDetectionPrbRangeLookupEntry* entry) const;
171 
172  virtual int selectedRow() const;
173 
174  virtual void setupGraphDataFor(const DtString& key, const PlotData&, bool andClear = false);
175  virtual bool addNewCoefficientEntry();
176  virtual void addNewCoefficientEntry(PlotData& pd);
177  virtual bool addNewRangeEntry();
178 
179  virtual bool eventFilter(QObject*, QEvent*) override;
180  virtual void cellEntered(QObject* e);
181 
182  virtual void moveRange();
183  virtual void wheelMove(double delta);
184 
185  virtual int changeRangeFor(const DtString& et, double fromRange, double toRange);
186  virtual int changeRangeFor(PlotData& pd, double fromRange, double toRange);
187 
188  virtual int changeRangeForColumn(const DtString& et, int column, double toRange);
189  virtual int changeRangeForColumn(PlotData& pd, int column, double toRange);
190 
191  virtual void removeRange(PlotData& pd, int currentColumn);
192 
193  virtual QListWidgetItem* selectedLine() const;
194 
195  virtual void addGraphDataCanvas();
196 
197  virtual void setEnabled(bool) override;
198  virtual void changeDataValue(QLineEdit*);
199 
200 signals:
201  void rangeChanged(DtString,double,double);
202  void dataChanged(DtString,double,double);
203  void graphDataChanged(const DtUiElementEvent& e);
204  void switchEquation();
205 
206 public slots:
207  virtual void resetGraphData();
208  virtual void resetGraphDataForCurrentlySelected();
209 
210 protected slots:
211  virtual void plotLineSelected();
212  virtual void sectionDoubleClicked(int);
213  virtual void legendClicked(const QVariant&, int);
214  virtual void selectCurve(const QPointF&);
215  virtual void changeDataValue();
216 
217  virtual void addRange();
218  virtual void editRange();
219  virtual void removeRange();
220  virtual void graphDataSelectionChanged();
221  virtual void changeEquationType();
222  virtual void setupGraphDataFor();
223 
224 public:
225  QVBoxLayout* myMainLayout;
226  QwtPlot* myGraph;
230  QHBoxLayout* myTopLineLayout;
231  QHBoxLayout* myButtonLayout;
232  QVBoxLayout* myTableLayout;
233  QHBoxLayout* myTableButtons;
237  QDoubleValidator* myRangeValidator;
238  QDoubleValidator* myCoefficientValidator;
240  QListWidget* myDataTypes;
242 
245 
246  QWidget* myButtonLine;
247 
248 protected:
250  typedef std::map<DtString, PlotData> RangeLines;
252  typedef std::map<DtString, QListWidgetItem*> ItemsMap;
253 
256 
262 
267 
270  unsigned int myStartingColorIndex;
271 
274  std::map<DtString, DtDetectionPrbRangeCalcEntry*> myToPlot;
275  mutable double myMaximumRange;
276 
280 
281  QAbstractButton* myGraphDataButton;
283  bool myMultipleLinesPerGraph = false;
284 
287  bool myInResetTimer = false;
288 };
289 #pragma once
DtRangeProbEntry is an abstract class whose deriving classes will have one of the two forms of DtPrbD...
Definition: rangeProbEntry.h:19
RangeLines myRangeLines
Definition: uiGraphDataWidget.h:272
QTableWidget * myGraphData
Definition: uiGraphDataWidget.h:229
QToolButton * myChangeToLookup
Definition: uiGraphDataWidget.h:244
virtual ~DtSizedTableWidget() override
Definition: uiGraphDataWidget.h:48
QToolButton * myRemoveRange
Definition: uiGraphDataWidget.h:236
DtPlotPicker * myPlotPicker
Definition: uiGraphDataWidget.h:241
makVrv::DtSignalConnectionManager myGraphLineColorConnections
Definition: uiGraphDataWidget.h:285
virtual void createControls(QWidget *parent)
If additional widgets or connections need to be made do it here. The parent is the myWidget member...
Definition: uiGraphDataWidget.h:79
QToolButton * myAddRange
Definition: uiGraphDataWidget.h:234
virtual void setFromParameters(DtReaderWriter *parentRw)
Calls setFromParameters with std::vector of parameter.
std::vector< DtRangeProbEntry * > entries
Definition: uiGraphDataWidget.h:85
DtUiGraphDataWidgetProperties()
Definition: uiGraphDataWidget.h:66
bool isColumnData
Definition: uiGraphDataWidget.h:91
QVector< QPointF > points
Definition: uiGraphDataWidget.h:82
bool myUseCustomValues
Set this to true if you do not want to display values as a percentage Will display value unmodified...
Definition: uiGraphDataWidget.h:266
bool myDisplayMultiRow
Display multi rows of the graph data table–used for damage widget Default is false most cases you onl...
Definition: uiGraphDataWidget.h:261
ItemsMap myItemsMap
Definition: uiGraphDataWidget.h:273
boost::function< DtUiElement *(makVrv::DtDe &)> CreatorFunction
Definition: uiElement.h:198
QDoubleValidator * myCoefficientValidator
Definition: uiGraphDataWidget.h:238
QAbstractButton * myGraphDataButton
Definition: uiGraphDataWidget.h:281
QWidget * myGraphDataCanvas
Definition: uiGraphDataWidget.h:228
QLabel * myComboLabel
Definition: uiGraphDataWidget.h:239
double oldData
Definition: uiGraphDataWidget.h:92
QLabel * myGraphDataLabel
Definition: uiGraphDataWidget.h:227
QListWidget * myDataTypes
Definition: uiGraphDataWidget.h:240
QHBoxLayout * myTopLineLayout
Definition: uiGraphDataWidget.h:230
QColor color
Definition: uiGraphDataWidget.h:84
bool myCanMoveWithMouse
Definition: uiGraphDataWidget.h:277
QHBoxLayout * myTableButtons
Definition: uiGraphDataWidget.h:233
virtual void setMinimumHeight(int i)
Definition: uiGraphDataWidget.h:50
Add the ability to set decimals to cursor text.
Definition: plotPicker.h:10
QwtPlot * myGraph
Definition: uiGraphDataWidget.h:226
Definition: uiGraphDataWidget.h:60
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
QColor myPlotPenColor
Definition: uiGraphDataWidget.h:71
DtDetectionPrbRangeCalcEntry is the derived form of DtRangeProbEntry that has a DtPrbCoefficientsDete...
Definition: detectionPrbRangeCalcEntry.h:23
bool myIsRangeType
Definition: uiGraphDataWidget.h:282
QHBoxLayout * myButtonLayout
Definition: uiGraphDataWidget.h:231
std::map< DtString, PlotData > RangeLines
Lines drawn on the graph.
Definition: uiGraphDataWidget.h:250
QVBoxLayout * myMainLayout
Definition: uiGraphDataWidget.h:225
QToolButton * myChangeToCoefficient
Definition: uiGraphDataWidget.h:243
int mySelectedRange
Definition: uiGraphDataWidget.h:258
double newData
Definition: uiGraphDataWidget.h:93
Description: Readable, Writable DtReal (double)
Definition: rwReal.h:27
virtual void setEnabled(bool)
If this item is not enabled it cannot be modified.
std::map< DtString, DtDetectionPrbRangeCalcEntry * > myToPlot
Definition: uiGraphDataWidget.h:274
QVBoxLayout * myTableLayout
Definition: uiGraphDataWidget.h:232
virtual QSize sizeHint() const override
Definition: uiGraphDataWidget.h:52
Base class to provide boost signal/slot management.
DtString myCurrentlySelected
Definition: uiGraphDataWidget.h:257
DtUiGraphDataWidgetProperties myPlotPenColor
Definition: uiGraphDataWidget.h:286
Definition: uiGraphDataWidget.h:44
The DtUiElement class is the base for which all UI elements are defined. If you wish to create a new ...
Definition: uiElement.h:97
unsigned int myStartingColorIndex
Set this to something higher than zero to allow for differnt graphs to use different colors...
Definition: uiGraphDataWidget.h:270
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
double myMaximumRange
Definition: uiGraphDataWidget.h:275
ModifiedData myModifiedData
Keeps track of changes when user is moving the plot line.
Definition: uiGraphDataWidget.h:255
std::vector< int > columns
Definition: uiGraphDataWidget.h:83
QDoubleValidator * myRangeValidator
Definition: uiGraphDataWidget.h:237
QWidget * myButtonLine
Definition: uiGraphDataWidget.h:246
QToolButton * myEditRange
Definition: uiGraphDataWidget.h:235
bool myIgnoreNextMouseMove
Definition: uiGraphDataWidget.h:278
Definition: uiGraphDataWidget.h:74
DtDetectionPrbRangeLookupEntry is the derived form of DtRangeProbEntry that has a DtPrbStepFunctionDe...
Definition: detectionPrbRangeLookupEntry.h:23
std::map< DtString, QListWidgetItem * > ItemsMap
graph data table row associated with range line
Definition: uiGraphDataWidget.h:252
DtString dataKey
Definition: uiGraphDataWidget.h:90
#define DT_DLL_simulationObjectEditorimpl
This file is used to determine how to build.
Definition: simulationObjectEditorImplDefines.h:33
Base class of the ui element class chain. Properties available through designer for all ui elements a...
Definition: uiElement.h:193
DtSizedTableWidget(QWidget *p)
Definition: uiGraphDataWidget.h:47
bool myMoveRange
Definition: uiGraphDataWidget.h:279
Definition: uiGraphDataWidget.h:88

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)