16#include <QApplication>
18#include <QItemSelectionModel>
30 "This table displays the following geometry data for the currently selected curve:\n\n"
31 "Function area = Area under the curve if it is a function\n\n"
32 "Polygon area = Area inside the curve if it is a relation. This value is only correct "
33 "if none of the curve lines intersect each other\n\n"
34 "X = X coordinate of each point\n\n"
35 "Y = Y coordinate of each point\n\n"
36 "Index = Point number\n\n"
37 "Distance = Distance along the curve in forward or backward direction, in either graph units "
38 "or as a percentage\n\n"
39 "If drag-and-drop is disabled, a rectangular set of cells may be selected by clicking and dragging. Otherwise, if "
40 "drag-and-drop is enabled, a rectangular set of cells may be selected using Click then Shift+Click, since click and drag "
41 "starts the dragging operation. Drag-and-drop mode is set in the Main Window settings"));
43 createWidgets (mainWindow);
56 resizeTable (NUM_HEADER_ROWS);
59 for (
int row = 0;
row < NUM_HEADER_ROWS - 1;
row++) {
73 return COLUMN_BODY_POINT_IDENTIFIERS;
76void GeometryWindow::createWidgets (
MainWindow *mainWindow)
82 mainWindow,
SLOT (slotTableStatusChange ()));
93 if (!
text.isEmpty ()) {
96 QApplication::clipboard ()->setText (
text);
101void GeometryWindow::initializeHeader ()
105 resizeTable (NUM_HEADER_ROWS);
107 m_model->setItem (HEADER_ROW_NAME, COLUMN_HEADER_LABEL,
new QStandardItem (tokenCurveName ()));
108 m_model->setItem (HEADER_ROW_FUNC_AREA, COLUMN_HEADER_LABEL,
new QStandardItem (tokenFunctionArea ()));
109 m_model->setItem (HEADER_ROW_POLY_AREA, COLUMN_HEADER_LABEL,
new QStandardItem (tokenPolygonArea ()));
110 m_model->setItem (HEADER_ROW_COLUMN_NAMES, COLUMN_BODY_X,
new QStandardItem (tokenX ()));
111 m_model->setItem (HEADER_ROW_COLUMN_NAMES, COLUMN_BODY_Y,
new QStandardItem (tokenY ()));
112 m_model->setItem (HEADER_ROW_COLUMN_NAMES, COLUMN_BODY_INDEX,
new QStandardItem (tokenIndex ()));
113 m_model->setItem (HEADER_ROW_COLUMN_NAMES, COLUMN_BODY_DISTANCE_GRAPH_FORWARD,
new QStandardItem (tokenDistanceGraph ()));
114 m_model->setItem (HEADER_ROW_COLUMN_NAMES, COLUMN_BODY_DISTANCE_PERCENT_FORWARD,
new QStandardItem (tokenDistancePercent ()));
115 m_model->setItem (HEADER_ROW_COLUMN_NAMES, COLUMN_BODY_DISTANCE_GRAPH_BACKWARD,
new QStandardItem (tokenDistanceGraph ()));
116 m_model->setItem (HEADER_ROW_COLUMN_NAMES, COLUMN_BODY_DISTANCE_PERCENT_BACKWARD,
new QStandardItem (tokenDistancePercent ()));
119void GeometryWindow::loadStrategies ()
124void GeometryWindow::resizeTable (
int rowCount)
130 m_model->setRowCount (rowCount);
131 m_model->setColumnCount (NUM_BODY_COLUMNS);
145QString GeometryWindow::tokenCurveName ()
const
147 return QString (
"%1:").arg (QObject::tr (
"CurveName"));
150QString GeometryWindow::tokenDistanceGraph ()
const
152 return QObject::tr (
"Distance");
155QString GeometryWindow::tokenDistancePercent ()
const
157 return QObject::tr (
"Percent");
160QString GeometryWindow::tokenFunctionArea ()
const
162 return QString (
"%1:").arg (QObject::tr (
"FunctionArea"));
165QString GeometryWindow::tokenIndex ()
const
167 return QObject::tr (
"Index");
170QString GeometryWindow::tokenPolygonArea ()
const
172 return QString (
"%1:").arg (QObject::tr (
"PolygonArea"));
175QString GeometryWindow::tokenX ()
const
177 return QObject::tr (
"X");
180QString GeometryWindow::tokenY ()
const
182 return QObject::tr (
"Y");
185void GeometryWindow::unselectAll ()
238 m_view->clearSpans();
251 int row = NUM_HEADER_ROWS;
252 for (
int index = 0; index < points.count();
row++, index++) {
254 const Point &point = points.at (index);
262 m_model->setItem (
row, COLUMN_BODY_INDEX,
new QStandardItem (QString::number (index + 1)));
273 m_model->setItem (
row, COLUMN_BODY_X,
274 new QStandardItem (
tr (
"Highlighted segments may have unexpected values when exported due to overlaps. "
275 "Adjust points or change Settings / Curve Properties / Connect As.")));
284 m_view->setColumnHidden (COLUMN_BODY_POINT_IDENTIFIERS,
true);
289 return dynamic_cast<QTableView*
> (m_view);
const int INNER_RADIUS_MIN
#define ENGAUGE_CHECK_PTR(ptr)
#endif
log4cpp::Category * mainCat
Container for LineStyle and PointStyle for one Curve.
LineStyle lineStyle() const
Get method for LineStyle.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Container for one set of digitized Points.
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
const Curve * curveForCurveName(const QString &curveName) const
See CurvesGraphs::curveForCurveNames, although this also works for AXIS_CURVE_NAME.
Model that adds row highlighting according to the currently select point identifier.
void setCurrentPointIdentifier(const QString &pointIdentifier)
Set the point identifier to be highlighted. Value is empty for no highlighting.
void setPotentialExportAmbiguity(const QVector< bool > &isPotentialExportAmbiguity)
Remember which rows could have ambiguities during export - these will be highlighted.
void calculateGeometry(const Points &points, const DocumentModelCoords &modelCoords, const DocumentModelGeneral &modelGeneral, const MainWindowModel &modelMainWindow, const Transformation &transformation, CurveConnectAs connectAs, QString &funcArea, QString &polyArea, QVector< QString > &x, QVector< QString > &y, QVector< bool > &isPotentialExportAmbiguity, QVector< QString > &distanceGraphForward, QVector< QString > &distancePercentForward, QVector< QString > &distanceGraphBackward, QVector< QString > &distancePercentBackward) const
Calculate geometry parameters.
static int columnBodyPointIdentifiers()
Hidden column that has the point identifiers.
GeometryWindow(MainWindow *mainWindow)
Single constructor. Parent is needed or else this widget cannot be redocked after being undocked.
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.
CurveConnectAs curveConnectAs() const
Get method for connect type.
Model for DlgSettingsMainWindow.
bool dragDropExport() const
Get method for drag and drop export.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
QPointF posScreen() const
Accessor for screen position.
QString identifier() const
Unique identifier for a specific Point.
Dockable widget abstract base class.
QString selectionAsText(ExportDelimiter delimiter) const
Convert the selection into exportable text which is good for text editors.
void setDelimiter(ExportDelimiter delimiter)
Save output delimiter.
Table view class with support for both drag-and-drop and copy-and-paste.
#define LOG4CPP_INFO_S(logger)