岩心分析左右刻度属性
This commit is contained in:
parent
8e3062931c
commit
05ae5043e9
|
|
@ -454,28 +454,24 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
@ -485,6 +481,10 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
|
||||||
this->m_formInfo->m_cp_leftScale = temp;
|
this->m_formInfo->m_cp_leftScale = temp;
|
||||||
this->m_formInfo->repaint();
|
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;
|
||||||
|
|
@ -500,6 +500,10 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
|
||||||
this->m_formInfo->m_cp_rightScale = temp;
|
this->m_formInfo->m_cp_rightScale = temp;
|
||||||
this->m_formInfo->repaint();
|
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++)
|
||||||
|
|
@ -518,8 +522,8 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
|
||||||
}
|
}
|
||||||
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:
|
||||||
|
|
@ -536,6 +540,10 @@ void PropertyWidget::changedCorePhysicsProperty(QtProperty *qtProperty, const QV
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this->m_formInfo->m_cp_scaleType = newStyle;
|
this->m_formInfo->m_cp_scaleType = newStyle;
|
||||||
|
|
||||||
|
QVariantMap variantMap;
|
||||||
|
variantMap["scaleType"] = newStyle;
|
||||||
|
emit CallManage::getInstance()->sig_changeCorePhysicsProperty(variantMap);
|
||||||
// this->m_tdCorePhysics->setCpScaleType(newStyle);
|
// this->m_tdCorePhysics->setCpScaleType(newStyle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,38 @@ void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hig
|
||||||
// lY2除以实际左到右刻度数值
|
// lY2除以实际左到右刻度数值
|
||||||
// lY2 = lY2 / (getCpRightScale() - getCpLeftScale()) * 100;
|
// 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)
|
||||||
|
{
|
||||||
|
// 线性(原来的公式)
|
||||||
|
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);//圆心位置
|
||||||
qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置
|
qcpItemLine->end->setCoords(right_Hight, lY2);//圆心位置
|
||||||
|
|
@ -372,60 +404,44 @@ void TransparentDraggableCorePhysics::setCpLineStyle(Qt::PenStyle value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//double TransparentDraggableCorePhysics::getCpLeftScale() const
|
double TransparentDraggableCorePhysics::getCpLeftScale() const
|
||||||
//{
|
{
|
||||||
// return this->m_cp_leftScale;
|
return this->m_cp_leftScale;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//void TransparentDraggableCorePhysics::setCpLeftScale(double value)
|
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);
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
//double TransparentDraggableCorePhysics::getCpRightScale() const
|
double TransparentDraggableCorePhysics::getCpRightScale() const
|
||||||
//{
|
{
|
||||||
// return this->m_cp_rightScale;
|
return this->m_cp_rightScale;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//void TransparentDraggableCorePhysics::setCpRightScale(double value)
|
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);
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
//int TransparentDraggableCorePhysics::getCpScaleType() const
|
int TransparentDraggableCorePhysics::getCpScaleType() const
|
||||||
//{
|
{
|
||||||
// return this->m_cp_scaleType;
|
return this->m_cp_scaleType;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//void TransparentDraggableCorePhysics::setCpScaleType(int value)
|
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
|
||||||
//{
|
//{
|
||||||
|
|
@ -642,7 +658,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
|
||||||
|
|
|
||||||
|
|
@ -63,14 +63,14 @@ public:
|
||||||
Qt::PenStyle getCpLineStyle() const;
|
Qt::PenStyle getCpLineStyle() const;
|
||||||
void setCpLineStyle(Qt::PenStyle value);
|
void setCpLineStyle(Qt::PenStyle value);
|
||||||
|
|
||||||
// double getCpLeftScale() const;
|
double getCpLeftScale() const;
|
||||||
// void setCpLeftScale(double value);
|
void setCpLeftScale(double value);
|
||||||
|
|
||||||
// double getCpRightScale() const;
|
double getCpRightScale() const;
|
||||||
// void setCpRightScale(double value);
|
void setCpRightScale(double value);
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
@ -126,9 +126,9 @@ private:
|
||||||
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; // 曲线名称
|
||||||
|
|
|
||||||
|
|
@ -852,8 +852,6 @@ void FormInfo::paintEvent(QPaintEvent* event)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
painter.setFont(oldFont);
|
painter.setFont(oldFont);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget::paintEvent(event);
|
QWidget::paintEvent(event);
|
||||||
|
|
|
||||||
|
|
@ -4944,6 +4944,23 @@ void QMyCustomPlot::s_changeCorePhysicsProperty(QVariantMap variantMap)
|
||||||
{
|
{
|
||||||
tdCorePhysics->setCpSymbolFillColor(variantMap["symbolFillColor"].value<QColor>());
|
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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user