This commit is contained in:
DESKTOP-450PEFP\mainc 2026-03-31 09:56:55 +08:00
commit 6e314845ed
16 changed files with 1169 additions and 800 deletions

View File

@ -183,7 +183,7 @@ signals:
void sig_changeDepthProperty(QVariantList vlist); void sig_changeDepthProperty(QVariantList vlist);
//改变岩心分析 //改变岩心分析
void sig_changeCorePhysicsProperty(QVariantList vlist); void sig_changeCorePhysicsProperty(QVariantMap vlist);
//右键--添加分段线 //右键--添加分段线
void sig_AddShiftLine(QString strUuid, double left_Low, double right_Hight); void sig_AddShiftLine(QString strUuid, double left_Low, double right_Hight);

View File

@ -296,22 +296,25 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
{ {
int temp = variant.toInt(); int temp = variant.toInt();
this->m_formInfo->m_cp_lineWidth = temp; this->m_formInfo->m_cp_lineWidth = temp;
this->m_tdCorePhysics->setCpLineWidth(temp);
QVariantList listCond; QVariantMap variantMap;
// emit CallManage::getInstance()->sig_changeCorePhysicsProperty(listCond); variantMap["lineWidth"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("颜色" == m_propertyData[qtProperty]) else if("颜色" == m_propertyData[qtProperty])
{ {
QColor temp = variant.value<QColor>(); QColor temp = variant.value<QColor>();
this->m_formInfo->m_cp_lineColor = temp; this->m_formInfo->m_cp_lineColor = temp;
this->m_tdCorePhysics->setCpLineColor(temp);
QVariantMap variantMap;
variantMap["lineColor"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("线型" == m_propertyData[qtProperty]) else if("线型" == m_propertyData[qtProperty])
{ {
int temp = variant.value<int>();
Qt::PenStyle newStyle = Qt::SolidLine; Qt::PenStyle newStyle = Qt::SolidLine;
int iStyle = variant.value<int>(); switch(temp)
switch(iStyle)
{ {
case 0: case 0:
//无 //无
@ -341,43 +344,62 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
break; break;
} }
this->m_formInfo->m_cp_lineStyle = newStyle; this->m_formInfo->m_cp_lineStyle = newStyle;
this->m_tdCorePhysics->setCpLineStyle(newStyle);
QVariantMap variantMap;
variantMap["lineStyle"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("杆状" == m_propertyData[qtProperty]) else if("杆状" == m_propertyData[qtProperty])
{ {
bool temp = variant.toBool(); bool temp = variant.toBool();
this->m_formInfo->m_cp_drawAsBar = temp; this->m_formInfo->m_cp_drawAsBar = temp;
this->m_tdCorePhysics->setCpDrawAsBar(temp);
QVariantMap variantMap;
variantMap["drawAsBar"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("左界" == m_propertyData[qtProperty]) else if("左界" == m_propertyData[qtProperty])
{ {
bool temp = variant.toBool(); bool temp = variant.toBool();
this->m_formInfo->m_cp_leftBoundary = temp; this->m_formInfo->m_cp_leftBoundary = temp;
this->m_tdCorePhysics->setCpLeftBoundary(temp);
QVariantMap variantMap;
variantMap["leftBoundary"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("不绘零等无效值" == m_propertyData[qtProperty]) else if("不绘零等无效值" == m_propertyData[qtProperty])
{ {
bool temp = variant.toBool(); bool temp = variant.toBool();
this->m_formInfo->m_cp_skipZeroInvalidValues = temp; this->m_formInfo->m_cp_skipZeroInvalidValues = temp;
this->m_tdCorePhysics->setCpSkipZeroInvalidValues(temp);
QVariantMap variantMap;
variantMap["skipZeroInvalidValues"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("绘制包络线" == m_propertyData[qtProperty]) else if("绘制包络线" == m_propertyData[qtProperty])
{ {
bool temp = variant.toBool(); bool temp = variant.toBool();
this->m_formInfo->m_cp_drawEnvelope = temp; this->m_formInfo->m_cp_drawEnvelope = temp;
this->m_tdCorePhysics->setCpDrawEnvelope(temp);
QVariantMap variantMap;
variantMap["drawEnvelope"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("点状" == m_propertyData[qtProperty]) else if("点状" == m_propertyData[qtProperty])
{ {
bool temp = variant.toBool(); bool temp = variant.toBool();
this->m_formInfo->m_cp_drawAsDot = temp; this->m_formInfo->m_cp_drawAsDot = temp;
this->m_tdCorePhysics->setCpDrawAsDot(temp);
QVariantMap variantMap;
variantMap["drawAsDot"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("符号类型" == m_propertyData[qtProperty]) else if("符号类型" == m_propertyData[qtProperty])
{ {
// 目前只有 圆形和矩形
int temp = variant.value<int>();
int newStyle = 0; int newStyle = 0;
int iStyle = variant.value<int>(); switch(temp)
switch(iStyle)
{ {
case 0: case 0:
// 圆形 // 圆形
@ -397,51 +419,59 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
break; break;
} }
this->m_formInfo->m_cp_symbolType = newStyle; this->m_formInfo->m_cp_symbolType = newStyle;
this->m_tdCorePhysics->setCpSymbolType(newStyle);
QVariantMap variantMap;
variantMap["symbolType"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("边框颜色" == m_propertyData[qtProperty]) else if("边框颜色" == m_propertyData[qtProperty])
{ {
QColor temp = variant.value<QColor>(); QColor temp = variant.value<QColor>();
this->m_formInfo->m_cp_symbolBorderColor = temp; this->m_formInfo->m_cp_symbolBorderColor = temp;
this->m_tdCorePhysics->setCpSymbolBorderColor(temp);
QVariantMap variantMap;
variantMap["symbolBorderColor"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("大小" == m_propertyData[qtProperty]) else if("大小" == m_propertyData[qtProperty])
{ {
int temp = variant.toInt(); int temp = variant.toInt();
this->m_formInfo->m_cp_symbolSize = temp; this->m_formInfo->m_cp_symbolSize = temp;
this->m_tdCorePhysics->setCpSymbolSize(temp);
QVariantMap variantMap;
variantMap["symbolSize"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("填充颜色" == m_propertyData[qtProperty]) else if("填充颜色" == m_propertyData[qtProperty])
{ {
QColor temp = variant.value<QColor>(); QColor temp = variant.value<QColor>();
this->m_formInfo->m_cp_symbolFillColor = temp; this->m_formInfo->m_cp_symbolFillColor = temp;
this->m_tdCorePhysics->setCpSymbolFillColor(temp);
QVariantMap variantMap;
variantMap["symbolFillColor"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
else if("序号" == m_propertyData[qtProperty]) else if("序号" == m_propertyData[qtProperty])
{ {
int temp = variant.toInt(); int temp = variant.toInt();
// this->m_formInfo->m_cp_order = temp;
this->m_tdCorePhysics->setCpOrder(temp); this->m_tdCorePhysics->setCpOrder(temp);
this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics();
} }
else if("深度" == m_propertyData[qtProperty]) else if("深度" == m_propertyData[qtProperty])
{ {
double temp = variant.toDouble(); double temp = variant.toDouble();
// this->m_formInfo->m_cp_depth = temp;
this->m_tdCorePhysics->setCpDepth(temp); this->m_tdCorePhysics->setCpDepth(temp);
this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics();
} }
else if("校正深度" == m_propertyData[qtProperty]) else if("校正深度" == m_propertyData[qtProperty])
{ {
double temp = variant.toDouble(); double temp = variant.toDouble();
// this->m_formInfo->m_cp_corrDepth = 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();
} }
else if("数值" == m_propertyData[qtProperty]) else if("数值" == m_propertyData[qtProperty])
{ {
double temp = variant.toDouble(); double temp = variant.toDouble();
// this->m_formInfo->m_cp_coreValue = temp;
this->m_tdCorePhysics->setCpCoreValue(temp); this->m_tdCorePhysics->setCpCoreValue(temp);
this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics(); this->m_tdCorePhysics->mPlot->saveToSLFCorePhysics();
} }
@ -449,38 +479,51 @@ 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_formInfo->repaint();
QVariantMap variantMap;
variantMap["leftScale"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
// this->m_tdCorePhysics->setCpLeftScale(temp); // this->m_tdCorePhysics->setCpLeftScale(temp);
// 这个操作需要修改所有对象 // 这个操作需要修改所有对象
QMap<QString, QObject*> m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; // 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++) // for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{ // {
TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); // TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
pDraggableRect->setCpLeftScale(temp); // 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_formInfo->repaint();
QVariantMap variantMap;
variantMap["rightScale"] = temp;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
// this->m_tdCorePhysics->setCpRightScale(temp); // this->m_tdCorePhysics->setCpRightScale(temp);
QMap<QString, QObject*> m_mapDraggable_CorePhysics = this->m_tdCorePhysics->mPlot->m_mapDraggable_CorePhysics; // 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++) // for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{ // {
TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); // TransparentDraggableCorePhysics* pDraggableRect = (TransparentDraggableCorePhysics*)iter.value();
pDraggableRect->setCpRightScale(temp); // pDraggableRect->setCpRightScale(temp);
} // }
} }
else if("等分刻度数或自定义序列" == m_propertyData[qtProperty]) else if("等分刻度数或自定义序列" == m_propertyData[qtProperty])
{ {
double temp = variant.toDouble(); double temp = variant.toDouble();
this->m_formInfo->m_cp_scaleDivisionsOrCustom = temp; this->m_formInfo->m_cp_scaleDivisionsOrCustom = temp;
this->m_tdCorePhysics->setCpScaleDivisionsOrCustom(temp); this->m_formInfo->repaint();
// this->m_tdCorePhysics->setCpScaleDivisionsOrCustom(temp);
} }
else if("刻度类型" == m_propertyData[qtProperty]) else if("刻度类型" == m_propertyData[qtProperty])
{ {
int newStyle = 0;
int iStyle = variant.value<int>(); int iStyle = variant.value<int>();
int newStyle = 0;
switch(iStyle) switch(iStyle)
{ {
case 0: case 0:
@ -497,14 +540,18 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
break; break;
} }
this->m_formInfo->m_cp_scaleType = newStyle; this->m_formInfo->m_cp_scaleType = newStyle;
this->m_tdCorePhysics->setCpScaleType(newStyle);
QVariantMap variantMap;
variantMap["scaleType"] = newStyle;
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
// this->m_tdCorePhysics->setCpScaleType(newStyle);
} }
else if("显示单位" == m_propertyData[qtProperty]) else if("显示单位" == m_propertyData[qtProperty])
{ {
QString temp = variant.toString(); QString temp = variant.toString();
this->m_formInfo->m_strUnit = temp; this->m_formInfo->m_strUnit = temp;
this->m_tdCorePhysics->setCpDisplayUnit(temp); // this->m_tdCorePhysics->setCpDisplayUnit(temp);
this->m_formInfo->repaint(); this->m_formInfo->repaint();
} }
else if("曲线单位" == m_propertyData[qtProperty]) else if("曲线单位" == m_propertyData[qtProperty])
@ -3410,6 +3457,14 @@ void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics
{ {
//初始化,清空 //初始化,清空
InitCurrentViewInfo(); InitCurrentViewInfo();
// qDebug() << "=========-----this:" << tdImage << " mPlot:" << tdImage->mPlot;
// QMyCustomPlot *mPlot = tdImage->mPlot;
// qDebug() << tdImage->mPlot->m_strUuid << "====";
// qDebug() << tdImage->mPlot->m_strWellName << "====";
// qDebug() << tdImage->mPlot->m_strTrackName << "====";
// qDebug() << tdImage->mPlot->m_strLineName << "====";
// qDebug() << tdImage->mPlot->m_formTrack << "====";
FormInfo* formInfo = tdImage->mPlot->m_formTrack->getFormInfoByParameters(tdImage->mPlot->m_strUuid, tdImage->mPlot->m_strWellName, FormInfo* formInfo = tdImage->mPlot->m_formTrack->getFormInfoByParameters(tdImage->mPlot->m_strUuid, tdImage->mPlot->m_strWellName,
tdImage->mPlot->m_strTrackName, tdImage->mPlot->m_strLineName); tdImage->mPlot->m_strTrackName, tdImage->mPlot->m_strLineName);
if (formInfo != NULL) if (formInfo != NULL)

View File

@ -203,7 +203,7 @@ public:
// 录井剖面属性 // 录井剖面属性
void initGeoLithProperty(FormInfo *formInfo); void initGeoLithProperty(FormInfo *formInfo);
void initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, const QString myLith, const QString myOil, const QString myColor); void initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, QString myLith, QString myOil, QString myColor);
// 文字结论属性 // 文字结论属性
void initTextProperty(FormInfo *formInfo); void initTextProperty(FormInfo *formInfo);

View File

@ -49,8 +49,40 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig
} }
} }
m_lY1 = lY1; m_lY1 = lY1;
// lY2除以实际左到右刻度数值
lY2 = lY2 / (getCpRightScale() - getCpLeftScale()) * 100;
double minV = getCpLeftScale();
double maxV = getCpRightScale();
double value = lY2;
double finalValue = 0;
int scaleType = getCpScaleType(); // 0=线性 1=对数 2=倾角
if (scaleType == 0)
{
// 线性(原来的公式) // lY2除以实际左到右刻度数值
finalValue = (value - minV) / (maxV - minV) * 100.0;
}
else if (scaleType == 1)
{
// 对数刻度(匹配 QCPAxis::stLogarithmic
double logMin = log10(minV <= 0 ? 1 : minV);
double logMax = log10(maxV);
double logVal = log10(value);
finalValue = (logVal - logMin) / (logMax - logMin) * 100.0;
}
else if (scaleType == 2)
{
// 倾角刻度正切非线性QCustomPlot没有我们自己实现标准倾角
double PI = acos(-1);
auto linearNorm = (value - minV) / (maxV - minV); // 0~1
double tanPos = tan(linearNorm * PI/2 - PI/4); // -1 ~ +1
double tanNorm = (tanPos + 1.0) / 2.0; // 0~1
finalValue = tanNorm * 100.0;
}
// 最终结果赋值给 lY2
lY2 = finalValue;
qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置 qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置
@ -98,13 +130,14 @@ void TransparentDraggableCorePhysics::update()
void TransparentDraggableCorePhysics::initRect() void TransparentDraggableCorePhysics::initRect()
{ {
// 连接鼠标事件 // 连接鼠标事件
connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableCorePhysics::onMousePress); connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableCorePhysics::onMousePress);
connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableCorePhysics::onMouseMove); connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableCorePhysics::onMouseMove);
connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableCorePhysics::onMouseRelease); connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableCorePhysics::onMouseRelease);
qcpItemLine = new QCPItemLine(mPlot); qcpItemLine = new QCPItemLine(mPlot);
// qcpItemLine->setPen(QPen(Qt::blue, 20));
qcpItemLine->setLayer("overlay"); // 确保在最上层 qcpItemLine->setLayer("overlay"); // 确保在最上层
//上下边界 //上下边界
@ -115,7 +148,7 @@ void TransparentDraggableCorePhysics::initRect()
tracer->setGraph(nullptr); // 不关联曲线,自由定位 tracer->setGraph(nullptr); // 不关联曲线,自由定位
tracer->setStyle(QCPItemTracer::tsCircle); // 圆形可选tsSquare, tsCross, tsPlus等 tracer->setStyle(QCPItemTracer::tsCircle); // 圆形可选tsSquare, tsCross, tsPlus等
tracer->setSize(3); // 点的大小(像素) tracer->setSize(3); // 点的大小(像素)
tracer->setPen(QPen(Qt::red)); // 边框颜色 tracer->setPen(QPen(Qt::black)); // 边框颜色
tracer->setBrush(QBrush(QColor(0, 0, 0, 0))); // 黄色半透明Alpha=128 tracer->setBrush(QBrush(QColor(0, 0, 0, 0))); // 黄色半透明Alpha=128
tracer->setInterpolating(false); tracer->setInterpolating(false);
// 绑定到线条终点(关键!) // 绑定到线条终点(关键!)
@ -123,6 +156,7 @@ void TransparentDraggableCorePhysics::initRect()
tracer->setVisible(false); tracer->setVisible(false);
qDebug() << "Creating qcpItemLine"; qDebug() << "Creating qcpItemLine";
// qDebug() << "=========this:" << this << " mPlot:" << mPlot;
} }
void TransparentDraggableCorePhysics::updateHandles() void TransparentDraggableCorePhysics::updateHandles()
@ -165,17 +199,13 @@ void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event)
{ {
//之前的选中线段,恢复黑色 //之前的选中线段,恢复黑色
TransparentDraggableCorePhysics *tmpLine = (TransparentDraggableCorePhysics*)mPlot->m_SelectShiftLine; TransparentDraggableCorePhysics *tmpLine = (TransparentDraggableCorePhysics*)mPlot->m_SelectShiftLine;
QPen pen = tmpLine->qcpItemLine->pen(); QPen pen = tmpLine->qcpItemLine->pen(); // 现在这里绝对安全
// pen.setWidth(getCpLineWidth()); pen.setColor(this->getCpLineColor());
pen.setColor(Qt::black); // 线宽
tmpLine->qcpItemLine->setPen(pen); tmpLine->qcpItemLine->setPen(pen);
// tmpLine->qcpItemLine->setPen(QPen(Qt::black));
} }
//重新设置选中线段 //重新设置选中线段
mPlot->m_SelectShiftLine = this; mPlot->m_SelectShiftLine = this;
QPen pen = qcpItemLine->pen(); QPen pen = qcpItemLine->pen();
// pen.setWidth(getCpLineWidth());
pen.setColor(Qt::red); pen.setColor(Qt::red);
qcpItemLine->setPen(pen); qcpItemLine->setPen(pen);
@ -307,35 +337,25 @@ void TransparentDraggableCorePhysics::setCpCoreValue(double value)
qcpItemLine->end->setCoords(currentX, value); qcpItemLine->end->setCoords(currentX, value);
} }
double TransparentDraggableCorePhysics::getCpExampleAreaHeightCm() const //double TransparentDraggableCorePhysics::getCpRotationAngle() const
{ //{
return this->m_cp_exampleAreaHeightCm; // return this->m_cp_rotationAngle;
} //}
void TransparentDraggableCorePhysics::setCpExampleAreaHeightCm(double value) //void TransparentDraggableCorePhysics::setCpRotationAngle(double value)
{ //{
this->m_cp_exampleAreaHeightCm = value; // this->m_cp_rotationAngle = value;
} //}
double TransparentDraggableCorePhysics::getCpRotationAngle() const //QString TransparentDraggableCorePhysics::getCpDisplayName() const
{ //{
return this->m_cp_rotationAngle; // return this->m_cp_displayName;
} //}
void TransparentDraggableCorePhysics::setCpRotationAngle(double value) //void TransparentDraggableCorePhysics::setCpDisplayName(const QString &value)
{ //{
this->m_cp_rotationAngle = value; // this->m_cp_displayName = value;
} //}
QString TransparentDraggableCorePhysics::getCpDisplayName() const
{
return this->m_cp_displayName;
}
void TransparentDraggableCorePhysics::setCpDisplayName(const QString &value)
{
this->m_cp_displayName = value;
}
int TransparentDraggableCorePhysics::getCpLineWidth() const int TransparentDraggableCorePhysics::getCpLineWidth() const
{ {
@ -345,12 +365,11 @@ int TransparentDraggableCorePhysics::getCpLineWidth() const
void TransparentDraggableCorePhysics::setCpLineWidth(int value) void TransparentDraggableCorePhysics::setCpLineWidth(int value)
{ {
this->m_cp_lineWidth = value; this->m_cp_lineWidth = value;
QList<QCPItemLine*> itemLine = this->mPlot->findChildren<QCPItemLine*>();
foreach (QCPItemLine *tracer, itemLine) { QPen pen = this->qcpItemLine->pen();
QPen pen = tracer->pen();
pen.setWidth(value); // 线宽 pen.setWidth(value); // 线宽
tracer->setPen(pen); this->qcpItemLine->setPen(pen);
}
} }
QColor TransparentDraggableCorePhysics::getCpLineColor() const QColor TransparentDraggableCorePhysics::getCpLineColor() const
@ -362,14 +381,12 @@ void TransparentDraggableCorePhysics::setCpLineColor(QColor value)
{ {
this->m_cp_lineColor = value; this->m_cp_lineColor = value;
QList<QCPItemLine*> itemLine = this->mPlot->findChildren<QCPItemLine*>(); QPen pen = this->qcpItemLine->pen();
foreach (QCPItemLine *tracer, itemLine) {
QPen pen = tracer->pen();
pen.setColor(value); pen.setColor(value);
tracer->setPen(pen); this->qcpItemLine->setPen(pen);
}
} }
Qt::PenStyle TransparentDraggableCorePhysics::getCpLineStyle() const Qt::PenStyle TransparentDraggableCorePhysics::getCpLineStyle() const
{ {
return this->m_cp_lineStyle; return this->m_cp_lineStyle;
@ -379,12 +396,10 @@ void TransparentDraggableCorePhysics::setCpLineStyle(Qt::PenStyle value)
{ {
this->m_cp_lineStyle = value; this->m_cp_lineStyle = value;
QList<QCPItemLine*> itemLine = this->mPlot->findChildren<QCPItemLine*>(); QPen pen = this->qcpItemLine->pen();
foreach (QCPItemLine *tracer, itemLine) {
QPen pen = tracer->pen();
pen.setStyle(value); pen.setStyle(value);
tracer->setPen(pen); this->qcpItemLine->setPen(pen);
}
} }
double TransparentDraggableCorePhysics::getCpLeftScale() const double TransparentDraggableCorePhysics::getCpLeftScale() const
@ -396,7 +411,6 @@ 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->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);
} }
@ -410,7 +424,6 @@ void TransparentDraggableCorePhysics::setCpRightScale(double value)
{ {
this->m_cp_rightScale = value; this->m_cp_rightScale = value;
this->mPlot->yAxis2->setRange(this->mPlot->yAxis2->range().lower, 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);
} }
@ -424,51 +437,37 @@ void TransparentDraggableCorePhysics::setCpScaleType(int value)
{ {
this->m_cp_scaleType = value; this->m_cp_scaleType = value;
int newStyle = 0; // 重新绘制图形
switch(value) this->setRange(this->m_left_Low, this->m_left_Low, this->getCpCoreValue(), false);
{
case 0:
// 线性
this->mPlot->yAxis2->setScaleType(QCPAxis::stLinear);
break;
case 1:
// 对数
this->mPlot->yAxis2->setScaleType(QCPAxis::stLogarithmic);
break;
case 2:
// 倾角 没有倾角类型
this->mPlot->yAxis2->setScaleType(QCPAxis::stLogarithmic);
break;
}
} }
int TransparentDraggableCorePhysics::getCpScaleDivisionsOrCustom() const //int TransparentDraggableCorePhysics::getCpScaleDivisionsOrCustom() const
{ //{
return this->m_cp_scaleDivisionsOrCustom; // return this->m_cp_scaleDivisionsOrCustom;
} //}
void TransparentDraggableCorePhysics::setCpScaleDivisionsOrCustom(int value) //void TransparentDraggableCorePhysics::setCpScaleDivisionsOrCustom(int value)
{ //{
this->m_cp_scaleDivisionsOrCustom = value; // this->m_cp_scaleDivisionsOrCustom = value;
// 创建文本刻度 Ticker //// // 创建文本刻度 Ticker
QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText); //// QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
double minVal = this->mPlot->yAxis2->range().lower; //// double minVal = this->mPlot->yAxis2->range().lower;
double maxVal = this->mPlot->yAxis2->range().upper; //// double maxVal = this->mPlot->yAxis2->range().upper;
// 计算步长:(最大值 - 最小值) / 等分数 //// // 计算步长:(最大值 - 最小值) / 等分数
double step = (maxVal - minVal) / value; //// double step = (maxVal - minVal) / value;
// 生成刻度 //// // 生成刻度
for (int i = 0; i <= value; ++i) { //// for (int i = 0; i <= value; ++i) {
double value = minVal + step * i; //// double value = minVal + step * i;
// 取整显示34.0 显示为 "34" //// // 取整显示34.0 显示为 "34"
QString label = QString::number(qRound(value)); //// QString label = QString::number(qRound(value));
textTicker->addTick(value, label); //// textTicker->addTick(value, label);
} //// }
// 应用 Ticker //// // 应用 Ticker
this->mPlot->yAxis2->setTicker(textTicker); //// this->mPlot->yAxis2->setTicker(textTicker);
// 设置范围(稍微留边距,让刻度显示完整) //// // 设置范围(稍微留边距,让刻度显示完整)
// this->mPlot->yAxis2->setRange(minVal - step * 0.1, maxVal + step * 0.1); ////// this->mPlot->yAxis2->setRange(minVal - step * 0.1, maxVal + step * 0.1);
} //}
QString TransparentDraggableCorePhysics::getCpDisplayUnit() const QString TransparentDraggableCorePhysics::getCpDisplayUnit() const
{ {
@ -509,7 +508,7 @@ void TransparentDraggableCorePhysics::setCpCurveScale(QFont value)
{ {
this->m_cp_curveScale = value; this->m_cp_curveScale = value;
this->mPlot->yAxis2->setTickLabelFont(value); // this->mPlot->yAxis2->setTickLabelFont(value);
} }
bool TransparentDraggableCorePhysics::getCpDrawAsBar() const bool TransparentDraggableCorePhysics::getCpDrawAsBar() const
@ -543,17 +542,28 @@ bool TransparentDraggableCorePhysics::getCpLeftBoundary() const
void TransparentDraggableCorePhysics::setCpLeftBoundary(bool value) void TransparentDraggableCorePhysics::setCpLeftBoundary(bool value)
{ {
this->m_cp_leftBoundary = value; this->m_cp_leftBoundary = value;
// 由于 X轴↔Y轴 互换,"水平翻转"变成关于 Y轴中心对称
double y_center = (this->mPlot->yAxis->range().lower + this->mPlot->yAxis->range().upper) / 2;
// 获取原坐标(注意:此时 coords() 返回的是互换后的坐标) double y_min = mPlot->yAxis->range().lower;
QPointF start = this->qcpItemLine->start->coords(); double y_max = mPlot->yAxis->range().upper;
QPointF end = this->qcpItemLine->end->coords(); double y_center = (y_min + y_max) / 2;
QPointF start = qcpItemLine->start->coords();
// 翻转Y轴不变实际是视觉上的X轴X轴镜像实际是视觉上的Y轴 QPointF end = qcpItemLine->end->coords();
// 但由于轴互换了,我们需要翻转的是 y 坐标 double targetYStart, targetYEnd;
this->qcpItemLine->start->setCoords(start.x(), 2 * y_center - start.y()); if (value) {
this->qcpItemLine->end->setCoords(end.x(), 2 * y_center - end.y()); // ======================================
// ✅ TRUE = 强制回到左边(固定公式)
// ======================================
targetYStart = y_min + (y_max - start.y());
targetYEnd = y_min + (y_max - end.y());
} else {
// ======================================
// ✅ FALSE = 强制去到右边(固定公式)
// ======================================
targetYStart = 2 * y_center - start.y();
targetYEnd = 2 * y_center - end.y();
}
qcpItemLine->start->setCoords(start.x(), targetYStart);
qcpItemLine->end->setCoords(end.x(), targetYEnd);
} }
bool TransparentDraggableCorePhysics::getCpSkipZeroInvalidValues() const bool TransparentDraggableCorePhysics::getCpSkipZeroInvalidValues() const
@ -657,7 +667,6 @@ void TransparentDraggableCorePhysics::setCpSymbolSize(int value)
foreach (QCPItemTracer *tracer, tracers) { foreach (QCPItemTracer *tracer, tracers) {
tracer->setSize(value); // 点的大小(像素) tracer->setSize(value); // 点的大小(像素)
} }
} }
QColor TransparentDraggableCorePhysics::getCpSymbolFillColor() const QColor TransparentDraggableCorePhysics::getCpSymbolFillColor() const
@ -680,12 +689,12 @@ void TransparentDraggableCorePhysics::setCpSymbolFillColor(QColor value)
} }
} }
int TransparentDraggableCorePhysics::getCpFieldName() const //int TransparentDraggableCorePhysics::getCpFieldName() const
{ //{
return this->m_cp_fieldName; // return this->m_cp_fieldName;
} //}
void TransparentDraggableCorePhysics::setCpFieldName(const int &value) //void TransparentDraggableCorePhysics::setCpFieldName(const int &value)
{ //{
this->m_cp_fieldName = value; // this->m_cp_fieldName = value;
} //}

View File

@ -48,14 +48,11 @@ public:
double getCpCoreValue() const; double getCpCoreValue() const;
void setCpCoreValue(double value); void setCpCoreValue(double value);
double getCpExampleAreaHeightCm() const; // double getCpRotationAngle() const;
void setCpExampleAreaHeightCm(double value); // void setCpRotationAngle(double value);
double getCpRotationAngle() const; // QString getCpDisplayName() const;
void setCpRotationAngle(double value); // void setCpDisplayName(const QString &value);
QString getCpDisplayName() const;
void setCpDisplayName(const QString &value);
int getCpLineWidth() const; int getCpLineWidth() const;
void setCpLineWidth(int value); void setCpLineWidth(int value);
@ -75,8 +72,8 @@ public:
int getCpScaleType() const; int getCpScaleType() const;
void setCpScaleType(int value); void setCpScaleType(int value);
int getCpScaleDivisionsOrCustom() const; // int getCpScaleDivisionsOrCustom() const;
void setCpScaleDivisionsOrCustom(int value); // void setCpScaleDivisionsOrCustom(int value);
QString getCpDisplayUnit() const; QString getCpDisplayUnit() const;
void setCpDisplayUnit(const QString &value); void setCpDisplayUnit(const QString &value);
@ -117,23 +114,22 @@ public:
QColor getCpSymbolFillColor() const; QColor getCpSymbolFillColor() const;
void setCpSymbolFillColor(QColor value); void setCpSymbolFillColor(QColor value);
int getCpFieldName() const; // int getCpFieldName() const;
void setCpFieldName(const int &value); // void setCpFieldName(const int &value);
signals: signals:
void rangeChanged(QCPRange newRange); void rangeChanged(QCPRange newRange);
private: private:
double m_cp_exampleAreaHeightCm; // 例区高度(cm) // double m_cp_rotationAngle; // 旋转角度
double m_cp_rotationAngle; // 旋转角度 // QString m_cp_displayName; // 显示名称
QString m_cp_displayName; // 显示名称
int m_cp_lineWidth; // 线宽 int m_cp_lineWidth; // 线宽
QColor m_cp_lineColor; // 线条颜色 QColor m_cp_lineColor; // 线条颜色
Qt::PenStyle m_cp_lineStyle; // 线型 Qt::PenStyle m_cp_lineStyle; // 线型
double m_cp_leftScale = 0; // 左刻度 double m_cp_leftScale = 0; // 左刻度
double m_cp_rightScale = 100; // 右刻度 double m_cp_rightScale = 100; // 右刻度
int m_cp_scaleType; // 刻度类型 int m_cp_scaleType = 0; // 刻度类型
int m_cp_scaleDivisionsOrCustom; // 等分刻度数或自定序列 // int m_cp_scaleDivisionsOrCustom; // 等分刻度数或自定序列
QString m_cp_displayUnit; // 显示单位 QString m_cp_displayUnit; // 显示单位
QString m_cp_curveName; // 曲线名称 QString m_cp_curveName; // 曲线名称
QString m_cp_curveUnit; // 曲线单位 QString m_cp_curveUnit; // 曲线单位
@ -147,7 +143,7 @@ private:
QColor m_cp_symbolBorderColor; // 边框颜色 QColor m_cp_symbolBorderColor; // 边框颜色
int m_cp_symbolSize; // 大小 int m_cp_symbolSize; // 大小
QColor m_cp_symbolFillColor; // 填充颜色 QColor m_cp_symbolFillColor; // 填充颜色
int m_cp_fieldName; // 字段名称 // int m_cp_fieldName; // 字段名称
// 这四个是slf文件保存读取的 // 这四个是slf文件保存读取的
int m_cp_order; // 序号 int m_cp_order; // 序号
double m_cp_depth; // 深度 double m_cp_depth; // 深度
@ -183,7 +179,6 @@ public:
double m_lY1 = 0; double m_lY1 = 0;
// 添加最小宽度成员变量 // 添加最小宽度成员变量
double mMinWidth; double mMinWidth;
}; };
#endif // TRANSPARENTDRAGGABLECOREPHYSICS_H #endif // TRANSPARENTDRAGGABLECOREPHYSICS_H

View File

@ -5501,7 +5501,7 @@ void FormDraw::initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString
widget->xAxis2->setTicks(false); widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false); widget->yAxis2->setTicks(false);
// //
LoadFromIMAGE_SLF(widget, strSlfName, strLineName); widget->LoadFromIMAGE_SLF(strSlfName, strLineName);
//显示文本 //显示文本
QString strAliasName = "岩心图片"; QString strAliasName = "岩心图片";
if(stringList.size() >= 1) if(stringList.size() >= 1)
@ -5518,61 +5518,61 @@ void FormDraw::initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString
m_RightVal, m_LeftVal, strScaleType, "tableObject", stringList);//yanxinImageObject m_RightVal, m_LeftVal, strScaleType, "tableObject", stringList);//yanxinImageObject
} }
bool FormDraw::LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName) //bool FormDraw::LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
{ //{
{ // {
QString ss=strSlfName; // QString ss=strSlfName;
CMemRdWt *logio=new CMemRdWt(); // CMemRdWt *logio=new CMemRdWt();
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead)) // if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead))
{ // {
delete logio; // delete logio;
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes); // // QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
return false; // return false;
} // }
int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); // int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
if(iIndex>-1) { // if(iIndex>-1) {
int len=logio->GetTableRecordLength(iIndex); // int len=logio->GetTableRecordLength(iIndex);
if(len<sizeof(IMAGE_DATA)) len=sizeof(IMAGE_DATA); // if(len<sizeof(IMAGE_DATA)) len=sizeof(IMAGE_DATA);
char*buf=new char[len+1]; // char*buf=new char[len+1];
IMAGE_DATA *m_Result=(IMAGE_DATA *)buf; // IMAGE_DATA *m_Result=(IMAGE_DATA *)buf;
int count=logio->GetTableRecordCount(iIndex); // int count=logio->GetTableRecordCount(iIndex);
for(int i=0;i<count;i++) { // for(int i=0;i<count;i++) {
memset(m_Result,0,sizeof(IMAGE_DATA)); // memset(m_Result,0,sizeof(IMAGE_DATA));
logio->ReadTable(iIndex,i+1,m_Result); // logio->ReadTable(iIndex,i+1,m_Result);
// WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth); // // WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth);
// if(!item) continue; // // if(!item) continue;
// OGWordsResultItem* pResult = dynamic_cast<OGWordsResultItem*>(item); // // OGWordsResultItem* pResult = dynamic_cast<OGWordsResultItem*>(item);
//logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Image,i+1); // //logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Image,i+1);
// SetCharacters(m_Result->Words); // // SetCharacters(m_Result->Words);
// fontColor=QColor(0,0,0,255); // // fontColor=QColor(0,0,0,255);
// backgroundColor=QColor(255,255,255,255); // // backgroundColor=QColor(255,255,255,255);
// wordfont.setFamily("黑体"); // // wordfont.setFamily("黑体");
// wordfont.setPointSize(10); // // wordfont.setPointSize(10);
//显示图片Image // //显示图片Image
QString filename=QString::fromLocal8Bit(m_Result->Image); // QString filename=QString::fromLocal8Bit(m_Result->Image);
int pos=filename.lastIndexOf("\\"); // int pos=filename.lastIndexOf("\\");
int pos1=filename.lastIndexOf("/"); // int pos1=filename.lastIndexOf("/");
if(pos1>pos) pos=pos1; // if(pos1>pos) pos=pos1;
if(filename.lastIndexOf(".")>-1) { // if(filename.lastIndexOf(".")>-1) {
int aa=filename.lastIndexOf("."); // int aa=filename.lastIndexOf(".");
if(aa<pos) { // if(aa<pos) {
filename=""; // filename="";
} // }
} // }
widget->addImageToPlot(-m_Result->EndDepth, -m_Result->StartDepth, filename, static_cast<double>(m_Result->Left), static_cast<double>(m_Result->Width)); // widget->addImageToPlot(-m_Result->EndDepth, -m_Result->StartDepth, filename, static_cast<double>(m_Result->Left), static_cast<double>(m_Result->Width));
} // }
logio->CloseTable(iIndex); // logio->CloseTable(iIndex);
delete buf; // delete buf;
} // }
delete logio; // delete logio;
} // }
return true; // return true;
} //}
//解释结论 //解释结论
void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString strLineName) void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
@ -6968,111 +6968,92 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
widget->xAxis->setTicks(false); widget->xAxis->setTicks(false);
widget->yAxis->setTicks(false); widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false); widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(true); widget->yAxis2->setTicks(false);
widget->yAxis2->setTickLabels(true);
widget->yAxis2->setTickLabelSide(QCPAxis::lsInside);
widget->yAxis2->setRange(0, 100);
// 设置刻度
// 创建文本刻度 Ticker
QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
double minVal = widget->yAxis2->range().lower;
double maxVal = widget->yAxis2->range().upper;
int value = 2;
// 计算步长:(最大值 - 最小值) / 等分数
double step = (maxVal - minVal) / value;
// 生成刻度
for (int i = 0; i <= value; ++i) {
double value = minVal + step * i;
// 取整显示34.0 显示为 "34"
QString label = QString::number(qRound(value));
textTicker->addTick(value, label);
}
// 应用 Ticker
widget->yAxis2->setTicker(textTicker);
// 加载slf文件 开始
QVector<double> x, y; QVector<double> x, y;
Slf_CORE_PHYSICS *m_pResult=NULL;
CMemRdWt *logio=new CMemRdWt();
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
return;
}
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
if(iIndex>-1) {
int FieldNo=0;
int count=logio->GetTableRecordCount(iIndex);
QString FieldName = "AC"; // // 加载slf文件 开始
// QVector<double> x, y;
// Slf_CORE_PHYSICS *m_pResult=NULL;
// CMemRdWt *logio=new CMemRdWt();
// if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
// {
// delete logio;
// // QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
// return;
// }
// int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
// if(iIndex>-1) {
// int FieldNo=0;
// int count=logio->GetTableRecordCount(iIndex);
if(!FieldName.isEmpty()) { // QString FieldName = "AC";
static int err=0;
FieldNo=logio->GetTableFieldNo(iIndex,(char *)FieldName.toStdString().c_str());
if(FieldNo<0) {
if(!err)QMessageBox::information(nullptr, "提示", "岩心试验数据模块初始加载数据不成功,因为隐含"+FieldName+"字段在实际数据表中不存在,稍后请您重新选择有效字段!");
err++;
delete logio;
return;
}
else err=0;
}
else {
delete logio;
return;
}
int len=logio->GetTableRecordLength(iIndex);
m_pResult=(Slf_CORE_PHYSICS *)new char[len+1];
char buf[100];
for(int i=0;i<count;i++) {
logio->GetTableFieldData(iIndex,1,buf,i+1);
sscanf(buf,"%f",&m_pResult->Depth);
logio->GetTableFieldData(iIndex,2,buf,i+1);
sscanf(buf,"%f",&m_pResult->CorrDepth);
// logio->ReadTable(iIndex,i+1,m_pResult);
int Order = m_pResult->Order; // if(!FieldName.isEmpty()) {
float depth = m_pResult->Depth; // static int err=0;
float CorrDepth = m_pResult->CorrDepth; // FieldNo=logio->GetTableFieldNo(iIndex,(char *)FieldName.toStdString().c_str());
float CoreValue = m_pResult->CoreValue; // if(FieldNo<0) {
logio->GetTableFieldData(iIndex,FieldNo,buf,i+1); // if(!err)QMessageBox::information(nullptr, "提示", "岩心试验数据模块初始加载数据不成功,因为隐含"+FieldName+"字段在实际数据表中不存在,稍后请您重新选择有效字段!");
// err++;
// delete logio;
// return;
// }
// else err=0;
// }
// else {
// delete logio;
// return;
// }
// int len=logio->GetTableRecordLength(iIndex);
// m_pResult=(Slf_CORE_PHYSICS *)new char[len+1];
// char buf[100];
// for(int i=0;i<count;i++) {
// logio->GetTableFieldData(iIndex,1,buf,i+1);
// sscanf(buf,"%f",&m_pResult->Depth);
// logio->GetTableFieldData(iIndex,2,buf,i+1);
// sscanf(buf,"%f",&m_pResult->CorrDepth);
// // logio->ReadTable(iIndex,i+1,m_pResult);
CoreValue=0; // int Order = m_pResult->Order;
sscanf(buf,"%f",&CoreValue); // float depth = m_pResult->Depth;
// // float CorrDepth = m_pResult->CorrDepth;
// float CoreValue = m_pResult->CoreValue;
// logio->GetTableFieldData(iIndex,FieldNo,buf,i+1);
if(i==0) // CoreValue=0;
{ // sscanf(buf,"%f",&CoreValue);
//最大值,最小值默认采用第一个有效值 // //
//vmax = vmin = CoreValue;
//默认采用0-100范围 // if(i==0)
if(vmax<CoreValue)vmax=CoreValue; // {
if(vmin>CoreValue)vmin=CoreValue; // //最大值,最小值默认采用第一个有效值
} // //vmax = vmin = CoreValue;
else
{ // //默认采用0-100范围
// // if(vmax<CoreValue)vmax=CoreValue;
if(vmax<CoreValue)vmax=CoreValue; // if(vmin>CoreValue)vmin=CoreValue;
if(vmin>CoreValue)vmin=CoreValue; // }
} // else
// // {
x.append(-CorrDepth); // //
y.append(CoreValue); // if(vmax<CoreValue)vmax=CoreValue;
// 已经加载了slf文件内容 显示界面上 // if(vmin>CoreValue)vmin=CoreValue;
widget->addCorePhysicsWithParam(Order, static_cast<double>(-depth), static_cast<double>(-CorrDepth), static_cast<double>(-CoreValue)); // }
} // //
logio->CloseTable(iIndex); // x.append(-CorrDepth);
delete m_pResult; // y.append(CoreValue);
} // // 已经加载了slf文件内容 显示界面上
delete logio; // widget->addCorePhysicsWithParam(Order, static_cast<double>(-depth), static_cast<double>(-CorrDepth), static_cast<double>(-CoreValue));
// 加载slf文件结束 // }
// logio->CloseTable(iIndex);
// delete m_pResult;
// }
// delete logio;
// // 加载slf文件结束
// 加载slf文件
widget->loadFromSLFCorePhysics(strSlfName, strLineName);
QString strAliasName = "岩心实验数据"; QString strAliasName = "岩心实验数据";
QString strUnit = ""; QString strUnit = "";
@ -7088,15 +7069,6 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit, addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit,
newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, stringList); newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, stringList);
// if(stringList.size() >= 1)
// {
// }
// else
// {
// addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit);
// }
//支持框选------------------ //支持框选------------------
// widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); // widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect);
widget->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData widget->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData

