16 Commits

Author SHA1 Message Date
7e119fbf91 fix
采集bug
2026-03-31 16:55:21 +08:00
e3f882d77b 消除状态栏中间的白色竖线 2026-03-31 13:56:38 +08:00
dac922eb29 打包
使用qrc和rc文件(exe文件图标)管理svg、png等资源
2026-03-25 10:51:00 +08:00
ae07b9c19e fix
1、相机参数有效性控制bug;
2、相机看板图像大小调整;
3、工程的realease模式修复;
2026-03-24 14:54:48 +08:00
2cf86df608 通过自定义控件实现功能:状态栏显示采集帧数; 2026-03-24 14:03:12 +08:00
d358989579 fix:
相机参数有效性控制3
2026-03-20 15:33:25 +08:00
0fb81ab3e8 相机参数有效性控制2 2026-03-20 11:52:32 +08:00
8bbe402a63 图像等比例缩放 2026-03-19 16:52:48 +08:00
b23aedc6c7 美化ui 2026-03-18 15:56:06 +08:00
06dffddfd0 美化窗口:关于+图像控制 2026-03-18 00:03:56 +08:00
ca10848750 调焦窗口美化 2026-03-17 19:11:33 +08:00
4af1187b7d 美化:
工具栏+图像控制看板
2026-03-17 17:22:44 +08:00
30fa211a22 tab切换,改变LayerTreeModel的setCurrentIndex 2026-03-16 17:13:17 +08:00
7473a45f41 修复点击显示光谱功能的问题:打开一副影像后,点击显示光谱出现十字架,然后移除图层后,再打开图层就会出现问题 2026-03-16 15:05:13 +08:00
6d8c2f0419 优化LayerTree的数据结构 2026-03-16 11:06:09 +08:00
1c7780eb14 完成maptool的功能:
1、工具在工具栏中的状态管理;
2、工具在mapcavas中的图标管理;
3、工具在多tab切换时的管理;
4、MapToolSpectral添加十字叉,显示点击位置;
2026-03-13 14:52:47 +08:00
51 changed files with 2873 additions and 1144 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ HPPA类图.drawio
HPPA - 副本.ui
icon
ignore_*
resources
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

28
HPPA/AspectRatioLabel.cpp Normal file
View File

@ -0,0 +1,28 @@
#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));
}

22
HPPA/AspectRatioLabel.h Normal file
View File

@ -0,0 +1,22 @@
#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;
};

View File

@ -126,10 +126,27 @@ void MyCarousel::contextMenuEvent(QContextMenuEvent* event)
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);
@ -142,6 +159,15 @@ void MyCarousel::showContextMenu(const QPoint& pos)
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()

View File

