支持参数卡深度平移校正

This commit is contained in:
jiayulong 2026-06-16 17:06:58 +08:00
parent 0ef7d85bf2
commit f10ff4b527
2 changed files with 374 additions and 3 deletions

View File

@ -30,6 +30,7 @@
#include <QPageSetupDialog>
#include "SetPageMegDlg.h"
#include "chooseShiftCurvesDlg.h"
#include "completertextedit.h"
//主窗口为了方便获取tab当前页
extern MainWindow *g_mainWindow;
@ -1260,7 +1261,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);
@ -1274,7 +1275,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);
@ -1629,6 +1630,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()
{
@ -3542,11 +3888,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();
}
//拼接
@ -3566,11 +3917,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);//新建道后,改变井宽
@ -323,7 +325,21 @@ public slots:
void ApplyShiftDepth(QString strSlfName, QString strLineName, double DepthOffset);
void s_Shift(); // 整体深度平移校正
void MoveShift(QString strSlfName, QString strLineName, float sdep,float edep,float delta);
void s_MoveShift(); // 深度分段平移校正
void s_MoveShift(); // 深度分段平移校正
// 参数卡深度平移校正
void s_CardMoveCurves();
//替换
void slotReplace();
//连续性检查
void slotDepthCheck();
//高亮显示当前行
void onCurrentLineHighLight();
//保存
void slotCardSave();
//执行
void slotCardRun();
void slotRun();
//设置/取消标准曲线
void s_Standard();