View File

@ -229,7 +229,7 @@ public:
//岩心图片数据 //岩心图片数据
void initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QStringList listOtherProperty={}); void initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QStringList listOtherProperty={});
bool LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName); // bool LoadFromIMAGE_SLF(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
//深度 //深度
void initDepth(QMyCustomPlot *widget); void initDepth(QMyCustomPlot *widget);

View File

@ -800,20 +800,60 @@ void FormInfo::paintEvent(QPaintEvent* event)
} }
if(m_strType == "tableObject" && m_strLineName == "CORE_PHYSICS") if(m_strType == "tableObject" && m_strLineName == "CORE_PHYSICS")
{ {
painter.setPen(Qt::black);
// 字体->曲线单位
QFont oldFont = painter.font(); QFont oldFont = painter.font();
painter.setFont(m_strUnitFont); 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.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit);
painter.setFont(oldFont); painter.setFont(oldFont);
// 显示刻度
if (m_bShowScale) // 刻度的那条线
int baseY = rect.top() + rect.height() * 2 / 3;
int textH = rect.height() / 3;
// 关键:线 Y 坐标 = 文字底部,但不超过 rect 底部
int lineY = baseY + textH - 7;
int x1 = rect.left() + 20;
int x2 = rect.right() - 30;
painter.drawLine(x1, lineY, x2, lineY);
// 字体->曲线刻度
oldFont = painter.font();
painter.setFont(m_cp_curveScale);
// ========== 在这条线上画刻度 + 数字 ==========
int minVal = this->m_cp_leftScale; // 最小值(可变)
int maxVal = this->m_cp_rightScale; // 最大值(可变)
if(this->m_cp_scaleDivisionsOrCustom <= 0)
{ {
painter.setFont(m_curveScaleFont); this->m_cp_scaleDivisionsOrCustom = 1;
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));
} }
int tickCount = this->m_cp_scaleDivisionsOrCustom + 1; // 总刻度等分数(可变,比如 5/10/20
// 样式配置
int tickHeight = 6; // 小刻度高度
int textOffsetUp = 18; // 数字往上偏移量(解决被遮挡问题)
// 计算总步长(自动等分)
double step = (maxVal - minVal) * 1.0 / (tickCount - 1);
// 开始画所有刻度 + 数字
for (int i = 0; i < tickCount; ++i) {
// 当前刻度值(自动计算)
int val = minVal + qRound(step * i);
// 计算在横线上的 X 坐标
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);
}
QWidget::paintEvent(event); QWidget::paintEvent(event);
} }

