岩心分析 属性
This commit is contained in:
parent
4ca74326e8
commit
0ddd73f8bd
File diff suppressed because it is too large
Load Diff
|
|
@ -130,6 +130,8 @@ 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);
|
||||||
|
|
@ -197,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(this->getCpLineColor()); // 线宽
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
@ -544,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
|
||||||
|
|
@ -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;
|
||||||
}
|
//}
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,8 @@ 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);
|
||||||
|
|
@ -143,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; // 深度
|
||||||
|
|
@ -179,7 +179,6 @@ public:
|
||||||
double m_lY1 = 0;
|
double m_lY1 = 0;
|
||||||
// 添加最小宽度成员变量
|
// 添加最小宽度成员变量
|
||||||
double mMinWidth;
|
double mMinWidth;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSPARENTDRAGGABLECOREPHYSICS_H
|
#endif // TRANSPARENTDRAGGABLECOREPHYSICS_H
|
||||||
|
|
|
||||||
|
|
@ -1937,6 +1937,7 @@ void QMyCustomPlot::deleteItemsImage()
|
||||||
|
|
||||||
//保存
|
//保存
|
||||||
SaveToSLFImage();
|
SaveToSLFImage();
|
||||||
|
m_mapDraggable_Image.clear();
|
||||||
//属性清空
|
//属性清空
|
||||||
PropertyService()->InitCurrentViewInfo();
|
PropertyService()->InitCurrentViewInfo();
|
||||||
}
|
}
|
||||||
|
|
@ -2006,10 +2007,12 @@ void QMyCustomPlot::deleteCorePhysics()
|
||||||
it++;
|
it++;
|
||||||
pDraggableRect->deleteRect();
|
pDraggableRect->deleteRect();
|
||||||
}
|
}
|
||||||
|
m_SelectShiftLine = nullptr;
|
||||||
this->replot();
|
this->replot();
|
||||||
|
|
||||||
//保存
|
//保存
|
||||||
saveToSLFCorePhysics();
|
saveToSLFCorePhysics();
|
||||||
|
m_mapDraggable_CorePhysics.clear();
|
||||||
//属性清空
|
//属性清空
|
||||||
PropertyService()->InitCurrentViewInfo();
|
PropertyService()->InitCurrentViewInfo();
|
||||||
}
|
}
|
||||||
|
|
@ -5122,9 +5125,9 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap)
|
||||||
// 左界
|
// 左界
|
||||||
if(variantMap["leftBoundary"].isValid())
|
if(variantMap["leftBoundary"].isValid())
|
||||||
{
|
{
|
||||||
tdCorePhysics->setCpLeftBoundary(variantMap["leftBoundary"].toBool());
|
bool aa = variantMap["leftBoundary"].toBool();
|
||||||
|
tdCorePhysics->setCpLeftBoundary(aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不绘零等无效值
|
// 不绘零等无效值
|
||||||
if(variantMap["skipZeroInvalidValues"].isValid())
|
if(variantMap["skipZeroInvalidValues"].isValid())
|
||||||
{
|
{
|
||||||
|
|
@ -5171,7 +5174,6 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap)
|
||||||
{
|
{
|
||||||
tdCorePhysics->setCpRightScale(variantMap["rightScale"].toDouble());
|
tdCorePhysics->setCpRightScale(variantMap["rightScale"].toDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 刻度类型
|
// 刻度类型
|
||||||
if(variantMap["scaleType"].isValid())
|
if(variantMap["scaleType"].isValid())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user