modified chart
This commit is contained in:
parent
387792620a
commit
e6b2472203
@ -515,12 +515,12 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="820"/>
|
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="968"/>
|
||||||
<source>2D Curve</source>
|
<source>2D Curve</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="831"/>
|
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="979"/>
|
||||||
<source>2D(y(lg)) Curve</source>
|
<source>2D(y(lg)) Curve</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -724,11 +724,6 @@
|
|||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ModelTreeWidget</name>
|
<name>ModelTreeWidget</name>
|
||||||
<message>
|
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="254"/>
|
|
||||||
<source>Release Track</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="107"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="107"/>
|
||||||
<source>Add boke Entity</source>
|
<source>Add boke Entity</source>
|
||||||
@ -759,6 +754,11 @@
|
|||||||
<source>Add satellite Entity</source>
|
<source>Add satellite Entity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="254"/>
|
||||||
|
<source>Release Track</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="262"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="262"/>
|
||||||
<source>Track</source>
|
<source>Track</source>
|
||||||
@ -1864,7 +1864,7 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/Table/targetlistwgt.cpp" line="127"/>
|
<location filename="../ui/Table/targetlistwgt.cpp" line="132"/>
|
||||||
<source>%1 -- %2</source>
|
<source>%1 -- %2</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1989,13 +1989,18 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="106"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="108"/>
|
||||||
<source>save spaceWork directory</source>
|
<source>save spaceWork directory</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="119"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="122"/>
|
||||||
<source>select commond file directory</source>
|
<source>select command xml file</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="124"/>
|
||||||
|
<source>XML files (*.xml);;All files (*.*)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "SignalIndicatorLampUI.h"
|
#include "SignalIndicatorLampUI.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
@ -37,215 +37,130 @@ void SignalIndicatorLampUI::AttachDock(DockWidget* dockWidget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != dockWidget) {
|
|
||||||
m_titleText = dockWidget->windowTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
dockWidget->SetDockWidgetTitleBar(nullptr);
|
dockWidget->SetDockWidgetTitleBar(nullptr);
|
||||||
dockWidget->setWidget(this);
|
dockWidget->setWidget(this);
|
||||||
|
|
||||||
DockTitleBar* dockTitleBar = new DockTitleBar;
|
DockTitleBar* dockTitleBar = new DockTitleBar;
|
||||||
m_pDockTitleBar = dockTitleBar;
|
m_pDockTitleBar = dockTitleBar;
|
||||||
|
|
||||||
if (m_titleText.isEmpty()) {
|
|
||||||
dockTitleBar->SetTitle(tr("Signal Indicator Lamp"));
|
|
||||||
} else {
|
|
||||||
dockTitleBar->SetTitle(m_titleText);
|
|
||||||
}
|
|
||||||
|
|
||||||
dockWidget->SetDockWidgetTitleBar(dockTitleBar);
|
dockWidget->SetDockWidgetTitleBar(dockTitleBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalIndicatorLampUI::InitIndicatorLamp(QStringList& lamps, LayoutType type, int nColCount)
|
void SignalIndicatorLampUI::updateTitle(const QString & title)
|
||||||
{
|
{
|
||||||
QGridLayout* pMainLyt = new QGridLayout(this);
|
if (nullptr != m_pDockTitleBar)
|
||||||
|
|
||||||
int nColIndex = 0;
|
|
||||||
int nRowIndex = 0;
|
|
||||||
|
|
||||||
for (auto i = 0; i < lamps.size(); ++i)
|
|
||||||
{
|
{
|
||||||
SignalLabel* pLampLab = new SignalLabel;
|
m_pDockTitleBar->SetTitle(title);
|
||||||
pLampLab->setFixedSize(24, 24);
|
|
||||||
pLampLab->setStyleSheet("QLabel{background-color: rgb(255, 0, 0);border-radius: 10px;}; ");
|
|
||||||
m_listLampPtr.push_back(pLampLab);
|
|
||||||
|
|
||||||
QLabel* pTextLab = new QLabel;
|
|
||||||
pTextLab->setText(lamps[i]);
|
|
||||||
|
|
||||||
QHBoxLayout* pLyt = new QHBoxLayout;
|
|
||||||
pLyt->addWidget(pLampLab);
|
|
||||||
pLyt->addWidget(pTextLab);
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case SignalIndicatorLampUI::HLyt:
|
|
||||||
{
|
|
||||||
pMainLyt->addLayout(pLyt, 0, i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SignalIndicatorLampUI::VLyt:
|
|
||||||
{
|
|
||||||
pMainLyt->addLayout(pLyt, i, 0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SignalIndicatorLampUI::GLyt:
|
|
||||||
{
|
|
||||||
pMainLyt->addLayout(pLyt, nRowIndex, nColIndex);
|
|
||||||
nColIndex++;
|
|
||||||
|
|
||||||
if (nColIndex >= nColCount)
|
|
||||||
{
|
|
||||||
nRowIndex++;
|
|
||||||
nColIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalIndicatorLampUI::SetLampState(std::vector<int> vecStatus)
|
void SignalIndicatorLampUI::updateParseFile(const QString & strFile, int nT, QVariantList listCurve)
|
||||||
{
|
{
|
||||||
int nIndexCount = 0;
|
if (strFile.isEmpty())
|
||||||
if (m_listLampPtr.size() >= vecStatus.size())
|
|
||||||
{
|
|
||||||
nIndexCount = vecStatus.size();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nIndexCount = m_listLampPtr.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto i = 0; i < nIndexCount; ++i)
|
|
||||||
{
|
|
||||||
QLabel* pLampLab = m_listLampPtr[i];
|
|
||||||
if (1 == vecStatus[i])
|
|
||||||
{
|
|
||||||
pLampLab->setStyleSheet("QLabel{background-color: rgb(0, 255, 0);border-radius: 10px;}; ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pLampLab->setStyleSheet("QLabel{background-color: rgb(255, 0, 0);border-radius: 10px;}; ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SignalIndicatorLampUI::UpdateIndicatorLamp(QStringList& lamps, LayoutType type, int nColCount)
|
|
||||||
{
|
|
||||||
QGridLayout* pMainLyt = (QGridLayout*)this->layout();
|
|
||||||
if (pMainLyt)
|
|
||||||
{
|
|
||||||
QList<QObject*> listChild = pMainLyt->children();
|
|
||||||
for (size_t i = 0; i < listChild.size(); i++)
|
|
||||||
{
|
|
||||||
pMainLyt->removeWidget((QWidget*)listChild[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int nColIndex = 0;
|
|
||||||
int nRowIndex = 0;
|
|
||||||
|
|
||||||
for (auto i = 0; i < lamps.size(); ++i)
|
|
||||||
{
|
|
||||||
SignalLabel* pLampLab = new SignalLabel;
|
|
||||||
pLampLab->setFixedSize(24, 24);
|
|
||||||
pLampLab->setStyleSheet("QLabel{background-color: rgb(255, 0, 0);border-radius: 10px;}; ");
|
|
||||||
m_listLampPtr.push_back(pLampLab);
|
|
||||||
|
|
||||||
QLabel* pTextLab = new QLabel;
|
|
||||||
pTextLab->setText(lamps[i]);
|
|
||||||
|
|
||||||
QHBoxLayout* pLyt = new QHBoxLayout;
|
|
||||||
pLyt->addWidget(pLampLab);
|
|
||||||
pLyt->addWidget(pTextLab);
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case SignalIndicatorLampUI::HLyt:
|
|
||||||
{
|
|
||||||
pMainLyt->addLayout(pLyt, 0, i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SignalIndicatorLampUI::VLyt:
|
|
||||||
{
|
|
||||||
pMainLyt->addLayout(pLyt, i, 0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SignalIndicatorLampUI::GLyt:
|
|
||||||
{
|
|
||||||
pMainLyt->addLayout(pLyt, nRowIndex, nColIndex);
|
|
||||||
nColIndex++;
|
|
||||||
|
|
||||||
if (nColIndex >= nColCount)
|
|
||||||
{
|
|
||||||
nRowIndex++;
|
|
||||||
nColIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SignalIndicatorLampUI::InitLamp(const QString& strFile)
|
|
||||||
{
|
|
||||||
bool bRet = ParseLamp(strFile);
|
|
||||||
if (nullptr != m_pDockTitleBar && bRet) {
|
|
||||||
QFileInfo fileInfo(strFile);
|
|
||||||
m_pDockTitleBar->SetTitle(tr("%1 -- %2").arg(m_titleText).arg(fileInfo.fileName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList listLamp;
|
|
||||||
for (size_t i = 0; i < m_iLampCount; i++)
|
|
||||||
{
|
|
||||||
listLamp <<tr("light") + QString::number(i+1); // ָʾ<D6B8><CABE>
|
|
||||||
}
|
|
||||||
|
|
||||||
InitIndicatorLamp(listLamp, SignalIndicatorLampUI::HLyt, listLamp.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SignalIndicatorLampUI::slotUpdateTime(double dTime)
|
|
||||||
{
|
|
||||||
if (dTime < 1)
|
|
||||||
{
|
{
|
||||||
|
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据文件路径!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dTime - 1) >= m_lampStatus.size())
|
QFile file(strFile);
|
||||||
|
if (file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
return;
|
QGridLayout* pMainLyt = new QGridLayout(this);
|
||||||
|
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||||
|
{
|
||||||
|
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||||
|
QString strName = mapCurve.value("Name").toString();
|
||||||
|
QStringList lamps = strName.split(",");
|
||||||
|
|
||||||
|
for (auto i = 0; i < lamps.size(); ++i)
|
||||||
|
{
|
||||||
|
SignalLabel* pLampLab = new SignalLabel;
|
||||||
|
pLampLab->setFixedSize(24, 24);
|
||||||
|
|
||||||
|
QString strStyle = m_lampColor.value(0);
|
||||||
|
pLampLab->setStyleSheet(strStyle);
|
||||||
|
|
||||||
|
QLabel* pTextLab = new QLabel;
|
||||||
|
pTextLab->setText(lamps[i]);
|
||||||
|
|
||||||
|
QHBoxLayout* pLyt = new QHBoxLayout;
|
||||||
|
pLyt->addWidget(pLampLab);
|
||||||
|
pLyt->addWidget(pTextLab);
|
||||||
|
|
||||||
|
pMainLyt->addLayout(pLyt, nI, i);
|
||||||
|
|
||||||
|
QString strKey = QString::number(nI) + "-" + QString::number(i);
|
||||||
|
m_mapLamp.insert(strKey, pLampLab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!file.atEnd())
|
||||||
|
{
|
||||||
|
QString strLine = file.readLine().simplified();
|
||||||
|
if (!strLine.isEmpty())
|
||||||
|
{
|
||||||
|
QStringList listLine = strLine.split(" ");
|
||||||
|
double t = listLine.at(nT).toDouble();
|
||||||
|
|
||||||
|
QVariantMap mapData;
|
||||||
|
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||||
|
{
|
||||||
|
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||||
|
QString strData = mapCurve.value("Data").toString();
|
||||||
|
QStringList lamps = strData.split(",");
|
||||||
|
|
||||||
|
for (int nJ = 0; nJ < lamps.size(); ++nJ)
|
||||||
|
{
|
||||||
|
int nIndex = lamps.at(nJ).toInt();
|
||||||
|
QString nState = listLine.at(nIndex);
|
||||||
|
QString strKey = QString::number(nI) + "-" + QString::number(nJ);
|
||||||
|
mapData.insert(strKey, nState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_dataLamp.insert(t, mapData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> vecStatus;
|
|
||||||
for (size_t i = 0; i < m_iLampCount; i++)
|
|
||||||
{
|
|
||||||
vecStatus.push_back(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int iStatus = m_lampStatus[dTime - 1];
|
|
||||||
vecStatus[iStatus-1] = 1;
|
|
||||||
|
|
||||||
SetLampState(vecStatus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalIndicatorLampUI::onStatusChanged(int status) {
|
void SignalIndicatorLampUI::updateLampColor(const QString & strOpenColor, const QString & strCloseColor)
|
||||||
if ((status) >= m_lampStatus.size()) {
|
{
|
||||||
return;
|
{
|
||||||
}
|
QString strStyle = "QLabel{background-color: rgb(" + strCloseColor + ");border-radius: 10px;}; ";
|
||||||
|
m_lampColor.insert(0, strStyle);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
QString strStyle = "QLabel{background-color: rgb(" + strOpenColor + ");border-radius: 10px;}; ";
|
||||||
|
m_lampColor.insert(1, strStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> vecStatus;
|
void SignalIndicatorLampUI::slotUpdateTime(double t)
|
||||||
for (size_t i = 0; i < m_iLampCount; i++) {
|
{
|
||||||
vecStatus.push_back(0);
|
if (m_dataLamp.size() > 0)
|
||||||
}
|
{
|
||||||
|
QMap< double, QVariantMap >::const_iterator ite = m_dataLamp.lowerBound(t);
|
||||||
|
if (ite == m_dataLamp.end())
|
||||||
|
{
|
||||||
|
ite--;
|
||||||
|
}
|
||||||
|
|
||||||
vecStatus[status - 1] = 1;
|
QVariantMap mapData = ite.value();
|
||||||
|
for (QVariantMap::Iterator it = mapData.begin(); it != mapData.end(); it++)
|
||||||
|
{
|
||||||
|
QString strKey = it.key();
|
||||||
|
int nState = it.value().toFloat();
|
||||||
|
|
||||||
SetLampState(vecStatus);
|
SignalLabel* pLampLab = m_mapLamp.value(strKey);
|
||||||
|
if (pLampLab)
|
||||||
|
{
|
||||||
|
QString strStyle = m_lampColor.value(nState);
|
||||||
|
pLampLab->setStyleSheet(strStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalIndicatorLampUI::OnWorkSpaceChanged(WorkSpace* worksapce) {
|
void SignalIndicatorLampUI::OnWorkSpaceChanged(WorkSpace* worksapce) {
|
||||||
@ -255,12 +170,6 @@ void SignalIndicatorLampUI::OnWorkSpaceChanged(WorkSpace* worksapce) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(worksapce, &WorkSpace::TimestepChanged, this, &SignalIndicatorLampUI::OnTimestepChanged);
|
connect(worksapce, &WorkSpace::TimestepChanged, this, &SignalIndicatorLampUI::OnTimestepChanged);
|
||||||
auto lamp = worksapce->GetLampStatus();
|
|
||||||
if (nullptr != lamp) {
|
|
||||||
InitLamp(lamp->GetPath());
|
|
||||||
}
|
|
||||||
// Initialize the lamp with the current workspace's lamp file
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalIndicatorLampUI::OnTimestepChanged(Timestep* timestep) {
|
void SignalIndicatorLampUI::OnTimestepChanged(Timestep* timestep) {
|
||||||
@ -283,37 +192,3 @@ void SignalIndicatorLampUI::paintEvent(QPaintEvent* event)
|
|||||||
|
|
||||||
painter.drawRect(QRect(5,5,rect().width() - 10, rect().height() - 10));
|
painter.drawRect(QRect(5,5,rect().width() - 10, rect().height() - 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SignalIndicatorLampUI::ParseLamp(const QString& strFile)
|
|
||||||
{
|
|
||||||
if (strFile.isEmpty())
|
|
||||||
{
|
|
||||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Lamp<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_lampStatus.clear();
|
|
||||||
|
|
||||||
QFile file(strFile);
|
|
||||||
if (file.open(QIODevice::ReadOnly))
|
|
||||||
{
|
|
||||||
while (!file.atEnd())
|
|
||||||
{
|
|
||||||
QString strLine = file.readLine().simplified();
|
|
||||||
if (!strLine.isEmpty())
|
|
||||||
{
|
|
||||||
int iLamp = (int)strLine.toDouble();
|
|
||||||
m_lampStatus.push_back(iLamp);
|
|
||||||
|
|
||||||
if (m_iLampCount < iLamp)
|
|
||||||
{
|
|
||||||
m_iLampCount = iLamp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -13,45 +13,29 @@ class SignalIndicatorLampUI : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum LayoutType // <20>źŵƲ<C5B5><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
{
|
|
||||||
HLyt, // ˮƽ
|
|
||||||
VLyt, // <20><>ֱ
|
|
||||||
GLyt, // <20><><EFBFBD><EFBFBD>
|
|
||||||
};
|
|
||||||
|
|
||||||
SignalIndicatorLampUI( QWidget *parent = Q_NULLPTR);
|
SignalIndicatorLampUI( QWidget *parent = Q_NULLPTR);
|
||||||
~SignalIndicatorLampUI();
|
~SignalIndicatorLampUI();
|
||||||
|
|
||||||
void AttachDock(class DockWidget* dockWidget);
|
void AttachDock(class DockWidget* dockWidget);
|
||||||
|
|
||||||
void InitIndicatorLamp(QStringList &lamps, LayoutType type, int nColCount = 4);
|
void updateTitle(const QString& title);
|
||||||
|
void updateParseFile(const QString& strFile, int nT, QVariantList listCurve);
|
||||||
void SetLampState(std::vector<int> vecStatus);
|
void updateLampColor(const QString& strOpenColor, const QString& strCloseColor);
|
||||||
|
|
||||||
void UpdateIndicatorLamp(QStringList& lamps, LayoutType type, int nColCount = 4);
|
|
||||||
|
|
||||||
void InitLamp(const QString& strFile);
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void slotUpdateTime(double dTime);
|
void slotUpdateTime(double t);
|
||||||
void onStatusChanged(int status);
|
|
||||||
void OnWorkSpaceChanged(class WorkSpace*);
|
void OnWorkSpaceChanged(class WorkSpace*);
|
||||||
void OnTimestepChanged(class Timestep*);
|
void OnTimestepChanged(class Timestep*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent* event);
|
void paintEvent(QPaintEvent* event);
|
||||||
|
|
||||||
bool ParseLamp(const QString& strFile);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SignalIndicatorLampUI ui;
|
Ui::SignalIndicatorLampUI ui;
|
||||||
|
|
||||||
QList<SignalLabel*> m_listLampPtr;
|
|
||||||
|
|
||||||
QList<int> m_lampStatus;
|
|
||||||
int m_iLampCount = 0;
|
|
||||||
|
|
||||||
QString m_titleText;
|
|
||||||
class DockTitleBar* m_pDockTitleBar { nullptr };
|
class DockTitleBar* m_pDockTitleBar { nullptr };
|
||||||
|
|
||||||
|
QMap<int, QString> m_lampColor;
|
||||||
|
QMap<QString, SignalLabel*> m_mapLamp;
|
||||||
|
QMap< double, QVariantMap > m_dataLamp;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -116,24 +116,24 @@ void MainWindow::InitUI() {
|
|||||||
DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
|
DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
|
||||||
fitCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitCurveDock));
|
fitCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitCurveDock));
|
||||||
fitCurveDock->setObjectName("Dock.WaveCurveDialog");
|
fitCurveDock->setObjectName("Dock.WaveCurveDialog");
|
||||||
fitCurveDlg_ = new FitCurveDialog(1);
|
fitCurveDlg_ = new FitCurveDialog();
|
||||||
fitCurveDlg_->AttachDock(fitCurveDock);
|
fitCurveDlg_->AttachDock(fitCurveDock);
|
||||||
m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
|
m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, fitCurveDock);
|
addDockWidget(Qt::BottomDockWidgetArea, fitCurveDock);
|
||||||
|
|
||||||
fitCurveDlg_->InitWaveFile(wavePath);
|
//fitCurveDlg_->InitWaveFile(wavePath);
|
||||||
DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
|
DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
|
||||||
fitLgCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitLgCurveDock));
|
fitLgCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitLgCurveDock));
|
||||||
fitLgCurveDock->setObjectName("Dock.SpeedCurveDialog");
|
fitLgCurveDock->setObjectName("Dock.SpeedCurveDialog");
|
||||||
|
|
||||||
fitYLgCurveDlg_ = new FitCurveDialog(1);
|
fitYLgCurveDlg_ = new FitCurveDialog();
|
||||||
fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
|
fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
|
||||||
m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
|
m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, fitLgCurveDock);
|
addDockWidget(Qt::BottomDockWidgetArea, fitLgCurveDock);
|
||||||
tabifyDockWidget(fitCurveDock, fitLgCurveDock);
|
tabifyDockWidget(fitCurveDock, fitLgCurveDock);
|
||||||
|
|
||||||
|
|
||||||
fitYLgCurveDlg_->InitReportFile(speedPath);
|
//fitYLgCurveDlg_->InitReportFile(speedPath);
|
||||||
|
|
||||||
DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
|
DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
|
||||||
surfaceCurveDock->SetDockWidgetTitleBar(new DockTitleBar(surfaceCurveDock));
|
surfaceCurveDock->SetDockWidgetTitleBar(new DockTitleBar(surfaceCurveDock));
|
||||||
@ -145,7 +145,7 @@ void MainWindow::InitUI() {
|
|||||||
addDockWidget(Qt::BottomDockWidgetArea, surfaceCurveDock);
|
addDockWidget(Qt::BottomDockWidgetArea, surfaceCurveDock);
|
||||||
tabifyDockWidget(fitCurveDock, surfaceCurveDock);
|
tabifyDockWidget(fitCurveDock, surfaceCurveDock);
|
||||||
|
|
||||||
surfaceDlg_->InitRD(rdPath);
|
//surfaceDlg_->InitRD(rdPath);
|
||||||
|
|
||||||
{
|
{
|
||||||
targetUITable_ = new TargetListWgt;
|
targetUITable_ = new TargetListWgt;
|
||||||
@ -162,7 +162,7 @@ void MainWindow::InitUI() {
|
|||||||
|
|
||||||
targetUITable_->SetHeader(headerLabels);
|
targetUITable_->SetHeader(headerLabels);
|
||||||
//const QString reportPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt";
|
//const QString reportPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt";
|
||||||
targetUITable_->InitFile(speedPath, 50);
|
//targetUITable_->InitFile(speedPath, 50);
|
||||||
|
|
||||||
DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
|
DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
|
||||||
dataTableDock->SetDockWidgetTitleBar(new DockTitleBar(dataTableDock));
|
dataTableDock->SetDockWidgetTitleBar(new DockTitleBar(dataTableDock));
|
||||||
@ -182,7 +182,7 @@ void MainWindow::InitUI() {
|
|||||||
signalIndicatorLampDock->setObjectName("Dock.SignalIndicatorLampUI");
|
signalIndicatorLampDock->setObjectName("Dock.SignalIndicatorLampUI");
|
||||||
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
|
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
|
||||||
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
|
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
|
||||||
signalIndicatorLampUI_->InitLamp(lampPath);
|
//signalIndicatorLampUI_->InitLamp(lampPath);
|
||||||
|
|
||||||
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, signalIndicatorLampDock);
|
addDockWidget(Qt::BottomDockWidgetArea, signalIndicatorLampDock);
|
||||||
@ -214,6 +214,8 @@ void MainWindow::InitUI() {
|
|||||||
// Restore previous UI layout if available
|
// Restore previous UI layout if available
|
||||||
UiLayoutManager::Restore(this, 1);
|
UiLayoutManager::Restore(this, 1);
|
||||||
|
|
||||||
|
InitChartLayout();
|
||||||
|
|
||||||
//ui->viewWidget->layout()->addWidget(qtOsgViewWidget_);
|
//ui->viewWidget->layout()->addWidget(qtOsgViewWidget_);
|
||||||
qtOsgViewWidget_->LoadDefaultScene();
|
qtOsgViewWidget_->LoadDefaultScene();
|
||||||
/*OsgViewer::Get().Initialize();
|
/*OsgViewer::Get().Initialize();
|
||||||
@ -256,8 +258,149 @@ void MainWindow::slotResetWorkSpace()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fitCurveDlg_->InitWaveFile(wavePath);
|
//fitCurveDlg_->InitWaveFile(wavePath);
|
||||||
fitYLgCurveDlg_->InitReportFile(speedPath);
|
//fitYLgCurveDlg_->InitReportFile(speedPath);
|
||||||
surfaceDlg_->InitRD(rdPath);
|
//surfaceDlg_->InitRD(rdPath);
|
||||||
targetUITable_->InitFile(speedPath, 50);
|
//targetUITable_->InitFile(speedPath, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::InitChartLayout()
|
||||||
|
{
|
||||||
|
QString strChart = RecourceHelper::Get().GetBasePath() + "/workspace/Chart.xml";
|
||||||
|
m_mgrChart.Load(strChart);
|
||||||
|
|
||||||
|
QVariantList varList = m_mgrChart.GetChartWgt();
|
||||||
|
for (int nI = 0; nI < varList.size(); nI++)
|
||||||
|
{
|
||||||
|
QVariantMap mapWgt = varList.at(nI).toMap();
|
||||||
|
QString strWgt = mapWgt.value("Name").toString();
|
||||||
|
QVariantList listChart = mapWgt.value("Chart").toList();
|
||||||
|
|
||||||
|
QMainWindow* mainWindow_ = new QMainWindow;
|
||||||
|
//connect(mainWindow_, &QMainWindow::tabifiedDockWidgetActivated, this, &MainWindow::OnTabifiedDockWidgetActivated);
|
||||||
|
|
||||||
|
DockWidget* wgtDock = new DockWidget(strWgt, 0);
|
||||||
|
wgtDock->SetDockWidgetTitleBar(new DockTitleBar(wgtDock));
|
||||||
|
wgtDock->setWidget(mainWindow_);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, wgtDock);
|
||||||
|
|
||||||
|
for (int nJ = 0; nJ < listChart.size(); nJ++)
|
||||||
|
{
|
||||||
|
QVariantMap mapChart = listChart.at(nJ).toMap();
|
||||||
|
InitChart(mapChart, mainWindow_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QDockWidget *MainWindow::InitChart(QVariantMap mapChart, QMainWindow* mainWindow)
|
||||||
|
{
|
||||||
|
QString strName = mapChart.value("Name").toString();
|
||||||
|
QString strType = mapChart.value("Type").toString();
|
||||||
|
QString after = mapChart.value("after").toString();
|
||||||
|
QString orientation = mapChart.value("orientation").toString();
|
||||||
|
int nT = mapChart.value("t").toInt();
|
||||||
|
QString strFile = mapChart.value("File").toString();
|
||||||
|
|
||||||
|
DockWidget* pDock = new DockWidget(strName, 0);
|
||||||
|
|
||||||
|
if (strType == "Wave" || strType == "Report")
|
||||||
|
{
|
||||||
|
QString xTitle = mapChart.value("xTitle").toString();
|
||||||
|
QString yTitle = mapChart.value("yTitle").toString();
|
||||||
|
float xMin = mapChart.value("xMin").toFloat();
|
||||||
|
float xMax = mapChart.value("xMax").toFloat();
|
||||||
|
int xCount = mapChart.value("xCount").toInt();
|
||||||
|
float yMin = mapChart.value("yMin").toFloat();
|
||||||
|
float yMax = mapChart.value("yMax").toFloat();
|
||||||
|
int yCount = mapChart.value("yCount").toInt();
|
||||||
|
QVariantList listCurve = mapChart.value("Curve").toList();
|
||||||
|
|
||||||
|
FitCurveDialog *fitCurveDlg = new FitCurveDialog();
|
||||||
|
fitCurveDlg->AttachDock(pDock);
|
||||||
|
fitCurveDlg->updateTitle(strName + "-" + strFile);
|
||||||
|
fitCurveDlg->updateTitleAxis(xTitle, yTitle);
|
||||||
|
fitCurveDlg->updateMinMaxX(xMin, xMax, xCount);
|
||||||
|
fitCurveDlg->updateMinMaxY(yMin, yMax, yCount);
|
||||||
|
|
||||||
|
if (strType == "Wave")
|
||||||
|
{
|
||||||
|
fitCurveDlg->updateParseWaveFile(strFile, nT, listCurve);
|
||||||
|
}
|
||||||
|
else if (strType == "Report")
|
||||||
|
{
|
||||||
|
fitCurveDlg->updateParseReportFile(strFile, nT, listCurve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strType == "Table")
|
||||||
|
{
|
||||||
|
QString head = mapChart.value("head").toString();
|
||||||
|
QVariantList listCurve = mapChart.value("Curve").toList();
|
||||||
|
|
||||||
|
TargetListWgt *targetUITable = new TargetListWgt;
|
||||||
|
targetUITable->AttachDock(pDock);
|
||||||
|
targetUITable->SetHead(head);
|
||||||
|
targetUITable->updateTitle(strName + "-" + strFile);
|
||||||
|
targetUITable->updateParseFile(strFile, nT, listCurve);
|
||||||
|
}
|
||||||
|
else if (strType == "Lamp")
|
||||||
|
{
|
||||||
|
QString openColor = mapChart.value("openColor").toString();
|
||||||
|
QString closeColor = mapChart.value("closeColor").toString();
|
||||||
|
QVariantList listCurve = mapChart.value("Curve").toList();
|
||||||
|
|
||||||
|
SignalIndicatorLampUI *signalIndicatorLamp = new SignalIndicatorLampUI;
|
||||||
|
signalIndicatorLamp->AttachDock(pDock);
|
||||||
|
signalIndicatorLamp->updateTitle(strName + "-" + strFile);
|
||||||
|
signalIndicatorLamp->updateLampColor(openColor, closeColor);
|
||||||
|
signalIndicatorLamp->updateParseFile(strFile, nT, listCurve);
|
||||||
|
}
|
||||||
|
else if (strType == "Surface")
|
||||||
|
{
|
||||||
|
QString xTitle = mapChart.value("xTitle").toString();
|
||||||
|
QString yTitle = mapChart.value("yTitle").toString();
|
||||||
|
QString zTitle = mapChart.value("zTitle").toString();
|
||||||
|
float xMin = mapChart.value("xMin").toFloat();
|
||||||
|
float xMax = mapChart.value("xMax").toFloat();
|
||||||
|
int xCount = mapChart.value("xCount").toInt();
|
||||||
|
float yMin = mapChart.value("yMin").toFloat();
|
||||||
|
float yMax = mapChart.value("yMax").toFloat();
|
||||||
|
int yCount = mapChart.value("yCount").toInt();
|
||||||
|
float zMin = mapChart.value("zMin").toFloat();
|
||||||
|
float zMax = mapChart.value("zMax").toFloat();
|
||||||
|
int zCount = mapChart.value("zCount").toInt();
|
||||||
|
QVariantList listCurve = mapChart.value("Curve").toList();
|
||||||
|
|
||||||
|
SurfaceDialog *surfaceDlg = new SurfaceDialog();
|
||||||
|
surfaceDlg->AttachDock(pDock);
|
||||||
|
surfaceDlg->updateTitle(strName + "-" + strFile);
|
||||||
|
surfaceDlg->updateTitleAxis(xTitle, yTitle, zTitle);
|
||||||
|
surfaceDlg->updateMinMaxX(xMin, xMax, xCount);
|
||||||
|
surfaceDlg->updateMinMaxY(yMin, yMax, yCount);
|
||||||
|
surfaceDlg->updateMinMaxZ(zMin, zMax, zCount);
|
||||||
|
surfaceDlg->updateParseFile(strFile, nT, listCurve);
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWindow->addDockWidget(Qt::LeftDockWidgetArea, pDock);
|
||||||
|
|
||||||
|
QDockWidget* afterDock = m_mapChartWidget.value(after);
|
||||||
|
if (afterDock)
|
||||||
|
{
|
||||||
|
if (orientation == QString("Horizontal"))
|
||||||
|
{
|
||||||
|
mainWindow->splitDockWidget(afterDock, pDock, Qt::Horizontal);
|
||||||
|
}
|
||||||
|
else if (orientation == QString("Vertical"))
|
||||||
|
{
|
||||||
|
mainWindow->splitDockWidget(afterDock, pDock, Qt::Vertical);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mapChartWidget.insert(strName, pDock);
|
||||||
|
|
||||||
|
return pDock;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDockWidget * MainWindow::InitCurveChart(QVariantMap mapChart, QMainWindow * mainWindow)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,10 @@ private:
|
|||||||
void InitUI();
|
void InitUI();
|
||||||
void UninitUI();
|
void UninitUI();
|
||||||
|
|
||||||
|
void InitChartLayout();
|
||||||
|
QDockWidget *InitChart(QVariantMap mapChart, QMainWindow* mainWindow);
|
||||||
|
QDockWidget *InitCurveChart(QVariantMap mapChart, QMainWindow* mainWindow);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
|
|
||||||
@ -67,4 +71,6 @@ private:
|
|||||||
QMap<QString, QDockWidget*> m_mapDockWidget;
|
QMap<QString, QDockWidget*> m_mapDockWidget;
|
||||||
|
|
||||||
ChartXMLMgr m_mgrChart;
|
ChartXMLMgr m_mgrChart;
|
||||||
|
|
||||||
|
QMap<QString, QDockWidget*> m_mapChartWidget;
|
||||||
};
|
};
|
||||||
@ -27,10 +27,6 @@ TargetListWgt::TargetListWgt(QWidget * parent) : QWidget(parent) {
|
|||||||
setWindowTitle(QString::fromLocal8Bit("数据列表"));
|
setWindowTitle(QString::fromLocal8Bit("数据列表"));
|
||||||
setWindowFlags(/*Qt::FramelessWindowHint | */Qt::Window);
|
setWindowFlags(/*Qt::FramelessWindowHint | */Qt::Window);
|
||||||
|
|
||||||
m_nCurTabPage = 0;
|
|
||||||
|
|
||||||
m_nBoundaryWth = 4;
|
|
||||||
|
|
||||||
QHeaderView* horizontalHeader = ui.tableWidget->horizontalHeader();
|
QHeaderView* horizontalHeader = ui.tableWidget->horizontalHeader();
|
||||||
QColor headerColor = QColor(100, 100, 100); // 灰色
|
QColor headerColor = QColor(100, 100, 100); // 灰色
|
||||||
horizontalHeader->setStyleSheet(QString("QHeaderView::section {background-color: %1;}").arg(headerColor.name()));
|
horizontalHeader->setStyleSheet(QString("QHeaderView::section {background-color: %1;}").arg(headerColor.name()));
|
||||||
@ -38,10 +34,6 @@ TargetListWgt::TargetListWgt(QWidget * parent) : QWidget(parent) {
|
|||||||
|
|
||||||
InitWgt();
|
InitWgt();
|
||||||
|
|
||||||
ui.lineEdit->setText("1");
|
|
||||||
ui.lineEdit_2->setText("1");
|
|
||||||
ui.spinBox_2->setValue(1);
|
|
||||||
|
|
||||||
connect(&WorkSpaceManager::Get(), &WorkSpaceManager::WorkSpaceChanged, this, &TargetListWgt::OnWorkSpaceChanged);
|
connect(&WorkSpaceManager::Get(), &WorkSpaceManager::WorkSpaceChanged, this, &TargetListWgt::OnWorkSpaceChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,157 +48,101 @@ void TargetListWgt::AttachDock(DockWidget* dockWidget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != dockWidget) {
|
|
||||||
m_titleText = dockWidget->windowTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
dockWidget->SetDockWidgetTitleBar(nullptr);
|
dockWidget->SetDockWidgetTitleBar(nullptr);
|
||||||
dockWidget->setWidget(this);
|
dockWidget->setWidget(this);
|
||||||
|
|
||||||
DockTitleBar* dockTitleBar = new DockTitleBar;
|
DockTitleBar* dockTitleBar = new DockTitleBar;
|
||||||
m_pDockTitleBar = dockTitleBar;
|
m_pDockTitleBar = dockTitleBar;
|
||||||
|
|
||||||
if (m_titleText.isEmpty()) {
|
|
||||||
dockTitleBar->SetTitle(tr("Data Table"));
|
|
||||||
} else {
|
|
||||||
dockTitleBar->SetTitle(m_titleText);
|
|
||||||
}
|
|
||||||
|
|
||||||
dockWidget->SetDockWidgetTitleBar(dockTitleBar);
|
dockWidget->SetDockWidgetTitleBar(dockTitleBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TargetListWgt::updateTitle(const QString & title)
|
||||||
|
{
|
||||||
|
if (nullptr != m_pDockTitleBar)
|
||||||
|
{
|
||||||
|
m_pDockTitleBar->SetTitle(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetListWgt::SetHead(const QString & headers)
|
||||||
|
{
|
||||||
|
QStringList headerLabels = headers.split(",");
|
||||||
|
SetHeader(headerLabels);
|
||||||
|
}
|
||||||
|
|
||||||
void TargetListWgt::SetHeader(const QStringList& headerLabels)
|
void TargetListWgt::SetHeader(const QStringList& headerLabels)
|
||||||
{
|
{
|
||||||
ui.tableWidget->clear();
|
ui.tableWidget->clear();
|
||||||
|
|
||||||
ui.tableWidget->setColumnCount(headerLabels.size());
|
ui.tableWidget->setColumnCount(headerLabels.size());
|
||||||
ui.tableWidget->setHorizontalHeaderLabels(headerLabels);
|
ui.tableWidget->setHorizontalHeaderLabels(headerLabels);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::AddRowData(QVariant& var)
|
void TargetListWgt::updateParseFile(const QString & strFile, int nT, QVariantList listCurve)
|
||||||
{
|
|
||||||
if (!var.isValid())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var.type() != QVariant::List)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantList varRowList = var.toList();
|
|
||||||
if (varRowList.size() < ui.tableWidget->columnCount())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_varRowDataList.push_back(var);
|
|
||||||
|
|
||||||
UpdatePageNum();
|
|
||||||
|
|
||||||
int nCurPage = ui.lineEdit->text().toInt();
|
|
||||||
UpdatePageData(nCurPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetListWgt::InitFile(const QString& strFile, int iBatchCount)
|
|
||||||
{
|
{
|
||||||
if (strFile.isEmpty())
|
if (strFile.isEmpty())
|
||||||
{
|
{
|
||||||
|
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据文件路径!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_iBatchCount = iBatchCount;
|
|
||||||
m_strFile = strFile;
|
|
||||||
m_vecReportPoint.clear();
|
|
||||||
bool bRet = ParseReport(strFile, m_vecReportPoint, m_iBatchCount);
|
|
||||||
|
|
||||||
if (nullptr != m_pDockTitleBar && bRet) {
|
|
||||||
QFileInfo fileInfo(strFile);
|
|
||||||
m_pDockTitleBar->SetTitle(tr("%1 -- %2").arg(m_titleText).arg(fileInfo.fileName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateTable(1);
|
|
||||||
|
|
||||||
UpdatePageNum();
|
|
||||||
|
|
||||||
UpdatePageData(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetListWgt::InitWgt()
|
|
||||||
{
|
|
||||||
ui.tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
|
|
||||||
ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
|
|
||||||
ui.tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
||||||
|
|
||||||
//UpdateButtonEnable();
|
|
||||||
|
|
||||||
connect(ui.toolButton, SIGNAL(clicked()), this, SLOT(slotForwardPage()));
|
|
||||||
connect(ui.toolButton_2, SIGNAL(clicked()), this, SLOT(slotNextPage()));
|
|
||||||
|
|
||||||
connect(ui.spinBox, SIGNAL(valueChanged(int)),
|
|
||||||
this, SLOT(slotRowCountChanged(int))); // 行数改变
|
|
||||||
|
|
||||||
connect(ui.spinBox_2, SIGNAL(valueChanged(int)),
|
|
||||||
this, SLOT(slotSelPage(int))); // 跳转
|
|
||||||
|
|
||||||
connect(ui.tableWidget, SIGNAL( itemDoubleClicked (QTableWidgetItem *)),
|
|
||||||
this, SLOT(slotDoubleClickedItem(QTableWidgetItem *)));
|
|
||||||
|
|
||||||
|
|
||||||
connect(ui.tableWidget, SIGNAL(itemClicked(QTableWidgetItem *)),
|
|
||||||
this, SLOT(slotClickedItem(QTableWidgetItem *)));
|
|
||||||
|
|
||||||
|
|
||||||
connect(ui.tableWidget->horizontalHeader(),SIGNAL(sectionClicked(int)), this, SLOT(slotSortTabCol(int)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TargetListWgt::ParseReport(const QString& strFile, std::vector<std::vector<std::vector<float>>>& vecReportPoint, int iRowCount)
|
|
||||||
{
|
|
||||||
if (strFile.isEmpty())
|
|
||||||
{
|
|
||||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据Report文件路径!"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QFile file(strFile);
|
QFile file(strFile);
|
||||||
if (file.open(QIODevice::ReadOnly))
|
if (file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
int iRow = 1;
|
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||||
|
{
|
||||||
std::vector<std::vector<float>> batch;
|
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||||
|
QString strName = mapCurve.value("Name").toString();
|
||||||
|
QString strColor = mapCurve.value("Color").toString();
|
||||||
|
m_tableSetting.insert(nI, mapCurve);
|
||||||
|
}
|
||||||
|
|
||||||
while (!file.atEnd())
|
while (!file.atEnd())
|
||||||
{
|
{
|
||||||
QString strLine = file.readLine().simplified();
|
QString strLine = file.readLine().simplified();
|
||||||
if (!strLine.isEmpty())
|
if (!strLine.isEmpty())
|
||||||
{
|
{
|
||||||
QStringList listLine = strLine.split(" ");
|
QStringList listLine = strLine.split(" ");
|
||||||
std::vector<float> vecLine;
|
double t = listLine.at(nT).toDouble();
|
||||||
for (size_t i = 0; i < listLine.size(); i++)
|
|
||||||
|
QMap<int, QVariantList> mapData;
|
||||||
|
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||||
{
|
{
|
||||||
vecLine.push_back(listLine[i].toFloat());
|
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||||
|
QString strData = mapCurve.value("Data").toString();
|
||||||
|
QStringList listData = strData.split(",");
|
||||||
|
|
||||||
|
QVariantList varList;
|
||||||
|
for (int nJ = 0; nJ < listData.size(); nJ++)
|
||||||
|
{
|
||||||
|
int nIndex = listData.at(nJ).toInt();
|
||||||
|
double data = listLine.at(nIndex).toDouble();
|
||||||
|
varList.push_back(data);
|
||||||
|
}
|
||||||
|
mapData.insert(nI, varList);
|
||||||
}
|
}
|
||||||
|
m_dataTable.insert(t, mapData);
|
||||||
batch.push_back(vecLine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批次
|
|
||||||
if (iRow % iRowCount == 0)
|
|
||||||
{
|
|
||||||
vecReportPoint.push_back(batch);
|
|
||||||
batch.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
iRow++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
void TargetListWgt::InitWgt()
|
||||||
|
{
|
||||||
|
ui.tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
ui.tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
//ui.tableWidget->setSortingEnabled(true);
|
||||||
|
|
||||||
|
connect(ui.tableWidget, SIGNAL( itemDoubleClicked (QTableWidgetItem *)),
|
||||||
|
this, SLOT(slotDoubleClickedItem(QTableWidgetItem *)));
|
||||||
|
|
||||||
|
connect(ui.tableWidget, SIGNAL(itemClicked(QTableWidgetItem *)),
|
||||||
|
this, SLOT(slotClickedItem(QTableWidgetItem *)));
|
||||||
|
|
||||||
|
//connect(ui.tableWidget->horizontalHeader(),SIGNAL(sectionClicked(int)), this, SLOT(slotSortTabCol(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::slotSortTabCol(int nCol)
|
void TargetListWgt::slotSortTabCol(int nCol)
|
||||||
@ -215,38 +151,6 @@ void TargetListWgt::slotSortTabCol(int nCol)
|
|||||||
QTableWidget *pParen = (QTableWidget *)(pSender->parent());
|
QTableWidget *pParen = (QTableWidget *)(pSender->parent());
|
||||||
pParen->sortItems(nCol, Qt::DescendingOrder);
|
pParen->sortItems(nCol, Qt::DescendingOrder);
|
||||||
//pParen->sortItems(nCol, Qt::AscendingOrder);
|
//pParen->sortItems(nCol, Qt::AscendingOrder);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetListWgt::slotForwardPage()
|
|
||||||
{
|
|
||||||
int nCurPage = ui.lineEdit->text().toInt();
|
|
||||||
if (nCurPage == 1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nCurPage -= 1;
|
|
||||||
|
|
||||||
ui.lineEdit->setText(QString::number(nCurPage));
|
|
||||||
|
|
||||||
UpdatePageData(nCurPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetListWgt::slotNextPage()
|
|
||||||
{
|
|
||||||
// 当前tab页显示的数据页数
|
|
||||||
int nCurPage = ui.lineEdit->text().toInt();
|
|
||||||
int iPageCount = ui.lineEdit_2->text().toInt();
|
|
||||||
if (nCurPage == iPageCount)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nCurPage += 1; // 下一页
|
|
||||||
ui.lineEdit->setText(QString::number(nCurPage));
|
|
||||||
|
|
||||||
UpdatePageData(nCurPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::OnWorkSpaceChanged(WorkSpace* worksapce) {
|
void TargetListWgt::OnWorkSpaceChanged(WorkSpace* worksapce) {
|
||||||
@ -254,12 +158,7 @@ void TargetListWgt::OnWorkSpaceChanged(WorkSpace* worksapce) {
|
|||||||
LOG_ERROR("worksapce is nullptr");
|
LOG_ERROR("worksapce is nullptr");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(worksapce, &WorkSpace::TimestepChanged, this, &TargetListWgt::OnTimestepChanged);
|
connect(worksapce, &WorkSpace::TimestepChanged, this, &TargetListWgt::OnTimestepChanged);
|
||||||
Timestep* timestep = worksapce->GetTimestep();
|
|
||||||
if (nullptr != timestep) {
|
|
||||||
InitFile(worksapce->GetReportPath(), timestep->GetSteps().size());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::OnTimestepChanged(Timestep* timestep) {
|
void TargetListWgt::OnTimestepChanged(Timestep* timestep) {
|
||||||
@ -268,17 +167,11 @@ void TargetListWgt::OnTimestepChanged(Timestep* timestep) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(timestep, SIGNAL(TimeChanged(double)), this, SLOT(slotUpdateTime(double)));
|
connect(timestep, SIGNAL(TimeChanged(double)), this, SLOT(slotUpdateTime(double)));
|
||||||
|
|
||||||
auto worksapce = timestep->GetWorkSpace();
|
|
||||||
if (nullptr != worksapce) {
|
|
||||||
InitFile(worksapce->GetReportPath(), timestep->GetSteps().size());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::slotTimeChanged(double dTime)
|
void TargetListWgt::slotUpdateTime(double dTime)
|
||||||
{
|
{
|
||||||
UpdateTable(dTime);
|
UpdateTable(dTime);
|
||||||
UpdatePageData(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::slotDoubleClickedItem(QTableWidgetItem *pItem)
|
void TargetListWgt::slotDoubleClickedItem(QTableWidgetItem *pItem)
|
||||||
@ -296,134 +189,44 @@ void TargetListWgt::timerEvent(QTimerEvent *event)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::UpdateTable(int iTime)
|
void TargetListWgt::UpdateTable(double t)
|
||||||
{
|
{
|
||||||
if (iTime < 1)
|
if (m_dataTable.size() > 0)
|
||||||
{
|
{
|
||||||
return;
|
clearTable();
|
||||||
}
|
|
||||||
|
|
||||||
if ((iTime - 1) >= m_vecReportPoint.size())
|
QMap< double, QMap<int, QVariantList> >::const_iterator ite = m_dataTable.lowerBound(t);
|
||||||
{
|
if (ite == m_dataTable.end())
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_varRowDataList.clear();
|
|
||||||
|
|
||||||
if (iTime-1 < m_vecReportPoint.size())
|
|
||||||
{
|
|
||||||
std::vector<std::vector<float>> batch = m_vecReportPoint[iTime-1];
|
|
||||||
|
|
||||||
ui.tableWidget->setRowCount(0);
|
|
||||||
|
|
||||||
for (int i = 0; i < batch.size(); i++)
|
|
||||||
{
|
{
|
||||||
ui.tableWidget->insertRow(i);
|
ite--;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<float> rowData = batch[i];
|
QMap<int, QVariantList> mapData = ite.value();
|
||||||
|
for (QMap<int, QVariantList>::Iterator it = mapData.begin(); it != mapData.end(); it++)
|
||||||
|
{
|
||||||
|
int nRow = it.key();
|
||||||
|
QVariantList dataList = it.value();
|
||||||
|
|
||||||
QVariantList varRow;
|
ui.tableWidget->insertRow(nRow);
|
||||||
for (int j = 0; j < ui.tableWidget->columnCount(); j++)
|
|
||||||
|
for (int nI = 0; nI < dataList.size(); nI++)
|
||||||
{
|
{
|
||||||
if (rowData.size() > j)
|
QString strVal;
|
||||||
{
|
strVal.sprintf("%.6f", dataList.at(nI).toFloat());
|
||||||
varRow.push_back(rowData[j]);
|
QTableWidgetItem *item = new QTableWidgetItem(strVal);
|
||||||
}
|
item->setTextAlignment(Qt::AlignCenter);
|
||||||
|
ui.tableWidget->setItem(nRow, nI, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_varRowDataList.push_back(varRow);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetListWgt::UpdatePageNum()
|
void TargetListWgt::clearTable()
|
||||||
{
|
{
|
||||||
m_nPageShowLineNum = ui.spinBox->value(); // 每页显示的行数
|
int nCount = ui.tableWidget->rowCount();
|
||||||
|
for (int nI = 0; nI < nCount; )
|
||||||
int iPageCount = 1;
|
|
||||||
|
|
||||||
int iDataCount = m_varRowDataList.size();
|
|
||||||
if (iDataCount > m_nPageShowLineNum)
|
|
||||||
{
|
|
||||||
iPageCount = m_varRowDataList.size() / m_nPageShowLineNum;
|
|
||||||
if (m_varRowDataList.size() % m_nPageShowLineNum > 0)
|
|
||||||
{
|
|
||||||
iPageCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.spinBox_2->setRange(1, iPageCount);
|
|
||||||
ui.lineEdit_2->setText(QString::number(iPageCount));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetListWgt::UpdateButtonEnable()
|
|
||||||
{
|
|
||||||
m_nPageShowLineNum = ui.spinBox->value(); // 每页显示的行数
|
|
||||||
|
|
||||||
// 当前tab页显示的数据页数
|
|
||||||
int nCurPage = 1;
|
|
||||||
|
|
||||||
if (1 == nCurPage) // 首页
|
|
||||||
{
|
|
||||||
ui.toolButton->setDisabled(true); // 前一页按钮
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui.toolButton->setDisabled(false); // 前一页按钮
|
|
||||||
}
|
|
||||||
|
|
||||||
// 总页数
|
|
||||||
int nPageCount = 1;
|
|
||||||
if (nCurPage == nPageCount) // 最后一页
|
|
||||||
{
|
|
||||||
ui.toolButton_2->setDisabled(true); // 后一页按钮
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui.toolButton_2->setDisabled(false); // 后一页按钮
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当前页码数
|
|
||||||
ui.lineEdit->setText(QString::number(nCurPage));
|
|
||||||
// 总页码数
|
|
||||||
ui.lineEdit_2->setText(QString::number(nPageCount));
|
|
||||||
|
|
||||||
// 设置页码数范围
|
|
||||||
ui.spinBox_2->setRange(1,nPageCount);
|
|
||||||
ui.spinBox_2->setValue(nCurPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetListWgt::UpdatePageData(int iPageNum)
|
|
||||||
{
|
|
||||||
m_nPageShowLineNum = ui.spinBox->value(); // 每页显示的行数
|
|
||||||
|
|
||||||
int iIndex = (iPageNum-1) * m_nPageShowLineNum; // 每页显示的行数
|
|
||||||
int iEndIndex = iIndex + m_nPageShowLineNum;
|
|
||||||
if (iEndIndex > m_varRowDataList.size())
|
|
||||||
{
|
|
||||||
iEndIndex = m_varRowDataList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ui.tableWidget->rowCount() > 0)
|
|
||||||
{
|
{
|
||||||
ui.tableWidget->removeRow(0);
|
ui.tableWidget->removeRow(0);
|
||||||
}
|
nCount = ui.tableWidget->rowCount();
|
||||||
|
|
||||||
int iRow = 0;
|
|
||||||
|
|
||||||
for (; iIndex < iEndIndex; iIndex++)
|
|
||||||
{
|
|
||||||
QVariantList varColList = m_varRowDataList[iIndex].toList();
|
|
||||||
|
|
||||||
ui.tableWidget->insertRow(iRow);
|
|
||||||
|
|
||||||
for (int iCol = 0; iCol < varColList.size(); iCol++)
|
|
||||||
{
|
|
||||||
QString strVal;
|
|
||||||
strVal.sprintf("%.6f", varColList[iCol].toFloat());
|
|
||||||
ui.tableWidget->setItem(iRow, iCol, new QTableWidgetItem(strVal));
|
|
||||||
}
|
|
||||||
|
|
||||||
iRow++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "ui/Dialog.h"
|
#include "ui/Dialog.h"
|
||||||
|
|
||||||
#include "ui_targetlistwgt.h"
|
#include "ui_targetlistwgt.h"
|
||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
|
|
||||||
class TargetListWgt : public QWidget {
|
class TargetListWgt : public QWidget
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -19,68 +18,36 @@ public:
|
|||||||
|
|
||||||
void AttachDock(class DockWidget* dockWidget);
|
void AttachDock(class DockWidget* dockWidget);
|
||||||
|
|
||||||
|
void updateTitle(const QString& title);
|
||||||
|
void SetHead(const QString& headers);
|
||||||
void SetHeader(const QStringList& headerLabels);
|
void SetHeader(const QStringList& headerLabels);
|
||||||
void AddRowData(QVariant &var);
|
|
||||||
|
|
||||||
void InitFile(const QString& strFile, int iBatchCount);
|
void updateParseFile(const QString& strFile, int nT, QVariantList listCurve);
|
||||||
|
|
||||||
QString GetFile()
|
|
||||||
{
|
|
||||||
return m_strFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetBatch()
|
|
||||||
{
|
|
||||||
return m_iBatchCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InitWgt();
|
void InitWgt();
|
||||||
|
|
||||||
bool ParseReport(const QString& strFile, std::vector<std::vector<std::vector<float>>>& vecReportPoint, int iRowCount = 50);
|
|
||||||
|
|
||||||
void UpdatePageNum();
|
|
||||||
void UpdateButtonEnable(); // 更新按钮状态
|
|
||||||
void UpdatePageData(int iPageNum);
|
|
||||||
|
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
|
|
||||||
void UpdateTable(int iTime);
|
void UpdateTable(double t);
|
||||||
|
|
||||||
|
void clearTable();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
void slotSortTabCol(int nCol);
|
||||||
|
void slotUpdateTime(double dTime);
|
||||||
void slotSortTabCol(int nCol);
|
|
||||||
void slotTimeChanged(double dTime);
|
|
||||||
|
|
||||||
void slotDoubleClickedItem(QTableWidgetItem *pItem); // 双击行
|
void slotDoubleClickedItem(QTableWidgetItem *pItem); // 双击行
|
||||||
void slotClickedItem(QTableWidgetItem *pItem);
|
void slotClickedItem(QTableWidgetItem *pItem);
|
||||||
|
|
||||||
void slotForwardPage(); // 前一页
|
|
||||||
void slotNextPage(); // 下一页
|
|
||||||
|
|
||||||
void OnWorkSpaceChanged(class WorkSpace*);
|
void OnWorkSpaceChanged(class WorkSpace*);
|
||||||
void OnTimestepChanged(class Timestep*);
|
void OnTimestepChanged(class Timestep*);
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TargetListWgt ui;
|
Ui::TargetListWgt ui;
|
||||||
|
|
||||||
|
|
||||||
int m_nCurTabPage; // 当前tab页
|
|
||||||
int m_nPageShowLineNum; // 页显示的行数
|
|
||||||
|
|
||||||
int m_nBoundaryWth;
|
|
||||||
|
|
||||||
QVariantList m_varRowDataList;
|
|
||||||
|
|
||||||
QString m_strFile;
|
|
||||||
|
|
||||||
std::vector<std::vector<std::vector<float>>> m_vecReportPoint;
|
|
||||||
int m_iBatchCount;
|
|
||||||
|
|
||||||
QString m_titleText;
|
|
||||||
class DockTitleBar* m_pDockTitleBar { nullptr };
|
class DockTitleBar* m_pDockTitleBar { nullptr };
|
||||||
|
|
||||||
|
QMap<int, QVariantMap> m_tableSetting;
|
||||||
|
QMap< double, QMap<int, QVariantList> > m_dataTable;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -24,144 +24,6 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>停止更新</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>显示行数</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>3000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="toolButton">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>前一页</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>60</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>/</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_2">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>60</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="toolButton_2">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>后一页</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>跳转</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_2">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>3000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|||||||
119
src/ui/chartPlot/ChartXMLMgr.cpp
Normal file
119
src/ui/chartPlot/ChartXMLMgr.cpp
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
#include "ChartXMLMgr.h"
|
||||||
|
#include "common/SpdLogger.h"
|
||||||
|
|
||||||
|
ChartXMLMgr::ChartXMLMgr(QObject* parent) noexcept
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChartXMLMgr::Load(const QString& file) {
|
||||||
|
std::string path = file.toLocal8Bit().constData();
|
||||||
|
LOG_INFO("load ChartXML path:{}", path);
|
||||||
|
tinyxml2::XMLDocument xmlDocument;
|
||||||
|
tinyxml2::XMLError error = xmlDocument.LoadFile(path.c_str());
|
||||||
|
if (tinyxml2::XMLError::XML_SUCCESS != error) {
|
||||||
|
LOG_INFO("load ChartXML feiled:{}", static_cast<int>(error));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tinyxml2::XMLElement* root = xmlDocument.RootElement();
|
||||||
|
|
||||||
|
const tinyxml2::XMLElement* xmlElement = root->FirstChildElement();
|
||||||
|
while (nullptr != xmlElement) {
|
||||||
|
const char* name = xmlElement->Name();
|
||||||
|
if (0 == strcmp(name, "Widget")) {
|
||||||
|
ParseWidget(xmlElement);
|
||||||
|
}
|
||||||
|
xmlElement = xmlElement->NextSiblingElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChartXMLMgr::ParseWidget(const tinyxml2::XMLElement* element)
|
||||||
|
{
|
||||||
|
if (nullptr == element) {
|
||||||
|
LOG_WARN("element is nullptr");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* current = element->FirstAttribute();
|
||||||
|
QString strWgt = "";
|
||||||
|
while (nullptr != current) {
|
||||||
|
const char* eleName = current->Name();
|
||||||
|
if (0 == strcmp(eleName, "Name")) {
|
||||||
|
const char* name = current->Value();
|
||||||
|
strWgt = QString(name);
|
||||||
|
}
|
||||||
|
current = current->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantList listChart;
|
||||||
|
const tinyxml2::XMLElement* xmlElement = element->FirstChildElement();
|
||||||
|
while (nullptr != xmlElement) {
|
||||||
|
const char* name = xmlElement->Name();
|
||||||
|
if (0 == strcmp(name, "Chart")) {
|
||||||
|
ParseChart(xmlElement, listChart);
|
||||||
|
}
|
||||||
|
xmlElement = xmlElement->NextSiblingElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap mapWgt;
|
||||||
|
mapWgt.insert("Name", QVariant(strWgt));
|
||||||
|
mapWgt.insert("Chart", QVariant(listChart));
|
||||||
|
m_listWgt.push_back(QVariant(mapWgt));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChartXMLMgr::ParseChart(const tinyxml2::XMLElement * element, QVariantList &listChart)
|
||||||
|
{
|
||||||
|
if (nullptr == element) {
|
||||||
|
LOG_WARN("element is nullptr");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* current = element->FirstAttribute();
|
||||||
|
QVariantMap mapChart;
|
||||||
|
while (nullptr != current) {
|
||||||
|
const char* eleName = current->Name();
|
||||||
|
const char* value = current->Value();
|
||||||
|
mapChart.insert(QString(eleName), QString(value));
|
||||||
|
current = current->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantList listCurve;
|
||||||
|
const tinyxml2::XMLElement* xmlElement = element->FirstChildElement();
|
||||||
|
while (nullptr != xmlElement) {
|
||||||
|
const char* name = xmlElement->Name();
|
||||||
|
if (0 == strcmp(name, "Curve")) {
|
||||||
|
ParseCurve(xmlElement, listCurve);
|
||||||
|
}
|
||||||
|
xmlElement = xmlElement->NextSiblingElement();
|
||||||
|
}
|
||||||
|
mapChart.insert("Curve", QVariant(listCurve));
|
||||||
|
|
||||||
|
listChart.push_back(QVariant(mapChart));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChartXMLMgr::ParseCurve(const tinyxml2::XMLElement * element, QVariantList &listCurve)
|
||||||
|
{
|
||||||
|
if (nullptr == element) {
|
||||||
|
LOG_WARN("element is nullptr");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tinyxml2::XMLAttribute* current = element->FirstAttribute();
|
||||||
|
QVariantMap mapCurve;
|
||||||
|
while (nullptr != current) {
|
||||||
|
const char* eleName = current->Name();
|
||||||
|
const char* value = current->Value();
|
||||||
|
mapCurve.insert(QString(eleName), QString(value));
|
||||||
|
current = current->Next();
|
||||||
|
}
|
||||||
|
listCurve.push_back(QVariant(mapCurve));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
30
src/ui/chartPlot/ChartXMLMgr.h
Normal file
30
src/ui/chartPlot/ChartXMLMgr.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
#include "xml/tinyxml2.h"
|
||||||
|
|
||||||
|
class ChartXMLMgr : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ChartXMLMgr(QObject* parent = nullptr) noexcept;
|
||||||
|
~ChartXMLMgr() override = default;
|
||||||
|
|
||||||
|
bool Load(const QString& file);
|
||||||
|
|
||||||
|
QVariantList GetChartWgt()
|
||||||
|
{
|
||||||
|
return m_listWgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool ParseWidget(const tinyxml2::XMLElement* element);
|
||||||
|
bool ParseChart(const tinyxml2::XMLElement* element, QVariantList &listChart);
|
||||||
|
bool ParseCurve(const tinyxml2::XMLElement* element, QVariantList &listCurve);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVariantList m_listWgt;
|
||||||
|
};
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -15,39 +15,32 @@ class FitCurveDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FitCurveDialog(int iType=1, QWidget* parent = nullptr);
|
explicit FitCurveDialog(QWidget* parent = nullptr);
|
||||||
~FitCurveDialog();
|
~FitCurveDialog();
|
||||||
|
|
||||||
void AttachDock(class DockWidget* dockWidget);
|
void AttachDock(class DockWidget* dockWidget);
|
||||||
|
|
||||||
void initQChartView();
|
void initQChartView();
|
||||||
void updateXYGuideLine();
|
|
||||||
void resetZoomAndScroll();
|
void resetZoomAndScroll();
|
||||||
QVector<int> getAxisRanges();
|
QVector<int> getAxisRanges();
|
||||||
|
|
||||||
void InitWaveFile(const QString& strFile, int iBatchCount = 50);
|
void updateTitle(const QString& title);
|
||||||
void InitReportFile(const QString& strFile, int iBatchCount = 50);
|
void updateTitleAxis(const QString& xTitle, const QString& yTitle);
|
||||||
|
|
||||||
void updateTitle(const QString& xTitle, const QString& yTitle);
|
|
||||||
void updateMinMaxX(float min, float max, int count);
|
void updateMinMaxX(float min, float max, int count);
|
||||||
void updateMinMaxY(float min, float max);
|
void updateMinMaxY(float min, float max, int count);
|
||||||
|
void updateParseWaveFile(const QString& strFile, int nT, QVariantList listCurve);
|
||||||
|
void updateParseReportFile(const QString& strFile, int nT, QVariantList listCurve);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ParseWave(const QString& strFile, std::vector < std::vector<std::vector<float>>>& vecWavePoint, int iRowCount = 50);
|
|
||||||
bool ParseReport(const QString& strFile, std::vector<std::vector<std::vector<float>>>& vecReportPoint, int iRowCount = 50);
|
|
||||||
void OnWorkSpaceChanged(class WorkSpace*);
|
void OnWorkSpaceChanged(class WorkSpace*);
|
||||||
void OnTimestepChanged(class Timestep*);
|
void OnTimestepChanged(class Timestep*);
|
||||||
|
void updateWaveData(double t);
|
||||||
|
void updateReportData(double t);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void theSlotMouseEvent(int eventId, QMouseEvent* event);
|
void theSlotMouseEvent(int eventId, QMouseEvent* event);
|
||||||
void theSlotWheelEvent(QWheelEvent* event);
|
void theSlotWheelEvent(QWheelEvent* event);
|
||||||
|
|
||||||
void slotAddSeries(QVariant varSeriesData);
|
|
||||||
|
|
||||||
void slotDelCurve(int iID); // ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
void slotInserKeyPoint(int iID,float xValue, float yValue);
|
|
||||||
|
|
||||||
void slotUpdateTime(double dTime);
|
void slotUpdateTime(double dTime);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -55,18 +48,11 @@ private:
|
|||||||
FitCurveChartView* curveChartView;
|
FitCurveChartView* curveChartView;
|
||||||
QChart* curveChart;
|
QChart* curveChart;
|
||||||
|
|
||||||
//QSplineSeries* fitPointsSeriesS; //Ҫ<><D2AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>
|
bool isPressed = false;
|
||||||
//QScatterSeries* tipSeries;
|
QPoint pressedPoint;
|
||||||
//QSplineSeries* xGuideSeries; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5>x<EFBFBD>Ḩ<EFBFBD><E1B8A8><EFBFBD><EFBFBD>
|
|
||||||
//QSplineSeries* yGuideSeries; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5>y<EFBFBD>Ḩ<EFBFBD><E1B8A8><EFBFBD><EFBFBD>
|
|
||||||
bool isPressed = false; //ͼ<><CDBC><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD><D7A7>
|
|
||||||
QPoint pressedPoint; //<2F><><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD><D7A7><EFBFBD>
|
|
||||||
|
|
||||||
int m_iType; // y<><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
QValueAxis* m_pAxisX = NULL;
|
QValueAxis* m_pAxisX = NULL;
|
||||||
QValueAxis* m_pAxisY = NULL;
|
QValueAxis* m_pAxisY = NULL;
|
||||||
QLogValueAxis* m_pLgAxisY = NULL;
|
|
||||||
float m_iXMax;
|
float m_iXMax;
|
||||||
float m_iXMin;
|
float m_iXMin;
|
||||||
float m_iYMax;
|
float m_iYMax;
|
||||||
@ -74,12 +60,10 @@ private:
|
|||||||
|
|
||||||
QMap<int, QSplineSeries*> m_seriesIDMap;
|
QMap<int, QSplineSeries*> m_seriesIDMap;
|
||||||
|
|
||||||
std::vector<std::vector<std::vector<float>>> m_vecWavePoint;
|
|
||||||
std::vector<std::vector<std::vector<float>>> m_vecReportPoint;
|
|
||||||
|
|
||||||
int m_iID = 1;
|
|
||||||
QString m_titleText;
|
|
||||||
class DockTitleBar* m_pDockTitleBar { nullptr };
|
class DockTitleBar* m_pDockTitleBar { nullptr };
|
||||||
|
|
||||||
|
QMap< double, QMap<int, QVariantList> > m_dataWava;
|
||||||
|
QMap< double, QMap<int, QPointF> > m_dataReport;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FITCURVEDIALOG_H
|
#endif // FITCURVEDIALOG_H
|
||||||
@ -21,7 +21,12 @@ SurfaceDialog::SurfaceDialog(QWidget *parent)
|
|||||||
|
|
||||||
setWindowTitle("3D Curve");
|
setWindowTitle("3D Curve");
|
||||||
|
|
||||||
|
m_iMinX = 0; m_iMaxX = 0;
|
||||||
|
m_iMinY = 0; m_iMaxY = 0;
|
||||||
|
m_iMinZ = 0; m_iMaxZ = 0;
|
||||||
|
|
||||||
InitSurface();
|
InitSurface();
|
||||||
|
|
||||||
connect(&WorkSpaceManager::Get(), &WorkSpaceManager::WorkSpaceChanged, this, &SurfaceDialog::OnWorkSpaceChanged);
|
connect(&WorkSpaceManager::Get(), &WorkSpaceManager::WorkSpaceChanged, this, &SurfaceDialog::OnWorkSpaceChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,247 +47,275 @@ void SurfaceDialog::AttachDock(DockWidget* dockWidget)
|
|||||||
|
|
||||||
m_pDockTitleBar = new DockTitleBar;
|
m_pDockTitleBar = new DockTitleBar;
|
||||||
|
|
||||||
m_pDockTitleBar->SetTitle(tr("3D Curve"));
|
|
||||||
|
|
||||||
dockWidget->SetDockWidgetTitleBar(m_pDockTitleBar);
|
dockWidget->SetDockWidgetTitleBar(m_pDockTitleBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceDialog::InitRD(const QString& strFile, int iBatch, int iRowCount)
|
void SurfaceDialog::updateTitle(const QString & title)
|
||||||
{
|
{
|
||||||
if (strFile.isEmpty())
|
if (nullptr != m_pDockTitleBar)
|
||||||
return;
|
{
|
||||||
|
m_pDockTitleBar->SetTitle(title);
|
||||||
m_vecRDPoint.clear();
|
}
|
||||||
bool bRet = ParseRD(strFile, m_vecRDPoint,iBatch, iRowCount);
|
|
||||||
|
|
||||||
if (nullptr != m_pDockTitleBar && bRet) {
|
|
||||||
QFileInfo fileInfo(strFile);
|
|
||||||
m_pDockTitleBar->SetTitle(tr("3D Curve -- %1").arg(fileInfo.fileName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceDialog::slotAddSeries(QVariant varSeriesData)
|
void SurfaceDialog::updateTitleAxis(const QString & xTitle, const QString & yTitle, const QString & zTitle)
|
||||||
{
|
{
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
m_p3DXAxis->setTitle(xTitle);
|
||||||
if (!varSeriesData.isValid())
|
m_p3DXAxis->setTitleVisible(true);
|
||||||
{
|
m_p3DYAxis->setTitle(yTitle);
|
||||||
return;
|
m_p3DYAxis->setTitleVisible(true);
|
||||||
}
|
m_p3DZAxis->setTitle(zTitle);
|
||||||
|
m_p3DZAxis->setTitleVisible(true);
|
||||||
QVariantList varCurDataList = varSeriesData.toMap().value("Data").toList(); // <20><><EFBFBD><EFBFBD>
|
|
||||||
QColor color = varSeriesData.toMap().value("Color").value<QColor>(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
||||||
QString strXName = varSeriesData.toMap().value("xTitle").toString(); // x<><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
QString strYName = varSeriesData.toMap().value("yTitle").toString(); // y<><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
QString strZName = varSeriesData.toMap().value("zTitle").toString(); // z<><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
int iID = varSeriesData.toMap().value("ID").toInt(); // y<><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
bool bAdd = varSeriesData.toMap().value("Add").toBool(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
int iCurveType = varSeriesData.toMap().value("curveType").toInt(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
if (iCurveType != 3) // <20><>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_p3DXAxis->setTitle(strXName);
|
|
||||||
m_p3DXAxis->setTitleVisible(true);
|
|
||||||
m_p3DYAxis->setTitle(strYName);
|
|
||||||
m_p3DYAxis->setTitleVisible(true);
|
|
||||||
m_p3DZAxis->setTitle(strZName);
|
|
||||||
m_p3DZAxis->setTitleVisible(true);
|
|
||||||
|
|
||||||
QSurfaceDataArray* data = new QSurfaceDataArray;
|
|
||||||
|
|
||||||
m_iMinX = 0; m_iMaxX = 0;
|
|
||||||
m_iMinY = 0; m_iMaxY = 0;
|
|
||||||
m_iMinZ = 0; m_iMaxZ = 0;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < varCurDataList.size(); i++)
|
|
||||||
{
|
|
||||||
QVariantList varRow = varCurDataList[i].toList();
|
|
||||||
if (varRow.size() > 2)
|
|
||||||
{
|
|
||||||
QSurfaceDataRow* dataRow = new QSurfaceDataRow;
|
|
||||||
|
|
||||||
float fX = varRow[0].toFloat();
|
|
||||||
|
|
||||||
QVariantList varY = varRow[1].toList();
|
|
||||||
QVariantList varZ = varRow[2].toList();
|
|
||||||
|
|
||||||
if (m_iMinX > fX)
|
|
||||||
{
|
|
||||||
m_iMinX = fX;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMaxX < fX)
|
|
||||||
{
|
|
||||||
m_iMaxX = fX;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t j = 0; j < varY.size(); j++)
|
|
||||||
{
|
|
||||||
float fY = varY[j].toFloat();
|
|
||||||
float fZ = varZ[j].toFloat();
|
|
||||||
|
|
||||||
if (m_iMinY > fY)
|
|
||||||
{
|
|
||||||
m_iMinY = fY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMaxY < fY)
|
|
||||||
{
|
|
||||||
m_iMaxY = fY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMinZ > fZ)
|
|
||||||
{
|
|
||||||
m_iMinZ = fZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMaxZ < fZ)
|
|
||||||
{
|
|
||||||
m_iMaxZ = fZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
*dataRow << QVector3D(fX, fY, fZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
*data << dataRow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pSeries->dataProxy()->resetArray(data);
|
|
||||||
|
|
||||||
m_p3DXAxis->setRange(m_iMinX, m_iMaxX);
|
|
||||||
m_p3DYAxis->setRange(m_iMinZ, m_iMaxZ);
|
|
||||||
m_p3DZAxis->setRange(m_iMinY, m_iMaxY);
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>ʽ
|
|
||||||
m_pSeries->setBaseColor(color);
|
|
||||||
m_pSeries->setColorStyle(Q3DTheme::ColorStyleUniform);
|
|
||||||
m_pSeries->setSingleHighlightColor(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceDialog::slotInserKeyPoint(float xValue, float yValue, float zValue)
|
void SurfaceDialog::updateMinMaxX(float min, float max, int count)
|
||||||
{
|
{
|
||||||
QVector3D vecItem(xValue, yValue, zValue);
|
if (max > min)
|
||||||
// <20><><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Сֵ
|
{
|
||||||
if (m_iMinX > xValue)
|
m_iMinX = min;
|
||||||
{
|
m_iMaxX = max;
|
||||||
m_iMinX = xValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMaxX < xValue)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
m_iMaxX = xValue;
|
m_p3DXAxis->setSegmentCount(count);
|
||||||
}
|
}
|
||||||
|
m_p3DXAxis->setRange(min, max);
|
||||||
if (m_iMinY > yValue)
|
}
|
||||||
{
|
|
||||||
m_iMinY = yValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMaxY < yValue)
|
|
||||||
{
|
|
||||||
m_iMaxY = yValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMinZ > zValue)
|
|
||||||
{
|
|
||||||
m_iMinZ = zValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iMaxZ < zValue)
|
|
||||||
{
|
|
||||||
m_iMaxZ = zValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_p3DXAxis->setRange(m_iMinX, m_iMaxX);
|
|
||||||
m_p3DYAxis->setRange(m_iMinY, m_iMaxY);
|
|
||||||
m_p3DZAxis->setRange(m_iMinZ, m_iMaxZ);
|
|
||||||
|
|
||||||
int iRowCount = m_pSeries->dataProxy()->rowCount();
|
|
||||||
QList<QSurfaceDataRow*> dataArry = *(m_pSeries->dataProxy()->array());
|
|
||||||
for (size_t i = 0; i < iRowCount; i++)
|
|
||||||
{
|
|
||||||
QSurfaceDataRow* dataRow = dataArry[i];
|
|
||||||
if (dataRow)
|
|
||||||
{
|
|
||||||
*dataRow << vecItem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pSeries->dataProxy()->resetArray(&dataArry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceDialog::slotUpdateTime(double dTime)
|
void SurfaceDialog::updateMinMaxY(float min, float max, int count)
|
||||||
{
|
{
|
||||||
if (dTime < 1)
|
if (max > min)
|
||||||
{
|
{
|
||||||
return;
|
m_iMinY = min;
|
||||||
}
|
m_iMaxY = max;
|
||||||
|
|
||||||
if ((dTime - 1) >= m_vecRDPoint.size())
|
if (count > 0)
|
||||||
{
|
{
|
||||||
return;
|
m_p3DYAxis->setSegmentCount(count);
|
||||||
}
|
}
|
||||||
|
m_p3DYAxis->setRange(min, max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::vector<float>> batch = m_vecRDPoint[dTime - 1];
|
void SurfaceDialog::updateMinMaxZ(float min, float max, int count)
|
||||||
|
{
|
||||||
|
if (max > min)
|
||||||
|
{
|
||||||
|
m_iMinZ = min;
|
||||||
|
m_iMaxZ = max;
|
||||||
|
|
||||||
m_p3DXAxis->setTitle("x");
|
if (count > 0)
|
||||||
m_p3DXAxis->setTitleVisible(true);
|
{
|
||||||
m_p3DYAxis->setTitle("y");
|
m_p3DZAxis->setSegmentCount(count);
|
||||||
m_p3DYAxis->setTitleVisible(true);
|
}
|
||||||
m_p3DZAxis->setTitle("z");
|
m_p3DZAxis->setRange(min, max);
|
||||||
m_p3DZAxis->setTitleVisible(true);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_pSeries->dataProxy()->resetArray(nullptr);
|
void SurfaceDialog::updateParseFile(const QString & strFile, int nT, QVariantList listCurve)
|
||||||
|
{
|
||||||
|
if (strFile.isEmpty())
|
||||||
|
{
|
||||||
|
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据文件路径!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QSurfaceDataArray* data = new QSurfaceDataArray;
|
QFile file(strFile);
|
||||||
|
if (file.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||||
|
{
|
||||||
|
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||||
|
QString strName = mapCurve.value("Name").toString();
|
||||||
|
QString strColor = mapCurve.value("Color").toString();
|
||||||
|
QColor color = QColor(strColor.section(",", 0, 0).toInt(), strColor.section(",", 1, 1).toInt(), strColor.section(",", 2, 2).toInt());
|
||||||
|
|
||||||
m_iMinX = 0; m_iMaxX = 0;
|
QLinearGradient gr;
|
||||||
m_iMinY = 0; m_iMaxY = 0;
|
gr.setColorAt(0.0, color);
|
||||||
m_iMinZ = 0; m_iMaxZ = 0;
|
gr.setColorAt(0.5, Qt::yellow);
|
||||||
|
gr.setColorAt(0.8, Qt::red);
|
||||||
|
gr.setColorAt(1.0, Qt::darkRed);
|
||||||
|
|
||||||
m_iMaxX = batch.size();
|
m_pSeries->setBaseGradient(gr);
|
||||||
|
m_pSeries->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
|
||||||
for (int i = 0; i < batch.size(); i++)
|
//m_pSeries->setSingleHighlightColor(Qt::green);
|
||||||
{
|
}
|
||||||
std::vector<float> rowData = batch[i];
|
|
||||||
|
|
||||||
QSurfaceDataRow* dataRow = new QSurfaceDataRow;
|
bool bResetAxisX = false;
|
||||||
|
if (m_iMaxX == m_iMinX)
|
||||||
|
{
|
||||||
|
bResetAxisX = true;
|
||||||
|
}
|
||||||
|
bool bResetAxisY = false;
|
||||||
|
if (m_iMaxZ == m_iMinZ)
|
||||||
|
{
|
||||||
|
bResetAxisY = true;
|
||||||
|
}
|
||||||
|
bool bResetAxisZ = false;
|
||||||
|
if (m_iMaxY == m_iMinY)
|
||||||
|
{
|
||||||
|
bResetAxisZ = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_iMaxY < rowData.size())
|
while (!file.atEnd())
|
||||||
{
|
{
|
||||||
m_iMaxY = rowData.size();
|
QString strLine = file.readLine().simplified();
|
||||||
}
|
if (!strLine.isEmpty())
|
||||||
|
{
|
||||||
for (int j = 0; j < rowData.size(); j++)
|
QStringList listLine = strLine.split(" ");
|
||||||
{
|
double t = listLine.at(nT).toDouble();
|
||||||
float fZ = abs(rowData[j]);
|
|
||||||
|
|
||||||
if (m_iMinZ > fZ)
|
QMap< int, QVector< QVector<QVector3D> > > mapData;
|
||||||
{
|
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||||
m_iMinZ = fZ;
|
{
|
||||||
}
|
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||||
|
int nStart = mapCurve.value("Start").toInt();
|
||||||
|
int nStop = mapCurve.value("Stop").toInt();
|
||||||
|
if (nStart == 0)
|
||||||
|
{
|
||||||
|
nStart = 1;
|
||||||
|
}
|
||||||
|
if (nStop == 0)
|
||||||
|
{
|
||||||
|
nStop = listLine.size();
|
||||||
|
}
|
||||||
|
QString strX = mapCurve.value("x").toString();
|
||||||
|
QString strY = mapCurve.value("y").toString();
|
||||||
|
QString strZ = mapCurve.value("z").toString();
|
||||||
|
|
||||||
if (m_iMaxZ < fZ)
|
double xInput = 0;
|
||||||
{
|
double yInput = 0;
|
||||||
m_iMaxZ = fZ;
|
double zInput = 0.0;
|
||||||
}
|
QVector< QVector<QVector3D> > listRowData;
|
||||||
|
int nRow = 0;
|
||||||
|
int nCol = 0;
|
||||||
|
for (int nJ = nStart; nJ < nStop; nJ+=3)
|
||||||
|
{
|
||||||
|
int x = listLine.at(nJ).toDouble();
|
||||||
|
int y = listLine.at(nJ+1).toDouble();
|
||||||
|
double z = listLine.at(nJ+2).toDouble();
|
||||||
|
|
||||||
|
if (strX == "x")
|
||||||
|
{
|
||||||
|
xInput = x;
|
||||||
|
}
|
||||||
|
else if (strX == "y")
|
||||||
|
{
|
||||||
|
xInput = y;
|
||||||
|
}
|
||||||
|
else if (strX == "z")
|
||||||
|
{
|
||||||
|
xInput = z;
|
||||||
|
}
|
||||||
|
|
||||||
*dataRow << QVector3D(i+1, fZ, j+1);
|
if (strY == "x")
|
||||||
}
|
{
|
||||||
|
yInput = x;
|
||||||
|
}
|
||||||
|
else if (strY == "y")
|
||||||
|
{
|
||||||
|
yInput = y;
|
||||||
|
}
|
||||||
|
else if (strY == "z")
|
||||||
|
{
|
||||||
|
yInput = z;
|
||||||
|
}
|
||||||
|
|
||||||
*data << dataRow;
|
if (strZ == "x")
|
||||||
}
|
{
|
||||||
|
zInput = x;
|
||||||
|
}
|
||||||
|
else if (strZ == "y")
|
||||||
|
{
|
||||||
|
zInput = y;
|
||||||
|
}
|
||||||
|
else if (strZ == "z")
|
||||||
|
{
|
||||||
|
zInput = z;
|
||||||
|
}
|
||||||
|
|
||||||
m_pSeries->dataProxy()->resetArray(data);
|
QVector3D v3d = QVector3D(xInput, yInput, zInput);
|
||||||
|
if (nRow == x)
|
||||||
|
{
|
||||||
|
int nIndex = listRowData.size() - 1;
|
||||||
|
QVector<QVector3D> listColData = listRowData[nIndex];
|
||||||
|
listColData.push_back(v3d);
|
||||||
|
listRowData.replace(nIndex, listColData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QVector<QVector3D> listColData;
|
||||||
|
listColData.push_back(v3d);
|
||||||
|
listRowData.push_back(listColData);
|
||||||
|
}
|
||||||
|
|
||||||
m_p3DXAxis->setRange(m_iMinX, m_iMaxX);
|
nRow = x;
|
||||||
m_p3DYAxis->setRange(m_iMinZ, m_iMaxZ);
|
nCol = y;
|
||||||
m_p3DZAxis->setRange(m_iMinY, m_iMaxY);
|
}
|
||||||
|
mapData.insert(nI, listRowData);
|
||||||
|
}
|
||||||
|
m_data.insert(t, mapData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_iMaxX == m_iMinX)
|
||||||
|
{
|
||||||
|
m_p3DXAxis->setAutoAdjustRange(true);
|
||||||
|
}
|
||||||
|
if (m_iMaxZ == m_iMinZ)
|
||||||
|
{
|
||||||
|
m_p3DZAxis->setAutoAdjustRange(true);
|
||||||
|
}
|
||||||
|
if (m_iMaxY == m_iMinY)
|
||||||
|
{
|
||||||
|
m_p3DYAxis->setAutoAdjustRange(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Surface.setHorizontalAspectRatio(1.0);
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SurfaceDialog::slotUpdateTime(double t)
|
||||||
|
{
|
||||||
|
if (m_data.size() > 0)
|
||||||
|
{
|
||||||
|
m_pSeries->dataProxy()->resetArray(nullptr);
|
||||||
|
|
||||||
|
QMap< double, QMap< int, QVector< QVector<QVector3D> > > >::const_iterator ite = m_data.lowerBound(t);
|
||||||
|
if (ite == m_data.end())
|
||||||
|
{
|
||||||
|
ite--;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap< int, QVector< QVector<QVector3D> > > mapData = ite.value();
|
||||||
|
for (QMap< int, QVector< QVector<QVector3D> > >::Iterator it = mapData.begin(); it != mapData.end(); it++)
|
||||||
|
{
|
||||||
|
int nIndex = it.key();
|
||||||
|
QVector< QVector<QVector3D> > listRowData = it.value();
|
||||||
|
|
||||||
|
QSurfaceDataArray* data = new QSurfaceDataArray;
|
||||||
|
|
||||||
|
for (int nI = 0; nI < listRowData.size(); nI++)
|
||||||
|
{
|
||||||
|
QSurfaceDataRow* dataRow = new QSurfaceDataRow;
|
||||||
|
|
||||||
|
QVector<QVector3D> listColData = listRowData[nI];
|
||||||
|
for (int nJ = 0; nJ < listColData.size(); nJ++)
|
||||||
|
{
|
||||||
|
QVector3D v3d = listColData[nJ];
|
||||||
|
*dataRow << v3d;
|
||||||
|
}
|
||||||
|
|
||||||
|
*data << dataRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pSeries->dataProxy()->resetArray(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Surface.setHorizontalAspectRatio(2.1);
|
|
||||||
m_Surface.setShadowQuality(QAbstract3DGraph::ShadowQuality::ShadowQualityNone);
|
m_Surface.setShadowQuality(QAbstract3DGraph::ShadowQuality::ShadowQualityNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +326,6 @@ void SurfaceDialog::OnWorkSpaceChanged(WorkSpace* worksapce) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(worksapce, &WorkSpace::TimestepChanged, this, &SurfaceDialog::OnTimestepChanged);
|
connect(worksapce, &WorkSpace::TimestepChanged, this, &SurfaceDialog::OnTimestepChanged);
|
||||||
InitRD(worksapce->GetRDPath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceDialog::OnTimestepChanged(Timestep* timestep) {
|
void SurfaceDialog::OnTimestepChanged(Timestep* timestep) {
|
||||||
@ -304,7 +336,6 @@ void SurfaceDialog::OnTimestepChanged(Timestep* timestep) {
|
|||||||
connect(timestep, SIGNAL(TimeChanged(double)), this, SLOT(slotUpdateTime(double)));
|
connect(timestep, SIGNAL(TimeChanged(double)), this, SLOT(slotUpdateTime(double)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SurfaceDialog::InitSurface()
|
void SurfaceDialog::InitSurface()
|
||||||
{
|
{
|
||||||
m_Surface.setFlags(m_Surface.flags());
|
m_Surface.setFlags(m_Surface.flags());
|
||||||
@ -322,9 +353,11 @@ void SurfaceDialog::InitSurface()
|
|||||||
m_p3DZAxis->setSegmentCount(10);
|
m_p3DZAxis->setSegmentCount(10);
|
||||||
m_p3DZAxis->setRange(-10, 10);
|
m_p3DZAxis->setRange(-10, 10);
|
||||||
|
|
||||||
m_Surface.setAxisX(m_p3DXAxis);
|
m_Surface.setAxisX(m_p3DXAxis);
|
||||||
m_Surface.setAxisY(m_p3DYAxis);
|
m_Surface.setAxisY(m_p3DYAxis);
|
||||||
m_Surface.setAxisZ(m_p3DZAxis);
|
m_Surface.setAxisZ(m_p3DZAxis);
|
||||||
|
|
||||||
|
m_Surface.activeTheme()->setType(Q3DTheme::Theme(2));
|
||||||
|
|
||||||
m_pSeries = new QSurface3DSeries;
|
m_pSeries = new QSurface3DSeries;
|
||||||
m_pSeries->setDrawMode(QSurface3DSeries::DrawSurface);
|
m_pSeries->setDrawMode(QSurface3DSeries::DrawSurface);
|
||||||
@ -339,70 +372,12 @@ void SurfaceDialog::InitSurface()
|
|||||||
QHBoxLayout* pLyt = new QHBoxLayout(this);
|
QHBoxLayout* pLyt = new QHBoxLayout(this);
|
||||||
pLyt->addWidget(containerHandle);
|
pLyt->addWidget(containerHandle);
|
||||||
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>ʽ
|
|
||||||
m_pSeries->setBaseColor(Qt::green);
|
m_pSeries->setBaseColor(Qt::green);
|
||||||
m_pSeries->setColorStyle(Q3DTheme::ColorStyleUniform);
|
m_pSeries->setColorStyle(Q3DTheme::ColorStyleUniform);
|
||||||
m_pSeries->setSingleHighlightColor(Qt::green);
|
m_pSeries->setSingleHighlightColor(Qt::green);
|
||||||
|
|
||||||
m_pSeries->setMeshSmooth(false); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ƽ<EFBFBD><C6BD>
|
m_pSeries->setMeshSmooth(false);
|
||||||
m_pSeries->setFlatShadingEnabled(false); // <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD>ɫ
|
m_pSeries->setFlatShadingEnabled(false);
|
||||||
}
|
|
||||||
|
m_Surface.scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPreset(13));
|
||||||
void SurfaceDialog::InitScatter()
|
|
||||||
{
|
|
||||||
m_Scatter.setFlags(m_Scatter.flags() ^ Qt::FramelessWindowHint);
|
|
||||||
QScatter3DSeries* series = new QScatter3DSeries;
|
|
||||||
QScatterDataArray data;
|
|
||||||
data << QVector3D(0.5f, 0.5f, 0.5f) << QVector3D(-0.3f, -0.5f, -0.4f) << QVector3D(0.0f, -0.3f, 0.2f);
|
|
||||||
series->dataProxy()->addItems(data);
|
|
||||||
m_Scatter.addSeries(series);
|
|
||||||
|
|
||||||
QWidget* container = QWidget::createWindowContainer(&m_Scatter);
|
|
||||||
|
|
||||||
QHBoxLayout* pLyt = new QHBoxLayout(this);
|
|
||||||
pLyt->addWidget(container);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SurfaceDialog::ParseRD(const QString& strFile, std::vector < std::vector<std::vector<float>>>& vecRDPoint, int iBatchCount, int iRowCount)
|
|
||||||
{
|
|
||||||
if (strFile.isEmpty())
|
|
||||||
{
|
|
||||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RD<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QFile file(strFile);
|
|
||||||
if (file.open(QIODevice::ReadOnly))
|
|
||||||
{
|
|
||||||
std::vector<std::vector<float>> vecBatch;
|
|
||||||
|
|
||||||
int iRow = 1;
|
|
||||||
while (!file.atEnd())
|
|
||||||
{
|
|
||||||
QString strLine = file.readLine().simplified();
|
|
||||||
if (!strLine.isEmpty())
|
|
||||||
{
|
|
||||||
QStringList listLine = strLine.split(" ");
|
|
||||||
std::vector<float> vecLine;
|
|
||||||
for (size_t i = 0; i < listLine.size(); i++)
|
|
||||||
{
|
|
||||||
vecLine.push_back(listLine[i].toFloat());
|
|
||||||
}
|
|
||||||
|
|
||||||
vecBatch.push_back(vecLine);
|
|
||||||
|
|
||||||
if (iRow % iRowCount == 0)
|
|
||||||
{
|
|
||||||
vecRDPoint.push_back(vecBatch);
|
|
||||||
vecBatch.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
iRow++;
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,26 +19,25 @@ public:
|
|||||||
|
|
||||||
void AttachDock(class DockWidget* dockWidget);
|
void AttachDock(class DockWidget* dockWidget);
|
||||||
|
|
||||||
void InitRD(const QString& strFile, int iBatch = 50, int iRowCount = 64);
|
void updateTitle(const QString& title);
|
||||||
|
void updateTitleAxis(const QString& xTitle, const QString& yTitle, const QString& zTitle);
|
||||||
|
void updateMinMaxX(float min, float max, int count);
|
||||||
|
void updateMinMaxY(float min, float max, int count);
|
||||||
|
void updateMinMaxZ(float min, float max, int count);
|
||||||
|
void updateParseFile(const QString& strFile, int nT, QVariantList listCurve);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotAddSeries(QVariant varSeriesData);
|
void slotUpdateTime(double t);
|
||||||
void slotInserKeyPoint(float xValue, float yValue, float zValue);
|
|
||||||
void slotUpdateTime(double dTime);
|
|
||||||
void OnWorkSpaceChanged(class WorkSpace*);
|
void OnWorkSpaceChanged(class WorkSpace*);
|
||||||
void OnTimestepChanged(class Timestep*);
|
void OnTimestepChanged(class Timestep*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InitSurface();
|
void InitSurface();
|
||||||
void InitScatter();
|
|
||||||
|
|
||||||
bool ParseRD(const QString& strFile, std::vector<std::vector<std::vector<float>>>& vecRDPoint, int iBatchCount = 50, int iRowCount = 64);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SurfaceDialog ui;
|
Ui::SurfaceDialog ui;
|
||||||
|
|
||||||
Q3DSurface m_Surface;
|
Q3DSurface m_Surface;
|
||||||
Q3DScatter m_Scatter;
|
|
||||||
|
|
||||||
QSurface3DSeries* m_pSeries;
|
QSurface3DSeries* m_pSeries;
|
||||||
|
|
||||||
@ -53,6 +52,7 @@ private:
|
|||||||
float m_iMinZ = 0;
|
float m_iMinZ = 0;
|
||||||
float m_iMaxZ = 10;
|
float m_iMaxZ = 10;
|
||||||
|
|
||||||
std::vector<std::vector<std::vector<float>>> m_vecRDPoint;
|
|
||||||
class DockTitleBar* m_pDockTitleBar { nullptr };
|
class DockTitleBar* m_pDockTitleBar { nullptr };
|
||||||
|
|
||||||
|
QMap< double, QMap< int, QVector< QVector<QVector3D> > > > m_data;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user