View File

@ -225,10 +225,10 @@ public:
Qt::PenStyle m_cp_lineStyle; // 线型 Qt::PenStyle m_cp_lineStyle; // 线型
double m_cp_leftScale = 0; // 左刻度 double m_cp_leftScale = 0; // 左刻度
double m_cp_rightScale = 100; // 右刻度 double m_cp_rightScale = 100; // 右刻度
int m_cp_scaleDivisionsOrCustom = 2; // 等分刻度数或自定序列 int m_cp_scaleDivisionsOrCustom = 1; // 等分刻度数或自定序列
int m_cp_scaleType = 0; // 刻度类型 int m_cp_scaleType = 0; // 刻度类型
QFont m_cp_curveUnit; // 曲线单位 QFont m_cp_curveUnit = QFont("微软雅黑", 7); // 曲线单位
QFont m_cp_curveScale; // 曲线刻度 QFont m_cp_curveScale = QFont("微软雅黑", 7); // 曲线刻度
bool m_cp_drawAsBar = true; // 杆状 bool m_cp_drawAsBar = true; // 杆状
bool m_cp_leftBoundary = true; // 左界 bool m_cp_leftBoundary = true; // 左界
bool m_cp_skipZeroInvalidValues = false; // 不绘零等无效值 bool m_cp_skipZeroInvalidValues = false; // 不绘零等无效值

