Compare commits

..

No commits in common. "1255631d7fcb1c76b91ff18979f5a744505a7156" and "696ef8b7c3ecf51624def87abe60b2418529d0a2" have entirely different histories.

8 changed files with 237 additions and 253 deletions

View File

@ -55,7 +55,7 @@ QWidget* PropertyWidget::GetPropertyWidget()
}
//初始化,清空
void PropertyWidget::InitCurrentViewInfo(bool bAll)
void PropertyWidget::InitCurrentViewInfo()
{
QList<QtProperty*> propertyList = m_pPropertyBrowser->properties();
m_pPropertyBrowser->clear();
@ -71,21 +71,18 @@ void PropertyWidget::InitCurrentViewInfo(bool bAll)
m_propertyData.clear();
m_mapGroupItem.clear();
if (bAll)
{
m_fromTop = NULL;
m_formInfo = NULL;
m_formHead = NULL;
m_tableWidget = NULL;
m_item = NULL;
m_strUuid = "";
m_strSlfName = "";
m_strWellName = "";
m_strTrackName = "";
m_strLineName = "";
//
m_strCurrentProperty = "";
}
m_fromTop = NULL;
m_formInfo = NULL;
m_formHead = NULL;
m_tableWidget = NULL;
m_item = NULL;
m_strUuid = "";
m_strSlfName = "";
m_strWellName = "";
m_strTrackName = "";
m_strLineName = "";
//
m_strCurrentProperty = "";
}
void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant )
@ -133,8 +130,7 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
bool bDraw = false;
QStringList slist;
slist << "显示名称" << "显示单位" << "曲线名称" << "曲线单位" << "曲线刻度"
<< "类型" << "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "颜色" << "线宽"
<< "波形间隔" << "显示刻度" << "色板" << "变密度颜色级数";
<< "类型" << "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "显示刻度" << "色板" << "变密度颜色级数";
for (int i = 0; i < slist.length(); i++)
{
if (slist.at(i) == m_propertyData[pProperty])
@ -159,12 +155,6 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
listCond << variant;
emit CallManage::getInstance()->sig_changeDrawProperty(listCond);
}
if ("类型" == m_propertyData[pProperty])
{
this->InitCurrentViewInfo(false);
initWaveProperty(m_formInfo, variant.toInt());
}
return;
}
if("深度比例尺" == m_propertyData[pProperty])
@ -1191,7 +1181,7 @@ void PropertyWidget::initProperty(FormInfo *formInfo)
}
else if (formInfo->m_strType == "waveObject")
{
this->initWaveProperty(formInfo, formInfo->m_nDrawType);
this->initWaveProperty(formInfo);
}
}
@ -1225,11 +1215,8 @@ void PropertyWidget::initRoseProperty(FormInfo *formInfo)
// _CreateVariantPropertyItem("玫瑰图", "道头字颜色", fromTop->m_fontColor, QVariant::Color);
}
void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType)
void PropertyWidget::initWaveProperty(FormInfo *formInfo)
{
if (formInfo == NULL)
return;
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strLineName, QVariant::String);
//_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_strUnit, QVariant::Double);
@ -1262,36 +1249,22 @@ void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType)
drawType.append("多臂井径");
_CreateEnumPropertyItem("绘图类型", "类型", formInfo->m_nDrawType, drawType);
if (nType == 2)
{
QStringList fillType;
fillType.append("全周");
fillType.append("正半周");
fillType.append("负半周");
_CreateEnumPropertyItem("填充方式", "方式", formInfo->m_nFillType, fillType);
}
QStringList fillType;
fillType.append("全周");
fillType.append("正半周");
fillType.append("负半周");
_CreateEnumPropertyItem("填充方式", "方式", formInfo->m_nFillType, fillType);
if (nType == 0 || nType == 1)
{
_CreateVariantPropertyItem("波形绘制参数", "绘制波深度", formInfo->m_bDrawDepth, QVariant::Bool);
_CreateVariantPropertyItem("波形绘制参数", "绘制波基线", formInfo->m_bDrawBase, QVariant::Bool);
_CreateVariantPropertyItem("波形绘制参数", "奇偶配色", formInfo->m_bOddEven, QVariant::Bool);
}
//_CreateVariantPropertyItem("波形绘制参数", "自动平滑", true, QVariant::Bool);
_CreateVariantPropertyItem("波形绘制参数", "左刻度", formInfo->m_vmin, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "右刻度", formInfo->m_vmax, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "幅度刻度", formInfo->m_strAmp, QVariant::String);
_CreateVariantPropertyItem("波形绘制参数", "最大振幅", formInfo->m_fMaxAmp, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "显示刻度", formInfo->m_bShowScale, QVariant::Bool);
//_CreateVariantPropertyItem("波形绘制参数", "波列基值", 0, QVariant::Double);
//_CreateVariantPropertyItem("波形绘制参数", "波形间隔", 1, QVariant::Int);
//_CreateVariantPropertyItem("波形绘制参数", "波形高度", 1, QVariant::Double);
if (nType == 0 || nType == 1)
{
_CreateVariantPropertyItem("波形绘制参数", "波列基值", formInfo->m_fWaveBase, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "波形间隔", formInfo->m_nWaveJg, QVariant::Int);
_CreateVariantPropertyItem("波形绘制参数", "波形高度", formInfo->m_fWaveHei, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "线宽", formInfo->m_dWidth, QVariant::Int);
_CreateVariantPropertyItem("波形绘制参数", "颜色", formInfo->m_lineColor, QVariant::Color);
}
//_CreateVariantPropertyItem("成像显示", "RGBA数据", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "绘制阵列数", 1, QVariant::Int);
//_CreateVariantPropertyItem("成像显示", "是否顶底倒置", false, QVariant::Bool);
@ -1301,11 +1274,8 @@ void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType)
//_CreateVariantPropertyItem("成像显示", "是否深度校正", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "是否自动计算波参数", "", QVariant::String);
if (nType == 2)
{
_CreateColorSchemePropertyItem("调色板参数设置", "色板", formInfo->m_nSchemeIndex);
_CreateVariantPropertyItem("调色板参数设置", "变密度颜色级数", formInfo->m_nColorNum, QVariant::Int);
}
_CreateColorSchemePropertyItem("调色板参数设置", "色板", formInfo->m_nSchemeIndex);
_CreateVariantPropertyItem("调色板参数设置", "变密度颜色级数", formInfo->m_nColorNum, QVariant::Int);
// _CreateVariantPropertyItem("调色板参数设置", "图例置顶", false, QVariant::Bool);
// _CreateVariantPropertyItem("调色板参数设置", "反转显示", false, QVariant::Bool);

