add
添加场景:3D植物表型,只涉及了部分界面
This commit is contained in:
119
HPPA/HPPA.cpp
119
HPPA/HPPA.cpp
@ -117,6 +117,7 @@ HPPA::HPPA(QWidget* parent)
|
|||||||
connect(this->ui.action_about, SIGNAL(triggered()), this, SLOT(onAbout()));
|
connect(this->ui.action_about, SIGNAL(triggered()), this, SLOT(onAbout()));
|
||||||
connect(this->ui.mActionOneMotorScenario, SIGNAL(triggered()), this, SLOT(createOneMotorScenario()));
|
connect(this->ui.mActionOneMotorScenario, SIGNAL(triggered()), this, SLOT(createOneMotorScenario()));
|
||||||
connect(this->ui.mActionPlantPhenotypeScenario, SIGNAL(triggered()), this, SLOT(createPlantPhenotypeScenario()));
|
connect(this->ui.mActionPlantPhenotypeScenario, SIGNAL(triggered()), this, SLOT(createPlantPhenotypeScenario()));
|
||||||
|
connect(this->ui.mAction3DPlantPhenotypeScenario, SIGNAL(triggered()), this, SLOT(create3DPlantPhenotypeScenario()));
|
||||||
connect(this->ui.mActionMicroscopicMotionControlScenario, SIGNAL(triggered()), this, SLOT(createMicroscopicMotionControlScenario()));
|
connect(this->ui.mActionMicroscopicMotionControlScenario, SIGNAL(triggered()), this, SLOT(createMicroscopicMotionControlScenario()));
|
||||||
|
|
||||||
delete ui.centralWidget;
|
delete ui.centralWidget;
|
||||||
@ -1013,6 +1014,13 @@ void HPPA::removeLayerByTreeIndex()
|
|||||||
if (!model) return;
|
if (!model) return;
|
||||||
|
|
||||||
LayerTreeNode* node = static_cast<LayerTreeNode*>(currentIndexTmp.internalPointer());
|
LayerTreeNode* node = static_cast<LayerTreeNode*>(currentIndexTmp.internalPointer());
|
||||||
|
if (!node || node->type() != LayerTreeNode::Type::Layer) return;
|
||||||
|
|
||||||
|
removeLayerByNode(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HPPA::removeLayerByNode(LayerTreeNode* node)
|
||||||
|
{
|
||||||
if (!node || node->type() != LayerTreeNode::Type::Layer) return;
|
if (!node || node->type() != LayerTreeNode::Type::Layer) return;
|
||||||
|
|
||||||
auto* layerNode = static_cast<LayerTreeLayer*>(node);
|
auto* layerNode = static_cast<LayerTreeLayer*>(node);
|
||||||
@ -1045,7 +1053,7 @@ void HPPA::removeLayerByTreeIndex()
|
|||||||
// 删除树模型中的节点
|
// 删除树模型中的节点
|
||||||
LayerTreeNode* parent = node->parentNode();
|
LayerTreeNode* parent = node->parentNode();
|
||||||
int row = node->rowInParent();
|
int row = node->rowInParent();
|
||||||
LayerTreeNode* removed = model->removeNode(parent, row);
|
LayerTreeNode* removed = m_LayerTreeModel->removeNode(parent, row);
|
||||||
if (removed)
|
if (removed)
|
||||||
{
|
{
|
||||||
delete removed;
|
delete removed;
|
||||||
@ -1130,46 +1138,7 @@ void HPPA::removeAllLayersInRasterGroup()
|
|||||||
pending.pop_back();
|
pending.pop_back();
|
||||||
if (!node) continue;
|
if (!node) continue;
|
||||||
|
|
||||||
for (int i = 0; i < node->childCount(); ++i)
|
removeLayerByNode(node);
|
||||||
{
|
|
||||||
pending.push_back(node->childAt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node->type() != LayerTreeNode::Type::Layer) continue;
|
|
||||||
|
|
||||||
auto* layerNode = static_cast<LayerTreeLayer*>(node);
|
|
||||||
MapLayer* mapLayer = layerNode->mapLayer();
|
|
||||||
QWidget* layerWidget = nullptr;
|
|
||||||
|
|
||||||
if (mapLayer && m_MapLayerStore)
|
|
||||||
{
|
|
||||||
layerWidget = m_MapLayerStore->widgetForLayer(mapLayer);
|
|
||||||
m_MapLayerStore->removeLayer(mapLayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (layerWidget && m_imageViewerTabWidget)
|
|
||||||
{
|
|
||||||
const int tabIndex = m_imageViewerTabWidget->indexOf(layerWidget);
|
|
||||||
if (tabIndex >= 0)
|
|
||||||
{
|
|
||||||
if (m_recordFrameCounter)
|
|
||||||
{
|
|
||||||
m_recordFrameCounter->removeCounter(layerWidget);
|
|
||||||
}
|
|
||||||
m_imageViewerTabWidget->removeTab(tabIndex);
|
|
||||||
}
|
|
||||||
layerWidget->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (m_RasterGroup->childCount() > 0)
|
|
||||||
{
|
|
||||||
const int row = m_RasterGroup->childCount() - 1;
|
|
||||||
LayerTreeNode* removed = m_LayerTreeModel->removeNode(m_RasterGroup, row);
|
|
||||||
if (removed)
|
|
||||||
{
|
|
||||||
delete removed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1265,6 +1234,7 @@ void HPPA::createScenarioActionGroup()
|
|||||||
m_ScenarioActionGroup = new QActionGroup(this);
|
m_ScenarioActionGroup = new QActionGroup(this);
|
||||||
m_ScenarioActionGroup->addAction(ui.mActionOneMotorScenario);
|
m_ScenarioActionGroup->addAction(ui.mActionOneMotorScenario);
|
||||||
m_ScenarioActionGroup->addAction(ui.mActionPlantPhenotypeScenario);
|
m_ScenarioActionGroup->addAction(ui.mActionPlantPhenotypeScenario);
|
||||||
|
m_ScenarioActionGroup->addAction(ui.mAction3DPlantPhenotypeScenario);
|
||||||
m_ScenarioActionGroup->addAction(ui.mActionMicroscopicMotionControlScenario);
|
m_ScenarioActionGroup->addAction(ui.mActionMicroscopicMotionControlScenario);
|
||||||
|
|
||||||
// 读取上次选择的结果
|
// 读取上次选择的结果
|
||||||
@ -1282,6 +1252,11 @@ void HPPA::createScenarioActionGroup()
|
|||||||
ui.mActionPlantPhenotypeScenario->setChecked(true);
|
ui.mActionPlantPhenotypeScenario->setChecked(true);
|
||||||
ui.mActionPlantPhenotypeScenario->trigger();
|
ui.mActionPlantPhenotypeScenario->trigger();
|
||||||
}
|
}
|
||||||
|
else if (lastSelectedAction == "mAction3DPlantPhenotypeScenario")
|
||||||
|
{
|
||||||
|
ui.mAction3DPlantPhenotypeScenario->setChecked(true);
|
||||||
|
ui.mAction3DPlantPhenotypeScenario->trigger();
|
||||||
|
}
|
||||||
else if (lastSelectedAction == "mActionMicroscopicMotionControlScenario")
|
else if (lastSelectedAction == "mActionMicroscopicMotionControlScenario")
|
||||||
{
|
{
|
||||||
ui.mActionMicroscopicMotionControlScenario->setChecked(true);
|
ui.mActionMicroscopicMotionControlScenario->setChecked(true);
|
||||||
@ -1317,14 +1292,10 @@ void HPPA::createOneMotorScenario()
|
|||||||
ui.mAction_1AxisMotor->setChecked(true);
|
ui.mAction_1AxisMotor->setChecked(true);
|
||||||
|
|
||||||
//右下角控制tab
|
//右下角控制tab
|
||||||
m_tabManager->hideTab(m_singleLensReflexCameraWindow);
|
m_tabManager->hideAllTabs();
|
||||||
m_tabManager->hideTab(m_depthCameraWindow);
|
|
||||||
m_tabManager->hideTab(m_rgbCameraControlWindow);
|
|
||||||
m_tabManager->hideTab(m_adt);
|
|
||||||
m_tabManager->hideTab(m_pc);
|
|
||||||
m_tabManager->hideTab(m_rac);
|
|
||||||
m_tabManager->hideTab(m_tmc);
|
|
||||||
|
|
||||||
|
m_tabManager->showTab(m_hic);
|
||||||
|
m_tabManager->showTab(m_ic);
|
||||||
m_tabManager->showTab(m_omc);
|
m_tabManager->showTab(m_omc);
|
||||||
|
|
||||||
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::OneMotor);
|
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::OneMotor);
|
||||||
@ -1352,12 +1323,37 @@ void HPPA::createPlantPhenotypeScenario()
|
|||||||
ui.mAction_2AxisMotor_new->setChecked(true);
|
ui.mAction_2AxisMotor_new->setChecked(true);
|
||||||
|
|
||||||
//右下角控制tab
|
//右下角控制tab
|
||||||
m_tabManager->hideTab(m_rac);
|
m_tabManager->hideAllTabs();
|
||||||
m_tabManager->hideTab(m_omc);
|
|
||||||
|
|
||||||
|
m_tabManager->showTab(m_hic);
|
||||||
|
m_tabManager->showTab(m_ic);
|
||||||
|
m_tabManager->showTab(m_rgbCameraControlWindow);
|
||||||
|
m_tabManager->showTab(m_adt);
|
||||||
|
m_tabManager->showTab(m_pc);
|
||||||
|
m_tabManager->showTab(m_tmc);
|
||||||
|
|
||||||
|
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::PlantPhenotype);
|
||||||
|
|
||||||
|
//右上角轮播
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HPPA::create3DPlantPhenotypeScenario()
|
||||||
|
{
|
||||||
|
//if (ui.mAction3DPlantPhenotypeScenario->isChecked())
|
||||||
|
// return;
|
||||||
|
|
||||||
|
//在菜单中选择移动平台
|
||||||
|
ui.mAction_2AxisMotor_new->setChecked(true);
|
||||||
|
|
||||||
|
//右下角控制tab
|
||||||
|
m_tabManager->hideAllTabs();
|
||||||
|
|
||||||
|
m_tabManager->showTab(m_hic);
|
||||||
|
m_tabManager->showTab(m_ic);
|
||||||
m_tabManager->showTab(m_depthCameraWindow);
|
m_tabManager->showTab(m_depthCameraWindow);
|
||||||
m_tabManager->showTab(m_singleLensReflexCameraWindow);
|
m_tabManager->showTab(m_singleLensReflexCameraWindow);
|
||||||
m_tabManager->showTab(m_rgbCameraControlWindow);
|
//m_tabManager->showTab(m_rgbCameraControlWindow);
|
||||||
m_tabManager->showTab(m_adt);
|
m_tabManager->showTab(m_adt);
|
||||||
m_tabManager->showTab(m_pc);
|
m_tabManager->showTab(m_pc);
|
||||||
m_tabManager->showTab(m_tmc);
|
m_tabManager->showTab(m_tmc);
|
||||||
@ -1377,14 +1373,10 @@ void HPPA::createMicroscopicMotionControlScenario()
|
|||||||
ui.mAction_2AxisMotor_new->setChecked(true);
|
ui.mAction_2AxisMotor_new->setChecked(true);
|
||||||
|
|
||||||
//右下角控制tab
|
//右下角控制tab
|
||||||
m_tabManager->hideTab(m_singleLensReflexCameraWindow);
|
m_tabManager->hideAllTabs();
|
||||||
m_tabManager->hideTab(m_depthCameraWindow);
|
|
||||||
m_tabManager->hideTab(m_rgbCameraControlWindow);
|
|
||||||
m_tabManager->hideTab(m_adt);
|
|
||||||
m_tabManager->hideTab(m_pc);
|
|
||||||
m_tabManager->hideTab(m_rac);
|
|
||||||
m_tabManager->hideTab(m_omc);
|
|
||||||
|
|
||||||
|
m_tabManager->showTab(m_hic);
|
||||||
|
m_tabManager->showTab(m_ic);
|
||||||
m_tabManager->showTab(m_tmc);
|
m_tabManager->showTab(m_tmc);
|
||||||
|
|
||||||
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::MicroscopicMotionControl);
|
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::MicroscopicMotionControl);
|
||||||
@ -2413,6 +2405,9 @@ void HPPA::onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QSt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ui.mAction3DPlantPhenotypeScenario->isChecked())
|
||||||
|
return;
|
||||||
|
|
||||||
//return;
|
//return;
|
||||||
//获取绘图控件
|
//获取绘图控件
|
||||||
QWidget* currentWidget = m_MapLayerStore->widgetForLayer(filePath);
|
QWidget* currentWidget = m_MapLayerStore->widgetForLayer(filePath);
|
||||||
@ -2606,8 +2601,16 @@ void WorkerThread3::run()
|
|||||||
void HPPA::onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex)
|
void HPPA::onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex)
|
||||||
{
|
{
|
||||||
if (!m_LayerTreeModel || !m_RasterGroup) return;
|
if (!m_LayerTreeModel || !m_RasterGroup) return;
|
||||||
|
|
||||||
|
if (ui.mAction3DPlantPhenotypeScenario->isChecked())
|
||||||
|
{
|
||||||
|
addLayer(baseName, filePath, false, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
addLayer(baseName, filePath, false);
|
addLayer(baseName, filePath, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HPPA::addLayer(const QString& baseName, const QString& filePath,bool refresh, bool isAddImage)
|
void HPPA::addLayer(const QString& baseName, const QString& filePath,bool refresh, bool isAddImage)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -369,6 +369,7 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
void createOneMotorScenario();
|
void createOneMotorScenario();
|
||||||
void createPlantPhenotypeScenario();
|
void createPlantPhenotypeScenario();
|
||||||
|
void create3DPlantPhenotypeScenario();
|
||||||
void onCreated3DModelPlantPhenotype();
|
void onCreated3DModelPlantPhenotype();
|
||||||
void onCreated3DModelMicroscopicMotion();
|
void onCreated3DModelMicroscopicMotion();
|
||||||
void createMicroscopicMotionControlScenario();
|
void createMicroscopicMotionControlScenario();
|
||||||
@ -378,6 +379,7 @@ public Q_SLOTS:
|
|||||||
void newImage(RasterLayer* ml, RasterImageLayer::RendererType, LayerTreeNode* parent, bool refresh=true);
|
void newImage(RasterLayer* ml, RasterImageLayer::RendererType, LayerTreeNode* parent, bool refresh=true);
|
||||||
void onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex);
|
void onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex);
|
||||||
void removeLayerByTreeIndex();
|
void removeLayerByTreeIndex();
|
||||||
|
void removeLayerByNode(LayerTreeNode* node);
|
||||||
void showColorImageByTreeIndex();
|
void showColorImageByTreeIndex();
|
||||||
void removeImageByTreeIndex();
|
void removeImageByTreeIndex();
|
||||||
void removeAllLayersInRasterGroup();
|
void removeAllLayersInRasterGroup();
|
||||||
|
|||||||
@ -134,6 +134,7 @@ color:white;
|
|||||||
<addaction name="mActionOneMotorScenario"/>
|
<addaction name="mActionOneMotorScenario"/>
|
||||||
<addaction name="mActionPlantPhenotypeScenario"/>
|
<addaction name="mActionPlantPhenotypeScenario"/>
|
||||||
<addaction name="mActionMicroscopicMotionControlScenario"/>
|
<addaction name="mActionMicroscopicMotionControlScenario"/>
|
||||||
|
<addaction name="mAction3DPlantPhenotypeScenario"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_4">
|
<widget class="QMenu" name="menu_4">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -734,6 +735,14 @@ QPushButton:pressed
|
|||||||
<string>显微运动控制台</string>
|
<string>显微运动控制台</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="mAction3DPlantPhenotypeScenario">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>3D植物表型</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|||||||
@ -7,6 +7,24 @@ TabManager::TabManager(QTabWidget* tabWidget, QObject* parent)
|
|||||||
Q_ASSERT(m_tabWidget);
|
Q_ASSERT(m_tabWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabManager::hideAllTabs()
|
||||||
|
{
|
||||||
|
int tabNumber = m_tabWidget->count();
|
||||||
|
for (size_t i = 0; i < tabNumber; i++)
|
||||||
|
{
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
TabInfo info;
|
||||||
|
info.index = idx;
|
||||||
|
info.text = m_tabWidget->tabText(idx);
|
||||||
|
info.icon = m_tabWidget->tabIcon(idx);
|
||||||
|
info.toolTip = m_tabWidget->tabToolTip(idx);
|
||||||
|
|
||||||
|
m_hiddenTabs.insert(m_tabWidget->widget(idx), info);
|
||||||
|
m_tabWidget->removeTab(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TabManager::hideTab(QWidget* page)
|
void TabManager::hideTab(QWidget* page)
|
||||||
{
|
{
|
||||||
if (!page || !m_tabWidget)
|
if (!page || !m_tabWidget)
|
||||||
|
|||||||
@ -10,6 +10,7 @@ class TabManager : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit TabManager(QTabWidget* tabWidget, QObject* parent = nullptr);
|
explicit TabManager(QTabWidget* tabWidget, QObject* parent = nullptr);
|
||||||
|
|
||||||
|
void hideAllTabs();
|
||||||
void hideTab(QWidget* page);
|
void hideTab(QWidget* page);
|
||||||
void showTab(QWidget* page);
|
void showTab(QWidget* page);
|
||||||
bool isHidden(QWidget* page) const;
|
bool isHidden(QWidget* page) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user