添加测井信息表,表格内容复制黏贴添加行删除行等右键操作

This commit is contained in:
zhaolei 2025-11-20 15:13:47 +08:00
parent 7fbc11fef7
commit 323769671a
8 changed files with 497 additions and 389 deletions

View File

@ -39,6 +39,7 @@ signals:
void sig_ShowCurve(QString strSlfName, QString strName);//曲线数据查看 void sig_ShowCurve(QString strSlfName, QString strName);//曲线数据查看
void sig_ShowTable(QString strSlfName, QString strName);//表格数据查看 void sig_ShowTable(QString strSlfName, QString strName);//表格数据查看
void sig_WelllogInformation(QString strSlfName, QString strName);//编辑测井信息
void sig_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType);//新建道 void sig_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType);//新建道
void sig_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);//新建空白道,没有曲线 void sig_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);//新建空白道,没有曲线

View File

@ -3,6 +3,7 @@
#include <QObject> #include <QObject>
#include <QDir> #include <QDir>
#include <QCoreApplication> #include <QCoreApplication>
#pragma execution_character_set("utf-8")
char* GetDescription(LAYER_DATA &m_Result,char *buf) char* GetDescription(LAYER_DATA &m_Result,char *buf)
{ {
buf[0]=0; buf[0]=0;
@ -2866,8 +2867,8 @@ int CLogIO::SetTableFieldData(int index,int FieldNo,char *buf,int Rec)
if(field[i].Reserved&&!IsChange) { if(field[i].Reserved&&!IsChange) {
int flag=0; int flag=0;
if(field[i].Reserved>0&&field[i].Reserved<=m_MenuNumber) if(field[i].Reserved>0&&field[i].Reserved<=m_MenuNumber)
{ {
if(isalpha(buf[0])||(buf[0]&0x80&&buf[1]&0x80)) { if(/*isalpha(buf[0])||*/(buf[0]&0x80&&buf[1]&0x80)) {
float ind=GetReservedIndex(buf,field[i].Reserved); float ind=GetReservedIndex(buf,field[i].Reserved);
if(ind>-1) { if(ind>-1) {
SetData(field[FieldNo].RepCode,&Buffer[len],(float *)&ind); SetData(field[FieldNo].RepCode,&Buffer[len],(float *)&ind);

View File

@ -519,19 +519,19 @@ bool WellLogTableDialogNew::event(QEvent *evt)
} }
bool isEvent=QDialog::event(evt); bool isEvent=QDialog::event(evt);
// if(evt->type()==QEvent::Paint) if(evt->type()==QEvent::Paint)
// { {
// m_gridData->CommitToSave(); m_gridData->CommitToSave();
// }else if(evt->type()==QEvent::ContextMenu) }else if(evt->type()==QEvent::ContextMenu)
// { {
// QPoint point= m_pUI->tableWidget->mapFromGlobal(QCursor::pos()); QPoint point= m_pUI->tableWidget->mapFromGlobal(QCursor::pos());
// if(m_pUI->tableWidget->rect().contains(point)) if(m_pUI->tableWidget->rect().contains(point))
// { {
// // emit m_pUI->tableWidget->cus//->customContextMenuRequested(QCursor::pos()); // emit m_pUI->tableWidget->cus//->customContextMenuRequested(QCursor::pos());
// m_gridData->reqCustomComtextMenu(QCursor::pos()); m_gridData->reqCustomComtextMenu(QCursor::pos());
// } }
// } }
return isEvent; return isEvent;
} }
void WellLogTableDialogNew::slotSave() void WellLogTableDialogNew::slotSave()
@ -560,144 +560,144 @@ void WellLogTableDialogNew::slotSave()
// m_pWell->SetZ( &vZ ); // m_pWell->SetZ( &vZ );
// } // }
// else if(m_rendererType == 2 && m_pWellLogs.size()) // else if(m_rendererType == 2 && m_pWellLogs.size())
// { {
// bool flag=false; bool flag=false;
// CLogIO *logio=new CLogIO; CLogIO *logio=new CLogIO;
// if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) {
// delete logio; delete logio;
// return; return;
// } }
// int index=logio->OpenCurve(m_pWellLogs[0]->GetName().toStdString().c_str()); int index=logio->OpenCurve(m_pWellLogs[0]->GetName().toStdString().c_str());
// if(index>-1) { if(index>-1) {
// flag=1; flag=1;
// } }
// if(index>-1) logio->CloseCurve(index); if(index>-1) logio->CloseCurve(index);
// delete logio; delete logio;
// CCurveLineLog* pCurveLineLog=dynamic_cast<CCurveLineLog*>(m_pWellLogs[0]); // CCurveLineLog* pCurveLineLog=dynamic_cast<CCurveLineLog*>(m_pWellLogs[0]);
// if (NULL != pCurveLineLog)//initWellLogData 曲线、井眼轨迹下级数据 // if (NULL != pCurveLineLog)//initWellLogData 曲线、井眼轨迹下级数据
// { // {
// flag=true; // flag=true;
// pCurveLineLog->ClearLines(); // pCurveLineLog->ClearLines();
// for(int index=0; index<rowCount; index++) // for(int index=0; index<rowCount; index++)
// { // {
// if(m_pUI->tableWidget->item(index,0)) { // if(m_pUI->tableWidget->item(index,0)) {
// float depth = m_pUI->tableWidget->item(index,0)->text().toFloat(); // float depth = m_pUI->tableWidget->item(index,0)->text().toFloat();
// pCurveLineLog->AddLine(depth, depth); // pCurveLineLog->AddLine(depth, depth);
// } // }
// } // }
// emit signalSave(); // emit signalSave();
// return; // return;
// } // }
// if(flag) if(flag)
// {//initMultWellLogData {//initMultWellLogData
// CLogIO *logio=new CLogIO; CLogIO *logio=new CLogIO;
// if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) {
// delete logio; delete logio;
// return; return;
// } }
// int count=rowCount; int count=rowCount;
// for(int j=0;j<m_pWellLogs.size();j++) for(int j=0;j<m_pWellLogs.size();j++)
// { {
// int index=logio->OpenCurve(m_pWellLogs[j]->GetName().toStdString().c_str()); int index=logio->OpenCurve(m_pWellLogs[j]->GetName().toStdString().c_str());
// if(index>-1) if(index>-1)
// { {
// float *data=new float[rowCount+1]; float *data=new float[rowCount+1];
// float sdep=0; float sdep=0;
// for(int i=0; i<rowCount; i++) for(int i=0; i<rowCount; i++)
// { {
// if(!m_pUI->tableWidget->item(i,0)) { if(!m_pUI->tableWidget->item(i,0)) {
// count=i; count=i;
// break; break;
// } }
// if(i==0) if(i==0)
// { {
// QString topDepth = m_pUI->tableWidget->item(i,0)->text(); QString topDepth = m_pUI->tableWidget->item(i,0)->text();
// sdep=topDepth.toFloat(); sdep=topDepth.toFloat();
// } }
// QString values ="-9999"; QString values ="-9999";
// if(m_pUI->tableWidget->item(i,j+1)) values=m_pUI->tableWidget->item(i,j+1)->text(); if(m_pUI->tableWidget->item(i,j+1)) values=m_pUI->tableWidget->item(i,j+1)->text();
// data[i]=values.toFloat(); data[i]=values.toFloat();
// } }
// logio->WriteCurve(index,sdep,count,data); logio->WriteCurve(index,sdep,count,data);
// delete data; delete data;
// logio->CloseCurve(index); logio->CloseCurve(index);
// } }
// m_pWellLogs[j]->isLoad=false; m_pWellLogs[j]->isLoad=false;
// m_pWellLogs[j]->LoadFromSLF(); m_pWellLogs[j]->LoadFromSLF();
// } }
// delete logio; delete logio;
// GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName()); // GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName());
// GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this); // GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this);
// m_gridData->ReFreshDisplayCurve(); m_gridData->ReFreshDisplayCurve();
// } }
// else //initTableWellLogData else //initTableWellLogData
// { {
// flag=true; flag=true;
// CLogIO *logio=new CLogIO; CLogIO *logio=new CLogIO;
// if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) {
// delete logio; delete logio;
// return; return;
// } }
// int iIndex=logio->OpenTable(m_pWellLogs[0]->GetName().toStdString().c_str()); int iIndex=logio->OpenTable(m_pWellLogs[0]->GetName().toStdString().c_str());
// if (iIndex >=0) if (iIndex >=0)
// { {
// int fc=logio->GetTableFieldCount(iIndex); int fc=logio->GetTableFieldCount(iIndex);
// Slf_TABLE_FIELD *field = new Slf_TABLE_FIELD[fc+1]; Slf_TABLE_FIELD *field = new Slf_TABLE_FIELD[fc+1];
// logio->GetTableFieldInfo(iIndex,field); logio->GetTableFieldInfo(iIndex,field);
// int rowCount = m_pUI->tableWidget->rowCount(); int rowCount = m_pUI->tableWidget->rowCount();
// int count = 0; int count = 0;
// int n = 0; int n = 0;
// bool allNoneRow = true; //全空列标记 bool allNoneRow = true; //全空列标记
// for(int row = rowCount - 1; row >= 0; row--) //遍历行 for(int row = rowCount - 1; row >= 0; row--) //遍历行
// { {
// for(int j = 0; j < fc; j++) //遍历列 for(int j = 0; j < fc; j++) //遍历列
// { {
// if(!m_pUI->tableWidget->item(row, j)) if(!m_pUI->tableWidget->item(row, j))
// continue; continue;
// if(m_pUI->tableWidget->item(row, j)->text() != "") if(m_pUI->tableWidget->item(row, j)->text() != "")
// allNoneRow = false; allNoneRow = false;
// } }
// if(allNoneRow) if(allNoneRow)
// { {
// rowCount--; rowCount--;
// continue; continue;
// } }
// for(int j = 0; j < fc; j++) //遍历列 for(int j = 0; j < fc; j++) //遍历列
// { {
// QString mColumn = "0"; QString mColumn = "0";
// if(m_pUI->tableWidget->item(row, j)) if(m_pUI->tableWidget->item(row, j))
// mColumn = m_pUI->tableWidget->item(row, j)->text(); mColumn = m_pUI->tableWidget->item(row, j)->text();
// char buf[513]; char buf[513];
// if(field[j].RepCode == 6 || field[j].Reserved) if(field[j].RepCode == 6 || field[j].Reserved)
// { {
// strcpy(buf, mColumn.toStdString().c_str()); strcpy(buf, mColumn.toStdString().c_str());
// logio->SetTableFieldData(iIndex, j, buf, row + 1); logio->SetTableFieldData(iIndex, j, buf, row + 1);
// } }
// else else
// { {
// float val = mColumn.toFloat(); float val = mColumn.toFloat();
// logio->SetTableFieldData(iIndex, j, (char *)&val, row + 1); logio->SetTableFieldData(iIndex, j, (char *)&val, row + 1);
// } }
// } }
// } }
// logio->SetTableRecordCount(iIndex, rowCount); logio->SetTableRecordCount(iIndex, rowCount);
// logio->CloseTable(iIndex); logio->CloseTable(iIndex);
// delete[] field; delete[] field;
// } }
// logio->Close(); logio->Close();
// delete logio; delete logio;
// GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName()); // GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName());
// GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this); // GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this);
// } }
// } }
} }
QMessageBox::about(NULL, "提示", "保存成功"); QMessageBox::about(NULL, "提示", "保存成功");
//QDialog::accept(); //QDialog::accept();

View File

@ -4,7 +4,7 @@
#include <QMimeData> #include <QMimeData>
#include <QClipboard> #include <QClipboard>
#include <qtablewidget.h> #include <qtablewidget.h>
// #include "ObjWellLogTABLE.h" #include "ObjWellLogTABLE.h"
// #include "ObjDiscreteWellLog.h" // #include "ObjDiscreteWellLog.h"
// #include "BaseDialog.h" // #include "BaseDialog.h"
#include "DepthProgress.h" #include "DepthProgress.h"
@ -92,145 +92,145 @@ void AssetCopy::onCopyData()
} }
void AssetCopy::onCopyLinesData() void AssetCopy::onCopyLinesData()
{ {
// if(!m_pWellLogs.size()) return; if(!m_pWellLogs.size()) return;
// m_isParse=false; m_isParse=false;
// if(NULL == m_menu || NULL == m_menu->parent()) return; if(NULL == m_menu || NULL == m_menu->parent()) return;
// QTableWidget *m_table=qobject_cast<QTableWidget*>(m_menu->parent()); QTableWidget *m_table=qobject_cast<QTableWidget*>(m_menu->parent());
// if(NULL == m_table) if(NULL == m_table)
// return; return;
// //if(m_table->isVisible()) //if(m_table->isVisible())
// QList<QTableWidgetItem*> selItems=m_table->selectedItems(); QList<QTableWidgetItem*> selItems=m_table->selectedItems();
// QList<QTableWidgetSelectionRange> selRanges=m_table->selectedRanges(); QList<QTableWidgetSelectionRange> selRanges=m_table->selectedRanges();
// CObjWellLogWavefile *pWaveValue=NULL; // CObjWellLogWavefile *pWaveValue=NULL;
// pWaveValue=dynamic_cast<CObjWellLogWavefile *>(m_pWellLogs[0]); // pWaveValue=dynamic_cast<CObjWellLogWavefile *>(m_pWellLogs[0]);
// CObjWellLogTABLE *pTableValue=NULL; CObjWellLogTABLE *pTableValue=NULL;
// pTableValue=dynamic_cast<CObjWellLogTABLE *>(m_pWellLogs[0]); pTableValue=dynamic_cast<CObjWellLogTABLE *>(m_pWellLogs[0]);
// if(selItems.size()>0) if(selItems.size()>0)
// { {
// QTableWidgetSelectionRange copyRange=selRanges.value(0); QTableWidgetSelectionRange copyRange=selRanges.value(0);
// int top = m_verScrolValue+copyRange.topRow(); int top = m_verScrolValue+copyRange.topRow();
// int bottom = m_verScrolValue+copyRange.bottomRow(); int bottom = m_verScrolValue+copyRange.bottomRow();
// int left = 0;//copyRange.leftColumn(); int left = 0;//copyRange.leftColumn();
// int right = m_horScrolValue+m_table->columnCount(); int right = m_horScrolValue+m_table->columnCount();
// if(pWaveValue) right =pWaveValue->waveinfo.TimeSamples; /* if(pWaveValue) right =pWaveValue->waveinfo.TimeSamples;
// else if(!pTableValue) right=m_pWellLogs.size(); else */if(!pTableValue) right=m_pWellLogs.size();
// char buffer[200]; char buffer[200];
// QString szClipText; QString szClipText;
// float stdep=999999; float stdep=999999;
// for(int i = 0; i < m_pWellLogs.size(); i++) { for(int i = 0; i < m_pWellLogs.size(); i++) {
// if(m_pWellLogs[i]->acurveinfo.StartDepth<stdep) if(m_pWellLogs[i]->acurveinfo.StartDepth<stdep)
// stdep = m_pWellLogs[i]->acurveinfo.StartDepth; stdep = m_pWellLogs[i]->acurveinfo.StartDepth;
// } }
// double dep=0; double dep=0;
// int nCurrentRow = m_table->currentRow(); int nCurrentRow = m_table->currentRow();
// for(int nRow = top;nRow <= bottom; nRow++) for(int nRow = top;nRow <= bottom; nRow++)
// { {
// if(!pTableValue) if(!pTableValue)
// dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel; dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel;
// for(int nCol = left;nCol < right; nCol++) for(int nCol = left;nCol < right; nCol++)
// { {
// QString szTmp; QString szTmp;
// if(nCol==0||pTableValue) { if(nCol==0||pTableValue) {
// auto pItem = m_table->item(nRow,nCol); auto pItem = m_table->item(nRow,nCol);
// if(pItem) if(pItem)
// szTmp = pItem->text(); szTmp = pItem->text();
// else else
// szTmp=toString(dep,'f',5,0); szTmp=toString(dep,'f',5,0);
// } }
// else { else {
// if(pWaveValue) szTmp=toString(pWaveValue->GetData((float)dep,nCol-1,buffer),'f',DECIMALPLACESNUM,0); /* if(pWaveValue) szTmp=toString(pWaveValue->GetData((float)dep,nCol-1,buffer),'f',DECIMALPLACESNUM,0);
// else szTmp=toString(m_pWellLogs[nCol-1]->GetData((float)dep),'f',DECIMALPLACESNUM,0); else */szTmp=toString(m_pWellLogs[nCol-1]->GetData((float)dep),'f',DECIMALPLACESNUM,0);
// } }
// szClipText.append(szTmp); szClipText.append(szTmp);
// szClipText.append("\t"); szClipText.append("\t");
// } }
// szClipText.chop(1); szClipText.chop(1);
// szClipText.append("\n"); szClipText.append("\n");
// } }
// QClipboard* clip=QApplication::clipboard(); QClipboard* clip=QApplication::clipboard();
// clip->setText(szClipText); clip->setText(szClipText);
// } }
} }
void AssetCopy::onCopyColnumsData() void AssetCopy::onCopyColnumsData()
{ {
// if(!m_pWellLogs.size()) return; if(!m_pWellLogs.size()) return;
// m_isParse=false; m_isParse=false;
// if(NULL == m_menu || NULL == m_menu->parent()) if(NULL == m_menu || NULL == m_menu->parent())
// return; return;
// QTableWidget *m_table=qobject_cast<QTableWidget*>(m_menu->parent()); QTableWidget *m_table=qobject_cast<QTableWidget*>(m_menu->parent());
// if(NULL == m_table) if(NULL == m_table)
// return; return;
// //if(m_table->isVisible()) //if(m_table->isVisible())
// CObjWellLogWavefile *pWaveValue=NULL; // CObjWellLogWavefile *pWaveValue=NULL;
// pWaveValue=dynamic_cast<CObjWellLogWavefile *>(m_pWellLogs[0]); // pWaveValue=dynamic_cast<CObjWellLogWavefile *>(m_pWellLogs[0]);
// CObjWellLogTABLE *pTableValue=NULL; CObjWellLogTABLE *pTableValue=NULL;
// CObjDiscreteWellLog *pTableValue1=NULL; // CObjDiscreteWellLog *pTableValue1=NULL;
// pTableValue=dynamic_cast<CObjWellLogTABLE *>(m_pWellLogs[0]); pTableValue=dynamic_cast<CObjWellLogTABLE *>(m_pWellLogs[0]);
// pTableValue1=dynamic_cast<CObjDiscreteWellLog *>(m_pWellLogs[0]); // pTableValue1=dynamic_cast<CObjDiscreteWellLog *>(m_pWellLogs[0]);
// QList<QTableWidgetItem*> selItems=m_table->selectedItems(); QList<QTableWidgetItem*> selItems=m_table->selectedItems();
// QList<QTableWidgetSelectionRange> selRanges=m_table->selectedRanges(); QList<QTableWidgetSelectionRange> selRanges=m_table->selectedRanges();
// float stdep=999999; float stdep=999999;
// for(int i=0;i<m_pWellLogs.size();i++) { for(int i=0;i<m_pWellLogs.size();i++) {
// if(m_pWellLogs[i]->acurveinfo.StartDepth<stdep) stdep=m_pWellLogs[i]->acurveinfo.StartDepth; if(m_pWellLogs[i]->acurveinfo.StartDepth<stdep) stdep=m_pWellLogs[i]->acurveinfo.StartDepth;
// } }
// if(selItems.size()>0) if(selItems.size()>0)
// { {
// QTableWidgetSelectionRange copyRange=selRanges.value(0); QTableWidgetSelectionRange copyRange=selRanges.value(0);
// int top = 0;//copyRange.topRow(); int top = 0;//copyRange.topRow();
// int bottom = m_table->rowCount();//copyRange.bottomRow(); int bottom = m_table->rowCount();//copyRange.bottomRow();
// int left = m_horScrolValue+copyRange.leftColumn(); int left = m_horScrolValue+copyRange.leftColumn();
// int right =m_horScrolValue+copyRange.rightColumn(); int right =m_horScrolValue+copyRange.rightColumn();
// if(!pTableValue&&!pTableValue1&&!pWaveValue) if(!pTableValue/*&&!pTableValue1&&!pWaveValue*/)
// { {
// bottom=(m_pWellLogs[0]->acurveinfo.EndDepth-m_pWellLogs[0]->acurveinfo.StartDepth)/m_pWellLogs[0]->acurveinfo.DepLevel+0.5; bottom=(m_pWellLogs[0]->acurveinfo.EndDepth-m_pWellLogs[0]->acurveinfo.StartDepth)/m_pWellLogs[0]->acurveinfo.DepLevel+0.5;
// } }
// else if(pWaveValue) { // else if(pWaveValue) {
// bottom=(pWaveValue->waveinfo.EndDepth-pWaveValue->waveinfo.StartDepth)/pWaveValue->waveinfo.DepLevel+0.5; // bottom=(pWaveValue->waveinfo.EndDepth-pWaveValue->waveinfo.StartDepth)/pWaveValue->waveinfo.DepLevel+0.5;
// } // }
// QString szClipText; QString szClipText;
// char buffer[200]; char buffer[200];
// QString szTmp; QString szTmp;
// float dep=0; float dep=0;
// for(int nRow = top;nRow <=bottom;nRow++) for(int nRow = top;nRow <=bottom;nRow++)
// { {
// if(!pTableValue&&!pTableValue1)dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel; if(!pTableValue/*&&!pTableValue1*/)dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel;
// for(int nCol = left;nCol <=right;nCol++) for(int nCol = left;nCol <=right;nCol++)
// { {
// if(nCol==0||pTableValue||pTableValue1) { if(nCol==0||pTableValue/*||pTableValue1*/) {
// auto pItem = m_table->item(nRow,nCol); auto pItem = m_table->item(nRow,nCol);
// if(pItem) if(pItem)
// szTmp = pItem->text(); szTmp = pItem->text();
// else if(nCol==0) { else if(nCol==0) {
// float val=szTmp.toFloat(); float val=szTmp.toFloat();
// sprintf(buffer,"%8.3f",val+m_pWellLogs[0]->acurveinfo.DepLevel); sprintf(buffer,"%8.3f",val+m_pWellLogs[0]->acurveinfo.DepLevel);
// szTmp =buffer ; szTmp =buffer ;
// } }
// } }
// else { else {
// if(pWaveValue) szTmp=toString(pWaveValue->GetData(dep,nCol-1,buffer),'f',0); /* if(pWaveValue) szTmp=toString(pWaveValue->GetData(dep,nCol-1,buffer),'f',0);
// else szTmp=toString(m_pWellLogs[nCol-1]->GetData(dep),'f',DECIMALPLACESNUM,0); else */szTmp=toString(m_pWellLogs[nCol-1]->GetData(dep),'f',DECIMALPLACESNUM,0);
// } }
// szClipText.append(szTmp); szClipText.append(szTmp);
// szClipText.append("\t"); szClipText.append("\t");
// } }
// szClipText.chop(1); szClipText.chop(1);
// szClipText.append("\n"); szClipText.append("\n");
// } }
// QClipboard* clip=QApplication::clipboard(); QClipboard* clip=QApplication::clipboard();
// clip->setText(szClipText); clip->setText(szClipText);
// } }
} }
void AssetCopy::cacheGridData(const QTableWidgetSelectionRange& m_selectionRange) void AssetCopy::cacheGridData(const QTableWidgetSelectionRange& m_selectionRange)
@ -513,161 +513,161 @@ void AssetCopy::reqCustomComtextMenu(const QPoint &pos)
void AssetCopy::onParseData() void AssetCopy::onParseData()
{ {
// if(type == D_MultWellLogData) if(type == D_MultWellLogData)
// { {
// int choose = QMessageBox::question(NULL, tr("提示"), int choose = QMessageBox::question(NULL, tr("提示"),
// QString(tr("该数据格式下,粘贴后将直接存储,是否粘贴?")), QString(tr("该数据格式下,粘贴后将直接存储,是否粘贴?")),
// QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
// if(choose == QMessageBox::No) if(choose == QMessageBox::No)
// return; return;
// } }
// if(!m_pWellLogs.size()) return; if(!m_pWellLogs.size()) return;
// if(NULL == m_menu || NULL == m_menu->parent()) if(NULL == m_menu || NULL == m_menu->parent())
// return; return;
// QTableWidget *m_table=qobject_cast<QTableWidget*>(m_menu->parent()); QTableWidget *m_table=qobject_cast<QTableWidget*>(m_menu->parent());
// if(NULL == m_table) if(NULL == m_table)
// return; return;
// QClipboard* pClip = QApplication::clipboard(); QClipboard* pClip = QApplication::clipboard();
// QString szText = pClip->text(); QString szText = pClip->text();
// if(szText.isEmpty()) if(szText.isEmpty())
// return; return;
// int nSpace = 0; int nSpace = 0;
// int nDou=0; int nDou=0;
// int nTab =0; int nTab =0;
// DepthProgress MyDepthProgress2; DepthProgress MyDepthProgress2;
// MyDepthProgress2.CreatProgress(0, szText.size(), "粘贴内容检查中..."); MyDepthProgress2.CreatProgress(0, szText.size(), "粘贴内容检查中...");
// for(int nIndex =0;nIndex<szText.size();++nIndex) for(int nIndex =0;nIndex<szText.size();++nIndex)
// { {
// if(szText[nIndex]=='\t') if(szText[nIndex]=='\t')
// { {
// nTab++; nTab++;
// } }
// else if(szText[nIndex]==' ') else if(szText[nIndex]==' ')
// { {
// nSpace++; nSpace++;
// } }
// else if(szText[nIndex]==',') else if(szText[nIndex]==',')
// { {
// nDou++; nDou++;
// } }
// MyDepthProgress2.SetDepth(nIndex); MyDepthProgress2.SetDepth(nIndex);
// } }
// int nMax = nSpace>nDou ? nSpace : nDou; int nMax = nSpace>nDou ? nSpace : nDou;
// nMax = nMax>nTab ? nMax : nTab; nMax = nMax>nTab ? nMax : nTab;
// char rFlag; char rFlag;
// if(nMax==nTab) if(nMax==nTab)
// { {
// rFlag ='\t'; rFlag ='\t';
// } }
// else if(nMax==nSpace) else if(nMax==nSpace)
// { {
// rFlag =' '; rFlag =' ';
// } }
// else if(nMax==nDou) else if(nMax==nDou)
// { {
// rFlag =','; rFlag =',';
// } }
// m_table->clearSelection(); m_table->clearSelection();
// QStringList rSplitList = szText.split('\n'); QStringList rSplitList = szText.split('\n');
// if(rSplitList.size()&&rSplitList[rSplitList.size()-1]=="") rSplitList.removeAt(rSplitList.size()-1); if(rSplitList.size()&&rSplitList[rSplitList.size()-1]=="") rSplitList.removeAt(rSplitList.size()-1);
// CObjWellLogWavefile *pWaveValue=NULL; // CObjWellLogWavefile *pWaveValue=NULL;
// pWaveValue=dynamic_cast<CObjWellLogWavefile *>(m_pWellLogs[0]); // pWaveValue=dynamic_cast<CObjWellLogWavefile *>(m_pWellLogs[0]);
// CObjWellLogTABLE *pTableValue=NULL; CObjWellLogTABLE *pTableValue=NULL;
// pTableValue=dynamic_cast<CObjWellLogTABLE *>(m_pWellLogs[0]); pTableValue=dynamic_cast<CObjWellLogTABLE *>(m_pWellLogs[0]);
// CObjDiscreteWellLog *pTableValue1=NULL; // CObjDiscreteWellLog *pTableValue1=NULL;
// pTableValue1=dynamic_cast<CObjDiscreteWellLog *>(m_pWellLogs[0]); // pTableValue1=dynamic_cast<CObjDiscreteWellLog *>(m_pWellLogs[0]);
// float stdep=999999; float stdep=999999;
// for(int i=0;i<m_pWellLogs.size();i++) { for(int i=0;i<m_pWellLogs.size();i++) {
// if(m_pWellLogs[i]->acurveinfo.StartDepth<stdep) stdep=m_pWellLogs[i]->acurveinfo.StartDepth; if(m_pWellLogs[i]->acurveinfo.StartDepth<stdep) stdep=m_pWellLogs[i]->acurveinfo.StartDepth;
// } }
// float dep=0; float dep=0;
// //起始行 //起始行
// int nCurrentRow = m_table->currentRow(); int nCurrentRow = m_table->currentRow();
// //纵向扩充表格 //纵向扩充表格
// MyDepthProgress2.CreatProgress(0, rSplitList.size(), "表格建设中..."); MyDepthProgress2.CreatProgress(0, rSplitList.size(), "表格建设中...");
// MyDepthProgress2.SetDepth(0); MyDepthProgress2.SetDepth(0);
// for(int cTemp = nCurrentRow; cTemp < (nCurrentRow + rSplitList.size()); cTemp++){ for(int cTemp = nCurrentRow; cTemp < (nCurrentRow + rSplitList.size()); cTemp++){
// if(cTemp >= m_table->rowCount()) if(cTemp >= m_table->rowCount())
// needANewLine(cTemp); needANewLine(cTemp);
// MyDepthProgress2.SetDepth(cTemp - nCurrentRow); MyDepthProgress2.SetDepth(cTemp - nCurrentRow);
// } }
// //进度条 //进度条
// int curprogre = 0; int curprogre = 0;
// MyDepthProgress2.CreatProgress(0, rSplitList.size(), "数据归位..."); MyDepthProgress2.CreatProgress(0, rSplitList.size(), "数据归位...");
// MyDepthProgress2.SetDepth(0); MyDepthProgress2.SetDepth(0);
// for(int nRow = 0; nRow < rSplitList.size(); ++nRow) for(int nRow = 0; nRow < rSplitList.size(); ++nRow)
// { {
// if(!pTableValue) if(!pTableValue)
// dep = stdep + (m_verScrolValue + nCurrentRow) * m_pWellLogs[0]->acurveinfo.DepLevel; dep = stdep + (m_verScrolValue + nCurrentRow) * m_pWellLogs[0]->acurveinfo.DepLevel;
// //起始列 //起始列
// int nCurrentColumn = m_table->currentColumn(); int nCurrentColumn = m_table->currentColumn();
// QStringList rColumnList = rSplitList[nRow].split(rFlag); QStringList rColumnList = rSplitList[nRow].split(rFlag);
// for(int nCol = 0; nCol < rColumnList.size(); nCol++) for(int nCol = 0; nCol < rColumnList.size(); nCol++)
// { {
// if(pTableValue||pTableValue1) { if(pTableValue/*||pTableValue1*/) {
// //空替换 //空替换
// if(rColumnList[nCol].isEmpty() ) rColumnList[nCol] = ""; if(rColumnList[nCol].isEmpty() ) rColumnList[nCol] = "";
// auto pItem = m_table->item(nCurrentRow, nCurrentColumn); auto pItem = m_table->item(nCurrentRow, nCurrentColumn);
// //写值 //写值
// if(pItem) if(pItem)
// pItem->setText(rColumnList[nCol]); pItem->setText(rColumnList[nCol]);
// else else
// { {
// QTableWidgetItem* pItem = new QTableWidgetItem; QTableWidgetItem* pItem = new QTableWidgetItem;
// pItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsTristate); pItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsTristate);
// pItem->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//对齐 pItem->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//对齐
// if(nCurrentColumn == 0) pItem->setFlags(pItem->flags() & (~Qt::ItemIsEditable)); if(nCurrentColumn == 0) pItem->setFlags(pItem->flags() & (~Qt::ItemIsEditable));
// pItem->setFont(QFont("Times",10)); pItem->setFont(QFont("Times",10));
// m_table->setItem(nCurrentRow, nCurrentColumn, pItem); m_table->setItem(nCurrentRow, nCurrentColumn, pItem);
// pItem->setText(rColumnList[nCol]); pItem->setText(rColumnList[nCol]);
// } }
// } }
// else if(nCurrentColumn){ else if(nCurrentColumn){
// float val=rColumnList[nCol].toFloat(); float val=rColumnList[nCol].toFloat();
// if(pWaveValue) pWaveValue->SetData(dep,m_horScrolValue+nCurrentColumn-1,&val); /* if(pWaveValue) pWaveValue->SetData(dep,m_horScrolValue+nCurrentColumn-1,&val);
// else m_pWellLogs[m_horScrolValue+nCurrentColumn-1]->SetData(dep,&val); else */m_pWellLogs[m_horScrolValue+nCurrentColumn-1]->SetData(dep,&val);
// } }
// nCurrentColumn++; nCurrentColumn++;
// MyDepthProgress2.SetDepth(++curprogre); MyDepthProgress2.SetDepth(++curprogre);
// } }
// nCurrentRow++; nCurrentRow++;
// } }
// if(!pTableValue) if(!pTableValue)
// for(int i=0;i<m_pWellLogs.size();i++) for(int i=0;i<m_pWellLogs.size();i++)
// { {
// m_pWellLogs[i]->SetModify(true); m_pWellLogs[i]->SetModify(true);
// m_pWellLogs[i]->SaveToSLF(); m_pWellLogs[i]->SaveToSLF();
// } }
// emit saveToTempModel(); emit saveToTempModel();
/* /*
CBaseDialog *pTableDialog=(CBaseDialog*)(m_table->parent()); CBaseDialog *pTableDialog=(CBaseDialog*)(m_table->parent());

View File

@ -80,6 +80,9 @@ MainWindow::MainWindow(QWidget *parent) :
//关联信号槽,数据查看 //关联信号槽,数据查看
connect(CallManage::getInstance(), SIGNAL(sig_ShowTable(QString, QString)), this, SLOT(s_ShowTable(QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_ShowTable(QString, QString)), this, SLOT(s_ShowTable(QString, QString)));
//关联信号槽,测井信息表数据查看
connect(CallManage::getInstance(), SIGNAL(sig_WelllogInformation(QString, QString)), this, SLOT(s_WelllogInformation(QString, QString)));
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -479,3 +482,78 @@ void MainWindow::s_ShowTable(QString strSlfName, QString strName)
m_centerWidgets->m_pTabBar->setCurrentIndex(iCount-1); m_centerWidgets->m_pTabBar->setCurrentIndex(iCount-1);
} }
} }
//编辑测井信息
void MainWindow::s_WelllogInformation(QString strSlfName, QString strName)
{
if(m_centerWidgets)
{
// pai::gui::WellLogInformation* pWellLogInformation=new pai::gui::WellLogInformation;
// pWellLogInformation->exec();
// pWellLogInformation->SetWelllogRound(pWelllogRound);
CLogIO * pLogio=new CLogIO();
if(!pLogio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeReadWrite))
{
QMessageBox::information(nullptr,QString::fromLocal8Bit("提示"),QString::fromLocal8Bit("存储失败!"));
delete pLogio;
return;
}
// pWellLogInformation->CreateTable(pLogio);
QString wellname;QString path;
GetWellNameAndPath(strSlfName, wellname, path);
// m_centerWidgets->addTab(pWellLogInformation, wellname + ":测井信息" );
// int iCount = m_centerWidgets->count();
// m_centerWidgets->m_pTabBar->setCurrentIndex(iCount-1);
int nTableFlag =pLogio->OpenTable("wellloginformation");
if(nTableFlag!=-1)
{
s_ShowTable(strSlfName, "wellloginformation");
return;
}
QString szColumnName;
szColumnName+=("缩写");szColumnName+=",";
szColumnName+=("");szColumnName+=",";
szColumnName+=("单位");szColumnName+=",";
szColumnName+=("中文名");szColumnName+=",";
QString szDataType;
szDataType+="6,6,6,6";
QString szSize;
szSize+="64,128,64,128";
QString szRemark;
szRemark+="0,0,0,0";
nTableFlag =pLogio->Open_Set_Table("wellloginformation",
TABLEE_OBJECT,
4,
// szColumnName.toLocal8Bit().data(),
szColumnName.toStdString().c_str(),
szSize.toLocal8Bit().data(),
szDataType.toLocal8Bit().data(),
szRemark.toLocal8Bit().data());
int nTableColumn=pLogio->GetTableFieldCount(nTableFlag);
Slf_TABLE_FIELD *pFieldInfo=new Slf_TABLE_FIELD[nTableColumn+1];
pLogio->GetTableFieldInfo(nTableFlag,pFieldInfo);
char pArr[100];
strcpy(pArr, "WN");
pLogio->SetTableFieldData(nTableFlag,0,pArr,1);//缩写
strcpy(pArr, wellname.toStdString().c_str());
pLogio->SetTableFieldData(nTableFlag,1,pArr,1);//单位
strcpy(pArr, "NONE");
pLogio->SetTableFieldData(nTableFlag,2,pArr,1);//井名
strcpy(pArr, "井名");
pLogio->SetTableFieldData(nTableFlag,3,pArr,1);
s_ShowTable(strSlfName, "wellloginformation");
}
}

View File

@ -88,6 +88,7 @@ public slots:
void s_ShowCurve(QString strSlfName, QString strName);//曲线数据查看 void s_ShowCurve(QString strSlfName, QString strName);//曲线数据查看
void s_ShowTable(QString strSlfName, QString strName);//表格数据查看 void s_ShowTable(QString strSlfName, QString strName);//表格数据查看
void s_WelllogInformation(QString strSlfName, QString strName);//编辑测井信息
}; };

View File

@ -600,7 +600,10 @@ void QtProjectWidgets::initMenu()
_menuWellName = new QMenu(ui->treeWidget); _menuWellName = new QMenu(ui->treeWidget);
initWellNameTreeMenu(_menuWellName, ui->treeWidget); initWellNameTreeMenu(_menuWellName, ui->treeWidget);
_menuSlfName = new QMenu(ui->treeWidget);
initSlfNameTreeMenu(_menuSlfName, ui->treeWidget);
// //评估方案-右键菜单 // //评估方案-右键菜单
// _menuEvaluate = new QMenu(ui->treeWidget); // _menuEvaluate = new QMenu(ui->treeWidget);
// initEvaluateTreeMenu(_menuEvaluate, ui->treeWidget); // initEvaluateTreeMenu(_menuEvaluate, ui->treeWidget);
@ -665,6 +668,15 @@ void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget
menu->addAction(action_New); menu->addAction(action_New);
} }
//初始化根节点(井次名称)-右键菜单
void QtProjectWidgets::initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget)
{
QAction* action_New = new QAction("编辑测井信息", treeWidget);
action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onWelllogInformation()));
menu->addAction(action_New);
}
//新建项目 //新建项目
void QtProjectWidgets::onNewProject(bool checked) void QtProjectWidgets::onNewProject(bool checked)
{ {
@ -725,6 +737,12 @@ void QtProjectWidgets::onShowTable(bool checked)
emit CallManage::getInstance()->sig_ShowTable(m_strSlfName, m_strCurveObjectName); emit CallManage::getInstance()->sig_ShowTable(m_strSlfName, m_strCurveObjectName);
} }
//编辑测井信息
void QtProjectWidgets::onWelllogInformation()
{
emit CallManage::getInstance()->sig_WelllogInformation(m_strSlfName, m_strCurveObjectName);
}
void QtProjectWidgets::onEditWelllogRound() void QtProjectWidgets::onEditWelllogRound()
{ {
QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin(); QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin();
@ -865,7 +883,12 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index)
//根节点(项目名称)-右键菜单 //根节点(项目名称)-右键菜单
popMenu = _menuWellName; popMenu = _menuWellName;
} }
else if (strTreeTag == "wellItem")
{
//根节点(项目名称)-右键菜单
popMenu = _menuSlfName;
m_strSlfName = item->data(0, Qt::UserRole+1).toString();
}
// //
if (qApp->mouseButtons() == Qt::RightButton) // 只针对鼠标右键,弹出菜单 if (qApp->mouseButtons() == Qt::RightButton) // 只针对鼠标右键,弹出菜单

View File

@ -44,6 +44,7 @@ public slots:
void onImportSingleWellLogData(); void onImportSingleWellLogData();
void onImportSlfTable(); void onImportSlfTable();
void onOutWellLogRound(); void onOutWellLogRound();
void onWelllogInformation(); //编辑测井信息
public: public:
//初始化树图控件 //初始化树图控件
void initTreeWidget(QString fullPath, QString strProjectName); void initTreeWidget(QString fullPath, QString strProjectName);
@ -53,7 +54,8 @@ public:
QMenu *_menuRoot; QMenu *_menuRoot;
QMenu *_menuCurveObject;//曲线对象(AC、BS...) QMenu *_menuCurveObject;//曲线对象(AC、BS...)
QMenu *_menuTableObject;//表格对象 QMenu *_menuTableObject;//表格对象
QMenu *_menuWellName; QMenu *_menuWellName; //井名
QMenu *_menuSlfName; //井次
//根节点(项目名称)-右键菜单 //根节点(项目名称)-右键菜单
QAction* m_action_New; QAction* m_action_New;
@ -82,6 +84,8 @@ public:
void initTableObjectTreeMenu(QMenu *menu, QTreeWidget *treeWidget); void initTableObjectTreeMenu(QMenu *menu, QTreeWidget *treeWidget);
//初始化根节点(井名称)-右键菜单 //初始化根节点(井名称)-右键菜单
void initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget); void initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget);
//初始化根节点(井次名称)-右键菜单
void initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget);
private: private:
}; };