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/Src/nmNum/nmPlot/nmObjPointWell.cpp

780 lines
24 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.

#include <QPainter>
//#include <QDialog.h>
#include <ZxSerializer.h>
#include "IxPtyPano.h"
#include "ZxSubAxisX.h"
#include "ZxSubAxisY.h"
#include "zxLogInstance.h"
#include "ZxPlot.h"
#include "ZxObjText.h"
#include "nmObjPointWellTool.h"
#include "nmObjPointWell.h"
#include "nmDataLogFile.h"
#include "iWxWellNew.h"
#include "ZxBaseUtil.h"
#include "ZxDataProject.h"
#include "TreeWxMain.h"
#include "Defines.h"
#include "zxSysUtils.h"
#include "iDataTypes.h"
#include "nmSingalCenter.h"
#include "nmDataAnalyzeManager.h"
#include "ZxDataGaugeP.h"
#include "ZxDataGaugeF.h"
#include "nmPlotDialogContext.h"
#include "nmPlotDialogContextProvider.h"
#include "nmDataVerticalFracturedWell.h"
#include "nmDataHorizontalFracturedWell.h"
#include "nmDataVerticalWell.h"
#include "nmDataWellBase.h"
ZX_DEFINE_DYNAMIC(nObjPointWell, nmObjPointWell)
nmObjPointWell::nmObjPointWell()
: nmObjPoint()
, m_pNameLabel(nullptr)
, m_bSelectWell(false)
, m_pWellData(nullptr)
, m_pNmWellData(nullptr)
, m_enumWellType(NM_WELL_MODEL::Vertical_Well)
{
nmObjPointWell::init("", NULL, NULL);
}
nmObjPointWell::nmObjPointWell(const QString& sName, \
ZxSubAxisX* pAxisX, \
ZxSubAxisY* pAxisY)
: nmObjPoint(sName, pAxisX, pAxisY)
, m_pNameLabel(nullptr)
, m_bSelectWell(false)
, m_pWellData(nullptr)
, m_pNmWellData(nullptr)
, m_enumWellType(NM_WELL_MODEL::Vertical_Well)
{
nmObjPointWell::init(sName, pAxisX, pAxisY);
}
nmObjPointWell::~nmObjPointWell()
{
// 井数据由DataManager统一释放图元只保存引用。
m_pNmWellData = nullptr;
}
void nmObjPointWell::init(const QString& sName, \
ZxSubAxisX* pAxisX, \
ZxSubAxisY* pAxisY)
{
m_sObjTag = "nObjPointWell";
nmObjBase::init(sName, pAxisX, pAxisY);
nmObjPointWell::initFlags();
m_oDot = ZxDot(DTS_DownTriangle, QColor(255, 0, 0, 125), 1.f, true);
m_sDesc = "";
m_bShowSubObjs = true;
m_oDot = ZxDot(DTS_Circle, QColor(0, 255, 0), 1.5f, true);
m_clrFillUnvalid = QColor(0, 255, 255);
m_clrOuter = QColor(255, 0, 0);
m_vecPoints << QPointF(0.f, 0.f);
loadTempl();
m_pNmWellData = nullptr;
// 连接图元可见性信号和槽
connect(this, SIGNAL(sigObjVisibleChanged(bool)),
this, SLOT(onObjVisibleChanged(bool)));
}
void nmObjPointWell::initTools()
{
m_pTool = new nmObjPointWellTool();
nmObjBase::initTools();
}
bool nmObjPointWell::runMove(const QPointF &pt1, const QPointF &pt2)
{
nmObjPoint::runMove(pt1, pt2);
// 更新井的位置信息
if(m_pWellData) {
QPointF newLocation = this->getValueOf(pt2);
m_pWellData->setLocationX(newLocation.x());
m_pWellData->setLocationY(newLocation.y());
// 更新井基础信息
nmDataAttribute tempAttr = m_pNmWellData->getX();
tempAttr.setValue(m_pWellData->getLocationX());
m_pNmWellData->setX(tempAttr);
tempAttr = m_pNmWellData->getY();
tempAttr.setValue(m_pWellData->getLocationY());
m_pNmWellData->setY(tempAttr);
tempAttr = m_pNmWellData->getRadius();
tempAttr.setValue(m_pWellData->getWellRadius());
m_pNmWellData->setRadius(tempAttr);
// 对于裂缝类型的井,需要更新裂缝位置
if (m_enumWellType == NM_WELL_MODEL::Vertical_Fractured_Well) {
if (nmDataVerticalFracturedWell* pVFWell = dynamic_cast<nmDataVerticalFracturedWell*>(m_pNmWellData)) {
pVFWell->setFracs();
}
} else if (m_enumWellType == NM_WELL_MODEL::Horizontal_Fractured_Well) {
if (nmDataHorizontalFracturedWell* pHFWell = dynamic_cast<nmDataHorizontalFracturedWell*>(m_pNmWellData)) {
pHFWell->setFracs();
}
}
}
nmDataAnalyzeManager::getCurrentInstance()->notifyDataChanged();
return true;
}
void nmObjPointWell::initFlags()
{
// TODO如果是选择的井则位置和大小都不能动设置为true
setLockPos(false);
setLockSize(false);
setReadOnly(false);
}
void nmObjPointWell::initSubObjs()
{
}
void nmObjPointWell::setPointTag(QString s)
{
nmObjPoint::setPointTag(s);
}
void nmObjPointWell::update()
{
nmObjBase::update();
}
void nmObjPointWell::onSerialize(ZxSerializer* ser)
{
nmObjBase::onSerialize(ser);
ser->write("NMWellID", m_sWellID);
}
void nmObjPointWell::onDeserialize(ZxSerializer* ser)
{
nmObjBase::onDeserialize(ser);
ser->read("NMWellID", m_sWellID);
// 根据wellID获取井的信息
m_pWellData = nullptr;
if (zxCurProject != nullptr) {
m_pWellData = (ZxDataWell*)zxCurProject->getChild(iDataModelType::sTypeWell, m_sWellID);
}
if(m_pWellData) {
// 设置图元的位置信息将井的坐标设置为plot对象的坐标
m_vecPoints.clear();
m_vecPoints << QPointF(m_pWellData->getLocationX(), m_pWellData->getLocationY());
return;
}
// TODO如果井数据不存在则其实就是新建井了
}
void nmObjPointWell::onSaveTempl(ZxSerializer* ser)
{
nmObjBase::onSaveTempl(ser);
ser->write("NMWellID", m_sWellID);
}
void nmObjPointWell::onLoadTempl(ZxSerializer* ser)
{
nmObjBase::onLoadTempl(ser);
ser->read("NMWellID", m_sWellID);
// 根据wellID获取井的信息
m_pWellData = nullptr;
if (zxCurProject != nullptr) {
m_pWellData = (ZxDataWell*)zxCurProject->getChild(iDataModelType::sTypeWell, m_sWellID);
}
if(m_pWellData) {
// 设置图元的位置信息将井的坐标设置为plot对象的坐标
m_vecPoints.clear();
m_vecPoints << QPointF(m_pWellData->getLocationX(), m_pWellData->getLocationY());
return;
}
// TODO如果井数据不存在则其实就是新建井了
}
void nmObjPointWell::afterCreated()
{
if(m_pWellData) {
ZxPlot* pPlot = dynamic_cast<ZxPlot*>(this->getParent());
if(NULL != pPlot) {
QString sName = m_pWellData->getName();
ZxObjBase* p = pPlot->addOneObj(POT_Text, sName, false, \
m_pAxisX, m_pAxisY);
appendSubObjs(p);
m_pNameLabel = dynamic_cast<ZxObjText*>(p);
Q_ASSERT(NULL != m_pNameLabel);
if (m_pNameLabel != NULL) {
m_pNameLabel->setFrameVisible(false);
QColor clr = QColor(255, 255, 255, 64);
m_pNameLabel->setBackgroundColor(clr);
m_pNameLabel->setReadOnly(true);
int n = Qt::AlignHCenter | Qt::AlignVCenter;
m_pNameLabel->setAlignFlag(n);
m_pNameLabel->setFont(QFont("Times", 8));
m_pNameLabel->deselect(true);
m_pNameLabel->deselectOthers();
// 设置字体颜色为黑色
QColor textColor = QColor(0, 0, 0); // 黑色
m_pNameLabel->setTextColor(textColor);
m_pNameLabel->setText(sName);
}
}
}
// 如果是选择的井则不弹出创建的dialog
if(m_bSelectWell) {
// 判断是哪一种井类型,初始化对应的参数
ZxDataWell* pWellData = m_pWellData;
if (pWellData == nullptr) {
return;
}
QString wellClass = m_pWellData->getWellClassEn();
// 获取当前井的压力、流量数据
ZxDataObjectList m_listGaugeP = pWellData->getChildren(iDataModelType::sTypeDataGaugeP);
ZxDataObjectList m_listGaugeF = pWellData->getChildren(iDataModelType::sTypeDataGaugeF);
ZxDataGaugeP* pGaugeP = nullptr;
ZxDataGaugeF* pGaugeF = nullptr;
// 遍历压力数据列表
for(int i = 0; i < m_listGaugeP.size(); ++i) {
if(pGaugeP = dynamic_cast<ZxDataGaugeP * >(m_listGaugeP[i])) { // 拿到第一条压力数据
break;
}
}
// 遍历流量数据列表
for(int i = 0; i < m_listGaugeF.size(); ++i) {
if(pGaugeF = dynamic_cast<ZxDataGaugeF * >(m_listGaugeF[i])) { // 拿到第一条流量数据
break;
}
}
// 获取的压力、流量数据
QVector<QPointF> vecPtsP, vecPtsF;
vecPtsP.clear();
vecPtsF.clear();
// 临时存储xy坐标
VecDouble vecX, vecY;
if(pGaugeP != nullptr) {
// 获取压力数据
if(pGaugeP->getDataVecXY(vecX, vecY)) {
for(int i = 0; i < vecX.size(); ++i) {
if(i < vecY.size()) {
QPointF pt(vecX[i], vecY[i]);
vecPtsP.append(pt);
}
}
}
}
if(pGaugeF != nullptr) {
vecX.clear();
vecY.clear();
// 获取流量数据
if(pGaugeF->getDataVecXY(vecX, vecY)) {
for(int i = 0; i < vecX.size(); ++i) {
if(i < vecY.size()) {
QPointF pt(vecX[i], vecY[i]);
vecPtsF.append(pt);
}
}
}
}
int nIndexF = -2; //当前井的流动段索引
// 判断是否为当前井
if(m_pWellData != zxCurWell) {
// 更新当前井的流动段的索引,默认为最后一段
nIndexF = vecPtsF.count() - 1;
}
if(ZxBaseUtil::isSameStr(wellClass, "VerticalWell")) {
// 切换当前井类型
m_enumWellType = NM_WELL_MODEL::Vertical_Well;
} else if(ZxBaseUtil::isSameStr(wellClass, "VerticalFracturedWell")) {
// 切换当前井类型
m_enumWellType = NM_WELL_MODEL::Vertical_Fractured_Well;
} else if(ZxBaseUtil::isSameStr(wellClass, "HorizontalFracturedWell")) {
// 切换当前井类型
m_enumWellType = NM_WELL_MODEL::Horizontal_Fractured_Well;
} else {
return;
}
// 初始化默认参数
m_pNmWellData = nmDataAnalyzeManager::getCurrentInstance()->createWell(m_enumWellType);
if (m_pNmWellData == nullptr) {
return;
}
m_pNmWellData->setWellName(m_pWellData->getName());
nmDataAttribute tempAttr = m_pNmWellData->getX();
tempAttr.setValue(m_pWellData->getLocationX());
m_pNmWellData->setX(tempAttr);
tempAttr = m_pNmWellData->getY();
tempAttr.setValue(m_pWellData->getLocationY());
m_pNmWellData->setY(tempAttr);
tempAttr = m_pNmWellData->getRadius();
tempAttr.setValue(m_pWellData->getWellRadius());
m_pNmWellData->setRadius(tempAttr);
// 设置井的压力数据、流量数据
m_pNmWellData->setPressurePoints(vecPtsP);
m_pNmWellData->setFlowPoints(vecPtsF);
// 设置井的流动段,默认为最后一段
if(nIndexF >= -1) {
m_pNmWellData->setIndexF(nIndexF);
}
// 对于裂缝类型的井,需要更新裂缝位置
if (m_enumWellType == NM_WELL_MODEL::Vertical_Fractured_Well) {
if (nmDataVerticalFracturedWell* pVFWell = dynamic_cast<nmDataVerticalFracturedWell*>(m_pNmWellData)) {
pVFWell->setFracs();
}
} else if (m_enumWellType == NM_WELL_MODEL::Horizontal_Fractured_Well) {
if (nmDataHorizontalFracturedWell* pHFWell = dynamic_cast<nmDataHorizontalFracturedWell*>(m_pNmWellData)) {
pHFWell->setFracs();
}
}
// TODO: 计算井的历史双对数/半对数数据
QVector<QVector<double>> vvecHistoryPressureData;
QVector<QVector<double>> vvecHistoryLogData;
QVector<QVector<double>> vvecHistorySemiLogData;
nmDataAnalyzeManager::getCurrentInstance()->calculationLogData(m_pNmWellData, vvecHistoryPressureData, vvecHistoryLogData, vvecHistorySemiLogData);
// 存储历史数据到井对象
m_pNmWellData->setHistoryPressure(vvecHistoryPressureData);
m_pNmWellData->setHistoryLogLog(vvecHistoryLogData);
m_pNmWellData->setHistorySemiLog(vvecHistorySemiLogData);
return;
}
if(m_pWellData == nullptr) {
this->createWell();
}
}
void nmObjPointWell::setWellData(ZxDataWell *wellObj)
{
if(wellObj) {
m_bSelectWell = true;
m_pWellData = wellObj;
m_sWellID = m_pWellData->getCode();
}
}
void nmObjPointWell::createWell()
{
if (m_vecPoints.isEmpty() || zxCurProject == nullptr) {
return;
}
// 弹出井属性的设置dialog
iWxWellNew* pWellDialog = new iWxWellNew();
ZxDataWell* pWellData = new ZxDataWell();
// 设置图元的坐标
pWellData->setLocationX(m_vecPoints[0].x());
pWellData->setLocationY(m_vecPoints[0].y());
// 生成code
QString sCode = pWellData->getDefaultCode(zxCurProject);
pWellData->setCode(sCode);
// 添加到整体结构树上
zxCurProject->appendChild(pWellData);
Q_ASSERT(NULL != pWellDialog);
// dialog框展示井数据并支持编辑
pWellDialog->setDataWell(dynamic_cast<ZxDataWell*>(pWellData));
pWellDialog->setActionMode(DAM_Edit);
// 初始化UI
pWellDialog->initUI();
// 图元保存井数据
m_sWellID = pWellData->getCode();
m_pWellData = pWellData;
// 模态展示
if(pWellDialog->exec() == QDialog::Rejected) {
// TODO如果是 选择的井,则直接删除画布上的图元
// TODO如果是 新建的井,删除图元 + 井数据!
nmSingalCenter::getInstance()->emitSigDeleteWell(sCode);
} else {
// 将数据做转换,然后移动到指定的位置
QVector<QPointF> vecPoss;
vecPoss << QPointF(m_pWellData->getLocationX(), m_pWellData->getLocationY());
nmDataLogFile::getInstance()->writeLog(" =========== " + QString::number(vecPoss[0].x()) + " " + QString::number(
vecPoss[0].y()));
// 将数据做转换,然后移动到指定的位置
this->setAllPos(vecPoss);
moveToPos(this->getPosOf(this->getAllPos()));
m_bSelectWell = true;
this->afterCreated();
}
delete pWellDialog;
}
void nmObjPointWell::editWell()
{
// 如果没有层数据,提示用户定义分层信息
if(nmDataAnalyzeManager::getCurrentInstance()->getLayers().isEmpty()) {
QMessageBox::information(nullptr, tr("error"), tr("please setting layers Data!"));
return;
}
nmPlotDialogContextProvider* pDialogProvider = nmPlotDialogContext::provider();
if(pDialogProvider == nullptr) {
return;
}
nmDataWellBase* pReturnWellData = nullptr;
if(pDialogProvider->editWell(nullptr, m_pWellData, m_pNmWellData, pReturnWellData)) {
// 获取修改后的井数据
if (pReturnWellData == nullptr || m_pWellData == nullptr || m_pNmWellData == nullptr) {
return;
}
// 更新ZxDataWell的数据
m_pWellData->setName(pReturnWellData->getWellName());
m_pWellData->setLocationX(pReturnWellData->getX().getValue().toDouble());
m_pWellData->setLocationY(pReturnWellData->getY().getValue().toDouble());
m_pWellData->setWellRadius(pReturnWellData->getRadius().getValue().toDouble());
NM_WELL_MODEL eWellType = pReturnWellData->getWellType();
// 修改了井类型,就重新设置
if (eWellType != m_enumWellType)
{
m_enumWellType = eWellType;
QString sWellClass;
if (m_enumWellType == NM_WELL_MODEL::Vertical_Well)
{
sWellClass = "VerticalWell";
} else if(m_enumWellType == NM_WELL_MODEL::Vertical_Fractured_Well) {
sWellClass = "VerticalFracturedWell";
} else if(m_enumWellType == NM_WELL_MODEL::Horizontal_Fractured_Well) {
sWellClass = "HorizontalFracturedWell";
}
m_pWellData->setWellClassCn(sWellClass);
}
if (m_pNameLabel != nullptr) {
m_pNameLabel->setText(pReturnWellData->getWellName());
}
// 根据新坐标进行移动
QVector<QPointF> vecPoss;
vecPoss << QPointF(m_pWellData->getLocationX(), m_pWellData->getLocationY());
// 将数据做转换,然后移动到指定的位置
this->setAllPos(vecPoss);
moveToPos(this->getPosOf(this->getAllPos()));
// 判断是不是当前查看的井
nmDataWellBase* pCurWellData = nmDataAnalyzeManager::getCurrentInstance()->getCurWellData();
if (pCurWellData != nullptr && pCurWellData->getWellName() == m_pNmWellData->getWellName())
{
// 设置到当前井
nmDataAnalyzeManager::getCurrentInstance()->setCurWellData(pReturnWellData);
}
// 更新当前井数据,并添加到数据中心
nmDataAnalyzeManager::getCurrentInstance()->removeWell(m_pNmWellData);
if (m_pNmWellData != nullptr)
{
m_pNmWellData = nullptr;
}
m_pNmWellData = pReturnWellData;
nmDataAnalyzeManager::getCurrentInstance()->appendNmWellData(m_pNmWellData);
}
nmDataAnalyzeManager::getCurrentInstance()->notifyDataChanged();
this->update();
}
QVector<double> nmObjPointWell::getWellInformation()
{
QVector<double> wellInformation;
if(m_pWellData) {
wellInformation.append(m_pWellData->getLocationX());
wellInformation.append(m_pWellData->getLocationY());
wellInformation.append(m_pWellData->getWellRadius());
}
return wellInformation;
}
ZxDataWell* nmObjPointWell::getWellData() const
{
return m_pWellData;
}
const QString& nmObjPointWell::getWellID() const
{
return m_sWellID;
}
void nmObjPointWell::paintBack(QPainter* painter, const ZxPaintParam& param)
{
if (m_pWellData == nullptr) {
return;
}
QString wellClass = m_pWellData->getWellClassEn();
if(ZxBaseUtil::isSameStr(wellClass, "VerticalFracturedWell") && m_pNmWellData != nullptr) { // 编辑完井之后
Q_ASSERT(NULL != m_pAxisX);
Q_ASSERT(NULL != m_pAxisY);
if(m_pAxisX->getRangeMin() == m_pAxisX->getRangeMax() || \
m_pAxisY->getRangeMin() == m_pAxisY->getRangeMax()) {
return;
}
painter->save();
double locX = m_pNmWellData->getX().getValue().toDouble();
double locY = m_pNmWellData->getY().getValue().toDouble();
double rad = m_pNmWellData->getRadius().getValue().toDouble();
m_vecPoints[0].setX(locX);
m_vecPoints[0].setY(locY);
m_pWellData->setLocationX(locX);
m_pWellData->setLocationY(locY);
m_pWellData->setWellRadius(rad);
double x = m_pWellData->getLocationX();
double y = m_pWellData->getLocationY();
QPointF point(x, y);
QPointF ptPos = getPosOf(point);
moveToPos(this->getPosOf(m_vecPoints));
nmDataVerticalFracturedWell* pVFWell = dynamic_cast<nmDataVerticalFracturedWell*>(m_pNmWellData);
if (pVFWell == nullptr) {
painter->restore();
return;
}
// 绘制填充
double r = m_oDot.radius();
QColor clrInner = m_oDot.color();
ZxDrawHelper::drawPoint(painter, ptPos, (int)m_oDot.style(),
r, m_oDot.isFilling(), clrInner);
//if (bCenter)
{
ZxDrawHelper::drawPoint(painter,
ptPos,
(int)m_oDot.style(),
m_oDot.radius() * 0.5f,
m_oDot.isFilling(),
QColor(255, 0, 0));
}
painter->setPen(m_clrOuter);
painter->drawEllipse(ptPos, r, r);
// 设置裂缝的画笔
QPen fracturePen(QColor(255, 0, 0));
fracturePen.setWidth(0.3f);
painter->setPen(fracturePen);
// 绘制裂缝
QVector<QPointF> vecFracs = pVFWell->getFracs();
if (vecFracs.size() == 2) {
QPointF startPos = getPosOf(vecFracs[0]);
QPointF endPos_frac = getPosOf(vecFracs[1]);
painter->drawLine(startPos, endPos_frac);
}
painter->restore();
} else if(ZxBaseUtil::isSameStr(wellClass, "HorizontalFracturedWell") && m_pNmWellData != nullptr) {
Q_ASSERT(NULL != m_pAxisX);
Q_ASSERT(NULL != m_pAxisY);
if(m_pAxisX->getRangeMin() == m_pAxisX->getRangeMax() || \
m_pAxisY->getRangeMin() == m_pAxisY->getRangeMax()) {
return;
}
painter->save();
double locX = m_pNmWellData->getX().getValue().toDouble();
double locY = m_pNmWellData->getY().getValue().toDouble();
double rad = m_pNmWellData->getRadius().getValue().toDouble();
m_vecPoints[0].setX(locX);
m_vecPoints[0].setY(locY);
m_pWellData->setLocationX(locX);
m_pWellData->setLocationY(locY);
m_pWellData->setWellRadius(rad);
double x = m_pWellData->getLocationX();
double y = m_pWellData->getLocationY();
QPointF point(x, y);
QPointF ptPos = getPosOf(point);
moveToPos(this->getPosOf(m_vecPoints));
nmDataHorizontalFracturedWell* pHFWell = dynamic_cast<nmDataHorizontalFracturedWell*>(m_pNmWellData);
if (pHFWell == nullptr) {
painter->restore();
return;
}
// 获取井长
double wellLength = pHFWell->getWellLength().getValue().toDouble();
// 获取井的角度
double drainAngle = pHFWell->getDrainAngle().getValue().toDouble();
// 将角度从度转换为弧度
double angleRad = drainAngle * M_PI / 180.0; // M_PI 是 π 的值,表示 180 度
// 获取裂缝角度(单位:度)
//double fractureAngle = m_HFracturedWell->getFractureAngle().getValue().toDouble();
//double fractureAngleRad = fractureAngle * M_PI / 180.0; // 转换为弧度
// 计算井的终点坐标
double endX = x + wellLength * cos(angleRad);
double endY = y + wellLength * sin(angleRad);
QPointF endPoint(endX, endY);
QPointF endPos = getPosOf(endPoint);
// 绘制填充
double r = m_oDot.radius();
QColor clrInner = m_oDot.color();
ZxDrawHelper::drawPoint(painter, ptPos, (int)m_oDot.style(),
r, m_oDot.isFilling(), clrInner);
//if (bCenter)
{
ZxDrawHelper::drawPoint(painter,
ptPos,
(int)m_oDot.style(),
m_oDot.radius() * 0.5f,
m_oDot.isFilling(),
QColor(255, 0, 0));
}
painter->setPen(m_clrOuter);
painter->drawEllipse(ptPos, r, r);
QPen linePen(QColor(0, 255, 255));
linePen.setWidth(0.8f);
painter->setPen(linePen);
// 井筒
painter->drawLine(ptPos, endPos);
// 获取预先计算好的裂缝坐标
QVector<QPair<QPointF, QPointF>>& vecFracs = pHFWell->getFracs();
// 设置裂缝的画笔
QPen fracturePen(QColor(255, 0, 0));
fracturePen.setWidth(0.3f);
painter->setPen(fracturePen);
// 遍历并绘制所有裂缝
foreach (const auto& frac , vecFracs) {
// 将世界坐标转换为绘图坐标
QPointF startPos = getPosOf(frac.first);
QPointF endPos_frac = getPosOf(frac.second);
// 绘制裂缝线段
painter->drawLine(startPos, endPos_frac);
}
painter->restore();
} else { //其他
if(m_pNmWellData != nullptr) {
double locX = m_pNmWellData->getX().getValue().toDouble();
double locY = m_pNmWellData->getY().getValue().toDouble();
double rad = m_pNmWellData->getRadius().getValue().toDouble();
m_vecPoints[0].setX(locX);
m_vecPoints[0].setY(locY);
m_pWellData->setLocationX(locX);
m_pWellData->setLocationY(locY);
m_pWellData->setWellRadius(rad);
moveToPos(this->getPosOf(m_vecPoints));
}
nmObjPoint::paintBack(painter, param);
}
}
void nmObjPointWell::removeData()
{
nmDataAnalyzeManager::getCurrentInstance()->removeWell(m_pNmWellData);
m_pNmWellData = nullptr;
}
void nmObjPointWell::setNmWellData(nmDataWellBase* wellData)
{
// 如果是外界设置了当前图元绑定的井数据则不需要再次在afterCreated()函数中再次设置数据
m_bSelectWell = false;
QString wellClass = m_pWellData->getWellClassEn();
m_pNmWellData = wellData;
if(ZxBaseUtil::isSameStr(wellClass, "VerticalWell")) {
m_enumWellType = NM_WELL_MODEL::Vertical_Well;
} else if(ZxBaseUtil::isSameStr(wellClass, "VerticalFracturedWell")) {
m_enumWellType = NM_WELL_MODEL::Vertical_Fractured_Well;
} else if(ZxBaseUtil::isSameStr(wellClass, "HorizontalFracturedWell")) {
m_enumWellType = NM_WELL_MODEL::Horizontal_Fractured_Well;
}
}
nmDataWellBase* nmObjPointWell::getNmWellData()
{
return m_pNmWellData;
}
void nmObjPointWell::onObjVisibleChanged(bool bIsVisible)
{
m_pNmWellData->setPlotVisible(bIsVisible);
}