View File

@ -100,7 +100,7 @@ public:
void _CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue);
void InitCurrentViewInfo(bool bAll = true); //初始化属性,清空
void InitCurrentViewInfo(); //初始化属性,清空
void initWidgetProperty(QString strUuid, int iScale); //可视解释整体属性
//井
void initWellProperty(QString strUuid, QString strSlfName, QString strWellName, double iY1, double iY2);
@ -117,7 +117,7 @@ public:
// 玫瑰图属性
void initRoseProperty(FormInfo *formInfo);
// 波列属性
void initWaveProperty(FormInfo *formInfo, int nType = 3);
void initWaveProperty(FormInfo *formInfo);
void ChangFillProperty();//填充属性改变

View File

@ -715,8 +715,6 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
curv->show();
curv->m_iY1 = m_iY1;
curv->m_iY2 = m_iY2;
int _nSamples = 0;
if(g_iSupport3D)
{
@ -724,10 +722,10 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
}
else
{
curv->initWave(strSlfName, strWaveName);
_nSamples = curv->getScaleV();
initWave(curv, strSlfName, strWaveName, _nSamples);
}
curv->replot();
curv->initColorTable();
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
//
@ -2411,6 +2409,142 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
//AppendConsole(PAI_INFO, "FormDraw initForm end");
}
void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples)
{
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;
// _SDep = 0.0 - m_iY2;
// _EDep = 0.0 - m_iY1;
_Rlev = _wave.DepLevel;
int m_Record=(float)(fabs((_EDep-_SDep)/_Rlev+0.5));
_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:
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实例来分配一些数据
for (int xIndex = 0; xIndex < nx; ++xIndex)
{
for (int yIndex = 0; yIndex < ny; ++yIndex)
{
if (wavedata[yIndex][xIndex] == -9999)
{
colorMap->data()->setCell(nx - xIndex - 1, yIndex, vmin);
continue;
}
//colorMap->data()->setCell(xIndex, yIndex, wavedata[yIndex][xIndex]);
colorMap->data()->setCell(nx - xIndex - 1, yIndex, wavedata[yIndex][xIndex]);
}
}
// 添加色标:
QCPColorScale *colorScale = new QCPColorScale(widget);
colorMap->setColorScale(colorScale); // 将颜色图与色标关联
// 将颜色贴图的“颜色渐变”设置为其中一个预设
//colorMap->setGradient(QCPColorGradient::gpPolar);//gpJet);
// 我们还可以创建一个QCPColorGradient实例并向其中添加自己的颜色
// 渐变请参阅QCPColorGradient的文档以获取可能的效果.
//int nIndex = 11;
//QVector<MyColorItem> colorList;
//bool inpolation = true;
//int iColorNum = getSystemColor(nIndex, colorList, inpolation);
////
//QCPColorGradient gradient;
//for (int i = 0; i < iColorNum; i++)
//{
// double dbTmpIndex = (double)(i + 1) / iColorNum;
// gradient.setColorStopAt(dbTmpIndex, colorList[i].color); // x% 位置的颜色
//}
//colorMap->setGradient(gradient);
// 重新缩放数据维度(颜色),以使所有数据点都位于颜色渐变显示的范围内:
colorMap->rescaleDataRange();
}
void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples)
{
CLogIO *logio=new CLogIO();

View File

@ -103,7 +103,10 @@ public:
void setupSelectionDemo(QMyCustomPlot *customPlot);
//波列
void initWave(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);
//图像-3d成图
int getColorConfig(QVector <QString> &qFiles);

View File

@ -284,59 +284,26 @@ void FormInfo::paintEvent(QPaintEvent* event)
if(m_strType=="waveObject")
{
if (m_nDrawType == 0 || m_nDrawType == 1)
QtColorTableData::getInstance()->SetCurrentSchemeIndex(m_nSchemeIndex);
//ColorTableIndex = ind;
QtColorTableData::getInstance()->ChangeColorNum(m_nColorNum);
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb();
int iColorNum = rgbList.size();
//头部绘制调色板
float scale = (float)(rect.width() - 4) / (float)iColorNum;
QRectF rt7 = QRectF(rect.left() + 2, rect.top() + rect.height() / 3, rect.width() - 4, rect.height() / 3);
for (int i = 0; i < iColorNum; i++)
{
int nbot = rect.bottom()- rect.height() / 3.0;
QVector<QPointF> pts;
int i = 0;
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 15.0));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 12.0));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 9.0));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 6.0));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 3.0));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 9.0));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 15.0));
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot));
pts.append(QPointF(rect.left() + rect.width() / 3.0, nbot));
if (m_nDrawType == 1) {
QPolygonF cRgn;
for (int j = 0; j < pts.size(); j++) {
cRgn.push_back(pts[j]);
}
QPainterPath path;
path.addPolygon(cRgn);
painter.fillPath(path, QBrush(m_lineColor));
}
else
{
painter.drawPolygon(pts);
}
}
else
{
QtColorTableData::getInstance()->SetCurrentSchemeIndex(m_nSchemeIndex);
//ColorTableIndex = ind;
QtColorTableData::getInstance()->ChangeColorNum(m_nColorNum);
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb();
int iColorNum = rgbList.size();
//头部绘制调色板
float scale = (float)(rect.width() - 4) / (float)iColorNum;
QRectF rt7 = QRectF(rect.left() + 2, rect.top() + rect.height() / 3, rect.width() - 4, rect.height() / 3);
for (int i = 0; i < iColorNum; i++)
{
QColor acolor = rgbList.at(i);
float temp = (float)i * scale;
if (i)rt7.setLeft(rect.left() + 2 + temp);
else rt7.setLeft(rect.left() + 2 + temp + 1);
temp = (float)(i + 1) * scale;
rt7.setRight(rect.left() + 2 + temp);
QBrush HeadBrush = QBrush(acolor);
painter.fillRect(rt7, HeadBrush);
}
QColor acolor = rgbList.at(i);
float temp = (float)i * scale;
if (i)rt7.setLeft(rect.left() + 2 + temp);
else rt7.setLeft(rect.left() + 2 + temp + 1);
temp = (float)(i + 1) * scale;
rt7.setRight(rect.left() + 2 + temp);
QBrush HeadBrush = QBrush(acolor);
painter.fillRect(rt7, HeadBrush);
}
}
@ -627,25 +594,6 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val)
{
this->m_bShowScale = val.toBool();
}
else if ("波形间隔" == strProName)
{
bDraw = true;
this->m_nWaveJg = val.toInt();
}
else if ("波形高度" == strProName)
{
bDraw = true;
this->m_fWaveHei = val.toInt();
}
else if ("颜色" == strProName)
{
bDraw = true;
this->m_lineColor = val.value<QColor>();
}
else if ("线宽" == strProName)
{
this->m_dWidth = val.toInt();
}
else if ("色板" == strProName)
{
this->m_nSchemeIndex = val.toInt();

View File

@ -100,19 +100,10 @@ public:
int m_nDrawType; // 绘图类型
int m_nFillType; // 填充类型
bool m_bDrawDepth = false; // 绘制波深度
bool m_bDrawBase = false; // 绘制波基线
bool m_bOddEven = false; // 奇偶配色
QString m_strAmp; // 幅度刻度
float m_fMaxAmp; // 最大振幅
bool m_bShowScale; // 显示刻度
float m_fWaveBase = 0.0f; // 波列基值
int m_nWaveJg = 100; // 波形间隔
float m_fWaveHei = 1; // 波形高度
int m_nColorNum = 256; // 调色板参数设置-变密度颜色级数
int m_nSchemeIndex = 1; // 调色板参数设置-色板

View File

@ -34,7 +34,7 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
setObjectName("QMyCustomPlot");
//this->setOpenGl(true);//不开启,电脑不支持会卡
// this->setNotAntialiasedElements(QCP::aeAll); // 关闭所有抗锯齿
m_newColor = Qt::black;
// 开启抗锯齿
this->setAntialiasedElement(QCP::aeAll);
@ -104,36 +104,6 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList)));
}
void QMyCustomPlot::changePropertyWaveUpdate()
{
if (m_nDrawType == 0 || m_nDrawType == 1)
{
if (this->m_colorMap)
this->m_colorMap->setVisible(false);
clearGraphs();
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 (m_nDrawType == 2)
{
if (this->m_colorMap)
this->m_colorMap->setVisible(true);
clearGraphs();
this->m_bX2Y = true;
this->initWave(m_strSlfName, m_strLineName);
}
}
void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName)
{
CLogIO *logio = new CLogIO();
@ -157,8 +127,7 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName)
int m_Record = (float)(fabs((_EDep - _SDep) / _Rlev + 0.5));
int _nSamples = _wave.TimeSamples;
if (m_fScaleV <= 0.0f)
m_fScaleV = _nSamples;
char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1];
logio->ReadWave(index, _SDep, m_Record, (void *)value);
logio->CloseWave(index);
@ -212,11 +181,6 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName)
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
widget->xAxis->setTicks(false);
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
//对调XY轴在最前面设置
QCPAxis *yAxis = widget->yAxis;
QCPAxis *xAxis = widget->xAxis;
@ -310,10 +274,7 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
float m_Base = 0.0f;
float DifBase = (m_MaxRange - m_Base) / 1;
int nStep = m_nWaveJg;// mWaveMes.m_WaveSpace;
if (m_nWaveJg < 10)
nStep = 10;
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;
@ -362,8 +323,8 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
else if (_wave.RepCode == REPR_FLOAT) {
ch = vVdl.vfloat[i + lpoint];
}
else
ch = GetData(_wave.RepCode, (char *)&vVdl.vchar[(i + lpoint)*_wave.CodeLen]);
//else
//ch = GetData(_wave.RepCode, (char *)&vVdl.vchar[(i + lpoint)*_wave.CodeLen]);
if (ch == -9999.0 || ch == -99999.0 || ch == -999.25)
ch = 0;
}
@ -373,51 +334,29 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
{
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;
double dminy = 0.0;
for (int i = 0; i < nPoint; i++)
{
vx << i;
double d = (-dep1 - 1) + vals[i] / (nmy/ m_nWaveHei);
vy << d;
if (d < dminy)
dminy = d;
vy << (-dep1 - 1) + vals[i] / nmy;
}
QCPGraph * graph0 = widget->graph(nidx);
if (graph0 == NULL)
QCPGraph * graph = widget->graph(nidx);
if (graph == NULL)
{
graph0 = widget->addGraph();
graph0->setPen(QPen(m_newColor));
graph = widget->addGraph();
//graph->setPen(QPen(clor));
}
graph0->setData(vx, vy);
//graph->setBrush(QBrush(QColor(255, 0, 0, 100)));
graph->setData(vx, vy);
nidx++;
if (m_nDrawType == 1)
{
QCPGraph * graph1 = widget->graph(nidx);
if (graph1 == NULL)
{
graph1 = widget->addGraph();
graph1->setPen(QPen(m_newColor));
}
double dx1 = vx[0];
double dx2 = vx[vx.size() - 1];
vx.clear();
vx << dx1 << dx2;
vy.clear();
vy << dminy << dminy;
graph1->setData(vx, vy);
nidx++;
graph0->setBrush(QBrush(m_newColor));
graph0->setChannelFillGraph(graph1);
}
}
widget->replot();
@ -522,11 +461,6 @@ QCPColorMap * QMyCustomPlot::updateWave()
return m_colorMap;
}
float QMyCustomPlot::getScaleV()
{
return m_fScaleV;
}
//蝌蚪图,重绘网格线
void QMyCustomPlot::drawCustomElements()
{
@ -1306,23 +1240,36 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
QString strValue = vlist.at(6).toString();
if ("类型" == strProperty)
{
m_nDrawType = strValue.toInt();
this->changePropertyWaveUpdate();
}
else if ("波形间隔" == strProperty)
{
m_nWaveJg = strValue.toInt();
this->changePropertyWaveUpdate();
}
else if ("波形高度" == strProperty)
{
m_nWaveHei = strValue.toInt();
this->changePropertyWaveUpdate();
}
else if ("颜色" == strProperty)
{
m_newColor = vlist.at(6).value<QColor>();
this->changePropertyWaveUpdate();
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)
{
@ -1337,8 +1284,7 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
{
if (m_colorMap)
{
m_fScaleV = strValue.toFloat();
float f = 264 / m_fScaleV;
float f = 264 / strValue.toFloat();
m_colorMap->data()->setValueRange(QCPRange(m_fmin, m_fmax*f));
}
}

View File

@ -21,10 +21,7 @@ public:
{
}
void changePropertyWaveUpdate();
// 绘图类型-变密度(成像)
void initWave(QString strSlfName, QString strWaveName);
// 绘图类型-波形
void initWave2(QString strSlfName, QString strWaveName);
@ -32,8 +29,6 @@ public:
void setSchemeIndex(int nidx, int colorNum);
double** getWavedata(int nrow, int ncol);
QCPColorMap * updateWave();
float getScaleV();
protected:
//virtual void mouseMoveEvent(QMouseEvent *event);
@ -80,16 +75,13 @@ public:
double** m_wavedata = NULL;
int m_nRow = 0;
int m_nCol = 0;
int m_nDrawType = 3; // 绘图类型
// 0.全周 1.正半周 2.负半周
int m_nMode = 1;
float m_fScaleV = 0.0f;
float m_fScaleV = 264.0f;
float m_fmin;
float m_fmax;
int m_nColorNum = 256;
int m_nSchemeIndex = 1;
int m_nWaveJg = 100;
int m_nWaveHei = 1;
public:
//分段刷新
QVector<double> m_x;