View File

@ -681,11 +681,11 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString
formInfo->m_strAliasName = listOtherProperty[3]; formInfo->m_strAliasName = listOtherProperty[3];
// 线宽 // 线宽
formInfo->m_cp_lineWidth = listOtherProperty[4].toInt(); formInfo->m_cp_lineWidth = listOtherProperty[4].toInt();
QVariantList listCond; QVariantMap variantMap;
listCond.append(listOtherProperty[4].toInt()); variantMap["lineWidth"] = listOtherProperty[4].toInt();
// 线条颜色 // 线条颜色
formInfo->m_cp_lineColor = listOtherProperty[5]; formInfo->m_cp_lineColor = listOtherProperty[5];
listCond.append(listOtherProperty[5]); variantMap["lineColor"] = listOtherProperty[5];
// 线型 // 线型
Qt::PenStyle newStyle = Qt::SolidLine; Qt::PenStyle newStyle = Qt::SolidLine;
int iStyle = listOtherProperty[6].toInt(); int iStyle = listOtherProperty[6].toInt();
@ -719,7 +719,7 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString
break; break;
} }
formInfo->m_cp_lineStyle = newStyle; formInfo->m_cp_lineStyle = newStyle;
listCond.append(listOtherProperty[6].toInt()); variantMap["lineStyle"] = (listOtherProperty[6].toInt());
// 左刻度 // 左刻度
formInfo->m_cp_leftScale = listOtherProperty[7].toInt(); formInfo->m_cp_leftScale = listOtherProperty[7].toInt();
formInfo->m_vmin = listOtherProperty[7].toInt(); formInfo->m_vmin = listOtherProperty[7].toInt();
@ -764,36 +764,36 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString
} }
// 杆状 // 杆状
formInfo->m_cp_drawAsBar = (listOtherProperty[15] == "1"); formInfo->m_cp_drawAsBar = (listOtherProperty[15] == "1");
listCond.append(formInfo->m_cp_drawAsBar); variantMap["drawAsBar"] = (formInfo->m_cp_drawAsBar);
// 左界 // 左界
formInfo->m_cp_leftBoundary = (listOtherProperty[16] == "1"); formInfo->m_cp_leftBoundary = (listOtherProperty[16] == "1");
listCond.append(formInfo->m_cp_leftBoundary); variantMap["leftBoundary"] = (formInfo->m_cp_leftBoundary);
// 不绘零等无效值 // 不绘零等无效值
formInfo->m_cp_skipZeroInvalidValues = (listOtherProperty[17] == "1"); formInfo->m_cp_skipZeroInvalidValues = (listOtherProperty[17] == "1");
listCond.append(formInfo->m_cp_skipZeroInvalidValues); variantMap["skipZeroInvalidValues"] = (formInfo->m_cp_skipZeroInvalidValues);
// 绘制包络线 // 绘制包络线
formInfo->m_cp_drawEnvelope = (listOtherProperty[18] == "1"); formInfo->m_cp_drawEnvelope = (listOtherProperty[18] == "1");
listCond.append(formInfo->m_cp_drawEnvelope); variantMap["drawEnvelope"] = (formInfo->m_cp_drawEnvelope);
// 点状 // 点状
formInfo->m_cp_drawAsDot = (listOtherProperty[19] == "1"); formInfo->m_cp_drawAsDot = (listOtherProperty[19] == "1");
listCond.append(formInfo->m_cp_drawAsDot); variantMap["drawAsDot"] = (formInfo->m_cp_drawAsDot);
// 符号类型 // 符号类型
formInfo->m_cp_symbolType = listOtherProperty[20].toInt(); formInfo->m_cp_symbolType = listOtherProperty[20].toInt();
listCond.append(formInfo->m_cp_symbolType); variantMap["symbolType"] = (formInfo->m_cp_symbolType);
// 边框颜色 // 边框颜色
formInfo->m_cp_symbolBorderColor = listOtherProperty[21]; formInfo->m_cp_symbolBorderColor = listOtherProperty[21];
listCond.append(formInfo->m_cp_symbolBorderColor); variantMap["symbolBorderColor"] = formInfo->m_cp_symbolBorderColor;
// 大小 // 大小
formInfo->m_cp_symbolSize = listOtherProperty[22].toInt(); formInfo->m_cp_symbolSize = listOtherProperty[22].toInt();
listCond.append(formInfo->m_cp_symbolSize); variantMap["symbolSize"] = (formInfo->m_cp_symbolSize);
// 填充颜色 // 填充颜色
formInfo->m_cp_symbolFillColor = listOtherProperty[23]; formInfo->m_cp_symbolFillColor = listOtherProperty[23];
listCond.append(formInfo->m_cp_symbolFillColor); variantMap["symbolFillColor"] = (formInfo->m_cp_symbolFillColor);
// 字段名称 // 字段名称
formInfo->m_cp_fieldName = listOtherProperty[24].toInt(); formInfo->m_cp_fieldName = listOtherProperty[24].toInt();
listCond.append(formInfo->m_cp_fieldName); variantMap["fieldName"] = (formInfo->m_cp_fieldName);
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(listCond); emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
} }
} }

