裂缝 属性 图形显示隐藏
This commit is contained in:
parent
5a5d87ebb4
commit
49027076d4
|
|
@ -184,6 +184,8 @@ signals:
|
|||
//改变深度属性
|
||||
void sig_changeDepthProperty(QVariantList vlist);
|
||||
|
||||
// 改变裂缝属性
|
||||
void sig_changeCrackProperty(QVariantMap variantMap);
|
||||
// 改变频率统计图属性
|
||||
void sig_changePlObjectProperty(QVariantMap variantMap);
|
||||
// 改变玫瑰图属性
|
||||
|
|
|
|||
|
|
@ -4325,76 +4325,91 @@ void PropertyWidget::changedCrackProperty(QString strProperty, QVariant varVal)
|
|||
{
|
||||
this->m_formInfo->m_pl_highGap = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("高阻缝" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_highReservoir = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("网状缝" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_reticularFracture = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("诱导缝" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_inducedFracture = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("层理" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_bedLayer = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("侵蚀面" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_erosionSurface = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("孔洞" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_pore = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("气孔" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_vesicle = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("砾石" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_gravel = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("结核" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_nodule = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("团块" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_lumps = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("断层" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_fault = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("垂直缝" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_verticalFracture = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("自定义1" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_custom1 = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
else if ("自定义2" == strProperty)
|
||||
{
|
||||
this->m_formInfo->m_pl_custom2 = varVal.toBool();
|
||||
this->m_formInfo->repaint();
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if(flag)
|
||||
|
|
@ -4402,38 +4417,30 @@ void PropertyWidget::changedCrackProperty(QString strProperty, QVariant varVal)
|
|||
QVariantMap variantMap;
|
||||
// 必须用来判断当前道
|
||||
variantMap["m_strTrackName"] = this->m_formInfo->m_strTrackName;
|
||||
// 数据
|
||||
// 分类
|
||||
variantMap["m_pl_highGap"] = this->m_formInfo->m_pl_highGap;
|
||||
variantMap["m_pl_highReservoir"] = this->m_formInfo->m_pl_highReservoir;
|
||||
variantMap["m_pl_reticularFracture"] = this->m_formInfo->m_pl_reticularFracture;
|
||||
variantMap["m_pl_inducedFracture"] = this->m_formInfo->m_pl_inducedFracture;
|
||||
variantMap["m_pl_bedLayer"] = this->m_formInfo->m_pl_bedLayer;
|
||||
variantMap["m_pl_erosionSurface"] = this->m_formInfo->m_pl_erosionSurface;
|
||||
variantMap["m_pl_pore"] = this->m_formInfo->m_pl_pore;
|
||||
variantMap["m_pl_vesicle"] = this->m_formInfo->m_pl_vesicle;
|
||||
variantMap["m_pl_gravel"] = this->m_formInfo->m_pl_gravel;
|
||||
variantMap["m_pl_nodule"] = this->m_formInfo->m_pl_nodule;
|
||||
variantMap["m_pl_lumps"] = this->m_formInfo->m_pl_lumps;
|
||||
variantMap["m_pl_fault"] = this->m_formInfo->m_pl_fault;
|
||||
variantMap["m_pl_verticalFracture"] = this->m_formInfo->m_pl_verticalFracture;
|
||||
variantMap["m_pl_custom1"] = this->m_formInfo->m_pl_custom1;
|
||||
variantMap["m_pl_custom2"] = this->m_formInfo->m_pl_custom2;
|
||||
variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType;
|
||||
variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType;
|
||||
variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType;
|
||||
variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType;
|
||||
variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType;
|
||||
variantMap["m_pl_dataType"] = this->m_formInfo->m_pl_dataType;
|
||||
variantMap["m_pl_azimuthCurve"] = this->m_formInfo->m_pl_azimuthCurve;
|
||||
variantMap["m_pl_inclinationCurve"] = this->m_formInfo->m_pl_inclinationCurve;
|
||||
// 控制曲线
|
||||
variantMap["m_pl_controlCurveName"] = this->m_formInfo->m_pl_controlCurveName;
|
||||
variantMap["m_pl_controlMinValue"] = this->m_formInfo->m_pl_controlMinValue;
|
||||
variantMap["m_pl_controlMaxValue"] = this->m_formInfo->m_pl_controlMaxValue;
|
||||
|
||||
variantMap["m_pl_sectorCount"] = this->m_formInfo->m_pl_sectorCount;
|
||||
variantMap["m_pl_circleRadius"] = this->m_formInfo->m_pl_circleRadius;
|
||||
variantMap["m_pl_circleColor"] = this->m_formInfo->m_pl_circleColor;
|
||||
variantMap["m_pl_circleLineWidth"] = this->m_formInfo->m_pl_circleLineWidth;
|
||||
variantMap["m_pl_isFillEnabled"] = this->m_formInfo->m_pl_isFillEnabled;
|
||||
variantMap["m_pl_fillColor"] = this->m_formInfo->m_pl_fillColor;
|
||||
// 线数
|
||||
variantMap["m_pl_lineNumber"] = this->m_formInfo->m_pl_lineNumber;
|
||||
variantMap["m_pl_lineHeight"] = this->m_formInfo->m_pl_lineHeight;
|
||||
variantMap["m_pl_lineThickness"] = this->m_formInfo->m_pl_lineThickness;
|
||||
variantMap["m_pl_lineColor"] = this->m_formInfo->m_pl_lineColor;
|
||||
variantMap["m_pl_drawAnnotation"] = this->m_formInfo->m_pl_drawAnnotation;
|
||||
variantMap["m_pl_drawHistogram"] = this->m_formInfo->m_pl_drawHistogram;
|
||||
variantMap["m_pl_baselineWidth"] = this->m_formInfo->m_pl_baselineWidth;
|
||||
variantMap["m_pl_baselineColor"] = this->m_formInfo->m_pl_baselineColor;
|
||||
// 统计间隔
|
||||
variantMap["m_pl_statInterval"] = this->m_formInfo->m_pl_statInterval;
|
||||
variantMap["m_pl_minInclination"] = this->m_formInfo->m_pl_minInclination;
|
||||
variantMap["m_pl_maxInclination"] = this->m_formInfo->m_pl_maxInclination;
|
||||
|
||||
variantMap["m_strUuid"] = this->m_formInfo->m_strUuid;
|
||||
variantMap["m_strTrackName"] = this->m_formInfo->m_strTrackName;
|
||||
// emit CallManage::getInstance()->sig_changePlObjectProperty(variantMap);
|
||||
emit CallManage::getInstance()->sig_changeCrackProperty(variantMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "TransparentDraggableCrackObject.h"
|
||||
#include "TransparentDraggableCrackObject.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QDebug>
|
||||
|
|
@ -7,12 +7,9 @@
|
|||
QPointer<TransparentDraggableCrackObject> TransparentDraggableCrackObject::s_activeObject = nullptr;
|
||||
|
||||
TransparentDraggableCrackObject::TransparentDraggableCrackObject(QCustomPlot *parentPlot,
|
||||
const QString &strUuid,
|
||||
double depth,
|
||||
CurveType type)
|
||||
const QString &strUuid, double depth, QString type, QString showNames)
|
||||
: QObject(parentPlot)
|
||||
, mPlot(parentPlot)
|
||||
, m_type(type)
|
||||
, m_uuid(strUuid)
|
||||
, m_depth(depth)
|
||||
, m_endX(mPlot->xAxis->range().upper)
|
||||
|
|
@ -31,7 +28,169 @@ TransparentDraggableCrackObject::TransparentDraggableCrackObject(QCustomPlot *pa
|
|||
, m_draggingPoint(false)
|
||||
, m_draggedPointIndex(-1)
|
||||
{
|
||||
// 注意:不要在这里清除全局活动对象,否则会影响已创建的其他对象
|
||||
if("高导缝" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#FF0000");
|
||||
m_typeName = "高导缝";
|
||||
}
|
||||
else if("高阻缝" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#400040");
|
||||
m_typeName = "高阻缝";
|
||||
}
|
||||
else if("诱导缝" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#00FFFF");
|
||||
m_typeName = "诱导缝";
|
||||
}
|
||||
else if("层理" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#00FF00");
|
||||
m_typeName = "层理";
|
||||
}
|
||||
else if("侵蚀面" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#409600");
|
||||
m_typeName = "侵蚀面";
|
||||
}
|
||||
else if("断层" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#A65300");
|
||||
m_typeName = "断层";
|
||||
}
|
||||
else if("自定义1" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#000000");
|
||||
m_typeName = "自定义1";
|
||||
}
|
||||
else if("自定义2" == type)
|
||||
{
|
||||
m_type = TYPE_A;
|
||||
m_lineColor.setNamedColor("#000000");
|
||||
m_typeName = "自定义2";
|
||||
}
|
||||
else if("网状缝" == type)
|
||||
{
|
||||
m_type = TYPE_B;
|
||||
m_lineColor.setNamedColor("#808000");
|
||||
m_typeName = "网状缝";
|
||||
}
|
||||
else if("垂直缝" == type)
|
||||
{
|
||||
m_type = TYPE_B;
|
||||
m_lineColor.setNamedColor("#FF0000");
|
||||
m_typeName = "垂直缝";
|
||||
}
|
||||
else if("孔洞" == type)
|
||||
{
|
||||
m_type = TYPE_C;
|
||||
m_lineColor.setNamedColor("#FF8064");
|
||||
m_typeName = "孔洞";
|
||||
}
|
||||
else if("气孔" == type)
|
||||
{
|
||||
m_type = TYPE_C;
|
||||
m_lineColor.setNamedColor("#FFFF00");
|
||||
m_typeName = "气孔";
|
||||
}
|
||||
else if("砾石" == type)
|
||||
{
|
||||
m_type = TYPE_C;
|
||||
m_lineColor.setNamedColor("#000096");
|
||||
m_typeName = "砾石";
|
||||
}
|
||||
else if("结核" == type)
|
||||
{
|
||||
m_type = TYPE_C;
|
||||
m_lineColor.setNamedColor("#A65300");
|
||||
m_typeName = "结核";
|
||||
}
|
||||
else if("团块" == type)
|
||||
{
|
||||
m_type = TYPE_C;
|
||||
m_lineColor.setNamedColor("#000000");
|
||||
m_typeName = "团块";
|
||||
}
|
||||
|
||||
// 创建的时候判断是否显示
|
||||
// if(showNames.contains("高导缝"))
|
||||
// {
|
||||
// m_isShow = true;
|
||||
// }
|
||||
// else if(showNames.contains("高阻缝"))
|
||||
// {
|
||||
// m_isShow = true;
|
||||
// }
|
||||
// else if(showNames.contains("诱导缝"))
|
||||
// {
|
||||
// m_isShow = true;
|
||||
// }
|
||||
// else if(showNames.contains("层理"))
|
||||
// {
|
||||
// m_isShow = true;
|
||||
// }
|
||||
// else if(showNames.contains("侵蚀面"))
|
||||
// {
|
||||
// m_isShow = true;
|
||||
// }
|
||||
// else if("断层" == type)
|
||||
// {
|
||||
// m_type = TYPE_A;
|
||||
// m_lineColor.setNamedColor("#A65300");
|
||||
// }
|
||||
// else if("自定义1" == type)
|
||||
// {
|
||||
// m_type = TYPE_A;
|
||||
// m_lineColor.setNamedColor("#000000");
|
||||
// }
|
||||
// else if("自定义2" == type)
|
||||
// {
|
||||
// m_type = TYPE_A;
|
||||
// m_lineColor.setNamedColor("#000000");
|
||||
// }
|
||||
// else if("网状缝" == type)
|
||||
// {
|
||||
// m_type = TYPE_B;
|
||||
// m_lineColor.setNamedColor("#808000");
|
||||
// }
|
||||
// else if("垂直缝" == type)
|
||||
// {
|
||||
// m_type = TYPE_B;
|
||||
// m_lineColor.setNamedColor("#FF0000");
|
||||
// }
|
||||
// else if("孔洞" == type)
|
||||
// {
|
||||
// m_type = TYPE_C;
|
||||
// m_lineColor.setNamedColor("#FF8064");
|
||||
// }
|
||||
// else if("气孔" == type)
|
||||
// {
|
||||
// m_type = TYPE_C;
|
||||
// m_lineColor.setNamedColor("#FFFF00");
|
||||
// }
|
||||
// else if("砾石" == type)
|
||||
// {
|
||||
// m_type = TYPE_C;
|
||||
// m_lineColor.setNamedColor("#000096");
|
||||
// }
|
||||
// else if("结核" == type)
|
||||
// {
|
||||
// m_type = TYPE_C;
|
||||
// m_lineColor.setNamedColor("#A65300");
|
||||
// }
|
||||
// else if("团块" == type)
|
||||
// {
|
||||
// m_type = TYPE_C;
|
||||
// m_lineColor.setNamedColor("#000000");
|
||||
// }
|
||||
|
||||
|
||||
if (m_type == TYPE_A) {
|
||||
m_orig_x1 = m_endX * 0.18;
|
||||
|
|
@ -46,25 +205,34 @@ TransparentDraggableCrackObject::TransparentDraggableCrackObject(QCustomPlot *pa
|
|||
m_offsetYA = 0.0;
|
||||
|
||||
mCurve = new QCPItemCurve(mPlot);
|
||||
mCurve->setPen(QPen(Qt::black, 2));
|
||||
mCurve->setPen(QPen(m_lineColor, 2));
|
||||
mCurve->setLayer("overlay");
|
||||
|
||||
updateCurveFromTargets();
|
||||
updateCurvePosition();
|
||||
|
||||
auto createTracer = [this](double x, double y, const QColor &color) -> QCPItemTracer* {
|
||||
auto createTracer = [this](double x, double y) -> QCPItemTracer* {
|
||||
QCPItemTracer *t = new QCPItemTracer(mPlot);
|
||||
t->setStyle(QCPItemTracer::tsCircle);
|
||||
t->setSize(12);
|
||||
t->setStyle(QCPItemTracer::tsSquare);
|
||||
t->setSize(8);
|
||||
t->setPen(QPen(Qt::black, 1));
|
||||
t->setBrush(QBrush(color));
|
||||
t->setBrush(QBrush(Qt::black));
|
||||
t->setSelectable(true);
|
||||
t->setLayer("overlay");
|
||||
t->position->setCoords(x, y);
|
||||
t->setVisible(false);
|
||||
return t;
|
||||
};
|
||||
m_tracer1 = createTracer(m_orig_x1 + m_offsetXA, m_orig_y1 + m_offsetYA, Qt::cyan);
|
||||
m_tracer2 = createTracer(m_orig_x2 + m_offsetXA, m_orig_y2 + m_offsetYA, Qt::cyan);
|
||||
m_tracer1 = createTracer(m_orig_x1 + m_offsetXA, m_orig_y1 + m_offsetYA);
|
||||
m_tracer2 = createTracer(m_orig_x2 + m_offsetXA, m_orig_y2 + m_offsetYA);
|
||||
m_itemText = new QCPItemText(mPlot);
|
||||
m_itemText->setText(m_typeName);
|
||||
m_itemText->setFont(QFont("Arial", 6, QFont::Bold));
|
||||
m_itemText->setColor(Qt::black);
|
||||
m_itemText->position->setCoords(m_orig_x1 + m_offsetXA + 15, m_orig_y1 + m_offsetYA);
|
||||
m_itemText->setPositionAlignment(Qt::AlignCenter);
|
||||
m_itemText->setLayer("overlay");
|
||||
m_labelsC.append(m_itemText);
|
||||
updateTracers();
|
||||
}
|
||||
else if (m_type == TYPE_B) {
|
||||
|
|
@ -72,7 +240,7 @@ TransparentDraggableCrackObject::TransparentDraggableCrackObject(QCustomPlot *pa
|
|||
}
|
||||
else if (m_type == TYPE_C) {
|
||||
m_curveC = new QCPCurve(mPlot->xAxis, mPlot->yAxis);
|
||||
m_curveC->setPen(QPen(Qt::red, 2));
|
||||
m_curveC->setPen(QPen(m_lineColor, 2));
|
||||
m_curveC->setScatterStyle(QCPScatterStyle::ssCircle);
|
||||
m_curveC->setLineStyle(QCPCurve::lsLine);
|
||||
m_curveC->setLayer("overlay");
|
||||
|
|
@ -89,6 +257,27 @@ TransparentDraggableCrackObject::~TransparentDraggableCrackObject()
|
|||
if (s_activeObject == this) s_activeObject = nullptr;
|
||||
}
|
||||
|
||||
void TransparentDraggableCrackObject::isShow(bool is)
|
||||
{
|
||||
this->m_isShow = is;
|
||||
if(this->mCurve)
|
||||
{
|
||||
this->mCurve->setVisible(this->m_isShow);
|
||||
}
|
||||
|
||||
if(this->m_curveC)
|
||||
{
|
||||
this->m_curveC->setVisible(this->m_isShow);
|
||||
}
|
||||
|
||||
for (const LineItem &item : m_lines) {
|
||||
if (item.line) {
|
||||
item.line->setVisible(this->m_isShow);
|
||||
}
|
||||
}
|
||||
this->mPlot->replot();
|
||||
}
|
||||
|
||||
// ========== 模式A辅助 ==========
|
||||
void TransparentDraggableCrackObject::updateCurveFromTargets()
|
||||
{
|
||||
|
|
@ -129,6 +318,7 @@ void TransparentDraggableCrackObject::updateTracers()
|
|||
if (!m_tracer1 || !m_tracer2) return;
|
||||
m_tracer1->position->setCoords(m_orig_x1 + m_offsetXA, m_orig_y1 + m_offsetYA);
|
||||
m_tracer2->position->setCoords(m_orig_x2 + m_offsetXA, m_orig_y2 + m_offsetYA);
|
||||
m_itemText->position->setCoords(m_orig_x1 + m_offsetXA + 15, m_orig_y1 + m_offsetYA);
|
||||
}
|
||||
|
||||
void TransparentDraggableCrackObject::setTracerHighlight(QCPItemTracer *tracer, bool highlight)
|
||||
|
|
@ -139,7 +329,9 @@ void TransparentDraggableCrackObject::setTracerHighlight(QCPItemTracer *tracer,
|
|||
tracer->setBrush(QBrush(Qt::red));
|
||||
} else {
|
||||
tracer->setPen(QPen(Qt::black, 1));
|
||||
tracer->setBrush(QBrush(Qt::cyan));
|
||||
tracer->setBrush(QBrush(Qt::black));
|
||||
m_tracer1->setVisible(true);
|
||||
m_tracer2->setVisible(true);
|
||||
}
|
||||
mPlot->replot();
|
||||
}
|
||||
|
|
@ -195,14 +387,14 @@ void TransparentDraggableCrackObject::updatePolylineC(bool closed)
|
|||
|
||||
void TransparentDraggableCrackObject::clearPolylineC()
|
||||
{
|
||||
QVector<QCPItemText*> labelsToDelete = m_labelsC;
|
||||
m_labelsC.clear();
|
||||
for (auto label : labelsToDelete) {
|
||||
for (QCPItemText* label : m_labelsC) {
|
||||
if (label) {
|
||||
mPlot->removeItem(label);
|
||||
// 断开与 mPlot 的父子关系,防止 mPlot 销毁时自动删除
|
||||
label->setParent(nullptr);
|
||||
delete label;
|
||||
}
|
||||
}
|
||||
m_labelsC.clear();
|
||||
m_pointsC.clear();
|
||||
if (m_curveC) {
|
||||
m_curveC->setData(QVector<double>(), QVector<double>());
|
||||
|
|
@ -223,6 +415,8 @@ void TransparentDraggableCrackObject::deactivate()
|
|||
setTracerHighlight(m_tracer1, false);
|
||||
setTracerHighlight(m_tracer2, false);
|
||||
m_dragStateA = IdleA;
|
||||
m_tracer1->setVisible(false);
|
||||
m_tracer2->setVisible(false);
|
||||
} else if (m_type == TYPE_B) {
|
||||
m_dragStateB = IdleB;
|
||||
m_draggedLineIndex = -1;
|
||||
|
|
@ -262,11 +456,11 @@ bool TransparentDraggableCrackObject::eventFilter(QObject *obj, QEvent *event)
|
|||
double y = mPlot->yAxis->pixelToCoord(me->pos().y());
|
||||
QPointF p2(x - m_offsetXB, y - m_offsetYB);
|
||||
QCPItemLine *line = new QCPItemLine(mPlot);
|
||||
line->setPen(QPen(Qt::blue, 2));
|
||||
line->setPen(QPen(m_lineColor, 2));
|
||||
line->setLayer("overlay");
|
||||
auto createTracer = [this](double x, double y, const QColor &color) -> QCPItemTracer* {
|
||||
QCPItemTracer *t = new QCPItemTracer(mPlot);
|
||||
t->setStyle(QCPItemTracer::tsCircle);
|
||||
t->setStyle(QCPItemTracer::tsSquare);
|
||||
t->setSize(10);
|
||||
t->setPen(QPen(Qt::black, 1));
|
||||
t->setBrush(QBrush(color));
|
||||
|
|
@ -275,8 +469,8 @@ bool TransparentDraggableCrackObject::eventFilter(QObject *obj, QEvent *event)
|
|||
t->position->setCoords(x + m_offsetXB, y + m_offsetYB);
|
||||
return t;
|
||||
};
|
||||
QCPItemTracer *startTracer = createTracer(m_tempPoint.x(), m_tempPoint.y(), Qt::green);
|
||||
QCPItemTracer *endTracer = createTracer(p2.x(), p2.y(), Qt::green);
|
||||
QCPItemTracer *startTracer = createTracer(m_tempPoint.x(), m_tempPoint.y(), Qt::black);
|
||||
QCPItemTracer *endTracer = createTracer(p2.x(), p2.y(), Qt::black);
|
||||
LineItem item;
|
||||
item.startOrig = m_tempPoint;
|
||||
item.endOrig = p2;
|
||||
|
|
@ -365,7 +559,6 @@ bool TransparentDraggableCrackObject::eventFilter(QObject *obj, QEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
// ========== 模式C ==========
|
||||
// ========== 模式C ==========
|
||||
if (m_type == TYPE_C) {
|
||||
// 1. 左键添加点(Shift)
|
||||
|
|
@ -379,12 +572,11 @@ bool TransparentDraggableCrackObject::eventFilter(QObject *obj, QEvent *event)
|
|||
QPointF pt(x - m_offsetXC, y - m_offsetYC);
|
||||
m_pointsC.append(pt);
|
||||
QCPItemText *label = new QCPItemText(mPlot);
|
||||
label->setText(QString::number(m_pointsC.size()));
|
||||
label->setFont(QFont("Arial", 10, QFont::Bold));
|
||||
label->setColor(Qt::white);
|
||||
label->setBrush(QBrush(Qt::blue));
|
||||
label->setText(" ");
|
||||
label->setFont(QFont("Arial", 6, QFont::Bold));
|
||||
label->setColor(Qt::black);
|
||||
label->setBrush(QBrush(Qt::black));
|
||||
label->setPen(QPen(Qt::black, 1));
|
||||
// label->setPadding(2);
|
||||
label->position->setCoords(x, y);
|
||||
label->setPositionAlignment(Qt::AlignCenter);
|
||||
label->setLayer("overlay");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef TRANSPARENTDRAGGABLECRACKOBJECT_H
|
||||
#ifndef TRANSPARENTDRAGGABLECRACKOBJECT_H
|
||||
#define TRANSPARENTDRAGGABLECRACKOBJECT_H
|
||||
|
||||
#include <QObject>
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
#include <QVector>
|
||||
#include "qcustomplot.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
class TransparentDraggableCrackObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -13,11 +15,12 @@ public:
|
|||
enum CurveType { TYPE_A, TYPE_B, TYPE_C };
|
||||
|
||||
explicit TransparentDraggableCrackObject(QCustomPlot *parentPlot,
|
||||
const QString &strUuid,
|
||||
double depth = 0,
|
||||
CurveType type = TYPE_A);
|
||||
const QString &strUuid, double depth, QString type, QString showNames);
|
||||
~TransparentDraggableCrackObject();
|
||||
|
||||
bool m_isShow = false;
|
||||
QString m_typeName;
|
||||
void isShow(bool is);
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
|
|
@ -27,9 +30,11 @@ private:
|
|||
QString m_uuid;
|
||||
double m_depth;
|
||||
double m_endX;
|
||||
QColor m_lineColor;
|
||||
|
||||
static QPointer<TransparentDraggableCrackObject> s_activeObject;
|
||||
|
||||
QCPItemText *m_itemText;
|
||||
// 模式A
|
||||
QCPItemCurve *mCurve;
|
||||
double m_orig_x1, m_orig_x2;
|
||||
|
|
|
|||
|
|
@ -169,6 +169,10 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
|||
// 深度属性修改
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_changeDepthProperty(QVariantList)), this, SLOT(s_changeDepthProperty(QVariantList)));
|
||||
|
||||
|
||||
// 频率统计图属性修改
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_changeCrackProperty(QVariantMap)), this, SLOT(s_changeCrackProperty(QVariantMap)));
|
||||
|
||||
// 频率统计图属性修改
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_changePlObjectProperty(QVariantMap)), this, SLOT(s_changePlObjectProperty(QVariantMap)));
|
||||
|
||||
|
|
@ -2033,16 +2037,16 @@ void QMyCustomPlot::addCorePhysicsWithParam(int Order, double Depth, double Corr
|
|||
{
|
||||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||||
QString strUuid = qtCommon->getUUid();
|
||||
// TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
|
||||
// dragRect->setCpDepth(Depth);
|
||||
// dragRect->setCpCoreValue(CoreValue);
|
||||
// dragRect->setCpCorrDepth(CorrDepth);
|
||||
// dragRect->setRange(CorrDepth, CorrDepth, CoreValue);
|
||||
// dragRect->setCpLineColor(Qt::black);
|
||||
// dragRect->setCpLineWidth(1);
|
||||
// dragRect->setCpOrder(Order);
|
||||
// dragRect->update();
|
||||
// m_mapDraggable_CorePhysics[strUuid] = dragRect;
|
||||
TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
|
||||
dragRect->setCpDepth(Depth);
|
||||
dragRect->setCpCoreValue(CoreValue);
|
||||
dragRect->setCpCorrDepth(CorrDepth);
|
||||
dragRect->setRange(CorrDepth, CorrDepth, CoreValue);
|
||||
dragRect->setCpLineColor(Qt::black);
|
||||
dragRect->setCpLineWidth(1);
|
||||
dragRect->setCpOrder(Order);
|
||||
dragRect->update();
|
||||
m_mapDraggable_CorePhysics[strUuid] = dragRect;
|
||||
}
|
||||
|
||||
void QMyCustomPlot::addCrackObject()
|
||||
|
|
@ -2117,47 +2121,15 @@ void QMyCustomPlot::addCrackObject()
|
|||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
// 获取用户输入
|
||||
double depth = editDepth->text().toDouble();
|
||||
QString type = cbbType->currentText();
|
||||
|
||||
|
||||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||||
QString strUuid = qtCommon->getUUid();
|
||||
// TransparentDraggableCrackObject *t = new TransparentDraggableCrackObject(this, strUuid, -depth);
|
||||
// m_mapDraggable_CrackObject[strUuid] = t;
|
||||
|
||||
|
||||
if("高导缝" == type)
|
||||
{
|
||||
// 模式A:原有贝塞尔曲线
|
||||
auto curve = new TransparentDraggableCrackObject(this, strUuid, -depth, TransparentDraggableCrackObject::TYPE_A);
|
||||
}
|
||||
else if("网状缝" == type)
|
||||
{
|
||||
// 模式B:直线(按住Shift选两点)
|
||||
auto line = new TransparentDraggableCrackObject(this, strUuid, -depth, TransparentDraggableCrackObject::TYPE_B);
|
||||
}
|
||||
else if("孔洞" == type)
|
||||
{
|
||||
// 模式C:折线(按住Shift连续选点)
|
||||
auto polyline = new TransparentDraggableCrackObject(this, strUuid, -depth, TransparentDraggableCrackObject::TYPE_C);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
|
||||
// dragRect->setRange(depth, depth, 50);
|
||||
// dragRect->setCpLineColor(Qt::black);
|
||||
// dragRect->setCpLineWidth(1);
|
||||
// m_mapDraggable_CorePhysics[strUuid] = dragRect;
|
||||
|
||||
double depth = editDepth->text().toDouble();
|
||||
QString type = cbbType->currentText();
|
||||
QString showNames = "";
|
||||
auto curve = new TransparentDraggableCrackObject(this, strUuid, -depth, type, showNames);
|
||||
m_mapDraggable_CrackObject[strUuid] = curve;
|
||||
// ========= 这里就是你要的结果!=========
|
||||
qDebug() << "深度:" << depth << " 类型:" << type;
|
||||
// qDebug() << "深度:" << depth << " 类型:" << type;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -10219,6 +10191,99 @@ void QMyCustomPlot::resetPosition()
|
|||
replot();
|
||||
}
|
||||
|
||||
void QMyCustomPlot::s_changeCrackProperty(QVariantMap variantMap)
|
||||
{
|
||||
QString strTrackName = variantMap["m_strTrackName"].toString();
|
||||
if(this->m_strTrackName != strTrackName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool m_pl_highGap = variantMap["m_pl_highGap"].toBool(); // 高导缝
|
||||
bool m_pl_highReservoir = variantMap["m_pl_highReservoir"].toBool(); // 高阻缝
|
||||
bool m_pl_reticularFracture = variantMap["m_pl_reticularFracture"].toBool(); // 网状缝
|
||||
bool m_pl_inducedFracture = variantMap["m_pl_inducedFracture"].toBool(); // 诱导缝
|
||||
bool m_pl_bedLayer = variantMap["m_pl_bedLayer"].toBool(); // 层理
|
||||
bool m_pl_erosionSurface = variantMap["m_pl_erosionSurface"].toBool(); // 侵蚀面
|
||||
bool m_pl_pore = variantMap["m_pl_pore"].toBool(); // 孔洞
|
||||
bool m_pl_vesicle = variantMap["m_pl_vesicle"].toBool(); // 气孔
|
||||
bool m_pl_gravel = variantMap["m_pl_gravel"].toBool(); // 砾石
|
||||
bool m_pl_nodule = variantMap["m_pl_nodule"].toBool(); // 结核
|
||||
bool m_pl_lumps = variantMap["m_pl_lumps"].toBool(); // 团块
|
||||
bool m_pl_fault = variantMap["m_pl_fault"].toBool(); // 断层
|
||||
bool m_pl_verticalFracture = variantMap["m_pl_verticalFracture"].toBool(); // 垂直缝
|
||||
bool m_pl_custom1 = variantMap["m_pl_custom1"].toBool(); // 自定义1
|
||||
bool m_pl_custom2 = variantMap["m_pl_custom2"].toBool(); // 自定义2
|
||||
|
||||
TransparentDraggableCrackObject *pDraggableRect = NULL;
|
||||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_CrackObject.begin();
|
||||
while( it != m_mapDraggable_CrackObject.end() )
|
||||
{
|
||||
pDraggableRect = (TransparentDraggableCrackObject*)it.value();
|
||||
if("高导缝" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_highGap);
|
||||
}
|
||||
else if("高阻缝" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_highReservoir);
|
||||
}
|
||||
else if("诱导缝" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_inducedFracture);
|
||||
}
|
||||
else if("层理" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_bedLayer);
|
||||
}
|
||||
else if("侵蚀面" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_erosionSurface);
|
||||
}
|
||||
else if("断层" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_fault);
|
||||
}
|
||||
else if("自定义1" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_custom1);
|
||||
}
|
||||
else if("自定义2" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_custom2);
|
||||
}
|
||||
else if("网状缝" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_reticularFracture);
|
||||
}
|
||||
else if("垂直缝" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_verticalFracture);
|
||||
}
|
||||
else if("孔洞" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_pore);
|
||||
}
|
||||
else if("气孔" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_vesicle);
|
||||
}
|
||||
else if("砾石" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_gravel);
|
||||
}
|
||||
else if("结核" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_nodule);
|
||||
}
|
||||
else if("团块" == pDraggableRect->m_typeName)
|
||||
{
|
||||
pDraggableRect->isShow(m_pl_lumps);
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap)
|
||||
{
|
||||
QString strTrackName = variantMap["m_strTrackName"].toString();
|
||||
|
|
|
|||
|
|
@ -576,6 +576,9 @@ public slots:
|
|||
// 深度
|
||||
void s_changeDepthProperty(QVariantList vlist);
|
||||
|
||||
// 裂缝
|
||||
void s_changeCrackProperty(QVariantMap variantMap);
|
||||
|
||||
// 频率统计图
|
||||
void s_changePlObjectProperty(QVariantMap variantMap);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user