@ -6,269 +6,616 @@
<rect>
<x>0</x>
<y>0</y>
<width>632</width>
<height>444</height>
<width>557</width>
<height>432</height>
</rect>
</property>
<property name="windowTitle">
<string>调焦</string>
</property>
<property name="windowIcon">
<iconset resource="HPPA.qrc">
<normaloff>:/HPPA/HPPA.ico</normaloff>:/HPPA/HPPA.ico</iconset>
<property name="styleSheet">
<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 &quot;新宋体&quot;;
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_4">
<item row="0" column="0" rowspan="2">
<widget class="QGroupBox" name="connectFocusModule_groupBox">
<property name="title">
<string>连接调焦模块</string>
<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">
<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="QLabel" name="label_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>线性平台</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="motorPort_comboBox"/>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="ultrasound_radioButton">
<property name="text">
<string>超声</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="ultrasoundPort_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="is_new_version_radioButton">
<property name="text">
<string>新版</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="connectMotor_btn">
<property name="text">
<string>连接线性平台</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="controlFocus_groupBox">
<property name="title">
<string>调焦</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>采样率</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="sample_ratio_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<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="QWidget" name="titlebarWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>更新实时位置</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="currentLocation_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>43</height>
</size>
</property>
<property name="text">
<string>null</string>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>43</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
<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 resource="HPPA.qrc">
<normaloff>:/svg/resources/icons/svg/close.svg</normaloff>:/svg/resources/icons/svg/close.svg</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="moveto_btn">
<property name="text">
<string>移动至</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="move2_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="add_btn">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="addStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="subtract_btn">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="subtractStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="logicZero_btn">
<property name="text">
<string>LogicZero</string>
</property>
</widget>
</item>
<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 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">
<widget class="QWidget" name="connectFocusModule_widget" native="true">
<property name="styleSheet">
<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>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>线性平台</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="motorPort_comboBox"/>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="ultrasound_radioButton">
<property name="text">
<string>超声</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="ultrasoundPort_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="is_new_version_radioButton">
<property name="text">
<string>新版</string>
</property>
</widget>
</item>
<item row="3" column="1">
<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">
<property name="text">
<string>连接线性平台</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="controlMotor_widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #controlMotor_widget
{
background: #121945;
border-radius: 5px 5px 5px 5px;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<widget class="QPushButton" name="moveto_btn">
<property name="text">
<string>移动至</string>
</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 name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="add_btn">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="subtractStepSize_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="1" column="0">
<widget class="QPushButton" name="updateCurrentLocation_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>34</height>
</size>
</property>
<property name="text">
<string>更新实时位置</string>
</property>
</widget>
</item>
<item row="3" 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">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>null</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</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">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>采样率</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="sample_ratio_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QProgressBar" name="autoFocusProgress_progressBar">
<property name="styleSheet">
<string notr="true">QProgressBar {
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>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="autoFocus_btn">
<property name="text">
<string>自动调焦</string>
</property>
</widget>
</item>
<item row="3" 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="3" column="1">
<widget class="QPushButton" name="manualFocus_btn">
<property name="text">
<string>手动调焦</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,12 @@
#include "MapToolSpectral.h"
#include "MapTools.h"
#include "AspectRatioLabel.h"
#include "HyperImagerControl.h"
#include "recordFrameCounter.h"
#define PI 3.1415926
QT_CHARTS_USE_NAMESPACE//QChartView 使用 需要加宏, 否则无法使用
@ -155,7 +161,7 @@ class WidgetWithBackgroundPicture : public QWidget
public:
explicit WidgetWithBackgroundPicture(QWidget* parent = nullptr)
: QWidget(parent),
m_pixmap(".//icon//titile_bar_bgp.png") // 使用资源或绝对路径
m_pixmap(":/png/resources/icons/png/titile_bar_bgp.png") // 使用资源或绝对路径
{
// 可选:设置初始大小
resize(800, 600);
@ -184,8 +190,6 @@ public:
static HPPA* instance();
LayerTreeNode* rasterGroupNode() const;
void CalculateIntegratioinTimeRange();//通过帧率计算积分时间范围设置slider最大值
WorkerThread * m_TestImagerStausThread;//检测相机连接状态的线程
private:
@ -199,6 +203,7 @@ private:
void initMenubarToolbar();
void initPanelToolbar();
void initControlTabwidget();
QWidget* tmp(QWidget* a);
QLineEdit * frame_number;
QLineEdit * m_FilenameLineEdit;
@ -241,6 +246,7 @@ private:
QActionGroup* mImagerGroup = nullptr;
void createActionGroups();
void selectingImager(QAction* selectedAction);
void updateImagerPicture(const QString& actionName);
QActionGroup* moveplatformActionGroup = nullptr;
void createMoveplatformActionGroup();
@ -263,6 +269,7 @@ private:
TabManager* m_tabManager;
HyperImagerControl* m_hic;
ImageControl* m_ic;
adjustTable* m_adt;
PowerControl* m_pc;
@ -281,8 +288,14 @@ private:
// Map tools
MapTools* m_mapTools = nullptr;
QActionGroup* m_mapToolActionGroup = nullptr;
void initMapTools();
void setMapTool();
QWidget* m_focusTab=nullptr;
recordFrameCounter* m_recordFrameCounter = nullptr;
public Q_SLOTS:
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath);
void PlotSpectral(int state);
@ -294,9 +307,11 @@ public Q_SLOTS:
void onOpenImg();
void onconnect();//连接相机
void testImagerStatus();//获取相机状态:连接是否正常
void autoExposureFinished();
void onAutoExposure();
void onFocus1();
void onFocus2(int command);
void onFocusWindowClosed();
void onAbout();
void onDark();
void recordDarkFinish();
@ -307,16 +322,12 @@ public Q_SLOTS:
void onTabWidgetCurrentChanged(int index);
void onActionOpenDirectory();
void OnFramerateLineeditEditingFinished();//
void OnFramerateSliderChanged(double framerate);//
void onFramerateChanged(double framerate);
void onIntegrationTimeChanged(double integrationTime);
void onGainChanged(double gain);
void OnIntegratioinTimeEditingFinished();//
void OnIntegratioinTimeSliderChanged(double IntegratioinTime);//
void OnGainEditingFinished();//
void OnGainSliderChanged(double Gain);//
void onLeftMouseButtonPressed(int x, int y, QVector<double> wavelengths, QVector<double> spectrum);//点击影像像元显示光谱
void setAxis(QValueAxis* axisX, QValueAxis* axisY);
void onLeftMouseButtonPressed(int x, int y, QVector<double> wavelengths, QVector<double> spectrum);//点击影像像元显示光谱
void setAxis(QValueAxis* axisX, QValueAxis* axisY);
void timerEvent(QTimerEvent *event);
@ -339,8 +350,7 @@ public Q_SLOTS:
void onCreated3DModelPlantPhenotype();
void onCreated3DModelOneMotor();
void onImageFileSaved(QString path, int fileIndex);
void addLayer(const QString& baseName, const QString& filePath, bool refresh);
void onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex);
void removeLayerByTreeIndex();
void removeAllLayersInRasterGroup();
@ -350,6 +360,9 @@ public Q_SLOTS:
void onMapToolPanTriggered();
void onMapToolSpectralTriggered();
protected:
void closeEvent(QCloseEvent* event) override;
signals:
void StartFocusSignal();
void StartRecordSignal();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,5 +1,53 @@
<RCC>
<qresource prefix="/HPPA">
<file>HPPA.ico</file>
<qresource prefix="/svg">
<file>resources/icons/svg/arrow_down.svg</file>
<file>resources/icons/svg/arrow_up.svg</file>
<file>resources/icons/svg/close.svg</file>
<file>resources/icons/svg/connect_imager.svg</file>
<file>resources/icons/svg/connect_imager_done.svg</file>
<file>resources/icons/svg/connect_imager_ing.svg</file>
<file>resources/icons/svg/dark.svg</file>
<file>resources/icons/svg/dark_done.svg</file>
<file>resources/icons/svg/dark_ing.svg</file>
<file>resources/icons/svg/exposure.svg</file>
<file>resources/icons/svg/exposure_done.svg</file>
<file>resources/icons/svg/exposure_ing.svg</file>
<file>resources/icons/svg/focus.svg</file>
<file>resources/icons/svg/focus_done.svg</file>
<file>resources/icons/svg/focus_ing.svg</file>
<file>resources/icons/svg/openDirectory.svg</file>
<file>resources/icons/svg/openDirectory_done.svg</file>
<file>resources/icons/svg/pan.svg</file>
<file>resources/icons/svg/pan_done.svg</file>
<file>resources/icons/svg/record.svg</file>
<file>resources/icons/svg/record_done.svg</file>
<file>resources/icons/svg/record_ing.svg</file>
<file>resources/icons/svg/reference.svg</file>
<file>resources/icons/svg/reference_done.svg</file>
<file>resources/icons/svg/reference_ing.svg</file>
<file>resources/icons/svg/software_icon.svg</file>
<file>resources/icons/svg/software_icon_small.svg</file>
<file>resources/icons/svg/spectral.svg</file>
<file>resources/icons/svg/spectral_done.svg</file>
<file>resources/icons/svg/tree_tri_down.svg</file>
<file>resources/icons/svg/tree_tri_right.svg</file>
<file>resources/icons/svg/mIconRaster.svg</file>
</qresource>
<qresource prefix="/png">
<file>resources/icons/png/Spectral_Insight_27.png</file>
<file>resources/icons/png/Spectral_Insight_54.png</file>
<file>resources/icons/png/Spectral_Insight_170.png</file>
<file>resources/icons/png/Spectral_Insight_340.png</file>
<file>resources/icons/png/titile_bar_bgp.png</file>
<file>resources/icons/png/titile_bar_bgp2x.png</file>
</qresource>
<qresource prefix="/imagerPicture">
<file>resources/icons/imagerPicture/corning410.png</file>
<file>resources/icons/imagerPicture/IR.png</file>
<file>resources/icons/imagerPicture/L.png</file>
<file>resources/icons/imagerPicture/XC2.png</file>
</qresource>
<qresource prefix="/ico">
<file>resources/icons/ico/Spectral_Insight_128.ico</file>
</qresource>
</RCC>

Binary file not shown.

View File

@ -11,11 +11,11 @@
</rect>
</property>
<property name="windowTitle">
<string>Hyper Plant Phenotypic Analysis</string>
<string>Spectral Insight</string>
</property>
<property name="windowIcon">
<iconset resource="HPPA.qrc">
<normaloff>:/HPPA/HPPA.ico</normaloff>:/HPPA/HPPA.ico</iconset>
<normaloff>:/ico/resources/icons/ico/Spectral_Insight_128.ico</normaloff>:/ico/resources/icons/ico/Spectral_Insight_128.ico</iconset>
</property>
<property name="styleSheet">
<string notr="true"/>
@ -197,17 +197,21 @@ QToolBar QToolButton:hover {
<addaction name="action_reference"/>
<addaction name="action_start_recording"/>
<addaction name="actionOpenDirectory"/>
<addaction name="mActionPan"/>
<addaction name="mActionSpectral"/>
</widget>
<widget class="QStatusBar" name="statusBar">
<property name="styleSheet">
<string notr="true">QStatusBar {
background-color: rgb(255, 255, 255);
color: white; /* 文字颜色 */
border-top: 1px solid #ccc; /* 顶部边框 */
padding: 5px; /* 内边距 */
<string notr="true">QStatusBar
{
background-color: #0D1233;
color: white;
}
</string>
QStatusBar::item
{
border: none;
}</string>
</property>
</widget>
<widget class="CustomDockWidgetBase" name="mDockWidgetSimulator">
@ -253,9 +257,9 @@ QToolBar QToolButton:hover {
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_4">
<widget class="QWidget" name="controlContents">
<property name="styleSheet">
<string notr="true">QWidget #dockWidgetContents_4
<string notr="true">QWidget #controlContents
{
background-color: #0E1C4C;
@ -324,329 +328,11 @@ QTabWidget::pane {
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<widget class="QWidget" name="tab">
<property name="styleSheet">
<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;
}
QLineEdit:hover {
border: 1px solid #4d8dff;
}
QLineEdit:focus {
border: 1px solid #6aa2ff;
background-color: #23345c;
}
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>
<attribute name="title">
<string>光谱仪</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="HPPA.qrc">:/HPPA/HPPA.ico</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</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="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>6</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="QLineEdit" name="framerate_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</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="QLineEdit" name="integratioin_time_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</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="QLineEdit" name="gain_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSlider" 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>
<widget class="QWidget" name="rgbCameraWidget">
<property name="styleSheet">
<string notr="true">QGroupBox
@ -816,18 +502,83 @@ QPushButton:pressed
</layout>
</widget>
</widget>
<widget class="QToolBar" name="mapToolBar">
<widget class="QToolBar" name="toolBar">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>图像查看</string>
<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>TopToolBarArea</enum>
<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>
<addaction name="mActionPan"/>
<addaction name="mActionSpectral"/>
</widget>
<action name="action_exit">
<property name="text">
@ -1090,11 +841,6 @@ QPushButton:pressed
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QDoubleSlider</class>
<extends>QSlider</extends>
<header>qdoubleslider.h</header>
</customwidget>
<customwidget>
<class>CustomDockWidgetBase</class>
<extends>QDockWidget</extends>

View File

@ -32,12 +32,12 @@
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>5.13.2_msvc2017_64</QtInstall>
<QtModules>core;network;gui;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts</QtModules>
<QtModules>core;network;gui;svg;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts</QtModules>
<QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
<QtInstall>5.9_msvc2017_64</QtInstall>
<QtModules>core;network;gui;widgets;serialport;websockets;charts</QtModules>
<QtInstall>5.13.2_msvc2017_64</QtInstall>
<QtModules>core;network;gui;svg;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts</QtModules>
<QtBuildConfig>release</QtBuildConfig>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
@ -57,10 +57,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;$(IncludePath)</IncludePath>
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\x64\Debug;$(LibraryPath)</LibraryPath>
<TargetName>Spectral Insight</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;$(IncludePath)</IncludePath>
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017_release;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Release;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\IrisMultiMotorController\x64\Release;C:\XIMEA\API\xiAPI;$(LibraryPath)</LibraryPath>
<TargetName>Spectral Insight</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
@ -106,11 +108,13 @@
<ItemGroup>
<ClCompile Include="aboutWindow.cpp" />
<ClCompile Include="adjustTable.cpp" />
<ClCompile Include="AspectRatioLabel.cpp" />
<ClCompile Include="CaptureCoordinator.cpp" />
<ClCompile Include="Carousel.cpp" />
<ClCompile Include="Corning410Imager.cpp" />
<ClCompile Include="CustomDockWidgetBase.cpp" />
<ClCompile Include="hppaConfigFile.cpp" />
<ClCompile Include="HyperImagerControl.cpp" />
<ClCompile Include="imageControl.cpp" />
<ClCompile Include="ImagerOperationBase.cpp" />
<ClCompile Include="imager_base.cpp" />
@ -136,6 +140,7 @@
<ClCompile Include="RasterDataProvider.cpp" />
<ClCompile Include="RasterLayer.cpp" />
<ClCompile Include="RasterRenderer.cpp" />
<ClCompile Include="recordFrameCounter.cpp" />
<ClCompile Include="resononImager.cpp" />
<ClCompile Include="ResononNirImager.cpp" />
<ClCompile Include="RgbCameraOperation.cpp" />
@ -165,6 +170,7 @@
<ClCompile Include="imagerSimulatioin.cpp" />
<ClCompile Include="ImageViewer.cpp" />
<ClCompile Include="main.cpp" />
<QtUic Include="hyperImagerControl.ui" />
<QtUic Include="imgControl.ui" />
<QtUic Include="oneMotorControl.ui" />
<QtUic Include="PathPlan.ui" />
@ -194,6 +200,8 @@
<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="irisximeaimager.h" />
<QtMoc Include="OneMotorControl.h" />
@ -215,6 +223,7 @@
<QtMoc Include="MapTools.h" />
<ClInclude Include="RasterDataProvider.h" />
<ClInclude Include="RasterRenderer.h" />
<QtMoc Include="recordFrameCounter.h" />
<ClInclude Include="utility_tc.h" />
<QtMoc Include="aboutWindow.h" />
<ClInclude Include="hppaConfigFile.h" />
@ -240,7 +249,7 @@
<ResourceCompile Include="HPPA.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="HPPA.ico" />
<Image Include="resources\icons\ico\Spectral_Insight_128.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">

View File

@ -190,6 +190,15 @@
<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>
<ClCompile Include="recordFrameCounter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="fileOperation.h">
@ -306,6 +315,15 @@
<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>
<QtMoc Include="recordFrameCounter.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<ClInclude Include="imageProcessor.h">
@ -382,6 +400,9 @@
<QtUic Include="imgControl.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="hyperImagerControl.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
@ -392,7 +413,7 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="HPPA.ico">
<Image Include="resources\icons\ico\Spectral_Insight_128.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>

195
HPPA/HyperImagerControl.cpp Normal file
View File

@ -0,0 +1,195 @@
#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.GainSlider->setMaximum(12);
ui.GainSlider->setMinimum(0);
ui.gain_spinBox->setMaximum(12);
ui.gain_spinBox->setMinimum(0);
ui.widget_3->setStyleSheet(R"(
QDoubleSpinBox {
border: 1px solid #999;
border-radius: 4px;
padding: 2px 20px 2px 6px; /* 右侧留空间给按钮 */
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(:/svg/resources/icons/svg/arrow_up.svg);
width: 10px;
height: 10px;
}
QDoubleSpinBox::down-arrow {
image: url(:/svg/resources/icons/svg/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;
}
)");
}
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();
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; // 毫秒
ui.IntegratioinTimeSlider->blockSignals(true);
ui.IntegratioinTimeSlider->setMaximum(maxIntegrationTime);
ui.IntegratioinTimeSlider->setMinimum(1);
ui.IntegratioinTimeSlider->blockSignals(false);
ui.integratioin_time_spinBox->blockSignals(true);
ui.integratioin_time_spinBox->setMaximum(maxIntegrationTime);
ui.integratioin_time_spinBox->setMinimum(1);
ui.integratioin_time_spinBox->blockSignals(false);
}
void HyperImagerControl::updateFramerateRange(double integrationTime)
{
double maxFramerate = 1.0 / (integrationTime / 1000.0); // 积分时间(毫秒)转帧率
if(maxFramerate > m_frameRateLimit)
{
maxFramerate = m_frameRateLimit;
}
ui.FramerateSlider->blockSignals(true);
ui.FramerateSlider->setMaximum(maxFramerate);
ui.FramerateSlider->setMinimum(1);
ui.FramerateSlider->blockSignals(false);
ui.framerate_spinBox->blockSignals(true);
ui.framerate_spinBox->setMaximum(maxFramerate);
ui.framerate_spinBox->setMinimum(1);
ui.framerate_spinBox->blockSignals(false);
}

47
HPPA/HyperImagerControl.h Normal file
View File

@ -0,0 +1,47 @@
#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);
double m_frameRateLimit = 150;//相机的最大帧率限制为250fps
Ui::HyperImagerControl ui;
};

View File

@ -45,7 +45,6 @@ Mapcavas::Mapcavas(QWidget* pParent) :QGraphicsView(pParent)
m_translateSpeed = 1.0;
m_bMouseTranslate = false;
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFrameShape(QFrame::NoFrame);
@ -104,6 +103,50 @@ bool Mapcavas::HasImage()
}
}
void Mapcavas::updateCrosshair(double sceneX, double sceneY)
{
QPen pen(Qt::red, 2.0);
pen.setCosmetic(true); // constant screen-width regardless of zoom
if (!m_hLine)
{
m_hLine = m_qtGraphicsScene->addLine(0, 0, 0, 0, pen);
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);
m_vLine->setPen(pen);
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)
{
// Always let the tool have a chance first
@ -136,29 +179,9 @@ void Mapcavas::mousePressEvent(QMouseEvent *event)
if (m_mapTool)
{
m_mapTool->canvasMousePressEvent(event);
QGraphicsView::mousePressEvent(event);
return;
}
// Legacy fallback when no tool is set
if (event->button()==Qt::LeftButton)
{
m_bMouseTranslate = true;
m_lastMousePos = event->pos();
const QPointF scenePt = mapToScene(m_lastMousePos);
const int x = static_cast<int>(std::floor(scenePt.x()));
const int y = static_cast<int>(std::floor(scenePt.y()));
if (m_rasterLayer && m_rasterLayer->isValidPixel(x, y))
{
QVector<double> wavelengths;
QVector<double> spectrum;
if (m_rasterLayer->readPixelSpectrum(x, y, wavelengths, spectrum))
{
emit leftMouseButtonPressed(x, y, wavelengths, spectrum);
}
}
}
QGraphicsView::mousePressEvent(event);
}
@ -167,16 +190,10 @@ void Mapcavas::mouseMoveEvent(QMouseEvent *event)
if (m_mapTool)
{
m_mapTool->canvasMouseMoveEvent(event);
QGraphicsView::mousePressEvent(event);
return;
}
// Legacy fallback
if (m_bMouseTranslate){
QPointF mouseDelta = mapToScene(event->pos()) - mapToScene(m_lastMousePos);
translate(mouseDelta.x(),mouseDelta.y());
}
m_lastMousePos = event->pos();
QGraphicsView::mousePressEvent(event);
}
@ -185,11 +202,10 @@ void Mapcavas::mouseReleaseEvent(QMouseEvent *event)
if (m_mapTool)
{
m_mapTool->canvasMouseReleaseEvent(event);
QGraphicsView::mouseReleaseEvent(event);
return;
}
// Legacy fallback
m_bMouseTranslate = false;
QGraphicsView::mouseReleaseEvent(event);
}

