modified surface

This commit is contained in:
pimin 2025-11-15 20:47:53 +08:00
parent 9404f9f2b4
commit 4fb15b371b
2 changed files with 47 additions and 0 deletions

View File

@ -25,6 +25,7 @@ SurfacePanel::SurfacePanel(int index, const QString& filePath, QWidget* parent)
m_countY = 0; m_countY = 0;
m_countZ = 0; m_countZ = 0;
m_title = "";
m_xTitle = ""; m_xTitle = "";
m_yTitle = ""; m_yTitle = "";
m_zTitle = ""; m_zTitle = "";
@ -32,6 +33,7 @@ SurfacePanel::SurfacePanel(int index, const QString& filePath, QWidget* parent)
m_time = -1.0; m_time = -1.0;
m_thread = nullptr; m_thread = nullptr;
m_mutex = nullptr;
LOG_INFO("Created SurfacePanel {} for file: {}", index, filePath.toStdString()); LOG_INFO("Created SurfacePanel {} for file: {}", index, filePath.toStdString());
} }
@ -54,6 +56,7 @@ SurfacePanel::SurfacePanel(int index, std::shared_ptr<FileEntrySurface> fileEntr
m_countY = 0; m_countY = 0;
m_countZ = 0; m_countZ = 0;
m_title = "";
m_xTitle = ""; m_xTitle = "";
m_yTitle = ""; m_yTitle = "";
m_zTitle = ""; m_zTitle = "";
@ -61,6 +64,7 @@ SurfacePanel::SurfacePanel(int index, std::shared_ptr<FileEntrySurface> fileEntr
m_time = -1.0; m_time = -1.0;
m_thread = nullptr; m_thread = nullptr;
m_mutex = nullptr;
if (fileEntry) { if (fileEntry) {
LOG_INFO("Created SurfacePanel {} for chart: {}", index, fileEntry->GetName().toStdString()); LOG_INFO("Created SurfacePanel {} for chart: {}", index, fileEntry->GetName().toStdString());
@ -152,6 +156,11 @@ QString SurfacePanel::GetTypeDisplayName() const
void SurfacePanel::OnDataPanelUpdated(FileEntrySurface* fileEntry) void SurfacePanel::OnDataPanelUpdated(FileEntrySurface* fileEntry)
{ {
if (!m_surfaceContainer)
{
createSurface();
}
QString strName = fileEntry->GetName(); QString strName = fileEntry->GetName();
updateTitle(strName); updateTitle(strName);
@ -219,8 +228,13 @@ void SurfacePanel::updateTitle(const QString & title)
{ {
if (nullptr != dockWidget_) if (nullptr != dockWidget_)
{ {
m_title = title;
dockWidget_->setWindowTitle(title); dockWidget_->setWindowTitle(title);
disconnect(dockWidget_, &QDockWidget::visibilityChanged,
this, &SurfacePanel::onVisibilityChanged);
connect(dockWidget_, &QDockWidget::visibilityChanged, connect(dockWidget_, &QDockWidget::visibilityChanged,
this, &SurfacePanel::onVisibilityChanged); this, &SurfacePanel::onVisibilityChanged);
} }
@ -328,6 +342,10 @@ void SurfacePanel::updateParseFile(const QString & strFile, int nT, FileEntrySur
} }
m_thread = new LoadDataThread(this, strFile, nT, listCurve); m_thread = new LoadDataThread(this, strFile, nT, listCurve);
connect(m_thread, &LoadDataThread::signalBeginLoadData,
this, &SurfacePanel::slotBeginLoadData);
connect(m_thread, &LoadDataThread::signalEndLoadData,
this, &SurfacePanel::slotEndLoadData);
m_thread->setMutex(m_mutex); m_thread->setMutex(m_mutex);
m_thread->start(); m_thread->start();
@ -476,6 +494,23 @@ void SurfacePanel::createSurface()
m_surface->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPreset(13)); m_surface->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPreset(13));
} }
void SurfacePanel::slotBeginLoadData()
{
if (nullptr != dockWidget_)
{
QString title = m_title + " -- " + QString(tr("Begin LoadData"));
dockWidget_->setWindowTitle(title);
}
}
void SurfacePanel::slotEndLoadData()
{
if (nullptr != dockWidget_)
{
dockWidget_->setWindowTitle(m_title);
}
}
void SurfacePanel::FinalParseFile() void SurfacePanel::FinalParseFile()
{ {
if (m_iMaxX == m_iMinX) if (m_iMaxX == m_iMinX)
@ -510,6 +545,8 @@ void LoadDataThread::run()
QFile file(m_file); QFile file(m_file);
if (file.open(QIODevice::ReadOnly)) if (file.open(QIODevice::ReadOnly))
{ {
emit signalBeginLoadData();
while (!file.atEnd() && !m_exit) while (!file.atEnd() && !m_exit)
{ {
QString strLine = file.readLine().simplified(); QString strLine = file.readLine().simplified();
@ -625,5 +662,7 @@ void LoadDataThread::run()
} }
file.close(); file.close();
emit signalEndLoadData();
} }
} }

View File

@ -78,6 +78,9 @@ private:
void onVisibilityChanged(bool visible); void onVisibilityChanged(bool visible);
void createSurface(); void createSurface();
void slotBeginLoadData();
void slotEndLoadData();
private: private:
Q3DSurface *m_surface; Q3DSurface *m_surface;
QWidget *m_surfaceContainer; QWidget *m_surfaceContainer;
@ -99,6 +102,7 @@ private:
int m_countY; int m_countY;
int m_countZ; int m_countZ;
QString m_title;
QString m_xTitle; QString m_xTitle;
QString m_yTitle; QString m_yTitle;
QString m_zTitle; QString m_zTitle;
@ -130,6 +134,10 @@ public:
void requestExit() { m_exit = true; } void requestExit() { m_exit = true; }
signals:
void signalBeginLoadData();
void signalEndLoadData();
private: private:
SurfacePanel *m_panel; SurfacePanel *m_panel;
QString m_file; QString m_file;