岩心分析 属性

This commit is contained in:
crqiqi77 2026-03-27 09:47:58 +08:00
parent d09d1006ca
commit f22a3bc415
6 changed files with 102 additions and 65 deletions

View File

@ -23,7 +23,7 @@ CPickFrac::CPickFrac(QMyCustomPlot *myCustomPlot, QString strSlfName, QString cs
} }
//支持框选------------------ //支持框选------------------
//myCustomPlot->m_bDrawCore_PHYSICS = true; myCustomPlot->m_bDrawCore_PHYSICS = true;
ReadData(strSlfName, csCurve); ReadData(strSlfName, csCurve);

View File

@ -432,8 +432,6 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
{ {
double temp = variant.toDouble(); double temp = variant.toDouble();
this->m_formInfo->m_cp_corrDepth = temp; this->m_formInfo->m_cp_corrDepth = temp;
// this->m_tdCorePhysics->m_left_Low = (temp);
// this->m_tdCorePhysics->m_right_Hight = (temp);
this->m_tdCorePhysics->setRange(temp,temp,this->m_tdCorePhysics->getCpCoreValue()); this->m_tdCorePhysics->setRange(temp,temp,this->m_tdCorePhysics->getCpCoreValue());
this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics();
} }
@ -448,13 +446,26 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
{ {
double temp = variant.toDouble(); double temp = variant.toDouble();
this->m_formInfo->m_cp_leftScale = temp; this->m_formInfo->m_cp_leftScale = temp;
this->m_tdCorePhysics->setCpLeftScale(temp); // this->m_tdCorePhysics->setCpLeftScale(temp);
// 这个操作需要修改所有对象
QMap<QString, QObject*> m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{
TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
pDraggableRect->setCpLeftScale(temp);
}
} }
else if("右刻度" == m_propertyData[qtProperty]) else if("右刻度" == m_propertyData[qtProperty])
{ {
double temp = variant.toDouble(); double temp = variant.toDouble();
this->m_formInfo->m_cp_rightScale = temp; this->m_formInfo->m_cp_rightScale = temp;
this->m_tdCorePhysics->setCpRightScale(temp); // this->m_tdCorePhysics->setCpRightScale(temp);
QMap<QString, QObject*> m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{
TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
pDraggableRect->setCpRightScale(temp);
}
} }
else if("等分刻度数或自定义序列" == m_propertyData[qtProperty]) else if("等分刻度数或自定义序列" == m_propertyData[qtProperty])
{ {
@ -505,6 +516,8 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
this->m_formInfo->m_cp_curveScale = temp; this->m_formInfo->m_cp_curveScale = temp;
this->m_tdCorePhysics->setCpCurveScale(temp); this->m_tdCorePhysics->setCpCurveScale(temp);
} }
this->m_tdCorePhysics->update(); this->m_tdCorePhysics->update();
} }

View File

@ -239,17 +239,18 @@ void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event)
//emit rangeChanged(getRange()); //emit rangeChanged(getRange());
mDragMode = DragNone; mDragMode = DragNone;
//取消选中状态 //取消选中状态
// QCPDataSelection emptySelection; // QCPDataSelection emptySelection;
// mPlot->graph(0)->setSelection(emptySelection); // mPlot->graph(0)->setSelection(emptySelection);
// mPlot->replot(); // mPlot->replot();
//取消选中框 //取消选中框
mPlot->selectionRect()->cancel(); mPlot->selectionRect()->cancel();
mPlot->replot(); mPlot->replot();
mPlot->selectionRect()->mActive=true; mPlot->selectionRect()->mActive=true;
// // 设置回选中之前的颜色 // // 设置回选中之前的颜色
// this->setCpLineColor(this->getCpLineColor()); // this->setCpLineColor(this->getCpLineColor());
PropertyService()->initCorePhysicsItemProperty(this);
// 保存slf文件 // 保存slf文件
this->mPlot->saveToSLFCorePhysics(); this->mPlot->saveToSLFCorePhysics();
} }
@ -379,6 +380,15 @@ void TransparentDraggableCorePhysics::setCpLeftScale(double value)
this->m_cp_leftScale = value; this->m_cp_leftScale = value;
this->mPlot->yAxis2->setRange(value, this->mPlot->yAxis2->range().upper); this->mPlot->yAxis2->setRange(value, this->mPlot->yAxis2->range().upper);
QList<QCPItemLine*> tracers = this->mPlot->findChildren<QCPItemLine*>();
foreach (QCPItemLine *tracer, tracers) {
// tracer->setVisible(value);
}
// 重新绘制图形 // 重新绘制图形
this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false); this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false);
} }