View File

@ -29,6 +29,9 @@ public:
bool HasImage();
void ensureSceneVisible();
void updateCrosshair(double sceneX, double sceneY);
void removeCrosshair();
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
void scaling(qreal scaleFactor);
@ -71,6 +74,10 @@ private:
QPoint m_lastMousePos; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>λ<EFBFBD><CEBB>
qreal m_scale; // <20><><EFBFBD><EFBFBD>ֵ
double m_CrosshairHalfLen = 10.0;
QGraphicsLineItem* m_hLine = nullptr; // horizontal line
QGraphicsLineItem* m_vLine = nullptr; // vertical line
signals:
void leftMouseButtonPressed(int, int, QVector<double>, QVector<double>);

View File

@ -67,6 +67,8 @@ double ImagerOperationBase::auto_exposure()
imagerStopCollect();
emit autoExposureSignal();
//std::cout << "<22>Զ<EFBFBD><D4B6>ع⣺" << getIntegrationTime() << std::endl;
return getIntegrationTime();

View File

@ -114,6 +114,7 @@ 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 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);

View File

@ -1,39 +1,13 @@
#include "LayerTree.h"
#include "LayerTreeGroupNode.h"
LayerTree::LayerTree(QObject* parent)
: QObject(parent)
: LayerTreeGroup("__root__", parent)
{
// root <20><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> view <20><><EFBFBD><EFBFBD>ʾ
m_root = new LayerTreeGroupNode("__root__", this);
m_root->setVisible(Qt::Checked);
setVisible(Qt::Checked);
}
LayerTree::~LayerTree()
{
delete m_root;
m_root = nullptr;
}
LayerTreeNode* LayerTree::root() const
{
return m_root;
}
LayerTreeNode* LayerTree::insertNode(LayerTreeNode* parent, int row, LayerTreeNode* node)
{
if (!node) return nullptr;
if (!parent) parent = m_root;
if (row < 0) row = parent->childCount();
parent->insertChild(row, node);
return node;
}
LayerTreeNode* LayerTree::removeNode(LayerTreeNode* parent, int row)
{
if (!parent) parent = m_root;
return parent->takeChild(row);
}
void LayerTree::setChildrenVisible(LayerTreeNode* n, Qt::CheckState state)

