|
|
|
|
@ -4,6 +4,7 @@
|
|
|
|
|
#include "nmPebiResultPlaybackController.h"
|
|
|
|
|
#include "nmPebiResultPropertyDisplayText.h"
|
|
|
|
|
#include "nmPebiResultSceneController.h"
|
|
|
|
|
#include "nmVTKMeshLayer.h"
|
|
|
|
|
#include "nmWxPebiResultAnimationSettingsDlg.h"
|
|
|
|
|
#include "nmWxPebiResultColorScaleSettingsDlg.h"
|
|
|
|
|
|
|
|
|
|
@ -56,6 +57,7 @@ nmWxPebiResultControlBar::nmWxPebiResultControlBar(
|
|
|
|
|
: QWidget(pParent),
|
|
|
|
|
m_pPlaybackController(nullptr),
|
|
|
|
|
m_pSceneController(pSceneController),
|
|
|
|
|
m_pDisplayModeCombo(nullptr),
|
|
|
|
|
m_pPropertyCombo(nullptr),
|
|
|
|
|
m_pColorSettingsButton(nullptr),
|
|
|
|
|
m_pFirstButton(nullptr),
|
|
|
|
|
@ -125,6 +127,34 @@ void nmWxPebiResultControlBar::setExportInProgress(bool bInProgress)
|
|
|
|
|
refreshFromController();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxPebiResultControlBar::onDisplayModeIndexChanged(int nIndex)
|
|
|
|
|
{
|
|
|
|
|
if(m_pDisplayModeCombo == nullptr ||
|
|
|
|
|
!m_pDisplayModeCombo->isEnabled() ||
|
|
|
|
|
m_pPlaybackController == nullptr || m_pSceneController == nullptr ||
|
|
|
|
|
m_bExportInProgress || m_pPlaybackController->isPlaying() ||
|
|
|
|
|
!m_pSceneController->hasSnapshot() || nIndex < 0 ||
|
|
|
|
|
nIndex >= m_pDisplayModeCombo->count()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bConverted = false;
|
|
|
|
|
const int nMode = m_pDisplayModeCombo->itemData(nIndex).toInt(
|
|
|
|
|
&bConverted);
|
|
|
|
|
const nmVTKMeshLayer::DisplayMode eMode =
|
|
|
|
|
static_cast<nmVTKMeshLayer::DisplayMode>(
|
|
|
|
|
nMode);
|
|
|
|
|
if(!bConverted || !nmVTKMeshLayer::isValidDisplayMode(eMode)) {
|
|
|
|
|
refreshFromController();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(eMode == m_pSceneController->getMeshDisplayMode()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m_pSceneController->setMeshDisplayMode(eMode);
|
|
|
|
|
emit operationSucceeded();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxPebiResultControlBar::onPropertyIndexChanged(int nIndex)
|
|
|
|
|
{
|
|
|
|
|
if(m_pPlaybackController == nullptr || m_bExportInProgress ||
|
|
|
|
|
@ -252,6 +282,19 @@ void nmWxPebiResultControlBar::onExportAnimationTriggered()
|
|
|
|
|
|
|
|
|
|
void nmWxPebiResultControlBar::refreshFromController()
|
|
|
|
|
{
|
|
|
|
|
if(m_pDisplayModeCombo != nullptr && m_pSceneController != nullptr) {
|
|
|
|
|
const int nDisplayModeIndex = findItemByData(
|
|
|
|
|
m_pDisplayModeCombo,
|
|
|
|
|
QVariant(static_cast<int>(
|
|
|
|
|
m_pSceneController->getMeshDisplayMode())));
|
|
|
|
|
if(nDisplayModeIndex >= 0) {
|
|
|
|
|
const bool bDisplayModeBlocked =
|
|
|
|
|
m_pDisplayModeCombo->blockSignals(true);
|
|
|
|
|
m_pDisplayModeCombo->setCurrentIndex(nDisplayModeIndex);
|
|
|
|
|
m_pDisplayModeCombo->blockSignals(bDisplayModeBlocked);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 控件状态严格镜像四类 Scene 状态:无快照、静态、单帧动态、多帧动态。
|
|
|
|
|
const bool bAvailable = m_pPlaybackController != nullptr &&
|
|
|
|
|
m_pPlaybackController->isAvailable();
|
|
|
|
|
@ -263,6 +306,7 @@ void nmWxPebiResultControlBar::refreshFromController()
|
|
|
|
|
m_sDisplayedSnapshotId.clear();
|
|
|
|
|
m_nDisplayedBindingRevision = 0;
|
|
|
|
|
m_listDisplayedPropertyIds.clear();
|
|
|
|
|
m_pDisplayModeCombo->setEnabled(false);
|
|
|
|
|
m_pPropertyCombo->setEnabled(false);
|
|
|
|
|
m_pColorSettingsButton->setEnabled(false);
|
|
|
|
|
m_pFirstButton->setEnabled(false);
|
|
|
|
|
@ -336,6 +380,7 @@ void nmWxPebiResultControlBar::refreshFromController()
|
|
|
|
|
nFrameCount > 1;
|
|
|
|
|
const bool bPlaying = m_pPlaybackController->isPlaying();
|
|
|
|
|
const bool bLocked = bPlaying || m_bExportInProgress;
|
|
|
|
|
m_pDisplayModeCombo->setEnabled(!bLocked);
|
|
|
|
|
m_pPropertyCombo->setEnabled(!bLocked);
|
|
|
|
|
m_pColorSettingsButton->setEnabled(!bLocked);
|
|
|
|
|
m_pTimeCombo->setEnabled(bHasTime && !bLocked);
|
|
|
|
|
@ -382,6 +427,37 @@ void nmWxPebiResultControlBar::createUi()
|
|
|
|
|
pLayout->setContentsMargins(4, 3, 4, 3);
|
|
|
|
|
pLayout->setSpacing(4);
|
|
|
|
|
|
|
|
|
|
QLabel* pDisplayLabel = new QLabel(tr("Display"), this);
|
|
|
|
|
pDisplayLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
|
|
|
|
m_pDisplayModeCombo = new QComboBox(this);
|
|
|
|
|
m_pDisplayModeCombo->addItem(
|
|
|
|
|
tr("Point"),
|
|
|
|
|
QVariant(static_cast<int>(
|
|
|
|
|
nmVTKMeshLayer::DisplayMode_Point)));
|
|
|
|
|
m_pDisplayModeCombo->addItem(
|
|
|
|
|
tr("Wireframe"),
|
|
|
|
|
QVariant(static_cast<int>(
|
|
|
|
|
nmVTKMeshLayer::DisplayMode_Wireframe)));
|
|
|
|
|
m_pDisplayModeCombo->addItem(
|
|
|
|
|
tr("Surface"),
|
|
|
|
|
QVariant(static_cast<int>(
|
|
|
|
|
nmVTKMeshLayer::DisplayMode_Surface)));
|
|
|
|
|
m_pDisplayModeCombo->addItem(
|
|
|
|
|
tr("Contour"),
|
|
|
|
|
QVariant(static_cast<int>(
|
|
|
|
|
nmVTKMeshLayer::DisplayMode_SurfaceWithEdges)));
|
|
|
|
|
m_pDisplayModeCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
|
|
|
|
m_pDisplayModeCombo->setFixedHeight(24);
|
|
|
|
|
m_pDisplayModeCombo->setSizePolicy(
|
|
|
|
|
QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
|
|
|
const int nInitialDisplayModeIndex = findItemByData(
|
|
|
|
|
m_pDisplayModeCombo,
|
|
|
|
|
QVariant(static_cast<int>(
|
|
|
|
|
m_pSceneController->getMeshDisplayMode())));
|
|
|
|
|
if(nInitialDisplayModeIndex >= 0) {
|
|
|
|
|
m_pDisplayModeCombo->setCurrentIndex(nInitialDisplayModeIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QLabel* pPropertyLabel = new QLabel(tr("Property"), this);
|
|
|
|
|
pPropertyLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
|
|
|
|
|
|
|
|
|
@ -436,6 +512,9 @@ void nmWxPebiResultControlBar::createUi()
|
|
|
|
|
m_pExportButton->setIconSize(QSize(16, 16));
|
|
|
|
|
m_pExportButton->setDefaultAction(m_pExportAction);
|
|
|
|
|
|
|
|
|
|
pLayout->addWidget(pDisplayLabel, 0, Qt::AlignVCenter);
|
|
|
|
|
pLayout->addWidget(m_pDisplayModeCombo);
|
|
|
|
|
pLayout->addSpacing(CONTROL_GROUP_GAP);
|
|
|
|
|
pLayout->addWidget(pPropertyLabel, 0, Qt::AlignVCenter);
|
|
|
|
|
pLayout->addWidget(m_pPropertyCombo);
|
|
|
|
|
pLayout->addWidget(m_pColorSettingsButton);
|
|
|
|
|
@ -450,6 +529,8 @@ void nmWxPebiResultControlBar::createUi()
|
|
|
|
|
pLayout->addWidget(m_pExportButton);
|
|
|
|
|
pLayout->addStretch(1);
|
|
|
|
|
|
|
|
|
|
connect(m_pDisplayModeCombo, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
this, SLOT(onDisplayModeIndexChanged(int)));
|
|
|
|
|
connect(m_pPropertyCombo, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
this, SLOT(onPropertyIndexChanged(int)));
|
|
|
|
|
connect(m_pColorSettingsButton, SIGNAL(clicked()),
|
|
|
|
|
|