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
Command queue stack.
Definition: CmdMediator.h:24
Container for one set of digitized Points.
Definition: Curve.h:34
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
Model that adds row highlighting according to the currently select point identifier.
Definition: GeometryModel.h:17
Class for that manages geometry strategies.
Window that displays the geometry information, as a table, for the current curve.
static int columnBodyPointIdentifiers()
Hidden column that has the point identifiers.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
virtual void closeEvent(QCloseEvent *event)
Catch close event so corresponding menu item in MainWindow can be updated accordingly.
void slotPointHoverEnter(QString)
Highlight the row for the specified point.
virtual QTableView * view() const
QTableView-based class used by child class.
void slotPointHoverLeave(QString)
Unhighlight the row for the specified point.
virtual void clear()
Clear stale information.
virtual void doCopy()
Copy the current selection to the clipboard.
virtual ~GeometryWindow()
void signalGeometryWindowClosed()
Signal that this QDockWidget was just closed.
Model for DlgSettingsMainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:92
Affine transformation between screen and graph coordinates, based on digitized axis points.
Dockable widget abstract base class.