View File

@ -1,18 +1,16 @@
#pragma once
#include <QObject>
#include "LayerTreeNode.h"
#include "LayerTreeGroupNode.h"
/**
* LayerTree<65><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* - <20><><EFBFBD><EFBFBD> root
* - <20><EFBFBD><E1B9A9><EFBFBD><EFBFBD>/<2F>Ƴ<EFBFBD><C6B3>ڵ<EFBFBD><DAB5><EFBFBD> API
* LayerTree<65><65>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
* - <20>̳<EFBFBD><EFBFBD><EFBFBD> LayerTreeGroup<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD>ڵ<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 QObject
class LayerTree : public LayerTreeGroup
{
Q_OBJECT
public:
@ -22,28 +20,7 @@ public:
LayerTree(const LayerTree&) = delete;
LayerTree& operator=(const LayerTree&) = delete;
LayerTreeNode* root() const;
// <20><><EFBFBD>룺parent Ϊ nullptr <20><>ʾ root<6F><74>row=-1 <20><>ʾ append
LayerTreeNode* insertNode(LayerTreeNode* parent, int row, LayerTreeNode* node);
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD> delete<74><65><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1>Ƴ<EFBFBD><C6B3>ڵ㣨<DAB5><E3A3A8><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD> delete <20><><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2>
LayerTreeNode* removeNode(LayerTreeNode* parent, int row);
// <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);
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;
}
private:
LayerTreeNode* m_root = nullptr; // owned
};

View File

@ -1,6 +1,103 @@
#include "LayerTreeGroupNode.h"
#include "LayerTreeLayerNode.h"
LayerTreeGroupNode::LayerTreeGroupNode(const QString& name, QObject* parent)
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;
}

View File

@ -1,15 +1,44 @@
#pragma once
#include "LayerTreeNode.h"
/** Group <20>ڵ<EFBFBD> */
class LayerTreeGroupNode : public LayerTreeNode
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 LayerTreeGroupNode(const QString& name,
QObject* parent = nullptr);
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;

