Compare commits
1 Commits
d358989579
...
T2.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 2322bf09cf |
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,7 +6,6 @@ gdal202.dll
|
|||||||
HPPA类图.drawio
|
HPPA类图.drawio
|
||||||
HPPA - 副本.ui
|
HPPA - 副本.ui
|
||||||
icon
|
icon
|
||||||
ignore_*
|
|
||||||
|
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "AspectRatioLabel.h"
|
|
||||||
|
|
||||||
AspectRatioLabel::AspectRatioLabel(QWidget* parent)
|
|
||||||
: QLabel(parent)
|
|
||||||
{
|
|
||||||
setAlignment(Qt::AlignCenter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AspectRatioLabel::setOriginalPixmap(const QPixmap& pixmap)
|
|
||||||
{
|
|
||||||
m_originalPixmap = pixmap;
|
|
||||||
updateScaledPixmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AspectRatioLabel::resizeEvent(QResizeEvent* event)
|
|
||||||
{
|
|
||||||
QLabel::resizeEvent(event);
|
|
||||||
updateScaledPixmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AspectRatioLabel::updateScaledPixmap()
|
|
||||||
{
|
|
||||||
if (m_originalPixmap.isNull())
|
|
||||||
return;
|
|
||||||
|
|
||||||
setPixmap(m_originalPixmap.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPixmap>
|
|
||||||
#include <QResizeEvent>
|
|
||||||
|
|
||||||
class AspectRatioLabel : public QLabel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit AspectRatioLabel(QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
void setOriginalPixmap(const QPixmap& pixmap);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateScaledPixmap();
|
|
||||||
QPixmap m_originalPixmap;
|
|
||||||
};
|
|
||||||
@ -1,285 +0,0 @@
|
|||||||
#include "Carousel.h"
|
|
||||||
#include <QContextMenuEvent>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
MyCarousel::MyCarousel(QWidget* parent)
|
|
||||||
: QWidget(parent),
|
|
||||||
m_stackedWidget(new QStackedWidget(this)),
|
|
||||||
m_bottomButtonOverlay(nullptr),
|
|
||||||
m_bottomButtonLayout(nullptr),
|
|
||||||
m_bottomButtonGroup(nullptr),
|
|
||||||
m_currentIndex(0),
|
|
||||||
m_isPlaying(false),
|
|
||||||
m_isLocked(false),
|
|
||||||
m_lockedIndex(-1),
|
|
||||||
m_playInterval(2000),
|
|
||||||
m_intervalButtonSize(40)
|
|
||||||
{
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
|
||||||
layout->addWidget(m_stackedWidget);
|
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
|
||||||
m_autoPlayerTimer = new QTimer(this);
|
|
||||||
connect(m_autoPlayerTimer, &QTimer::timeout,
|
|
||||||
this, &MyCarousel::slideRight);
|
|
||||||
|
|
||||||
m_nomalQSS= R"(
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #FFFFFF;
|
|
||||||
}
|
|
||||||
QPushButton:checked
|
|
||||||
{
|
|
||||||
background-color: #08F8E8;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #08F8E8;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: red;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid red;
|
|
||||||
}
|
|
||||||
/*QPushButton:!checked {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #FFFFFF;
|
|
||||||
}*/
|
|
||||||
)";
|
|
||||||
|
|
||||||
m_lockedQSS = R"(
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #FFFFFF;
|
|
||||||
}
|
|
||||||
QPushButton:checked
|
|
||||||
{
|
|
||||||
background-color: #08F8E8;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #08F8E8;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: red;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid red;
|
|
||||||
}
|
|
||||||
)";
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::addWidget(QWidget* w)
|
|
||||||
{
|
|
||||||
m_widgets.append(w);
|
|
||||||
m_stackedWidget->addWidget(w);
|
|
||||||
updateStackedWidgetVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::play()
|
|
||||||
{
|
|
||||||
if (m_widgets.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_isPlaying = true;
|
|
||||||
|
|
||||||
// 创建底部按钮
|
|
||||||
m_bottomButtonLayout = new QHBoxLayout();
|
|
||||||
m_bottomButtonGroup = new QButtonGroup(this);
|
|
||||||
m_bottomButtons.clear();
|
|
||||||
|
|
||||||
for (int i = 0; i < m_widgets.size(); ++i) {
|
|
||||||
QPushButton* btn = new QPushButton(this);
|
|
||||||
btn->setCheckable(true);
|
|
||||||
btn->setFixedSize(m_intervalButtonSize, 3);
|
|
||||||
btn->setStyleSheet(m_nomalQSS);
|
|
||||||
btn->setFixedHeight(10);
|
|
||||||
btn->setFixedWidth(10);
|
|
||||||
|
|
||||||
m_bottomButtonLayout->addWidget(btn);
|
|
||||||
m_bottomButtonGroup->addButton(btn, i);
|
|
||||||
m_bottomButtons.append(btn);
|
|
||||||
|
|
||||||
connect(btn, &QPushButton::clicked, this, [this, i]() {
|
|
||||||
onButtonClicked(i);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
m_bottomButtonOverlay = new QWidget(this);
|
|
||||||
m_bottomButtonOverlay->setLayout(m_bottomButtonLayout);
|
|
||||||
m_bottomButtonOverlay->setAttribute(Qt::WA_TranslucentBackground);
|
|
||||||
m_bottomButtonOverlay->show();
|
|
||||||
|
|
||||||
m_autoPlayerTimer->setInterval(m_playInterval);
|
|
||||||
m_autoPlayerTimer->start();
|
|
||||||
|
|
||||||
updateStackedWidgetVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::contextMenuEvent(QContextMenuEvent* event)
|
|
||||||
{
|
|
||||||
showContextMenu(event->globalPos());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::showContextMenu(const QPoint& pos)
|
|
||||||
{
|
|
||||||
QMenu menu(this);
|
|
||||||
menu.setStyleSheet(R"(
|
|
||||||
QMenu {
|
|
||||||
background-color: #2a5dec;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
QMenu::item:selected {
|
|
||||||
background-color: #1a4ddc;
|
|
||||||
}
|
|
||||||
QMenu::separator {
|
|
||||||
height: 1px;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
|
|
||||||
QAction* startAct = menu.addAction(QString::fromLocal8Bit("开始轮播"));
|
|
||||||
QAction* stopAct = menu.addAction(QString::fromLocal8Bit("停止轮播"));
|
|
||||||
|
|
||||||
menu.addSeparator();
|
|
||||||
QAction* incAct = menu.addAction("+1");
|
|
||||||
QAction* decAct = menu.addAction("-1");
|
|
||||||
|
|
||||||
if (!m_isLocked)
|
|
||||||
startAct->setEnabled(false);
|
|
||||||
|
|
||||||
if (m_isLocked)
|
|
||||||
stopAct->setEnabled(false);
|
|
||||||
|
|
||||||
QAction* act = menu.exec(pos);
|
|
||||||
|
|
||||||
if (act == startAct)
|
|
||||||
startAutoPlay();
|
|
||||||
else if (act == stopAct)
|
|
||||||
stopAutoPlay();
|
|
||||||
else if (act == incAct) {
|
|
||||||
m_playInterval += 1000;
|
|
||||||
m_autoPlayerTimer->setInterval(m_playInterval);
|
|
||||||
}
|
|
||||||
else if (act == decAct) {
|
|
||||||
if (m_playInterval > 1)
|
|
||||||
m_playInterval -= 1000;
|
|
||||||
m_autoPlayerTimer->setInterval(m_playInterval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::startAutoPlay()
|
|
||||||
{
|
|
||||||
updateButtonState(m_currentIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::stopAutoPlay()
|
|
||||||
{
|
|
||||||
updateButtonState(m_currentIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::onButtonClicked(int index)
|
|
||||||
{
|
|
||||||
updateButtonState(index);
|
|
||||||
gotoWidget(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::updateButtonState(int index)
|
|
||||||
{
|
|
||||||
if (m_isLocked)
|
|
||||||
{
|
|
||||||
if (index == m_lockedIndex) {
|
|
||||||
// 解锁
|
|
||||||
m_isLocked = false;
|
|
||||||
m_lockedIndex = -1;
|
|
||||||
|
|
||||||
if (m_isPlaying)
|
|
||||||
m_autoPlayerTimer->start();
|
|
||||||
|
|
||||||
restoreButtonStyle(index);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// 切换锁定
|
|
||||||
restoreButtonStyle(m_lockedIndex);
|
|
||||||
setButtonLocked(index);
|
|
||||||
m_lockedIndex = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// 初次锁定
|
|
||||||
m_isLocked = true;
|
|
||||||
m_lockedIndex = index;
|
|
||||||
m_autoPlayerTimer->stop();
|
|
||||||
setButtonLocked(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::setButtonLocked(int index)
|
|
||||||
{
|
|
||||||
QPushButton* btn = m_bottomButtons[index];
|
|
||||||
btn->setText("");
|
|
||||||
btn->setStyleSheet(m_lockedQSS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::restoreButtonStyle(int index)
|
|
||||||
{
|
|
||||||
if (index < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QPushButton* btn = m_bottomButtons[index];
|
|
||||||
btn->setText("");
|
|
||||||
btn->setStyleSheet(m_nomalQSS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::slideLeft()
|
|
||||||
{
|
|
||||||
if (m_widgets.isEmpty() || m_isLocked || !m_isPlaying)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_currentIndex = (m_currentIndex - 1 + m_widgets.size()) % m_widgets.size();
|
|
||||||
updateStackedWidgetVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::slideRight()
|
|
||||||
{
|
|
||||||
if (m_widgets.isEmpty() || m_isLocked || !m_isPlaying)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_currentIndex = (m_currentIndex + 1) % m_widgets.size();
|
|
||||||
updateStackedWidgetVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::gotoWidget(int index)
|
|
||||||
{
|
|
||||||
m_currentIndex = index;
|
|
||||||
updateStackedWidgetVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::updateStackedWidgetVisibility()
|
|
||||||
{
|
|
||||||
if (m_widgets.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_stackedWidget->setCurrentIndex(m_currentIndex);
|
|
||||||
|
|
||||||
if (!m_isLocked) {
|
|
||||||
for (int i = 0; i < m_bottomButtons.size(); ++i)
|
|
||||||
m_bottomButtons[i]->setChecked(i == m_currentIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCarousel::resizeEvent(QResizeEvent*)
|
|
||||||
{
|
|
||||||
if (!m_bottomButtonOverlay)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int count = m_widgets.size();
|
|
||||||
int totalWidth = m_intervalButtonSize * count + 10 * (count - 1);
|
|
||||||
|
|
||||||
int x = (width() - totalWidth) / 2;
|
|
||||||
int y = height() - m_intervalButtonSize;
|
|
||||||
|
|
||||||
m_bottomButtonOverlay->setGeometry(x, y, totalWidth, m_intervalButtonSize);
|
|
||||||
}
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QStackedWidget>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QButtonGroup>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
class MyCarousel : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit MyCarousel(QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
void addWidget(QWidget* w);
|
|
||||||
void play();
|
|
||||||
void gotoWidget(int index);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void slideLeft();
|
|
||||||
void slideRight();
|
|
||||||
void onButtonClicked(int index);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// UI
|
|
||||||
QStackedWidget* m_stackedWidget;
|
|
||||||
QWidget* m_bottomButtonOverlay;
|
|
||||||
QHBoxLayout* m_bottomButtonLayout;
|
|
||||||
QButtonGroup* m_bottomButtonGroup;
|
|
||||||
|
|
||||||
QVector<QWidget*> m_widgets;
|
|
||||||
QVector<QPushButton*> m_bottomButtons;
|
|
||||||
QString m_nomalQSS;
|
|
||||||
QString m_lockedQSS;
|
|
||||||
|
|
||||||
// ״ֵ̬
|
|
||||||
int m_currentIndex;
|
|
||||||
bool m_isPlaying;
|
|
||||||
bool m_isLocked;
|
|
||||||
int m_lockedIndex;
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD>
|
|
||||||
int m_playInterval;
|
|
||||||
int m_intervalButtonSize;
|
|
||||||
|
|
||||||
QTimer* m_autoPlayerTimer;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateStackedWidgetVisibility();
|
|
||||||
void updateButtonState(int index);
|
|
||||||
|
|
||||||
void setButtonLocked(int index);
|
|
||||||
void restoreButtonStyle(int index);
|
|
||||||
|
|
||||||
void showContextMenu(const QPoint& pos);
|
|
||||||
|
|
||||||
void startAutoPlay();
|
|
||||||
void stopAutoPlay();
|
|
||||||
};
|
|
||||||
@ -1,204 +0,0 @@
|
|||||||
#include "CustomDockWidgetBase.h"
|
|
||||||
|
|
||||||
CustomDockWidgetBase::CustomDockWidgetBase(QMainWindow* parent)
|
|
||||||
: QDockWidget(parent),
|
|
||||||
m_mainWindow(parent),
|
|
||||||
m_isMaximized(false)
|
|
||||||
{
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomDockWidgetBase::CustomDockWidgetBase(QString title, QMainWindow* parent)
|
|
||||||
: QDockWidget(title, parent),
|
|
||||||
m_mainWindow(parent),
|
|
||||||
m_isMaximized(false)
|
|
||||||
{
|
|
||||||
initialize();
|
|
||||||
setTile(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomDockWidgetBase::initialize()
|
|
||||||
{
|
|
||||||
QWidget* titleBar_Background = new QWidget(this);
|
|
||||||
titleBar_Background->setObjectName("titleBar_Background");
|
|
||||||
QGridLayout* layout_titleBar_Background = new QGridLayout(titleBar_Background);
|
|
||||||
layout_titleBar_Background->setContentsMargins(0, 0, 0, 0);
|
|
||||||
titleBar_Background->setStyleSheet(R"(
|
|
||||||
QWidget #titleBar_Background{
|
|
||||||
background: #040125;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
|
|
||||||
QWidget* titleBar = new QWidget(titleBar_Background);
|
|
||||||
titleBar->setObjectName("titleBar");
|
|
||||||
QHBoxLayout* layout = new QHBoxLayout(titleBar);
|
|
||||||
titleBar->setFixedHeight(30);
|
|
||||||
|
|
||||||
title_label = new QLabel(titleBar);
|
|
||||||
|
|
||||||
layout->setContentsMargins(10, 0, 10, 0);
|
|
||||||
layout->addWidget(title_label);
|
|
||||||
layout->addStretch();
|
|
||||||
|
|
||||||
m_maxButton = new QToolButton(titleBar);
|
|
||||||
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
|
|
||||||
|
|
||||||
layout->addWidget(m_maxButton);
|
|
||||||
|
|
||||||
titleBar->setStyleSheet(R"(
|
|
||||||
QWidget #titleBar{
|
|
||||||
background: #0E1C4C;
|
|
||||||
/*border: 4px solid #2c586b;*/
|
|
||||||
/*padding-top: 10px;
|
|
||||||
padding-bottom: 10px;*/
|
|
||||||
|
|
||||||
border-top: 1px solid #2c586b;
|
|
||||||
border-left: 1px solid #2c586b;
|
|
||||||
border-right: 1px solid #2c586b;
|
|
||||||
border-bottom: none; /* ȡ<><C8A1><EFBFBD>ײ<EFBFBD><D7B2>߿<EFBFBD> */
|
|
||||||
|
|
||||||
border-top-left-radius: 5px;
|
|
||||||
border-top-right-radius: 5px;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
title_label->setStyleSheet("color: white;");
|
|
||||||
m_maxButton->setStyleSheet("");
|
|
||||||
|
|
||||||
layout_titleBar_Background->addWidget(titleBar);
|
|
||||||
|
|
||||||
setTitleBarWidget(titleBar_Background);
|
|
||||||
setFeatures(QDockWidget::DockWidgetClosable);
|
|
||||||
connect(m_maxButton, &QToolButton::clicked, this, &CustomDockWidgetBase::toggleMaximize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomDockWidgetBase::setTile(QString title)
|
|
||||||
{
|
|
||||||
title_label->setText(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomDockWidgetBase::hideMaxButton()
|
|
||||||
{
|
|
||||||
m_maxButton->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomDockWidgetBase::toggleMaximize()
|
|
||||||
{
|
|
||||||
if (!m_isMaximized)
|
|
||||||
{
|
|
||||||
m_hiddenDocks.clear();
|
|
||||||
m_originalSizes.clear();
|
|
||||||
|
|
||||||
m_savedState = m_mainWindow->saveState();
|
|
||||||
|
|
||||||
const QList<QDockWidget*> docks = m_mainWindow->findChildren<QDockWidget*>();
|
|
||||||
for (QDockWidget* dock : docks)
|
|
||||||
{
|
|
||||||
m_originalSizes[dock] = dock->size();
|
|
||||||
if (dock != this && dock->isVisible())
|
|
||||||
{
|
|
||||||
dock->hide();
|
|
||||||
m_hiddenDocks.append(dock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_isMaximized = true;
|
|
||||||
emit maximizeStateChanged(m_isMaximized);
|
|
||||||
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarNormalButton));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (QDockWidget* dock : m_hiddenDocks)
|
|
||||||
{
|
|
||||||
dock->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_savedState.isEmpty())
|
|
||||||
{
|
|
||||||
m_mainWindow->restoreState(m_savedState);
|
|
||||||
m_savedState.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QDockWidget*> docks;
|
|
||||||
QList<int> widths, heights;
|
|
||||||
for (auto it = m_originalSizes.begin(); it != m_originalSizes.end(); ++it)
|
|
||||||
{
|
|
||||||
docks.append(it.key());
|
|
||||||
widths.append(it.value().width());
|
|
||||||
heights.append(it.value().height());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_mainWindow->resizeDocks(docks, widths, Qt::Horizontal);
|
|
||||||
m_mainWindow->resizeDocks(docks, heights, Qt::Vertical);
|
|
||||||
|
|
||||||
m_isMaximized = false;
|
|
||||||
emit maximizeStateChanged(m_isMaximized);
|
|
||||||
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CustomDockWidgetHideAbove::CustomDockWidgetHideAbove(QString title, QMainWindow* parent)
|
|
||||||
:CustomDockWidgetBase(title, parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
CustomDockWidgetHideAbove::CustomDockWidgetHideAbove(QMainWindow* parent)
|
|
||||||
:CustomDockWidgetBase(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomDockWidgetHideAbove::toggleMaximize()
|
|
||||||
{
|
|
||||||
if (!m_isMaximized)
|
|
||||||
{
|
|
||||||
m_hiddenDocks.clear();
|
|
||||||
m_originalSizes.clear();
|
|
||||||
|
|
||||||
m_savedState = m_mainWindow->saveState();
|
|
||||||
|
|
||||||
const QList<QDockWidget*> docks = m_mainWindow->findChildren<QDockWidget*>();
|
|
||||||
for (QDockWidget* dock : docks)
|
|
||||||
{
|
|
||||||
m_originalSizes[dock] = dock->size();
|
|
||||||
if (dock->objectName().contains("mDockCarousel") && dock->isVisible())
|
|
||||||
{
|
|
||||||
dock->hide();
|
|
||||||
m_hiddenDocks.append(dock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_isMaximized = true;
|
|
||||||
emit maximizeStateChanged(m_isMaximized);
|
|
||||||
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarNormalButton));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (QDockWidget* dock : m_hiddenDocks)
|
|
||||||
{
|
|
||||||
dock->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_savedState.isEmpty())
|
|
||||||
{
|
|
||||||
m_mainWindow->restoreState(m_savedState);
|
|
||||||
m_savedState.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//QList<QDockWidget*> docks;
|
|
||||||
//QList<int> widths, heights;
|
|
||||||
//for (auto it = m_originalSizes.begin(); it != m_originalSizes.end(); ++it)
|
|
||||||
//{
|
|
||||||
// docks.append(it.key());
|
|
||||||
// widths.append(it.value().width());
|
|
||||||
// heights.append(it.value().height());
|
|
||||||
//}
|
|
||||||
|
|
||||||
//m_mainWindow->resizeDocks(docks, widths, Qt::Horizontal);
|
|
||||||
//m_mainWindow->resizeDocks(docks, heights, Qt::Vertical);
|
|
||||||
|
|
||||||
m_isMaximized = false;
|
|
||||||
emit maximizeStateChanged(m_isMaximized);
|
|
||||||
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QToolButton>
|
|
||||||
#include <QStyle>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QMap>
|
|
||||||
#include <QSize>
|
|
||||||
#include <QLabel>
|
|
||||||
|
|
||||||
class CustomDockWidgetBase :
|
|
||||||
public QDockWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit CustomDockWidgetBase(QString title, QMainWindow* parent = nullptr);
|
|
||||||
explicit CustomDockWidgetBase(QMainWindow* parent = nullptr);
|
|
||||||
void setTile(QString title);
|
|
||||||
void hideMaxButton();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
virtual void toggleMaximize();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void maximizeStateChanged(bool isMaximized);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QMainWindow* m_mainWindow = nullptr;
|
|
||||||
QToolButton* m_maxButton = nullptr;
|
|
||||||
bool m_isMaximized = false;
|
|
||||||
|
|
||||||
QList<QDockWidget*> m_hiddenDocks;
|
|
||||||
QByteArray m_savedState;
|
|
||||||
QMap<QDockWidget*, QSize> m_originalSizes;
|
|
||||||
|
|
||||||
QLabel* title_label;
|
|
||||||
void initialize();
|
|
||||||
};
|
|
||||||
|
|
||||||
class CustomDockWidgetHideAbove :
|
|
||||||
public CustomDockWidgetBase
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit CustomDockWidgetHideAbove(QString title, QMainWindow* parent = nullptr);
|
|
||||||
explicit CustomDockWidgetHideAbove(QMainWindow* parent = nullptr);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void toggleMaximize();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>557</width>
|
<width>632</width>
|
||||||
<height>432</height>
|
<height>444</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -17,292 +17,14 @@
|
|||||||
<iconset resource="HPPA.qrc">
|
<iconset resource="HPPA.qrc">
|
||||||
<normaloff>:/HPPA/HPPA.ico</normaloff>:/HPPA/HPPA.ico</iconset>
|
<normaloff>:/HPPA/HPPA.ico</normaloff>:/HPPA/HPPA.ico</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<string notr="true">QLineEdit {
|
|
||||||
background-color: #142D7F;
|
|
||||||
color: #e6eeff;
|
|
||||||
border: 1px solid #2f6bff;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 4px 8px;
|
|
||||||
min-width: 70px;
|
|
||||||
min-height: 20px;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QGroupBox
|
|
||||||
{
|
|
||||||
border: 12px solid transparent;
|
|
||||||
/*border-top: 12px solid transparent;
|
|
||||||
border-right: 0px solid transparent;
|
|
||||||
border-bottom: 0px solid transparent;
|
|
||||||
border-left: 0px solid transparent;*/
|
|
||||||
color: #ACCDFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;*/
|
|
||||||
font: 10pt "新宋体";
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLabel {
|
|
||||||
color: rgb(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
QSlider::groove:horizontal {
|
|
||||||
height: 10px;
|
|
||||||
background: #1e2a44;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 已滑过:渐变蓝 */
|
|
||||||
QSlider::sub-page:horizontal {
|
|
||||||
background: qlineargradient(
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1f4fff,
|
|
||||||
stop:0.5 #2f6bff,
|
|
||||||
stop:1 #5fa0ff
|
|
||||||
);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 未滑过 */
|
|
||||||
QSlider::add-page:horizontal {
|
|
||||||
height: 10px;
|
|
||||||
background: #2a3550;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===== 滑块按钮 ===== */
|
|
||||||
QSlider::handle:horizontal {
|
|
||||||
width: 15px;
|
|
||||||
height: 10px;
|
|
||||||
|
|
||||||
/* 蓝色实心 */
|
|
||||||
background: #2f6bff;
|
|
||||||
|
|
||||||
/* 白色外圈 */
|
|
||||||
border: 2px solid #ffffff;
|
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
/* 垂直居中 */
|
|
||||||
margin: -5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 悬停 */
|
|
||||||
QSlider::handle:horizontal:hover {
|
|
||||||
background: #4d8dff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 按下 */
|
|
||||||
QSlider::handle:horizontal:pressed {
|
|
||||||
background: #1f4fff;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QWidget" name="contentWidget" native="true">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QWidget #contentWidget
|
|
||||||
{
|
|
||||||
background: #040125;
|
|
||||||
/*border-radius: 8px 8px 8px 8px;*/
|
|
||||||
border: 1px solid #2f6bff;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QWidget" name="titlebarWidget" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>43</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>43</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QWidget #titlebarWidget
|
|
||||||
{
|
|
||||||
background: #0E1C4C;
|
|
||||||
border: 1px solid #2f6bff;
|
|
||||||
}
|
|
||||||
</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="iconLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>调焦</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>505</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QPushButton" name="closeBtn">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>icon/all/close.svg</normaloff>icon/all/close.svg</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0" rowspan="2">
|
||||||
<widget class="QWidget" name="connectFocusModule_widget" native="true">
|
<widget class="QGroupBox" name="connectFocusModule_groupBox">
|
||||||
<property name="styleSheet">
|
<property name="title">
|
||||||
<string notr="true">QWidget #connectFocusModule_widget
|
|
||||||
{
|
|
||||||
background: #121945;
|
|
||||||
border-radius: 5px 5px 5px 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRadioButton
|
|
||||||
{
|
|
||||||
color: #E2EDFF;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>连接调焦模块</string>
|
<string>连接调焦模块</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
</item>
|
<item row="0" column="0">
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -315,44 +37,31 @@ QRadioButton
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="motorPort_comboBox"/>
|
<widget class="QComboBox" name="motorPort_comboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QRadioButton" name="ultrasound_radioButton">
|
<widget class="QRadioButton" name="ultrasound_radioButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>超声</string>
|
<string>超声</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="ultrasoundPort_comboBox">
|
<widget class="QComboBox" name="ultrasoundPort_comboBox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="is_new_version_radioButton">
|
<widget class="QRadioButton" name="is_new_version_radioButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>新版</string>
|
<string>新版</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="0" colspan="2">
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>107</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QPushButton" name="connectMotor_btn">
|
<widget class="QPushButton" name="connectMotor_btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>连接线性平台</string>
|
<string>连接线性平台</string>
|
||||||
@ -362,63 +71,35 @@ QRadioButton
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QWidget" name="controlMotor_widget" native="true">
|
<widget class="QGroupBox" name="controlFocus_groupBox">
|
||||||
<property name="styleSheet">
|
<property name="title">
|
||||||
<string notr="true">QWidget #controlMotor_widget
|
<string>调焦</string>
|
||||||
{
|
|
||||||
background: #121945;
|
|
||||||
border-radius: 5px 5px 5px 5px;
|
|
||||||
}</string>
|
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="2" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="moveto_btn">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="enabled">
|
||||||
<string>移动至</string>
|
<bool>true</bool>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QPushButton" name="logicZero_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>LogicZero</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="2">
|
|
||||||
<widget class="QLineEdit" name="move2_lineEdit">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>88</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>10</string>
|
<string>采样率</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="add_btn">
|
<widget class="QLineEdit" name="sample_ratio_lineEdit">
|
||||||
<property name="text">
|
|
||||||
<string>+</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1" colspan="2">
|
|
||||||
<widget class="QLineEdit" name="subtractStepSize_lineEdit">
|
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>88</width>
|
<width>0</width>
|
||||||
<height>30</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>10</string>
|
<string>20</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
@ -426,53 +107,67 @@ QRadioButton
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
<widget class="QProgressBar" name="autoFocusProgress_progressBar">
|
||||||
|
<property name="value">
|
||||||
|
<number>24</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="autoFocus_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>自动调焦</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>171</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="manualFocus_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>手动调焦</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QGroupBox" name="controlMotor_groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>调整线性平台</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="updateCurrentLocation_btn">
|
<widget class="QPushButton" name="updateCurrentLocation_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>34</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>更新实时位置</string>
|
<string>更新实时位置</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" colspan="2">
|
<item row="0" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="addStepSize_lineEdit">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>88</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>10</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QPushButton" name="rangeMeasurement_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>量程测量</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="2">
|
|
||||||
<widget class="QLineEdit" name="currentLocation_lineEdit">
|
<widget class="QLineEdit" name="currentLocation_lineEdit">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>88</width>
|
<width>0</width>
|
||||||
<height>30</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -486,82 +181,23 @@ QRadioButton
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QPushButton" name="subtract_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>-</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QPushButton" name="max_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>max</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>调整线性平台</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QWidget" name="controlFocus_widget" native="true">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QWidget #controlFocus_widget
|
|
||||||
{
|
|
||||||
background: #121945;
|
|
||||||
border-radius: 5px 5px 5px 5px;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>调焦</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QPushButton" name="moveto_btn">
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>采样率</string>
|
<string>移动至</string>
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="sample_ratio_lineEdit">
|
<widget class="QLineEdit" name="move2_lineEdit">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>88</width>
|
<width>0</width>
|
||||||
<height>30</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>20</string>
|
<string>10</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
@ -569,57 +205,70 @@ QRadioButton
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QProgressBar" name="autoFocusProgress_progressBar">
|
<widget class="QPushButton" name="add_btn">
|
||||||
<property name="styleSheet">
|
<property name="text">
|
||||||
<string notr="true">QProgressBar {
|
<string>+</string>
|
||||||
border: 2px solid #08FACE; /* 边框颜色和宽度 */
|
|
||||||
border-radius: 8px; /* 圆角 */
|
|
||||||
background-color: #eee; /* 未完成部分颜色 */
|
|
||||||
text-align: center; /* 百分比文本居中 */
|
|
||||||
height: 13px; /* 高度 */
|
|
||||||
}
|
|
||||||
|
|
||||||
QProgressBar::chunk {
|
|
||||||
background-color: #08FACE; /* 渐变色进度块 */
|
|
||||||
border-radius: 8px; /* 保持和整体圆角一致 */
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>24</number>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1" colspan="2">
|
||||||
<widget class="QPushButton" name="autoFocus_btn">
|
<widget class="QLineEdit" name="addStepSize_lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>自动调焦</string>
|
<string>10</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QPushButton" name="subtract_btn">
|
||||||
<property name="orientation">
|
<property name="text">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="subtractStepSize_lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>171</width>
|
<width>0</width>
|
||||||
<height>20</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QPushButton" name="manualFocus_btn">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>手动调焦</string>
|
<string>10</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="4" column="0">
|
||||||
|
<widget class="QPushButton" name="logicZero_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>LogicZero</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="4" column="1">
|
||||||
|
<widget class="QPushButton" name="max_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>max</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QPushButton" name="rangeMeasurement_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>量程测量</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
2015
HPPA/HPPA.cpp
2015
HPPA/HPPA.cpp
File diff suppressed because it is too large
Load Diff
182
HPPA/HPPA.h
182
HPPA/HPPA.h
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -12,14 +12,11 @@
|
|||||||
#include <QLineSeries>
|
#include <QLineSeries>
|
||||||
#include <QChart>
|
#include <QChart>
|
||||||
#include <QChartView>
|
#include <QChartView>
|
||||||
#include <QValueAxis>
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QVector>
|
|
||||||
#include <QItemSelection>
|
|
||||||
|
|
||||||
#include "ui_HPPA.h"
|
#include "ui_HPPA.h"
|
||||||
#include "resononImager.h"
|
#include "resononImager.h"
|
||||||
@ -38,7 +35,6 @@
|
|||||||
#include "RobotArmControl.h"
|
#include "RobotArmControl.h"
|
||||||
#include "OneMotorControl.h"
|
#include "OneMotorControl.h"
|
||||||
#include "TwoMotorControl.h"
|
#include "TwoMotorControl.h"
|
||||||
#include "imageControl.h"
|
|
||||||
|
|
||||||
#include "hppaConfigFile.h"
|
#include "hppaConfigFile.h"
|
||||||
#include "path_tc.h"
|
#include "path_tc.h"
|
||||||
@ -46,34 +42,9 @@
|
|||||||
#include "ResononNirImager.h"
|
#include "ResononNirImager.h"
|
||||||
#include "Corning410Imager.h"
|
#include "Corning410Imager.h"
|
||||||
|
|
||||||
#include "CustomDockWidgetBase.h"
|
|
||||||
#include "Carousel.h"
|
|
||||||
|
|
||||||
#include "View3D.h"
|
|
||||||
#include "TabManager.h"
|
|
||||||
|
|
||||||
#include "View3DModelManager.h"
|
|
||||||
|
|
||||||
#include "LayerTreeModel.h"
|
|
||||||
#include "LayerTree.h"
|
|
||||||
#include "MapLayer.h"
|
|
||||||
#include "MapLayerStore.h"
|
|
||||||
|
|
||||||
#include "LayerTreeView.h"
|
|
||||||
#include "LayerTreeViewMenuProvider.h"
|
|
||||||
|
|
||||||
#include "MapTool.h"
|
|
||||||
#include "MapToolPan.h"
|
|
||||||
#include "MapToolSpectral.h"
|
|
||||||
#include "MapTools.h"
|
|
||||||
|
|
||||||
#include "AspectRatioLabel.h"
|
|
||||||
|
|
||||||
#include "HyperImagerControl.h"
|
|
||||||
|
|
||||||
#define PI 3.1415926
|
#define PI 3.1415926
|
||||||
|
|
||||||
QT_CHARTS_USE_NAMESPACE//QChartView 使用 需要加宏, 否则无法使用
|
QT_CHARTS_USE_NAMESPACE//QChartView ʹ<EFBFBD><EFBFBD> <20><>Ҫ<EFBFBD>Ӻ꣬ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||||
|
|
||||||
class WorkerThread : public QThread
|
class WorkerThread : public QThread
|
||||||
{
|
{
|
||||||
@ -100,11 +71,11 @@ public:
|
|||||||
// //double x = m_Imager->m_ResononImager.get_framerate();
|
// //double x = m_Imager->m_ResononImager.get_framerate();
|
||||||
// int x = m_Imager->m_ResononImager.get_band_count();
|
// int x = m_Imager->m_ResononImager.get_band_count();
|
||||||
|
|
||||||
// std::cout << "相机连接正常!slope为:" << x << std::endl;
|
// std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>slopeΪ<EFBFBD><EFBFBD>" << x << std::endl;
|
||||||
// }
|
// }
|
||||||
// catch (std::runtime_error *e)//CException *e
|
// catch (std::runtime_error *e)//CException *e
|
||||||
// {
|
// {
|
||||||
// std::cout << "相机断开连接!" << e->what() << std::endl;
|
// std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>" << e->what() << std::endl;
|
||||||
// }
|
// }
|
||||||
// Sleep(1000);
|
// Sleep(1000);
|
||||||
// }
|
// }
|
||||||
@ -152,31 +123,6 @@ signals:
|
|||||||
void threadSignal(QString s);
|
void threadSignal(QString s);
|
||||||
};
|
};
|
||||||
|
|
||||||
class WidgetWithBackgroundPicture : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WidgetWithBackgroundPicture(QWidget* parent = nullptr)
|
|
||||||
: QWidget(parent),
|
|
||||||
m_pixmap(".//icon//titile_bar_bgp.png") // 使用资源或绝对路径
|
|
||||||
{
|
|
||||||
// 可选:设置初始大小
|
|
||||||
resize(800, 600);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent* event) override
|
|
||||||
{
|
|
||||||
QPainter painter(this);
|
|
||||||
QPixmap scaled = m_pixmap.scaled(size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
|
||||||
painter.drawPixmap(rect(), scaled);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPixmap m_pixmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
class HPPA : public QMainWindow
|
class HPPA : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -185,23 +131,17 @@ public:
|
|||||||
HPPA(QWidget *parent = Q_NULLPTR);
|
HPPA(QWidget *parent = Q_NULLPTR);
|
||||||
~HPPA();
|
~HPPA();
|
||||||
|
|
||||||
static HPPA* instance();
|
void CalculateIntegratioinTimeRange();//ͨ<><CDA8>֡<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䷶Χ<E4B7B6><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>slider<65><72><EFBFBD><EFBFBD>ֵ
|
||||||
LayerTreeNode* rasterGroupNode() const;
|
|
||||||
|
|
||||||
WorkerThread * m_TestImagerStausThread;//检测相机连接状态的线程
|
WorkerThread * m_TestImagerStausThread;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static HPPA* s_instance;
|
|
||||||
Ui::HPPAClass ui;
|
Ui::HPPAClass ui;
|
||||||
QTabWidget* m_imageViewerTabWidget;
|
|
||||||
|
|
||||||
QMenu* mPanelMenu = nullptr;
|
QMenu* mPanelMenu = nullptr;
|
||||||
QMenu* mToolbarMenu = nullptr;
|
QMenu* mToolbarMenu = nullptr;
|
||||||
|
|
||||||
void initMenubarToolbar();
|
|
||||||
void initPanelToolbar();
|
void initPanelToolbar();
|
||||||
void initControlTabwidget();
|
|
||||||
QWidget* tmp(QWidget* a);
|
|
||||||
|
|
||||||
QLineEdit * frame_number;
|
QLineEdit * frame_number;
|
||||||
QLineEdit * m_FilenameLineEdit;
|
QLineEdit * m_FilenameLineEdit;
|
||||||
@ -212,31 +152,30 @@ private:
|
|||||||
|
|
||||||
ImagerOperationBase* m_Imager;//
|
ImagerOperationBase* m_Imager;//
|
||||||
|
|
||||||
int m_RecordState;//用来控制相机采集流程,取2的余数,1 → 正在采集,0 → 停止采集
|
int m_RecordState;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>ȡ2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 <20><> <20><><EFBFBD>ڲɼ<DAB2><C9BC><EFBFBD>0 <20><> ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
|
|
||||||
QThread * m_RecordThread;//影像采集线程
|
QThread * m_RecordThread;//Ӱ<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD>߳<EFBFBD>
|
||||||
QThread * m_RgbCameraThread;//rgb相机获取图像线程
|
QThread * m_RgbCameraThread;//rgb<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡͼ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||||
QThread * m_CopyFileThread;//影像文件复制线程
|
QThread * m_CopyFileThread;//Ӱ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||||
FileOperation * m_FileOperation;
|
FileOperation * m_FileOperation;
|
||||||
|
|
||||||
QChartView * m_chartView;
|
QChartView * m_chartView;
|
||||||
QChart* m_chart;
|
|
||||||
|
|
||||||
//QLineSeries *series;
|
//QLineSeries *series;
|
||||||
//QChart *chart;
|
//QChart *chart;
|
||||||
|
|
||||||
QString operateWidget;//当前操作的控件名
|
QString operateWidget;//<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀؼ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
//模拟相机位置
|
//ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
||||||
double widthScale;//QGraphicsView的viewport宽和真实距离比例:widthScale = rect.width() / maxDistance;
|
double widthScale;//QGraphicsView<EFBFBD><EFBFBD>viewport<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>widthScale = rect.width() / maxDistance;
|
||||||
double heightScale;//QGraphicsView的viewport高和真实距离比例:heightScale = rect.height() / maxDistance;
|
double heightScale;//QGraphicsView<EFBFBD><EFBFBD>viewport<EFBFBD>ߺ<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>heightScale = rect.height() / maxDistance;
|
||||||
void setImagerSimulationPos(double x, double y);//ui.graphicsView->imager->setPos(x, y);
|
void setImagerSimulationPos(double x, double y);//ui.graphicsView->imager->setPos(x, y);
|
||||||
|
|
||||||
//采集线规划
|
//<EFBFBD>ɼ<EFBFBD><EFBFBD>߹滮
|
||||||
int m_numberOfRecording;//表示ui.recordLine_tableWidget中的第几行 → 正在采集第几条线
|
int m_numberOfRecording;//<EFBFBD><EFBFBD>ʾui.recordLine_tableWidget<EFBFBD>еĵڼ<EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>ڲɼ<DAB2><C9BC>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
//
|
//
|
||||||
int m_TabWidgetCurrentIndex;//当手动选择TabWidget的标签时,记录变化后的tab index
|
int m_TabWidgetCurrentIndex;//<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ѡ<EFBFBD><EFBFBD>TabWidget<EFBFBD>ı<EFBFBD>ǩʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>仯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>tab index
|
||||||
RgbCameraOperation *m_RgbCamera;
|
RgbCameraOperation *m_RgbCamera;
|
||||||
|
|
||||||
void getRequest(QString str);
|
void getRequest(QString str);
|
||||||
@ -244,86 +183,51 @@ private:
|
|||||||
QActionGroup* mImagerGroup = nullptr;
|
QActionGroup* mImagerGroup = nullptr;
|
||||||
void createActionGroups();
|
void createActionGroups();
|
||||||
void selectingImager(QAction* selectedAction);
|
void selectingImager(QAction* selectedAction);
|
||||||
void updateImagerPicture(const QString& actionName);
|
|
||||||
|
|
||||||
QActionGroup* moveplatformActionGroup = nullptr;
|
QActionGroup* moveplatformActionGroup = nullptr;
|
||||||
void createMoveplatformActionGroup();
|
void createMoveplatformActionGroup();
|
||||||
void selectingMoveplatform(QAction* selectedAction);
|
void selectingMoveplatform(QAction* selectedAction);
|
||||||
|
RobotArmControl* rac;
|
||||||
|
|
||||||
QActionGroup* m_ScenarioActionGroup = nullptr;
|
OneMotorControl* omc;
|
||||||
void createScenarioActionGroup();
|
QDockWidget* dock_omc;
|
||||||
void selectScenario(QAction* selectedAction);
|
|
||||||
|
|
||||||
|
|
||||||
|
TwoMotorControl* tmc;
|
||||||
|
QDockWidget* dock_tmc;
|
||||||
|
|
||||||
FILE* m_hTimesFile;
|
FILE* m_hTimesFile;
|
||||||
|
|
||||||
CustomDockWidgetBase* m_dock_carousel;
|
|
||||||
|
|
||||||
MyCarousel* m_carousel;
|
|
||||||
QLabel* m_cam_label;
|
|
||||||
QPushButton* m_open_rgb_camera_btn;
|
|
||||||
QPushButton* m_close_rgb_camera_btn;
|
|
||||||
|
|
||||||
TabManager* m_tabManager;
|
|
||||||
|
|
||||||
HyperImagerControl* m_hic;
|
|
||||||
ImageControl* m_ic;
|
|
||||||
adjustTable* m_adt;
|
|
||||||
PowerControl* m_pc;
|
|
||||||
RobotArmControl* m_rac;
|
|
||||||
OneMotorControl* m_omc;
|
|
||||||
TwoMotorControl* m_tmc;
|
|
||||||
|
|
||||||
View3DModelManager* m_view3DModelManager;
|
|
||||||
|
|
||||||
LayerTreeView* m_layerTreeView;
|
|
||||||
LayerTree* m_LayerTree = nullptr;
|
|
||||||
LayerTreeModel* m_LayerTreeModel = nullptr;
|
|
||||||
LayerTreeNode* m_RasterGroup = nullptr; // 指向 "Raster" 分组,便于后续添加 layer
|
|
||||||
|
|
||||||
MapLayerStore* m_MapLayerStore = nullptr;
|
|
||||||
|
|
||||||
// Map tools
|
|
||||||
MapTools* m_mapTools = nullptr;
|
|
||||||
QActionGroup* m_mapToolActionGroup = nullptr;
|
|
||||||
void initMapTools();
|
|
||||||
void setMapTool();
|
|
||||||
|
|
||||||
QWidget* m_focusTab=nullptr;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath);
|
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber);
|
||||||
void PlotSpectral(int state);
|
void PlotSpectral(int state);
|
||||||
void onRecordFinishedSignal_WhenFrameNumberMeet();
|
void onRecordFinishedSignal_WhenFrameNumberMeet();
|
||||||
void onRecordFinishedSignal_WhenFrameNumberNotMeet();
|
void onRecordFinishedSignal_WhenFrameNumberNotMeet();
|
||||||
void onsequenceComplete();
|
void onsequenceComplete();
|
||||||
|
|
||||||
void onExit();
|
void onExit();
|
||||||
void onOpenImg();
|
void onconnect();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
void onconnect();//连接相机
|
void testImagerStatus();//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||||
void testImagerStatus();//获取相机状态:连接是否正常
|
|
||||||
void autoExposureFinished();
|
|
||||||
void onAutoExposure();
|
void onAutoExposure();
|
||||||
void onFocus1();
|
void onFocus1();
|
||||||
void onFocus2(int command);
|
void onFocus2(int command);
|
||||||
void onFocusWindowClosed();
|
|
||||||
void onAbout();
|
void onAbout();
|
||||||
void onDark();
|
void onDark();
|
||||||
void recordDarkFinish();
|
void recordDarkFinish();
|
||||||
void onReference();
|
void onReference();
|
||||||
void recordWhiteFinish();
|
void recordWhiteFinish();
|
||||||
void onStartRecordStep1();
|
void onStartRecordStep1();
|
||||||
QWidget* onCreateTab(QString tabName);
|
void onCreateTab(int trackNumber);
|
||||||
void onTabWidgetCurrentChanged(int index);
|
void onTabWidgetCurrentChanged(int index);
|
||||||
void onActionOpenDirectory();
|
void onActionOpenDirectory();
|
||||||
|
|
||||||
void onFramerateChanged(double framerate);
|
void OnFramerateLineeditEditingFinished();//
|
||||||
void onIntegrationTimeChanged(double integrationTime);
|
void OnFramerateSliderChanged(double framerate);//
|
||||||
void onGainChanged(double gain);
|
|
||||||
|
|
||||||
void onLeftMouseButtonPressed(int x, int y, QVector<double> wavelengths, QVector<double> spectrum);//点击影像像元显示光谱
|
void OnIntegratioinTimeEditingFinished();//
|
||||||
void setAxis(QValueAxis* axisX, QValueAxis* axisY);
|
void OnIntegratioinTimeSliderChanged(double IntegratioinTime);//
|
||||||
|
void OnGainEditingFinished();//
|
||||||
|
void OnGainSliderChanged(double Gain);//
|
||||||
|
|
||||||
|
void onLeftMouseButtonPressed(int x, int y);//<2F><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
|
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
@ -342,23 +246,6 @@ public Q_SLOTS:
|
|||||||
void recordFromRobotArm(int fileCounter);
|
void recordFromRobotArm(int fileCounter);
|
||||||
|
|
||||||
void createOneMotorScenario();
|
void createOneMotorScenario();
|
||||||
void createPlantPhenotypeScenario();
|
|
||||||
void onCreated3DModelPlantPhenotype();
|
|
||||||
void onCreated3DModelOneMotor();
|
|
||||||
|
|
||||||
void addLayer(const QString& baseName, const QString& filePath, bool refresh);
|
|
||||||
void onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex);
|
|
||||||
void removeLayerByTreeIndex();
|
|
||||||
void removeAllLayersInRasterGroup();
|
|
||||||
|
|
||||||
void onLayerTreeSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
|
||||||
void onBandSelectionChanged(double rWave, double gWave, double bWave);
|
|
||||||
|
|
||||||
void onMapToolPanTriggered();
|
|
||||||
void onMapToolSpectralTriggered();
|
|
||||||
protected:
|
|
||||||
void closeEvent(QCloseEvent* event) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StartFocusSignal();
|
void StartFocusSignal();
|
||||||
void StartRecordSignal();
|
void StartRecordSignal();
|
||||||
@ -367,3 +254,4 @@ signals:
|
|||||||
void RecordWhiteSignal();
|
void RecordWhiteSignal();
|
||||||
void RecordDarlSignal();
|
void RecordDarlSignal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
767
HPPA/HPPA.ui
767
HPPA/HPPA.ui
@ -6,27 +6,85 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1486</width>
|
<width>1194</width>
|
||||||
<height>898</height>
|
<height>834</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Spectral Insight</string>
|
<string>Hyper Plant Phenotypic Analysis</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset resource="HPPA.qrc">
|
||||||
<normaloff>icon/all/png/Group 356_slices/22.png</normaloff>icon/all/png/Group 356_slices/22.png</iconset>
|
<normaloff>:/HPPA/HPPA.ico</normaloff>:/HPPA/HPPA.ico</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget"/>
|
<widget class="QWidget" name="centralWidget">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTabWidget" name="ImageViewerTabWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>5</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab_4">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Tab 1</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_5">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Tab 2</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1486</width>
|
<width>1194</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -70,7 +128,8 @@ color:white;
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>文件</string>
|
<string>文件</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="mActionOpenImg"/>
|
<addaction name="action_9"/>
|
||||||
|
<addaction name="action_10"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="action_11"/>
|
<addaction name="action_11"/>
|
||||||
<addaction name="action_exit"/>
|
<addaction name="action_exit"/>
|
||||||
@ -132,7 +191,11 @@ color:white;
|
|||||||
<string>应用场景</string>
|
<string>应用场景</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="mActionOneMotorScenario"/>
|
<addaction name="mActionOneMotorScenario"/>
|
||||||
<addaction name="mActionPlantPhenotypeScenario"/>
|
<addaction name="action_8"/>
|
||||||
|
<addaction name="action2"/>
|
||||||
|
<addaction name="action_7"/>
|
||||||
|
<addaction name="action_3"/>
|
||||||
|
<addaction name="action_6"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_4">
|
<widget class="QMenu" name="menu_4">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -197,26 +260,138 @@ QToolBar QToolButton:hover {
|
|||||||
<addaction name="action_reference"/>
|
<addaction name="action_reference"/>
|
||||||
<addaction name="action_start_recording"/>
|
<addaction name="action_start_recording"/>
|
||||||
<addaction name="actionOpenDirectory"/>
|
<addaction name="actionOpenDirectory"/>
|
||||||
<addaction name="mActionPan"/>
|
|
||||||
<addaction name="mActionSpectral"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar">
|
<widget class="QStatusBar" name="statusBar">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">QStatusBar {
|
<string notr="true">QStatusBar {
|
||||||
background-color: #0D1233;
|
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
|
color: white; /* 文字颜色 */
|
||||||
|
border-top: 1px solid #ccc; /* 顶部边框 */
|
||||||
|
padding: 5px; /* 内边距 */
|
||||||
}
|
}
|
||||||
</string>
|
</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="CustomDockWidgetBase" name="mDockWidgetSimulator">
|
<widget class="QDockWidget" name="mDockWidgetRGBCamera">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true">/* 标题设置 */
|
||||||
|
QDockWidget::title {
|
||||||
|
text-align: left;
|
||||||
|
background-color: rgb(240, 240, 240);
|
||||||
|
/*padding-left: 35px;*/
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>RGB 相机</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>1</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
<property name="mouseTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QGroupBox {
|
||||||
|
/* border: 2px solid #3498db; 边框颜色 */
|
||||||
|
border-radius: 5px; /* 圆角 */
|
||||||
|
padding: 10px; /* 内边距 */
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
QGroupBox:title {
|
||||||
|
subcontrol-position: top left; /* 标题位置 */
|
||||||
|
padding: 0 10px; /* 标题内边距 */
|
||||||
|
font-weight: bold; /* 标题字体加粗 */
|
||||||
|
color: #3498db; /* 标题文字颜色 */
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="close_rgb_camera_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>关闭</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="open_rgb_camera_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>打开</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="cam_label">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>摄像头关闭!</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="mDockWidgetSimulator">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">/* 标题设置 */
|
||||||
|
QDockWidget::title {
|
||||||
|
text-align: left;
|
||||||
|
background-color: rgb(240, 240, 240);
|
||||||
|
/*padding-left: 35px;*/
|
||||||
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="features">
|
<property name="features">
|
||||||
<set>QDockWidget::AllDockWidgetFeatures</set>
|
<set>QDockWidget::AllDockWidgetFeatures</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>3D模型</string>
|
<string>线性平台位置模拟</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
@ -238,245 +413,303 @@ QToolBar QToolButton:hover {
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="ImagerPositionSimulation" name="graphicsView">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="CustomDockWidgetHideAbove" name="mDockWidgetSpectrometer">
|
<widget class="QDockWidget" name="mDockWidgetSpectralViewer">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true">/* 标题设置 */
|
||||||
|
QDockWidget::title {
|
||||||
|
text-align: left;
|
||||||
|
background-color: rgb(240, 240, 240);
|
||||||
|
/*padding-left: 35px;*/
|
||||||
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>控制</string>
|
<string>光谱曲线</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QWidget" name="controlContents">
|
<widget class="QWidget" name="dockWidgetContents_3">
|
||||||
<property name="styleSheet">
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
<string notr="true">QWidget #controlContents
|
|
||||||
{
|
|
||||||
background-color: #0E1C4C;
|
|
||||||
|
|
||||||
border-top: 1px solid #2c586b;
|
|
||||||
border-left: 1px solid #2c586b;
|
|
||||||
border-right: 1px solid #2c586b;
|
|
||||||
border-bottom: 1px solid #2c586b;
|
|
||||||
|
|
||||||
border-top-left-radius: 0px;
|
|
||||||
border-top-right-radius: 0px;
|
|
||||||
border-bottom-left-radius: 10px;
|
|
||||||
border-bottom-right-radius: 10px;
|
|
||||||
}
|
|
||||||
</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QTabWidget" name="controlTabWidget">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QTabBar::tab {
|
|
||||||
background: #0E1C4C;
|
|
||||||
color: white;
|
|
||||||
padding: 6px 12px;
|
|
||||||
border: none;
|
|
||||||
border-top: 1px solid #27376C;
|
|
||||||
height: 41;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTabBar::tab:selected {
|
|
||||||
background: #0D1233;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*QTabBar::tab:hover {
|
|
||||||
background: #141A45;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
QTabWidget::pane {
|
|
||||||
border: none;
|
|
||||||
border-top: 1px solid #27376C;
|
|
||||||
background: #0D1233;
|
|
||||||
top: -1px;
|
|
||||||
}
|
|
||||||
</string>
|
|
||||||
</property>
|
|
||||||
<property name="tabPosition">
|
|
||||||
<enum>QTabWidget::South</enum>
|
|
||||||
</property>
|
|
||||||
<property name="tabShape">
|
|
||||||
<enum>QTabWidget::Rounded</enum>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="elideMode">
|
<property name="topMargin">
|
||||||
<enum>Qt::ElideNone</enum>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="rgbCameraWidget">
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="mDockWidgetSpectrometer">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">QGroupBox
|
<string notr="true">/* 标题设置 */
|
||||||
{
|
QDockWidget::title {
|
||||||
border: 12px solid transparent;
|
text-align: left;
|
||||||
color: #ACCDFF;
|
background-color: rgb(240, 240, 240);
|
||||||
}
|
/*padding-left: 35px;*/
|
||||||
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;*/
|
|
||||||
font: 19pt "新宋体";
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}</string>
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="title">
|
<property name="windowTitle">
|
||||||
<string>rgb相机</string>
|
<string>光谱仪</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>2</number>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_4" rowstretch="2,4,2" columnstretch="1,3,1">
|
<widget class="QWidget" name="dockWidgetContents_4">
|
||||||
<item row="0" column="1">
|
<layout class="QGridLayout" name="gridLayout_13">
|
||||||
<spacer name="verticalSpacer">
|
<property name="leftMargin">
|
||||||
<property name="orientation">
|
<number>9</number>
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="topMargin">
|
||||||
<size>
|
<number>9</number>
|
||||||
<width>20</width>
|
</property>
|
||||||
<height>174</height>
|
<property name="rightMargin">
|
||||||
</size>
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<spacer name="horizontalSpacer">
|
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_16">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>115</width>
|
<width>100</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,1">
|
<widget class="QDoubleSlider" name="FramerateSlider">
|
||||||
<property name="spacing">
|
<property name="orientation">
|
||||||
<number>20</number>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="take_video_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>录制视频</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QPushButton" name="take_photo_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>拍照</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="close_rgb_camera_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>关闭</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="open_rgb_camera_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>打开</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="0" column="0">
|
||||||
<spacer name="horizontalSpacer_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>帧率</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="framerate_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>积分时间</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="integratioin_time_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_17">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>115</width>
|
<width>100</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item>
|
||||||
|
<widget class="QDoubleSlider" name="IntegratioinTimeSlider">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>gain</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="gain_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_18">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSlider" name="GainSlider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -484,7 +717,7 @@ QPushButton:pressed
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>173</height>
|
<height>123</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -492,88 +725,6 @@ QPushButton:pressed
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolBar" name="toolBar">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>toolBar</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QToolBar {
|
|
||||||
background: #040125;/*transparent*/
|
|
||||||
border: 1px solid #040125;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="movable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>LeftToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolBar" name="toolBar_2">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>toolBar_2</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QToolBar {
|
|
||||||
background: #040125;/*transparent*/
|
|
||||||
border: 1px solid #040125;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="movable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>RightToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolBar" name="toolBar_3">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>toolBar_3</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QToolBar {
|
|
||||||
background: #040125;/*transparent*/
|
|
||||||
border: 1px solid #040125;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="movable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>BottomToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<action name="action_exit">
|
<action name="action_exit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>退出</string>
|
<string>退出</string>
|
||||||
@ -749,9 +900,6 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="mActionOneMotorScenario">
|
<action name="mActionOneMotorScenario">
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>室内1轴线性平台</string>
|
<string>室内1轴线性平台</string>
|
||||||
</property>
|
</property>
|
||||||
@ -781,7 +929,7 @@ QPushButton:pressed
|
|||||||
<string>三脚架(旋转平台)</string>
|
<string>三脚架(旋转平台)</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="mActionOpenImg">
|
<action name="action_9">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打开影像</string>
|
<string>打开影像</string>
|
||||||
</property>
|
</property>
|
||||||
@ -801,10 +949,7 @@ QPushButton:pressed
|
|||||||
<string>拼接</string>
|
<string>拼接</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="mActionPlantPhenotypeScenario">
|
<action name="action_3">
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>植物表型</string>
|
<string>植物表型</string>
|
||||||
</property>
|
</property>
|
||||||
@ -822,30 +967,18 @@ QPushButton:pressed
|
|||||||
<string>2 轴线性马达</string>
|
<string>2 轴线性马达</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="mActionPan">
|
|
||||||
<property name="text">
|
|
||||||
<string>漫游</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="mActionSpectral">
|
|
||||||
<property name="text">
|
|
||||||
<string>光谱</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CustomDockWidgetBase</class>
|
<class>QDoubleSlider</class>
|
||||||
<extends>QDockWidget</extends>
|
<extends>QSlider</extends>
|
||||||
<header>customdockwidgetbase.h</header>
|
<header>qdoubleslider.h</header>
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CustomDockWidgetHideAbove</class>
|
<class>ImagerPositionSimulation</class>
|
||||||
<extends>QDockWidget</extends>
|
<extends>QGraphicsView</extends>
|
||||||
<header>CustomDockWidgetBase.h</header>
|
<header location="global">imagerpositionsimulation.h</header>
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
@ -14,16 +14,16 @@
|
|||||||
<ProjectGuid>{E7886664-B69E-4781-BCBE-804574FB4033}</ProjectGuid>
|
<ProjectGuid>{E7886664-B69E-4781-BCBE-804574FB4033}</ProjectGuid>
|
||||||
<Keyword>QtVS_v304</Keyword>
|
<Keyword>QtVS_v304</Keyword>
|
||||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
@ -32,7 +32,7 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||||
<QtInstall>5.13.2_msvc2017_64</QtInstall>
|
<QtInstall>5.13.2_msvc2017_64</QtInstall>
|
||||||
<QtModules>core;network;gui;svg;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts</QtModules>
|
<QtModules>core;network;gui;widgets;serialport;websockets;charts</QtModules>
|
||||||
<QtBuildConfig>debug</QtBuildConfig>
|
<QtBuildConfig>debug</QtBuildConfig>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||||
@ -106,38 +106,17 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="aboutWindow.cpp" />
|
<ClCompile Include="aboutWindow.cpp" />
|
||||||
<ClCompile Include="adjustTable.cpp" />
|
<ClCompile Include="adjustTable.cpp" />
|
||||||
<ClCompile Include="AspectRatioLabel.cpp" />
|
|
||||||
<ClCompile Include="CaptureCoordinator.cpp" />
|
<ClCompile Include="CaptureCoordinator.cpp" />
|
||||||
<ClCompile Include="Carousel.cpp" />
|
|
||||||
<ClCompile Include="Corning410Imager.cpp" />
|
<ClCompile Include="Corning410Imager.cpp" />
|
||||||
<ClCompile Include="CustomDockWidgetBase.cpp" />
|
|
||||||
<ClCompile Include="hppaConfigFile.cpp" />
|
<ClCompile Include="hppaConfigFile.cpp" />
|
||||||
<ClCompile Include="HyperImagerControl.cpp" />
|
|
||||||
<ClCompile Include="imageControl.cpp" />
|
|
||||||
<ClCompile Include="ImagerOperationBase.cpp" />
|
<ClCompile Include="ImagerOperationBase.cpp" />
|
||||||
<ClCompile Include="imager_base.cpp" />
|
<ClCompile Include="imager_base.cpp" />
|
||||||
<ClCompile Include="irisximeaimager.cpp" />
|
<ClCompile Include="irisximeaimager.cpp" />
|
||||||
<ClCompile Include="LayerTree.cpp" />
|
|
||||||
<ClCompile Include="LayerTreeGroupNode.cpp" />
|
|
||||||
<ClCompile Include="LayerTreeLayerNode.cpp" />
|
|
||||||
<ClCompile Include="LayerTreeModel.cpp" />
|
|
||||||
<ClCompile Include="LayerTreeNode.cpp" />
|
|
||||||
<ClCompile Include="LayerTreeView.cpp" />
|
|
||||||
<ClCompile Include="LayerTreeViewMenuProvider.cpp" />
|
|
||||||
<ClCompile Include="MapLayer.cpp" />
|
|
||||||
<ClCompile Include="MapLayerStore.cpp" />
|
|
||||||
<ClCompile Include="MapTool.cpp" />
|
|
||||||
<ClCompile Include="MapToolPan.cpp" />
|
|
||||||
<ClCompile Include="MapTools.cpp" />
|
|
||||||
<ClCompile Include="MapToolSpectral.cpp" />
|
|
||||||
<ClCompile Include="OneMotorControl.cpp" />
|
<ClCompile Include="OneMotorControl.cpp" />
|
||||||
<ClCompile Include="path_tc.cpp" />
|
<ClCompile Include="path_tc.cpp" />
|
||||||
<ClCompile Include="PowerControl.cpp" />
|
<ClCompile Include="PowerControl.cpp" />
|
||||||
<ClCompile Include="QDoubleSlider.cpp" />
|
<ClCompile Include="QDoubleSlider.cpp" />
|
||||||
<ClCompile Include="QMotorDoubleSlider.cpp" />
|
<ClCompile Include="QMotorDoubleSlider.cpp" />
|
||||||
<ClCompile Include="RasterDataProvider.cpp" />
|
|
||||||
<ClCompile Include="RasterLayer.cpp" />
|
|
||||||
<ClCompile Include="RasterRenderer.cpp" />
|
|
||||||
<ClCompile Include="resononImager.cpp" />
|
<ClCompile Include="resononImager.cpp" />
|
||||||
<ClCompile Include="ResononNirImager.cpp" />
|
<ClCompile Include="ResononNirImager.cpp" />
|
||||||
<ClCompile Include="RgbCameraOperation.cpp" />
|
<ClCompile Include="RgbCameraOperation.cpp" />
|
||||||
@ -146,11 +125,8 @@
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="TabManager.cpp" />
|
|
||||||
<ClCompile Include="TwoMotorControl.cpp" />
|
<ClCompile Include="TwoMotorControl.cpp" />
|
||||||
<ClCompile Include="utility_tc.cpp" />
|
<ClCompile Include="utility_tc.cpp" />
|
||||||
<ClCompile Include="View3D.cpp" />
|
|
||||||
<ClCompile Include="View3DModelManager.cpp" />
|
|
||||||
<QtRcc Include="HPPA.qrc" />
|
<QtRcc Include="HPPA.qrc" />
|
||||||
<QtUic Include="about.ui" />
|
<QtUic Include="about.ui" />
|
||||||
<QtUic Include="adjustTable.ui" />
|
<QtUic Include="adjustTable.ui" />
|
||||||
@ -167,8 +143,6 @@
|
|||||||
<ClCompile Include="imagerSimulatioin.cpp" />
|
<ClCompile Include="imagerSimulatioin.cpp" />
|
||||||
<ClCompile Include="ImageViewer.cpp" />
|
<ClCompile Include="ImageViewer.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<QtUic Include="hyperImagerControl.ui" />
|
|
||||||
<QtUic Include="imgControl.ui" />
|
|
||||||
<QtUic Include="oneMotorControl.ui" />
|
<QtUic Include="oneMotorControl.ui" />
|
||||||
<QtUic Include="PathPlan.ui" />
|
<QtUic Include="PathPlan.ui" />
|
||||||
<QtUic Include="PowerControl.ui" />
|
<QtUic Include="PowerControl.ui" />
|
||||||
@ -187,39 +161,15 @@
|
|||||||
<QtMoc Include="image2display.h" />
|
<QtMoc Include="image2display.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="View3DModelManager.h" />
|
|
||||||
<QtMoc Include="View3D.h" />
|
|
||||||
<QtMoc Include="adjustTable.h" />
|
<QtMoc Include="adjustTable.h" />
|
||||||
<QtMoc Include="PowerControl.h" />
|
<QtMoc Include="PowerControl.h" />
|
||||||
<QtMoc Include="RobotArmControl.h" />
|
<QtMoc Include="RobotArmControl.h" />
|
||||||
<QtMoc Include="Corning410Imager.h" />
|
<QtMoc Include="Corning410Imager.h" />
|
||||||
<QtMoc Include="CaptureCoordinator.h" />
|
<QtMoc Include="CaptureCoordinator.h" />
|
||||||
<QtMoc Include="CustomDockWidgetBase.h" />
|
|
||||||
<QtMoc Include="Carousel.h" />
|
|
||||||
<QtMoc Include="imageControl.h" />
|
|
||||||
<QtMoc Include="AspectRatioLabel.h" />
|
|
||||||
<QtMoc Include="HyperImagerControl.h" />
|
|
||||||
<ClInclude Include="imager_base.h" />
|
<ClInclude Include="imager_base.h" />
|
||||||
<ClInclude Include="irisximeaimager.h" />
|
<ClInclude Include="irisximeaimager.h" />
|
||||||
<QtMoc Include="OneMotorControl.h" />
|
<QtMoc Include="OneMotorControl.h" />
|
||||||
<QtMoc Include="TwoMotorControl.h" />
|
<QtMoc Include="TwoMotorControl.h" />
|
||||||
<QtMoc Include="TabManager.h" />
|
|
||||||
<QtMoc Include="LayerTreeModel.h" />
|
|
||||||
<QtMoc Include="LayerTreeNode.h" />
|
|
||||||
<QtMoc Include="LayerTree.h" />
|
|
||||||
<QtMoc Include="LayerTreeGroupNode.h" />
|
|
||||||
<QtMoc Include="LayerTreeLayerNode.h" />
|
|
||||||
<QtMoc Include="MapLayer.h" />
|
|
||||||
<QtMoc Include="RasterLayer.h" />
|
|
||||||
<QtMoc Include="MapLayerStore.h" />
|
|
||||||
<ClInclude Include="LayerTreeView.h" />
|
|
||||||
<QtMoc Include="LayerTreeViewMenuProvider.h" />
|
|
||||||
<QtMoc Include="MapTool.h" />
|
|
||||||
<QtMoc Include="MapToolPan.h" />
|
|
||||||
<QtMoc Include="MapToolSpectral.h" />
|
|
||||||
<QtMoc Include="MapTools.h" />
|
|
||||||
<ClInclude Include="RasterDataProvider.h" />
|
|
||||||
<ClInclude Include="RasterRenderer.h" />
|
|
||||||
<ClInclude Include="utility_tc.h" />
|
<ClInclude Include="utility_tc.h" />
|
||||||
<QtMoc Include="aboutWindow.h" />
|
<QtMoc Include="aboutWindow.h" />
|
||||||
<ClInclude Include="hppaConfigFile.h" />
|
<ClInclude Include="hppaConfigFile.h" />
|
||||||
|
|||||||
@ -21,6 +21,15 @@
|
|||||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||||
<Extensions>ts</Extensions>
|
<Extensions>ts</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Header Files\motor">
|
||||||
|
<UniqueIdentifier>{eadfac5f-f4f9-49e2-9f99-0849bf074cf8}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\motor">
|
||||||
|
<UniqueIdentifier>{4672856c-86fb-46e3-94ff-0a296dcc6111}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\focus">
|
||||||
|
<UniqueIdentifier>{f2bfb93e-9ef8-4fdd-a776-db93b81af553}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="HPPA.qrc">
|
<QtRcc Include="HPPA.qrc">
|
||||||
@ -124,78 +133,6 @@
|
|||||||
<ClCompile Include="TwoMotorControl.cpp">
|
<ClCompile Include="TwoMotorControl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CustomDockWidgetBase.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Carousel.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="View3D.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TabManager.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="View3DModelManager.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LayerTreeNode.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LayerTreeModel.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LayerTree.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LayerTreeGroupNode.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LayerTreeLayerNode.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="MapLayer.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="RasterLayer.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="RasterDataProvider.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="RasterRenderer.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="MapLayerStore.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LayerTreeView.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="LayerTreeViewMenuProvider.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="imageControl.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="MapTool.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="MapToolPan.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="MapToolSpectral.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="MapTools.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="AspectRatioLabel.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="HyperImagerControl.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h">
|
<QtMoc Include="fileOperation.h">
|
||||||
@ -255,69 +192,6 @@
|
|||||||
<QtMoc Include="CaptureCoordinator.h">
|
<QtMoc Include="CaptureCoordinator.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="CustomDockWidgetBase.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="Carousel.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="View3D.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="TabManager.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="View3DModelManager.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="LayerTreeModel.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="LayerTreeNode.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="LayerTree.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="LayerTreeGroupNode.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="LayerTreeLayerNode.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="MapLayer.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="RasterLayer.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="MapLayerStore.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="LayerTreeViewMenuProvider.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="imageControl.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="MapToolSpectral.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="MapToolPan.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="MapTool.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="MapTools.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="AspectRatioLabel.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="HyperImagerControl.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="imageProcessor.h">
|
<ClInclude Include="imageProcessor.h">
|
||||||
@ -350,15 +224,6 @@
|
|||||||
<ClInclude Include="irisximeaimager.h">
|
<ClInclude Include="irisximeaimager.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="RasterDataProvider.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="RasterRenderer.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="LayerTreeView.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtUic Include="FocusDialog.ui">
|
<QtUic Include="FocusDialog.ui">
|
||||||
@ -391,12 +256,6 @@
|
|||||||
<QtUic Include="twoMotorControl.ui">
|
<QtUic Include="twoMotorControl.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
<QtUic Include="imgControl.ui">
|
|
||||||
<Filter>Form Files</Filter>
|
|
||||||
</QtUic>
|
|
||||||
<QtUic Include="hyperImagerControl.ui">
|
|
||||||
<Filter>Form Files</Filter>
|
|
||||||
</QtUic>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
|||||||
@ -1,141 +0,0 @@
|
|||||||
#include "HyperImagerControl.h"
|
|
||||||
|
|
||||||
HyperImagerControl::HyperImagerControl(QWidget* parent)
|
|
||||||
: QDialog(parent)
|
|
||||||
{
|
|
||||||
ui.setupUi(this);
|
|
||||||
|
|
||||||
connect(ui.framerate_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onFramerateSpinBoxEditingFinished);
|
|
||||||
connect(ui.FramerateSlider, &QDoubleSlider::valueChanged, this, &HyperImagerControl::onFramerateSliderChanged);
|
|
||||||
connect(ui.FramerateSlider, &QDoubleSlider::sliderReleased, this, &HyperImagerControl::onFramerateSliderReleased);
|
|
||||||
|
|
||||||
connect(ui.integratioin_time_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onIntegrationTimeSpinBoxEditingFinished);
|
|
||||||
connect(ui.IntegratioinTimeSlider, &QDoubleSlider::valueChanged, this, &HyperImagerControl::onIntegrationTimeSliderChanged);
|
|
||||||
connect(ui.IntegratioinTimeSlider, &QDoubleSlider::sliderReleased, this, &HyperImagerControl::onIntegrationTimeSliderReleased);
|
|
||||||
|
|
||||||
connect(ui.gain_spinBox, &QDoubleSpinBox::editingFinished, this, &HyperImagerControl::onGainSpinBoxEditingFinished);
|
|
||||||
connect(ui.GainSlider, &QSlider::valueChanged, this, &HyperImagerControl::onGainSliderChanged);
|
|
||||||
connect(ui.GainSlider, &QSlider::sliderReleased, this, &HyperImagerControl::onGainSliderReleased);
|
|
||||||
|
|
||||||
ui.framerate_spinBox->setMinimum(1);
|
|
||||||
ui.framerate_spinBox->setMaximum(250);
|
|
||||||
ui.FramerateSlider->setMinimum(1);
|
|
||||||
ui.FramerateSlider->setMaximum(250);
|
|
||||||
|
|
||||||
ui.gain_spinBox->setMinimum(0);
|
|
||||||
ui.gain_spinBox->setMaximum(12);
|
|
||||||
ui.GainSlider->setMinimum(0);
|
|
||||||
ui.GainSlider->setMaximum(12);
|
|
||||||
}
|
|
||||||
|
|
||||||
HyperImagerControl::~HyperImagerControl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::setFrameRate(double frameRate)
|
|
||||||
{
|
|
||||||
ui.framerate_spinBox->setValue(frameRate);
|
|
||||||
ui.FramerateSlider->setValue(frameRate);
|
|
||||||
|
|
||||||
updateIntegrationTimeRange(frameRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::setIntegrationTime(double integrationTime)
|
|
||||||
{
|
|
||||||
ui.integratioin_time_spinBox->setValue(integrationTime);
|
|
||||||
ui.IntegratioinTimeSlider->setValue(integrationTime);
|
|
||||||
|
|
||||||
updateFramerateRange(integrationTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::setGain(double gain)
|
|
||||||
{
|
|
||||||
ui.gain_spinBox->setValue(gain);
|
|
||||||
ui.GainSlider->setValue(gain);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onFramerateSpinBoxEditingFinished()
|
|
||||||
{
|
|
||||||
double framerate = ui.framerate_spinBox->value();
|
|
||||||
ui.FramerateSlider->setValue(framerate);
|
|
||||||
emit framerateChanged(framerate);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onFramerateSliderChanged(double framerate)
|
|
||||||
{
|
|
||||||
ui.framerate_spinBox->blockSignals(true);
|
|
||||||
ui.framerate_spinBox->setValue(framerate);
|
|
||||||
ui.framerate_spinBox->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onFramerateSliderReleased()
|
|
||||||
{
|
|
||||||
double framerate = ui.framerate_spinBox->value();//<2F><><EFBFBD>ᴥ<EFBFBD><E1B4A5>QDoubleSpinBox::editingFinished<65>źţ<C5BA><C5A3>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD>onFramerateSpinBoxEditingFinished<65>ۺ<EFBFBD><DBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD><D5B7><EFBFBD>framerateChanged<65>źš<C5BA>
|
|
||||||
emit framerateChanged(framerate);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onIntegrationTimeSpinBoxEditingFinished()
|
|
||||||
{
|
|
||||||
double integrationTime = ui.integratioin_time_spinBox->value();
|
|
||||||
ui.IntegratioinTimeSlider->setValue(integrationTime);
|
|
||||||
emit integrationTimeChanged(integrationTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onIntegrationTimeSliderChanged(double integrationTime)
|
|
||||||
{
|
|
||||||
ui.integratioin_time_spinBox->blockSignals(true);
|
|
||||||
ui.integratioin_time_spinBox->setValue(integrationTime);
|
|
||||||
ui.integratioin_time_spinBox->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onIntegrationTimeSliderReleased()
|
|
||||||
{
|
|
||||||
double integrationTime = ui.integratioin_time_spinBox->value();
|
|
||||||
emit integrationTimeChanged(integrationTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onGainSpinBoxEditingFinished()
|
|
||||||
{
|
|
||||||
double gain = ui.gain_spinBox->value();
|
|
||||||
ui.GainSlider->setValue(gain);
|
|
||||||
emit gainChanged(gain);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onGainSliderChanged(double gain)
|
|
||||||
{
|
|
||||||
ui.gain_spinBox->blockSignals(true);
|
|
||||||
ui.gain_spinBox->setValue(gain);
|
|
||||||
ui.gain_spinBox->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::onGainSliderReleased()
|
|
||||||
{
|
|
||||||
double gain = ui.gain_spinBox->value();
|
|
||||||
emit gainChanged(gain);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::updateIntegrationTimeRange(double frameRate)
|
|
||||||
{
|
|
||||||
double maxIntegrationTime = 1.0 / frameRate * 1000.0; // <20><><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
ui.IntegratioinTimeSlider->blockSignals(true);
|
|
||||||
ui.IntegratioinTimeSlider->setMaximum(maxIntegrationTime);
|
|
||||||
ui.IntegratioinTimeSlider->blockSignals(false);
|
|
||||||
|
|
||||||
ui.integratioin_time_spinBox->blockSignals(true);
|
|
||||||
ui.integratioin_time_spinBox->setMaximum(maxIntegrationTime);
|
|
||||||
ui.integratioin_time_spinBox->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HyperImagerControl::updateFramerateRange(double integrationTime)
|
|
||||||
{
|
|
||||||
double maxFramerate = 1.0 / (integrationTime / 1000.0); // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>(<28><><EFBFBD><EFBFBD>)ת֡<D7AA><D6A1>
|
|
||||||
|
|
||||||
ui.FramerateSlider->blockSignals(true);
|
|
||||||
ui.FramerateSlider->setMaximum(maxFramerate);
|
|
||||||
ui.FramerateSlider->blockSignals(false);
|
|
||||||
|
|
||||||
ui.framerate_spinBox->blockSignals(true);
|
|
||||||
ui.framerate_spinBox->setMaximum(maxFramerate);
|
|
||||||
ui.framerate_spinBox->blockSignals(false);
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
#include "ui_hyperImagerControl.h"
|
|
||||||
|
|
||||||
#include "AspectRatioLabel.h"
|
|
||||||
|
|
||||||
class QDoubleSlider;
|
|
||||||
|
|
||||||
class HyperImagerControl : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
HyperImagerControl(QWidget* parent = nullptr);
|
|
||||||
~HyperImagerControl();
|
|
||||||
|
|
||||||
AspectRatioLabel* imagerPictureLabel() const { return ui.imagerPictureLabel; }
|
|
||||||
|
|
||||||
void setFrameRate(double frameRate);
|
|
||||||
void setIntegrationTime(double integrationTime);
|
|
||||||
void setGain(double gain);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void framerateChanged(double framerate);
|
|
||||||
void integrationTimeChanged(double integrationTime);
|
|
||||||
void gainChanged(double gain);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void onFramerateSpinBoxEditingFinished();
|
|
||||||
void onFramerateSliderChanged(double framerate);
|
|
||||||
void onFramerateSliderReleased();
|
|
||||||
void onIntegrationTimeSpinBoxEditingFinished();
|
|
||||||
void onIntegrationTimeSliderChanged(double integrationTime);
|
|
||||||
void onIntegrationTimeSliderReleased();
|
|
||||||
void onGainSpinBoxEditingFinished();
|
|
||||||
void onGainSliderChanged(double gain);
|
|
||||||
void onGainSliderReleased();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateIntegrationTimeRange(double frameRate);
|
|
||||||
void updateFramerateRange(double integrationTime);
|
|
||||||
|
|
||||||
Ui::HyperImagerControl ui;
|
|
||||||
};
|
|
||||||
@ -1,26 +1,24 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
#include "ImageViewer.h"
|
#include "ImageViewer.h"
|
||||||
#include "RasterLayer.h"
|
|
||||||
#include "MapTool.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define VIEW_CENTER viewport()->rect().center()
|
#define VIEW_CENTER viewport()->rect().center()
|
||||||
#define VIEW_WIDTH viewport()->rect().width()
|
#define VIEW_WIDTH viewport()->rect().width()
|
||||||
#define VIEW_HEIGHT viewport()->rect().height()
|
#define VIEW_HEIGHT viewport()->rect().height()
|
||||||
|
|
||||||
Mapcavas::Mapcavas(QWidget* pParent) :QGraphicsView(pParent)
|
|
||||||
|
ImageViewer::ImageViewer(QWidget* pParent) :QGraphicsView(pParent)
|
||||||
{
|
{
|
||||||
setRenderHint(QPainter::Antialiasing);
|
setRenderHint(QPainter::Antialiasing);
|
||||||
setRenderHint(QPainter::SmoothPixmapTransform);
|
setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
setDragMode(QGraphicsView::ScrollHandDrag);
|
||||||
|
|
||||||
// ʹ<EFBFBD><EFBFBD> Qt Ĭ<><C4AC> anchor <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
// <20>ؼ<EFBFBD><D8BC>㣺<EFBFBD><E3A3BA>ʹ<EFBFBD><EFBFBD> Qt Ĭ<>ϵ<EFBFBD> anchor<6F><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
setTransformationAnchor(QGraphicsView::NoAnchor);
|
setTransformationAnchor(QGraphicsView::NoAnchor);
|
||||||
setResizeAnchor(QGraphicsView::NoAnchor);
|
setResizeAnchor(QGraphicsView::NoAnchor);
|
||||||
|
|
||||||
@ -45,23 +43,24 @@ Mapcavas::Mapcavas(QWidget* pParent) :QGraphicsView(pParent)
|
|||||||
m_translateSpeed = 1.0;
|
m_translateSpeed = 1.0;
|
||||||
m_bMouseTranslate = false;
|
m_bMouseTranslate = false;
|
||||||
|
|
||||||
|
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setFrameShape(QFrame::NoFrame);
|
setFrameShape(QFrame::NoFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mapcavas::~Mapcavas()
|
ImageViewer::~ImageViewer()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::DisplayFrameNumber(int frameNumber)
|
void ImageViewer::DisplayFrameNumber(int frameNumber)
|
||||||
{
|
{
|
||||||
m_framNumberLabel->setText(QString::number(frameNumber));
|
m_framNumberLabel->setText(QString::number(frameNumber));
|
||||||
m_framNumberLabel->adjustSize();
|
m_framNumberLabel->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::SetImage(QPixmap *image)
|
void ImageViewer::SetImage(QPixmap *image)
|
||||||
{
|
{
|
||||||
if (!HasImage())
|
if (!HasImage())
|
||||||
{
|
{
|
||||||
@ -74,7 +73,7 @@ void Mapcavas::SetImage(QPixmap *image)
|
|||||||
ensureSceneVisible();
|
ensureSceneVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::ensureSceneVisible()
|
void ImageViewer::ensureSceneVisible()
|
||||||
{
|
{
|
||||||
resetTransform();
|
resetTransform();
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ void Mapcavas::ensureSceneVisible()
|
|||||||
centerOn(scene_rect.center());
|
centerOn(scene_rect.center());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mapcavas::HasImage()
|
bool ImageViewer::HasImage()
|
||||||
{
|
{
|
||||||
if (m_GraphicsPixmapItemHandle == nullptr)
|
if (m_GraphicsPixmapItemHandle == nullptr)
|
||||||
{
|
{
|
||||||
@ -103,57 +102,38 @@ bool Mapcavas::HasImage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::updateCrosshair(double sceneX, double sceneY)
|
void ImageViewer::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
QPen pen(Qt::red, 2.0);
|
//qDebug() << "---------------+++++++++++++++++++++++++++++++++++++++++++++++++++ ";
|
||||||
pen.setCosmetic(true); // constant screen-width regardless of zoom
|
//if (true)//HasImage()
|
||||||
|
//{
|
||||||
|
// //Χ<><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD>https://blog.csdn.net/GoForwardToStep/article/details/77035287?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param
|
||||||
|
// // <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view<65><77>λ<EFBFBD><CEBB>;
|
||||||
|
// QPointF cursorPoint = event->pos();
|
||||||
|
// // <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>scene<6E><65>λ<EFBFBD><CEBB>;
|
||||||
|
// QPointF scenePos = this->mapToScene(QPoint(cursorPoint.x(), cursorPoint.y()));
|
||||||
|
|
||||||
if (!m_hLine)
|
// // <20><>ȡview<65>Ŀ<EFBFBD><C4BF><EFBFBD>;
|
||||||
{
|
// qreal viewWidth = this->viewport()->width();
|
||||||
m_hLine = m_qtGraphicsScene->addLine(0, 0, 0, 0, pen);
|
// qreal viewHeight = this->viewport()->height();
|
||||||
m_hLine->setZValue(1e9);
|
|
||||||
}
|
|
||||||
if (!m_vLine)
|
|
||||||
{
|
|
||||||
m_vLine = m_qtGraphicsScene->addLine(0, 0, 0, 0, pen);
|
|
||||||
m_vLine->setZValue(1e9);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hLine->setPen(pen);
|
// // <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>൱<EFBFBD><E0B5B1>view<65><77>С<EFBFBD>ĺ<EFBFBD><C4BA>ݱ<EFBFBD><DDB1><EFBFBD>;
|
||||||
m_vLine->setPen(pen);
|
// qreal hScale = cursorPoint.x() / viewWidth;
|
||||||
|
// qreal vScale = cursorPoint.y() / viewHeight;
|
||||||
m_hLine->setLine(sceneX - m_CrosshairHalfLen, sceneY,
|
|
||||||
sceneX + m_CrosshairHalfLen, sceneY);
|
|
||||||
m_vLine->setLine(sceneX, sceneY - m_CrosshairHalfLen,
|
|
||||||
sceneX, sceneY + m_CrosshairHalfLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapcavas::removeCrosshair()
|
|
||||||
{
|
|
||||||
if (m_hLine)
|
|
||||||
{
|
|
||||||
if (m_hLine->scene())
|
|
||||||
m_hLine->scene()->removeItem(m_hLine);
|
|
||||||
delete m_hLine;
|
|
||||||
m_hLine = nullptr;
|
|
||||||
}
|
|
||||||
if (m_vLine)
|
|
||||||
{
|
|
||||||
if (m_vLine->scene())
|
|
||||||
m_vLine->scene()->removeItem(m_vLine);
|
|
||||||
delete m_vLine;
|
|
||||||
m_vLine = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Mapcavas::wheelEvent(QWheelEvent *event)
|
// // <20><><EFBFBD>ֵĹ<D6B5><C4B9><EFBFBD><EFBFBD><EFBFBD>
|
||||||
{
|
// QPoint scrollAmount = event->angleDelta();
|
||||||
// Always let the tool have a chance first
|
// // <20><>ֵ<EFBFBD><D6B5>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>ʹ<EFBFBD><CAB9><EFBFBD>߷Ŵ<DFB7><C5B4><EFBFBD>ֵ<EFBFBD><D6B5>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||||
if (m_mapTool)
|
// scrollAmount.y() > 0 ? zoomIn() : zoomOut();
|
||||||
{
|
|
||||||
m_mapTool->canvasWheelEvent(event);
|
|
||||||
}
|
// // <20><>scene<6E><65><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
||||||
|
// QPointF viewPoint = this->matrix().map(scenePos);
|
||||||
|
// // ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view<65>Ŵ<EFBFBD><C5B4><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>չʾscene<6E><65>λ<EFBFBD><CEBB>;
|
||||||
|
// horizontalScrollBar()->setValue(int(viewPoint.x() - viewWidth * hScale));
|
||||||
|
// verticalScrollBar()->setValue(int(viewPoint.y() - viewHeight * vScale));
|
||||||
|
//}
|
||||||
|
|
||||||
if (HasImage())
|
if (HasImage())
|
||||||
{
|
{
|
||||||
@ -167,71 +147,68 @@ void Mapcavas::wheelEvent(QWheelEvent *event)
|
|||||||
QPointF delta = newPos - oldPos;
|
QPointF delta = newPos - oldPos;
|
||||||
translate(delta.x(), delta.y());
|
translate(delta.x(), delta.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//QGraphicsView::wheelEvent(event);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::scaling(qreal scaleFactor)
|
void ImageViewer::scaling(qreal scaleFactor)
|
||||||
{
|
{
|
||||||
|
//qDebug() << this->sceneRect();
|
||||||
scale(scaleFactor, scaleFactor);
|
scale(scaleFactor, scaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::mousePressEvent(QMouseEvent *event)
|
void ImageViewer::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_mapTool)
|
if (event->button()==Qt::LeftButton)
|
||||||
{
|
{
|
||||||
m_mapTool->canvasMousePressEvent(event);
|
m_bMouseTranslate = true;
|
||||||
QGraphicsView::mousePressEvent(event);
|
m_lastMousePos = event->pos();
|
||||||
return;
|
|
||||||
|
//qDebug() << mapToScene(m_lastMousePos);
|
||||||
|
|
||||||
|
emit leftMouseButtonPressed(mapToScene(m_lastMousePos).x(), mapToScene(m_lastMousePos).y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//If you do not perform all the necessary work in your implementation of the virtual function, you may need to call the base class's implementation.
|
||||||
QGraphicsView::mousePressEvent(event);
|
QGraphicsView::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::mouseMoveEvent(QMouseEvent *event)
|
void ImageViewer::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_mapTool)
|
if (m_bMouseTranslate){
|
||||||
{
|
QPointF mouseDelta = mapToScene(event->pos()) - mapToScene(m_lastMousePos);
|
||||||
m_mapTool->canvasMouseMoveEvent(event);
|
translate(mouseDelta.x(),mouseDelta.y());
|
||||||
QGraphicsView::mousePressEvent(event);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_lastMousePos = event->pos();
|
||||||
QGraphicsView::mousePressEvent(event);
|
QGraphicsView::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::mouseReleaseEvent(QMouseEvent *event)
|
void ImageViewer::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_mapTool)
|
m_bMouseTranslate = false;
|
||||||
{
|
|
||||||
m_mapTool->canvasMouseReleaseEvent(event);
|
|
||||||
QGraphicsView::mouseReleaseEvent(event);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QGraphicsView::mouseReleaseEvent(event);
|
QGraphicsView::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::mouseDoubleClickEvent(QMouseEvent *event)
|
void ImageViewer::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_mapTool)
|
|
||||||
{
|
|
||||||
m_mapTool->canvasMouseDoubleClickEvent(event);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QGraphicsView::mouseDoubleClickEvent(event);
|
QGraphicsView::mouseDoubleClickEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::zoomIn()
|
void ImageViewer::zoomIn()
|
||||||
{
|
{
|
||||||
zoom(1 + m_zoomDelta);
|
zoom(1 + m_zoomDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::zoomOut()
|
void ImageViewer::zoomOut()
|
||||||
{
|
{
|
||||||
zoom(1 - m_zoomDelta);
|
zoom(1 - m_zoomDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::zoom(float scaleFactor)
|
void ImageViewer::zoom(float scaleFactor)
|
||||||
{
|
{
|
||||||
|
// <20><>ֹ<EFBFBD><D6B9>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
|
qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
|
||||||
if (factor < 0.07 || factor > 100)
|
if (factor < 0.07 || factor > 100)
|
||||||
return;
|
return;
|
||||||
@ -240,99 +217,28 @@ void Mapcavas::zoom(float scaleFactor)
|
|||||||
m_scale *= scaleFactor;
|
m_scale *= scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::setTranslateSpeed(qreal speed)
|
void ImageViewer::setTranslateSpeed(qreal speed)
|
||||||
{
|
{
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ٶȷ<D9B6>Χ
|
||||||
Q_ASSERT_X(speed >= 0.0 && speed <= 2.0,
|
Q_ASSERT_X(speed >= 0.0 && speed <= 2.0,
|
||||||
"InteractiveView::setTranslateSpeed", "Speed should be in range [0.0, 2.0].");
|
"InteractiveView::setTranslateSpeed", "Speed should be in range [0.0, 2.0].");
|
||||||
m_translateSpeed = speed;
|
m_translateSpeed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal Mapcavas::translateSpeed() const
|
qreal ImageViewer::translateSpeed() const
|
||||||
{
|
{
|
||||||
return m_translateSpeed;
|
return m_translateSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapcavas::setZoomDelta(qreal delta)
|
void ImageViewer::setZoomDelta(qreal delta)
|
||||||
{
|
{
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
|
||||||
Q_ASSERT_X(delta >= 0.0 && delta <= 1.0,
|
Q_ASSERT_X(delta >= 0.0 && delta <= 1.0,
|
||||||
"InteractiveView::setZoomDelta", "Delta should be in range [0.0, 1.0].");
|
"InteractiveView::setZoomDelta", "Delta should be in range [0.0, 1.0].");
|
||||||
m_zoomDelta = delta;
|
m_zoomDelta = delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal Mapcavas::zoomDelta() const
|
qreal ImageViewer::zoomDelta() const
|
||||||
{
|
{
|
||||||
return m_zoomDelta;
|
return m_zoomDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// new: set associated raster layer
|
|
||||||
void Mapcavas::setLayers(RasterLayer* layer)
|
|
||||||
{
|
|
||||||
m_rasterLayer = layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterLayer* Mapcavas::rasterLayer() const
|
|
||||||
{
|
|
||||||
return m_rasterLayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// new: refresh the map by rendering using the RasterLayer's render method
|
|
||||||
void Mapcavas::freshmap()
|
|
||||||
{
|
|
||||||
if (!m_rasterLayer) return;
|
|
||||||
|
|
||||||
RasterLayer::RenderParams params = m_rasterLayer->currentRenderParams();
|
|
||||||
QImage img = m_rasterLayer->render(params);
|
|
||||||
if (img.isNull()) return;
|
|
||||||
|
|
||||||
QPixmap pm = QPixmap::fromImage(img);
|
|
||||||
SetImage(&pm);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapcavas::freshmap(const RasterLayer::RenderParams& params)
|
|
||||||
{
|
|
||||||
if (!m_rasterLayer) return;
|
|
||||||
|
|
||||||
QImage img = m_rasterLayer->render(params);
|
|
||||||
if (img.isNull()) return;
|
|
||||||
|
|
||||||
QPixmap pm = QPixmap::fromImage(img);
|
|
||||||
SetImage(&pm);
|
|
||||||
}
|
|
||||||
|
|
||||||
// MapTool management
|
|
||||||
void Mapcavas::setMapTool(MapTool* tool)
|
|
||||||
{
|
|
||||||
if (m_mapTool)
|
|
||||||
{
|
|
||||||
m_mapTool->deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_mapTool = tool;
|
|
||||||
|
|
||||||
if (m_mapTool)
|
|
||||||
{
|
|
||||||
// Disable built-in drag mode so the tool controls everything
|
|
||||||
setDragMode(QGraphicsView::NoDrag);
|
|
||||||
m_mapTool->activate();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Restore legacy drag mode when no tool
|
|
||||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapcavas::unsetMapTool(MapTool* tool)
|
|
||||||
{
|
|
||||||
if (m_mapTool && m_mapTool == tool)
|
|
||||||
{
|
|
||||||
m_mapTool->deactivate();
|
|
||||||
m_mapTool = nullptr;
|
|
||||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MapTool* Mapcavas::mapTool() const
|
|
||||||
{
|
|
||||||
return m_mapTool;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,20 +1,15 @@
|
|||||||
#ifndef MAPCAVAS_H
|
#ifndef IMAGE_VIEWER
|
||||||
#define MAPCAVAS_H
|
#define IMAGE_VIEWER
|
||||||
|
|
||||||
#include "QGraphicsView"
|
#include "QGraphicsView"
|
||||||
#include "qlabel.h"
|
#include "qlabel.h"
|
||||||
#include <QVector>
|
class ImageViewer :public QGraphicsView
|
||||||
#include "RasterLayer.h"
|
|
||||||
|
|
||||||
class MapTool;
|
|
||||||
|
|
||||||
class Mapcavas : public QGraphicsView
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mapcavas(QWidget* pParent = NULL);
|
ImageViewer(QWidget* pParent = NULL);
|
||||||
~Mapcavas();
|
~ImageViewer();
|
||||||
|
|
||||||
|
|
||||||
void DisplayFrameNumber(int frameNumber);
|
void DisplayFrameNumber(int frameNumber);
|
||||||
@ -29,9 +24,6 @@ public:
|
|||||||
bool HasImage();
|
bool HasImage();
|
||||||
void ensureSceneVisible();
|
void ensureSceneVisible();
|
||||||
|
|
||||||
void updateCrosshair(double sceneX, double sceneY);
|
|
||||||
void removeCrosshair();
|
|
||||||
|
|
||||||
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
||||||
void scaling(qreal scaleFactor);
|
void scaling(qreal scaleFactor);
|
||||||
|
|
||||||
@ -46,27 +38,12 @@ public:
|
|||||||
// <20><><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>
|
// <20><><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>
|
||||||
void setZoomDelta(qreal delta);
|
void setZoomDelta(qreal delta);
|
||||||
qreal zoomDelta() const;
|
qreal zoomDelta() const;
|
||||||
|
|
||||||
// new: set raster layer and refresh map
|
|
||||||
void setLayers(RasterLayer* layer);
|
|
||||||
void freshmap();
|
|
||||||
void freshmap(const RasterLayer::RenderParams& params);
|
|
||||||
|
|
||||||
RasterLayer* rasterLayer() const;
|
|
||||||
|
|
||||||
// MapTool management
|
|
||||||
void setMapTool(MapTool* tool);
|
|
||||||
void unsetMapTool(MapTool* tool);
|
|
||||||
MapTool* mapTool() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QGraphicsScene *m_qtGraphicsScene;
|
QGraphicsScene *m_qtGraphicsScene;
|
||||||
private:
|
private:
|
||||||
QGraphicsPixmapItem *m_GraphicsPixmapItemHandle;
|
QGraphicsPixmapItem *m_GraphicsPixmapItemHandle;
|
||||||
QLabel *m_framNumberLabel;//<2F><>ʾʵʱ<CAB5>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>
|
QLabel *m_framNumberLabel;//<2F><>ʾʵʱ<CAB5>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>
|
||||||
|
|
||||||
RasterLayer* m_rasterLayer = nullptr; // associated raster layer
|
|
||||||
MapTool* m_mapTool = nullptr; // current active map tool
|
|
||||||
|
|
||||||
qreal m_translateSpeed; // ƽ<><C6BD><EFBFBD>ٶ<EFBFBD>
|
qreal m_translateSpeed; // ƽ<><C6BD><EFBFBD>ٶ<EFBFBD>
|
||||||
qreal m_zoomDelta; // <20><><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>
|
qreal m_zoomDelta; // <20><><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@ -74,12 +51,8 @@ private:
|
|||||||
QPoint m_lastMousePos; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>λ<EFBFBD><CEBB>
|
QPoint m_lastMousePos; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>λ<EFBFBD><CEBB>
|
||||||
qreal m_scale; // <20><><EFBFBD><EFBFBD>ֵ
|
qreal m_scale; // <20><><EFBFBD><EFBFBD>ֵ
|
||||||
|
|
||||||
double m_CrosshairHalfLen = 10.0;
|
|
||||||
QGraphicsLineItem* m_hLine = nullptr; // horizontal line
|
|
||||||
QGraphicsLineItem* m_vLine = nullptr; // vertical line
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void leftMouseButtonPressed(int, int, QVector<double>, QVector<double>);
|
void leftMouseButtonPressed(int, int);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -67,8 +67,6 @@ double ImagerOperationBase::auto_exposure()
|
|||||||
|
|
||||||
imagerStopCollect();
|
imagerStopCollect();
|
||||||
|
|
||||||
emit autoExposureSignal();
|
|
||||||
|
|
||||||
//std::cout << "<22>Զ<EFBFBD><D4B6>ع⣺" << getIntegrationTime() << std::endl;
|
//std::cout << "<22>Զ<EFBFBD><D4B6>ع⣺" << getIntegrationTime() << std::endl;
|
||||||
|
|
||||||
return getIntegrationTime();
|
return getIntegrationTime();
|
||||||
@ -235,13 +233,7 @@ void ImagerOperationBase::start_record()
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <20>ڿ<EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ<EFBFBD><CFA2>UI <20><><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD> MapLayer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
// prepare file name that will be used for saving
|
|
||||||
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
||||||
QString baseName = QString::fromStdString(getFileNameFromPath(m_FileName2Save2));
|
|
||||||
QString filePath = QString::fromStdString(m_FileName2Save2);
|
|
||||||
emit LayerFileCreated(baseName, filePath, m_FileSavedCounter);
|
|
||||||
|
|
||||||
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
||||||
|
|
||||||
size_t x;
|
size_t x;
|
||||||
@ -307,7 +299,7 @@ void ImagerOperationBase::start_record()
|
|||||||
//ÿ<><C3BF>1s<31><73><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>ͼ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
//ÿ<><C3BF>1s<31><73><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>ͼ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
||||||
if (m_iFrameCounter % (int)getFramerate() == 0)
|
if (m_iFrameCounter % (int)getFramerate() == 0)
|
||||||
{
|
{
|
||||||
emit PlotSignal(m_FileSavedCounter, m_iFrameCounter, filePath);
|
emit PlotSignal(m_FileSavedCounter, m_iFrameCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_iFrameCounter >= m_iFrameNumber)
|
if (m_iFrameCounter >= m_iFrameNumber)
|
||||||
@ -320,15 +312,10 @@ void ImagerOperationBase::start_record()
|
|||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
//m_RgbImage
|
//m_RgbImage
|
||||||
emit PlotSignal(m_FileSavedCounter, -1, filePath);
|
emit PlotSignal(m_FileSavedCounter, -1);//<2F><>1<EFBFBD><31><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Է<EFBFBD><D4B7>ɼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<CAB5><C4B1><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ȫ<EFBFBD><C8AB>2<EFBFBD><32>ʹ<EFBFBD>û<EFBFBD>е<EFBFBD>۲ɼ<DBB2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ᵼ<EFBFBD><E1B5BC><EFBFBD>ϴβɼ<CEB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4>źŵ<C5BA><C5B5>õIJۺ<C4B2><DBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>˼<EFBFBD><CBBC>ݣ<EFBFBD>ע<EFBFBD>͵<EFBFBD>
|
||||||
|
|
||||||
m_bRecordControlState = false;
|
m_bRecordControlState = false;
|
||||||
WriteHdr();
|
WriteHdr();
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD> ImageFileSaved <20>źţ<C5BA>֪ͨ UI <20><><EFBFBD>Ѹ<EFBFBD><D1B8>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
// m_FileName2Save2 <20><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD> .bil <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "tmp_image_0.bil"<22><>
|
|
||||||
emit ImageFileSaved(QString::fromStdString(m_FileName2Save2), m_FileSavedCounter);
|
|
||||||
|
|
||||||
m_FileSavedCounter++;
|
m_FileSavedCounter++;
|
||||||
|
|
||||||
if (m_iFrameCounter >= m_iFrameNumber)
|
if (m_iFrameCounter >= m_iFrameNumber)
|
||||||
|
|||||||
@ -9,8 +9,6 @@
|
|||||||
#include "ImagerOperationBase.h"
|
#include "ImagerOperationBase.h"
|
||||||
#include "utility_tc.h"
|
#include "utility_tc.h"
|
||||||
|
|
||||||
class MapLayer; // forward declaration
|
|
||||||
|
|
||||||
class ImagerOperationBase :public QObject
|
class ImagerOperationBase :public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -102,7 +100,7 @@ public slots:
|
|||||||
|
|
||||||
void getFocusIndexSobel();
|
void getFocusIndexSobel();
|
||||||
signals:
|
signals:
|
||||||
void PlotSignal(int, int, QString);//<2F><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>źţ<C5BA><C5A3><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD>Ӱ<EFBFBD>ڶ<F1A3BBB5><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>-1<><31><EFBFBD><EFBFBD><EFBFBD>˴βɼ<CEB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
void PlotSignal(int, int);//<2F><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>źţ<C5BA><C5A3><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD>Ӱ<EFBFBD>ڶ<F1A3BBB5><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>-1<><31><EFBFBD><EFBFBD><EFBFBD>˴βɼ<CEB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
||||||
void RecordFinishedSignal_WhenFrameNumberMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
|
void RecordFinishedSignal_WhenFrameNumberMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
|
||||||
void RecordFinishedSignal_WhenFrameNumberNotMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72>û<EFBFBD>вɼ<D0B2><C9BC><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>;ֹͣ<CDA3>ɼ<EFBFBD>
|
void RecordFinishedSignal_WhenFrameNumberNotMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72>û<EFBFBD>вɼ<D0B2><C9BC><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>;ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
void SpectralSignal(int);//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD><C6B9>ף<EFBFBD><D7A3><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
void SpectralSignal(int);//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD><C6B9>ף<EFBFBD><D7A3><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
||||||
@ -114,11 +112,4 @@ signals:
|
|||||||
|
|
||||||
|
|
||||||
void testImagerStatus();//<2F><>ʾ<EFBFBD><CABE><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
void testImagerStatus();//<2F><>ʾ<EFBFBD><CABE><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
void autoExposureSignal();
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>.bil/.hdr<64><72>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>ɺ<C9BA><F3B7A2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳɼ<D3B2><C9BC>̷߳<DFB3><CCB7><EFBFBD><EFBFBD><EFBFBD>Qt <20><><EFBFBD><EFBFBD> queued connection<6F><6E>
|
|
||||||
void ImageFileSaved(const QString& path, int fileIndex);
|
|
||||||
|
|
||||||
// <20>ģ<DEB8><C4A3><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD> MapLayer*<2A><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>UI <20>㸺<EFBFBD><EFBFBD> MapLayer <20><><EFBFBD><EFBFBD><F3B2A2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
void LayerFileCreated(const QString& baseName, const QString& filePath, int fileIndex);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,47 +0,0 @@
|
|||||||
#include "LayerTree.h"
|
|
||||||
|
|
||||||
LayerTree::LayerTree(QObject* parent)
|
|
||||||
: LayerTreeGroup("__root__", parent)
|
|
||||||
{
|
|
||||||
setVisible(Qt::Checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTree::~LayerTree()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTree::setChildrenVisible(LayerTreeNode* n, Qt::CheckState state)
|
|
||||||
{
|
|
||||||
if (!n) return;
|
|
||||||
const auto& cs = n->children();
|
|
||||||
for (LayerTreeNode* c : cs) {
|
|
||||||
c->setVisible(state);
|
|
||||||
setChildrenVisible(c, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTree::updateParentVisibleFromChildren(LayerTreeNode* p)
|
|
||||||
{
|
|
||||||
if (!p) return;
|
|
||||||
if (p->childCount() == 0) return;
|
|
||||||
|
|
||||||
int checked = 0, unchecked = 0, partial = 0;
|
|
||||||
const auto& cs = p->children();
|
|
||||||
for (LayerTreeNode* c : cs) {
|
|
||||||
auto s = c->visible();
|
|
||||||
if (s == Qt::Checked) checked++;
|
|
||||||
else if (s == Qt::Unchecked) unchecked++;
|
|
||||||
else partial++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::CheckState newState;
|
|
||||||
if (partial > 0) newState = Qt::PartiallyChecked;
|
|
||||||
else if (checked > 0 && unchecked == 0) newState = Qt::Checked;
|
|
||||||
else if (unchecked > 0 && checked == 0) newState = Qt::Unchecked;
|
|
||||||
else newState = Qt::PartiallyChecked;
|
|
||||||
|
|
||||||
if (p->visible() != newState) {
|
|
||||||
p->setVisible(newState);
|
|
||||||
updateParentVisibleFromChildren(p->parentNode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "LayerTreeGroupNode.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LayerTree<65><65>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
|
||||||
* - <20>̳<EFBFBD><CCB3><EFBFBD> LayerTreeGroup<75><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>ڵ<EFBFBD>
|
|
||||||
* - <20>ṩ<EFBFBD>ɼ<EFBFBD><C9BC>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>븸<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>µľ<C2B5>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|
||||||
*
|
|
||||||
* ע<>⣺beginInsertRows/endInsertRows <20><> Qt Model <20><><EFBFBD><EFBFBD>֪ͨӦ<D6AA><D3A6> Model <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
|
|
||||||
* LayerTree ֻ<><D6BB><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9>ȷ<EFBFBD>ԡ<EFBFBD>
|
|
||||||
*/
|
|
||||||
class LayerTree : public LayerTreeGroup
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit LayerTree(QObject* parent = nullptr);
|
|
||||||
~LayerTree() override;
|
|
||||||
|
|
||||||
LayerTree(const LayerTree&) = delete;
|
|
||||||
LayerTree& operator=(const LayerTree&) = delete;
|
|
||||||
|
|
||||||
// <20>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD> Model <20><><EFBFBD>ã<EFBFBD>
|
|
||||||
static void setChildrenVisible(LayerTreeNode* n, Qt::CheckState state);
|
|
||||||
static void updateParentVisibleFromChildren(LayerTreeNode* parent);
|
|
||||||
};
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
#include "LayerTreeGroupNode.h"
|
|
||||||
#include "LayerTreeLayerNode.h"
|
|
||||||
|
|
||||||
LayerTreeGroup::LayerTreeGroup(const QString& name, QObject* parent)
|
|
||||||
: LayerTreeNode(name, parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeGroup* LayerTreeGroup::insertGroup(int index, const QString& name)
|
|
||||||
{
|
|
||||||
auto* group = new LayerTreeGroup(name);
|
|
||||||
insertChildNode(index, group);
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeGroup* LayerTreeGroup::addGroup(const QString& name)
|
|
||||||
{
|
|
||||||
return insertGroup(childCount(), name);
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeLayer* LayerTreeGroup::insertLayer(int index, LayerTreeLayer* layer)
|
|
||||||
{
|
|
||||||
if (!layer) return nullptr;
|
|
||||||
insertChildNode(index, layer);
|
|
||||||
return layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeLayer* LayerTreeGroup::addLayer(LayerTreeLayer* layer)
|
|
||||||
{
|
|
||||||
return insertLayer(childCount(), layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeGroup::insertChildNode(int index, LayerTreeNode* node)
|
|
||||||
{
|
|
||||||
insertChild(index, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeGroup::addChildNode(LayerTreeNode* node)
|
|
||||||
{
|
|
||||||
appendChild(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* LayerTreeGroup::removeChildNode(LayerTreeNode* node)
|
|
||||||
{
|
|
||||||
if (!node) return nullptr;
|
|
||||||
int row = -1;
|
|
||||||
for (int i = 0; i < childCount(); ++i)
|
|
||||||
{
|
|
||||||
if (childAt(i) == node)
|
|
||||||
{
|
|
||||||
row = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (row < 0) return nullptr;
|
|
||||||
removeChild(row, 1, false);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeLayer* LayerTreeGroup::findLayer(const QString& name) const
|
|
||||||
{
|
|
||||||
const auto layers = findLayers();
|
|
||||||
for (auto* l : layers)
|
|
||||||
{
|
|
||||||
if (l->name() == name)
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<LayerTreeLayer*> LayerTreeGroup::findLayers() const
|
|
||||||
{
|
|
||||||
QList<LayerTreeLayer*> result;
|
|
||||||
for (int i = 0; i < childCount(); ++i)
|
|
||||||
{
|
|
||||||
LayerTreeNode* child = childAt(i);
|
|
||||||
if (LayerTreeNode::isLayer(child))
|
|
||||||
{
|
|
||||||
result.append(static_cast<LayerTreeLayer*>(child));
|
|
||||||
}
|
|
||||||
else if (LayerTreeNode::isGroup(child))
|
|
||||||
{
|
|
||||||
result.append(static_cast<LayerTreeGroup*>(child)->findLayers());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<LayerTreeGroup*> LayerTreeGroup::findGroups() const
|
|
||||||
{
|
|
||||||
QList<LayerTreeGroup*> result;
|
|
||||||
for (int i = 0; i < childCount(); ++i)
|
|
||||||
{
|
|
||||||
LayerTreeNode* child = childAt(i);
|
|
||||||
if (LayerTreeNode::isGroup(child))
|
|
||||||
{
|
|
||||||
auto* g = static_cast<LayerTreeGroup*>(child);
|
|
||||||
result.append(g);
|
|
||||||
result.append(g->findGroups());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "LayerTreeNode.h"
|
|
||||||
|
|
||||||
class LayerTreeLayer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LayerTreeGroup<75><70>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
|
||||||
* - <20><><EFBFBD><EFBFBD>Ϊ LayerTreeNode
|
|
||||||
* - <20>ṩ<EFBFBD><E1B9A9><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ڵ㣨LayerTreeLayer<65><72><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>飨LayerTreeGroup<75><70><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
*/
|
|
||||||
class LayerTreeGroup : public LayerTreeNode
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit LayerTreeGroup(const QString& name = QString(),
|
|
||||||
QObject* parent = nullptr);
|
|
||||||
|
|
||||||
Type type() const override { return Type::Group; }
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
LayerTreeGroup* insertGroup(int index, const QString& name);
|
|
||||||
LayerTreeGroup* addGroup(const QString& name);
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ڵ<EFBFBD>
|
|
||||||
LayerTreeLayer* insertLayer(int index, LayerTreeLayer* layer);
|
|
||||||
LayerTreeLayer* addLayer(LayerTreeLayer* layer);
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
|
||||||
void insertChildNode(int index, LayerTreeNode* node);
|
|
||||||
void addChildNode(LayerTreeNode* node);
|
|
||||||
|
|
||||||
// <20>Ƴ<EFBFBD><C6B3>ӽڵ㣨<DAB5><E3A3A8> delete<74><65><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1>Ƴ<EFBFBD><C6B3>ڵ㣩
|
|
||||||
LayerTreeNode* removeChildNode(LayerTreeNode* node);
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD>
|
|
||||||
LayerTreeLayer* findLayer(const QString& name) const;
|
|
||||||
QList<LayerTreeLayer*> findLayers() const;
|
|
||||||
QList<LayerTreeGroup*> findGroups() const;
|
|
||||||
|
|
||||||
// <20>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>collapsed / groupOpacity <20><>
|
|
||||||
};
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
using LayerTreeGroupNode = LayerTreeGroup;
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
#include "LayerTreeLayerNode.h"
|
|
||||||
|
|
||||||
LayerTreeLayer::LayerTreeLayer(MapLayer* layer, QObject* parent)
|
|
||||||
: LayerTreeNode(layer ? layer->name() : QString(), parent), m_layer(layer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode::Type LayerTreeLayer::type() const
|
|
||||||
{
|
|
||||||
return Type::Layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> MapLayer ָ<>루<EFBFBD><EBA3A8>ӵ<EFBFBD>У<EFBFBD>
|
|
||||||
void LayerTreeLayer::setMapLayer(MapLayer* layer)
|
|
||||||
{
|
|
||||||
m_layer = layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
MapLayer* LayerTreeLayer::mapLayer() const
|
|
||||||
{
|
|
||||||
return m_layer;
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "LayerTreeNode.h"
|
|
||||||
#include "MapLayer.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LayerTreeLayer<65><72>ͼ<EFBFBD><CDBC><EFBFBD>ڵ<EFBFBD>
|
|
||||||
* - <20><><EFBFBD><EFBFBD>Ϊ LayerTreeNode
|
|
||||||
* - <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> MapLayer ָ<>루<EFBFBD><EBA3A8>ӵ<EFBFBD>У<EFBFBD>
|
|
||||||
*/
|
|
||||||
class LayerTreeLayer : public LayerTreeNode
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit LayerTreeLayer(MapLayer* layer, QObject* parent = nullptr);
|
|
||||||
|
|
||||||
Type type() const override;
|
|
||||||
|
|
||||||
void setMapLayer(MapLayer* layer);
|
|
||||||
MapLayer* mapLayer() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
MapLayer* m_layer = nullptr;
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>layerId / pointer / legendItems <20><>
|
|
||||||
};
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
using LayerTreeLayerNode = LayerTreeLayer;
|
|
||||||
@ -1,183 +0,0 @@
|
|||||||
#include "LayerTreeModel.h"
|
|
||||||
#include "LayerTreeGroupNode.h"
|
|
||||||
#include "LayerTreeLayerNode.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
LayerTreeModel::LayerTreeModel(LayerTree* tree, QObject* parent, bool cascadeCheck)
|
|
||||||
: QAbstractItemModel(parent),
|
|
||||||
m_tree(tree),
|
|
||||||
m_cascadeCheck(cascadeCheck)
|
|
||||||
{
|
|
||||||
Q_ASSERT(m_tree && "LayerTreeModel requires a valid LayerTree*");
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex LayerTreeModel::index(int row, int column, const QModelIndex& parent) const
|
|
||||||
{
|
|
||||||
if (column != 0 || row < 0) return {};
|
|
||||||
|
|
||||||
LayerTreeNode* parentNode = nodeFromIndex(parent);
|
|
||||||
if (!parentNode) return {};
|
|
||||||
|
|
||||||
LayerTreeNode* child = parentNode->childAt(row);
|
|
||||||
if (!child) return {};
|
|
||||||
|
|
||||||
return createIndex(row, column, child);
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex LayerTreeModel::parent(const QModelIndex& child) const
|
|
||||||
{
|
|
||||||
LayerTreeNode* node = nodeFromIndex(child);
|
|
||||||
if (!node || node == m_tree) return {};
|
|
||||||
|
|
||||||
LayerTreeNode* p = node->parentNode();
|
|
||||||
if (!p || p == m_tree) return {};
|
|
||||||
|
|
||||||
return createIndex(p->rowInParent(), 0, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
int LayerTreeModel::rowCount(const QModelIndex& parent) const
|
|
||||||
{
|
|
||||||
LayerTreeNode* p = nodeFromIndex(parent);
|
|
||||||
return p ? p->childCount() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LayerTreeModel::columnCount(const QModelIndex&) const
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant LayerTreeModel::data(const QModelIndex& index, int role) const
|
|
||||||
{
|
|
||||||
LayerTreeNode* n = nodeFromIndex(index);
|
|
||||||
if (!n || n == m_tree) return {};
|
|
||||||
|
|
||||||
switch (role) {
|
|
||||||
case Qt::DisplayRole:
|
|
||||||
return n->name();
|
|
||||||
|
|
||||||
case Qt::DecorationRole:
|
|
||||||
{
|
|
||||||
auto* tmp = nodeFromIndex(index);
|
|
||||||
if (LayerTreeNode::isGroup(tmp))
|
|
||||||
return QIcon();
|
|
||||||
else if (LayerTreeNode::isLayer(tmp))
|
|
||||||
{
|
|
||||||
QString basePath = QCoreApplication::applicationDirPath();
|
|
||||||
return QIcon(basePath + "/icons/mIconRaster.svg");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//case Qt::CheckStateRole:
|
|
||||||
// return static_cast<int>(n->visible());
|
|
||||||
|
|
||||||
case Qt::ToolTipRole:
|
|
||||||
return (n->type() == LayerTreeNode::Type::Group) ? "Group" : "Layer";
|
|
||||||
|
|
||||||
default:
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LayerTreeModel::setData(const QModelIndex& index, const QVariant& value, int role)
|
|
||||||
{
|
|
||||||
LayerTreeNode* n = nodeFromIndex(index);
|
|
||||||
if (!n || n == m_tree) return false;
|
|
||||||
|
|
||||||
if (role == Qt::CheckStateRole) {
|
|
||||||
auto newState = static_cast<Qt::CheckState>(value.toInt());
|
|
||||||
if (n->visible() == newState) return true;
|
|
||||||
|
|
||||||
n->setVisible(newState);
|
|
||||||
|
|
||||||
// 1) <20><> -> <20><> <20><><EFBFBD><EFBFBD>
|
|
||||||
if (m_cascadeCheck) {
|
|
||||||
LayerTree::setChildrenVisible(n, newState);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2) <20><> -> <20><> <20><><EFBFBD><EFBFBD> PartiallyChecked
|
|
||||||
LayerTree::updateParentVisibleFromChildren(n->parentNode());
|
|
||||||
|
|
||||||
// <20><EFBFBD><F2BBAFA3><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻Ϊ<E6BBBB><CEAA> dataChanged<65><64>
|
|
||||||
emit layoutChanged();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::ItemFlags LayerTreeModel::flags(const QModelIndex& index) const
|
|
||||||
{
|
|
||||||
if (!index.isValid()) return Qt::NoItemFlags;
|
|
||||||
|
|
||||||
LayerTreeNode* n = nodeFromIndex(index);
|
|
||||||
if (!n || n == m_tree) return Qt::NoItemFlags;
|
|
||||||
|
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* LayerTreeModel::root() const
|
|
||||||
{
|
|
||||||
return m_tree;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* LayerTreeModel::addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon)
|
|
||||||
{
|
|
||||||
if (!parent) parent = m_tree;
|
|
||||||
|
|
||||||
const int row = parent->childCount();
|
|
||||||
beginInsertRows(indexFromNode(parent), row, row);
|
|
||||||
LayerTreeNode* g = m_tree->addGroup(name);
|
|
||||||
endInsertRows();
|
|
||||||
|
|
||||||
return g;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* LayerTreeModel::addLayer(LayerTreeNode* parent, LayerTreeLayer* layerNode, const QIcon& icon)
|
|
||||||
{
|
|
||||||
if (!parent) parent = m_tree;
|
|
||||||
if (!layerNode) return nullptr;
|
|
||||||
|
|
||||||
const int row = parent->childCount();
|
|
||||||
beginInsertRows(indexFromNode(parent), row, row);
|
|
||||||
parent->insertChild(row, layerNode);
|
|
||||||
endInsertRows();
|
|
||||||
|
|
||||||
return layerNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeModel::setCascadeCheckEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
m_cascadeCheck = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LayerTreeModel::cascadeCheckEnabled() const
|
|
||||||
{
|
|
||||||
return m_cascadeCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><D6A3>Ƴ<EFBFBD><C6B3>ӽڵ㲢<DAB5><E3B2A2> model <20>Ϸ<EFBFBD><CFB7><EFBFBD> begin/endRemoveRows
|
|
||||||
LayerTreeNode* LayerTreeModel::removeNode(LayerTreeNode* parent, int row)
|
|
||||||
{
|
|
||||||
if (!parent) parent = m_tree;
|
|
||||||
if (row < 0 || row >= parent->childCount()) return nullptr;
|
|
||||||
|
|
||||||
LayerTreeNode* removed = parent->childAt(row);
|
|
||||||
beginRemoveRows(indexFromNode(parent), row, row);
|
|
||||||
parent->removeChild(row, 1, false);
|
|
||||||
endRemoveRows();
|
|
||||||
|
|
||||||
return removed;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* LayerTreeModel::nodeFromIndex(const QModelIndex& index) const
|
|
||||||
{
|
|
||||||
if (!index.isValid()) return m_tree;
|
|
||||||
return static_cast<LayerTreeNode*>(index.internalPointer());
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex LayerTreeModel::indexFromNode(LayerTreeNode* n) const
|
|
||||||
{
|
|
||||||
if (!n || n == m_tree) return {};
|
|
||||||
return createIndex(n->rowInParent(), 0, n);
|
|
||||||
}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QAbstractItemModel>
|
|
||||||
#include "LayerTree.h"
|
|
||||||
|
|
||||||
class LayerTreeLayer; // forward declare
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LayerTreeModel<65><6C>Qt <20><><EFBFBD><EFBFBD><EFBFBD>㣨<EFBFBD><E3A3A8><EFBFBD>ٹ<EFBFBD><D9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
* - 1 <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͼ<EFBFBD>꣩+ checkbox
|
|
||||||
* - <20><>ѡ<EFBFBD>ɼ<EFBFBD><C9BC>ԣ<EFBFBD><D4A3><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
|
||||||
*/
|
|
||||||
class LayerTreeModel : public QAbstractItemModel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit LayerTreeModel(LayerTree* tree,
|
|
||||||
QObject* parent = nullptr,
|
|
||||||
bool cascadeCheck = true);
|
|
||||||
~LayerTreeModel() override = default;
|
|
||||||
|
|
||||||
// QAbstractItemModel <20><><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
|
||||||
QModelIndex index(int row, int column,
|
|
||||||
const QModelIndex& parent = QModelIndex()) const override;
|
|
||||||
QModelIndex parent(const QModelIndex& child) const override;
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
||||||
|
|
||||||
QVariant data(const QModelIndex& index, int role) const override;
|
|
||||||
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
|
|
||||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD> API<50><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD> begin/endInsertRows<77><73>
|
|
||||||
LayerTreeNode* root() const;
|
|
||||||
|
|
||||||
LayerTreeNode* addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon = QIcon());
|
|
||||||
LayerTreeNode* addLayer(LayerTreeNode* parent, LayerTreeLayer* layerNode, const QIcon& icon = QIcon());
|
|
||||||
|
|
||||||
void setCascadeCheckEnabled(bool enabled);
|
|
||||||
bool cascadeCheckEnabled() const;
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӹ<EFBFBD><D3B8>ڵ<EFBFBD><DAB5>Ƴ<EFBFBD><C6B3>ӽڵ㣨<DAB5><E3A3A8>װ LayerTree::removeNode <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> model ֪ͨ<CDA8><D6AA>
|
|
||||||
LayerTreeNode* removeNode(LayerTreeNode* parent, int row);
|
|
||||||
|
|
||||||
private:
|
|
||||||
LayerTree* m_tree = nullptr; // not owned
|
|
||||||
bool m_cascadeCheck = true;
|
|
||||||
|
|
||||||
private:
|
|
||||||
LayerTreeNode* nodeFromIndex(const QModelIndex& index) const;
|
|
||||||
QModelIndex indexFromNode(LayerTreeNode* n) const;
|
|
||||||
};
|
|
||||||
@ -1,135 +0,0 @@
|
|||||||
#include "LayerTreeNode.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
LayerTreeNode::LayerTreeNode(const QString& name, QObject* parent)
|
|
||||||
: QObject(parent), m_name(name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode::~LayerTreeNode()
|
|
||||||
{
|
|
||||||
qDeleteAll(m_children);
|
|
||||||
m_children.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LayerTreeNode::name() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeNode::setName(const QString& name)
|
|
||||||
{
|
|
||||||
if (m_name != name)
|
|
||||||
{
|
|
||||||
m_name = name;
|
|
||||||
emit nameChanged(this, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon LayerTreeNode::icon() const
|
|
||||||
{
|
|
||||||
return m_icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeNode::setIcon(const QIcon& icon)
|
|
||||||
{
|
|
||||||
m_icon = icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::CheckState LayerTreeNode::visible() const
|
|
||||||
{
|
|
||||||
return m_visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeNode::setVisible(Qt::CheckState s)
|
|
||||||
{
|
|
||||||
m_visible = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* LayerTreeNode::parentNode() const
|
|
||||||
{
|
|
||||||
return m_parentNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeNode::setParentNode(LayerTreeNode* p)
|
|
||||||
{
|
|
||||||
m_parentNode = p;
|
|
||||||
// <20><> QObject <20><> parent Ҳ<><D2B2><EFBFBD>棨<EFBFBD><E6A3A8><EFBFBD><EFBFBD> Qt <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ι<EFBFBD><CEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD> delete children<65><6E>
|
|
||||||
if (p) this->setParent(p);
|
|
||||||
else this->setParent(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int LayerTreeNode::rowInParent() const
|
|
||||||
{
|
|
||||||
if (!m_parentNode) return 0;
|
|
||||||
|
|
||||||
const auto& siblings = m_parentNode->m_children;
|
|
||||||
for (int i = 0; i < siblings.size(); ++i)
|
|
||||||
{
|
|
||||||
if (siblings[i] == this) return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LayerTreeNode::childCount() const
|
|
||||||
{
|
|
||||||
return m_children.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* LayerTreeNode::childAt(int row) const
|
|
||||||
{
|
|
||||||
if (row < 0 || row >= m_children.size()) return nullptr;
|
|
||||||
return m_children[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
const QVector<LayerTreeNode*>& LayerTreeNode::children() const
|
|
||||||
{
|
|
||||||
return m_children;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeNode::appendChild(LayerTreeNode* child)
|
|
||||||
{
|
|
||||||
insertChild(m_children.size(), child);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeNode::insertChild(int row, LayerTreeNode* child)
|
|
||||||
{
|
|
||||||
if (!child) return;
|
|
||||||
|
|
||||||
if (row < 0 || row > m_children.size())
|
|
||||||
row = m_children.size();
|
|
||||||
|
|
||||||
emit willAddChildren(this, row, row);
|
|
||||||
child->setParentNode(this);
|
|
||||||
m_children.insert(row, child);
|
|
||||||
emit addedChildren(this, row, row);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeNode::removeChild(int from, int count, bool destroy)
|
|
||||||
{
|
|
||||||
if (from < 0 || count <= 0 || from + count > m_children.size()) return;
|
|
||||||
|
|
||||||
emit willRemoveChildren(this, from, from + count - 1);
|
|
||||||
|
|
||||||
QVector<LayerTreeNode*> removed;
|
|
||||||
removed.reserve(count);
|
|
||||||
for (int i = 0; i < count; ++i)
|
|
||||||
{
|
|
||||||
removed.append(m_children.at(from));
|
|
||||||
m_children.removeAt(from);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (LayerTreeNode* node : removed)
|
|
||||||
{
|
|
||||||
node->setParentNode(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit removedChildren(this, from, from + count - 1);
|
|
||||||
|
|
||||||
if (destroy)
|
|
||||||
{
|
|
||||||
qDeleteAll(removed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QVector>
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LayerTreeNode<64><65><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ࣨ<EFBFBD><E0A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
* - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>/ͼ<><CDBC>/<2F>ɼ<EFBFBD><C9BC><EFBFBD>/<2F><><EFBFBD>ӹ<EFBFBD>ϵ
|
|
||||||
* - Group / Layer <20>ڵ<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>̳<EFBFBD>ʵ<EFBFBD><CAB5>
|
|
||||||
* - <20>ṩ<EFBFBD><E1B9A9><EFBFBD><EFBFBD>/ɾ<><C9BE><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ź<EFBFBD>֪ͨ
|
|
||||||
*
|
|
||||||
* ˵<><CBB5><EFBFBD><EFBFBD>
|
|
||||||
* - <20><><EFBFBD><EFBFBD>ͬʱά<CAB1><CEAC>"<22><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>"<22><>m_parentNode<64><65><EFBFBD><EFBFBD> QObject parent<6E><74><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
|
||||||
* - children <20>ɽڵ<C9BD><DAB5>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷţ<CDB7><C5A3><EFBFBD><EFBFBD><EFBFBD>ʱ delete children<65><6E>
|
|
||||||
*/
|
|
||||||
class LayerTreeNode : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
enum class Type { Group, Layer };
|
|
||||||
|
|
||||||
explicit LayerTreeNode(const QString& name,
|
|
||||||
QObject* parent = nullptr);
|
|
||||||
~LayerTreeNode() override;
|
|
||||||
|
|
||||||
LayerTreeNode(const LayerTreeNode&) = delete;
|
|
||||||
LayerTreeNode& operator=(const LayerTreeNode&) = delete;
|
|
||||||
|
|
||||||
virtual Type type() const = 0;
|
|
||||||
|
|
||||||
// ---- properties ----
|
|
||||||
QString name() const;
|
|
||||||
void setName(const QString& name);
|
|
||||||
|
|
||||||
QIcon icon() const;
|
|
||||||
void setIcon(const QIcon& icon);
|
|
||||||
|
|
||||||
Qt::CheckState visible() const;
|
|
||||||
void setVisible(Qt::CheckState s);
|
|
||||||
|
|
||||||
// ---- tree relations ----
|
|
||||||
LayerTreeNode* parentNode() const;
|
|
||||||
int rowInParent() const;
|
|
||||||
|
|
||||||
int childCount() const;
|
|
||||||
LayerTreeNode* childAt(int row) const;
|
|
||||||
const QVector<LayerTreeNode*>& children() const;
|
|
||||||
|
|
||||||
// ---- structure mutation (used by LayerTree / Model) ----
|
|
||||||
void appendChild(LayerTreeNode* child);
|
|
||||||
void insertChild(int row, LayerTreeNode* child);
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD> QgsLayerTreeNode::removeChildrenPrivate <20>Ľ<EFBFBD>
|
|
||||||
// from: <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>, count: <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>, destroy: true <20><> delete <20><><EFBFBD>Ƴ<EFBFBD><C6B3>ڵ<EFBFBD>
|
|
||||||
void removeChild(int from, int count, bool destroy = true);
|
|
||||||
|
|
||||||
// ---- static type helpers ----
|
|
||||||
static inline bool isLayer(LayerTreeNode* node)
|
|
||||||
{
|
|
||||||
return node && node->type() == LayerTreeNode::Type::Layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool isGroup(LayerTreeNode* node)
|
|
||||||
{
|
|
||||||
return node && node->type() == LayerTreeNode::Type::Group;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
// <20>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>ӽڵ<D3BD>֮ǰ/֮<><EFBFBD>
|
|
||||||
void willAddChildren(LayerTreeNode* node, int indexFrom, int indexTo);
|
|
||||||
void addedChildren(LayerTreeNode* node, int indexFrom, int indexTo);
|
|
||||||
|
|
||||||
// <20><><EFBFBD>Ƴ<EFBFBD><C6B3>ӽڵ<D3BD>֮ǰ/֮<><EFBFBD>
|
|
||||||
void willRemoveChildren(LayerTreeNode* node, int indexFrom, int indexTo);
|
|
||||||
void removedChildren(LayerTreeNode* node, int indexFrom, int indexTo);
|
|
||||||
|
|
||||||
void nameChanged(LayerTreeNode* node, const QString& name);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void setParentNode(LayerTreeNode* p);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString m_name;
|
|
||||||
QIcon m_icon;
|
|
||||||
Qt::CheckState m_visible = Qt::Checked;
|
|
||||||
|
|
||||||
LayerTreeNode* m_parentNode = nullptr;
|
|
||||||
QVector<LayerTreeNode*> m_children;
|
|
||||||
};
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
#include "LayerTreeView.h"
|
|
||||||
#include "LayerTreeViewMenuProvider.h"
|
|
||||||
#include <QContextMenuEvent>
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
LayerTreeView::LayerTreeView(QWidget* parent)
|
|
||||||
: QTreeView(parent), m_menuProvider(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeView::~LayerTreeView()
|
|
||||||
{
|
|
||||||
delete m_menuProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeView::setMenuProvider(LayerTreeViewMenuProvider* provider)
|
|
||||||
{
|
|
||||||
m_menuProvider = provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerTreeView::contextMenuEvent(QContextMenuEvent* event)
|
|
||||||
{
|
|
||||||
if (!m_menuProvider)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const QModelIndex idx = indexAt(event->pos());
|
|
||||||
if (idx.isValid())
|
|
||||||
setCurrentIndex(idx);
|
|
||||||
else
|
|
||||||
setCurrentIndex(QModelIndex());
|
|
||||||
|
|
||||||
QMenu* menu = m_menuProvider->createContextMenu();
|
|
||||||
menu->setStyleSheet(R"(
|
|
||||||
QMenu {
|
|
||||||
background-color: #2a5dec;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
QMenu::item:selected {
|
|
||||||
background-color: #1a4ddc;
|
|
||||||
}
|
|
||||||
QMenu::separator {
|
|
||||||
height: 1px;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
if (menu)
|
|
||||||
{
|
|
||||||
menu->exec(event->globalPos());
|
|
||||||
delete menu;
|
|
||||||
}
|
|
||||||
//QTreeView::contextMenuEvent(event);
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QTreeView>
|
|
||||||
|
|
||||||
class LayerTreeViewMenuProvider;
|
|
||||||
|
|
||||||
class LayerTreeView : public QTreeView
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit LayerTreeView(QWidget* parent = nullptr);
|
|
||||||
~LayerTreeView() override;
|
|
||||||
|
|
||||||
void setMenuProvider(LayerTreeViewMenuProvider* provider);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
LayerTreeViewMenuProvider* m_menuProvider = nullptr; // not owned
|
|
||||||
};
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
#include "LayerTreeViewMenuProvider.h"
|
|
||||||
#include "LayerTreeView.h"
|
|
||||||
#include "LayerTreeModel.h"
|
|
||||||
#include "LayerTreeNode.h"
|
|
||||||
#include "HPPA.h"
|
|
||||||
#include <QAction>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
LayerTreeViewMenuProvider::LayerTreeViewMenuProvider(LayerTreeView* view, QObject* parent)
|
|
||||||
: QObject(parent), m_view(view)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QMenu* LayerTreeViewMenuProvider::createContextMenu()
|
|
||||||
{
|
|
||||||
m_contextIndex = m_view->currentIndex();
|
|
||||||
|
|
||||||
QMenu* menu = new QMenu();
|
|
||||||
|
|
||||||
if (!m_contextIndex.isValid())
|
|
||||||
{
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
const LayerTreeModel* model = static_cast<const LayerTreeModel*>(m_contextIndex.model());
|
|
||||||
if (!model)
|
|
||||||
{
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerTreeNode* node = static_cast<LayerTreeNode*>(m_contextIndex.internalPointer());
|
|
||||||
if (!node)
|
|
||||||
{
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node->type() == LayerTreeNode::Type::Layer)
|
|
||||||
{
|
|
||||||
QAction* removeAction = new QAction(QStringLiteral("<EFBFBD>Ƴ<EFBFBD>ͼ<EFBFBD><EFBFBD>"), menu);
|
|
||||||
connect(removeAction, &QAction::triggered, HPPA::instance(), &HPPA::removeLayerByTreeIndex);
|
|
||||||
menu->addAction(removeAction);
|
|
||||||
}
|
|
||||||
else if (node->type() == LayerTreeNode::Type::Group)
|
|
||||||
{
|
|
||||||
HPPA* app = HPPA::instance();
|
|
||||||
if (app && node == app->rasterGroupNode())
|
|
||||||
{
|
|
||||||
QAction* removeAllAction = new QAction(QStringLiteral("<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>"), menu);
|
|
||||||
connect(removeAllAction, &QAction::triggered, app, &HPPA::removeAllLayersInRasterGroup);
|
|
||||||
menu->addAction(removeAllAction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QModelIndex>
|
|
||||||
|
|
||||||
class LayerTreeView;
|
|
||||||
class LayerTreeModel;
|
|
||||||
class MapLayer;
|
|
||||||
|
|
||||||
class LayerTreeViewMenuProvider : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit LayerTreeViewMenuProvider(LayerTreeView* view, QObject* parent = nullptr);
|
|
||||||
~LayerTreeViewMenuProvider() override = default;
|
|
||||||
|
|
||||||
// <20><><EFBFBD>ݸ<EFBFBD><DDB8><EFBFBD> index <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> QMenu*
|
|
||||||
QMenu* createContextMenu();
|
|
||||||
|
|
||||||
private:
|
|
||||||
LayerTreeView* m_view = nullptr; // not owned
|
|
||||||
QModelIndex m_contextIndex;
|
|
||||||
};
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
#include "MapLayer.h"
|
|
||||||
|
|
||||||
MapLayer::MapLayer(const QString& name, const QString& uri)
|
|
||||||
: QObject(nullptr), m_name(name), m_uri(uri)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MapLayer::name() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapLayer::setName(const QString& n)
|
|
||||||
{
|
|
||||||
m_name = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MapLayer::dataPath() const
|
|
||||||
{
|
|
||||||
return m_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapLayer::setDataPath(const QString& p)
|
|
||||||
{
|
|
||||||
m_uri = p;
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
#include <QMetaType>
|
|
||||||
|
|
||||||
class MapLayer : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
enum class LayerType { Raster, Vector };
|
|
||||||
|
|
||||||
explicit MapLayer(const QString& name, const QString& uri);
|
|
||||||
|
|
||||||
virtual ~MapLayer() override = default;
|
|
||||||
|
|
||||||
QString name() const;
|
|
||||||
void setName(const QString& n);
|
|
||||||
|
|
||||||
QString dataPath() const;
|
|
||||||
void setDataPath(const QString& p);
|
|
||||||
|
|
||||||
virtual LayerType layerType() const = 0;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString m_name;
|
|
||||||
QString m_uri;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(MapLayer*)
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
#include "MapLayerStore.h"
|
|
||||||
#include "MapLayer.h"
|
|
||||||
|
|
||||||
MapLayerStore::MapLayerStore(QObject* parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
int a = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapLayerStore::addLayer(MapLayer* layer, QWidget* widget)
|
|
||||||
{
|
|
||||||
if (!layer) return;
|
|
||||||
MapLayer* raw = layer;
|
|
||||||
m_layers.emplace_back(std::shared_ptr<MapLayer>(layer));
|
|
||||||
if (widget)
|
|
||||||
m_layerWidgets[raw] = widget;
|
|
||||||
emit layerAdded(raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapLayerStore::removeLayer(MapLayer* layer)
|
|
||||||
{
|
|
||||||
if (!layer) return;
|
|
||||||
for (auto it = m_layers.begin(); it != m_layers.end(); ++it) {
|
|
||||||
if (it->get() == layer) {
|
|
||||||
emit layerAboutToBeRemoved(layer);
|
|
||||||
m_layers.erase(it);
|
|
||||||
m_layerWidgets.erase(layer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapLayerStore::removeLayerByName(const QString& name)
|
|
||||||
{
|
|
||||||
for (auto it = m_layers.begin(); it != m_layers.end(); ++it) {
|
|
||||||
if ((*it)->name() == name) {
|
|
||||||
MapLayer* raw = it->get();
|
|
||||||
emit layerAboutToBeRemoved(raw);
|
|
||||||
m_layers.erase(it);
|
|
||||||
m_layerWidgets.erase(raw);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MapLayer* MapLayerStore::getLayer(const QString& name) const
|
|
||||||
{
|
|
||||||
for (const auto& l : m_layers) {
|
|
||||||
if (l->name() == name) return l.get();
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
MapLayer* MapLayerStore::getLayerAt(int index) const
|
|
||||||
{
|
|
||||||
if (index < 0 || index >= (int)m_layers.size()) return nullptr;
|
|
||||||
return m_layers[index].get();
|
|
||||||
}
|
|
||||||
|
|
||||||
int MapLayerStore::layerCount() const
|
|
||||||
{
|
|
||||||
return (int)m_layers.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget* MapLayerStore::widgetForLayer(MapLayer* layer) const
|
|
||||||
{
|
|
||||||
auto it = m_layerWidgets.find(layer);
|
|
||||||
if (it == m_layerWidgets.end()) return nullptr;
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget* MapLayerStore::widgetForLayer(const QString& absolutePath) const
|
|
||||||
{
|
|
||||||
for (const auto& sp : m_layers) {
|
|
||||||
if (sp && sp->dataPath() == absolutePath) {
|
|
||||||
MapLayer* raw = sp.get();
|
|
||||||
auto it = m_layerWidgets.find(raw);
|
|
||||||
if (it != m_layerWidgets.end()) return it->second;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
MapLayer* MapLayerStore::layerForWidget(QWidget* widget) const
|
|
||||||
{
|
|
||||||
if (!widget) return nullptr;
|
|
||||||
for (const auto& kv : m_layerWidgets) {
|
|
||||||
if (kv.second == widget) return kv.first;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
class MapLayer;
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
class MapLayerStore : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit MapLayerStore(QObject* parent = nullptr);
|
|
||||||
~MapLayerStore() override = default;
|
|
||||||
|
|
||||||
// Take ownership of the layer (store will own and manage its lifetime)
|
|
||||||
// Now also accept the associated QWidget so UI widget can be retrieved by layer pointer
|
|
||||||
void addLayer(MapLayer* layer, QWidget* widget = nullptr);
|
|
||||||
|
|
||||||
// Remove by pointer or by name. Destruction happens when removed from store.
|
|
||||||
public slots:
|
|
||||||
void removeLayer(MapLayer* layer);
|
|
||||||
void removeLayerByName(const QString& name);
|
|
||||||
|
|
||||||
// Queries
|
|
||||||
MapLayer* getLayer(const QString& name) const;
|
|
||||||
MapLayer* getLayerAt(int index) const;
|
|
||||||
int layerCount() const;
|
|
||||||
|
|
||||||
// Get associated widget for a layer (or nullptr if none)
|
|
||||||
QWidget* widgetForLayer(MapLayer* layer) const;
|
|
||||||
// Get associated widget by layer absolute data path
|
|
||||||
QWidget* widgetForLayer(const QString& absolutePath) const;
|
|
||||||
|
|
||||||
// Reverse lookup: find the MapLayer associated with a given widget (or nullptr)
|
|
||||||
MapLayer* layerForWidget(QWidget* widget) const;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void layerAdded(MapLayer* layer);
|
|
||||||
// Emitted just before the layer is destroyed/removed from store
|
|
||||||
void layerAboutToBeRemoved(MapLayer* layer);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// store shared ownership so other parts can keep raw pointers safely (or use QPointer)
|
|
||||||
std::vector<std::shared_ptr<MapLayer>> m_layers;
|
|
||||||
// mapping from raw MapLayer pointer to associated QWidget*
|
|
||||||
std::unordered_map<MapLayer*, QWidget*> m_layerWidgets;
|
|
||||||
};
|
|
||||||
110
HPPA/MapTool.cpp
110
HPPA/MapTool.cpp
@ -1,110 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "MapTool.h"
|
|
||||||
#include "ImageViewer.h"
|
|
||||||
#include <QAction>
|
|
||||||
|
|
||||||
MapTool::MapTool(QObject* parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, m_cursor(Qt::ArrowCursor)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
MapTool::~MapTool()
|
|
||||||
{
|
|
||||||
if (m_canvas && m_canvas->mapTool() == this)
|
|
||||||
{
|
|
||||||
m_canvas->unsetMapTool(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QAction* MapTool::action() const
|
|
||||||
{
|
|
||||||
return m_action;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::setAction(QAction* action)
|
|
||||||
{
|
|
||||||
m_action = action;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::setMapcavas(Mapcavas* canvas)
|
|
||||||
{
|
|
||||||
if (m_canvas == canvas)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_isActive && m_canvas)
|
|
||||||
{
|
|
||||||
//deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_canvas = canvas;
|
|
||||||
}
|
|
||||||
|
|
||||||
Mapcavas* MapTool::canvas() const
|
|
||||||
{
|
|
||||||
return m_canvas;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::setCursor(const QCursor& cursor)
|
|
||||||
{
|
|
||||||
m_cursor = cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
QCursor MapTool::cursor() const
|
|
||||||
{
|
|
||||||
return m_cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::activate()
|
|
||||||
{
|
|
||||||
if (m_canvas)
|
|
||||||
{
|
|
||||||
m_canvas->viewport()->setCursor(m_cursor);
|
|
||||||
}
|
|
||||||
if (m_action)
|
|
||||||
{
|
|
||||||
m_action->setChecked(true);
|
|
||||||
}
|
|
||||||
m_isActive = true;
|
|
||||||
emit activated();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::deactivate()
|
|
||||||
{
|
|
||||||
if (m_action)
|
|
||||||
{
|
|
||||||
m_action->setChecked(false);
|
|
||||||
}
|
|
||||||
m_isActive = false;
|
|
||||||
emit deactivated();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MapTool::isActive() const
|
|
||||||
{
|
|
||||||
return m_isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::canvasMousePressEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
Q_UNUSED(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::canvasMouseReleaseEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
Q_UNUSED(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::canvasMouseMoveEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
Q_UNUSED(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::canvasMouseDoubleClickEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
Q_UNUSED(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTool::canvasWheelEvent(QWheelEvent* e)
|
|
||||||
{
|
|
||||||
Q_UNUSED(e);
|
|
||||||
}
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
#ifndef MAPTOOL_H
|
|
||||||
#define MAPTOOL_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QCursor>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QAction>
|
|
||||||
|
|
||||||
class Mapcavas;
|
|
||||||
class QAction;
|
|
||||||
|
|
||||||
class MapTool : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum Flag
|
|
||||||
{
|
|
||||||
NoFlags = 0,
|
|
||||||
Transient = 1 << 1,
|
|
||||||
};
|
|
||||||
Q_DECLARE_FLAGS(Flags, Flag)
|
|
||||||
|
|
||||||
MapTool(QObject* parent = nullptr);
|
|
||||||
virtual ~MapTool();
|
|
||||||
|
|
||||||
virtual Flags flags() const { return NoFlags; }
|
|
||||||
|
|
||||||
QAction* action() const;
|
|
||||||
void setAction(QAction* action);
|
|
||||||
|
|
||||||
void setMapcavas(Mapcavas* canvas);
|
|
||||||
Mapcavas* canvas() const;
|
|
||||||
|
|
||||||
virtual void setCursor(const QCursor& cursor);
|
|
||||||
QCursor cursor() const;
|
|
||||||
|
|
||||||
virtual void activate();
|
|
||||||
virtual void deactivate();
|
|
||||||
bool isActive() const;
|
|
||||||
|
|
||||||
virtual void canvasMousePressEvent(QMouseEvent* e);
|
|
||||||
virtual void canvasMouseReleaseEvent(QMouseEvent* e);
|
|
||||||
virtual void canvasMouseMoveEvent(QMouseEvent* e);
|
|
||||||
virtual void canvasMouseDoubleClickEvent(QMouseEvent* e);
|
|
||||||
virtual void canvasWheelEvent(QWheelEvent* e);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void activated();
|
|
||||||
void deactivated();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Mapcavas* m_canvas = nullptr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QAction* m_action = nullptr;
|
|
||||||
QCursor m_cursor;
|
|
||||||
bool m_isActive = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(MapTool::Flags)
|
|
||||||
|
|
||||||
#endif // MAPTOOL_H
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "MapToolPan.h"
|
|
||||||
#include "ImageViewer.h"
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QGraphicsView>
|
|
||||||
|
|
||||||
MapToolPan::MapToolPan(QObject* parent)
|
|
||||||
: MapTool(parent)
|
|
||||||
{
|
|
||||||
setCursor(Qt::OpenHandCursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapToolPan::~MapToolPan()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolPan::activate()
|
|
||||||
{
|
|
||||||
MapTool::activate();
|
|
||||||
if (canvas())
|
|
||||||
{
|
|
||||||
canvas()->setDragMode(QGraphicsView::NoDrag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolPan::deactivate()
|
|
||||||
{
|
|
||||||
m_dragging = false;
|
|
||||||
MapTool::deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolPan::canvasMousePressEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
if (e->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
m_dragging = true;
|
|
||||||
m_lastPos = e->pos();
|
|
||||||
if (canvas())
|
|
||||||
{
|
|
||||||
canvas()->viewport()->setCursor(Qt::ClosedHandCursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolPan::canvasMouseMoveEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
if (m_dragging && canvas())
|
|
||||||
{
|
|
||||||
QPointF delta = canvas()->mapToScene(e->pos()) - canvas()->mapToScene(m_lastPos);
|
|
||||||
canvas()->translate(delta.x(), delta.y());
|
|
||||||
m_lastPos = e->pos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolPan::canvasMouseReleaseEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
if (e->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
m_dragging = false;
|
|
||||||
if (canvas())
|
|
||||||
{
|
|
||||||
canvas()->viewport()->setCursor(Qt::OpenHandCursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
#ifndef MAPTOOLPAN_H
|
|
||||||
#define MAPTOOLPAN_H
|
|
||||||
|
|
||||||
#include "MapTool.h"
|
|
||||||
#include <QPoint>
|
|
||||||
|
|
||||||
class MapToolPan : public MapTool
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
MapToolPan(QObject* parent = nullptr);
|
|
||||||
~MapToolPan();
|
|
||||||
|
|
||||||
void activate() override;
|
|
||||||
void deactivate() override;
|
|
||||||
|
|
||||||
void canvasMousePressEvent(QMouseEvent* e) override;
|
|
||||||
void canvasMouseMoveEvent(QMouseEvent* e) override;
|
|
||||||
void canvasMouseReleaseEvent(QMouseEvent* e) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_dragging = false;
|
|
||||||
QPoint m_lastPos;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MAPTOOLPAN_H
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "MapToolSpectral.h"
|
|
||||||
#include "ImageViewer.h"
|
|
||||||
#include "RasterLayer.h"
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QGraphicsLineItem>
|
|
||||||
#include <QPen>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
MapToolSpectral::MapToolSpectral(QObject* parent)
|
|
||||||
: MapTool(parent)
|
|
||||||
{
|
|
||||||
setCursor(Qt::CrossCursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapToolSpectral::~MapToolSpectral()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolSpectral::activate()
|
|
||||||
{
|
|
||||||
MapTool::activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolSpectral::deactivate()
|
|
||||||
{
|
|
||||||
canvas()->removeCrosshair();
|
|
||||||
MapTool::deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapToolSpectral::canvasMousePressEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
if (e->button() != Qt::LeftButton)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!canvas())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const QPointF scenePt = canvas()->mapToScene(e->pos());
|
|
||||||
const int x = static_cast<int>(std::floor(scenePt.x()));
|
|
||||||
const int y = static_cast<int>(std::floor(scenePt.y()));
|
|
||||||
|
|
||||||
RasterLayer* rl = canvas()->rasterLayer();
|
|
||||||
if (rl && rl->isValidPixel(x, y))
|
|
||||||
{
|
|
||||||
// Place crosshair at pixel center
|
|
||||||
canvas()->updateCrosshair(x + 0.5, y + 0.5);
|
|
||||||
|
|
||||||
QVector<double> wavelengths;
|
|
||||||
QVector<double> spectrum;
|
|
||||||
if (rl->readPixelSpectrum(x, y, wavelengths, spectrum))
|
|
||||||
{
|
|
||||||
emit spectralClicked(x, y, wavelengths, spectrum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#ifndef MAPTOOLSPECTRAL_H
|
|
||||||
#define MAPTOOLSPECTRAL_H
|
|
||||||
|
|
||||||
#include "MapTool.h"
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
class QGraphicsLineItem;
|
|
||||||
|
|
||||||
class MapToolSpectral : public MapTool
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
MapToolSpectral(QObject* parent = nullptr);
|
|
||||||
~MapToolSpectral();
|
|
||||||
|
|
||||||
void canvasMousePressEvent(QMouseEvent* e) override;
|
|
||||||
|
|
||||||
void activate() override;
|
|
||||||
void deactivate() override;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void spectralClicked(int x, int y, QVector<double> wavelengths, QVector<double> spectrum);
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MAPTOOLSPECTRAL_H
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "MapTools.h"
|
|
||||||
#include "MapToolPan.h"
|
|
||||||
#include "MapToolSpectral.h"
|
|
||||||
|
|
||||||
MapTools::MapTools(QObject* parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
m_tools.insert(Pan, new MapToolPan(this));
|
|
||||||
m_tools.insert(Spectral, new MapToolSpectral(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
MapTools::~MapTools()
|
|
||||||
{
|
|
||||||
qDeleteAll(m_tools);
|
|
||||||
m_tools.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
MapToolPan* MapTools::mapToolPan() const
|
|
||||||
{
|
|
||||||
return qobject_cast<MapToolPan*>(m_tools.value(Pan));
|
|
||||||
}
|
|
||||||
|
|
||||||
MapToolSpectral* MapTools::mapToolSpectral() const
|
|
||||||
{
|
|
||||||
return qobject_cast<MapToolSpectral*>(m_tools.value(Spectral));
|
|
||||||
}
|
|
||||||
|
|
||||||
MapTool* MapTools::mapTool(Tool tool) const
|
|
||||||
{
|
|
||||||
return m_tools.value(tool, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapTool* MapTools::activeTool() const
|
|
||||||
{
|
|
||||||
return m_activeTool;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTools::setActiveTool(MapTool* tool)
|
|
||||||
{
|
|
||||||
m_activeTool = tool;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapTools::setMapcavas(Mapcavas* canvas)
|
|
||||||
{
|
|
||||||
if (m_activeTool)
|
|
||||||
{
|
|
||||||
m_activeTool->setMapcavas(canvas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
#ifndef MAPTOOLS_H
|
|
||||||
#define MAPTOOLS_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QHash>
|
|
||||||
|
|
||||||
class MapTool;
|
|
||||||
class MapToolPan;
|
|
||||||
class MapToolSpectral;
|
|
||||||
class Mapcavas;
|
|
||||||
|
|
||||||
class MapTools : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum Tool
|
|
||||||
{
|
|
||||||
Pan,
|
|
||||||
Spectral,
|
|
||||||
};
|
|
||||||
|
|
||||||
MapTools(QObject* parent = nullptr);
|
|
||||||
~MapTools();
|
|
||||||
|
|
||||||
MapToolPan* mapToolPan() const;
|
|
||||||
MapToolSpectral* mapToolSpectral() const;
|
|
||||||
|
|
||||||
MapTool* mapTool(Tool tool) const;
|
|
||||||
|
|
||||||
MapTool* activeTool() const;
|
|
||||||
void setActiveTool(MapTool* tool);
|
|
||||||
|
|
||||||
void setMapcavas(Mapcavas* canvas);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QHash<Tool, MapTool*> m_tools;
|
|
||||||
MapTool* m_activeTool = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MAPTOOLS_H
|
|
||||||
@ -64,8 +64,6 @@ void OneMotorControl::display_x_loc(std::vector<double> loc)
|
|||||||
{
|
{
|
||||||
double tmp = round(loc[0] * 100) / 100;
|
double tmp = round(loc[0] * 100) / 100;
|
||||||
this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp));
|
this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp));
|
||||||
|
|
||||||
emit broadcastLocationSignal(loc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneMotorControl::display_motors_connectivity(std::vector<int> connectivity)
|
void OneMotorControl::display_motors_connectivity(std::vector<int> connectivity)
|
||||||
|
|||||||
@ -55,8 +55,6 @@ signals:
|
|||||||
|
|
||||||
void sequenceComplete();
|
void sequenceComplete();
|
||||||
|
|
||||||
void broadcastLocationSignal(std::vector<double>);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::OneMotorControl_UI ui;
|
Ui::OneMotorControl_UI ui;
|
||||||
|
|
||||||
|
|||||||
@ -6,103 +6,19 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>432</width>
|
<width>294</width>
|
||||||
<height>346</height>
|
<height>119</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>PowerControl</string>
|
<string>PowerControl</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QGroupBox
|
|
||||||
{
|
|
||||||
border: 12px solid transparent;
|
|
||||||
color: #ACCDFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;*/
|
|
||||||
font: 19pt "新宋体";
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3" rowstretch="1,1,1,1" columnstretch="1,3,1">
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>145</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>151</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>卤素灯</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>10</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -110,142 +26,94 @@ QPushButton:pressed
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="horizontalSpacing">
|
<property name="spacing">
|
||||||
<number>20</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="lamp_power_open_btn">
|
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<widget class="QLabel" name="label_17">
|
||||||
<horstretch>0</horstretch>
|
<property name="text">
|
||||||
<verstretch>0</verstretch>
|
<string>卤素灯</string>
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="lamp_power_open_btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打开</string>
|
<string>打开</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QPushButton" name="lamp_power_close_btn">
|
<widget class="QPushButton" name="lamp_power_close_btn">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>关闭</string>
|
<string>关闭</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_19">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="0">
|
||||||
<spacer name="horizontalSpacer_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<widget class="QLabel" name="label_18">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>151</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>151</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>马 达</string>
|
<string>马 达</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
</widget>
|
||||||
<property name="leftMargin">
|
</item>
|
||||||
<number>0</number>
|
<item>
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="motor_power_open_btn">
|
<widget class="QPushButton" name="motor_power_open_btn">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打开</string>
|
<string>打开</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QPushButton" name="motor_power_close_btn">
|
<widget class="QPushButton" name="motor_power_close_btn">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>关闭</string>
|
<string>关闭</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item>
|
||||||
</widget>
|
<spacer name="horizontalSpacer_20">
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>151</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
</layout>
|
||||||
<spacer name="verticalSpacer_2">
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>144</height>
|
<height>42</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|||||||
@ -23,8 +23,8 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
signals :
|
signals :
|
||||||
void valueChanged(double Value);//QSlider<65><72>valueChanged<65>źŵIJ<C5B5><C4B2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
void valueChanged(double Value);
|
||||||
void rangeChanged(double Min, double Max);//QSlider<65><72>rangeChanged<65>źŵIJ<C5B5><C4B2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
void rangeChanged(double Min, double Max);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_Multiplier;
|
double m_Multiplier;
|
||||||
|
|||||||
@ -1,225 +0,0 @@
|
|||||||
#include "RasterDataProvider.h"
|
|
||||||
#include <QString>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QRegularExpression>
|
|
||||||
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
#include <gdal_priv.h>
|
|
||||||
#include <cpl_conv.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RasterDataProvider::RasterDataProvider(const QString& uri)
|
|
||||||
: m_uri(uri), m_dataset(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterDataProvider::~RasterDataProvider()
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterDataProvider::open()
|
|
||||||
{
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
GDALAllRegister();
|
|
||||||
m_dataset = (GDALDataset*)GDALOpen((const char*)m_uri.toLocal8Bit().constData(), GA_ReadOnly);
|
|
||||||
if (!m_dataset) {
|
|
||||||
qWarning() << "RasterDataProvider: failed to open dataset:" << m_uri;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
Q_UNUSED(m_uri);
|
|
||||||
qWarning() << "RasterDataProvider: GDAL not available, open will fail.";
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void RasterDataProvider::close()
|
|
||||||
{
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
if (m_dataset) {
|
|
||||||
GDALClose((GDALDatasetH)m_dataset);
|
|
||||||
m_dataset = nullptr;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
m_dataset = nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int RasterDataProvider::bandCount() const
|
|
||||||
{
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
if (!m_dataset) return 0;
|
|
||||||
return m_dataset->GetRasterCount();
|
|
||||||
#else
|
|
||||||
Q_UNUSED(this);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int RasterDataProvider::width() const
|
|
||||||
{
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
if (!m_dataset) return 0;
|
|
||||||
return m_dataset->GetRasterXSize();
|
|
||||||
#else
|
|
||||||
Q_UNUSED(this);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int RasterDataProvider::height() const
|
|
||||||
{
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
if (!m_dataset) return 0;
|
|
||||||
return m_dataset->GetRasterYSize();
|
|
||||||
#else
|
|
||||||
Q_UNUSED(this);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterDataProvider::isValidPixel(int x, int y) const
|
|
||||||
{
|
|
||||||
const int w = width();
|
|
||||||
const int h = height();
|
|
||||||
return x >= 0 && y >= 0 && x < w && y < h;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<double> RasterDataProvider::parseEnviHdrWavelengths() const
|
|
||||||
{
|
|
||||||
std::vector<double> res;
|
|
||||||
|
|
||||||
QFileInfo fi(m_uri);
|
|
||||||
QString hdrPath = fi.path() + "/" + fi.completeBaseName() + ".hdr";
|
|
||||||
QFile hdr(hdrPath);
|
|
||||||
if (!hdr.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString text = QString::fromLocal8Bit(hdr.readAll());
|
|
||||||
hdr.close();
|
|
||||||
|
|
||||||
QRegularExpression rx("wavelength\\s*=\\s*\\{([^}]*)\\}", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption);
|
|
||||||
QRegularExpressionMatch m = rx.match(text);
|
|
||||||
if (!m.hasMatch()) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString body = m.captured(1);
|
|
||||||
const QStringList parts = body.split(',', QString::SkipEmptyParts);
|
|
||||||
res.reserve(parts.size());
|
|
||||||
for (const QString& p : parts) {
|
|
||||||
bool ok = false;
|
|
||||||
double v = p.trimmed().toDouble(&ok);
|
|
||||||
if (ok) {
|
|
||||||
res.push_back(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<double> RasterDataProvider::bandWavelengths() const
|
|
||||||
{
|
|
||||||
std::vector<double> res;
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
if (!m_dataset) return res;
|
|
||||||
|
|
||||||
// 1) Try ENVI dataset-level metadata first: wavelength = { ... }
|
|
||||||
const char* dsWave = m_dataset->GetMetadataItem("wavelength", "ENVI");
|
|
||||||
if (!dsWave) dsWave = m_dataset->GetMetadataItem("Wavelength", "ENVI");
|
|
||||||
if (dsWave) {
|
|
||||||
QString dsWaveStr = QString::fromLocal8Bit(dsWave);
|
|
||||||
dsWaveStr.remove('{').remove('}');
|
|
||||||
const QStringList parts = dsWaveStr.split(',', QString::SkipEmptyParts);
|
|
||||||
res.reserve(parts.size());
|
|
||||||
for (const QString& p : parts) {
|
|
||||||
bool ok = false;
|
|
||||||
double v = p.trimmed().toDouble(&ok);
|
|
||||||
if (ok) res.push_back(v);
|
|
||||||
}
|
|
||||||
if (!res.empty()) return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2) Try per-band metadata
|
|
||||||
for (int i = 1; i <= m_dataset->GetRasterCount(); ++i) {
|
|
||||||
GDALRasterBand* band = m_dataset->GetRasterBand(i);
|
|
||||||
if (!band) continue;
|
|
||||||
const char* val = band->GetMetadataItem("Wavelength");
|
|
||||||
if (!val) val = band->GetMetadataItem("wavelength");
|
|
||||||
if (val) {
|
|
||||||
bool ok = false;
|
|
||||||
double v = QString::fromLocal8Bit(val).trimmed().toDouble(&ok);
|
|
||||||
res.push_back(ok ? v : -1.0);
|
|
||||||
} else {
|
|
||||||
res.push_back(-1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!res.empty()) return res;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 3) Fallback: parse ENVI .hdr directly
|
|
||||||
return parseEnviHdrWavelengths();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterDataProvider::readPixelSpectrum(int x, int y, std::vector<double>& outSpectrum) const
|
|
||||||
{
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
outSpectrum.clear();
|
|
||||||
if (!m_dataset) return false;
|
|
||||||
if (!isValidPixel(x, y)) return false;
|
|
||||||
|
|
||||||
const int bands = m_dataset->GetRasterCount();
|
|
||||||
if (bands <= 0) return false;
|
|
||||||
|
|
||||||
outSpectrum.resize(bands);
|
|
||||||
for (int i = 0; i < bands; ++i) {
|
|
||||||
GDALRasterBand* band = m_dataset->GetRasterBand(i + 1);
|
|
||||||
if (!band) return false;
|
|
||||||
|
|
||||||
float value = 0.0f;
|
|
||||||
CPLErr err = band->RasterIO(
|
|
||||||
GF_Read,
|
|
||||||
x, y,
|
|
||||||
1, 1,
|
|
||||||
&value,
|
|
||||||
1, 1,
|
|
||||||
GDT_Float32,
|
|
||||||
0, 0);
|
|
||||||
|
|
||||||
if (err != CE_None) return false;
|
|
||||||
outSpectrum[i] = static_cast<double>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
Q_UNUSED(x);
|
|
||||||
Q_UNUSED(y);
|
|
||||||
Q_UNUSED(outSpectrum);
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterDataProvider::readBandAsFloat(int bandIndex, std::vector<float>& outBuffer) const
|
|
||||||
{
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
if (!m_dataset) return false;
|
|
||||||
int bands = m_dataset->GetRasterCount();
|
|
||||||
if (bandIndex < 0 || bandIndex >= bands) return false;
|
|
||||||
GDALRasterBand* band = m_dataset->GetRasterBand(bandIndex + 1);
|
|
||||||
if (!band) return false;
|
|
||||||
int w = m_dataset->GetRasterXSize();
|
|
||||||
int h = m_dataset->GetRasterYSize();
|
|
||||||
outBuffer.assign(w * h, 0.0f);
|
|
||||||
CPLErr err = band->RasterIO(GF_Read, 0, 0, w, h, outBuffer.data(), w, h, GDT_Float32, 0, 0);
|
|
||||||
return err == CE_None;
|
|
||||||
#else
|
|
||||||
Q_UNUSED(bandIndex);
|
|
||||||
Q_UNUSED(outBuffer);
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#if __has_include(<gdal_priv.h>)
|
|
||||||
#define HPPA_HAVE_GDAL 1
|
|
||||||
#include <gdal_priv.h>
|
|
||||||
#include <cpl_conv.h>
|
|
||||||
#else
|
|
||||||
#define HPPA_HAVE_GDAL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class RasterDataProvider
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit RasterDataProvider(const QString& uri);
|
|
||||||
~RasterDataProvider();
|
|
||||||
|
|
||||||
bool open();
|
|
||||||
void close();
|
|
||||||
|
|
||||||
int bandCount() const;
|
|
||||||
int width() const;
|
|
||||||
int height() const;
|
|
||||||
|
|
||||||
bool isValidPixel(int x, int y) const;
|
|
||||||
|
|
||||||
// Returns per-band wavelength metadata if available. If not available, returns empty vector.
|
|
||||||
std::vector<double> bandWavelengths() const;
|
|
||||||
|
|
||||||
// Read spectrum of one pixel (x,y) across all bands.
|
|
||||||
bool readPixelSpectrum(int x, int y, std::vector<double>& outSpectrum) const;
|
|
||||||
|
|
||||||
// Read a single band (0-based index) into a float buffer of size width()*height().
|
|
||||||
// Returns true on success.
|
|
||||||
bool readBandAsFloat(int bandIndex, std::vector<float>& outBuffer) const;
|
|
||||||
|
|
||||||
QString uri() const { return m_uri; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString m_uri;
|
|
||||||
std::vector<double> parseEnviHdrWavelengths() const;
|
|
||||||
#if HPPA_HAVE_GDAL
|
|
||||||
GDALDataset* m_dataset = nullptr;
|
|
||||||
#else
|
|
||||||
// no-op when GDAL not available
|
|
||||||
void* m_dataset = nullptr;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
@ -1,116 +0,0 @@
|
|||||||
#include "RasterLayer.h"
|
|
||||||
#include "RasterDataProvider.h"
|
|
||||||
#include "RasterRenderer.h"
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
RasterLayer::RasterLayer(const QString& name, const QString& uri)
|
|
||||||
: MapLayer(name, uri)
|
|
||||||
{
|
|
||||||
// lazy creation
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterLayer::~RasterLayer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
MapLayer::LayerType RasterLayer::layerType() const
|
|
||||||
{
|
|
||||||
return MapLayer::LayerType::Raster;
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterDataProvider* RasterLayer::dataProvider() const
|
|
||||||
{
|
|
||||||
return m_provider ? m_provider.get() : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterRenderer* RasterLayer::renderer() const
|
|
||||||
{
|
|
||||||
return m_renderer ? m_renderer.get() : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterLayer::openDataProvider()
|
|
||||||
{
|
|
||||||
if (!m_provider) m_provider = std::make_unique<RasterDataProvider>(dataPath());
|
|
||||||
if (!m_provider) return false;
|
|
||||||
bool ok = m_provider->open();
|
|
||||||
if (ok && !m_renderer) m_renderer = std::make_unique<RasterRenderer>(m_provider.get());
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterLayer::isValidPixel(int x, int y)
|
|
||||||
{
|
|
||||||
if (!m_provider) {
|
|
||||||
if (!openDataProvider()) return false;
|
|
||||||
}
|
|
||||||
return m_provider->isValidPixel(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterLayer::readPixelSpectrum(int x, int y, QVector<double>& wavelengths, QVector<double>& spectrum)
|
|
||||||
{
|
|
||||||
if (!m_provider) {
|
|
||||||
if (!openDataProvider()) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<double> wl;
|
|
||||||
std::vector<double> sp;
|
|
||||||
|
|
||||||
if (!m_provider->readPixelSpectrum(x, y, sp)) return false;
|
|
||||||
|
|
||||||
wl = m_provider->bandWavelengths();
|
|
||||||
|
|
||||||
wavelengths = QVector<double>::fromStdVector(wl);
|
|
||||||
spectrum = QVector<double>::fromStdVector(sp);
|
|
||||||
|
|
||||||
if (wavelengths.size() != spectrum.size()) {
|
|
||||||
wavelengths.resize(spectrum.size());
|
|
||||||
for (int i = 0; i < wavelengths.size(); ++i) {
|
|
||||||
wavelengths[i] = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage RasterLayer::render(const RenderParams& params)
|
|
||||||
{
|
|
||||||
if (!m_provider) {
|
|
||||||
if (!openDataProvider()) return QImage();
|
|
||||||
}
|
|
||||||
if (!m_renderer) m_renderer = std::make_unique<RasterRenderer>(m_provider.get());
|
|
||||||
RasterRenderer::Params p;
|
|
||||||
p.rWave = params.rWave;
|
|
||||||
p.gWave = params.gWave;
|
|
||||||
p.bWave = params.bWave;
|
|
||||||
p.minValue = params.minValue;
|
|
||||||
p.maxValue = params.maxValue;
|
|
||||||
return m_renderer->render(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterLayer::RenderParams RasterLayer::currentRenderParams() const
|
|
||||||
{
|
|
||||||
return m_currentParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RasterLayer::setCurrentRenderParams(const RenderParams& params)
|
|
||||||
{
|
|
||||||
m_currentParams = params;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RasterLayer::wavelengthRange(double& minWave, double& maxWave) const
|
|
||||||
{
|
|
||||||
auto wl = bandWavelengths();
|
|
||||||
if (wl.empty()) return false;
|
|
||||||
minWave = *std::min_element(wl.begin(), wl.end());
|
|
||||||
maxWave = *std::max_element(wl.begin(), wl.end());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<double> RasterLayer::bandWavelengths() const
|
|
||||||
{
|
|
||||||
if (!m_provider) {
|
|
||||||
// need to open provider to read wavelengths - cast away const for lazy init
|
|
||||||
auto* self = const_cast<RasterLayer*>(this);
|
|
||||||
if (!self->openDataProvider()) return {};
|
|
||||||
}
|
|
||||||
return m_provider->bandWavelengths();
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "MapLayer.h"
|
|
||||||
#include <memory>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
class RasterDataProvider;
|
|
||||||
class RasterRenderer;
|
|
||||||
|
|
||||||
class RasterLayer : public MapLayer
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit RasterLayer(const QString& name, const QString& uri);
|
|
||||||
~RasterLayer();
|
|
||||||
|
|
||||||
LayerType layerType() const override;
|
|
||||||
|
|
||||||
// Access provider/renderer
|
|
||||||
RasterDataProvider* dataProvider() const;
|
|
||||||
RasterRenderer* renderer() const;
|
|
||||||
|
|
||||||
// Create or open provider based on this layer's uri
|
|
||||||
bool openDataProvider();
|
|
||||||
|
|
||||||
bool isValidPixel(int x, int y);
|
|
||||||
bool readPixelSpectrum(int x, int y, QVector<double>& wavelengths, QVector<double>& spectrum);
|
|
||||||
|
|
||||||
struct RenderParams {
|
|
||||||
double rWave = 665.0; // default wavelengths (nm)
|
|
||||||
double gWave = 560.0;
|
|
||||||
double bWave = 490.0;
|
|
||||||
double minValue = 0.0; // optional stretch
|
|
||||||
double maxValue = 4095.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Render the raster using current provider and renderer. Returns an empty QImage on failure.
|
|
||||||
QImage render(const RenderParams& params);
|
|
||||||
|
|
||||||
// Current render params stored per layer
|
|
||||||
RenderParams currentRenderParams() const;
|
|
||||||
void setCurrentRenderParams(const RenderParams& params);
|
|
||||||
|
|
||||||
// Get wavelength range from data provider (min, max). Returns false if unavailable.
|
|
||||||
bool wavelengthRange(double& minWave, double& maxWave) const;
|
|
||||||
|
|
||||||
// Get all band wavelengths
|
|
||||||
std::vector<double> bandWavelengths() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<RasterDataProvider> m_provider;
|
|
||||||
std::unique_ptr<RasterRenderer> m_renderer;
|
|
||||||
RenderParams m_currentParams;
|
|
||||||
};
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
#include "RasterRenderer.h"
|
|
||||||
#include "RasterDataProvider.h"
|
|
||||||
#include <QDebug>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
RasterRenderer::RasterRenderer(RasterDataProvider* provider)
|
|
||||||
: m_provider(provider)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void RasterRenderer::stretchTo8bit(const std::vector<float>& in, std::vector<unsigned char>& out, float minVal, float maxVal)
|
|
||||||
{
|
|
||||||
size_t n = in.size();
|
|
||||||
out.resize(n);
|
|
||||||
if (maxVal <= minVal) {
|
|
||||||
std::fill(out.begin(), out.end(), 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float denom = 1.0f / (maxVal - minVal);
|
|
||||||
for (size_t i = 0; i < n; ++i) {
|
|
||||||
float v = (in[i] - minVal) * denom;
|
|
||||||
v = std::min(std::max(v, 0.0f), 1.0f);
|
|
||||||
out[i] = static_cast<unsigned char>(v * 255.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage RasterRenderer::render(const Params& params)
|
|
||||||
{
|
|
||||||
if (!m_provider) return QImage();
|
|
||||||
int bands = m_provider->bandCount();
|
|
||||||
int w = m_provider->width();
|
|
||||||
int h = m_provider->height();
|
|
||||||
if (w <= 0 || h <= 0) return QImage();
|
|
||||||
|
|
||||||
// Find nearest bands for requested wavelengths if wavelengths available
|
|
||||||
std::vector<double> wavelengths = m_provider->bandWavelengths();
|
|
||||||
|
|
||||||
auto chooseBandIndexForWave = [&](double wave)->int {
|
|
||||||
if (wavelengths.empty()) {
|
|
||||||
// fallback: select R,G,B as first three bands
|
|
||||||
if (bands >= 3) return (wave==params.rWave?0:(wave==params.gWave?1:2));
|
|
||||||
if (bands >= 1) return 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int best = -1; double bestDiff = 1e12;
|
|
||||||
for (int i = 0; i < (int)wavelengths.size(); ++i) {
|
|
||||||
if (wavelengths[i] < 0) continue;
|
|
||||||
double d = std::abs(wavelengths[i] - wave);
|
|
||||||
if (d < bestDiff) { bestDiff = d; best = i; }
|
|
||||||
}
|
|
||||||
if (best >= 0) return best;
|
|
||||||
// fallback
|
|
||||||
return std::min(2, bands-1);
|
|
||||||
};
|
|
||||||
|
|
||||||
int rIdx = chooseBandIndexForWave(params.rWave);
|
|
||||||
int gIdx = chooseBandIndexForWave(params.gWave);
|
|
||||||
int bIdx = chooseBandIndexForWave(params.bWave);
|
|
||||||
|
|
||||||
std::vector<float> rbuf, gbuf, bbuf;
|
|
||||||
if (rIdx >= 0) m_provider->readBandAsFloat(rIdx, rbuf);
|
|
||||||
if (gIdx >= 0) m_provider->readBandAsFloat(gIdx, gbuf);
|
|
||||||
if (bIdx >= 0) m_provider->readBandAsFloat(bIdx, bbuf);
|
|
||||||
|
|
||||||
std::vector<unsigned char> r8, g8, b8;
|
|
||||||
float minV = static_cast<float>(params.minValue);
|
|
||||||
float maxV = static_cast<float>(params.maxValue);
|
|
||||||
if (!rbuf.empty()) stretchTo8bit(rbuf, r8, minV, maxV);
|
|
||||||
if (!gbuf.empty()) stretchTo8bit(gbuf, g8, minV, maxV);
|
|
||||||
if (!bbuf.empty()) stretchTo8bit(bbuf, b8, minV, maxV);
|
|
||||||
|
|
||||||
QImage out(w, h, QImage::Format_RGB888);
|
|
||||||
for (int y = 0; y < h; ++y) {
|
|
||||||
unsigned char* scan = out.scanLine(y);
|
|
||||||
for (int x = 0; x < w; ++x) {
|
|
||||||
int idx = y * w + x;
|
|
||||||
unsigned char rc = (r8.size() > (size_t)idx) ? r8[idx] : 0;
|
|
||||||
unsigned char gc = (g8.size() > (size_t)idx) ? g8[idx] : 0;
|
|
||||||
unsigned char bc = (b8.size() > (size_t)idx) ? b8[idx] : 0;
|
|
||||||
scan[x*3 + 0] = rc;
|
|
||||||
scan[x*3 + 1] = gc;
|
|
||||||
scan[x*3 + 2] = bc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QImage>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class RasterDataProvider;
|
|
||||||
|
|
||||||
class RasterRenderer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct Params {
|
|
||||||
double rWave = 665.0;
|
|
||||||
double gWave = 560.0;
|
|
||||||
double bWave = 490.0;
|
|
||||||
double minValue = 0.0;
|
|
||||||
double maxValue = 255.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit RasterRenderer(RasterDataProvider* provider);
|
|
||||||
|
|
||||||
// Render to an 8-bit RGB image. Returns empty image on failure.
|
|
||||||
QImage render(const Params& params);
|
|
||||||
|
|
||||||
private:
|
|
||||||
RasterDataProvider* m_provider;
|
|
||||||
|
|
||||||
// helper to map float buffer to 8-bit with min/max stretch
|
|
||||||
static void stretchTo8bit(const std::vector<float>& in, std::vector<unsigned char>& out, float minVal, float maxVal);
|
|
||||||
};
|
|
||||||
@ -286,7 +286,6 @@ void ResononNirImager::start_record()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
||||||
QString filePath = QString::fromStdString(m_FileName2Save2);
|
|
||||||
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
||||||
|
|
||||||
size_t x;
|
size_t x;
|
||||||
@ -354,7 +353,7 @@ void ResononNirImager::start_record()
|
|||||||
//ÿ<><C3BF>1s<31><73><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>ͼ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
//ÿ<><C3BF>1s<31><73><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>ͼ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
||||||
if (m_iFrameCounter % (int)getFramerate() == 0)
|
if (m_iFrameCounter % (int)getFramerate() == 0)
|
||||||
{
|
{
|
||||||
emit PlotSignal(m_FileSavedCounter, m_iFrameCounter, filePath);
|
emit PlotSignal(m_FileSavedCounter, m_iFrameCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_iFrameCounter >= m_iFrameNumber)
|
if (m_iFrameCounter >= m_iFrameNumber)
|
||||||
@ -368,7 +367,7 @@ void ResononNirImager::start_record()
|
|||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
//m_RgbImage
|
//m_RgbImage
|
||||||
emit PlotSignal(m_FileSavedCounter, -1, filePath);//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Է<EFBFBD><D4B7>ɼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<CAB5><C4B1><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ȫ
|
emit PlotSignal(m_FileSavedCounter, -1);//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Է<EFBFBD><D4B7>ɼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<CAB5><C4B1><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ȫ
|
||||||
|
|
||||||
m_bRecordControlState = false;
|
m_bRecordControlState = false;
|
||||||
WriteHdr();
|
WriteHdr();
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
#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());
|
|
||||||
int insertIndex = 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);
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
#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;
|
|
||||||
};
|
|
||||||
@ -5,6 +5,7 @@ TwoMotorControl::TwoMotorControl(QWidget* parent) : QDialog(parent)
|
|||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus);
|
ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus);
|
||||||
|
ui.recordLine_tableWidget->setStyleSheet("selection-background-color:rgb(255,209,128)");//设置选择的行高亮
|
||||||
|
|
||||||
ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//设置选择行为,以行为单位
|
ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//设置选择行为,以行为单位
|
||||||
//ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//设置选择模式,选择单行
|
//ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//设置选择模式,选择单行
|
||||||
@ -15,9 +16,13 @@ TwoMotorControl::TwoMotorControl(QWidget* parent) : QDialog(parent)
|
|||||||
|
|
||||||
connect(ui.addRecordLine_btn, SIGNAL(clicked()), this, SLOT(onAddRecordLine_btn()));
|
connect(ui.addRecordLine_btn, SIGNAL(clicked()), this, SLOT(onAddRecordLine_btn()));
|
||||||
connect(ui.removeRecordLine_btn, SIGNAL(clicked()), this, SLOT(onRemoveRecordLine_btn()));
|
connect(ui.removeRecordLine_btn, SIGNAL(clicked()), this, SLOT(onRemoveRecordLine_btn()));
|
||||||
|
connect(ui.generateRecordLine_btn, SIGNAL(clicked()), this, SLOT(onGenerateRecordLine_btn()));
|
||||||
connect(ui.deleteRecordLine_btn, SIGNAL(clicked()), this, SLOT(onDeleteRecordLine_btn()));
|
connect(ui.deleteRecordLine_btn, SIGNAL(clicked()), this, SLOT(onDeleteRecordLine_btn()));
|
||||||
connect(ui.saveRecordLine2File_btn, SIGNAL(clicked()), this, SLOT(onSaveRecordLine2File_btn()));
|
connect(ui.saveRecordLine2File_btn, SIGNAL(clicked()), this, SLOT(onSaveRecordLine2File_btn()));
|
||||||
connect(ui.readRecordLineFile_btn, SIGNAL(clicked()), this, SLOT(onReadRecordLineFile_btn()));
|
connect(ui.readRecordLineFile_btn, SIGNAL(clicked()), this, SLOT(onReadRecordLineFile_btn()));
|
||||||
|
|
||||||
|
connect(ui.run_btn, SIGNAL(clicked()), this, SLOT(run()));
|
||||||
|
connect(ui.stop_btn, SIGNAL(clicked()), this, SLOT(stop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoMotorControl::setImager(ImagerOperationBase* imager)
|
void TwoMotorControl::setImager(ImagerOperationBase* imager)
|
||||||
@ -232,44 +237,20 @@ void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
|
|||||||
//std::cout << "-----------------------------------"<<connectivity.size()<< std::endl;
|
//std::cout << "-----------------------------------"<<connectivity.size()<< std::endl;
|
||||||
if (connectivity[0])
|
if (connectivity[0])
|
||||||
{
|
{
|
||||||
this->ui.xMotorStateLabel->setStyleSheet(R"(
|
this->ui.xMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
|
||||||
QLabel
|
|
||||||
{
|
|
||||||
background-color: #08FACE;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->ui.xMotorStateLabel->setStyleSheet(R"(
|
this->ui.xMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
|
||||||
QLabel
|
|
||||||
{
|
|
||||||
background-color: red;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connectivity[1])
|
if (connectivity[1])
|
||||||
{
|
{
|
||||||
this->ui.yMotorStateLabel->setStyleSheet(R"(
|
this->ui.yMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
|
||||||
QLabel
|
|
||||||
{
|
|
||||||
background-color: #08FACE;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->ui.yMotorStateLabel->setStyleSheet(R"(
|
this->ui.yMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
|
||||||
QLabel
|
|
||||||
{
|
|
||||||
background-color: red;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,8 +320,6 @@ void TwoMotorControl::displayRealTimeLoc(std::vector<double> loc)
|
|||||||
|
|
||||||
tmp = round(loc[1] * 100) / 100;
|
tmp = round(loc[1] * 100) / 100;
|
||||||
this->ui.ymotor_realTimeLoc_lineEdit->setText(QString::number(tmp));
|
this->ui.ymotor_realTimeLoc_lineEdit->setText(QString::number(tmp));
|
||||||
|
|
||||||
emit broadcastLocationSignal(loc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoMotorControl::zeroStart()
|
void TwoMotorControl::zeroStart()
|
||||||
@ -414,6 +393,93 @@ void TwoMotorControl::onRemoveRecordLine_btn()
|
|||||||
ui.recordLine_tableWidget->removeRow(rowIndex);
|
ui.recordLine_tableWidget->removeRow(rowIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TwoMotorControl::onGenerateRecordLine_btn()
|
||||||
|
{
|
||||||
|
//求幅宽
|
||||||
|
double height = ui.height_lineEdit->text().toDouble();
|
||||||
|
double fov = ui.fov_lineEdit->text().toDouble();
|
||||||
|
double swath = (height * tan(fov / 2 * PI / 180)) * 2;//tan输入是弧度
|
||||||
|
ui.swath_lineEdit->setText(QString::number(swath));
|
||||||
|
|
||||||
|
|
||||||
|
//读取马达测量范围
|
||||||
|
double xMotorRange = 50;
|
||||||
|
double yMotorRange = 500;
|
||||||
|
|
||||||
|
|
||||||
|
//确定有多少条采集线,公式:numberOfRecordLine_tmp * swath - repetitiveLength(numberOfRecordLine_tmp - 1) = overallLength
|
||||||
|
double overallLength = yMotorRange + swath;
|
||||||
|
double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble() / 100;
|
||||||
|
double repetitiveLength = repetitiveRate * swath;
|
||||||
|
double offset = ui.offset_lineEdit->text().toDouble();
|
||||||
|
|
||||||
|
double numberOfRecordLine_tmp = (overallLength - repetitiveLength - offset) / (swath - repetitiveLength);
|
||||||
|
double tmp = numberOfRecordLine_tmp - (int)numberOfRecordLine_tmp;
|
||||||
|
int numberOfRecordLine;
|
||||||
|
double threshold = ui.LastLineThreshold_lineEdit->text().toDouble();//当numberOfRecordLine_tmp为小数时,判断是否多加一条采集线
|
||||||
|
if (tmp > threshold)
|
||||||
|
{
|
||||||
|
numberOfRecordLine = (int)numberOfRecordLine_tmp + 1;
|
||||||
|
//std::cout << "大于:" << threshold << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
numberOfRecordLine = (int)numberOfRecordLine_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//去掉tableWidget中所有的行
|
||||||
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
|
for (size_t i = 0; i < rowCount; i++)
|
||||||
|
{
|
||||||
|
ui.recordLine_tableWidget->removeRow(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//向tableWidget添加行(采集线)
|
||||||
|
QTableWidgetItem* tmpItem;
|
||||||
|
for (size_t i = 0; i < numberOfRecordLine; i++)
|
||||||
|
{
|
||||||
|
//增加一行
|
||||||
|
int RowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
|
ui.recordLine_tableWidget->insertRow(RowCount);
|
||||||
|
|
||||||
|
//设置yPosition
|
||||||
|
if (tmp > threshold && i == numberOfRecordLine - 1)//设置最后一行的yPosition
|
||||||
|
{
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(yMotorRange, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double x = swath * i - i * repetitiveLength + offset;
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(x, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
|
||||||
|
}
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(1, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 1, tmpItem);
|
||||||
|
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(0, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 2, tmpItem);
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(1, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 3, tmpItem);
|
||||||
|
|
||||||
|
//设置x马达最大运动位置 → 值设置为x马达量程
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(xMotorRange, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 4, tmpItem);
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(1, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 5, tmpItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TwoMotorControl::onDeleteRecordLine_btn()
|
void TwoMotorControl::onDeleteRecordLine_btn()
|
||||||
{
|
{
|
||||||
int rowCount = ui.recordLine_tableWidget->rowCount();
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
@ -432,12 +498,19 @@ void TwoMotorControl::onSaveRecordLine2File_btn()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double height = ui.height_lineEdit->text().toDouble();
|
||||||
|
double fov = ui.fov_lineEdit->text().toDouble();
|
||||||
|
double swath = ui.swath_lineEdit->text().toDouble();
|
||||||
|
double offset = ui.offset_lineEdit->text().toDouble();
|
||||||
|
double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble();
|
||||||
|
double LastLineThreshold = ui.LastLineThreshold_lineEdit->text().toDouble();
|
||||||
|
|
||||||
FileOperation* fileOperation = new FileOperation();
|
FileOperation* fileOperation = new FileOperation();
|
||||||
string directory = fileOperation->getDirectoryOfExe();
|
string directory = fileOperation->getDirectoryOfExe();
|
||||||
|
|
||||||
QString RecordLineFilePath = QFileDialog::getSaveFileName(this, tr("Save RecordLine3 File"),
|
QString RecordLineFilePath = QFileDialog::getSaveFileName(this, tr("Save RecordLine2 File"),
|
||||||
QString::fromStdString(directory),
|
QString::fromStdString(directory),
|
||||||
tr("RecordLineFile3 (*.RecordLine3)"));
|
tr("RecordLineFile2 (*.RecordLine2)"));
|
||||||
|
|
||||||
if (RecordLineFilePath.isEmpty())
|
if (RecordLineFilePath.isEmpty())
|
||||||
{
|
{
|
||||||
@ -446,6 +519,13 @@ void TwoMotorControl::onSaveRecordLine2File_btn()
|
|||||||
|
|
||||||
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "wb+");
|
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "wb+");
|
||||||
|
|
||||||
|
fwrite(&height, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&fov, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&swath, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&offset, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
double number = ui.recordLine_tableWidget->rowCount() * ui.recordLine_tableWidget->columnCount();
|
double number = ui.recordLine_tableWidget->rowCount() * ui.recordLine_tableWidget->columnCount();
|
||||||
fwrite(&number, sizeof(double), 1, RecordLineFileHandle);
|
fwrite(&number, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
@ -464,7 +544,7 @@ void TwoMotorControl::onSaveRecordLine2File_btn()
|
|||||||
fclose(RecordLineFileHandle);
|
fclose(RecordLineFileHandle);
|
||||||
delete[] data;
|
delete[] data;
|
||||||
|
|
||||||
//QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("保存成功!"));
|
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("保存成功!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoMotorControl::onReadRecordLineFile_btn()
|
void TwoMotorControl::onReadRecordLineFile_btn()
|
||||||
@ -473,9 +553,9 @@ void TwoMotorControl::onReadRecordLineFile_btn()
|
|||||||
FileOperation* fileOperation = new FileOperation();
|
FileOperation* fileOperation = new FileOperation();
|
||||||
string directory = fileOperation->getDirectoryOfExe();
|
string directory = fileOperation->getDirectoryOfExe();
|
||||||
|
|
||||||
QString RecordLineFilePath = QFileDialog::getOpenFileName(this, tr("Open RecordLine3 File"),
|
QString RecordLineFilePath = QFileDialog::getOpenFileName(this, tr("Open RecordLine2 File"),
|
||||||
QString::fromStdString(directory),
|
QString::fromStdString(directory),
|
||||||
tr("RecordLineFile (*.RecordLine3)"));
|
tr("RecordLineFile (*.RecordLine2)"));
|
||||||
|
|
||||||
if (RecordLineFilePath.isEmpty())
|
if (RecordLineFilePath.isEmpty())
|
||||||
{
|
{
|
||||||
@ -483,9 +563,15 @@ void TwoMotorControl::onReadRecordLineFile_btn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "rb");
|
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "rb");
|
||||||
double number;
|
double height, fov, swath, offset, repetitiveRate, LastLineThreshold, number;
|
||||||
|
|
||||||
//读取数据
|
//读取数据
|
||||||
|
fread(&height, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&fov, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&swath, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&offset, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle);
|
||||||
fread(&number, sizeof(double), 1, RecordLineFileHandle);
|
fread(&number, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
double* data = new double[number];
|
double* data = new double[number];
|
||||||
@ -495,6 +581,15 @@ void TwoMotorControl::onReadRecordLineFile_btn()
|
|||||||
//std::cout << *(data + i) << std::endl;
|
//std::cout << *(data + i) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//向界面中填写
|
||||||
|
ui.height_lineEdit->setText(QString::number(height));
|
||||||
|
ui.fov_lineEdit->setText(QString::number(fov));
|
||||||
|
ui.swath_lineEdit->setText(QString::number(swath));
|
||||||
|
ui.offset_lineEdit->setText(QString::number(offset));
|
||||||
|
ui.repetitiveRate_lineEdit->setText(QString::number(repetitiveRate));
|
||||||
|
ui.LastLineThreshold_lineEdit->setText(QString::number(LastLineThreshold));
|
||||||
|
|
||||||
|
|
||||||
//向tableWidget添加采集线
|
//向tableWidget添加采集线
|
||||||
//(1)去掉tableWidget中所有的行
|
//(1)去掉tableWidget中所有的行
|
||||||
int rowCount = ui.recordLine_tableWidget->rowCount();
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
@ -523,5 +618,5 @@ void TwoMotorControl::onReadRecordLineFile_btn()
|
|||||||
fclose(RecordLineFileHandle);
|
fclose(RecordLineFileHandle);
|
||||||
delete[] data;
|
delete[] data;
|
||||||
|
|
||||||
//QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("读取成功!"));
|
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("读取成功!"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,6 +57,7 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
void onAddRecordLine_btn();
|
void onAddRecordLine_btn();
|
||||||
void onRemoveRecordLine_btn();
|
void onRemoveRecordLine_btn();
|
||||||
|
void onGenerateRecordLine_btn();
|
||||||
void onDeleteRecordLine_btn();
|
void onDeleteRecordLine_btn();
|
||||||
void onSaveRecordLine2File_btn();
|
void onSaveRecordLine2File_btn();
|
||||||
void onReadRecordLineFile_btn();
|
void onReadRecordLineFile_btn();
|
||||||
@ -83,8 +84,6 @@ signals:
|
|||||||
void startLineNumSignal(int lineNum);
|
void startLineNumSignal(int lineNum);
|
||||||
void sequenceComplete();//所有采集线正常运行完成
|
void sequenceComplete();//所有采集线正常运行完成
|
||||||
|
|
||||||
void broadcastLocationSignal(std::vector<double>);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::twoMotorControl_UI ui;
|
Ui::twoMotorControl_UI ui;
|
||||||
QThread m_coordinatorThread;
|
QThread m_coordinatorThread;
|
||||||
|
|||||||
375
HPPA/View3D.cpp
375
HPPA/View3D.cpp
@ -1,375 +0,0 @@
|
|||||||
#include "View3D.h"
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QShowEvent>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QWheelEvent>
|
|
||||||
#include <Qt3DExtras/QForwardRenderer>
|
|
||||||
#include <QtMath>
|
|
||||||
#include <Qt3DRender/QAttribute>
|
|
||||||
#include <QGeometryRenderer>
|
|
||||||
|
|
||||||
View3DBase::View3DBase(const QString& baseModelPath,
|
|
||||||
const QString& armModelPath,
|
|
||||||
QWidget* parent)
|
|
||||||
: QWidget(parent),
|
|
||||||
m_container(nullptr),
|
|
||||||
m_baseModelPath(baseModelPath),
|
|
||||||
m_armModelPath(armModelPath)
|
|
||||||
{
|
|
||||||
m_view = new Qt3DExtras::Qt3DWindow();
|
|
||||||
// 部分 Qt5.9 构建可能需要强转 frame graph,但 defaultFrameGraph() 通常可用
|
|
||||||
QColor c1("#0D1233");
|
|
||||||
m_view->defaultFrameGraph()->setClearColor(c1);
|
|
||||||
|
|
||||||
m_rootEntity = new Qt3DCore::QEntity();
|
|
||||||
|
|
||||||
initScene();
|
|
||||||
initCamera();
|
|
||||||
|
|
||||||
// 自动旋转臂(如果不需要可注释掉 timer/connect)
|
|
||||||
//connect(&m_timer, &QTimer::timeout, this, [=]() {
|
|
||||||
// m_angle += 1.0f;
|
|
||||||
// m_t += 1.0f;
|
|
||||||
// if (m_angle >= 360.0f) m_angle = 0.0f;
|
|
||||||
// if (m_armTransform)
|
|
||||||
// {
|
|
||||||
// //m_armTransform->setRotationX(m_angle);
|
|
||||||
// //m_armTransform->setTranslation(QVector3D(m_t, 0, 0));
|
|
||||||
//
|
|
||||||
// Qt3DCore::QTransform transform;
|
|
||||||
// transform.setTranslation(QVector3D(2, 0, 0));
|
|
||||||
|
|
||||||
// QMatrix4x4 M = m_armTransform->matrix();
|
|
||||||
// M = transform.matrix() * M; // 左乘:在世界坐标系叠加
|
|
||||||
// m_armTransform->setMatrix(M);
|
|
||||||
|
|
||||||
// qDebug() << m_armTransform->matrix();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
/*auto* lightEntity = new Qt3DCore::QEntity(m_rootEntity);
|
|
||||||
|
|
||||||
auto* light = new Qt3DRender::QPointLight(lightEntity);
|
|
||||||
light->setColor(Qt::white);
|
|
||||||
light->setIntensity(1.2f);
|
|
||||||
|
|
||||||
auto* lightTransform = new Qt3DCore::QTransform(lightEntity);
|
|
||||||
lightTransform->setTranslation(QVector3D(500, 500, 500));
|
|
||||||
|
|
||||||
lightEntity->addComponent(light);
|
|
||||||
lightEntity->addComponent(lightTransform);*/
|
|
||||||
|
|
||||||
// ===== 创建 base 根节点 =====
|
|
||||||
auto* baseModel = new Qt3DCore::QEntity(m_rootEntity);
|
|
||||||
auto* baseLoader = new Qt3DRender::QSceneLoader(baseModel);
|
|
||||||
baseLoader->setSource(QUrl::fromLocalFile(m_baseModelPath));
|
|
||||||
|
|
||||||
//connect(baseLoader, &Qt3DRender::QSceneLoader::statusChanged,
|
|
||||||
// this, &View3DBase::onSceneLoaderStatusChanged);
|
|
||||||
|
|
||||||
|
|
||||||
m_baseTransform = new Qt3DCore::QTransform();
|
|
||||||
m_baseTransform->setTranslation(QVector3D(0, 0, 0));
|
|
||||||
baseModel->addComponent(baseLoader);
|
|
||||||
baseModel->addComponent(m_baseTransform);
|
|
||||||
|
|
||||||
connect(baseLoader, &Qt3DRender::QSceneLoader::statusChanged,
|
|
||||||
this, [=](Qt3DRender::QSceneLoader::Status status) {
|
|
||||||
|
|
||||||
if (status == Qt3DRender::QSceneLoader::Ready) {
|
|
||||||
applyWhiteMaterialRecursive(baseModel);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// ===== 创建 arm 根节点 =====
|
|
||||||
auto* armModel = new Qt3DCore::QEntity(m_rootEntity);
|
|
||||||
auto* armLoader = new Qt3DRender::QSceneLoader(armModel);
|
|
||||||
armLoader->setSource(QUrl::fromLocalFile(m_armModelPath));
|
|
||||||
|
|
||||||
m_armTransform = new Qt3DCore::QTransform();
|
|
||||||
m_armTransform->setTranslation(QVector3D(0, 0, 0));
|
|
||||||
armModel->addComponent(armLoader);
|
|
||||||
armModel->addComponent(m_armTransform);
|
|
||||||
|
|
||||||
connect(armLoader, &Qt3DRender::QSceneLoader::statusChanged,
|
|
||||||
this, [=](Qt3DRender::QSceneLoader::Status status) {
|
|
||||||
|
|
||||||
if (status == Qt3DRender::QSceneLoader::Ready) {
|
|
||||||
applyWhiteMaterialRecursive(armModel);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 坐标轴依然挂在 root,不会被移动
|
|
||||||
//createAxes();
|
|
||||||
|
|
||||||
m_view->setRootEntity(m_rootEntity);
|
|
||||||
|
|
||||||
qDebug() << m_baseTransform->matrix();
|
|
||||||
qDebug() << m_armTransform->matrix();
|
|
||||||
|
|
||||||
//m_armTransform->setTranslation(QVector3D(2000, 0, 0));
|
|
||||||
//m_baseTransform->setTranslation(QVector3D(-1000, -1000, -1000));
|
|
||||||
|
|
||||||
qDebug() << m_baseTransform->matrix();
|
|
||||||
qDebug() << m_armTransform->matrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DBase::applyWhiteMaterialRecursive(Qt3DCore::QEntity* entity)
|
|
||||||
{
|
|
||||||
// 如果这个 entity 有 mesh,就给它加白色材质
|
|
||||||
auto meshes = entity->componentsOfType<Qt3DRender::QGeometryRenderer>();
|
|
||||||
if (!meshes.isEmpty()) {
|
|
||||||
auto* mat = new Qt3DExtras::QPhongMaterial(entity);
|
|
||||||
QColor c1("#cccccc");
|
|
||||||
mat->setDiffuse(c1);
|
|
||||||
mat->setAmbient(c1);
|
|
||||||
mat->setSpecular(c1);
|
|
||||||
mat->setShininess(50.0f);
|
|
||||||
entity->addComponent(mat);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 递归处理子节点
|
|
||||||
const auto children = entity->children();
|
|
||||||
for (QObject* obj : children) {
|
|
||||||
auto* childEntity = qobject_cast<Qt3DCore::QEntity*>(obj);
|
|
||||||
if (childEntity)
|
|
||||||
applyWhiteMaterialRecursive(childEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DBase::createAxes()
|
|
||||||
{
|
|
||||||
// 参数
|
|
||||||
float axisLength = 500.0f;
|
|
||||||
float axisRadius = 50.0f;
|
|
||||||
|
|
||||||
// ----- X axis (red) -----
|
|
||||||
Qt3DCore::QEntity* xAxis = new Qt3DCore::QEntity(m_rootEntity);
|
|
||||||
auto* xMesh = new Qt3DExtras::QCylinderMesh();
|
|
||||||
xMesh->setRadius(axisRadius);
|
|
||||||
xMesh->setLength(axisLength);
|
|
||||||
xMesh->setRings(16);
|
|
||||||
xMesh->setSlices(16);
|
|
||||||
|
|
||||||
auto* xTrans = new Qt3DCore::QTransform();
|
|
||||||
// cylinder 默认沿 Y 轴,绕 Z 轴 90 度让其沿 X
|
|
||||||
xTrans->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(0, 0, 1), 90.0f));
|
|
||||||
xTrans->setTranslation(QVector3D(axisLength / 2.0f, 0.0f, 0.0f));
|
|
||||||
|
|
||||||
auto* xMat = new Qt3DExtras::QPhongMaterial();
|
|
||||||
xMat->setDiffuse(QColor(Qt::red));
|
|
||||||
|
|
||||||
xAxis->addComponent(xMesh);
|
|
||||||
xAxis->addComponent(xTrans);
|
|
||||||
xAxis->addComponent(xMat);
|
|
||||||
|
|
||||||
// ----- Y axis (green) -----
|
|
||||||
Qt3DCore::QEntity* yAxis = new Qt3DCore::QEntity(m_rootEntity);
|
|
||||||
auto* yMesh = new Qt3DExtras::QCylinderMesh();
|
|
||||||
yMesh->setRadius(axisRadius);
|
|
||||||
yMesh->setLength(axisLength*2);
|
|
||||||
yMesh->setRings(16);
|
|
||||||
yMesh->setSlices(16);
|
|
||||||
|
|
||||||
auto* yTrans = new Qt3DCore::QTransform();
|
|
||||||
// Y 轴无需旋转(cylinder 默认沿 Y)
|
|
||||||
yTrans->setTranslation(QVector3D(0.0f, axisLength / 2.0f, 0.0f));
|
|
||||||
|
|
||||||
auto* yMat = new Qt3DExtras::QPhongMaterial();
|
|
||||||
yMat->setDiffuse(QColor(Qt::green));
|
|
||||||
|
|
||||||
yAxis->addComponent(yMesh);
|
|
||||||
yAxis->addComponent(yTrans);
|
|
||||||
yAxis->addComponent(yMat);
|
|
||||||
|
|
||||||
// ----- Z axis (blue) -----
|
|
||||||
Qt3DCore::QEntity* zAxis = new Qt3DCore::QEntity(m_rootEntity);
|
|
||||||
auto* zMesh = new Qt3DExtras::QCylinderMesh();
|
|
||||||
zMesh->setRadius(axisRadius);
|
|
||||||
zMesh->setLength(axisLength*3);
|
|
||||||
zMesh->setRings(16);
|
|
||||||
zMesh->setSlices(16);
|
|
||||||
|
|
||||||
auto* zTrans = new Qt3DCore::QTransform();
|
|
||||||
// 让 cylinder 沿 Z:绕 X 轴 90 度
|
|
||||||
zTrans->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 90.0f));
|
|
||||||
zTrans->setTranslation(QVector3D(0.0f, 0.0f, axisLength / 2.0f));
|
|
||||||
|
|
||||||
auto* zMat = new Qt3DExtras::QPhongMaterial();
|
|
||||||
zMat->setDiffuse(QColor(Qt::blue));
|
|
||||||
|
|
||||||
zAxis->addComponent(zMesh);
|
|
||||||
zAxis->addComponent(zTrans);
|
|
||||||
zAxis->addComponent(zMat);
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DBase::initCamera()
|
|
||||||
{
|
|
||||||
m_camera = m_view->camera();
|
|
||||||
// 16:10 假设窗口比例,后续 resize 时相机透视会保持
|
|
||||||
m_camera->lens()->setPerspectiveProjection(50.0f, 16.0f / 10.0f, 0.1f, 10000.0f);
|
|
||||||
updateCameraPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DBase::updateCameraPosition()
|
|
||||||
{
|
|
||||||
float yaw = qDegreesToRadians(m_yawDeg);
|
|
||||||
float pitch = qDegreesToRadians(m_pitchDeg);
|
|
||||||
|
|
||||||
float x = m_distance * qCos(pitch) * qSin(yaw);
|
|
||||||
float y = m_distance * qSin(pitch);
|
|
||||||
float z = m_distance * qCos(pitch) * qCos(yaw);
|
|
||||||
|
|
||||||
QVector3D camPos = m_viewCenter + QVector3D(x, y, z);
|
|
||||||
m_camera->setPosition(camPos);
|
|
||||||
m_camera->setViewCenter(m_viewCenter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DBase::showEvent(QShowEvent* event)
|
|
||||||
{
|
|
||||||
QWidget::showEvent(event);
|
|
||||||
|
|
||||||
if (!m_container) {
|
|
||||||
m_container = QWidget::createWindowContainer(m_view, this);
|
|
||||||
m_view->installEventFilter(this);
|
|
||||||
|
|
||||||
auto* layout = new QHBoxLayout(this);
|
|
||||||
layout->addWidget(m_container);
|
|
||||||
layout->setMargin(0);
|
|
||||||
setLayout(layout);
|
|
||||||
|
|
||||||
// 启动自动旋转 timer(如果你不需要可以注释)
|
|
||||||
m_timer.start(100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool View3DBase::eventFilter(QObject* obj, QEvent* event)
|
|
||||||
{
|
|
||||||
if (obj == m_view)
|
|
||||||
{
|
|
||||||
// 鼠标按下
|
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
|
||||||
auto* e = static_cast<QMouseEvent*>(event);
|
|
||||||
if (e->button() == Qt::LeftButton) {
|
|
||||||
m_mouseDragging = true;
|
|
||||||
m_lastMousePos = e->pos();
|
|
||||||
}
|
|
||||||
else if (e->button() == Qt::MiddleButton) {
|
|
||||||
m_middleDragging = true;
|
|
||||||
m_lastMousePos = e->pos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 鼠标释放
|
|
||||||
else if (event->type() == QEvent::MouseButtonRelease) {
|
|
||||||
auto* e = static_cast<QMouseEvent*>(event);
|
|
||||||
if (e->button() == Qt::LeftButton) {
|
|
||||||
m_mouseDragging = false;
|
|
||||||
}
|
|
||||||
else if (e->button() == Qt::MiddleButton) {
|
|
||||||
m_middleDragging = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 鼠标移动
|
|
||||||
else if (event->type() == QEvent::MouseMove) {
|
|
||||||
auto* e = static_cast<QMouseEvent*>(event);
|
|
||||||
QPoint pos = e->pos();
|
|
||||||
QPoint delta = pos - m_lastMousePos;
|
|
||||||
|
|
||||||
// 左键:orbit(旋转)
|
|
||||||
if (m_mouseDragging) {
|
|
||||||
float sensitivity = 0.3f;
|
|
||||||
m_yawDeg -= delta.x() * sensitivity;
|
|
||||||
m_pitchDeg += delta.y() * sensitivity;
|
|
||||||
|
|
||||||
if (m_pitchDeg > 89.0f) m_pitchDeg = 89.0f;
|
|
||||||
if (m_pitchDeg < -89.0f) m_pitchDeg = -89.0f;
|
|
||||||
|
|
||||||
updateCameraPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 中键:pan(平移 viewCenter)
|
|
||||||
if (m_middleDragging) {
|
|
||||||
float speed = 2.0f;
|
|
||||||
|
|
||||||
// 根据摄像机方向计算平移方向
|
|
||||||
QVector3D camPos = m_camera->position();
|
|
||||||
QVector3D forward = (m_viewCenter - camPos).normalized();
|
|
||||||
QVector3D up(0, 1, 0);
|
|
||||||
QVector3D right = QVector3D::crossProduct(forward, up).normalized();
|
|
||||||
|
|
||||||
// 世界坐标变化量
|
|
||||||
QVector3D deltaMove =
|
|
||||||
-right * (delta.x() * speed) +
|
|
||||||
up * (delta.y() * speed);
|
|
||||||
|
|
||||||
// 将平移应用到两个模型根 Transform
|
|
||||||
if (m_baseRootTransform)
|
|
||||||
m_baseRootTransform->setTranslation(
|
|
||||||
m_baseRootTransform->translation() + deltaMove*-1);
|
|
||||||
|
|
||||||
if (m_armRootTransform)
|
|
||||||
m_armRootTransform->setTranslation(
|
|
||||||
m_armRootTransform->translation() + deltaMove*-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_lastMousePos = pos;
|
|
||||||
}
|
|
||||||
// 滚轮缩放
|
|
||||||
else if (event->type() == QEvent::Wheel) {
|
|
||||||
auto* e = static_cast<QWheelEvent*>(event);
|
|
||||||
// Qt5: angleDelta 返回像素值(通常为 120 per notch)
|
|
||||||
int delta = e->angleDelta().y();
|
|
||||||
if (delta == 0) delta = e->delta(); // 备选
|
|
||||||
m_distance -= delta * 2.0f; // 缩放速度
|
|
||||||
if (m_distance < 2.0f) m_distance = 2.0f;
|
|
||||||
if (m_distance > 10000.0f) m_distance = 10000.0f;
|
|
||||||
updateCameraPosition();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 让 Qt 继续处理(保持原行为)
|
|
||||||
return QWidget::eventFilter(obj, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
112
HPPA/View3D.h
112
HPPA/View3D.h
@ -1,112 +0,0 @@
|
|||||||
#ifndef VIEW3D_H
|
|
||||||
#define VIEW3D_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QPoint>
|
|
||||||
#include <QString>
|
|
||||||
#include <QQuaternion>
|
|
||||||
#include <QColor>
|
|
||||||
|
|
||||||
#include <Qt3DCore/QEntity>
|
|
||||||
#include <Qt3DCore/QTransform>
|
|
||||||
#include <Qt3DExtras/Qt3DWindow>
|
|
||||||
#include <Qt3DRender/QCamera>
|
|
||||||
#include <Qt3DExtras/QOrbitCameraController>
|
|
||||||
#include <Qt3DExtras/QPhongMaterial>
|
|
||||||
#include <Qt3DRender/QSceneLoader>
|
|
||||||
#include <Qt3DExtras/QCylinderMesh>
|
|
||||||
#include <QPointLight>
|
|
||||||
|
|
||||||
class View3DBase : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
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;
|
|
||||||
|
|
||||||
void initScene();
|
|
||||||
void initCamera();
|
|
||||||
void updateCameraPosition();
|
|
||||||
void createAxes();
|
|
||||||
|
|
||||||
QString m_baseModelPath;
|
|
||||||
QString m_armModelPath;
|
|
||||||
|
|
||||||
Qt3DExtras::Qt3DWindow* m_view;
|
|
||||||
QWidget* m_container;
|
|
||||||
Qt3DCore::QEntity* m_rootEntity;
|
|
||||||
|
|
||||||
Qt3DCore::QEntity* m_baseEntity;
|
|
||||||
Qt3DCore::QEntity* m_armEntity;
|
|
||||||
Qt3DCore::QTransform* m_armTransform;
|
|
||||||
Qt3DCore::QTransform* m_baseTransform;
|
|
||||||
|
|
||||||
QTimer m_timer;
|
|
||||||
float m_angle = 0; // arm auto rotation
|
|
||||||
float m_t = 0;
|
|
||||||
|
|
||||||
// ----- Camera control -----
|
|
||||||
Qt3DRender::QCamera* m_camera = nullptr;
|
|
||||||
float m_distance = 5000.0f;
|
|
||||||
float m_yawDeg = 0.0f;
|
|
||||||
float m_pitchDeg = 0.0f;
|
|
||||||
QVector3D m_viewCenter = QVector3D(1000, 1000, -1000);
|
|
||||||
|
|
||||||
// Mouse state
|
|
||||||
bool m_mouseDragging = false; // left button: orbit
|
|
||||||
bool m_middleDragging = false; // middle button: pan
|
|
||||||
QPoint m_lastMousePos;
|
|
||||||
|
|
||||||
Qt3DCore::QTransform* m_baseRootTransform = nullptr;
|
|
||||||
Qt3DCore::QTransform* m_armRootTransform = nullptr;
|
|
||||||
|
|
||||||
void applyWhiteMaterialRecursive(Qt3DCore::QEntity* entity);
|
|
||||||
|
|
||||||
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
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
#include "View3DModelManager.h"
|
|
||||||
|
|
||||||
View3DModelManager::View3DModelManager(QWidget* parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
{
|
|
||||||
m_stackedWidget = new QStackedWidget();
|
|
||||||
m_stackedWidget->setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
|
||||||
layout->addWidget(m_stackedWidget);
|
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DModelManager::switchScenario(ScenarioType type)
|
|
||||||
{
|
|
||||||
if (type == ScenarioType::PlantPhenotype) {
|
|
||||||
ensurePlantPhenotypeView();
|
|
||||||
m_stackedWidget->setCurrentWidget(m_viewPlant);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ensureOneMotorView();
|
|
||||||
m_stackedWidget->setCurrentWidget(m_viewMotor);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit scenarioChanged(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DModelManager::ensurePlantPhenotypeView()
|
|
||||||
{
|
|
||||||
if (m_viewPlant)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString basePath = QCoreApplication::applicationDirPath();
|
|
||||||
|
|
||||||
m_viewPlant = new View3DPlantPhenotype(
|
|
||||||
basePath + "/3DModel/HPPA_frame.obj",
|
|
||||||
basePath + "/3DModel/HPPA_camera.obj",
|
|
||||||
m_stackedWidget
|
|
||||||
);
|
|
||||||
|
|
||||||
m_viewPlant->setViewCenter(1000, 1000, -1000);
|
|
||||||
m_viewPlant->setDistance(5000);
|
|
||||||
|
|
||||||
m_stackedWidget->addWidget(m_viewPlant);
|
|
||||||
|
|
||||||
emit created3DModelPlantPhenotype();
|
|
||||||
}
|
|
||||||
|
|
||||||
void View3DModelManager::ensureOneMotorView()
|
|
||||||
{
|
|
||||||
if (m_viewMotor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString basePath = QCoreApplication::applicationDirPath();
|
|
||||||
|
|
||||||
m_viewMotor = new View3DLinearStage(
|
|
||||||
basePath + "/3DModel/linear_stage_indoor1.obj",
|
|
||||||
basePath + "/3DModel/linear_stage_indoor2.obj",
|
|
||||||
m_stackedWidget
|
|
||||||
);
|
|
||||||
|
|
||||||
m_viewMotor->setViewCenter(500, 100, 500);
|
|
||||||
m_viewMotor->setDistance(1000);
|
|
||||||
|
|
||||||
m_stackedWidget->addWidget(m_viewMotor);
|
|
||||||
|
|
||||||
emit created3DModelOneMotor();
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <QObject>
|
|
||||||
#include <QStackedWidget>
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
|
|
||||||
#include "View3D.h"
|
|
||||||
|
|
||||||
class View3DPlantPhenotype;
|
|
||||||
class View3DLinearStage;
|
|
||||||
|
|
||||||
class View3DModelManager : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
enum class ScenarioType {
|
|
||||||
PlantPhenotype,
|
|
||||||
OneMotor
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit View3DModelManager(QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
void switchScenario(ScenarioType type);
|
|
||||||
|
|
||||||
View3DPlantPhenotype* m_viewPlant = nullptr;
|
|
||||||
View3DLinearStage* m_viewMotor = nullptr;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void scenarioChanged(ScenarioType type);
|
|
||||||
void created3DModelPlantPhenotype();
|
|
||||||
void created3DModelOneMotor();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void ensurePlantPhenotypeView();
|
|
||||||
void ensureOneMotorView();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QStackedWidget* m_stackedWidget = nullptr;
|
|
||||||
};
|
|
||||||
319
HPPA/about.ui
319
HPPA/about.ui
@ -9,8 +9,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>486</width>
|
<width>629</width>
|
||||||
<height>401</height>
|
<height>463</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -18,292 +18,93 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>C:/Users/73505/.designer/backup/HPPA.ico</normaloff>C:/Users/73505/.designer/backup/HPPA.ico</iconset>
|
<normaloff>HPPA.ico</normaloff>HPPA.ico</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QWidget" name="contentWidget" native="true">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QWidget #contentWidget
|
|
||||||
{
|
|
||||||
background: #040125;
|
|
||||||
/*border-radius: 8px 8px 8px 8px;*/
|
|
||||||
border: 1px solid #2f6bff;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QWidget" name="titlebarWidget" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>43</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>43</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QWidget #titlebarWidget
|
|
||||||
{
|
|
||||||
background: #0E1C4C;
|
|
||||||
border: 1px solid #2f6bff;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="iconLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap>icon/all/png/Group 356_slices/22.png</pixmap>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QLabel
|
|
||||||
{
|
|
||||||
color:#E2EDFF;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>关于</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>505</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QPushButton" name="closeBtn">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;*/
|
|
||||||
font: 10pt "新宋体";
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>icon/all/close.svg</normaloff>icon/all/close.svg</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>70</x>
|
<x>90</x>
|
||||||
<y>20</y>
|
<y>250</y>
|
||||||
<width>171</width>
|
<width>434</width>
|
||||||
<height>171</height>
|
<height>134</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<string/>
|
<item>
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap>icon/all/png/Group 356_slices/Group 356@2x.png</pixmap>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>70</x>
|
|
||||||
<y>210</y>
|
|
||||||
<width>306</width>
|
|
||||||
<height>111</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QLabel
|
|
||||||
{
|
|
||||||
color: #E2EDFF;
|
|
||||||
font: 10pt "Adobe Devanagari";
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>地址:北京市海淀区清河安宁庄东路18号5号楼二层205</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>电话:010-51292601</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>邮箱:hanshanlong@iris-rs.cn</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="companylname_label">
|
<widget class="QLabel" name="companylname_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>公司:北京依锐思遥感技术有限公司</string>
|
<string>公司:北京依锐思遥感技术有限公司</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>地址:北京市海淀区清河安宁庄东路18号5号楼二层205</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>电话:010-51292601</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>邮箱:hanshanlong@iris-rs.cn</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="widget_3" native="true">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>260</x>
|
<x>270</x>
|
||||||
<y>50</y>
|
<y>150</y>
|
||||||
<width>171</width>
|
<width>141</width>
|
||||||
<height>101</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="text">
|
||||||
<string notr="true"/>
|
<string>版本:T2.1</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
</widget>
|
||||||
<property name="verticalSpacing">
|
<widget class="QLabel" name="label_4">
|
||||||
<number>30</number>
|
<property name="geometry">
|
||||||
</property>
|
<rect>
|
||||||
<item row="0" column="0">
|
<x>270</x>
|
||||||
<widget class="QLabel" name="nameLabel">
|
<y>70</y>
|
||||||
<property name="styleSheet">
|
<width>391</width>
|
||||||
<string notr="true">QLabel
|
<height>31</height>
|
||||||
{
|
</rect>
|
||||||
color:#E2EDFF;
|
|
||||||
font: italic 18pt "Adobe Devanagari";
|
|
||||||
}</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Spectral Insight</string>
|
<string>Hyper Plant Phenotypic Analysis</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::PlainText</enum>
|
<enum>Qt::PlainText</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
<widget class="QLabel" name="label_7">
|
||||||
<item row="1" column="0">
|
<property name="geometry">
|
||||||
<widget class="QLabel" name="versionLabel">
|
<rect>
|
||||||
<property name="styleSheet">
|
<x>90</x>
|
||||||
<string notr="true">QLabel
|
<y>50</y>
|
||||||
{
|
<width>141</width>
|
||||||
color:#E2EDFF;
|
<height>141</height>
|
||||||
font: 10pt "Adobe Devanagari";
|
</rect>
|
||||||
}</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>版本:3.0</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap>HPPA.ico</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "aboutWindow.h"
|
#include "aboutWindow.h"
|
||||||
#include <QSvgRenderer>
|
|
||||||
#include <QPainter>
|
|
||||||
|
|
||||||
aboutWindow::aboutWindow(QWidget* parent)
|
aboutWindow::aboutWindow(QWidget* parent)
|
||||||
{
|
{
|
||||||
@ -10,22 +9,14 @@ aboutWindow::aboutWindow(QWidget* parent)
|
|||||||
QString text = ui.companylname_label->text();
|
QString text = ui.companylname_label->text();
|
||||||
ui.companylname_label->setText("<a style='color: green; text-decoration: none' href = http://www.iris-rs.cn/pr.jsp?_jcp=3_10>" + text);
|
ui.companylname_label->setText("<a style='color: green; text-decoration: none' href = http://www.iris-rs.cn/pr.jsp?_jcp=3_10>" + text);
|
||||||
|
|
||||||
//Qt::WindowFlags flags = 0;
|
Qt::WindowFlags flags = 0;
|
||||||
////flags |= Qt::WindowMinimizeButtonHint;
|
//flags |= Qt::WindowMinimizeButtonHint;
|
||||||
//flags |= Qt::WindowCloseButtonHint;
|
flags |= Qt::WindowCloseButtonHint;
|
||||||
//flags |= Qt::MSWindowsFixedSizeDialogHint;
|
flags |= Qt::MSWindowsFixedSizeDialogHint;
|
||||||
//setWindowFlags(flags);
|
setWindowFlags(flags);
|
||||||
setWindowFlags(Qt::FramelessWindowHint);
|
|
||||||
|
|
||||||
connect(this->ui.closeBtn, SIGNAL(released()), this, SLOT(onExit()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aboutWindow::~aboutWindow()
|
aboutWindow::~aboutWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void aboutWindow::onExit()
|
|
||||||
{
|
|
||||||
this->close();
|
|
||||||
}
|
|
||||||
@ -2,7 +2,6 @@
|
|||||||
#include <QtWidgets/qdialog.h>
|
#include <QtWidgets/qdialog.h>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
|
|
||||||
|
|
||||||
#include "ui_about.h"
|
#include "ui_about.h"
|
||||||
|
|
||||||
class aboutWindow :public QDialog
|
class aboutWindow :public QDialog
|
||||||
@ -20,7 +19,6 @@ private:
|
|||||||
Ui::aboutDialog ui;
|
Ui::aboutDialog ui;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onExit();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|||||||
@ -6,127 +6,24 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>501</width>
|
<width>687</width>
|
||||||
<height>363</height>
|
<height>389</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>adjustTable</string>
|
<string>adjustTable</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<string notr="true">QGroupBox
|
<item row="0" column="0">
|
||||||
{
|
|
||||||
border: 12px solid transparent;
|
|
||||||
/*border-top: 12px solid transparent;
|
|
||||||
border-right: 0px solid transparent;
|
|
||||||
border-bottom: 0px solid transparent;
|
|
||||||
border-left: 0px solid transparent;*/
|
|
||||||
color: #ACCDFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;*/
|
|
||||||
font: 19pt "新宋体";
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_4" rowstretch="1,2,2,2,1" columnstretch="1,10,1">
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>66</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>63</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QGroupBox" name="groupBox_8">
|
<widget class="QGroupBox" name="groupBox_8">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>252号升降台</string>
|
<string>252号升降台</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>18</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="objective_table252_up_btn">
|
<widget class="QPushButton" name="objective_table252_up_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -136,10 +33,10 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="objective_table252_down_btn">
|
<widget class="QPushButton" name="objective_table252_down_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -149,10 +46,10 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="2" column="0">
|
||||||
<widget class="QPushButton" name="objective_table252_stop_btn">
|
<widget class="QPushButton" name="objective_table252_stop_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -165,63 +62,16 @@ QPushButton:pressed
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="0" column="1">
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>63</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>63</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QGroupBox" name="groupBox_7">
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>253号升降台</string>
|
<string>253号升降台</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_11">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>18</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="objective_table1_up_btn">
|
<widget class="QPushButton" name="objective_table1_up_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -231,10 +81,10 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="objective_table1_down_btn">
|
<widget class="QPushButton" name="objective_table1_down_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -244,10 +94,10 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="2" column="0">
|
||||||
<widget class="QPushButton" name="objective_table1_stop_btn">
|
<widget class="QPushButton" name="objective_table1_stop_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -260,63 +110,16 @@ QPushButton:pressed
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="0" column="2">
|
||||||
<spacer name="horizontalSpacer_6">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>63</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>63</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QGroupBox" name="groupBox_6">
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>254号升降台</string>
|
<string>254号升降台</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>18</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="objective_table2_up_btn">
|
<widget class="QPushButton" name="objective_table2_up_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -326,10 +129,10 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="objective_table2_down_btn">
|
<widget class="QPushButton" name="objective_table2_down_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -339,10 +142,10 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="2" column="0">
|
||||||
<widget class="QPushButton" name="objective_table2_stop_btn">
|
<widget class="QPushButton" name="objective_table2_stop_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -355,32 +158,6 @@ QPushButton:pressed
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
|
||||||
<spacer name="horizontalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>63</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>65</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|||||||
@ -1,22 +1,10 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "focusWindow.h"
|
#include "focusWindow.h"
|
||||||
#include <QSvgRenderer>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
|
|
||||||
focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
|
focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
setWindowFlags(Qt::FramelessWindowHint);
|
|
||||||
ui.titlebarWidget->installEventFilter(this);
|
|
||||||
|
|
||||||
QSvgRenderer svgRenderer(QString(".//icon//all//focus.svg"));
|
|
||||||
QPixmap pixmap(24, 24);
|
|
||||||
pixmap.fill(Qt::transparent); // 背景透明
|
|
||||||
QPainter painter(&pixmap);
|
|
||||||
svgRenderer.render(&painter);
|
|
||||||
ui.iconLabel->setPixmap(pixmap);
|
|
||||||
|
|
||||||
//读取配置文件
|
//读取配置文件
|
||||||
string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
|
string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
|
||||||
Configfile configfile;
|
Configfile configfile;
|
||||||
@ -51,7 +39,6 @@ focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
|
|||||||
connect(this->ui.moveto_btn, SIGNAL(clicked()), this, SLOT(onMoveto()));
|
connect(this->ui.moveto_btn, SIGNAL(clicked()), this, SLOT(onMoveto()));
|
||||||
|
|
||||||
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement()));
|
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement()));
|
||||||
connect(this->ui.closeBtn, SIGNAL(released()), this, SLOT(onExit()));
|
|
||||||
|
|
||||||
//查找可用串口,并显示
|
//查找可用串口,并显示
|
||||||
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
|
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
|
||||||
@ -80,7 +67,6 @@ focusWindow::~focusWindow()
|
|||||||
printf("destroy focusWindow-------------------------\n");
|
printf("destroy focusWindow-------------------------\n");
|
||||||
|
|
||||||
emit StartManualFocusSignal(0);//当用户没有点击停止调焦就关闭窗口
|
emit StartManualFocusSignal(0);//当用户没有点击停止调焦就关闭窗口
|
||||||
emit closeSignal();
|
|
||||||
|
|
||||||
delete m_ctrlFocusMotor;
|
delete m_ctrlFocusMotor;
|
||||||
//delete thread1, progressThread;
|
//delete thread1, progressThread;
|
||||||
@ -92,50 +78,9 @@ focusWindow::~focusWindow()
|
|||||||
m_MotionCaptureCoordinatorThread.wait();
|
m_MotionCaptureCoordinatorThread.wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void focusWindow::onExit()
|
|
||||||
{
|
|
||||||
this->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool focusWindow::eventFilter(QObject *obj, QEvent *event)
|
|
||||||
{
|
|
||||||
if (obj == ui.titlebarWidget)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::MouseButtonPress)
|
|
||||||
{
|
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
|
||||||
if (mouseEvent->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
m_bDrag = true;
|
|
||||||
m_dragPosition = mouseEvent->globalPos() - frameGeometry().topLeft();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event->type() == QEvent::MouseMove)
|
|
||||||
{
|
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
|
||||||
if (m_bDrag && (mouseEvent->buttons() & Qt::LeftButton))
|
|
||||||
{
|
|
||||||
move(mouseEvent->globalPos() - m_dragPosition);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event->type() == QEvent::MouseButtonRelease)
|
|
||||||
{
|
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
|
||||||
if (mouseEvent->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
m_bDrag = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QDialog::eventFilter(obj, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void focusWindow::disableBeforeConnect(bool disable)
|
void focusWindow::disableBeforeConnect(bool disable)
|
||||||
{
|
{
|
||||||
ui.controlMotor_widget->setDisabled(disable);
|
ui.controlMotor_groupBox->setDisabled(disable);
|
||||||
ui.autoFocus_btn->setDisabled(disable);
|
ui.autoFocus_btn->setDisabled(disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,13 +105,8 @@ public:
|
|||||||
|
|
||||||
ImagerOperationBase* m_Imager;
|
ImagerOperationBase* m_Imager;
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPoint m_dragPosition;
|
|
||||||
bool m_bDrag = false;
|
|
||||||
|
|
||||||
Ui::focusDialog ui;
|
Ui::focusDialog ui;
|
||||||
QThread *m_AutoFocusThread;
|
QThread *m_AutoFocusThread;
|
||||||
int m_FocusState;
|
int m_FocusState;
|
||||||
@ -156,8 +151,6 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
void moveAfterAutoFocus(int motorID, double location);
|
void moveAfterAutoFocus(int motorID, double location);
|
||||||
|
|
||||||
void onExit();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StartManualFocusSignal(int);//1<><31><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
void StartManualFocusSignal(int);//1<><31><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
@ -168,7 +161,6 @@ signals:
|
|||||||
void zeroStartSignal(int);
|
void zeroStartSignal(int);
|
||||||
|
|
||||||
void startStepMotion(double speed, int stepInterval = 100, double startPos = 0, double endPos = -1);
|
void startStepMotion(double speed, int stepInterval = 100, double startPos = 0, double endPos = -1);
|
||||||
void closeSignal();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WorkerThread2 : public QThread
|
class WorkerThread2 : public QThread
|
||||||
|
|||||||
@ -1,351 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>HyperImagerControl</class>
|
|
||||||
<widget class="QWidget" name="HyperImagerControl">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>462</width>
|
|
||||||
<height>385</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Color Adjust</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QGroupBox
|
|
||||||
{
|
|
||||||
border: 12px solid transparent;
|
|
||||||
/*border-top: 12px solid transparent;
|
|
||||||
border-right: 0px solid transparent;
|
|
||||||
border-bottom: 0px solid transparent;
|
|
||||||
border-left: 0px solid transparent;*/
|
|
||||||
color: #ACCDFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;*/
|
|
||||||
font: 10pt "新宋体";
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLabel {
|
|
||||||
color: rgb(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
QSlider::groove:horizontal {
|
|
||||||
height: 10px;
|
|
||||||
background: #1e2a44;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 已滑过:渐变蓝 */
|
|
||||||
QSlider::sub-page:horizontal {
|
|
||||||
background: qlineargradient(
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1f4fff,
|
|
||||||
stop:0.5 #2f6bff,
|
|
||||||
stop:1 #5fa0ff
|
|
||||||
);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 未滑过 */
|
|
||||||
QSlider::add-page:horizontal {
|
|
||||||
height: 10px;
|
|
||||||
background: #2a3550;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===== 滑块按钮 ===== */
|
|
||||||
QSlider::handle:horizontal {
|
|
||||||
width: 15px;
|
|
||||||
height: 10px;
|
|
||||||
|
|
||||||
/* 蓝色实心 */
|
|
||||||
background: #2f6bff;
|
|
||||||
|
|
||||||
/* 白色外圈 */
|
|
||||||
border: 2px solid #ffffff;
|
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
/* 垂直居中 */
|
|
||||||
margin: -5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 悬停 */
|
|
||||||
QSlider::handle:horizontal:hover {
|
|
||||||
background: #4d8dff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 按下 */
|
|
||||||
QSlider::handle:horizontal:pressed {
|
|
||||||
background: #1f4fff;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="AspectRatioLabel" name="imagerPictureLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QWidget" name="widget_3" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">color: rgb(255, 255, 255);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>帧率</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QDoubleSpinBox" name="framerate_spinBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="decimals">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDoubleSlider" name="FramerateSlider">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">color: rgb(255, 255, 255);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>积分时间</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QDoubleSpinBox" name="integratioin_time_spinBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="decimals">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDoubleSlider" name="IntegratioinTimeSlider">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">color: rgb(255, 255, 255);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>gain</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QDoubleSpinBox" name="gain_spinBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="decimals">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSlider" name="GainSlider">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>AspectRatioLabel</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>AspectRatioLabel.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>QDoubleSlider</class>
|
|
||||||
<extends>QSlider</extends>
|
|
||||||
<header location="global">qdoubleslider.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@ -1,347 +0,0 @@
|
|||||||
#include "imageControl.h"
|
|
||||||
#include "RasterLayer.h"
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
ImageControl::ImageControl(QWidget* parent)
|
|
||||||
: QDialog(parent)
|
|
||||||
{
|
|
||||||
ui.setupUi(this);
|
|
||||||
|
|
||||||
// Spinbox valueChanged: only sync the paired slider (no render)
|
|
||||||
connect(ui.spinRed, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ImageControl::onSpinRedValueChanged);
|
|
||||||
connect(ui.spinGreen, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ImageControl::onSpinGreenValueChanged);
|
|
||||||
connect(ui.spinBlue, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ImageControl::onSpinBlueValueChanged);
|
|
||||||
|
|
||||||
// Spinbox editingFinished: commit on Enter key / focus lost (trigger render)
|
|
||||||
connect(ui.spinRed, &QDoubleSpinBox::editingFinished, this, &ImageControl::onSpinRedEditingFinished);
|
|
||||||
connect(ui.spinGreen, &QDoubleSpinBox::editingFinished, this, &ImageControl::onSpinGreenEditingFinished);
|
|
||||||
connect(ui.spinBlue, &QDoubleSpinBox::editingFinished, this, &ImageControl::onSpinBlueEditingFinished);
|
|
||||||
|
|
||||||
// Slider valueChanged: only sync the paired spinbox (no render)
|
|
||||||
// Slider now represents band index (0 .. N-1)
|
|
||||||
connect(ui.sliderRed, &QSlider::valueChanged, this, &ImageControl::onSliderRedValueChanged);
|
|
||||||
connect(ui.sliderGreen, &QSlider::valueChanged, this, &ImageControl::onSliderGreenValueChanged);
|
|
||||||
connect(ui.sliderBlue, &QSlider::valueChanged, this, &ImageControl::onSliderBlueValueChanged);
|
|
||||||
|
|
||||||
// Slider sliderReleased: commit on mouse release (trigger render)
|
|
||||||
connect(ui.sliderRed, &QSlider::sliderReleased, this, &ImageControl::onSliderRedReleased);
|
|
||||||
connect(ui.sliderGreen, &QSlider::sliderReleased, this, &ImageControl::onSliderGreenReleased);
|
|
||||||
connect(ui.sliderBlue, &QSlider::sliderReleased, this, &ImageControl::onSliderBlueReleased);
|
|
||||||
|
|
||||||
// Connect preset buttons
|
|
||||||
connect(ui.btnTrueColor, &QPushButton::clicked, this, &ImageControl::onTrueColorClicked);
|
|
||||||
connect(ui.btnColorInfrared, &QPushButton::clicked, this, &ImageControl::onColorInfraredClicked);
|
|
||||||
|
|
||||||
// Spinbox only commits on Enter, not on every keystroke
|
|
||||||
ui.spinRed->setKeyboardTracking(false);
|
|
||||||
ui.spinGreen->setKeyboardTracking(false);
|
|
||||||
ui.spinBlue->setKeyboardTracking(false);
|
|
||||||
|
|
||||||
ui.groupAdjustments->setStyleSheet(R"(
|
|
||||||
QDoubleSpinBox {
|
|
||||||
border: 1px solid #999;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 2px 20px 2px 6px; /* <20>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>ť */
|
|
||||||
background: #0e1c4c;
|
|
||||||
selection-background-color: #0078d7;
|
|
||||||
font-size: 12px;
|
|
||||||
color:#ACCDFF ;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDoubleSpinBox::up-button {
|
|
||||||
subcontrol-origin: border;
|
|
||||||
subcontrol-position: top right;
|
|
||||||
width: 16px;
|
|
||||||
border-left: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDoubleSpinBox::down-button {
|
|
||||||
subcontrol-origin: border;
|
|
||||||
subcontrol-position: bottom right;
|
|
||||||
width: 16px;
|
|
||||||
border-left: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDoubleSpinBox::up-arrow {
|
|
||||||
image: url(D:/cpp_project_vs2022/HPPA/HPPA/icon/all/arrow_up.svg);
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDoubleSpinBox::down-arrow {
|
|
||||||
image: url(D:/cpp_project_vs2022/HPPA/HPPA/icon/all/arrow_down.svg);
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDoubleSpinBox::up-button:hover,
|
|
||||||
QDoubleSpinBox::down-button:hover {
|
|
||||||
background: #e6f2ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDoubleSpinBox::up-button:pressed,
|
|
||||||
QDoubleSpinBox::down-button:pressed {
|
|
||||||
background: #cce4ff;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageControl::~ImageControl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::setActiveLayer(RasterLayer* layer)
|
|
||||||
{
|
|
||||||
m_activeLayer = layer;
|
|
||||||
|
|
||||||
if (!layer) {
|
|
||||||
setEnabled(false);
|
|
||||||
m_wavelengths.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setEnabled(true);
|
|
||||||
|
|
||||||
// Get band wavelengths from the layer's header
|
|
||||||
m_wavelengths = layer->bandWavelengths();
|
|
||||||
std::sort(m_wavelengths.begin(), m_wavelengths.end());
|
|
||||||
|
|
||||||
if (m_wavelengths.empty()) {
|
|
||||||
setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_minWave = m_wavelengths.front();
|
|
||||||
m_maxWave = m_wavelengths.back();
|
|
||||||
|
|
||||||
// Compute spinbox step as the average wavelength interval between adjacent bands
|
|
||||||
double step = 1.0;
|
|
||||||
if (m_wavelengths.size() >= 2) {
|
|
||||||
step = (m_maxWave - m_minWave) / (m_wavelengths.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
blockAllSignals(true);
|
|
||||||
|
|
||||||
// Configure spinbox ranges and step
|
|
||||||
ui.spinRed->setMinimum(m_minWave);
|
|
||||||
ui.spinRed->setMaximum(m_maxWave);
|
|
||||||
ui.spinRed->setSingleStep(step);
|
|
||||||
ui.spinGreen->setMinimum(m_minWave);
|
|
||||||
ui.spinGreen->setMaximum(m_maxWave);
|
|
||||||
ui.spinGreen->setSingleStep(step);
|
|
||||||
ui.spinBlue->setMinimum(m_minWave);
|
|
||||||
ui.spinBlue->setMaximum(m_maxWave);
|
|
||||||
ui.spinBlue->setSingleStep(step);
|
|
||||||
|
|
||||||
// Slider now represents band index (0 .. N-1), step = 1
|
|
||||||
int maxIdx = static_cast<int>(m_wavelengths.size()) - 1;
|
|
||||||
ui.sliderRed->setMinimum(0);
|
|
||||||
ui.sliderRed->setMaximum(maxIdx);
|
|
||||||
ui.sliderRed->setSingleStep(1);
|
|
||||||
ui.sliderRed->setPageStep(1);
|
|
||||||
ui.sliderGreen->setMinimum(0);
|
|
||||||
ui.sliderGreen->setMaximum(maxIdx);
|
|
||||||
ui.sliderGreen->setSingleStep(1);
|
|
||||||
ui.sliderGreen->setPageStep(1);
|
|
||||||
ui.sliderBlue->setMinimum(0);
|
|
||||||
ui.sliderBlue->setMaximum(maxIdx);
|
|
||||||
ui.sliderBlue->setSingleStep(1);
|
|
||||||
ui.sliderBlue->setPageStep(1);
|
|
||||||
|
|
||||||
// Set current values from layer's render params
|
|
||||||
auto params = layer->currentRenderParams();
|
|
||||||
|
|
||||||
int rIdx = nearestBandIndex(params.rWave);
|
|
||||||
int gIdx = nearestBandIndex(params.gWave);
|
|
||||||
int bIdx = nearestBandIndex(params.bWave);
|
|
||||||
|
|
||||||
ui.spinRed->setValue(m_wavelengths[rIdx]);
|
|
||||||
ui.spinGreen->setValue(m_wavelengths[gIdx]);
|
|
||||||
ui.spinBlue->setValue(m_wavelengths[bIdx]);
|
|
||||||
|
|
||||||
ui.sliderRed->setValue(rIdx);
|
|
||||||
ui.sliderGreen->setValue(gIdx);
|
|
||||||
ui.sliderBlue->setValue(bIdx);
|
|
||||||
|
|
||||||
blockAllSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterLayer* ImageControl::activeLayer() const
|
|
||||||
{
|
|
||||||
return m_activeLayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ImageControl::nearestBandIndex(double wave) const
|
|
||||||
{
|
|
||||||
if (m_wavelengths.empty()) return 0;
|
|
||||||
int best = 0;
|
|
||||||
double bestDiff = std::abs(m_wavelengths[0] - wave);
|
|
||||||
for (int i = 1; i < static_cast<int>(m_wavelengths.size()); ++i) {
|
|
||||||
double d = std::abs(m_wavelengths[i] - wave);
|
|
||||||
if (d < bestDiff) {
|
|
||||||
bestDiff = d;
|
|
||||||
best = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return best;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::setControlsToBandIndex(QDoubleSpinBox* spin, QSlider* slider, int idx)
|
|
||||||
{
|
|
||||||
if (idx < 0 || idx >= static_cast<int>(m_wavelengths.size())) return;
|
|
||||||
double wv = m_wavelengths[idx];
|
|
||||||
spin->blockSignals(true);
|
|
||||||
spin->setValue(wv);
|
|
||||||
spin->blockSignals(false);
|
|
||||||
slider->blockSignals(true);
|
|
||||||
slider->setValue(idx);
|
|
||||||
slider->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Spinbox valueChanged: snap to nearest band, sync slider, no render ---
|
|
||||||
|
|
||||||
void ImageControl::onSpinRedValueChanged(double val)
|
|
||||||
{
|
|
||||||
int idx = nearestBandIndex(val);
|
|
||||||
ui.sliderRed->blockSignals(true);
|
|
||||||
ui.sliderRed->setValue(idx);
|
|
||||||
ui.sliderRed->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSpinGreenValueChanged(double val)
|
|
||||||
{
|
|
||||||
int idx = nearestBandIndex(val);
|
|
||||||
ui.sliderGreen->blockSignals(true);
|
|
||||||
ui.sliderGreen->setValue(idx);
|
|
||||||
ui.sliderGreen->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSpinBlueValueChanged(double val)
|
|
||||||
{
|
|
||||||
int idx = nearestBandIndex(val);
|
|
||||||
ui.sliderBlue->blockSignals(true);
|
|
||||||
ui.sliderBlue->setValue(idx);
|
|
||||||
ui.sliderBlue->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Slider valueChanged: map band index to wavelength, sync spinbox, no render ---
|
|
||||||
|
|
||||||
void ImageControl::onSliderRedValueChanged(int val)
|
|
||||||
{
|
|
||||||
if (val < 0 || val >= static_cast<int>(m_wavelengths.size())) return;
|
|
||||||
ui.spinRed->blockSignals(true);
|
|
||||||
ui.spinRed->setValue(m_wavelengths[val]);
|
|
||||||
ui.spinRed->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSliderGreenValueChanged(int val)
|
|
||||||
{
|
|
||||||
if (val < 0 || val >= static_cast<int>(m_wavelengths.size())) return;
|
|
||||||
ui.spinGreen->blockSignals(true);
|
|
||||||
ui.spinGreen->setValue(m_wavelengths[val]);
|
|
||||||
ui.spinGreen->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSliderBlueValueChanged(int val)
|
|
||||||
{
|
|
||||||
if (val < 0 || val >= static_cast<int>(m_wavelengths.size())) return;
|
|
||||||
ui.spinBlue->blockSignals(true);
|
|
||||||
ui.spinBlue->setValue(m_wavelengths[val]);
|
|
||||||
ui.spinBlue->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Spinbox editingFinished: snap to nearest band wavelength, then commit ---
|
|
||||||
|
|
||||||
void ImageControl::onSpinRedEditingFinished()
|
|
||||||
{
|
|
||||||
int idx = nearestBandIndex(ui.spinRed->value());
|
|
||||||
setControlsToBandIndex(ui.spinRed, ui.sliderRed, idx);
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSpinGreenEditingFinished()
|
|
||||||
{
|
|
||||||
int idx = nearestBandIndex(ui.spinGreen->value());
|
|
||||||
setControlsToBandIndex(ui.spinGreen, ui.sliderGreen, idx);
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSpinBlueEditingFinished()
|
|
||||||
{
|
|
||||||
int idx = nearestBandIndex(ui.spinBlue->value());
|
|
||||||
setControlsToBandIndex(ui.spinBlue, ui.sliderBlue, idx);
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Slider sliderReleased: commit on mouse release ---
|
|
||||||
|
|
||||||
void ImageControl::onSliderRedReleased()
|
|
||||||
{
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSliderGreenReleased()
|
|
||||||
{
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onSliderBlueReleased()
|
|
||||||
{
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Preset buttons ---
|
|
||||||
|
|
||||||
void ImageControl::onTrueColorClicked()
|
|
||||||
{
|
|
||||||
blockAllSignals(true);
|
|
||||||
int rIdx = nearestBandIndex(665.0);
|
|
||||||
int gIdx = nearestBandIndex(560.0);
|
|
||||||
int bIdx = nearestBandIndex(490.0);
|
|
||||||
setControlsToBandIndex(ui.spinRed, ui.sliderRed, rIdx);
|
|
||||||
setControlsToBandIndex(ui.spinGreen, ui.sliderGreen, gIdx);
|
|
||||||
setControlsToBandIndex(ui.spinBlue, ui.sliderBlue, bIdx);
|
|
||||||
blockAllSignals(false);
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::onColorInfraredClicked()
|
|
||||||
{
|
|
||||||
blockAllSignals(true);
|
|
||||||
int rIdx = nearestBandIndex(800.0);
|
|
||||||
int gIdx = nearestBandIndex(665.0);
|
|
||||||
int bIdx = nearestBandIndex(560.0);
|
|
||||||
setControlsToBandIndex(ui.spinRed, ui.sliderRed, rIdx);
|
|
||||||
setControlsToBandIndex(ui.spinGreen, ui.sliderGreen, gIdx);
|
|
||||||
setControlsToBandIndex(ui.spinBlue, ui.sliderBlue, bIdx);
|
|
||||||
blockAllSignals(false);
|
|
||||||
emitBandChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::emitBandChange()
|
|
||||||
{
|
|
||||||
double r = ui.spinRed->value();
|
|
||||||
double g = ui.spinGreen->value();
|
|
||||||
double b = ui.spinBlue->value();
|
|
||||||
|
|
||||||
// Update active layer's stored render params
|
|
||||||
if (m_activeLayer) {
|
|
||||||
auto params = m_activeLayer->currentRenderParams();
|
|
||||||
params.rWave = r;
|
|
||||||
params.gWave = g;
|
|
||||||
params.bWave = b;
|
|
||||||
m_activeLayer->setCurrentRenderParams(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit bandSelectionChanged(r, g, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageControl::blockAllSignals(bool block)
|
|
||||||
{
|
|
||||||
ui.spinRed->blockSignals(block);
|
|
||||||
ui.spinGreen->blockSignals(block);
|
|
||||||
ui.spinBlue->blockSignals(block);
|
|
||||||
ui.sliderRed->blockSignals(block);
|
|
||||||
ui.sliderGreen->blockSignals(block);
|
|
||||||
ui.sliderBlue->blockSignals(block);
|
|
||||||
}
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "ui_imgControl.h"
|
|
||||||
|
|
||||||
class RasterLayer;
|
|
||||||
|
|
||||||
class ImageControl : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ImageControl(QWidget* parent = nullptr);
|
|
||||||
~ImageControl();
|
|
||||||
|
|
||||||
// Populate controls from a RasterLayer's wavelength info and current render params
|
|
||||||
void setActiveLayer(RasterLayer* layer);
|
|
||||||
RasterLayer* activeLayer() const;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
// Emitted when user changes any of the R/G/B wavelength values
|
|
||||||
void bandSelectionChanged(double rWave, double gWave, double bWave);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
// Sync slider position while dragging spinbox (no render)
|
|
||||||
void onSpinRedValueChanged(double val);
|
|
||||||
void onSpinGreenValueChanged(double val);
|
|
||||||
void onSpinBlueValueChanged(double val);
|
|
||||||
|
|
||||||
// Sync spinbox display while dragging slider (no render)
|
|
||||||
void onSliderRedValueChanged(int val);
|
|
||||||
void onSliderGreenValueChanged(int val);
|
|
||||||
void onSliderBlueValueChanged(int val);
|
|
||||||
|
|
||||||
// Commit: spinbox Enter key pressed / focus lost
|
|
||||||
void onSpinRedEditingFinished();
|
|
||||||
void onSpinGreenEditingFinished();
|
|
||||||
void onSpinBlueEditingFinished();
|
|
||||||
|
|
||||||
// Commit: slider mouse released
|
|
||||||
void onSliderRedReleased();
|
|
||||||
void onSliderGreenReleased();
|
|
||||||
void onSliderBlueReleased();
|
|
||||||
|
|
||||||
void onTrueColorClicked();
|
|
||||||
void onColorInfraredClicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void emitBandChange();
|
|
||||||
void blockAllSignals(bool block);
|
|
||||||
|
|
||||||
// Find the band index whose wavelength is closest to the given value
|
|
||||||
int nearestBandIndex(double wave) const;
|
|
||||||
// Set spinbox and slider to wavelength of the given band index
|
|
||||||
void setControlsToBandIndex(QDoubleSpinBox* spin, QSlider* slider, int idx);
|
|
||||||
|
|
||||||
Ui::ImageControl ui;
|
|
||||||
RasterLayer* m_activeLayer = nullptr;
|
|
||||||
double m_minWave = 374.5;
|
|
||||||
double m_maxWave = 948.1;
|
|
||||||
std::vector<double> m_wavelengths; // band wavelengths from header
|
|
||||||
};
|
|
||||||
@ -1,291 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ImageControl</class>
|
|
||||||
<widget class="QWidget" name="ImageControl">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>520</width>
|
|
||||||
<height>360</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Color Adjust</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QGroupBox
|
|
||||||
{
|
|
||||||
border: 12px solid transparent;
|
|
||||||
/*border-top: 12px solid transparent;
|
|
||||||
border-right: 0px solid transparent;
|
|
||||||
border-bottom: 0px solid transparent;
|
|
||||||
border-left: 0px solid transparent;*/
|
|
||||||
color: #ACCDFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;*/
|
|
||||||
font: 10pt "新宋体";
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLabel {
|
|
||||||
color: rgb(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
QSlider::groove:horizontal {
|
|
||||||
height: 10px;
|
|
||||||
background: #1e2a44;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 已滑过:渐变蓝 */
|
|
||||||
QSlider::sub-page:horizontal {
|
|
||||||
background: qlineargradient(
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1f4fff,
|
|
||||||
stop:0.5 #2f6bff,
|
|
||||||
stop:1 #5fa0ff
|
|
||||||
);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 未滑过 */
|
|
||||||
QSlider::add-page:horizontal {
|
|
||||||
height: 10px;
|
|
||||||
background: #2a3550;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===== 滑块按钮 ===== */
|
|
||||||
QSlider::handle:horizontal {
|
|
||||||
width: 15px;
|
|
||||||
height: 10px;
|
|
||||||
|
|
||||||
/* 蓝色实心 */
|
|
||||||
background: #2f6bff;
|
|
||||||
|
|
||||||
/* 白色外圈 */
|
|
||||||
border: 2px solid #ffffff;
|
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
/* 垂直居中 */
|
|
||||||
margin: -5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 悬停 */
|
|
||||||
QSlider::handle:horizontal:hover {
|
|
||||||
background: #4d8dff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 按下 */
|
|
||||||
QSlider::handle:horizontal:pressed {
|
|
||||||
background: #1f4fff;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupAdjustments">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QLabel
|
|
||||||
{
|
|
||||||
color: #ACCDFF;
|
|
||||||
font-size: 14px;
|
|
||||||
font: 9pt "Adobe Devanagari";
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>调整</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="labelRed">
|
|
||||||
<property name="text">
|
|
||||||
<string>红</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QDoubleSpinBox" name="spinRed">
|
|
||||||
<property name="minimum">
|
|
||||||
<double>374.500000000000000</double>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>948.100000000000023</double>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<double>643.100000000000023</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QSlider" name="sliderRed">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QLabel" name="labelRedNm">
|
|
||||||
<property name="text">
|
|
||||||
<string>nm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="labelGreen">
|
|
||||||
<property name="text">
|
|
||||||
<string>绿</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QDoubleSpinBox" name="spinGreen">
|
|
||||||
<property name="minimum">
|
|
||||||
<double>374.500000000000000</double>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>948.100000000000023</double>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<double>548.799999999999955</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QSlider" name="sliderGreen">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QLabel" name="labelGreenNm">
|
|
||||||
<property name="text">
|
|
||||||
<string>nm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="labelBlue">
|
|
||||||
<property name="text">
|
|
||||||
<string>蓝</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QDoubleSpinBox" name="spinBlue">
|
|
||||||
<property name="minimum">
|
|
||||||
<double>374.500000000000000</double>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>948.100000000000023</double>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<double>461.600000000000023</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QSlider" name="sliderBlue">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QLabel" name="labelBlueNm">
|
|
||||||
<property name="text">
|
|
||||||
<string>nm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupPresets">
|
|
||||||
<property name="title">
|
|
||||||
<string>预设</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="btnTrueColor">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>43</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>43</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>真彩色</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="btnColorInfrared">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>43</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>假彩色</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@ -6,120 +6,20 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>678</width>
|
<width>544</width>
|
||||||
<height>480</height>
|
<height>346</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>一轴马达控制</string>
|
<string>一轴马达控制</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QPushButton
|
|
||||||
{
|
|
||||||
/*width: 172px;
|
|
||||||
height: 56px;
|
|
||||||
font: 19pt "新宋体";*/
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0.5, y1:0, x2:0.5, y2:1,
|
|
||||||
stop:0 #283D86,
|
|
||||||
stop:1 #0F1A40
|
|
||||||
);
|
|
||||||
color: white;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #3A4875,
|
|
||||||
stop:1 #5F6B91
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/* 按下时的效果 */
|
|
||||||
QPushButton:pressed
|
|
||||||
{
|
|
||||||
background-color: qlineargradient(
|
|
||||||
spread:pad,
|
|
||||||
x1:0, y1:0, x2:1, y2:0,
|
|
||||||
stop:0 #1A254F,
|
|
||||||
stop:1 #3A466B
|
|
||||||
);
|
|
||||||
/* 可选:添加下压效果 */
|
|
||||||
padding-top: 9px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
}
|
|
||||||
QLabel
|
|
||||||
{
|
|
||||||
color: #ACCDFF;
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QLineEdit {
|
|
||||||
background-color: #142D7F;
|
|
||||||
color: #e6eeff;
|
|
||||||
border: 1px solid #2f6bff;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 4px 8px;
|
|
||||||
min-width: 70px;
|
|
||||||
min-height: 20px;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
QLineEdit:hover {
|
|
||||||
border: 1px solid #4d8dff;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLineEdit:focus {
|
|
||||||
border: 1px solid #6aa2ff;
|
|
||||||
background-color: #23345c;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,3,1" columnstretch="1,3,1">
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>87</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>127</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>实时位置</string>
|
<string>实时位置</string>
|
||||||
</property>
|
</property>
|
||||||
@ -128,49 +28,8 @@ QLineEdit:focus {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QLineEdit" name="realTimeLoc_lineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>88</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QPushButton" name="connect_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>连接</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>运行速度</string>
|
<string>运行速度</string>
|
||||||
</property>
|
</property>
|
||||||
@ -179,18 +38,52 @@ QLineEdit:focus {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>返回速度</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="realTimeLoc_lineEdit">
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QLineEdit" name="speed_lineEdit">
|
<widget class="QLineEdit" name="speed_lineEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>88</width>
|
<width>0</width>
|
||||||
<height>30</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -200,7 +93,7 @@ QLineEdit:focus {
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0.1</string>
|
<string>0.1</string>
|
||||||
@ -210,49 +103,29 @@ QLineEdit:focus {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item>
|
||||||
<widget class="QPushButton" name="zero_start_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>归零</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>返回速度</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="return_speed_lineEdit">
|
<widget class="QLineEdit" name="return_speed_lineEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>88</width>
|
<width>0</width>
|
||||||
<height>30</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>2</string>
|
<string>2</string>
|
||||||
</property>
|
</property>
|
||||||
@ -261,10 +134,50 @@ QLineEdit:focus {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item>
|
||||||
|
<widget class="QLineEdit" name="move2loc_lineEdit">
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="connect_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>连接</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="zero_start_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>归零</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QPushButton" name="rangeMeasurement_btn">
|
<widget class="QPushButton" name="rangeMeasurement_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -274,45 +187,36 @@ QLineEdit:focus {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item>
|
||||||
<widget class="QLineEdit" name="move2loc_lineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>88</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="2">
|
|
||||||
<widget class="QPushButton" name="move2loc_pushButton">
|
<widget class="QPushButton" name="move2loc_pushButton">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>移动至</string>
|
<string>移动至</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>161</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
<widget class="QPushButton" name="left_btn">
|
<widget class="QPushButton" name="left_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -322,10 +226,10 @@ QLineEdit:focus {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item>
|
||||||
<widget class="QPushButton" name="right_btn">
|
<widget class="QPushButton" name="right_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -335,64 +239,41 @@ QLineEdit:focus {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="2">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>状态</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="motor_state_label">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>8</width>
|
|
||||||
<height>8</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement">
|
|
||||||
<size>
|
|
||||||
<width>8</width>
|
|
||||||
<height>8</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: red;
|
|
||||||
border-radius: 4px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="2" column="0">
|
||||||
</item>
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item row="1" column="2">
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>127</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<widget class="QLabel" name="motor_state_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>马达状态</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>87</height>
|
<height>191</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -112,24 +112,6 @@ std::string removeFileExtension(std::string filename)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从绝对路径中提取文件名(不包含扩展名)
|
|
||||||
std::string getFileNameFromPath(const std::string &fullPath)
|
|
||||||
{
|
|
||||||
// 找到最后一个路径分隔符,支持 '/' 和 '\\'
|
|
||||||
size_t lastSlash = fullPath.find_last_of("/\\");
|
|
||||||
size_t start = (lastSlash == std::string::npos) ? 0 : lastSlash + 1;
|
|
||||||
|
|
||||||
// 找到最后一个点,确保点在文件名范围内
|
|
||||||
size_t lastDot = fullPath.find_last_of('.');
|
|
||||||
if (lastDot == std::string::npos || lastDot < start) {
|
|
||||||
// 没有扩展名或点在路径之前,直接返回从 start 到结尾的子串
|
|
||||||
return fullPath.substr(start);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回从 start 到 lastDot 之间的文件名(不含扩展名)
|
|
||||||
return fullPath.substr(start, lastDot - start);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QString> getFileInfo(QString file)
|
QList<QString> getFileInfo(QString file)
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo = QFileInfo(file);
|
QFileInfo fileInfo = QFileInfo(file);
|
||||||
|
|||||||
@ -20,7 +20,6 @@ void swap(unsigned short * a, unsigned short * b);
|
|||||||
|
|
||||||
bool createDir(QString fullPath);
|
bool createDir(QString fullPath);
|
||||||
std::string removeFileExtension(std::string filename);
|
std::string removeFileExtension(std::string filename);
|
||||||
std::string getFileNameFromPath(const std::string& fullPath);
|
|
||||||
|
|
||||||
QList<QString> getFileInfo(QString file);
|
QList<QString> getFileInfo(QString file);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user