View File

@ -438,11 +438,11 @@ void FormWell::slot_NewTrack_No_Line(QString strUuid, QJsonObject topObj, QJsonO
} }
} }
int nW = 0; double nW = 0;
if (topObj.contains("TrackW")) if (topObj.contains("TrackW"))
{ {
QJsonValue value = topObj.value("TrackW"); QJsonValue value = topObj.value("TrackW");
nW = value.toInt(); nW = value.toDouble();
} }
QStringList listdt; QStringList listdt;

View File

@ -91,7 +91,7 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
// 连接信号和槽 // 连接信号和槽
connect(ui->tableWidget_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint))); connect(ui->tableWidget_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)));
connect(this, SIGNAL(sig_NewTrackChangeWidth(QString, int)), this, SLOT(s_NewTrackChangeWidth(QString, int))); connect(this, SIGNAL(sig_NewTrackChangeWidth(QString, double)), this, SLOT(s_NewTrackChangeWidth(QString, double)));
//connect(this, SIGNAL(sig_NewWell(QString, QString)), this, SLOT(s_NewWell(QString, QString))); //connect(this, SIGNAL(sig_NewWell(QString, QString)), this, SLOT(s_NewWell(QString, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
@ -2611,7 +2611,7 @@ void MainWindowCurve::onItemClicked(QTableWidgetItem* item)
PropertyService()->initWellProperty(m_strUuid, strSlfName, strWellName, m_iY1, m_iY2); PropertyService()->initWellProperty(m_strUuid, strSlfName, strWellName, m_iY1, m_iY2);
//取消所有选中单元格 //取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(m_strUuid, strSlfName, strWellName, "", "", 0, ""); emit CallManage::getInstance()->sig_Raise(m_strUuid, strSlfName, strWellName, "", "", 1, "");
} }
@ -3365,7 +3365,7 @@ void MainWindowCurve::s_NewTDT()
emit CallManage::getInstance()->sig_NewCol(dt); emit CallManage::getInstance()->sig_NewCol(dt);
} }
void MainWindowCurve::s_NewTrackChangeWidth(QString strWellName, int nW) void MainWindowCurve::s_NewTrackChangeWidth(QString strWellName, double nW)
{ {
qDebug() << "MainWindowCurve s_NewTrackChangeWidth"; qDebug() << "MainWindowCurve s_NewTrackChangeWidth";
@ -3419,7 +3419,7 @@ void MainWindowCurve::s_AddLine_Property(QString strSlfName, QString strWellName
//新建井+道+曲线(首条) //新建井+道+曲线(首条)
void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName, QString strType) void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName, QString strType)
{ {
int nW = 0; double nW = 0;
if(strType=="SantuyibiaoObject") if(strType=="SantuyibiaoObject")
{ {
//斜井三图一表 //斜井三图一表
@ -4024,7 +4024,7 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray)
QJsonObject trackObj = trackValue.toObject(); QJsonObject trackObj = trackValue.toObject();
// //
QString strTrackName = ""; QString strTrackName = "";
int nTrackW = 0; double nTrackW = 0;
if (trackObj.contains("topinfo") && trackObj.contains("info")) if (trackObj.contains("topinfo") && trackObj.contains("info"))
{ {
QJsonValue topVal = trackObj.value("topinfo"); QJsonValue topVal = trackObj.value("topinfo");
@ -4037,7 +4037,7 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray)
DisplayTrack_Top(id, topObj, infoObj); DisplayTrack_Top(id, topObj, infoObj);
strTrackName = topObj.value("TrackName").toString(); strTrackName = topObj.value("TrackName").toString();
nTrackW = topObj.value("TrackW").toInt(); nTrackW = topObj.value("TrackW").toDouble();
} }
} }
// if (trackObj.contains("info")) // if (trackObj.contains("info"))
@ -4057,7 +4057,7 @@ void MainWindowCurve::DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject
{ {
//新建道+曲线 //新建道+曲线
s_NewTrack_No_Line(trackTop, trackInfo);//新建空白道,没有曲线 s_NewTrack_No_Line(trackTop, trackInfo);//新建空白道,没有曲线
if(id>0) //if(id>0)
{ {
QString strWellName = ""; QString strWellName = "";
if (trackTop.contains("WellName")) if (trackTop.contains("WellName"))
@ -4068,14 +4068,22 @@ void MainWindowCurve::DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject
qDebug() << "WellName:" << strWellName; qDebug() << "WellName:" << strWellName;
} }
} }
int nW = 0; double nW = 0;
if (trackTop.contains("TrackW")) if (trackTop.contains("TrackW"))
{ {
QJsonValue value = trackTop.value("TrackW"); QJsonValue value = trackTop.value("TrackW");
nW = value.toInt(); nW = value.toDouble();
} }
//改变井宽 //改变井宽
s_NewTrackChangeWidth(strWellName, nW * static_cast<int>(g_dPixelPerCm)); if(id==0)
{
//第一道默认减掉空井宽g_iOneWidth
s_NewTrackChangeWidth(strWellName, nW * g_dPixelPerCm - g_iOneWidth);
}
else
{
s_NewTrackChangeWidth(strWellName, nW * g_dPixelPerCm);
}
//mainWindowCurve->s_NewTrackChangeWidth(strWellName); //mainWindowCurve->s_NewTrackChangeWidth(strWellName);
} }
} }

