岩心分析 属性
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()
|
||||
{
|
||||
|
||||
|
||||
// 连接鼠标事件
|
||||
connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableCorePhysics::onMousePress);
|
||||
connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableCorePhysics::onMouseMove);
|
||||
|
|
@ -197,17 +199,13 @@ void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event)
|
|||
{
|
||||
//之前的选中线段,恢复黑色
|
||||
TransparentDraggableCorePhysics *tmpLine = (TransparentDraggableCorePhysics*)mPlot->m_SelectShiftLine;
|
||||
QPen pen = tmpLine->qcpItemLine->pen();
|
||||
// pen.setWidth(getCpLineWidth());
|
||||
pen.setColor(this->getCpLineColor()); // 线宽
|
||||
QPen pen = tmpLine->qcpItemLine->pen(); // 现在这里绝对安全
|
||||
pen.setColor(this->getCpLineColor());
|
||||
tmpLine->qcpItemLine->setPen(pen);
|
||||
// tmpLine->qcpItemLine->setPen(QPen(Qt::black));
|
||||
}
|
||||
|
||||
//重新设置选中线段
|
||||
mPlot->m_SelectShiftLine = this;
|
||||
QPen pen = qcpItemLine->pen();
|
||||
// pen.setWidth(getCpLineWidth());
|
||||
pen.setColor(Qt::red);
|
||||
qcpItemLine->setPen(pen);
|
||||
|
||||
|
|
@ -544,17 +542,28 @@ bool TransparentDraggableCorePhysics::getCpLeftBoundary() const
|
|||
void TransparentDraggableCorePhysics::setCpLeftBoundary(bool value)
|
||||
{
|
||||
this->m_cp_leftBoundary = value;
|
||||
// 由于 X轴↔Y轴 互换,"水平翻转"变成关于 Y轴中心对称
|
||||
double y_center = (this->mPlot->yAxis->range().lower + this->mPlot->yAxis->range().upper) / 2;
|
||||
|
||||
// 获取原坐标(注意:此时 coords() 返回的是互换后的坐标)
|
||||
QPointF start = this->qcpItemLine->start->coords();
|
||||
QPointF end = this->qcpItemLine->end->coords();
|
||||
|
||||
// 翻转:Y轴不变(实际是视觉上的X轴),X轴镜像(实际是视觉上的Y轴)
|
||||
// 但由于轴互换了,我们需要翻转的是 y 坐标
|
||||
this->qcpItemLine->start->setCoords(start.x(), 2 * y_center - start.y());
|
||||
this->qcpItemLine->end->setCoords(end.x(), 2 * y_center - end.y());
|
||||
double y_min = mPlot->yAxis->range().lower;
|
||||
double y_max = mPlot->yAxis->range().upper;
|
||||
double y_center = (y_min + y_max) / 2;
|
||||
QPointF start = qcpItemLine->start->coords();
|
||||
QPointF end = qcpItemLine->end->coords();
|
||||
double targetYStart, targetYEnd;
|
||||
if (value) {
|
||||
// ======================================
|
||||
// ✅ 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
|
||||
|
|
@ -680,12 +689,12 @@ void TransparentDraggableCorePhysics::setCpSymbolFillColor(QColor value)
|
|||
}
|
||||
}
|
||||
|
||||
int TransparentDraggableCorePhysics::getCpFieldName() const
|
||||
{
|
||||
return this->m_cp_fieldName;
|
||||
}
|
||||
//int TransparentDraggableCorePhysics::getCpFieldName() const
|
||||
//{
|
||||
// return this->m_cp_fieldName;
|
||||
//}
|
||||
|
||||
void TransparentDraggableCorePhysics::setCpFieldName(const int &value)
|
||||
{
|
||||
this->m_cp_fieldName = value;
|
||||
}
|
||||
//void TransparentDraggableCorePhysics::setCpFieldName(const int &value)
|
||||
//{
|
||||
// this->m_cp_fieldName = value;
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ public:
|
|||
QColor getCpSymbolFillColor() const;
|
||||
void setCpSymbolFillColor(QColor value);
|
||||
|
||||
int getCpFieldName() const;
|
||||
void setCpFieldName(const int &value);
|
||||
// int getCpFieldName() const;
|
||||
// void setCpFieldName(const int &value);
|
||||
|
||||
signals:
|
||||
void rangeChanged(QCPRange newRange);
|
||||
|
|
@ -143,7 +143,7 @@ private:
|
|||
QColor m_cp_symbolBorderColor; // 边框颜色
|
||||
int m_cp_symbolSize; // 大小
|
||||
QColor m_cp_symbolFillColor; // 填充颜色
|
||||
int m_cp_fieldName; // 字段名称
|
||||
// int m_cp_fieldName; // 字段名称
|
||||
// 这四个是slf文件保存读取的
|
||||
int m_cp_order; // 序号
|
||||
double m_cp_depth; // 深度
|
||||
|
|
@ -179,7 +179,6 @@ public:
|
|||
double m_lY1 = 0;
|
||||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLECOREPHYSICS_H
|
||||
|
|
|
|||
|
|
@ -1937,6 +1937,7 @@ void QMyCustomPlot::deleteItemsImage()
|
|||
|
||||
//保存
|
||||
SaveToSLFImage();
|
||||
m_mapDraggable_Image.clear();
|
||||
//属性清空
|
||||
PropertyService()->InitCurrentViewInfo();
|
||||
}
|
||||
|
|
@ -2006,10 +2007,12 @@ void QMyCustomPlot::deleteCorePhysics()
|
|||
it++;
|
||||
pDraggableRect->deleteRect();
|
||||
}
|
||||
m_SelectShiftLine = nullptr;
|
||||
this->replot();
|
||||
|
||||
//保存
|
||||
saveToSLFCorePhysics();
|
||||
m_mapDraggable_CorePhysics.clear();
|
||||
//属性清空
|
||||
PropertyService()->InitCurrentViewInfo();
|
||||
}
|
||||
|
|
@ -5122,9 +5125,9 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap)
|
|||
// 左界
|
||||
if(variantMap["leftBoundary"].isValid())
|
||||
{
|
||||
tdCorePhysics->setCpLeftBoundary(variantMap["leftBoundary"].toBool());
|
||||
bool aa = variantMap["leftBoundary"].toBool();
|
||||
tdCorePhysics->setCpLeftBoundary(aa);
|
||||
}
|
||||
|
||||
// 不绘零等无效值
|
||||
if(variantMap["skipZeroInvalidValues"].isValid())
|
||||
{
|
||||
|
|
@ -5171,7 +5174,6 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap)
|
|||
{
|
||||
tdCorePhysics->setCpRightScale(variantMap["rightScale"].toDouble());
|
||||
}
|
||||
|
||||
// 刻度类型
|
||||
if(variantMap["scaleType"].isValid())
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user