This commit is contained in:
DESKTOP-450PEFP\mainc 2026-06-17 14:05:44 +08:00
commit b56dd736e5
5 changed files with 492 additions and 25 deletions

View File

@ -798,28 +798,28 @@ void CDataManagger::DataStatistics(int Type,
pDlg2->show();
}
}
// //whp add 2020.4.9 for 波列曲线预览
// void CDataManagger::DisplayWave(const QString& FileName,const QString& WaveName)
// {
// CLogIO *logio=new CLogIO();
// if(!logio->Open(FileName.toStdString().c_str(),CSlfIO::modeRead))
// {
// delete logio;
// QMessageBox::warning(NULL,"提示","打开文件"+FileName+"错误");
// return ;
// }
// int index=logio->OpenWave(WaveName.toStdString().c_str());
// if(index<0){
// delete logio;
// return;
// }
// logio->CloseWave(index);
// delete logio;
// ShowWave *pDlg=new ShowWave();
// pDlg->FileName=FileName,pDlg->WaveName=WaveName;
// pDlg->init();
// pDlg->show();
// }
//whp add 2020.4.9 for 波列曲线预览
void CDataManagger::DisplayWave(const QString& FileName,const QString& WaveName)
{
CLogIO *logio=new CLogIO();
if(!logio->Open(FileName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
QMessageBox::warning(NULL,"提示","打开文件"+FileName+"错误");
return ;
}
int index=logio->OpenWave(WaveName.toStdString().c_str());
if(index<0){
delete logio;
return;
}
logio->CloseWave(index);
delete logio;
ShowWave *pDlg=new ShowWave();
pDlg->FileName=FileName,pDlg->WaveName=WaveName;
pDlg->init();
pDlg->show();
}
// //whp add 2020.5.12 for 常规曲线预览
// void CDataManagger::DisplayCurve(const QString& FileName,const QString& CurveName)
// {

View File

@ -30,6 +30,7 @@
#include <QPageSetupDialog>
#include "SetPageMegDlg.h"
#include "chooseShiftCurvesDlg.h"
#include "completertextedit.h"
//主窗口为了方便获取tab当前页
extern MainWindow *g_mainWindow;
@ -1366,7 +1367,7 @@ void MainWindowCurve::initToolBar_2()
//add QAction to Widget.
ui->toolBar_2->addAction(m_ShiftAc);
ui->toolBar_2->addAction(m_MoveShiftAc);
//ui->toolBar_2->addAction(m_DepthShiftAc);
ui->toolBar_2->addAction(m_DepthShiftAc);
ui->toolBar_2->addSeparator();
ui->toolBar_2->addAction(m_StandardAc);
ui->toolBar_2->addAction(m_CorrectionAc);
@ -1380,7 +1381,7 @@ void MainWindowCurve::initToolBar_2()
connect(m_ShiftAc, &QAction::triggered, this, &MainWindowCurve::s_Shift);
connect(m_MoveShiftAc, &QAction::triggered, this, &MainWindowCurve::s_MoveShift);
// connect(m_DepthShiftAc, &QAction::triggered, this, &MainWindowCurve::s_DepthShift);
connect(m_DepthShiftAc, &QAction::triggered, this, &MainWindowCurve::s_CardMoveCurves);
connect(m_StandardAc, &QAction::triggered, this, &MainWindowCurve::s_Standard);
connect(m_CorrectionAc, &QAction::triggered, this, &MainWindowCurve::s_Correction);
connect(m_ShiftotherAc, &QAction::triggered, this, &MainWindowCurve::s_Shiftother);
@ -1735,6 +1736,351 @@ void MainWindowCurve::s_MoveShift()
}
}
void MainWindowCurve::s_CardMoveCurves()
{
if(m_SelectTableItem.m_iTableType==0) {
QMessageBox::warning(this, "提示", "请先选中一条目标井曲线!");
return;
}
if(m_SelectTableItem.m_iTableType==1) {
QMessageBox::warning(this, "提示", "该功能不支持对井次校正,如果需要井次校正请到数据树上进行!");
return;
}
if(m_SelectTableItem.m_iTableType==2 || m_SelectTableItem.m_iTableType==3)
{
QDialog dialog(NULL);
dialog.setModal(false);
Qt::WindowFlags flags = dialog.windowFlags();
flags |= Qt::WindowStaysOnTopHint;
flags &= ~Qt::WindowContextHelpButtonHint;
dialog.setWindowFlags(flags);
QString path,wellname;
GetWellNameAndPath(m_SelectTableItem.m_strSlfName,wellname,path);
dialog.setWindowTitle("分段平移井次文件-"+wellname);
QGridLayout *verticalLayoutWidget = new QGridLayout(&dialog);
verticalLayoutWidget->setObjectName(QString::fromUtf8("verticalLayoutWidget"));
verticalLayoutWidget->setGeometry(QRect(30, 30, 631, 281));
QVBoxLayout*form = new QVBoxLayout();
form->setObjectName(QString::fromUtf8("form"));
form->setContentsMargins(0, 0, 0, 0);
pTDialog = new CompleterTextEdit(&dialog);
pTDialog->setObjectName(QString::fromUtf8("pTDialog"));
form->addWidget(pTDialog);
QHBoxLayout*horizontalLayout = new QHBoxLayout();
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
QLabel*label = new QLabel(&dialog);
label->setObjectName(QString::fromUtf8("label"));
label->setText("原曲线");
horizontalLayout->addWidget(label);
spinbox1 = new QLineEdit(&dialog);
spinbox1->setObjectName(QString::fromUtf8("lineEdit"));
horizontalLayout->addWidget(spinbox1);
QLabel*label_2 = new QLabel(&dialog);
label_2->setObjectName(QString::fromUtf8("label_2"));
label_2->setText("替换曲线");
horizontalLayout->addWidget(label_2);
spinbox2 = new QLineEdit(&dialog);
spinbox2->setObjectName(QString::fromUtf8("lineEdit_2"));
horizontalLayout->addWidget(spinbox2);
QFont ft(QString::fromLocal8Bit("宋体"),12);
pTDialog->setFont(ft);
QPushButton*pushButton = new QPushButton(&dialog);
pushButton->setObjectName(QString::fromUtf8("pushButton"));
pushButton->setText("替换");
horizontalLayout->addWidget(pushButton);
QObject::connect(pushButton, SIGNAL(clicked()), this, SLOT(slotReplace()));
QPushButton*pushButton1 = new QPushButton(&dialog);
pushButton1->setObjectName(QString::fromUtf8("pushButton1"));
pushButton1->setText("连续性检查");
horizontalLayout->addWidget(pushButton1);
QObject::connect(pushButton1, SIGNAL(clicked()), this, SLOT(slotDepthCheck()));
{
DWORD bytes_write;
char cardname[200]="cardmove_inp";
CMemRdWt mem(m_SelectTableItem.m_strSlfName.toStdString().c_str());
int index_result = mem.OpenStream(cardname);
if(index_result>-1)
{
int len=mem.GetStreamLength(index_result);
if(len>0) {
char *buff=new char[len+1];
DWORD lb=0;
mem.ReadStream(index_result,len,&lb,buff);
pTDialog->document()->setPlainText(buff);
delete buff;
}
}
mem.Close();
}
QDialogButtonBox buttonBox(QDialogButtonBox::Yes|QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, &dialog);
form->addLayout(horizontalLayout);
form->addWidget(&buttonBox);
verticalLayoutWidget->addLayout(form, 0, 0, 1, 1);
connect(pTDialog,SIGNAL(cursorPositionChanged()),
this,SLOT(onCurrentLineHighLight()));
if(buttonBox.button(QDialogButtonBox::Yes)) buttonBox.button(QDialogButtonBox::Yes)->setText("保存");
if(buttonBox.button(QDialogButtonBox::Ok)) buttonBox.button(QDialogButtonBox::Ok)->setText("执行");
QObject::connect(buttonBox.button(QDialogButtonBox::Yes), SIGNAL(clicked()), this, SLOT(slotCardSave()));
QObject::connect(buttonBox.button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(slotCardRun()));
QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
dialog.show();
if (dialog.exec() == QDialog::Accepted) {
pTDialog=NULL;
}
else {
pTDialog=NULL;
return;
}
}
}
//替换
void MainWindowCurve::slotReplace()
{
if(pTDialog)
{
QString sdep=spinbox1->text();
QString edep=spinbox2->text();
if(!sdep.isEmpty()&&!edep.isEmpty())
{
QString str=pTDialog->toPlainText();
str.replace(sdep,edep);
pTDialog->setText(str);
}
}
}
//连续性检查
void MainWindowCurve::slotDepthCheck()
{
QString text=pTDialog->document()->toPlainText();
text.replace("\r\n","\n");
QStringList lines=text.split("\n");
lines.removeAll("");
float sdep1=-9999,edep1=-9999;
QString cname;
QString oline;
for(int i=0;i<lines.size();i++) {
QString line=lines.at(i);
line.replace("",",");
line.replace(" "," ");
line.trimmed();
if(line.compare("end",Qt::CaseInsensitive)==0) break;
QStringList vals=line.split(" ");
vals.removeAll("");
if(vals.size()<2) {
vals=line.split(",");
vals.removeAll("");
}
if(vals.size()<4) continue;
float sdep=vals[1].toFloat();
float edep=vals[2].toFloat();
if(sdep1!=-9999&&cname.compare(vals[0],Qt::CaseInsensitive)==0)
{
if((sdep>sdep1&&sdep!=edep1)||(sdep<sdep1&&sdep1!=edep))
{
int flag = QMessageBox::warning(pTDialog->parentWidget(),
"提示",
line+"\n深度不连续!",
QMessageBox::Ok);
}
}
sdep1=sdep;
edep1=edep;
cname=vals[0];
oline=line;
}
}
//高亮显示当前行
void MainWindowCurve::onCurrentLineHighLight()
{
QTextEdit *edit = (QTextEdit *)pTDialog;
if(!pTDialog) return;
QTextCursor cursor = edit->textCursor();
QList<QTextEdit::ExtraSelection> extraSelection;
QTextEdit::ExtraSelection selection;
QColor lineColor = QColor(Qt::gray).lighter(140);
selection.format.setBackground(lineColor);
selection.format.setProperty(QTextFormat::FullWidthSelection,true);
selection.cursor = cursor;
selection.cursor.clearSelection();
//将刚设置的 selection追加到链表当中
extraSelection.append(selection);
edit->setExtraSelections(extraSelection);
}
//执行
void MainWindowCurve::slotCardRun()
{
QString text=pTDialog->document()->toPlainText();
text.replace("\r\n","\n");
QStringList lines=text.split("\n");
lines.removeAll("");
QStringList ovals;
for(int i=0;i<lines.size();i++) {
QString line=lines.at(i);
line.replace("",",");
line.replace(" "," ");
line.trimmed();
if(line.compare("end",Qt::CaseInsensitive)==0) break;
QStringList vals=line.split(" ");
vals.removeAll("");
if(vals.size()<2) {
vals=line.split(",");
vals.removeAll("");
}
if(vals.size()==1&&vals.at(0).at(0).isLetter()&&ovals.size()){
ovals[0]=vals[0];
vals=ovals;
}
if(vals.size()<4) continue;
double depthshift=vals[3].toFloat();
if(depthshift==0) continue;
if(depthshift>10)
{
int flag = QMessageBox::warning(pTDialog->parentWidget(),"提示",QString("深度移动量 >")+QString::number(depthshift)+"m\n"+line+"\n您确定执行校正?",
QMessageBox::Yes,QMessageBox::No);
if(flag==QMessageBox::No)
{
return;
}
}
//
CMemRdWt * logio=new CMemRdWt();
if(!logio->Open(m_SelectTableItem.m_strSlfName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
//AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败请检查");
return;
}
//
int curveindex=logio->FindObjectName((char*)vals[0].toUpper().toStdString().c_str());
if(curveindex<0)
{
continue;
}
//
float sdepOld=0, edepOld=0;
short curvetype=logio->GetObjectType(curveindex);
if(curvetype>CARD_OBJECT || 0 == curvetype)
{
qDebug() << "strCurveName: " << vals[0];
//表格数据
}
else if(CURVE_OBJECT == curvetype)
{
//曲线
//判断曲线有效性
Slf_CURVE acurveinfo;
logio->GetCurveInfo(curveindex,&acurveinfo);
sdepOld = acurveinfo.StartDepth;
edepOld = acurveinfo.EndDepth;
}
else if(CARD_OBJECT == curvetype)
{
}
else if(WAVE_OBJECT == curvetype)
{
//波列
Slf_WAVE _wave;
logio->GetWaveInfo(curveindex, &_wave);
sdepOld = _wave.StartDepth;
edepOld = _wave.EndDepth;
}
else if(TDT_OBJECT == curvetype)
{
//TDT-》树图
}
delete logio;
//
ovals=vals;
float sdep=vals[1].toFloat();
float edep=vals[2].toFloat();
if(sdep<sdepOld||edep>edepOld)
{
QString str;
str+=vals[0];
str+="深度";
str+=vals[1];
str+="-";
str+=vals[2];
str+="不在原曲线深度";
str+=QString::number(sdepOld);
str+="-";
str+=QString::number(edepOld);
str+="范围内";
if(QMessageBox::information(pTDialog->parentWidget(),"提示",str+",是否继续?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::No) break;
}
MoveShift(m_SelectTableItem.m_strSlfName, vals[0], sdep,edep,depthshift);
}
//
DWORD bytes_write;
char cardname[200]="cardmove_inp";
CMemRdWt mem(m_SelectTableItem.m_strSlfName.toStdString().c_str());
int index_result = mem.CreateStream(PARA_OBJECT,cardname,16384,FALSE);
if(index_result>-1) {
int len=strlen(text.toStdString().c_str());
if(len>0) {
DWORD lb=0;
mem.WriteStream(index_result,len+1,&lb,text.toStdString().c_str());
}
}
mem.Close();
return;
}
//保存
void MainWindowCurve::slotCardSave()
{
QString text=pTDialog->document()->toPlainText();
DWORD bytes_write;
char cardname[200]="cardmove_inp";
CMemRdWt mem(m_SelectTableItem.m_strSlfName.toStdString().c_str());
int index_result = mem.CreateStream(PARA_OBJECT,cardname,16384,FALSE);
if(index_result>-1) {
int len=strlen(text.toStdString().c_str());
if(len>0) {
DWORD lb=0;
mem.WriteStream(index_result,len+1,&lb,text.toStdString().c_str());
}
}
mem.Close();
// AfxMessageBox("保存完毕!");
return;
}
//设置/取消标准(目标拼接)曲线
void MainWindowCurve::s_Standard()
{
@ -3648,11 +3994,16 @@ void MainWindowCurve::s_ExecuteDepthShift()
if(ui->toolBar_2->isHidden())
{
ui->toolBar_2->show();
QMessageBox::information(nullptr, "提示", "校深");
}
else
{
ui->toolBar_2->hide();
QMessageBox::information(nullptr, "提示", "取消校深");
}
//锁头,使居中
s_showHeadTable();
}
//拼接
@ -3672,11 +4023,15 @@ void MainWindowCurve::s_ExecuteMerge()
if(ui->toolBar_3->isHidden())
{
ui->toolBar_3->show();
QMessageBox::information(nullptr, "提示", "拼接");
}
else
{
ui->toolBar_3->hide();
QMessageBox::information(nullptr, "提示", "取消拼接");
}
//锁头,使居中
s_showHeadTable();
}
void MainWindowCurve::s_ModuleOpen()

View File

@ -280,6 +280,8 @@ public:
CModuleConsole* m_pModuleConsole = nullptr; //CModuleConsole
CModuleParamers* m_pModuleDlg = nullptr;
//参数卡深度平移校正
QTextEdit *pTDialog;
public slots:
void s_NewWell(QString strWellName, QString strSlfName, bool bShowTrackHead = true);//新建井
void s_NewTrackChangeWidth(QString strWellName, double nW=0);//新建道后,改变井宽
@ -324,6 +326,20 @@ public slots:
void s_Shift(); // 整体深度平移校正
void MoveShift(QString strSlfName, QString strLineName, float sdep,float edep,float delta);
void s_MoveShift(); // 深度分段平移校正
// 参数卡深度平移校正
void s_CardMoveCurves();
//替换
void slotReplace();
//连续性检查
void slotDepthCheck();
//高亮显示当前行
void onCurrentLineHighLight();
//保存
void slotCardSave();
//执行
void slotCardRun();
void slotRun();
//设置/取消标准曲线
void s_Standard();

View File

@ -27,6 +27,7 @@
#include "ObjWelllog.h"
#include "DataImport.h"
#include "CallGlobalManage.h"
#include "ObjWelllogWavefile.h"
extern QString g_prjname;
// extern void AppendConsole(Priority priority, const QString &output);
@ -965,6 +966,11 @@ void QtProjectWidgets::initWaveObjectTreeMenu(QMenu *menu, QTreeWidget *treeWidg
connect(m_action_DepthResample, SIGNAL(triggered(bool)), this, SLOT(onDepthResample(bool)));
menu->addAction(m_action_DepthResample);
QAction* action_DisplayWave = new QAction("波列曲线预览", treeWidget);
action_DisplayWave->setIcon(QIcon(GetImagePath() + "icon/AddToTrack.png"));
connect(action_DisplayWave, SIGNAL(triggered(bool)), this, SLOT(onDisplayWave(bool)));
menu->addAction(action_DisplayWave);
QAction* action_InfoEdit = new QAction("属性编辑", treeWidget);
action_InfoEdit->setIcon(QIcon(GetImagePath() + "icon/AddToTrack.png"));
connect(action_InfoEdit, SIGNAL(triggered()), this, SLOT(onInfoEdit()));
@ -1065,6 +1071,11 @@ void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget
connect(m_action_DepthResample, SIGNAL(triggered(bool)), this, SLOT(onDepthResample(bool)));
menu->addAction(m_action_DepthResample);
action_New = new QAction("更新数据", treeWidget);
action_New->setIcon(QIcon(GetImagePath() + "icon/Sheet.png")); // 设置图标
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotRefreshData()));
menu->addAction(action_New);
QAction* action_ReName = new QAction("重命名", treeWidget);
action_ReName->setIcon(QIcon(GetImagePath() + "icon/Rename.png")); // 设置图标":/image/u174.png"
connect(action_ReName, SIGNAL(triggered()), this, SLOT(onReNameObject()));
@ -1116,6 +1127,11 @@ void QtProjectWidgets::initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget)
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onWelllogInformation()));
menu->addAction(action_New);
action_New = new QAction("更新数据", treeWidget);
action_New->setIcon(QIcon(GetImagePath() + "icon/Sheet.png")); // 设置图标
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotRefreshData()));
menu->addAction(action_New);
QAction* action_ReName = new QAction("重命名", treeWidget);
action_ReName->setIcon(QIcon(GetImagePath() + "icon/Rename.png")); // 设置图标":/image/u174.png"
connect(action_ReName, SIGNAL(triggered()), this, SLOT(onReNameObject()));
@ -1561,6 +1577,26 @@ void QtProjectWidgets::onCurve2Table(bool checked)
}
}
//波列曲线预览
void QtProjectWidgets::onDisplayWave(bool checked)
{
if (ui->treeWidget->selectedItems().count()!=1)
return;
QTreeWidgetItem *pItem = *ui->treeWidget->selectedItems().begin();
QString strSlfName = pItem->data(0, Qt::UserRole+1).toString();
CObjWellLogWavefile *pround=new CObjWellLogWavefile();
pround->SetName(pItem->text(0));
pround->SetSlfFileName(strSlfName);
QString CurveName=pround->GetName();
QString FileName=pround->GetSlfFileName();
if (NULL==magr)
{
return;
}
magr->DisplayWave(FileName,CurveName);
}
//合成阵列曲线
void QtProjectWidgets::onWaveCompose(bool checked)
{
@ -2359,6 +2395,64 @@ void QtProjectWidgets::RefreshWellRoundTree(QTreeWidgetItem *parentItem)
}
}
void QtProjectWidgets::slotRefreshData()
{
if (ui->treeWidget->selectedItems().count()!=1)
return;
QString strWellName = "";
QString strSlfName = "";
QTreeWidgetItem *pItem = *ui->treeWidget->selectedItems().begin();
QString strTreeTag = pItem->data(0, Qt::UserRole).toString();
if (strTreeTag == "wellname") //井名
{
strWellName = pItem->text(0);
}
else if (strTreeTag == "wellItem") //井次
{
strWellName = pItem->parent()->text(0);
strSlfName = pItem->data(0, Qt::UserRole+1).toString();
}
QString strProjectFolder = GetProjectFolder();
QString strProjectFile = strProjectFolder + g_prjname;
strProjectFile += ".wwl";
s_OpenProject(strProjectFile);
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
int childCount = item->childCount(); // 获取子节点数量
for (int i = 0; i < childCount; ++i)
{
//井组,数据分析...
QTreeWidgetItem *wellGroupItem = item->child(i);
QString wellGroupname = wellGroupItem->text(0);
if (wellGroupname == "井组")
{
int wellCount = wellGroupItem->childCount(); // 获取井节点数量
for (int j = 0; j < wellCount; ++j)
{
//井组,数据分析...
QTreeWidgetItem *wellItem = wellGroupItem->child(j);
QString wellname = wellItem->text(0);
if(wellname==strWellName)//井
{
wellItem->setExpanded(true);
int wellItemCount = wellItem->childCount(); // 获取井次数量
for (int k = 0; k < wellItemCount; ++k)
{
if(strSlfName== wellItem->child(k)->data(0, Qt::UserRole+1).toString())//井次
{
expandAll(wellItem->child(k));
}
}
}
}
}
}
return /*pWell*/;
}
void QtProjectWidgets::onEditWelllogRound()
{
QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin();

View File

@ -59,6 +59,7 @@ public slots:
void onDepthShift(bool checked = false); //深度移动
void onDepthResample(bool checked = false); //深度重采样
void onCurve2Table(bool checked = false); //转换为结论表格
void onDisplayWave(bool checked = false); //波列曲线预览
void onWaveCompose(bool checked = false); //合成阵列曲线
void onCurveCompute(bool checked = false); //曲线计算
void onInfoEdit(bool checked = false); //属性
@ -72,6 +73,7 @@ public slots:
void onSlfbackup(); //备份井次
void onCutSlf(); //剪切井次
void slotRefreshData(); //更新数据
void onEditWelllogRound();
void onImportFolder(); //按目录导入测井数据
void onImportSingleWellLogData(); //数据导入