View File

@ -136,7 +136,7 @@ public:
QStringList getLineList(QString strWellName, QString strTrackName); QStringList getLineList(QString strWellName, QString strTrackName);
signals: signals:
void sig_NewTrackChangeWidth(QString strWellName, int nW=0);//新建道后,改变井宽 void sig_NewTrackChangeWidth(QString strWellName, double nW=0);//新建道后,改变井宽
void sig_NewWell(QString strWellName); void sig_NewWell(QString strWellName);
public slots: public slots:
@ -168,7 +168,7 @@ public slots:
public slots: public slots:
void s_NewWell(QString strWellName, QString strSlfName);//新建井 void s_NewWell(QString strWellName, QString strSlfName);//新建井
void s_NewTrackChangeWidth(QString strWellName, int nW=0);//新建道后,改变井宽 void s_NewTrackChangeWidth(QString strWellName, double nW=0);//新建道后,改变井宽
void s_NewTrack_No_Line(QString strWellName, QString strTrackName);//新建空白道,没有曲线 void s_NewTrack_No_Line(QString strWellName, QString strTrackName);//新建空白道,没有曲线
void s_NewTrack_No_Line(QJsonObject topObj, QJsonObject infoObj);//新建空白道,没有曲线 void s_NewTrack_No_Line(QJsonObject topObj, QJsonObject infoObj);//新建空白道,没有曲线

View File

