1.杆状图属性追加 2.支持从json模板加载杆状图

This commit is contained in:
jiayulong 2026-04-22 15:14:50 +08:00
parent 5bccdc8808
commit 945436e7d9
12 changed files with 547 additions and 269 deletions

View File

@ -265,6 +265,10 @@ signals:
//改变蝌蚪图属性
void sig_changeKedouProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
//改变杆状图属性
void sig_changeGanzhuangProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
//
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);

View File

@ -2371,7 +2371,13 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
//
changedKedouProperty(m_propertyData[pProperty], variant);
}
else if (m_strCurrentProperty == Ganzhuang_Property)//杆状图
{
//先处理通用属性
CommonPropertyChanged(pProperty, variant);
//
changedGanzhuangProperty(m_propertyData[pProperty], variant);
}
}
@ -3198,6 +3204,11 @@ void PropertyWidget::initProperty(FormInfo *formInfo)
//蝌蚪图
this->initKedouProperty(formInfo);
}
else if (m_strLineName == "GANZHUANG.LINE")
{
//杆状图
this->initGanzhuangProperty(formInfo);
}
else
{
this->initTableProperty(formInfo);
@ -5247,8 +5258,6 @@ void PropertyWidget::changedKedouProperty(QString strProperty, QVariant varVal)
if ("名称" == strProperty)
{
QFont newFont = varVal.value<QFont>();
// this->m_formInfo->m_strAliasNameFont = newFont;
// this->m_formInfo->repaint();
m_formInfo->m_curveNameFont = newFont;
m_formInfo->update();
}
@ -5319,11 +5328,13 @@ void PropertyWidget::changedKedouProperty(QString strProperty, QVariant varVal)
else if ("最小倾角" == strProperty)
{
this->m_formInfo->m_pl_minInclination = varVal.toDouble();
this->m_formInfo->repaint();
flag = true;
}
else if ("最大倾角" == strProperty)
{
this->m_formInfo->m_pl_maxInclination = varVal.toDouble();
this->m_formInfo->repaint();
flag = true;
}
else if ("可信度1" == strProperty)
@ -5444,3 +5455,100 @@ void PropertyWidget::changedKedouProperty(QString strProperty, QVariant varVal)
emit CallManage::getInstance()->sig_changeKedouProperty(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName);
}
}
void PropertyWidget::initGanzhuangProperty(FormInfo *formInfo)
{
_CreateVariantPropertyItem("曲线图名", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("井文件名", "井文件名称", m_strSlfName, QVariant::String);
//
_CreateVariantPropertyItem("曲线选择", "方位曲线", formInfo->m_pl_azimuthCurve, QVariant::String);
_CreateVariantPropertyItem("曲线选择", "倾角曲线", formInfo->m_pl_inclinationCurve, QVariant::String);
_CreateVariantPropertyItem("曲线选择", "可信度曲线", formInfo->m_pl_GradCurve, QVariant::String);
//
_CreateVariantPropertyItem("倾角刻度", "最小倾角", formInfo->m_pl_minInclination, QVariant::Double);
_CreateVariantPropertyItem("倾角刻度", "最大倾角", formInfo->m_pl_maxInclination, QVariant::Double);
//
_CreateVariantPropertyItem("可信度", "可信度1", formInfo->m_flGrad1, QVariant::Double);
_CreateVariantPropertyItem("可信度", "可信度2", formInfo->m_flGrad2, QVariant::Double);
//
_CreateVariantPropertyItem("曲线单位", "显示单位", formInfo->m_strUnit, QVariant::String);
//
_CreateVariantPropertyItem("杆设置", "线长度", formInfo->m_nTailLen, QVariant::Double);
_CreateVariantPropertyItem("杆设置", "线宽度", formInfo->m_nTailWidth, QVariant::Double);
_CreateVariantPropertyItem("杆设置", "线颜色", formInfo->m_crTail, QVariant::Color);
m_strCurrentProperty = Ganzhuang_Property;
}
void PropertyWidget::changedGanzhuangProperty(QString strProperty, QVariant varVal)
{
bool flag = false;
if ("方位曲线" == strProperty)
{
this->m_formInfo->m_pl_azimuthCurve = varVal.toString();
flag = true;
}
else if ("倾角曲线" == strProperty)
{
this->m_formInfo->m_pl_inclinationCurve = varVal.toString();
flag = true;
}
else if ("可信度曲线" == strProperty)
{
this->m_formInfo->m_pl_GradCurve = varVal.toString();
flag = true;
}
// 杆
else if ("线长度" == strProperty)
{
this->m_formInfo->m_nTailLen = varVal.toDouble();
flag = true;
}
else if ("线宽度" == strProperty)
{
this->m_formInfo->m_nTailWidth = varVal.toDouble();
flag = true;
}
else if ("线颜色" == strProperty)
{
this->m_formInfo->m_crTail = varVal.value<QColor>();
flag = true;
}
//
else if ("最小倾角" == strProperty)
{
this->m_formInfo->m_pl_minInclination = varVal.toDouble();
this->m_formInfo->repaint();
flag = true;
}
else if ("最大倾角" == strProperty)
{
this->m_formInfo->m_pl_maxInclination = varVal.toDouble();
this->m_formInfo->repaint();
flag = true;
}
else if ("可信度1" == strProperty)
{
this->m_formInfo->m_flGrad1 = varVal.toDouble();
flag = true;
}
else if ("可信度2" == strProperty)
{
this->m_formInfo->m_flGrad2 = varVal.toDouble();
flag = true;
}
else if ("显示单位" == strProperty)
{
this->m_formInfo->m_strUnit = varVal.toString();
this->m_formInfo->repaint();
}
if(flag)
{
emit CallManage::getInstance()->sig_changeGanzhuangProperty(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName);
}
}

View File

@ -78,6 +78,7 @@
#define TubingItem_Property "TubingItem_Property" //套管组件item
#define Kedou_Property "Kedou_Property" //蝌蚪图
#define Ganzhuang_Property "Ganzhuang_Property" //杆状图
#pragma execution_character_set("utf-8")
@ -262,6 +263,10 @@ public:
void initKedouProperty(FormInfo *formInfo);
void changedKedouProperty(QString strProName, QVariant val);
//杆状图
void initGanzhuangProperty(FormInfo *formInfo);
void changedGanzhuangProperty(QString strProName, QVariant val);
public slots:
void SlotPropertyChanged(QtProperty *property, const QVariant &variant);
void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle);

View File

@ -59,7 +59,7 @@ FormDraw::FormDraw(QWidget *parent, QString strSlfName, QString strWellName, QSt
connect(CallManage::getInstance(), SIGNAL(sig_AddTableLine(QString, QString, QString, QString, QString)), this, SLOT(s_addTableLine(QString, QString, QString, QString, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_delTableLine(QString, QString, QString, QString)), this, SLOT(s_delTableLine(QString, QString, QString, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_AddGanZhuangTu(QString, QString, QString, QString, QString, int)), this, SLOT(s_addGanZuangTu(QString, QString, QString, QString, QString,int)));
connect(CallManage::getInstance(), SIGNAL(sig_AddGanZhuangTu(QString, QString, QString, QString, QString, int)), this, SLOT(s_addGanZhuangTu(QString, QString, QString, QString, QString,int)));
//井眼垮塌矢量图
connect(CallManage::getInstance(), SIGNAL(sig_AddJykt(QString, QString, QString, QString, QString, int)), this, SLOT(s_addJykt(QString, QString, QString, QString, QString,int)));
@ -536,9 +536,9 @@ void FormDraw::DisplayLines(QJsonArray linesArray)
// 岩心照片
displayImageData(lineObjInfo);
}
else if (strLineName == "FRAC_HOLE.TABLE")
else if (strLineName == "FRAC_HOLE.TABLE" || strLineName == "GANZHUANG.LINE")
{
// 蝌蚪图
// 蝌蚪图、杆状图
DisplayKedou_One(lineObjInfo);
}
}
@ -1194,15 +1194,9 @@ void FormDraw::DisplayKedou_One(QJsonObject lineObjInfo)
if (strLineName != "")
{
/*
QVariantMap variantMap;
// 数据
variantMap["AliasName"] = strAliasName;
variantMap["curveNameFont"] = curveNameFont;*/
//结论
//蝌蚪图、杆状
this->addKedou(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, lineObjInfo);
}
}
}
//气测/FMT/射孔/文本
@ -2908,14 +2902,6 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri
if (strLineName == "FRAC_HOLE.TABLE")
{
//蝌蚪图
curv->mKedou = true;
//隐藏网格
curv->xAxis->grid()->setVisible(false);
curv->yAxis->grid()->setVisible(false);
//
curv->m_bRowGridVisible = false;
curv->m_bColGridVisible = false;
//
initKedou(curv, strSlfName, strLineName);
}
else if (strLineName == "WORDS_RELUST")
@ -3032,13 +3018,9 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri
QMyCustomPlot* FormDraw::addKedou(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QJsonObject listOtherProperty)
{
if (strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT"
|| strLineName == "GEO_LITH" || strLineName == "SWALL_CORE"
|| strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT"
|| strLineName == "CORE_PHYSICS" || strLineName == "IMAGE_DATA"
|| strLineName == "LAYER_DATA" )
//蝌蚪、杆状
if (strLineName == "FRAC_HOLE.TABLE" || strLineName == "GANZHUANG.LINE")
{
}
else
{
@ -3070,14 +3052,6 @@ QMyCustomPlot* FormDraw::addKedou(QString strUuid, QString strSlfName, QString s
if (strLineName == "FRAC_HOLE.TABLE")
{
//蝌蚪图
curv->mKedou = true;
//隐藏网格
curv->xAxis->grid()->setVisible(false);
curv->yAxis->grid()->setVisible(false);
//
curv->m_bRowGridVisible = false;
curv->m_bColGridVisible = false;
QString strAliasName = "蝌蚪图";
QColor newlineColor=QColor(0,0,0);
// 显示名称
@ -3092,6 +3066,23 @@ QMyCustomPlot* FormDraw::addKedou(QString strUuid, QString strSlfName, QString s
//
initKedou(curv, strSlfName, strLineName, strAliasName, newlineColor, listOtherProperty);
}
else if(strLineName == "GANZHUANG.LINE")
{
QString strAliasName = "杆状图";
QColor newlineColor=QColor(0,0,0);
// 显示名称
// 显示名称
if (listOtherProperty.contains("AliasName"))
{
QJsonValue value = listOtherProperty.value("AliasName");
if (value.isString()) {
strAliasName = value.toString();
}
}
//
initGanzhuang(curv, strSlfName, strLineName, strAliasName, newlineColor, listOtherProperty);
}
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
//
m_listLineName.push_back(strLineName);
@ -3716,9 +3707,8 @@ void FormDraw::s_selectionRectAccepted(const QRect &rect, QMouseEvent *event)
// double y2 = widget->yAxis->pixelToCoord(rect.bottom());
}
void FormDraw::s_addGanZuangTu(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW)
void FormDraw::s_addGanZhuangTu(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW)
{
//井名&道名不一致
if(strUuid == m_strUuid && m_strWellName == strWellName && m_strTrackName == strTrackName)
{
@ -3741,100 +3731,17 @@ void FormDraw::s_addGanZuangTu(QString strUuid, QString strSlfName, QString strW
curv->m_strUuid = m_strUuid;
curv->setDepthY(m_iY1, m_iY2);
curv->initGeometry(m_strUuid, m_iScale, g_iOneWidth);
curv->show();
//杆状图
initGanzhuang(curv, strSlfName, strLineName);
////////////////////////////////////////
m_Value=NULL;
m_Value2=NULL;
m_Value3=NULL;
m_bTableData=0;//表格或曲线
//m_csCurveDDIR="DDIR";
//m_csCurveDANG="DANG";
//m_csCurveGrad="GRAD";
m_nTailWidth=2;
m_crTail=qRgb(0,0,0);
m_crPointFill=qRgb(0,0,0);
m_crGridSmall=qRgb(100,100,100);
m_nRadius = 6;
m_nTailLen = 10;
m_nCircleWidth=1;
m_flGrad1 = 10;
m_flGrad2 = 50;
//Table dip
m_qsTable="FRAC_HOLE.TABLE";
m_qsDIR=("DIR"); // 方位 曲线名
m_qsDIP=("DIPorS");//倾角
m_qsDepth="DEP";
m_qsID = "ID";
m_qsProperty=("ID");
m_iPrecision = 3;
//读数据
m_csCurveDDIR = "DDIR"; // 方位 曲线名
m_csCurveDANG = "DANG";//倾角
m_csCurveGrad = "GRAD";
this->ReadData(strSlfName, m_csCurveDDIR, 0, &m_Curve);
this->ReadData(strSlfName, m_csCurveDANG, 1, &m_Curve2);
this->ReadData(strSlfName, m_csCurveGrad, 2, &m_Curve3);
curv->yAxis->setTickLabels(true);
curv->yAxis->setTickLabelSide(QCPAxis::lsInside);
QFont font1("微软雅黑", 16); //fontSize 10
curv->yAxis->setTickLabelFont(font1);
//
// curv->xAxis->ticker()->setTickCount(10);//x个主刻度
// curv->yAxis->ticker()->setTickCount(60);//y个主刻度
int iMyWidth = curv->axisRect(0)->width();
float vmax = iMyWidth;
float vmin = 0;
curv->setScaleX(vmin, vmax);
curv->axisRect()->setupFullAxesBox();
//
curv->xAxis->ticker()->setTickCount(10);//x个主刻度
curv->yAxis->ticker()->setTickCount(60);//y个主刻度
//对调XY轴在最前面设置
QCPAxis *yAxis = curv->yAxis;
QCPAxis *xAxis = curv->xAxis;
curv->xAxis = yAxis;
curv->yAxis = xAxis;
m_LeftVal = 0;
m_RightVal = 90;
//隐藏刻度
curv->xAxis->setTicks(false);
curv->yAxis->setTicks(false);
curv->xAxis2->setTicks(false);
curv->yAxis2->setTicks(false);
curv->xAxis->setVisible(false);
curv->xAxis2->setVisible(false);
curv->yAxis->setVisible(false);
curv->yAxis2->setVisible(false);
//蝌蚪图
// curv->mKedou = true;
//隐藏网格
// curv->xAxis->grid()->setVisible(false);
// curv->yAxis->grid()->setVisible(false);
DrawStck(curv);
//道-对象
QString strAliasName = "杆状图";
QString strUnit = "";
QColor newlineColor=QColor(0,0,0);
double width=2;
QString strScaleType = "";
//道-对象
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "ganzhuangtuObject");
//
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
m_listLineName.push_back(strLineName);
}
void FormDraw::s_addJykt(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW)
{
//井名&道名不一致
@ -5156,6 +5063,15 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName,
//蝌蚪图
void FormDraw::initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QJsonObject listOtherProperty)
{
widget->mKedou = true;
//隐藏网格
widget->xAxis->grid()->setVisible(false);
widget->yAxis->grid()->setVisible(false);
//
widget->m_bRowGridVisible = false;
widget->m_bColGridVisible = false;
int iMyWidth = widget->axisRect(0)->width();
float vmax = iMyWidth;
float vmin = 0;
@ -5185,7 +5101,7 @@ void FormDraw::initKedou(QMyCustomPlot *widget, QString strSlfName, QString strL
widget->yAxis2->setVisible(false);
//-----------------------------------
QString strUnit = "";
QString strUnit = "(°)";
double width=2;
QString strScaleType = "";
//道-对象
@ -5193,8 +5109,59 @@ void FormDraw::initKedou(QMyCustomPlot *widget, QString strSlfName, QString strL
//蝌蚪图
widget->Draw_Kedou();
}
//杆状图
void FormDraw::initGanzhuang(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QJsonObject listOtherProperty)
{
//隐藏网格
widget->xAxis->grid()->setVisible(false);
widget->yAxis->grid()->setVisible(false);
//
widget->m_bRowGridVisible = false;
widget->m_bColGridVisible = false;
int iMyWidth = widget->axisRect(0)->width();
float vmax = iMyWidth;
float vmin = 0;
widget->setScaleX(vmin, iMyWidth);
widget->axisRect()->setupFullAxesBox();
//
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
//对调XY轴在最前面设置
QCPAxis *yAxis = widget->yAxis;
QCPAxis *xAxis = widget->xAxis;
widget->xAxis = yAxis;
widget->yAxis = xAxis;
m_LeftVal = 0;
m_RightVal = 90;
//隐藏刻度
widget->xAxis->setTicks(false);
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//-----------------------------------
QString strUnit = "(°)";
double width=2;
QString strScaleType = "";
if(!listOtherProperty.isEmpty())
{
strUnit = listOtherProperty["Unit"].toString(); // 单位
}
//道-对象
FormInfo* pInfo = m_formTrack->AddGanzhuang(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject", listOtherProperty);
//杆状图
widget->Draw_Ganzhuang();
}
void FormDraw::initWords(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty)
@ -6796,139 +6763,6 @@ void FormDraw::DrawDenv(QMyCustomPlot *widget, QString strSlfName)
}
}
void FormDraw::DrawStck(QMyCustomPlot *widget)
{
float flWidth[50];
int l;
float dep;
int m_nScaleThinGrid=10;
float lstk=2;
float dang,ddir;
float dg,dy,dx;
// 计算位置
int iMyWidth = widget->axisRect(0)->width();
float x1 = 0;
float x2 = iMyWidth;
float x=0,y=0;
int j=0,i=0,k=0;
float flTemp=0;
for(int i=0;i<50;i++) flWidth[i]=0;
CalcDipWidth(m_nScaleThinGrid, flWidth, 1.2, x1, x2, 1.);
QPen pPen(m_crTail,m_nTailWidth);
QBrush cBrushFill(m_crPointFill);
float flDepthScale,tempf,flVal;
int nPointNum=0,tempi;
QRectF rt,rtRect;
float dgtord,dr;
for(int i=0;i<50;i++) flWidth[i]=0;
if(m_Value==0 || m_Value2==0)
{
Refurbish();
}
if ( m_Value==0 || m_Value2==0 )
return ;
dgtord=3.14159265/180.;
CalcDipWidth(9, flWidth, 1.2, 0, iMyWidth, 1);
while ( 1)
{
dep = m_SDep + k * m_Rlev;
if ( dep >m_EDep )
break;
if(dep<m_SDep)
{
k++;
continue;
}
i=(dep-m_Curve2.StartDepth)/m_Curve2.DepLevel+0.5;
if(i<0)
{
k++;
continue;
}
flVal = GetData(m_Curve2.RepCode,(char *)&m_Value2[i*m_Curve2.CodeLen]);//DANG
if ( flVal > m_RightVal || flVal < m_LeftVal )
{
k++;
continue;
}
tempi = (int)( flVal /10.);
tempf = 0.;
for (j=0; j<tempi; j++)
{
tempf += flWidth[j];
}
x =160;//= tempf + (flVal-tempi*10.)*(flWidth[j+1]/10.);
y = -dep;//起始深度
// pDC->setPen(pPen);// [5/22/2019 9:43 hxb]
// rtRect.setLeft(x - GetLineWidth(pDC,m_nRadius));
// rtRect.setRight(x + GetLineWidth(pDC,m_nRadius));
// rtRect.setBottom(y +GetLineWidth(pDC,m_nRadius));
// rtRect.setTop(y -GetLineWidth(pDC,m_nRadius));
// pDC->setPen(PenCircle);
// pDC->drawEllipse(rtRect.center(),m_nRadius,m_nRadius);
// QCPItemEllipse *qcpItemEllipse = new QCPItemEllipse(widget);
// qcpItemEllipse->setPen(pPen);
// qcpItemEllipse->m_bCustom = true;
// qcpItemEllipse->m_nRadius = m_nRadius;
// qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置
// qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置
// qcpItemEllipse->setBrush(cBrushFill);//填充圆的颜色
//方位
dang = GetData(m_Curve.RepCode,(char *)&m_Value[i*m_Curve.CodeLen]);//DDIR
dr=dang*dgtord;
//dx=abs(lstk*cos(dr));
// dy=sqrt(lstk*lstk*(1-cos(dr)*cos(dr)));
// // 注意映射方式
// x +=GetLineWidth(pDC,m_nRadius)*sin(dr);
// y -=GetLineWidth(pDC,m_nRadius)*cos(dr);
// float x1=x +GetLineWidth(pDC,m_nTailLen)*sin(dr);
// float y1=y -GetLineWidth(pDC,m_nTailLen)*cos(dr);
// pDC->setPen(pPen);
// pDC->drawLine(QPointF(x,y),QPointF(x1,y1));
QCPItemLine *qcpItemLine = new QCPItemLine(widget);
qcpItemLine->start->setCoords(y, x);//圆心位置
qcpItemLine->end->setCoords(y, x);//圆心位置
qcpItemLine->setPen(pPen);
qcpItemLine->m_bCustom = true;
qcpItemLine->m_nTailLen = m_nSltk; //杆长
qcpItemLine->m_nRadius = 0; //半径
qcpItemLine->m_dr = dr;
QCPItemLine *qcpItemLine1 = new QCPItemLine(widget);
qcpItemLine1->start->setCoords(y, x);//圆心位置
qcpItemLine1->end->setCoords(y, x);//圆心位置
qcpItemLine1->setPen(pPen);
qcpItemLine1->m_bCustom = true;
qcpItemLine1->m_nTailLen = m_nSltk; //杆长
qcpItemLine1->m_nRadius = 0; //半径
qcpItemLine1->m_dr = dr+PI;
//移动对象
// widget->mSizeHandleManager->addItem(qcpItemEllipse, true);
// widget->mSizeHandleManager->addItem(qcpItemLine, true);
k++;
}
}
//read config file: FRAC.CFG,save info into m_FracDef
void FormDraw::ReadFracDef()

View File

@ -150,10 +150,12 @@ public:
//表格曲线
void initKedou(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "蝌蚪图", QColor newlineColor=QColor(0,0,0), QJsonObject listOtherProperty={});
void initGanzhuang(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "杆状图", QColor newlineColor=QColor(0,0,0), QJsonObject listOtherProperty={});
void ReadFracDef();
void ReadData(QString strSlfName, QString strLineName);//表格
void ReadData(QString strSlfName, QString strLineName, int iCurve, Slf_CURVE *curve);//曲线
void DrawStck(QMyCustomPlot *widget);
void CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio);
void Refurbish();
void DrawJykt(QMyCustomPlot *widget, QString strSlfName);
@ -255,7 +257,7 @@ public slots:
void s_handleRectRangeChange(QCPRange newRange);
void s_selectionRectAccepted(const QRect &rect, QMouseEvent *event);
void s_addGanZuangTu(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW);//杆状图
void s_addGanZhuangTu(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW);//杆状图
//井眼垮塌矢量图
void s_addJykt(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW);
//井斜方位图

View File

@ -127,8 +127,8 @@ void FormInfo::initProperty_Kedou(QJsonObject obj)
// 显示控制
this->m_pl_minInclination = 0; // 最小倾角
this->m_pl_maxInclination = 360; // 最大倾角
this->m_flGrad1 = 10; // 可信度1
this->m_flGrad2 = 50; // 可信度2
this->m_flGrad1 = 1; // 可信度1
this->m_flGrad2 = 5; // 可信度2
// 显示控制(数据表)
this->m_crack_decimal_digits = 2; // 小数位数
@ -212,6 +212,59 @@ void FormInfo::initProperty_Kedou(QJsonObject obj)
}
}
void FormInfo::initProperty_Ganzhuang(QJsonObject obj)
{
if(obj.isEmpty())
{
// 字体
// 曲线选择
this->m_pl_azimuthCurve = "DDIR"; // 方位曲线
this->m_pl_inclinationCurve = "DANG"; // 倾角曲线
this->m_pl_GradCurve = "GRAD"; // 可信度曲线
//杆
this->m_nTailLen = 15; // 尾线长度
this->m_nTailWidth = 2; // 尾线宽度
// 显示控制
this->m_pl_minInclination = 0; // 最小倾角
this->m_pl_maxInclination = 90; // 最大倾角
this->m_flGrad1 = 10; // 可信度1
this->m_flGrad2 = 50; // 可信度2
//
this->m_strUnit = "(°)";
}
else
{
QString strType = obj.value("Type").toString();
if ("tableObject" == strType)
{
// 字体
// 名称
this->m_curveNameFont.fromString(obj["curveNameFont"].toString());
// 曲线选择
this->m_pl_azimuthCurve = obj["m_pl_azimuthCurve"].toString(); // 方位曲线
this->m_pl_inclinationCurve = obj["m_pl_inclinationCurve"].toString(); // 倾角曲线
this->m_pl_GradCurve = obj["m_pl_GradCurve"].toString(); // 可信度曲线
//杆
this->m_nTailLen = obj["m_nTailLen"].toDouble(); // 尾线长度
this->m_nTailWidth = obj["m_nTailWidth"].toDouble(); // 尾线宽度
this->m_crTail.setNamedColor(obj["m_crTail"].toString());// 尾线颜色
// 显示控制
this->m_pl_minInclination = obj["m_pl_minInclination"].toDouble(); // 最小倾角
this->m_pl_maxInclination = obj["m_pl_maxInclination"].toDouble(); // 最大倾角
this->m_flGrad1 = obj["m_flGrad1"].toDouble(); // 可信度1
this->m_flGrad2 = obj["m_flGrad2"].toDouble(); // 可信度2
//
this->m_strUnit = obj["Unit"].toString(); // 单位
}
}
}
void FormInfo::initProperty(QJsonObject obj)
{
m_vmin = obj.value("vmin").toDouble();
@ -484,7 +537,6 @@ QJsonObject FormInfo::makeJson()
{
//蝌蚪图
// 字体
//rootObj["m_strAliasNameFont"] = this->m_strAliasNameFont.toString(); // 名称
rootObj["m_strUnitFont"] = this->m_strUnitFont.toString(); // 单位
rootObj["m_pl_fontScale"] = this->m_pl_fontScale.toString(); // 刻度
// 数据类型选择
@ -530,6 +582,29 @@ QJsonObject FormInfo::makeJson()
rootObj["m_pl_custom2"] = this->m_pl_custom2; // 自定义2
return rootObj;
}
else if (m_strLineName == "GANZHUANG.LINE")
{
//杆状图
// 字体
rootObj["m_strUnitFont"] = this->m_strUnitFont.toString(); // 单位
rootObj["m_pl_fontScale"] = this->m_pl_fontScale.toString(); // 刻度
// 曲线选择
rootObj["m_pl_azimuthCurve"] = this->m_pl_azimuthCurve; // 方位曲线
rootObj["m_pl_inclinationCurve"] = this->m_pl_inclinationCurve; // 倾角曲线
rootObj["m_pl_GradCurve"] = this->m_pl_GradCurve; // 可信度曲线
//杆
rootObj["m_nTailLen"] = this->m_nTailLen; // 尾线长度
rootObj["m_nTailWidth"] = this->m_nTailWidth; // 尾线宽度
rootObj["m_crTail"] = this->m_crTail.name(); // 尾线颜色
// 显示控制
rootObj["m_pl_minInclination"] = this->m_pl_minInclination; // 最小倾角
rootObj["m_pl_maxInclination"] = this->m_pl_maxInclination; // 最大倾角
rootObj["m_flGrad1"] = this->m_flGrad1; // 可信度1
rootObj["m_flGrad2"] = this->m_flGrad2; // 可信度2
//单位
rootObj["Unit"] = m_strUnit;
return rootObj;
}
}
else if (m_strType == "JiegutextObject")
{
@ -1229,6 +1304,21 @@ void FormInfo::paintEvent(QPaintEvent* event)
painter.drawText(rect.left(), rect.top()+rect.height()*2/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, QString::number(m_vmin)+" ~ "+QString::number(m_vmax));
}
//蝌蚪图、杆状图
if(m_strLineName == "FRAC_HOLE.TABLE" || m_strLineName=="GANZHUANG.LINE")
{
int nbay = rect.height() - 5;
// 显示刻度
if (m_bShowScale)
{
drawScale_Kedou(painter, rect);
}
QFontMetrics fm2(m_curveUnitFont);
QRect tRect = fm2.boundingRect(m_strUnit);
painter.drawText(rect.width()/2- tRect.width()/2, nbay - 6, m_strUnit);
}
if(m_strLineName == "深度")
{
QFont oldFont = painter.font();
@ -1575,6 +1665,28 @@ void FormInfo::drawScale(QPainter& painter, const QRect& rect)
}
}
void FormInfo::drawScale_Kedou(QPainter& painter, const QRect& rect)
{
int nbay = rect.height() - 5;
QVector<QStringList> vecScale;
vecScale << QStringList({ QString::number(m_pl_minInclination) , QString::number(m_pl_maxInclination) });
painter.setFont(m_curveScaleFont);
QFontMetrics fm1(m_curveScaleFont);
QRect textRect = fm1.boundingRect(QString::number(m_pl_minInclination, 'f', 0));
int ntxthei = textRect.height() - 4;
int nyy = nbay - ntxthei * vecScale.size() - 3;
for (int i = 0; i < vecScale.size(); i++)
{
const QStringList& slist = vecScale.at(i);
QRect textRect = fm1.boundingRect(slist.at(1));
int y = nyy + (i + 1) * ntxthei;
painter.drawText(rect.x() + 3, y, slist.at(0));
painter.drawText(rect.width() - textRect.width() - 3, y, slist.at(1));
}
}
void FormInfo::paintClassify(QPainter &painter, int compassCenterY)
{
// 绘制分类

View File

@ -27,6 +27,7 @@ public:
void initProperty(QJsonObject obj);
void initProperty_Kedou(QJsonObject obj);
void initProperty_Ganzhuang(QJsonObject obj);
void paintClassify(QPainter &painter, int compassCenterY);
private:
@ -37,6 +38,7 @@ protected:
// 绘制刻度
void drawScale(QPainter& painter, const QRect& rect);
void drawScale_Kedou(QPainter& painter, const QRect& rect);
public slots:
void dragEnterEvent(QDragEnterEvent* event);

View File

@ -347,6 +347,45 @@ FormInfo* FormTrack::AddKedou(QString strSlfName, QString strWellName, QString s
ui->tableWidget->setRowHeight(row, 100);
//
ui->tableWidget->setCellWidget(row, 0, formInfo);
return formInfo;
}
FormInfo* FormTrack::AddGanzhuang(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QString strType, QJsonObject listOtherProperty)
{
if(strLineName == "GANZHUANG.LINE")
{
}
else
{
return nullptr;
}
qDebug() << "FormTrack AddGanzhuang";
ui->tableWidget->m_strUuid = m_strUuid;
int row = ui->tableWidget->rowCount();
ui->tableWidget->setRowCount(row + 1);
//曲线信息栏
FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor);
formInfo->m_strUuid = m_strUuid;
//formInfo->m_strUnit = strUnit;
formInfo->initProperty_Ganzhuang(listOtherProperty);
formInfo->m_strAliasName = strAliasName;
formInfo->m_strScaleType = strScaleType;
formInfo->m_strType = "tableObject";
formInfo->setLineWidth(dWidth);
formInfo->setVMax(vmax);
formInfo->setVMin(vmin);
formInfo->setFrontColor(QColor(0,0,0));
formInfo->setBackColor(QColor(255,255,255));
//设置高度
ui->tableWidget->setRowHeight(row, 100);
//
ui->tableWidget->setCellWidget(row, 0, formInfo);
return formInfo;
}
FormInfo* FormTrack::setDrawDt(QStringList listdt, QJsonObject obj)

View File

@ -45,6 +45,7 @@ public:
public:
void Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QString strType, QStringList listOtherProperty={});
FormInfo* AddKedou(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QString strType, QJsonObject listOtherProperty={});
FormInfo* AddGanzhuang(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QString strType, QJsonObject listOtherProperty={});
FormInfo* setDrawDt(QStringList listdt, QJsonObject obj);

View File

@ -3667,7 +3667,7 @@ void MainWindowCurve::s_NewGanZhuangTu()
QString strSlfName = sret.at(1);
//新建道
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, strSlfName, "杆状图", "ganzhuangtuObject", nW);
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, strSlfName, "GANZHUANG.LINE", "ganzhuangtuObject", nW);
}
void MainWindowCurve::s_roseAc()

View File

@ -215,6 +215,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
connect(CallManage::getInstance(), SIGNAL(sig_changeGuanD(QString, QString, QString, QString, QString, QString, double)), this, SLOT(s_changeGuanD(QString, QString, QString, QString, QString, QString, double)));
//改变蝌蚪图属性
connect(CallManage::getInstance(), SIGNAL(sig_changeKedouProperty(QString, QString, QString, QString, QString)), this, SLOT(s_changeKedouProperty(QString, QString, QString, QString, QString)));
//改变杆状图属性
connect(CallManage::getInstance(), SIGNAL(sig_changeGanzhuangProperty(QString, QString, QString, QString, QString)), this, SLOT(s_changeGanzhuangProperty(QString, QString, QString, QString, QString)));
}
void QMyCustomPlot::initGeometry(QString strUuid, int nscale, double fW)
@ -11977,10 +11979,6 @@ void QMyCustomPlot::Draw_Kedou()
if (m_bTableData)
{
ReadFracDef_gaodaofeng();
// for (int i = 0 ; i < iFracType ; i++)
// {
// m_bTypeDraw[i] = true;
// }
ReadData(m_strSlfName, m_strLineName);
}
else
@ -12247,7 +12245,8 @@ void QMyCustomPlot::DrawDip_Kedou()
}
bool bFillBrush = true;
if ( m_Value3!=NULL)// && m_Value3 !=0xcdcdcdcd )
//可信度
if ( m_Value3!=NULL)
{
flVal = GetData(m_Curve3.RepCode,(char *)&m_Value3[i*m_Curve3.CodeLen]);//置信度
if ( flVal < m_flGrad1 )
@ -12337,3 +12336,169 @@ void QMyCustomPlot::s_changeKedouProperty(QString strUuid, QString strSlfName, Q
//绘制蝌蚪图
Draw_Kedou();
}
//改变杆状图属性
void QMyCustomPlot::s_changeGanzhuangProperty(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;
}
//绘制杆状图
Draw_Ganzhuang();
}
void QMyCustomPlot::Draw_Ganzhuang()
{
this->clearItems();
//
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
//-----------------------------------
this->m_Value=NULL;
this->m_Value2=NULL;
this->m_Value3=NULL;
// 曲线选择
this->m_csCurveDDIR = pInfo->m_pl_azimuthCurve; // 方位 曲线名
this->m_csCurveDANG = pInfo->m_pl_inclinationCurve;//倾角
this->m_csCurveGrad = pInfo->m_pl_GradCurve; // 可信度曲线
//蝌蚪符号
this->m_nTailLen = pInfo->m_nTailLen; // 尾线长度
this->m_nTailWidth = pInfo->m_nTailWidth; // 尾线宽度
this->m_crTail = pInfo->m_crTail; // 尾线颜色
// 显示控制
this->m_pl_minInclination = pInfo->m_pl_minInclination; // 最小倾角
this->m_pl_maxInclination = pInfo->m_pl_maxInclination; // 最大倾角
this->m_flGrad1 = pInfo->m_flGrad1; //可信度1
this->m_flGrad2 = pInfo->m_flGrad2; //可信度2
//读数据
this->ReadData(m_strSlfName, m_csCurveDDIR, 0, &m_Curve);
this->ReadData(m_strSlfName, m_csCurveDANG, 1, &m_Curve2);
this->ReadData(m_strSlfName, m_csCurveGrad, 2, &m_Curve3);
float flWidth[50];
int l;
float dep;
int m_nScaleThinGrid=10;
float lstk=2;
float dang,ddir;
float dg,dy,dx;
// 计算位置
int iMyWidth = this->axisRect(0)->width();
float x1 = 0;
float x2 = iMyWidth;
float x=0,y=0;
int j=0,i=0,k=0;
float flTemp=0;
for(int i=0;i<50;i++) flWidth[i]=0;
CalcDipWidth(m_nScaleThinGrid, flWidth, 1.2, x1, x2, 1.);
QPen pPenTail(m_crTail,m_nTailWidth);
float flDepthScale,tempf,flVal;
int nPointNum=0,tempi;
QRectF rt,rtRect;
float dgtord,dr;
for(int i=0;i<50;i++) flWidth[i]=0;
if(m_Value==0 || m_Value2==0)
{
Refurbish();
}
if ( m_Value==0 || m_Value2==0 )
return ;
dgtord=3.14159265/180.;
CalcDipWidth(9, flWidth, 1.2, 0, iMyWidth, 1);
while ( 1)
{
dep = m_SDep + k * m_Rlev;
if ( dep >m_EDep )
break;
if(dep<m_SDep)
{
k++;
continue;
}
i=(dep-m_Curve2.StartDepth)/m_Curve2.DepLevel+0.5;
if(i<0)
{
k++;
continue;
}
//可信度
if ( m_Value3!=NULL)
{
flVal = GetData(m_Curve3.RepCode,(char *)&m_Value3[i*m_Curve3.CodeLen]);//置信度
if ( flVal < m_flGrad1 || flVal > m_flGrad2 )
{
k++;
continue;
}
}
flVal = GetData(m_Curve2.RepCode,(char *)&m_Value2[i*m_Curve2.CodeLen]);//DANG
if ( flVal > m_pl_maxInclination || flVal < m_pl_minInclination )
{
k++;
continue;
}
tempi = (int)( flVal /10.);
tempf = 0.;
for (j=0; j<tempi; j++)
{
tempf += flWidth[j];
}
x = (x1+x2)/2.0; //160;//= tempf + (flVal-tempi*10.)*(flWidth[j+1]/10.);
y = -dep;//起始深度
//方位
dang = GetData(m_Curve.RepCode,(char *)&m_Value[i*m_Curve.CodeLen]);//DDIR
dr=dang*dgtord;
QCPItemLine *qcpItemLine = new QCPItemLine(this);
qcpItemLine->start->setCoords(y, x);//圆心位置
qcpItemLine->end->setCoords(y, x);//圆心位置
qcpItemLine->setPen(pPenTail);
qcpItemLine->m_bCustom = true;
qcpItemLine->m_nTailLen = m_nTailLen/2.0; //杆长
qcpItemLine->m_nRadius = 0; //半径
qcpItemLine->m_dr = dr;
//
QCPItemLine *qcpItemLine1 = new QCPItemLine(this);
qcpItemLine1->start->setCoords(y, x);//圆心位置
qcpItemLine1->end->setCoords(y, x);//圆心位置
qcpItemLine1->setPen(pPenTail);
qcpItemLine1->m_bCustom = true;
qcpItemLine1->m_nTailLen = m_nTailLen/2.0; //杆长
qcpItemLine1->m_nRadius = 0; //半径
qcpItemLine1->m_dr = dr+PI;
k++;
}
this->replot();
}

View File

@ -677,6 +677,9 @@ public slots:
//改变蝌蚪图属性
void s_changeKedouProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
//改变杆状图属性
void s_changeGanzhuangProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
public:
//蝌蚪图重绘网格线
bool mKedou = false;
@ -748,6 +751,9 @@ public:
void ReadFracDef_gaodaofeng();
//杆状图
void Draw_Ganzhuang();
private:
};