初步实现采集、图层和TOC联动
This commit is contained in:
@ -3,16 +3,21 @@
|
||||
|
||||
#include <exception>
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo> // 新增,用于解析路径
|
||||
|
||||
#include "HPPA.h"
|
||||
#include "ImageReaderWriter.h"
|
||||
|
||||
#include "RasterLayer.h"
|
||||
#include "LayerTreeLayerNode.h"
|
||||
|
||||
HPPA::HPPA(QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
// register MapLayer* metatype for queued signal/slot across threads
|
||||
qRegisterMetaType<MapLayer*>("MapLayer*");
|
||||
|
||||
QCoreApplication::setOrganizationName("IRIS");
|
||||
QCoreApplication::setOrganizationDomain("iris.com");
|
||||
QCoreApplication::setApplicationName("HPPA");
|
||||
@ -58,6 +63,7 @@ HPPA::HPPA(QWidget* parent)
|
||||
|
||||
|
||||
connect(this->ui.action_exit, SIGNAL(triggered()), this, SLOT(onExit()));
|
||||
connect(this->ui.mActionOpenImg, SIGNAL(triggered()), this, SLOT(onOpenImg()));
|
||||
|
||||
//ui.cam_label->setScaledContents(true);
|
||||
|
||||
@ -145,8 +151,8 @@ HPPA::HPPA(QWidget* parent)
|
||||
graphicsView_delete->setObjectName(QString::fromUtf8("graphicsView_delete"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidth());
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidth());
|
||||
graphicsView_delete->setSizePolicy(sizePolicy1);
|
||||
graphicsView_delete->setFrameShape(QFrame::NoFrame);
|
||||
graphicsView_delete->setFrameShadow(QFrame::Raised);
|
||||
@ -203,23 +209,27 @@ HPPA::HPPA(QWidget* parent)
|
||||
//gridLayout_toc->addWidget(treeWidget, 0, 0, 1, 1);
|
||||
|
||||
//3、正经TOC
|
||||
LayerTree* tree = new LayerTree();
|
||||
auto* model = new LayerTreeModel(tree, this, true);
|
||||
m_LayerTree = new LayerTree();
|
||||
m_LayerTreeModel = new LayerTreeModel(m_LayerTree, this, true);
|
||||
|
||||
//auto* g1 = model->addGroup(model->root(), "Group A");
|
||||
//model->addLayer(g1, "Roads");
|
||||
//model->addLayer(g1, "Buildings");
|
||||
// 创建并保留 Raster 分组指针,后续添加 layer 使用它
|
||||
m_RasterGroup = m_LayerTreeModel->addGroup(m_LayerTreeModel->root(), "Raster");
|
||||
{
|
||||
auto* ln1 = new LayerTreeLayerNode(nullptr);
|
||||
ln1->setName("tmp_image_1");
|
||||
m_LayerTreeModel->addLayer(m_RasterGroup, ln1);
|
||||
}
|
||||
{
|
||||
auto* ln2 = new LayerTreeLayerNode(nullptr);
|
||||
ln2->setName("tmp_image_2");
|
||||
m_LayerTreeModel->addLayer(m_RasterGroup, ln2);
|
||||
}
|
||||
|
||||
|
||||
auto* g1 = model->addGroup(model->root(), "Raster");
|
||||
model->addLayer(g1, "tmp_image_1");
|
||||
model->addLayer(g1, "tmp_image_2");
|
||||
|
||||
auto* g2 = model->addGroup(model->root(), "Vector");
|
||||
auto* g2 = m_LayerTreeModel->addGroup(m_LayerTreeModel->root(), "Vector");
|
||||
//model->addLayer(g2, "Rivers");
|
||||
|
||||
QTreeView* LayerTreeView = new QTreeView();
|
||||
LayerTreeView->setModel(model);
|
||||
LayerTreeView->setModel(m_LayerTreeModel);
|
||||
LayerTreeView->setHeaderHidden(true);
|
||||
LayerTreeView->setStyleSheet(R"(
|
||||
QTreeView
|
||||
@ -864,6 +874,7 @@ void HPPA::initPanelToolbar()
|
||||
mToolbarMenu->addAction(ui.mainToolBar->toggleViewAction());
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
void HPPA::createScenarioActionGroup()
|
||||
{
|
||||
m_ScenarioActionGroup = new QActionGroup(this);
|
||||
@ -1431,6 +1442,10 @@ void HPPA::onExit()
|
||||
this->close();
|
||||
}
|
||||
|
||||
void HPPA::onOpenImg()
|
||||
{
|
||||
}
|
||||
|
||||
void HPPA::onconnect()
|
||||
{
|
||||
if (m_Imager != nullptr)
|
||||
@ -1494,7 +1509,6 @@ void HPPA::onconnect()
|
||||
m_TestImagerStausThread = new WorkerThread(m_Imager);
|
||||
|
||||
|
||||
|
||||
connect(this->ui.action_auto_exposure, SIGNAL(triggered()), this, SLOT(onAutoExposure()));
|
||||
connect(this->ui.action_focus, SIGNAL(triggered()), this, SLOT(onFocus1()));
|
||||
connect(this, SIGNAL(StartFocusSignal()), m_Imager, SLOT(focus()));
|
||||
@ -1508,11 +1522,12 @@ void HPPA::onconnect()
|
||||
connect(m_Imager, SIGNAL(RecordWhiteFinishSignal()), this, SLOT(recordWhiteFinish()));
|
||||
connect(m_Imager, SIGNAL(RecordDarlFinishSignal()), this, SLOT(recordDarkFinish()));
|
||||
|
||||
// Connect LayerFileCreated from imager to HPPA slot
|
||||
connect(m_Imager, SIGNAL(LayerFileCreated(QString,QString,int)), this, SLOT(onLayerCreatedFromFile(QString,QString,int)));
|
||||
|
||||
connect(this->ui.actionOpenDirectory, SIGNAL(triggered()), this, SLOT(onActionOpenDirectory()));
|
||||
|
||||
|
||||
|
||||
|
||||
connect(this->ui.framerate_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnFramerateLineeditEditingFinished()));
|
||||
connect(this->ui.FramerateSlider, SIGNAL(valueChanged(double)), this, SLOT(OnFramerateSliderChanged(double)));
|
||||
connect(this->ui.integratioin_time_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnIntegratioinTimeEditingFinished()));
|
||||
@ -1571,6 +1586,26 @@ void HPPA::testImagerStatus()
|
||||
m_TestImagerStausThread->start();
|
||||
}
|
||||
|
||||
void HPPA::onImageFileSaved(QString path, int fileIndex)
|
||||
{
|
||||
// 该槽在 UI 线程中执行(Qt 会使用 queued connection),可以安全操作 model
|
||||
QFileInfo fi(path);
|
||||
QString base = fi.completeBaseName(); // 去掉路径与扩展名(例如 tmp_image_0)
|
||||
|
||||
// 将新的 layer 添加到 Raster 分组
|
||||
if (!m_LayerTreeModel || !m_RasterGroup) return;
|
||||
|
||||
// layer 名称可根据需要调整,这里用文件名作为图层名
|
||||
{
|
||||
auto* ln = new LayerTreeLayerNode(nullptr);
|
||||
ln->setName(base);
|
||||
m_LayerTreeModel->addLayer(m_RasterGroup, ln);
|
||||
}
|
||||
|
||||
// 可选:展开 TOC 或者做其他 UI 更新(目前不做动画,仅打印日志)
|
||||
qDebug() << "ImageFileSaved -> add layer:" << base << " index:" << fileIndex;
|
||||
}
|
||||
|
||||
void HPPA::onAutoExposure()
|
||||
{
|
||||
double ReturnedExposureTime = m_Imager->auto_exposure();
|
||||
@ -1868,3 +1903,20 @@ void WorkerThread3::run()
|
||||
|
||||
emit AutoFocusFinishedSignal();
|
||||
}
|
||||
|
||||
void HPPA::onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex)
|
||||
{
|
||||
if (!m_LayerTreeModel || !m_RasterGroup) return;
|
||||
|
||||
// Create MapLayer first and attach it to a LayerTreeLayerNode
|
||||
MapLayer* ml = new RasterLayer(baseName, filePath);
|
||||
auto* layerNode = new LayerTreeLayerNode(ml);
|
||||
|
||||
LayerTreeNode* node = m_LayerTreeModel->addLayer(m_RasterGroup, layerNode);
|
||||
LayerTreeLayerNode* lnode = dynamic_cast<LayerTreeLayerNode*>(node);
|
||||
if (!lnode) return;
|
||||
|
||||
// layerNode already holds the MapLayer pointer from constructor
|
||||
|
||||
qDebug() << "LayerFileCreated -> created layer:" << baseName << "path:" << filePath << "index:" << fileIndex;
|
||||
}
|
||||
|
||||
55
HPPA/HPPA.h
55
HPPA/HPPA.h
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
@ -53,10 +53,11 @@
|
||||
|
||||
#include "LayerTreeModel.h"
|
||||
#include "LayerTree.h"
|
||||
#include "MapLayer.h"
|
||||
|
||||
#define PI 3.1415926
|
||||
|
||||
QT_CHARTS_USE_NAMESPACE//QChartView ʹ<EFBFBD><EFBFBD> <20><>Ҫ<EFBFBD>Ӻ꣬ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||
QT_CHARTS_USE_NAMESPACE//QChartView 使用 需要加宏, 否则无法使用
|
||||
|
||||
class WorkerThread : public QThread
|
||||
{
|
||||
@ -83,11 +84,11 @@ public:
|
||||
// //double x = m_Imager->m_ResononImager.get_framerate();
|
||||
// int x = m_Imager->m_ResononImager.get_band_count();
|
||||
|
||||
// std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>slopeΪ<EFBFBD><EFBFBD>" << x << std::endl;
|
||||
// std::cout << "相机连接正常!slope为:" << x << std::endl;
|
||||
// }
|
||||
// catch (std::runtime_error *e)//CException *e
|
||||
// {
|
||||
// std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>" << e->what() << std::endl;
|
||||
// std::cout << "相机断开连接!" << e->what() << std::endl;
|
||||
// }
|
||||
// Sleep(1000);
|
||||
// }
|
||||
@ -142,9 +143,9 @@ class WidgetWithBackgroundPicture : public QWidget
|
||||
public:
|
||||
explicit WidgetWithBackgroundPicture(QWidget* parent = nullptr)
|
||||
: QWidget(parent),
|
||||
m_pixmap(".//icon//titile_bar_bgp.png") // ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>
|
||||
m_pixmap(".//icon//titile_bar_bgp.png") // 使用资源或绝对路径
|
||||
{
|
||||
// <EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><EFBFBD>С
|
||||
// 可选:设置初始大小
|
||||
resize(800, 600);
|
||||
}
|
||||
|
||||
@ -168,9 +169,9 @@ public:
|
||||
HPPA(QWidget *parent = Q_NULLPTR);
|
||||
~HPPA();
|
||||
|
||||
void CalculateIntegratioinTimeRange();//ͨ<EFBFBD><EFBFBD>֡<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䷶Χ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>slider<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
void CalculateIntegratioinTimeRange();//通过帧率计算积分时间范围,设置slider最大值
|
||||
|
||||
WorkerThread * m_TestImagerStausThread;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
WorkerThread * m_TestImagerStausThread;//检测相机连接状态的线程
|
||||
|
||||
private:
|
||||
Ui::HPPAClass ui;
|
||||
@ -192,11 +193,11 @@ private:
|
||||
|
||||
ImagerOperationBase* m_Imager;//
|
||||
|
||||
int m_RecordState;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>ȡ2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 <20><> <20><><EFBFBD>ڲɼ<DAB2><C9BC><EFBFBD>0 <20><> ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
int m_RecordState;//用来控制相机采集流程,取2的余数,1 → 正在采集,0 → 停止采集
|
||||
|
||||
QThread * m_RecordThread;//Ӱ<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
QThread * m_RgbCameraThread;//rgb<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡͼ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
QThread * m_CopyFileThread;//Ӱ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
QThread * m_RecordThread;//影像采集线程
|
||||
QThread * m_RgbCameraThread;//rgb相机获取图像线程
|
||||
QThread * m_CopyFileThread;//影像文件复制线程
|
||||
FileOperation * m_FileOperation;
|
||||
|
||||
QChartView * m_chartView;
|
||||
@ -205,18 +206,18 @@ private:
|
||||
//QLineSeries *series;
|
||||
//QChart *chart;
|
||||
|
||||
QString operateWidget;//<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀؼ<EFBFBD><EFBFBD><EFBFBD>
|
||||
QString operateWidget;//当前操作的控件名
|
||||
|
||||
//ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
||||
double widthScale;//QGraphicsView<EFBFBD><EFBFBD>viewport<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>widthScale = rect.width() / maxDistance;
|
||||
double heightScale;//QGraphicsView<EFBFBD><EFBFBD>viewport<EFBFBD>ߺ<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>heightScale = rect.height() / maxDistance;
|
||||
//模拟相机位置
|
||||
double widthScale;//QGraphicsView的viewport宽和真实距离比例:widthScale = rect.width() / maxDistance;
|
||||
double heightScale;//QGraphicsView的viewport高和真实距离比例:heightScale = rect.height() / maxDistance;
|
||||
void setImagerSimulationPos(double x, double y);//ui.graphicsView->imager->setPos(x, y);
|
||||
|
||||
//<EFBFBD>ɼ<EFBFBD><EFBFBD>߹滮
|
||||
int m_numberOfRecording;//<EFBFBD><EFBFBD>ʾui.recordLine_tableWidget<EFBFBD>еĵڼ<EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>ڲɼ<DAB2><C9BC>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD>
|
||||
//采集线规划
|
||||
int m_numberOfRecording;//表示ui.recordLine_tableWidget中的第几行 → 正在采集第几条线
|
||||
|
||||
//
|
||||
int m_TabWidgetCurrentIndex;//<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ѡ<EFBFBD><EFBFBD>TabWidget<EFBFBD>ı<EFBFBD>ǩʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>仯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>tab index
|
||||
int m_TabWidgetCurrentIndex;//当手动选择TabWidget的标签时,记录变化后的tab index
|
||||
RgbCameraOperation *m_RgbCamera;
|
||||
|
||||
void getRequest(QString str);
|
||||
@ -254,6 +255,9 @@ private:
|
||||
|
||||
View3DModelManager* m_view3DModelManager;
|
||||
|
||||
LayerTree* m_LayerTree = nullptr;
|
||||
LayerTreeModel* m_LayerTreeModel = nullptr;
|
||||
LayerTreeNode* m_RasterGroup = nullptr; // 指向 "Raster" 分组,便于后续添加 layer
|
||||
|
||||
public Q_SLOTS:
|
||||
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber);
|
||||
@ -263,8 +267,9 @@ public Q_SLOTS:
|
||||
void onsequenceComplete();
|
||||
|
||||
void onExit();
|
||||
void onconnect();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void testImagerStatus();//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
void onOpenImg();
|
||||
void onconnect();//连接相机
|
||||
void testImagerStatus();//获取相机状态:连接是否正常
|
||||
void onAutoExposure();
|
||||
void onFocus1();
|
||||
void onFocus2(int command);
|
||||
@ -286,7 +291,7 @@ public Q_SLOTS:
|
||||
void OnGainEditingFinished();//
|
||||
void OnGainSliderChanged(double Gain);//
|
||||
|
||||
void onLeftMouseButtonPressed(int x, int y);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void onLeftMouseButtonPressed(int x, int y);//点击影像像元显示光谱
|
||||
void setAxis(QValueAxis* axisX, QValueAxis* axisY);
|
||||
|
||||
|
||||
@ -309,6 +314,11 @@ public Q_SLOTS:
|
||||
void createPlantPhenotypeScenario();
|
||||
void onCreated3DModelPlantPhenotype();
|
||||
void onCreated3DModelOneMotor();
|
||||
|
||||
void onImageFileSaved(QString path, int fileIndex);
|
||||
|
||||
void onLayerCreatedFromFile(const QString& baseName, const QString& filePath, int fileIndex);
|
||||
|
||||
signals:
|
||||
void StartFocusSignal();
|
||||
void StartRecordSignal();
|
||||
@ -317,4 +327,3 @@ signals:
|
||||
void RecordWhiteSignal();
|
||||
void RecordDarlSignal();
|
||||
};
|
||||
|
||||
|
||||
@ -70,8 +70,7 @@ color:white;
|
||||
<property name="title">
|
||||
<string>文件</string>
|
||||
</property>
|
||||
<addaction name="action_9"/>
|
||||
<addaction name="action_10"/>
|
||||
<addaction name="mActionOpenImg"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_11"/>
|
||||
<addaction name="action_exit"/>
|
||||
@ -1024,7 +1023,7 @@ QPushButton:pressed
|
||||
<string>三脚架(旋转平台)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_9">
|
||||
<action name="mActionOpenImg">
|
||||
<property name="text">
|
||||
<string>打开影像</string>
|
||||
</property>
|
||||
|
||||
@ -14,16 +14,16 @@
|
||||
<ProjectGuid>{E7886664-B69E-4781-BCBE-804574FB4033}</ProjectGuid>
|
||||
<Keyword>QtVS_v304</Keyword>
|
||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -119,11 +119,13 @@
|
||||
<ClCompile Include="LayerTreeLayerNode.cpp" />
|
||||
<ClCompile Include="LayerTreeModel.cpp" />
|
||||
<ClCompile Include="LayerTreeNode.cpp" />
|
||||
<ClCompile Include="MapLayer.cpp" />
|
||||
<ClCompile Include="OneMotorControl.cpp" />
|
||||
<ClCompile Include="path_tc.cpp" />
|
||||
<ClCompile Include="PowerControl.cpp" />
|
||||
<ClCompile Include="QDoubleSlider.cpp" />
|
||||
<ClCompile Include="QMotorDoubleSlider.cpp" />
|
||||
<ClCompile Include="RasterLayer.cpp" />
|
||||
<ClCompile Include="resononImager.cpp" />
|
||||
<ClCompile Include="ResononNirImager.cpp" />
|
||||
<ClCompile Include="RgbCameraOperation.cpp" />
|
||||
@ -190,6 +192,8 @@
|
||||
<QtMoc Include="LayerTree.h" />
|
||||
<QtMoc Include="LayerTreeGroupNode.h" />
|
||||
<QtMoc Include="LayerTreeLayerNode.h" />
|
||||
<QtMoc Include="MapLayer.h" />
|
||||
<QtMoc Include="RasterLayer.h" />
|
||||
<ClInclude Include="utility_tc.h" />
|
||||
<QtMoc Include="aboutWindow.h" />
|
||||
<ClInclude Include="hppaConfigFile.h" />
|
||||
|
||||
@ -154,6 +154,12 @@
|
||||
<ClCompile Include="LayerTreeLayerNode.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MapLayer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RasterLayer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="fileOperation.h">
|
||||
@ -243,6 +249,12 @@
|
||||
<QtMoc Include="LayerTreeLayerNode.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="MapLayer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="RasterLayer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="imageProcessor.h">
|
||||
|
||||
@ -233,7 +233,15 @@ void ImagerOperationBase::start_record()
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// <20>ڿ<EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ<EFBFBD><CFA2>UI <20><><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD> MapLayer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
// prepare file name that will be used for saving
|
||||
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
||||
QString baseName = QString::fromStdString(removeFileExtension(m_FileName2Save2));
|
||||
QString filePath = QString::fromStdString(m_FileName2Save2);
|
||||
emit LayerFileCreated(baseName, filePath, m_FileSavedCounter);
|
||||
}
|
||||
|
||||
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
||||
|
||||
size_t x;
|
||||
@ -312,10 +320,15 @@ void ImagerOperationBase::start_record()
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//m_RgbImage
|
||||
emit PlotSignal(m_FileSavedCounter, -1);//<2F><>1<EFBFBD><31><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Է<EFBFBD><D4B7>ɼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<CAB5><C4B1><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ȫ<EFBFBD><C8AB>2<EFBFBD><32>ʹ<EFBFBD>û<EFBFBD>е<EFBFBD>۲ɼ<DBB2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ᵼ<EFBFBD><E1B5BC><EFBFBD>ϴβɼ<CEB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4>źŵ<C5BA><C5B5>õIJۺ<C4B2><DBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>˼<EFBFBD><CBBC>ݣ<EFBFBD>ע<EFBFBD>͵<EFBFBD>
|
||||
emit PlotSignal(m_FileSavedCounter, -1);
|
||||
|
||||
m_bRecordControlState = false;
|
||||
WriteHdr();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> ImageFileSaved <20>źţ<C5BA>֪ͨ UI <20><><EFBFBD>Ѹ<EFBFBD><D1B8>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// m_FileName2Save2 <20><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD> .bil <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "tmp_image_0.bil"<22><>
|
||||
emit ImageFileSaved(QString::fromStdString(m_FileName2Save2), m_FileSavedCounter);
|
||||
|
||||
m_FileSavedCounter++;
|
||||
|
||||
if (m_iFrameCounter >= m_iFrameNumber)
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
#include "ImagerOperationBase.h"
|
||||
#include "utility_tc.h"
|
||||
|
||||
class MapLayer; // forward declaration
|
||||
|
||||
class ImagerOperationBase :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -112,4 +114,10 @@ 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>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>.bil/.hdr<64><72>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>ɺ<C9BA><F3B7A2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳɼ<D3B2><C9BC>̷߳<DFB3><CCB7><EFBFBD><EFBFBD><EFBFBD>Qt <20><><EFBFBD><EFBFBD> queued connection<6F><6E>
|
||||
void ImageFileSaved(const QString& path, int fileIndex);
|
||||
|
||||
// <20>ģ<DEB8><C4A3><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD> MapLayer*<2A><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>UI <20>㸺<EFBFBD><EFBFBD> MapLayer <20><><EFBFBD><EFBFBD><F3B2A2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void LayerFileCreated(const QString& baseName, const QString& filePath, int fileIndex);
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "LayerTreeLayerNode.h"
|
||||
|
||||
LayerTreeLayerNode::LayerTreeLayerNode(const QString& name, QObject* parent)
|
||||
: LayerTreeNode(name, parent)
|
||||
LayerTreeLayerNode::LayerTreeLayerNode(MapLayer* layer, QObject* parent)
|
||||
: LayerTreeNode(layer ? layer->name() : QString(), parent), m_layer(layer)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1,15 +1,23 @@
|
||||
#pragma once
|
||||
#include "LayerTreeNode.h"
|
||||
#include "MapLayer.h"
|
||||
|
||||
/** Layer <20>ڵ<EFBFBD> */
|
||||
class LayerTreeLayerNode : public LayerTreeNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LayerTreeLayerNode(const QString& name,
|
||||
explicit LayerTreeLayerNode(MapLayer* layer,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
Type type() const override { return Type::Layer; }
|
||||
|
||||
// <20>Ժ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD>layerId / pointer / legendItems <20><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> MapLayer ָ<>루<EFBFBD><EBA3A8>ӵ<EFBFBD>У<EFBFBD>
|
||||
void setMapLayer(MapLayer* layer) { m_layer = layer; }
|
||||
MapLayer* mapLayer() const { return m_layer; }
|
||||
|
||||
private:
|
||||
MapLayer* m_layer = nullptr;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>layerId / pointer / legendItems <20><>
|
||||
};
|
||||
|
||||
@ -133,13 +133,14 @@ LayerTreeNode* LayerTreeModel::addGroup(LayerTreeNode* parent, const QString& na
|
||||
return g;
|
||||
}
|
||||
|
||||
LayerTreeNode* LayerTreeModel::addLayer(LayerTreeNode* parent, const QString& name, const QIcon& icon)
|
||||
LayerTreeNode* LayerTreeModel::addLayer(LayerTreeNode* parent, LayerTreeLayerNode* layerNode, const QIcon& icon)
|
||||
{
|
||||
if (!parent) parent = m_tree->root();
|
||||
if (!layerNode) return nullptr;
|
||||
|
||||
const int row = parent->childCount();
|
||||
beginInsertRows(indexFromNode(parent), row, row);
|
||||
LayerTreeNode* l = m_tree->insertNode(parent, row, new LayerTreeLayerNode(name));
|
||||
LayerTreeNode* l = m_tree->insertNode(parent, row, layerNode);
|
||||
endInsertRows();
|
||||
|
||||
return l;
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include "LayerTree.h"
|
||||
|
||||
class LayerTreeLayerNode; // forward declare
|
||||
|
||||
/**
|
||||
* LayerTreeModel<65><6C>Qt <20><><EFBFBD><EFBFBD><EFBFBD>㣨<EFBFBD><E3A3A8><EFBFBD>ٹ<EFBFBD><D9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* - 1 <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͼ<EFBFBD>꣩+ checkbox
|
||||
@ -32,7 +34,7 @@ public:
|
||||
LayerTreeNode* root() const;
|
||||
|
||||
LayerTreeNode* addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon = QIcon());
|
||||
LayerTreeNode* addLayer(LayerTreeNode* parent, const QString& name, const QIcon& icon = QIcon());
|
||||
LayerTreeNode* addLayer(LayerTreeNode* parent, LayerTreeLayerNode* layerNode, const QIcon& icon = QIcon());
|
||||
|
||||
void setCascadeCheckEnabled(bool enabled);
|
||||
bool cascadeCheckEnabled() const;
|
||||
|
||||
26
HPPA/MapLayer.cpp
Normal file
26
HPPA/MapLayer.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "MapLayer.h"
|
||||
|
||||
MapLayer::MapLayer(const QString& name, const QString& uri)
|
||||
: QObject(nullptr), m_name(name), m_uri(uri)
|
||||
{
|
||||
}
|
||||
|
||||
QString MapLayer::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void MapLayer::setName(const QString& n)
|
||||
{
|
||||
m_name = n;
|
||||
}
|
||||
|
||||
QString MapLayer::dataPath() const
|
||||
{
|
||||
return m_uri;
|
||||
}
|
||||
|
||||
void MapLayer::setDataPath(const QString& p)
|
||||
{
|
||||
m_uri = p;
|
||||
}
|
||||
28
HPPA/MapLayer.h
Normal file
28
HPPA/MapLayer.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QMetaType>
|
||||
|
||||
class MapLayer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum class LayerType { Raster, Vector };
|
||||
|
||||
explicit MapLayer(const QString& name, const QString& uri);
|
||||
|
||||
virtual ~MapLayer() override = default;
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString& n);
|
||||
|
||||
QString dataPath() const;
|
||||
void setDataPath(const QString& p);
|
||||
|
||||
virtual LayerType layerType() const = 0;
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_uri;
|
||||
};
|
||||
12
HPPA/RasterLayer.cpp
Normal file
12
HPPA/RasterLayer.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "RasterLayer.h"
|
||||
|
||||
RasterLayer::RasterLayer(const QString& name, const QString& uri)
|
||||
: MapLayer(name, uri)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MapLayer::LayerType RasterLayer::layerType() const
|
||||
{
|
||||
return MapLayer::LayerType::Raster;
|
||||
}
|
||||
14
HPPA/RasterLayer.h
Normal file
14
HPPA/RasterLayer.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "MapLayer.h"
|
||||
|
||||
class RasterLayer : public MapLayer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RasterLayer(const QString& name, const QString& uri);
|
||||
|
||||
LayerType layerType() const override;
|
||||
|
||||
// future: renderer, data provider, etc.
|
||||
};
|
||||
Reference in New Issue
Block a user