@ -144,7 +144,7 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList))); connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList)));
// 岩心分析 // 岩心分析
connect(CallManage::getInstance(), SIGNAL(sig_changeCorePhysicsProperty(QVariantList)), this, SLOT(s_changeCorePhysicsProperty(QVariantList))); connect(CallManage::getInstance(), SIGNAL(sig_changeCorePhysicsProperty(QVariantMap)), this, SLOT(s_changeCorePhysicsProperty(QVariantMap)));
//改变固井曲线名 //改变固井曲线名
connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString)));
@ -1999,8 +1999,48 @@ void QMyCustomPlot::addItemsImage(){
//属性清空 //属性清空
PropertyService()->InitCurrentViewInfo(); PropertyService()->InitCurrentViewInfo();
} }
void QMyCustomPlot::deleteItemsImage(){} void QMyCustomPlot::deleteItemsImage()
void QMyCustomPlot::refreshItemsImage(){} {
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
QString obj = m_strLineName + "BAK";
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
AddTableToWellRound();
//删除对象
TransparentDraggableImage *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Image.begin();
while( it != m_mapDraggable_Image.end() )
{
pDraggableRect = (TransparentDraggableImage*)it.value();
it++;
pDraggableRect->deleteRect();
}
this->replot();
//保存
SaveToSLFImage();
m_mapDraggable_Image.clear();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
void QMyCustomPlot::refreshItemsImage()
{
//删除对象
TransparentDraggableImage *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Image.begin();
while( it != m_mapDraggable_Image.end() )
{
pDraggableRect = (TransparentDraggableImage*)it.value();
it++;
pDraggableRect->deleteRect();
}
//重新加载
this->LoadFromIMAGE_SLF(m_strSlfName, m_strLineName);
this->replot();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
// 增加 // 增加
void QMyCustomPlot::addCorePhysics() void QMyCustomPlot::addCorePhysics()
@ -2012,6 +2052,10 @@ void QMyCustomPlot::addCorePhysics()
void QMyCustomPlot::addCorePhysicsWithParam(int Order, double Depth, double CorrDepth, double CoreValue) void QMyCustomPlot::addCorePhysicsWithParam(int Order, double Depth, double CorrDepth, double CoreValue)
{ {
// qDebug() << Order << "=====";
// qDebug() << Depth << "=====";
// qDebug() << CorrDepth << "=====";
// qDebug() << CoreValue << "=====";
QtCommonClass *qtCommon = new QtCommonClass(this); QtCommonClass *qtCommon = new QtCommonClass(this);
QString strUuid = qtCommon->getUUid(); QString strUuid = qtCommon->getUUid();
TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid); TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
@ -2030,10 +2074,48 @@ void QMyCustomPlot::pasteCorePhysics()
{} {}
//全部清空 //全部清空
void QMyCustomPlot::deleteCorePhysics() void QMyCustomPlot::deleteCorePhysics()
{} {
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
QString obj = m_strLineName + "BAK";
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
AddTableToWellRound();
//删除对象
TransparentDraggableCorePhysics *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_CorePhysics.begin();
while( it != m_mapDraggable_CorePhysics.end() )
{
pDraggableRect = (TransparentDraggableCorePhysics*)it.value();
it++;
pDraggableRect->deleteRect();
}
m_SelectShiftLine = nullptr;
this->replot();
//保存
saveToSLFCorePhysics();
m_mapDraggable_CorePhysics.clear();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//刷新数据 //刷新数据
void QMyCustomPlot::refreshCorePhysics() void QMyCustomPlot::refreshCorePhysics()
{} {
//删除对象
TransparentDraggableCorePhysics *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_CorePhysics.begin();
while( it != m_mapDraggable_CorePhysics.end() )
{
pDraggableRect = (TransparentDraggableCorePhysics*)it.value();
it++;
pDraggableRect->deleteRect();
}
//重新加载
this->loadFromSLFCorePhysics(m_strSlfName, m_strLineName);
this->replot();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//右键--添加录井剖面 //右键--添加录井剖面
void QMyCustomPlot::onEditGeoLith() void QMyCustomPlot::onEditGeoLith()
@ -3088,10 +3170,10 @@ void QMyCustomPlot::addItem_SWallCore()
int CoreColor=0; int CoreColor=0;
if (liths.size()>=CoreLith) if (liths.size()>=CoreLith)
{ {
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".svg"; LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths[CoreLith-1]+".svg";
QDir ss(LithologyImage); QDir ss(LithologyImage);
if(!ss.exists()) { if(!ss.exists()) {
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".png"; LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths[CoreLith-1]+".png";
} }
} }
if (CoreOil>0&&oils.size()>=CoreOil) if (CoreOil>0&&oils.size()>=CoreOil)
@ -3252,10 +3334,10 @@ void QMyCustomPlot::AddItem_SWallCore(QStringList lists)
} }
else if (liths_SWallCore.size()>=m_Result.CoreLith) else if (liths_SWallCore.size()>=m_Result.CoreLith)
{ {
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg"; LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg";
QDir ss(LithologyImage); QDir ss(LithologyImage);
if(!ss.exists()) { if(!ss.exists()) {
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png"; LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png";
} }
} }
if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil) if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil)
@ -3678,6 +3760,148 @@ void QMyCustomPlot::RefreshItems_GeoLith()
PropertyService()->InitCurrentViewInfo(); PropertyService()->InitCurrentViewInfo();
} }
bool QMyCustomPlot::LoadFromIMAGE_SLF(QString strSlfName, QString strLineName)
{
{
QString ss=strSlfName;
CMemRdWt *logio=new CMemRdWt();
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
return false;
}
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
if(iIndex>-1) {
int len=logio->GetTableRecordLength(iIndex);
if(len<sizeof(IMAGE_DATA)) len=sizeof(IMAGE_DATA);
char*buf=new char[len+1];
IMAGE_DATA *m_Result=(IMAGE_DATA *)buf;
int count=logio->GetTableRecordCount(iIndex);
for(int i=0;i<count;i++) {
memset(m_Result,0,sizeof(IMAGE_DATA));
logio->ReadTable(iIndex,i+1,m_Result);
// WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth);
// if(!item) continue;
// OGWordsResultItem* pResult = dynamic_cast<OGWordsResultItem*>(item);
//logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Image,i+1);
// SetCharacters(m_Result->Words);
// fontColor=QColor(0,0,0,255);
// backgroundColor=QColor(255,255,255,255);
// wordfont.setFamily("黑体");
// wordfont.setPointSize(10);
//显示图片Image
QString filename=QString::fromLocal8Bit(m_Result->Image);
int pos=filename.lastIndexOf("\\");
int pos1=filename.lastIndexOf("/");
if(pos1>pos) pos=pos1;
if(filename.lastIndexOf(".")>-1) {
int aa=filename.lastIndexOf(".");
if(aa<pos) {
filename="";
}
}
this->addImageToPlot(-m_Result->EndDepth, -m_Result->StartDepth, filename, static_cast<double>(m_Result->Left), static_cast<double>(m_Result->Width));
}
logio->CloseTable(iIndex);
delete buf;
}
delete logio;
}
return true;
}
bool QMyCustomPlot::loadFromSLFCorePhysics(QString strSlfName, QString strLineName)
{
float vmax = 100;
float vmin = 0;
// 加载slf文件 开始
QVector<double> x, y;
Slf_CORE_PHYSICS *m_pResult=NULL;
CMemRdWt *logio=new CMemRdWt();
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
return false;
}
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
if(iIndex>-1) {
int FieldNo=0;
int count=logio->GetTableRecordCount(iIndex);
QString FieldName = "AC";
if(!FieldName.isEmpty()) {
static int err=0;
FieldNo=logio->GetTableFieldNo(iIndex,(char *)FieldName.toStdString().c_str());
if(FieldNo<0) {
if(!err)QMessageBox::information(nullptr, "提示", "岩心试验数据模块初始加载数据不成功,因为隐含"+FieldName+"字段在实际数据表中不存在,稍后请您重新选择有效字段!");
err++;
delete logio;
return false;
}
else err=0;
}
else {
delete logio;
return false;
}
int len=logio->GetTableRecordLength(iIndex);
m_pResult=(Slf_CORE_PHYSICS *)new char[len+1];
char buf[100];
for(int i=0;i<count;i++) {
logio->GetTableFieldData(iIndex,1,buf,i+1);
sscanf(buf,"%f",&m_pResult->Depth);
logio->GetTableFieldData(iIndex,2,buf,i+1);
sscanf(buf,"%f",&m_pResult->CorrDepth);
// logio->ReadTable(iIndex,i+1,m_pResult);
int Order = m_pResult->Order;
float depth = m_pResult->Depth;
float CorrDepth = m_pResult->CorrDepth;
float CoreValue = m_pResult->CoreValue;
logio->GetTableFieldData(iIndex,FieldNo,buf,i+1);
CoreValue=0;
sscanf(buf,"%f",&CoreValue);
//
if(i==0)
{
//最大值,最小值默认采用第一个有效值
//vmax = vmin = CoreValue;
//默认采用0-100范围
if(vmax<CoreValue)vmax=CoreValue;
if(vmin>CoreValue)vmin=CoreValue;
}
else
{
//
if(vmax<CoreValue)vmax=CoreValue;
if(vmin>CoreValue)vmin=CoreValue;
}
//
x.append(-CorrDepth);
y.append(CoreValue);
// 已经加载了slf文件内容 显示界面上
this->addCorePhysicsWithParam(Order, static_cast<double>(-depth), static_cast<double>(-CorrDepth), static_cast<double>(-CoreValue));
}
logio->CloseTable(iIndex);
delete m_pResult;
}
delete logio;
// 加载slf文件结束
return true;
}
bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineName) bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineName)
{ {
WALLCORE_DATA m_Result; WALLCORE_DATA m_Result;
@ -3739,10 +3963,10 @@ bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineNam
} }
else if (liths_SWallCore.size()>=m_Result.CoreLith) else if (liths_SWallCore.size()>=m_Result.CoreLith)
{ {
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg"; LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg";
QDir ss(LithologyImage); QDir ss(LithologyImage);
if(!ss.exists()) { if(!ss.exists()) {
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png"; LithologyImage=::GetSymbolDir()+"取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png";
} }
} }
if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil) if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil)
@ -4923,74 +5147,121 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist)
} }
// 岩心分析 // 岩心分析
void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantList vlist) void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap)
{ {
int lineWidth = vlist.at(0).toInt(); TransparentDraggableCorePhysics *tdCorePhysics = NULL;
QColor lineColor = vlist[1].value<QColor>(); for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
int iStyle = vlist.at(2).toInt(); {
Qt::PenStyle newStyle = Qt::SolidLine; tdCorePhysics = (TransparentDraggableCorePhysics*)iter.value();
switch(iStyle) // 线宽
if(variantMap["lineWidth"].isValid())
{
tdCorePhysics->setCpLineWidth(variantMap["lineWidth"].toInt());
}
// 颜色
if(variantMap["lineColor"].isValid())
{
tdCorePhysics->setCpLineColor(variantMap["lineColor"].value<QColor>());
}
// 线形
if(variantMap["lineStyle"].isValid())
{
int lineStyle = variantMap["lineStyle"].toInt();
Qt::PenStyle penStyle = Qt::SolidLine;
switch(lineStyle)
{ {
case 0: case 0:
//无 //无
newStyle = Qt::NoPen; penStyle = Qt::NoPen;
break; break;
case 1: case 1:
//实线 //实线
newStyle = Qt::SolidLine; penStyle = Qt::SolidLine;
break; break;
case 2: case 2:
//虚线 //虚线
newStyle = Qt::DashLine; penStyle = Qt::DashLine;
break; break;
case 3: case 3:
//点线 //点线
newStyle = Qt::DotLine; penStyle = Qt::DotLine;
break; break;
case 4: case 4:
//虚点线 //虚点线
newStyle = Qt::DashDotLine; penStyle = Qt::DashDotLine;
break; break;
case 5: case 5:
//虚点点线 //虚点点线
newStyle = Qt::DashDotDotLine; penStyle = Qt::DashDotDotLine;
break; break;
default: default:
break; break;
} }
tdCorePhysics->setCpLineStyle(penStyle);
}
// 杆状 // 杆状
bool drawAsBar = vlist.at(3).toBool(); if(variantMap["drawAsBar"].isValid())
// 左界
bool leftBoundary = vlist.at(4).toBool();
// 不绘零等无效值
bool skipZeroInvalidValues = vlist.at(5).toBool();
// 绘制包络线
bool drawEnvelope = vlist.at(6).toBool();
// 点状
bool drawAsDot = vlist.at(7).toBool();
// 符号类型
int symbolType = vlist.at(8).toInt();
// 边框颜色
QColor symbolBorderColor = vlist[9].value<QColor>();
// 大小
int symbolSize = vlist.at(10).toInt();
// 填充颜色
QColor symbolFillColor = vlist[11].value<QColor>();
TransparentDraggableCorePhysics *pDraggableRect =NULL;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_CorePhysics.begin(); iter != m_mapDraggable_CorePhysics.end(); iter++)
{ {
pDraggableRect = (TransparentDraggableCorePhysics*)iter.value(); tdCorePhysics->setCpDrawAsBar(variantMap["drawAsBar"].toBool());
pDraggableRect->setCpLineWidth(lineWidth); }
pDraggableRect->setCpLineColor(lineColor); // 左界
pDraggableRect->setCpLineStyle(newStyle); if(variantMap["leftBoundary"].isValid())
pDraggableRect->setCpDrawAsBar(drawAsBar); {
pDraggableRect->setCpLeftBoundary(leftBoundary); bool aa = variantMap["leftBoundary"].toBool();
pDraggableRect->setCpDrawAsDot(drawAsDot); tdCorePhysics->setCpLeftBoundary(aa);
pDraggableRect->setCpSymbolType(symbolType); }
pDraggableRect->setCpSymbolBorderColor(symbolBorderColor); // 不绘零等无效值
pDraggableRect->setCpSymbolSize(symbolSize); if(variantMap["skipZeroInvalidValues"].isValid())
pDraggableRect->setCpSymbolFillColor(symbolFillColor); {
tdCorePhysics->setCpSkipZeroInvalidValues(variantMap["skipZeroInvalidValues"].toBool());
}
// 绘制包络线
if(variantMap["drawEnvelope"].isValid())
{
tdCorePhysics->setCpDrawEnvelope(variantMap["drawEnvelope"].toBool());
}
// 点状
if(variantMap["drawAsDot"].isValid())
{
tdCorePhysics->setCpDrawAsDot(variantMap["drawAsDot"].toBool());
}
// 符号类型
if(variantMap["symbolType"].isValid())
{
tdCorePhysics->setCpSymbolType(variantMap["symbolType"].toInt());
}
// 边框颜色
if(variantMap["symbolBorderColor"].isValid())
{
tdCorePhysics->setCpSymbolBorderColor(variantMap["symbolBorderColor"].value<QColor>());
}
// 大小
if(variantMap["symbolSize"].isValid())
{
tdCorePhysics->setCpSymbolSize(variantMap["symbolSize"].toInt());
}
// 填充颜色
if(variantMap["symbolFillColor"].isValid())
{
tdCorePhysics->setCpSymbolFillColor(variantMap["symbolFillColor"].value<QColor>());
}
// 左刻度
if(variantMap["leftScale"].isValid())
{
tdCorePhysics->setCpLeftScale(variantMap["leftScale"].toDouble());
}
// 右刻度
if(variantMap["rightScale"].isValid())
{
tdCorePhysics->setCpRightScale(variantMap["rightScale"].toDouble());
}
// 刻度类型
if(variantMap["scaleType"].isValid())
{
tdCorePhysics->setCpScaleType(variantMap["scaleType"].toInt());
}
} }
this->replot(); this->replot();
} }
@ -6870,7 +7141,7 @@ void QMyCustomPlot::DrawTubing()
} }
if(m_bDrawTubing_Tubing) if(m_bDrawTubing_Tubing)
{ {
QString shotimgfile=GetSymbolDir()+"\\管柱组件\\管柱.png"; QString shotimgfile=GetSymbolDir()+"管柱组件\\管柱.png";
double lY1 = 0;//this->yAxis->range().lower;//+10 double lY1 = 0;//this->yAxis->range().lower;//+10
double lY2 = m_OutD_Tubing;//this->yAxis->range().upper - this->yAxis->range().lower; //this->yAxis->range().upper; double lY2 = m_OutD_Tubing;//this->yAxis->range().upper - this->yAxis->range().lower; //this->yAxis->range().upper;
@ -9028,7 +9299,7 @@ bool QMyCustomPlot::LoadFromSLF_Tubing(QString strSlfName, QString csCurve)
{ {
m_pResultList_Tubing.clear(); m_pResultList_Tubing.clear();
cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\"; cclimgpath_Tubing=GetSymbolDir()+"管柱组件\\";
//先删除 //先删除
if(mPixmap_Tubing) if(mPixmap_Tubing)
{ {
@ -9169,7 +9440,7 @@ void QMyCustomPlot::drawOne_Tubing(Slf_JIEGUPOS result)
bool QMyCustomPlot::LoadFromSLF_ReDrawTubing(QString strSlfName, QString csCurve) bool QMyCustomPlot::LoadFromSLF_ReDrawTubing(QString strSlfName, QString csCurve)
{ {
cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\"; cclimgpath_Tubing=GetSymbolDir()+"管柱组件\\";
Slf_JIEGUPOS *m_pResult=NULL; Slf_JIEGUPOS *m_pResult=NULL;
CMemRdWt *logio=new CMemRdWt(); CMemRdWt *logio=new CMemRdWt();

View File

@ -227,10 +227,12 @@ public:
// 岩心图片 // 岩心图片
QMap<QString,QString> zoneOrderImage; QMap<QString,QString> zoneOrderImage;
bool SaveToSLFImage(); bool SaveToSLFImage();
bool LoadFromIMAGE_SLF(QString strSlfName, QString strLineName);
// 岩心分析 // 岩心分析
QMap<QString,QString> zoneOrderCorePhysics; QMap<QString,QString> zoneOrderCorePhysics;
bool saveToSLFCorePhysics(); bool saveToSLFCorePhysics();
bool loadFromSLFCorePhysics(QString strSlfName, QString strLineName);
//井壁取心 //井壁取心
QStringList liths_SWallCore; QStringList liths_SWallCore;
@ -551,7 +553,7 @@ public slots:
void s_changeDepthProperty(QVariantList vlist); void s_changeDepthProperty(QVariantList vlist);
// 岩心分析 // 岩心分析
void s_changeCorePhysicsProperty(QVariantList vlist); void s_changeCorePhysicsProperty(QVariantMap vlist);
void onAddRect(); void onAddRect();

View File

@ -216,6 +216,7 @@ void QtProjectWidgets::s_loadTreeWidget(QString fileFull)
//展开树图 //展开树图
ui->treeWidget->expandItem(parent); ui->treeWidget->expandItem(parent);
itemIndex->setExpanded(true);
} }
void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFull, QString prjname) void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFull, QString prjname)
@ -1286,23 +1287,39 @@ void QtProjectWidgets::onImportSingleWellLogData()
QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin(); QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin();
QString wellname = wellItem->text(0); QString wellname = wellItem->text(0);
if (wellname == "井组") QString wellroundname = wellname;
QString strTreeTag = wellItem->data(0, Qt::UserRole).toString();
if (strTreeTag == "wells") //井组
{ {
QFileInfo temDir(file_name); QFileInfo temDir(file_name);
QString tempWellName=temDir.completeBaseName(); QString tempWellName=temDir.completeBaseName();
tempWellName.replace(" ","");//whp add 2020.3.3 删除井名中的空格 tempWellName.replace(" ","");//whp add 2020.3.3 删除井名中的空格
//m_WellLogRoundInfo->SetName(tempWellName.toStdString()); //m_WellLogRoundInfo->SetName(tempWellName.toStdString());
wellname = tempWellName; wellname = tempWellName;
wellroundname = wellname;
}
else if (strTreeTag == "wellname") //井名
{
}
else if (strTreeTag == "wellItem") //井次
{
wellname = wellItem->parent()->text(0);
} }
QString wellroundname = wellname;
ImportDataDialog *pDialog = new ImportDataDialog(NULL,wellname,wellroundname); ImportDataDialog *pDialog = new ImportDataDialog(NULL,wellname,wellroundname);
QTreeWidgetItem rootItem = *ui->treeWidget->topLevelItem(0); QTreeWidgetItem rootItem = *ui->treeWidget->topLevelItem(0);
pDialog->SetProjectname(rootItem.text(0)); pDialog->SetProjectname(rootItem.text(0));
pDialog->DisplayFileInformationAreaData(vConvertor,listFiles[0]); pDialog->DisplayFileInformationAreaData(vConvertor,listFiles[0]);
if ( pDialog->exec() == QDialog::Accepted ) if ( pDialog->exec() == QDialog::Accepted )
{
QString strProjectFolder = GetProjectFolder();
QString strProjectFile = strProjectFolder + g_prjname;
strProjectFile += ".wwl";
s_OpenProject(strProjectFile);
return ; return ;
} }
} }
}
void QtProjectWidgets::onImportSlfTable() void QtProjectWidgets::onImportSlfTable()
{ {