You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmSubWxs/nmWellPressureFlowPage.h

133 lines
4.5 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "nmSubWxs_global.h"
#include <QPointF>
#include <QString>
#include <QVector>
#include <QWidget>
class iUnitGroup;
class iUnitItem;
class nmDataWellBase;
class nmWxPressFlowChartWidget;
class QSplitter;
class QStackedWidget;
class QTableWidget;
class ZxTableHeaderViewUnit;
/**
* @brief 显示当前井工作副本中的只读压力和流量数据。
* @note 页面不拥有井对象只保存以h、m³/d和MPa为基准的数据副本。
*/
class NM_SUB_WXS_EXPORT nmWellPressureFlowPage : public QWidget
{
Q_OBJECT
public:
/** @brief 创建只读压力流量页面。 */
explicit nmWellPressureFlowPage(QWidget* pParent = nullptr);
/**
* @brief 绑定当前井工作副本,不立即读取数据。
* @param pWell 井工作副本,不转移所有权。
*/
void setWell(nmDataWellBase* pWell);
/** @brief 从已绑定井重新读取原始数据并刷新全部视图。 */
void refreshData();
/** @brief 解除井绑定并清空全部显示数据。 */
void clearData();
private slots:
/** @brief 从原始副本重新生成指定单位的表格和曲线。 */
void slotUnitChanged(int nColumn,
const iUnitItem* pSourceUnit,
const iUnitItem* pDestinationUnit);
/** @brief 将表格当前行同步为两张曲线的高亮流量段。 */
void slotFlowRowChanged(int nCurrentRow,
int nCurrentColumn,
int nPreviousRow,
int nPreviousColumn);
/** @brief 将流量曲线点击时间映射为表格行选择。 */
void slotFlowChartPointClicked(double dTimePoint);
private:
/** @brief 创建左右分栏、上下图表和只读流量表格。 */
void createUi();
/** @brief 重新获取框架单位组并同步双行表头。 */
void initializeUnitSupport();
/** @brief 将表头恢复为当前已成功应用的单位。 */
void updateUnitHeader();
/** @brief 由基准副本生成表格显示点和目标单位精度。 */
bool buildFlowTableData(
const QString& sTimeUnit,
const QString& sFlowUnit,
QVector<QPointF>& vecFlowPoints,
int& nTimeDigit,
int& nFlowDigit) const;
/** @brief 使用指定单位组转换一个值。 */
bool convertValue(iUnitGroup* pUnitGroup,
const QString& sBaseUnit,
const QString& sDestinationUnit,
double dSourceValue,
double& dDestinationValue,
int* pDestinationDigit = nullptr) const;
/** @brief 刷新表格、图表、空状态和选中段。 */
void updateViews();
/** @brief 从原始流量持续时间生成基准单位阶梯曲线点。 */
QVector<QPointF> createFlowChartPoints() const;
/** @brief 刷新流量时序表并恢复有效选中行。 */
void updateFlowTable();
/** @brief 按原始压力和流量数据的时间并集同步图表范围。 */
void updateXAxisRange(
const QVector<QPointF>& vecFlowChartPoints);
/** @brief 根据共享流量段索引刷新两张曲线高亮。 */
void updateSelectedFlowSegment();
/** @brief 统一应用表格与曲线共享的零基流量点索引。 */
void applyFlowSegmentSelection(int nSegmentIndex);
/** @brief 按表格当前时间单位查找点击时间所属的流量点。 */
int findFlowSegmentByTableTime(double dTimePoint) const;
/** @brief 清空数据副本和视图,但保留当前单位及井绑定。 */
void resetDataViews();
nmDataWellBase* m_pWell; ///< 当前工作副本,不拥有。
QStackedWidget* m_pContentStack;
QSplitter* m_pHorizontalSplitter;
QSplitter* m_pChartSplitter;
QStackedWidget* m_pPressureChartStack;
QStackedWidget* m_pFlowChartStack;
QStackedWidget* m_pFlowTableStack;
nmWxPressFlowChartWidget* m_pPressureChart;
nmWxPressFlowChartWidget* m_pFlowChart;
QTableWidget* m_pFlowTable;
ZxTableHeaderViewUnit* m_pFlowHeader;
iUnitGroup* m_pTimeUnitGroup; ///< 框架拥有。
iUnitGroup* m_pFlowUnitGroup; ///< 框架拥有。
QVector<QPointF> m_vecRawPressurePoints;
QVector<QPointF> m_vecRawFlowPoints;
QVector<QPointF> m_vecTableFlowPoints;
QString m_sTimeBaseUnit;
QString m_sFlowBaseUnit;
QString m_sTimeUnit;
QString m_sFlowUnit;
int m_nTimeDigit;
int m_nFlowDigit;
int m_nSelectedFlowSegment;
};