岩心分析 属性

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);

View File

@ -432,8 +432,6 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
{
double temp = variant.toDouble();
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->mPlot->saveToSLFCorePhysics();
}
@ -448,13 +446,26 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
{
double temp = variant.toDouble();
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])
{
double temp = variant.toDouble();
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])
{
@ -505,6 +516,8 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
this->m_formInfo->m_cp_curveScale = temp;
this->m_tdCorePhysics->setCpCurveScale(temp);
}
this->m_tdCorePhysics->update();
}

View File

@ -239,17 +239,18 @@ void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event)
//emit rangeChanged(getRange());
mDragMode = DragNone;
//取消选中状态
// QCPDataSelection emptySelection;
// mPlot->graph(0)->setSelection(emptySelection);
// mPlot->replot();
// QCPDataSelection emptySelection;
// mPlot->graph(0)->setSelection(emptySelection);
// mPlot->replot();
//取消选中框
mPlot->selectionRect()->cancel();
mPlot->replot();
mPlot->selectionRect()->mActive=true;
// // 设置回选中之前的颜色
// this->setCpLineColor(this->getCpLineColor());
// // 设置回选中之前的颜色
// this->setCpLineColor(this->getCpLineColor());
PropertyService()->initCorePhysicsItemProperty(this);
// 保存slf文件
this->mPlot->saveToSLFCorePhysics();
}
@ -379,6 +380,15 @@ void TransparentDraggableCorePhysics::setCpLeftScale(double value)
this->m_cp_leftScale = value;
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);
}

View File

@ -6731,8 +6731,9 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
QString strAliasName = "岩心实验数据";
QString strUnit = "";
// widget->m_bDrawCore_PHYSICS = true;
widget->m_bDrawCore_PHYSICS = true;
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);

View File

@ -306,7 +306,6 @@ QJsonObject FormInfo::makeJson()
{
makeTvdJson(rootObj);
}
else if (m_strType == "depthObject")
{
rootObj["bVerticaDrawing"] = m_bVerticaDrawing; // 垂向绘制
@ -332,6 +331,7 @@ QJsonObject FormInfo::makeJson()
rootObj["sdMinorTickLineLength"] = m_sdMinorTickLineLength; // 次刻度线长度
rootObj["sdMinorTickLineWidth"] = m_sdMinorTickLineWidth; // 次刻度线宽度
}
return rootObj;
}
@ -757,10 +757,25 @@ void FormInfo::paintEvent(QPaintEvent* event)
if(m_strLineName == "深度")
{
// 2. 给painter设置字体关键步骤 || m_strLineName == "CORE_PHYSICS"
painter.setFont(m_strUnitFont);
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);
}

View File

@ -799,51 +799,52 @@ void QMyCustomPlot::mousePressEvent(QMouseEvent *event)
}
}
if(m_bDrawCore_PHYSICS)//岩心分析
{
//获取鼠标点位置
double x_pos = event->pos().x();
double y_pos = event->pos().y();
// 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);
// 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;
}
// //从选择中获取数据区间
// QCPDataRange range;
// qDebug() << graph(0)->selected() << "------===---------";
// 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 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)
////// 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;
//// }
////// //鼠标位距离数据点位置判断
////// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) {
////// //在此范围(自由设计)则表示选中数据点
////// dataIndex = dataIndex;
////// }else{
////// dataIndex = -1;
////// }
singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex)
singleDragMove = true;
}
// singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex)
// singleDragMove = true;
// }
QCustomPlot::mousePressEvent(event);
}
@ -1027,9 +1028,9 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
if(m_bDrawCore_PHYSICS)//岩心分析
{
if(singleDragMove){
executeSingle(event);
}
// if(singleDragMove){
// executeSingle(event);
// }
}
else
{
@ -1066,13 +1067,13 @@ void QMyCustomPlot::mouseReleaseEvent(QMouseEvent *event)
}
}
if(m_bDrawCore_PHYSICS)//岩心分析
{
dataIndex = -1;
singleDragMove = false;
//setCursor(Qt::ArrowCursor);
replot(QCustomPlot::rpQueuedReplot);
}
// if(m_bDrawCore_PHYSICS)//岩心分析
// {
// dataIndex = -1;
// singleDragMove = false;
// //setCursor(Qt::ArrowCursor);
// replot(QCustomPlot::rpQueuedReplot);
// }
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++)
{
pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
//
// QCPRange tmpRange = pDraggableRect->m_right_Hight;
//
float fSDepth = -pDraggableRect->m_right_Hight;
listSDepth.append(fSDepth);
}