沉积相右键菜单功能,追加删除微相、修改沉积相。
This commit is contained in:
parent
ae0c8f0c11
commit
3b32c2ed8e
|
|
@ -701,7 +701,7 @@ void TransparentDraggableGeoLith::setLower(double lower)
|
|||
if(newRange.size() < mMinWidth) {
|
||||
// 如果是边界拖动,强制设置最小宽度
|
||||
newRange.lower = newRange.upper - mMinWidth;
|
||||
}
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
}
|
||||
|
|
@ -897,6 +897,13 @@ void TransparentDraggableGeoLith::onMouseMove(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//位置改变,鼠标拖动item
|
||||
if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper)
|
||||
{
|
||||
m_bChange = true;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
|
@ -905,14 +912,16 @@ void TransparentDraggableGeoLith::onMouseRelease(QMouseEvent *event)
|
|||
{
|
||||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||
event->accept();
|
||||
//属性
|
||||
//if(mDragMode == DragRect)
|
||||
//属性
|
||||
{
|
||||
double low = mRect->topLeft->coords().x();
|
||||
double hight = mRect->bottomRight->coords().x();
|
||||
PropertyService()->initGeoLithItemProperty(this, low, hight, m_Lith, m_Oil, m_Color);
|
||||
//保存
|
||||
mPlot->SaveToSLF_GeoLith();
|
||||
if(m_bChange)
|
||||
{
|
||||
//保存
|
||||
mPlot->SaveToSLF_GeoLith();
|
||||
}
|
||||
|
||||
//取消所有选中单元格
|
||||
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ public:
|
|||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
//鼠标是否拖动item
|
||||
bool m_bChange = false;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLEGEOLITH_H
|
||||
|
|
|
|||
|
|
@ -622,6 +622,12 @@ void TransparentDraggableGujing::onMouseMove(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
//位置改变,鼠标拖动item
|
||||
if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper)
|
||||
{
|
||||
m_bChange = true;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
|
@ -630,14 +636,16 @@ void TransparentDraggableGujing::onMouseRelease(QMouseEvent *event)
|
|||
{
|
||||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||
event->accept();
|
||||
//属性
|
||||
//if(mDragMode == DragRect)
|
||||
//属性
|
||||
{
|
||||
double low = mRect->topLeft->coords().x();
|
||||
double hight = mRect->bottomRight->coords().x();
|
||||
PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
|
||||
//保存
|
||||
mPlot->SaveToSLF_Gujing();
|
||||
if(m_bChange)
|
||||
{
|
||||
//保存
|
||||
mPlot->SaveToSLF_Gujing();
|
||||
}
|
||||
|
||||
//取消所有选中单元格
|
||||
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ public:
|
|||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
//鼠标是否拖动item
|
||||
bool m_bChange = false;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLEGUJING_H
|
||||
|
|
|
|||
|
|
@ -471,6 +471,12 @@ void TransparentDraggableJiegutext::onMouseMove(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
//位置改变,鼠标拖动item
|
||||
if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper)
|
||||
{
|
||||
m_bChange = true;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
|
@ -555,13 +561,15 @@ void TransparentDraggableJiegutext::onMouseRelease(QMouseEvent *event)
|
|||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||
event->accept();
|
||||
//属性
|
||||
//if(mDragMode == DragRect)
|
||||
{
|
||||
double low = mRect->topLeft->coords().x();
|
||||
double hight = mRect->bottomRight->coords().x();
|
||||
PropertyService()->initJiegutextItemProperty(this, low, hight);
|
||||
//保存
|
||||
mPlot->SaveToSLF_Jiegutext();
|
||||
if(m_bChange)
|
||||
{
|
||||
//保存
|
||||
mPlot->SaveToSLF_Jiegutext();
|
||||
}
|
||||
//重新加载数据
|
||||
this->ReLoadValues();
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ public:
|
|||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
//鼠标是否拖动item
|
||||
bool m_bChange = false;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLEJIEGUTEXT_H
|
||||
|
|
|
|||
|
|
@ -559,6 +559,12 @@ void TransparentDraggableLayer::onMouseMove(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
//位置改变,鼠标拖动item
|
||||
if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper)
|
||||
{
|
||||
m_bChange = true;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
|
@ -568,13 +574,15 @@ void TransparentDraggableLayer::onMouseRelease(QMouseEvent *event)
|
|||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||
event->accept();
|
||||
//属性
|
||||
//if(mDragMode == DragRect)
|
||||
{
|
||||
double low = mRect->topLeft->coords().x();
|
||||
double hight = mRect->bottomRight->coords().x();
|
||||
PropertyService()->initLayerItemProperty(this, low, hight, mstrTitle);
|
||||
//保存
|
||||
mPlot->SaveToSLF_Layer();
|
||||
if(m_bChange)
|
||||
{
|
||||
//保存
|
||||
mPlot->SaveToSLF_Layer();
|
||||
}
|
||||
|
||||
//取消所有选中单元格
|
||||
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ public:
|
|||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
//鼠标是否拖动item
|
||||
bool m_bChange = false;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLELAYER_H
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
#include "TransparentDraggableMFac.h"
|
||||
#include "PropertyWidget.h"
|
||||
#include "CallManage.h"
|
||||
#include "fracsel.h"
|
||||
|
||||
extern double g_dPixelPerCm;//每厘米像素数
|
||||
//static GeoIndicatorGenerator m_drawGeo;
|
||||
//沉积相
|
||||
extern double g_SDepthFac;
|
||||
extern double g_EDepthFac;
|
||||
extern QString g_SelectMFac;
|
||||
|
||||
TransparentDraggableMFac::TransparentDraggableMFac(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle)
|
||||
: QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth)
|
||||
|
|
@ -173,16 +180,99 @@ void TransparentDraggableMFac::updateHandles()
|
|||
|
||||
}
|
||||
|
||||
//修改沉积相
|
||||
void TransparentDraggableMFac::onChangeRect()
|
||||
{
|
||||
double low = mRect->topLeft->coords().x();
|
||||
double hight = mRect->bottomRight->coords().x();
|
||||
|
||||
// 创建对话框
|
||||
FracSel *dlg = new FracSel(nullptr);
|
||||
dlg->setChangeInfo(low, hight, mPlot->m_FracDef, mstrTitle);
|
||||
//
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象
|
||||
int result = dlg->exec();//模态对话框
|
||||
if (result == QDialog::Accepted) {
|
||||
// 处理用户点击了确定按钮的逻辑
|
||||
qDebug() << "Accepted=";
|
||||
//
|
||||
setTitle(g_SelectMFac);
|
||||
setRange(-g_EDepthFac, -g_SDepthFac);
|
||||
|
||||
mPlot->SaveToSLF_Fac();
|
||||
//刷新 bAdd不支持true,否则崩溃,因为发消息的item本身会被删除,无法继续后续处理
|
||||
mPlot->RefreshItems_Fac(false);
|
||||
}
|
||||
else if (result == QDialog::Rejected) {
|
||||
// 处理用户点击了取消按钮的逻辑
|
||||
qDebug() << "Rejected=";
|
||||
}
|
||||
else {
|
||||
// 处理其他情况的逻辑
|
||||
qDebug() << "other=";
|
||||
}
|
||||
}
|
||||
|
||||
void TransparentDraggableMFac::onDelRect()
|
||||
{
|
||||
//mDragMode = DragNone;
|
||||
//删除框图
|
||||
deleteRect();
|
||||
//保存
|
||||
mPlot->SaveToSLF_Fac();
|
||||
//刷新 bAdd不支持true,否则崩溃,因为发消息的item本身会被删除,无法继续后续处理
|
||||
mPlot->RefreshItems_Fac(false);
|
||||
//属性清空
|
||||
PropertyService()->InitCurrentViewInfo();
|
||||
}
|
||||
|
||||
//设置顶深
|
||||
void TransparentDraggableMFac::setUpper(double upper)
|
||||
{
|
||||
QCPRange currentRange = getRange();
|
||||
QCPRange newRange = currentRange;
|
||||
|
||||
double proposedRight = upper;
|
||||
// 确保不超出轴范围且不使宽度小于最小值
|
||||
newRange.upper = qBound(
|
||||
currentRange.lower + mMinWidth,
|
||||
proposedRight,
|
||||
getMyUpper());
|
||||
|
||||
// 最终确保宽度不小于最小值(针对整体拖动的情况)
|
||||
if(newRange.size() < mMinWidth) {
|
||||
newRange.upper = newRange.lower + mMinWidth;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
}
|
||||
|
||||
//设置底深
|
||||
void TransparentDraggableMFac::setLower(double lower)
|
||||
{
|
||||
QCPRange currentRange = getRange();
|
||||
QCPRange newRange = currentRange;
|
||||
|
||||
double proposedLeft = lower;
|
||||
// 确保不超出轴范围且不使宽度小于最小值
|
||||
newRange.lower = qBound(
|
||||
getMyLower(),
|
||||
proposedLeft,
|
||||
currentRange.upper - mMinWidth);
|
||||
|
||||
// 最终确保宽度不小于最小值(针对整体拖动的情况)
|
||||
if(newRange.size() < mMinWidth) {
|
||||
// 如果是边界拖动,强制设置最小宽度
|
||||
newRange.lower = newRange.upper - mMinWidth;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
}
|
||||
|
||||
void TransparentDraggableMFac::onMousePress(QMouseEvent *event)
|
||||
{
|
||||
m_bChange = false;
|
||||
|
||||
if(event->button() != Qt::LeftButton)//右键
|
||||
{
|
||||
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
|
||||
|
|
@ -203,20 +293,13 @@ void TransparentDraggableMFac::onMousePress(QMouseEvent *event)
|
|||
}
|
||||
|
||||
//event->accept();
|
||||
// double low = mRect->topLeft->coords().x();
|
||||
// double hight = mRect->bottomRight->coords().x();
|
||||
// PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
|
||||
|
||||
QMenu menu(nullptr);
|
||||
QAction *delAction = menu.addAction("删除框图");
|
||||
//delAction->installEventFilter(this);
|
||||
connect(delAction, &QAction::triggered, this, &TransparentDraggableMFac::onDelRect);
|
||||
|
||||
// QAction* pItem = menu.exec(event->globalPos());
|
||||
// if(pItem == delAction)
|
||||
// {
|
||||
// //event->accept();
|
||||
|
||||
// int ii=0;
|
||||
// ii++;
|
||||
// }
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/DelColumn.png"), "删除微相", this, &TransparentDraggableMFac::onDelRect);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/AddRow.png"), "修改沉积相", this, &TransparentDraggableMFac::onChangeRect);
|
||||
menu.exec(event->globalPos());
|
||||
|
||||
return;
|
||||
|
|
@ -253,8 +336,38 @@ void TransparentDraggableMFac::onMousePress(QMouseEvent *event)
|
|||
|
||||
}
|
||||
|
||||
int TransparentDraggableMFac::getCursor()
|
||||
{
|
||||
if (m_bMoveRect)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (m_bArrow)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransparentDraggableMFac::onMouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (mDragMode == DragRect)
|
||||
{
|
||||
m_bMoveRect = true;
|
||||
}
|
||||
else if (mLeftHandle->selectTest(event->pos(), false) < 5
|
||||
|| mRightHandle->selectTest(event->pos(), false) < 5)
|
||||
{
|
||||
m_bArrow = true;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bArrow = false;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
if(mDragMode == DragNone) return;
|
||||
|
||||
event->accept();
|
||||
|
|
@ -347,6 +460,12 @@ void TransparentDraggableMFac::onMouseMove(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
//位置改变,鼠标拖动item
|
||||
if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper)
|
||||
{
|
||||
m_bChange = true;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
|
@ -355,6 +474,20 @@ void TransparentDraggableMFac::onMouseRelease(QMouseEvent *event)
|
|||
{
|
||||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||
event->accept();
|
||||
// double low = mRect->topLeft->coords().x();
|
||||
// double hight = mRect->bottomRight->coords().x();
|
||||
// PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
|
||||
//属性
|
||||
if(m_bChange)
|
||||
{
|
||||
//保存
|
||||
mPlot->SaveToSLF_Fac();
|
||||
//刷新 bAdd不支持true,否则崩溃,因为发消息的item本身会被删除,无法继续后续处理
|
||||
mPlot->RefreshItems_Fac(false);
|
||||
//取消所有选中单元格
|
||||
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
|
||||
}
|
||||
|
||||
//避免二次绘制框图
|
||||
mPlot->m_bDrawRect = false;
|
||||
//emit rangeChanged(getRange());
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ public:
|
|||
// 删除框图
|
||||
void deleteRect();
|
||||
|
||||
//设置顶深
|
||||
void setUpper(double upper);
|
||||
//设置底深
|
||||
void setLower(double lower);
|
||||
|
||||
signals:
|
||||
void rangeChanged(QCPRange newRange);
|
||||
|
||||
|
|
@ -43,13 +48,14 @@ private:
|
|||
|
||||
private slots:
|
||||
void onDelRect();
|
||||
void onChangeRect();
|
||||
void onMousePress(QMouseEvent *event);
|
||||
void onMouseMove(QMouseEvent *event);
|
||||
void onMouseRelease(QMouseEvent *event);
|
||||
double getMyLower();
|
||||
double getMyUpper();
|
||||
|
||||
private:
|
||||
public:
|
||||
QMyCustomPlot *mPlot;
|
||||
QCPItemRect *mRect;
|
||||
QCPItemRect *mLeftHandle;
|
||||
|
|
@ -68,6 +74,13 @@ private:
|
|||
|
||||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
|
||||
//鼠标形状
|
||||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
//鼠标是否拖动item
|
||||
bool m_bChange = false;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLEMFAC_H
|
||||
|
|
|
|||
|
|
@ -445,6 +445,12 @@ void TransparentDraggableRect::onMouseMove(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
//位置改变,鼠标拖动item
|
||||
if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper)
|
||||
{
|
||||
m_bChange = true;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
|
@ -454,13 +460,16 @@ void TransparentDraggableRect::onMouseRelease(QMouseEvent *event)
|
|||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||
event->accept();
|
||||
//属性
|
||||
//if(mDragMode == DragRect)
|
||||
{
|
||||
double low = mRect->topLeft->coords().x();
|
||||
double hight = mRect->bottomRight->coords().x();
|
||||
PropertyService()->initTextItemProperty(this, low, hight, mstrTitle);
|
||||
//保存
|
||||
mPlot->SaveToSLF_Text();
|
||||
|
||||
if(m_bChange)
|
||||
{
|
||||
//保存
|
||||
mPlot->SaveToSLF_Text();
|
||||
}
|
||||
|
||||
//取消所有选中单元格
|
||||
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ public:
|
|||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
//鼠标是否拖动item
|
||||
bool m_bChange = false;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLERECT_H
|
||||
|
|
|
|||
|
|
@ -644,6 +644,12 @@ void TransparentDraggableSwallCore::onMouseMove(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
//位置改变,鼠标拖动item
|
||||
if(newRange.lower!= mDragStartRange.lower || newRange.upper!= mDragStartRange.upper)
|
||||
{
|
||||
m_bChange = true;
|
||||
}
|
||||
|
||||
setRange(newRange.lower, newRange.upper);
|
||||
|
||||
}
|
||||
|
|
@ -695,7 +701,7 @@ void TransparentDraggableSwallCore::onMouseRelease(QMouseEvent *event)
|
|||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||
event->accept();
|
||||
//属性
|
||||
//if(mDragMode == DragRect)
|
||||
|
||||
{
|
||||
double low = mRect->topLeft->coords().x();
|
||||
QString ColorImage = "";
|
||||
|
|
@ -710,8 +716,11 @@ void TransparentDraggableSwallCore::onMouseRelease(QMouseEvent *event)
|
|||
|
||||
PropertyService()->initSwallCoreItemProperty(this, low, m_Lith, m_Oil, ColorImage, m_fLeftSpace / g_dPixelPerCm, 1, mstrTitle.toInt());
|
||||
|
||||
//保存
|
||||
mPlot->SaveToSLF_SwallCore();
|
||||
if(m_bChange)
|
||||
{
|
||||
//保存
|
||||
mPlot->SaveToSLF_SwallCore();
|
||||
}
|
||||
|
||||
//取消所有选中单元格
|
||||
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ public:
|
|||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
//鼠标是否拖动item
|
||||
bool m_bChange = false;
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLESWALLCORE_H
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ void FracSel::loadStyle(const QString &qssFile)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void FracSel::setInfo(double right_Hight, QList <FAC_DEF> FracDef)
|
||||
{
|
||||
ui->doubleSpinBox_1->setValue(-right_Hight);
|
||||
|
|
@ -62,6 +61,17 @@ void FracSel::setInfo(double right_Hight, QList <FAC_DEF> FracDef)
|
|||
}
|
||||
}
|
||||
|
||||
void FracSel::setChangeInfo(double left_Low, double right_Hight, QList <FAC_DEF> FracDef, QString strCurrent)
|
||||
{
|
||||
ui->doubleSpinBox_1->setValue(-right_Hight);
|
||||
ui->doubleSpinBox_2->setValue(-left_Low);
|
||||
for(int i=0; i<FracDef.size(); i++)
|
||||
{
|
||||
ui->comboBox->addItem(FracDef[i].mFac);
|
||||
}
|
||||
ui->comboBox->setCurrentText(strCurrent);
|
||||
}
|
||||
|
||||
//
|
||||
void FracSel::slotOkClicked()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ private:
|
|||
public:
|
||||
void loadStyle(const QString &qssFile);
|
||||
void setInfo(double right_Hight, QList <FAC_DEF> FracDef);
|
||||
void setChangeInfo(double left_Low, double right_Hight, QList <FAC_DEF> FracDef, QString strCurrent);
|
||||
|
||||
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -2163,6 +2163,8 @@ bool QMyCustomPlot::SaveToSLF_SwallCore()
|
|||
if(n>sizeof(m_Result.dest)) n=sizeof(m_Result.dest);
|
||||
strncpy(m_Result.dest,name.toLocal8Bit().data(),n);
|
||||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2309,6 +2311,8 @@ bool QMyCustomPlot::SaveToSLF_GeoLith()
|
|||
strncpy(m_Result.Dest,name.toLocal8Bit().data(),n);
|
||||
//
|
||||
logio->WriteTable(iIndex,i+1,&m_Result);
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2418,6 +2422,8 @@ bool QMyCustomPlot::SaveToSLF_Text()
|
|||
logio->SetTableFieldData(iIndex,2,(char*)&m_Result->EndDepth,i+1);
|
||||
QString FieldName = "RESULT";
|
||||
logio->SetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),(char*)&m_Result->Words,i+1);
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2543,6 +2549,8 @@ bool QMyCustomPlot::SaveToSLF_Layer()
|
|||
// {
|
||||
// logio->SetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),(char*)pGeoItem->GetCharacters().toStdString().c_str(),j+1);
|
||||
// }
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6819,7 +6827,8 @@ bool QMyCustomPlot::SaveToSLF_Jiegutext()
|
|||
}
|
||||
//logio->SetTableFieldData(iIndex,iRecNum,(char*)pDraggableRect->mList_coredat[iRecNum].toLocal8Bit().data(),i+1);//toStdString().c_str()
|
||||
}
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7501,7 +7510,7 @@ void QMyCustomPlot::ReadFracDef()
|
|||
}
|
||||
}
|
||||
|
||||
void QMyCustomPlot::ReadData_Fac(QString strSlfName, QString csCurve)
|
||||
void QMyCustomPlot::ReadData_Fac(QString strSlfName, QString csCurve, bool bAdd)
|
||||
{
|
||||
if(strSlfName.isEmpty()) return;
|
||||
//清空
|
||||
|
|
@ -7531,8 +7540,11 @@ void QMyCustomPlot::ReadData_Fac(QString strSlfName, QString csCurve)
|
|||
mrw.ReadTable(iIndex,i+1,(void*)&frac);
|
||||
m_ObjList_Fac.append(frac);
|
||||
|
||||
//微相
|
||||
this->addMFacToPlot(-frac.edep, -frac.sdep, QString::fromLocal8Bit(frac.mFac));
|
||||
if(bAdd)
|
||||
{
|
||||
//微相
|
||||
this->addMFacToPlot(-frac.edep, -frac.sdep, QString::fromLocal8Bit(frac.mFac));
|
||||
}
|
||||
}
|
||||
mrw.CloseTable(iIndex);
|
||||
}
|
||||
|
|
@ -7571,33 +7583,89 @@ void QMyCustomPlot::DrawFac(int iType)
|
|||
str2 = QString::fromLocal8Bit(pObj.Phase);
|
||||
str2.trimmed();
|
||||
|
||||
if (str2!=str1 || j==(m_ObjList_Fac.count()-1))
|
||||
// if (str2!=str1 || j==(m_ObjList_Fac.count()-1))
|
||||
// {
|
||||
// if ( j==(m_ObjList_Fac.count()-1))
|
||||
// bottom = m_ObjList_Fac[j].edep;
|
||||
// else
|
||||
// bottom = m_ObjList_Fac[j-1].edep;
|
||||
|
||||
if(j==(m_ObjList_Fac.count()-1))//最后1个
|
||||
{
|
||||
if ( j==(m_ObjList_Fac.count()-1))
|
||||
bottom = m_ObjList_Fac[j].edep;
|
||||
else
|
||||
if (str2!=str1)
|
||||
{
|
||||
//倒数第2个item
|
||||
bottom = m_ObjList_Fac[j-1].edep;
|
||||
//显示文本
|
||||
if (iType==1)
|
||||
{
|
||||
//相
|
||||
this->addFacToPlot(-bottom, -top, str1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//亚相
|
||||
this->addPhaseToPlot(-bottom, -top, str1);
|
||||
}
|
||||
|
||||
|
||||
//显示文本
|
||||
if (iType==1)
|
||||
{
|
||||
//相
|
||||
this->addFacToPlot(-bottom, -top, str1);
|
||||
//添加最后1个不同的item
|
||||
top = pObj.sdep;
|
||||
bottom = pObj.edep;
|
||||
str1=str2;
|
||||
//显示文本
|
||||
if (iType==1)
|
||||
{
|
||||
//相
|
||||
this->addFacToPlot(-bottom, -top, str1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//亚相
|
||||
this->addPhaseToPlot(-bottom, -top, str1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//亚相
|
||||
this->addPhaseToPlot(-bottom, -top, str1);
|
||||
bottom = pObj.edep;
|
||||
//显示文本
|
||||
if (iType==1)
|
||||
{
|
||||
//相
|
||||
this->addFacToPlot(-bottom, -top, str1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//亚相
|
||||
this->addPhaseToPlot(-bottom, -top, str1);
|
||||
}
|
||||
}
|
||||
|
||||
top = pObj.sdep;
|
||||
str1=str2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (str2!=str1)
|
||||
{
|
||||
//
|
||||
bottom = m_ObjList_Fac[j-1].edep;
|
||||
//显示文本
|
||||
if (iType==1)
|
||||
{
|
||||
//相
|
||||
this->addFacToPlot(-bottom, -top, str1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//亚相
|
||||
this->addPhaseToPlot(-bottom, -top, str1);
|
||||
}
|
||||
top = pObj.sdep;
|
||||
str1=str2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool QMyCustomPlot::LoadFromSLF_Fac(QString strSlfName, QString csCurve)
|
||||
bool QMyCustomPlot::LoadFromSLF_Fac(QString strSlfName, QString csCurve, bool bAdd)
|
||||
{
|
||||
//隐藏刻度
|
||||
this->xAxis->setTicks(false);
|
||||
|
|
@ -7605,23 +7673,34 @@ bool QMyCustomPlot::LoadFromSLF_Fac(QString strSlfName, QString csCurve)
|
|||
this->xAxis2->setTicks(false);
|
||||
this->yAxis2->setTicks(false);
|
||||
|
||||
//先删除
|
||||
if(m_qcpItemLine)
|
||||
{
|
||||
removeItem(m_qcpItemLine);
|
||||
}
|
||||
if(m_qcpItemLine2)
|
||||
{
|
||||
removeItem(m_qcpItemLine2);
|
||||
}
|
||||
|
||||
//画2条竖线
|
||||
int iMyWidth = this->axisRect(0)->width();
|
||||
QCPItemStraightLine *qcpItemLine = new QCPItemStraightLine(this);
|
||||
qcpItemLine->point1->setCoords(-1, iMyWidth/2);//位置
|
||||
qcpItemLine->point2->setCoords(-2, iMyWidth/2);//位置
|
||||
m_qcpItemLine = new QCPItemStraightLine(this);
|
||||
m_qcpItemLine->point1->setCoords(-1, iMyWidth/2);//位置
|
||||
m_qcpItemLine->point2->setCoords(-2, iMyWidth/2);//位置
|
||||
//qcpItemLine->setPen(pPenStraightLine);
|
||||
|
||||
QCPItemStraightLine *qcpItemLine2 = new QCPItemStraightLine(this);
|
||||
qcpItemLine2->point1->setCoords(-1, 3*iMyWidth/4);//位置
|
||||
qcpItemLine2->point2->setCoords(-2, 3*iMyWidth/4);//位置
|
||||
m_qcpItemLine2 = new QCPItemStraightLine(this);
|
||||
m_qcpItemLine2->point1->setCoords(-1, 3*iMyWidth/4);//位置
|
||||
m_qcpItemLine2->point2->setCoords(-2, 3*iMyWidth/4);//位置
|
||||
|
||||
ReadFracDef();
|
||||
|
||||
ReadData_Fac(strSlfName, csCurve);
|
||||
ReadData_Fac(strSlfName, csCurve, bAdd);
|
||||
DrawFac(1);//相
|
||||
DrawFac(2);//亚相
|
||||
|
||||
replot();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -7642,7 +7721,10 @@ void QMyCustomPlot::addItem_Fac()
|
|||
|
||||
//微相
|
||||
this->addMFacToPlot(-g_EDepthFac, -g_SDepthFac, g_SelectMFac);
|
||||
this->replot();
|
||||
//this->replot();
|
||||
SaveToSLF_Fac();
|
||||
//刷新
|
||||
RefreshItems_Fac(false);
|
||||
}
|
||||
else if (result == QDialog::Rejected) {
|
||||
// 处理用户点击了取消按钮的逻辑
|
||||
|
|
@ -7653,3 +7735,190 @@ void QMyCustomPlot::addItem_Fac()
|
|||
qDebug() << "other=";
|
||||
}
|
||||
}
|
||||
|
||||
//打开或创建数据表,不超过16个字段
|
||||
// char Name[3][32]={"NAME","VALUE","SCRIPT"};// 64 字段名称
|
||||
// char HZName[3][32]={"参数名称","参数数值","参数描述"};// 64 别名
|
||||
// char Unit[3][32]={"","",""};;// 32 字段单位
|
||||
// char HZUnit[3][32]={"","",""};// 32 单位别名
|
||||
// short RepCode[3]={6,4,6};// 2 字段数据类型
|
||||
// short CodeLength[3]={64,4,256};//字段长度
|
||||
// unsigned short Reserved[3]={0,0,0};//字段备注
|
||||
int OpenTable2(CMemRdWt *MemRdWt,char *strTable,char *strInfo,int nFields,char Name[16][32],char HZName[16][32],char Unit[16][32],
|
||||
char HZUnit[16][32],short *RepCode,short *CodeLength,unsigned short *tReserved)
|
||||
{
|
||||
int i,indext;
|
||||
indext=MemRdWt->OpenTable(strTable);
|
||||
if(indext<0)
|
||||
{
|
||||
Slf_OBJECT_FIELD Par_Table_Field[16];
|
||||
Slf_OBJECT_FIELD Table_Field[16];
|
||||
for(i=0;i<nFields;i++)
|
||||
{
|
||||
strcpy(Table_Field[i].Name,Name[i]);
|
||||
strcpy(Table_Field[i].HZName,HZName[i]);
|
||||
strcpy(Table_Field[i].Unit,Unit[i]);;//32字段单位
|
||||
strcpy(Table_Field[i].HZUnit,HZUnit[i]);;//32单位别名
|
||||
Table_Field[i].CodeLength=CodeLength[i];
|
||||
Table_Field[i].RepCode=RepCode[i];
|
||||
Table_Field[i].Sequence=0;//是否连续控制
|
||||
Table_Field[i].Start=1;//字段起始值
|
||||
Table_Field[i].End=99999;//字段起始值
|
||||
Table_Field[i].Rlev=1;//字段采样间隔
|
||||
Table_Field[i].SamplePoint=1;//一个阵列的横向采样样本点数
|
||||
Table_Field[i].ArrayNum=1;//阵列数
|
||||
Table_Field[i].Vmin=-99999;//字段最大值
|
||||
Table_Field[i].Vmax=99999;//字段最小值
|
||||
Table_Field[i].DefVal=9999;//缺省值
|
||||
*(DWORD *)&Table_Field[i].Reserved=tReserved[i];
|
||||
}
|
||||
indext=MemRdWt->CreateTable(0,strTable,strInfo,nFields,Table_Field,0);
|
||||
}
|
||||
return indext;
|
||||
}
|
||||
|
||||
//保存
|
||||
void QMyCustomPlot::SaveToSLF_Fac()
|
||||
{
|
||||
int i,nField = 40;
|
||||
int nCount = m_mapDraggable_MFac.size();
|
||||
char FacFile[MAX_PATH];
|
||||
CMemRdWt mrw;
|
||||
FAC_TABLE m_Result;
|
||||
|
||||
strcpy(FacFile,"LITHA");
|
||||
QString wellname = m_strSlfName;
|
||||
if ( mrw.Open(wellname.toStdString().c_str()) ) // 打开井文件
|
||||
{
|
||||
char tName[7][32]={"NO","SDEP","EDEP","FAC","PHASE","MFAC","DEST"};// 64 字段名称
|
||||
char tHZName[7][32]={"序号","开始深度","结束深度","沉积相","亚相","微相","描述"};// 64 别名
|
||||
char tUnit[7][32]={"","M","M","","","",""};// 32 字段单位
|
||||
char tHZUnit[7][32]={"","米","米","","","",""};// 32 单位别名
|
||||
short tRepCode[7]={1,4,4,6,6,6,6};// 2 字段数据类型
|
||||
short tCodeLength[7]={4,4,4,32,32,32,32};//字段长度
|
||||
unsigned short tReserved[7]={0,0,0,0,0,0,0};//字段备注
|
||||
//
|
||||
QString strInfo = "岩性数据表";
|
||||
char szInfo[MAX_PATH];
|
||||
memset(szInfo, 0, sizeof(szInfo));
|
||||
//微相
|
||||
int n=strlen(strInfo.toStdString().c_str());
|
||||
strncpy(szInfo, strInfo.toLocal8Bit().data(),n);
|
||||
|
||||
int iLithIndex=OpenTable2(&mrw,FacFile,szInfo,7,
|
||||
tName,tHZName,tUnit,tHZUnit,tRepCode,tCodeLength,tReserved);
|
||||
//保存输入输出曲线定义
|
||||
if (iLithIndex>= 0)
|
||||
{
|
||||
TransparentDraggableMFac *pDraggableRect =NULL;
|
||||
|
||||
//排序
|
||||
QList<float> listSDepth;
|
||||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_MFac.begin(); iter != m_mapDraggable_MFac.end(); iter++)
|
||||
{
|
||||
pDraggableRect = (TransparentDraggableMFac*)iter.value();
|
||||
//
|
||||
QCPRange tmpRange = pDraggableRect->getRange();
|
||||
//
|
||||
float fSDepth = -tmpRange.upper;
|
||||
listSDepth.append(fSDepth);
|
||||
}
|
||||
qSort(listSDepth);
|
||||
|
||||
//if ( nCount>=2)
|
||||
{
|
||||
mrw.SetTableRecordCount(iLithIndex,nCount);
|
||||
|
||||
//
|
||||
for(int i=0; i<listSDepth.size(); i++)
|
||||
{
|
||||
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_MFac.begin(); iter != m_mapDraggable_MFac.end(); iter++)
|
||||
{
|
||||
pDraggableRect = (TransparentDraggableMFac*)iter.value();
|
||||
//
|
||||
QCPRange tmpRange = pDraggableRect->getRange();
|
||||
float fSDepth = -tmpRange.upper;
|
||||
if(fSDepth == listSDepth[i])//按顺序写入
|
||||
{
|
||||
memset(&m_Result,0,sizeof(FAC_TABLE));
|
||||
m_Result.sdep = -tmpRange.upper;
|
||||
m_Result.edep = -tmpRange.lower;
|
||||
m_Result.no = i+1;
|
||||
|
||||
for (int j=0; j<m_FracDef.count(); j++)
|
||||
{
|
||||
if ( m_FracDef[j].mFac == pDraggableRect->mstrTitle )
|
||||
{
|
||||
//微相
|
||||
int n=strlen(m_FracDef[j].mFac.toStdString().c_str());
|
||||
if(n>sizeof(m_Result.mFac)) n=sizeof(m_Result.mFac);
|
||||
strncpy(m_Result.mFac, m_FracDef[j].mFac.toLocal8Bit().data(),n);
|
||||
//亚相
|
||||
n=strlen(m_FracDef[j].Phase.toStdString().c_str());
|
||||
if(n>sizeof(m_Result.Phase)) n=sizeof(m_Result.Phase);
|
||||
strncpy(m_Result.Phase, m_FracDef[j].Phase.toLocal8Bit().data(),n);
|
||||
//相
|
||||
n=strlen(m_FracDef[j].Fac.toStdString().c_str());
|
||||
if(n>sizeof(m_Result.Fac)) n=sizeof(m_Result.Fac);
|
||||
strncpy(m_Result.Fac, m_FracDef[j].Fac.toLocal8Bit().data(),n);
|
||||
//
|
||||
mrw.WriteTable(iLithIndex,i+1,&m_Result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mrw.CloseTable(iLithIndex);
|
||||
}
|
||||
|
||||
mrw.Close();
|
||||
}
|
||||
}
|
||||
|
||||
//刷新数据 bAdd不支持true,否则崩溃,因为发消息的item本身会被删除,无法继续后续处理
|
||||
void QMyCustomPlot::RefreshItems_Fac(bool bAdd)
|
||||
{
|
||||
//return;
|
||||
|
||||
//删除对象
|
||||
if(bAdd)
|
||||
{
|
||||
//微相
|
||||
TransparentDraggableMFac *pDraggableRect =NULL;
|
||||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_MFac.begin();
|
||||
while( it != m_mapDraggable_MFac.end() )
|
||||
{
|
||||
pDraggableRect = (TransparentDraggableMFac*)it.value();
|
||||
it++;
|
||||
pDraggableRect->deleteRect();
|
||||
}
|
||||
}
|
||||
//亚相
|
||||
TransparentDraggablePhase *pDraggableRect2 =NULL;
|
||||
QMap<QString,QObject *>::Iterator it2 = m_mapDraggable_Phase.begin();
|
||||
while( it2 != m_mapDraggable_Phase.end() )
|
||||
{
|
||||
pDraggableRect2 = (TransparentDraggablePhase*)it2.value();
|
||||
it2++;
|
||||
pDraggableRect2->deleteRect();
|
||||
}
|
||||
//相
|
||||
TransparentDraggableFac *pDraggableRect3 =NULL;
|
||||
QMap<QString,QObject *>::Iterator it3 = m_mapDraggable_Fac.begin();
|
||||
while( it3 != m_mapDraggable_Fac.end() )
|
||||
{
|
||||
pDraggableRect3 = (TransparentDraggableFac*)it3.value();
|
||||
it3++;
|
||||
pDraggableRect3->deleteRect();
|
||||
}
|
||||
|
||||
//重新加载
|
||||
LoadFromSLF_Fac(m_strSlfName, m_strLineName, bAdd);
|
||||
|
||||
//属性清空
|
||||
PropertyService()->InitCurrentViewInfo();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ public:
|
|||
// 绘图类型-波形
|
||||
void initWave2(QString strSlfName, QString strWaveName);
|
||||
|
||||
|
||||
void initColorTable();
|
||||
void setSchemeIndex(int nidx, int colorNum);
|
||||
double** getWavedata(int nrow, int ncol);
|
||||
|
|
@ -186,9 +185,9 @@ public:
|
|||
QMap<QString, QObject*> m_mapDraggable_SwallCore; //井壁取心
|
||||
QMap<QString, QObject*> m_mapDraggable_Gujing; //固井
|
||||
QMap<QString, QObject*> m_mapDraggable_Image;
|
||||
QMap<QString, QObject*> m_mapDraggable_MFac;
|
||||
QMap<QString, QObject*> m_mapDraggable_Phase;
|
||||
QMap<QString, QObject*> m_mapDraggable_Fac;
|
||||
QMap<QString, QObject*> m_mapDraggable_MFac; //微相
|
||||
QMap<QString, QObject*> m_mapDraggable_Phase; //亚相
|
||||
QMap<QString, QObject*> m_mapDraggable_Fac; //相
|
||||
QMap<QString, QObject*> m_mapDraggable_Guan;
|
||||
QMap<QString, QObject*> m_mapDraggable_Jiegutext;
|
||||
QMap<QString, QObject*> m_mapDraggable_Line;
|
||||
|
|
@ -258,10 +257,14 @@ public:
|
|||
//沉积相
|
||||
QList <FAC_DEF> m_FracDef;
|
||||
QList <FAC_TABLE> m_ObjList_Fac;
|
||||
QCPItemStraightLine *m_qcpItemLine=nullptr;
|
||||
QCPItemStraightLine *m_qcpItemLine2=nullptr;
|
||||
void ReadFracDef();
|
||||
void ReadData_Fac(QString strSlfName, QString csCurve);
|
||||
void ReadData_Fac(QString strSlfName, QString csCurve, bool bAdd=true);
|
||||
void DrawFac(int iType);
|
||||
bool LoadFromSLF_Fac(QString strSlfName, QString csCurve);
|
||||
bool LoadFromSLF_Fac(QString strSlfName, QString csCurve, bool bAdd=true);
|
||||
//保存
|
||||
void SaveToSLF_Fac();
|
||||
|
||||
public slots:
|
||||
void slot_time();
|
||||
|
|
@ -429,6 +432,7 @@ public slots:
|
|||
|
||||
//右键--沉积相
|
||||
void addItem_Fac(); //添加沉积相
|
||||
void RefreshItems_Fac(bool bAdd=true); //刷新数据
|
||||
|
||||
//右键--解释结论
|
||||
void onOpenEditResult();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user