裂缝属性
This commit is contained in:
parent
30d7301cd6
commit
3df63394fb
|
|
@ -56,7 +56,7 @@ void CPickFrac::ReadFracDef()
|
||||||
if (qs.length() < 8) break;
|
if (qs.length() < 8) break;
|
||||||
sscanf(str, "%d %s %d %d %d %d %d", &fd.iCode, name, &fd.iType, &r, &g, &b, &fd.nLineWidth);
|
sscanf(str, "%d %s %d %d %d %d %d", &fd.iCode, name, &fd.iType, &r, &g, &b, &fd.nLineWidth);
|
||||||
fd.crColor = QColor(r, g, b);
|
fd.crColor = QColor(r, g, b);
|
||||||
fd.csName = name;
|
fd.csName = QString::fromLocal8Bit(name);
|
||||||
fd.csName = fd.csName.trimmed();
|
fd.csName = fd.csName.trimmed();
|
||||||
fd.bDraw = 0;
|
fd.bDraw = 0;
|
||||||
m_FracDef.append(fd);
|
m_FracDef.append(fd);
|
||||||
|
|
@ -102,7 +102,7 @@ void CPickFrac::ReadData(QString strSlfName, QString csCurve)
|
||||||
|
|
||||||
for (int j=0; j<m_FracDef.count(); ++j) {
|
for (int j=0; j<m_FracDef.count(); ++j) {
|
||||||
if (m_FracDef[j].iCode == frac.ID) {
|
if (m_FracDef[j].iCode == frac.ID) {
|
||||||
drawOne(frac, m_FracDef[j].iType, m_FracDef[j].nLineWidth, m_FracDef[j].crColor);
|
drawOne(frac, m_FracDef[j].iType, m_FracDef[j].nLineWidth, m_FracDef[j].crColor, m_FracDef[j].csName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +111,7 @@ void CPickFrac::ReadData(QString strSlfName, QString csCurve)
|
||||||
mrw.Close();
|
mrw.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPickFrac::drawOne(FRAC_TABLE_Crack frac, int iType, int nLineWidth, QColor crColor)
|
void CPickFrac::drawOne(FRAC_TABLE_Crack frac, int iType, int nLineWidth, QColor crColor, QString csName)
|
||||||
{
|
{
|
||||||
qDebug() << "========== READ FRAC ==========";
|
qDebug() << "========== READ FRAC ==========";
|
||||||
qDebug() << "DEP:" << frac.DEP << "AorX:" << frac.AorX << "XETAorH:" << frac.XETAorH
|
qDebug() << "DEP:" << frac.DEP << "AorX:" << frac.AorX << "XETAorH:" << frac.XETAorH
|
||||||
|
|
@ -125,6 +125,10 @@ void CPickFrac::drawOne(FRAC_TABLE_Crack frac, int iType, int nLineWidth, QColor
|
||||||
|
|
||||||
DraggableCrackItem *item = new DraggableCrackItem(m_myCustomPlot, type, crColor, nLineWidth);
|
DraggableCrackItem *item = new DraggableCrackItem(m_myCustomPlot, type, crColor, nLineWidth);
|
||||||
item->setCrackCode(frac.ID);
|
item->setCrackCode(frac.ID);
|
||||||
|
item->csName = csName;
|
||||||
|
item->DIPorS = frac.DIPorS;
|
||||||
|
item->DIR = frac.DIR;
|
||||||
|
item->setLabelInfo(csName, frac.DIPorS, frac.DIR);
|
||||||
connect(item, &DraggableCrackItem::dataChanged, this, &CPickFrac::saveToFile);
|
connect(item, &DraggableCrackItem::dataChanged, this, &CPickFrac::saveToFile);
|
||||||
connect(item, &DraggableCrackItem::removeMe, this, &CPickFrac::onRemoveCrackItem);
|
connect(item, &DraggableCrackItem::removeMe, this, &CPickFrac::onRemoveCrackItem);
|
||||||
m_items.append(item);
|
m_items.append(item);
|
||||||
|
|
@ -261,6 +265,11 @@ void DraggableCrackItem::cleanupFromPlot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DraggableCrackItem::setShow(bool flag)
|
||||||
|
{
|
||||||
|
setVisible(flag);
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== DraggableCrackItem 实现 ====================
|
// ==================== DraggableCrackItem 实现 ====================
|
||||||
QPointer<DraggableCrackItem> DraggableCrackItem::s_activeItem = nullptr;
|
QPointer<DraggableCrackItem> DraggableCrackItem::s_activeItem = nullptr;
|
||||||
|
|
||||||
|
|
@ -298,6 +307,13 @@ DraggableCrackItem::DraggableCrackItem(QCustomPlot *plot, Type type, const QColo
|
||||||
m_curveC->setLayer("overlay");
|
m_curveC->setLayer("overlay");
|
||||||
m_plot->installEventFilter(this);
|
m_plot->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
// 创建文本标签
|
||||||
|
m_labelText = new QCPItemText(m_plot);
|
||||||
|
m_labelText->setFont(QFont("微软雅黑", 7));
|
||||||
|
m_labelText->setColor(Qt::black);
|
||||||
|
m_labelText->setPositionAlignment(Qt::AlignCenter);
|
||||||
|
m_labelText->setLayer("overlay");
|
||||||
|
m_labelText->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
DraggableCrackItem::~DraggableCrackItem()
|
DraggableCrackItem::~DraggableCrackItem()
|
||||||
|
|
@ -314,6 +330,43 @@ DraggableCrackItem::~DraggableCrackItem()
|
||||||
if (s_activeItem == this) s_activeItem = nullptr;
|
if (s_activeItem == this) s_activeItem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DraggableCrackItem::setLabelInfo(const QString &name, double angle, double angle2, int digitCapacity)
|
||||||
|
{
|
||||||
|
QString text = name;
|
||||||
|
if (angle >= 0) {
|
||||||
|
text += QString(" %1").arg(angle, 0, 'f', digitCapacity) + "-" + QString("%1").arg(angle2, 0, 'f', digitCapacity);
|
||||||
|
}
|
||||||
|
if (m_labelText) {
|
||||||
|
m_labelText->setText(text);
|
||||||
|
}
|
||||||
|
updateLabelPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DraggableCrackItem::updateLabelPosition()
|
||||||
|
{
|
||||||
|
if (!m_labelText) return;
|
||||||
|
QPointF pos;
|
||||||
|
if (m_type == TypeA_Sine) {
|
||||||
|
// 曲线中心点(起点和终点的中点)
|
||||||
|
double centerX = (m_orig_startX + m_orig_endX) / 2.0 + m_offsetXA;
|
||||||
|
double centerY = m_depth + m_offsetYA;
|
||||||
|
pos = QPointF(centerX, centerY);
|
||||||
|
} else if (m_type == TypeB_Polyline) {
|
||||||
|
if (!m_lines.isEmpty()) {
|
||||||
|
// 取第一条线段的中点
|
||||||
|
QPointF p1 = m_lines.first().startOrig + QPointF(m_offsetXB, m_offsetYB);
|
||||||
|
QPointF p2 = m_lines.first().endOrig + QPointF(m_offsetXB, m_offsetYB);
|
||||||
|
pos = (p1 + p2) / 2.0;
|
||||||
|
}
|
||||||
|
} else if (m_type == TypeC_Closed) {
|
||||||
|
if (!m_pointsC.isEmpty()) {
|
||||||
|
// 取第一个点
|
||||||
|
pos = m_pointsC.first() + QPointF(m_offsetXC, m_offsetYC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_labelText->position->setCoords(pos.x(), pos.y());
|
||||||
|
}
|
||||||
|
|
||||||
void DraggableCrackItem::setVisible(bool visible)
|
void DraggableCrackItem::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
if (m_pendingDelete) return;
|
if (m_pendingDelete) return;
|
||||||
|
|
@ -423,6 +476,7 @@ void DraggableCrackItem::setSineData(double depth, double amplitude, double phas
|
||||||
updateCurveFromTargets();
|
updateCurveFromTargets();
|
||||||
updateCurvePosition();
|
updateCurvePosition();
|
||||||
updateTracers();
|
updateTracers();
|
||||||
|
updateLabelPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DraggableCrackItem::updateCurveFromTargets()
|
void DraggableCrackItem::updateCurveFromTargets()
|
||||||
|
|
@ -511,8 +565,10 @@ void DraggableCrackItem::setPolylineData(const QVector<QPointF> &points, double
|
||||||
item.startTracer = startTracer;
|
item.startTracer = startTracer;
|
||||||
item.endTracer = endTracer;
|
item.endTracer = endTracer;
|
||||||
m_lines.append(item);
|
m_lines.append(item);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
updateLinesPosition();
|
updateLinesPosition();
|
||||||
|
updateLabelPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DraggableCrackItem::updateLineEndpoints(LineItem &item)
|
void DraggableCrackItem::updateLineEndpoints(LineItem &item)
|
||||||
|
|
@ -562,6 +618,7 @@ void DraggableCrackItem::setClosedData(const QVector<QPointF> &points, double sc
|
||||||
}
|
}
|
||||||
m_cFinished = true;
|
m_cFinished = true;
|
||||||
updatePolylineC(true);
|
updatePolylineC(true);
|
||||||
|
updateLabelPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DraggableCrackItem::updatePolylineC(bool closed)
|
void DraggableCrackItem::updatePolylineC(bool closed)
|
||||||
|
|
@ -587,18 +644,31 @@ void DraggableCrackItem::clearPolylineC()
|
||||||
{
|
{
|
||||||
for (auto label : m_labelsC) {
|
for (auto label : m_labelsC) {
|
||||||
if (label) {
|
if (label) {
|
||||||
m_plot->removeItem(label);
|
if (m_plot) m_plot->removeItem(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_labelsC.clear();
|
m_labelsC.clear();
|
||||||
m_pointsC.clear();
|
m_pointsC.clear();
|
||||||
if (m_curveC) m_curveC->setData(QVector<double>(), QVector<double>());
|
// 仅当曲线对象仍然存在于 plot 中时才清空数据
|
||||||
|
if (m_curveC && m_plot && m_plot->plottableCount() > 0) {
|
||||||
|
// 检查 m_curveC 是否还在 plot 的 plottable 列表中
|
||||||
|
bool found = false;
|
||||||
|
for (int i = 0; i < m_plot->plottableCount(); ++i) {
|
||||||
|
if (m_plot->plottable(i) == m_curveC) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
m_curveC->setData(QVector<double>(), QVector<double>());
|
||||||
|
}
|
||||||
|
}
|
||||||
m_offsetXC = m_offsetYC = 0.0;
|
m_offsetXC = m_offsetYC = 0.0;
|
||||||
m_cFinished = false;
|
m_cFinished = false;
|
||||||
m_cDragging = false;
|
m_cDragging = false;
|
||||||
m_draggingPoint = false;
|
m_draggingPoint = false;
|
||||||
m_draggedPointIndex = -1;
|
m_draggedPointIndex = -1;
|
||||||
m_plot->replot();
|
if (m_plot) m_plot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- 保存辅助 ----------
|
// ---------- 保存辅助 ----------
|
||||||
|
|
@ -915,6 +985,7 @@ bool DraggableCrackItem::eventFilter(QObject *obj, QEvent *event)
|
||||||
updateTracers();
|
updateTracers();
|
||||||
m_plot->replot();
|
m_plot->replot();
|
||||||
m_lastDragPixelA = current;
|
m_lastDragPixelA = current;
|
||||||
|
updateLabelPosition();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -930,6 +1001,7 @@ bool DraggableCrackItem::eventFilter(QObject *obj, QEvent *event)
|
||||||
m_offsetXB += dx;
|
m_offsetXB += dx;
|
||||||
m_offsetYB += dy;
|
m_offsetYB += dy;
|
||||||
updateLinesPosition();
|
updateLinesPosition();
|
||||||
|
updateLabelPosition();
|
||||||
} else if (m_dragStateB == DraggingStartPoint || m_dragStateB == DraggingEndPoint) {
|
} else if (m_dragStateB == DraggingStartPoint || m_dragStateB == DraggingEndPoint) {
|
||||||
int idx = m_draggedLineIndex;
|
int idx = m_draggedLineIndex;
|
||||||
if (idx >= 0 && idx < m_lines.size()) {
|
if (idx >= 0 && idx < m_lines.size()) {
|
||||||
|
|
@ -967,6 +1039,7 @@ bool DraggableCrackItem::eventFilter(QObject *obj, QEvent *event)
|
||||||
updatePolylineC(true);
|
updatePolylineC(true);
|
||||||
m_plot->replot();
|
m_plot->replot();
|
||||||
m_cDragStart = current;
|
m_cDragStart = current;
|
||||||
|
updateLabelPosition();
|
||||||
return true;
|
return true;
|
||||||
} else if (m_draggingPoint) {
|
} else if (m_draggingPoint) {
|
||||||
QPointF current = me->localPos();
|
QPointF current = me->localPos();
|
||||||
|
|
@ -1026,8 +1099,105 @@ bool DraggableCrackItem::eventFilter(QObject *obj, QEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 新建裂缝 ====================
|
// ==================== 新建裂缝 ====================
|
||||||
bool CPickFrac::createNewCrack(int iType, double depth)
|
bool CPickFrac::createNewCrack(double depth, QString type)
|
||||||
{
|
{
|
||||||
|
int iType = 1;
|
||||||
|
QColor m_lineColor;
|
||||||
|
QString m_typeName;
|
||||||
|
if("高导缝" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#FF0000");
|
||||||
|
m_typeName = "高导缝";
|
||||||
|
}
|
||||||
|
else if("高阻缝" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#400040");
|
||||||
|
m_typeName = "高阻缝";
|
||||||
|
}
|
||||||
|
else if("诱导缝" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#00FFFF");
|
||||||
|
m_typeName = "诱导缝";
|
||||||
|
}
|
||||||
|
else if("层理" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#00FF00");
|
||||||
|
m_typeName = "层理";
|
||||||
|
}
|
||||||
|
else if("侵蚀面" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#409600");
|
||||||
|
m_typeName = "侵蚀面";
|
||||||
|
}
|
||||||
|
else if("断层" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#A65300");
|
||||||
|
m_typeName = "断层";
|
||||||
|
}
|
||||||
|
else if("自定义1" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#000000");
|
||||||
|
m_typeName = "自定义1";
|
||||||
|
}
|
||||||
|
else if("自定义2" == type)
|
||||||
|
{
|
||||||
|
iType = 1;
|
||||||
|
m_lineColor.setNamedColor("#000000");
|
||||||
|
m_typeName = "自定义2";
|
||||||
|
}
|
||||||
|
else if("网状缝" == type)
|
||||||
|
{
|
||||||
|
iType = 2;
|
||||||
|
m_lineColor.setNamedColor("#808000");
|
||||||
|
m_typeName = "网状缝";
|
||||||
|
}
|
||||||
|
else if("垂直缝" == type)
|
||||||
|
{
|
||||||
|
iType = 2;
|
||||||
|
m_lineColor.setNamedColor("#FF0000");
|
||||||
|
m_typeName = "垂直缝";
|
||||||
|
}
|
||||||
|
else if("孔洞" == type)
|
||||||
|
{
|
||||||
|
iType = 3;
|
||||||
|
m_lineColor.setNamedColor("#FF8064");
|
||||||
|
m_typeName = "孔洞";
|
||||||
|
}
|
||||||
|
else if("气孔" == type)
|
||||||
|
{
|
||||||
|
iType = 3;
|
||||||
|
m_lineColor.setNamedColor("#FFFF00");
|
||||||
|
m_typeName = "气孔";
|
||||||
|
}
|
||||||
|
else if("砾石" == type)
|
||||||
|
{
|
||||||
|
iType = 3;
|
||||||
|
m_lineColor.setNamedColor("#000096");
|
||||||
|
m_typeName = "砾石";
|
||||||
|
}
|
||||||
|
else if("结核" == type)
|
||||||
|
{
|
||||||
|
iType = 3;
|
||||||
|
m_lineColor.setNamedColor("#A65300");
|
||||||
|
m_typeName = "结核";
|
||||||
|
}
|
||||||
|
else if("团块" == type)
|
||||||
|
{
|
||||||
|
iType = 3;
|
||||||
|
m_lineColor.setNamedColor("#000000");
|
||||||
|
m_typeName = "团块";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// int iType,
|
||||||
|
// QString type
|
||||||
// 从配置文件中查找第一个匹配 iType 的定义,获取颜色和线宽
|
// 从配置文件中查找第一个匹配 iType 的定义,获取颜色和线宽
|
||||||
FRAC_DEF_Crack def;
|
FRAC_DEF_Crack def;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
@ -1040,7 +1210,7 @@ bool CPickFrac::createNewCrack(int iType, double depth)
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
def.iType = iType;
|
def.iType = iType;
|
||||||
def.crColor = QColor(255, 0, 0);
|
def.crColor = m_lineColor;
|
||||||
def.nLineWidth = 2;
|
def.nLineWidth = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1053,11 +1223,15 @@ bool CPickFrac::createNewCrack(int iType, double depth)
|
||||||
|
|
||||||
DraggableCrackItem *item = nullptr;
|
DraggableCrackItem *item = nullptr;
|
||||||
|
|
||||||
|
def.crColor = m_lineColor;
|
||||||
|
def.csName = m_typeName;
|
||||||
if (iType == 1) {
|
if (iType == 1) {
|
||||||
item = new DraggableCrackItem(m_myCustomPlot, DraggableCrackItem::TypeA_Sine, def.crColor, def.nLineWidth);
|
item = new DraggableCrackItem(m_myCustomPlot, DraggableCrackItem::TypeA_Sine, def.crColor, def.nLineWidth);
|
||||||
|
item->csName = m_typeName;
|
||||||
|
item->setLabelInfo(m_typeName, 0);
|
||||||
double amplitude = 0.5;
|
double amplitude = 0.5;
|
||||||
double phase = 0.0;
|
double phase = 0.0;
|
||||||
double width = xWidth * 0.8;
|
double width = xWidth;
|
||||||
double xScale = 360.0 / width;
|
double xScale = 360.0 / width;
|
||||||
double centerY = -(depth + amplitude);
|
double centerY = -(depth + amplitude);
|
||||||
item->setSineData(centerY, amplitude, phase, xScale, width);
|
item->setSineData(centerY, amplitude, phase, xScale, width);
|
||||||
|
|
@ -1071,6 +1245,8 @@ bool CPickFrac::createNewCrack(int iType, double depth)
|
||||||
}
|
}
|
||||||
else if (iType == 2) {
|
else if (iType == 2) {
|
||||||
item = new DraggableCrackItem(m_myCustomPlot, DraggableCrackItem::TypeB_Polyline, def.crColor, def.nLineWidth);
|
item = new DraggableCrackItem(m_myCustomPlot, DraggableCrackItem::TypeB_Polyline, def.crColor, def.nLineWidth);
|
||||||
|
item->csName = m_typeName;
|
||||||
|
item->setLabelInfo(m_typeName, 0);
|
||||||
item->setCrackCode(def.iCode);
|
item->setCrackCode(def.iCode);
|
||||||
connect(item, &DraggableCrackItem::dataChanged, this, &CPickFrac::saveToFile);
|
connect(item, &DraggableCrackItem::dataChanged, this, &CPickFrac::saveToFile);
|
||||||
connect(item, &DraggableCrackItem::removeMe, this, &CPickFrac::onRemoveCrackItem);
|
connect(item, &DraggableCrackItem::removeMe, this, &CPickFrac::onRemoveCrackItem);
|
||||||
|
|
@ -1081,6 +1257,8 @@ bool CPickFrac::createNewCrack(int iType, double depth)
|
||||||
}
|
}
|
||||||
else if (iType == 3) {
|
else if (iType == 3) {
|
||||||
item = new DraggableCrackItem(m_myCustomPlot, DraggableCrackItem::TypeC_Closed, def.crColor, def.nLineWidth);
|
item = new DraggableCrackItem(m_myCustomPlot, DraggableCrackItem::TypeC_Closed, def.crColor, def.nLineWidth);
|
||||||
|
item->csName = m_typeName;
|
||||||
|
item->setLabelInfo(m_typeName, 0);
|
||||||
item->setCrackCode(def.iCode);
|
item->setCrackCode(def.iCode);
|
||||||
connect(item, &DraggableCrackItem::dataChanged, this, &CPickFrac::saveToFile);
|
connect(item, &DraggableCrackItem::dataChanged, this, &CPickFrac::saveToFile);
|
||||||
connect(item, &DraggableCrackItem::removeMe, this, &CPickFrac::onRemoveCrackItem);
|
connect(item, &DraggableCrackItem::removeMe, this, &CPickFrac::onRemoveCrackItem);
|
||||||
|
|
@ -1091,3 +1269,37 @@ bool CPickFrac::createNewCrack(int iType, double depth)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPickFrac::setShowHide(QString names, int nameShow, int angleShow, int digitCapacity)
|
||||||
|
{
|
||||||
|
for (DraggableCrackItem* item : m_items)
|
||||||
|
{
|
||||||
|
if(names.contains(item->csName))
|
||||||
|
{
|
||||||
|
item->setShow(true);
|
||||||
|
item->m_labelText->setVisible(false);
|
||||||
|
if(angleShow == 0 && nameShow == 1)
|
||||||
|
{
|
||||||
|
item->setLabelInfo(item->csName, -1, -1, digitCapacity);
|
||||||
|
item->m_labelText->setVisible(true);
|
||||||
|
}
|
||||||
|
if(angleShow == 1 && nameShow == 0)
|
||||||
|
{
|
||||||
|
item->setLabelInfo("", item->DIPorS, item->DIR, digitCapacity);
|
||||||
|
item->m_labelText->setVisible(true);
|
||||||
|
}
|
||||||
|
if(angleShow == 1 && nameShow == 1)
|
||||||
|
{
|
||||||
|
item->setLabelInfo(item->csName, item->DIPorS, item->DIR, digitCapacity);
|
||||||
|
item->m_labelText->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item->setShow(false);
|
||||||
|
item->m_labelText->setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_myCustomPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,8 @@ public:
|
||||||
void setDraggingEnabled(bool enabled);
|
void setDraggingEnabled(bool enabled);
|
||||||
QList<DraggableCrackItem*> getAllItems() const { return m_items; }
|
QList<DraggableCrackItem*> getAllItems() const { return m_items; }
|
||||||
bool saveToFile();
|
bool saveToFile();
|
||||||
bool createNewCrack(int iType, double depth);
|
bool createNewCrack(double depth, QString type);
|
||||||
|
void setShowHide(QString names, int nameShow, int angleShow, int digitCapacity);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QMyCustomPlot *m_myCustomPlot;
|
QMyCustomPlot *m_myCustomPlot;
|
||||||
|
|
@ -76,7 +77,8 @@ public:
|
||||||
|
|
||||||
void ReadFracDef();
|
void ReadFracDef();
|
||||||
void ReadData(QString strSlfName, QString csCurve);
|
void ReadData(QString strSlfName, QString csCurve);
|
||||||
void drawOne(FRAC_TABLE_Crack frac, int iType, int nLineWidth, QColor crColor);
|
void drawOne(FRAC_TABLE_Crack frac, int iType, int nLineWidth, QColor crColor, QString csName);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
|
|
@ -126,6 +128,14 @@ public:
|
||||||
|
|
||||||
void cleanupFromPlot(); // 立即从画布移除所有图形项
|
void cleanupFromPlot(); // 立即从画布移除所有图形项
|
||||||
|
|
||||||
|
void setShow(bool flag);
|
||||||
|
QString csName;
|
||||||
|
float DIPorS;
|
||||||
|
float DIR;
|
||||||
|
void setLabelInfo(const QString &name, double angle = -1.0, double angle2 = -1.0, int digitCapacity = 2); // angle为-1时不显示角度
|
||||||
|
void updateLabelPosition();
|
||||||
|
QCPItemText *m_labelText = nullptr;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dataChanged();
|
void dataChanged();
|
||||||
void removeMe(DraggableCrackItem* item);
|
void removeMe(DraggableCrackItem* item);
|
||||||
|
|
@ -139,6 +149,7 @@ private:
|
||||||
double m_originalXETAorH = 0.0;
|
double m_originalXETAorH = 0.0;
|
||||||
double m_originalAorX = 0.0;
|
double m_originalAorX = 0.0;
|
||||||
|
|
||||||
|
|
||||||
// 模式A
|
// 模式A
|
||||||
QCPItemCurve *m_curve = nullptr;
|
QCPItemCurve *m_curve = nullptr;
|
||||||
QCPItemTracer *m_tracer1 = nullptr, *m_tracer2 = nullptr;
|
QCPItemTracer *m_tracer1 = nullptr, *m_tracer2 = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -4465,6 +4465,7 @@ void PropertyWidget::changedCrackProperty(QString strProperty, QVariant varVal)
|
||||||
else if ("小数位数" == strProperty)
|
else if ("小数位数" == strProperty)
|
||||||
{
|
{
|
||||||
this->m_formInfo->m_crack_decimal_digits = varVal.toInt();
|
this->m_formInfo->m_crack_decimal_digits = varVal.toInt();
|
||||||
|
flag = true;
|
||||||
}
|
}
|
||||||
// 分类
|
// 分类
|
||||||
else if ("高导缝" == strProperty)
|
else if ("高导缝" == strProperty)
|
||||||
|
|
@ -4563,6 +4564,11 @@ void PropertyWidget::changedCrackProperty(QString strProperty, QVariant varVal)
|
||||||
QVariantMap variantMap;
|
QVariantMap variantMap;
|
||||||
// 必须用来判断当前道
|
// 必须用来判断当前道
|
||||||
variantMap["m_strTrackName"] = this->m_formInfo->m_strTrackName;
|
variantMap["m_strTrackName"] = this->m_formInfo->m_strTrackName;
|
||||||
|
// 数据
|
||||||
|
variantMap["m_crack_drawName"] = this->m_formInfo->m_crack_drawName;
|
||||||
|
variantMap["m_crack_drawAngle"] = this->m_formInfo->m_crack_drawAngle;
|
||||||
|
// 显示控制
|
||||||
|
variantMap["m_crack_decimal_digits"] = this->m_formInfo->m_crack_decimal_digits;
|
||||||
// 分类
|
// 分类
|
||||||
variantMap["m_pl_highGap"] = this->m_formInfo->m_pl_highGap;
|
variantMap["m_pl_highGap"] = this->m_formInfo->m_pl_highGap;
|
||||||
variantMap["m_pl_highReservoir"] = this->m_formInfo->m_pl_highReservoir;
|
variantMap["m_pl_highReservoir"] = this->m_formInfo->m_pl_highReservoir;
|
||||||
|
|
|
||||||
|
|
@ -3995,6 +3995,7 @@ void FormDraw::s_addCrack(QString strUuid, QString strSlfName, QString strWellNa
|
||||||
//注意,不对调XY轴
|
//注意,不对调XY轴
|
||||||
curv->m_bX2Y = false;
|
curv->m_bX2Y = false;
|
||||||
CPickFrac *pickFrac = new CPickFrac(curv, strSlfName, strWaveName, iMyWidth);
|
CPickFrac *pickFrac = new CPickFrac(curv, strSlfName, strWaveName, iMyWidth);
|
||||||
|
pickFrac->setShowHide("", false, false, 2);
|
||||||
curv->m_cPickFrac = pickFrac;
|
curv->m_cPickFrac = pickFrac;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -2190,20 +2190,22 @@ void QMyCustomPlot::addCrackObject()
|
||||||
QString type = cbbType->currentText();
|
QString type = cbbType->currentText();
|
||||||
QString showNames = "";
|
QString showNames = "";
|
||||||
|
|
||||||
if("高导缝" == type)
|
this->m_cPickFrac->createNewCrack(depth, type);
|
||||||
{
|
|
||||||
this->m_cPickFrac->createNewCrack(1 ,depth);
|
|
||||||
}
|
|
||||||
else if("网状缝" == type)
|
|
||||||
{
|
|
||||||
this->m_cPickFrac->createNewCrack(2 ,depth);
|
|
||||||
}
|
|
||||||
else if("孔洞" == type)
|
|
||||||
{
|
|
||||||
this->m_cPickFrac->createNewCrack(3 ,depth);
|
|
||||||
}
|
|
||||||
// auto curve = new CPickFrac(this, strUuid, -depth, type, showNames);
|
|
||||||
|
|
||||||
|
// if("高导缝" == type)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// else if("网状缝" == type)
|
||||||
|
// {
|
||||||
|
// this->m_cPickFrac->createNewCrack(2, depth, type);
|
||||||
|
// }
|
||||||
|
// else if("孔洞" == type)
|
||||||
|
// {
|
||||||
|
// this->m_cPickFrac->createNewCrack(3, depth, type);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// auto curve = new CPickFrac(this, strUuid, -depth, type, showNames);
|
||||||
// m_mapDraggable_CrackObject[strUuid] = curve;
|
// m_mapDraggable_CrackObject[strUuid] = curve;
|
||||||
|
|
||||||
// ========= 这里就是你要的结果!=========
|
// ========= 这里就是你要的结果!=========
|
||||||
|
|
@ -10726,7 +10728,12 @@ void QMyCustomPlot::s_changeCrackProperty(QVariantMap variantMap)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 数据
|
||||||
|
int m_crack_drawName = variantMap["m_crack_drawName"].toInt(); //
|
||||||
|
int m_crack_drawAngle = variantMap["m_crack_drawAngle"].toInt(); //
|
||||||
|
// 显示控制
|
||||||
|
int m_crack_decimal_digits = variantMap["m_crack_decimal_digits"].toInt();
|
||||||
|
// 分类
|
||||||
bool m_pl_highGap = variantMap["m_pl_highGap"].toBool(); // 高导缝
|
bool m_pl_highGap = variantMap["m_pl_highGap"].toBool(); // 高导缝
|
||||||
bool m_pl_highReservoir = variantMap["m_pl_highReservoir"].toBool(); // 高阻缝
|
bool m_pl_highReservoir = variantMap["m_pl_highReservoir"].toBool(); // 高阻缝
|
||||||
bool m_pl_reticularFracture = variantMap["m_pl_reticularFracture"].toBool(); // 网状缝
|
bool m_pl_reticularFracture = variantMap["m_pl_reticularFracture"].toBool(); // 网状缝
|
||||||
|
|
@ -10742,74 +10749,70 @@ void QMyCustomPlot::s_changeCrackProperty(QVariantMap variantMap)
|
||||||
bool m_pl_verticalFracture = variantMap["m_pl_verticalFracture"].toBool(); // 垂直缝
|
bool m_pl_verticalFracture = variantMap["m_pl_verticalFracture"].toBool(); // 垂直缝
|
||||||
bool m_pl_custom1 = variantMap["m_pl_custom1"].toBool(); // 自定义1
|
bool m_pl_custom1 = variantMap["m_pl_custom1"].toBool(); // 自定义1
|
||||||
bool m_pl_custom2 = variantMap["m_pl_custom2"].toBool(); // 自定义2
|
bool m_pl_custom2 = variantMap["m_pl_custom2"].toBool(); // 自定义2
|
||||||
|
QString showNames = "";
|
||||||
|
|
||||||
TransparentDraggableCrackObject *pDraggableRect = NULL;
|
if(m_pl_highGap)
|
||||||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_CrackObject.begin();
|
|
||||||
while( it != m_mapDraggable_CrackObject.end() )
|
|
||||||
{
|
{
|
||||||
pDraggableRect = (TransparentDraggableCrackObject*)it.value();
|
showNames += "高导缝,";
|
||||||
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++;
|
|
||||||
}
|
}
|
||||||
|
if(m_pl_highReservoir)
|
||||||
|
{
|
||||||
|
showNames += "高阻缝,";
|
||||||
|
}
|
||||||
|
if(m_pl_reticularFracture)
|
||||||
|
{
|
||||||
|
showNames += "网状缝,";
|
||||||
|
}
|
||||||
|
if(m_pl_inducedFracture)
|
||||||
|
{
|
||||||
|
showNames += "诱导缝,";
|
||||||
|
}
|
||||||
|
if(m_pl_bedLayer)
|
||||||
|
{
|
||||||
|
showNames += "层理,";
|
||||||
|
}
|
||||||
|
if(m_pl_erosionSurface)
|
||||||
|
{
|
||||||
|
showNames += "侵蚀面,";
|
||||||
|
}
|
||||||
|
if(m_pl_pore)
|
||||||
|
{
|
||||||
|
showNames += "孔洞,";
|
||||||
|
}
|
||||||
|
if(m_pl_vesicle)
|
||||||
|
{
|
||||||
|
showNames += "气孔,";
|
||||||
|
}
|
||||||
|
if(m_pl_gravel)
|
||||||
|
{
|
||||||
|
showNames += "砾石,";
|
||||||
|
}
|
||||||
|
if(m_pl_nodule)
|
||||||
|
{
|
||||||
|
showNames += "结核,";
|
||||||
|
}
|
||||||
|
if(m_pl_lumps)
|
||||||
|
{
|
||||||
|
showNames += "团块,";
|
||||||
|
}
|
||||||
|
if(m_pl_fault)
|
||||||
|
{
|
||||||
|
showNames += "断层,";
|
||||||
|
}
|
||||||
|
if(m_pl_verticalFracture)
|
||||||
|
{
|
||||||
|
showNames += "垂直缝,";
|
||||||
|
}
|
||||||
|
if(m_pl_custom1)
|
||||||
|
{
|
||||||
|
showNames += "自定义1,";
|
||||||
|
}
|
||||||
|
if(m_pl_custom2)
|
||||||
|
{
|
||||||
|
showNames += "自定义2,";
|
||||||
|
}
|
||||||
|
this->m_cPickFrac->setShowHide(showNames, m_crack_drawName, m_crack_drawAngle, m_crack_decimal_digits);
|
||||||
|
// this->m_cPickFrac->setShowName(m_crack_drawName, m_crack_drawAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap)
|
void QMyCustomPlot::s_changePlObjectProperty(QVariantMap variantMap)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user