Compare commits
No commits in common. "5804813c577bf84a5c10b2192696fbb7d9d9830f" and "fcad00a5d78700da1b6588beef623ea6ebc3d47c" have entirely different histories.
5804813c57
...
fcad00a5d7
|
|
@ -12,50 +12,6 @@
|
||||||
|
|
||||||
float mLineWidth=0.75;
|
float mLineWidth=0.75;
|
||||||
QString OilField;
|
QString OilField;
|
||||||
|
|
||||||
double GetData(int RepCode, char *buffer)
|
|
||||||
{
|
|
||||||
double yy;
|
|
||||||
if (!buffer) return 0;
|
|
||||||
switch (RepCode)
|
|
||||||
{
|
|
||||||
case REPR_INT: //0
|
|
||||||
yy = (double)(*((int*)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_SHORT: //1
|
|
||||||
yy = (double)(*((short *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_LONG://2
|
|
||||||
yy = (double)(*((long *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_FLOAT://3
|
|
||||||
yy = (double)(*((float *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_DOUBLE://4
|
|
||||||
yy = (double)(*((double *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_CHAR://5
|
|
||||||
yy = (double)(*((char *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_UCHAR://6
|
|
||||||
yy = (double)(*((unsigned char *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_USHORT://7
|
|
||||||
yy = (double)(*((unsigned short *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_UINT://8
|
|
||||||
yy = (double)(*((unsigned int *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_ULONG://9
|
|
||||||
yy = (double)(*((unsigned long *)buffer));
|
|
||||||
break;
|
|
||||||
case REPR_STRING://10
|
|
||||||
yy = -99999;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return yy;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString setdec(QString text,int dec,bool all)
|
QString setdec(QString text,int dec,bool all)
|
||||||
{
|
{
|
||||||
if(text.size()==0) return text;
|
if(text.size()==0) return text;
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,6 @@ typedef struct GEOLITH_Table
|
||||||
char Dest[64];
|
char Dest[64];
|
||||||
} GeoLith_DATA;
|
} GeoLith_DATA;
|
||||||
|
|
||||||
double GetData(int RepCode, char *buffer);
|
|
||||||
|
|
||||||
QString GetProjectFolder();
|
QString GetProjectFolder();
|
||||||
QString GetLogdataPath();
|
QString GetLogdataPath();
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
||||||
bool bDraw = false;
|
bool bDraw = false;
|
||||||
QStringList slist;
|
QStringList slist;
|
||||||
slist << "显示名称" << "显示单位" << "曲线名称" << "曲线单位" << "曲线刻度"
|
slist << "显示名称" << "显示单位" << "曲线名称" << "曲线单位" << "曲线刻度"
|
||||||
<< "类型" << "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "显示刻度" << "色板" << "变密度颜色级数";
|
<< "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "显示刻度" << "色板" << "变密度颜色级数";
|
||||||
for (int i = 0; i < slist.length(); i++)
|
for (int i = 0; i < slist.length(); i++)
|
||||||
{
|
{
|
||||||
if (slist.at(i) == m_propertyData[pProperty])
|
if (slist.at(i) == m_propertyData[pProperty])
|
||||||
|
|
@ -1245,13 +1245,13 @@ void PropertyWidget::initWaveProperty(FormInfo *formInfo)
|
||||||
drawType.append("自选阵列");
|
drawType.append("自选阵列");
|
||||||
drawType.append("三维图像");
|
drawType.append("三维图像");
|
||||||
drawType.append("多臂井径");
|
drawType.append("多臂井径");
|
||||||
_CreateEnumPropertyItem("绘图类型", "类型", formInfo->m_nDrawType, drawType);
|
_CreateEnumPropertyItem("绘图类型", "类型", drawType.indexOf(formInfo->m_strDrawType), drawType);
|
||||||
|
|
||||||
QStringList fillType;
|
QStringList fillType;
|
||||||
fillType.append("全周");
|
fillType.append("全周");
|
||||||
fillType.append("正半周");
|
fillType.append("正半周");
|
||||||
fillType.append("负半周");
|
fillType.append("负半周");
|
||||||
_CreateEnumPropertyItem("填充方式", "方式", formInfo->m_nFillType, fillType);
|
_CreateEnumPropertyItem("填充方式", "方式", formInfo->m_strFillType.toInt(), fillType);
|
||||||
|
|
||||||
//_CreateVariantPropertyItem("波形绘制参数", "自动平滑", true, QVariant::Bool);
|
//_CreateVariantPropertyItem("波形绘制参数", "自动平滑", true, QVariant::Bool);
|
||||||
_CreateVariantPropertyItem("波形绘制参数", "左刻度", formInfo->m_vmin, QVariant::Double);
|
_CreateVariantPropertyItem("波形绘制参数", "左刻度", formInfo->m_vmin, QVariant::Double);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ extern QString g_prjname;
|
||||||
|
|
||||||
extern int g_iSupport3D;
|
extern int g_iSupport3D;
|
||||||
|
|
||||||
|
double GetData(int RepCode,char *buffer);
|
||||||
extern void AppendConsole(Priority priority, const QString &output);
|
extern void AppendConsole(Priority priority, const QString &output);
|
||||||
|
|
||||||
//曲线绘制(多个)
|
//曲线绘制(多个)
|
||||||
|
|
@ -147,15 +148,6 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo)
|
||||||
|
|
||||||
if ("waveObject" == strType)
|
if ("waveObject" == strType)
|
||||||
{
|
{
|
||||||
curv->m_iY1 = m_iY1;
|
|
||||||
curv->m_iY2 = m_iY2;
|
|
||||||
curv->m_nMode = pInfo->getFillTypeIndex();
|
|
||||||
//curv->m_fmin = pInfo->getVMin();
|
|
||||||
//curv->m_fmax = pInfo->getVMax();
|
|
||||||
curv->m_nColorNum = pInfo->m_nColorNum;
|
|
||||||
curv->m_nSchemeIndex = pInfo->m_nSchemeIndex;
|
|
||||||
curv->m_fScaleV = pInfo->getVMax();
|
|
||||||
|
|
||||||
int _nSamples = 0;
|
int _nSamples = 0;
|
||||||
if (g_iSupport3D)
|
if (g_iSupport3D)
|
||||||
{
|
{
|
||||||
|
|
@ -163,9 +155,17 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//curv->initWave2(m_strSlfName, strLineName);
|
initWave(curv, m_strSlfName, strLineName, _nSamples);
|
||||||
curv->initWave(m_strSlfName, strLineName);
|
|
||||||
}
|
}
|
||||||
|
curv->m_nMode = pInfo->getFillTypeIndex();
|
||||||
|
//curv->m_fmin = pInfo->getVMin();
|
||||||
|
//curv->m_fmax = pInfo->getVMax();
|
||||||
|
curv->m_nColorNum = pInfo->m_nColorNum;
|
||||||
|
curv->m_nSchemeIndex = pInfo->m_nSchemeIndex;
|
||||||
|
curv->initColorTable();
|
||||||
|
curv->updateWave();
|
||||||
|
float f = 264 / pInfo->getVMax();
|
||||||
|
curv->m_colorMap->data()->setValueRange(QCPRange(curv->m_fmin, curv->m_fmax*f));
|
||||||
}
|
}
|
||||||
// 深度
|
// 深度
|
||||||
else if("depthObject" == strType)
|
else if("depthObject" == strType)
|
||||||
|
|
@ -2501,6 +2501,49 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
|
||||||
//AppendConsole(PAI_INFO, "FormDraw initForm end");
|
//AppendConsole(PAI_INFO, "FormDraw initForm end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double GetData(int RepCode,char *buffer)
|
||||||
|
{
|
||||||
|
double yy;
|
||||||
|
if(!buffer) return 0;
|
||||||
|
switch(RepCode)
|
||||||
|
{
|
||||||
|
case REPR_INT: //0
|
||||||
|
yy=(double)(*((int*)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_SHORT: //1
|
||||||
|
yy=(double)(*((short *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_LONG://2
|
||||||
|
yy=(double)(*((long *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_FLOAT://3
|
||||||
|
yy=(double)(*((float *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_DOUBLE://4
|
||||||
|
yy=(double)(*((double *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_CHAR://5
|
||||||
|
yy=(double)(*((char *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_UCHAR://6
|
||||||
|
yy=(double)(*((unsigned char *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_USHORT://7
|
||||||
|
yy=(double)(*((unsigned short *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_UINT://8
|
||||||
|
yy=(double)(*((unsigned int *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_ULONG://9
|
||||||
|
yy=(double)(*((unsigned long *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_STRING://10
|
||||||
|
yy=-99999;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return yy;
|
||||||
|
}
|
||||||
|
|
||||||
void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples)
|
void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples)
|
||||||
{
|
{
|
||||||
CLogIO *logio=new CLogIO();
|
CLogIO *logio=new CLogIO();
|
||||||
|
|
@ -3135,6 +3178,146 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName,
|
||||||
//widget->rescaleAxes();
|
//widget->rescaleAxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FormDraw::initWave2(QMyCustomPlot *widget, QString strSlfName, QString strWaveName)
|
||||||
|
{
|
||||||
|
CLogIO *logio=new CLogIO();
|
||||||
|
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||||||
|
//
|
||||||
|
int index=logio->OpenWave(strWaveName.toStdString().c_str());
|
||||||
|
if(index<0) {
|
||||||
|
delete logio;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Slf_WAVE _wave;
|
||||||
|
logio->GetWaveInfo(index, &_wave);
|
||||||
|
float _SDep,_EDep,_Rlev;
|
||||||
|
// _SDep = _wave.StartDepth;
|
||||||
|
// _EDep = _wave.EndDepth;
|
||||||
|
|
||||||
|
m_iY2 = 0 - _wave.StartDepth;
|
||||||
|
m_iY1 = 0 - _wave.EndDepth;
|
||||||
|
|
||||||
|
_SDep = 0.0 - m_iY2;
|
||||||
|
_EDep = 0.0 - m_iY1;
|
||||||
|
_Rlev = _wave.DepLevel;
|
||||||
|
int m_Record=(float)(fabs((_EDep-_SDep)/_Rlev+0.5));
|
||||||
|
|
||||||
|
int _nSamples = _wave.TimeSamples;
|
||||||
|
|
||||||
|
char *value=new char[(_nSamples+1)*m_Record*_wave.CodeLen+1];
|
||||||
|
logio->ReadWave(index,_SDep,m_Record,(void *)value);
|
||||||
|
logio->CloseWave(index);
|
||||||
|
delete logio;
|
||||||
|
|
||||||
|
bool bFistValue=false;
|
||||||
|
float vmax = (float)_nSamples;
|
||||||
|
float vmin = 0;
|
||||||
|
//
|
||||||
|
double** wavedata;
|
||||||
|
wavedata = new double*[_nSamples];
|
||||||
|
for(int kk = 0;kk<_nSamples;kk++){
|
||||||
|
wavedata[kk] = new double[m_Record];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<m_Record; i++)
|
||||||
|
{
|
||||||
|
for(int kk = 0;kk<_nSamples;kk++)
|
||||||
|
{
|
||||||
|
double val = GetData(_wave.RepCode,(char *)&value[(kk)*_wave.CodeLen+i*_nSamples*_wave.CodeLen]);
|
||||||
|
wavedata[kk][i] = val;
|
||||||
|
if(val==-9999)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// if(bFistValue==false)
|
||||||
|
// {
|
||||||
|
// //最大值,最小值默认采用第一个有效值
|
||||||
|
// bFistValue=true;
|
||||||
|
// vmax = vmin = val;
|
||||||
|
// }
|
||||||
|
// if(vmax<val)vmax=val;
|
||||||
|
// if(vmin>val)vmin=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete[] value;
|
||||||
|
|
||||||
|
// m_iY1 = 0.0 -_EDep;
|
||||||
|
// m_iY2 = 0.0 -_SDep;
|
||||||
|
//------------------------
|
||||||
|
widget->m_iX1 = vmin;
|
||||||
|
widget->m_iX2 = vmax;
|
||||||
|
widget->m_iY1 = m_iY1;
|
||||||
|
widget->m_iY2 = m_iY2;
|
||||||
|
//
|
||||||
|
widget->xAxis->setRange(vmin, vmax);
|
||||||
|
widget->yAxis->setRange(m_iY1, m_iY2);
|
||||||
|
widget->axisRect()->setupFullAxesBox();
|
||||||
|
//
|
||||||
|
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
|
||||||
|
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
|
||||||
|
|
||||||
|
//对调XY轴,在最前面设置
|
||||||
|
// QCPAxis *yAxis = widget->yAxis;
|
||||||
|
// QCPAxis *xAxis = widget->xAxis;
|
||||||
|
// widget->xAxis = yAxis;
|
||||||
|
// widget->yAxis = xAxis;
|
||||||
|
|
||||||
|
//注意,不对调XY轴
|
||||||
|
widget->m_bX2Y = false;
|
||||||
|
float nPerHight = 50;//25
|
||||||
|
float nSpace = 1;
|
||||||
|
for (int i=0; i<m_Record; i++)
|
||||||
|
{
|
||||||
|
//--------------------------------
|
||||||
|
QVector<double> x;
|
||||||
|
QVector<double> y;
|
||||||
|
widget->addGraph();
|
||||||
|
QString strLineName = "";
|
||||||
|
if(strLineName=="")
|
||||||
|
{
|
||||||
|
strLineName = QString("曲线 %1").arg(widget->graphCount());
|
||||||
|
}
|
||||||
|
widget->graph()->setName(strLineName);
|
||||||
|
|
||||||
|
for(int kk = 0;kk<_nSamples;kk++)
|
||||||
|
{
|
||||||
|
//double val = wavedata[kk][m_Record-i-1];
|
||||||
|
double val = wavedata[kk][i];
|
||||||
|
if(val==-9999)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//x.append(_nSamples-kk-1);
|
||||||
|
float tempValue = -(_SDep + nPerHight*_Rlev*i + (val*200*2)/vmax);
|
||||||
|
x.append(kk);
|
||||||
|
//float tempValue = -(_SDep + nSpace*i + (val*nPerHight*_Rlev*2)/vmax);
|
||||||
|
y.append(tempValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
widget->graph()->setData(x, y);
|
||||||
|
widget->graph()->setLineStyle((QCPGraph::LineStyle)(1));//曲线
|
||||||
|
widget->graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(1)));
|
||||||
|
//
|
||||||
|
QPen graphPen;
|
||||||
|
QColor newlineColor = QColor(std::rand()%245+10, std::rand()%245+10, std::rand()%245+10);
|
||||||
|
graphPen.setColor(newlineColor);
|
||||||
|
double width = 1;
|
||||||
|
graphPen.setWidthF(width);
|
||||||
|
graphPen.setStyle(Qt::SolidLine);//实线
|
||||||
|
widget->graph()->setPen(graphPen);
|
||||||
|
//widget->replot();
|
||||||
|
|
||||||
|
if(i>=20)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//表格曲线
|
//表格曲线
|
||||||
void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,6 @@ public:
|
||||||
//波列
|
//波列
|
||||||
void initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples);
|
void initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples);
|
||||||
void initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples);
|
void initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples);
|
||||||
// 绘图类型-波形
|
|
||||||
void initWave2(QMyCustomPlot *widget, QString strSlfName, QString strWaveName);
|
void initWave2(QMyCustomPlot *widget, QString strSlfName, QString strWaveName);
|
||||||
|
|
||||||
//图像-3d成图
|
//图像-3d成图
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,8 @@ void FormInfo::initProperty(QJsonObject obj)
|
||||||
QString strType = obj.value("Type").toString();
|
QString strType = obj.value("Type").toString();
|
||||||
if ("waveObject" == strType)
|
if ("waveObject" == strType)
|
||||||
{
|
{
|
||||||
m_nDrawType = obj.value("DrawType").toInt();
|
m_strDrawType = obj.value("DrawType").toString();
|
||||||
m_nFillType = obj.value("FillType").toInt();
|
m_strFillType = obj.value("FillType").toString();
|
||||||
m_strAmp = obj.value("Amp").toString();
|
m_strAmp = obj.value("Amp").toString();
|
||||||
m_fMaxAmp = obj.value("MaxAmp").toDouble();
|
m_fMaxAmp = obj.value("MaxAmp").toDouble();
|
||||||
m_nSchemeIndex = obj.value("SchemeIndex").toInt();
|
m_nSchemeIndex = obj.value("SchemeIndex").toInt();
|
||||||
|
|
@ -146,8 +146,8 @@ QJsonObject FormInfo::makeJson()
|
||||||
}
|
}
|
||||||
else if (m_strType == "waveObject")
|
else if (m_strType == "waveObject")
|
||||||
{
|
{
|
||||||
rootObj["DrawType"] = m_nDrawType;
|
rootObj["DrawType"] = m_strDrawType;
|
||||||
rootObj["FillType"] = m_nFillType;
|
rootObj["FillType"] = m_strFillType;
|
||||||
rootObj["Amp"] = m_strAmp;
|
rootObj["Amp"] = m_strAmp;
|
||||||
rootObj["MaxAmp"] = m_fMaxAmp;
|
rootObj["MaxAmp"] = m_fMaxAmp;
|
||||||
|
|
||||||
|
|
@ -571,15 +571,10 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val)
|
||||||
{
|
{
|
||||||
this->m_curveScaleFont = val.value<QFont>();
|
this->m_curveScaleFont = val.value<QFont>();
|
||||||
}
|
}
|
||||||
else if ("类型" == strProName)
|
|
||||||
{
|
|
||||||
bDraw = true;
|
|
||||||
this->m_nDrawType = val.toInt();
|
|
||||||
}
|
|
||||||
else if ("方式" == strProName)
|
else if ("方式" == strProName)
|
||||||
{
|
{
|
||||||
bDraw = true;
|
bDraw = true;
|
||||||
this->m_nFillType = val.toInt();
|
this->m_strFillType = val.toString();
|
||||||
}
|
}
|
||||||
else if ("左刻度" == strProName)
|
else if ("左刻度" == strProName)
|
||||||
{
|
{
|
||||||
|
|
@ -619,7 +614,7 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val)
|
||||||
|
|
||||||
int FormInfo::getFillTypeIndex()
|
int FormInfo::getFillTypeIndex()
|
||||||
{
|
{
|
||||||
return m_nFillType;
|
return m_strFillType.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改曲线选择状态 iSelect=0未知,1标准曲线,2主曲线,3从曲线
|
//修改曲线选择状态 iSelect=0未知,1标准曲线,2主曲线,3从曲线
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,8 @@ public:
|
||||||
|
|
||||||
int m_nJg;
|
int m_nJg;
|
||||||
|
|
||||||
int m_nDrawType; // 绘图类型
|
QString m_strDrawType; // 绘图类型
|
||||||
int m_nFillType; // 填充类型
|
QString m_strFillType; // 填充类型
|
||||||
QString m_strAmp; // 幅度刻度
|
QString m_strAmp; // 幅度刻度
|
||||||
float m_fMaxAmp; // 最大振幅
|
float m_fMaxAmp; // 最大振幅
|
||||||
bool m_bShowScale; // 显示刻度
|
bool m_bShowScale; // 显示刻度
|
||||||
|
|
|
||||||
|
|
@ -365,8 +365,6 @@ void FormTrack::s_addWave(QString strSlfName, QString strWellName, QString strTr
|
||||||
formInfo->setVMax(vmax);
|
formInfo->setVMax(vmax);
|
||||||
formInfo->setVMin(vmin);
|
formInfo->setVMin(vmin);
|
||||||
|
|
||||||
formInfo->m_nDrawType = 2;
|
|
||||||
formInfo->m_nFillType = 1;
|
|
||||||
formInfo->m_curveNameFont = QFont("黑体", 12);
|
formInfo->m_curveNameFont = QFont("黑体", 12);
|
||||||
formInfo->m_curveUnitFont = QFont("黑体", 10);
|
formInfo->m_curveUnitFont = QFont("黑体", 10);
|
||||||
formInfo->m_curveScaleFont = QFont("黑体", 10);
|
formInfo->m_curveScaleFont = QFont("黑体", 10);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
#include "transparentdraggableSelectRect.h"
|
#include "transparentdraggableSelectRect.h"
|
||||||
#include "transparentdraggableRightList.h"
|
#include "transparentdraggableRightList.h"
|
||||||
#include "qtcommonclass.h"
|
#include "qtcommonclass.h"
|
||||||
#include "slf.h"
|
|
||||||
|
|
||||||
//是否隐藏刻度
|
//是否隐藏刻度
|
||||||
extern int g_iShow;
|
extern int g_iShow;
|
||||||
|
|
@ -104,265 +103,6 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
||||||
connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList)));
|
connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName)
|
|
||||||
{
|
|
||||||
CLogIO *logio = new CLogIO();
|
|
||||||
logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead);
|
|
||||||
//
|
|
||||||
int index = logio->OpenWave(strWaveName.toStdString().c_str());
|
|
||||||
if (index < 0) {
|
|
||||||
delete logio;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMyCustomPlot* widget = this;
|
|
||||||
Slf_WAVE _wave;
|
|
||||||
logio->GetWaveInfo(index, &_wave);
|
|
||||||
float _SDep, _EDep, _Rlev;
|
|
||||||
_SDep = _wave.StartDepth;
|
|
||||||
_EDep = _wave.EndDepth;
|
|
||||||
// _SDep = 0.0 - m_iY2;
|
|
||||||
// _EDep = 0.0 - m_iY1;
|
|
||||||
_Rlev = _wave.DepLevel;
|
|
||||||
int m_Record = (float)(fabs((_EDep - _SDep) / _Rlev + 0.5));
|
|
||||||
|
|
||||||
int _nSamples = _wave.TimeSamples;
|
|
||||||
|
|
||||||
char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1];
|
|
||||||
logio->ReadWave(index, _SDep, m_Record, (void *)value);
|
|
||||||
logio->CloseWave(index);
|
|
||||||
delete logio;
|
|
||||||
|
|
||||||
bool bFistValue = false;
|
|
||||||
float vmax = -9999;//(float)_nSamples;
|
|
||||||
float vmin = -9999;
|
|
||||||
//
|
|
||||||
double** wavedata = widget->getWavedata(_nSamples, m_Record);
|
|
||||||
//wavedata = new double*[_nSamples];
|
|
||||||
//for(int kk = 0;kk<_nSamples;kk++){
|
|
||||||
// wavedata[kk] = new double[m_Record];
|
|
||||||
//}
|
|
||||||
|
|
||||||
for (int i = 0; i < m_Record; i++)
|
|
||||||
{
|
|
||||||
for (int kk = 0; kk < _nSamples; kk++)
|
|
||||||
{
|
|
||||||
double val = GetData(_wave.RepCode, (char *)&value[(kk)*_wave.CodeLen + i * _nSamples*_wave.CodeLen]);
|
|
||||||
wavedata[kk][i] = val;
|
|
||||||
if (val == -9999)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (bFistValue == false)
|
|
||||||
{
|
|
||||||
//最大值,最小值默认采用第一个有效值
|
|
||||||
bFistValue = true;
|
|
||||||
vmax = vmin = val;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (vmax < val)vmax = val;
|
|
||||||
if (vmin > val)vmin = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] value;
|
|
||||||
|
|
||||||
// m_iY1 = 0.0 -_EDep;
|
|
||||||
// m_iY2 = 0.0 -_SDep;
|
|
||||||
//------------------------
|
|
||||||
widget->m_iX1 = vmin;
|
|
||||||
widget->m_iX2 = vmax;
|
|
||||||
widget->m_iY1 = m_iY1;
|
|
||||||
widget->m_iY2 = m_iY2;
|
|
||||||
//
|
|
||||||
widget->xAxis->setRange(vmin, vmax);
|
|
||||||
widget->yAxis->setRange(m_iY1, m_iY2);
|
|
||||||
widget->axisRect()->setupFullAxesBox();
|
|
||||||
//
|
|
||||||
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
|
|
||||||
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
|
|
||||||
|
|
||||||
//对调XY轴,在最前面设置
|
|
||||||
QCPAxis *yAxis = widget->yAxis;
|
|
||||||
QCPAxis *xAxis = widget->xAxis;
|
|
||||||
widget->xAxis = yAxis;
|
|
||||||
widget->yAxis = xAxis;
|
|
||||||
|
|
||||||
widget->m_fmin = vmin;
|
|
||||||
widget->m_fmax = vmax;
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
// set up the QCPColorMap:
|
|
||||||
if (widget->m_colorMap == NULL)
|
|
||||||
{
|
|
||||||
QCPColorMap *colorMap = new QCPColorMap(widget->xAxis, widget->yAxis);
|
|
||||||
widget->m_colorMap = colorMap;
|
|
||||||
|
|
||||||
int nx = m_Record;
|
|
||||||
int ny = _nSamples;
|
|
||||||
colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
|
|
||||||
//colorMap->data()->setRange(QCPRange(m_iY1, m_iY2), QCPRange(vmin, vmax)); // 并在键(x)和值(y)维上跨越坐标范围-4..4
|
|
||||||
colorMap->data()->setRange(QCPRange(0 - _EDep, 0 - _SDep), QCPRange(vmin, vmax));
|
|
||||||
// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据:
|
|
||||||
this->updateWave();
|
|
||||||
|
|
||||||
// 添加色标:
|
|
||||||
QCPColorScale *colorScale = new QCPColorScale(widget);
|
|
||||||
colorMap->setColorScale(colorScale); // 将颜色图与色标关联
|
|
||||||
// 重新缩放数据维度(颜色),以使所有数据点都位于颜色渐变显示的范围内:
|
|
||||||
colorMap->rescaleDataRange();
|
|
||||||
|
|
||||||
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->updateWave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|
||||||
{
|
|
||||||
QMyCustomPlot* widget = this;
|
|
||||||
CLogIO *logio = new CLogIO();
|
|
||||||
logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead);
|
|
||||||
//
|
|
||||||
int index = logio->OpenWave(strWaveName.toStdString().c_str());
|
|
||||||
if (index < 0) {
|
|
||||||
delete logio;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float vmax = 264;// (float)_nSamples;
|
|
||||||
float vmin = 0;
|
|
||||||
|
|
||||||
widget->m_iX1 = vmin;
|
|
||||||
widget->m_iX2 = vmax;
|
|
||||||
//
|
|
||||||
widget->xAxis->setRange(vmin, vmax);
|
|
||||||
widget->yAxis->setRange(m_iY1, m_iY2);
|
|
||||||
widget->axisRect()->setupFullAxesBox();
|
|
||||||
//
|
|
||||||
widget->xAxis->setTicks(false);
|
|
||||||
widget->yAxis->setTicks(false);
|
|
||||||
widget->xAxis2->setTicks(false);
|
|
||||||
widget->yAxis2->setTicks(false);
|
|
||||||
|
|
||||||
//注意,不对调XY轴
|
|
||||||
widget->m_bX2Y = false;
|
|
||||||
|
|
||||||
Slf_WAVE _wave;
|
|
||||||
logio->GetWaveInfo(index, &_wave);
|
|
||||||
|
|
||||||
float m_SDep = _wave.StartDepth;
|
|
||||||
float m_EDep = _wave.EndDepth;
|
|
||||||
float m_Rlev = _wave.DepLevel;
|
|
||||||
int m_Record = (float)(fabs((m_EDep - m_SDep) / m_Rlev + 0.5));
|
|
||||||
int _nSamples = _wave.TimeSamples;
|
|
||||||
|
|
||||||
char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1];
|
|
||||||
logio->ReadWave(index, m_SDep, m_Record, (void *)value);
|
|
||||||
logio->CloseWave(index);
|
|
||||||
delete logio;
|
|
||||||
|
|
||||||
MyDataTypeEnum vVdl;
|
|
||||||
int lpoint = 0;
|
|
||||||
int nPoint = _nSamples;
|
|
||||||
float detp = -m_iY2;
|
|
||||||
float edepc = -m_iY1;
|
|
||||||
float m_PlotSdep = -m_iY2;
|
|
||||||
float m_MoveDep = 0.0f;
|
|
||||||
float m_MaxRange = 1023.0f;
|
|
||||||
float m_Base = 0.0f;
|
|
||||||
float DifBase = (m_MaxRange - m_Base) / 1;
|
|
||||||
|
|
||||||
int nStep = 600;// mWaveMes.m_WaveSpace;
|
|
||||||
if (nStep < 1) nStep = 1;
|
|
||||||
float m_r = m_Rlev * nStep;
|
|
||||||
detp = int((detp - m_PlotSdep) / m_r)*m_r + m_PlotSdep;
|
|
||||||
|
|
||||||
int nidx = 0;
|
|
||||||
for (float dep1 = detp - m_r; dep1 < edepc + m_MoveDep + m_r; dep1 += m_r)
|
|
||||||
{
|
|
||||||
if (dep1 >= m_EDep || dep1 + m_r < m_SDep)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iIndex = Slf_Int(dep1 + m_MoveDep, m_SDep, m_Rlev);
|
|
||||||
if (iIndex < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<float> vals;
|
|
||||||
if (iIndex < 0 || iIndex >= m_Record)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
vals.resize(nPoint);
|
|
||||||
vVdl.vchar = &((char *)value)[iIndex*_nSamples*_wave.CodeLen];
|
|
||||||
|
|
||||||
float nmy = 0;
|
|
||||||
for (int i = 0; i < nPoint; i++)
|
|
||||||
{
|
|
||||||
float ch = 0.0f;
|
|
||||||
if (i + lpoint < 0)
|
|
||||||
ch = 0;
|
|
||||||
else if (i + lpoint < _nSamples) {
|
|
||||||
if (_wave.RepCode == REPR_CHAR) {
|
|
||||||
ch = vVdl.vchar[i + lpoint];
|
|
||||||
}
|
|
||||||
else if (_wave.RepCode == REPR_UCHAR) {
|
|
||||||
ch = vVdl.vuchar[i + lpoint];
|
|
||||||
}
|
|
||||||
else if (_wave.RepCode == REPR_SHORT) {
|
|
||||||
ch = vVdl.vshort[i + lpoint];
|
|
||||||
if (ch == -32767) ch = 0;
|
|
||||||
}
|
|
||||||
else if (_wave.RepCode == REPR_USHORT) {
|
|
||||||
ch = vVdl.vushort[i + lpoint];
|
|
||||||
if ((short)ch == -32767) ch = 0;
|
|
||||||
}
|
|
||||||
else if (_wave.RepCode == REPR_FLOAT) {
|
|
||||||
ch = vVdl.vfloat[i + lpoint];
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//ch = GetData(_wave.RepCode, (char *)&vVdl.vchar[(i + lpoint)*_wave.CodeLen]);
|
|
||||||
if (ch == -9999.0 || ch == -99999.0 || ch == -999.25)
|
|
||||||
ch = 0;
|
|
||||||
}
|
|
||||||
else ch = 0;
|
|
||||||
vals[i] = ch;
|
|
||||||
if (ch > nmy)
|
|
||||||
{
|
|
||||||
nmy = ch;
|
|
||||||
}
|
|
||||||
//if (objViewInfo->m_Logarithmic == AXIS_LOGARITHMIC ||
|
|
||||||
// objViewInfo->m_maxRange == -99999) {
|
|
||||||
// if (vmin > ch) vmin = ch;
|
|
||||||
// if (vmax < ch) vmax = ch;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<double> vx;
|
|
||||||
QVector<double> vy;
|
|
||||||
for (int i = 0; i < nPoint; i++)
|
|
||||||
{
|
|
||||||
vx << i;
|
|
||||||
vy << (-dep1 - 1) + vals[i] / nmy;
|
|
||||||
}
|
|
||||||
|
|
||||||
QCPGraph * graph = widget->graph(nidx);
|
|
||||||
if (graph == NULL)
|
|
||||||
{
|
|
||||||
graph = widget->addGraph();
|
|
||||||
//graph->setPen(QPen(clor));
|
|
||||||
}
|
|
||||||
graph->setData(vx, vy);
|
|
||||||
nidx++;
|
|
||||||
}
|
|
||||||
widget->replot();
|
|
||||||
|
|
||||||
delete[]value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QMyCustomPlot::initColorTable()
|
void QMyCustomPlot::initColorTable()
|
||||||
{
|
{
|
||||||
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
this->setSchemeIndex(m_nSchemeIndex, m_nColorNum);
|
||||||
|
|
@ -1238,40 +978,7 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
||||||
{
|
{
|
||||||
QString strProperty = vlist.at(5).toString();
|
QString strProperty = vlist.at(5).toString();
|
||||||
QString strValue = vlist.at(6).toString();
|
QString strValue = vlist.at(6).toString();
|
||||||
if ("类型" == strProperty)
|
if ("方式" == strProperty)
|
||||||
{
|
|
||||||
if (strValue == "0")
|
|
||||||
{
|
|
||||||
if (this->m_colorMap)
|
|
||||||
this->m_colorMap->setVisible(false);
|
|
||||||
for (int i = 0; i < graphCount(); i++)
|
|
||||||
{
|
|
||||||
graph(i)->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->m_bX2Y)
|
|
||||||
{
|
|
||||||
QCPAxis *yAxis = this->yAxis;
|
|
||||||
QCPAxis *xAxis = this->xAxis;
|
|
||||||
this->xAxis = yAxis;
|
|
||||||
this->yAxis = xAxis;
|
|
||||||
this->m_bX2Y = false;
|
|
||||||
}
|
|
||||||
this->initWave2(m_strSlfName, m_strLineName);
|
|
||||||
}
|
|
||||||
else if (strValue == "2")
|
|
||||||
{
|
|
||||||
if (this->m_colorMap)
|
|
||||||
this->m_colorMap->setVisible(true);
|
|
||||||
for (int i = 0; i < graphCount(); i++)
|
|
||||||
{
|
|
||||||
graph(i)->setVisible(false);
|
|
||||||
}
|
|
||||||
this->m_bX2Y = true;
|
|
||||||
this->initWave(m_strSlfName, m_strLineName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ("方式" == strProperty)
|
|
||||||
{
|
{
|
||||||
m_nMode = strValue.toFloat();
|
m_nMode = strValue.toFloat();
|
||||||
this->updateWave();
|
this->updateWave();
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void initWave(QString strSlfName, QString strWaveName);
|
|
||||||
void initWave2(QString strSlfName, QString strWaveName);
|
|
||||||
|
|
||||||
|
|
||||||
void initColorTable();
|
void initColorTable();
|
||||||
void setSchemeIndex(int nidx, int colorNum);
|
void setSchemeIndex(int nidx, int colorNum);
|
||||||
double** getWavedata(int nrow, int ncol);
|
double** getWavedata(int nrow, int ncol);
|
||||||
|
|
@ -77,7 +73,6 @@ public:
|
||||||
int m_nCol = 0;
|
int m_nCol = 0;
|
||||||
// 0.全周 1.正半周 2.负半周
|
// 0.全周 1.正半周 2.负半周
|
||||||
int m_nMode = 1;
|
int m_nMode = 1;
|
||||||
float m_fScaleV = 264.0f;
|
|
||||||
float m_fmin;
|
float m_fmin;
|
||||||
float m_fmax;
|
float m_fmax;
|
||||||
int m_nColorNum = 256;
|
int m_nColorNum = 256;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user