From 323769671abfa891ca03ff02befe629380a55b34 Mon Sep 17 00:00:00 2001 From: zhaolei <353719554@qq.com> Date: Thu, 20 Nov 2025 15:13:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E4=BA=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=A1=A8=EF=BC=8C=E8=A1=A8=E6=A0=BC=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E9=BB=8F=E8=B4=B4=E6=B7=BB=E5=8A=A0=E8=A1=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A1=8C=E7=AD=89=E5=8F=B3=E9=94=AE=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CallManage/CallManage.h | 1 + Slfio/src/LogIO.cpp | 5 +- WellLogUI/src/WellLogTableDialogNew.cpp | 286 +++++++------- WellLogUI/src/assetcopy.cpp | 482 ++++++++++++------------ logPlus/mainwindow.cpp | 78 ++++ logPlus/mainwindow.h | 1 + logPlus/qtprojectwidgets.cpp | 27 +- logPlus/qtprojectwidgets.h | 6 +- 8 files changed, 497 insertions(+), 389 deletions(-) diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 90dba82..ba0f84c 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -39,6 +39,7 @@ signals: void sig_ShowCurve(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_No_Line(QString strUuid, QString strWellName, QString strTrackName);//新建空白道,没有曲线 diff --git a/Slfio/src/LogIO.cpp b/Slfio/src/LogIO.cpp index 25dc844..f1d6243 100644 --- a/Slfio/src/LogIO.cpp +++ b/Slfio/src/LogIO.cpp @@ -3,6 +3,7 @@ #include #include #include +#pragma execution_character_set("utf-8") char* GetDescription(LAYER_DATA &m_Result,char *buf) { buf[0]=0; @@ -2866,8 +2867,8 @@ int CLogIO::SetTableFieldData(int index,int FieldNo,char *buf,int Rec) if(field[i].Reserved&&!IsChange) { int flag=0; 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); if(ind>-1) { SetData(field[FieldNo].RepCode,&Buffer[len],(float *)&ind); diff --git a/WellLogUI/src/WellLogTableDialogNew.cpp b/WellLogUI/src/WellLogTableDialogNew.cpp index f9f6a86..0096da7 100644 --- a/WellLogUI/src/WellLogTableDialogNew.cpp +++ b/WellLogUI/src/WellLogTableDialogNew.cpp @@ -519,19 +519,19 @@ bool WellLogTableDialogNew::event(QEvent *evt) } bool isEvent=QDialog::event(evt); -// if(evt->type()==QEvent::Paint) -// { -// m_gridData->CommitToSave(); + if(evt->type()==QEvent::Paint) + { + m_gridData->CommitToSave(); -// }else if(evt->type()==QEvent::ContextMenu) -// { -// QPoint point= m_pUI->tableWidget->mapFromGlobal(QCursor::pos()); -// if(m_pUI->tableWidget->rect().contains(point)) -// { -// // emit m_pUI->tableWidget->cus//->customContextMenuRequested(QCursor::pos()); -// m_gridData->reqCustomComtextMenu(QCursor::pos()); -// } -// } + }else if(evt->type()==QEvent::ContextMenu) + { + QPoint point= m_pUI->tableWidget->mapFromGlobal(QCursor::pos()); + if(m_pUI->tableWidget->rect().contains(point)) + { + // emit m_pUI->tableWidget->cus//->customContextMenuRequested(QCursor::pos()); + m_gridData->reqCustomComtextMenu(QCursor::pos()); + } + } return isEvent; } void WellLogTableDialogNew::slotSave() @@ -560,144 +560,144 @@ void WellLogTableDialogNew::slotSave() // m_pWell->SetZ( &vZ ); // } -// else if(m_rendererType == 2 && m_pWellLogs.size()) -// { -// bool flag=false; -// CLogIO *logio=new CLogIO; -// if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { -// delete logio; -// return; -// } + // else if(m_rendererType == 2 && m_pWellLogs.size()) + { + bool flag=false; + CLogIO *logio=new CLogIO; + if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { + delete logio; + return; + } -// int index=logio->OpenCurve(m_pWellLogs[0]->GetName().toStdString().c_str()); -// if(index>-1) { -// flag=1; -// } -// if(index>-1) logio->CloseCurve(index); -// delete logio; -// CCurveLineLog* pCurveLineLog=dynamic_cast(m_pWellLogs[0]); -// if (NULL != pCurveLineLog)//initWellLogData 曲线、井眼轨迹下级数据 -// { -// flag=true; -// pCurveLineLog->ClearLines(); -// for(int index=0; indextableWidget->item(index,0)) { -// float depth = m_pUI->tableWidget->item(index,0)->text().toFloat(); -// pCurveLineLog->AddLine(depth, depth); -// } -// } -// emit signalSave(); -// return; -// } -// if(flag) -// {//initMultWellLogData -// CLogIO *logio=new CLogIO; -// if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { -// delete logio; -// return; -// } -// int count=rowCount; -// for(int j=0;jOpenCurve(m_pWellLogs[j]->GetName().toStdString().c_str()); -// if(index>-1) -// { -// float *data=new float[rowCount+1]; -// float sdep=0; -// for(int i=0; itableWidget->item(i,0)) { -// count=i; -// break; -// } -// if(i==0) -// { -// QString topDepth = m_pUI->tableWidget->item(i,0)->text(); -// sdep=topDepth.toFloat(); -// } -// QString values ="-9999"; -// if(m_pUI->tableWidget->item(i,j+1)) values=m_pUI->tableWidget->item(i,j+1)->text(); -// data[i]=values.toFloat(); -// } -// logio->WriteCurve(index,sdep,count,data); -// delete data; -// logio->CloseCurve(index); -// } -// m_pWellLogs[j]->isLoad=false; -// m_pWellLogs[j]->LoadFromSLF(); -// } -// delete logio; -// GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName()); -// GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this); + int index=logio->OpenCurve(m_pWellLogs[0]->GetName().toStdString().c_str()); + if(index>-1) { + flag=1; + } + if(index>-1) logio->CloseCurve(index); + delete logio; + // CCurveLineLog* pCurveLineLog=dynamic_cast(m_pWellLogs[0]); + // if (NULL != pCurveLineLog)//initWellLogData 曲线、井眼轨迹下级数据 + // { + // flag=true; + // pCurveLineLog->ClearLines(); + // for(int index=0; indextableWidget->item(index,0)) { + // float depth = m_pUI->tableWidget->item(index,0)->text().toFloat(); + // pCurveLineLog->AddLine(depth, depth); + // } + // } + // emit signalSave(); + // return; + // } + if(flag) + {//initMultWellLogData + CLogIO *logio=new CLogIO; + if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { + delete logio; + return; + } + int count=rowCount; + for(int j=0;jOpenCurve(m_pWellLogs[j]->GetName().toStdString().c_str()); + if(index>-1) + { + float *data=new float[rowCount+1]; + float sdep=0; + for(int i=0; itableWidget->item(i,0)) { + count=i; + break; + } + if(i==0) + { + QString topDepth = m_pUI->tableWidget->item(i,0)->text(); + sdep=topDepth.toFloat(); + } + QString values ="-9999"; + if(m_pUI->tableWidget->item(i,j+1)) values=m_pUI->tableWidget->item(i,j+1)->text(); + data[i]=values.toFloat(); + } + logio->WriteCurve(index,sdep,count,data); + delete data; + logio->CloseCurve(index); + } + m_pWellLogs[j]->isLoad=false; + m_pWellLogs[j]->LoadFromSLF(); + } + delete logio; + // GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName()); + // GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this); -// m_gridData->ReFreshDisplayCurve(); -// } -// else //initTableWellLogData -// { -// flag=true; -// CLogIO *logio=new CLogIO; -// if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { -// delete logio; -// return; -// } -// int iIndex=logio->OpenTable(m_pWellLogs[0]->GetName().toStdString().c_str()); -// if (iIndex >=0) -// { -// int fc=logio->GetTableFieldCount(iIndex); -// Slf_TABLE_FIELD *field = new Slf_TABLE_FIELD[fc+1]; -// logio->GetTableFieldInfo(iIndex,field); + m_gridData->ReFreshDisplayCurve(); + } + else //initTableWellLogData + { + flag=true; + CLogIO *logio=new CLogIO; + if(!logio->Open(m_pWellLogs[0]->GetSlfFileName().toStdString().c_str(),CLogIO::modeReadWrite)) { + delete logio; + return; + } + int iIndex=logio->OpenTable(m_pWellLogs[0]->GetName().toStdString().c_str()); + if (iIndex >=0) + { + int fc=logio->GetTableFieldCount(iIndex); + Slf_TABLE_FIELD *field = new Slf_TABLE_FIELD[fc+1]; + logio->GetTableFieldInfo(iIndex,field); -// int rowCount = m_pUI->tableWidget->rowCount(); -// int count = 0; -// int n = 0; -// bool allNoneRow = true; //全空列标记 -// for(int row = rowCount - 1; row >= 0; row--) //遍历行 -// { -// for(int j = 0; j < fc; j++) //遍历列 -// { -// if(!m_pUI->tableWidget->item(row, j)) -// continue; + int rowCount = m_pUI->tableWidget->rowCount(); + int count = 0; + int n = 0; + bool allNoneRow = true; //全空列标记 + for(int row = rowCount - 1; row >= 0; row--) //遍历行 + { + for(int j = 0; j < fc; j++) //遍历列 + { + if(!m_pUI->tableWidget->item(row, j)) + continue; -// if(m_pUI->tableWidget->item(row, j)->text() != "") -// allNoneRow = false; -// } -// if(allNoneRow) -// { -// rowCount--; -// continue; -// } + if(m_pUI->tableWidget->item(row, j)->text() != "") + allNoneRow = false; + } + if(allNoneRow) + { + rowCount--; + continue; + } -// for(int j = 0; j < fc; j++) //遍历列 -// { -// QString mColumn = "0"; -// if(m_pUI->tableWidget->item(row, j)) -// mColumn = m_pUI->tableWidget->item(row, j)->text(); + for(int j = 0; j < fc; j++) //遍历列 + { + QString mColumn = "0"; + if(m_pUI->tableWidget->item(row, j)) + mColumn = m_pUI->tableWidget->item(row, j)->text(); -// char buf[513]; -// if(field[j].RepCode == 6 || field[j].Reserved) -// { -// strcpy(buf, mColumn.toStdString().c_str()); -// logio->SetTableFieldData(iIndex, j, buf, row + 1); -// } -// else -// { -// float val = mColumn.toFloat(); -// logio->SetTableFieldData(iIndex, j, (char *)&val, row + 1); -// } -// } -// } + char buf[513]; + if(field[j].RepCode == 6 || field[j].Reserved) + { + strcpy(buf, mColumn.toStdString().c_str()); + logio->SetTableFieldData(iIndex, j, buf, row + 1); + } + else + { + float val = mColumn.toFloat(); + logio->SetTableFieldData(iIndex, j, (char *)&val, row + 1); + } + } + } -// logio->SetTableRecordCount(iIndex, rowCount); -// logio->CloseTable(iIndex); -// delete[] field; -// } -// logio->Close(); -// delete logio; -// GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName()); -// GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this); -// } -// } + logio->SetTableRecordCount(iIndex, rowCount); + logio->CloseTable(iIndex); + delete[] field; + } + logio->Close(); + delete logio; + // GetObjectEvent().OnDeAttchData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName()); + // GetObjectEvent().OnRefreshData(m_pWellLogs[0]->GetSlfFileName(),m_pWellLogs[0]->GetName(),this); + } + } } QMessageBox::about(NULL, "提示", "保存成功"); //QDialog::accept(); diff --git a/WellLogUI/src/assetcopy.cpp b/WellLogUI/src/assetcopy.cpp index cd4da77..563ace9 100644 --- a/WellLogUI/src/assetcopy.cpp +++ b/WellLogUI/src/assetcopy.cpp @@ -4,7 +4,7 @@ #include #include #include -// #include "ObjWellLogTABLE.h" +#include "ObjWellLogTABLE.h" // #include "ObjDiscreteWellLog.h" // #include "BaseDialog.h" #include "DepthProgress.h" @@ -92,145 +92,145 @@ void AssetCopy::onCopyData() } void AssetCopy::onCopyLinesData() { - // if(!m_pWellLogs.size()) return; - // m_isParse=false; - // if(NULL == m_menu || NULL == m_menu->parent()) return; - // QTableWidget *m_table=qobject_cast(m_menu->parent()); - // if(NULL == m_table) - // return; - // //if(m_table->isVisible()) + if(!m_pWellLogs.size()) return; + m_isParse=false; + if(NULL == m_menu || NULL == m_menu->parent()) return; + QTableWidget *m_table=qobject_cast(m_menu->parent()); + if(NULL == m_table) + return; + //if(m_table->isVisible()) - // QList selItems=m_table->selectedItems(); - // QList selRanges=m_table->selectedRanges(); + QList selItems=m_table->selectedItems(); + QList selRanges=m_table->selectedRanges(); // CObjWellLogWavefile *pWaveValue=NULL; // pWaveValue=dynamic_cast(m_pWellLogs[0]); - // CObjWellLogTABLE *pTableValue=NULL; - // pTableValue=dynamic_cast(m_pWellLogs[0]); - // if(selItems.size()>0) - // { - // QTableWidgetSelectionRange copyRange=selRanges.value(0); + CObjWellLogTABLE *pTableValue=NULL; + pTableValue=dynamic_cast(m_pWellLogs[0]); + if(selItems.size()>0) + { + QTableWidgetSelectionRange copyRange=selRanges.value(0); - // int top = m_verScrolValue+copyRange.topRow(); - // int bottom = m_verScrolValue+copyRange.bottomRow(); - // int left = 0;//copyRange.leftColumn(); - // int right = m_horScrolValue+m_table->columnCount(); + int top = m_verScrolValue+copyRange.topRow(); + int bottom = m_verScrolValue+copyRange.bottomRow(); + int left = 0;//copyRange.leftColumn(); + int right = m_horScrolValue+m_table->columnCount(); - // if(pWaveValue) right =pWaveValue->waveinfo.TimeSamples; - // else if(!pTableValue) right=m_pWellLogs.size(); - // char buffer[200]; - // QString szClipText; - // float stdep=999999; - // for(int i = 0; i < m_pWellLogs.size(); i++) { - // if(m_pWellLogs[i]->acurveinfo.StartDepthacurveinfo.StartDepth; - // } - // double dep=0; - // int nCurrentRow = m_table->currentRow(); +/* if(pWaveValue) right =pWaveValue->waveinfo.TimeSamples; + else */if(!pTableValue) right=m_pWellLogs.size(); + char buffer[200]; + QString szClipText; + float stdep=999999; + for(int i = 0; i < m_pWellLogs.size(); i++) { + if(m_pWellLogs[i]->acurveinfo.StartDepthacurveinfo.StartDepth; + } + double dep=0; + int nCurrentRow = m_table->currentRow(); - // for(int nRow = top;nRow <= bottom; nRow++) - // { - // if(!pTableValue) - // dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel; + for(int nRow = top;nRow <= bottom; nRow++) + { + if(!pTableValue) + dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel; - // for(int nCol = left;nCol < right; nCol++) - // { - // QString szTmp; - // if(nCol==0||pTableValue) { - // auto pItem = m_table->item(nRow,nCol); - // if(pItem) - // szTmp = pItem->text(); - // else - // szTmp=toString(dep,'f',5,0); - // } - // else { - // 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); - // } - // szClipText.append(szTmp); - // szClipText.append("\t"); - // } - // szClipText.chop(1); - // szClipText.append("\n"); - // } + for(int nCol = left;nCol < right; nCol++) + { + QString szTmp; + if(nCol==0||pTableValue) { + auto pItem = m_table->item(nRow,nCol); + if(pItem) + szTmp = pItem->text(); + else + szTmp=toString(dep,'f',5,0); + } + else { +/* 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); + } + szClipText.append(szTmp); + szClipText.append("\t"); + } + szClipText.chop(1); + szClipText.append("\n"); + } - // QClipboard* clip=QApplication::clipboard(); - // clip->setText(szClipText); + QClipboard* clip=QApplication::clipboard(); + clip->setText(szClipText); - // } + } } void AssetCopy::onCopyColnumsData() { - // if(!m_pWellLogs.size()) return; - // m_isParse=false; - // if(NULL == m_menu || NULL == m_menu->parent()) - // return; + if(!m_pWellLogs.size()) return; + m_isParse=false; + if(NULL == m_menu || NULL == m_menu->parent()) + return; - // QTableWidget *m_table=qobject_cast(m_menu->parent()); - // if(NULL == m_table) - // return; - // //if(m_table->isVisible()) + QTableWidget *m_table=qobject_cast(m_menu->parent()); + if(NULL == m_table) + return; + //if(m_table->isVisible()) // CObjWellLogWavefile *pWaveValue=NULL; // pWaveValue=dynamic_cast(m_pWellLogs[0]); - // CObjWellLogTABLE *pTableValue=NULL; + CObjWellLogTABLE *pTableValue=NULL; // CObjDiscreteWellLog *pTableValue1=NULL; - // pTableValue=dynamic_cast(m_pWellLogs[0]); + pTableValue=dynamic_cast(m_pWellLogs[0]); // pTableValue1=dynamic_cast(m_pWellLogs[0]); - // QList selItems=m_table->selectedItems(); - // QList selRanges=m_table->selectedRanges(); - // float stdep=999999; - // for(int i=0;iacurveinfo.StartDepthacurveinfo.StartDepth; - // } - // if(selItems.size()>0) - // { - // QTableWidgetSelectionRange copyRange=selRanges.value(0); + QList selItems=m_table->selectedItems(); + QList selRanges=m_table->selectedRanges(); + float stdep=999999; + for(int i=0;iacurveinfo.StartDepthacurveinfo.StartDepth; + } + if(selItems.size()>0) + { + QTableWidgetSelectionRange copyRange=selRanges.value(0); - // int top = 0;//copyRange.topRow(); - // int bottom = m_table->rowCount();//copyRange.bottomRow(); - // int left = m_horScrolValue+copyRange.leftColumn(); - // int right =m_horScrolValue+copyRange.rightColumn(); + int top = 0;//copyRange.topRow(); + int bottom = m_table->rowCount();//copyRange.bottomRow(); + int left = m_horScrolValue+copyRange.leftColumn(); + int right =m_horScrolValue+copyRange.rightColumn(); - // if(!pTableValue&&!pTableValue1&&!pWaveValue) - // { - // bottom=(m_pWellLogs[0]->acurveinfo.EndDepth-m_pWellLogs[0]->acurveinfo.StartDepth)/m_pWellLogs[0]->acurveinfo.DepLevel+0.5; - // } - // else if(pWaveValue) { - // bottom=(pWaveValue->waveinfo.EndDepth-pWaveValue->waveinfo.StartDepth)/pWaveValue->waveinfo.DepLevel+0.5; - // } - // QString szClipText; - // char buffer[200]; - // QString szTmp; - // float dep=0; - // for(int nRow = top;nRow <=bottom;nRow++) - // { - // if(!pTableValue&&!pTableValue1)dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel; - // for(int nCol = left;nCol <=right;nCol++) - // { - // if(nCol==0||pTableValue||pTableValue1) { - // auto pItem = m_table->item(nRow,nCol); - // if(pItem) - // szTmp = pItem->text(); - // else if(nCol==0) { - // float val=szTmp.toFloat(); - // sprintf(buffer,"%8.3f",val+m_pWellLogs[0]->acurveinfo.DepLevel); - // szTmp =buffer ; - // } - // } - // else { - // if(pWaveValue) szTmp=toString(pWaveValue->GetData(dep,nCol-1,buffer),'f',0); - // else szTmp=toString(m_pWellLogs[nCol-1]->GetData(dep),'f',DECIMALPLACESNUM,0); - // } - // szClipText.append(szTmp); - // szClipText.append("\t"); - // } - // szClipText.chop(1); - // szClipText.append("\n"); - // } - // QClipboard* clip=QApplication::clipboard(); - // clip->setText(szClipText); - // } + if(!pTableValue/*&&!pTableValue1&&!pWaveValue*/) + { + bottom=(m_pWellLogs[0]->acurveinfo.EndDepth-m_pWellLogs[0]->acurveinfo.StartDepth)/m_pWellLogs[0]->acurveinfo.DepLevel+0.5; + } + // else if(pWaveValue) { + // bottom=(pWaveValue->waveinfo.EndDepth-pWaveValue->waveinfo.StartDepth)/pWaveValue->waveinfo.DepLevel+0.5; + // } + QString szClipText; + char buffer[200]; + QString szTmp; + float dep=0; + for(int nRow = top;nRow <=bottom;nRow++) + { + if(!pTableValue/*&&!pTableValue1*/)dep=stdep+nRow*m_pWellLogs[0]->acurveinfo.DepLevel; + for(int nCol = left;nCol <=right;nCol++) + { + if(nCol==0||pTableValue/*||pTableValue1*/) { + auto pItem = m_table->item(nRow,nCol); + if(pItem) + szTmp = pItem->text(); + else if(nCol==0) { + float val=szTmp.toFloat(); + sprintf(buffer,"%8.3f",val+m_pWellLogs[0]->acurveinfo.DepLevel); + szTmp =buffer ; + } + } + else { +/* if(pWaveValue) szTmp=toString(pWaveValue->GetData(dep,nCol-1,buffer),'f',0); + else */szTmp=toString(m_pWellLogs[nCol-1]->GetData(dep),'f',DECIMALPLACESNUM,0); + } + szClipText.append(szTmp); + szClipText.append("\t"); + } + szClipText.chop(1); + szClipText.append("\n"); + } + QClipboard* clip=QApplication::clipboard(); + clip->setText(szClipText); + } } void AssetCopy::cacheGridData(const QTableWidgetSelectionRange& m_selectionRange) @@ -513,161 +513,161 @@ void AssetCopy::reqCustomComtextMenu(const QPoint &pos) void AssetCopy::onParseData() { - // if(type == D_MultWellLogData) - // { - // int choose = QMessageBox::question(NULL, tr("提示"), - // QString(tr("该数据格式下,粘贴后将直接存储,是否粘贴?")), - // QMessageBox::Yes | QMessageBox::No); - // if(choose == QMessageBox::No) - // return; - // } + if(type == D_MultWellLogData) + { + int choose = QMessageBox::question(NULL, tr("提示"), + QString(tr("该数据格式下,粘贴后将直接存储,是否粘贴?")), + QMessageBox::Yes | QMessageBox::No); + if(choose == QMessageBox::No) + return; + } - // if(!m_pWellLogs.size()) return; - // if(NULL == m_menu || NULL == m_menu->parent()) - // return; + if(!m_pWellLogs.size()) return; + if(NULL == m_menu || NULL == m_menu->parent()) + return; - // QTableWidget *m_table=qobject_cast(m_menu->parent()); - // if(NULL == m_table) - // return; + QTableWidget *m_table=qobject_cast(m_menu->parent()); + if(NULL == m_table) + return; - // QClipboard* pClip = QApplication::clipboard(); - // QString szText = pClip->text(); + QClipboard* pClip = QApplication::clipboard(); + QString szText = pClip->text(); - // if(szText.isEmpty()) - // return; + if(szText.isEmpty()) + return; - // int nSpace = 0; - // int nDou=0; - // int nTab =0; + int nSpace = 0; + int nDou=0; + int nTab =0; - // DepthProgress MyDepthProgress2; - // MyDepthProgress2.CreatProgress(0, szText.size(), "粘贴内容检查中..."); + DepthProgress MyDepthProgress2; + MyDepthProgress2.CreatProgress(0, szText.size(), "粘贴内容检查中..."); - // for(int nIndex =0;nIndexnDou ? nSpace : nDou; - // nMax = nMax>nTab ? nMax : nTab; + int nMax = nSpace>nDou ? nSpace : nDou; + nMax = nMax>nTab ? nMax : nTab; - // char rFlag; - // if(nMax==nTab) - // { - // rFlag ='\t'; - // } - // else if(nMax==nSpace) - // { - // rFlag =' '; - // } - // else if(nMax==nDou) - // { - // rFlag =','; - // } - // m_table->clearSelection(); - // QStringList rSplitList = szText.split('\n'); - // if(rSplitList.size()&&rSplitList[rSplitList.size()-1]=="") rSplitList.removeAt(rSplitList.size()-1); + char rFlag; + if(nMax==nTab) + { + rFlag ='\t'; + } + else if(nMax==nSpace) + { + rFlag =' '; + } + else if(nMax==nDou) + { + rFlag =','; + } + m_table->clearSelection(); + QStringList rSplitList = szText.split('\n'); + if(rSplitList.size()&&rSplitList[rSplitList.size()-1]=="") rSplitList.removeAt(rSplitList.size()-1); // CObjWellLogWavefile *pWaveValue=NULL; // pWaveValue=dynamic_cast(m_pWellLogs[0]); - // CObjWellLogTABLE *pTableValue=NULL; - // pTableValue=dynamic_cast(m_pWellLogs[0]); + CObjWellLogTABLE *pTableValue=NULL; + pTableValue=dynamic_cast(m_pWellLogs[0]); // CObjDiscreteWellLog *pTableValue1=NULL; // pTableValue1=dynamic_cast(m_pWellLogs[0]); - // float stdep=999999; + float stdep=999999; - // for(int i=0;iacurveinfo.StartDepthacurveinfo.StartDepth; - // } - // float dep=0; + for(int i=0;iacurveinfo.StartDepthacurveinfo.StartDepth; + } + float dep=0; - // //起始行 - // int nCurrentRow = m_table->currentRow(); + //起始行 + int nCurrentRow = m_table->currentRow(); - // //纵向扩充表格 - // MyDepthProgress2.CreatProgress(0, rSplitList.size(), "表格建设中..."); - // MyDepthProgress2.SetDepth(0); - // for(int cTemp = nCurrentRow; cTemp < (nCurrentRow + rSplitList.size()); cTemp++){ - // if(cTemp >= m_table->rowCount()) - // needANewLine(cTemp); + //纵向扩充表格 + MyDepthProgress2.CreatProgress(0, rSplitList.size(), "表格建设中..."); + MyDepthProgress2.SetDepth(0); + for(int cTemp = nCurrentRow; cTemp < (nCurrentRow + rSplitList.size()); cTemp++){ + if(cTemp >= m_table->rowCount()) + needANewLine(cTemp); - // MyDepthProgress2.SetDepth(cTemp - nCurrentRow); - // } + MyDepthProgress2.SetDepth(cTemp - nCurrentRow); + } - // //进度条 - // int curprogre = 0; - // MyDepthProgress2.CreatProgress(0, rSplitList.size(), "数据归位..."); - // MyDepthProgress2.SetDepth(0); + //进度条 + int curprogre = 0; + MyDepthProgress2.CreatProgress(0, rSplitList.size(), "数据归位..."); + MyDepthProgress2.SetDepth(0); - // for(int nRow = 0; nRow < rSplitList.size(); ++nRow) - // { - // if(!pTableValue) - // dep = stdep + (m_verScrolValue + nCurrentRow) * m_pWellLogs[0]->acurveinfo.DepLevel; + for(int nRow = 0; nRow < rSplitList.size(); ++nRow) + { + if(!pTableValue) + 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++) - // { - // if(pTableValue||pTableValue1) { - // //空替换 - // if(rColumnList[nCol].isEmpty() ) rColumnList[nCol] = ""; - // auto pItem = m_table->item(nCurrentRow, nCurrentColumn); + for(int nCol = 0; nCol < rColumnList.size(); nCol++) + { + if(pTableValue/*||pTableValue1*/) { + //空替换 + if(rColumnList[nCol].isEmpty() ) rColumnList[nCol] = ""; + auto pItem = m_table->item(nCurrentRow, nCurrentColumn); - // //写值 - // if(pItem) - // pItem->setText(rColumnList[nCol]); - // else - // { - // QTableWidgetItem* pItem = new QTableWidgetItem; - // pItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsTristate); - // pItem->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//对齐 - // if(nCurrentColumn == 0) pItem->setFlags(pItem->flags() & (~Qt::ItemIsEditable)); - // pItem->setFont(QFont("Times",10)); + //写值 + if(pItem) + pItem->setText(rColumnList[nCol]); + else + { + QTableWidgetItem* pItem = new QTableWidgetItem; + pItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsTristate); + pItem->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//对齐 + if(nCurrentColumn == 0) pItem->setFlags(pItem->flags() & (~Qt::ItemIsEditable)); + 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){ - // float val=rColumnList[nCol].toFloat(); - // if(pWaveValue) pWaveValue->SetData(dep,m_horScrolValue+nCurrentColumn-1,&val); - // else m_pWellLogs[m_horScrolValue+nCurrentColumn-1]->SetData(dep,&val); - // } + } + else if(nCurrentColumn){ + float val=rColumnList[nCol].toFloat(); +/* if(pWaveValue) pWaveValue->SetData(dep,m_horScrolValue+nCurrentColumn-1,&val); + else */m_pWellLogs[m_horScrolValue+nCurrentColumn-1]->SetData(dep,&val); + } - // nCurrentColumn++; + nCurrentColumn++; - // MyDepthProgress2.SetDepth(++curprogre); - // } - // nCurrentRow++; - // } + MyDepthProgress2.SetDepth(++curprogre); + } + nCurrentRow++; + } - // if(!pTableValue) - // for(int i=0;iSetModify(true); - // m_pWellLogs[i]->SaveToSLF(); - // } + if(!pTableValue) + for(int i=0;iSetModify(true); + m_pWellLogs[i]->SaveToSLF(); + } - // emit saveToTempModel(); + emit saveToTempModel(); /* CBaseDialog *pTableDialog=(CBaseDialog*)(m_table->parent()); diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index e6af4aa..3ddf375 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -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_WelllogInformation(QString, QString)), this, SLOT(s_WelllogInformation(QString, QString))); } MainWindow::~MainWindow() @@ -479,3 +482,78 @@ void MainWindow::s_ShowTable(QString strSlfName, QString strName) 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"); + } +} diff --git a/logPlus/mainwindow.h b/logPlus/mainwindow.h index b8f8d06..e95d07a 100644 --- a/logPlus/mainwindow.h +++ b/logPlus/mainwindow.h @@ -88,6 +88,7 @@ public slots: void s_ShowCurve(QString strSlfName, QString strName);//曲线数据查看 void s_ShowTable(QString strSlfName, QString strName);//表格数据查看 + void s_WelllogInformation(QString strSlfName, QString strName);//编辑测井信息 }; diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index f19af8c..637781b 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -600,7 +600,10 @@ void QtProjectWidgets::initMenu() _menuWellName = new QMenu(ui->treeWidget); initWellNameTreeMenu(_menuWellName, ui->treeWidget); - + + _menuSlfName = new QMenu(ui->treeWidget); + initSlfNameTreeMenu(_menuSlfName, ui->treeWidget); + // //评估方案-右键菜单 // _menuEvaluate = new QMenu(ui->treeWidget); // initEvaluateTreeMenu(_menuEvaluate, ui->treeWidget); @@ -665,6 +668,15 @@ void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget 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) { @@ -725,6 +737,12 @@ void QtProjectWidgets::onShowTable(bool checked) emit CallManage::getInstance()->sig_ShowTable(m_strSlfName, m_strCurveObjectName); } +//编辑测井信息 +void QtProjectWidgets::onWelllogInformation() +{ + emit CallManage::getInstance()->sig_WelllogInformation(m_strSlfName, m_strCurveObjectName); +} + void QtProjectWidgets::onEditWelllogRound() { QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin(); @@ -865,7 +883,12 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index) //根节点(项目名称)-右键菜单 popMenu = _menuWellName; } - + else if (strTreeTag == "wellItem") + { + //根节点(项目名称)-右键菜单 + popMenu = _menuSlfName; + m_strSlfName = item->data(0, Qt::UserRole+1).toString(); + } // if (qApp->mouseButtons() == Qt::RightButton) // 只针对鼠标右键,弹出菜单 diff --git a/logPlus/qtprojectwidgets.h b/logPlus/qtprojectwidgets.h index 01103f0..1049a94 100644 --- a/logPlus/qtprojectwidgets.h +++ b/logPlus/qtprojectwidgets.h @@ -44,6 +44,7 @@ public slots: void onImportSingleWellLogData(); void onImportSlfTable(); void onOutWellLogRound(); + void onWelllogInformation(); //编辑测井信息 public: //初始化树图控件 void initTreeWidget(QString fullPath, QString strProjectName); @@ -53,7 +54,8 @@ public: QMenu *_menuRoot; QMenu *_menuCurveObject;//曲线对象(AC、BS...) QMenu *_menuTableObject;//表格对象 - QMenu *_menuWellName; + QMenu *_menuWellName; //井名 + QMenu *_menuSlfName; //井次 //根节点(项目名称)-右键菜单 QAction* m_action_New; @@ -82,6 +84,8 @@ public: void initTableObjectTreeMenu(QMenu *menu, QTreeWidget *treeWidget); //初始化根节点(井名称)-右键菜单 void initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget); + //初始化根节点(井次名称)-右键菜单 + void initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget); private: };