logplus/WellLogUI/src/WellLogTableDialogNew.cpp
2025-11-10 16:35:40 +08:00

831 lines
27 KiB
C++

#include <QTextStream>
#include <QDir>
#include <QFile>
#include <QFileDialog>
#include <QSpacerItem>
#include <QDebug>
//#include "BaseDialog.h"
#include "WellLogTableDialogNew.h"
//#include "ui_PaiCoreDialog.h"
//#include "ObjCoreImage.h"
#include "geometryutils.h"
#include "ObjWelllog.h"
#include "LogIO.h"
//#include "CurveLineLog.h"
#include "ObjWelllogTABLE.h"
//#include "DataManagger.h"
#include "griddataadapter.h"
//#include "ConsoleOutputWidget.h"
#include "ui_WellLogTableDialogNew.h"
#include "ShowCurve.h"
#include "CurvePropertyEdit.h"
#include "CallManage.h"
#include "ObjectID.h"
//float保留4位小数
#define FLOATPREC 4
#define SWITCH_VIEWID "switchId"
using namespace std;
static Slf_WAVE WaveInfo;
WellLogTableDialogNew::WellLogTableDialogNew(QWidget *parent, Qt::WindowFlags flags)
:QDialog(parent, flags), m_isShowDig(false)
{
m_pUI = new Ui::WellLogTableDialogNew();
m_pUI->setupUi(this);
// //数据局部显示适配器
m_gridData = new GridDataAdapter(m_pUI->tableWidget, m_pUI->horizontalScrollBar, m_pUI->verticalScrollBar);
// m_pWell = NULL;
// m_pBaseObjectImpl = NULL;
m_rendererType = 0;
setAttribute( Qt::WA_DeleteOnClose ,true );
m_pUI->btnExpView->setProperty(SWITCH_VIEWID,false);
connect(m_pUI->tableWidget->horizontalHeader(), SIGNAL(clicked()), this, SLOT(SelelctOk()));
connect(m_pUI->btnSave, SIGNAL(clicked()), this, SLOT(slotSave()));
connect(m_pUI->btnExport, SIGNAL(clicked()), this, SLOT(slotExport()));
connect(m_pUI->btnImport, SIGNAL(clicked()), this, SLOT(slotImport()));
connect(m_pUI->btnExpView, SIGNAL(clicked()), this, SLOT(slotExpdView()));
m_DataTyle=valid_NULL;
m_pUI->btnExport->setIcon(QIcon( ::GetImagePath() + "icon/Export.png"));
m_pUI->btnImport->setIcon(QIcon( ::GetImagePath() + "icon/Import.png"));
m_pUI->btnSave->setIcon(QIcon( ::GetImagePath() + "icon/Save.png"));
//隐藏
m_pUI->verticalScrollBar->hide();
m_pUI->horizontalScrollBar->hide();
m_pUI->btnExpView->hide();
connect(m_pUI->tableWidget->verticalScrollBar(), SIGNAL(valueChanged(int)),this,SLOT(slotVerScrollValueChange(int)));
// connect(m_pUI->tableWidget->verticalScrollBar(), SIGNAL(sliderPressed()), this, SLOT(slotVerScrollBarPressed()));
// connect(m_pUI->tableWidget->verticalScrollBar(), SIGNAL(sliderReleased()), this, SLOT(slotVerScrollBarReleased()));
}
void WellLogTableDialogNew::slotExpdView()
{
bool isExp=m_pUI->btnExpView->property(SWITCH_VIEWID).toBool();
m_pUI->btnExpView->setProperty(SWITCH_VIEWID,!isExp);
// if(m_gridData)
// {
// swtichViewSize();
// m_gridData->switchLogView(!isExp);
// m_gridData->bindData();
// }
}
void WellLogTableDialogNew::swtichViewSize()
{
// if(!m_pWellLogs.size()) return;
QWidget* spanItem=m_pUI->horSeat;
spanItem->setMinimumWidth(0);
spanItem->hide();
bool isExp=m_pUI->btnExpView->property(SWITCH_VIEWID).toBool();
bool isNull=NULL == spanItem;
if(!isNull)
{
QSize size=this->size();
if(isExp)
{
// int changeSize=size.width()/2.0;
// spanItem->setMinimumWidth(changeSize);
// spanItem->show();
m_pUI->tabWidget->setFixedWidth(0);
spanItem->setMinimumWidth(0);
m_gridData->m_gridWidth=size.width()-10;
spanItem->show();
}
}
// if(!isNull)
// {
// if(m_pWellLogs.size() > 1
// && NULL != m_pWellLogs[0]
// && m_pWellLogs[0]->GetTypeID()==GetClassID_WellLog()
// )
// {
// QSize size=this->size();
// if(isExp)
// {
// int changeSize=size.width()/2.0;
// spanItem->setMinimumWidth(changeSize);
// spanItem->show();
// m_gridData->m_middleWidth=changeSize-10;
// }else
// {
// m_gridData->m_gridWidth=size.width()-10;
// }
// }
// else if(NULL != m_pWellLogs[0]
// && m_pWellLogs[0]->GetTypeID()==GetClassID_WellLogWavefile()
// )
// {
// QSize size=this->size();
// if(isExp)
// {
// int changeSize=size.width()/2.0;
// m_pUI->tabWidget->setFixedWidth(changeSize);
// //spanItem->setMinimumWidth(changeSize);
// m_pUI->tabWidget->show();
// spanItem->show();
// m_gridData->m_middleWidth=changeSize-10;
// }else
// {
// m_pUI->tabWidget->setFixedWidth(0);
// spanItem->setMinimumWidth(0);
// m_gridData->m_gridWidth=size.width()-10;
// }
// }
// else if(m_pWellLogs.size() == 1
// &&NULL != m_pWellLogs[0]
// && m_pWellLogs[0]->GetTypeID()==GetClassID_WellLog()
// )
// {
// QSize size=this->size();
// int changeSize=size.width()-size.width()/3.0;
// spanItem->setMinimumWidth(changeSize);
// spanItem->show();
// }
// if(isExp)
// {
// m_pUI->btnExpView->setText("=>");
// }else
// {
// m_pUI->btnExpView->setText("<=");
// }
// }
}
void WellLogTableDialogNew::ReFreshWindow(int type)
{
// m_gridData->ReFreshWindow(m_gridData->m_dtype);
}
void WellLogTableDialogNew::slotExport()
{
TableToCSVFile(m_pUI->tableWidget);
}
void WellLogTableDialogNew::slotImport()
{
TableFromCSVFile(m_pUI->tableWidget);
}
void WellLogTableDialogNew::setName(QString strOldPath, QString strOldName, int nObjectType)
{
FileName = strOldPath;
CurveName = strOldName;
m_ObjectType = nObjectType;
CObjWellLogTABLE* pWellLog = new CObjWellLogTABLE;
pWellLog->SetSlfFileName(strOldPath);
pWellLog->m_name = strOldName;
m_pWellLogs.clear();
m_pWellLogs.append(pWellLog);
//初始化
InitWell();
InitWellLog();
qDebug() << "count=" << QString::number(count);
m_pUI->tableWidget->verticalScrollBar()->setRange(0, count);//count
m_pUI->tableWidget->verticalScrollBar()->setValue(count / 2);
//m_pUI->tableWidget->setCurrentCell(300, 0);
}
//井眼轨迹
void WellLogTableDialogNew::InitWell()
{
// if(m_pWell != NULL)
// {
// m_gridData->initWellData(D_WellData,m_pWell);
// }
if (TABLEE_OBJECT == m_ObjectType)
{
m_gridData->addActonMenu(2);
m_DataTyle=valid_NULL;
//表格数据
m_gridData->initTableWellLogData(D_TableWellLogData,m_pWellLogs);
m_pUI->tableWidget->verticalHeader()->hide();//隐藏左侧系统序号栏
swtichViewSize();
return;
}
CLogIO *logio=new CLogIO();
logio->Open(FileName.toStdString().c_str(),CSlfIO::modeRead);
index=logio->OpenCurve(CurveName.toStdString().c_str());
if(index<0) {
delete logio;
return;
}
logio->GetCurveInfo(index,&curveinfo);
sdep=curveinfo.StartDepth;
edep=curveinfo.EndDepth;
rlev=curveinfo.DepLevel;
curDepth=sdep+(edep-sdep)/2.;
count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5;
val=new float[count];
logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]);
logio->CloseCurve(index);
delete logio;
//
//清空
m_pUI->tableWidget->clearContents();
m_pUI->tableWidget->verticalHeader()->hide();//隐藏左侧系统序号栏
//因为tableWidget需要提前规定好行数与列数
int recordcount = count; //总行数
m_pUI->tableWidget->setColumnCount(2);
m_pUI->tableWidget->setRowCount(recordcount); //动态设置行数
//表头
QStringList list;
list << "深度" << "数据";
m_pUI->tableWidget->setHorizontalHeaderLabels(list);
m_pUI->tableWidget->setColumnWidth(0, 200);
m_pUI->tableWidget->setColumnWidth(1, 200);
for(int i=0; i<recordcount; i++)
{
float tmpdep = sdep+ rlev*i;
float vtmp=val[i];
QTableWidgetItem* item = new QTableWidgetItem(QString::number(tmpdep));
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
m_pUI->tableWidget->setItem(i, 0, item);
//
QTableWidgetItem* item2 = new QTableWidgetItem(QString::number(vtmp));
//item2->setFlags(item2->flags() & (~Qt::ItemIsEditable));
m_pUI->tableWidget->setItem(i, 1, item2);
}
}
bool WellLogTableDialogNew::InitWellLog()
{
if (TABLEE_OBJECT == m_ObjectType)
{
//表格数据
m_gridData->bindData();
return true;
}
//swtichViewSize();
int Type=0;
//if(TypeName=="波列数据")Type=1;
QWidget* sPage=findChild<QWidget*>("statisticsPage");
QWidget* pPage=findChild<QWidget*>("protoprtyPage");
QWidget* cPage=findChild<QWidget*>("computePage");
QWidget* pvPage=findChild<QWidget*>("curvePreViewPage");
QTabWidget* tabWidget=findChild<QTabWidget*>("tabWidget");
if(NULL != sPage && NULL != pPage && NULL != cPage && NULL != pvPage)
{
if(NULL != tabWidget)
{
QScrollArea* sScrollArea=tabWidget->findChild<QScrollArea*>("sScrollArea");
QScrollArea* pScrollArea=tabWidget->findChild<QScrollArea*>("pScrollArea");
QScrollArea* cScrollArea=tabWidget->findChild<QScrollArea*>("cscrollArea");
QScrollArea* curveScrollArea=tabWidget->findChild<QScrollArea*>("curveScrollArea");
if(NULL != sScrollArea)
{
sScrollArea->setWidget(sPage);
}
if(NULL != pScrollArea)
{
pScrollArea->setWidget(pPage);
//属性
CCurvePropertyEditDlg *pDlg=new CCurvePropertyEditDlg(pPage, 0);
//connect(pDlg,SIGNAL(destroyed()),this,SLOT(slotCurvePropertyGc()));
pDlg->FileName=FileName;
pDlg->CurveName=CurveName;
pDlg->Type=Type;
//pDlg->init();
pDlg->show();
}
if(NULL != cScrollArea)
{
if(Type==0)cScrollArea->setWidget(cPage);
}
if(NULL != curveScrollArea)
{
curveScrollArea->setWidget(pvPage);
//曲线
ShowCurve *pDlg=new ShowCurve(m_pUI->curvePreViewPage);
pDlg->setObjectName("curveView");
pDlg->FileName=FileName;
pDlg->CurveName=CurveName;
pDlg->init();
pDlg->setCurveTable(m_pUI->tableWidget);
pDlg->show();
}
sPage->show();
pPage->show();
pvPage->show();
if(Type==0)
{
cPage->show();//whp change 2020.5.11 for 波列数据编辑和管理 波列曲线不计算
}
tabWidget->show();
}
}
// if(m_pWellLogs.size())
// {
// if ((m_pWellLogs[0]->GetTypeID()==GetClassID_WellLog()||
// m_pWellLogs[0]->GetTypeID()==GetClassID_WellTrajectory())&&m_pWellLogs[0]->m_ObjectType!=TABLE_OBJECT)//非多维数据
// {
// m_DataTyle=valid_NULL;
// m_gridData->initWellLogData(D_WellLogData ,m_pWellLogs);
// }
// else //多维数据
// if (m_pWellLogs[0]->GetTypeID()==GetClassID_WellLogWavefile())
// {
// m_DataTyle=valid_NULL;
// m_gridData->initMultWellLogData(D_MultWellLogData,m_pWellLogs);
// }
// else if (m_pWellLogs[0]->GetTypeID()==GetClassID_WellLogTDT())
// {
// m_DataTyle=valid_NULL;
// m_gridData->initTDTWellLogData(D_TDTWellLogData,m_pWellLogs);
// }
// else if (m_pWellLogs[0]->GetTypeID()==GetClassID_WellLogFMT())
// {
// m_DataTyle=valid_NULL;
// m_gridData->initFMTWellLogData(D_FMTWellLogData,m_pWellLogs);
// }
// else {
// m_gridData->addActonMenu(2);
// m_DataTyle=valid_NULL;
// //表格数据
// m_gridData->initTableWellLogData(D_TableWellLogData,m_pWellLogs);
// }
// }
return true;
}
void WellLogTableDialogNew::SelelctOk()
{
int a=1;
}
void WellLogTableDialogNew::InitSingleDimTable(int depthNum)
{
}
void WellLogTableDialogNew::InitMutiCurvesPropertyTable(const SelectMutiCurve mutiCurves,const QString wellLogName,const std::vector<float>MutiVM)
{
}
//void WellLogTableDialogNew::SetViewObject(QList<CBaseObject *>&pObject)
//{
// m_rBaseObjectlist = pObject;
// if(pObject.size()==0)
// return;
// QString nameTemp;
// m_pWell = dynamic_cast<CObjWell *>(pObject[0]);
// if(!m_pWell
// &&pObject[0]->GetPaiObject()
// &&pObject[0]->GetPaiObject()->GetTypeID()==GetClassID_WellTrajectoryFolder())
// {
// PaiObject *pPaiObject=pObject[0]->GetPaiObject()->GetParent();
// if(pPaiObject)
// pPaiObject=pPaiObject->GetParent();
// m_pWell = dynamic_cast<CObjWell *>(pPaiObject);
// }
// if(m_pWell != NULL)
// {
// m_rendererType = 1;
// nameTemp = m_pWell->GetName();
// m_pWell->LoadXYZ();
// if(m_pWell->GetX().size() < 1)
// {
// QString errMsg = QObject::tr(" %1 为无效数据,请选择其他有效数据").arg(nameTemp);
// QMessageBox::about(NULL, "空文件提示", errMsg);
// return;
// }
// m_pWell->ClearXYZ();
// }
// else
// {
// CObjWellLog *m_pWellLog = NULL;
// m_pWellLogs.clear();
// for(int i=0;i<pObject.size();i++)
// {
// m_pWellLog = dynamic_cast<CObjWellLog *>(pObject[i]);
// if(m_pWellLog)
// m_pWellLogs.append(m_pWellLog);
// }
// if(m_pWellLog != NULL)
// {
// m_rendererType = 2;
// QString path,wellname;
// GetWellNameAndPath(m_pWellLog->GetSlfFileName(),wellname,path);
// nameTemp = wellname+":"+m_pWellLog->GetName();
// }
// else
// {
// m_pBaseObjectImpl = dynamic_cast<CBaseObjectImpl*>(pObject[0]);
// if (m_pBaseObjectImpl != NULL)
// {
// m_rendererType = 2;
// }
// else
// {
// m_rendererType = 0;
// }
// }
// }
// if(m_rendererType == 0)
// {
// return;
// }
// this->setWindowTitle(nameTemp);
// bool bCancel(false);
// if(m_rendererType == 1)
// {
// InitWell();
// }
// else if(m_rendererType == 2)
// {
// bCancel=InitWellLog();
// if (!bCancel)
// return ;
// }
// RendererHead();
//}
void WellLogTableDialogNew::RendererHead()
{
m_pUI->tableWidget->verticalHeader()->setVisible(false);
m_pUI->tableWidget->horizontalHeader()->setVisible(true);
m_pUI->tableWidget->setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
m_pUI->tableWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
m_pUI->tableWidget->setVisible(true);
m_pUI->tableWidget->setAlternatingRowColors(true);
m_pUI->tableWidget->verticalHeader()->setDefaultSectionSize(20);
}
bool WellLogTableDialogNew::event(QEvent *evt)
{
if(evt->type()==QEvent::KeyPress)
{
// QKeyEvent * event=dynamic_cast<QKeyEvent *>(evt);
// if(event)
// {
// if(event->key()==Qt::Key_Escape)
// {
// return false;
// }
// }
}
bool isEvent=QDialog::event(evt);
// 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());
// }
// }
return isEvent;
}
void WellLogTableDialogNew::slotSave()
{
if(m_pUI->tableWidget != NULL)
{
int rowCount = m_pUI->tableWidget->rowCount();
int columnCount = m_pUI->tableWidget->columnCount();
// if(m_rendererType == 1 && m_pWell != NULL)//initWellData 井眼轨迹
// {
// DOUBLEPROPERTY vX(rowCount),vY(rowCount),vZ(rowCount);
// for(int row = 0; row < rowCount; row++)
// {
// QString xColumn="-9999";
// if(m_pUI->tableWidget->item(row, 2)) xColumn= m_pUI->tableWidget->item(row, 2)->text();
// QString yColumn ="-9999";
// if(m_pUI->tableWidget->item(row, 3)) yColumn=m_pUI->tableWidget->item(row, 3)->text();
// QString zColumn ="-9999";
// if(m_pUI->tableWidget->item(row, 4)) zColumn=m_pUI->tableWidget->item(row, 4)->text();
// vX.m_vProperty[row] = xColumn.toDouble();
// vY.m_vProperty[row] = yColumn.toDouble();
// vZ.m_vProperty[row] = zColumn.toDouble();
// }
// m_pWell->SetX( &vX );
// m_pWell->SetY( &vY );
// 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;
// }
// 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<CCurveLineLog*>(m_pWellLogs[0]);
// if (NULL != pCurveLineLog)//initWellLogData 曲线、井眼轨迹下级数据
// {
// flag=true;
// pCurveLineLog->ClearLines();
// for(int index=0; index<rowCount; index++)
// {
// if(m_pUI->tableWidget->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;j<m_pWellLogs.size();j++)
// {
// int index=logio->OpenCurve(m_pWellLogs[j]->GetName().toStdString().c_str());
// if(index>-1)
// {
// float *data=new float[rowCount+1];
// float sdep=0;
// for(int i=0; i<rowCount; i++)
// {
// if(!m_pUI->tableWidget->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);
// 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;
// }
// 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);
// }
// }
// }
// 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();
}
WellLogTableDialogNew::~WellLogTableDialogNew()
{
//luol 20200302
// m_gridData->deleteLater();
// if(NULL != m_gridData)
// {
// delete m_gridData;
// m_gridData=NULL;
// }
delete m_pUI;
m_pUI = NULL;
}
void WellLogTableDialogNew::SetTableTitleList( const SelectMutiCurve mutiCurve,QStringList &Titlelist,Ui::WellLogTableDialogNew*& m_pUI )
{
for (int jcol=mutiCurve.StartDim;jcol<=mutiCurve.EndDim;jcol++)
{
QString title;
title.setNum(jcol+1,10).append("");
Titlelist<<title;
}
Titlelist<<" ";
//luol 20200302
//m_pUI->tableWidget->setColumnCount(Titlelist.size());
// m_gridData->setColCount(Titlelist.size());
m_pUI->tableWidget->setHorizontalHeaderLabels(Titlelist);
}
void WellLogTableDialogNew::InitMutiCurves( )
{
}
void WellLogTableDialogNew::GetSelectMutiCurve(SelectMutiCurve &mutiCurve )
{
int num=(WaveInfo.EndDepth-WaveInfo.StartDepth)/WaveInfo.DepLevel+1.5;
// mutiCurve.StartDepth=(m_pUI->stdep->text().toFloat()-WaveInfo.StartDepth)/WaveInfo.DepLevel;
// mutiCurve.EndDepth= (m_pUI->endep->text().toFloat()-WaveInfo.StartDepth)/WaveInfo.DepLevel;
if(mutiCurve.EndDepth>num) mutiCurve.EndDepth=num;
if(mutiCurve.StartDepth>num) mutiCurve.StartDepth=num;
// mutiCurve.StartDim=m_pUI->spbBeginDimIndex->value();
// mutiCurve.EndDim=m_pUI->spbEndDimIndex->value();
if (mutiCurve.EndDepth<mutiCurve.StartDepth) mutiCurve.EndDepth=mutiCurve.StartDepth;
if (mutiCurve.EndDim<mutiCurve.StartDim)
mutiCurve.EndDim=mutiCurve.StartDim;
if (mutiCurve.StartDepth<0)
mutiCurve.StartDepth=0;
if (mutiCurve.StartDim<0)
mutiCurve.StartDim=0;
// m_pUI->stdep->setText(QString::number(WaveInfo.StartDepth+mutiCurve.StartDepth*WaveInfo.DepLevel));
// m_pUI->endep->setText(QString::number(WaveInfo.StartDepth+mutiCurve.EndDepth*WaveInfo.DepLevel));
}
std::vector<float> WellLogTableDialogNew::InterceptDepthPoints( const SelectMutiCurve mutiCurve,const std::vector<float>dimvM )
{
std::vector<float>vProperty;
for (int i=0;i<dimvM.size();i++)
{
if (i>=mutiCurve.StartDepth&&i<=mutiCurve.EndDepth)
{
vProperty.push_back(dimvM[i]);
}
}
return vProperty;
}
bool WellLogTableDialogNew::TableFromCSVFile(QTableWidget *tableWidget)
{
// m_gridData->importToFile();
return true;
}
void WellLogTableDialogNew::showEvent(QShowEvent *evt)
{
// if(!m_pWellLogs.size())
// return;
// QDialog::showEvent(evt);
// if( (m_pWellLogs[0]->GetTypeID()==GetClassID_WellLog() ||
// m_pWellLogs[0]->GetTypeID()==GetClassID_WellLogTABLE()
// )
// && m_pWellLogs.size() == 1 )
// {
// m_pUI->btnExpView->hide();
// }
// m_isShowDig=true;
// m_gridData->m_middleWidth=0;
// m_gridData->m_gridWidth=0;
// swtichViewSize();
// m_gridData->bindData();
}
void WellLogTableDialogNew::resizeEvent(QResizeEvent *evt)
{
QDialog::resizeEvent(evt);
// if(m_isShowDig)
// {
// m_gridData->m_middleWidth=0;
// m_gridData->m_gridWidth=0;
// swtichViewSize();
// m_gridData->bindData();
// }
}
bool WellLogTableDialogNew::TableToCSVFile(QTableWidget *tableWidget)
{
//return m_gridData->tableToCSVFile();
return true;
}
void WellLogTableDialogNew::slotVerScrollValueChange(int nValue)
{
qDebug() << "nValue=" << QString::number(nValue);
curDepth=sdep+ nValue*rlev;
emit CallManage::getInstance()->sig_ValueChange(nValue, curDepth);
}