初步实现场景切换
This commit is contained in:
194
HPPA/HPPA.cpp
194
HPPA/HPPA.cpp
@ -105,6 +105,7 @@ HPPA::HPPA(QWidget* parent)
|
||||
setDockNestingEnabled(true);
|
||||
connect(this->ui.action_about, SIGNAL(triggered()), this, SLOT(onAbout()));
|
||||
connect(this->ui.mActionOneMotorScenario, SIGNAL(triggered()), this, SLOT(createOneMotorScenario()));
|
||||
connect(this->ui.mActionPlantPhenotypeScenario, SIGNAL(triggered()), this, SLOT(createPlantPhenotypeScenario()));
|
||||
|
||||
delete ui.centralWidget;
|
||||
|
||||
@ -125,10 +126,6 @@ HPPA::HPPA(QWidget* parent)
|
||||
ui.mDockWidgetSimulator->setTile(QString::fromLocal8Bit("3Dģ<EFBFBD><EFBFBD>"));
|
||||
ui.mDockWidgetSpectrometer->setTile(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
m_view3D_tmp = new View3D("D:\\cpp_project_vs2022\\HPPA\\x64\\Debug\\3DModel\\HPPA_frame.obj", "D:\\cpp_project_vs2022\\HPPA\\x64\\Debug\\3DModel\\HPPA_camera.obj");
|
||||
|
||||
ui.mDockWidgetSimulator->setWidget(m_view3D_tmp);
|
||||
|
||||
//TOC
|
||||
CustomDockWidgetBase* dock_layers = new CustomDockWidgetBase(QString::fromLocal8Bit("layers"), this);
|
||||
dock_layers->setObjectName("mDockLayers");
|
||||
@ -314,8 +311,8 @@ HPPA::HPPA(QWidget* parent)
|
||||
|
||||
m_carousel->addWidget(sa);
|
||||
m_carousel->addWidget(new QLabel("1"));
|
||||
m_carousel->addWidget(new QLabel("2"));
|
||||
m_carousel->addWidget(new QLabel("3"));
|
||||
//m_carousel->addWidget(new QLabel("2"));
|
||||
//m_carousel->addWidget(new QLabel("3"));
|
||||
//m_carousel->addWidget(new QLabel("4"));
|
||||
//m_carousel->addWidget(new QLabel("5"));
|
||||
//m_carousel->addWidget(new QLabel("6"));
|
||||
@ -334,6 +331,7 @@ HPPA::HPPA(QWidget* parent)
|
||||
m_dock_carousel->setWidget(m_carousel);
|
||||
|
||||
initControlTabwidget();
|
||||
m_tabManager = new TabManager(ui.controlTabWidget, this);
|
||||
|
||||
|
||||
splitDockWidget(dock_layers, dock_hyperimgViewer, Qt::Horizontal);
|
||||
@ -393,6 +391,9 @@ HPPA::HPPA(QWidget* parent)
|
||||
createMoveplatformActionGroup();
|
||||
connect(moveplatformActionGroup, &QActionGroup::triggered, this, &HPPA::selectingMoveplatform);
|
||||
|
||||
createScenarioActionGroup();
|
||||
connect(m_ScenarioActionGroup, &QActionGroup::triggered, this, &HPPA::selectScenario);
|
||||
|
||||
ui.mDockWidgetSimulator->setFeatures(QDockWidget::DockWidgetClosable);
|
||||
|
||||
QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini";
|
||||
@ -522,8 +523,8 @@ void HPPA::initControlTabwidget()
|
||||
{
|
||||
ui.controlTabWidget->removeTab(1);
|
||||
|
||||
QWidget* videoWidget = new QWidget();
|
||||
QVBoxLayout* vBoxLayout_videoWidget = new QVBoxLayout(videoWidget);
|
||||
m_videoWidget = new QWidget();
|
||||
QVBoxLayout* vBoxLayout_videoWidget = new QVBoxLayout(m_videoWidget);
|
||||
|
||||
vBoxLayout_videoWidget->setSpacing(6);
|
||||
vBoxLayout_videoWidget->setObjectName(QString::fromUtf8("vBoxLayout_videoWidget"));
|
||||
@ -550,37 +551,36 @@ void HPPA::initControlTabwidget()
|
||||
connect(m_close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
|
||||
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SLOT(onClearLabel()));
|
||||
|
||||
ui.controlTabWidget->addTab(videoWidget, QString::fromLocal8Bit("rgb<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
ui.controlTabWidget->addTab(m_videoWidget, QString::fromLocal8Bit("rgb<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dock
|
||||
adjustTable* adt = new adjustTable();
|
||||
adt->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(adt, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
m_adt = new adjustTable();
|
||||
m_adt->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(m_adt, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
|
||||
//<2F><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>
|
||||
PowerControl* pc = new PowerControl();
|
||||
pc->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(pc, QString::fromLocal8Bit("<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
m_pc = new PowerControl();
|
||||
m_pc->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(m_pc, QString::fromLocal8Bit("<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
//<2F><>е<EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD>
|
||||
rac = new RobotArmControl();
|
||||
connect(rac->robotController, SIGNAL(hsiRecordSignal(int)), this, SLOT(recordFromRobotArm(int)));
|
||||
rac->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(rac, QString::fromLocal8Bit("<EFBFBD><EFBFBD>е<EFBFBD>ۿ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
m_rac = new RobotArmControl();
|
||||
connect(m_rac->robotController, SIGNAL(hsiRecordSignal(int)), this, SLOT(recordFromRobotArm(int)));
|
||||
m_rac->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(m_rac, QString::fromLocal8Bit("<EFBFBD><EFBFBD>е<EFBFBD>ۿ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
omc = new OneMotorControl();
|
||||
omc->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(omc, QString::fromLocal8Bit("1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
m_omc = new OneMotorControl();
|
||||
m_omc->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(m_omc, QString::fromLocal8Bit("1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
//2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
tmc = new TwoMotorControl(this);
|
||||
connect(tmc, SIGNAL(startLineNumSignal(int)), this, SLOT(onCreateTab(int)));
|
||||
connect(tmc, SIGNAL(sequenceComplete()), this, SLOT(onsequenceComplete()));
|
||||
connect(tmc, SIGNAL(broadcastLocationSignal(std::vector<double>)), m_view3D_tmp, SLOT(setLoc(std::vector<double>)));
|
||||
tmc->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(tmc, QString::fromLocal8Bit("2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
m_tmc = new TwoMotorControl(this);
|
||||
connect(m_tmc, SIGNAL(startLineNumSignal(int)), this, SLOT(onCreateTab(int)));
|
||||
connect(m_tmc, SIGNAL(sequenceComplete()), this, SLOT(onsequenceComplete()));
|
||||
m_tmc->setWindowFlags(Qt::Widget);
|
||||
ui.controlTabWidget->addTab(m_tmc, QString::fromLocal8Bit("2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
}
|
||||
|
||||
void HPPA::recordFromRobotArm(int fileCounter)
|
||||
@ -726,35 +726,103 @@ void HPPA::initPanelToolbar()
|
||||
mToolbarMenu->addAction(ui.mainToolBar->toggleViewAction());
|
||||
}
|
||||
|
||||
void HPPA::createOneMotorScenario()
|
||||
void HPPA::createScenarioActionGroup()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DockWidget
|
||||
//this->removeDockWidget(ui.mDockWidgetSpectrometer);
|
||||
QList<QDockWidget*> dockWidgets = this->findChildren<QDockWidget*>();
|
||||
for (QDockWidget* dock : dockWidgets)
|
||||
m_ScenarioActionGroup = new QActionGroup(this);
|
||||
m_ScenarioActionGroup->addAction(ui.mActionOneMotorScenario);
|
||||
m_ScenarioActionGroup->addAction(ui.mActionPlantPhenotypeScenario);
|
||||
|
||||
// <20><>ȡ<EFBFBD>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||
QSettings settings;
|
||||
QString lastSelectedAction = settings.value("LastSelectedScenario").toString();
|
||||
|
||||
// <20>ָ<EFBFBD><D6B8>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||
if (lastSelectedAction == "mActionOneMotorScenario")
|
||||
{
|
||||
dock->hide();
|
||||
ui.mActionOneMotorScenario->setChecked(true);
|
||||
ui.mActionOneMotorScenario->trigger();
|
||||
}
|
||||
else if (lastSelectedAction == "mActionPlantPhenotypeScenario")
|
||||
{
|
||||
ui.mActionPlantPhenotypeScenario->setChecked(true);
|
||||
ui.mActionPlantPhenotypeScenario->trigger();
|
||||
}
|
||||
}
|
||||
|
||||
ui.mDockWidgetSpectrometer->show();
|
||||
void HPPA::selectScenario(QAction* selectedAction)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("LastSelectedScenario", selectedAction->objectName());
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//tabifyDockWidget(ui.mDockWidgetSpectrometer, dock_omc);
|
||||
void HPPA::createOneMotorScenario()
|
||||
{
|
||||
//if (ui.mActionOneMotorScenario->isChecked())
|
||||
// return;
|
||||
|
||||
//addDockWidget(Qt::RightDockWidgetArea, ui.mDockWidgetSpectrometer);
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DockWidget
|
||||
//QList<QDockWidget*> dockWidgets = this->findChildren<QDockWidget*>();
|
||||
//for (QDockWidget* dock : dockWidgets)
|
||||
//{
|
||||
// dock->hide();
|
||||
//}
|
||||
|
||||
//QDockWidget* dockTop = new QDockWidget(QString::fromLocal8Bit("1"), this);
|
||||
//QDockWidget* dockBottom = new QDockWidget(QString::fromLocal8Bit("2"), this);
|
||||
//QDockWidget* dockBottom3 = new QDockWidget(QString::fromLocal8Bit("3"), this);
|
||||
//<EFBFBD>ڲ˵<EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>ƽ̨
|
||||
ui.mAction_1AxisMotor->setChecked(true);
|
||||
|
||||
//// <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> dock
|
||||
//addDockWidget(Qt::RightDockWidgetArea, dockTop);
|
||||
//<2F><><EFBFBD>½ǿ<EFBFBD><EFBFBD><EFBFBD>tab
|
||||
m_tabManager->hideTab(m_videoWidget);
|
||||
m_tabManager->hideTab(m_adt);
|
||||
m_tabManager->hideTab(m_pc);
|
||||
m_tabManager->hideTab(m_rac);
|
||||
m_tabManager->hideTab(m_tmc);
|
||||
|
||||
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD> dock<63><6B><EFBFBD><EFBFBD>ʼҲ<CABC><D2B2><EFBFBD>Ҳ<EFBFBD>
|
||||
//addDockWidget(Qt::RightDockWidgetArea, dockBottom);
|
||||
//addDockWidget(Qt::RightDockWidgetArea, dockBottom3);
|
||||
m_tabManager->showTab(m_omc);
|
||||
|
||||
//<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>3Dģ<EFBFBD><EFBFBD>
|
||||
QString basePath = QCoreApplication::applicationDirPath();
|
||||
QString model1 = basePath + "/3DModel/linear_stage_indoor1.obj";
|
||||
QString model2 = basePath + "/3DModel/linear_stage_indoor2.obj";
|
||||
m_view3DLinearStage = new View3DLinearStage(model1, model2);
|
||||
m_view3DLinearStage->setViewCenter(500, 100, 500);
|
||||
m_view3DLinearStage->setDistance(1000);
|
||||
ui.mDockWidgetSimulator->setWidget(m_view3DLinearStage);
|
||||
connect(m_omc, SIGNAL(broadcastLocationSignal(std::vector<double>)), m_view3DLinearStage, SLOT(setLoc(std::vector<double>)));
|
||||
|
||||
//<2F><><EFBFBD>Ͻ<EFBFBD><CFBD>ֲ<EFBFBD>
|
||||
|
||||
}
|
||||
|
||||
void HPPA::createPlantPhenotypeScenario()
|
||||
{
|
||||
//if (ui.mActionPlantPhenotypeScenario->isChecked())
|
||||
// return;
|
||||
|
||||
//<2F>ڲ˵<DAB2><CBB5><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ƶ<EFBFBD>ƽ̨
|
||||
ui.mAction_2AxisMotor_new->setChecked(true);
|
||||
|
||||
//<2F><><EFBFBD>½ǿ<C2BD><C7BF><EFBFBD>tab
|
||||
m_tabManager->hideTab(m_rac);
|
||||
m_tabManager->hideTab(m_omc);
|
||||
|
||||
m_tabManager->showTab(m_videoWidget);
|
||||
m_tabManager->showTab(m_adt);
|
||||
m_tabManager->showTab(m_pc);
|
||||
m_tabManager->showTab(m_tmc);
|
||||
|
||||
//<2F><EFBFBD>Ӧ<EFBFBD><D3A6>3Dģ<44><C4A3>
|
||||
QString basePath = QCoreApplication::applicationDirPath();
|
||||
QString model1 = basePath + "/3DModel/HPPA_frame.obj";
|
||||
QString model2 = basePath + "/3DModel/HPPA_camera.obj";
|
||||
m_view3DPlantPhenotype = new View3DPlantPhenotype(model1, model2);
|
||||
m_view3DPlantPhenotype->setViewCenter(1000, 1000, -1000);
|
||||
m_view3DPlantPhenotype->setDistance(5000);
|
||||
ui.mDockWidgetSimulator->setWidget(m_view3DPlantPhenotype);
|
||||
connect(m_tmc, SIGNAL(broadcastLocationSignal(std::vector<double>)), m_view3DPlantPhenotype, SLOT(setLoc(std::vector<double>)));
|
||||
|
||||
//<2F><><EFBFBD>Ͻ<EFBFBD><CFBD>ֲ<EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD> dock <20>ָ<D6B8><EEB5BD><EFBFBD><EFBFBD> dock <20><><EFBFBD>·<EFBFBD>
|
||||
//splitDockWidget(dockTop, dockBottom, Qt::Horizontal);
|
||||
}
|
||||
|
||||
void HPPA::CalculateIntegratioinTimeRange()
|
||||
@ -854,12 +922,12 @@ void HPPA::onStartRecordStep1()
|
||||
//Ӧ<><D3A6><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٿ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Dzɼ<C7B2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC>źţ<C5BA>
|
||||
m_Imager->setFileName2Save(imgPath);
|
||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||
omc->setImager(m_Imager);
|
||||
omc->run();
|
||||
m_omc->setImager(m_Imager);
|
||||
m_omc->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
omc->stop();
|
||||
m_omc->stop();
|
||||
m_RecordState -= 1;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
@ -877,16 +945,16 @@ void HPPA::onStartRecordStep1()
|
||||
|
||||
m_Imager->setFileName2Save(imgPath);
|
||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||
tmc->setImager(m_Imager);
|
||||
tmc->setPosFileName(QString::fromStdString(x_location));
|
||||
tmc->run();
|
||||
m_tmc->setImager(m_Imager);
|
||||
m_tmc->setPosFileName(QString::fromStdString(x_location));
|
||||
m_tmc->run();
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("ֹͣ<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
tmc->stop();
|
||||
m_tmc->stop();
|
||||
|
||||
m_RecordState--;
|
||||
|
||||
@ -901,7 +969,7 @@ void HPPA::onStartRecordStep1()
|
||||
//<2F><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>к<EFBFBD><D0BA><EFBFBD>RobotArmControl::executeTask<73><6B><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾbug
|
||||
m_Imager->setFileName2Save(imgPath);
|
||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||
rac->executeTaskWithHyperImager();
|
||||
m_rac->executeTaskWithHyperImager();
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1439,13 +1507,13 @@ void HPPA::onDark()
|
||||
}
|
||||
else if (checkedName == "mAction_1AxisMotor")
|
||||
{
|
||||
omc->setImager(m_Imager);
|
||||
omc->record_dark();
|
||||
m_omc->setImager(m_Imager);
|
||||
m_omc->record_dark();
|
||||
}
|
||||
else if (checkedName == "mAction_2AxisMotor_new")
|
||||
{
|
||||
tmc->setImager(m_Imager);
|
||||
tmc->record_dark();
|
||||
m_tmc->setImager(m_Imager);
|
||||
m_tmc->record_dark();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1469,13 +1537,13 @@ void HPPA::onReference()
|
||||
}
|
||||
else if (checkedName == "mAction_1AxisMotor")
|
||||
{
|
||||
omc->setImager(m_Imager);
|
||||
omc->record_white();
|
||||
m_omc->setImager(m_Imager);
|
||||
m_omc->record_white();
|
||||
}
|
||||
else if (checkedName == "mAction_2AxisMotor_new")
|
||||
{
|
||||
tmc->setImager(m_Imager);
|
||||
tmc->record_white();
|
||||
m_tmc->setImager(m_Imager);
|
||||
m_tmc->record_white();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
24
HPPA/HPPA.h
24
HPPA/HPPA.h
@ -47,6 +47,7 @@
|
||||
#include "Carousel.h"
|
||||
|
||||
#include "View3D.h"
|
||||
#include "TabManager.h"
|
||||
|
||||
#define PI 3.1415926
|
||||
|
||||
@ -218,13 +219,16 @@ private:
|
||||
QActionGroup* mImagerGroup = nullptr;
|
||||
void createActionGroups();
|
||||
void selectingImager(QAction* selectedAction);
|
||||
|
||||
QActionGroup* moveplatformActionGroup = nullptr;
|
||||
void createMoveplatformActionGroup();
|
||||
void selectingMoveplatform(QAction* selectedAction);
|
||||
RobotArmControl* rac;
|
||||
|
||||
OneMotorControl* omc;
|
||||
TwoMotorControl* tmc;
|
||||
QActionGroup* m_ScenarioActionGroup = nullptr;
|
||||
void createScenarioActionGroup();
|
||||
void selectScenario(QAction* selectedAction);
|
||||
|
||||
|
||||
|
||||
FILE* m_hTimesFile;
|
||||
|
||||
@ -235,7 +239,18 @@ private:
|
||||
QPushButton* m_open_rgb_camera_btn;
|
||||
QPushButton* m_close_rgb_camera_btn;
|
||||
|
||||
View3D* m_view3D_tmp;
|
||||
View3DPlantPhenotype* m_view3DPlantPhenotype;
|
||||
View3DLinearStage* m_view3DLinearStage;
|
||||
|
||||
TabManager* m_tabManager;
|
||||
|
||||
QWidget* m_videoWidget;
|
||||
adjustTable* m_adt;
|
||||
PowerControl* m_pc;
|
||||
RobotArmControl* m_rac;
|
||||
OneMotorControl* m_omc;
|
||||
TwoMotorControl* m_tmc;
|
||||
|
||||
|
||||
public Q_SLOTS:
|
||||
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber);
|
||||
@ -288,6 +303,7 @@ public Q_SLOTS:
|
||||
void recordFromRobotArm(int fileCounter);
|
||||
|
||||
void createOneMotorScenario();
|
||||
void createPlantPhenotypeScenario();
|
||||
signals:
|
||||
void StartFocusSignal();
|
||||
void StartRecordSignal();
|
||||
|
||||
14
HPPA/HPPA.ui
14
HPPA/HPPA.ui
@ -151,11 +151,7 @@ color:white;
|
||||
<string>应用场景</string>
|
||||
</property>
|
||||
<addaction name="mActionOneMotorScenario"/>
|
||||
<addaction name="action_8"/>
|
||||
<addaction name="action2"/>
|
||||
<addaction name="action_7"/>
|
||||
<addaction name="action_3"/>
|
||||
<addaction name="action_6"/>
|
||||
<addaction name="mActionPlantPhenotypeScenario"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_4">
|
||||
<property name="title">
|
||||
@ -722,6 +718,9 @@ QToolBar QToolButton:hover {
|
||||
</property>
|
||||
</action>
|
||||
<action name="mActionOneMotorScenario">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>室内1轴线性平台</string>
|
||||
</property>
|
||||
@ -771,7 +770,10 @@ QToolBar QToolButton:hover {
|
||||
<string>拼接</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_3">
|
||||
<action name="mActionPlantPhenotypeScenario">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>植物表型</string>
|
||||
</property>
|
||||
|
||||
@ -127,6 +127,7 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TabManager.cpp" />
|
||||
<ClCompile Include="TwoMotorControl.cpp" />
|
||||
<ClCompile Include="utility_tc.cpp" />
|
||||
<ClCompile Include="View3D.cpp" />
|
||||
@ -176,6 +177,7 @@
|
||||
<ClInclude Include="irisximeaimager.h" />
|
||||
<QtMoc Include="OneMotorControl.h" />
|
||||
<QtMoc Include="TwoMotorControl.h" />
|
||||
<QtMoc Include="TabManager.h" />
|
||||
<ClInclude Include="utility_tc.h" />
|
||||
<QtMoc Include="aboutWindow.h" />
|
||||
<ClInclude Include="hppaConfigFile.h" />
|
||||
|
||||
@ -142,6 +142,9 @@
|
||||
<ClCompile Include="View3D.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TabManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="fileOperation.h">
|
||||
@ -210,6 +213,9 @@
|
||||
<QtMoc Include="View3D.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="TabManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="imageProcessor.h">
|
||||
|
||||
@ -64,6 +64,8 @@ void OneMotorControl::display_x_loc(std::vector<double> loc)
|
||||
{
|
||||
double tmp = round(loc[0] * 100) / 100;
|
||||
this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp));
|
||||
|
||||
emit broadcastLocationSignal(loc);
|
||||
}
|
||||
|
||||
void OneMotorControl::display_motors_connectivity(std::vector<int> connectivity)
|
||||
|
||||
@ -55,6 +55,8 @@ signals:
|
||||
|
||||
void sequenceComplete();
|
||||
|
||||
void broadcastLocationSignal(std::vector<double>);
|
||||
|
||||
private:
|
||||
Ui::OneMotorControl_UI ui;
|
||||
|
||||
|
||||
61
HPPA/TabManager.cpp
Normal file
61
HPPA/TabManager.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include "TabManager.h"
|
||||
|
||||
TabManager::TabManager(QTabWidget* tabWidget, QObject* parent)
|
||||
: QObject(parent),
|
||||
m_tabWidget(tabWidget)
|
||||
{
|
||||
Q_ASSERT(m_tabWidget);
|
||||
}
|
||||
|
||||
void TabManager::hideTab(QWidget* page)
|
||||
{
|
||||
if (!page || !m_tabWidget)
|
||||
return;
|
||||
|
||||
int index = m_tabWidget->indexOf(page);
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
if (m_hiddenTabs.contains(page))
|
||||
return;
|
||||
|
||||
TabInfo info;
|
||||
info.index = index;
|
||||
info.text = m_tabWidget->tabText(index);
|
||||
info.icon = m_tabWidget->tabIcon(index);
|
||||
info.toolTip = m_tabWidget->tabToolTip(index);
|
||||
|
||||
m_hiddenTabs.insert(page, info);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>ǵ<EFBFBD>ǰҳ<C7B0><D2B3><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD>
|
||||
if (m_tabWidget->currentIndex() == index)
|
||||
{
|
||||
int next = (index > 0) ? index - 1 : 0;
|
||||
m_tabWidget->setCurrentIndex(next);
|
||||
}
|
||||
|
||||
m_tabWidget->removeTab(index);
|
||||
emit tabHidden(page);
|
||||
}
|
||||
|
||||
void TabManager::showTab(QWidget* page)
|
||||
{
|
||||
if (!page || !m_tabWidget)
|
||||
return;
|
||||
|
||||
if (!m_hiddenTabs.contains(page))
|
||||
return;
|
||||
|
||||
TabInfo info = m_hiddenTabs.take(page);
|
||||
|
||||
int insertIndex = qMin(info.index, m_tabWidget->count());
|
||||
m_tabWidget->insertTab(insertIndex, page, info.icon, info.text);
|
||||
m_tabWidget->setTabToolTip(insertIndex, info.toolTip);
|
||||
|
||||
emit tabShown(page);
|
||||
}
|
||||
|
||||
bool TabManager::isHidden(QWidget* page) const
|
||||
{
|
||||
return m_hiddenTabs.contains(page);
|
||||
}
|
||||
32
HPPA/TabManager.h
Normal file
32
HPPA/TabManager.h
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QTabWidget>
|
||||
#include <QHash>
|
||||
|
||||
class TabManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TabManager(QTabWidget* tabWidget, QObject* parent = nullptr);
|
||||
|
||||
void hideTab(QWidget* page);
|
||||
void showTab(QWidget* page);
|
||||
bool isHidden(QWidget* page) const;
|
||||
|
||||
signals:
|
||||
void tabHidden(QWidget* page);
|
||||
void tabShown(QWidget* page);
|
||||
|
||||
private:
|
||||
struct TabInfo
|
||||
{
|
||||
int index;
|
||||
QString text;
|
||||
QIcon icon;
|
||||
QString toolTip;
|
||||
};
|
||||
|
||||
QTabWidget* m_tabWidget = nullptr;
|
||||
QHash<QWidget*, TabInfo> m_hiddenTabs;
|
||||
};
|
||||
@ -8,7 +8,7 @@
|
||||
#include <Qt3DRender/QAttribute>
|
||||
#include <QGeometryRenderer>
|
||||
|
||||
View3D::View3D(const QString& baseModelPath,
|
||||
View3DBase::View3DBase(const QString& baseModelPath,
|
||||
const QString& armModelPath,
|
||||
QWidget* parent)
|
||||
: QWidget(parent),
|
||||
@ -47,7 +47,19 @@ View3D::View3D(const QString& baseModelPath,
|
||||
// });
|
||||
}
|
||||
|
||||
void View3D::initScene()
|
||||
void View3DBase::setViewCenter(float x, float y, float z)
|
||||
{
|
||||
m_viewCenter.setX(x);
|
||||
m_viewCenter.setY(y);
|
||||
m_viewCenter.setZ(z);
|
||||
}
|
||||
|
||||
void View3DBase::setDistance(float distance)
|
||||
{
|
||||
m_distance = distance;
|
||||
}
|
||||
|
||||
void View3DBase::initScene()
|
||||
{
|
||||
// ===== 创建 base 根节点 =====
|
||||
auto* baseModel = new Qt3DCore::QEntity(m_rootEntity);
|
||||
@ -55,7 +67,7 @@ void View3D::initScene()
|
||||
baseLoader->setSource(QUrl::fromLocalFile(m_baseModelPath));
|
||||
|
||||
//connect(baseLoader, &Qt3DRender::QSceneLoader::statusChanged,
|
||||
// this, &View3D::onSceneLoaderStatusChanged);
|
||||
// this, &View3DBase::onSceneLoaderStatusChanged);
|
||||
|
||||
|
||||
m_baseTransform = new Qt3DCore::QTransform();
|
||||
@ -88,7 +100,7 @@ void View3D::initScene()
|
||||
qDebug() << m_armTransform->matrix();
|
||||
}
|
||||
|
||||
void View3D::createAxes()
|
||||
void View3DBase::createAxes()
|
||||
{
|
||||
// 参数
|
||||
float axisLength = 500.0f;
|
||||
@ -154,7 +166,7 @@ void View3D::createAxes()
|
||||
zAxis->addComponent(zMat);
|
||||
}
|
||||
|
||||
void View3D::initCamera()
|
||||
void View3DBase::initCamera()
|
||||
{
|
||||
m_camera = m_view->camera();
|
||||
// 16:10 假设窗口比例,后续 resize 时相机透视会保持
|
||||
@ -162,7 +174,7 @@ void View3D::initCamera()
|
||||
updateCameraPosition();
|
||||
}
|
||||
|
||||
void View3D::updateCameraPosition()
|
||||
void View3DBase::updateCameraPosition()
|
||||
{
|
||||
float yaw = qDegreesToRadians(m_yawDeg);
|
||||
float pitch = qDegreesToRadians(m_pitchDeg);
|
||||
@ -176,7 +188,7 @@ void View3D::updateCameraPosition()
|
||||
m_camera->setViewCenter(m_viewCenter);
|
||||
}
|
||||
|
||||
void View3D::showEvent(QShowEvent* event)
|
||||
void View3DBase::showEvent(QShowEvent* event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
|
||||
@ -194,7 +206,7 @@ void View3D::showEvent(QShowEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
bool View3D::eventFilter(QObject* obj, QEvent* event)
|
||||
bool View3DBase::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (obj == m_view)
|
||||
{
|
||||
@ -282,11 +294,29 @@ bool View3D::eventFilter(QObject* obj, QEvent* event)
|
||||
return QWidget::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void View3D::setLoc(std::vector<double> loc)
|
||||
View3DPlantPhenotype::View3DPlantPhenotype(const QString& baseModelPath, const QString& armModelPath, QWidget* parent)
|
||||
:View3DBase(baseModelPath, armModelPath, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void View3DPlantPhenotype::setLoc(std::vector<double> loc)
|
||||
{
|
||||
double x = round(loc[0] * 100) / 100;
|
||||
double y = round(loc[1] * 100) / 100;
|
||||
|
||||
|
||||
m_armTransform->setTranslation(QVector3D(x, y, 0));
|
||||
}
|
||||
|
||||
View3DLinearStage::View3DLinearStage(const QString& baseModelPath, const QString& armModelPath, QWidget* parent)
|
||||
:View3DBase(baseModelPath, armModelPath, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void View3DLinearStage::setLoc(std::vector<double> loc)
|
||||
{
|
||||
double x = round(loc[0] * 100) / 100;
|
||||
|
||||
m_armTransform->setTranslation(QVector3D(x, 0, 0));
|
||||
}
|
||||
@ -17,25 +17,25 @@
|
||||
#include <Qt3DRender/QSceneLoader>
|
||||
#include <Qt3DExtras/QCylinderMesh>
|
||||
|
||||
class View3D : public QWidget
|
||||
class View3DBase : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit View3D(const QString& baseModelPath,
|
||||
explicit View3DBase(const QString& baseModelPath,
|
||||
const QString& armModelPath,
|
||||
QWidget* parent = nullptr);
|
||||
void setViewCenter(float x, float y, float z);
|
||||
void setDistance(float distance);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
|
||||
private:
|
||||
void initScene();
|
||||
void initCamera();
|
||||
void updateCameraPosition();
|
||||
void createAxes();
|
||||
|
||||
private:
|
||||
QString m_baseModelPath;
|
||||
QString m_armModelPath;
|
||||
|
||||
@ -67,8 +67,43 @@ private:
|
||||
Qt3DCore::QTransform* m_baseRootTransform = nullptr;
|
||||
Qt3DCore::QTransform* m_armRootTransform = nullptr;
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void setLoc(std::vector<double> loc) = 0;
|
||||
};
|
||||
|
||||
class View3DPlantPhenotype : public View3DBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
View3DPlantPhenotype(const QString& baseModelPath,
|
||||
const QString& armModelPath,
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
|
||||
public Q_SLOTS:
|
||||
void setLoc(std::vector<double> loc);
|
||||
};
|
||||
|
||||
class View3DLinearStage : public View3DBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
View3DLinearStage(const QString& baseModelPath,
|
||||
const QString& armModelPath,
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
|
||||
public Q_SLOTS:
|
||||
void setLoc(std::vector<double> loc);
|
||||
};
|
||||
#endif // VIEW3D_H
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>684</width>
|
||||
<height>799</height>
|
||||
<height>741</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -43,14 +43,14 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>684</width>
|
||||
<height>799</height>
|
||||
<height>741</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -58,7 +58,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>150</height>
|
||||
<height>180</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@ -105,7 +105,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="ymotor_forward_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -131,7 +131,7 @@
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="connect_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -144,7 +144,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="xmotor_left_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -170,7 +170,7 @@
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="xmotor_right_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -183,7 +183,7 @@
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="zero_start_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -209,7 +209,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="ymotor_backward_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -235,7 +235,7 @@
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="rangeMeasurement_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
||||
Reference in New Issue
Block a user