|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "iDlgBase.h"
|
|
|
|
|
#include "iResultInfo.h"
|
|
|
|
|
#include "iGridRowItemUnt.h"
|
|
|
|
|
|
|
|
|
|
class iBdyInfo;
|
|
|
|
|
|
|
|
|
|
// 参数区统一处理的Utils
|
|
|
|
|
class X_GUI_GRIDPTY_EXPORT iGridRowUtils : public iDlgBase//QAbstractScrollArea
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
explicit iGridRowUtils();
|
|
|
|
|
~iGridRowUtils();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 初始化
|
|
|
|
|
virtual void initUI();
|
|
|
|
|
|
|
|
|
|
// 对外暴露接口
|
|
|
|
|
bool buildRowUtils(QStringList listParas, \
|
|
|
|
|
QStringList& listParaTags, \
|
|
|
|
|
bool bDnMode, \
|
|
|
|
|
QWidget* pWxDlg);
|
|
|
|
|
void setParaItems(QVector<iGridRowItem *>& vec, \
|
|
|
|
|
bool bDnMode, \
|
|
|
|
|
QWidget* pWxDlg);
|
|
|
|
|
void setBounds(QRectF& rt);
|
|
|
|
|
float getUtilHeight();
|
|
|
|
|
void connectSignalsOf(iGridRowItem* p);
|
|
|
|
|
void bkAllItems();
|
|
|
|
|
QStringList getAllTags(); //不考虑层级
|
|
|
|
|
void resetLayout(); //流动段增减后重置
|
|
|
|
|
// 根据名字获取
|
|
|
|
|
iGridRowItem* getItemByPara(QString sPara);
|
|
|
|
|
// 根据名字取数据
|
|
|
|
|
QVariant getItemValueByPara(QString sPara);
|
|
|
|
|
|
|
|
|
|
// 查询并处理 UseMdoe == 3 的参数,初始不显示
|
|
|
|
|
void dealwithHide(bool bHideMode, bool& bItemChanged);
|
|
|
|
|
|
|
|
|
|
// 查询并处理 多相/单相切换 的参数,初始不显示
|
|
|
|
|
void deawithMpMode(bool bMultiPhase, bool& bItemChanged);
|
|
|
|
|
|
|
|
|
|
void dealwithItemOfs(ParaUseMode o, bool bHideMode, bool& bItemChanged);
|
|
|
|
|
|
|
|
|
|
// 清空
|
|
|
|
|
void clearAllItems();
|
|
|
|
|
|
|
|
|
|
// Header
|
|
|
|
|
void setHeaderVisible(bool b);
|
|
|
|
|
bool isHeaderVisible();
|
|
|
|
|
|
|
|
|
|
// 对Items进行检测,正确输入
|
|
|
|
|
bool checkItems();
|
|
|
|
|
|
|
|
|
|
// 刷新
|
|
|
|
|
void updateItem(iGridRowItem* p);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// 搭建过程
|
|
|
|
|
QStringList getParaTypes(QStringList listParas);
|
|
|
|
|
bool createAndAddItem(iGridRowItem* pParent, \
|
|
|
|
|
iParameter* p, QString sPara);
|
|
|
|
|
iGridRowItem* createWithSegOlds(iGridRowItem* pParent, \
|
|
|
|
|
iParameter* p, QString sPara);//兼容原先,没有配置ParaType
|
|
|
|
|
void insertItem(int nIndex, iGridRowItem* pItem);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 这是一些特殊处理,就是创建完成所有Item后,相关的关联
|
|
|
|
|
// 如 产液段与有效长度
|
|
|
|
|
void bindItems();
|
|
|
|
|
|
|
|
|
|
// 把所有Item从上到下(不考虑层级记录下来)
|
|
|
|
|
bool getAllItems(QVector<iGridRowItem*>& vec); //不考虑层级
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 范围及布局
|
|
|
|
|
void setSplitPos(float f);
|
|
|
|
|
void updateLayout();
|
|
|
|
|
void doLayout();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void mousePressEvent(QMouseEvent *);
|
|
|
|
|
virtual void mouseDoubleClickEvent(QMouseEvent* e);
|
|
|
|
|
virtual void mouseReleaseEvent(QMouseEvent *);
|
|
|
|
|
virtual void mouseMoveEvent(QMouseEvent *);
|
|
|
|
|
|
|
|
|
|
virtual void resizeEvent(QResizeEvent *);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void paintEvent(QPaintEvent *);
|
|
|
|
|
|
|
|
|
|
void paintGrid(QPainter* pPainter);
|
|
|
|
|
void paintHeader(QPainter* pPainter);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
|
|
void slotActivateItem(iGridRowItem* p);
|
|
|
|
|
void onActiveItemChanged(iGridRowItem* p);
|
|
|
|
|
void slotValuePrevChanged(QVariant& o1, QVariant& o2);
|
|
|
|
|
|
|
|
|
|
void slotGetValueOf(QString sPara, QVariant& o, bool& bOk);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
void sigHelpMsg(QString& s);
|
|
|
|
|
// TODO not use
|
|
|
|
|
// void sigAppendOtherItems(QVector<iGridRowItem *>& vec);
|
|
|
|
|
/// @brief 触发参数改变,允许外界进行更改
|
|
|
|
|
/// @param sName: 参数名称
|
|
|
|
|
/// @param o1: 主要数据,m_oRawValue
|
|
|
|
|
/// @param o2: 辅助数据,如Cbx的下拉填充内容QStringList
|
|
|
|
|
/// @param bSet:是否已经正确设置
|
|
|
|
|
void sigItemPrevChanged(QString sName, \
|
|
|
|
|
QVariant& o1, QVariant& o2, \
|
|
|
|
|
bool& bSet);
|
|
|
|
|
|
|
|
|
|
// 是否启用正则验证,比如,直角边界,第一个边界要大于井长/2,只有点源才支持
|
|
|
|
|
void sigOuterValidate(QString sPara, QVariant o, bool& bValid, bool& bSet);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// @brief 触发子参数列表改变,比如调用水平井段数编辑功能,目前只限于 iGridRowItemSegEx 类型的信号传递
|
|
|
|
|
/// @param sSegName: (in) 基准参数,为英文标识,如流动段数:"Nq"
|
|
|
|
|
/// @param vvec: (in & out) 子参数数据,注意:key为英文,如"NqX","NqL","NqQ"之类,与xml配置文件严格对应
|
|
|
|
|
/// @param dWellLen: (in) 水平井长度
|
|
|
|
|
/// @param bModified: (out) 是否正确触发且vvec发生改变
|
|
|
|
|
void sigSegMore(const QString sSegName, \
|
|
|
|
|
QVector< QMap<QString, double> >& vvec, \
|
|
|
|
|
const double dWellLen, \
|
|
|
|
|
bool& bModified);
|
|
|
|
|
|
|
|
|
|
/// @brief 触发边界信息改变,比如修改平行边界,由上下改为左右
|
|
|
|
|
/// @param pItem: (in) 当前的GroupItem,其实即是本类iGridRowGroupBdy
|
|
|
|
|
/// @param vvec: (in & out) 边界信息数据
|
|
|
|
|
/// @param bModified: (out) 是否正确触发且vvec发生改变
|
|
|
|
|
void sigBdyDetails(iGridRowItem* pItem, \
|
|
|
|
|
QVector< iBdyInfo* >& vvec, \
|
|
|
|
|
bool& bModified);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// 节点操作及属性更改
|
|
|
|
|
GridTickPos hitTest(QPoint pt);
|
|
|
|
|
|
|
|
|
|
void expand(iGridRowItem* p);
|
|
|
|
|
void collapse(iGridRowItem* p);
|
|
|
|
|
|
|
|
|
|
iGridRowItem* getLastActive();
|
|
|
|
|
|
|
|
|
|
// 位置记录
|
|
|
|
|
int getPreferedSplitX();
|
|
|
|
|
void saveSplitX();
|
|
|
|
|
void loadSplitX();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 组织数据
|
|
|
|
|
// 序列化
|
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
|
|
|
|
|
// 组织结果数据,注:vec不进行clear,由调用方自行clear
|
|
|
|
|
virtual bool organizeResults(QVector<iResultInfo>& vec, QString sType);
|
|
|
|
|
|
|
|
|
|
// 从各个Wx(m_vecWxDatas)中遍历查找
|
|
|
|
|
virtual bool setParaValue(QString sPara, QVariant o);
|
|
|
|
|
virtual bool getParaValue(QString sPara, QVariant& o);
|
|
|
|
|
// 返回所有参数,Key为英文ID
|
|
|
|
|
virtual bool getAllParaValues(QMap<QString, QVariant>& map,
|
|
|
|
|
bool bOnlyFitted = false,
|
|
|
|
|
bool bClearMap = true);
|
|
|
|
|
|
|
|
|
|
virtual bool getAllParaUnits(QMap<QString, QString>& map,
|
|
|
|
|
bool bOnlyFitted = false,
|
|
|
|
|
bool bClearMap = true);
|
|
|
|
|
|
|
|
|
|
// 返回所有的跟模型相关的边界参数的类型,封闭或定压
|
|
|
|
|
// 封闭:0
|
|
|
|
|
// 定压:1
|
|
|
|
|
bool getBdyInfos(QMap<QString, int>& map);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// 窗体载体
|
|
|
|
|
QWidget* m_pWxDlg;
|
|
|
|
|
|
|
|
|
|
// 子项
|
|
|
|
|
QVector<iGridRowItem*> m_vecGridItems;
|
|
|
|
|
QVector<iGridRowItem *> m_vecAllItems;// 从上到下不考虑层级,所有
|
|
|
|
|
iGridRowItem* m_pItemSel;
|
|
|
|
|
|
|
|
|
|
// 位置及布局
|
|
|
|
|
QRectF m_rtBounds;
|
|
|
|
|
bool m_bNeedLayout;
|
|
|
|
|
|
|
|
|
|
// 分割线
|
|
|
|
|
bool m_bHitSplit;
|
|
|
|
|
float m_fSplitPos;
|
|
|
|
|
|
|
|
|
|
// Header
|
|
|
|
|
bool m_bHeaderVisible;
|
|
|
|
|
|
|
|
|
|
float m_fRowHeight;
|
|
|
|
|
|
|
|
|
|
bool m_bUnableSP;
|
|
|
|
|
};
|