560 lines
20 KiB
C++
560 lines
20 KiB
C++
#pragma warning(push,0)
|
||
// #include "Family.h"
|
||
#include <QMessageBox>
|
||
#include "WaveComposeDlg.h"
|
||
#include "ui_WaveCompose.h"
|
||
#include "CStringType.h"
|
||
#include "DataHelper.h"
|
||
#include <QTimer>
|
||
#include <QItemSelectionModel>
|
||
#include <QAbstractItemModel>
|
||
// #include "ObjProject.h"
|
||
#include "AddCompCurveDlg.h"
|
||
#include "DepthProgress.h"
|
||
#include "dataslothelper.h"
|
||
#include "DataImport.h"
|
||
#include "CallGlobalManage.h"
|
||
#pragma warning(pop)
|
||
using namespace pai::ios::welllog;
|
||
BEGIN_OSGGRAPHICS_NAMESPACE
|
||
/*extern char *DataTypea[];
|
||
extern int DataLengtha[];
|
||
|
||
extern char *Rep_STR[];
|
||
extern int RepSize[12];*/
|
||
//CWaveComposeDlg::CWaveComposeDlg(QWidget * parent, Qt::WFlags flags)
|
||
//: QWidget(parent,flags)
|
||
CWaveComposeDlg::CWaveComposeDlg(QWidget * parent, Qt::WindowFlags flags)
|
||
: QDialog(parent,flags)
|
||
{
|
||
m_pUI = new Ui_WaveCompose();
|
||
m_pUI->setupUi(this);
|
||
|
||
QObject::connect(m_pUI->pushButton_Add, SIGNAL(clicked()), this, SLOT(slotAdd()));
|
||
QObject::connect(m_pUI->pushButton_Delete, SIGNAL(clicked()), this, SLOT(slotDelete()));
|
||
QObject::connect(m_pUI->pushButton_Up, SIGNAL(clicked()), this, SLOT(slotUp()));
|
||
QObject::connect(m_pUI->pushButton_Down, SIGNAL(clicked()), this, SLOT(slotDown()));
|
||
QObject::connect(m_pUI->okbtn, SIGNAL(clicked()), this, SLOT(slotSave()));
|
||
QObject::connect(m_pUI->cancelbtn, SIGNAL(clicked()), this, SLOT(slotCancel()));
|
||
for(int i=0;i<11;i++)m_pUI->comboBox_DataType->addItem(QLatin1String(Rep_STR[i]));
|
||
QObject::connect(m_pUI->lineEdit_ArrayNum, SIGNAL(textChanged(const QString &)), this, SLOT(arrayChanged(const QString &)));
|
||
QObject::connect(m_pUI->lineEdit_Sample, SIGNAL(textChanged(const QString &)), this, SLOT(sampleChanged(const QString &)));
|
||
//m_pUI->comboBox_DataType->setCurrentIndex(3);
|
||
m_fillColumn=5;
|
||
|
||
}
|
||
|
||
void CWaveComposeDlg::slotSave()
|
||
{
|
||
if(m_pUI->tableWidget->rowCount()<=1)
|
||
{
|
||
QMessageBox::warning(NULL,"提示","至少需要两条或两条以上的曲线才进行合并");
|
||
return ;
|
||
}
|
||
NewWaveInfo.ArrayNum=m_pUI->lineEdit_ArrayNum->text().toInt();
|
||
NewWaveInfo.SamplePoint=m_pUI->lineEdit_Sample->text().toInt();
|
||
NewWaveInfo.TimeSamples=m_pUI->lineEdit_TotalSample->text().toInt();
|
||
if(NewWaveInfo.TimeSamples<=1)
|
||
{
|
||
QMessageBox::warning(NULL,"提示","合成结果曲线总元素个数<2,合并无意义\r\n请重新修改合并曲线二维信息!");
|
||
return;
|
||
}
|
||
if(NewWaveInfo.ArrayNum<1||NewWaveInfo.ArrayNum>m_SampleIn)
|
||
{
|
||
if(NewWaveInfo.ArrayNum<1)NewWaveInfo.ArrayNum=1;
|
||
if(NewWaveInfo.ArrayNum>m_SampleIn)NewWaveInfo.ArrayNum=m_SampleIn;
|
||
NewWaveInfo.SamplePoint=m_SampleIn/NewWaveInfo.ArrayNum;
|
||
// NewWaveInfo.TimeSamples=NewWaveInfo.SamplePoint*NewWaveInfo.ArrayNum;
|
||
QMessageBox::warning(NULL,"提示","对不起,您所给定的输出曲线阵列信息参数不合适\r\n系统已进行自动修正\r\n请返回对话框,检查后再执行合成操作!");
|
||
m_pUI->lineEdit_ArrayNum->setText(QString::number(NewWaveInfo.ArrayNum));
|
||
m_pUI->lineEdit_Sample->setText(QString::number(NewWaveInfo.SamplePoint));
|
||
// m_pUI->lineEdit_TotalSample->setText(QString::number(NewWaveInfo.TimeSamples));
|
||
return;
|
||
}
|
||
//检查输出曲线元素个数是否和输入一致
|
||
/*
|
||
if(NewWaveInfo.TimeSamples!=m_SampleIn)
|
||
{
|
||
QMessageBox::warning(NULL,"提示","输出曲线元素个数%d和输入的元素个数%d不一致\r\n请重新输入");
|
||
return;
|
||
}
|
||
*/
|
||
//检查输出曲线深度是否合理
|
||
NewWaveInfo.StartDepth=m_pUI->lineEdit_Sdep->text().toFloat();
|
||
NewWaveInfo.EndDepth=m_pUI->lineEdit_Edep->text().toFloat();
|
||
NewWaveInfo.DepLevel=m_pUI->lineEdit_Rlev->text().toFloat();
|
||
if(NewWaveInfo.StartDepth>=NewWaveInfo.EndDepth||NewWaveInfo.EndDepth<=0)
|
||
{
|
||
QMessageBox::warning(NULL,"提示","输出曲线的起、止深度不合理,请重新输入");
|
||
return;
|
||
}
|
||
if(NewWaveInfo.DepLevel>100||NewWaveInfo.DepLevel<=0)
|
||
{
|
||
QMessageBox::warning(NULL,"提示","输出曲线采样间隔不合理,请重新输入");
|
||
return;
|
||
}
|
||
NewWaveInfo.StartTime=m_pUI->lineEdit_StartTime->text().toFloat();
|
||
NewWaveInfo.TimeLevel=m_pUI->lineEdit_TimeRlev->text().toFloat();
|
||
if(NewWaveInfo.TimeLevel<=0)
|
||
{
|
||
QMessageBox::warning(NULL,"提示","输出曲线h=时间间隔不合理,请重新输入");
|
||
return;
|
||
}
|
||
NewWaveInfo.MinValue=m_pUI->lineEdit_Min->text().toFloat();
|
||
NewWaveInfo.MaxValue=m_pUI->lineEdit_Max->text().toFloat();
|
||
NewWaveInfo.DefVal=m_pUI->lineEdit_DefVal->text().toFloat();
|
||
int m_DataType=m_pUI->comboBox_DataType->currentIndex()+1;
|
||
NewWaveInfo.RepCode=m_DataType;
|
||
NewWaveInfo.CodeLen=RepSize[m_DataType];
|
||
strcpy(NewWaveInfo.Name,m_pUI->lineEdit_CurveName->text().toStdString().c_str());
|
||
strcpy(NewWaveInfo.AliasName,m_pUI->lineEdit_CurveName_2->text().toStdString().c_str());
|
||
strcpy(NewWaveInfo.Unit,m_pUI->lineEdit_CurveUnit->text().toStdString().c_str());
|
||
strcpy(NewWaveInfo.AliasUnit,m_pUI->lineEdit_CurveUnit_2->text().toStdString().c_str());
|
||
|
||
strcpy(NewWaveInfo.DepthUnit,m_pUI->lineEdit_DepthUnit->text().toStdString().c_str());
|
||
strcpy(NewWaveInfo.DepthHZUnit,m_pUI->lineEdit_DepthUnit_2->text().toStdString().c_str());
|
||
//二维
|
||
strcpy(NewWaveInfo.TimeName,m_pUI->lineEdit_TimeName->text().toStdString().c_str());
|
||
strcpy(NewWaveInfo.TimeHZName,UTF8ToGBK(m_pUI->lineEdit_TimeName2->text()));//m_pUI->lineEdit_TimeName2->text().toStdString().c_str());
|
||
strcpy(NewWaveInfo.TimeUnit,m_pUI->lineEdit_TimeUnit->text().toStdString().c_str());
|
||
strcpy(NewWaveInfo.TimeHZUnit,UTF8ToGBK(m_pUI->lineEdit_TimeUnit2->text()));//m_pUI->lineEdit_TimeUnit2->text().toStdString().c_str());
|
||
|
||
//检查输出曲线是否存在
|
||
CMemRdWt *Slffile=new CMemRdWt();
|
||
Slffile->Open(FileName.toStdString().c_str(),CSlfIO::modeReadWrite);
|
||
int index=Slffile->FindSlfObjectIndex(NewWaveInfo.Name);
|
||
if(index>=0)
|
||
{
|
||
QString str="输出对象名"+QString(QLatin1String(NewWaveInfo.Name));
|
||
str+=+"已存在,是否覆盖原同名对象?\r\n\r\n是--覆盖原同名对象;否--重新修改合并曲线名";
|
||
int flag = QMessageBox::warning(NULL,tr("提示"),str,QMessageBox::Yes,QMessageBox::No);
|
||
if(flag != QMessageBox::Yes)
|
||
{
|
||
delete Slffile;
|
||
return ;
|
||
}
|
||
short type=Slffile->GetObjectType(index);
|
||
if(type!=WAVE_OBJECT)Slffile->DiscardObject(NewWaveInfo.Name);
|
||
else
|
||
{
|
||
Slf_WAVE info;
|
||
Slffile->GetWaveInfo(index,&info);
|
||
if(NewWaveInfo.TimeSamples!=info.TimeSamples)Slffile->DiscardObject(NewWaveInfo.Name);
|
||
if(NewWaveInfo.DepLevel!=info.DepLevel)Slffile->ChannelResamples(index,NewWaveInfo.DepLevel);
|
||
}
|
||
}
|
||
int isResamples=0;
|
||
int TimeSamples=NewWaveInfo.SamplePoint*NewWaveInfo.ArrayNum;
|
||
if(NewWaveInfo.TimeSamples!=NewWaveInfo.ArrayNum*NewWaveInfo.SamplePoint)
|
||
{
|
||
isResamples=NewWaveInfo.SamplePoint*NewWaveInfo.ArrayNum;
|
||
NewWaveInfo.SamplePoint=NewWaveInfo.TimeSamples*NewWaveInfo.ArrayNum;
|
||
}
|
||
index=Slffile->OpenWave(&NewWaveInfo);
|
||
if(index<0)
|
||
{
|
||
delete Slffile;
|
||
AfxMessageBox("产生合并曲线失败!");
|
||
return ;
|
||
}
|
||
/* DepthProgress MyDepthProgress;(已加)
|
||
MyDepthProgress.CreatProgress(m_Sdep,m_Edep,"正在合并曲线");//"解编CLIS数据");
|
||
MyDepthProgress.SetDepth(m_Sdep);*/
|
||
char name[64];
|
||
int CurveNum=m_pUI->tableWidget->rowCount();
|
||
int *Index,*CurveType,*Point;
|
||
float *sdep,*edep,*rlev;
|
||
Index=new int[CurveNum];
|
||
CurveType=new int[CurveNum];
|
||
Point=new int[CurveNum];
|
||
sdep=new float[CurveNum];
|
||
edep=new float[CurveNum];
|
||
rlev=new float[CurveNum];
|
||
DepthProgress MyDepthProgress;
|
||
int proceCount=CurveNum*2+1;
|
||
MyDepthProgress.CreatProgress(0,proceCount,"正在合并曲线");
|
||
int pvalue=0;
|
||
//whp change 2018.10.15 保证读写一致
|
||
DWORD num=(NewWaveInfo.EndDepth-NewWaveInfo.StartDepth)/NewWaveInfo.DepLevel+1.5;
|
||
float *value;
|
||
value=new float[TimeSamples*num];
|
||
for( int i=0;i<CurveNum;i++)
|
||
{
|
||
sdep[i]=m_pUI->tableWidget->item(i,1)->text().toFloat();
|
||
edep[i]=m_pUI->tableWidget->item(i,2)->text().toFloat();
|
||
rlev[i]=m_pUI->tableWidget->item(i,3)->text().toFloat();
|
||
Point[i]=m_pUI->tableWidget->item(i,4)->text().toInt();
|
||
if(Point[i]==1)Index[i]=Slffile->OpenCurve(m_pUI->tableWidget->item(i,0)->text().toStdString().c_str());
|
||
else Index[i]=Slffile->OpenWave(m_pUI->tableWidget->item(i,0)->text().toStdString().c_str());
|
||
pvalue++;
|
||
MyDepthProgress.SetDepth(pvalue);
|
||
}
|
||
int pos=0;
|
||
for( int i=0;i<CurveNum;i++)
|
||
{
|
||
if(Point[i]==1)
|
||
{
|
||
if(rlev[i]==NewWaveInfo.DepLevel)
|
||
{
|
||
float *myvalue;
|
||
myvalue=new float[Point[i]*num];
|
||
Slffile->ReadCurve(Index[i],NewWaveInfo.StartDepth,num,myvalue);
|
||
for(DWORD ip=0;ip<num;ip++)
|
||
{
|
||
value[ip*TimeSamples+pos]=myvalue[ip];
|
||
}
|
||
delete []myvalue;
|
||
}
|
||
else
|
||
{
|
||
for(DWORD ip=0;ip<num;ip++)
|
||
Slffile->ReadCurve(Index[i],NewWaveInfo.StartDepth+ip*NewWaveInfo.DepLevel,1,&value[ip*NewWaveInfo.TimeSamples+pos]);
|
||
}
|
||
Slffile->CloseCurve(Index[i]);
|
||
}
|
||
else
|
||
{
|
||
if(rlev[i]==NewWaveInfo.DepLevel)
|
||
{
|
||
float *myvalue;
|
||
myvalue=new float[Point[i]*num];
|
||
Slffile->ReadWave(Index[i],NewWaveInfo.StartDepth,num,myvalue);
|
||
for(DWORD ip=0;ip<num;ip++)
|
||
{
|
||
for(int m=0;m<Point[i];m++)
|
||
{
|
||
value[ip*TimeSamples+pos+m]=myvalue[ip*Point[i]+m];
|
||
}
|
||
memcpy(&value[ip*TimeSamples+pos],&myvalue[ip*Point[i]],Point[i]*NewWaveInfo.CodeLen);
|
||
}
|
||
delete []myvalue;
|
||
}
|
||
else
|
||
{
|
||
for(DWORD ip=0;ip<num;ip++)
|
||
Slffile->ReadWave(Index[i],NewWaveInfo.StartDepth+ip*NewWaveInfo.DepLevel,1,&value[ip*TimeSamples+pos]);
|
||
}
|
||
}
|
||
pos+=Point[i];
|
||
pvalue++;
|
||
MyDepthProgress.SetDepth(pvalue);
|
||
Slffile->CloseWave(Index[i]);
|
||
}
|
||
if(isResamples)
|
||
{
|
||
float *nvalue=new float[num*NewWaveInfo.TimeSamples];
|
||
for(int i=0;i<num;i++){
|
||
Resamples(&value[i*isResamples],&nvalue[i*NewWaveInfo.TimeSamples],isResamples,NewWaveInfo.TimeSamples);
|
||
}
|
||
delete value;
|
||
value=nvalue;
|
||
}
|
||
Slffile->WriteWave(index,NewWaveInfo.StartDepth,num,value);
|
||
Slffile->CloseWave(index);
|
||
delete Slffile;
|
||
pvalue++;
|
||
MyDepthProgress.SetDepth(pvalue);
|
||
delete []Index;
|
||
delete []CurveType;
|
||
delete []Point;
|
||
delete []sdep;
|
||
delete []edep;
|
||
delete []rlev;
|
||
delete []value;
|
||
QMessageBox::warning(NULL,tr("提示"),"合成阵列曲线成功!");
|
||
|
||
|
||
QStringList lisObject;
|
||
lisObject.append(NewWaveInfo.Name);
|
||
emit CallGlobalManage::getInstance()->sig_Notice_AddObject("DataMgr",FileName,lisObject);
|
||
|
||
accept();
|
||
/*pai::graphics::*/CDataImport::ChangetoSlf(FileName,NULL);
|
||
}
|
||
/**
|
||
*@brief 取消槽函数
|
||
*/
|
||
void CWaveComposeDlg::slotCancel()
|
||
{
|
||
reject ();
|
||
}
|
||
//需要罗林解决的问题:
|
||
void CWaveComposeDlg::slotAdd()
|
||
{
|
||
//添加行:添加的内容第一列被保存在QStringList nameList中,其他列内容你不用管
|
||
//1、在指定位置插入一行多行,如果没有选择插入点,追加到尾部
|
||
//2、将nameList插入到CurveNameList相应位置
|
||
CAddCompCurveDlg *dlg=new CAddCompCurveDlg();
|
||
dlg->OldList=CurveNameList;
|
||
dlg->FileName=FileName;
|
||
dlg->init();
|
||
if(dlg->exec()==QDialog::Rejected)return;
|
||
|
||
int count=m_pUI->tableWidget->rowCount();
|
||
int insertRow=dlg->NewList.count();
|
||
m_rowCount+=insertRow;
|
||
QList<QTableWidgetSelectionRange> selRange=m_pUI->tableWidget->selectedRanges();
|
||
bool isSel=selRange.size()>0;
|
||
int index=0;
|
||
int sRow=isSel?(selRange.value(0).bottomRow()+1):count+1;//m_rowCount;
|
||
|
||
if(!isSel)
|
||
{
|
||
m_pUI->tableWidget->setRowCount(insertRow+count);//m_rowCount);
|
||
index=sRow-1;
|
||
// CurveNameList.append(dlg->NewList);
|
||
}else
|
||
{
|
||
for(int i=0;i<insertRow;i++)
|
||
{
|
||
m_pUI->tableWidget->insertRow(sRow);
|
||
// CurveNameList.insert(sRow+i,dlg->NewList.at(i));
|
||
}
|
||
index=sRow;
|
||
|
||
}
|
||
QTableWidgetItem *item=NULL;
|
||
QString textValue;
|
||
for(int i=0;i<dlg->m_pUI->tableWidgetNewCurve->rowCount();i++)//for(int i=1;i<=insertRow;i++)
|
||
{
|
||
Qt::CheckState eState= dlg->m_pUI->tableWidgetNewCurve->item(i,0)->checkState();
|
||
if (eState==Qt::Unchecked)continue;
|
||
item=new QTableWidgetItem(dlg->m_pUI->tableWidgetNewCurve->item(i,0)->text());
|
||
m_pUI->tableWidget->setItem(index,0,item);
|
||
for(int j=1;j<=m_fillColumn-1;j++)
|
||
{
|
||
textValue=dlg->m_pUI->tableWidgetNewCurve->item(i,j)->text();
|
||
item=new QTableWidgetItem(textValue);
|
||
m_pUI->tableWidget->setItem(index,j,item);
|
||
}
|
||
index++;
|
||
}
|
||
refresh();
|
||
}
|
||
void CWaveComposeDlg::refresh()//刷新CurveNameList和元素总数
|
||
{
|
||
CurveNameList.clear();
|
||
int h=CurveNameList.count();
|
||
int TENum=0;
|
||
for(int i=0;i<m_pUI->tableWidget->rowCount();i++)
|
||
{
|
||
CurveNameList.append(m_pUI->tableWidget->item(i,0)->text());
|
||
int ENum=m_pUI->tableWidget->item(i,4)->text().toInt();
|
||
TENum+=ENum;
|
||
m_pUI->tableWidget->setItem(i,5,new QTableWidgetItem(QString::number(TENum)));
|
||
}
|
||
h=CurveNameList.count();
|
||
h=0;
|
||
}
|
||
void CWaveComposeDlg::slotDelete()
|
||
{
|
||
//选择一行或者多行被删除,允许不连续选择,如删除1、2、3、8、10行
|
||
//实现以下功能:
|
||
//1、删除列表中的删除行
|
||
//2、从CurveNameList中删除相应项目(CurveNameList中保存的是第一列的内容)
|
||
/*QList<QTableWidgetItem *>selItem=m_pUI->tableWidget->selectedItems();
|
||
m_pUI->tableWidget->removeRow(2);
|
||
m_pUI->tableWidget->setRowCount(CurveNameList.count()-1);*/
|
||
if(m_rowCount<=1)
|
||
{
|
||
return;
|
||
}
|
||
|
||
int count=m_pUI->tableWidget->rowCount();
|
||
int insertRow=m_rowCount-count;
|
||
QList<QTableWidgetSelectionRange> selRanges=m_pUI->tableWidget->selectedRanges();
|
||
bool isSel=selRanges.size()>0;
|
||
if(!isSel)
|
||
{
|
||
return;
|
||
}
|
||
int index=0;
|
||
int sRow=0;
|
||
int eRow=0;
|
||
int delCount=0;
|
||
foreach(const QTableWidgetSelectionRange &range,selRanges)
|
||
{
|
||
|
||
sRow=range.topRow();
|
||
eRow=range.bottomRow();
|
||
index=sRow-delCount;
|
||
delCount=0;
|
||
for(int r=sRow;r<=eRow;r++)
|
||
{
|
||
--m_rowCount;
|
||
delCount++;
|
||
m_pUI->tableWidget->removeRow(index);
|
||
|
||
}
|
||
}
|
||
refresh();
|
||
}
|
||
|
||
|
||
|
||
void CWaveComposeDlg::slotUp()
|
||
{
|
||
//选择一行或者多行往前移动,允许不连续选择,如删除1、2、3、8、10行
|
||
//1、把选择的行向上移动一行,移动后被选择的行仍处于选中状态(可以继续上移,实现多步移动)
|
||
//2、CurveNameList内容随之改变
|
||
int count=m_pUI->tableWidget->rowCount();
|
||
int insertRow=m_rowCount-count;
|
||
QList<QTableWidgetSelectionRange> selRanges=m_pUI->tableWidget->selectedRanges();
|
||
bool isSel=selRanges.size()>0;
|
||
if(!isSel)
|
||
{
|
||
return;
|
||
}
|
||
DataSlotHelper::instance()->movedUp(m_pUI->tableWidget);
|
||
|
||
}
|
||
void CWaveComposeDlg::slotDown()
|
||
{
|
||
//选择一行或者多行往后移动,允许不连续选择,如删除1、2、3、8、10行
|
||
//1、把选择的行向上移动一行,移动后被选择的行仍处于选中状态(可以继续上移,实现多步移动)
|
||
//2、CurveNameList内容随之改变
|
||
int count=m_pUI->tableWidget->rowCount();
|
||
int insertRow=m_rowCount-count;
|
||
QList<QTableWidgetSelectionRange> selRanges=m_pUI->tableWidget->selectedRanges();
|
||
bool isSel=selRanges.size()>0;
|
||
if(!isSel)
|
||
{
|
||
return;
|
||
}
|
||
DataSlotHelper::instance()->movedDow(m_pUI->tableWidget);
|
||
|
||
}
|
||
|
||
void CWaveComposeDlg::sampleChanged(const QString &str)
|
||
{
|
||
int mSample=m_pUI->lineEdit_Sample->text().toInt();
|
||
if(mSample>1&&mSample<=m_SampleIn)
|
||
{
|
||
int mArrayNum=m_SampleIn/mSample;
|
||
int mSampleTotal=mSample*mArrayNum;
|
||
m_pUI->lineEdit_ArrayNum->setText(QString::number(mArrayNum));
|
||
m_pUI->lineEdit_TotalSample->setText(QString::number(mSampleTotal));
|
||
}
|
||
}
|
||
void CWaveComposeDlg::arrayChanged(const QString &str)
|
||
{
|
||
int mArrayNum=m_pUI->lineEdit_ArrayNum->text().toInt();
|
||
if(mArrayNum>=1&&mArrayNum<=m_SampleIn)
|
||
{
|
||
int mSample=m_SampleIn/mArrayNum;
|
||
int mSampleTotal=mSample*mArrayNum;
|
||
m_pUI->lineEdit_Sample->setText(QString::number(mSample));
|
||
m_pUI->lineEdit_TotalSample->setText(QString::number(mSampleTotal));
|
||
}
|
||
}
|
||
void CWaveComposeDlg::init()//const QString& FileName,const QStringList& CurveNameList)//int row,int col,QStringList header)
|
||
{
|
||
m_pUI->tableWidget->setColumnCount(6);
|
||
QStringList header;
|
||
header<<" 名称"<<"起始深度"<<"终止深度"<<"采样间隔"<<"元素个数"<<"累计元素个数";
|
||
m_pUI->tableWidget->setHorizontalHeaderLabels(header);
|
||
m_pUI->tableWidget->setColumnWidth(1,200);
|
||
m_pUI->tableWidget->horizontalHeader()->setStretchLastSection(true);
|
||
//m_pUI->tableWidget->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||
//m_pUI->tableWidget->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
|
||
// m_pUI->tableWidget->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents);
|
||
m_rowCount=CurveNameList.count();
|
||
m_pUI->tableWidget->setRowCount(CurveNameList.count());
|
||
int TENum=0;//总元素个数
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
logio->Open(FileName.toStdString().c_str(),CSlfIO::modeReadWrite);
|
||
for(int i=0;i<m_rowCount;i++)
|
||
{
|
||
QString CurveName=CurveNameList[i];
|
||
m_pUI->tableWidget->setItem(i,0,new QTableWidgetItem(CurveName));
|
||
int index=logio->OpenChannel(CurveName.toStdString().c_str());
|
||
if(index<0)continue;
|
||
Slf_CHANNEL pInfo;
|
||
memset(&pInfo,0,sizeof(Slf_CHANNEL));
|
||
logio->GetChannelInfo(index,&pInfo);
|
||
float sdep=pInfo.DimInfo[0].StartVal;
|
||
float edep=pInfo.DimInfo[0].StartVal+(pInfo.DimInfo[0].Samples-1)*pInfo.DimInfo[0].Delta;
|
||
m_pUI->tableWidget->setItem(i,1,new QTableWidgetItem(QString::number(sdep)));
|
||
m_pUI->tableWidget->setItem(i,2,new QTableWidgetItem(QString::number(edep)));
|
||
m_pUI->tableWidget->setItem(i,3,new QTableWidgetItem(QString::number(pInfo.DimInfo[0].Delta)));
|
||
int ENum=pInfo.DimInfo[0].Size/pInfo.CodeLen;//元素个数
|
||
m_pUI->tableWidget->setItem(i,4,new QTableWidgetItem(QString::number(ENum)));
|
||
TENum+=ENum;
|
||
m_pUI->tableWidget->setItem(i,5,new QTableWidgetItem(QString::number(TENum)));
|
||
if(i==0)
|
||
{
|
||
m_EdepMin= edep;
|
||
m_SdepMin= sdep;
|
||
m_RlevMin= pInfo.DimInfo[0].Delta;
|
||
m_EdepMax= edep;
|
||
m_SdepMax= sdep;
|
||
m_RlevMax= pInfo.DimInfo[0].Delta;
|
||
if(ENum==1)
|
||
{
|
||
Slf_CURVE pInfo;
|
||
logio->GetCurveInfo(index,&pInfo);
|
||
memcpy(&NewWaveInfo,&pInfo,sizeof(Slf_CURVE));
|
||
NewWaveInfo.StartTime=0;
|
||
NewWaveInfo.TimeLevel=1;
|
||
NewWaveInfo.ArrayNum=1;
|
||
strcpy(NewWaveInfo.TimeUnit,"ms");
|
||
strcpy(NewWaveInfo.TimeHZUnit,"毫秒");
|
||
strcpy(NewWaveInfo.TimeName,"Time");;
|
||
strcpy(NewWaveInfo.TimeHZName,"时间");
|
||
}
|
||
else
|
||
{
|
||
Slf_WAVE pInfo;
|
||
logio->GetWaveInfo(index,&pInfo);
|
||
memcpy(&NewWaveInfo,&pInfo,sizeof(Slf_WAVE));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(m_SdepMin>sdep)m_SdepMin=sdep;
|
||
if(m_EdepMin>edep)m_EdepMin=edep;
|
||
if(m_SdepMax<sdep)m_SdepMax=sdep;
|
||
if(m_EdepMax<edep)m_EdepMax=edep;
|
||
if(m_RlevMin>pInfo.DimInfo[0].Delta)m_RlevMin=pInfo.DimInfo[0].Delta;
|
||
if(m_RlevMax<pInfo.DimInfo[0].Delta)m_RlevMax=pInfo.DimInfo[0].Delta;
|
||
}
|
||
logio->CloseChannel(index);
|
||
}
|
||
delete logio;
|
||
m_SampleIn=TENum;
|
||
m_pUI->lineEdit_SdepMin->setText(QString::number(m_SdepMin));
|
||
m_pUI->lineEdit_SdepMax->setText(QString::number(m_SdepMax));
|
||
m_pUI->lineEdit_EdepMin->setText(QString::number(m_EdepMin));
|
||
m_pUI->lineEdit_EdepMax->setText(QString::number(m_EdepMax));
|
||
m_pUI->lineEdit_RlevMin->setText(QString::number(m_RlevMin));
|
||
m_pUI->lineEdit_RlevMax->setText(QString::number(m_RlevMax));
|
||
m_pUI->lineEdit_Sdep->setText(QString::number(m_SdepMax));
|
||
m_pUI->lineEdit_Edep->setText(QString::number(m_EdepMin));
|
||
m_pUI->lineEdit_Rlev->setText(QString::number(m_RlevMax));
|
||
m_pUI->lineEdit_CurveName->setText(CurveNameList[0]+"wave");
|
||
m_pUI->lineEdit_CurveName_2->setText(CurveNameList[0]+"wave");
|
||
m_pUI->lineEdit_CurveUnit->setText(QString(QLatin1String(NewWaveInfo.Unit)));//m
|
||
m_pUI->lineEdit_CurveUnit_2->setText(QString::fromLocal8Bit(NewWaveInfo.AliasUnit));//"米"
|
||
m_pUI->lineEdit_DepthUnit->setText(QString(QLatin1String(NewWaveInfo.DepthUnit)));//m
|
||
m_pUI->lineEdit_DepthUnit_2->setText(QString::fromLocal8Bit(NewWaveInfo.DepthHZUnit));//"米"
|
||
m_pUI->comboBox_DataType->setCurrentIndex(NewWaveInfo.RepCode-1);
|
||
m_pUI->lineEdit_Min->setText(QString::number(NewWaveInfo.MinValue));
|
||
m_pUI->lineEdit_Max->setText(QString::number(NewWaveInfo.MaxValue));
|
||
m_pUI->lineEdit_DefVal->setText(QString::number(NewWaveInfo.DefVal));
|
||
//二维
|
||
m_pUI->lineEdit_TimeName->setText(QString(QLatin1String(NewWaveInfo.TimeName)));//time
|
||
m_pUI->lineEdit_TimeName2->setText((/*QString::fromLocal8Bit*/(NewWaveInfo.TimeHZName)));//"时间"
|
||
m_pUI->lineEdit_TimeUnit->setText(QString(QLatin1String(NewWaveInfo.TimeUnit)));//ms
|
||
m_pUI->lineEdit_TimeUnit2->setText(/*QString::fromLocal8Bit*/(NewWaveInfo.TimeHZUnit));//毫秒
|
||
m_pUI->lineEdit_StartTime->setText(QString::number(NewWaveInfo.StartTime));
|
||
m_pUI->lineEdit_TimeRlev->setText(QString::number(NewWaveInfo.TimeLevel));
|
||
m_pUI->lineEdit_ArrayNum->setText("1");
|
||
m_pUI->lineEdit_Sample->setText(QString::number(TENum));
|
||
m_pUI->lineEdit_TotalSample->setText(QString::number(TENum));
|
||
m_pUI->lineEdit_TotalSampleIn->setText(QString::number(TENum));
|
||
}
|
||
|
||
|
||
|
||
END_OSGGRAPHICS_NAMESPACE
|