Engauge Digitizer 2
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
FittingWindow Class Reference

Window that displays curve fitting as applied to the currently selected curve. More...

#include <FittingWindow.h>

Inheritance diagram for FittingWindow:
Inheritance graph
Collaboration diagram for FittingWindow:
Collaboration graph

Signals

void signalCurveFit (FittingCurveCoefficients, double, double, bool, bool)
 Signal containing coefficients from curve fit.
 
void signalFittingWindowClosed ()
 Signal that this QDockWidget was just closed.
 

Public Member Functions

 FittingWindow (MainWindow *mainWindow)
 Single constructor. Parent is needed or else this widget cannot be redocked after being undocked.
 
virtual ~FittingWindow ()
 
virtual void clear ()
 Clear stale information.
 
virtual void closeEvent (QCloseEvent *event)
 Catch close event so corresponding menu item in MainWindow can be updated accordingly.
 
virtual void doCopy ()
 Copy the current selection to the clipboard.
 
virtual void update (const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
 Populate the table with the specified Curve.
 
virtual QTableView * view () const
 QTableView-based class used by child class.
 
- Public Member Functions inherited from WindowAbstractBase
 WindowAbstractBase (QWidget *parent)
 Single constructor. Parent is needed or else this widget cannot be redocked after being undocked.
 
virtual ~WindowAbstractBase ()
 
void getTableStatus (bool &tableIsActive, bool &tableIsCopyable) const
 Give table status so MainWindow can determine if table can be copied.
 

Additional Inherited Members

Detailed Description

Window that displays curve fitting as applied to the currently selected curve.

The strategy used assumes no changes to the DIG file format will be made for the original implementation. Since settings cannot be saved for the Document or Curves, this keeps the implementation simple

Definition at line 34 of file FittingWindow.h.

Constructor & Destructor Documentation

◆ FittingWindow()

FittingWindow::FittingWindow ( MainWindow * mainWindow)

Single constructor. Parent is needed or else this widget cannot be redocked after being undocked.

Definition at line 34 of file FittingWindow.cpp.

34 :
35 WindowAbstractBase (mainWindow),
36 m_isLogXTheta (false),
37 m_isLogYRadius (false),
38 m_significantDigits (mainWindow->modelMainWindow().significantDigits ())
39{
40 setVisible (false);
41 setAllowedAreas (Qt::AllDockWidgetAreas);
42 setWindowTitle (tr ("Curve Fitting Window")); // Appears in title bar when undocked
43 setStatusTip (tr ("Curve Fitting Window"));
44 setWhatsThis (tr ("Curve Fitting Window\n\n"
45 "This window applies a curve fit to the currently selected curve.\n\n"
46 "If drag-and-drop is disabled, a rectangular set of cells may be selected by clicking and dragging. Otherwise, if "
47 "drag-and-drop is enabled, a rectangular set of cells may be selected using Click then Shift+Click, since click and drag "
48 "starts the dragging operation. Drag-and-drop mode is set in the Main Window settings"));
49
50 m_coefficients.resize (MAX_POLYNOMIAL_ORDER + 1);
51
52 createWidgets (mainWindow);
53 initializeOrder ();
54 clear ();
55}
const int INNER_RADIUS_MIN
const int MAX_POLYNOMIAL_ORDER
virtual void clear()
Clear stale information.
int significantDigits() const
Get method for significant digits.
MainWindowModel modelMainWindow() const
Get method for main window model.
Dockable widget abstract base class.

◆ ~FittingWindow()

FittingWindow::~FittingWindow ( )
virtual

Definition at line 57 of file FittingWindow.cpp.

58{
59}

Member Function Documentation

◆ clear()

void FittingWindow::clear ( )
virtual

Clear stale information.

Implements WindowAbstractBase.

Definition at line 102 of file FittingWindow.cpp.

103{
104 m_labelY->setText ("");
105 m_model->setRowCount (0);
106 m_lblMeanSquareError->setText ("");
107 m_lblRootMeanSquare->setText ("");
108 m_lblRSquared->setText ("");
109}

◆ closeEvent()

void FittingWindow::closeEvent ( QCloseEvent * event)
virtual

Catch close event so corresponding menu item in MainWindow can be updated accordingly.

Implements WindowAbstractBase.

Definition at line 111 of file FittingWindow.cpp.

112{
113 LOG4CPP_INFO_S ((*mainCat)) << "FittingWindow::closeEvent";
114
116}
log4cpp::Category * mainCat
Definition Logger.cpp:14
void signalFittingWindowClosed()
Signal that this QDockWidget was just closed.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ doCopy()

void FittingWindow::doCopy ( )
virtual

Copy the current selection to the clipboard.

Implements WindowAbstractBase.

Definition at line 178 of file FittingWindow.cpp.

179{
180 LOG4CPP_INFO_S ((*mainCat)) << "FittingWindow::doCopy";
181
182 QString text = m_model->selectionAsText (m_modelExport.delimiter());
183
184 if (!text.isEmpty ()) {
185
186 // Save to clipboard
187 QApplication::clipboard ()->setText (text);
188
189 }
190}
ExportDelimiter delimiter() const
Get method for delimiter.
QString selectionAsText(ExportDelimiter delimiter) const
Convert the selection into exportable text which is good for text editors.

◆ signalCurveFit

void FittingWindow::signalCurveFit ( FittingCurveCoefficients ,
double ,
double ,
bool ,
bool  )
signal

Signal containing coefficients from curve fit.

◆ signalFittingWindowClosed

void FittingWindow::signalFittingWindowClosed ( )
signal

Signal that this QDockWidget was just closed.

◆ update()

void FittingWindow::update ( const CmdMediator & cmdMediator,
const MainWindowModel & modelMainWindow,
const QString & curveSelected,
const Transformation & transformation )
virtual

Populate the table with the specified Curve.

Implements WindowAbstractBase.

Definition at line 255 of file FittingWindow.cpp.

259{
260 LOG4CPP_INFO_S ((*mainCat)) << "FittingWindow::update";
261
262 // Save inputs
263 m_curveSelected = curveSelected;
264 m_modelExport = cmdMediator.document().modelExport();
265 m_model->setDelimiter (m_modelExport.delimiter());
266 m_isLogXTheta = (cmdMediator.document().modelCoords().coordScaleXTheta() == COORD_SCALE_LOG);
267 m_isLogYRadius = (cmdMediator.document().modelCoords().coordScaleYRadius() == COORD_SCALE_LOG);
268 m_view->setDragEnabled (modelMainWindow.dragDropExport());
269 m_significantDigits = modelMainWindow.significantDigits();
270
271 m_pointsConvenient.clear ();
272
273 if (transformation.transformIsDefined()) {
274
275 // Gather and calculate geometry data
276 const Curve *curve = cmdMediator.document().curveForCurveName (curveSelected);
277
279
280 if (curve->numPoints() > 0) {
281
282 // Copy points to convenient list
283 const Points points = curve->points();
284 Points::const_iterator itr;
285 for (itr = points.begin (); itr != points.end (); itr++) {
286
287 const Point &point = *itr;
288 QPointF posScreen = point.posScreen ();
289 QPointF posGraph;
290 transformation.transformScreenToRawGraph (posScreen,
291 posGraph);
292
293 // Adjust for log coordinates
294 if (m_isLogXTheta) {
295 double x = qLn (posGraph.x()) / qLn (10.0); // Use base 10 consistent with text in resizeTable
296 posGraph.setX (x);
297 }
298 if (m_isLogYRadius) {
299 double y = qLn (posGraph.y()) / qLn (10.0); // Use base 10 consistent with text in resizeTable
300 posGraph.setY (y);
301 }
302
303 m_pointsConvenient.append (posGraph);
304 }
305 }
306 }
307
308 refreshTable ();
309}
@ COORD_SCALE_LOG
Definition CoordScale.h:14
#define ENGAUGE_CHECK_PTR(ptr)
#endif
QList< Point > Points
Definition Points.h:13
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Container for one set of digitized Points.
Definition Curve.h:34
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
CoordScale coordScaleXTheta() const
Get method for linear/log scale on x/theta.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Definition Document.cpp:695
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
Definition Document.cpp:716
const Curve * curveForCurveName(const QString &curveName) const
See CurvesGraphs::curveForCurveNames, although this also works for AXIS_CURVE_NAME.
Definition Document.cpp:335
bool dragDropExport() const
Get method for drag and drop export.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition Point.h:26
QPointF posScreen() const
Accessor for screen position.
Definition Point.cpp:404
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.
void setDelimiter(ExportDelimiter delimiter)
Save output delimiter.

◆ view()

QTableView * FittingWindow::view ( ) const
virtual

QTableView-based class used by child class.

Implements WindowAbstractBase.

Definition at line 311 of file FittingWindow.cpp.

312{
313 return dynamic_cast<QTableView*> (m_view);
314}

The documentation for this class was generated from the following files: