频率统计图 属性

This commit is contained in:
crqiqi77 2026-04-03 14:24:10 +08:00
parent f3da99fea2
commit 7d8bd3480d
7 changed files with 844 additions and 221 deletions

View File

@ -182,8 +182,11 @@ signals:
//改变深度属性
void sig_changeDepthProperty(QVariantList vlist);
//改变频率统计图属性
void sig_changePlObjectProperty(QVariantMap variantMap);
//改变岩心分析
void sig_changeCorePhysicsProperty(QVariantMap vlist);
void sig_changeCorePhysicsProperty(QVariantMap variantMap);
//右键--添加分段线
void sig_AddShiftLine(QString strUuid, double left_Low, double right_Hight);

View File

@ -4076,7 +4076,7 @@ void PropertyWidget::initPlObjectProperty(FormInfo *formInfo)
_CreateVariantPropertyItem("控制曲线", "最大值", formInfo->m_pl_controlMaxValue, QVariant::Int);
_CreateVariantPropertyItem("方位频率", "扇形", formInfo->m_pl_sectorCount, QVariant::Int);
_CreateVariantPropertyItem("方位频率", "圆半径", formInfo->m_pl_circleRadius, QVariant::Int);
_CreateVariantPropertyItem("方位频率", "圆半径(cm)", formInfo->m_pl_circleRadius, QVariant::Int);
_CreateVariantPropertyItem("方位频率", "圆线颜色", formInfo->m_pl_circleColor, QVariant::Color);
_CreateVariantPropertyItem("方位频率", "圆线宽度", formInfo->m_pl_circleLineWidth, QVariant::Int);
_CreateVariantPropertyItem("方位频率", "是否填充", formInfo->m_pl_isFillEnabled, QVariant::Bool);
@ -4117,21 +4117,35 @@ void PropertyWidget::initPlObjectProperty(FormInfo *formInfo)
void PropertyWidget::changedPlObjectProperty(QString strProperty, QVariant varVal)
{
bool flag = false;
if ("数据名称" == strProperty)
{
m_formInfo->m_strAliasName = varVal.toString();
this->m_formInfo->repaint();
}
if ("显示单位" == strProperty)
else if ("数据类型" == strProperty)
{
this->m_formInfo->m_pl_dataType = varVal.toInt();
}
else if ("显示单位" == strProperty)
{
this->m_formInfo->m_strUnit = varVal.toString();
this->m_formInfo->repaint();
}
else if ("方位曲线" == strProperty)
{
this->m_formInfo->m_pl_azimuthCurve = varVal.toString();
}
else if ("倾角曲线" == strProperty)
{
this->m_formInfo->m_pl_inclinationCurve = varVal.toString();
}
else if ("例区高度" == strProperty)
{
int temp = varVal.toInt();
this->m_formInfo->m_headHeight = temp;
this->m_formInfo->setFixedHeight(temp);
this->m_formInfo->repaint();
}
else if ("名称" == strProperty || "曲线名称" == strProperty)
{
@ -4154,38 +4168,47 @@ void PropertyWidget::changedPlObjectProperty(QString strProperty, QVariant varVa
else if ("曲线名" == strProperty)
{
this->m_formInfo->m_pl_controlCurveName = varVal.toString();
flag = true;
}
else if ("最小值" == strProperty)
{
this->m_formInfo->m_pl_controlMinValue = varVal.toDouble();
flag = true;
}
else if ("最大值" == strProperty)
{
this->m_formInfo->m_pl_controlMaxValue = varVal.toDouble();
flag = true;
}
else if ("扇形" == strProperty)
{
this->m_formInfo->m_pl_sectorCount = varVal.toInt();
flag = true;
}
else if ("圆半径(cm)" == strProperty)
{
this->m_formInfo->m_pl_circleRadius = varVal.toInt();
flag = true;
}
else if ("圆线颜色" == strProperty)
{
this->m_formInfo->m_pl_circleColor = varVal.value<QColor>();
flag = true;
}
else if ("圆线宽度" == strProperty)
{
this->m_formInfo->m_pl_circleLineWidth = varVal.toInt();
flag = true;
}
else if ("是否填充" == strProperty)
{
this->m_formInfo->m_pl_isFillEnabled = varVal.toBool();
flag = true;
}
else if ("填充颜色" == strProperty)
{
this->m_formInfo->m_pl_fillColor = varVal.value<QColor>();
flag = true;
}
else if ("线数" == strProperty)
{
@ -4291,6 +4314,28 @@ void PropertyWidget::changedPlObjectProperty(QString strProperty, QVariant varVa
{
this->m_formInfo->m_pl_custom2 = varVal.toBool();
}
if(flag)
{
QVariantMap variantMap;
variantMap["m_pl_controlCurveName"] = this->m_formInfo->m_pl_controlCurveName;
variantMap["m_pl_controlMinValue"] = this->m_formInfo->m_pl_controlMinValue;
variantMap["m_pl_controlMaxValue"] = this->m_formInfo->m_pl_controlMaxValue;
variantMap["m_pl_sectorCount"] = this->m_formInfo->m_pl_sectorCount;
variantMap["m_pl_circleRadius"] = this->m_formInfo->m_pl_circleRadius;
variantMap["m_pl_circleColor"] = this->m_formInfo->m_pl_circleColor;
variantMap["m_pl_circleLineWidth"] = this->m_formInfo->m_pl_circleLineWidth;
variantMap["m_pl_isFillEnabled"] = this->m_formInfo->m_pl_isFillEnabled;
variantMap["m_pl_fillColor"] = this->m_formInfo->m_pl_fillColor;
emit CallManage::getInstance()->sig_changePlObjectProperty(variantMap);
}
}
void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal)

View File

@ -189,13 +189,12 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo)
initDepth(curv);
// 在s_addDepth方法设置单位无效
// 读json
// 读json后 重新设置样式
// 设置左侧显示属性 设置界面样式
if(pInfo->m_strUnit.isEmpty()){
pInfo->m_strUnit = "(米)";
pInfo->m_strUnitFont = QFont("微软雅黑", 8);
}
// 读json后 重新设置样式
// 头部高度
pInfo->setFixedHeight(pInfo->m_headHeight);
// 标尺颜色
@ -310,14 +309,84 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo)
curv->yAxis->setSubTickPen(tickPen);
}
}
else if("plObject" == strType)
else if("plObject" == strType) // 频率统计图
{
initFgrq(curv);
// 读json后 重新设置样式
// 设置左侧显示属性 设置界面样式
if(pInfo->m_strUnit.isEmpty()){
pInfo->m_strUnit = "(°)";
pInfo->m_strUnitFont = QFont("微软雅黑", 8);
}
// 例区高度
pInfo->setFixedHeight(pInfo->m_headHeight);
initFgrq(curv);
// // 数据
// int m_pl_dataType = 0; // 数据类型
// QString m_pl_azimuthCurve = "DDIR"; // 方位曲线
// QString m_pl_inclinationCurve = "DANG"; // 倾角曲线
// // 字体相关配置
// QFont m_pl_fontScale = QFont("微软雅黑", 7); // 刻度字体大小
// // 控制曲线参数
// QString m_pl_controlCurveName = "GRAD"; // 控制曲线名
// double m_pl_controlMinValue = 0; // 控制最小值
// double m_pl_controlMaxValue = 100; // 控制最大值
// // 方位频率绘图参数
// int m_pl_sectorCount = 36; // 扇形数量
// double m_pl_circleRadius = 1; // 圆半径(cm)
// QColor m_pl_circleColor = Qt::black; // 圆线颜色
// int m_pl_circleLineWidth = 2; // 圆线宽度
// bool m_pl_isFillEnabled = true; // 是否启用填充
// QColor m_pl_fillColor = Qt::black; // 填充颜色
// // 倾角频率绘图参数
// int m_pl_lineNumber = 9; // 线数
// double m_pl_lineHeight = 2; // 统计线高度
// int m_pl_lineThickness = 2; // 线粗细
// QColor m_pl_lineColor = Qt::black; // 线颜色
// bool m_pl_drawAnnotation = true; // 是否绘制标注
// bool m_pl_drawHistogram = true; // 是否绘制直方图
// // 基线参数
// int m_pl_baselineWidth = 2; // 基线宽度
// QColor m_pl_baselineColor = Qt::black; // 基线颜色
// // 统计参数
// int m_pl_statInterval = 20; // 统计间隔
// double m_pl_minInclination = 0; // 最小倾角
// double m_pl_maxInclination = 90; // 最大倾角
// // 地质要素分类开关
// bool m_pl_highGap = false; // 高导缝
// bool m_pl_highReservoir = false; // 高阻缝
// bool m_pl_reticularFracture = false; // 网状缝
// bool m_pl_inducedFracture = false; // 诱导缝
// bool m_pl_bedLayer = false; // 层理
// bool m_pl_erosionSurface = false; // 侵蚀面
// bool m_pl_pore = false; // 孔洞
// bool m_pl_vesicle = false; // 气孔
// bool m_pl_gravel = false; // 砾石
// bool m_pl_nodule = false; // 结核
// bool m_pl_lumps = false; // 团块
// bool m_pl_fault = false; // 断层
// bool m_pl_verticalFracture = false; // 垂直缝
// bool m_pl_custom1 = false; // 自定义1
// bool m_pl_custom2 = false; // 自定义2
double m_LeftVal3 = pInfo->m_pl_controlMinValue;
double m_RightVal3 = pInfo->m_pl_controlMaxValue;
QString csCurveGrad = "GRAD";
double LeftVal3 = 0;
double RightVal3 = 100;
int nArc = 36;
double nR = 50;
QColor crArc = Qt::black;
int nArcLineWidth = 1;
bool bFill = true;
QColor crFill = Qt::black;
curv->fgrqDraw(csCurveGrad, LeftVal3, RightVal3, nArc, nR, crArc, nArcLineWidth, bFill, crFill);
}
else if("roseObject" == strType)
{
@ -476,7 +545,7 @@ void FormDraw::DisplayLines(QJsonArray linesArray)
}
else if (strType == "plObject")
{
// 斜井三图一表属性
// 频率统计图
displayPlObject(lineObjInfo);
}
else
@ -491,7 +560,17 @@ void FormDraw::DisplayLines(QJsonArray linesArray)
void FormDraw::displayPlObject(QJsonObject objInfo)
{
QString strType = objInfo.value("Type").toString();
QString strLineName = objInfo.value("LineName").toString();
QStringList dt;
dt << m_strUuid;
dt << m_strWellName;
dt << m_strSlfName;
dt << strLineName;
dt << strType;
dt << QString::number(m_nTrackW);
this->setDrawData(dt, objInfo);
}
// 深度
@ -5929,255 +6008,251 @@ void FormDraw::initFgrq(QMyCustomPlot *widget)
QCPAxis *xAxis = widget->xAxis;
widget->xAxis = yAxis;
widget->yAxis = xAxis;
this->fgrqDraw(widget);
}
void FormDraw::fgrqDraw(QMyCustomPlot *widget)
void FormDraw::fgrqDraw(QMyCustomPlot *widget, double m_LeftVal3, double m_RightVal3)
{
// widget->clearGraphs();
// widget->clearItems();
// if(m_Value == NULL)
{
m_bTableData = false; // 表格 曲线
m_csCurveDDIR = "DDIR"; // 方位 曲线名
m_csCurveDANG = "DANG";//倾角
m_csCurveGrad = "GRAD";
// // if(m_Value == NULL)
// {
// m_bTableData = false; // 表格 曲线
// m_csCurveDDIR = "DDIR"; // 方位 曲线名
// m_csCurveDANG = "DANG";//倾角
// m_csCurveGrad = "GRAD";
m_qsTable="FRAC_HOLE.TABLE";
m_qsDIR=("DDIR"); // 方位 曲线名
m_qsDIP=("DANG");//倾角
m_qsDepth="DEPT";
m_qsID = "ID";
// m_qsTable="FRAC_HOLE.TABLE";
// m_qsDIR=("DDIR"); // 方位 曲线名
// m_qsDIP=("DANG");//倾角
// m_qsDepth="DEPT";
// m_qsID = "ID";
Refurbish();
}
// Refurbish();
// }
double nR = 50;
// double nR = 50;
QPen wPen(Qt::black, 2);
double centerX = widget->m_iX2/2;
// QPen wPen(Qt::black, 2);
// double centerX = widget->m_iX2/2;
float flVal = 0.0f;
float x,y,x1,y1,x2,y2;
float ifdir[360];
int m_nArc = 36;
float m_LeftVal3 = 0;
float m_RightVal3 = 100.0;
m_LeftVal = 0.0f;
m_RightVal = 90.0f;
float mind=min(m_RightVal , m_LeftVal);
float maxd=max(m_RightVal , m_LeftVal);
float dirmax,dipmax,dr;
// float flVal = 0.0f;
// float x,y,x1,y1,x2,y2;
// float ifdir[360];
// int m_nArc = 36;
// m_LeftVal = 0.0f;
// m_RightVal = 90.0f;
// float mind=min(m_RightVal , m_LeftVal);
// float maxd=max(m_RightVal , m_LeftVal);
// float dirmax,dipmax,dr;
float deps;
// float deps;
float ftmpSdep = m_SDep;
float ftmpEdep = m_EDep;
if (m_bTableData)
{
ReadFracDef();
for (int i = 0 ; i < iFracType ; i++)
{
m_bTypeDraw[i] = true;
}
// float ftmpSdep = m_SDep;
// float ftmpEdep = m_EDep;
// if (m_bTableData)
// {
// ReadFracDef();
// for (int i = 0 ; i < iFracType ; i++)
// {
// m_bTypeDraw[i] = true;
// }
ftmpSdep = -m_iY2;
ftmpEdep = -m_iY1;
}
// ftmpSdep = -m_iY2;
// ftmpEdep = -m_iY1;
// }
int nPointNum = m_FracTabList.count();
int n = m_FracDefList.count();
int nstep = 5;
int tmp = ftmpSdep / nstep;
float flDep = tmp * nstep;
// int nPointNum = m_FracTabList.count();
// int n = m_FracDefList.count();
// int nstep = 5;
// int tmp = ftmpSdep / nstep;
// float flDep = tmp * nstep;
m_Curve.DepLevel = 0.5;
while ( 1)
{
if((flDep>=ftmpEdep+nstep)||flDep>=ftmpEdep)break;
// m_Curve.DepLevel = 0.5;
// while ( 1)
// {
// if((flDep>=ftmpEdep+nstep)||flDep>=ftmpEdep)break;
double tempf = flDep+(float)(nstep)/2.;
double centerY = tempf * -1.0;
// double tempf = flDep+(float)(nstep)/2.;
// double centerY = tempf * -1.0;
QCPItemEllipse* pEse = new QCPItemEllipse(widget);
pEse->setPen(wPen);
pEse->m_bCustom = true;
pEse->m_nRadius = nR;
pEse->topLeft->setCoords(centerY, centerX);
pEse->bottomRight->setCoords(centerY, centerX);
// QCPItemEllipse* pEse = new QCPItemEllipse(widget);
// pEse->setPen(wPen);
// pEse->m_bCustom = true;
// pEse->m_nRadius = nR;
// pEse->topLeft->setCoords(centerY, centerX);
// pEse->bottomRight->setCoords(centerY, centerX);
for(int k = 0; k < 4; k++)
{
QCPItemLine* pLine1 = new QCPItemLine(widget);
pLine1->m_bCustom = true;
pLine1->m_dr = qDegreesToRadians(k*90.0);
pLine1->m_nRadius = 0;
pLine1->m_nTailLen=nR;
pLine1->setPen(wPen);
pLine1->start->setCoords(centerY,centerX);
pLine1->end->setCoords(centerY,centerX);
}
// for(int k = 0; k < 4; k++)
// {
// QCPItemLine* pLine1 = new QCPItemLine(widget);
// pLine1->m_bCustom = true;
// pLine1->m_dr = qDegreesToRadians(k*90.0);
// pLine1->m_nRadius = 0;
// pLine1->m_nTailLen=nR;
// pLine1->setPen(wPen);
// pLine1->start->setCoords(centerY,centerX);
// pLine1->end->setCoords(centerY,centerX);
// }
for(int i=0;i<=m_nArc;i++) ifdir[i]=0.;
x1 = 360./m_nArc;
// for(int i=0;i<=m_nArc;i++) ifdir[i]=0.;
// x1 = 360./m_nArc;
int i = 0;
if (m_bTableData)
{
int m_nLine = 9;
y1 = (maxd-mind)/m_nLine;//线数
for (i=0; i<nPointNum; i++)
{
const FRAC_TABLE& frac = m_FracTabList.at(i);
if ( frac.DEP < 0 ) continue;
bool bDraw = false;
for (int j=0; j<n; j++)
{
const FRAC_DEF& fd = m_FracDefList.at(j);
if ( (int)(frac.ID) == fd.iCode )
{
bDraw = m_bTypeDraw[j];//fd.bDraw;
break;
}
}
if ( !bDraw ) continue;
// int i = 0;
// if (m_bTableData)
// {
// int m_nLine = 9;
// y1 = (maxd-mind)/m_nLine;//线数
// for (i=0; i<nPointNum; i++)
// {
// const FRAC_TABLE& frac = m_FracTabList.at(i);
// if ( frac.DEP < 0 ) continue;
// bool bDraw = false;
// for (int j=0; j<n; j++)
// {
// const FRAC_DEF& fd = m_FracDefList.at(j);
// if ( (int)(frac.ID) == fd.iCode )
// {
// bDraw = m_bTypeDraw[j];//fd.bDraw;
// break;
// }
// }
// if ( !bDraw ) continue;
deps =frac.DEP;
// deps =frac.DEP;
if ( deps >= flDep &&deps < (flDep+ nstep) )
{
flVal = frac.DIR;//方位
int j = flVal/x1;
if ( j >= 0 && j< m_nArc+1 )
ifdir[j] ++;
// if ( deps >= flDep &&deps < (flDep+ nstep) )
// {
// flVal = frac.DIR;//方位
// int j = flVal/x1;
// if ( j >= 0 && j< m_nArc+1 )
// ifdir[j] ++;
flVal = frac.DIPorS;//倾角
//按倾角范围统计
if(flVal> maxd || flVal < mind)
{
//i++;
continue;
}
// j = (flVal-mind)/y1;//j = flVal/y1+1;
// if ( j >= 0 && j< m_nLine+1 )
// ifdir[j] ++;
}
}
}
else
{
while ( 1 )
{
deps = flDep + i * m_Curve.DepLevel;
// flVal = frac.DIPorS;//倾角
// //按倾角范围统计
// if(flVal> maxd || flVal < mind)
// {
// //i++;
// continue;
// }
// // j = (flVal-mind)/y1;//j = flVal/y1+1;
// // if ( j >= 0 && j< m_nLine+1 )
// // ifdir[j] ++;
// }
// }
// }
// else
// {
// while ( 1 )
// {
// deps = flDep + i * m_Curve.DepLevel;
tempf = (deps-m_Curve.StartDepth)/m_Curve.DepLevel+0.5;
if (deps >= ftmpEdep||
deps > m_Curve.EndDepth||
deps >=( flDep + nstep))
break;
if(tempf<0)
{
i++;
continue;
}
// tempf = (deps-m_Curve.StartDepth)/m_Curve.DepLevel+0.5;
// if (deps >= ftmpEdep||
// deps > m_Curve.EndDepth||
// deps >=( flDep + nstep))
// break;
// if(tempf<0)
// {
// i++;
// continue;
// }
if (m_Value3 !=NULL )// for 控制曲线
{
float tempf3 = (deps-m_Curve3.StartDepth)/m_Curve3.DepLevel+0.5;
if(tempf3<0)
{
i++;
continue;
}
double grad = GetData(m_Curve3.RepCode,(char *)&m_Value3[(int)(tempf3)*m_Curve3.CodeLen]);
if(grad<m_LeftVal3||grad>m_RightVal3){i++;continue;}
}
// if (m_Value3 !=NULL )// for 控制曲线
// {
// float tempf3 = (deps-m_Curve3.StartDepth)/m_Curve3.DepLevel+0.5;
// if(tempf3<0)
// {
// i++;
// continue;
// }
// double grad = GetData(m_Curve3.RepCode,(char *)&m_Value3[(int)(tempf3)*m_Curve3.CodeLen]);
// if(grad<m_LeftVal3||grad>m_RightVal3){i++;continue;}
// }
flVal = GetData(m_Curve.RepCode,(char *)&m_Value[(int)(tempf)*m_Curve.CodeLen]);
flVal=fmod(flVal,360.f);
int j = flVal/x1;
if ( j >= 0 && j< m_nArc+1 )
ifdir[j] ++;
// flVal = GetData(m_Curve.RepCode,(char *)&m_Value[(int)(tempf)*m_Curve.CodeLen]);
// flVal=fmod(flVal,360.f);
// int j = flVal/x1;
// if ( j >= 0 && j< m_nArc+1 )
// ifdir[j] ++;
tempf = (deps-m_Curve2.StartDepth)/m_Curve2.DepLevel+0.5;
if(tempf<0 )
{
i++;
continue;
}
// tempf = (deps-m_Curve2.StartDepth)/m_Curve2.DepLevel+0.5;
// if(tempf<0 )
// {
// i++;
// continue;
// }
//按倾角范围统计
if(flVal> maxd || flVal < mind)
{
i++;
continue;
}
i ++;
}
}
// //按倾角范围统计
// if(flVal> maxd || flVal < mind)
// {
// i++;
// continue;
// }
// i ++;
// }
// }
flVal = 3.1415926535 *2./ m_nArc ;
dirmax=0; dipmax=0;
for(i=0;i<=m_nArc;i++)
if (dirmax<ifdir[i]) dirmax=ifdir[i];
// flVal = 3.1415926535 *2./ m_nArc ;
// dirmax=0; dipmax=0;
// for(i=0;i<=m_nArc;i++)
// if (dirmax<ifdir[i]) dirmax=ifdir[i];
if (dirmax == 0 )
dirmax=1;
for(i=0;i<=m_nArc;i++)
ifdir[i]=ifdir[i]*(nR)/dirmax;//-m_nArcLineWidth/2.whp add 2016.10.21 for线粗时扇叶超界
// ifdir[i]=ifdir[i]*(nRadius-GetLineWidth(pDC,m_nArcLineWidth/2.))/dirmax;//-m_nArcLineWidth/2.whp add 2016.10.21 for线粗时扇叶超界
ifdir[m_nArc+1]=ifdir[1];
// if (dirmax == 0 )
// dirmax=1;
// for(i=0;i<=m_nArc;i++)
// ifdir[i]=ifdir[i]*(nR)/dirmax;//-m_nArcLineWidth/2.whp add 2016.10.21 for线粗时扇叶超界
// // ifdir[i]=ifdir[i]*(nRadius-GetLineWidth(pDC,m_nArcLineWidth/2.))/dirmax;//-m_nArcLineWidth/2.whp add 2016.10.21 for线粗时扇叶超界
// ifdir[m_nArc+1]=ifdir[1];
//方位频率
float x0,y0;
// //方位频率
// float x0,y0;
x = centerY;
y = centerX;
for(int i=0;i<=m_nArc;i++)
{
if(ifdir[i] <= 0.0f)
continue;
QCPItemPolygon* pol = new QCPItemPolygon(widget);
pol->topLeft->setCoords(x, y);
pol->bottomRight->setCoords(x, y);
// x = centerY;
// y = centerX;
// for(int i=0;i<=m_nArc;i++)
// {
// if(ifdir[i] <= 0.0f)
// continue;
// QCPItemPolygon* pol = new QCPItemPolygon(widget);
// pol->topLeft->setCoords(x, y);
// pol->bottomRight->setCoords(x, y);
// pol->setPloyVal(i,flVal, ifdir[i]);
// // pol->setPloyVal(i,flVal, ifdir[i]);
float dr=i*flVal;
float x1 = ifdir[i]*sin(dr);
float y1 = ifdir[i]*cos(dr);
dr=(i+1)*flVal;
float x2 = ifdir[i]*sin(dr);
float y2 = ifdir[i]*cos(dr);
// float dr=i*flVal;
// float x1 = ifdir[i]*sin(dr);
// float y1 = ifdir[i]*cos(dr);
// dr=(i+1)*flVal;
// float x2 = ifdir[i]*sin(dr);
// float y2 = ifdir[i]*cos(dr);
QPolygonF myPolygon;
myPolygon << QPointF(0, 0);
myPolygon << QPointF(x1, y1);
myPolygon << QPointF(x2, y2);
myPolygon << QPointF(0, 0);
pol->setPoints(myPolygon);
// QPolygonF myPolygon;
// myPolygon << QPointF(0, 0);
// myPolygon << QPointF(x1, y1);
// myPolygon << QPointF(x2, y2);
// myPolygon << QPointF(0, 0);
// pol->setPoints(myPolygon);
// QCPItemRect* prt = new QCPItemRect(widget);
// prt->topLeft->setCoords(x, y);
// prt->bottomRight->setCoords(x, y);
// // QCPItemRect* prt = new QCPItemRect(widget);
// // prt->topLeft->setCoords(x, y);
// // prt->bottomRight->setCoords(x, y);
// if(m_bFill)
// {
// QPainterPath myPath;
// myPath.addPolygon(myPolygon);
// pDC->fillPath(myPath,textBrushFill);
// }
// if(m_nArcLineWidth>=1)
// {
// pDC->setPen(pPenArc);
// // pDC->drawPolygon(myPolygon);
// }
}
// // if(m_bFill)
// // {
// // QPainterPath myPath;
// // myPath.addPolygon(myPolygon);
// // pDC->fillPath(myPath,textBrushFill);
// // }
// // if(m_nArcLineWidth>=1)
// // {
// // pDC->setPen(pPenArc);
// // // pDC->drawPolygon(myPolygon);
// // }
// }
flDep += nstep;
}
// flDep += nstep;
// }
}

View File

@ -238,7 +238,7 @@ public:
//频率统计图
void initFgrq(QMyCustomPlot *widget);
void fgrqDraw(QMyCustomPlot *widget);
void fgrqDraw(QMyCustomPlot *widget, double m_LeftVal3, double m_RightVal3);
//玫瑰图
void initRose(QMyCustomPlot *widget);
void addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, const QPointF& p1, const QPointF& p2, const QPen& wPen);

View File

@ -254,7 +254,7 @@ public:
double m_pl_controlMaxValue = 100; // 控制最大值
// 方位频率绘图参数
int m_pl_sectorCount = 36; // 扇形数量
double m_pl_circleRadius = 1; // 圆半径(cm)
double m_pl_circleRadius = 50; // 圆半径(cm)
QColor m_pl_circleColor = Qt::black; // 圆线颜色
int m_pl_circleLineWidth = 2; // 圆线宽度
bool m_pl_isFillEnabled = true; // 是否启用填充

View File

@ -142,6 +142,9 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
// 深度属性修改
connect(CallManage::getInstance(), SIGNAL(sig_changeDepthProperty(QVariantList)), this, SLOT(s_changeDepthProperty(QVariantList)));
// 深度属性修改
connect(CallManage::getInstance(), SIGNAL(sig_changePlObjectProperty(QVariantMap)), this, SLOT(s_changePlObjectProperty(QVariantMap)));
connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList)));
// 岩心分析
connect(CallManage::getInstance(), SIGNAL(sig_changeCorePhysicsProperty(QVariantMap)), this, SLOT(s_changeCorePhysicsProperty(QVariantMap)));
@ -10019,3 +10022,454 @@ void QMyCustomPlot::resetPosition()
//刷新
replot();
}
void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap)
{
QString csCurveGrad = variantMap["m_pl_controlCurveName"].toString();
double LeftVal3 = variantMap["m_pl_controlMinValue"].toDouble();
double RightVal3 = variantMap["m_pl_controlMaxValue"].toDouble();
int nArc = variantMap["m_pl_sectorCount"].toInt();
double nR = variantMap["m_pl_circleRadius"].toDouble();
QColor crArc = variantMap["m_pl_circleColor"].value<QColor>();
int nArcLineWidth = variantMap["m_pl_circleLineWidth"].toInt();
bool bFill = variantMap["m_pl_isFillEnabled"].toBool();
QColor crFill = variantMap["m_pl_fillColor"].value<QColor>();
this->fgrqDraw(csCurveGrad, LeftVal3, RightVal3, nArc, nR, crArc, nArcLineWidth, bFill, crFill);
}
void QMyCustomPlot::fgrqDraw(QString csCurveGrad, double LeftVal3, double RightVal3, int nArc,
double nR, QColor crArc, int nArcLineWidth, bool bFill, QColor crFill)
{
this->clearGraphs();
this->clearItems();
// if(m_Value == NULL)
{
m_bTableData = false; // 表格 曲线
m_csCurveDDIR = "DDIR"; // 方位 曲线名
m_csCurveDANG = "DANG";//倾角
this->m_csCurveGrad = csCurveGrad;
m_qsTable="FRAC_HOLE.TABLE";
m_qsDIR=("DDIR"); // 方位 曲线名
m_qsDIP=("DANG");//倾角
m_qsDepth="DEPT";
m_qsID = "ID";
Refurbish();
}
// double nR = 50;
QPen wPen(crArc, nArcLineWidth);
double centerX = this->m_iX2/2;
float flVal = 0.0f;
float x,y,x1,y1,x2,y2;
float ifdir[360];
float m_LeftVal = 0.0f;
float m_RightVal = 90.0f;
float mind=min(m_RightVal , m_LeftVal);
float maxd=max(m_RightVal , m_LeftVal);
float dirmax,dipmax,dr;
float deps;
float ftmpSdep = m_SDep;
float ftmpEdep = m_EDep;
if (m_bTableData)
{
// ReadFracDef();
for (int i = 0 ; i < iFracType ; i++)
{
m_bTypeDraw[i] = true;
}
ftmpSdep = -m_iY2;
ftmpEdep = -m_iY1;
}
int nPointNum = m_FracTabList.count();
int n = m_FracDefList.count();
int nstep = 5;
int tmp = ftmpSdep / nstep;
float flDep = tmp * nstep;
m_Curve.DepLevel = 0.5;
while ( 1)
{
if((flDep>=ftmpEdep+nstep)||flDep>=ftmpEdep)break;
double tempf = flDep+(float)(nstep)/2.;
double centerY = tempf * -1.0;
// 圆
QCPItemEllipse* pEse = new QCPItemEllipse(this);
pEse->setPen(wPen);
pEse->m_bCustom = true;
pEse->m_nRadius = nR;
pEse->topLeft->setCoords(centerY, centerX);
pEse->bottomRight->setCoords(centerY, centerX);
for(int k = 0; k < 4; k++)
{
// 圆里面的十字
QCPItemLine* pLine1 = new QCPItemLine(this);
pLine1->m_bCustom = true;
pLine1->m_dr = qDegreesToRadians(k*90.0);
pLine1->m_nRadius = 0;
pLine1->m_nTailLen=nR;
pLine1->setPen(wPen);
pLine1->start->setCoords(centerY,centerX);
pLine1->end->setCoords(centerY,centerX);
}
for(int i=0;i<=nArc;i++) ifdir[i]=0.;
x1 = 360./nArc;
int i = 0;
if (m_bTableData)
{
int m_nLine = 9;
y1 = (maxd-mind)/m_nLine;//线数
for (i=0; i<nPointNum; i++)
{
const FRAC_TABLE& frac = m_FracTabList.at(i);
if ( frac.DEP < 0 ) continue;
bool bDraw = false;
for (int j=0; j<n; j++)
{
const FRAC_DEF& fd = m_FracDefList.at(j);
if ( (int)(frac.ID) == fd.iCode )
{
bDraw = m_bTypeDraw[j];//fd.bDraw;
break;
}
}
if ( !bDraw ) continue;
deps =frac.DEP;
if ( deps >= flDep &&deps < (flDep+ nstep) )
{
flVal = frac.DIR;//方位
int j = flVal/x1;
if ( j >= 0 && j< nArc+1 )
ifdir[j] ++;
flVal = frac.DIPorS;//倾角
//按倾角范围统计
if(flVal> maxd || flVal < mind)
{
//i++;
continue;
}
// j = (flVal-mind)/y1;//j = flVal/y1+1;
// if ( j >= 0 && j< m_nLine+1 )
// ifdir[j] ++;
}
}
}
else
{
while ( 1 )
{
deps = flDep + i * m_Curve.DepLevel;
tempf = (deps-m_Curve.StartDepth)/m_Curve.DepLevel+0.5;
if (deps >= ftmpEdep||
deps > m_Curve.EndDepth||
deps >=( flDep + nstep))
break;
if(tempf<0)
{
i++;
continue;
}
if (m_Value3 !=NULL )// for 控制曲线
{
float tempf3 = (deps-m_Curve3.StartDepth)/m_Curve3.DepLevel+0.5;
if(tempf3<0)
{
i++;
continue;
}
double grad = GetData(m_Curve3.RepCode,(char *)&m_Value3[(int)(tempf3)*m_Curve3.CodeLen]);
if(grad<LeftVal3||grad>RightVal3){i++;continue;}
}
flVal = GetData(m_Curve.RepCode,(char *)&m_Value[(int)(tempf)*m_Curve.CodeLen]);
flVal=fmod(flVal,360.f);
int j = flVal/x1;
if ( j >= 0 && j< nArc+1 )
ifdir[j] ++;
tempf = (deps-m_Curve2.StartDepth)/m_Curve2.DepLevel+0.5;
if(tempf<0 )
{
i++;
continue;
}
//按倾角范围统计
if(flVal> maxd || flVal < mind)
{
i++;
continue;
}
i ++;
}
}
flVal = 3.1415926535 *2./ nArc ;
dirmax=0; dipmax=0;
for(i=0;i<=nArc;i++)
if (dirmax<ifdir[i]) dirmax=ifdir[i];
if (dirmax == 0 )
dirmax=1;
for(i=0;i<=nArc;i++)
ifdir[i]=ifdir[i]*(nR)/dirmax;//-m_nArcLineWidth/2.whp add 2016.10.21 for线粗时扇叶超界
// ifdir[i]=ifdir[i]*(nRadius-GetLineWidth(pDC,m_nArcLineWidth/2.))/dirmax;//-m_nArcLineWidth/2.whp add 2016.10.21 for线粗时扇叶超界
ifdir[nArc+1]=ifdir[1];
//方位频率
float x0,y0;
x = centerY;
y = centerX;
for(int i=0;i<=nArc;i++)
{
if(ifdir[i] <= 0.0f)
continue;
if(bFill)
{
// 圆里面的折线
QCPItemPolygon* pol = new QCPItemPolygon(this);
pol->topLeft->setCoords(x , y );
pol->bottomRight->setCoords(x , y );
pol->setBrushColor(crFill);
// pol->setPloyVal(i,flVal, ifdir[i]);
float dr=i*flVal;
float x1 = ifdir[i]*sin(dr);
float y1 = ifdir[i]*cos(dr);
dr=(i+1)*flVal;
float x2 = ifdir[i]*sin(dr);
float y2 = ifdir[i]*cos(dr);
QPolygonF myPolygon;
myPolygon << QPointF(0, 0);
myPolygon << QPointF(x1, y1);
myPolygon << QPointF(x2, y2);
myPolygon << QPointF(0, 0);
pol->setPoints(myPolygon);
}
// QCPItemRect* prt = new QCPItemRect(this);
// prt->topLeft->setCoords(x, y);
// prt->bottomRight->setCoords(x, y);
}
flDep += nstep;
}
this->drawDipAngle(0, 0);
this->replot();
}
void QMyCustomPlot::drawDipAngle(double centerX, double centerY)
{
// 2. 开启 QCustomPlot 的绘制层
this->setBackground(Qt::white);
this->axisRect()->setBackground(Qt::white);
// 3. 获取绘制对象(关键!直接拿到 painter
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
// 4. 获取绘制区域
QRect drawRect = this->axisRect()->rect();
// 5. 画测试线:左上角 → 右下角(红色粗线,看得清)
QPen pen(Qt::red);
pen.setWidth(2);
painter.setPen(pen);
painter.drawLine(drawRect.topLeft(), drawRect.bottomRight());
// 6. 标记文字
painter.setPen(Qt::black);
painter.drawText(drawRect, Qt::AlignTop|Qt::AlignLeft, "左上角");
painter.drawText(drawRect, Qt::AlignBottom|Qt::AlignRight, "右下角");
// // 拿到 QCustomPlot 的画布区域
// QRect rect = this->axisRect()->rect(); // 绘制区域(和你原来的 rect 一致)
//// rect.getRect();
// // 你原来的所有坐标逻辑 1:1 保留
// int baseY = rect.top() + rect.height() * 2 / 3;
// int textH = rect.height() / 3;
// int lineY = baseY + textH - 7;
// int x1 = rect.left() + 20;
// int x2 = rect.right() - 30;
// // 开始在 QCustomPlot 上绘制
// QPainter painter(this);
// painter.setRenderHint(QPainter::Antialiasing);
// // 1. 画底部刻度主线(完全不变)
// painter.drawLine(0, 0, 100, 100);
// // 2. 字体
//// QFont oldFont = painter.font();
//// painter.setFont(m_cp_curveScale);
// // 3. 你的参数(完全不变)
// int minVal = 0;
// int maxVal = 100;
//// if(m_cp_scaleDivisionsOrCustom <= 0)
//// m_cp_scaleDivisionsOrCustom = 1;
// int tickCount = 9 + 1;
// int tickHeight = 6;
// int textOffsetUp = 18;
// // 4. 计算步长(完全不变)
// double step = (maxVal - minVal) * 1.0 / (tickCount - 1);
// // 5. 循环画刻度 + 文字(完全不变)
// for (int i = 0; i < tickCount; ++i) {
// int val = minVal + qRound(step * i);
// qreal ratio = (val - minVal) * 1.0 / (maxVal - minVal);
// int tickX = x1 + ratio * (x2 - x1);
// // 画小刻度
// painter.drawLine(tickX, lineY, tickX, lineY - tickHeight);
// // 画文字(位置完全一样)
// painter.drawText(
// tickX - 12,
// lineY - tickHeight - textOffsetUp,
// 24, 14,
// Qt::AlignCenter,
// QString::number(val)
// );
// }
// painter.setFont(oldFont);
}
void QMyCustomPlot::Refurbish()
{
if (m_bTableData)
{
// ReadData(m_strSlfName, "");
}
else
{
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);
}
}
//曲线
//read curve
void QMyCustomPlot::ReadData(QString strSlfName, QString strLineName, int iCurve, Slf_CURVE *curve)
{
//
if(strSlfName.isEmpty())
{
return;
}
// 读曲线数值
CMemRdWt mrw;
m_PointNum = 0 ;
if ( iCurve== 0 )
{
if(m_Value) delete []m_Value;
m_Value = 0;
}
if ( iCurve== 1 )
{
if(m_Value2) delete []m_Value2;
m_Value2 = 0;
}
if ( iCurve== 2 )
{
if(m_Value3) delete []m_Value3;
m_Value3 = 0;
}
DWORD byte;
//CString wellname(sFilePath);
if ( mrw.Open(strSlfName.toStdString().c_str()) ) // 打开井文件
{
int iIndex=mrw.OpenCurve(strLineName.toStdString().c_str());
if (iIndex >= 0)
{
mrw.GetCurveInfo(iIndex,curve);
if(curve->DepLevel==0) return;
m_PointNum = (float)(fabs((curve->EndDepth - curve->StartDepth)/curve->DepLevel+0.5));
m_SDep=curve->StartDepth;
m_EDep=curve->EndDepth;
m_Rlev=curve->DepLevel;
if ( iCurve== 0 )
{
m_Value=new char[m_PointNum*curve->CodeLen+4];
if(m_Value)
{
byte = mrw.ReadCurve(iIndex,m_SDep,m_PointNum,(void *)m_Value);
}
}
else
{
if ( iCurve == 1 )
{
m_Value2=new char[m_PointNum*curve->CodeLen+4];
if(m_Value2){
byte = mrw.ReadCurve(iIndex,m_SDep,m_PointNum,(void *)m_Value2);
}
}
else
{
m_Value3=new char[m_PointNum*curve->CodeLen+4];
if(m_Value3){
byte = mrw.ReadCurve(iIndex,m_SDep,m_PointNum,(void *)m_Value3);
}
}
}
mrw.CloseCurve(iIndex);
}
mrw.Close(); //关闭井文件
}
}

View File

@ -552,8 +552,11 @@ public slots:
// 深度
void s_changeDepthProperty(QVariantList vlist);
// 频率统计图
void s_changePlObjectProperty(QVariantMap variantMap);
// 岩心分析
void s_changeCorePhysicsProperty(QVariantMap vlist);
void s_changeCorePhysicsProperty(QVariantMap variantMap);
void onAddRect();
@ -600,6 +603,49 @@ public:
virtual void contextMenuEvent(QContextMenuEvent *event);
typedef struct FRACTABLE
{
float DEP; //深度
float AorX;
float XETAorH;
float W;
float DIPorS; //倾角
float DIR; //方位
float ID; //裂缝代码/可信度
float NUM;
float X[16],Y[16];//X0,Y0,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9;
}FRAC_TABLE;
//蝌蚪图
typedef struct FRACDEF
{
int iCode; //代码
QString csName; // 名称
int iType; //形状代码(1:正弦曲线 2:连线 3:封闭区域)
QColor crColor; //颜色(红 绿 蓝)
int nLineWidth; //线宽度
int bDraw; // 是否显示
}FRAC_DEF;
QList<FRAC_TABLE> m_FracTabList; // --
QList<FRAC_DEF> m_FracDefList;
bool m_bTypeDraw[iFracType]; // --
int m_bTableData = 0;
QString m_csCurveDDIR,m_csCurveDANG,m_csCurveGrad;
Slf_CURVE m_Curve,m_Curve2,m_Curve3;
QString m_qsWellName,m_qsTable;
QString m_qsDepth,m_qsDIP,m_qsDIR,m_qsID,m_qsProperty; // 控制曲线
float m_SDep,m_EDep,m_Rlev;
// csCurveGrad曲线名 LeftVal3最小值 RightVal3最大值 nArc扇形 nR圆半径 crArc圆颜色 nArcLineWidth圆线宽度 bFill是否填充
void fgrqDraw(QString csCurveGrad, double LeftVal3, double RightVal3, int nArc, double nR, QColor crArc, int nArcLineWidth, bool bFill, QColor crFill);
// 绘制倾角
void drawDipAngle(double centerX, double centerY);
void Refurbish();
int m_PointNum;
char *m_Value = NULL,*m_Value2 = NULL,*m_Value3 = NULL;
void ReadData(QString strSlfName, QString strLineName, int iCurve, Slf_CURVE *curve);
private:
};