9510 lines
314 KiB
C++
9510 lines
314 KiB
C++
#include "qmycustomplot.h"
|
||
#include "CallManage.h"
|
||
#include "geometryutils.h"
|
||
#include "TransparentDraggableRect.h"
|
||
#include "TransparentGroupResult.h"
|
||
#include "TransparentDraggableResult.h"
|
||
#include "TransparentDraggableGeoLith.h"
|
||
#include "TransparentDraggableSwallCore.h"
|
||
#include "TransparentDraggableGujing.h"
|
||
#include "transparentdraggableimage.h"
|
||
#include "TransparentDraggableJiegutext.h"
|
||
#include "TransparentDraggableMFac.h"
|
||
#include "TransparentDraggablePhase.h"
|
||
#include "TransparentDraggableFac.h"
|
||
#include "transparentdraggableGuan.h"
|
||
#include "TransparentDraggableLine.h"
|
||
#include "transparentdraggableSelectRect.h"
|
||
#include "transparentdraggableLayer.h"
|
||
#include "transparentdraggableRightList.h"
|
||
#include "TransparentDraggableCorePhysics.h"
|
||
#include "qtcommonclass.h"
|
||
#include "slf.h"
|
||
#include "MemRdWt.h"
|
||
#include "PropertyWidget.h"
|
||
#include "YxzpDialog.h"
|
||
#include "fracsel.h"
|
||
|
||
//是否隐藏刻度
|
||
extern int g_iShow;
|
||
extern double g_dPixelPerCm;//每厘米像素数
|
||
//沉积相
|
||
extern double g_SDepthFac;
|
||
extern double g_EDepthFac;
|
||
extern QString g_SelectMFac;
|
||
|
||
QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) :
|
||
QCustomPlot(parent)
|
||
{
|
||
m_strSlfName = strSlfName;
|
||
m_strWellName = strWellName;
|
||
m_strTrackName = strTrackName;
|
||
m_strLineName = strLineName;
|
||
|
||
mSizeHandleManager = new QCPSizeHandleManager(this);
|
||
|
||
setObjectName("QMyCustomPlot");
|
||
//this->setOpenGl(true);//不开启,电脑不支持会卡
|
||
// this->setNotAntialiasedElements(QCP::aeAll); // 关闭所有抗锯齿
|
||
m_newColor = Qt::black;
|
||
// 开启抗锯齿
|
||
this->setAntialiasedElement(QCP::aeAll);
|
||
|
||
//背景设置成透明色
|
||
this->setBackground(Qt::transparent);
|
||
this->setStyleSheet("background: transparent;");
|
||
|
||
//jyl
|
||
if(g_iShow==1)
|
||
{
|
||
yAxis->setTickLabels(true);
|
||
}
|
||
else
|
||
{
|
||
//隐藏刻度
|
||
yAxis->setTickLabels(false);
|
||
}
|
||
//
|
||
xAxis->setTickLabels(false);
|
||
xAxis2->setTickLabels(false);
|
||
yAxis2->setTickLabels(false);
|
||
|
||
//套管组件
|
||
zoneOrder_Tubing.clear();
|
||
if(zoneOrder_Tubing.size()==0)
|
||
{
|
||
zoneOrder_Tubing=GetZoneOrder(QString("TubTools.ini"));
|
||
}
|
||
|
||
connect(this->selectionRect(), &QCPSelectionRect::accepted, this, &QMyCustomPlot::slotSelectionRectAccepted);
|
||
// make bottom and left axes transfer their ranges to top and right axes:
|
||
connect(xAxis, SIGNAL(rangeChanged(QCPRange)), xAxis2, SLOT(setRange(QCPRange)));
|
||
connect(yAxis, SIGNAL(rangeChanged(QCPRange)), yAxis2, SLOT(setRange(QCPRange)));
|
||
// 在自定义类中
|
||
connect(this, SIGNAL(afterReplot()), this, SLOT(drawCustomElements()));
|
||
|
||
//关联信号槽
|
||
//左刻度
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLeftScale(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeLeftScale(QString, QString, QString, QString, QString, double)));
|
||
//右刻度
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeRightScale(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeRightScale(QString, QString, QString, QString, QString, double)));
|
||
//刻度类型
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeScaleType(QString, QString, QString, QString, QString, QString)), this, SLOT(s_ChangeScaleType(QString, QString, QString, QString, QString, QString)));
|
||
|
||
//曲线选中,置顶
|
||
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString)));
|
||
//颜色
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineColor(QString, QString, QString, QString, QString, QColor)), this, SLOT(s_ChangeLineColor(QString, QString, QString, QString, QString, QColor)));
|
||
//线宽
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineWidth(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeLineWidth(QString, QString, QString, QString, QString, double)));
|
||
//线型
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineStyle(QString, QString, QString, QString, QString, Qt::PenStyle)), this, SLOT(s_ChangeLineStyle(QString, QString, QString, QString, QString, Qt::PenStyle)));
|
||
|
||
//绘制方式
|
||
//曲线
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawLine(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawLine(QString, QString, QString, QString, QString, bool)));
|
||
//杆状
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawGan(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawGan(QString, QString, QString, QString, QString, bool)));
|
||
//点状
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawPoint(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawPoint(QString, QString, QString, QString, QString, bool)));
|
||
//绘制对称曲线
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawSymmetry(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawSymmetry(QString, QString, QString, QString, QString, bool)));
|
||
//改变曲线名
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeLineName(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeLineName(QString, QString, QString, QString, QString, QString)));
|
||
//数据点 符号类型
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangePointStyle(QString, QString, QString, QString, QString, QCPScatterStyle::ScatterShape)), this, SLOT(s_ChangePointStyle(QString, QString, QString, QString, QString, QCPScatterStyle::ScatterShape)));
|
||
|
||
//岩性填充-不填充
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString, QString)));
|
||
//岩性填充-填充
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString , QColor, QColor, QString, bool)),
|
||
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool)));
|
||
//添加校深线段
|
||
connect(CallManage::getInstance(), SIGNAL(sig_AddShifLineToPlot(QString, QString, QString, QString, QString, double, double)), this, SLOT(s_AddShifLineToPlot(QString, QString, QString, QString, QString, double, double)));
|
||
//清除当前分段线
|
||
connect(CallManage::getInstance(), SIGNAL(sig_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString)));
|
||
//清除全部分段线
|
||
connect(CallManage::getInstance(), SIGNAL(sig_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString)));
|
||
|
||
//执行校正
|
||
connect(CallManage::getInstance(), SIGNAL(sig_RuncorFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_RuncorFromPlot(QString, QString, QString, QString, QString)));
|
||
//执行拼接
|
||
connect(CallManage::getInstance(), SIGNAL(sig_MergeFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_MergeFromPlot(QString, QString, QString, QString, QString)));
|
||
//执行预览
|
||
connect(CallManage::getInstance(), SIGNAL(sig_PreMergeFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_PreMergeFromPlot(QString, QString, QString, QString, QString)));
|
||
//采用右侧数据,执行预览
|
||
connect(CallManage::getInstance(), SIGNAL(sig_PreMerge_FromRightList(QString, QString, QString, QString, QString, QList<double>, QList<double>)), this, SLOT(s_PreMerge_FromRightList(QString, QString, QString, QString, QString, QList<double>, QList<double>)));
|
||
//关闭预览框
|
||
connect(CallManage::getInstance(), SIGNAL(sig_PreMerge_Close(QString, QString, QString, QString, QString)), this, SLOT(s_PreMerge_Close(QString, QString, QString, QString, QString)));
|
||
|
||
//Plot重新加载数据
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ReloadPlot(QString, QString, QString)), this, SLOT(s_ReloadPlot(QString, QString, QString)));
|
||
// 深度属性修改
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeDepthProperty(QVariantList)), this, SLOT(s_changeDepthProperty(QVariantList)));
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList)));
|
||
//改变固井曲线名
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString)));
|
||
//改变曲线名 //气测/FMT/射孔/文本
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeJiegutextLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeJiegutextLine(QString, QString, QString, QString, QString, QString)));
|
||
//改变曲线Title //气测/FMT/射孔/文本
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeJiegutextTitle(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeJiegutextTitle(QString, QString, QString, QString, QString, QString)));
|
||
//改变录井剖面属性
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeGeoLithLine(QString, QString, QString, QString, QString, double)), this, SLOT(s_changeGeoLithLine(QString, QString, QString, QString, QString, double)));
|
||
//是否显示
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeGeoLithShow(QString, QString, QString, QString, QString, QString, bool)), this, SLOT(s_changeGeoLithShow(QString, QString, QString, QString, QString, QString, bool)));
|
||
//改变沉积相属性,是否显示
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeFacShow(QString, QString, QString, QString, QString, QString, bool)), this, SLOT(s_changeFacShow(QString, QString, QString, QString, QString, QString, bool)));
|
||
//改变套管组件属性,是否显示
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeGuanShow(QString, QString, QString, QString, QString, QString, bool)), this, SLOT(s_changeGuanShow(QString, QString, QString, QString, QString, QString, bool)));
|
||
//改变套管组件属性,直径
|
||
connect(CallManage::getInstance(), SIGNAL(sig_changeGuanD(QString, QString, QString, QString, QString, QString, double)), this, SLOT(s_changeGuanD(QString, QString, QString, QString, QString, QString, double)));
|
||
}
|
||
|
||
void QMyCustomPlot::initGeometry(QString strUuid, int nscale, int nW)
|
||
{
|
||
this->m_strUuid = strUuid;
|
||
|
||
double dHight = (m_iY2 - m_iY1)*100.0 / (double)nscale * g_dPixelPerCm;
|
||
if (g_iShow == 1)
|
||
{
|
||
//显示刻度
|
||
dHight = dHight + 30;
|
||
}
|
||
|
||
qDebug() << "FormDraw dHight=" << QString::number((int)dHight);
|
||
if (dHight > 32767)
|
||
{
|
||
dHight = 32767;
|
||
}
|
||
|
||
//curv->setMaximumHeight((int)dHight);
|
||
//curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184
|
||
this->setGeometry(0, 0, nW, (int)dHight);//7500-3184
|
||
}
|
||
|
||
void QMyCustomPlot::changePropertyWaveUpdate()
|
||
{
|
||
if (m_nDrawType == 0 || m_nDrawType == 1)
|
||
{
|
||
if (this->m_colorMap)
|
||
this->m_colorMap->setVisible(false);
|
||
|
||
clearGraphs();
|
||
clearItems();
|
||
|
||
if (this->m_colorMap && this->m_bX2Y)
|
||
{
|
||
QCPAxis *yAxis = this->yAxis;
|
||
QCPAxis *xAxis = this->xAxis;
|
||
this->xAxis = yAxis;
|
||
this->yAxis = xAxis;
|
||
this->m_bX2Y = false;
|
||
}
|
||
this->initWave2(m_strSlfName, m_strLineName);
|
||
}
|
||
else if (m_nDrawType == 2)
|
||
{
|
||
if (this->m_colorMap)
|
||
this->m_colorMap->setVisible(true);
|
||
clearGraphs();
|
||
clearItems();
|
||
|
||
this->m_bX2Y = true;
|
||
this->initWave(m_strSlfName, m_strLineName);
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName)
|
||
{
|
||
CLogIO *logio = new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead);
|
||
//
|
||
int index = logio->OpenWave(strWaveName.toStdString().c_str());
|
||
if (index < 0) {
|
||
delete logio;
|
||
return;
|
||
}
|
||
|
||
QMyCustomPlot* widget = this;
|
||
Slf_WAVE _wave;
|
||
logio->GetWaveInfo(index, &_wave);
|
||
float _SDep, _EDep, _Rlev;
|
||
_SDep = _wave.StartDepth;
|
||
_EDep = _wave.EndDepth;
|
||
// _SDep = 0.0 - m_iY2;
|
||
// _EDep = 0.0 - m_iY1;
|
||
_Rlev = _wave.DepLevel;
|
||
int m_Record = (float)(fabs((_EDep - _SDep) / _Rlev + 0.5));
|
||
|
||
int _nSamples = _wave.TimeSamples;
|
||
if (m_fScaleV <= 0.0f)
|
||
m_fScaleV = _nSamples;
|
||
char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1];
|
||
logio->ReadWave(index, _SDep, m_Record, (void *)value);
|
||
logio->CloseWave(index);
|
||
delete logio;
|
||
|
||
bool bFistValue = false;
|
||
float vmax = -9999;//(float)_nSamples;
|
||
float vmin = -9999;
|
||
//
|
||
double** wavedata = widget->getWavedata(_nSamples, m_Record);
|
||
//wavedata = new double*[_nSamples];
|
||
//for(int kk = 0;kk<_nSamples;kk++){
|
||
// wavedata[kk] = new double[m_Record];
|
||
//}
|
||
|
||
for (int i = 0; i < m_Record; i++)
|
||
{
|
||
for (int kk = 0; kk < _nSamples; kk++)
|
||
{
|
||
double val = GetData(_wave.RepCode, (char *)&value[(kk)*_wave.CodeLen + i * _nSamples*_wave.CodeLen]);
|
||
wavedata[kk][i] = val;
|
||
if (val == -9999)
|
||
{
|
||
continue;
|
||
}
|
||
if (bFistValue == false)
|
||
{
|
||
//最大值,最小值默认采用第一个有效值
|
||
bFistValue = true;
|
||
vmax = vmin = val;
|
||
}
|
||
//
|
||
if (vmax < val)vmax = val;
|
||
if (vmin > val)vmin = val;
|
||
}
|
||
}
|
||
delete[] value;
|
||
|
||
// m_iY1 = 0.0 -_EDep;
|
||
// m_iY2 = 0.0 -_SDep;
|
||
//------------------------
|
||
widget->m_iY1 = m_iY1;
|
||
widget->m_iY2 = m_iY2;
|
||
//
|
||
widget->xAxis->setRange(vmin, vmax);
|
||
widget->yAxis->setRange(m_iY1, m_iY2);
|
||
widget->axisRect()->setupFullAxesBox();
|
||
//
|
||
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
|
||
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
|
||
|
||
widget->xAxis->setTicks(false);
|
||
widget->yAxis->setTicks(false);
|
||
widget->xAxis2->setTicks(false);
|
||
widget->yAxis2->setTicks(false);
|
||
|
||
//对调XY轴,在最前面设置
|
||
QCPAxis *yAxis = widget->yAxis;
|
||
QCPAxis *xAxis = widget->xAxis;
|
||
widget->xAxis = yAxis;
|
||
widget->yAxis = xAxis;
|
||
|
||
widget->m_fmin = vmin;
|
||
widget->m_fmax = vmax;
|
||
|
||
//-------------------
|
||
// set up the QCPColorMap:
|
||
if (widget->m_colorMap == NULL)
|
||
{
|
||
QCPColorMap *colorMap = new QCPColorMap(widget->xAxis, widget->yAxis);
|
||
widget->m_colorMap = colorMap;
|
||
|
||
int nx = m_Record;
|
||
int ny = _nSamples;
|
||
colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
|
||
//colorMap->data()->setRange(QCPRange(m_iY1, m_iY2), QCPRange(vmin, vmax)); // 并在键(x)和值(y)维上跨越坐标范围-4..4
|
||
colorMap->data()->setRange(QCPRange(0 - _EDep, 0 - _SDep), QCPRange(vmin, vmax));
|
||
// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据:
|
||
this->updateWave();
|
||
|
||
// 添加色标:
|
||
QCPColorScale *colorScale = new QCPColorScale(widget);
|
||
colorMap->setColorScale(colorScale); // 将颜色图与色标关联
|
||
// 重新缩放数据维度(颜色),以使所有数据点都位于颜色渐变显示的范围内:
|
||
colorMap->rescaleDataRange();
|
||
|
||
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
||
}
|
||
else
|
||
{
|
||
this->updateWave();
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
||
{
|
||
QMyCustomPlot* widget = this;
|
||
CLogIO *logio = new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead);
|
||
//
|
||
int index = logio->OpenWave(strWaveName.toStdString().c_str());
|
||
if (index < 0) {
|
||
delete logio;
|
||
return;
|
||
}
|
||
|
||
float vmax = 264;// (float)_nSamples;
|
||
float vmin = 0;
|
||
|
||
//widget->m_iX1 = vmin;
|
||
//widget->m_iX2 = vmax;
|
||
//
|
||
widget->xAxis->setRange(vmin, vmax);
|
||
widget->yAxis->setRange(m_iY1, m_iY2);
|
||
widget->axisRect()->setupFullAxesBox();
|
||
//
|
||
widget->xAxis->setTicks(false);
|
||
widget->yAxis->setTicks(false);
|
||
widget->xAxis2->setTicks(false);
|
||
widget->yAxis2->setTicks(false);
|
||
|
||
//注意,不对调XY轴
|
||
widget->m_bX2Y = false;
|
||
|
||
Slf_WAVE _wave;
|
||
logio->GetWaveInfo(index, &_wave);
|
||
|
||
float m_SDep = _wave.StartDepth;
|
||
float m_EDep = _wave.EndDepth;
|
||
float m_Rlev = _wave.DepLevel;
|
||
int m_Record = (float)(fabs((m_EDep - m_SDep) / m_Rlev + 0.5));
|
||
int _nSamples = _wave.TimeSamples;
|
||
|
||
char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1];
|
||
logio->ReadWave(index, m_SDep, m_Record, (void *)value);
|
||
logio->CloseWave(index);
|
||
delete logio;
|
||
|
||
MyDataTypeEnum vVdl;
|
||
int lpoint = 0;
|
||
int nPoint = _nSamples;
|
||
float detp = -m_iY2;
|
||
float edepc = -m_iY1;
|
||
float m_PlotSdep = -m_iY2;
|
||
float m_MoveDep = 0.0f;
|
||
float DifBase = (m_MaxRange - m_Base) / 1;
|
||
float yscale = m_nWaveHei;
|
||
yscale = yscale / DifBase;
|
||
|
||
int nStep = m_nWaveJg;// mWaveMes.m_WaveSpace;
|
||
if (m_nWaveJg < 10)
|
||
nStep = 10;
|
||
|
||
if (nStep < 1) nStep = 1;
|
||
float m_r = m_Rlev * nStep;
|
||
detp = int((detp - m_PlotSdep) / m_r)*m_r + m_PlotSdep;
|
||
|
||
int nOdd = 0;
|
||
int nidx = 0;
|
||
for (float dep1 = detp - m_r; dep1 < edepc + m_MoveDep + m_r; dep1 += m_r)
|
||
{
|
||
if (dep1 >= m_EDep || dep1 + m_r < m_SDep)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
int iIndex = Slf_Int(dep1 + m_MoveDep, m_SDep, m_Rlev);
|
||
if (iIndex < 0) {
|
||
continue;
|
||
}
|
||
|
||
QVector<float> vals;
|
||
if (iIndex < 0 || iIndex >= m_Record)
|
||
continue;
|
||
|
||
vals.resize(nPoint);
|
||
vVdl.vchar = &((char *)value)[iIndex*_nSamples*_wave.CodeLen];
|
||
|
||
for (int i = 0; i < nPoint; i++)
|
||
{
|
||
float ch = 0.0f;
|
||
if (i + lpoint < 0)
|
||
ch = 0;
|
||
else if (i + lpoint < _nSamples) {
|
||
if (_wave.RepCode == REPR_CHAR) {
|
||
ch = vVdl.vchar[i + lpoint];
|
||
}
|
||
else if (_wave.RepCode == REPR_UCHAR) {
|
||
ch = vVdl.vuchar[i + lpoint];
|
||
}
|
||
else if (_wave.RepCode == REPR_SHORT) {
|
||
ch = vVdl.vshort[i + lpoint];
|
||
if (ch == -32767) ch = 0;
|
||
}
|
||
else if (_wave.RepCode == REPR_USHORT) {
|
||
ch = vVdl.vushort[i + lpoint];
|
||
if ((short)ch == -32767) ch = 0;
|
||
}
|
||
else if (_wave.RepCode == REPR_FLOAT) {
|
||
ch = vVdl.vfloat[i + lpoint];
|
||
}
|
||
else
|
||
ch = GetData(_wave.RepCode, (char *)&vVdl.vchar[(i + lpoint)*_wave.CodeLen]);
|
||
if (ch == -9999.0 || ch == -99999.0 || ch == -999.25)
|
||
ch = 0;
|
||
}
|
||
else ch = 0;
|
||
vals[i] = ch;
|
||
}
|
||
|
||
QVector<double> vx;
|
||
QVector<double> vy;
|
||
double dminy = 0.0;
|
||
for (int i = 0; i < nPoint; i++)
|
||
{
|
||
vx << i;
|
||
|
||
double d = (-dep1 - 1) + vals[i] * yscale;
|
||
vy << d;
|
||
if (d < dminy)
|
||
dminy = d;
|
||
}
|
||
|
||
QCPGraph * graph0 = widget->graph(nidx);
|
||
if (graph0 == NULL)
|
||
{
|
||
graph0 = widget->addGraph();
|
||
graph0->setPen(QPen(m_newColor));
|
||
}
|
||
if (m_nDrawType == 0 && m_bOddEven) // 波形&&奇偶配色
|
||
{
|
||
if (nOdd % 2 == 1)
|
||
graph0->setPen(QPen(QColor(255, 0, 0)));
|
||
}
|
||
graph0->setData(vx, vy);
|
||
|
||
if (m_bDrawDepth)
|
||
{
|
||
QCPItemText* pText = new QCPItemText(this);
|
||
pText->setText(QString::number(dminy*-1, 'f', 2));
|
||
pText->position->setCoords(30, dminy);
|
||
if (m_bOddEven && nOdd % 2 == 1)
|
||
pText->setColor(QColor(255, 0, 0));
|
||
else
|
||
pText->setColor(m_newColor);
|
||
}
|
||
//graph->setBrush(QBrush(QColor(255, 0, 0, 100)));
|
||
nidx++;
|
||
|
||
if (m_bDrawBase || m_nDrawType == 1) // 填充 || 绘制波基线
|
||
{
|
||
QCPGraph * graph1 = widget->graph(nidx);
|
||
if (graph1 == NULL)
|
||
{
|
||
graph1 = widget->addGraph();
|
||
graph1->setPen(QPen(m_newColor));
|
||
}
|
||
if (m_bOddEven && nOdd % 2 == 1)
|
||
graph1->setPen(QPen(QColor(255, 0, 0)));
|
||
double dx1 = vx[0];
|
||
double dx2 = vx[vx.size() - 1];
|
||
vx.clear();
|
||
vx << dx1 << dx2;
|
||
vy.clear();
|
||
vy << dminy << dminy;
|
||
graph1->setData(vx, vy);
|
||
nidx++;
|
||
if (m_nDrawType == 1)
|
||
{
|
||
graph0->setBrush(QBrush(m_newColor));
|
||
graph0->setChannelFillGraph(graph1);
|
||
}
|
||
}
|
||
|
||
nOdd++;
|
||
}
|
||
widget->replot();
|
||
|
||
delete[]value;
|
||
}
|
||
|
||
void QMyCustomPlot::initColorTable()
|
||
{
|
||
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
||
}
|
||
|
||
void QMyCustomPlot::setSchemeIndex(int nidx, int colorNum)
|
||
{
|
||
if (m_colorMap == NULL)
|
||
return;
|
||
|
||
m_nSchemeIndex = nidx;
|
||
m_nColorNum = colorNum;
|
||
|
||
QtColorTableData::getInstance()->SetCurrentSchemeIndex(nidx);
|
||
//ColorTableIndex = ind;
|
||
|
||
QtColorTableData::getInstance()->ChangeColorNum(colorNum);
|
||
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb();
|
||
|
||
int iColorNum = rgbList.size();
|
||
QCPColorGradient gradient;
|
||
for (int i = 0; i < iColorNum; i++)
|
||
{
|
||
QColor acolor = rgbList.at(i);
|
||
double dbTmpIndex = (double)(i) / iColorNum;
|
||
gradient.setColorStopAt(dbTmpIndex, acolor); // x% 位置的颜色
|
||
//mWaveMes.m_ColorMessage.Color[i] = acolor;
|
||
}
|
||
|
||
m_colorMap->setGradient(gradient);
|
||
}
|
||
|
||
double** QMyCustomPlot::getWavedata(int nrow, int ncol)
|
||
{
|
||
if (nrow > 0 && m_wavedata)
|
||
{
|
||
for (int i = 0; i < m_nRow; i++)
|
||
{
|
||
if (m_wavedata[i])
|
||
{
|
||
delete[] m_wavedata[i];
|
||
}
|
||
}
|
||
delete[] m_wavedata;
|
||
m_wavedata = NULL;
|
||
}
|
||
m_nRow = nrow;
|
||
m_nCol = ncol;
|
||
m_wavedata = new double*[nrow];
|
||
for (int kk = 0; kk < nrow; kk++) {
|
||
m_wavedata[kk] = new double[ncol];
|
||
}
|
||
return m_wavedata;
|
||
}
|
||
|
||
QCPColorMap * QMyCustomPlot::updateWave()
|
||
{
|
||
int nx = m_nCol;
|
||
int ny = m_nRow;
|
||
|
||
// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据:
|
||
double x, y, z;
|
||
for (int xIndex = 0; xIndex < nx; ++xIndex)
|
||
{
|
||
for (int yIndex = 0; yIndex < ny; ++yIndex)
|
||
{
|
||
double dz = m_wavedata[yIndex][xIndex];
|
||
if (m_nMode == 0)
|
||
{
|
||
if (m_wavedata[yIndex][xIndex] == -9999)
|
||
{
|
||
dz = m_fmax;
|
||
}
|
||
}
|
||
else if (m_nMode == 1)
|
||
{
|
||
if (m_wavedata[yIndex][xIndex] == -9999)
|
||
{
|
||
dz = m_fmin;
|
||
}
|
||
}
|
||
else if (m_nMode == 2)
|
||
{
|
||
if (m_wavedata[yIndex][xIndex] == -9999)
|
||
{
|
||
dz = m_fmax;
|
||
}
|
||
else
|
||
{
|
||
dz = m_fmin;
|
||
}
|
||
}
|
||
m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz);
|
||
}
|
||
}
|
||
return m_colorMap;
|
||
}
|
||
|
||
float QMyCustomPlot::getScaleV()
|
||
{
|
||
return m_fScaleV;
|
||
}
|
||
|
||
void QMyCustomPlot::groupBeginResult(float fEndDepth, float fStartDepth)
|
||
{
|
||
// 组ID
|
||
m_strGroupUid = getUUid();
|
||
m_fResultEndDepth = fEndDepth;
|
||
addResultGroup(fEndDepth, fStartDepth, m_strGroupUid, "11");
|
||
}
|
||
|
||
void QMyCustomPlot::groupEndResult()
|
||
{
|
||
m_strGroupUid = "";
|
||
}
|
||
|
||
void QMyCustomPlot::setShowProperty(QVariant val, int ntag)
|
||
{
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for (int i = 0; i < objList.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
if (ntag == 1)
|
||
{
|
||
pGroup->setGroupConclusionProportion(val.toInt());
|
||
}
|
||
else if (ntag == 2)
|
||
{
|
||
pGroup->setGroupShowPos(val.toInt());
|
||
}
|
||
else if (ntag == 3)
|
||
{
|
||
pGroup->setFloorVisible(val.toBool());
|
||
}
|
||
else if (ntag == 4)
|
||
{
|
||
QFont f = val.value<QFont>();
|
||
pGroup->setFloorFont(f);
|
||
}
|
||
else if (ntag == 5)
|
||
{
|
||
pGroup->setFloorRot(val.toDouble());
|
||
}
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::setConclusionProportion(int nCopro)
|
||
{
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for (int i = 0; i < objList.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
pGroup->setGroupConclusionProportion(nCopro);
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::setShowPos(int nSPos)
|
||
{
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for (int i = 0; i < objList.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
pGroup->setGroupShowPos(nSPos);
|
||
}
|
||
}
|
||
|
||
//蝌蚪图,重绘网格线
|
||
void QMyCustomPlot::drawCustomElements()
|
||
{
|
||
QCPPainter painter(this);
|
||
|
||
//if(!mKedou)
|
||
{
|
||
return;
|
||
}
|
||
// 绘制自定义背景网格
|
||
painter.setPen(QPen(QColor(220, 0, 0), 0, Qt::DotLine));
|
||
for (int i=0; i<10; ++i) {
|
||
double x = xAxis->range().lower + i*xAxis->range().size()/10.0;
|
||
QPointF p1;
|
||
QPointF p2;
|
||
p1.setX(xAxis->coordToPixel(x));
|
||
p1.setY(yAxis->coordToPixel(yAxis->range().lower));
|
||
//
|
||
p2.setX(xAxis->coordToPixel(x));
|
||
p2.setY(yAxis->coordToPixel(yAxis->range().upper));
|
||
//
|
||
painter.drawLine(p1,p2);
|
||
}
|
||
|
||
// 绘制自定义标记
|
||
painter.setPen(Qt::NoPen);
|
||
painter.setBrush(QColor(255, 100, 100, 150));
|
||
painter.drawEllipse(QPointF(xAxis->coordToPixel(5.0),
|
||
yAxis->coordToPixel(0.5)), 20, 20);
|
||
}
|
||
|
||
|
||
void QMyCustomPlot::init(QString strName, QVector<double> xx, QVector<double> yy0)
|
||
{
|
||
//raise(); //置于上层显示
|
||
}
|
||
|
||
void QMyCustomPlot::mouseDoubleClickEvent(QMouseEvent *event)
|
||
{
|
||
// 检查是否是左键双击
|
||
if (event->button() == Qt::LeftButton) {
|
||
//qDebug() << "左键双击发生!";
|
||
// 在这里添加你的双击处理逻辑
|
||
m_bEditor = true;
|
||
|
||
// 接受事件
|
||
event->accept();
|
||
}
|
||
else {
|
||
// 其他按钮的双击交给基类处理
|
||
QWidget::mouseDoubleClickEvent(event);
|
||
}
|
||
}
|
||
|
||
//void QMyCustomPlot::mousePressEvent(QMouseEvent *event)
|
||
//{
|
||
// //qDebug() << "mousePress";
|
||
// QCustomPlot::mousePressEvent(event);
|
||
//}
|
||
|
||
void QMyCustomPlot::mousePressEvent(QMouseEvent *event)
|
||
{
|
||
if (event->button() == Qt::LeftButton)
|
||
{
|
||
if (m_strLineName == "RESULT")
|
||
{
|
||
if (m_bEditor)
|
||
{
|
||
//获取鼠标点位置
|
||
double y_pos = event->pos().y();
|
||
//转为图像位置
|
||
double x_val = xAxis->pixelToCoord(y_pos);
|
||
mMousePress = true;
|
||
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for (int i = 0; i < objList.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
QCPRange rg = pGroup->getRange();
|
||
if (x_val <= rg.upper && x_val >= rg.lower)
|
||
{
|
||
mMousePress = false;
|
||
break;
|
||
}
|
||
}
|
||
if (mMousePress)
|
||
{
|
||
m_dPressX = x_val;
|
||
if (m_pAddLine1 == NULL)
|
||
{
|
||
m_pAddLine1 = new QCPItemStraightLine(this);
|
||
m_pAddLine1->setPen(QPen(Qt::red, 1, Qt::DashDotDotLine));
|
||
m_pAddLine1->setVisible(false);
|
||
}
|
||
if (m_pAddLine2 == NULL)
|
||
{
|
||
m_pAddLine2 = new QCPItemStraightLine(this);
|
||
m_pAddLine2->setPen(QPen(Qt::red, 1, Qt::DashDotDotLine));
|
||
m_pAddLine2->setVisible(false);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if(m_bDrawCore_PHYSICS)//岩心分析
|
||
{
|
||
//获取鼠标点位置
|
||
double x_pos = event->pos().x();
|
||
double y_pos = event->pos().y();
|
||
|
||
double x_val;
|
||
double y_val;
|
||
//转为图像位置
|
||
x_val = xAxis->pixelToCoord(y_pos);
|
||
//曲线关联在左右轴判断
|
||
y_val = yAxis->pixelToCoord(x_pos);
|
||
|
||
//从选择中获取数据区间
|
||
QCPDataRange range;
|
||
if(graph(0)->selected()){
|
||
range = graph(0)->selection().dataRange();
|
||
}
|
||
// 检查选定的区间是否是单个数据点
|
||
if (range.size() == 1) {
|
||
// 获取选定的数据点的下标范围
|
||
dataIndex = range.begin();
|
||
// 执行特定操作,例如输出下标:
|
||
}else{
|
||
dataIndex = -1;
|
||
return;
|
||
}
|
||
|
||
double xx = graph(0)->data()->at(dataIndex)->key;
|
||
// double yy = graph(0)->data()->at(dataIndex)->value;
|
||
|
||
//// double newYPoint = y_val / yy; //曲线Y轴数据 m_y.at(dataIndex)
|
||
//// double xDistand = abs(x_val - xx); //曲线X轴数据 m_x.at(dataIndex)
|
||
|
||
//// //鼠标位距离数据点位置判断
|
||
//// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) {
|
||
//// //在此范围(自由设计)则表示选中数据点
|
||
//// dataIndex = dataIndex;
|
||
//// }else{
|
||
//// dataIndex = -1;
|
||
//// }
|
||
|
||
singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex)
|
||
singleDragMove = true;
|
||
}
|
||
|
||
QCustomPlot::mousePressEvent(event);
|
||
}
|
||
|
||
|
||
void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
|
||
{
|
||
if (m_strLineName == "RESULT")
|
||
{
|
||
if (mMousePress)
|
||
{
|
||
//获取鼠标点位置
|
||
double y_pos = event->pos().y();
|
||
//转为图像位置
|
||
double x_val = xAxis->pixelToCoord(y_pos);
|
||
double absval = abs(abs(m_dPressX) - abs(x_val));
|
||
if (absval > 0.5 && !m_pAddLine1->visible())
|
||
{
|
||
m_pAddLine1->setVisible(true);
|
||
m_pAddLine1->point1->setCoords(m_dPressX, 0);
|
||
m_pAddLine1->point2->setCoords(m_dPressX, 1);
|
||
m_pAddLine2->setVisible(true);
|
||
}
|
||
m_pAddLine2->point1->setCoords(x_val, 0);
|
||
m_pAddLine2->point2->setCoords(x_val, 1);
|
||
replot();
|
||
}
|
||
}
|
||
|
||
QCustomPlot::mouseMoveEvent(event);
|
||
|
||
int nmaxCursor = 0;
|
||
//解释结论
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for( int i = 0; i< objList.size(); i++)
|
||
{
|
||
TransparentGroupResult* group = qobject_cast<TransparentGroupResult*>(objList.at(i));
|
||
if (group)
|
||
{
|
||
if (group->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = group->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//固井结论
|
||
QObjectList objList_Gujing = m_mapDraggable_Gujing.values();
|
||
for( int i = 0; i< objList_Gujing.size(); i++)
|
||
{
|
||
TransparentDraggableGujing* tdGujing = qobject_cast<TransparentDraggableGujing*>(objList_Gujing.at(i));
|
||
if (tdGujing)
|
||
{
|
||
if (tdGujing->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdGujing->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//文字结论
|
||
QObjectList objList_Rect = m_mapDraggable_Rect.values();
|
||
for( int i = 0; i< objList_Rect.size(); i++)
|
||
{
|
||
TransparentDraggableRect* tdRect = qobject_cast<TransparentDraggableRect*>(objList_Rect.at(i));
|
||
if (tdRect)
|
||
{
|
||
if (tdRect->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdRect->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//地质分层
|
||
QObjectList objList_Layer = m_mapDraggable_Layer.values();
|
||
for( int i = 0; i< objList_Layer.size(); i++)
|
||
{
|
||
TransparentDraggableLayer* tdLayer = qobject_cast<TransparentDraggableLayer*>(objList_Layer.at(i));
|
||
if (tdLayer)
|
||
{
|
||
if (tdLayer->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdLayer->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//录井剖面
|
||
QObjectList objList_GeoLith = m_mapDraggable_GeoLith.values();
|
||
for( int i = 0; i< objList_GeoLith.size(); i++)
|
||
{
|
||
TransparentDraggableGeoLith* tdGeoLith = qobject_cast<TransparentDraggableGeoLith*>(objList_GeoLith.at(i));
|
||
if (tdGeoLith)
|
||
{
|
||
if (tdGeoLith->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdGeoLith->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//井壁取心
|
||
QObjectList objList_SwallCore = m_mapDraggable_SwallCore.values();
|
||
for( int i = 0; i< objList_SwallCore.size(); i++)
|
||
{
|
||
TransparentDraggableSwallCore* tdSwallCore = qobject_cast<TransparentDraggableSwallCore*>(objList_SwallCore.at(i));
|
||
if (tdSwallCore)
|
||
{
|
||
if (tdSwallCore->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdSwallCore->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//气测-管柱-文本-FMT-射孔
|
||
QObjectList objList_Jiegutext = m_mapDraggable_Jiegutext.values();
|
||
for( int i = 0; i< objList_Jiegutext.size(); i++)
|
||
{
|
||
TransparentDraggableJiegutext* tdJiegutext = qobject_cast<TransparentDraggableJiegutext*>(objList_Jiegutext.at(i));
|
||
if (tdJiegutext)
|
||
{
|
||
if (tdJiegutext->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdJiegutext->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//沉积相
|
||
QObjectList objList_MFac = m_mapDraggable_MFac.values();
|
||
for( int i = 0; i< objList_MFac.size(); i++)
|
||
{
|
||
TransparentDraggableMFac* tdMFac = qobject_cast<TransparentDraggableMFac*>(objList_MFac.at(i));
|
||
if (tdMFac)
|
||
{
|
||
if (tdMFac->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdMFac->getCursor();
|
||
}
|
||
}
|
||
}
|
||
//套管组件
|
||
QObjectList objList_Guan = m_mapDraggable_Guan.values();
|
||
for( int i = 0; i< objList_Guan.size(); i++)
|
||
{
|
||
TransparentDraggableGuan* tdGuan = qobject_cast<TransparentDraggableGuan*>(objList_Guan.at(i));
|
||
if (tdGuan)
|
||
{
|
||
if (tdGuan->getCursor() > nmaxCursor)
|
||
{
|
||
nmaxCursor = tdGuan->getCursor();
|
||
}
|
||
}
|
||
}
|
||
|
||
if (nmaxCursor == 2)
|
||
{
|
||
this->setCursor(Qt::ClosedHandCursor);
|
||
}
|
||
else if (nmaxCursor == 1)
|
||
{
|
||
this->setCursor(Qt::SizeVerCursor);
|
||
}
|
||
else
|
||
{
|
||
this->setCursor(Qt::ArrowCursor);
|
||
}
|
||
// if (mMousePress) {
|
||
// auto items = selectedItems();
|
||
|
||
// foreach (auto *item, items) {
|
||
// if (auto *sizeHandle = qobject_cast<QCPSizeHandle *>(item))
|
||
// {
|
||
// mSizeHandleManager->handleItemResize(sizeHandle, event->pos() - mLastPos); // 控制item缩放
|
||
// }
|
||
// else
|
||
// {
|
||
// mSizeHandleManager->handleItemMove(item, event->pos() - mLastPos); // 控制item移动
|
||
// }
|
||
|
||
// }
|
||
// mLastPos = event->pos();
|
||
// replot();
|
||
// }
|
||
// else
|
||
|
||
if(m_bDrawCore_PHYSICS)//岩心分析
|
||
{
|
||
if(singleDragMove){
|
||
executeSingle(event);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// 当前鼠标位置(像素坐标)
|
||
//int x_pos = event->pos().x();
|
||
int y_pos = event->pos().y();
|
||
|
||
// 像素坐标转成实际的x,y轴的坐标
|
||
//float x_val = yAxis->pixelToCoord(x_pos);
|
||
float y_val = xAxis->pixelToCoord(y_pos);
|
||
emit CallManage::getInstance()->sig_MouseMove(m_strUuid, m_strWellName, m_strTrackName, 0-y_val);
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::mouseReleaseEvent(QMouseEvent *event)
|
||
{
|
||
if (m_strLineName == "RESULT")
|
||
{
|
||
if (mMousePress)
|
||
{
|
||
//获取鼠标点位置
|
||
double y_pos = event->pos().y();
|
||
//转为图像位置
|
||
double x_val = xAxis->pixelToCoord(y_pos);
|
||
double absval = abs(abs(m_dPressX) - abs(x_val));
|
||
if (absval < 0.4)
|
||
{
|
||
mMousePress = false;
|
||
m_pAddLine1->setVisible(false);
|
||
m_pAddLine2->setVisible(false);
|
||
replot();
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
if(m_bDrawCore_PHYSICS)//岩心分析
|
||
{
|
||
dataIndex = -1;
|
||
singleDragMove = false;
|
||
//setCursor(Qt::ArrowCursor);
|
||
replot(QCustomPlot::rpQueuedReplot);
|
||
}
|
||
QCustomPlot::mouseReleaseEvent(event);
|
||
}
|
||
|
||
//单点移动功能
|
||
void QMyCustomPlot::executeSingle(QMouseEvent *event)
|
||
{
|
||
try {
|
||
if(dataIndex == -1)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//获取鼠标信息
|
||
int x_pos = event->pos().x();
|
||
int y_pos = event->pos().y();
|
||
// double x_val = xAxis->pixelToCoord(x_pos);
|
||
// double y_val = yAxis->pixelToCoord(y_pos);
|
||
|
||
double x_val;
|
||
double y_val;
|
||
//转为图像位置
|
||
x_val = xAxis->pixelToCoord(y_pos);
|
||
//曲线关联在左右轴判断
|
||
y_val = yAxis->pixelToCoord(x_pos);
|
||
|
||
//double xx = graph(0)->data()->at(dataIndex)->key;
|
||
//double yy = graph(0)->data()->at(dataIndex)->value;
|
||
|
||
// //获取数据改变鼠标的形状
|
||
// double newYPoint = y_val / yy;
|
||
// double xDistand = abs(x_val - xx);
|
||
// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) {
|
||
// customPlot->setCursor(Qt::ClosedHandCursor);
|
||
// }else{
|
||
// customPlot->setCursor(Qt::ArrowCursor);
|
||
// }
|
||
|
||
//更新曲线数据中拖动的那个点数据
|
||
for(int i =0; i<m_x.size(); i++)
|
||
{
|
||
if(m_x[i] == singleOldPosition)
|
||
{
|
||
m_y[i]=y_val;
|
||
break;
|
||
}
|
||
}
|
||
graph(0)->data()->clear();
|
||
graph(0)->setData(m_x, m_y);
|
||
// graph(0)->data()->remove(dataIndex);
|
||
// graph(0)->addData(singleOldPosition, y_val); //更新曲线数据
|
||
replot(QCustomPlot::rpQueuedReplot); //刷新曲线
|
||
} catch (...) {
|
||
//FERROR("系统发异常!");
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::slotSelectionRectAccepted(const QRect &rect, QMouseEvent *event)
|
||
{
|
||
if ("RESULT" == m_strLineName)
|
||
{
|
||
if (!mMousePress)
|
||
return;
|
||
|
||
// 当选择完成时,获取矩形范围并放大
|
||
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
|
||
m_bEditRect = true;//当前是否正在编辑曲线。
|
||
|
||
// 转换为坐标轴范围
|
||
double top = rect.top();
|
||
double bottom = rect.bottom();
|
||
|
||
double right_Hight = this->xAxis->pixelToCoord(top); //上边界
|
||
double left_Low = this->xAxis->pixelToCoord(bottom); //下边界
|
||
|
||
bool bAdd = true;
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for (int i = 0; i < objList.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
QCPRange rg = pGroup->getRange();
|
||
if (right_Hight <= rg.upper && right_Hight >= rg.lower
|
||
|| left_Low <= rg.upper && left_Low >= rg.lower)
|
||
{
|
||
bAdd = false;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (bAdd)
|
||
{
|
||
QString strUp = "";
|
||
TransparentGroupResult* pGroup = this->addResultGroup(left_Low, right_Hight, strUp, "");
|
||
strUp = "";
|
||
pGroup->addResultToPlot(left_Low, right_Hight, ::GetOilSymbolDir() + "油层.svg", strUp);
|
||
|
||
}
|
||
mMousePress = false;
|
||
m_pAddLine1->setVisible(false);
|
||
m_pAddLine2->setVisible(false);
|
||
replot();
|
||
}
|
||
}
|
||
|
||
//槽函数,选中曲线
|
||
void QMyCustomPlot::s_LineClicked(int index)
|
||
{
|
||
// qDebug() << "s_LineClicked";
|
||
|
||
// //全部取消选中
|
||
// deselectAll();
|
||
|
||
// //重新选中
|
||
// QCPGraph *graph = this->graph(index);
|
||
// if (graph)
|
||
// {
|
||
// //qDebug() << "s_LineClicked graph";
|
||
// graph->setSelection(QCPDataSelection(graph->data()->dataRange()));
|
||
|
||
// QCPPlottableLegendItem *item = legend->itemWithPlottable(graph);
|
||
// if (item)
|
||
// {
|
||
// //qDebug() << "s_LineClicked item";
|
||
// //仅显示当前被选中的曲线
|
||
// item->setSelected(true);
|
||
// replot();
|
||
// }
|
||
// }
|
||
}
|
||
|
||
void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
||
{
|
||
m_event = event;
|
||
//曲线
|
||
if(m_addRandomGraph && m_strLineName != "CORE_PHYSICS")
|
||
{
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ZonePoint.png"), "添加分段线", this, &QMyCustomPlot::onAddShiftLine);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearZonePoint.png"), "清除当前分段线", this, &QMyCustomPlot::onDelSelectShiftLine);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearZone.png"), "清除全部分段线", this, &QMyCustomPlot::onDelAllShiftLine);
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑曲线", this, &QMyCustomPlot::onEditLine);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
|
||
if (m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT")
|
||
{
|
||
QMenu menu(this);
|
||
//固井
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑固井结论", this, &QMyCustomPlot::onEditGujing);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Gujing);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Gujing);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Gujing);
|
||
menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::MegResult_Gujing);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (m_strLineName == "SWALL_CORE")
|
||
{
|
||
QMenu menu(this);
|
||
//井壁取心
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), "增加井壁取心", this, &QMyCustomPlot::addItem_SWallCore);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), "平移水平位置", this, &QMyCustomPlot::moveItems_SWallCore);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_SWallCore);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_SWallCore);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_SWallCore);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (m_strLineName == "GEO_LITH")
|
||
{
|
||
QMenu menu(this);
|
||
//录井剖面
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑录井剖面", this, &QMyCustomPlot::onEditGeoLith);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_GeoLith);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_GeoLith);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_GeoLith);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (m_strLineName == "WORDS_RELUST")
|
||
{
|
||
QMenu menu(this);
|
||
//岩性描述,文字结论
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑文字结论", this, &QMyCustomPlot::onEditText);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Text);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Text);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Text);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (m_strLineName == "LAYER_DATA")
|
||
{
|
||
QMenu menu(this);
|
||
//地质分层
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑地质分层", this, &QMyCustomPlot::onEditLayer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Layer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Layer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Layer);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (m_strLineName == "RESULT") // 解释结论
|
||
{
|
||
QMenu menu(this);
|
||
if (!m_bEditor)
|
||
{
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑解释结论", this, &QMyCustomPlot::onOpenEditResult);
|
||
}
|
||
else
|
||
{
|
||
mLastPos = event->pos();
|
||
qDebug() << "mLastPos:" << mLastPos;
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑解释结论", this, &QMyCustomPlot::onCloseEditResult);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Layer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &QMyCustomPlot::DeleteItemGroup);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Layer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Layer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/SetZone.png"), "更新层号", this, &QMyCustomPlot::updateGroupZone);
|
||
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割为层内层", this, &QMyCustomPlot::segmentationInnerLayer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割为独立层", this, &QMyCustomPlot::segmentationIndependentLayer);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "拆分复合层成独立层", this, &QMyCustomPlot::splitIndependentLayer);
|
||
QMap<double, TransparentGroupResult*> mapsort = this->getSelectGroupResult();
|
||
if (mapsort.size() > 1)
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/decreasey.png"), "合并", this, &QMyCustomPlot::megResultLayer);
|
||
}
|
||
menu.exec(event->globalPos());
|
||
|
||
}
|
||
else if (m_strLineName == "IMAGE_DATA")
|
||
{
|
||
//岩心图片
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑岩心图片", this, &QMyCustomPlot::onEditImage);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItemsImage);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::deleteItemsImage);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::refreshItemsImage);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (m_strLineName == "CORE_PHYSICS")
|
||
{
|
||
// 岩心分析
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "增加", this, &QMyCustomPlot::addCorePhysics);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::pasteCorePhysics);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::deleteCorePhysics);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::refreshCorePhysics);
|
||
|
||
menu.exec(event->globalPos());
|
||
}
|
||
|
||
//
|
||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||
if (pInfo == NULL)
|
||
{
|
||
return;
|
||
}
|
||
QString strType = pInfo->m_strType;
|
||
if (strType == "JiegutextObject")
|
||
{
|
||
QMenu menu(this);
|
||
//气测/FMT/射孔/文本
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Jiegutext);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Jiegutext);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Jiegutext);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (strType == "LogfaceObject")
|
||
{
|
||
QMenu menu(this);
|
||
//沉积相
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/add_frac.png"), "添加沉积相", this, &QMyCustomPlot::addItem_Fac);
|
||
//menu.addAction(QIcon(::GetImagePath() + "icon/Layer.png"), "沉积相自动描述", this, &QMyCustomPlot::ChangeDep);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if (strType == "TubingstringObject")
|
||
{
|
||
QStringList strs=zoneOrder_Tubing.keys();
|
||
QStringList mstrs=QString("油管接箍,套管接箍,偏配,封隔器,筛管,喇叭口,水力猫,短接,管底部,油管深").split(",");
|
||
QMenu menu(this);
|
||
QMenu *pSubMenu = menu.addMenu("特殊工具");
|
||
//套管组件
|
||
for(int i=0;i<strs.size();i++) {
|
||
QString str;
|
||
str="添加"+strs.at(i);
|
||
if(mstrs.indexOf(strs.at(i))>-1) {
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), str, this, &QMyCustomPlot::addItem_Tubing);
|
||
}
|
||
else {
|
||
pSubMenu->addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), str, this, &QMyCustomPlot::addItem_Tubing);
|
||
}
|
||
}
|
||
menu.addSeparator();
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Tubing);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Tubing);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Tubing);
|
||
|
||
menu.exec(event->globalPos());
|
||
}
|
||
}
|
||
|
||
//右键--添加分段线
|
||
void QMyCustomPlot::onAddShiftLine()
|
||
{
|
||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||
double left_Low = right_Hight;
|
||
|
||
//通知界面,增加一条校深线段
|
||
emit CallManage::getInstance()->sig_AddShiftLine(m_strUuid, left_Low, right_Hight);
|
||
}
|
||
|
||
//右键--清除当前分段线
|
||
void QMyCustomPlot::onDelSelectShiftLine()
|
||
{
|
||
//通知界面,清除当前分段线
|
||
emit CallManage::getInstance()->sig_DelSelectShiftLine(m_strUuid);
|
||
}
|
||
|
||
//右键--清除全部分段线
|
||
void QMyCustomPlot::onDelAllShiftLine()
|
||
{
|
||
//通知界面,清除全部分段线
|
||
emit CallManage::getInstance()->sig_DelAllShiftLine(m_strUuid);
|
||
}
|
||
|
||
//右键--编辑曲线
|
||
void QMyCustomPlot::onEditLine()
|
||
{
|
||
if(m_bEditRect)
|
||
{
|
||
QMessageBox::information(nullptr, "提示", "当前正在编辑曲线,请先完成编辑!");
|
||
return;
|
||
}
|
||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
|
||
|
||
if(m_bFirstTimeConnect)
|
||
{
|
||
//信号槽只绑定一次,避免重复绑定
|
||
m_bFirstTimeConnect = false;
|
||
|
||
for (int i=0; i < this->graphCount(); ++i) {
|
||
QCPGraph *graph = this->graph(i);
|
||
graph->setSelectable(QCP::stDataRange);
|
||
break;
|
||
}
|
||
|
||
connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){
|
||
if(this->m_bDrawRect == false)
|
||
{
|
||
this->m_bDrawRect = true;
|
||
return;
|
||
}
|
||
// 当选择完成时,获取矩形范围并放大
|
||
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
|
||
m_bEditRect=true;//当前是否正在编辑曲线。
|
||
|
||
// 转换为坐标轴范围
|
||
double top = rect.top();
|
||
double bottom = rect.bottom();
|
||
|
||
double right_Hight = this->xAxis->pixelToCoord(top);
|
||
double left_Low = this->xAxis->pixelToCoord(bottom);
|
||
|
||
float rlev=0;
|
||
if(m_x.size()>=2)
|
||
{
|
||
rlev = abs(m_x[1] - m_x[0]);
|
||
}
|
||
//
|
||
int left_Low_Number=0;
|
||
int right_Hight_Number=0;
|
||
for(int i =0; i<m_x.size(); i++)
|
||
{
|
||
if(abs(m_x[i]-left_Low) <= rlev)
|
||
{
|
||
left_Low_Number = i;
|
||
break;
|
||
}
|
||
}
|
||
for(int i =0; i<m_x.size(); i++)
|
||
{
|
||
if(abs(m_x[i]-right_Hight) <= rlev)
|
||
{
|
||
right_Hight_Number = i;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(abs(right_Hight-left_Low) >= (3*rlev) )//至少选中5个点
|
||
{
|
||
// for (int j=right_Hight_Number; j<left_Low_Number-1; j++)
|
||
// {
|
||
// QCPItemLine *qcpItemLine = new QCPItemLine(this);
|
||
// qcpItemLine->setPen(QPen(Qt::blue));
|
||
// qcpItemLine->setLayer("overlay"); // 确保在最上层
|
||
// qcpItemLine->start->setCoords(this->m_x[j], this->m_y[j]);
|
||
// qcpItemLine->end->setCoords(this->m_x[j+1], this->m_y[j+1]);
|
||
// }
|
||
// this->replot();
|
||
// QPixmap p = this->grab(QRect(rect.x(), rect.y(), rect.width(), rect.height()));
|
||
// p.save("./Rectpicture.png", "png");
|
||
|
||
//添加图形
|
||
this->addSelectRectToPlot(m_x[left_Low_Number], m_x[right_Hight_Number], left_Low_Number, right_Hight_Number);//left_Low, right_Hight
|
||
|
||
//取消框选
|
||
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||
this->setSelectionRectMode(QCP::srmNone);
|
||
}
|
||
});
|
||
|
||
}
|
||
}
|
||
|
||
//右键--添加文字结论
|
||
void QMyCustomPlot::onEditText()
|
||
{
|
||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
|
||
|
||
if(m_bFirstTimeConnect)
|
||
{
|
||
//信号槽只绑定一次,避免重复绑定
|
||
m_bFirstTimeConnect = false;
|
||
|
||
for (int i=0; i < this->graphCount(); ++i) {
|
||
QCPGraph *graph = this->graph(i);
|
||
graph->setSelectable(QCP::stDataRange);
|
||
break;
|
||
}
|
||
|
||
connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){
|
||
if(this->m_bDrawRect == false)
|
||
{
|
||
this->m_bDrawRect = true;
|
||
return;
|
||
}
|
||
// 当选择完成时,获取矩形范围并放大
|
||
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
|
||
m_bEditRect=true;//当前是否正在编辑曲线。
|
||
|
||
// 转换为坐标轴范围
|
||
double top = rect.top();
|
||
double bottom = rect.bottom();
|
||
|
||
double right_Hight = this->xAxis->pixelToCoord(top);
|
||
double left_Low = this->xAxis->pixelToCoord(bottom);
|
||
|
||
//追加判断,避免框选重叠
|
||
TransparentDraggableRect *pDraggableRect =NULL;
|
||
{
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Rect.begin();
|
||
while( it != m_mapDraggable_Rect.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableRect*)it.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
it++;
|
||
}
|
||
}
|
||
|
||
{
|
||
//添加文字结论
|
||
this->addTextToPlot(left_Low, right_Hight, "");
|
||
|
||
//保存
|
||
this->SaveToSLF_Text();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
|
||
//取消框选
|
||
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||
this->setSelectionRectMode(QCP::srmNone);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
//右键--添加地质分层
|
||
void QMyCustomPlot::onEditLayer()
|
||
{
|
||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
|
||
|
||
if(m_bFirstTimeConnect)
|
||
{
|
||
//信号槽只绑定一次,避免重复绑定
|
||
m_bFirstTimeConnect = false;
|
||
|
||
for (int i=0; i < this->graphCount(); ++i) {
|
||
QCPGraph *graph = this->graph(i);
|
||
graph->setSelectable(QCP::stDataRange);
|
||
break;
|
||
}
|
||
|
||
connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){
|
||
if(this->m_bDrawRect == false)
|
||
{
|
||
this->m_bDrawRect = true;
|
||
return;
|
||
}
|
||
// 当选择完成时,获取矩形范围并放大
|
||
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
|
||
m_bEditRect=true;//当前是否正在编辑曲线。
|
||
|
||
// 转换为坐标轴范围
|
||
double top = rect.top();
|
||
double bottom = rect.bottom();
|
||
|
||
double right_Hight = this->xAxis->pixelToCoord(top);
|
||
double left_Low = this->xAxis->pixelToCoord(bottom);
|
||
|
||
//追加判断,避免框选重叠
|
||
TransparentDraggableRect *pDraggableRect =NULL;
|
||
{
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Rect.begin();
|
||
while( it != m_mapDraggable_Rect.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableRect*)it.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
it++;
|
||
}
|
||
}
|
||
|
||
{
|
||
QColor bkColor(255,255,255);
|
||
//添加地质分层
|
||
this->addLayerToPlot(left_Low, right_Hight, "", true, bkColor);
|
||
|
||
//保存
|
||
this->SaveToSLF_Layer();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
|
||
//取消框选
|
||
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||
this->setSelectionRectMode(QCP::srmNone);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
//右键--添加固井
|
||
void QMyCustomPlot::onEditGujing()
|
||
{
|
||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
|
||
|
||
if(m_bFirstTimeConnect)
|
||
{
|
||
//信号槽只绑定一次,避免重复绑定
|
||
m_bFirstTimeConnect = false;
|
||
|
||
for (int i=0; i < this->graphCount(); ++i) {
|
||
QCPGraph *graph = this->graph(i);
|
||
graph->setSelectable(QCP::stDataRange);
|
||
break;
|
||
}
|
||
|
||
connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){
|
||
if(this->m_bDrawRect == false)
|
||
{
|
||
this->m_bDrawRect = true;
|
||
return;
|
||
}
|
||
// 当选择完成时,获取矩形范围并放大
|
||
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
|
||
m_bEditRect=true;//当前是否正在编辑曲线。
|
||
|
||
// 转换为坐标轴范围
|
||
double top = rect.top();
|
||
double bottom = rect.bottom();
|
||
|
||
double right_Hight = this->xAxis->pixelToCoord(top);
|
||
double left_Low = this->xAxis->pixelToCoord(bottom);
|
||
|
||
//追加判断,避免框选重叠
|
||
TransparentDraggableGujing *pDraggableRect =NULL;
|
||
{
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Gujing.begin();
|
||
while( it != m_mapDraggable_Gujing.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGujing*)it.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
it++;
|
||
}
|
||
}
|
||
|
||
{
|
||
//添加固井结论
|
||
this->addGujingToPlot(left_Low, right_Hight, ::GetGujingSymbolDir());
|
||
|
||
//保存
|
||
this->SaveToSLF_Gujing();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
|
||
//取消框选
|
||
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||
this->setSelectionRectMode(QCP::srmNone);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
// 岩心图片
|
||
void QMyCustomPlot::onEditImage()
|
||
{
|
||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
|
||
|
||
if(m_bFirstTimeConnect)
|
||
{
|
||
//信号槽只绑定一次,避免重复绑定
|
||
m_bFirstTimeConnect = false;
|
||
|
||
for (int i=0; i < this->graphCount(); ++i) {
|
||
QCPGraph *graph = this->graph(i);
|
||
graph->setSelectable(QCP::stDataRange);
|
||
break;
|
||
}
|
||
|
||
connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){
|
||
if(this->m_bDrawRect == false)
|
||
{
|
||
this->m_bDrawRect = true;
|
||
return;
|
||
}
|
||
// 当选择完成时,获取矩形范围并放大
|
||
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
|
||
m_bEditRect=true;//当前是否正在编辑曲线。
|
||
|
||
// 转换为坐标轴范围
|
||
double top = rect.top();
|
||
double bottom = rect.bottom();
|
||
|
||
double right_Hight = this->xAxis->pixelToCoord(top);
|
||
double left_Low = this->xAxis->pixelToCoord(bottom);
|
||
|
||
//追加判断,避免框选重叠
|
||
TransparentDraggableGujing *pDraggableRect =NULL;
|
||
{
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Gujing.begin();
|
||
while( it != m_mapDraggable_Gujing.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGujing*)it.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
it++;
|
||
}
|
||
}
|
||
{
|
||
// 弹框选择图片
|
||
YxzpDialog dlg(nullptr);
|
||
QString imagePath = "";
|
||
if (dlg.exec() == QDialog::Accepted) // 点击“确定”按钮
|
||
{
|
||
imagePath = dlg.getImagePath();
|
||
}
|
||
|
||
// 添加岩心图片
|
||
this->addImageToPlot(left_Low, right_Hight, imagePath, 0, 100);
|
||
|
||
//保存
|
||
this->SaveToSLFImage();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
|
||
//取消框选
|
||
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||
this->setSelectionRectMode(QCP::srmNone);
|
||
}
|
||
});
|
||
|
||
//this->selectionRect()->cancel();
|
||
}
|
||
}
|
||
|
||
// 岩心图片
|
||
void QMyCustomPlot::addItemsImage(){
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace(","," ");
|
||
originalText.replace("\t"," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
QStringList line=originalText.split("\n");
|
||
QStringList old;
|
||
for(int i=0;i<line.size();i++) {
|
||
QStringList coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||
if(coredat.size()<3) {
|
||
if(old.size()<1) {
|
||
old=coredat;
|
||
continue;
|
||
}
|
||
else {
|
||
QStringList cs;
|
||
cs.append(old[0]);
|
||
cs.append(old[1]);
|
||
cs.append(coredat[1]);
|
||
// cs.append(old[2]);
|
||
old=coredat;
|
||
coredat=cs;
|
||
}
|
||
}
|
||
//添加固井结论
|
||
int NO = coredat[0].toInt();
|
||
float SDEP = coredat[1].toDouble();
|
||
float EDEP = coredat[2].toDouble();
|
||
int iRESULT = 0;
|
||
QString result = "";
|
||
if(coredat.size()>3) {
|
||
if(coredat[3].at(0).isDigit()) {
|
||
iRESULT = coredat[3].toInt();
|
||
QString iconshotname=zoneOrderImage.key(QString::number(iRESULT));
|
||
if(iconshotname!="")
|
||
result=::GetImageSymbolDir()+iconshotname+".svg";
|
||
}
|
||
else
|
||
{
|
||
QStringList vals=zoneOrderImage.keys();
|
||
coredat[3].trimmed();
|
||
int j=vals.indexOf(coredat[3]);
|
||
if(j>-1) {
|
||
result=::GetImageSymbolDir()+vals[j]+".svg";
|
||
}
|
||
}
|
||
}
|
||
|
||
//
|
||
int len=2;
|
||
int pos=result.indexOf(".//");
|
||
if(pos<0) pos=result.indexOf("./");
|
||
else len=3;
|
||
QString svg;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=result.mid(len-1);
|
||
}
|
||
else svg=result;
|
||
QDir ss;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
result=QDir::toNativeSeparators(svg);
|
||
|
||
//显示固井
|
||
addImageToPlot(-EDEP, -SDEP, result);
|
||
}
|
||
//保存
|
||
//this->SaveToSLFImage();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
void QMyCustomPlot::deleteItemsImage(){}
|
||
void QMyCustomPlot::refreshItemsImage(){}
|
||
|
||
// 增加
|
||
void QMyCustomPlot::addCorePhysics()
|
||
{
|
||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||
this->addCorePhysicsWithParam(0,right_Hight,right_Hight,20);
|
||
this->saveToSLFCorePhysics();
|
||
}
|
||
|
||
void QMyCustomPlot::addCorePhysicsWithParam(int Order, double Depth, double CorrDepth, double CoreValue)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
|
||
dragRect->setCpDepth(Depth);
|
||
dragRect->setRange(CorrDepth, CorrDepth, 20);
|
||
dragRect->setCpLineColor(Qt::black);
|
||
dragRect->setCpLineWidth(1);
|
||
dragRect->update();
|
||
m_mapDraggable_CorePhysics[strUuid] = dragRect;
|
||
}
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::pasteCorePhysics()
|
||
{}
|
||
//全部清空
|
||
void QMyCustomPlot::deleteCorePhysics()
|
||
{}
|
||
//刷新数据
|
||
void QMyCustomPlot::refreshCorePhysics()
|
||
{}
|
||
|
||
//右键--添加录井剖面
|
||
void QMyCustomPlot::onEditGeoLith()
|
||
{
|
||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
|
||
|
||
if(m_bFirstTimeConnect)
|
||
{
|
||
//信号槽只绑定一次,避免重复绑定
|
||
m_bFirstTimeConnect = false;
|
||
|
||
for (int i=0; i < this->graphCount(); ++i) {
|
||
QCPGraph *graph = this->graph(i);
|
||
graph->setSelectable(QCP::stDataRange);
|
||
break;
|
||
}
|
||
|
||
connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){
|
||
if(this->m_bDrawRect == false)
|
||
{
|
||
this->m_bDrawRect = true;
|
||
return;
|
||
}
|
||
// 当选择完成时,获取矩形范围并放大
|
||
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
|
||
m_bEditRect=true;//当前是否正在编辑曲线。
|
||
|
||
// 转换为坐标轴范围
|
||
double top = rect.top();
|
||
double bottom = rect.bottom();
|
||
|
||
double right_Hight = this->xAxis->pixelToCoord(top);
|
||
double left_Low = this->xAxis->pixelToCoord(bottom);
|
||
|
||
//追加判断,避免框选重叠
|
||
TransparentDraggableGeoLith *pDraggableRect =NULL;
|
||
{
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
|
||
while( it != m_mapDraggable_GeoLith.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight)
|
||
{
|
||
return;
|
||
}
|
||
|
||
it++;
|
||
}
|
||
}
|
||
|
||
{
|
||
//
|
||
QMap<QString,QString> OilOrder;
|
||
QMap<QString,QString> LithOrder;
|
||
QMap<QString,QString> ColorOrder;
|
||
QMap<QString,QString> ColorInds;
|
||
//
|
||
LithOrder=GetZoneOrder(QString("GeoLith"));
|
||
OilOrder=GetZoneOrder(QString("CoreOil"));
|
||
ColorOrder=GetZoneOrder(QString("CoreColor"));
|
||
ColorInds=GetZoneOrder(QString("ColorInd"));
|
||
|
||
int iOil=1;//含油性
|
||
int iLith=50;//岩性
|
||
int iColor=0;//颜色
|
||
|
||
QString iconshotname="";
|
||
QString IntLith = QString::number(iLith);
|
||
if(IntLith=="0") {
|
||
iconshotname="";
|
||
}
|
||
else
|
||
{
|
||
iconshotname=LithOrder.key(IntLith);
|
||
}
|
||
|
||
//
|
||
QString Lith = "";
|
||
if(iconshotname!="")
|
||
Lith=::GetMudSymbolDir()+""+iconshotname+".svg";
|
||
int len=2;
|
||
int pos=Lith.indexOf(".//");
|
||
if(pos<0) pos=Lith.indexOf("./");
|
||
else len=3;
|
||
QString svg;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=Lith.mid(len-1);
|
||
}
|
||
else svg=Lith;
|
||
QDir ss;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
Lith=svg;
|
||
|
||
//
|
||
QString Oil = "";
|
||
iconshotname=OilOrder.key(QString::number(iOil));
|
||
if(iconshotname!="")
|
||
Oil=::GetGasSymbolDir()+""+iconshotname+".svg";
|
||
len=2;
|
||
pos=Oil.indexOf(".//");
|
||
if(pos<0) pos=Oil.indexOf("./");
|
||
else len=3;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=Oil.mid(len-1);
|
||
}
|
||
else svg=Oil;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
Oil=svg;
|
||
|
||
//
|
||
QString Color = "";
|
||
int ind=ColorInds.value(QString::number(iColor)).toInt();
|
||
if (ind>-1&&ind<ColorOrder.size())
|
||
{
|
||
Color=::GetColorSymbolDir()+""+ColorOrder.key(QString::number(ind))+".svg";
|
||
}
|
||
else {
|
||
Color=::GetColorSymbolDir()+"空白.svg";
|
||
}
|
||
|
||
//添加录井剖面
|
||
this->addGeoLithToPlot(left_Low, right_Hight, Lith, Oil, Color);
|
||
|
||
//保存
|
||
this->SaveToSLF_GeoLith();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
|
||
//取消框选
|
||
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||
this->setSelectionRectMode(QCP::srmNone);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
bool QMyCustomPlot::SaveToSLF_SwallCore()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
WALLCORE_DATA m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
bool isfirst=false;
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_SwallCore.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,8,
|
||
"NO,DEPTH,OIL,LITH,COLOR,LEFT,WIDTH,DEST",
|
||
"4,4,4,4,4,4,4,64",//字段长度
|
||
"1,4,1,1,1,4,4,6",//字段类型
|
||
"0,0,3,4,5,0,0,0");//字段备注,1-枚举
|
||
isfirst=true;
|
||
}
|
||
else {
|
||
static int err=0;
|
||
int fc=logio->GetTableFieldCount(iIndex);
|
||
Slf_TABLE_FIELD *tf=new Slf_TABLE_FIELD[fc+1];
|
||
logio->GetTableFieldInfo(iIndex,tf);
|
||
if(fc<5||tf[0].RepCode!=REPR_INT||
|
||
tf[1].RepCode!=REPR_FLOAT||
|
||
tf[2].RepCode!=REPR_INT||
|
||
tf[3].RepCode!=REPR_INT||
|
||
tf[4].RepCode!=REPR_INT||
|
||
tf[5].RepCode!=REPR_FLOAT||
|
||
tf[6].RepCode!=REPR_FLOAT)
|
||
{
|
||
if(!err)QMessageBox::information(NULL,"提示","不是有效取心表,无法保存数据!");
|
||
err++;
|
||
delete tf;
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
else err=0;
|
||
delete tf;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_SwallCore.size());
|
||
if(!m_mapDraggable_SwallCore.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_SwallCore.begin(); iter != m_mapDraggable_SwallCore.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableSwallCore*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.lower;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//------------
|
||
QStringList liths;
|
||
QStringList oils;
|
||
QStringList colors;
|
||
QStringList colorinds;
|
||
QString cs=GetConfPath();
|
||
QString color;
|
||
for(int j=0;j<4;j++)
|
||
{
|
||
if(j==0) color=cs+"corecolor.ini";
|
||
else if(j==1) color=cs+"corelith.ini";
|
||
else if(j==2) color=cs+"coreoil.ini";
|
||
else color=cs+"colorind.ini";
|
||
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
||
QStringList ss;
|
||
char buf[100];
|
||
if(fp) {
|
||
while(!feof(fp)) {
|
||
fscanf(fp,"%s",buf);
|
||
ss.append(buf);
|
||
}
|
||
fclose(fp);
|
||
}
|
||
if(j==0) colors=ss;
|
||
else if(j==1) liths=ss;
|
||
else if(j==2) oils=ss;
|
||
else colorinds=ss;
|
||
}
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
char dest[64];
|
||
dest[0]=0;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_SwallCore.begin(); iter != m_mapDraggable_SwallCore.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableSwallCore*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.lower;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(WALLCORE_DATA));
|
||
m_Result.Depth=fSDepth;
|
||
m_Result.Order=i+1;
|
||
|
||
QString name,lithname,oilname,colorname;
|
||
pDraggableRect->m_Lith.replace("\\","/");
|
||
int l=pDraggableRect->m_Lith.lastIndexOf("/");
|
||
if(l>-1) name=pDraggableRect->m_Lith.mid(l+1);
|
||
l=name.indexOf(".");
|
||
name=name.left(l);
|
||
lithname=name;
|
||
m_Result.CoreLith=liths.indexOf(name)+1;
|
||
if(m_Result.CoreLith<1) m_Result.CoreLith=1;
|
||
//
|
||
pDraggableRect->m_Oil.replace("\\","/");
|
||
l=pDraggableRect->m_Oil.lastIndexOf("/");
|
||
if(l>-1) name=pDraggableRect->m_Oil.mid(l+1);
|
||
|
||
l=name.indexOf(".");
|
||
if(l>-1)name=name.left(l);
|
||
oilname=name;
|
||
m_Result.CoreOil=oils.indexOf(name)+1;
|
||
if(m_Result.CoreOil<1) m_Result.CoreOil=1;
|
||
|
||
m_Result.CoreColor=pDraggableRect->mstrTitle.toInt();
|
||
|
||
m_Result.left=pDraggableRect->m_fLeftSpace / g_dPixelPerCm;
|
||
m_Result.width=SideWallCoreWidth * g_dPixelPerCm;//1.2厘米像素数
|
||
if(m_Result.width<=0) m_Result.width=1;
|
||
//
|
||
int ind=colorinds.indexOf(QString::number(m_Result.CoreColor));
|
||
if (ind>-1&&ind<colors.size())
|
||
{
|
||
colorname=colors[ind];
|
||
}
|
||
|
||
name="";
|
||
if(colorname!="空白"||name!="空") name+=colorname;
|
||
if(oilname!="空白"||name!="空") name+=oilname;
|
||
if(lithname!="空白"||name!="空") name+=lithname;
|
||
int n=strlen(name.toStdString().c_str());
|
||
if(n>sizeof(m_Result.dest)) n=sizeof(m_Result.dest);
|
||
strncpy(m_Result.dest,name.toLocal8Bit().data(),n);
|
||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||
//
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return true;
|
||
}
|
||
|
||
//
|
||
QString QMyCustomPlot::GetIntLith(QString Lith)
|
||
{
|
||
if(Lith=="") return "";
|
||
QFileInfo afile(Lith);
|
||
return LithOrder.value(afile.completeBaseName());
|
||
}
|
||
|
||
QString QMyCustomPlot::GetIntOil(QString Oil)
|
||
{
|
||
if(Oil=="") return "";
|
||
QFileInfo afile(Oil);
|
||
return OilOrder.value(afile.completeBaseName());
|
||
}
|
||
QString QMyCustomPlot::GetIntColor(QString Color)
|
||
{
|
||
if(Color=="") return "";
|
||
QFileInfo afile(Color);
|
||
return ColorOrder.value(afile.completeBaseName());
|
||
}
|
||
|
||
//保存录井剖面
|
||
bool QMyCustomPlot::SaveToSLF_GeoLith()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
GeoLith_DATA m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
bool isfirst=false;
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_GeoLith.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,7,
|
||
"NO,SDEP,EDEP,OIL,LITH,COLOR,DEST",
|
||
"4,4,4,4,4,4,64",//字段长度
|
||
"1,4,4,1,1,1,6",//字段类型
|
||
"0,0,0,3,7,5,0");//字段备注
|
||
isfirst=true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_GeoLith.size());
|
||
|
||
if(!m_mapDraggable_GeoLith.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
//-----
|
||
LithOrder.clear();
|
||
OilOrder.clear();
|
||
ColorOrder.clear();
|
||
ColorInds.clear();
|
||
LithOrder=GetZoneOrder(QString("GeoLith"));
|
||
OilOrder=GetZoneOrder(QString("CoreOil"));
|
||
ColorOrder=GetZoneOrder(QString("CoreColor"));
|
||
ColorInds=GetZoneOrder(QString("ColorInd"));
|
||
|
||
TransparentDraggableGeoLith *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_GeoLith.begin(); iter != m_mapDraggable_GeoLith.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableGeoLith*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_GeoLith.begin(); iter != m_mapDraggable_GeoLith.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableGeoLith*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(GeoLith_DATA));
|
||
m_Result.SDEP = -tmpRange.upper;
|
||
m_Result.EDEP = -tmpRange.lower;
|
||
m_Result.NO=i+1;
|
||
m_Result.Lith=325;
|
||
QString innerresult=GetIntLith(pDraggableRect->m_Lith);
|
||
if(innerresult!="")
|
||
m_Result.Lith=innerresult.toInt();
|
||
if(m_Result.Lith<1) m_Result.Lith=325;
|
||
m_Result.Oil=1;
|
||
innerresult=GetIntOil(pDraggableRect->m_Oil);
|
||
if(innerresult!="")
|
||
m_Result.Oil=innerresult.toInt();
|
||
if(m_Result.Oil<1) m_Result.Oil=1;
|
||
|
||
QString name,path;
|
||
GetWellNameAndPath(pDraggableRect->m_Color,name,path);
|
||
if(name!="空白"&&name!="空"&&name!="白色") strcpy(m_Result.Dest,name.toStdString().c_str());
|
||
int ind=ColorOrder.value(name).toInt();
|
||
if(ind<0||ind>=ColorInds.size()) m_Result.Color=0;
|
||
else m_Result.Color=ColorInds.key(QString::number(ind)).toInt();
|
||
name="";
|
||
GetWellNameAndPath(pDraggableRect->m_Oil,name,path);
|
||
if(name!="空白"&&name!="空") strcat(m_Result.Dest,name.toStdString().c_str());
|
||
name="";
|
||
GetWellNameAndPath(pDraggableRect->m_Lith,name,path);
|
||
if(name!="空白"&&name!="空") strcat(m_Result.Dest,name.toStdString().c_str());
|
||
name=m_Result.Dest;
|
||
name.remove("空白");
|
||
//此处统一转换
|
||
int n=strlen(name.toStdString().c_str());
|
||
if(n>sizeof(m_Result.Dest)) n=sizeof(m_Result.Dest);
|
||
strncpy(m_Result.Dest,name.toLocal8Bit().data(),n);
|
||
//
|
||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||
//
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return true;
|
||
}
|
||
|
||
//保存文字结论
|
||
bool QMyCustomPlot::SaveToSLF_Text()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
QString name=m_strLineName;
|
||
bool isfirst=false;
|
||
int iIndex=logio->OpenTable(name.toStdString().c_str());
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_Rect.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,4,
|
||
"NO,SDEP,EDEP,RESULT",
|
||
"4,4,4,100",//字段长度
|
||
"1,4,4,6",//字段类型
|
||
"0,0,0,0");//字段备注
|
||
isfirst=true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_Rect.size());
|
||
if(!m_mapDraggable_Rect.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
if(len<sizeof(WORDS_DATA)) len=sizeof(WORDS_DATA)+1;
|
||
char *buf=new char[len+1];
|
||
WORDS_DATA *m_Result=(WORDS_DATA*)buf;
|
||
|
||
TransparentDraggableRect *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Rect.begin(); iter != m_mapDraggable_Rect.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableRect*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Rect.begin(); iter != m_mapDraggable_Rect.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableRect*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(m_Result,0,sizeof(WORDS_DATA));
|
||
m_Result->StartDepth=-tmpRange.upper;
|
||
m_Result->EndDepth=-tmpRange.lower;
|
||
m_Result->Order=i+1;
|
||
|
||
int l=strlen(pDraggableRect->mstrTitle.toStdString().c_str());
|
||
if(l>100) l=100;
|
||
strncpy(m_Result->Words,pDraggableRect->mstrTitle.toLocal8Bit().data(),l);
|
||
if(l<100) m_Result->Words[l]=0;
|
||
float yy=m_Result->Order;
|
||
|
||
// if(pResult->GetLeftAndRightAlign()) {
|
||
// strcat(m_Result->Words,"$L");
|
||
// QString s=QString::number(pResult->GetLeftAndRightAlign());
|
||
// strcat(m_Result->Words,s.toStdString().c_str());
|
||
// }
|
||
// if(pResult->GetUpAndDownAlign()!=1) {
|
||
// strcat(m_Result->Words,"$U");
|
||
// QString s=QString::number(pResult->GetUpAndDownAlign());
|
||
// strcat(m_Result->Words,s.toStdString().c_str());
|
||
// }
|
||
logio->SetTableFieldData(iIndex,0,(char*)&yy,i+1);
|
||
logio->SetTableFieldData(iIndex,1,(char*)&m_Result->StartDepth,i+1);
|
||
logio->SetTableFieldData(iIndex,2,(char*)&m_Result->EndDepth,i+1);
|
||
QString FieldName = "RESULT";
|
||
logio->SetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),(char*)&m_Result->Words,i+1);
|
||
//
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
delete buf;
|
||
isrun=false;
|
||
return true;
|
||
}
|
||
|
||
//地质层位
|
||
bool QMyCustomPlot::SaveToSLF_Layer()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
int count=m_mapDraggable_Layer.size();
|
||
LAYER_DATA m_Result;
|
||
CLogIO *logio=new CLogIO();
|
||
if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeWrite))
|
||
{
|
||
delete logio;
|
||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
bool isfirst=false;
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if(iIndex<0) {
|
||
iIndex=logio->OpenTable("LAYER_DATA");
|
||
if(iIndex<0) {
|
||
if(!count) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,35,
|
||
"NO,SDEP,EDEP,ZONE,RESULTNO,THICK,TT,MDEPTH1,MDEPTH2,MDEPTH3,MDEPTH4,MDEPTH5,MDEPTH6,MDEPTH7,MDEPTH8,MDEPTH9,MDEPTH10,OIL,POOROIL,OILWATER,WATEROIL,GAS,POORGAS,GASWATER,WATERGAS,DEST1,DEST2,DEST3,DEST4,DEST5,DEST6,DEST7,DEST8,DEST9,DEST10,SDEP1,EDEP1,SDEP2,EDEP2,SDEP3,EDEP3,SDEP4,EDEP4,SDEP5,EDEP5,SDEP6,EDEP6,SDEP7,EDEP7,SDEP8,EDEP8,SDEP9,EDEP9,SDEP10,EDEP10",
|
||
"4,4,4,8,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,48,48,48,48,48,48,48,48,48,48,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",//字段长度
|
||
"1,4,4,6,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,6,6,6,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",//字段类型
|
||
"0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");//字段备注
|
||
isfirst=true;
|
||
}
|
||
}
|
||
|
||
TransparentDraggableLayer *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Layer.begin(); iter != m_mapDraggable_Layer.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableLayer*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
if (iIndex >=0)
|
||
{
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
logio->SetTableRecordCount(iIndex,count);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Layer.begin(); iter != m_mapDraggable_Layer.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableLayer*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(LAYER_DATA));
|
||
m_Result.StartDepth=-tmpRange.upper;
|
||
m_Result.EndDepth=-tmpRange.lower;
|
||
m_Result.Thick=m_Result.EndDepth-m_Result.StartDepth;
|
||
strncpy(m_Result.Zone, pDraggableRect->mstrTitle.toLocal8Bit().data(),sizeof(m_Result.Zone));
|
||
|
||
strcpy(m_Result.Description1,"");
|
||
strcpy(m_Result.Description2,"");
|
||
strcpy(m_Result.Description3,"");
|
||
strcpy(m_Result.Description4,"");
|
||
strcpy(m_Result.Description5,"");
|
||
strcpy(m_Result.Description6,"");
|
||
strcpy(m_Result.Description7,"");
|
||
strcpy(m_Result.Description8,"");
|
||
strcpy(m_Result.Description9,"");
|
||
strcpy(m_Result.Description10,"");
|
||
|
||
//m_Result.Result=LithOrder.value(pGeoItem->GetLith()).toInt();
|
||
|
||
m_Result.Sdep1=0;
|
||
m_Result.Edep1=0;
|
||
m_Result.Sdep2=0;
|
||
m_Result.Edep2=0;
|
||
m_Result.Sdep3=0;
|
||
m_Result.Edep3=0;
|
||
m_Result.Sdep4=0;
|
||
m_Result.Edep4=0;
|
||
m_Result.Sdep5=0;
|
||
m_Result.Edep5=0;
|
||
m_Result.Sdep6=0;
|
||
m_Result.Edep6=0;
|
||
m_Result.Sdep7=0;
|
||
m_Result.Edep7=0;
|
||
m_Result.Sdep8=0;
|
||
m_Result.Edep8=0;
|
||
m_Result.Sdep9=0;
|
||
m_Result.Edep9=0;
|
||
m_Result.Sdep10=0;
|
||
m_Result.Edep10=0;
|
||
m_Result.Order=i+1;
|
||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||
// if(!FieldName.isEmpty())
|
||
// {
|
||
// logio->SetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),(char*)pGeoItem->GetCharacters().toStdString().c_str(),j+1);
|
||
// }
|
||
//
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
}
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return true;
|
||
}
|
||
|
||
//保存固井结论道
|
||
bool QMyCustomPlot::SaveToSLF_Gujing()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
GUJING_DATA m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
bool isfirst=false;
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_Gujing.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4,
|
||
"NO,SDEP,EDEP,RESULT",
|
||
"4,4,4,4",//字段长度
|
||
"1,4,4,1",//字段类型
|
||
"0,0,0,2");//字段备注
|
||
isfirst=true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_Gujing.size());
|
||
//int j=0;
|
||
if(!m_mapDraggable_Gujing.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
TransparentDraggableGujing *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Gujing.begin(); iter != m_mapDraggable_Gujing.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableGujing*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Gujing.begin(); iter != m_mapDraggable_Gujing.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableGujing*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(GUJING_DATA));
|
||
m_Result.SDEP = -tmpRange.upper;
|
||
m_Result.EDEP = -tmpRange.lower;
|
||
m_Result.NO=i+1;
|
||
m_Result.RESULT=0;
|
||
QString innerresult=GetIntResult_Gujing(pDraggableRect->m_Result);
|
||
if(innerresult!="")
|
||
m_Result.RESULT=innerresult.toInt();
|
||
if(m_Result.RESULT<0) m_Result.RESULT=0;
|
||
//写入
|
||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return true;
|
||
}
|
||
|
||
//保存岩心图片
|
||
bool QMyCustomPlot::SaveToSLFImage()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
IMAGE_DATA m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
//QString ssss = m_strLineName.toStdString().c_str();
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
bool isfirst=false;
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_Image.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4,
|
||
"NO,SDEP,EDEP,RESULT",
|
||
"4,4,4,4",//字段长度
|
||
"1,4,4,1",//字段类型
|
||
"0,0,0,2");//字段备注
|
||
isfirst=true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_Image.size());
|
||
//int j=0;
|
||
if(!m_mapDraggable_Image.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
TransparentDraggableImage *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Image.begin(); iter != m_mapDraggable_Image.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableImage*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Image.begin(); iter != m_mapDraggable_Image.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableImage*)iter.value();
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(GUJING_DATA));
|
||
m_Result.StartDepth = -tmpRange.upper;
|
||
m_Result.EndDepth = -tmpRange.lower;
|
||
m_Result.Order=i+1;
|
||
// 拷贝字符串到数组,长度为数组长度-1(留1位存'\0'结束符)
|
||
strncpy(m_Result.Image, pDraggableRect->getMResult().toLocal8Bit().constData(), sizeof(m_Result.Image) - 1);
|
||
// 手动添加结束符(确保字符串合法)
|
||
m_Result.Image[sizeof(m_Result.Image) - 1] = '\0';
|
||
m_Result.Left = static_cast<float>(pDraggableRect->getLeft());
|
||
m_Result.Width = static_cast<float>(pDraggableRect->getWidth());
|
||
//写入
|
||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
|
||
// 写到slf文件
|
||
return true;
|
||
}
|
||
|
||
bool QMyCustomPlot::saveToSLFCorePhysics()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
Slf_CORE_PHYSICS m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
//QString ssss = m_strLineName.toStdString().c_str();
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
bool isfirst=false;
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_CorePhysics.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4,
|
||
"NO,SDEP,EDEP,RESULT",
|
||
"4,4,4,4",//字段长度
|
||
"1,4,4,1",//字段类型
|
||
"0,0,0,2");//字段备注
|
||
isfirst=true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_CorePhysics.size());
|
||
//int j=0;
|
||
if(!m_mapDraggable_CorePhysics.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
TransparentDraggableCorePhysics *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
|
||
//
|
||
// QCPRange tmpRange = pDraggableRect->m_right_Hight;
|
||
//
|
||
float fSDepth = -pDraggableRect->m_right_Hight;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
|
||
float fSDepth = -pDraggableRect->m_right_Hight;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(GUJING_DATA));
|
||
m_Result.Order = i + 1;
|
||
m_Result.CoreValue = -pDraggableRect->getCpCoreValue();
|
||
m_Result.Depth = -pDraggableRect->m_right_Hight;
|
||
m_Result.CorrDepth = -pDraggableRect->m_right_Hight;
|
||
//写入
|
||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
|
||
// 写到slf文件
|
||
return true;
|
||
}
|
||
|
||
QString QMyCustomPlot::GetIntResult_Gujing(QString result)
|
||
{
|
||
if(result=="") return "";
|
||
QFileInfo afile(result);
|
||
QString strBaseName = afile.completeBaseName();
|
||
|
||
return zoneOrder_Gujing.value(strBaseName);
|
||
}
|
||
|
||
//向左侧树图,追加固井结论表格
|
||
void QMyCustomPlot::AddTableToWellRound()
|
||
{
|
||
emit CallManage::getInstance()->sig_AddGujingToTree(m_strSlfName, m_strWellName, m_strLineName);
|
||
}
|
||
|
||
//增加井壁取心
|
||
void QMyCustomPlot::addItem_SWallCore()
|
||
{
|
||
QStringList liths;
|
||
QStringList oils;
|
||
QStringList colors;
|
||
QStringList colorinds;
|
||
|
||
QString cs=GetConfPath();
|
||
QString color;
|
||
for(int j=0;j<4;j++)
|
||
{
|
||
if(j==0) color=cs+"corecolor.ini";
|
||
else if(j==1) color=cs+"corelith.ini";
|
||
else if(j==2) color=cs+"coreoil.ini";
|
||
else color=cs+"colorind.ini";
|
||
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
||
QStringList ss;
|
||
char buf[100];
|
||
if(fp) {
|
||
while(!feof(fp)) {
|
||
fscanf(fp,"%s",buf);
|
||
ss.append(buf);
|
||
}
|
||
fclose(fp);
|
||
}
|
||
if(j==0) colors=ss;
|
||
else if(j==1) liths=ss;
|
||
else if(j==2) oils=ss;
|
||
else colorinds=ss;
|
||
}
|
||
|
||
QString LithologyImage="";
|
||
QString OilGasImage="";
|
||
QString ColorImage="";
|
||
|
||
int CoreLith=27;
|
||
int CoreOil=7;
|
||
int CoreColor=0;
|
||
if (liths.size()>=CoreLith)
|
||
{
|
||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".svg";
|
||
QDir ss(LithologyImage);
|
||
if(!ss.exists()) {
|
||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".png";
|
||
}
|
||
}
|
||
if (CoreOil>0&&oils.size()>=CoreOil)
|
||
{
|
||
OilGasImage=::GetGasSymbolDir()+""+oils[CoreOil-1]+".svg";
|
||
}
|
||
int ind=colorinds.indexOf(QString::number(CoreColor));
|
||
if (ind>-1&&ind<colors.size())
|
||
{
|
||
ColorImage=::GetColorSymbolDir()+""+colors[ind]+".svg";
|
||
}
|
||
|
||
float width = SideWallCoreWidth * g_dPixelPerCm;//1.2cm
|
||
float Sideleft = 0;
|
||
|
||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||
//添加井壁取心
|
||
addSwallCoreToPlot(right_Hight, LithologyImage, OilGasImage, ColorImage, Sideleft, width, CoreColor);
|
||
|
||
//保存
|
||
this->SaveToSLF_SwallCore();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//平移水平位置
|
||
void QMyCustomPlot::moveItems_SWallCore()
|
||
{
|
||
int num=m_mapDraggable_SwallCore.size();
|
||
if(num)
|
||
{
|
||
bool ok=0;
|
||
QString Formtiom=QInputDialog::getText(NULL,"水平位置移动","请输入移动量(1,2,3,4..)",QLineEdit::Normal,"",&ok);
|
||
if(!ok) return;
|
||
if(Formtiom.toFloat())
|
||
{
|
||
float dleft=Formtiom.toFloat();//厘米数
|
||
|
||
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_SwallCore.begin(); iter != m_mapDraggable_SwallCore.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableSwallCore*)iter.value();
|
||
pDraggableRect->m_fLeftSpace += dleft*g_dPixelPerCm;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//统一刷新
|
||
replot();
|
||
|
||
//保存
|
||
this->SaveToSLF_SwallCore();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
}
|
||
}
|
||
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::addItems_SWallCore()
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace("\t"," ");
|
||
originalText.replace(","," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
QStringList line=originalText.split("\n");
|
||
line.removeAll("");
|
||
for(int i=0;i<line.size();i++) {
|
||
QStringList coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||
|
||
AddItem_SWallCore(coredat);
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_SwallCore();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
void QMyCustomPlot::AddItem_SWallCore(QStringList lists)
|
||
{
|
||
if(lists.size()<2) return;
|
||
if(lists.size()<3) lists.insert(0,"0");
|
||
WALLCORE_DATA m_Result;
|
||
memset(&m_Result,0,sizeof(WALLCORE_DATA));
|
||
double top=-9999.0;
|
||
double bottom=-9999.0;
|
||
m_Result.Order=lists[0].toInt();
|
||
top=lists[1].toDouble();
|
||
bottom=top;
|
||
m_Result.Depth=top;
|
||
if(lists.size()>2) {
|
||
if(!lists[2].isEmpty()) {
|
||
if(lists[2].at(0).isDigit()) {
|
||
m_Result.CoreOil=lists[2].toDouble();
|
||
if(lists.size()>3) m_Result.CoreLith=lists[3].toDouble();
|
||
if(lists.size()>4) m_Result.CoreColor=lists[4].toDouble();
|
||
}
|
||
else {
|
||
for(int j=0;j<3;j++) {
|
||
QStringList ss;
|
||
if(j==0) ss=colors_SWallCore;
|
||
else if(j==1) ss=liths_SWallCore;
|
||
else ss=oils_SWallCore;
|
||
int len=0;
|
||
int len1=0;
|
||
int iid=0;
|
||
for(int i=0;i<ss.size();i++) {
|
||
if(lists[2].indexOf(ss[i])>-1) {
|
||
len1=strlen(ss[i].toStdString().c_str());
|
||
if(len<len1) {
|
||
len=len1;
|
||
iid=i;
|
||
}
|
||
}
|
||
}
|
||
if(len) {
|
||
if(j==0) {
|
||
if(iid>=0&&iid<colorinds_SWallCore.size()) m_Result.CoreColor=colorinds_SWallCore[iid].toInt();
|
||
else m_Result.CoreColor=0;
|
||
}
|
||
else if(j==1) m_Result.CoreLith=iid+1;
|
||
else m_Result.CoreOil=iid+1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if(top&&bottom==0) bottom=top;
|
||
|
||
if(m_Result.CoreLith<1) m_Result.CoreLith=1;
|
||
if(m_Result.CoreOil<1) m_Result.CoreOil=1;
|
||
if(m_Result.CoreColor<0) m_Result.CoreColor=0;
|
||
|
||
QString LithologyImage="";
|
||
QString OilGasImage="";
|
||
QString ColorImage="";
|
||
|
||
//
|
||
if(m_Result.CoreLith<1) {
|
||
LithologyImage="";
|
||
}
|
||
else if (liths_SWallCore.size()>=m_Result.CoreLith)
|
||
{
|
||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg";
|
||
QDir ss(LithologyImage);
|
||
if(!ss.exists()) {
|
||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png";
|
||
}
|
||
}
|
||
if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil)
|
||
{
|
||
OilGasImage=::GetGasSymbolDir()+""+oils_SWallCore[m_Result.CoreOil-1]+".svg";
|
||
}
|
||
else {
|
||
OilGasImage="";
|
||
}
|
||
int ind=colorinds_SWallCore.indexOf(QString::number(m_Result.CoreColor));
|
||
if (ind>-1&&ind<colors_SWallCore.size())
|
||
{
|
||
ColorImage=::GetColorSymbolDir()+""+colors_SWallCore[ind]+".svg";
|
||
}
|
||
else {
|
||
ColorImage="";
|
||
}
|
||
|
||
float width = 1;
|
||
float Sideleft = 0;
|
||
//增加井壁取心
|
||
addSwallCoreToPlot(-m_Result.Depth, LithologyImage, OilGasImage, ColorImage, Sideleft, width, m_Result.CoreColor);
|
||
}
|
||
|
||
//全部清空
|
||
void QMyCustomPlot::DeleteItems_SWallCore()
|
||
{
|
||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||
QString obj=m_strLineName + "BAK";
|
||
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
|
||
AddTableToWellRound();
|
||
|
||
//删除对象
|
||
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_SwallCore.begin();
|
||
while( it != m_mapDraggable_SwallCore.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableSwallCore*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//保存
|
||
SaveToSLF_SwallCore();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//全部清空
|
||
void QMyCustomPlot::DeleteItems_GeoLith()
|
||
{
|
||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||
QString obj=m_strLineName + "BAK";
|
||
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
|
||
AddTableToWellRound();
|
||
|
||
//删除对象
|
||
TransparentDraggableGeoLith *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
|
||
while( it != m_mapDraggable_GeoLith.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//保存
|
||
SaveToSLF_GeoLith();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::addItems_GeoLith()
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace("\t"," ");
|
||
originalText.replace(","," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
QStringList line=originalText.split("\n");
|
||
line.removeAll("");
|
||
for(int i=0;i<line.size();i++) {
|
||
QStringList coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||
|
||
//录井剖面
|
||
AddItem_GeoLith(coredat);
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_GeoLith();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
void QMyCustomPlot::AddItem_GeoLith(QStringList lists)
|
||
{
|
||
//初始化LithOrder
|
||
if(LithOrder.size()<=0)
|
||
{
|
||
LithOrder=GetZoneOrder(QString("GeoLith"));
|
||
}
|
||
if(OilOrder.size()<=0)
|
||
{
|
||
OilOrder=GetZoneOrder(QString("CoreOil"));
|
||
}
|
||
if(ColorOrder.size()<=0)
|
||
{
|
||
ColorOrder=GetZoneOrder(QString("CoreColor"));
|
||
}
|
||
if(ColorInds.size()<=0)
|
||
{
|
||
ColorInds=GetZoneOrder(QString("ColorInd"));
|
||
}
|
||
if(LithWidth.size()<=0)
|
||
{
|
||
QString configfile=::GetConfPath()+GetOilFieldName()+"LithWidth";
|
||
QDir ss1;
|
||
if(!ss1.exists(configfile+".txt")) configfile+=".ini";
|
||
else configfile+=".txt";
|
||
QStringList lines;
|
||
QFile file( configfile );
|
||
if ( file.open( QIODevice::ReadOnly ) ) {
|
||
QTextStream stream( &file );
|
||
QString line;
|
||
while ( !stream.atEnd() ) {
|
||
line = stream.readLine(); // 不包括“\n”的一行文本
|
||
lines += line;
|
||
}
|
||
file.close();
|
||
}
|
||
LithWidth=lines;
|
||
}
|
||
if(lists.size()<3) return;
|
||
if(lists.size()<4) lists.insert(0,"0");
|
||
GeoLith_DATA m_Result;
|
||
memset(&m_Result,0,sizeof(GeoLith_DATA));
|
||
double top=-9999.0;
|
||
double bottom=-9999.0;
|
||
m_Result.NO=lists[0].toInt();
|
||
top=(int)(lists[1].toDouble()*1000+0.5)/1000.0;
|
||
bottom=(int)(lists[2].toDouble()*1000+0.5)/1000.0;
|
||
m_Result.SDEP=top;
|
||
m_Result.EDEP=bottom;
|
||
m_Result.Oil=-1;
|
||
m_Result.Lith=325;
|
||
if(lists.size()>2) {
|
||
if(!lists[3].isEmpty()) {
|
||
if(lists[3].at(0).isDigit()||lists[3].at(0)=='.') {
|
||
m_Result.Oil=lists[3].toDouble();
|
||
if(lists.size()>4) m_Result.Lith=lists[4].toDouble();
|
||
}
|
||
else {
|
||
for(int j=0;j<3;j++) {
|
||
QMap<QString,QString> ss;
|
||
if(j==0) ss=LithOrder;
|
||
else if(j==1)ss=OilOrder;
|
||
else ss=ColorOrder;
|
||
int len=0;
|
||
int len1=0;
|
||
int iid=-1;
|
||
QString key,value;
|
||
for(int i=0;i<ss.size();i++) {
|
||
key=ss.key(QString::number(i+1));
|
||
value=lists[3];
|
||
if(!key.isEmpty()&&value.indexOf(key)>-1) {
|
||
len1=strlen(key.toStdString().c_str());
|
||
if(len<len1) {
|
||
len=len1;
|
||
iid=i;
|
||
}
|
||
}
|
||
}
|
||
if(len) {
|
||
if(j==0) m_Result.Lith=iid+1;
|
||
else if(j==1) m_Result.Oil=iid+1;
|
||
else {
|
||
if(iid>=0&&iid<ColorInds.size()) m_Result.Color=ColorInds.key(QString::number(iid+1)).toInt();
|
||
else m_Result.Color=0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if(top==0&&bottom==0) return;
|
||
if(bottom<top) {
|
||
return;
|
||
}
|
||
|
||
//----------
|
||
QString iconshotname="";
|
||
QString IntLith = QString::number(m_Result.Lith);
|
||
if(IntLith=="0") {
|
||
iconshotname="";
|
||
}
|
||
else
|
||
{
|
||
iconshotname=LithOrder.key(IntLith);
|
||
}
|
||
|
||
//
|
||
QString Lith = "";
|
||
if(iconshotname!="")
|
||
Lith=::GetMudSymbolDir()+""+iconshotname+".svg";
|
||
int len=2;
|
||
int pos=Lith.indexOf(".//");
|
||
if(pos<0) pos=Lith.indexOf("./");
|
||
else len=3;
|
||
QString svg;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=Lith.mid(len-1);
|
||
}
|
||
else svg=Lith;
|
||
QDir ss;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
Lith=svg;
|
||
|
||
//
|
||
QString Oil = "";
|
||
iconshotname=OilOrder.key(QString::number(m_Result.Oil));
|
||
if(iconshotname!="")
|
||
Oil=::GetGasSymbolDir()+""+iconshotname+".svg";
|
||
len=2;
|
||
pos=Oil.indexOf(".//");
|
||
if(pos<0) pos=Oil.indexOf("./");
|
||
else len=3;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=Oil.mid(len-1);
|
||
}
|
||
else svg=Oil;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
Oil=svg;
|
||
|
||
//
|
||
QString Color = "";
|
||
int ind=ColorInds.value(QString::number(m_Result.Color)).toInt();
|
||
if (ind>-1&&ind<ColorOrder.size())
|
||
{
|
||
Color=::GetColorSymbolDir()+""+ColorOrder.key(QString::number(ind))+".svg";
|
||
}
|
||
else {
|
||
Color=::GetColorSymbolDir()+"空白.svg";
|
||
}
|
||
|
||
//
|
||
this->addGeoLithToPlot(-m_Result.EDEP, -m_Result.SDEP, Lith, Oil, Color);
|
||
}
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_GeoLith(QString strSlfName, QString strLineName)
|
||
{
|
||
//
|
||
LithOrder.clear();
|
||
OilOrder.clear();
|
||
ColorOrder.clear();
|
||
ColorInds.clear();
|
||
LithOrder=GetZoneOrder(QString("GeoLith"));
|
||
OilOrder=GetZoneOrder(QString("CoreOil"));
|
||
ColorOrder=GetZoneOrder(QString("CoreColor"));
|
||
ColorInds=GetZoneOrder(QString("ColorInd"));
|
||
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
return false;
|
||
}
|
||
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
||
if(iIndex>-1) {
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
int sl=sizeof(GeoLith_DATA);
|
||
if(sl>len) len=sl;
|
||
GeoLith_DATA *m_Result;
|
||
m_Result=(GeoLith_DATA *)new char[len+1];
|
||
int count=logio->GetTableRecordCount(iIndex);
|
||
for(int i=0;i<count;i++) {
|
||
memset(m_Result,0,len);
|
||
logio->ReadTable(iIndex,i+1,m_Result);
|
||
|
||
QString iconshotname="";
|
||
QString IntLith = QString::number(m_Result->Lith);
|
||
if(IntLith=="0") {
|
||
iconshotname="";
|
||
}
|
||
else
|
||
{
|
||
iconshotname=LithOrder.key(IntLith);
|
||
}
|
||
|
||
//
|
||
QString Lith = "";
|
||
if(iconshotname!="")
|
||
Lith=::GetMudSymbolDir()+""+iconshotname+".svg";
|
||
int len=2;
|
||
int pos=Lith.indexOf(".//");
|
||
if(pos<0) pos=Lith.indexOf("./");
|
||
else len=3;
|
||
QString svg;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=Lith.mid(len-1);
|
||
}
|
||
else svg=Lith;
|
||
QDir ss;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
Lith=svg;
|
||
|
||
//
|
||
QString Oil = "";
|
||
iconshotname=OilOrder.key(QString::number(m_Result->Oil));
|
||
if(iconshotname!="")
|
||
Oil=::GetGasSymbolDir()+""+iconshotname+".svg";
|
||
len=2;
|
||
pos=Oil.indexOf(".//");
|
||
if(pos<0) pos=Oil.indexOf("./");
|
||
else len=3;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=Oil.mid(len-1);
|
||
}
|
||
else svg=Oil;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
Oil=svg;
|
||
|
||
//
|
||
QString Color = "";
|
||
int ind=ColorInds.value(QString::number(m_Result->Color)).toInt();
|
||
if (ind>-1&&ind<ColorOrder.size())
|
||
{
|
||
Color=::GetColorSymbolDir()+""+ColorOrder.key(QString::number(ind))+".svg";
|
||
}
|
||
else {
|
||
Color=::GetColorSymbolDir()+"空白.svg";
|
||
}
|
||
|
||
//不单独刷新
|
||
bool bRefresh = false;//true;
|
||
this->addGeoLithToPlot(-m_Result->EDEP, -m_Result->SDEP, Lith, Oil, Color, bRefresh);
|
||
}
|
||
//最后统一刷新
|
||
this->replot();
|
||
|
||
logio->CloseTable(iIndex);
|
||
delete m_Result;
|
||
}
|
||
delete logio;
|
||
return true;
|
||
}
|
||
|
||
//刷新数据
|
||
void QMyCustomPlot::RefreshItems_SWallCore()
|
||
{
|
||
//删除对象
|
||
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_SwallCore.begin();
|
||
while( it != m_mapDraggable_SwallCore.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableSwallCore*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
LoadFromSLF_SwallCore(m_strSlfName, m_strLineName);
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//刷新数据
|
||
void QMyCustomPlot::RefreshItems_GeoLith()
|
||
{
|
||
//删除对象
|
||
TransparentDraggableGeoLith *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
|
||
while( it != m_mapDraggable_GeoLith.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
LoadFromSLF_GeoLith(m_strSlfName, m_strLineName);
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineName)
|
||
{
|
||
WALLCORE_DATA m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return false;
|
||
}
|
||
|
||
//清空
|
||
liths_SWallCore.clear();
|
||
oils_SWallCore.clear();
|
||
colors_SWallCore.clear();
|
||
colorinds_SWallCore.clear();
|
||
|
||
QString cs=GetConfPath();
|
||
QString color;
|
||
for(int j=0;j<4;j++)
|
||
{
|
||
if(j==0) color=cs+"corecolor.ini";
|
||
else if(j==1) color=cs+"corelith.ini";
|
||
else if(j==2) color=cs+"coreoil.ini";
|
||
else color=cs+"colorind.ini";
|
||
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
||
QStringList ss;
|
||
char buf[100];
|
||
if(fp) {
|
||
while(!feof(fp)) {
|
||
fscanf(fp,"%s",buf);
|
||
ss.append(buf);
|
||
}
|
||
fclose(fp);
|
||
}
|
||
if(j==0) colors_SWallCore=ss;
|
||
else if(j==1) liths_SWallCore=ss;
|
||
else if(j==2) oils_SWallCore=ss;
|
||
else colorinds_SWallCore=ss;
|
||
}
|
||
|
||
//
|
||
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
||
if(iIndex>-1) {
|
||
int count=logio->GetTableRecordCount(iIndex);
|
||
for(int i=0;i<count;i++) {
|
||
memset(&m_Result,0,sizeof(WALLCORE_DATA));
|
||
logio->ReadTable(iIndex,i+1,&m_Result);
|
||
double top=m_Result.Depth;
|
||
double bottom=m_Result.Depth;
|
||
|
||
QString LithologyImage="";
|
||
QString OilGasImage="";
|
||
QString ColorImage="";
|
||
|
||
//
|
||
if(m_Result.CoreLith<1) {
|
||
LithologyImage="";
|
||
}
|
||
else if (liths_SWallCore.size()>=m_Result.CoreLith)
|
||
{
|
||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg";
|
||
QDir ss(LithologyImage);
|
||
if(!ss.exists()) {
|
||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png";
|
||
}
|
||
}
|
||
if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil)
|
||
{
|
||
OilGasImage=::GetGasSymbolDir()+""+oils_SWallCore[m_Result.CoreOil-1]+".svg";
|
||
}
|
||
else {
|
||
OilGasImage="";
|
||
}
|
||
int ind=colorinds_SWallCore.indexOf(QString::number(m_Result.CoreColor));
|
||
if (ind>-1&&ind<colors_SWallCore.size())
|
||
{
|
||
ColorImage=::GetColorSymbolDir()+""+colors_SWallCore[ind]+".svg";
|
||
}
|
||
else {
|
||
ColorImage="";
|
||
}
|
||
float depth = m_Result.Depth;
|
||
float width = 1;
|
||
float Sideleft = m_Result.left;
|
||
if(m_Result.width<=0)
|
||
{
|
||
width = 1;
|
||
}
|
||
else
|
||
{
|
||
width = m_Result.width;
|
||
}
|
||
if(Sideleft<0) Sideleft=0;
|
||
if(width<=0) width=1;
|
||
|
||
//
|
||
addSwallCoreToPlot(-m_Result.Depth, LithologyImage, OilGasImage, ColorImage, Sideleft, width, m_Result.CoreColor, false);
|
||
}
|
||
//统一刷新
|
||
this->replot();
|
||
logio->CloseTable(iIndex);
|
||
}
|
||
delete logio;
|
||
return true;
|
||
}
|
||
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::addItems_Core()
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace(","," ");
|
||
originalText.replace("\t"," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
|
||
QStringList line=originalText.split("\n");
|
||
QString ss=m_strSlfName;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return;
|
||
}
|
||
bool isfirst=false;
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if(iIndex<=0){
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","缺失表"+m_strLineName+",请检查!!",QMessageBox::Yes);
|
||
return;
|
||
}
|
||
|
||
int k=0;
|
||
for(int i=0;i<line.size();i++) {
|
||
QStringList coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(coredat[0].isEmpty()) continue;
|
||
if(!i) {
|
||
if(coredat.size()<4){
|
||
QMessageBox::information(NULL,"提示","字段数不能小于4个!\nNO DEPTH CURRDEPTH AC DEN ...\n1 2200 220.1 350 2.3\n2 2202 2202.2 340 25.0\n");
|
||
delete logio;
|
||
if(isfirst)this->AddTableToWellRound();
|
||
return;
|
||
}
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit())
|
||
{
|
||
if(iIndex>=0) {
|
||
int count=logio->GetTableFieldCount(iIndex);
|
||
if(count!=coredat.size()) {
|
||
logio->DiscardObject(m_strLineName.toStdString().c_str());
|
||
}
|
||
iIndex=-1;
|
||
}
|
||
if (iIndex < 0)
|
||
{
|
||
QString Names=coredat.join(",");
|
||
Names=Names.toUpper();
|
||
QString types="1";
|
||
for(int i=0;i<coredat.size()-1;i++) types+=",4";
|
||
QString lengs="4";
|
||
for(int i=0;i<coredat.size()-1;i++) lengs+=",4";
|
||
QString ress="0";
|
||
for(int i=0;i<coredat.size()-1;i++) ress+=",0";
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),CORE_PHYSICS_OBJECT,coredat.size(),
|
||
(char*)Names.toStdString().c_str(),
|
||
(char*)lengs.toStdString().c_str(),//字段长度
|
||
(char*)types.toStdString().c_str(),//字段类型
|
||
(char*)ress.toStdString().c_str());//字段备注,1-枚举
|
||
//if(coredat.indexOf(CoreObj->GetFieldName())==-1) CoreObj->SetFieldName(coredat.at(3));
|
||
isfirst=true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,0);
|
||
//if(CoreObj->GetFieldName().isEmpty()||coredat.indexOf(CoreObj->GetFieldName())<0) CoreObj->SetFieldName(coredat[3]);
|
||
continue;
|
||
}
|
||
else {
|
||
QMessageBox::information(NULL,"提示", "首行必须是表头!如:\nNO,DEPTH,...");
|
||
delete logio;
|
||
if(isfirst)this->AddTableToWellRound();
|
||
return;
|
||
}
|
||
}
|
||
else {
|
||
//
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||
for(int j=0;j<coredat.size();j++)
|
||
{
|
||
float yy=coredat[j].toFloat();
|
||
logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
|
||
}
|
||
k++;
|
||
}
|
||
}
|
||
delete logio;
|
||
if(isfirst)this->AddTableToWellRound();
|
||
|
||
// //保存
|
||
// this->SaveToSLF_SwallCore();
|
||
// //属性清空
|
||
// PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::addItems_Gujing()
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace(","," ");
|
||
originalText.replace("\t"," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
QStringList line=originalText.split("\n");
|
||
QStringList old;
|
||
for(int i=0;i<line.size();i++) {
|
||
QStringList coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||
if(coredat.size()<3) {
|
||
if(old.size()<1) {
|
||
old=coredat;
|
||
continue;
|
||
}
|
||
else {
|
||
QStringList cs;
|
||
cs.append(old[0]);
|
||
cs.append(old[1]);
|
||
cs.append(coredat[1]);
|
||
// cs.append(old[2]);
|
||
old=coredat;
|
||
coredat=cs;
|
||
}
|
||
}
|
||
//添加固井结论
|
||
int NO = coredat[0].toInt();
|
||
float SDEP = coredat[1].toDouble();
|
||
float EDEP = coredat[2].toDouble();
|
||
int iRESULT = 0;
|
||
QString result = "";
|
||
if(coredat.size()>3) {
|
||
if(coredat[3].at(0).isDigit()) {
|
||
iRESULT = coredat[3].toInt();
|
||
QString iconshotname=zoneOrder_Gujing.key(QString::number(iRESULT));
|
||
if(iconshotname!="")
|
||
result=::GetGujingSymbolDir()+iconshotname+".svg";
|
||
}
|
||
else
|
||
{
|
||
QStringList vals=zoneOrder_Gujing.keys();
|
||
coredat[3].trimmed();
|
||
int j=vals.indexOf(coredat[3]);
|
||
if(j>-1) {
|
||
result=::GetGujingSymbolDir()+vals[j]+".svg";
|
||
}
|
||
}
|
||
}
|
||
|
||
//
|
||
int len=2;
|
||
int pos=result.indexOf(".//");
|
||
if(pos<0) pos=result.indexOf("./");
|
||
else len=3;
|
||
QString svg;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=result.mid(len-1);
|
||
}
|
||
else svg=result;
|
||
QDir ss;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
result=QDir::toNativeSeparators(svg);
|
||
|
||
//显示固井
|
||
addGujingToPlot(-EDEP, -SDEP, result);
|
||
}
|
||
//保存
|
||
this->SaveToSLF_Gujing();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//取消选中
|
||
void QMyCustomPlot::ClearSelectItems()
|
||
{
|
||
if (m_strLineName == "RESULT")
|
||
{
|
||
QMap<double, TransparentGroupResult*> mapsort = this->getSelectGroupResult();
|
||
QList<TransparentGroupResult*> listGroup = mapsort.values();
|
||
for (int i = 0; i < listGroup.size(); i++)
|
||
{
|
||
TransparentGroupResult* pGroup = listGroup.at(i);
|
||
if (pGroup == NULL)
|
||
continue;
|
||
pGroup->setSelectRect(false);
|
||
}
|
||
}
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//全部清空
|
||
void QMyCustomPlot::DeleteItems_Gujing()
|
||
{
|
||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||
QString obj=m_strLineName + "BAK";
|
||
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
|
||
AddTableToWellRound();
|
||
|
||
//删除对象
|
||
TransparentDraggableGujing *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Gujing.begin();
|
||
while( it != m_mapDraggable_Gujing.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGujing*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_Gujing();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//刷新数据
|
||
void QMyCustomPlot::RefreshItems_Gujing()
|
||
{
|
||
//删除对象
|
||
TransparentDraggableGujing *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Gujing.begin();
|
||
while( it != m_mapDraggable_Gujing.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGujing*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
LoadFromSLF_Gujing(m_strSlfName, m_strLineName);
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//合并结论
|
||
void QMyCustomPlot::MegResult_Gujing()
|
||
{
|
||
typedef struct ss_struct{
|
||
int NO;
|
||
float SDEP,EDEP;
|
||
int RESULT;
|
||
} GUJING;
|
||
CMemRdWt *MemRdWt=new CMemRdWt();
|
||
if(!MemRdWt->Open(m_strSlfName.toStdString().c_str(),CMemRdWt::modeReadWrite)) {
|
||
delete MemRdWt;
|
||
return;
|
||
}
|
||
int itable2=MemRdWt->OpenOG_RESULT(m_strLineName.toStdString().c_str());
|
||
if(itable2<1) {
|
||
delete MemRdWt;
|
||
return;
|
||
}
|
||
GUJING *pg1=NULL;
|
||
GUJING *pgb=NULL;
|
||
int rec1=0;
|
||
int j=0;
|
||
int jj=0;
|
||
|
||
////////////////////////////////////////////
|
||
rec1=MemRdWt->GetTableRecordCount(itable2);
|
||
if(rec1<=0) {
|
||
QMessageBox::information(NULL,"提示","没有数据,终止运行!");
|
||
return;
|
||
}
|
||
pg1=new GUJING[rec1];
|
||
pgb=new GUJING[rec1];
|
||
for(j=0;j<rec1;j++) {
|
||
MemRdWt->ReadTable(itable2,j+1,&pg1[j]);
|
||
}
|
||
jj=0;
|
||
for(j=0;j<rec1;j++) {
|
||
if(j!=0&&pg1[j].EDEP-pg1[j].SDEP<0.2) {
|
||
pgb[jj-1].EDEP=pg1[j].EDEP;
|
||
}
|
||
else {
|
||
memmove((char *)&pgb[jj],(char *)&pg1[j],sizeof(GUJING));
|
||
jj++;
|
||
}
|
||
}
|
||
rec1=jj;
|
||
jj=0;
|
||
for(j=1;j<rec1;j++) {
|
||
if(pgb[j].RESULT==pgb[jj].RESULT) {
|
||
pgb[jj].EDEP=pgb[j].EDEP;
|
||
pgb[j].RESULT=-1;
|
||
}
|
||
else {
|
||
jj=j;
|
||
}
|
||
}
|
||
MemRdWt->SetTableRecordCount(itable2,0);
|
||
jj=0;
|
||
for(j=0;j<rec1;j++) {
|
||
if(pgb[j].RESULT!=-1) {
|
||
pgb[j].NO=jj;
|
||
MemRdWt->WriteTable(itable2,jj+1,&pgb[j]);
|
||
jj++;
|
||
}
|
||
}
|
||
|
||
delete pg1;
|
||
delete pgb;
|
||
delete MemRdWt;
|
||
|
||
//刷新数据
|
||
RefreshItems_Gujing();
|
||
}
|
||
|
||
//加载固井slf数据
|
||
bool QMyCustomPlot::LoadFromSLF_Gujing(QString strSlfName, QString strLineName)
|
||
{
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return false;
|
||
}
|
||
|
||
QString configfile=GetConfPath()+GetOilFieldName()+"GujingOrder.ini";
|
||
QStringList lines;
|
||
QFile file( configfile );
|
||
if ( file.open( QIODevice::ReadOnly ) ) {
|
||
QTextStream stream( &file );
|
||
stream.setCodec("UTF-8"); // 设置UTF-8编码
|
||
QString line;
|
||
int n = 1;
|
||
while ( !stream.atEnd() ) {
|
||
line = stream.readLine(); // 不包括“\n”的一行文本
|
||
lines += line;
|
||
}
|
||
file.close();
|
||
}
|
||
|
||
//QMap<QString,QString> zoneOrder;
|
||
for(int i=0;i<lines.size();i++){
|
||
zoneOrder_Gujing.insert(lines[i],QString::number(i));
|
||
}
|
||
|
||
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
||
if(iIndex>-1) {
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
int sl=sizeof(GUJING_DATA);
|
||
if(sl>len) len=sl;
|
||
GUJING_DATA *m_Result;
|
||
m_Result=(GUJING_DATA *)new char[len+1];
|
||
int count=logio->GetTableRecordCount(iIndex);
|
||
for(int i=0;i<count;i++) {
|
||
memset(m_Result,0,len);
|
||
logio->ReadTable(iIndex,i+1,m_Result);
|
||
|
||
int NO = m_Result->NO;
|
||
float SDEP = m_Result->SDEP;
|
||
float EDEP = m_Result->EDEP;
|
||
int iRESULT = m_Result->RESULT;
|
||
QString result = "";
|
||
|
||
//
|
||
QString iconshotname=zoneOrder_Gujing.key(QString::number(m_Result->RESULT));
|
||
if(iconshotname!="")
|
||
result=::GetGujingSymbolDir()+iconshotname+".svg";
|
||
int len=2;
|
||
int pos=result.indexOf(".//");
|
||
if(pos<0) pos=result.indexOf("./");
|
||
else len=3;
|
||
QString svg;
|
||
if(pos==0)
|
||
{
|
||
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||
svg+=result.mid(len-1);
|
||
}
|
||
else svg=result;
|
||
QDir ss;
|
||
if(!ss.exists(svg))
|
||
{
|
||
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||
svg=path+"png";
|
||
}
|
||
result=QDir::toNativeSeparators(svg);
|
||
|
||
//显示固井
|
||
addGujingToPlot(-EDEP, -SDEP, result, false);
|
||
}
|
||
//统一刷新
|
||
this->replot();
|
||
logio->CloseTable(iIndex);
|
||
delete m_Result;
|
||
}
|
||
delete logio;
|
||
return true;
|
||
}
|
||
|
||
bool QMyCustomPlot::CopyToSLFFile(QString targetSLFFileName, bool deleteFromSrc, char*newCurveName)
|
||
{
|
||
if(m_strSlfName=="") return false;
|
||
CLogIO a_cslfio;
|
||
CLogIO * logio=new CLogIO();
|
||
if(!logio->Open(targetSLFFileName.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
//AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败,请检查!");
|
||
return false;
|
||
};
|
||
if(!a_cslfio.Open(m_strSlfName.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
//AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败,请检查!");
|
||
delete logio;
|
||
return false;
|
||
};
|
||
char* curvename=new char[65];
|
||
curvename[64]='\0';
|
||
strcpy(curvename, m_strLineName.toStdString().c_str());
|
||
if(newCurveName) logio->CopyFromFile(a_cslfio, curvename, newCurveName);
|
||
else logio->CopyFromFile(a_cslfio,curvename);
|
||
delete[] curvename;
|
||
delete logio;
|
||
return true;
|
||
}
|
||
|
||
void QMyCustomPlot::onAddRect()
|
||
{
|
||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||
double left_Low = right_Hight-5;
|
||
//添加图形
|
||
//emit CallManage::getInstance()->sig_addImageToPlot(this, left_Low, right_Hight, ":/image/file.png");
|
||
addImageToPlot(left_Low, right_Hight, ":/image/file.png");
|
||
|
||
}
|
||
|
||
void QMyCustomPlot::addImageToPlot(double left_Low, double right_Hight, const QString imagePath)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableImage *dragRect = new TransparentDraggableImage(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setResult(imagePath);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_Image[strUuid] = dragRect;
|
||
}
|
||
|
||
void QMyCustomPlot::addImageToPlot(double left_Low, double right_Hight, const QString imagePath,
|
||
double left, double width)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableImage *dragRect = new TransparentDraggableImage(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setResult(imagePath);
|
||
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setTitle(strText);
|
||
dragRect->setLeft(left);
|
||
dragRect->setWidth(width);
|
||
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight,left,width);
|
||
|
||
m_mapDraggable_Image[strUuid] = dragRect;
|
||
}
|
||
|
||
void QMyCustomPlot::addImageToPlot(double left_Low, double right_Hight, const QString imagePath,
|
||
double left, double width, QColor borderColor, Qt::PenStyle borderStyle, int borderWidth)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableImage *dragRect = new TransparentDraggableImage(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setResult(imagePath);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight,left,width);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setTitle(strText);
|
||
dragRect->setLeft(left);
|
||
dragRect->setWidth(width);
|
||
|
||
m_mapDraggable_Image[strUuid] = dragRect;
|
||
}
|
||
|
||
void QMyCustomPlot::addSelectRectToPlot(double left_Low, double right_Hight, int left_Low_Number, int right_Hight_Number)
|
||
{
|
||
//qDebug() << "QMyCustomPlot addSelectRectToPlot";
|
||
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableSelectRect *dragRect = new TransparentDraggableSelectRect(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setNumber(left_Low_Number, right_Hight_Number);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_SelectRect[strUuid] = dragRect;
|
||
}
|
||
|
||
//预览
|
||
void QMyCustomPlot::addRightListToPlot( QList<double> new_DepthList, QList<double> new_ValueListt)
|
||
{
|
||
//qDebug() << "QMyCustomPlot addSelectRectToPlot";
|
||
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableRightList *dragRect = new TransparentDraggableRightList(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setRightList(new_DepthList, new_ValueListt);
|
||
// 设置初始范围
|
||
dragRect->setRange(new_DepthList[new_DepthList.size()-1], new_DepthList[0]);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_RightList[strUuid] = dragRect;
|
||
}
|
||
|
||
//校深线段
|
||
void QMyCustomPlot::s_AddShifLineToPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
addLineToPlot(left_Low, right_Hight, "");
|
||
}
|
||
|
||
//清除当前分段线
|
||
void QMyCustomPlot::s_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(m_SelectShiftLine)
|
||
{
|
||
TransparentDraggableLine *pDraggableLine = (TransparentDraggableLine *)m_SelectShiftLine;
|
||
pDraggableLine->deleteRect();
|
||
}
|
||
}
|
||
|
||
//清除全部分段线
|
||
void QMyCustomPlot::s_DelAllShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
TransparentDraggableLine *pDraggableLine =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Line.begin();
|
||
while( it != m_mapDraggable_Line.end() )
|
||
{
|
||
pDraggableLine = (TransparentDraggableLine*)it.value();
|
||
it++;
|
||
pDraggableLine->deleteRect();
|
||
}
|
||
}
|
||
|
||
//执行校正
|
||
void QMyCustomPlot::s_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
QList<double> left_Low_List;
|
||
QList<double> right_Hight_List;
|
||
|
||
TransparentDraggableLine *pDraggableLine =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Line.begin();
|
||
while( it != m_mapDraggable_Line.end() )
|
||
{
|
||
pDraggableLine = (TransparentDraggableLine*)it.value();
|
||
left_Low_List.append(0-pDraggableLine->m_left_Low);
|
||
right_Hight_List.append(0-pDraggableLine->m_right_Hight);
|
||
|
||
//
|
||
it++;
|
||
}
|
||
|
||
if(left_Low_List.size()<=0)
|
||
{
|
||
QMessageBox::warning(nullptr, "提示", "无校正深度线或深度移动量!");
|
||
return;
|
||
}
|
||
|
||
//执行校正
|
||
emit CallManage::getInstance()->sig_Runcor_List(m_strUuid, left_Low_List, right_Hight_List);
|
||
}
|
||
|
||
//执行拼接
|
||
void QMyCustomPlot::s_MergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
QList<double> left_Low_List;
|
||
QList<double> right_Hight_List;
|
||
|
||
TransparentDraggableLine *pDraggableLine =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Line.begin();
|
||
while( it != m_mapDraggable_Line.end() )
|
||
{
|
||
pDraggableLine = (TransparentDraggableLine*)it.value();
|
||
left_Low_List.append(0-pDraggableLine->m_left_Low);
|
||
right_Hight_List.append(0-pDraggableLine->m_right_Hight);
|
||
|
||
//
|
||
it++;
|
||
}
|
||
|
||
if(left_Low_List.size()<=0)
|
||
{
|
||
QMessageBox::warning(nullptr, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。");
|
||
return;
|
||
}
|
||
|
||
//执行拼接
|
||
emit CallManage::getInstance()->sig_Merge_List(m_strUuid, left_Low_List, right_Hight_List);
|
||
}
|
||
|
||
//关闭预览框
|
||
void QMyCustomPlot::s_PreMerge_Close(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
TransparentDraggableRightList *pDraggableRect =NULL;
|
||
{
|
||
QMap<QString,QObject *>::Iterator it = this->m_mapDraggable_RightList.begin();
|
||
if( it != this->m_mapDraggable_RightList.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableRightList*)it.value();
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::s_PreMerge_FromRightList(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList<double> new_DepthList, QList<double> new_ValueList)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
//预览
|
||
addRightListToPlot(new_DepthList, new_ValueList);
|
||
}
|
||
|
||
//执行预览
|
||
void QMyCustomPlot::s_PreMergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
QList<double> left_Low_List;
|
||
QList<double> right_Hight_List;
|
||
|
||
TransparentDraggableLine *pDraggableLine =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Line.begin();
|
||
while( it != m_mapDraggable_Line.end() )
|
||
{
|
||
pDraggableLine = (TransparentDraggableLine*)it.value();
|
||
left_Low_List.append(0-pDraggableLine->m_left_Low);
|
||
right_Hight_List.append(0-pDraggableLine->m_right_Hight);
|
||
|
||
//
|
||
it++;
|
||
}
|
||
|
||
if(left_Low_List.size()<=0)
|
||
{
|
||
QMessageBox::warning(nullptr, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。");
|
||
return;
|
||
}
|
||
|
||
//执行预览
|
||
emit CallManage::getInstance()->sig_PreMerge_List(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, left_Low_List, right_Hight_List);
|
||
}
|
||
|
||
//Plot重新加载数据
|
||
void QMyCustomPlot::s_ReloadPlot(QString strUuid, QString strSlfName, QString strLineName)
|
||
{
|
||
if(m_strSlfName == strSlfName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
//读取slf
|
||
CLogIO *logio=new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||
//
|
||
int index=logio->OpenCurve(strLineName.toStdString().c_str());
|
||
if(index<0) {
|
||
delete logio;
|
||
return;
|
||
}
|
||
|
||
Slf_CURVE curveinfo;
|
||
float *val;
|
||
DWORD count;
|
||
float sdep,edep,rlev;
|
||
//
|
||
logio->GetCurveInfo(index,&curveinfo);
|
||
sdep=curveinfo.StartDepth;
|
||
edep=curveinfo.EndDepth;
|
||
rlev=curveinfo.DepLevel;
|
||
//
|
||
count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||
val=new float[count];
|
||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||
logio->CloseCurve(index);
|
||
delete logio;
|
||
|
||
//slf文件读取曲线
|
||
QVector<double> x, y;
|
||
for(int i=0; i<count; i++)
|
||
{
|
||
x.append(-(sdep+ rlev*i));
|
||
y.append(val[i]);
|
||
}
|
||
|
||
//先清空
|
||
m_x.clear();
|
||
m_y.clear();
|
||
//
|
||
m_x.append(x);
|
||
m_y.append(y);
|
||
|
||
graph(0)->data()->clear();
|
||
graph(0)->setData(m_x, m_y);
|
||
replot(QCustomPlot::rpQueuedReplot); //刷新曲线
|
||
}
|
||
|
||
void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
||
{
|
||
QString strUuid = vlist.at(0).toString();
|
||
QString strSlfName = vlist.at(1).toString();
|
||
QString strWellName = vlist.at(2).toString();
|
||
QString strTrackName = vlist.at(3).toString();
|
||
QString strLineName = vlist.at(4).toString();
|
||
|
||
if (m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
QString strProperty = vlist.at(5).toString();
|
||
QVariant varVal = vlist.at(6).toString();
|
||
if ("类型" == strProperty)
|
||
{
|
||
m_nDrawType = varVal.toInt();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("绘制波深度" == strProperty)
|
||
{
|
||
m_bDrawDepth = varVal.toBool();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("绘制波基线" == strProperty)
|
||
{
|
||
m_bDrawBase = varVal.toBool();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("奇偶配色" == strProperty)
|
||
{
|
||
m_bOddEven = varVal.toBool();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("波列基值" == strProperty)
|
||
{
|
||
m_Base = varVal.toFloat();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("波形间隔" == strProperty)
|
||
{
|
||
m_nWaveJg = varVal.toInt();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("波形高度" == strProperty)
|
||
{
|
||
m_nWaveHei = varVal.toInt();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("颜色" == strProperty)
|
||
{
|
||
m_newColor = varVal.value<QColor>();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("方式" == strProperty)
|
||
{
|
||
m_nMode = varVal.toFloat();
|
||
this->updateWave();
|
||
}
|
||
else if ("左刻度" == strProperty)
|
||
{
|
||
|
||
}
|
||
else if ("右刻度" == strProperty)
|
||
{
|
||
if (m_colorMap)
|
||
{
|
||
m_fScaleV = varVal.toFloat();
|
||
float f = 264 / m_fScaleV;
|
||
m_colorMap->data()->setValueRange(QCPRange(m_fmin, m_fmax*f));
|
||
}
|
||
}
|
||
else if ("最大振幅" == strProperty)
|
||
{
|
||
m_MaxRange = varVal.toDouble();
|
||
this->changePropertyWaveUpdate();
|
||
}
|
||
else if ("色板" == strProperty)
|
||
{
|
||
this->setSchemeIndex(varVal.toInt(), m_nColorNum);
|
||
}
|
||
else if ("变密度颜色级数" == strProperty)
|
||
{
|
||
this->setSchemeIndex(m_nSchemeIndex, varVal.toInt());
|
||
}
|
||
else if ("结论占比%" == strProperty)
|
||
{
|
||
this->setShowProperty(varVal, 1);
|
||
}
|
||
else if ("显示位置(cm)" == strProperty)
|
||
{
|
||
this->setShowProperty(varVal, 2);
|
||
}
|
||
else if ("显示层号" == strProperty)
|
||
{
|
||
this->setShowProperty(varVal, 3);
|
||
}
|
||
else if ("层号字体" == strProperty)
|
||
{
|
||
this->setShowProperty(varVal, 4);
|
||
}
|
||
else if ("层号旋转" == strProperty)
|
||
{
|
||
this->setShowProperty(varVal, 5);
|
||
}
|
||
this->replot();
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist)
|
||
{
|
||
|
||
|
||
QString strUuid = vlist.at(0).toString();
|
||
QString strSlfName = vlist.at(1).toString();
|
||
QString strWellName = vlist.at(2).toString();
|
||
QString strTrackName = vlist.at(3).toString();
|
||
QString strLineName = vlist.at(4).toString();
|
||
|
||
if (m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
QString strProperty = vlist.at(5).toString();
|
||
QVariant varVal = vlist.at(6).toString();
|
||
if ("标尺颜色" == strProperty)
|
||
{
|
||
QColor newColor = varVal.value<QColor>();
|
||
this->yAxis->setTickLabelColor(newColor);
|
||
}
|
||
else if ("间隔" == strProperty)
|
||
{
|
||
double temp = varVal.toDouble();
|
||
// 创建固定间隔刻度器
|
||
QSharedPointer<QCPAxisTickerFixed> fixedTicker(new QCPAxisTickerFixed);
|
||
// 设置刻度间隔为50
|
||
fixedTicker->setTickStep(temp);
|
||
// 设置刻度步长策略为固定值
|
||
fixedTicker->setScaleStrategy(QCPAxisTickerFixed::ssNone);
|
||
// 应用到Y轴
|
||
this->yAxis->setTicker(fixedTicker);
|
||
}
|
||
else if ("标注字体" == strProperty)
|
||
{
|
||
QFont newFont = varVal.value<QFont>();
|
||
this->yAxis->setTickLabelFont(newFont);
|
||
}
|
||
else if ("旋转(°)" == strProperty)
|
||
{
|
||
double temp = varVal.toDouble();
|
||
this->yAxis->setTickLabelRotation(temp);
|
||
}
|
||
else if ("斜深" == strProperty)
|
||
{
|
||
bool temp = varVal.toBool();
|
||
this->yAxis->setTickLabels(temp);
|
||
}
|
||
else if ("海拔垂深" == strProperty)
|
||
{
|
||
bool temp = varVal.toBool();
|
||
if(!this->m_yAxis2)
|
||
{
|
||
this->m_yAxis2 = new QCPAxis(this->axisRect(), QCPAxis::atLeft);
|
||
this->axisRect()->addAxis(QCPAxis::atLeft, this->m_yAxis2);
|
||
this->m_yAxis2->setRange(0, 100);
|
||
this->m_yAxis2->setOffset(40);
|
||
this->m_yAxis2->setTickLabelPadding(10);
|
||
}
|
||
// 设置旋转 间隔
|
||
this->m_yAxis2->setVisible(temp); // 显示第三个Y轴
|
||
this->m_yAxis2->setTickLabels(temp);
|
||
this->m_yAxis2->setTickLabelSide(QCPAxis::lsInside);
|
||
}
|
||
else if ("垂深" == strProperty)
|
||
{
|
||
bool temp = varVal.toBool();
|
||
if(!this->m_yAxis3)
|
||
{
|
||
this->m_yAxis3 = new QCPAxis(this->axisRect(), QCPAxis::atLeft);
|
||
this->axisRect()->addAxis(QCPAxis::atLeft, this->m_yAxis3);
|
||
this->m_yAxis3->setRange(0, 100);
|
||
this->m_yAxis3->setOffset(40);
|
||
this->m_yAxis3->setTickLabelPadding(10);
|
||
}
|
||
this->m_yAxis3->setVisible(temp); // 显示第三个Y轴
|
||
this->m_yAxis3->setTickLabels(temp);
|
||
this->m_yAxis3->setTickLabelSide(QCPAxis::lsInside);
|
||
}
|
||
else if ("斜深位置" == strProperty)
|
||
{
|
||
// 没有直接设置偏移方法 动态计算太麻烦
|
||
int temp = varVal.toInt();
|
||
switch(temp)
|
||
{
|
||
case 0:
|
||
// 偏左
|
||
this->yAxis->setTickLabelPadding(5);
|
||
break;
|
||
case 1:
|
||
// 居中
|
||
this->yAxis->setTickLabelPadding(30);
|
||
break;
|
||
case 2:
|
||
this->yAxis->setTickLabelPadding(50);
|
||
break;
|
||
}
|
||
}
|
||
else if ("垂深位置" == strProperty)
|
||
{
|
||
int temp = varVal.toInt();
|
||
switch(temp)
|
||
{
|
||
case 0:
|
||
// 偏左
|
||
this->m_yAxis3->setTickLabelPadding(5 + 10);
|
||
break;
|
||
case 1:
|
||
// 居中
|
||
this->m_yAxis3->setTickLabelPadding(30 + 10);
|
||
break;
|
||
case 2:
|
||
this->m_yAxis3->setTickLabelPadding(50 + 10);
|
||
break;
|
||
}
|
||
}
|
||
else if ("海拔垂深位置" == strProperty)
|
||
{
|
||
int temp = varVal.toInt();
|
||
switch(temp)
|
||
{
|
||
case 0:
|
||
// 偏左
|
||
this->m_yAxis2->setTickLabelPadding(5 + 10);
|
||
break;
|
||
case 1:
|
||
// 居中
|
||
this->m_yAxis2->setTickLabelPadding(30);
|
||
break;
|
||
case 2:
|
||
this->m_yAxis2->setTickLabelPadding(50 + 10);
|
||
break;
|
||
}
|
||
}
|
||
else if ("主刻度线长度" == strProperty)
|
||
{
|
||
int height = varVal.toInt();
|
||
this->yAxis->setTickLength(height, 0);
|
||
}
|
||
else if ("主刻度线宽度" == strProperty)
|
||
{
|
||
int temp = varVal.toInt();
|
||
QPen tickPen = this->yAxis->tickPen();
|
||
tickPen.setWidth(temp);
|
||
this->yAxis->setTickPen(tickPen);
|
||
}
|
||
else if ("次刻度线长度" == strProperty)
|
||
{
|
||
int temp = varVal.toInt();
|
||
this->yAxis->setSubTickLength(temp, 0);
|
||
}
|
||
else if ("次刻度线宽度" == strProperty)
|
||
{
|
||
int temp = varVal.toInt();
|
||
QPen tickPen = this->yAxis->subTickPen();
|
||
tickPen.setWidth(temp);
|
||
this->yAxis->setSubTickPen(tickPen);
|
||
}
|
||
|
||
|
||
|
||
this->replot();
|
||
}
|
||
}
|
||
|
||
//校深线段
|
||
void QMyCustomPlot::addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
// 在初始化代码中
|
||
TransparentDraggableLine *dragRect = new TransparentDraggableLine(this, strUuid);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(crColor); // 半透明白色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
dragRect->setTitle(strText);
|
||
m_mapDraggable_Line[strUuid] = dragRect;
|
||
|
||
}
|
||
|
||
void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
// 在初始化代码中
|
||
TransparentDraggableRect *dragRect = new TransparentDraggableRect(this, strUuid);
|
||
dragRect->setTitle(strText);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(crColor); // 半透明白色
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
|
||
m_mapDraggable_Rect[strUuid] = dragRect;
|
||
}
|
||
|
||
void QMyCustomPlot::addLayerToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
// 在初始化代码中
|
||
TransparentDraggableLayer *dragRect = new TransparentDraggableLayer(this, strUuid);
|
||
dragRect->setTitle(strText);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(crColor); // 半透明白色
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
|
||
m_mapDraggable_Layer[strUuid] = dragRect;
|
||
}
|
||
|
||
TransparentGroupResult* QMyCustomPlot::addResultGroup(double left_Low, double right_Hight, QString &strUuid, QString strText /*= ""*/)
|
||
{
|
||
TransparentGroupResult *upGroup = nullptr;
|
||
if (strUuid != "")
|
||
{
|
||
upGroup = (TransparentGroupResult *)m_mapDragGroup.value(strUuid);
|
||
}
|
||
|
||
strUuid = getUUid();
|
||
|
||
// 在初始化代码中addResultToPlot
|
||
TransparentGroupResult *dragRect = new TransparentGroupResult(this, upGroup, strUuid);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight);
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
dragRect->setTitle(strText);
|
||
|
||
m_mapDragGroup[strUuid] = dragRect;
|
||
|
||
return dragRect;
|
||
}
|
||
|
||
void QMyCustomPlot::addResultToPlot(double left_Low, double right_Hight, QString myResult, QString &strUuid, QString strText)
|
||
{
|
||
//获取上方Rect
|
||
TransparentDraggableResult *upDragRect = nullptr;
|
||
if(strUuid!="")
|
||
{
|
||
upDragRect = (TransparentDraggableResult *)m_mapDraggable_Result[strUuid];
|
||
}
|
||
|
||
strUuid = getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableResult *dragRect = new TransparentDraggableResult(this, upDragRect, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setResult(myResult);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight);
|
||
// 可选:设置颜色
|
||
//dragRect->setColor(QColor(255, 0, 0, 80)); // 半透明红色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_Result[strUuid] = dragRect;
|
||
}
|
||
|
||
void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor, bool bRefresh)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableSwallCore *dragRect = new TransparentDraggableSwallCore(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setOil(OilGasImage);
|
||
dragRect->setLith(LithologyImage);
|
||
dragRect->setTitle(QString::number(iColor));
|
||
//左侧空白
|
||
dragRect->m_fLeftSpace = Sideleft*g_dPixelPerCm;
|
||
// 设置初始范围
|
||
double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40;
|
||
double x1 = this->xAxis->coordToPixel(Depth);
|
||
//
|
||
double Depth2 = this->xAxis->pixelToCoord(x1-h);
|
||
dragRect->setRange(Depth, Depth2, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色255, 100, 100, 80
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setColor(myColor);
|
||
|
||
m_mapDraggable_SwallCore[strUuid] = dragRect;
|
||
|
||
//刷新
|
||
//this->replot();
|
||
}
|
||
|
||
void QMyCustomPlot::addGeoLithToPlot(double left_Low, double right_Hight, const QString myLith, const QString myOil, const QString myColor, bool bRefresh)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableGeoLith *dragRect = new TransparentDraggableGeoLith(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setOil(myOil);
|
||
dragRect->setLith(myLith, myColor);
|
||
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色255, 100, 100, 80
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setColor(myColor);
|
||
|
||
m_mapDraggable_GeoLith[strUuid] = dragRect;
|
||
|
||
//刷新
|
||
//this->replot();
|
||
}
|
||
|
||
void QMyCustomPlot::addGujingToPlot(double left_Low, double right_Hight, const QString strResult, bool bRefresh)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableGujing *dragRect = new TransparentDraggableGujing(this, strUuid);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setResult(strResult);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_Gujing[strUuid] = dragRect;
|
||
|
||
}
|
||
|
||
//气测/FMT/射孔/文本
|
||
void QMyCustomPlot::addJiegutextToPlot(double left_Low, double right_Hight, const QStringList strText, const QStringList strList_coredat, bool bRefresh, QColor crColor)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableJiegutext *dragRect = new TransparentDraggableJiegutext(this, strUuid, 1.0, strText);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(crColor); // 半透明白色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
dragRect->mList_coredat.append(strList_coredat);//直接创建时赋值
|
||
|
||
m_mapDraggable_Jiegutext[strUuid] = dragRect;
|
||
}
|
||
|
||
//沉积相-微相
|
||
void QMyCustomPlot::addMFacToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableMFac *dragRect = new TransparentDraggableMFac(this, strUuid);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(crColor); // 半透明白色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_MFac[strUuid] = dragRect;
|
||
}
|
||
|
||
//沉积相-亚相
|
||
void QMyCustomPlot::addPhaseToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggablePhase *dragRect = new TransparentDraggablePhase(this, strUuid);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(crColor); // 半透明白色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_Phase[strUuid] = dragRect;
|
||
}
|
||
|
||
//沉积相-相
|
||
void QMyCustomPlot::addFacToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableFac *dragRect = new TransparentDraggableFac(this, strUuid);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(crColor); // 半透明白色
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_Fac[strUuid] = dragRect;
|
||
}
|
||
|
||
//套管
|
||
void QMyCustomPlot::addGuanToPlot(double left_Low, double right_Hight, const QString imagePath, float in, bool bRefresh)
|
||
{
|
||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||
QString strUuid = qtCommon->getUUid();
|
||
|
||
// 在初始化代码中
|
||
TransparentDraggableGuan *dragRect = new TransparentDraggableGuan(this, strUuid);
|
||
//长度
|
||
dragRect->setOin(in);
|
||
//图片,提前设值,后面setRange改变
|
||
dragRect->setResult(imagePath);
|
||
// 设置初始范围
|
||
dragRect->setRange(left_Low, right_Hight, bRefresh);
|
||
// 可选:设置颜色
|
||
dragRect->setColor(QColor(255, 255, 255, 0)); // 透明
|
||
//最小宽度
|
||
dragRect->setMinWidth(0.1);
|
||
//dragRect->setTitle(strText);
|
||
|
||
m_mapDraggable_Guan[strUuid] = dragRect;
|
||
}
|
||
|
||
void QMyCustomPlot::onResetZoom()
|
||
{
|
||
|
||
// //rescaleAxes();
|
||
// //x,y互换
|
||
// yAxis->setRange(m_iX1, m_iX2);
|
||
// xAxis->setRange(m_iY1, m_iY2);
|
||
// //
|
||
// replot();
|
||
}
|
||
|
||
void QMyCustomPlot::removeSelectedGraph()
|
||
{
|
||
// if (selectedGraphs().size() > 0)
|
||
// {
|
||
// QString strLineName = selectedGraphs().first()->name();
|
||
// qDebug() << "removeSelectedGraph name=" << strLineName;
|
||
|
||
// removeGraph(selectedGraphs().first());
|
||
// replot();
|
||
|
||
// //emit CallManage::getInstance()->sig_DelCurve(m_indexID, strLineName);
|
||
// }
|
||
}
|
||
|
||
void QMyCustomPlot::removeSelectedGraphByTitle()
|
||
{
|
||
// if (selectedGraphs().size() > 0)
|
||
// {
|
||
// QString strLineName = selectedGraphs().first()->name();
|
||
// qDebug() << "removeSelectedGraph name=" << strLineName;
|
||
|
||
// removeGraph(selectedGraphs().first());
|
||
// replot();
|
||
|
||
// emit CallManage::getInstance()->sig_DelCurve(m_indexID, strLineName);
|
||
// }
|
||
}
|
||
|
||
void QMyCustomPlot::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName &&
|
||
iTableType==3)
|
||
{
|
||
raise();
|
||
}
|
||
}
|
||
|
||
//属性-左刻度
|
||
void QMyCustomPlot::s_ChangeLeftScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_iX1 = newLeftScale;
|
||
|
||
double rg = m_iX2 - m_iX1;
|
||
double lower = m_iX1 - rg * m_nLeftCross;
|
||
double upper = m_iX2 + rg * m_nRightCross;
|
||
yAxis->setRange(lower, upper);
|
||
//
|
||
replot();
|
||
}
|
||
else if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_newTargetLine == strLineName)
|
||
{
|
||
//其他曲线
|
||
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
|
||
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
|
||
newLeftScale, m_vMax, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true);
|
||
}
|
||
}
|
||
|
||
//属性-右刻度
|
||
void QMyCustomPlot::s_ChangeRightScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_iX2 = newRightScale;
|
||
|
||
double rg = m_iX2 - m_iX1;
|
||
double lower = m_iX1 - rg * m_nLeftCross;
|
||
double upper = m_iX2 + rg * m_nRightCross;
|
||
yAxis->setRange(lower, upper);
|
||
//
|
||
replot();
|
||
}
|
||
else if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_newTargetLine == strLineName)
|
||
{
|
||
//其他曲线
|
||
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
|
||
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
|
||
m_vMin, newRightScale, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true);
|
||
}
|
||
}
|
||
|
||
//属性-刻度类型
|
||
void QMyCustomPlot::s_ChangeScaleType(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_strScaleType = strScaleType;
|
||
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
yAxis->setScaleType(QCPAxis::stLogarithmic);
|
||
}
|
||
else //if(m_strScaleType=="线性")
|
||
{
|
||
yAxis->setScaleType(QCPAxis::stLinear);
|
||
}
|
||
|
||
//
|
||
replot();
|
||
}
|
||
else if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_newTargetLine == strLineName)
|
||
{
|
||
//其他曲线
|
||
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
|
||
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
|
||
m_vMin, m_vMax, strScaleType, m_frontColor, m_backColor, m_newFillMode, true);
|
||
}
|
||
}
|
||
|
||
//属性-颜色
|
||
void QMyCustomPlot::s_ChangeLineColor(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
QCPGraph* graph =this->graph(0);
|
||
if(graph)
|
||
{
|
||
QPen pen = graph->pen();
|
||
pen.setColor(lineColor);
|
||
graph->setPen(pen);
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
}
|
||
|
||
//属性-线宽
|
||
void QMyCustomPlot::s_ChangeLineWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double width)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
QCPGraph* graph = this->graph(0);
|
||
if(graph)
|
||
{
|
||
QPen pen = graph->pen();
|
||
pen.setWidthF(width);
|
||
graph->setPen(pen);
|
||
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
}
|
||
|
||
//属性-线型
|
||
void QMyCustomPlot::s_ChangeLineStyle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, Qt::PenStyle lineStyle)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
QPen pen = this->graph(0)->pen();
|
||
pen.setStyle(lineStyle);
|
||
graph(0)->setPen(pen);
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
|
||
//数据点 符号类型
|
||
void QMyCustomPlot::s_ChangePointStyle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QCPScatterStyle::ScatterShape pointStyle)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_pointStyle = pointStyle;
|
||
|
||
QCPGraph* graph =this->graph(0);
|
||
if(graph)
|
||
{
|
||
//勾选3个
|
||
if(m_bDrawLine && m_bDrawGan && m_bDrawPoint)
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈(QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
//勾选2个
|
||
else if(m_bDrawLine && m_bDrawGan && !m_bDrawPoint){//曲线+杆状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(m_bDrawLine && !m_bDrawGan && m_bDrawPoint){//曲线+点状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈(QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
else if(!m_bDrawLine && m_bDrawGan && m_bDrawPoint){//杆状+点状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈(QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
//勾选1个
|
||
else if(m_bDrawLine && !m_bDrawGan && !m_bDrawPoint)//曲线
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(!m_bDrawLine && m_bDrawGan && !m_bDrawPoint)//杆状
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(!m_bDrawLine && !m_bDrawGan && m_bDrawPoint)//点状
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsNone));
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈 (QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
//勾选0个
|
||
else if(!m_bDrawLine && !m_bDrawGan && !m_bDrawPoint)//曲线
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsNone));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssNone)));
|
||
}
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
}
|
||
|
||
//绘制方式
|
||
void QMyCustomPlot::ChangeDrawMethod(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
QCPGraph* graph =this->graph(0);
|
||
if(graph)
|
||
{
|
||
//勾选3个
|
||
if(m_bDrawLine && m_bDrawGan && m_bDrawPoint)
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈(QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
//勾选2个
|
||
else if(m_bDrawLine && m_bDrawGan && !m_bDrawPoint){//曲线+杆状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(m_bDrawLine && !m_bDrawGan && m_bDrawPoint){//曲线+点状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈(QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
else if(!m_bDrawLine && m_bDrawGan && m_bDrawPoint){//杆状+点状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈(QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
//勾选1个
|
||
else if(m_bDrawLine && !m_bDrawGan && !m_bDrawPoint)//曲线
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(!m_bDrawLine && m_bDrawGan && !m_bDrawPoint)//杆状
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(!m_bDrawLine && !m_bDrawGan && m_bDrawPoint)//点状
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsNone));
|
||
graph->setScatterStyle(QCPScatterStyle(m_pointStyle));//圆圈 (QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)
|
||
}
|
||
//勾选0个
|
||
else if(!m_bDrawLine && !m_bDrawGan && !m_bDrawPoint)//曲线
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsNone));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssNone)));
|
||
}
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
}
|
||
|
||
//曲线
|
||
void QMyCustomPlot::s_ChangeDrawLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawLine)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
//
|
||
m_bDrawLine = bDrawLine;
|
||
//绘制方式
|
||
ChangeDrawMethod(strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||
}
|
||
|
||
//杆状
|
||
void QMyCustomPlot::s_ChangeDrawGan(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawGan)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
//
|
||
m_bDrawGan = bDrawGan;
|
||
//绘制方式
|
||
ChangeDrawMethod(strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||
}
|
||
|
||
//点状
|
||
void QMyCustomPlot::s_ChangeDrawPoint(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawPoint)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
//
|
||
m_bDrawPoint = bDrawPoint;
|
||
//绘制方式
|
||
ChangeDrawMethod(strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||
}
|
||
|
||
//绘制对称曲线
|
||
void QMyCustomPlot::s_ChangeDrawSymmetry(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawSymmetry)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
//
|
||
m_bDrawSymmetry = bDrawSymmetry;
|
||
|
||
if(m_bDrawSymmetry)//绘制对称线
|
||
{
|
||
|
||
//graph(duichen)
|
||
QVector<double> x, y;
|
||
|
||
CLogIO *logio=new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||
int index=logio->OpenCurve(strLineName.toStdString().c_str());
|
||
if(index<0)
|
||
{
|
||
delete logio;
|
||
}
|
||
else
|
||
{
|
||
Slf_CURVE curveinfo;
|
||
float *val;
|
||
float sdep,edep,rlev;
|
||
float vmax,vmin;
|
||
//
|
||
logio->GetCurveInfo(index,&curveinfo);
|
||
sdep=curveinfo.StartDepth;
|
||
edep=curveinfo.EndDepth;
|
||
rlev=curveinfo.DepLevel;
|
||
//
|
||
int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||
val=new float[count];
|
||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||
logio->CloseCurve(index);
|
||
delete logio;
|
||
|
||
|
||
for(int i=0; i<count; i++)
|
||
{
|
||
x.append(-(sdep+ rlev*i));
|
||
//对称处理
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
y.append(log(m_iX1)+log(m_iX2)-log(val[i]));
|
||
}
|
||
else //if(m_strScaleType=="线性")
|
||
{
|
||
y.append(m_iX1+m_iX2-val[i]);
|
||
}
|
||
}
|
||
}
|
||
//
|
||
this->yAxis2->setRange(m_iY1, m_iY2);
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
this->xAxis2->setRange(log(m_iX1), log(m_iX2));
|
||
}
|
||
else //if(m_strScaleType=="线性")
|
||
{
|
||
this->xAxis2->setRange(m_iX1, m_iX2);
|
||
}
|
||
//移除
|
||
if(graph_Symmetry)
|
||
{
|
||
this->removeGraph(graph_Symmetry);
|
||
graph_Symmetry=nullptr;
|
||
}
|
||
//新建
|
||
graph_Symmetry = this->addGraph(yAxis2, xAxis2);
|
||
if(graph_Symmetry)
|
||
{
|
||
graph_Symmetry->setData(x, y);
|
||
graph_Symmetry->setLineStyle(graph(0)->lineStyle());//曲线
|
||
graph_Symmetry->setScatterStyle(graph(0)->scatterStyle());
|
||
//graph_Fill->setPen(QColor(255, 255, 255));
|
||
graph_Symmetry->setPen(QColor(0, 0, 0));//(graph(0)->pen());
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//移除
|
||
if(graph_Symmetry)
|
||
{
|
||
this->removeGraph(graph_Symmetry);
|
||
graph_Symmetry=nullptr;
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
}
|
||
|
||
//岩性填充-不填充
|
||
void QMyCustomPlot::s_ClearFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
//清空填充
|
||
if(graph_Fill)
|
||
{
|
||
//this->removeGraph(1);
|
||
this->removeGraph(graph_Fill);
|
||
graph_Fill=nullptr;
|
||
}
|
||
// if(this->graphCount() > 1)
|
||
// {
|
||
// this->removeGraph(1);
|
||
// }
|
||
if(graph(0))
|
||
{
|
||
graph(0)->setBrush(Qt::NoBrush);
|
||
//
|
||
replot();
|
||
}
|
||
}
|
||
}
|
||
|
||
//岩性填充-填充
|
||
void QMyCustomPlot::s_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow)
|
||
{
|
||
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
//其他曲线
|
||
m_newFillType = newFillType;
|
||
m_newTargetLine = newTargetLine;
|
||
m_newColor = newColor;
|
||
m_newLithosImage = newLithosImage;
|
||
m_newHeadFill = newHeadFill;
|
||
m_vMin = vMin;
|
||
m_vMax = vMax;
|
||
m_strOtherScaleType = strOtherScaleType;
|
||
m_frontColor = frontColor;
|
||
m_backColor = backColor;
|
||
m_newFillMode = newFillMode;
|
||
m_bFillNow = bFillNow;
|
||
|
||
//默认true,只有模板存在填充时,才会false
|
||
if(m_bFillNow==false)
|
||
{
|
||
return;
|
||
}
|
||
//填充
|
||
//if(this->graphCount() > 1)
|
||
if(graph_Fill)
|
||
{
|
||
//this->removeGraph(1);
|
||
this->removeGraph(graph_Fill);
|
||
graph_Fill=nullptr;
|
||
}
|
||
//graph(1)
|
||
//QCPGraph *graph_Fill=nullptr;
|
||
QVector<double> x, y;
|
||
|
||
if(newTargetLine=="左界道")
|
||
{
|
||
x.append(m_iY1);
|
||
y.append(m_iX1);
|
||
//
|
||
x.append(m_iY2);
|
||
y.append(m_iX1);
|
||
|
||
//
|
||
graph_Fill=this->addGraph();
|
||
}
|
||
else if(newTargetLine=="右界道")
|
||
{
|
||
x.append(m_iY1);
|
||
y.append(m_iX2);
|
||
//
|
||
x.append(m_iY2);
|
||
y.append(m_iX2);
|
||
|
||
//
|
||
graph_Fill=this->addGraph();
|
||
}
|
||
else if(newTargetLine=="对称线")
|
||
{
|
||
CLogIO *logio=new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||
int index=logio->OpenCurve(strLineName.toStdString().c_str());
|
||
if(index<0)
|
||
{
|
||
delete logio;
|
||
}
|
||
else
|
||
{
|
||
Slf_CURVE curveinfo;
|
||
float *val;
|
||
float sdep,edep,rlev;
|
||
float vmax,vmin;
|
||
//
|
||
logio->GetCurveInfo(index,&curveinfo);
|
||
sdep=curveinfo.StartDepth;
|
||
edep=curveinfo.EndDepth;
|
||
rlev=curveinfo.DepLevel;
|
||
//
|
||
int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||
val=new float[count];
|
||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||
logio->CloseCurve(index);
|
||
delete logio;
|
||
|
||
for(int i=0; i<count; i++)
|
||
{
|
||
x.append(-(sdep+ rlev*i));
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
y.append(log(m_iX1)+log(m_iX2)-log(val[i]));
|
||
}
|
||
else //if(m_strScaleType=="线性")
|
||
{
|
||
y.append(m_iX1+m_iX2-val[i]);
|
||
}
|
||
}
|
||
}
|
||
//
|
||
this->yAxis2->setRange(m_iY1, m_iY2);
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
this->xAxis2->setRange(log(m_iX1), log(m_iX2));
|
||
}
|
||
else //if(m_strScaleType=="线性")
|
||
{
|
||
this->xAxis2->setRange(m_iX1, m_iX2);
|
||
}
|
||
graph_Fill=this->addGraph(yAxis2, xAxis2);
|
||
}
|
||
else//其他曲线
|
||
{
|
||
if(newFillMode=="左填充")
|
||
{
|
||
float iX1_Tmp=m_iX1;
|
||
float iX2_Tmp=m_iX2;
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
iX1_Tmp=log(m_iX1);
|
||
iX2_Tmp=log(m_iX2);
|
||
}
|
||
|
||
//其他曲线(左填充)
|
||
CLogIO *logio=new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||
|
||
//读取基线信息
|
||
int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str());
|
||
if(indexBaseCurv < 0) {
|
||
graph_Fill=this->addGraph();//空曲线
|
||
delete logio;
|
||
}
|
||
else
|
||
{
|
||
//其他曲线
|
||
int index=logio->OpenCurve(newTargetLine.toStdString().c_str());
|
||
if(index<0)
|
||
{
|
||
graph_Fill=this->addGraph();//空曲线
|
||
delete logio;
|
||
}
|
||
else
|
||
{
|
||
Slf_CURVE curveinfo;
|
||
float *val;
|
||
float sdep,edep,rlev;
|
||
//
|
||
logio->GetCurveInfo(index,&curveinfo);
|
||
sdep=curveinfo.StartDepth;
|
||
edep=curveinfo.EndDepth;
|
||
rlev=curveinfo.DepLevel;
|
||
//
|
||
int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||
val=new float[count];
|
||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||
logio->CloseCurve(index);
|
||
//读完基线再关闭
|
||
// delete logio;
|
||
|
||
float vMax_Tmp=vMax;
|
||
float vMin_Tmp=vMin;
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
vMax_Tmp=log(vMax);
|
||
vMin_Tmp=log(vMin);
|
||
}
|
||
|
||
float newVal = 0.0;
|
||
for(int i=0; i<count; i++)
|
||
{
|
||
float x0=-(sdep+ rlev*i);
|
||
float y0_old=val[i];
|
||
float y0 = (iX2_Tmp-iX1_Tmp)*(val[i]-vMin_Tmp)/(vMax_Tmp-vMin) + iX1_Tmp;
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
//其他曲线
|
||
y0_old=log(val[i]);
|
||
y0 = (iX2_Tmp-iX1_Tmp)*(log(val[i])-vMin_Tmp)/(vMax_Tmp-vMin_Tmp) + iX1_Tmp;
|
||
}
|
||
|
||
//读取基线
|
||
float BaseY0=0;
|
||
float BaseY0_Tmp=0;
|
||
logio->ReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0);
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
BaseY0_Tmp=log(BaseY0);
|
||
BaseY0 = BaseY0_Tmp;
|
||
}
|
||
|
||
//
|
||
if(i+1<count)
|
||
{
|
||
float x1=-(sdep+ rlev*(i+1));
|
||
//float y1=val[i+1];
|
||
float y1 = (iX2_Tmp-iX1_Tmp)*(val[i+1]-vMin_Tmp)/(vMax_Tmp-vMin_Tmp) + iX1_Tmp;
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
//其他曲线
|
||
y1 = (iX2_Tmp-iX1_Tmp)*(log(val[i+1])-vMin_Tmp)/(vMax_Tmp-vMin_Tmp) + iX1_Tmp;
|
||
}
|
||
|
||
//读取基线
|
||
float BaseY1=0;
|
||
float BaseY1_Tmp=0;
|
||
logio->ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1);
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
BaseY1_Tmp=log(BaseY1);
|
||
BaseY1 = BaseY1_Tmp;
|
||
}
|
||
|
||
if(BaseY0<=y0 && BaseY1<=y1)
|
||
{
|
||
//基线在左,采用基线值
|
||
//y0=BaseY0;
|
||
y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
}
|
||
else if(BaseY0>=y0 && BaseY1>=y1)
|
||
{
|
||
//基线在右,直接赋值
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
}
|
||
else if(BaseY0<=y0 && BaseY1>=y1)
|
||
{
|
||
//基线起点在左,采用基线值
|
||
//y0=BaseY0;
|
||
y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
|
||
//插值
|
||
float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1);
|
||
float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1;
|
||
float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(xNew);
|
||
y.append(yNew_Old);
|
||
}
|
||
else if(BaseY0>=y0 && BaseY1<=y1)
|
||
{
|
||
//基线在右,直接赋值
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
|
||
//插值
|
||
float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1);
|
||
float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1;
|
||
float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(xNew);
|
||
y.append(yNew_Old);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//最后一个点
|
||
if(BaseY0<y0)
|
||
{
|
||
//基线在左,采用基线值
|
||
//y0=BaseY0;
|
||
y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
}
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
}
|
||
}
|
||
logio->CloseCurve(indexBaseCurv);
|
||
delete logio;
|
||
//
|
||
this->yAxis2->setRange(m_iY1, m_iY2);
|
||
this->xAxis2->setRange(vMin_Tmp, vMax_Tmp);
|
||
graph_Fill=this->addGraph(yAxis2, xAxis2);
|
||
}
|
||
}
|
||
}
|
||
else if(newFillMode=="右填充")
|
||
{
|
||
float iX1_Tmp=m_iX1;
|
||
float iX2_Tmp=m_iX2;
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
iX1_Tmp=log(m_iX1);
|
||
iX2_Tmp=log(m_iX2);
|
||
}
|
||
|
||
//其他曲线(右填充)
|
||
CLogIO *logio=new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||
|
||
//读取基线信息
|
||
int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str());
|
||
if(indexBaseCurv < 0) {
|
||
graph_Fill=this->addGraph();//空曲线
|
||
delete logio;
|
||
}
|
||
else
|
||
{
|
||
//其他曲线
|
||
int index=logio->OpenCurve(newTargetLine.toStdString().c_str());
|
||
if(index<0)
|
||
{
|
||
graph_Fill=this->addGraph();//空曲线
|
||
delete logio;
|
||
}
|
||
else
|
||
{
|
||
Slf_CURVE curveinfo;
|
||
float *val;
|
||
float sdep,edep,rlev;
|
||
//
|
||
logio->GetCurveInfo(index,&curveinfo);
|
||
sdep=curveinfo.StartDepth;
|
||
edep=curveinfo.EndDepth;
|
||
rlev=curveinfo.DepLevel;
|
||
//
|
||
int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||
val=new float[count];
|
||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||
logio->CloseCurve(index);
|
||
//读完基线再关闭
|
||
// delete logio;
|
||
|
||
float vMax_Tmp=vMax;
|
||
float vMin_Tmp=vMin;
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
vMax_Tmp=log(vMax);
|
||
vMin_Tmp=log(vMin);
|
||
}
|
||
|
||
float newVal = 0.0;
|
||
for(int i=0; i<count; i++)
|
||
{
|
||
float x0=-(sdep+ rlev*i);
|
||
float y0_old=val[i];
|
||
float y0 = (iX2_Tmp-iX1_Tmp)*(val[i]-vMin_Tmp)/(vMax_Tmp-vMin_Tmp) + iX1_Tmp;
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
//其他曲线
|
||
y0_old=log(val[i]);
|
||
y0 = (iX2_Tmp-iX1_Tmp)*(log(val[i])-vMin_Tmp)/(vMax_Tmp-vMin_Tmp) + iX1_Tmp;
|
||
}
|
||
|
||
//读取基线
|
||
float BaseY0=0;
|
||
float BaseY0_Tmp=0;
|
||
logio->ReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0);
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
BaseY0_Tmp=log(BaseY0);
|
||
BaseY0 = BaseY0_Tmp;
|
||
}
|
||
|
||
//
|
||
if(i+1<count)
|
||
{
|
||
float x1=-(sdep+ rlev*(i+1));
|
||
//float y1=val[i+1];
|
||
float y1 = (iX2_Tmp-iX1_Tmp)*(val[i+1]-vMin_Tmp)/(vMax_Tmp-vMin_Tmp) + iX1_Tmp;
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
//其他曲线
|
||
y1 = (iX2_Tmp-iX1_Tmp)*(log(val[i+1])-vMin_Tmp)/(vMax_Tmp-vMin_Tmp) + iX1_Tmp;
|
||
}
|
||
|
||
//读取基线
|
||
float BaseY1=0;
|
||
float BaseY1_Tmp=0;
|
||
logio->ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1);
|
||
if(m_strScaleType=="对数")
|
||
{
|
||
BaseY1_Tmp=log(BaseY1);
|
||
BaseY1 = BaseY1_Tmp;
|
||
}
|
||
|
||
if(BaseY0<=y0 && BaseY1<=y1)
|
||
{
|
||
//基线在左,直接赋值
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
}
|
||
else if(BaseY0>=y0 && BaseY1>=y1)
|
||
{
|
||
//基线在右,采用基线值
|
||
//y0=BaseY0;
|
||
y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
}
|
||
else if(BaseY0<=y0 && BaseY1>=y1)
|
||
{
|
||
//基线起点在左,直接赋值
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
|
||
//插值
|
||
float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1);
|
||
float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1;
|
||
float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(xNew);
|
||
y.append(yNew_Old);
|
||
}
|
||
else if(BaseY0>=y0 && BaseY1<=y1)
|
||
{
|
||
//基线在右,采用基线值
|
||
//y0=BaseY0;
|
||
y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
|
||
//插值
|
||
float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1);
|
||
float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1;
|
||
float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
//
|
||
x.append(xNew);
|
||
y.append(yNew_Old);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//最后一个点
|
||
if(BaseY0>y0)
|
||
{
|
||
//基线在右,采用基线值
|
||
//y0=BaseY0;
|
||
y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp;
|
||
}
|
||
x.append(x0);
|
||
y.append(y0_old);
|
||
}
|
||
}
|
||
logio->CloseCurve(indexBaseCurv);
|
||
delete logio;
|
||
//
|
||
this->yAxis2->setRange(m_iY1, m_iY2);
|
||
this->xAxis2->setRange(vMin_Tmp, vMax_Tmp);
|
||
graph_Fill=this->addGraph(yAxis2, xAxis2);
|
||
}
|
||
}
|
||
}
|
||
else //填充
|
||
{
|
||
//其他曲线
|
||
CLogIO *logio=new CLogIO();
|
||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||
int index=logio->OpenCurve(newTargetLine.toStdString().c_str());
|
||
if(index<0)
|
||
{
|
||
graph_Fill=this->addGraph();
|
||
|
||
delete logio;
|
||
}
|
||
else
|
||
{
|
||
Slf_CURVE curveinfo;
|
||
float *val;
|
||
float sdep,edep,rlev;
|
||
//
|
||
logio->GetCurveInfo(index,&curveinfo);
|
||
sdep=curveinfo.StartDepth;
|
||
edep=curveinfo.EndDepth;
|
||
rlev=curveinfo.DepLevel;
|
||
//
|
||
int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
|
||
val=new float[count];
|
||
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
|
||
logio->CloseCurve(index);
|
||
delete logio;
|
||
|
||
float vMax_Tmp=vMax;
|
||
float vMin_Tmp=vMin;
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
vMax_Tmp=log(vMax);
|
||
vMin_Tmp=log(vMin);
|
||
}
|
||
|
||
float newVal = 0.0;
|
||
for(int i=0; i<count; i++)
|
||
{
|
||
x.append(-(sdep+ rlev*i));
|
||
//newVal = (m_iX2-m_iX1)*(val[i]-vMin)/(vMax-vMin) + m_iX1;
|
||
newVal = val[i];
|
||
if(strOtherScaleType=="对数")
|
||
{
|
||
//其他曲线
|
||
newVal = log(val[i]);
|
||
}
|
||
y.append(newVal);
|
||
}
|
||
this->yAxis2->setRange(m_iY1, m_iY2);
|
||
this->xAxis2->setRange(vMin_Tmp, vMax_Tmp);
|
||
graph_Fill=this->addGraph(yAxis2, xAxis2);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(graph_Fill)
|
||
{
|
||
graph_Fill->setData(x, y);
|
||
graph_Fill->setLineStyle(graph(0)->lineStyle());//曲线
|
||
graph_Fill->setScatterStyle(graph(0)->scatterStyle());
|
||
//graph_Fill->setPen(QColor(255, 255, 255));
|
||
graph_Fill->setPen(QColor(0, 0, 0));//(graph(0)->pen());
|
||
}
|
||
|
||
// this->graph(1)->setData(x, y);
|
||
// graph(1)->setLineStyle(graph(0)->lineStyle());//曲线
|
||
// graph(1)->setScatterStyle(graph(0)->scatterStyle());
|
||
// //graph(1)->setPen(QColor(255, 255, 255));
|
||
// graph(1)->setPen(QColor(0, 0, 0));//(graph(0)->pen());
|
||
|
||
//
|
||
if(newFillType == "岩性模式")
|
||
{
|
||
QColor oldFrontColor(0, 0, 0); // 原始颜色
|
||
QColor oldBackColor(255, 255, 255); // 原始颜色
|
||
//
|
||
QImage image(newLithosImage);
|
||
for (int y = 0; y < image.height(); ++y) {
|
||
for (int x = 0; x < image.width(); ++x) {
|
||
QColor pixelColor = QColor(image.pixel(x, y));
|
||
if (pixelColor == oldFrontColor) {
|
||
image.setPixelColor(x, y, m_frontColor); // 使用 setPixelColor 来设置新颜色
|
||
}
|
||
if (pixelColor == oldBackColor) {
|
||
image.setPixelColor(x, y, m_backColor); // 使用 setPixelColor 来设置新颜色
|
||
}
|
||
}
|
||
}
|
||
|
||
//
|
||
graph(0)->setBrush(QBrush(QPixmap::fromImage(image)));
|
||
//graph(0)->setBrush(QBrush(QPixmap(newLithosImage)));
|
||
}
|
||
else if(newFillType == "颜色模式")
|
||
{
|
||
graph(0)->setBrush(QBrush(newColor));
|
||
}
|
||
else if(newFillType == "成像化")
|
||
{
|
||
|
||
}
|
||
|
||
if(graph_Fill)
|
||
{
|
||
graph(0)->setChannelFillGraph( graph_Fill);//this->graph()
|
||
}
|
||
//
|
||
replot();
|
||
//update();
|
||
}
|
||
}
|
||
|
||
//void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
|
||
//{
|
||
// // 当前鼠标位置(像素坐标)
|
||
// //int x_pos = event->pos().x();
|
||
// int y_pos = event->pos().y();
|
||
|
||
// // 像素坐标转成实际的x,y轴的坐标
|
||
// //float x_val = yAxis->pixelToCoord(x_pos);
|
||
// float y_val = xAxis->pixelToCoord(y_pos);
|
||
|
||
// emit CallManage::getInstance()->sig_MouseMove(m_strUuid, m_strWellName, m_strTrackName, 0-y_val);
|
||
|
||
// QCustomPlot::mouseMoveEvent(event);
|
||
//}
|
||
|
||
|
||
void QMyCustomPlot::addRandomGraph(QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
|
||
double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle)
|
||
{
|
||
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph");
|
||
|
||
m_addRandomGraph=true;
|
||
|
||
m_x.append(x);
|
||
m_y.append(y);
|
||
|
||
QCPGraph *graph=addGraph();
|
||
if(strLineName=="")
|
||
{
|
||
strLineName = QString("曲线 %1").arg(graphCount());
|
||
}
|
||
graph->setName(strLineName);
|
||
//禁用自动重绘:在大量数据更新前禁用自动重绘
|
||
//setNotAntialiasedElements(QCP::aeAll);
|
||
|
||
//graph()->setData(x, y);
|
||
|
||
if(newLeftScale!=-9999)
|
||
{
|
||
if(m_bDrawCore_PHYSICS)//岩心分析
|
||
{
|
||
m_addRandomGraph=false;
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
|
||
}
|
||
else
|
||
{
|
||
//勾选3个
|
||
if(m_bDrawLine && m_bDrawGan && m_bDrawPoint)
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
|
||
}
|
||
//勾选2个
|
||
else if(m_bDrawLine && m_bDrawGan && !m_bDrawPoint){//曲线+杆状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(m_bDrawLine && !m_bDrawGan && m_bDrawPoint){//曲线+点状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
|
||
}
|
||
else if(!m_bDrawLine && m_bDrawGan && m_bDrawPoint){//杆状+点状
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
|
||
}
|
||
//勾选1个
|
||
else if(m_bDrawLine && !m_bDrawGan && !m_bDrawPoint)//曲线
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(!m_bDrawLine && m_bDrawGan && !m_bDrawPoint)//杆状
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));
|
||
}
|
||
else if(!m_bDrawLine && !m_bDrawGan && m_bDrawPoint)//点状
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsNone));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
|
||
}
|
||
//勾选0个
|
||
else if(!m_bDrawLine && !m_bDrawGan && !m_bDrawPoint)//曲线
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsNone));
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssNone)));
|
||
}
|
||
|
||
// graph()->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));//曲线
|
||
// graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));//点
|
||
}
|
||
|
||
QPen graphPen;
|
||
graphPen.setColor(newlineColor);
|
||
graphPen.setWidthF(width);
|
||
graphPen.setStyle(lineStyle);//实线
|
||
graph->setPen(graphPen);
|
||
}
|
||
else
|
||
{
|
||
if(m_bDrawCore_PHYSICS)//岩心分析
|
||
{
|
||
m_addRandomGraph=false;
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
|
||
}
|
||
else
|
||
{
|
||
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));//曲线
|
||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));//点
|
||
}
|
||
|
||
// graph()->setScatterStyle(QCPScatterStyle(QPixmap(":/image/file.png")));
|
||
//graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 5));
|
||
|
||
QPen graphPen;
|
||
newlineColor = QColor(std::rand()%245+10, std::rand()%245+10, std::rand()%245+10);
|
||
graphPen.setColor(newlineColor);
|
||
width = 2;
|
||
graphPen.setWidthF(width);
|
||
graphPen.setStyle(Qt::SolidLine);//实线
|
||
graph->setPen(graphPen);
|
||
//replot();
|
||
}
|
||
|
||
|
||
if(x.size()<m_iSplitNum)
|
||
{
|
||
graph->setData(x, y);
|
||
replot();
|
||
//replot(QCustomPlot::rpRefreshHint);// 仅刷新可见部分,跳过轴计算等
|
||
}
|
||
else
|
||
{
|
||
graph->setData(x.mid(0,m_iSplitNum), y.mid(0,m_iSplitNum));
|
||
replot();
|
||
|
||
m_iCurNum = m_iSplitNum;
|
||
QTimer::singleShot(100, this, SLOT(slot_time()));
|
||
}
|
||
|
||
|
||
}
|
||
|
||
void QMyCustomPlot::slot_time()
|
||
{
|
||
if(m_iCurNum >= m_x.size())
|
||
{
|
||
//处理完成
|
||
return;
|
||
}
|
||
|
||
//
|
||
if(m_x.size() <= m_iCurNum+m_iSplitNum)
|
||
{
|
||
graph()->addData(m_x.mid(m_iCurNum), m_y.mid(m_iCurNum));
|
||
m_iCurNum = m_x.size();
|
||
|
||
//处理完成,绘制对称曲线
|
||
if(m_bDrawSymmetry)
|
||
{
|
||
s_ChangeDrawSymmetry(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, m_bDrawSymmetry);
|
||
}
|
||
|
||
//处理完成,填充
|
||
//默认true,只有模板存在填充时,才会false
|
||
if(m_bFillNow==false)
|
||
{
|
||
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
|
||
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
|
||
m_vMin, m_vMax, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true);
|
||
|
||
}
|
||
replot();
|
||
}
|
||
else
|
||
{
|
||
graph()->addData(m_x.mid(m_iCurNum, m_iSplitNum), m_y.mid(m_iCurNum, m_iSplitNum));
|
||
m_iCurNum = m_iCurNum + m_iSplitNum;
|
||
//replot();
|
||
QTimer::singleShot(100, this, SLOT(slot_time()));
|
||
}
|
||
//replot();
|
||
}
|
||
|
||
//改变固井曲线名
|
||
void QMyCustomPlot::s_changeGujingLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
m_strLineName = strNewLineName;
|
||
//刷新数据
|
||
RefreshItems_Gujing();
|
||
}
|
||
|
||
//改变曲线名 //气测/FMT/射孔/文本
|
||
void QMyCustomPlot::s_changeJiegutextLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
m_strLineName = strNewLineName;
|
||
//刷新数据
|
||
RefreshItems_Jiegutext();
|
||
}
|
||
|
||
//改变曲线Title //气测/FMT/射孔/文本
|
||
void QMyCustomPlot::s_changeJiegutextTitle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
//删除对象
|
||
TransparentDraggableJiegutext *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin();
|
||
while( it != m_mapDraggable_Jiegutext.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableJiegutext*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
//QString strAliasName = "气测-FMT-射孔-文本";
|
||
LoadFromSLF_Jiegutext(m_strSlfName, m_strLineName, strAliasName);
|
||
//属性清空(LoadFromSLF_Jiegutext内部调用)
|
||
//PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//改变录井剖面属性
|
||
void QMyCustomPlot::s_changeGeoLithLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double dOilZhan)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
m_dOilZhan = dOilZhan;
|
||
//删除对象
|
||
TransparentDraggableGeoLith *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
|
||
while( it != m_mapDraggable_GeoLith.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
LoadFromSLF_GeoLith(m_strSlfName, m_strLineName);
|
||
|
||
//不清空属性窗口
|
||
}
|
||
|
||
//改变录井剖面属性,是否显示
|
||
void QMyCustomPlot::s_changeGeoLithShow(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString propertyData, bool bShow)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(propertyData == "岩性配色显示")
|
||
{
|
||
m_bLithColor = bShow;
|
||
}
|
||
else if(propertyData == "单岩性显示")
|
||
{
|
||
m_bLithOne = bShow;
|
||
}
|
||
else if(propertyData == "显示含油性")
|
||
{
|
||
m_bShowOil = bShow;
|
||
}
|
||
else if(propertyData == "含油性居中")
|
||
{
|
||
m_bCenterOil = bShow;
|
||
}
|
||
else if(propertyData == "显示颜色")
|
||
{
|
||
m_bShowColor = bShow;
|
||
}
|
||
else if(propertyData == "绘制颜色号")
|
||
{
|
||
m_bShowColorNum = bShow;
|
||
}
|
||
|
||
//删除对象
|
||
TransparentDraggableGeoLith *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
|
||
while( it != m_mapDraggable_GeoLith.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
LoadFromSLF_GeoLith(m_strSlfName, m_strLineName);
|
||
|
||
//不清空属性窗口
|
||
}
|
||
|
||
//改变沉积相属性,是否显示
|
||
void QMyCustomPlot::s_changeFacShow(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString propertyData, bool bShow)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(propertyData == "绘制相")
|
||
{
|
||
m_bDrawFac = bShow;
|
||
RefreshItems_Fac(false); //刷新数据
|
||
{
|
||
//微相
|
||
TransparentDraggableMFac *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_MFac.begin();
|
||
while( it != m_mapDraggable_MFac.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableMFac*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//统一刷新
|
||
replot();
|
||
}
|
||
}
|
||
else if(propertyData == "绘制亚相")
|
||
{
|
||
m_bDrawPhase = bShow;
|
||
RefreshItems_Fac(false); //刷新数据
|
||
{
|
||
//微相
|
||
TransparentDraggableMFac *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_MFac.begin();
|
||
while( it != m_mapDraggable_MFac.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableMFac*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//统一刷新
|
||
replot();
|
||
}
|
||
}
|
||
else if(propertyData == "微相名称")
|
||
{
|
||
m_bDrawMFacName = bShow;
|
||
{
|
||
//微相
|
||
TransparentDraggableMFac *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_MFac.begin();
|
||
while( it != m_mapDraggable_MFac.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableMFac*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//统一刷新
|
||
replot();
|
||
}
|
||
}
|
||
|
||
|
||
//不清空属性窗口
|
||
}
|
||
|
||
//绘制结构
|
||
void QMyCustomPlot::DrawStruct()
|
||
{
|
||
//先删除
|
||
if(mRect_Tubing)
|
||
{
|
||
removeItem(mRect_Tubing);
|
||
mRect_Tubing = nullptr;
|
||
}
|
||
if(mRect2_Tubing)
|
||
{
|
||
removeItem(mRect2_Tubing);
|
||
mRect2_Tubing = nullptr;
|
||
}
|
||
if(m_bDrawStruct_Tubing)
|
||
{
|
||
//绘制套管
|
||
float upper = this->xAxis->range().upper;
|
||
float lower = this->xAxis->range().lower;
|
||
// double lY1 = 0;//this->yAxis->range().lower;
|
||
// double lY2 = m_OutD_Tubing;//this->yAxis->range().upper - this->yAxis->range().lower; //this->yAxis->range().upper;
|
||
// 创建矩形
|
||
mRect_Tubing = new QCPItemRect(this);
|
||
mRect_Tubing->setLayer("overlay"); // 确保在最上层
|
||
mRect_Tubing->setBrush(QBrush(QColor(0, 0, 0, 255)));
|
||
mRect_Tubing->setPen(QPen(QColor(0, 0, 0, 255)));
|
||
//
|
||
double lyTmp = 0; //lY1 + (lY2-lY1-m_OutD_Tubing)/2.0;
|
||
if(lyTmp<0)
|
||
{
|
||
lyTmp=0;
|
||
}
|
||
mRect_Tubing->topLeft->setCoords(lower, lyTmp);
|
||
//
|
||
double lyTmp2 = (m_OutD_Tubing-m_inD_Tubing)/2.0; //lY1 + (lY2-lY1-m_inD_Tubing)/2.0;
|
||
if(lyTmp2<0)
|
||
{
|
||
lyTmp2=0;
|
||
}
|
||
mRect_Tubing->bottomRight->setCoords(upper, lyTmp2);
|
||
|
||
// 创建矩形
|
||
mRect2_Tubing = new QCPItemRect(this);
|
||
mRect2_Tubing->setLayer("overlay"); // 确保在最上层
|
||
mRect2_Tubing->setBrush(QBrush(QColor(0, 0, 0, 255)));
|
||
mRect2_Tubing->setPen(QPen(QColor(0, 0, 0, 255)));
|
||
lyTmp = m_OutD_Tubing/2.0 + m_inD_Tubing/2.0; //lY2 - (lY2-lY1-m_OutD_Tubing)/2.0
|
||
mRect2_Tubing->topLeft->setCoords(lower, lyTmp);
|
||
//
|
||
lyTmp2 = m_OutD_Tubing; //lY2 - (lY2-lY1-m_inD_Tubing)/2.0;
|
||
mRect2_Tubing->bottomRight->setCoords(upper, lyTmp2);
|
||
|
||
//
|
||
|
||
}
|
||
}
|
||
|
||
//绘制管柱
|
||
void QMyCustomPlot::DrawTubing()
|
||
{
|
||
//先删除
|
||
if(mPixmap_Tubing)
|
||
{
|
||
removeItem(mPixmap_Tubing);
|
||
mPixmap_Tubing = nullptr;
|
||
}
|
||
if(m_bDrawTubing_Tubing)
|
||
{
|
||
QString shotimgfile=GetSymbolDir()+"\\管柱组件\\管柱.png";
|
||
|
||
double lY1 = 0;//this->yAxis->range().lower;//+10
|
||
double lY2 = m_OutD_Tubing;//this->yAxis->range().upper - this->yAxis->range().lower; //this->yAxis->range().upper;
|
||
//
|
||
|
||
mPixmap_Tubing = new QCPItemPixmap(this);
|
||
//mPixmap->setPixmap(QPixmap(":/image/file.png")); // 设置图片
|
||
mPixmap_Tubing->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式
|
||
mPixmap_Tubing->setLayer("grid"); // 确保在最上层overlay
|
||
//
|
||
float upper = this->xAxis->range().upper;
|
||
mPixmap_Tubing->topLeft->setCoords(upper, lY1 + (lY2-lY1-m_Oguan_Tubing)/2.0);
|
||
mPixmap_Tubing->bottomRight->setCoords(-m_depth_Tubing, lY2 - (lY2-lY1-m_Oguan_Tubing)/2.0);
|
||
mPixmap_Tubing->setPixmap(QPixmap(shotimgfile)); // 设置图片
|
||
}
|
||
}
|
||
|
||
//改变套管组件属性,是否显示
|
||
void QMyCustomPlot::s_changeGuanShow(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString propertyData, bool bShow)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(propertyData == "绘制结构")
|
||
{
|
||
m_bDrawStruct_Tubing = bShow;
|
||
//绘制结构
|
||
DrawStruct();
|
||
//刷新
|
||
replot();
|
||
}
|
||
else if(propertyData == "绘制管柱")
|
||
{
|
||
m_bDrawTubing_Tubing = bShow;
|
||
|
||
//绘制管柱
|
||
DrawTubing();
|
||
//刷新
|
||
replot();
|
||
}
|
||
else if(propertyData == "绘制工具")
|
||
{
|
||
m_bDrawTools_Tubing = bShow;
|
||
{
|
||
//
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//统一刷新
|
||
replot();
|
||
}
|
||
}
|
||
else if(propertyData == "标注工具")
|
||
{
|
||
m_bDrawSPTool_Tubing = bShow;
|
||
{
|
||
//
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//统一刷新
|
||
replot();
|
||
}
|
||
}
|
||
else if(propertyData == "绘制接箍")
|
||
{
|
||
m_bDrawCCL_Tubing = bShow;
|
||
{
|
||
//
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(m_bDrawCCL_Tubing)
|
||
{
|
||
pDraggableRect->mIn = m_inD_Tubing+1;
|
||
}
|
||
else
|
||
{
|
||
pDraggableRect->mIn = m_Oguan_Tubing+1;
|
||
}
|
||
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//统一刷新
|
||
replot();
|
||
}
|
||
}
|
||
|
||
|
||
//不清空属性窗口
|
||
}
|
||
|
||
//改变套管组件属性,是否显示
|
||
void QMyCustomPlot::s_changeGuanD(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString propertyData, double newD)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(propertyData == "油管外径")
|
||
{
|
||
m_Oguan_Tubing = newD;
|
||
//绘制管柱
|
||
DrawTubing();
|
||
//
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(m_bDrawCCL_Tubing)
|
||
{
|
||
pDraggableRect->mIn = m_inD_Tubing+1;
|
||
}
|
||
else
|
||
{
|
||
pDraggableRect->mIn = m_Oguan_Tubing+1;
|
||
}
|
||
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//刷新
|
||
replot();
|
||
}
|
||
else if(propertyData == "套管内径")
|
||
{
|
||
m_inD_Tubing = newD;
|
||
//绘制结构
|
||
DrawStruct();
|
||
//
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
if(m_bDrawCCL_Tubing)
|
||
{
|
||
pDraggableRect->mIn = m_inD_Tubing+1;
|
||
}
|
||
else
|
||
{
|
||
pDraggableRect->mIn = m_Oguan_Tubing+1;
|
||
}
|
||
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//刷新
|
||
replot();
|
||
}
|
||
else if(propertyData == "套管外径")
|
||
{
|
||
m_OutD_Tubing = newD;
|
||
//绘制结构
|
||
DrawStruct();
|
||
//先画图,再改变左右刻度
|
||
this->m_iX1 = 0;
|
||
this->m_iX2 = m_OutD_Tubing;
|
||
this->yAxis->setRange(this->m_iX1, this->m_iX2);
|
||
|
||
//绘制管柱
|
||
DrawTubing();
|
||
//绘制工具
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
//刷新
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
// if(m_bDrawCCL_Tubing)
|
||
// {
|
||
// pDraggableRect->mIn = m_inD_Tubing+1;
|
||
// }
|
||
// else
|
||
// {
|
||
// pDraggableRect->mIn = m_Oguan_Tubing+1;
|
||
// }
|
||
|
||
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper, false);
|
||
}
|
||
//刷新
|
||
replot();
|
||
}
|
||
|
||
//不清空属性窗口
|
||
}
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_Layer(QString strSlfName, QString strLineName)
|
||
{
|
||
LAYER_DATA m_Result;
|
||
if(strSlfName=="") return false;
|
||
CLogIO *logio=new CLogIO();
|
||
if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return false;
|
||
}
|
||
|
||
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
||
if (iIndex <0) {
|
||
iIndex=logio->OpenTable("LAYER_DATA");
|
||
}
|
||
|
||
if (iIndex >=0)
|
||
{
|
||
int count=logio->GetTableRecordCount(iIndex);
|
||
|
||
int ColorNum=6;
|
||
if(ColorNum<1) ColorNum=1;
|
||
QList<QRgb> rgbList;
|
||
rgbList.append(QRgb(4294967295));
|
||
rgbList.append(QRgb(4294966617));
|
||
rgbList.append(QRgb(4294944512));
|
||
rgbList.append(QRgb(4293345792));
|
||
rgbList.append(QRgb(4288741473));
|
||
rgbList.append(QRgb(4278190080));
|
||
|
||
for(int j=0;j<count;j++) {
|
||
memset(&m_Result,0,sizeof(LAYER_DATA));
|
||
logio->ReadTable(iIndex,j+1,&m_Result);
|
||
float sdep=m_Result.StartDepth;
|
||
float edep=m_Result.EndDepth;
|
||
//
|
||
char buf[490];
|
||
buf[0]=0;
|
||
::GetDescription(m_Result,buf);
|
||
|
||
QColor bkColor = rgbList.at(j%ColorNum);
|
||
|
||
//地质分层
|
||
this->addLayerToPlot(-edep, -sdep, QString::fromLocal8Bit(buf), false, bkColor);
|
||
}
|
||
//统一刷新
|
||
this->replot();
|
||
|
||
logio->CloseTable(iIndex);
|
||
}
|
||
delete logio;
|
||
return true;
|
||
}
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_Text(QString strSlfName, QString strLineName)
|
||
{
|
||
QString FieldName="RESULT";
|
||
|
||
{
|
||
QString ss=strSlfName;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return false;
|
||
}
|
||
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
||
if(iIndex>-1) {
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
if(len<sizeof(WORDS_DATA)) len=sizeof(WORDS_DATA);
|
||
char*buf=new char[len+1];
|
||
WORDS_DATA *m_Result=(WORDS_DATA *)buf;
|
||
|
||
int count=logio->GetTableRecordCount(iIndex);
|
||
for(int i=0;i<count;i++) {
|
||
memset(m_Result,0,sizeof(WORDS_DATA));
|
||
logio->ReadTable(iIndex,i+1,m_Result);
|
||
// WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth);
|
||
// if(!item) continue;
|
||
// OGWordsResultItem* pResult = dynamic_cast<OGWordsResultItem*>(item);
|
||
logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Words,i+1);
|
||
|
||
if(strstr(m_Result->Words,"$L")) {
|
||
char *s=strstr(m_Result->Words,"$L");
|
||
if(strstr(s+2,"$U")) {
|
||
char *p=strstr(s+1,"$U");
|
||
int len=p-s-2;
|
||
char buf1[100];
|
||
strncpy(buf1,s+2,len);
|
||
buf1[len]=0;
|
||
// SetLeftAndRightAlign(atoi(buf1));
|
||
// SetUpAndDownAlign(atoi(p+2));
|
||
}
|
||
else {
|
||
// SetLeftAndRightAlign(atoi(s+2));
|
||
}
|
||
*s=0;
|
||
}
|
||
else if(strstr(m_Result->Words,"$U")){
|
||
char *p=strstr(m_Result->Words,"$U");
|
||
// SetUpAndDownAlign(atoi(p+2));
|
||
*p=0;
|
||
}
|
||
// SetCharacters(m_Result->Words);
|
||
|
||
// fontColor=QColor(0,0,0,255);
|
||
// backgroundColor=QColor(255,255,255,255);
|
||
// wordfont.setFamily("黑体");
|
||
// wordfont.setPointSize(10);
|
||
|
||
//插入文本
|
||
this->addTextToPlot(-m_Result->EndDepth, -m_Result->StartDepth, QString::fromLocal8Bit(m_Result->Words), false);
|
||
}
|
||
//统一刷新
|
||
this->replot();
|
||
|
||
logio->CloseTable(iIndex);
|
||
delete buf;
|
||
}
|
||
delete logio;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::addItems_Text()
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace("\t"," ");
|
||
originalText.replace(","," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
QStringList line=originalText.split("\n");
|
||
line.removeAll("");
|
||
for(int i=0;i<line.size();i++) {
|
||
QStringList coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||
|
||
//文字结论
|
||
AddItem_Text(coredat);
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_Text();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
void QMyCustomPlot::AddItem_Text(QStringList lists)
|
||
{
|
||
if(lists.size()==3) lists.insert(0,"0");
|
||
double top=-9999.0;
|
||
double bottom=-9999.0;
|
||
if(lists.size()>1) top=lists[1].toDouble();
|
||
if(lists.size()>2) bottom=lists[2].toDouble();
|
||
if(top&&bottom==0) bottom=top;
|
||
if(top==bottom&&top==-9999.0) return;
|
||
|
||
if(lists.size()<4)
|
||
{
|
||
this->addTextToPlot(-bottom, -top, "");
|
||
return;
|
||
}
|
||
|
||
//插入文本
|
||
this->addTextToPlot(-bottom, -top, lists[3]);
|
||
}
|
||
|
||
//全部清空
|
||
void QMyCustomPlot::DeleteItems_Text()
|
||
{
|
||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||
QString obj=m_strLineName + "BAK";
|
||
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
|
||
AddTableToWellRound();
|
||
|
||
//删除对象
|
||
TransparentDraggableRect *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Rect.begin();
|
||
while( it != m_mapDraggable_Rect.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableRect*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_Text();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//刷新数据
|
||
void QMyCustomPlot::RefreshItems_Text()
|
||
{
|
||
//删除对象
|
||
TransparentDraggableRect *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Rect.begin();
|
||
while( it != m_mapDraggable_Rect.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableRect*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//加载
|
||
this->LoadFromSLF_Text(m_strSlfName, m_strLineName);
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//全部清空
|
||
void QMyCustomPlot::DeleteItems_Layer()
|
||
{
|
||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||
QString obj=m_strLineName + "BAK";
|
||
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
|
||
AddTableToWellRound();
|
||
|
||
//删除对象
|
||
TransparentDraggableLayer *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Layer.begin();
|
||
while( it != m_mapDraggable_Layer.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableLayer*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_Layer();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//刷新数据
|
||
void QMyCustomPlot::RefreshItems_Layer()
|
||
{
|
||
//删除对象
|
||
TransparentDraggableLayer *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Layer.begin();
|
||
while( it != m_mapDraggable_Layer.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableLayer*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//加载
|
||
this->LoadFromSLF_Layer(m_strSlfName, m_strLineName);
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::addItems_Layer()
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace("\t"," ");
|
||
originalText.replace(","," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
QStringList line=originalText.split("\n");
|
||
line.removeAll("");
|
||
for(int i=0;i<line.size();i++) {
|
||
QStringList coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||
|
||
//地质分层
|
||
AddItem_Layer(coredat);
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_Layer();
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
void QMyCustomPlot::AddItem_Layer(QStringList lists)
|
||
{
|
||
if(lists.size()==3) lists.insert(0,"0");
|
||
double top=-9999.0;
|
||
double bottom=-9999.0;
|
||
if(lists.size()>1) top=lists[1].toDouble();
|
||
if(lists.size()>2) bottom=lists[2].toDouble();
|
||
if(top&&bottom==0) bottom=top;
|
||
if(top==bottom&&top==-9999.0) return;
|
||
|
||
if(lists.size()<4)
|
||
{
|
||
this->addLayerToPlot(-bottom, -top, "");
|
||
return;
|
||
}
|
||
|
||
//插入文本
|
||
this->addLayerToPlot(-bottom, -top, lists[3]);
|
||
}
|
||
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_Jiegutext(QString strSlfName, QString csCurve, QString strAliasName)
|
||
{
|
||
Slf_TxtPOS *m_pResult=NULL;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return false;
|
||
}
|
||
|
||
int iIndex=logio->OpenTable(csCurve.toStdString().c_str());
|
||
if(iIndex<0) {
|
||
delete logio;
|
||
return false;
|
||
}
|
||
if(iIndex>-1) {
|
||
int count = logio->GetTableRecordCount(iIndex);
|
||
int fieldnum = logio->GetTableFieldCount(iIndex);
|
||
int len = logio->GetTableRecordLength(iIndex);
|
||
Slf_TABLE_FIELD *pField=new Slf_TABLE_FIELD[fieldnum+1];
|
||
logio->GetTableFieldInfo(iIndex,pField);
|
||
|
||
m_FieldNameList.clear();
|
||
m_FieldUnitList.clear();
|
||
m_FieldHZNameList.clear();
|
||
m_FieldHZUnitList.clear();
|
||
//
|
||
for(int i=0;i<fieldnum;i++)
|
||
{
|
||
m_FieldNameList.push_back(QString::fromLocal8Bit(pField[i].Name));
|
||
m_FieldHZNameList.push_back(QString::fromLocal8Bit(pField[i].HZName));
|
||
m_FieldUnitList.push_back(QString::fromLocal8Bit(pField[i].Unit));
|
||
m_FieldHZUnitList.push_back(QString::fromLocal8Bit(pField[i].HZUnit));
|
||
}
|
||
delete pField;
|
||
|
||
QStringList listAliasName = strAliasName.split("/");//QString字符串分割函数
|
||
|
||
//
|
||
m_pResult=(Slf_TxtPOS *)new char[len+1];
|
||
char buf[200];
|
||
for(int i=0;i<count;i++) {
|
||
logio->GetTableFieldData(iIndex,0,buf,i+1);
|
||
m_pResult->Order=atof(buf);
|
||
logio->GetTableFieldData(iIndex,1,buf,i+1);
|
||
m_pResult->Depth=atof(buf);
|
||
logio->GetTableFieldData(iIndex,2,buf,i+1);
|
||
m_pResult->CorrDepth=atof(buf);
|
||
double top=m_pResult->Depth;
|
||
double bottom=m_pResult->Depth;
|
||
if(m_FieldNameList.size()>2&&
|
||
(m_FieldNameList[2].indexOf("EDEP")>-1 ||
|
||
m_FieldNameList[2].indexOf("ENDEP")>-1)
|
||
)
|
||
{
|
||
bottom=m_pResult->CorrDepth;
|
||
}
|
||
|
||
QStringList coredat;
|
||
CoreValues.clear();
|
||
ValueTypes.clear();
|
||
for(int j=0;j<fieldnum;j++)
|
||
{
|
||
int iType = logio->GetTableFieldData(iIndex,j,buf,i+1);
|
||
ValueTypes.append(iType);
|
||
float val=0;
|
||
val=atof(buf);
|
||
coredat.append(QString::number(val));
|
||
|
||
if(listAliasName.contains(m_FieldNameList[j]))
|
||
{
|
||
CoreValues.append(QString::number(val));
|
||
}
|
||
}
|
||
|
||
//
|
||
this->addJiegutextToPlot(-bottom, -top, CoreValues, coredat, false);
|
||
}
|
||
//统一刷新
|
||
this->replot();
|
||
logio->CloseTable(iIndex);
|
||
delete m_pResult;
|
||
}
|
||
delete logio;
|
||
|
||
//设置所有title,供用户选择
|
||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||
if (pInfo == NULL)
|
||
{
|
||
return true;
|
||
}
|
||
//
|
||
pInfo->m_strAliasName = strAliasName;
|
||
pInfo->m_FieldNameList.clear();
|
||
pInfo->m_FieldNameList.append(this->m_FieldNameList);
|
||
pInfo->update();
|
||
|
||
//属性清空
|
||
//PropertyService()->InitCurrentViewInfo();
|
||
|
||
return true;
|
||
}
|
||
|
||
//从剪切板文本数据粘贴
|
||
void QMyCustomPlot::addItems_Jiegutext()
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalText = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalText.indexOf(" ");
|
||
int istab=originalText.indexOf("\t");
|
||
int isd=originalText.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalText.replace("\t"," ");
|
||
originalText.replace(","," ");
|
||
originalText.replace("\r\n","\n");
|
||
originalText.replace("\r","\n");
|
||
QStringList line=originalText.split("\n");
|
||
line.removeAll("");
|
||
if(line.size()<1) return;
|
||
QString TableName;
|
||
QStringList temp1;
|
||
|
||
if(line.size()>1) {
|
||
temp1=line[0].split(" ");
|
||
temp1.removeAll("");
|
||
if(temp1.size()==1&&temp1.at(0).length()&&!temp1.at(0).at(0).isDigit()) {
|
||
TableName=temp1.at(0);
|
||
line.removeAt(0);
|
||
//CoreObj->SetName(TableName);//此处更改曲线名称,暂时不处理
|
||
}
|
||
}
|
||
QString ss=m_strSlfName;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return;
|
||
}
|
||
int k=0;
|
||
QStringList coredat=line[0].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if(iIndex>=0) {
|
||
int count=logio->GetTableFieldCount(iIndex);
|
||
if(count!=coredat.size()) {
|
||
logio->DiscardObject(m_strLineName.toStdString().c_str());
|
||
}
|
||
iIndex=-1;
|
||
}
|
||
bool hasNO=false;
|
||
int isSK=0;
|
||
bool isfirst=false;
|
||
if(iIndex<0)
|
||
{
|
||
QString name,Length,type,temp;
|
||
bool ret=false;
|
||
QStringList css;
|
||
if(line.size()>1) css=line[1].split(" ");
|
||
if(coredat.size()&&!coredat[0].isEmpty()) {
|
||
int NUM=0;
|
||
if(!coredat.at(0).at(0).isDigit()){
|
||
if(coredat.at(0).indexOf("NO",0,Qt::CaseInsensitive)<0
|
||
&&coredat.at(0).indexOf("序号")<0
|
||
&&coredat.at(0).indexOf("INDEX")<0
|
||
&&coredat.at(0).indexOf("ORDER")<0
|
||
)
|
||
{
|
||
coredat.insert(0,"NO");
|
||
hasNO=true;
|
||
}
|
||
}
|
||
if(hasNO) css.insert(0,"1");
|
||
if((m_strLineName.indexOf("SK",0,Qt::CaseInsensitive)>-1||m_strLineName.indexOf("PERT",0,Qt::CaseInsensitive)>-1)&&(coredat.size()==4||coredat.size()==5))
|
||
{
|
||
isSK=1;
|
||
name="NO,SDEP,EDEP,ZONE,RESULT,THICK,TT,ZONENO,LAYER,DEST";
|
||
Length="4,4,4,8,4,4,4,64,64,64";
|
||
type= "1,4,4,6,1,4,4,6,6,6";
|
||
temp= "0,0,0,0,1,0,0,0,0,0";
|
||
NUM=10;
|
||
}
|
||
else {
|
||
//CViewInfoText*pInv=dynamic_cast<CViewInfoText*>(m_discreteLogViewInfo);
|
||
for(int j=0;j<coredat.size();j++)
|
||
{
|
||
if(j==0) name+="NO";
|
||
else if(j==1) name+="SDEP";
|
||
else if(j==2)name+="EDEP";
|
||
if(j==0){
|
||
Length+="4";
|
||
type+="1";
|
||
}
|
||
else {
|
||
bool isdi=false;
|
||
if(css.size()>j)
|
||
{
|
||
for (int k=0;k<css.at(j).size();k++)
|
||
{
|
||
if(!css.at(j).at(k).isDigit()&&css.at(j).at(k)!='.'&&css.at(j).at(k)!='-'){
|
||
isdi=true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
bool bDrawGASLOG=false;
|
||
//if(pInv&&pInv->GetDrawGASLOG()||isdi) {
|
||
if(bDrawGASLOG||isdi) {
|
||
type+="6";
|
||
Length+="64";
|
||
}
|
||
else {
|
||
type+="4";
|
||
Length+="4";
|
||
}
|
||
}
|
||
temp+="0";
|
||
if(j!=coredat.size())
|
||
{
|
||
name+=",";
|
||
Length+=",";
|
||
type+=",";
|
||
temp+=",";
|
||
}
|
||
}
|
||
if(!coredat.at(0).at(0).isDigit()&&coredat.at(0).at(0)!='.'&&coredat.at(0).at(0)!='-') name=coredat.join(",");
|
||
NUM=coredat.size();
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,NUM,
|
||
(char*)name.toStdString().c_str(),
|
||
(char*)Length.toStdString().c_str(),//字段长度
|
||
(char*)type.toStdString().c_str(),//字段类型
|
||
(char*)temp.toStdString().c_str());//字段备注,1-枚举
|
||
isfirst=true;
|
||
logio->SetTableRecordCount(iIndex,0);
|
||
}
|
||
}
|
||
|
||
//
|
||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||
if (pInfo == NULL)
|
||
{
|
||
return;
|
||
}
|
||
//
|
||
QString strAliasName = pInfo->m_strAliasName;
|
||
QStringList listAliasName = strAliasName.split("/");//QString字符串分割函数
|
||
|
||
//
|
||
int count=logio->GetTableFieldCount(iIndex);
|
||
Slf_TABLE_FIELD*pField=new Slf_TABLE_FIELD[count];
|
||
logio->GetTableFieldInfo(iIndex,pField);
|
||
//
|
||
m_FieldNameList.clear();
|
||
for(int i=0;i<count;i++) {
|
||
m_FieldNameList.push_back(pField[i].Name);
|
||
}
|
||
//
|
||
//k = 0;
|
||
float yy;
|
||
for(int i=0;i<line.size();i++)
|
||
{
|
||
coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(coredat[0].isEmpty()) continue;
|
||
if(coredat.size()<2)continue;
|
||
if(!coredat.at(0).at(0).isDigit()) continue;
|
||
if(hasNO) coredat.insert(0,QString::number(0));
|
||
// for(int j=0;j<coredat.size();j++)
|
||
// {
|
||
// if(isSK&&(coredat.size()==5||coredat.size()==6))
|
||
// {
|
||
// if(j<3){
|
||
// yy=coredat[j].toFloat();
|
||
// logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
|
||
// }
|
||
// else if(j==3) logio->SetTableFieldData(iIndex,7,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// else if(j==4) logio->SetTableFieldData(iIndex,8,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// else if(j==5) logio->SetTableFieldData(iIndex,9,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// }
|
||
// else {
|
||
// if(pField[j].RepCode==6) {
|
||
// logio->SetTableFieldData(iIndex,j,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// }
|
||
// else {
|
||
// yy=coredat[j].toFloat();
|
||
// logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
|
||
// }
|
||
// }
|
||
// }
|
||
// k++;
|
||
|
||
//-------------------------------------
|
||
CoreValues.clear();
|
||
for(int j=0;j<coredat.size();j++)
|
||
{
|
||
if(listAliasName.contains(m_FieldNameList[j]))
|
||
{
|
||
CoreValues.append(coredat[j]);
|
||
}
|
||
}
|
||
//
|
||
double top=coredat[1].toDouble();
|
||
double bottom=coredat[1].toDouble();
|
||
if(m_FieldNameList.size()>2&&
|
||
(m_FieldNameList[2].indexOf("EDEP")>-1 ||
|
||
m_FieldNameList[2].indexOf("ENDEP")>-1)
|
||
)
|
||
{
|
||
bottom=coredat[2].toDouble();
|
||
}
|
||
this->addJiegutextToPlot(-bottom, -top, CoreValues, coredat);
|
||
}
|
||
delete logio;
|
||
delete []pField;
|
||
if(isfirst)
|
||
{
|
||
AddTableToWellRound();
|
||
pInfo->m_FieldNameList.clear();
|
||
pInfo->m_FieldNameList.append(m_FieldNameList);
|
||
}
|
||
|
||
SaveToSLF_Jiegutext();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
bool QMyCustomPlot::SaveToSLF_Jiegutext()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
Slf_TxtPOS m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
bool isfirst=false;
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_Jiegutext.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,3,
|
||
"NO,DEPTH,DDEP",
|
||
"4,4,4",//字段长度
|
||
"1,4,4",//字段类型
|
||
"0,0,0");//字段备注,1-枚举
|
||
isfirst=true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_Jiegutext.size());
|
||
if(!m_mapDraggable_Jiegutext.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
|
||
int count=logio->GetTableFieldCount(iIndex);
|
||
Slf_TABLE_FIELD *pField = new Slf_TABLE_FIELD[count];
|
||
logio->GetTableFieldInfo(iIndex,pField);
|
||
|
||
TransparentDraggableJiegutext *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Jiegutext.begin(); iter != m_mapDraggable_Jiegutext.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableJiegutext*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Jiegutext.begin(); iter != m_mapDraggable_Jiegutext.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableJiegutext*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(Slf_TxtPOS));
|
||
m_Result.Order = i+1;
|
||
m_Result.Depth = -tmpRange.upper;
|
||
m_Result.CorrDepth = -tmpRange.lower;
|
||
float yy=m_Result.Order;
|
||
logio->SetTableFieldData(iIndex,0,(char *)&yy,i+1);
|
||
yy=m_Result.Depth;
|
||
logio->SetTableFieldData(iIndex,1,(char *)&yy,i+1);
|
||
yy=m_Result.CorrDepth;
|
||
logio->SetTableFieldData(iIndex,2,(char *)&yy,i+1);
|
||
|
||
for(int iRecNum=3; iRecNum<pDraggableRect->mList_coredat.size(); iRecNum++)
|
||
{
|
||
if(pField[iRecNum].RepCode==6) {
|
||
logio->SetTableFieldData(iIndex, iRecNum, (char*)pDraggableRect->mList_coredat[iRecNum].toStdString().c_str(), i+1);
|
||
}
|
||
else {
|
||
yy=pDraggableRect->mList_coredat[iRecNum].toFloat();
|
||
logio->SetTableFieldData(iIndex,iRecNum,(char*)&yy,i+1);
|
||
}
|
||
//logio->SetTableFieldData(iIndex,iRecNum,(char*)pDraggableRect->mList_coredat[iRecNum].toLocal8Bit().data(),i+1);//toStdString().c_str()
|
||
}
|
||
//
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete []pField;
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return true;
|
||
}
|
||
|
||
//全部清空
|
||
void QMyCustomPlot::DeleteItems_Jiegutext()
|
||
{
|
||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||
QString obj=m_strLineName + "BAK";
|
||
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
|
||
AddTableToWellRound();
|
||
|
||
//删除对象
|
||
TransparentDraggableJiegutext *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin();
|
||
while( it != m_mapDraggable_Jiegutext.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableJiegutext*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//保存
|
||
this->SaveToSLF_Jiegutext();
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//刷新数据
|
||
void QMyCustomPlot::RefreshItems_Jiegutext()
|
||
{
|
||
//删除对象
|
||
TransparentDraggableJiegutext *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin();
|
||
while( it != m_mapDraggable_Jiegutext.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableJiegutext*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//
|
||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||
if (pInfo == NULL)
|
||
{
|
||
return;
|
||
}
|
||
//
|
||
QString strAliasName = pInfo->m_strAliasName;
|
||
//加载
|
||
this->LoadFromSLF_Jiegutext(m_strSlfName, m_strLineName, strAliasName);
|
||
//属性清空(LoadFromSLF_Jiegutext内部调用)
|
||
//PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
void QMyCustomPlot::onOpenEditResult()
|
||
{
|
||
m_bEditor = true;
|
||
this->selectionRect()->setPen(Qt::NoPen);
|
||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||
this->setSelectionRectMode(QCP::srmSelect); // 鼠标框选
|
||
}
|
||
|
||
void QMyCustomPlot::onCloseEditResult()
|
||
{
|
||
ClearSelectItems();
|
||
m_bEditor = false;
|
||
//取消框选
|
||
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||
this->setSelectionRectMode(QCP::srmNone);
|
||
}
|
||
|
||
void QMyCustomPlot::DeleteItemGroup()
|
||
{
|
||
if (m_strLineName == "RESULT")
|
||
{
|
||
QStringList listRemove;
|
||
QMap<QString, QObject*>::iterator it = m_mapDragGroup.begin();
|
||
for (; it != m_mapDragGroup.end(); ++it)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(it.value());
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
if (pGroup->getSelect())
|
||
listRemove << it.key();
|
||
}
|
||
|
||
for (int i = 0; i < listRemove.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(m_mapDragGroup.value(listRemove.at(i)));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
pGroup->removeAllResult();
|
||
}
|
||
SaveToSLF_Result();
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::updateGroupZone()
|
||
{
|
||
QMap<double, QString> mapSort;
|
||
QMap<QString, QObject*>::iterator it = m_mapDragGroup.begin();
|
||
for (; it != m_mapDragGroup.end(); ++it)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(it.value());
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
|
||
mapSort.insert(pGroup->getRange().upper, it.key());
|
||
}
|
||
int nZid = 1;
|
||
QList<double> listkey = mapSort.keys();
|
||
for (int i = listkey.size() - 1; i >= 0; i--)
|
||
{
|
||
QString skey = mapSort.value(listkey.at(i));
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(m_mapDragGroup.value(skey));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
pGroup->setTitle(QString::number(nZid));
|
||
nZid++;
|
||
}
|
||
this->replot();
|
||
|
||
SaveToSLF_Result();
|
||
}
|
||
|
||
bool QMyCustomPlot::SaveToSLF_Result()
|
||
{
|
||
static int isrun = false;
|
||
if (isrun) return false;
|
||
QString ss = m_strSlfName;
|
||
if (ss == "") return false;
|
||
isrun = true;
|
||
|
||
CMemRdWt *logio = new CMemRdWt();
|
||
if (ss == "" || !logio->Open(ss.toStdString().c_str(), CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL, "提示", "SLF文件打开失败,请检查!!", QMessageBox::Yes);
|
||
isrun = false;
|
||
return false;
|
||
}
|
||
int resultGroupSize = m_mapDragGroup.size();
|
||
bool isfirst = false;
|
||
int iIndex = logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if (iIndex < 0)
|
||
{
|
||
if (!resultGroupSize) {
|
||
delete logio;
|
||
isrun = false;
|
||
return false;
|
||
}
|
||
iIndex = logio->Open_Set_Table(m_strLineName.toStdString().c_str(), 0, 35,
|
||
"NO,SDEP,EDEP,ZONE,RESULTNO,THICK,TT,MDEPTH1,MDEPTH2,MDEPTH3,MDEPTH4,MDEPTH5,MDEPTH6,MDEPTH7,MDEPTH8,MDEPTH9,MDEPTH10,OIL,POOROIL,OILWATER,WATEROIL,GAS,POORGAS,GASWATER,WATERGAS,DEST1,DEST2,DEST3,DEST4,DEST5,DEST6,DEST7,DEST8,DEST9,DEST10,SDEP1,EDEP1,SDEP2,EDEP2,SDEP3,EDEP3,SDEP4,EDEP4,SDEP5,EDEP5,SDEP6,EDEP6,SDEP7,EDEP7,SDEP8,EDEP8,SDEP9,EDEP9,SDEP10,EDEP10",
|
||
"4,4,4,8,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,48,48,48,48,48,48,48,48,48,48,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",//字段长度
|
||
"1,4,4,6,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,6,6,6,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",//字段类型
|
||
"0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");//字段备注
|
||
isfirst = true;
|
||
}
|
||
logio->SetTableRecordCount(iIndex, resultGroupSize);//-nn);
|
||
if (!resultGroupSize) {
|
||
delete logio;
|
||
//if (isfirst)AddTableToWellRound();
|
||
isrun = false;
|
||
return false;
|
||
}
|
||
QMap<QString, QString> zoneOrder = GetZoneOrder();
|
||
|
||
LAYER_DATA m_Result;
|
||
QMap<double, TransparentGroupResult*> mapSortGroup;
|
||
QMap<QString, QObject*>::iterator it = m_mapDragGroup.begin();
|
||
for (; it != m_mapDragGroup.end(); ++it)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(it.value());
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
|
||
mapSortGroup.insert(pGroup->getRange().upper, pGroup);
|
||
}
|
||
|
||
QList<TransparentGroupResult*> listGroup = mapSortGroup.values();
|
||
for (int i = 0; i < listGroup.size(); i++)
|
||
{
|
||
TransparentGroupResult* pGroup = listGroup.at(i);
|
||
if (pGroup == NULL)
|
||
continue;
|
||
|
||
memset(&m_Result, 0, sizeof(LAYER_DATA));
|
||
m_Result.StartDepth = -pGroup->getRange().upper;
|
||
m_Result.EndDepth = -pGroup->getRange().lower;
|
||
|
||
m_Result.Result = pGroup->getNResult();
|
||
|
||
const QVector<QString>& vec = pGroup->getVecResult();
|
||
const QMap<QString, QObject*>& mapResult = pGroup->getMapDraggable_Result();
|
||
QVector<double> vecDepth;
|
||
QVector<int> vecResult;
|
||
//vecDepth << 0.0;
|
||
//vecResult << 0;
|
||
//QString strRet = "";
|
||
for (int k = 0; k < vec.size(); k++)
|
||
{
|
||
TransparentDraggableResult* pret = qobject_cast<TransparentDraggableResult*>(mapResult.value(vec.at(k)));
|
||
if (pret == NULL)
|
||
continue;
|
||
QCPRange rg = pret->getRange();
|
||
vecDepth << -rg.upper;
|
||
QFileInfo finfo(pret->getResult());
|
||
QString s = zoneOrder.value(finfo.baseName());
|
||
//QString str = QString("%1").arg(s.toInt(), 2, 10, QChar('0'));
|
||
//strRet += str;
|
||
vecResult << s.toInt();
|
||
}
|
||
QByteArray btzone = UTF8ToGBK(pGroup->getTitle());
|
||
strcpy(m_Result.Zone, btzone.data());
|
||
QByteArray btrmk = UTF8ToGBK(pGroup->getRemark());
|
||
strcpy(m_Result.Description10, btrmk.data());
|
||
//strcpy(m_Result.szResult, strRet.toStdString().c_str());
|
||
m_Result.Result = 0;
|
||
int n = vecDepth.size();
|
||
if (n > 0)
|
||
{
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(0);
|
||
}
|
||
if (n > 1)
|
||
{
|
||
m_Result.MDepth1 = vecDepth.at(1);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(1);
|
||
}
|
||
if (n > 2)
|
||
{
|
||
m_Result.MDepth2 = vecDepth.at(2);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(2);
|
||
}
|
||
if (n > 3)
|
||
{
|
||
m_Result.MDepth3 = vecDepth.at(3);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(3);
|
||
}
|
||
if (n > 4)
|
||
{
|
||
m_Result.MDepth4 = vecDepth.at(4);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(4);
|
||
}
|
||
if (n > 5)
|
||
{
|
||
m_Result.MDepth5 = vecDepth.at(5);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(5);
|
||
}
|
||
if (n > 6)
|
||
{
|
||
m_Result.MDepth6 = vecDepth.at(6);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(6);
|
||
}
|
||
if (n > 7)
|
||
{
|
||
m_Result.MDepth7 = vecDepth.at(7);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(7);
|
||
}
|
||
if (n > 8)
|
||
{
|
||
m_Result.MDepth8 = vecDepth.at(8);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(8);
|
||
}
|
||
if (n > 9)
|
||
{
|
||
m_Result.MDepth9 = vecDepth.at(9);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(9);
|
||
}
|
||
if (n > 10)
|
||
{
|
||
m_Result.MDepth10 = vecDepth.at(10);
|
||
m_Result.Result = 10 * m_Result.Result + vecResult.at(10);
|
||
}
|
||
logio->WriteTable(iIndex, i + 1, &m_Result);
|
||
}
|
||
/*
|
||
foreach(WelllogItem*iter, items)
|
||
{
|
||
if (!iter) continue;
|
||
memset(&m_Result, 0, sizeof(LAYER_DATA));
|
||
m_Result.StartDepth = iter->GetTopDepth();
|
||
m_Result.EndDepth = iter->GetBottomDepth();
|
||
if (m_Result.EndDepth - m_Result.StartDepth <= 0) {
|
||
continue;
|
||
}
|
||
OGResultItem* pResult = dynamic_cast<OGResultItem*>(iter);
|
||
m_Result.Order = j;
|
||
m_Result.Result = 0;
|
||
m_Result.MDepth1 = pResult->m_MDepth1;
|
||
m_Result.MDepth2 = pResult->m_MDepth2;
|
||
m_Result.MDepth3 = pResult->m_MDepth3;
|
||
m_Result.MDepth4 = pResult->m_MDepth4;
|
||
m_Result.MDepth5 = pResult->m_MDepth5;
|
||
m_Result.MDepth6 = pResult->m_MDepth6;
|
||
m_Result.MDepth7 = pResult->m_MDepth7;
|
||
m_Result.MDepth8 = pResult->m_MDepth8;
|
||
m_Result.MDepth9 = pResult->m_MDepth9;
|
||
m_Result.MDepth10 = pResult->m_MDepth10;
|
||
|
||
QString innerresult = pResult->GetIntResult();
|
||
if (innerresult != "") m_Result.Result = innerresult.toInt();
|
||
if (m_Result.Result < 0) m_Result.Result = 0;
|
||
innerresult = pResult->GetIntResult1();
|
||
if (innerresult != ""&&m_Result.MDepth1)
|
||
{
|
||
m_Result.Result = 10 * m_Result.Result + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult2();
|
||
if (innerresult != ""&&m_Result.MDepth2)
|
||
{
|
||
m_Result.Result = 10 * m_Result.Result + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult3();
|
||
if (innerresult != ""&&m_Result.MDepth3) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult4();
|
||
if (innerresult != ""&&m_Result.MDepth4) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult5();
|
||
if (innerresult != ""&&m_Result.MDepth5) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult6();
|
||
if (innerresult != ""&&m_Result.MDepth6) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult7();
|
||
if (innerresult != ""&&m_Result.MDepth7) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult8();
|
||
if (innerresult != ""&&m_Result.MDepth8) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult9();
|
||
if (innerresult != ""&&m_Result.MDepth9) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
innerresult = pResult->GetIntResult10();
|
||
if (innerresult != ""&&m_Result.MDepth10) {
|
||
m_Result.Result = m_Result.Result * 10 + innerresult.toInt();
|
||
}
|
||
strcpy(m_Result.Zone, pResult->Zone.toStdString().c_str());
|
||
ComputeTT(m_Result,
|
||
pResult->result,
|
||
pResult->result1,
|
||
pResult->result2,
|
||
pResult->result3,
|
||
pResult->result4,
|
||
pResult->result5,
|
||
pResult->result6,
|
||
pResult->result7,
|
||
pResult->result8,
|
||
pResult->result9,
|
||
pResult->result10
|
||
);
|
||
strcpy(m_Result.Description1, pResult->Description1.toStdString().c_str());
|
||
strcpy(m_Result.Description2, pResult->Description2.toStdString().c_str());
|
||
strcpy(m_Result.Description3, pResult->Description3.toStdString().c_str());
|
||
strcpy(m_Result.Description4, pResult->Description4.toStdString().c_str());
|
||
strcpy(m_Result.Description5, pResult->Description5.toStdString().c_str());
|
||
strcpy(m_Result.Description6, pResult->Description6.toStdString().c_str());
|
||
strcpy(m_Result.Description7, pResult->Description7.toStdString().c_str());
|
||
strcpy(m_Result.Description8, pResult->Description8.toStdString().c_str());
|
||
strcpy(m_Result.Description9, pResult->Description9.toStdString().c_str());
|
||
strcpy(m_Result.Description10, pResult->Description10.toStdString().c_str());
|
||
|
||
m_Result.Sdep1 = pResult->m_SDEP1;
|
||
m_Result.Edep1 = pResult->m_EDEP1;
|
||
m_Result.Sdep2 = pResult->m_SDEP2;
|
||
m_Result.Edep2 = pResult->m_EDEP2;
|
||
m_Result.Sdep3 = pResult->m_SDEP3;
|
||
m_Result.Edep3 = pResult->m_EDEP3;
|
||
m_Result.Sdep4 = pResult->m_SDEP4;
|
||
m_Result.Edep4 = pResult->m_EDEP4;
|
||
m_Result.Sdep5 = pResult->m_SDEP5;
|
||
m_Result.Edep5 = pResult->m_EDEP5;
|
||
m_Result.Sdep6 = pResult->m_SDEP6;
|
||
m_Result.Edep6 = pResult->m_EDEP6;
|
||
m_Result.Sdep7 = pResult->m_SDEP7;
|
||
m_Result.Edep7 = pResult->m_EDEP7;
|
||
m_Result.Sdep8 = pResult->m_SDEP8;
|
||
m_Result.Edep8 = pResult->m_EDEP8;
|
||
m_Result.Sdep9 = pResult->m_SDEP9;
|
||
m_Result.Edep9 = pResult->m_EDEP9;
|
||
m_Result.Sdep10 = pResult->m_SDEP10;
|
||
m_Result.Edep10 = pResult->m_EDEP10;
|
||
|
||
logio->WriteTable(iIndex, j + 1, &m_Result);
|
||
j++;
|
||
}
|
||
*/
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
isrun = false;
|
||
|
||
return true;
|
||
}
|
||
|
||
TransparentGroupResult* QMyCustomPlot::getCurGroupResult(double x_val)
|
||
{
|
||
TransparentGroupResult *pClickGroup = NULL;
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for (int i = 0; i < objList.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||
if (pGroup == nullptr)
|
||
continue;
|
||
QCPRange rg = pGroup->getRange();
|
||
if (x_val <= rg.upper && x_val >= rg.lower)
|
||
{
|
||
pClickGroup = pGroup;
|
||
break;
|
||
}
|
||
}
|
||
return pClickGroup;
|
||
}
|
||
|
||
QMap<double, TransparentGroupResult*> QMyCustomPlot::getSelectGroupResult()
|
||
{
|
||
QMap<double, TransparentGroupResult*> mapsort;
|
||
QObjectList objList = m_mapDragGroup.values();
|
||
for (int i = 0; i < objList.size(); i++)
|
||
{
|
||
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||
if (pGroup == nullptr || !pGroup->getSelect())
|
||
continue;
|
||
QCPRange rg = pGroup->getRange();
|
||
mapsort.insert(-rg.upper, pGroup);
|
||
}
|
||
return mapsort;
|
||
}
|
||
|
||
void QMyCustomPlot::segmentationInnerLayer()
|
||
{
|
||
//获取鼠标点位置
|
||
double y_pos = mLastPos.y();
|
||
//转为图像位置
|
||
double x_val = xAxis->pixelToCoord(y_pos);
|
||
// 获取当前点击的解释结论组
|
||
TransparentGroupResult *pClickGroup = getCurGroupResult(x_val);
|
||
if (pClickGroup == NULL)
|
||
return;
|
||
pClickGroup->segmentationInnerLayer(x_val);
|
||
|
||
SaveToSLF_Result();
|
||
|
||
}
|
||
|
||
void QMyCustomPlot::segmentationIndependentLayer()
|
||
{
|
||
//获取鼠标点位置
|
||
double y_pos = mLastPos.y();
|
||
//转为图像位置
|
||
double x_val = xAxis->pixelToCoord(y_pos);
|
||
// 获取当前点击的解释结论组
|
||
TransparentGroupResult *pClickGroup = getCurGroupResult(x_val);
|
||
if (pClickGroup == NULL)
|
||
return;
|
||
|
||
int nidx = pClickGroup->getDraggableResultIndex(x_val);
|
||
if (nidx < 0)
|
||
return;
|
||
|
||
double dupper;
|
||
double dlower;
|
||
|
||
const QVector<QString>& vec = pClickGroup->getVecResult();
|
||
const QMap<QString, QObject*>& mapResult = pClickGroup->getMapDraggable_Result();
|
||
|
||
QVector<QPair<QCPRange, QString>> g1;
|
||
for (int i = 0; i <= nidx; i++)
|
||
{
|
||
TransparentDraggableResult* pret = qobject_cast<TransparentDraggableResult*>(mapResult.value(vec.at(i)));
|
||
if (pret == NULL)
|
||
continue;
|
||
|
||
QCPRange rg = pret->getRange();
|
||
if (i == 0)
|
||
dupper = rg.upper;
|
||
|
||
if (i == nidx)
|
||
{
|
||
dlower = x_val;
|
||
rg.lower = x_val;
|
||
g1 << qMakePair(rg, pret->getResult());
|
||
}
|
||
else
|
||
{
|
||
g1 << qMakePair(rg, pret->getResult());
|
||
}
|
||
}
|
||
QString strUuid = "";
|
||
if (g1.size() > 0)
|
||
{
|
||
TransparentGroupResult* pGroup = this->addResultGroup(dlower, dupper, strUuid);
|
||
strUuid = "";
|
||
for (int i = 0; i < g1.size(); i++)
|
||
{
|
||
const QPair<QCPRange, QString>& r = g1.at(i);
|
||
pGroup->addResultToPlot(r.first.lower, r.first.upper, r.second, strUuid);
|
||
}
|
||
}
|
||
|
||
QVector<QPair<QCPRange, QString>> g2;
|
||
for (int i = nidx; i < vec.size(); i++)
|
||
{
|
||
TransparentDraggableResult* pret = qobject_cast<TransparentDraggableResult*>(mapResult.value(vec.at(i)));
|
||
if (pret == NULL)
|
||
continue;
|
||
|
||
QCPRange rg = pret->getRange();
|
||
if (i == vec.size() - 1)
|
||
dlower = rg.lower;
|
||
|
||
if (i == nidx)
|
||
{
|
||
dupper = x_val;
|
||
rg.upper = x_val;
|
||
g2 << qMakePair(rg, pret->getResult());
|
||
}
|
||
else
|
||
{
|
||
g2 << qMakePair(rg, pret->getResult());
|
||
}
|
||
}
|
||
if (g2.size() > 0)
|
||
{
|
||
TransparentGroupResult* pGroup2 = this->addResultGroup(dlower, dupper, strUuid);
|
||
strUuid = "";
|
||
for (int i = 0; i < g2.size(); i++)
|
||
{
|
||
const QPair<QCPRange, QString>& r = g2.at(i);
|
||
pGroup2->addResultToPlot(r.first.lower, r.first.upper, r.second, strUuid);
|
||
}
|
||
}
|
||
pClickGroup->removeAllResult();
|
||
this->replot();
|
||
SaveToSLF_Result();
|
||
}
|
||
|
||
void QMyCustomPlot::splitIndependentLayer()
|
||
{
|
||
//获取鼠标点位置
|
||
double y_pos = mLastPos.y();
|
||
//转为图像位置
|
||
double x_val = xAxis->pixelToCoord(y_pos);
|
||
// 获取当前点击的解释结论组
|
||
TransparentGroupResult *pClickGroup = getCurGroupResult(x_val);
|
||
if (pClickGroup == NULL)
|
||
return;
|
||
|
||
// 符合层拆分成独立层
|
||
pClickGroup->splitIndependentLayer();
|
||
// 删除原来的复合层
|
||
pClickGroup->removeAllResult();
|
||
this->replot();
|
||
SaveToSLF_Result();
|
||
}
|
||
|
||
void QMyCustomPlot::megResultLayer()
|
||
{
|
||
if (QMessageBox::information(NULL, QObject::tr("提示"), QObject::tr("合并为复合层?"), tr("是"), tr("否")) != 0) return;
|
||
// 筛选出选中的Group, 并且排序
|
||
QMap<double, TransparentGroupResult*> mapsort = this->getSelectGroupResult();
|
||
if (mapsort.size() <= 0)
|
||
return;
|
||
|
||
// 取出Group下面的DraggableResult,并且调整 lower,删除原来选中的Group
|
||
double dupper;
|
||
double dlower;
|
||
QVector<QPair<QCPRange, QString>> gr;
|
||
QList<TransparentGroupResult*> listGroup = mapsort.values();
|
||
for (int i = 0; i < listGroup.size(); i++)
|
||
{
|
||
TransparentGroupResult* pGroup = listGroup.at(i);
|
||
if (pGroup == NULL)
|
||
continue;
|
||
|
||
if (i == 0)
|
||
{
|
||
dupper = pGroup->getRange().upper;
|
||
}
|
||
if (i == listGroup.size() - 1)
|
||
{
|
||
dlower = pGroup->getRange().lower;
|
||
}
|
||
|
||
const QVector<QString>& vec = pGroup->getVecResult();
|
||
const QMap<QString, QObject*>& mapResult = pGroup->getMapDraggable_Result();
|
||
|
||
for (int k = 0; k < vec.size(); k++)
|
||
{
|
||
TransparentDraggableResult* pret = qobject_cast<TransparentDraggableResult*>(mapResult.value(vec.at(k)));
|
||
if (pret == NULL)
|
||
continue;
|
||
QCPRange rg = pret->getRange();
|
||
if (i + 1 < listGroup.size())
|
||
{
|
||
TransparentGroupResult* pLowGroup = listGroup.at(i+1);
|
||
if (pGroup)
|
||
rg.lower = pLowGroup->getRange().upper;
|
||
}
|
||
gr << qMakePair(rg, pret->getResult());
|
||
}
|
||
pGroup->removeAllResult();
|
||
}
|
||
|
||
// 生成新的Group
|
||
QString strUuid = "";
|
||
TransparentGroupResult* pNewG = this->addResultGroup(dlower, dupper, strUuid);
|
||
strUuid = "";
|
||
for (int i = 0; i < gr.size(); i++)
|
||
{
|
||
const QPair<QCPRange, QString>& r = gr.at(i);
|
||
pNewG->addResultToPlot(r.first.lower, r.first.upper, r.second, strUuid);
|
||
}
|
||
this->replot();
|
||
SaveToSLF_Result();
|
||
}
|
||
|
||
bool QMyCustomPlot::getIsEditor()
|
||
{
|
||
if (m_strLineName == "RESULT")
|
||
{
|
||
return m_bEditor;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
//沉积相
|
||
void QMyCustomPlot::ReadFracDef()
|
||
{
|
||
m_FracDef.clear();
|
||
|
||
QString fracFilePath = GetConfPath() + "GEoFac.ini";
|
||
|
||
//
|
||
FAC_DEF fd;
|
||
char str[512],fac[512],phase[64],mFac[64];
|
||
int r,g,b,id;
|
||
FILE *fp;
|
||
QString qs;
|
||
fp = fopen(fracFilePath.toStdString().c_str(), "r");
|
||
if ( fp != nullptr )
|
||
{
|
||
fgets(str,256,fp); // 跳过第一行
|
||
while (!feof(fp))
|
||
{
|
||
fgets(str,256,fp);
|
||
qs = str;
|
||
qs.trimmed();
|
||
if (qs.length() < 8) break ;
|
||
//代码 微相 亚相 相
|
||
sscanf(str,"%d %s %s %s",&fd.iCode,mFac,phase,fac);
|
||
fd.mFac = mFac;
|
||
fd.Fac = fac;
|
||
fd.Phase = phase;
|
||
m_FracDef.append(fd);
|
||
if ( feof(fp))
|
||
break;
|
||
}
|
||
fclose(fp);
|
||
}
|
||
else
|
||
{
|
||
sprintf(fac,"打开沉积相参数配置文件错误:%s!",str);
|
||
QMessageBox::information(nullptr, "读取文件失败", fac);
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::ReadData_Fac(QString strSlfName, QString csCurve, bool bAdd)
|
||
{
|
||
if(strSlfName.isEmpty()) return;
|
||
//清空
|
||
m_ObjList_Fac.clear();
|
||
|
||
QString cs;
|
||
int nLineWidth=2;
|
||
int nField;
|
||
QColor crColor(255,0,0);
|
||
FAC_TABLE frac;
|
||
CMemRdWt mrw;
|
||
char strFracTable[256];
|
||
int i,j,iIndex,nCount,iType=1;
|
||
|
||
if (mrw.Open(strSlfName.toStdString().c_str()) ) // 打开井文件
|
||
{
|
||
iIndex=mrw.OpenTable(csCurve.toStdString().c_str());
|
||
if(iIndex>=0)
|
||
{
|
||
nField=mrw.GetTableFieldCount(iIndex);
|
||
nCount=mrw.GetTableRecordCount(iIndex);
|
||
cs ="";
|
||
if ( nField != 7 )
|
||
nCount = 0;
|
||
for(i=0;i<nCount;i++)
|
||
{
|
||
mrw.ReadTable(iIndex,i+1,(void*)&frac);
|
||
m_ObjList_Fac.append(frac);
|
||
|
||
if(bAdd)
|
||
{
|
||
//微相
|
||
this->addMFacToPlot(-frac.edep, -frac.sdep, QString::fromLocal8Bit(frac.mFac), false);
|
||
}
|
||
}
|
||
mrw.CloseTable(iIndex);
|
||
}
|
||
mrw.Close(); //关闭井文件
|
||
}
|
||
}
|
||
|
||
void QMyCustomPlot::DrawFac(int iType)
|
||
{
|
||
//判读是否绘制 相/亚相
|
||
if(m_bDrawFac && iType==1)
|
||
{
|
||
//相
|
||
}
|
||
else if(m_bDrawPhase && iType==2)
|
||
{
|
||
//亚相
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
|
||
int j;
|
||
float dep1,dep2;
|
||
float top,bottom;
|
||
QString str1,str2;
|
||
QColor crColor(0,0,0);
|
||
QPen qPen(crColor, 1, Qt::SolidLine);
|
||
if ( m_ObjList_Fac.count()<2 )
|
||
return ;
|
||
|
||
//绘制相、亚相
|
||
FAC_TABLE pObj;
|
||
pObj =m_ObjList_Fac[0];
|
||
if (iType==1)
|
||
str1 = QString::fromLocal8Bit(pObj.Fac);
|
||
else
|
||
str1 = QString::fromLocal8Bit(pObj.Phase);
|
||
str1.trimmed();
|
||
top = pObj.sdep;
|
||
|
||
for (j=1;j<m_ObjList_Fac.count(); j++)
|
||
{
|
||
pObj =m_ObjList_Fac[j];
|
||
|
||
if (iType==1)
|
||
str2= QString::fromLocal8Bit(pObj.Fac);
|
||
else
|
||
str2 = QString::fromLocal8Bit(pObj.Phase);
|
||
str2.trimmed();
|
||
|
||
// if (str2!=str1 || j==(m_ObjList_Fac.count()-1))
|
||
// {
|
||
// if ( j==(m_ObjList_Fac.count()-1))
|
||
// bottom = m_ObjList_Fac[j].edep;
|
||
// else
|
||
// bottom = m_ObjList_Fac[j-1].edep;
|
||
|
||
if(j==(m_ObjList_Fac.count()-1))//最后1个
|
||
{
|
||
if (str2!=str1)
|
||
{
|
||
//倒数第2个item
|
||
bottom = m_ObjList_Fac[j-1].edep;
|
||
//显示文本
|
||
if (iType==1)
|
||
{
|
||
//相
|
||
this->addFacToPlot(-bottom, -top, str1, false);
|
||
}
|
||
else
|
||
{
|
||
//亚相
|
||
this->addPhaseToPlot(-bottom, -top, str1, false);
|
||
}
|
||
|
||
//添加最后1个不同的item
|
||
top = pObj.sdep;
|
||
bottom = pObj.edep;
|
||
str1=str2;
|
||
//显示文本
|
||
if (iType==1)
|
||
{
|
||
//相
|
||
this->addFacToPlot(-bottom, -top, str1, false);
|
||
}
|
||
else
|
||
{
|
||
//亚相
|
||
this->addPhaseToPlot(-bottom, -top, str1, false);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
bottom = pObj.edep;
|
||
//显示文本
|
||
if (iType==1)
|
||
{
|
||
//相
|
||
this->addFacToPlot(-bottom, -top, str1, false);
|
||
}
|
||
else
|
||
{
|
||
//亚相
|
||
this->addPhaseToPlot(-bottom, -top, str1, false);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (str2!=str1)
|
||
{
|
||
//
|
||
bottom = m_ObjList_Fac[j-1].edep;
|
||
//显示文本
|
||
if (iType==1)
|
||
{
|
||
//相
|
||
this->addFacToPlot(-bottom, -top, str1, false);
|
||
}
|
||
else
|
||
{
|
||
//亚相
|
||
this->addPhaseToPlot(-bottom, -top, str1, false);
|
||
}
|
||
top = pObj.sdep;
|
||
str1=str2;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_Fac(QString strSlfName, QString csCurve, bool bAdd)
|
||
{
|
||
//隐藏刻度
|
||
this->xAxis->setTicks(false);
|
||
this->yAxis->setTicks(false);
|
||
this->xAxis2->setTicks(false);
|
||
this->yAxis2->setTicks(false);
|
||
|
||
//先删除
|
||
if(m_qcpItemLine)
|
||
{
|
||
removeItem(m_qcpItemLine);
|
||
m_qcpItemLine = nullptr;
|
||
}
|
||
if(m_qcpItemLine2)
|
||
{
|
||
removeItem(m_qcpItemLine2);
|
||
m_qcpItemLine2 = nullptr;
|
||
}
|
||
|
||
int iMyWidth = this->axisRect(0)->width();
|
||
if(m_bDrawFac && m_bDrawPhase)
|
||
{
|
||
//画2条竖线
|
||
m_qcpItemLine = new QCPItemStraightLine(this);
|
||
m_qcpItemLine->point1->setCoords(-1, iMyWidth/2);//位置
|
||
m_qcpItemLine->point2->setCoords(-2, iMyWidth/2);//位置
|
||
//qcpItemLine->setPen(pPenStraightLine);
|
||
|
||
m_qcpItemLine2 = new QCPItemStraightLine(this);
|
||
m_qcpItemLine2->point1->setCoords(-1, 3*iMyWidth/4);//位置
|
||
m_qcpItemLine2->point2->setCoords(-2, 3*iMyWidth/4);//位置
|
||
}
|
||
else if(m_bDrawFac || m_bDrawPhase)
|
||
{
|
||
//画1条竖线
|
||
m_qcpItemLine2 = new QCPItemStraightLine(this);
|
||
m_qcpItemLine2->point1->setCoords(-1, 3*iMyWidth/4);//位置
|
||
m_qcpItemLine2->point2->setCoords(-2, 3*iMyWidth/4);//位置
|
||
}
|
||
|
||
ReadFracDef();
|
||
|
||
ReadData_Fac(strSlfName, csCurve, bAdd);
|
||
DrawFac(1);//相
|
||
DrawFac(2);//亚相
|
||
|
||
//统一刷新
|
||
replot();
|
||
return true;
|
||
}
|
||
|
||
//添加套管组件
|
||
void QMyCustomPlot::addItem_Tubing()
|
||
{
|
||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||
|
||
QAction *pAct=dynamic_cast<QAction *>(sender());
|
||
if(pAct){
|
||
QString str=pAct->text();
|
||
str.remove("添加");
|
||
int i=zoneOrder_Tubing[str].toInt();
|
||
if(i>-1) {
|
||
Slf_JIEGUPOS result;
|
||
result.Depth=-right_Hight;
|
||
result.Order=0;
|
||
result.Number=i;
|
||
//
|
||
drawOne_Tubing(result);
|
||
//保存
|
||
SaveToSLF_Tubing();
|
||
|
||
|
||
if(!mRect_Tubing || !mRect2_Tubing)
|
||
{
|
||
//绘制结构
|
||
DrawStruct();
|
||
}
|
||
|
||
//检查套管组件名称,是否需要更新套管图形
|
||
//画管柱
|
||
if(str == "管底部" ||
|
||
str == "油管深" ||
|
||
str == "喇叭口" ||
|
||
str == "剌叭口")
|
||
{
|
||
//组件改变后,重绘管柱
|
||
LoadFromSLF_ReDrawTubing(m_strSlfName, m_strLineName);
|
||
}
|
||
else{
|
||
//刷新
|
||
this->replot();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//添加沉积相
|
||
void QMyCustomPlot::addItem_Fac()
|
||
{
|
||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||
|
||
// 创建对话框
|
||
FracSel *dlg = new FracSel(this);
|
||
dlg->setInfo(right_Hight, m_FracDef);
|
||
//
|
||
dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象
|
||
int result = dlg->exec();//模态对话框
|
||
if (result == QDialog::Accepted) {
|
||
// 处理用户点击了确定按钮的逻辑
|
||
qDebug() << "Accepted=";
|
||
|
||
//微相
|
||
this->addMFacToPlot(-g_EDepthFac, -g_SDepthFac, g_SelectMFac);
|
||
//this->replot();
|
||
SaveToSLF_Fac();
|
||
//刷新
|
||
RefreshItems_Fac(false);
|
||
}
|
||
else if (result == QDialog::Rejected) {
|
||
// 处理用户点击了取消按钮的逻辑
|
||
qDebug() << "Rejected=";
|
||
}
|
||
else {
|
||
// 处理其他情况的逻辑
|
||
qDebug() << "other=";
|
||
}
|
||
}
|
||
|
||
//打开或创建数据表,不超过16个字段
|
||
// char Name[3][32]={"NAME","VALUE","SCRIPT"};// 64 字段名称
|
||
// char HZName[3][32]={"参数名称","参数数值","参数描述"};// 64 别名
|
||
// char Unit[3][32]={"","",""};;// 32 字段单位
|
||
// char HZUnit[3][32]={"","",""};// 32 单位别名
|
||
// short RepCode[3]={6,4,6};// 2 字段数据类型
|
||
// short CodeLength[3]={64,4,256};//字段长度
|
||
// unsigned short Reserved[3]={0,0,0};//字段备注
|
||
int OpenTable2(CMemRdWt *MemRdWt,char *strTable,char *strInfo,int nFields,char Name[16][32],char HZName[16][32],char Unit[16][32],
|
||
char HZUnit[16][32],short *RepCode,short *CodeLength,unsigned short *tReserved)
|
||
{
|
||
int i,indext;
|
||
indext=MemRdWt->OpenTable(strTable);
|
||
if(indext<0)
|
||
{
|
||
Slf_OBJECT_FIELD Par_Table_Field[16];
|
||
Slf_OBJECT_FIELD Table_Field[16];
|
||
for(i=0;i<nFields;i++)
|
||
{
|
||
strcpy(Table_Field[i].Name,Name[i]);
|
||
strcpy(Table_Field[i].HZName,HZName[i]);
|
||
strcpy(Table_Field[i].Unit,Unit[i]);;//32字段单位
|
||
strcpy(Table_Field[i].HZUnit,HZUnit[i]);;//32单位别名
|
||
Table_Field[i].CodeLength=CodeLength[i];
|
||
Table_Field[i].RepCode=RepCode[i];
|
||
Table_Field[i].Sequence=0;//是否连续控制
|
||
Table_Field[i].Start=1;//字段起始值
|
||
Table_Field[i].End=99999;//字段起始值
|
||
Table_Field[i].Rlev=1;//字段采样间隔
|
||
Table_Field[i].SamplePoint=1;//一个阵列的横向采样样本点数
|
||
Table_Field[i].ArrayNum=1;//阵列数
|
||
Table_Field[i].Vmin=-99999;//字段最大值
|
||
Table_Field[i].Vmax=99999;//字段最小值
|
||
Table_Field[i].DefVal=9999;//缺省值
|
||
*(DWORD *)&Table_Field[i].Reserved=tReserved[i];
|
||
}
|
||
indext=MemRdWt->CreateTable(0,strTable,strInfo,nFields,Table_Field,0);
|
||
}
|
||
return indext;
|
||
}
|
||
|
||
//保存
|
||
void QMyCustomPlot::SaveToSLF_Fac()
|
||
{
|
||
int i,nField = 40;
|
||
int nCount = m_mapDraggable_MFac.size();
|
||
char FacFile[MAX_PATH];
|
||
CMemRdWt mrw;
|
||
FAC_TABLE m_Result;
|
||
|
||
strcpy(FacFile,"LITHA");
|
||
QString wellname = m_strSlfName;
|
||
if ( mrw.Open(wellname.toStdString().c_str()) ) // 打开井文件
|
||
{
|
||
char tName[7][32]={"NO","SDEP","EDEP","FAC","PHASE","MFAC","DEST"};// 64 字段名称
|
||
char tHZName[7][32]={"序号","开始深度","结束深度","沉积相","亚相","微相","描述"};// 64 别名
|
||
char tUnit[7][32]={"","M","M","","","",""};// 32 字段单位
|
||
char tHZUnit[7][32]={"","米","米","","","",""};// 32 单位别名
|
||
short tRepCode[7]={1,4,4,6,6,6,6};// 2 字段数据类型
|
||
short tCodeLength[7]={4,4,4,32,32,32,32};//字段长度
|
||
unsigned short tReserved[7]={0,0,0,0,0,0,0};//字段备注
|
||
//
|
||
QString strInfo = "岩性数据表";
|
||
char szInfo[MAX_PATH];
|
||
memset(szInfo, 0, sizeof(szInfo));
|
||
//微相
|
||
int n=strlen(strInfo.toStdString().c_str());
|
||
strncpy(szInfo, strInfo.toLocal8Bit().data(),n);
|
||
|
||
int iLithIndex=OpenTable2(&mrw,FacFile,szInfo,7,
|
||
tName,tHZName,tUnit,tHZUnit,tRepCode,tCodeLength,tReserved);
|
||
//保存输入输出曲线定义
|
||
if (iLithIndex>= 0)
|
||
{
|
||
TransparentDraggableMFac *pDraggableRect =NULL;
|
||
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_MFac.begin(); iter != m_mapDraggable_MFac.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableMFac*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//if ( nCount>=2)
|
||
{
|
||
mrw.SetTableRecordCount(iLithIndex,nCount);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_MFac.begin(); iter != m_mapDraggable_MFac.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableMFac*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,sizeof(FAC_TABLE));
|
||
m_Result.sdep = -tmpRange.upper;
|
||
m_Result.edep = -tmpRange.lower;
|
||
m_Result.no = i+1;
|
||
|
||
for (int j=0; j<m_FracDef.count(); j++)
|
||
{
|
||
if ( m_FracDef[j].mFac == pDraggableRect->mstrTitle )
|
||
{
|
||
//微相
|
||
int n=strlen(m_FracDef[j].mFac.toStdString().c_str());
|
||
if(n>sizeof(m_Result.mFac)) n=sizeof(m_Result.mFac);
|
||
strncpy(m_Result.mFac, m_FracDef[j].mFac.toLocal8Bit().data(),n);
|
||
//亚相
|
||
n=strlen(m_FracDef[j].Phase.toStdString().c_str());
|
||
if(n>sizeof(m_Result.Phase)) n=sizeof(m_Result.Phase);
|
||
strncpy(m_Result.Phase, m_FracDef[j].Phase.toLocal8Bit().data(),n);
|
||
//相
|
||
n=strlen(m_FracDef[j].Fac.toStdString().c_str());
|
||
if(n>sizeof(m_Result.Fac)) n=sizeof(m_Result.Fac);
|
||
strncpy(m_Result.Fac, m_FracDef[j].Fac.toLocal8Bit().data(),n);
|
||
//
|
||
mrw.WriteTable(iLithIndex,i+1,&m_Result);
|
||
break;
|
||
}
|
||
}
|
||
//
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
mrw.CloseTable(iLithIndex);
|
||
}
|
||
|
||
mrw.Close();
|
||
}
|
||
}
|
||
|
||
//刷新数据 bAdd不支持true,否则崩溃,因为发消息的item本身会被删除,无法继续后续处理
|
||
void QMyCustomPlot::RefreshItems_Fac(bool bAdd)
|
||
{
|
||
//return;
|
||
|
||
//删除对象
|
||
if(bAdd)
|
||
{
|
||
//微相
|
||
TransparentDraggableMFac *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_MFac.begin();
|
||
while( it != m_mapDraggable_MFac.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableMFac*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
}
|
||
//亚相
|
||
TransparentDraggablePhase *pDraggableRect2 =NULL;
|
||
QMap<QString,QObject *>::Iterator it2 = m_mapDraggable_Phase.begin();
|
||
while( it2 != m_mapDraggable_Phase.end() )
|
||
{
|
||
pDraggableRect2 = (TransparentDraggablePhase*)it2.value();
|
||
it2++;
|
||
pDraggableRect2->deleteRect();
|
||
}
|
||
//相
|
||
TransparentDraggableFac *pDraggableRect3 =NULL;
|
||
QMap<QString,QObject *>::Iterator it3 = m_mapDraggable_Fac.begin();
|
||
while( it3 != m_mapDraggable_Fac.end() )
|
||
{
|
||
pDraggableRect3 = (TransparentDraggableFac*)it3.value();
|
||
it3++;
|
||
pDraggableRect3->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
LoadFromSLF_Fac(m_strSlfName, m_strLineName, bAdd);
|
||
|
||
//属性清空
|
||
//PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_Tubing(QString strSlfName, QString csCurve)
|
||
{
|
||
m_pResultList_Tubing.clear();
|
||
|
||
cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\";
|
||
//先删除
|
||
if(mPixmap_Tubing)
|
||
{
|
||
removeItem(mPixmap_Tubing);
|
||
mPixmap_Tubing = nullptr;
|
||
}
|
||
|
||
Slf_JIEGUPOS *m_pResult=NULL;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
return false;
|
||
}
|
||
|
||
int iIndex=logio->OpenTable(csCurve.toStdString().c_str());
|
||
if(iIndex<0)
|
||
{
|
||
delete logio;
|
||
return false;
|
||
}
|
||
//
|
||
if(iIndex>-1) {
|
||
int count=logio->GetTableRecordCount(iIndex);
|
||
//int fieldnum=logio->GetTableFieldCount(iIndex);
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
m_pResult=(Slf_JIEGUPOS *)new char[len+1];
|
||
char buf[200];
|
||
logio->IsChange=true;
|
||
|
||
bool bDrawGuanzhu = false;
|
||
for(int i=0;i<count;i++)
|
||
{
|
||
memset(m_pResult,0,sizeof(len));
|
||
logio->ReadTable(iIndex,i+1,m_pResult);
|
||
|
||
Slf_JIEGUPOS result;
|
||
result.Depth=m_pResult->Depth;
|
||
result.Order=m_pResult->Order;
|
||
result.Number=m_pResult->Number;
|
||
m_pResultList_Tubing.append(result);
|
||
|
||
//
|
||
double depth=m_pResult->Depth;
|
||
int Order=m_pResult->Order;
|
||
int Number=m_pResult->Number;
|
||
|
||
if(bDrawGuanzhu == false)
|
||
{
|
||
//还没有画管柱
|
||
if(Number == zoneOrder_Tubing.value("管底部").toInt()||
|
||
Number == zoneOrder_Tubing.value("油管深").toInt()||
|
||
Number == zoneOrder_Tubing.value("喇叭口").toInt()||
|
||
Number == zoneOrder_Tubing.value("剌叭口").toInt())
|
||
{
|
||
bDrawGuanzhu = true;//画管柱
|
||
m_depth_Tubing = depth;//管柱深度
|
||
|
||
//绘制管柱
|
||
DrawTubing();
|
||
}
|
||
}
|
||
}
|
||
|
||
//绘制结构
|
||
DrawStruct();
|
||
//
|
||
logio->CloseTable(iIndex);
|
||
delete m_pResult;
|
||
}
|
||
delete logio;
|
||
|
||
for(int i=0; i<m_pResultList_Tubing.size(); i++)
|
||
{
|
||
Slf_JIEGUPOS result = m_pResultList_Tubing[i];
|
||
//
|
||
drawOne_Tubing(result);
|
||
}
|
||
//统一刷新
|
||
this->replot();
|
||
|
||
return true;
|
||
}
|
||
|
||
void QMyCustomPlot::drawOne_Tubing(Slf_JIEGUPOS result)
|
||
{
|
||
double depth=result.Depth;
|
||
//int Order=result.Order;
|
||
int Number=result.Number;
|
||
|
||
float h=20;
|
||
float in=m_Oguan_Tubing;
|
||
if(!m_bDrawCCL_Tubing)
|
||
{
|
||
if(Number==1) {
|
||
in=m_Oguan_Tubing+1;
|
||
}
|
||
else if(Number==zoneOrder_Tubing.value("套管接箍").toInt()){
|
||
h=10;
|
||
in=m_Oguan_Tubing;
|
||
}
|
||
else if(Number==zoneOrder_Tubing.value("封隔器").toInt()||
|
||
Number==zoneOrder_Tubing.value("水力猫").toInt()||
|
||
Number==zoneOrder_Tubing.value("卡瓦").toInt()||
|
||
Number==zoneOrder_Tubing.value("定封隔猫").toInt()
|
||
)
|
||
{
|
||
if(Number==zoneOrder_Tubing.value("封隔器").toInt()) h=25;
|
||
in=m_Oguan_Tubing;
|
||
}
|
||
else {
|
||
in=m_Oguan_Tubing+1;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
in=m_inD_Tubing+1;
|
||
}
|
||
|
||
QString name;
|
||
if(!m_bDrawCCL_Tubing)
|
||
{
|
||
name=zoneOrder_Tubing.key(QString::number(Number));
|
||
if(name.isEmpty()) name=zoneOrder_Tubing.key(QString::number(1));
|
||
}
|
||
else
|
||
{
|
||
name=zoneOrder_Tubing.key(QString::number(1));
|
||
}
|
||
|
||
QString cclimgfile=cclimgpath_Tubing+name+".png";
|
||
float upper = this->xAxis->coordToPixel(-depth)-h/2.0;
|
||
float lower = this->xAxis->coordToPixel(-depth)+h/2.0;
|
||
float newUpper = this->xAxis->pixelToCoord(upper);
|
||
float newLower = this->xAxis->pixelToCoord(lower);
|
||
this->addGuanToPlot(newLower, newUpper, cclimgfile, in, false);
|
||
}
|
||
|
||
bool QMyCustomPlot::LoadFromSLF_ReDrawTubing(QString strSlfName, QString csCurve)
|
||
{
|
||
cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\";
|
||
|
||
Slf_JIEGUPOS *m_pResult=NULL;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
return false;
|
||
}
|
||
|
||
int iIndex=logio->OpenTable(csCurve.toStdString().c_str());
|
||
if(iIndex<0)
|
||
{
|
||
delete logio;
|
||
return false;
|
||
}
|
||
//
|
||
if(iIndex>-1) {
|
||
int count=logio->GetTableRecordCount(iIndex);
|
||
//int fieldnum=logio->GetTableFieldCount(iIndex);
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
m_pResult=(Slf_JIEGUPOS *)new char[len+1];
|
||
char buf[200];
|
||
logio->IsChange=true;
|
||
|
||
bool bDrawGuanzhu = false;
|
||
for(int i=0;i<count;i++)
|
||
{
|
||
memset(m_pResult,0,sizeof(len));
|
||
logio->ReadTable(iIndex,i+1,m_pResult);
|
||
|
||
Slf_JIEGUPOS result;
|
||
result.Depth=m_pResult->Depth;
|
||
result.Order=m_pResult->Order;
|
||
result.Number=m_pResult->Number;
|
||
|
||
//
|
||
double depth=m_pResult->Depth;
|
||
int Order=m_pResult->Order;
|
||
int Number=m_pResult->Number;
|
||
|
||
if(bDrawGuanzhu == false)
|
||
{
|
||
//还没有画管柱
|
||
if(Number == zoneOrder_Tubing.value("管底部").toInt()||
|
||
Number == zoneOrder_Tubing.value("油管深").toInt()||
|
||
Number == zoneOrder_Tubing.value("喇叭口").toInt()||
|
||
Number == zoneOrder_Tubing.value("剌叭口").toInt())
|
||
{
|
||
bDrawGuanzhu = true;//画管柱
|
||
m_depth_Tubing = depth;//管柱深度
|
||
|
||
//绘制管柱
|
||
DrawTubing();
|
||
}
|
||
}
|
||
}
|
||
//
|
||
logio->CloseTable(iIndex);
|
||
delete m_pResult;
|
||
}
|
||
delete logio;
|
||
//统一刷新
|
||
this->replot();
|
||
|
||
return true;
|
||
}
|
||
|
||
|
||
bool QMyCustomPlot::SaveToSLF_Tubing()
|
||
{
|
||
static int isrun=false;
|
||
if(isrun) return false;
|
||
QString ss=m_strSlfName;
|
||
if(ss=="") return false;
|
||
isrun=true;
|
||
|
||
Slf_JIEGUPOS m_Result;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
bool isfirst=false;
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if (iIndex < 0)
|
||
{
|
||
if(!m_mapDraggable_Guan.size()) {
|
||
delete logio;
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
if(m_strLineName.indexOf("READCCL",0,Qt::CaseInsensitive)>-1) {
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,3,
|
||
"NO,DEPTH,NUMBER",
|
||
"4,4,4",//字段长度
|
||
"1,4,4",//字段类型
|
||
"0,0,0");//字段备注,1-枚举
|
||
}
|
||
else iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,4,
|
||
"NO,DEPTH,NUMBER,DEST",
|
||
"4,4,4,64",//字段长度
|
||
"1,4,4,6",//字段类型
|
||
"0,0,8,0");//字段备注,1-枚举
|
||
isfirst=true;
|
||
}
|
||
logio->IsChange=true;
|
||
logio->SetTableRecordCount(iIndex,m_mapDraggable_Guan.size());
|
||
if(!m_mapDraggable_Guan.size()) {
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return false;
|
||
}
|
||
int len=logio->GetTableRecordLength(iIndex);
|
||
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
//排序
|
||
QList<float> listSDepth;
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Guan.begin(); iter != m_mapDraggable_Guan.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
//
|
||
float fSDepth = -tmpRange.upper;
|
||
listSDepth.append(fSDepth);
|
||
}
|
||
qSort(listSDepth);
|
||
|
||
//
|
||
for(int i=0; i<listSDepth.size(); i++)
|
||
{
|
||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Guan.begin(); iter != m_mapDraggable_Guan.end(); iter++)
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)iter.value();
|
||
//
|
||
QCPRange tmpRange = pDraggableRect->getRange();
|
||
float fSDepth = -tmpRange.upper;
|
||
float fEDepth = -tmpRange.lower;
|
||
if(fSDepth == listSDepth[i])//按顺序写入
|
||
{
|
||
memset(&m_Result,0,len);
|
||
m_Result.Order=i+1;
|
||
m_Result.Depth=(fSDepth+fEDepth)/2.0;
|
||
//
|
||
QString name,itemName;
|
||
pDraggableRect->m_Result.replace("\\","/");
|
||
int l=pDraggableRect->m_Result.lastIndexOf("/");
|
||
if(l>-1) name=pDraggableRect->m_Result.mid(l+1);
|
||
l=name.indexOf(".");
|
||
name=name.left(l);
|
||
itemName=name;
|
||
//
|
||
m_Result.Number=zoneOrder_Tubing.value(itemName).toInt();
|
||
if(len==sizeof(Slf_JIEGUPOS)) {
|
||
strncpy(m_Result.Dest,"",64);
|
||
m_Result.Dest[63]=0;
|
||
}
|
||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||
}
|
||
}
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete logio;
|
||
if(isfirst)AddTableToWellRound();
|
||
isrun=false;
|
||
return true;
|
||
}
|
||
|
||
|
||
//检查套管组件名称,是否需要更新套管图形
|
||
bool QMyCustomPlot::checkTubingName(QString m_Result)
|
||
{
|
||
//
|
||
QString name,itemName;
|
||
m_Result.replace("\\","/");
|
||
int l=m_Result.lastIndexOf("/");
|
||
if(l>-1) name=m_Result.mid(l+1);
|
||
l=name.indexOf(".");
|
||
name=name.left(l);
|
||
itemName=name;
|
||
//画管柱
|
||
if(itemName == "管底部" ||
|
||
itemName == "油管深" ||
|
||
itemName == "喇叭口" ||
|
||
itemName == "剌叭口")
|
||
{
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
//粘贴数据成取心
|
||
void QMyCustomPlot::addItems_Tubing()
|
||
{
|
||
int hasNO=0;
|
||
int isSK=0;
|
||
bool bReDraw = false;
|
||
{
|
||
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||
QString originalTubingstring = clipboard->text(); //获取剪贴板上文本信息
|
||
int isspace=originalTubingstring.indexOf(" ");
|
||
int istab=originalTubingstring.indexOf("\t");
|
||
int isd=originalTubingstring.indexOf(",");
|
||
|
||
if((istab>-1|isd>-1)&&isspace>-1)
|
||
{
|
||
QMessageBox::information(NULL,"提示","\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
|
||
}
|
||
originalTubingstring.replace("\t"," ");
|
||
originalTubingstring.replace(","," ");
|
||
originalTubingstring.replace("\r\n","\n");
|
||
originalTubingstring.replace("\r","\n");
|
||
QStringList line=originalTubingstring.split("\n");
|
||
line.removeAll("");
|
||
if(line.size()<1) return;
|
||
QString TableName;
|
||
QStringList temp1;
|
||
|
||
if(line.size()>1) {
|
||
temp1=line[0].split(" ");
|
||
temp1.removeAll("");
|
||
if(temp1.size()==1&&temp1.at(0).length()&&!temp1.at(0).at(0).isDigit()) {
|
||
TableName=temp1.at(0);
|
||
line.removeAt(0);
|
||
//CoreObj->SetName(TableName);
|
||
}
|
||
}
|
||
QString ss = m_strSlfName;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
|
||
{
|
||
delete logio;
|
||
QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return;
|
||
}
|
||
int k=0;
|
||
QStringList coredat=line[0].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||
if(iIndex>=0) {
|
||
int count=logio->GetTableFieldCount(iIndex);
|
||
if(count!=coredat.size()) {
|
||
logio->DiscardObject(m_strLineName.toStdString().c_str());
|
||
}
|
||
iIndex=-1;
|
||
}
|
||
bool isfirst=false;
|
||
if(iIndex<0)
|
||
{
|
||
QString name,Length,type,temp;
|
||
bool ret=false;
|
||
QStringList css;
|
||
if(coredat.size()&&!coredat[0].isEmpty()) {
|
||
int NUM=0;
|
||
if(!coredat.at(0).at(0).isDigit()){
|
||
if(coredat.at(0).indexOf("NO",0,Qt::CaseInsensitive)<0
|
||
&&coredat.at(0).indexOf("序号")<0
|
||
&&coredat.at(0).indexOf("INDEX")<0
|
||
&&coredat.at(0).indexOf("ORDER")<0
|
||
)
|
||
{
|
||
coredat.insert(0,"NO");
|
||
hasNO=true;
|
||
}
|
||
}
|
||
else {
|
||
if(hasNO) coredat.insert(0,QString::number(1));
|
||
}
|
||
if(m_strLineName=="SK"&&(coredat.size()==4||coredat.size()==5))
|
||
{
|
||
isSK=1;
|
||
name="NO,SDEP,EDEP,ZONE,RESULT,THICK,TT,ZONENO,LAYER,DEST";
|
||
Length="4,4,4,8,4,4,4,64,64,64";
|
||
type= "1,4,4,6,1,4,4,6,6,6";
|
||
temp= "0,0,0,0,1,0,0,0,0,0";
|
||
NUM=10;
|
||
}
|
||
else {
|
||
for(int j=0;j<coredat.size();j++)
|
||
{
|
||
if(j==0) name+="NO";
|
||
//else if(j==1) name+="SDEP";
|
||
//else if(j==2)name+="EDEP";
|
||
if(j==0){
|
||
Length+="4";
|
||
type+="1";
|
||
}
|
||
else {
|
||
bool isdi=false;
|
||
if(css.size()>j)
|
||
{
|
||
for (int k=0;k<css.at(j).size();k++)
|
||
{
|
||
if(!css.at(j).at(k).isDigit()&&css.at(j).at(k)!='.'&&css.at(j).at(k)!='-'){
|
||
isdi=true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if(isdi) {
|
||
type+="6";
|
||
Length+="64";
|
||
}
|
||
else {
|
||
type+="4";
|
||
Length+="4";
|
||
}
|
||
}
|
||
if(name.indexOf("Number",0,Qt::CaseInsensitive)>-1) temp+="8";
|
||
else temp+"0";
|
||
if(j!=coredat.size())
|
||
{
|
||
name+=",";
|
||
Length+=",";
|
||
type+=",";
|
||
temp+=",";
|
||
}
|
||
}
|
||
if(!coredat.at(0).at(0).isDigit()&&coredat.at(0).at(0)!='.'&&coredat.at(0).at(0)!='-') name=coredat.join(",");
|
||
NUM=coredat.size();
|
||
}
|
||
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,NUM,
|
||
(char*)name.toStdString().c_str(),
|
||
(char*)Length.toStdString().c_str(),//字段长度
|
||
(char*)type.toStdString().c_str(),//字段类型
|
||
(char*)temp.toStdString().c_str());//字段备注,1-枚举
|
||
isfirst=true;
|
||
logio->SetTableRecordCount(iIndex,0);
|
||
}
|
||
}
|
||
int count=logio->GetTableFieldCount(iIndex);
|
||
Slf_TABLE_FIELD*pField=new Slf_TABLE_FIELD[logio->GetTableFieldCount(iIndex)];
|
||
logio->GetTableFieldInfo(iIndex,pField);
|
||
float yy;
|
||
for(int i=0;i<line.size();i++)
|
||
{
|
||
coredat=line[i].split(" ");
|
||
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
|
||
if(coredat.size()<1) continue;
|
||
if(coredat[0].isEmpty()) continue;
|
||
if(coredat.size()<2)continue;
|
||
if(!coredat.at(0).at(0).isDigit()) continue;
|
||
if(hasNO) coredat.insert(0,QString::number(0));
|
||
// for(int j=0;j<coredat.size();j++)
|
||
// {
|
||
// if(isSK&&(coredat.size()==5||coredat.size()==6))
|
||
// {
|
||
// if(j<3){
|
||
// yy=coredat[j].toFloat();
|
||
// logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
|
||
// }
|
||
// else if(j==3) logio->SetTableFieldData(iIndex,7,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// else if(j==4) logio->SetTableFieldData(iIndex,8,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// else if(j==5) logio->SetTableFieldData(iIndex,9,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// }
|
||
// else {
|
||
// if(pField[j].RepCode==6) {
|
||
// logio->SetTableFieldData(iIndex,j,(char*)coredat[j].toStdString().c_str(),k+1);
|
||
// }
|
||
// else {
|
||
// yy=coredat[j].toFloat();
|
||
// logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
|
||
// }
|
||
// }
|
||
// }
|
||
// k++;
|
||
//AddItem(coredat);
|
||
//
|
||
double Depth = coredat[1].toDouble();
|
||
int Number = coredat[2].toDouble();
|
||
Slf_JIEGUPOS result;
|
||
result.Depth = Depth;
|
||
result.Order = 0;
|
||
result.Number = Number;
|
||
//
|
||
drawOne_Tubing(result);
|
||
|
||
//还没有画管柱
|
||
if(Number == zoneOrder_Tubing.value("管底部").toInt()||
|
||
Number == zoneOrder_Tubing.value("油管深").toInt()||
|
||
Number == zoneOrder_Tubing.value("喇叭口").toInt()||
|
||
Number == zoneOrder_Tubing.value("剌叭口").toInt())
|
||
{
|
||
bReDraw = true;//重画管柱
|
||
}
|
||
}
|
||
delete logio;
|
||
delete []pField;
|
||
|
||
if(isfirst)
|
||
{
|
||
AddTableToWellRound();
|
||
//绘制结构
|
||
DrawStruct();
|
||
}
|
||
|
||
//保存
|
||
SaveToSLF_Tubing();
|
||
|
||
if(bReDraw)
|
||
{
|
||
//组件改变后,重绘管柱
|
||
LoadFromSLF_ReDrawTubing(m_strSlfName, m_strLineName);
|
||
}
|
||
else
|
||
{
|
||
//刷新
|
||
this->replot();
|
||
}
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
}
|
||
|
||
//全部清空
|
||
void QMyCustomPlot::DeleteItems_Tubing()
|
||
{
|
||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||
QString obj=m_strLineName + "BAK";
|
||
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
|
||
AddTableToWellRound();
|
||
|
||
//删除对象
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//刷新
|
||
//this->replot();
|
||
|
||
//保存
|
||
SaveToSLF_Tubing();
|
||
|
||
//重新加载
|
||
LoadFromSLF_Tubing(m_strSlfName, m_strLineName);
|
||
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//刷新数据
|
||
void QMyCustomPlot::RefreshItems_Tubing()
|
||
{
|
||
//删除对象
|
||
TransparentDraggableGuan *pDraggableRect =NULL;
|
||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Guan.begin();
|
||
while( it != m_mapDraggable_Guan.end() )
|
||
{
|
||
pDraggableRect = (TransparentDraggableGuan*)it.value();
|
||
it++;
|
||
pDraggableRect->deleteRect();
|
||
}
|
||
|
||
//重新加载
|
||
LoadFromSLF_Tubing(m_strSlfName, m_strLineName);
|
||
//属性清空
|
||
PropertyService()->InitCurrentViewInfo();
|
||
}
|
||
|
||
//改变曲线名
|
||
void QMyCustomPlot::s_changeLineName(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
m_strLineName = strNewLineName;
|
||
//刷新数据
|
||
s_ReloadPlot(strUuid, strSlfName, strNewLineName);
|
||
//RefreshItems_Jiegutext();
|
||
}
|