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/nmWxForecast.h

166 lines
4.8 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.

#ifndef NMWXFORECAST_H
#define NMWXFORECAST_H
#include "iDlgBase.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QGroupBox>
#include <QRadioButton>
#include <QCheckBox>
#include <QButtonGroup>
#include <QPushButton>
#include <QStackedWidget>
#include <QTableWidget>
#include <QComboBox>
#include <QPointer>
#include "nmDataForecast.h"
#include "nmGUIComponentLineEdit.h"
#include "nmDataAnalyzeManager.h"
class nmCalculationDllPebiSolverTask;
class QProgressDialog;
class nmWxForecast : public iDlgBase
{
Q_OBJECT
public:
explicit nmWxForecast(QWidget *parent = 0, nmDataAnalyzeManager* manager = 0);
~nmWxForecast();
signals:
// 计算完成后由所属分析主界面承载结果,输入窗口不持有结果窗口。
void sigForecastReady(const QString& wellName, const QVector<double>& times,
const QVector<double>& pressures, const QVector<double>& durations,
const QVector<double>& rates);
public slots:
void reject();
private slots:
// Forecast option slots
void onConstantPressureSelected();
void onDecliningPressureSelected();
void onMultiplePressuresSelected();
void onMultipleRatesSelected();
// Checkbox slots
void onUsePastHistoryToggled(bool checked);
void onSurfacePressuresToggled(bool checked);
void onAbandonmentRateCheckToggled(bool checked);
void onMaximumRateCheckToggled(bool checked);
// Button slots
void onLoadDataClicked();
void onGenerateClicked();
void onCancelClicked();
void onForecastFinished();
void onModelChanged();
// Table edit
void onPressureCellChanged(int row, int column);
void onPressureUnitChanged(const QString& unit);
// Slots for Multiple Rates table
void onRateCellChanged(int row, int column);
void onRateUnitChanged(const QString& unit);
void onSharedDurationUnitChanged(const QString &);
private:
void setupUI();
void setupConnections();
void loadDataFromManager();
void updateParametersForOption();
void updateUIFromData();
void updateDataFromUI();
void saveDataToManager();
bool readRateSchedule(QVector<double>& durations, QVector<double>& rates, QString& error) const;
QWidget* buildExtEmptyPage(const QString& text = QString());
QWidget* buildExtRampPage();
QWidget* buildExtMultiPressurePage();
QWidget* buildExtMultiRatePage();
QTableWidgetItem* makeCenteredEmptyItem();
private:
nmDataForecast m_forecastData;
QPointer<nmDataAnalyzeManager> m_manager; ///< 固定所属分析窗口,不跟随全局当前窗口。
nmCalculationDllPebiSolverTask* m_task;
QProgressDialog* m_progress;
QString m_sourceSnapshotId;
QString m_wellName;
QVector<double> m_durations; ///< 本次计算的分段时长(hr)。
QVector<double> m_rates; ///< 本次计算的分段产量(m^3/D)。
// Main layout
QVBoxLayout *m_mainLayout;
// Forecast options group
QGroupBox *m_forecastOptionsGroup;
QVBoxLayout *m_forecastOptionsLayout;
QRadioButton *m_constantPressureRadio;
QRadioButton *m_decliningPressureRadio;
QRadioButton *m_multiplePressuresRadio;
QRadioButton *m_multipleRatesRadio;
QButtonGroup *m_forecastButtonGroup;
QCheckBox *m_usePastHistoryCheck;
QCheckBox *m_surfacePressuresCheck;
// Parameters group
QGroupBox *m_parametersGroup;
QGridLayout *m_parametersLayout;
// Base parameters
nmGUIComponentLineEdit *m_initialPressureComponent;
QCheckBox *m_abandonmentRateCheck;
nmGUIComponentLineEdit *m_abandonmentRateComponent;
QCheckBox *m_maximumRateCheck;
nmGUIComponentLineEdit *m_maximumRateComponent;
nmGUIComponentLineEdit *m_forecastDurationComponent;
nmGUIComponentLineEdit *m_producingPressureComponent;
// Extension stack for different options
QWidget *m_extEmpty;
QWidget *m_extRamp;
QWidget *m_extMultiP;
QWidget *m_extMultiR;
// Ramp-specific parameters
nmGUIComponentLineEdit *m_producingPressureEndComponent;
nmGUIComponentLineEdit *m_pressureChangePeriodComponent;
// Bottom buttons
QHBoxLayout *m_buttonLayout;
QPushButton *m_loadDataButton;
QPushButton *m_generateButton;
QPushButton *m_cancelButton;
// Table
QTableWidget* m_pressureTableWidget;
QComboBox* m_pDurationUnitCombo;
QComboBox* m_pPressureUnitCombo;
QString m_currentDurationUnit;
QString m_currentPressureUnit;
// For Multiple Rates
QTableWidget* m_rateTableWidget;
QComboBox* m_rDurationUnitCombo;
QComboBox* m_rRateUnitCombo;
QString m_currentRateUnit;
QStackedWidget* m_extStackedWidget;
QStackedWidget* m_abandonmentStack;
QStackedWidget* m_maximumStack;
QWidget* m_abandonmentSpacer;
QWidget* m_maximumSpacer;
};
#endif // NMWXFORECAST_H