View File

@ -6731,8 +6731,9 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
QString strAliasName = "岩心实验数据"; QString strAliasName = "岩心实验数据";
QString strUnit = ""; QString strUnit = "";
// widget->m_bDrawCore_PHYSICS = true; widget->m_bDrawCore_PHYSICS = true;
addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit); addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit);
// m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType, "tableObject");
//支持框选------------------ //支持框选------------------
// widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); // widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect);

View File

@ -306,7 +306,6 @@ QJsonObject FormInfo::makeJson()
{ {
makeTvdJson(rootObj); makeTvdJson(rootObj);
} }
else if (m_strType == "depthObject") else if (m_strType == "depthObject")
{ {
rootObj["bVerticaDrawing"] = m_bVerticaDrawing; // 垂向绘制 rootObj["bVerticaDrawing"] = m_bVerticaDrawing; // 垂向绘制
@ -332,6 +331,7 @@ QJsonObject FormInfo::makeJson()
rootObj["sdMinorTickLineLength"] = m_sdMinorTickLineLength; // 次刻度线长度 rootObj["sdMinorTickLineLength"] = m_sdMinorTickLineLength; // 次刻度线长度
rootObj["sdMinorTickLineWidth"] = m_sdMinorTickLineWidth; // 次刻度线宽度 rootObj["sdMinorTickLineWidth"] = m_sdMinorTickLineWidth; // 次刻度线宽度
} }
return rootObj; return rootObj;
} }
@ -757,10 +757,25 @@ void FormInfo::paintEvent(QPaintEvent* event)
if(m_strLineName == "深度") if(m_strLineName == "深度")
{ {
// 2. 给painter设置字体关键步骤 || m_strLineName == "CORE_PHYSICS"
painter.setFont(m_strUnitFont); painter.setFont(m_strUnitFont);
painter.drawText(rect.left(), rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, this->m_strUnit); painter.drawText(rect.left(), rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, this->m_strUnit);
} }
if(m_strType == "tableObject" && m_strLineName == "CORE_PHYSICS")
{
QFont oldFont = painter.font();
painter.setFont(m_strUnitFont);
painter.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit);
painter.setFont(oldFont);
// 显示刻度
if (m_bShowScale)
{
painter.setFont(m_curveScaleFont);
QFontMetrics fm1(m_curveScaleFont);
QRect textRect = fm1.boundingRect(QString::number(m_vmax, 'f', 0));
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignLeft | Qt::AlignVCenter, QString::number(m_vmin));// +" ~ " + QString::number(m_vmax));
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width() - textRect.width(), rect.height() / 3, Qt::AlignRight | Qt::AlignVCenter, QString::number(m_vmax));
}
}
QWidget::paintEvent(event); QWidget::paintEvent(event);
} }

View File

