#ifndef NMWXPROPERTYINTERPOLATIONDLG_H #define NMWXPROPERTYINTERPOLATIONDLG_H #include "iDlgBase.h" #include "nmDataAnalyzeManager.h" #include "nmSubWxs_global.h" #include #include #include class QCheckBox; class QComboBox; class QDoubleSpinBox; class QEvent; class QLineEdit; class QPointF; class QPushButton; class QTableWidget; class QTableWidgetItem; class QTimer; class nmGuiPlot; class nmObjPoint; class nmWxPropertyInterpolationPreviewDlg; class NM_SUB_WXS_EXPORT nmWxPropertyInterpolationDlg : public iDlgBase { Q_OBJECT public: explicit nmWxPropertyInterpolationDlg(nmGuiPlot* plot, nmDataAnalyzeManager* dataManager, QWidget* parent = 0); ~nmWxPropertyInterpolationDlg(); protected: bool eventFilter(QObject* watched, QEvent* event); private slots: void onDataSetChanged(int index); void onAddDataSet(); void onDeleteDataSet(); void onDataSetNameChanged(const QString& name); // 当前数据组属性及显示单位变化. void onCurrentDataSetPropertyChanged(); void onCurrentDataSetEdited(); void onXDisplayUnitChanged(const QString& unit); void onYDisplayUnitChanged(const QString& unit); void onValueDisplayUnitChanged(const QString& unit); void onRangeDisplayUnitChanged(const QString& unit); // 正式求解使用的数据组变化. void onCalculationSelectionChanged(); void onMapPickToggled(bool checked); void onMapClicked(const QPointF& position); void onPointSelectionChanged(); void onPointItemChanged(QTableWidgetItem* item); void onDeleteSelectedPoint(); void onClearPoints(); void onShowPointsToggled(bool checked); void onShowLabelsToggled(bool checked); void onPreview(); void refreshPreview(); private: // 初始化界面及持久化数据组. void initInterpolationUI(); void initializeDataSets(); nmPropertyInterpolationDataSet createDefaultDataSet(); QString nextDataSetName(); void loadDataSet(int index); void clearCurrentDataSet(); void saveCurrentDataSet(); // 单位控件只维护界面显示状态;插值数据始终按求解器基准单位保存. void updateUnitControls(nmPropertyInterpolationDataSet& dataSet); void updatePointDisplayValues(); void clearPointRows(); void updatePointRowNumbers(); void syncDataSetsToManager(bool markModified); void updateDataSetButtons(); // 管理正式求解时k、phi和h各自使用的插值数据组. void updateCalculationDataSetControls(); void updateCalculationDataSetControl(const QString& property, QCheckBox* checkBox, QComboBox* comboBox); void saveCalculationSelection(const QString& property, QCheckBox* checkBox, QComboBox* comboBox); // 管理测点表格和地图上的临时标记. void appendPoint(const QPointF& valuePoint); void appendPointRow(const nmPropertyInterpolationPointData& point, const QString& markerName); QString createMarker(const QPointF& valuePosition, double value, bool showPoints, bool showLabels); void createMarkersForAllDataSets(); void removeDataSetMarkers(int dataSetIndex); void removeAllMarkers(); QString markerNameAt(int row) const; nmObjPoint* markerByName(const QString& markerName) const; nmObjPoint* markerAt(int row) const; void removeMarkerByName(const QString& markerName); void clearTableSelection(); void updatePointButtons(); void updateCurrentMarkerVisibility(); void schedulePreviewRefresh(); void updatePreviewWindow(bool activateWindow); void showPreviewError(const QString& message, bool activateWindow); private: QPointer m_pPlot; QPointer m_pDataManager; // 多组插值数据. QComboBox* m_pDataSetCombo; QPushButton* m_pAddDataSetButton; QPushButton* m_pDeleteDataSetButton; QVector m_vecDataSets; // 与数据组、测点下标一一对应,仅保存地图临时标记的对象名称. QVector m_vecMarkerNames; int m_nCurrentDataSetIndex; int m_nNextPointId; // 加载界面数据时阻止控件信号反向修改当前数据组. bool m_bUpdatingUi; // 当前数据组的属性及名称. QComboBox* m_pPropertyCombo; QLineEdit* m_pNameEdit; // 测点数据录入. QDoubleSpinBox* m_pNewValueSpin; // 新值单位与表格Value列单位保持同步. QComboBox* m_pNewValueUnitCombo; QPushButton* m_pMapPickButton; QTableWidget* m_pPointTable; // 表格第0行中的X、Y和Value显示单位. QComboBox* m_pXUnitCombo; QComboBox* m_pYUnitCombo; QComboBox* m_pValueUnitCombo; QPushButton* m_pDeletePointButton; QPushButton* m_pClearPointsButton; QCheckBox* m_pShowPointsCheck; QCheckBox* m_pShowLabelsCheck; // Kriging插值参数. QDoubleSpinBox* m_pNuggetSpin; QDoubleSpinBox* m_pSillSpin; QDoubleSpinBox* m_pRangeSpin; QComboBox* m_pRangeUnitCombo; QComboBox* m_pModelCombo; // 正式求解时各属性使用的数据组. QCheckBox* m_pUseKCheck; QComboBox* m_pKCalculationDataSetCombo; QCheckBox* m_pUsePhiCheck; QComboBox* m_pPhiCalculationDataSetCombo; QCheckBox* m_pUseHCheck; QComboBox* m_pHCalculationDataSetCombo; // 插值结果预览. QPushButton* m_pPreviewButton; QPointer m_pPreviewDialog; QTimer* m_pPreviewRefreshTimer; }; #endif // NMWXPROPERTYINTERPOLATIONDLG_H