View File

@ -1,22 +1,22 @@
#include "LayerTreeLayerNode.h"
LayerTreeLayerNode::LayerTreeLayerNode(MapLayer* layer, QObject* parent)
LayerTreeLayer::LayerTreeLayer(MapLayer* layer, QObject* parent)
: LayerTreeNode(layer ? layer->name() : QString(), parent), m_layer(layer)
{
}
LayerTreeNode::Type LayerTreeLayerNode::type() const
LayerTreeNode::Type LayerTreeLayer::type() const
{
return Type::Layer;
}
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> MapLayer ָ<><EFBFBD><EBA3A8>ӵ<EFBFBD>У<EFBFBD>
void LayerTreeLayerNode::setMapLayer(MapLayer* layer)
void LayerTreeLayer::setMapLayer(MapLayer* layer)
{
m_layer = layer;
}
MapLayer* LayerTreeLayerNode::mapLayer() const
MapLayer* LayerTreeLayer::mapLayer() const
{
return m_layer;
}

View File

@ -2,16 +2,19 @@
#include "LayerTreeNode.h"
#include "MapLayer.h"
/** Layer <20>ڵ<EFBFBD> */
class LayerTreeLayerNode : public LayerTreeNode
/**
* LayerTreeLayer<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
* - <20><><EFBFBD><EFBFBD>Ϊ LayerTreeNode
* - <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> MapLayer ָ<><EFBFBD><EBA3A8>ӵ<EFBFBD>У<EFBFBD>
*/
class LayerTreeLayer : public LayerTreeNode
{
Q_OBJECT
public:
explicit LayerTreeLayerNode(MapLayer* layer, QObject* parent = nullptr);
explicit LayerTreeLayer(MapLayer* layer, QObject* parent = nullptr);
Type type() const override;
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> MapLayer ָ<><EFBFBD><EBA3A8>ӵ<EFBFBD>У<EFBFBD>
void setMapLayer(MapLayer* layer);
MapLayer* mapLayer() const;
@ -20,3 +23,6 @@ private:
// <20><><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>layerId / pointer / legendItems <20><>
};
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
using LayerTreeLayerNode = LayerTreeLayer;

View File