@ -799,51 +799,52 @@ void QMyCustomPlot::mousePressEvent(QMouseEvent *event)
} }
} }
if(m_bDrawCore_PHYSICS)//岩心分析 // if(m_bDrawCore_PHYSICS)//岩心分析
{ // {
//获取鼠标点位置 // //获取鼠标点位置
double x_pos = event->pos().x(); // double x_pos = event->pos().x();
double y_pos = event->pos().y(); // double y_pos = event->pos().y();
double x_val; // double x_val;
double y_val; // double y_val;
//转为图像位置 // //转为图像位置
x_val = xAxis->pixelToCoord(y_pos); // x_val = xAxis->pixelToCoord(y_pos);
//曲线关联在左右轴判断 // //曲线关联在左右轴判断
y_val = yAxis->pixelToCoord(x_pos); // y_val = yAxis->pixelToCoord(x_pos);
//从选择中获取数据区间 // //从选择中获取数据区间
QCPDataRange range; // QCPDataRange range;
if(graph(0)->selected()){ // qDebug() << graph(0)->selected() << "------===---------";
range = graph(0)->selection().dataRange(); // if(graph(0)->selected()){
} // range = graph(0)->selection().dataRange();
// 检查选定的区间是否是单个数据点 // }
if (range.size() == 1) { // // 检查选定的区间是否是单个数据点
// 获取选定的数据点的下标范围 // if (range.size() == 1) {
dataIndex = range.begin(); // // 获取选定的数据点的下标范围
// 执行特定操作,例如输出下标: // dataIndex = range.begin();
}else{ // // 执行特定操作,例如输出下标:
dataIndex = -1; // }else{
return; // dataIndex = -1;
} // return;
// }
double xx = graph(0)->data()->at(dataIndex)->key; // double xx = graph(0)->data()->at(dataIndex)->key;
// double yy = graph(0)->data()->at(dataIndex)->value; //// double yy = graph(0)->data()->at(dataIndex)->value;
//// double newYPoint = y_val / yy; //曲线Y轴数据 m_y.at(dataIndex) ////// double newYPoint = y_val / yy; //曲线Y轴数据 m_y.at(dataIndex)
//// double xDistand = abs(x_val - xx); //曲线X轴数据 m_x.at(dataIndex) ////// double xDistand = abs(x_val - xx); //曲线X轴数据 m_x.at(dataIndex)
//// //鼠标位距离数据点位置判断 ////// //鼠标位距离数据点位置判断
//// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) { ////// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) {
//// //在此范围(自由设计)则表示选中数据点 ////// //在此范围(自由设计)则表示选中数据点
//// dataIndex = dataIndex; ////// dataIndex = dataIndex;
//// }else{ ////// }else{
//// dataIndex = -1; ////// dataIndex = -1;
//// } ////// }
singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex) // singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex)
singleDragMove = true; // singleDragMove = true;
} // }
QCustomPlot::mousePressEvent(event); QCustomPlot::mousePressEvent(event);
} }
@ -1027,9 +1028,9 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
if(m_bDrawCore_PHYSICS)//岩心分析 if(m_bDrawCore_PHYSICS)//岩心分析
{ {
if(singleDragMove){ // if(singleDragMove){
executeSingle(event); // executeSingle(event);
} // }
} }
else else
{ {
@ -1066,13 +1067,13 @@ void QMyCustomPlot::mouseReleaseEvent(QMouseEvent *event)
} }
} }
if(m_bDrawCore_PHYSICS)//岩心分析 // if(m_bDrawCore_PHYSICS)//岩心分析
{ // {
dataIndex = -1; // dataIndex = -1;
singleDragMove = false; // singleDragMove = false;
//setCursor(Qt::ArrowCursor); // //setCursor(Qt::ArrowCursor);
replot(QCustomPlot::rpQueuedReplot); // replot(QCustomPlot::rpQueuedReplot);
} // }
QCustomPlot::mouseReleaseEvent(event); QCustomPlot::mouseReleaseEvent(event);
} }
@ -2913,9 +2914,6 @@ bool QMyCustomPlot::saveToSLFCorePhysics()
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++) for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{ {
pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
//
// QCPRange tmpRange = pDraggableRect->m_right_Hight;
//
float fSDepth = -pDraggableRect->m_right_Hight; float fSDepth = -pDraggableRect->m_right_Hight;
listSDepth.append(fSDepth); listSDepth.append(fSDepth);
} }