曲线数值设置,曲线数值,累加基曲线
This commit is contained in:
parent
618dcec52c
commit
65289a6da1
|
|
@ -1959,13 +1959,19 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
<< "线宽" << "颜色" << "线型"
|
||||
<< "第二比例大小" << "自动计算二比例"
|
||||
<< "绘制左二比例" << "左二比例连续折返" << "左二比例左刻度" << "左二比例右刻度"
|
||||
<< "绘制右二比例" << "右二比例连续折返" << "右二比例左刻度" << "右二比例右刻度";
|
||||
<< "绘制右二比例" << "右二比例连续折返" << "右二比例左刻度" << "右二比例右刻度"
|
||||
<< "曲线数值" << "累加基曲线";
|
||||
for (int i = 0; i < slist.length(); i++)
|
||||
{
|
||||
if (slist.at(i) == m_propertyData[pProperty])
|
||||
{
|
||||
bhv = true;
|
||||
bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant, strGroup);
|
||||
QVariant val = variant;
|
||||
if (m_propertyData[pProperty] == "累加基曲线")
|
||||
{
|
||||
val = m_listOtherLine.at(val.toInt());
|
||||
}
|
||||
bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], val, strGroup);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2939,6 +2945,14 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt
|
|||
_CreateVariantPropertyItem("岩性填充", "岩性前景色", formInfo->m_frontColor, QVariant::Color);
|
||||
_CreateVariantPropertyItem("岩性填充", "岩性背景色", formInfo->m_backColor, QVariant::Color);
|
||||
|
||||
QStringList listCvrval;
|
||||
listCvrval.append("原值");
|
||||
listCvrval.append("和曲线");
|
||||
_CreateEnumPropertyItem("曲线数值设置", "曲线数值", formInfo->m_nCurveV, listCvrval);
|
||||
m_listOtherLine = strListOtherLine;
|
||||
m_listOtherLine.prepend("");
|
||||
_CreateEnumPropertyItem("曲线数值设置", "累加基曲线", strListOtherLine.indexOf(formInfo->m_strCurveAnd), m_listOtherLine);
|
||||
|
||||
//当前属性类型
|
||||
m_strCurrentProperty = Curve_Property;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public:
|
|||
//图头, 行高、列宽
|
||||
double m_colWidth = 1;
|
||||
double m_rowHeight = 1;
|
||||
|
||||
QStringList m_listOtherLine; // 其他曲线
|
||||
//道
|
||||
QMyTableWidget *m_myTableWidget;
|
||||
int m_iCurrentCol;
|
||||
|
|
|
|||
|
|
@ -2736,6 +2736,19 @@ bool FormDraw::isHvRowGridLine()
|
|||
return bret;
|
||||
}
|
||||
|
||||
QMyCustomPlot* FormDraw::getCurve(QString strCurveName)
|
||||
{
|
||||
for (int i = 0; i < m_vecCurv.size(); i++)
|
||||
{
|
||||
QMyCustomPlot* plot = m_vecCurv.at(i);
|
||||
if (plot->m_strLineName == strCurveName)
|
||||
{
|
||||
return plot;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void FormDraw::setGridProperty(int ncuGrid, /* 粗网格间隔 */ QPen cuPen, int nzhongGrid, /* 中网格间隔 */ QPen zhongPen, int nxiGrid, /* 细网格间隔 */ QPen xiPen)
|
||||
{
|
||||
m_ncuGrid = ncuGrid;
|
||||
|
|
@ -4396,36 +4409,13 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
|
|||
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle, QStringList listOtherProperty)
|
||||
{
|
||||
//AppendConsole(PAI_INFO, "FormDraw initForm");
|
||||
|
||||
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;
|
||||
float vmax,vmin;
|
||||
//
|
||||
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_CURVE curveinfo;
|
||||
QVector<double> x, y;
|
||||
double vmax = -9999, vmin = -9999;
|
||||
widget->getCurveData(strSlfName, strLineName, curveinfo, x, y, newLeftScale, vmin, vmax);
|
||||
|
||||
QString strAliasName="";
|
||||
QString strUnit="";
|
||||
|
||||
if(listOtherProperty.size()>=2)
|
||||
{
|
||||
strAliasName=listOtherProperty[0];
|
||||
|
|
@ -4487,36 +4477,6 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
|
|||
pointStyle = (QCPScatterStyle::ScatterShape)listOtherProperty[7].toInt();
|
||||
}
|
||||
|
||||
//最大值,最小值
|
||||
bool bFistValue=false;
|
||||
vmax = -9999;//(float)_nSamples;
|
||||
vmin = -9999;
|
||||
|
||||
//slf文件读取曲线
|
||||
QVector<double> x, y;
|
||||
for(int i=0; i<count; i++)
|
||||
{
|
||||
if(newLeftScale==-9999)
|
||||
{
|
||||
if(val[i]==-9999)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(bFistValue==false)
|
||||
{
|
||||
//最大值,最小值默认采用第一个有效值
|
||||
bFistValue=true;
|
||||
vmax = vmin = val[i];
|
||||
}
|
||||
|
||||
if(vmax<val[i])vmax=val[i];
|
||||
if(vmin>val[i])vmin=val[i];
|
||||
}
|
||||
//
|
||||
x.append(-(sdep+ rlev*i));
|
||||
y.append(val[i]);
|
||||
}
|
||||
|
||||
if(newLeftScale!=-9999)
|
||||
{
|
||||
vmax = newRightScale;
|
||||
|
|
@ -4529,24 +4489,6 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
|
|||
|
||||
widget->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
|
||||
|
||||
//框选-----
|
||||
// widget->setInteraction(QCP::iRangeDrag, false); // 关闭拖动
|
||||
// widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); // 启用框选放大
|
||||
// //
|
||||
// widget->selectionRect()->setPen(QPen(Qt::black, 1, Qt::DashLine)); // 虚线边框
|
||||
// widget->selectionRect()->setBrush(QBrush(QColor(0,0,100,50))); // 半透明蓝色填充
|
||||
// //
|
||||
// QCPSelectionRect *selectionRect = new QCPSelectionRect(widget);
|
||||
// connect(selectionRect, &QCPSelectionRect::accepted, [=]() {
|
||||
// // 当选择完成时,获取矩形范围并放大
|
||||
// QRectF rect = selectionRect->rect(); // 获取选择的矩形区域(像素坐标)
|
||||
// // 转换为坐标轴范围
|
||||
// double x1 = widget->xAxis->pixelToCoord(rect.left());
|
||||
// double x2 = widget->xAxis->pixelToCoord(rect.right());
|
||||
// double y1 = widget->yAxis->pixelToCoord(rect.top());
|
||||
// double y2 = widget->yAxis->pixelToCoord(rect.bottom());
|
||||
// });
|
||||
|
||||
widget->setScaleX(vmin, vmax);
|
||||
widget->setDepthY(m_iY1, m_iY2);
|
||||
widget->initGeometry(m_strUuid, m_iScale, g_iOneWidth);
|
||||
|
|
@ -4596,13 +4538,6 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
|
|||
addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit);
|
||||
}
|
||||
|
||||
//支持框选
|
||||
//setupSelectionDemo(widget);
|
||||
//AppendConsole(PAI_INFO, "FormDraw setupSelectionDemo end");
|
||||
|
||||
//widget->rescaleAxes();
|
||||
//widget->replot();//屏蔽,缩减时间
|
||||
//AppendConsole(PAI_INFO, "FormDraw initForm end");
|
||||
}
|
||||
|
||||
void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples)
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ public:
|
|||
void addCusPlot(QMyCustomPlot* plot);
|
||||
// 绘图是否有显示横线格子;
|
||||
bool isHvRowGridLine();
|
||||
// 根据曲线名字获取曲线
|
||||
QMyCustomPlot* getCurve(QString strCurveName);
|
||||
|
||||
void setGridProperty(int ncuGrid, // 粗网格间隔
|
||||
QPen cuPen,
|
||||
|
|
|
|||
|
|
@ -1864,6 +1864,14 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val, QString strGp)
|
|||
{
|
||||
m_twoBLRightRight = val.toString();
|
||||
}
|
||||
else if ("曲线数值" == strProName)
|
||||
{
|
||||
m_nCurveV = val.toInt();
|
||||
}
|
||||
else if ("累加基曲线" == strProName)
|
||||
{
|
||||
m_strCurveAnd = val.toString();
|
||||
}
|
||||
else if ("色板" == strProName)
|
||||
{
|
||||
this->m_nSchemeIndex = val.toInt();
|
||||
|
|
|
|||
|
|
@ -134,6 +134,9 @@ public:
|
|||
QString m_twoBLRightLeft = ""; // 右二比例左刻度
|
||||
QString m_twoBLRightRight = ""; // 右二比例右刻度
|
||||
|
||||
int m_nCurveV = 0; // 曲线数值
|
||||
QString m_strCurveAnd = ""; // 累加基曲线
|
||||
|
||||
//绘制方式
|
||||
bool m_bDrawLine = true; // 曲线
|
||||
bool m_bDrawGan = false; // 杆状
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "PropertyWidget.h"
|
||||
#include "YxzpDialog.h"
|
||||
#include "fracsel.h"
|
||||
#include "formtrack.h"
|
||||
#include "formdraw.h"
|
||||
|
||||
//是否隐藏刻度
|
||||
|
|
@ -50,17 +51,17 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
|||
// 移动这个图层到所有图层的最上方
|
||||
this->moveLayer(this->layer("topLayer"), this->layer("grid")); // -1 表示移动到列表末尾,即最顶层
|
||||
|
||||
FormDraw* pFormDw = qobject_cast<FormDraw*>(parent);
|
||||
if (pFormDw)
|
||||
m_formDraw = qobject_cast<FormDraw*>(parent);
|
||||
if (m_formDraw)
|
||||
{
|
||||
if (pFormDw->isHvRowGridLine())
|
||||
if (m_formDraw->isHvRowGridLine())
|
||||
{
|
||||
m_bRowGridVisible = false;
|
||||
}
|
||||
m_cuPen = pFormDw->m_cuPen;
|
||||
m_zhongPen = pFormDw->m_zhongPen;
|
||||
m_xiPen = pFormDw->m_xiPen;
|
||||
pFormDw->addCusPlot(this);
|
||||
m_cuPen = m_formDraw->m_cuPen;
|
||||
m_zhongPen = m_formDraw->m_zhongPen;
|
||||
m_xiPen = m_formDraw->m_xiPen;
|
||||
m_formDraw->addCusPlot(this);
|
||||
}
|
||||
|
||||
mSizeHandleManager = new QCPSizeHandleManager(this);
|
||||
|
|
@ -750,6 +751,63 @@ void QMyCustomPlot::setShowPos(int nSPos)
|
|||
}
|
||||
}
|
||||
|
||||
void QMyCustomPlot::getCurveData(QString strSlfName,
|
||||
QString strLineName, Slf_CURVE& curveinfo,
|
||||
QVector<double>& x, QVector<double>& y, double newLeftScale, double& vmin, double& vmax)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
logio->GetCurveInfo(index, &curveinfo);
|
||||
float sdep, edep, rlev;
|
||||
sdep = curveinfo.StartDepth;
|
||||
edep = curveinfo.EndDepth;
|
||||
rlev = curveinfo.DepLevel;
|
||||
//
|
||||
DWORD count = (curveinfo.EndDepth - curveinfo.StartDepth) / curveinfo.DepLevel + 1.5;
|
||||
float* val = new float[count];
|
||||
logio->ReadCurve(index, curveinfo.StartDepth, count, &val[0]);
|
||||
logio->CloseCurve(index);
|
||||
delete logio;
|
||||
|
||||
bool bFistValue = false;
|
||||
//slf文件读取曲线
|
||||
x.clear();
|
||||
y.clear();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (newLeftScale == -9999)
|
||||
{
|
||||
if (val[i] == -9999)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (val[i] > -1000)
|
||||
{
|
||||
if (bFistValue == false)
|
||||
{
|
||||
//最大值,最小值默认采用第一个有效值
|
||||
bFistValue = true;
|
||||
vmax = vmin = val[i];
|
||||
}
|
||||
|
||||
if (vmax < val[i])vmax = val[i];
|
||||
if (vmin > val[i])vmin = val[i];
|
||||
}
|
||||
}
|
||||
//
|
||||
x.append(-(sdep + rlev * i));
|
||||
y.append(val[i]);
|
||||
}
|
||||
delete []val;
|
||||
}
|
||||
|
||||
//蝌蚪图,重绘网格线
|
||||
void QMyCustomPlot::drawCustomElements()
|
||||
{
|
||||
|
|
@ -5115,6 +5173,10 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
|||
if (graph)
|
||||
graph->setVisible(varVal.toBool());
|
||||
}
|
||||
else if ("曲线数值" == strProperty || "累加基曲线" == strProperty)
|
||||
{
|
||||
this->changeCurveValSetting();
|
||||
}
|
||||
|
||||
this->replot();
|
||||
}
|
||||
|
|
@ -10488,6 +10550,47 @@ void QMyCustomPlot::changeGrapProperty(QString strGroup)
|
|||
|
||||
}
|
||||
|
||||
void QMyCustomPlot::changeCurveValSetting()
|
||||
{
|
||||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Slf_CURVE curveinfo;
|
||||
QVector<double> x, y;
|
||||
double vmax = -9999, vmin = -9999;
|
||||
this->getCurveData(m_strSlfName, m_strLineName, curveinfo, x, y, -9999, vmin, vmax);
|
||||
if (pInfo->m_nCurveV == 1 && pInfo->m_strCurveAnd.length() > 0)
|
||||
{
|
||||
QVector<double> x1, y1;
|
||||
this->getCurveData(m_strSlfName, pInfo->m_strCurveAnd, curveinfo, x1, y1, -9999, vmin, vmax);
|
||||
|
||||
int nsize = min(y1.size(), y.size());
|
||||
m_x.clear();
|
||||
m_x = x;
|
||||
m_y.clear();
|
||||
for (int i = 0; i < nsize; i++)
|
||||
{
|
||||
if (y1.at(i) > -1000)
|
||||
m_y.append(y1.at(i) + y.at(i));
|
||||
else
|
||||
m_y.append(y.at(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_x.clear();
|
||||
m_y.clear();
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
}
|
||||
//if (pInfo->m_bConBackAndForth)
|
||||
updateCurveConBackAndForth();
|
||||
if (pInfo->m_twoBLSize > 0)
|
||||
updateCurveTwoBackAndForth();
|
||||
}
|
||||
|
||||
//道宽改变后,避免井壁取心等组件变形,需要重新刷新
|
||||
void QMyCustomPlot::resetPosition()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "LogIO.h"
|
||||
#include "QCPSizeHandleManager.h"
|
||||
#include "qtColorSchemeComboBox.h"
|
||||
#include "formtrack.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
|
|
@ -47,6 +46,8 @@ typedef struct
|
|||
char Dest[32];
|
||||
}FAC_TABLE;
|
||||
|
||||
class FormTrack;
|
||||
class FormDraw;
|
||||
class TransparentGroupResult;
|
||||
class QMyCustomPlot : public QCustomPlot
|
||||
{
|
||||
|
|
@ -82,6 +83,16 @@ public:
|
|||
void setConclusionProportion(int nCopro);
|
||||
void setShowPos(int nSPos);
|
||||
|
||||
void getCurveData(
|
||||
QString strSlfName,
|
||||
QString strLineName,
|
||||
Slf_CURVE& curveinfo,
|
||||
QVector<double>& x,
|
||||
QVector<double>& y,
|
||||
double newLeftScale,
|
||||
double& vmin,
|
||||
double& vmax);
|
||||
|
||||
//道宽改变后,避免井壁取心等组件变形,需要重新刷新
|
||||
void resetPosition();
|
||||
//固井结论
|
||||
|
|
@ -109,8 +120,11 @@ public:
|
|||
void updateCurveConBackAndForth();
|
||||
// 二比例
|
||||
void updateCurveTwoBackAndForth();
|
||||
//
|
||||
// 线宽 颜色 线型
|
||||
void changeGrapProperty(QString strGroup);
|
||||
// 曲线数值设置
|
||||
void changeCurveValSetting();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
|
@ -123,7 +137,7 @@ public:
|
|||
QString m_strLineName;
|
||||
|
||||
FormTrack *m_formTrack = NULL;
|
||||
|
||||
FormDraw *m_formDraw = NULL;
|
||||
//
|
||||
float m_iX1, m_iX2;
|
||||
float m_iY1, m_iY2;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user