Engauge Digitizer  2
GeometryWindow.h
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef GEOMETRY_WINDOW_H
8 #define GEOMETRY_WINDOW_H
9 
12 #include "WindowAbstractBase.h"
13 
14 class CmdMediator;
15 class Curve;
16 class GeometryModel;
17 class MainWindow;
18 class MainWindowModel;
19 class QItemSelection;
20 class QString;
21 class QTableView;
22 class Transformation;
23 
29 {
30  Q_OBJECT;
31 
32 public:
34  GeometryWindow (MainWindow *mainWindow);
35  virtual ~GeometryWindow ();
36 
37  virtual void clear ();
38  virtual void closeEvent(QCloseEvent *event);
39 
41  static int columnBodyPointIdentifiers ();
42 
43  virtual void doCopy ();
44  virtual void update (const CmdMediator &cmdMediator,
45  const MainWindowModel &modelMainWindow,
46  const QString &curveSelected,
47  const Transformation &transformation);
48  virtual QTableView *view () const;
49 
50 public slots:
51 
53  void slotPointHoverEnter (QString);
54 
56  void slotPointHoverLeave (QString);
57 
58 signals:
59 
62 
63 private:
65 
66  void createWidgets (MainWindow *mainWindow);
67  void initializeHeader();
68  void loadStrategies ();
69  void resizeTable (int rowCount);
70 
71  // String constants that get translated, by wrapper functions, after QTranslator has been set up.
72  //
73  // Token constraints:
74  // (1) should fit nicely into narrow columns. This eliminates details like Forward and Backward in the distance parameter tokens
75  // (2) should not have any spaces. This simplifies copying and pasting into spreadsheet programs
76  QString tokenCurveName () const;
77  QString tokenDistanceGraph () const;
78  QString tokenDistancePercent () const;
79  QString tokenFunctionArea () const;
80  QString tokenIndex () const;
81  QString tokenPolygonArea () const;
82  QString tokenX () const;
83  QString tokenY () const;
84 
85  void unselectAll (); // Unselect all cells. This cleans up nicely when Document is closed
86 
87  enum ColumnsHeader {
88  COLUMN_HEADER_LABEL,
89  COLUMN_HEADER_VALUE,
90  NUM_HEADER_COLUMNS
91  };
92 
93  enum ColumnsBody {
94  COLUMN_BODY_X,
95  COLUMN_BODY_Y,
96  COLUMN_BODY_INDEX,
97  COLUMN_BODY_DISTANCE_GRAPH_FORWARD,
98  COLUMN_BODY_DISTANCE_PERCENT_FORWARD,
99  COLUMN_BODY_DISTANCE_GRAPH_BACKWARD,
100  COLUMN_BODY_DISTANCE_PERCENT_BACKWARD,
101  COLUMN_BODY_POINT_IDENTIFIERS,
102  NUM_BODY_COLUMNS
103  };
104 
105  enum HeaderRows {
106  HEADER_ROW_NAME,
107  HEADER_ROW_FUNC_AREA,
108  HEADER_ROW_POLY_AREA,
109  HEADER_ROW_COLUMN_NAMES,
110  NUM_HEADER_ROWS
111  };
112 
113  QTableView *m_view;
114  GeometryModel *m_model;
115 
116  GeometryStrategyContext m_geometryStrategyContext;
117 
118  // Export format is updated after every CmdAbstractBase gets redone/undone
119  DocumentModelExportFormat m_modelExport;
120 };
121 
122 #endif // GEOMETRY_WINDOW_H
GeometryWindow::view
virtual QTableView * view() const
QTableView-based class used by child class.
Definition: GeometryWindow.cpp:286
DocumentModelExportFormat.h
GeometryStrategyContext
Class for that manages geometry strategies.
Definition: GeometryStrategyContext.h:20
GeometryWindow::slotPointHoverLeave
void slotPointHoverLeave(QString)
Unhighlight the row for the specified point.
Definition: GeometryWindow.cpp:139
Transformation
Affine transformation between screen and graph coordinates, based on digitized axis points.
Definition: Transformation.h:30
GeometryWindow::doCopy
virtual void doCopy()
Copy the current selection to the clipboard.
Definition: GeometryWindow.cpp:86
GeometryWindow::~GeometryWindow
virtual ~GeometryWindow()
Definition: GeometryWindow.cpp:47
Curve
Container for one set of digitized Points.
Definition: Curve.h:32
MainWindowModel
Model for DlgSettingsMainWindow.
Definition: MainWindowModel.h:29
GeometryWindow::slotPointHoverEnter
void slotPointHoverEnter(QString)
Highlight the row for the specified point.
Definition: GeometryWindow.cpp:134
MainWindow
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:90
GeometryWindow::update
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
Definition: GeometryWindow.cpp:191
GeometryWindow::signalGeometryWindowClosed
void signalGeometryWindowClosed()
Signal that this QDockWidget was just closed.
DocumentModelExportFormat
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
Definition: DocumentModelExportFormat.h:22
GeometryWindow::columnBodyPointIdentifiers
static int columnBodyPointIdentifiers()
Hidden column that has the point identifiers.
Definition: GeometryWindow.cpp:70
CmdMediator
Command queue stack.
Definition: CmdMediator.h:22
WindowAbstractBase.h
GeometryWindow
Window that displays the geometry information, as a table, for the current curve.
Definition: GeometryWindow.h:27
GeometryWindow::clear
virtual void clear()
Clear stale information.
Definition: GeometryWindow.cpp:52
GeometryModel
Model that adds row highlighting according to the currently select point identifier.
Definition: GeometryModel.h:15
GeometryStrategyContext.h
WindowAbstractBase
Dockable widget abstract base class.
Definition: WindowAbstractBase.h:19
GeometryWindow::closeEvent
virtual void closeEvent(QCloseEvent *event)
Catch close event so corresponding menu item in MainWindow can be updated accordingly.
Definition: GeometryWindow.cpp:63