@ -28,10 +28,10 @@ QModelIndex LayerTreeModel::index(int row, int column, const QModelIndex& parent
QModelIndex LayerTreeModel::parent(const QModelIndex& child) const
{
LayerTreeNode* node = nodeFromIndex(child);
if (!node || node == m_tree->root()) return {};
if (!node || node == m_tree) return {};
LayerTreeNode* p = node->parentNode();
if (!p || p == m_tree->root()) return {};
if (!p || p == m_tree) return {};
return createIndex(p->rowInParent(), 0, p);
}
@ -50,7 +50,7 @@ int LayerTreeModel::columnCount(const QModelIndex&) const
QVariant LayerTreeModel::data(const QModelIndex& index, int role) const
{
LayerTreeNode* n = nodeFromIndex(index);
if (!n || n == m_tree->root()) return {};
if (!n || n == m_tree) return {};
switch (role) {
case Qt::DisplayRole:
@ -59,17 +59,17 @@ QVariant LayerTreeModel::data(const QModelIndex& index, int role) const
case Qt::DecorationRole:
{
auto* tmp = nodeFromIndex(index);
if (LayerTree::isGroup(tmp))
if (LayerTreeNode::isGroup(tmp))
return QIcon();
else if (LayerTree::isLayer(tmp))
else if (LayerTreeNode::isLayer(tmp))
{
QString basePath = QCoreApplication::applicationDirPath();
return QIcon(basePath + "/icons/mIconRaster.svg");
return QIcon(":/svg/resources/icons/svg/mIconRaster.svg");
}
}
case Qt::CheckStateRole:
return static_cast<int>(n->visible());
//case Qt::CheckStateRole:
// return static_cast<int>(n->visible());
case Qt::ToolTipRole:
return (n->type() == LayerTreeNode::Type::Group) ? "Group" : "Layer";
@ -82,7 +82,7 @@ QVariant LayerTreeModel::data(const QModelIndex& index, int role) const
bool LayerTreeModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
LayerTreeNode* n = nodeFromIndex(index);
if (!n || n == m_tree->root()) return false;
if (!n || n == m_tree) return false;
if (role == Qt::CheckStateRole) {
auto newState = static_cast<Qt::CheckState>(value.toInt());
@ -111,39 +111,39 @@ Qt::ItemFlags LayerTreeModel::flags(const QModelIndex& index) const
if (!index.isValid()) return Qt::NoItemFlags;
LayerTreeNode* n = nodeFromIndex(index);
if (!n || n == m_tree->root()) return Qt::NoItemFlags;
if (!n || n == m_tree) return Qt::NoItemFlags;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
}
LayerTreeNode* LayerTreeModel::root() const
{
return m_tree->root();
return m_tree;
}
LayerTreeNode* LayerTreeModel::addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon)
{
if (!parent) parent = m_tree->root();
if (!parent) parent = m_tree;
const int row = parent->childCount();
beginInsertRows(indexFromNode(parent), row, row);
LayerTreeNode* g = m_tree->insertNode(parent, row, new LayerTreeGroupNode(name));
LayerTreeNode* g = m_tree->addGroup(name);
endInsertRows();
return g;
}
LayerTreeNode* LayerTreeModel::addLayer(LayerTreeNode* parent, LayerTreeLayerNode* layerNode, const QIcon& icon)
LayerTreeNode* LayerTreeModel::addLayer(LayerTreeNode* parent, LayerTreeLayer* layerNode, const QIcon& icon)
{
if (!parent) parent = m_tree->root();
if (!parent) parent = m_tree;
if (!layerNode) return nullptr;
const int row = parent->childCount();
beginInsertRows(indexFromNode(parent), row, row);
LayerTreeNode* l = m_tree->insertNode(parent, row, layerNode);
parent->insertChild(row, layerNode);
endInsertRows();
return l;
return layerNode;
}
void LayerTreeModel::setCascadeCheckEnabled(bool enabled)
@ -159,11 +159,12 @@ bool LayerTreeModel::cascadeCheckEnabled() const
// <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->root();
if (!parent) parent = m_tree;
if (row < 0 || row >= parent->childCount()) return nullptr;
LayerTreeNode* removed = parent->childAt(row);
beginRemoveRows(indexFromNode(parent), row, row);
LayerTreeNode* removed = m_tree->removeNode(parent, row);
parent->removeChild(row, 1, false);
endRemoveRows();
return removed;
@ -171,12 +172,12 @@ LayerTreeNode* LayerTreeModel::removeNode(LayerTreeNode* parent, int row)
LayerTreeNode* LayerTreeModel::nodeFromIndex(const QModelIndex& index) const
{
if (!index.isValid()) return m_tree->root();
if (!index.isValid()) return m_tree;
return static_cast<LayerTreeNode*>(index.internalPointer());
}
QModelIndex LayerTreeModel::indexFromNode(LayerTreeNode* n) const
{
if (!n || n == m_tree->root()) return {};
if (!n || n == m_tree) return {};
return createIndex(n->rowInParent(), 0, n);
}

View File

@ -3,7 +3,7 @@
#include <QAbstractItemModel>
#include "LayerTree.h"
class LayerTreeLayerNode; // forward declare
class LayerTreeLayer; // forward declare
/**
* LayerTreeModel<65><6C>Qt <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E3A3A8><EFBFBD>ٹ<EFBFBD><D9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -34,7 +34,7 @@ public:
LayerTreeNode* root() const;
LayerTreeNode* addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon = QIcon());
LayerTreeNode* addLayer(LayerTreeNode* parent, LayerTreeLayerNode* layerNode, const QIcon& icon = QIcon());
LayerTreeNode* addLayer(LayerTreeNode* parent, LayerTreeLayer* layerNode, const QIcon& icon = QIcon());
void setCascadeCheckEnabled(bool enabled);
bool cascadeCheckEnabled() const;

View File

@ -20,7 +20,11 @@ QString LayerTreeNode::name() const
void LayerTreeNode::setName(const QString& name)
{
m_name = name;
if (m_name != name)
{
m_name = name;
emit nameChanged(this, name);
}
}
QIcon LayerTreeNode::icon() const
@ -97,14 +101,35 @@ void LayerTreeNode::insertChild(int row, LayerTreeNode* child)
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);
}
LayerTreeNode* LayerTreeNode::takeChild(int row)
void LayerTreeNode::removeChild(int from, int count, bool destroy)
{
if (row < 0 || row >= m_children.size()) return nullptr;
LayerTreeNode* taken = m_children.takeAt(row);
if (taken) taken->setParentNode(nullptr);
return taken;
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);
}
}

View File

@ -9,9 +9,10 @@
* 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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>m_parentNode<EFBFBD><EFBFBD><EFBFBD><EFBFBD> QObject parent<6E><74><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
* - <20><><EFBFBD><EFBFBD>ͬʱά<CAB1><CEAC>"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>"<EFBFBD><EFBFBD>m_parentNode<EFBFBD><EFBFBD><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
@ -50,7 +51,32 @@ public:
// ---- structure mutation (used by LayerTree / Model) ----
void appendChild(LayerTreeNode* child);
void insertChild(int row, LayerTreeNode* child);
LayerTreeNode* takeChild(int row); // remove but not delete
// <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);

View File

@ -30,6 +30,19 @@ void LayerTreeView::contextMenuEvent(QContextMenuEvent* event)
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());

View File

@ -81,3 +81,12 @@ QWidget* MapLayerStore::widgetForLayer(const QString& absolutePath) const
}
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;
}

View File

@ -35,6 +35,9 @@ public slots:
// 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

View File

@ -34,7 +34,7 @@ void MapTool::setMapcavas(Mapcavas* canvas)
if (m_isActive && m_canvas)
{
deactivate();
//deactivate();
}
m_canvas = canvas;

View File

@ -3,6 +3,9 @@
#include "ImageViewer.h"
#include "RasterLayer.h"
#include <QMouseEvent>
#include <QGraphicsScene>
#include <QGraphicsLineItem>
#include <QPen>
#include <cmath>
MapToolSpectral::MapToolSpectral(QObject* parent)
@ -15,6 +18,17 @@ MapToolSpectral::~MapToolSpectral()
{
}
void MapToolSpectral::activate()
{
MapTool::activate();
}
void MapToolSpectral::deactivate()
{
canvas()->removeCrosshair();
MapTool::deactivate();
}
void MapToolSpectral::canvasMousePressEvent(QMouseEvent* e)
{
if (e->button() != Qt::LeftButton)
@ -30,6 +44,9 @@ void MapToolSpectral::canvasMousePressEvent(QMouseEvent* e)
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))

View File

@ -4,6 +4,8 @@
#include "MapTool.h"
#include <QVector>
class QGraphicsLineItem;
class MapToolSpectral : public MapTool
{
Q_OBJECT
@ -14,8 +16,13 @@ public:
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

View File

@ -6,39 +6,45 @@
MapTools::MapTools(QObject* parent)
: QObject(parent)
{
m_mapToolPan = new MapToolPan(this);
m_mapToolSpectral = new MapToolSpectral(this);
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 m_mapToolPan;
return qobject_cast<MapToolPan*>(m_tools.value(Pan));
}
MapToolSpectral* MapTools::mapToolSpectral() const
{
return m_mapToolSpectral;
return qobject_cast<MapToolSpectral*>(m_tools.value(Spectral));
}
MapTool* MapTools::mapTool(Tool tool) const
{
switch (tool)
{
case Pan:
return m_mapToolPan;
case Spectral:
return m_mapToolSpectral;
default:
return nullptr;
}
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)
{
m_mapToolPan->setMapcavas(canvas);
m_mapToolSpectral->setMapcavas(canvas);
if (m_activeTool)
{
m_activeTool->setMapcavas(canvas);
}
}

View File

@ -2,6 +2,7 @@
#define MAPTOOLS_H
#include <QObject>
#include <QHash>
class MapTool;
class MapToolPan;
@ -27,11 +28,14 @@ public:
MapTool* mapTool(Tool tool) const;
MapTool* activeTool() const;
void setActiveTool(MapTool* tool);
void setMapcavas(Mapcavas* canvas);
private:
MapToolPan* m_mapToolPan = nullptr;
MapToolSpectral* m_mapToolSpectral = nullptr;
QHash<Tool, MapTool*> m_tools;
MapTool* m_activeTool = nullptr;
};
#endif // MAPTOOLS_H

View File

@ -7,6 +7,7 @@ m_Multiplier(100.0)
connect(this, SIGNAL(valueChanged(int)), this, SLOT(notifyValueChanged(int)));
setSingleStep(1);
setRange(1, 500);
setOrientation(Qt::Horizontal);
setFocusPolicy(Qt::NoFocus);

View File

@ -23,8 +23,8 @@ public:
private slots:
signals :
void valueChanged(double Value);
void rangeChanged(double Min, double Max);
void valueChanged(double Value);//QSlider<65><72>valueChanged<65>źŵIJ<C5B5><C4B2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
void rangeChanged(double Min, double Max);//QSlider<65><72>rangeChanged<65>źŵIJ<C5B5><C4B2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
private:
double m_Multiplier;

View File

@ -232,20 +232,44 @@ void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
//std::cout << "-----------------------------------"<<connectivity.size()<< std::endl;
if (connectivity[0])
{
this->ui.xMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
this->ui.xMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: #08FACE;
border-radius: 4px;
}
)");
}
else
{
this->ui.xMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
this->ui.xMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: red;
border-radius: 4px;
}
)");
}
if (connectivity[1])
{
this->ui.yMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
this->ui.yMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: #08FACE;
border-radius: 4px;
}
)");
}
else
{
this->ui.yMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
this->ui.yMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: red;
border-radius: 4px;
}
)");
}
}
@ -440,7 +464,7 @@ void TwoMotorControl::onSaveRecordLine2File_btn()
fclose(RecordLineFileHandle);
delete[] data;
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("保存成功!"));
//QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("保存成功!"));
}
void TwoMotorControl::onReadRecordLineFile_btn()
@ -499,5 +523,5 @@ void TwoMotorControl::onReadRecordLineFile_btn()
fclose(RecordLineFileHandle);
delete[] data;
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("读取成功!"));
//QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("读取成功!"));
}

View File

@ -9,103 +9,300 @@
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<height>463</height>
<width>486</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>HPPA.ico</normaloff>HPPA.ico</iconset>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>90</x>
<y>250</y>
<width>434</width>
<height>134</height>
</rect>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="companylname_label">
<property name="text">
<string>公司:北京依锐思遥感技术有限公司</string>
<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>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>地址北京市海淀区清河安宁庄东路18号5号楼二层205</string>
<property name="topMargin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>电话010-51292601</string>
<property name="rightMargin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>邮箱hanshanlong@iris-rs.cn</string>
<property name="bottomMargin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>270</x>
<y>150</y>
<width>141</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>版本2.0</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>270</x>
<y>70</y>
<width>391</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Hyper Plant Phenotypic Analysis</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>90</x>
<y>50</y>
<width>141</width>
<height>141</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>HPPA.ico</pixmap>
</property>
</widget>
<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 resource="HPPA.qrc">:/png/resources/icons/png/Spectral_Insight_27.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 &quot;新宋体&quot;;
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 resource="HPPA.qrc">
<normaloff>:/svg/resources/icons/svg/close.svg</normaloff>:/svg/resources/icons/svg/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">
<rect>
<x>70</x>
<y>20</y>
<width>171</width>
<height>171</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="HPPA.qrc">:/png/resources/icons/png/Spectral_Insight_170.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 &quot;Adobe Devanagari&quot;;
}</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">
<property name="text">
<string>公司:北京依锐思遥感技术有限公司</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="widget_3" native="true">
<property name="geometry">
<rect>
<x>260</x>
<y>50</y>
<width>171</width>
<height>101</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="verticalSpacing">
<number>30</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="styleSheet">
<string notr="true">QLabel
{
color:#E2EDFF;
font: italic 18pt &quot;Adobe Devanagari&quot;;
}</string>
</property>
<property name="text">
<string>Spectral Insight</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="versionLabel">
<property name="styleSheet">
<string notr="true">QLabel
{
color:#E2EDFF;
font: 10pt &quot;Adobe Devanagari&quot;;
}</string>
</property>
<property name="text">
<string>版本3.0.0</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="HPPA.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,5 +1,6 @@
#include "aboutWindow.h"
#include <QSvgRenderer>
#include <QPainter>
aboutWindow::aboutWindow(QWidget* parent)
{
@ -9,14 +10,22 @@ aboutWindow::aboutWindow(QWidget* parent)
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);
Qt::WindowFlags flags = 0;
//flags |= Qt::WindowMinimizeButtonHint;
flags |= Qt::WindowCloseButtonHint;
flags |= Qt::MSWindowsFixedSizeDialogHint;
setWindowFlags(flags);
//Qt::WindowFlags flags = 0;
////flags |= Qt::WindowMinimizeButtonHint;
//flags |= Qt::WindowCloseButtonHint;
//flags |= Qt::MSWindowsFixedSizeDialogHint;
//setWindowFlags(flags);
setWindowFlags(Qt::FramelessWindowHint);
connect(this->ui.closeBtn, SIGNAL(released()), this, SLOT(onExit()));
}
aboutWindow::~aboutWindow()
{
}
void aboutWindow::onExit()
{
this->close();
}

View File

@ -2,6 +2,7 @@
#include <QtWidgets/qdialog.h>
#include <qstring.h>
#include "ui_about.h"
class aboutWindow :public QDialog
@ -19,6 +20,7 @@ private:
Ui::aboutDialog ui;
public Q_SLOTS:
void onExit();
signals:

View File

@ -1,10 +1,22 @@
#include "stdafx.h"
#include "focusWindow.h"
#include <QSvgRenderer>
#include <QMouseEvent>
focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
{
ui.setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
ui.titlebarWidget->installEventFilter(this);
QSvgRenderer svgRenderer(QString(":/svg/resources/icons/svg/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";
Configfile configfile;
@ -39,6 +51,7 @@ focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
connect(this->ui.moveto_btn, SIGNAL(clicked()), this, SLOT(onMoveto()));
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())
@ -67,6 +80,7 @@ focusWindow::~focusWindow()
printf("destroy focusWindow-------------------------\n");
emit StartManualFocusSignal(0);//当用户没有点击停止调焦就关闭窗口
emit closeSignal();
delete m_ctrlFocusMotor;
//delete thread1, progressThread;
@ -78,9 +92,50 @@ focusWindow::~focusWindow()
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)
{
ui.controlMotor_groupBox->setDisabled(disable);
ui.controlMotor_widget->setDisabled(disable);
ui.autoFocus_btn->setDisabled(disable);
}
@ -151,7 +206,7 @@ void focusWindow::onConnectMotor()
int motorPort = rx.cap(0).toInt();
rx.indexIn(ultrasoundPortTmp, 0);
int ultrasoundPort = rx.cap(0).toInt();
if (isUltrasound)

View File

@ -105,8 +105,13 @@ public:
ImagerOperationBase* m_Imager;
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
QPoint m_dragPosition;
bool m_bDrag = false;
Ui::focusDialog ui;
QThread *m_AutoFocusThread;
int m_FocusState;
@ -151,6 +156,8 @@ public Q_SLOTS:
void moveAfterAutoFocus(int motorID, double location);
void onExit();
signals:
void StartManualFocusSignal(int);//1<><31><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -161,6 +168,7 @@ signals:
void zeroStartSignal(int);
void startStepMotion(double speed, int stepInterval = 100, double startPos = 0, double endPos = -1);
void closeSignal();
};
class WorkerThread2 : public QThread

341
HPPA/hyperImagerControl.ui Normal file
View File

@ -0,0 +1,341 @@
<?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>437</width>
<height>372</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 &quot;新宋体&quot;;
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" rowstretch="3,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="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>16</number>
</property>
<item row="0" column="1">
<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 row="0" column="2">
<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>
<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="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="2" column="1">
<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 row="2" column="2">
<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>
<item row="1" column="1">
<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 row="1" column="2">
<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>
<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="3">
<widget class="QLabel" name="label_4">
<property name="text">
<string>hz</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>ms</string>
</property>
</widget>
</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>

View File

@ -37,6 +37,54 @@ ImageControl::ImageControl(QWidget* parent)
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(:/svg/resources/icons/svg/arrow_up.svg);
width: 10px;
height: 10px;
}
QDoubleSpinBox::down-arrow {
image: url(:/svg/resources/icons/svg/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()

View File

@ -14,7 +14,56 @@
<string>Color Adjust</string>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
<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 &quot;新宋体&quot;;
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);
}
@ -71,10 +120,21 @@ QSlider::handle:horizontal:pressed {
<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 &quot;Adobe Devanagari&quot;;
}</string>
</property>
<property name="title">
<string>调整</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>16</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelRed">
<property name="text">
@ -185,16 +245,40 @@ QSlider::handle:horizontal:pressed {
<property name="title">
<string>预设</string>
</property>
<layout class="QVBoxLayout" name="presetLayout">
<item>
<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>
<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>

View File

@ -0,0 +1,57 @@
#include "stdafx.h"
#include "recordFrameCounter.h"
recordFrameCounter::recordFrameCounter(QWidget* parent)
: QWidget(parent)
{
m_stackedWidget = new QStackedWidget();
m_stackedWidget->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QLabel* titleLabel = new QLabel(QString::fromLocal8Bit("帧数: "));
titleLabel->setStyleSheet("color: white;");
layout->addWidget(titleLabel);
layout->addWidget(m_stackedWidget);
}
void recordFrameCounter::addCounter(QWidget* tabWidget)
{
QLabel* label = new QLabel("0");
label->setStyleSheet("color: white;");
label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
m_labelMap.insert(tabWidget, label);
m_stackedWidget->addWidget(label);
m_stackedWidget->setCurrentWidget(label);
}
void recordFrameCounter::removeCounter(QWidget* tabWidget)
{
auto it = m_labelMap.find(tabWidget);
if (it != m_labelMap.end())
{
QLabel* label = it.value();
m_stackedWidget->removeWidget(label);
delete label;
m_labelMap.erase(it);
}
}
void recordFrameCounter::switchTo(QWidget* tabWidget)
{
auto it = m_labelMap.find(tabWidget);
if (it != m_labelMap.end())
{
m_stackedWidget->setCurrentWidget(it.value());
}
}
void recordFrameCounter::updateFrameCount(QWidget* tabWidget, int frameCount)
{
auto it = m_labelMap.find(tabWidget);
if (it != m_labelMap.end())
{
it.value()->setText(QString::number(frameCount));
}
}

24
HPPA/recordFrameCounter.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
#include <QWidget>
#include <QStackedWidget>
#include <QLabel>
#include <QHBoxLayout>
#include <QMap>
class recordFrameCounter : public QWidget
{
Q_OBJECT
public:
explicit recordFrameCounter(QWidget* parent = nullptr);
void addCounter(QWidget* tabWidget);
void removeCounter(QWidget* tabWidget);
void switchTo(QWidget* tabWidget);
void updateFrameCount(QWidget* tabWidget, int frameCount);
private:
QStackedWidget* m_stackedWidget = nullptr;
QMap<QWidget*, QLabel*> m_labelMap;
};

View File

@ -2,13 +2,13 @@
// Microsoft Visual C++ <20><><EFBFBD>ɵİ<C9B5><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
// <20><> HPPA.rc ʹ<><CAB9>
//
#define IDI_ICON1 101
#define IDI_ICON1 106
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101