diff --git a/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.vcxproj b/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.vcxproj
deleted file mode 100644
index 70afc2d..0000000
--- a/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.vcxproj
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- {89CAC2D1-AF91-42BC-BDE1-2BC8C490CE7A}
- QtVS_v304
- 10.0
- 10.0
- $(MSBuildProjectDirectory)\QtMsBuild
-
-
-
- Application
- v143
- true
- Unicode
-
-
- Application
- v143
- false
- true
- Unicode
-
-
-
-
-
-
- qgis_qt5
- core;gui;widgets
- debug
-
-
- tools_qt5
- core;xml;gui;widgets
- release
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- D:\OSGeo4W\apps\qgis-dev\include;D:\OSGeo4W\include;$(IncludePath)
- D:\OSGeo4W\lib;D:\OSGeo4W\apps\qgis-dev\lib;$(ReferencePath)
- D:\OSGeo4W\lib;D:\OSGeo4W\apps\qgis-dev\lib;$(LibraryPath)
-
-
-
- qgis_core.lib;qgis_app.lib;qgis_gui.lib;%(AdditionalDependencies)
-
-
- _USE_MATH_DEFINES;_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;%(PreprocessorDefinitions)
- stdcpp17
-
-
-
-
- true
- Level3
- true
- true
-
-
- Windows
- true
-
-
-
-
- true
- Level3
- true
- true
- true
- true
-
-
- Windows
- false
- true
- true
-
-
-
-<<<<<<< HEAD
-
-=======
->>>>>>> bc199244a3370d5bb7d3f52d5c17e6e2c467f20a
-
-
-
-
-
-<<<<<<< HEAD
-
-
-
-=======
->>>>>>> bc199244a3370d5bb7d3f52d5c17e6e2c467f20a
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Manual-Label-Tool-Widget/ManualLabelToolWidget.cpp b/Manual-Label-Tool-Widget/ManualLabelToolWidget.cpp
deleted file mode 100644
index 77836a7..0000000
--- a/Manual-Label-Tool-Widget/ManualLabelToolWidget.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-#include "ManualLabelToolWidget.h"
-#include
-#include
-#include
-#include
-<<<<<<< HEAD
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-//QgsUnitTypes
-
-// ʲ
-#define RASTERFILEFILTER u8"ļ (*.*);;TIF (*.tif);;TIFF (*.tiff);;bin (*.bin);;dat (*.dat);;"
-
-
-=======
->>>>>>> bc199244a3370d5bb7d3f52d5c17e6e2c467f20a
-
-ManualLabelToolWidget::ManualLabelToolWidget(QWidget *parent)
- : QMainWindow(parent)
-{
- this->init_UI();
-
-}
-
-ManualLabelToolWidget::~ManualLabelToolWidget()
-{
-}
-
-void ManualLabelToolWidget::init_UI()
-{
-<<<<<<< HEAD
- this->setWindowTitle(tr(u8"AIע"));
- // ʼС
- {
- this->resize(1920,1080);
- }
-
- //ͼ
- {
- // 1. inti map canvas
- this->map_canvas = new QgsMapCanvas();
- this->setCentralWidget((this->map_canvas));
-
- // 2. map tool pan
- this->map_tool_pan = new QgsMapToolPan(this->map_canvas);
- this->map_canvas->setMapTool(this->map_tool_pan);
-
- // 3. map layer manager
- this->map_layerTreeView = new QgsLayerTreeView(this);
- // 4. create map model
- this->map_layerModel = new QgsLayerTreeModel(QgsProject::instance()->layerTreeRoot(), this);
- this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeRename); //
- this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeReorder); // ˳
- this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeChangeVisibility); // ıɼ
- this->map_layerModel->setFlag(QgsLayerTreeModel::ShowLegendAsTree); // ״ͼʾͼ
- this->map_layerModel->setAutoCollapseLegendNodes(10); // Զ۵ͼ
-
- this->map_layerTreeView->setModel(this->map_layerModel);
- // create bridge between mapcontrol and layer
- this->map_layer_Bridge = new QgsLayerTreeMapCanvasBridge(QgsProject::instance()->layerTreeRoot(), this->map_canvas, this);
-
-
- // layer
- // 1. һQDockWidgetͣڣͼͼ
- this->layerTreeDock = new QDockWidget(tr(u8"ͼ"), this);
- this->layerTreeDock->setWidget(this->map_layerTreeView);
-
- // 2. еͼͼ(m_layerTreeView)ΪͣڵIJ
- layerTreeDock->setWidget(this->map_layerTreeView);
-
- // 3. (ѡƼ)ͣͣ
- layerTreeDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-
- // 5. ͣӵڵ
- this->addDockWidget(Qt::LeftDockWidgetArea, this->layerTreeDock);
-
-
- }
-
- // ״̬
- {
- appStatusBar = this->statusBar(); // ȡ״̬
-
- scaleLabel = new QLabel(tr(u8"ߣ"));
- CoordinaryTextLabel = new QLabel(tr(u8"ϵ"));
- PointXYLabel = new QLabel(tr(u8"꣺"));
- UnitLabel = new QLabel(tr(u8"λ"));
- appStatusBar->addPermanentWidget(PointXYLabel); //
- appStatusBar->addPermanentWidget(scaleLabel); //
- appStatusBar->addPermanentWidget(UnitLabel); //
- appStatusBar->addPermanentWidget(CoordinaryTextLabel); //
-
- // ӱ߱仯ź
- connect(map_canvas, SIGNAL(scaleChanged(double)) , this, SLOT(updateScaleLabel(double)));
- connect(map_canvas, SIGNAL(xyCoordinates(const QgsPointXY&)), this, SLOT(updateCoordinateLabel(const QgsPointXY&)));
-
- connect(map_canvas, SIGNAL(extentsChanged()), this, SLOT(onMapExtentsChanged()));
-
-
- }
-
- // ˵
- {
- menubar = this->menuBar();
-
- // ڲ˵"ļ""༭"˵
- fileMenu = menubar->addMenu(tr(u8"ļ"));
-
-
- // "ļ"˵Ӳ˵QAction
- newAction = fileMenu->addAction(tr(u8"½"));
- fileMenu->addSeparator(); // ӷָ[1,5](@ref)
- openMenu = fileMenu->addMenu(tr(u8""));
-
- openRasterFolderAction = openMenu->addAction(tr(u8"Ӱļ"));
- openRasterAction = openMenu->addAction(tr(u8"Ӱ"));
- openSLCRasterAction = openMenu->addAction(tr(u8"SLCӰ"));
- editMenu = menubar->addMenu(tr(u8"༭"));
-
- // ¼
- QObject::connect(this->openRasterAction, SIGNAL(triggered()), this, SLOT(openRasterLayerTriggered()));
-
- }
-
- // AIע
- {
- AiLabelToolBar = new QToolBar(tr(u8"AIע"), this);
- this->addToolBar(Qt::LeftToolBarArea, AiLabelToolBar);
- }
-
-}
-
-void ManualLabelToolWidget::open()
-{
-}
-
-
-void ManualLabelToolWidget::openRasterLayerTriggered()
-{
- if (lastFileDialogPath.isEmpty()) {
- lastFileDialogPath = ".";
- }
- // Ӱ
- // 2. ѡļ
- QString rasterPath = QFileDialog::getOpenFileName(
- this,
- tr(u8"ѡӰļ"),
- lastFileDialogPath,
- tr(RASTERFILEFILTER)
- );
-
- lastFileDialogPath = rasterPath;
- // ȡ
- this->openRaster(rasterPath);
-}
-
-void ManualLabelToolWidget::openRaster(QString& filePath)
-{
- QString filename = QFileInfo(filePath).fileName();
-
- QgsRasterLayer* rasterLayer = new QgsRasterLayer(filePath, filename);
- if (!rasterLayer->isValid()) {
- qDebug() << "Failed to load raster layer!";
- //
- return;
- }
-
- QgsProject::instance()->addMapLayer(rasterLayer);
-
-}
-
-void ManualLabelToolWidget::updateCoordinateLabel(const QgsPointXY& point)
-{
- QString coordText = QString(tr(u8"꣺X:%1 Y:%2")).arg(QString::number(point.x(), 'f', 2)).arg(QString::number(point.y(), 'f', 2));
- PointXYLabel->setText(coordText);
-}
-
-void ManualLabelToolWidget::onMapExtentsChanged()
-{
- QgsRectangle currentExtent = map_canvas->extent();
-
- //// ʹΧϢˣ磺
- //// 1. ӡΧ
- //qDebug() << "·Χ - Xmin:" << currentExtent.xMinimum()
- // << "Ymin:" << currentExtent.yMinimum()
- // << "Xmax:" << currentExtent.xMaximum()
- // << "Ymax:" << currentExtent.yMaximum();
-}
-
-void ManualLabelToolWidget::onLayersChanged(QgsMapLayer* layer)
-{
-
- // WGSϵ
- QgsCoordinateReferenceSystem currentCrs = map_canvas->mapSettings().destinationCrs();
- // ȡϵϢ֤ʶ "WGS 84 / EPSG:4326"
- QString description = currentCrs.description();
- QString authid = currentCrs.authid();
-
-
- // ȡǰĿͼ
- QList layers = QgsProject::instance()->mapLayers().values();
- int layerCount = layers.size();
-
- // жϵǰǷһ
- if (layerCount == 0&&description == "") {
- QgsMapLayer* theOnlyLayer = layers.first();
-
- // ͼǷЧӵжϵ
- if (theOnlyLayer && theOnlyLayer->isValid() && theOnlyLayer->crs().isValid()) {
- // ͼĿϵΪͼһ
- map_canvas->mapSettings().setDestinationCrs(theOnlyLayer->crs());
- // ѡͼΧͼȫΧṩõijʼͼ
- map_canvas->setExtent(theOnlyLayer->extent());
- // ˢ»ʹЧ
- map_canvas->refresh();
- qDebug() << "ͼΪ1ͬϵ" << theOnlyLayer->crs().description();
- }
- }
-
-}
-
-void ManualLabelToolWidget::updateScaleLabel(double scale)
-{
- // ֵʽΪַ 1:10000
- QString scaleText = QString(tr(u8"ߣ1:%1")).arg(QString::number(scale, 'f', 0));
- scaleLabel->setText(scaleText);
-
- // ͬʱµλǩ
- Qgis::DistanceUnit unit = map_canvas->mapUnits();
- QString unitString;
- if (unit == Qgis::DistanceUnit::Meters) {
- unitString = tr(u8"");
- }
- else if (unit == Qgis::DistanceUnit::Degrees) {
- unitString = tr(u8"");
- }
- else if (unit == Qgis::DistanceUnit::Feet) {
- unitString = tr(u8"Ӣ");
- }
- else {
- unitString = tr(u8"δ֪");
- }
- UnitLabel->setText(QString(tr(u8"λ%1")).arg(unitString));
-
- // WGSϵ
- QgsCoordinateReferenceSystem currentCrs = map_canvas->mapSettings().destinationCrs();
- // ȡϵϢ֤ʶ "WGS 84 / EPSG:4326"
- QString description = currentCrs.description();
- QString authid = currentCrs.authid();
-
- if (description == "") {
- // ui->label_crs ʾϵϢQLabel
- CoordinaryTextLabel->setText(QString(tr(u8"ϵδ֪")));
- }
- else {
- // ui->label_crs ʾϵϢQLabel
- CoordinaryTextLabel->setText(QString(tr(u8"ϵ%1 (%2)")).arg(description).arg(authid));
- }
-
-
-}
-=======
- // 1. inti map canvas
- this->map_canvas = new QgsMapCanvas();
- this->setCentralWidget((this->map_canvas));
-
- // 2. map tool pan
- this->map_tool_pan = new QgsMapToolPan(this->map_canvas);
- this->map_canvas->setMapTool(this->map_tool_pan);
-
- // 3. map layer manager
- this->map_layerTreeView =new QgsLayerTreeView(this);
- // 4. create map model
- this->map_layerModel = new QgsLayerTreeModel(QgsProject::instance()->layerTreeRoot(), this);
- this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeRename); //
- this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeReorder); // ˳
- this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeChangeVisibility); // ıɼ
- this->map_layerModel->setFlag(QgsLayerTreeModel::ShowLegendAsTree); // ״ͼʾͼ
- this->map_layerModel->setAutoCollapseLegendNodes(10); // Զ۵ͼ
-
- this->map_layerTreeView->setModel(this->map_layerModel);
- // create bridge between mapcontrol and layer
- this->map_layer_Bridge = new QgsLayerTreeMapCanvasBridge(QgsProject::instance()->layerTreeRoot(), this->map_canvas, this);
-
-
- // layer
- // 1. һQDockWidgetͣڣͼͼ
- this->layerTreeDock =new QDockWidget(tr(u8"ͼ"), this);
- this->layerTreeDock->setWidget(this->map_layerTreeView);
-
- // 2. еͼͼ(m_layerTreeView)ΪͣڵIJ
- layerTreeDock->setWidget(this->map_layerTreeView);
-
- // 3. (ѡƼ)ͣͣ
- layerTreeDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-
-
-
- // 5. ͣӵڵ
- this->addDockWidget(Qt::LeftDockWidgetArea, this->layerTreeDock);
-
-
-
-
-}
-
->>>>>>> bc199244a3370d5bb7d3f52d5c17e6e2c467f20a
diff --git a/Manual-Label-Tool-Widget/ManualLabelToolWidget.h b/Manual-Label-Tool-Widget/ManualLabelToolWidget.h
deleted file mode 100644
index 671a43b..0000000
--- a/Manual-Label-Tool-Widget/ManualLabelToolWidget.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#pragma once
-
-#include
-<<<<<<< HEAD
-#include
-#include
-
-class QgsMapCanvas;
-class QgsMapToolPan;
-class QgsLayerTreeModel;
-class QgsLayerTreeView;
-class QgsLayerTreeMapCanvasBridge;
-class QDockWidget;
-class QLabel;
-class QStatusBar;
-class QMenuBar;
-class QToolBar;
-class QgsMapLayer;
-
-=======
-#include
-#include
-#include
-#include
-#include
-#include
->>>>>>> bc199244a3370d5bb7d3f52d5c17e6e2c467f20a
-
-class ManualLabelToolWidget : public QMainWindow
-{
- Q_OBJECT
-
-public:
- ManualLabelToolWidget(QWidget *parent = nullptr);
- ~ManualLabelToolWidget();
-
-<<<<<<< HEAD
-=======
-
-
->>>>>>> bc199244a3370d5bb7d3f52d5c17e6e2c467f20a
-private: // UI
- void init_UI();// Init UI
-
-private: //
- QgsMapCanvas* map_canvas=nullptr; // map widget
- QgsMapToolPan* map_tool_pan = nullptr; // map tool for pan zoom
-
- QgsLayerTreeModel* map_layerModel = nullptr;
- QgsLayerTreeView* map_layerTreeView = nullptr;
- QgsLayerTreeMapCanvasBridge* map_layer_Bridge = nullptr;
-
-private: //
- QDockWidget* layerTreeDock;
-<<<<<<< HEAD
-
- // ״̬
- QLabel* scaleLabel; //
- QLabel* CoordinaryTextLabel; // ͼϵ
- QLabel* PointXYLabel;// ָ
- QLabel* UnitLabel;
- QStatusBar* appStatusBar;// ״̬
-
-private: // ˵
- QMenuBar* menubar;
-
-private: // ͼ
- QToolBar* AiLabelToolBar;
-
-private: // ļ˵
- QMenu* fileMenu;
- QAction* newAction;
- QMenu* openMenu;
- QAction* openRasterFolderAction;
- QAction* openRasterAction;
- QAction* openSLCRasterAction;
-
-private:// ༭˵
- QMenu* editMenu;
-
-public slots:// ܺ
- void open();
- void openRasterLayerTriggered();
- void openRaster(QString &path);
-
-public slots: // ״̬
- void updateScaleLabel(double);
- void updateCoordinateLabel(const QgsPointXY&);
-
- void onMapExtentsChanged();
- void onLayersChanged(QgsMapLayer* layer);
-
-public: // ñ
- QString lastFileDialogPath;
-
-
-
-=======
->>>>>>> bc199244a3370d5bb7d3f52d5c17e6e2c467f20a
-
-
-};
-
diff --git a/Manual-Label-Tool-Widget/main.cpp b/Manual-Label-Tool-Widget/main.cpp
deleted file mode 100644
index e3b1a43..0000000
--- a/Manual-Label-Tool-Widget/main.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//#include "ManualLabelToolWidget.h"
-//#include
-//
-//int main(int argc, char *argv[])
-//{
-// QApplication app(argc, argv);
-// ManualLabelToolWidget window;
-// window.show();
-// return app.exec();
-//}
-#include
-#include
-
-#include
-#include
-#include
-#include "ManualLabelToolWidget.h"
-//(ͳƲ,ַַָָ)
-int main(int argc, char** argv)
-{
- //QApplicationҽһӦóĶ
- QApplication app(argc, argv);
- ManualLabelToolWidget labeltoolwidget;
- labeltoolwidget.show();
- //ȴû
- return app.exec();
-}
diff --git a/Manual-Labeling-Client/BaseCommonLibrary b/Manual-Labeling-Client/BaseCommonLibrary
index 1c1cbc3..1f5664c 160000
--- a/Manual-Labeling-Client/BaseCommonLibrary
+++ b/Manual-Labeling-Client/BaseCommonLibrary
@@ -1 +1 @@
-Subproject commit 1c1cbc3d7f3418f9e26d5a2892eace6a87e0c5e1
+Subproject commit 1f5664c3c340d2815dea05d04e542a50e15079f7
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/CustomCursorTool.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/CustomCursorTool.cpp
new file mode 100644
index 0000000..7ae4f37
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/CustomCursorTool.cpp
@@ -0,0 +1,50 @@
+// CustomCursorTool.cpp
+#include "CustomCursorTool.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "qgsmapmouseevent.h"
+#include "qgsmaptoolidentify.h"
+#include
+#include
+#include
+
+CustomCursorTool::CustomCursorTool(QgsMapCanvas* canvas)
+ : QgsMapToolIdentify(canvas)
+{
+ canvas->setCursor(Qt::CrossCursor);
+}
+
+void CustomCursorTool::canvasMoveEvent(QgsMapMouseEvent* e)
+{
+
+ if (!canvas()) return;
+ QgsPointXY pointxy= e->pos();
+ QList result;
+ QList allLayers = mCanvas->layers();
+ if (allLayers.count() == 0) {
+ return;
+ }
+ QList < QgsMapToolIdentify::IdentifyResult > rasterlayerresult=this->identify(e->x(), e->y(), IdentifyMode::ActiveLayer, allLayers,QgsMapToolIdentify::Type::RasterLayer);
+ QList < QgsMapToolIdentify::IdentifyResult > meshlayerresult=this->identify(e->x(), e->y(), IdentifyMode::ActiveLayer, allLayers, QgsMapToolIdentify::Type::MeshLayer);
+ for (int32_t i = 0; i < rasterlayerresult.count(); i++) {
+ result.append(rasterlayerresult[i]);
+ }
+ for (int32_t i = 0; i < meshlayerresult.count(); i++) {
+ result.append(meshlayerresult[i]);
+ }
+ if (result.count() > 0){
+ emit identifyResultChange(result);
+ }
+ else {
+
+ }
+ }
+
+
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/CustomCursorTool.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/CustomCursorTool.h
new file mode 100644
index 0000000..ab5df20
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/CustomCursorTool.h
@@ -0,0 +1,34 @@
+// CustomCursorTool.h
+#ifndef CUSTOMCURSORTOOL_H
+#define CUSTOMCURSORTOOL_H
+
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "qgsmaptoolidentify.h"
+
+class QgsMapMouseEvent;
+
+class CustomCursorTool : public QgsMapToolIdentify
+{
+ Q_OBJECT
+
+public:
+ explicit CustomCursorTool(QgsMapCanvas* canvas);
+ ~CustomCursorTool() override = default;
+
+signals:
+ void identifyResultChange(QList result);
+private :
+ void canvasMoveEvent(QgsMapMouseEvent* e) override; // ƶ¼
+
+};
+
+#endif // CUSTOMCURSORTOOL_H
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/LAMPDataManagerDialog.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LAMPDataManagerDialog.cpp
new file mode 100644
index 0000000..9810933
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LAMPDataManagerDialog.cpp
@@ -0,0 +1,281 @@
+#include "LAMPDataManagerDialog.h"
+#include
+#include
+#include
+#include
+#include
+#include "ManualLabelToolWidget.h"
+#include "WidgetSettingClass.h"
+#include
+#include
+#include "LampDataItem.h"
+#include "LampWindDataItem.h"
+#include
+
+LampDataManager::LampDataManager(ManualLabelToolWidget* InmainWidget, QWidget* parent)
+ : QDialog(parent),
+ mainWidget(InmainWidget)
+{
+ setupUI();
+ clearCurrentFile();
+ dataitems.clear();
+ this->setWindowTitle(u8"ݹ");
+ this->resize(500, 600);
+}
+
+LampDataManager::~LampDataManager()
+{
+
+}
+
+
+void LampDataManager::LoadRasterFile(QString RasterPath)
+{
+}
+
+
+void LampDataManager::showtreeWidgetBtnClicked()
+{
+ if (isShowTreeWidgetflag) {
+ //
+ this->datatreeWidget->setHidden(true);
+ isShowTreeWidgetflag = false;
+ showtreeWidgetBtn->setText(tr(u8"չб"));
+ }
+ else {
+ this->datatreeWidget->setHidden(false);
+ isShowTreeWidgetflag = true;
+ showtreeWidgetBtn->setText(tr(u8"б"));
+ }
+}
+
+void LampDataManager::showtextEditBtnClicked()
+{
+ if (isShowExtendWidgetflag) {
+ this->textEdit->setHidden(true);
+ isShowExtendWidgetflag = false;
+ showtextEditBtn->setText(tr(u8"չϸϢ"));
+ }
+ else {
+ this->textEdit->setHidden(false);
+ isShowExtendWidgetflag = true;
+ showtextEditBtn->setText(tr(u8"ϸϢ"));
+ }
+}
+
+void LampDataManager::openRasterFile()
+{
+ QString lastFileDialogPath = WidgetSettingClass::instance().getLastFileDialogPath();
+ if (lastFileDialogPath.isEmpty()) {
+ lastFileDialogPath = ".";
+ }
+ // Ӱ
+ // 2. ѡļ
+ QString lampwindPath = QFileDialog::getOpenFileName(
+ this,
+ tr(u8"ѡӰļ"),
+ lastFileDialogPath,
+ tr(LAMPWINDDATAFILEFILTER)
+ );
+ if (std::filesystem::exists(lampwindPath.toUtf8().constData())) {
+ WidgetSettingClass::instance().setLastFileDialogPath(lampwindPath);
+ this->openLampWindFile(lampwindPath);
+ }
+
+
+
+}
+void LampDataManager::openLampWindDataFile()
+{
+
+ QString lastFileDialogPath = WidgetSettingClass::instance().getLastFileDialogPath();
+ if (lastFileDialogPath.isEmpty()) {
+ lastFileDialogPath = ".";
+ }
+ // Ӱ
+ // 2. ѡļ
+ QString lampwindPath = QFileDialog::getOpenFileName(
+ this,
+ tr(u8"ѡ糡ļ"),
+ lastFileDialogPath,
+ tr(LAMPWINDDATAFILEFILTER)
+ );
+
+ if (std::filesystem::exists(lampwindPath.toUtf8().constData())) {
+ WidgetSettingClass::instance().setLastFileDialogPath(lampwindPath);
+ this->openLampWindFile(lampwindPath);
+ }
+}
+
+
+void LampDataManager::closeEvent(QCloseEvent* event)
+{
+ event->ignore();
+ this->hide();
+}
+
+void LampDataManager::reject()
+{
+ this->hide();
+}
+
+void LampDataManager::setupUI()
+{
+ // 4. ò - ǽɵԻĹؼ
+ QVBoxLayout* layout = new QVBoxLayout(this);
+ fileToolbar = new QToolBar(this);
+ showtreeWidgetBtn = new QPushButton(tr(u8"б"), this);
+ datatreeWidget = new QTreeWidget(this);
+ showtextEditBtn = new QPushButton(tr(u8"ϸϢ"), this);
+ textEdit = new QTextEdit(this);
+ layout->addWidget(fileToolbar); // ӵֶ
+ layout->addWidget(showtreeWidgetBtn); // ӵֶ
+ layout->addWidget(datatreeWidget); // ӵֶ
+ layout->addWidget(showtextEditBtn); // ӵֶ
+ layout->addWidget(textEdit); // ӵֶ
+ layout->setAlignment(Qt::AlignTop);
+ setLayout(layout);
+
+ isShowTreeWidgetflag = true;
+ isShowExtendWidgetflag = true;
+
+ datatreeWidget->setColumnCount(2); //
+ datatreeWidget->setHeaderLabels(QStringList() << u8"" << u8""); // б
+ datatreeWidget->setColumnWidth(0, 150);
+
+
+ LoadFileAction = fileToolbar->addAction(tr(u8""));
+ //openFileAction = fileToolbar->addAction(tr(u8""));
+ removeFileAction = fileToolbar->addAction(tr(u8"Ƴ"));
+ removeAllFileAction = fileToolbar->addAction(tr(u8"Ƴ"));
+
+
+ QObject::connect(this->showtreeWidgetBtn, SIGNAL(clicked()), this, SLOT(showtreeWidgetBtnClicked()));
+ QObject::connect(this->showtextEditBtn, SIGNAL(clicked()), this, SLOT(showtextEditBtnClicked()));
+ QObject::connect(this->removeFileAction, SIGNAL(triggered()), this, SLOT(removeNodeItem()));
+ QObject::connect(this->removeAllFileAction, SIGNAL(triggered()), this, SLOT(removeALLNodeItems()));
+ QObject::connect(this->LoadFileAction, SIGNAL(triggered()), this, SLOT(onShowData()));
+ QObject::connect(this->datatreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(oncurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
+
+
+
+}
+
+void LampDataManager::openLampWindFile(QString winddatapath)
+{
+ LampWindDataItem* item = new LampWindDataItem(this->datatreeWidget);
+ item->OpenFileData(winddatapath);
+ this->AddDataNode(item);
+}
+
+
+void LampDataManager::AddDataNode(LampDataItem* item)
+{
+ item->InitTreeNode();
+ this->dataitems.append(item);
+}
+
+
+void LampDataManager::oncurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous)
+{
+ QTreeWidgetItem* currentItem = datatreeWidget->currentItem();
+ if (currentItem == nullptr) return;
+
+ QTreeWidgetItem* rootnode = nullptr;
+
+ if (currentItem->parent() == nullptr) {
+ rootnode = currentItem;
+ }
+ else {
+ // ǰӽڵ
+ QTreeWidgetItem* parent = currentItem->parent();
+ rootnode = parent;
+ }
+
+ if (rootnode) {
+ LampDataItem* lampItem = static_cast(rootnode);
+ QString context = lampItem->getDescription();
+ this->textEdit->clear();
+ this->textEdit->setText(context);
+ }
+
+}
+
+
+void LampDataManager::removeNodeItem()
+{
+ QTreeWidgetItem* currentItem = datatreeWidget->currentItem();
+ if (currentItem == nullptr) return;
+
+ QTreeWidgetItem* rootnode = nullptr;
+
+ if (currentItem->parent() == nullptr) {
+ rootnode = currentItem;
+ }
+ else {
+ // ǰӽڵ
+ QTreeWidgetItem* parent = currentItem->parent();
+ rootnode = parent;
+ }
+
+ if (rootnode) {
+ LampDataItem* lampItem = static_cast(rootnode);
+ int32_t hashcode = lampItem->getHash();
+ for (int32_t i = 0; i < this->dataitems.count(); i++) {
+ if (this->dataitems[i]->getHash() == hashcode) {
+ this->dataitems.removeAt(i);
+ break;
+ }
+ }
+
+ int index = datatreeWidget->indexOfTopLevelItem(rootnode);
+ if (index >= 0) {
+ delete datatreeWidget->takeTopLevelItem(index);
+ }
+ }
+
+ this->textEdit->clear();
+
+}
+
+void LampDataManager::removeALLNodeItems()
+{
+ if (!datatreeWidget) return;
+
+ // ѭȡɾÿһڵ
+ while (datatreeWidget->topLevelItemCount() > 0) {
+ QTreeWidgetItem* item = datatreeWidget->takeTopLevelItem(0); // ȡ0ڵ
+ if (item) {
+ delete item; // ֶɾtakeTopLevelItemƳ
+ }
+ }
+
+ this->dataitems.clear();
+ this->textEdit->clear();
+}
+
+void LampDataManager::onShowData()
+{
+ // Ƿѡ
+ for (int32_t i = 0; i < datatreeWidget->topLevelItemCount(); i++) {
+ QTreeWidgetItem* item = datatreeWidget->topLevelItem(i);
+ LampDataItem* lampItem = static_cast(item);
+ lampItem->showData(mainWidget);
+ }
+}
+
+void LampDataManager::loadFile(const QString& filePath)
+{
+
+}
+
+void LampDataManager::clearCurrentFile()
+{
+
+}
+
+void LampDataManager::onLoadDataClicked()
+{
+
+}
+
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/LAMPDataManagerDialog.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LAMPDataManagerDialog.h
new file mode 100644
index 0000000..f530c2c
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LAMPDataManagerDialog.h
@@ -0,0 +1,109 @@
+#pragma once
+
+#include
+
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class ManualLabelToolWidget;
+class LampDataItem;
+class QTreeTreeWidgetItem;
+
+class LampDataManager : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit LampDataManager(ManualLabelToolWidget* mainWidget,QWidget* parent = nullptr);
+ ~LampDataManager();
+
+ void loadFile(const QString& filePath);
+ void clearCurrentFile();
+
+public slots:
+ void onLoadDataClicked();
+
+ void showtreeWidgetBtnClicked();
+ void showtextEditBtnClicked();
+ void openRasterFile();
+ void openLampWindDataFile();
+
+ // ڵز
+ void AddDataNode(LampDataItem* item);
+
+ //
+
+ void oncurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
+ void removeNodeItem();
+ void removeALLNodeItems();
+ void onShowData();
+
+
+public:
+ void openLampWindFile(QString winddatapath);
+ void LoadRasterFile(QString RasterPath);
+
+public:
+
+
+private:
+ void setupUI();
+
+
+
+signals:
+ void dataLoaded(const QString& filePath, int bandIndex, bool grayscale, bool newView);
+
+protected:
+ // дر¼
+ void closeEvent(QCloseEvent* event) override;
+ // дrejectۺӦEsc
+ void reject() override;
+
+private:
+ ManualLabelToolWidget* mainWidget;
+
+private:// UI Ԫ
+ QVBoxLayout* layout;
+ QToolBar* fileToolbar;
+ QPushButton* showtreeWidgetBtn;
+ QTreeWidget* datatreeWidget;
+ QPushButton* showtextEditBtn;
+ QTextEdit* textEdit;
+
+ bool isShowTreeWidgetflag;
+ bool isShowExtendWidgetflag;
+
+private://fileToolbar
+ //QAction* openFileAction;
+ QAction* removeFileAction;
+ QAction* removeAllFileAction;
+ QAction* LoadFileAction;
+ //QPushButton* LoadFileAction;
+
+
+private:// datatreeWidget
+ QList dataitems;
+
+
+
+};
+
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampDataItem.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampDataItem.cpp
new file mode 100644
index 0000000..c099397
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampDataItem.cpp
@@ -0,0 +1,41 @@
+#include "LampDataItem.h"
+
+LampDataItem::LampDataItem(QTreeWidget* IntreeWidget)
+ :QTreeWidgetItem(IntreeWidget)
+ , treeWidget(IntreeWidget)
+{
+
+}
+
+LampDataItem::~LampDataItem()
+{
+
+}
+
+void LampDataItem::showData(ManualLabelToolWidget* mainWidget)
+{
+}
+
+QString LampDataItem::getDescription()
+{
+ return u8"";
+}
+
+void LampDataItem::InitTreeNode()
+{
+
+}
+
+void LampDataItem::OpenFileData(QString path)
+{
+}
+int32_t LampDataItem::getHash()
+{
+ return hashCode;
+}
+void LampDataItem::setSelectItems(QList selectItemName)
+{
+
+
+
+}
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampDataItem.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampDataItem.h
new file mode 100644
index 0000000..900b08e
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampDataItem.h
@@ -0,0 +1,32 @@
+#pragma once
+#include
+#include
+#include
+#include
+
+class ManualLabelToolWidget;
+class LampDataItem : public QTreeWidgetItem
+{
+public:
+ // 캯
+ explicit LampDataItem(QTreeWidget* treeWidget = nullptr);
+ ~LampDataItem();
+
+public: //
+ virtual void InitTreeNode();
+ virtual void showData(ManualLabelToolWidget* mainWidget);
+ virtual QString getDescription();
+ virtual void setSelectItems(QList selectItemName);
+ virtual void OpenFileData(QString path);
+ virtual int32_t getHash();
+public:
+ QTreeWidget* treeWidget;
+ QString ItemType;
+ int32_t hashCode;
+};
+
+
+
+
+
+
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampWindDataItem.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampWindDataItem.cpp
new file mode 100644
index 0000000..fdf685d
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampWindDataItem.cpp
@@ -0,0 +1,230 @@
+#include
+#include "LampWindDataItem.h"
+#include "BaseTool.h"
+#include
+#include "ManualLabelToolWidget.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "WidgetSettingClass.h"
+#include "ImageOperatorBase.h"
+#include "Wind2ERANc.h"
+#include
+#include
+#include
+
+LampWindDataItem::LampWindDataItem(QTreeWidget* IntreeWidget)
+ :LampDataItem(IntreeWidget)
+{
+ timeArr.clear();
+ Filename.clear();
+ Filepath.clear();
+ time_filepath.clear();
+ selectItems.clear();
+ this->treeWidget = IntreeWidget;
+ this->ItemType = u8"LampWind";
+}
+
+LampWindDataItem::~LampWindDataItem()
+{
+
+}
+
+void LampWindDataItem::InitTreeNode()
+{
+ // 创建根节点,子节点,父窗体: QTreeWidget* treeWidget;
+ // 其中要求子节点选中的时候,需要能够知道根节点的文本
+
+ this->setText(0, this->Filename);
+ this->setText(1, u8"WindData");
+ this->setCheckState(0, Qt::Unchecked);
+ // 添加子节点
+ for (const auto& key : timeArr.keys()) {
+ QTreeWidgetItem* childItem1 = new QTreeWidgetItem(this); // 指定父节点为rootItem
+ childItem1->setText(0, key);
+ childItem1->setText(1, "");
+ childItem1->setCheckState(0, Qt::Unchecked); // 在第一列添加复选框 [3](@ref)
+ }
+ //treeWidget->expandAll();
+
+}
+
+void LampWindDataItem::showData(ManualLabelToolWidget* mainWidget)
+{
+ // 获取当前节点的setCheckState
+ if (this->checkState(0) == Qt::Checked) {
+ for (int32_t i = 0; i < this->childCount(); i++) {
+ int32_t tid = timeArr[this->child(i)->text(0)];
+ this->ShowWindData(mainWidget, tid, this->child(i)->text(0));
+ }
+ }
+ else {
+ for (int32_t i = 0; i < this->childCount(); i++) {
+ if (this->child(i)->checkState(0) == Qt::Checked) {
+ int32_t tid = timeArr[this->child(i)->text(0)];
+ this->ShowWindData(mainWidget, tid, this->child(i)->text(0));
+ }
+ }
+ }
+}
+
+QString LampWindDataItem::getDescription()
+{
+ QString starttimestr = Timenanosecond2timeStr(info.firstTimestamp);
+ QString endtimestr = Timenanosecond2timeStr(info.lastTimestamp);
+
+ return QString(u8"FilePath: %1\nFileName: %2\nHeight:%3 \nWidth:%4 \nNum:%5, \nfirstTs:%6, \nlastTs:%7, \nminLon:%8, \nmaxLon:%9, \nminLat:%10, \nmaxLat:%11, \nESPG:%12, \nTransX:%13, %14, %15, \nTransY:%15, %16, %17, \nSize:%18 \n")
+ .arg(this->Filepath).arg(this->Filename)
+ .arg(info.Height).arg(info.Width).arg(info.Num)
+ .arg(starttimestr).arg(endtimestr)
+ .arg(info.minLon).arg(info.maxLon).arg(info.minLat).arg(info.maxLat)
+ .arg(info.ESPGCODE)
+ .arg(info.T11).arg(info.T12).arg(info.T13)
+ .arg(info.T21).arg(info.T22).arg(info.T23)
+ .arg(info.fileSize);
+}
+
+void LampWindDataItem::setSelectItems(QList selectItemName)
+{
+
+
+
+}
+
+void LampWindDataItem::OpenFileData(QString path)
+{
+ // 读取数据
+ this->info = getDataFileInfo(path.toUtf8().constData());
+ int64_t* timeArr = new int64_t[this->info.Num];
+
+ QString ncfilename = QFileInfo(path).completeBaseName();
+ QProgressDialog* progressDialog = new QProgressDialog(this->treeWidget);
+ progressDialog->setWindowTitle( (u8"请稍候")); // 设置对话框标题
+ progressDialog->setLabelText( (u8"正在处理中...")); // 设置说明文字
+ progressDialog->resize(150, 50);
+
+
+ // 生成缓存文件地址
+ FileCacheFolderPath = WidgetSettingClass::instance().getTempFolder() + "\\"+ ncfilename;
+ QDir dir;
+ dir.mkpath(FileCacheFolderPath);
+ ERA5NetCDFConverter cover;
+ if (get_WindDataFileTimeArr(path.toUtf8().constData(), this->info, timeArr) == 0) {
+ this->timeArr.clear();
+ progressDialog->setRange(0, this->info.Num); // 设置进度范围,例如从0到100 [3,4](@ref)
+ for (int64_t i = 0; i < this->info.Num; i++) {
+ QString timeflag = Timenanosecond2timeStr(timeArr[i]);
+ QString timefilename= QString(u8"\\mesh_wind_%1.nc").arg(timeflag.replace(":", "").replace(".", "M"));
+
+ QString temppath = FileCacheFolderPath + "\\" + timefilename;
+ time_filepath.insert(i, temppath);
+ cover.convert_to_era5_netcdf(
+ path.toUtf8().constData(),
+ temppath.toUtf8().constData(),
+ i
+ );
+
+ this->timeArr.insert(QString(u8"%1").arg(timeflag),i);
+ if (i % 30 == 0) {
+ progressDialog->setValue(i);
+ progressDialog->show();
+ }
+
+ }
+ }else{}
+
+ this->hashCode = pathToHashCode_Qt(path);
+
+ this->Filepath = path;
+ this->Filename=QFileInfo(path).fileName();
+ progressDialog->close();
+ delArrPtr(timeArr);
+}
+
+
+
+void LampWindDataItem::ShowWindData(ManualLabelToolWidget* mainWidget, int64_t tid, QString timeStr)
+{
+ // 创建缓存文件
+ //QString temppath = WidgetSettingClass::instance().getTempFolder() + QString(u8"\\mesh_wind_%1.nc").arg(timeStr.replace(":", "").replace(".", "M"));
+
+ QgsMapCanvas* map_canvas = mainWidget->map_canvas; // 地图
+ QString url = time_filepath[tid];
+ QgsMeshLayer* meshLayer = new QgsMeshLayer(url, timeStr, "mdal");
+ //qDebug() << temppath;
+ QString EPSGStr = QString(u8"EPSG:%1").arg(info.ESPGCODE);
+ // 获取数据提供者
+ QgsMeshDataProvider* dp = meshLayer->dataProvider();
+ if (!dp) {
+ qDebug() << "Failed to get data provider!";
+ return;
+ }
+ meshLayer->setCrs(QgsCoordinateReferenceSystem(EPSGStr));
+ // 获取数据集组数量
+ int gprCount = dp->datasetGroupCount();
+ int targetVectorIndex = -1; // 初始化为-1,表示未找到
+
+ // 遍历所有数据集组,寻找第一个矢量数据集
+ for (int i = 0; i < gprCount; ++i) {
+ QgsMeshDatasetIndex index(i, 0); // 组索引i,时间步0
+ QgsMeshDatasetGroupMetadata meta = dp->datasetGroupMetadata(index);
+
+ bool isVector = meta.isVector();
+ QString name = meta.name();
+
+ if (isVector) {
+ targetVectorIndex = i;
+ break;
+ }
+ }
+
+ // 如果找到了矢量数据集组
+ if (targetVectorIndex != -1) {
+ // 获取当前的渲染器设置
+ QgsMeshRendererSettings s = meshLayer->rendererSettings();
+
+ // 设置激活的矢量数据集组和标量数据集组
+ s.setActiveVectorDatasetGroup(targetVectorIndex);
+ s.setActiveScalarDatasetGroup(targetVectorIndex);
+
+ // 将修改后的设置应用回图层
+ meshLayer->setRendererSettings(s);
+
+ qDebug() << "Successfully set active dataset group to index:" << targetVectorIndex;
+ }
+ else {
+ qDebug() << "No vector dataset group found!";
+ }
+
+ mainWidget->AddLayers(meshLayer);
+
+ map_canvas->setExtent(meshLayer->extent());
+ map_canvas->refresh();
+
+
+
+
+}
+
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampWindDataItem.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampWindDataItem.h
new file mode 100644
index 0000000..7c290e5
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/LampWindDataItem.h
@@ -0,0 +1,38 @@
+#pragma once
+#include "LampDataItem.h"
+#include
+#include
+#include
+#include "WindDataFileOperator.h"
+// 糡ļItem
+
+class QgsMeshLayer;
+class QgsVectorLayer;
+class QgsSymbol;
+class QgsMapCanvas;
+
+class LampWindDataItem:public LampDataItem
+{
+public:
+ // ʼ
+ LampWindDataItem(QTreeWidget* treeWidget);
+ ~LampWindDataItem();
+public: //
+ void InitTreeNode() override;
+ void showData(ManualLabelToolWidget* mainWidget) override;
+ QString getDescription() override;
+ void setSelectItems(QList selectItemName) override;
+ void OpenFileData(QString path) override;
+
+public:
+ void ShowWindData(ManualLabelToolWidget* mainWidget, int64_t tid,QString timeStr);
+
+ public:
+ QString Filename;
+ QString Filepath;
+ DataFileInfo info;
+ QMap timeArr;
+ QMap time_filepath;
+ QList selectItems;
+ QString FileCacheFolderPath;
+};
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.rc b/Manual-Labeling-Client/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.rc
new file mode 100644
index 0000000..16ed57b
Binary files /dev/null and b/Manual-Labeling-Client/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.rc differ
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.vcxproj.filters b/Manual-Labeling-Client/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.vcxproj.filters
new file mode 100644
index 0000000..94b54f2
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/Manual-Label-Tool-Widget.vcxproj.filters
@@ -0,0 +1,148 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
+ ui
+
+
+ {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}
+ ts
+
+
+ {52e7c8b2-7a19-4ead-9f28-ef550a98ee93}
+
+
+ {c712db7e-8172-42c7-ac70-bdf85c9c9d8a}
+
+
+ {2192b24d-785f-4815-a5fd-d0a4e96e11da}
+
+
+ {1ba868a3-5a19-4e4a-a422-0a3fc9672258}
+
+
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ ImageTools
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ datamanager
+
+
+ datamanager
+
+
+ datamanager
+
+
+ ManualLabelToolWidget
+
+
+ Source Files
+
+
+ Source Files
+
+
+ ImageTools
+
+
+ ImageTools
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ datamanager
+
+
+ datamanager
+
+
+ Header Files
+
+
+
+
+ ImageTools
+
+
+ Header Files
+
+
+ Header Files
+
+
+ datamanager
+
+
+ ManualLabelToolWidget
+
+
+ Header Files
+
+
+ Header Files
+
+
+ ImageTools
+
+
+ ImageTools
+
+
+
+
+ Form Files
+
+
+ Form Files
+
+
+
+
+ Resource Files
+
+
+
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.cpp
new file mode 100644
index 0000000..745229e
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.cpp
@@ -0,0 +1,472 @@
+#include "ManualLabelToolWidget.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "WidgetSettingClass.h"
+#include "LAMPDataManagerDialog.h"
+#include
+#include
+//#include
+#include
+#include
+#include "QBatchStaticEchoDialog.h"
+#include "QImageCursorWidget.h"
+#include
+#include
+#include
+#include "CustomCursorTool.h"
+#include "qgslayerpropertiesdialog.h"
+#include "windLayerTreeViewMenuProvider.h"
+//QgsUnitTypes
+
+
+ManualLabelToolWidget::ManualLabelToolWidget(QWidget* parent)
+ : QMainWindow(parent)
+{
+ this->init_UI();
+
+}
+
+ManualLabelToolWidget::~ManualLabelToolWidget()
+{
+}
+
+void ManualLabelToolWidget::init_UI()
+{
+ // ʼС
+ {
+ this->setWindowTitle(tr(u8"ܷ"));
+ // ȡĻĿ
+ QRect availableGeometry = QApplication::primaryScreen()->availableGeometry();
+
+ // ĴڴСĻ80%
+ int width = availableGeometry.width() * 0.8;
+ int height = availableGeometry.height() * 0.8;
+
+ // ڴС
+ resize(width, height);
+
+ // ѡƶĻ
+ move(availableGeometry.center() - rect().center());
+
+
+ }
+
+ {
+ datamanagerDialog = new LampDataManager(this);
+ onshowDatamanagerActionTriggered();
+ }
+
+ //ͼ
+ {
+ // 1. inti map canvas
+ this->map_canvas = new QgsMapCanvas(this);
+ this->setCentralWidget((this->map_canvas));
+
+ // 2. map tool pan
+ this->map_tool_pan = new QgsMapToolPan(this->map_canvas);
+ this->map_canvas->setMapTool(this->map_tool_pan);
+ // ؼȾ
+ map_canvas->setCachingEnabled(true); // û棬ʵַֿЧĹؼ[citation:6][citation:8]
+ map_canvas->setParallelRenderingEnabled(true); // òȾ[citation:6]
+ // 3. map layer manager
+ this->map_layerTreeView = new QgsLayerTreeView(this);
+ // 4. create map model
+ this->map_layerModel = new QgsLayerTreeModel(QgsProject::instance()->layerTreeRoot(), this);
+ this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeRename); //
+ this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeReorder); // ˳
+ this->map_layerModel->setFlag(QgsLayerTreeModel::AllowNodeChangeVisibility); // ıɼ
+ this->map_layerModel->setFlag(QgsLayerTreeModel::ShowLegendAsTree); // ״ͼʾͼ
+ this->map_layerModel->setAutoCollapseLegendNodes(10); // Զ۵ͼ
+
+ this->map_layerTreeView->setModel(this->map_layerModel);
+ this->map_layer_Bridge = new QgsLayerTreeMapCanvasBridge(QgsProject::instance()->layerTreeRoot(), this->map_canvas, this);
+ this->layerTreeDock = new QDockWidget(tr(u8"ͼ"), this);
+ this->layerTreeDock->setWidget(this->map_layerTreeView);
+ layerTreeDock->setWidget(this->map_layerTreeView);
+ layerTreeDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+ this->addDockWidget(Qt::LeftDockWidgetArea, this->layerTreeDock);
+
+ windLayerTreeViewMenuProvider* mLayerTreeViewMenuProvider = new windLayerTreeViewMenuProvider(map_layerTreeView, map_canvas, this);
+
+ this->map_layerTreeView->setMenuProvider(mLayerTreeViewMenuProvider);
+
+
+ }
+
+ // ״̬
+ {
+ appStatusBar = this->statusBar(); // ȡ״̬
+
+ scaleLabel = new QLabel(tr(u8"ߣ"));
+ CoordinaryTextLabel = new QLabel(tr(u8"ϵ"));
+ PointXYLabel = new QLabel(tr(u8"꣺"));
+ UnitLabel = new QLabel(tr(u8"λ"));
+ appStatusBar->addPermanentWidget(PointXYLabel); //
+ appStatusBar->addPermanentWidget(scaleLabel); //
+ appStatusBar->addPermanentWidget(UnitLabel); //
+ appStatusBar->addPermanentWidget(CoordinaryTextLabel); //
+
+ // ӱ߱仯ź
+ connect(map_canvas, SIGNAL(scaleChanged(double)), this, SLOT(updateScaleLabel(double)));
+ connect(map_canvas, SIGNAL(xyCoordinates(const QgsPointXY&)), this, SLOT(updateCoordinateLabel(const QgsPointXY&)));
+ connect(map_canvas, SIGNAL(extentsChanged()), this, SLOT(onMapExtentsChanged()));
+
+
+ }
+
+ // ˵
+ {
+ menubar = this->menuBar();
+
+ // ڲ˵"ļ""༭"˵
+ fileMenu = menubar->addMenu(tr(u8"ļ"));
+
+
+ // "ļ"˵Ӳ˵QAction
+ newAction = fileMenu->addAction(tr(u8"½"));
+ fileMenu->addSeparator(); // ӷָ[1,5](@ref)
+ openMenu = fileMenu->addMenu(tr(u8""));
+
+ openRasterFolderAction = openMenu->addAction(tr(u8"Ӱļ"));
+ openRasterAction = openMenu->addAction(tr(u8"Ӱ"));
+ openSLCRasterAction = openMenu->addAction(tr(u8"SLCӰ"));
+ openLampWindDataAction = openMenu->addAction(tr(u8"糡"));
+
+ // ¼
+ QObject::connect(this->openRasterAction, SIGNAL(triggered()), this, SLOT(openRaster()));
+ QObject::connect(this->openLampWindDataAction, SIGNAL(triggered()), this->datamanagerDialog, SLOT(openLampWindDataFile()));
+
+
+
+ editMenu = menubar->addMenu(tr(u8"༭"));
+ SARWindInversionMenu = menubar->addMenu(tr(u8"SAR糡"));
+ SARImageImportAction = SARWindInversionMenu->addAction(tr(u8"SARݵ"));
+ SARInversionAtion = SARWindInversionMenu->addAction(tr(u8"SAR糡"));
+ SARInversionResulutShowAtion = SARWindInversionMenu->addAction(tr(u8"糡ݽչʾ"));
+
+ //SARWindAysysMenu = SARWindInversionMenu->addMenu(tr(u8"糡"));
+ //SARImageAysysAction = SARWindAysysMenu->addAction(tr(u8"Ŀʱз"));
+ QObject::connect(SARInversionAtion, SIGNAL(triggered()), this, SLOT(onshowSARInversionAtionTriggered()));
+
+ }
+
+ // ͼ
+ {
+ datatoolbar = new QToolBar(tr(u8""));
+ showDatamanagerAction = datatoolbar->addAction(tr(u8"ݹ"));
+
+
+ mapToolActionGroup = new QActionGroup(this);
+ ZoomInToolbtn = new QAction(tr(u8"Ŵ"));
+ ZoomInToolbtn->setCheckable(true);
+ mapToolActionGroup->addAction(ZoomInToolbtn);
+ ZoomOutToolbtn = new QAction(tr(u8"С"));
+ ZoomOutToolbtn->setCheckable(true);
+ mapToolActionGroup->addAction(ZoomOutToolbtn);
+ MapPanToolbtn = new QAction(tr(u8"ƽ"));
+ MapPanToolbtn->setCheckable(true);
+ MapPanToolbtn->setChecked(true);
+ mapToolActionGroup->addAction(MapPanToolbtn);
+ IdentifyToolbtn = new QAction(tr(u8"ʶ"));
+ IdentifyToolbtn->setCheckable(true);
+ mapToolActionGroup->addAction(IdentifyToolbtn);
+ cursorAction = new QAction(tr(u8"α"));
+ cursorAction->setCheckable(true);
+ mapToolActionGroup->addAction(cursorAction);
+
+ datatoolbar->addAction(ZoomInToolbtn);
+ datatoolbar->addAction(ZoomOutToolbtn);
+ datatoolbar->addAction(MapPanToolbtn);
+ datatoolbar->addAction(cursorAction);
+
+
+ m_mapToolPan = new QgsMapToolPan(this->map_canvas);
+ m_mapToolZoomIn = new QgsMapToolZoom(this->map_canvas, false);
+ m_mapToolZoomOut = new QgsMapToolZoom(this->map_canvas, true);
+ m_mapIdentifyToolPan = new QgsMapToolIdentify(this->map_canvas);
+ m_CustomCursorTool = new CustomCursorTool(this->map_canvas);
+ ZoomInToolbtn->setText(u8"Ŵ");
+ ZoomOutToolbtn->setText(u8"С");
+ MapPanToolbtn->setText(u8"ƽ");
+ IdentifyToolbtn->setText(u8"ʶ");
+ connect(mapToolActionGroup, &QActionGroup::triggered, this, &ManualLabelToolWidget::onMapToolActionTriggered);
+
+ //QObject::connect(cursorAction, SIGNAL(triggered()), this, SLOT(onCursorImageToolTriggered()));
+ QObject::connect(showDatamanagerAction, SIGNAL(triggered()), this, SLOT(onshowDatamanagerActionTriggered()));
+
+
+ this->addToolBar(Qt::TopToolBarArea, datatoolbar);
+ }
+
+
+ // AIע
+ {
+ AiLabelToolBar = new QToolBar(tr(u8"AIע"), this);
+ this->addToolBar(Qt::LeftToolBarArea, AiLabelToolBar);
+ }
+
+
+ //
+ {
+ QString qgisPrefixPath = WidgetSettingClass::instance().getExeDirectionApplicationPath();
+ // 3. ʽòĿ¼ȷQGISҵ̬ṩ
+ QString pluginPath = qgisPrefixPath + "/plugins";
+ QgsApplication::setPluginPath(pluginPath);
+
+ // 4. QGISĹĿ¼proj.dbȣ
+ QString pkgDataPath = qgisPrefixPath + "/share/qgis";
+ QgsApplication::setPkgDataPath(pkgDataPath);
+ QgsApplication::initQgis();
+
+ QStringList providers = QgsProviderRegistry::instance()->providerList();
+ qDebug() << u8"עṩ:" << providers;
+
+ // "mesh_memory" ص "mdal" ṩǷ
+ if (providers.contains("mesh_memory")) {
+ qDebug() << u8"'mesh_memory' ṩ߿á";
+ }
+ else {
+ qDebug() << u8"棺δҵصṩߡ";
+ }
+ if (providers.contains("mdal")) {
+ qDebug() << u8"'mdal' ṩ߿ãܰ 'mdal' С";
+ }
+ else {
+ qDebug() << u8"棺δҵصṩߡ";
+ }
+ }
+}
+
+void ManualLabelToolWidget::open()
+{
+
+}
+
+
+void ManualLabelToolWidget::openRaster()
+{
+
+
+ QString lastFileDialogPath = WidgetSettingClass::instance().getLastFileDialogPath();
+ if (lastFileDialogPath.isEmpty()) {
+ lastFileDialogPath = ".";
+ }
+ // Ӱ
+ // 2. ѡļ
+ QString lampwindPath = QFileDialog::getOpenFileName(
+ this,
+ tr(u8"ѡӰļ"),
+ lastFileDialogPath,
+ tr(LAMPWINDDATAFILEFILTER)
+ );
+
+ QString filename = QFileInfo(lampwindPath).fileName();
+
+ QgsRasterLayer* rasterLayer = new QgsRasterLayer(lampwindPath, filename);
+ if (!rasterLayer->isValid()) {
+ qDebug() << "Failed to load raster layer!";
+ //
+ return;
+ }
+
+ this->AddLayers(rasterLayer);
+
+}
+
+void ManualLabelToolWidget::updateCoordinateLabel(const QgsPointXY& point)
+{
+ QString coordText = QString(tr(u8"꣺X:%1 Y:%2")).arg(QString::number(point.x(), 'f', 2)).arg(QString::number(point.y(), 'f', 2));
+ PointXYLabel->setText(coordText);
+}
+
+void ManualLabelToolWidget::onMapExtentsChanged()
+{
+ QgsRectangle currentExtent = map_canvas->extent();
+
+ //// ʹΧϢˣ磺
+ //// 1. ӡΧ
+ //qDebug() << "·Χ - Xmin:" << currentExtent.xMinimum()
+ // << "Ymin:" << currentExtent.yMinimum()
+ // << "Xmax:" << currentExtent.xMaximum()
+ // << "Ymax:" << currentExtent.yMaximum();
+}
+
+
+void ManualLabelToolWidget::AddLayers(QgsMapLayer* layer)
+{
+ if (!layer || !layer->isValid()) {
+ qDebug() << "Чͼ㣬ӣ";
+ return;
+ }
+
+ if (QgsProject::instance()->mapLayers().size() == 0) {
+ // ͼǷЧӵжϵ
+ if (layer && layer->isValid() && layer->crs().isValid()) {
+ // ͼĿϵΪͼһ
+ map_canvas->mapSettings().setDestinationCrs(layer->crs());
+ // ѡͼΧͼȫΧṩõijʼͼ
+ map_canvas->setExtent(layer->extent());
+ // ˢ»ʹЧ
+ map_canvas->refresh();
+ qDebug() << "ͼΪ1ͬϵ" << layer->crs().description();
+ }
+ }
+
+ QgsProject::instance()->addMapLayer(layer);
+
+}
+
+void ManualLabelToolWidget::updateScaleLabel(double scale)
+{
+ QString scaleText = QString(tr(u8"ߣ1:%1")).arg(QString::number(scale, 'f', 0));
+ scaleLabel->setText(scaleText);
+
+ Qgis::DistanceUnit unit = map_canvas->mapUnits();
+ QString unitString;
+ if (unit == Qgis::DistanceUnit::Meters) {
+ unitString = tr(u8"");
+ }
+ else if (unit == Qgis::DistanceUnit::Degrees) {
+ unitString = tr(u8"");
+ }
+ else if (unit == Qgis::DistanceUnit::Feet) {
+ unitString = tr(u8"Ӣ");
+ }
+ else {
+ unitString = tr(u8"δ֪");
+ }
+ UnitLabel->setText(QString(tr(u8"λ%1")).arg(unitString));
+
+ QgsCoordinateReferenceSystem currentCrs = map_canvas->mapSettings().destinationCrs();
+
+ QString description = currentCrs.description();
+ QString authid = currentCrs.authid();
+
+ if (description == "") {
+ CoordinaryTextLabel->setText(QString(tr(u8"ϵδ֪")));
+ }
+ else {
+ CoordinaryTextLabel->setText(QString(tr(u8"ϵ%1")).arg(description));
+ }
+
+}
+
+void ManualLabelToolWidget::onshowDatamanagerActionTriggered()
+{
+ if (nullptr == datamanagerDialog) {
+ datamanagerDialog = new LampDataManager(this);
+ }
+ else {}
+
+ QRect parentGeometry = this->geometry();
+ QSize dialogSize = datamanagerDialog->size();
+ // λ
+ int x = parentGeometry.x() + (parentGeometry.width() - dialogSize.width()) / 2;
+ int y = parentGeometry.y() + (parentGeometry.height() - dialogSize.height()) / 2;
+
+ // öԻλ
+ datamanagerDialog->move(x, y);
+ datamanagerDialog->show();
+ datamanagerDialog->raise(); // ȷԻǰ
+ datamanagerDialog->activateWindow(); // Իȡ
+}
+
+void ManualLabelToolWidget::setupLayerTreeContextMenu()
+{
+ // ͼͼĬIJ˵
+ this->map_layerTreeView->setMenuProvider(this->map_layerTreeView->menuProvider());
+
+ // Զ˵
+ this->map_layerTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(this->map_layerTreeView, &QgsLayerTreeView::customContextMenuRequested,
+ this, &ManualLabelToolWidget::onLayerTreeContextMenu);
+}
+
+void ManualLabelToolWidget::onLayerTreeContextMenu(const QPoint& pos)
+{
+ QModelIndex index = map_layerTreeView->indexAt(pos);
+ if (!index.isValid())
+ return;
+
+ QgsLayerTreeNode* node = map_layerTreeView->layerTreeModel()->index2node(index);
+ if (!node)
+ return;
+
+ QMenu* menu = new QMenu(this);
+
+ if (QgsLayerTree::isLayer(node))
+ {
+ QgsMapLayer* layer = QgsLayerTree::toLayer(node)->layer();
+ if (layer)
+ {
+ // Ա˵
+ QAction* attributeTableAction = menu->addAction(tr("Ա"));
+
+
+ // ͼԲ˵
+ QAction* layerPropertiesAction = menu->addAction(tr("ͼ"));
+
+ }
+ }
+
+ menu->exec(map_layerTreeView->mapToGlobal(pos));
+ delete menu;
+}
+
+void ManualLabelToolWidget::onshowSARInversionAtionTriggered()
+{
+ QBatchStaticEchoDialog* d = new QBatchStaticEchoDialog(this);
+ d->show();
+}
+
+void ManualLabelToolWidget::onMapToolActionTriggered(QAction* action)
+{
+ if (action == ZoomInToolbtn) {
+ this->map_canvas->setMapTool(m_mapToolZoomIn);
+ }
+ else if (action == ZoomOutToolbtn) {
+ this->map_canvas->setMapTool(m_mapToolZoomOut);
+ }
+ else if (action == MapPanToolbtn) {
+ this->map_canvas->setMapTool(m_mapToolPan);
+ }
+ else if (action == IdentifyToolbtn) {
+ this->map_canvas->setMapTool(m_mapIdentifyToolPan);
+ }
+ else if (action == cursorAction) {
+ this->map_canvas->setMapTool(m_CustomCursorTool);
+ if (!cursorInfoDialog)
+ {
+ cursorInfoDialog = new QImageCursorWidget(this); // αʾ
+ }
+ QObject::connect(m_CustomCursorTool, &CustomCursorTool::identifyResultChange, cursorInfoDialog, &QImageCursorWidget::showCursor, Qt::ConnectionType::AutoConnection);
+ cursorInfoDialog->show();
+ map_canvas->setCursor(Qt::CrossCursor);
+ }
+ else {
+ map_canvas->setCursor(Qt::CursorShape::ArrowCursor);
+ }
+}
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.h
new file mode 100644
index 0000000..51d08d0
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.h
@@ -0,0 +1,139 @@
+#pragma once
+
+#include
+#include
+#include
+
+
+class QgsMapCanvas;
+class QgsMapToolPan;
+class QgsLayerTreeModel;
+class QgsLayerTreeView;
+class QgsLayerTreeMapCanvasBridge;
+class QDockWidget;
+class QLabel;
+class QStatusBar;
+class QMenuBar;
+class QToolBar;
+class QgsMapLayer;
+class QImageCursorWidget;
+class LampDataManager;
+class QToolButton;
+class QgsMapToolZoom;
+class QgsMapToolIdentify;
+class QActionGroup;
+class CustomCursorTool;
+class QgsLayerTreeViewMenuProvider;
+class ManualLabelToolWidget : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ ManualLabelToolWidget(QWidget *parent = nullptr);
+ ~ManualLabelToolWidget();
+
+private: // UI
+ void init_UI();// Init UI
+
+private:
+ LampDataManager* datamanagerDialog;
+
+public: //
+ QgsMapCanvas* map_canvas=nullptr; // map widget
+ QgsMapToolPan* map_tool_pan = nullptr; // map tool for pan zoom
+
+ QgsLayerTreeModel* map_layerModel = nullptr;
+ QgsLayerTreeView* map_layerTreeView = nullptr;
+ QgsLayerTreeMapCanvasBridge* map_layer_Bridge = nullptr;
+
+private: //
+ QDockWidget* layerTreeDock;
+ // ״̬
+ QLabel* scaleLabel; //
+ QLabel* CoordinaryTextLabel; // ͼϵ
+ QLabel* PointXYLabel;// ָ
+ QLabel* UnitLabel;
+ QStatusBar* appStatusBar;// ״̬
+ private: // ˵
+ QMenuBar* menubar;
+
+private: // AI
+ QToolBar* AiLabelToolBar;
+
+private: // ļ˵
+ QMenu* fileMenu;
+ QAction* newAction;
+ QMenu* openMenu;
+ QAction* openRasterFolderAction;
+ QAction* openRasterAction;
+ QAction* openSLCRasterAction;
+ QAction* openLampWindDataAction;
+
+//private:// ༭˵
+// QMenu* editMenu;
+
+
+
+private: // 糡
+ QMenu* SARWindFieldMenu;
+ QAction* SARWindSpeedStatisticsAction;
+ QAction* SARInversionResulutShowAtion;
+ QMenu* SARWindAysysMenu;
+ QAction* SARImageAysysAction;
+
+private: // ܷ
+ QMenu* SARWindPowerMenu;
+ QAction* SARWindPowerDensityAction; // 繦ܶ
+ QAction* SARWindPowerAction; // ܶ
+
+
+
+
+private: // ݲ
+ QToolBar* datatoolbar;
+ QAction* showDatamanagerAction; // ݹ
+ QAction* cursorAction;
+ QImageCursorWidget* cursorTextShowDialog = nullptr;
+
+private: // ͼ㹤
+ QActionGroup* mapToolActionGroup;
+ QAction* ZoomInToolbtn;
+ QAction* ZoomOutToolbtn;
+ QAction* MapPanToolbtn;
+ QAction* IdentifyToolbtn;
+
+ QgsMapToolPan* m_mapToolPan;
+ QgsMapToolZoom* m_mapToolZoomIn;
+ QgsMapToolZoom* m_mapToolZoomOut;
+ QgsMapToolIdentify* m_mapIdentifyToolPan;
+ CustomCursorTool* m_CustomCursorTool;
+ QImageCursorWidget* cursorInfoDialog;
+
+
+public slots:// ܺ
+ void open();
+ void openRaster();
+
+ // ״̬
+ void updateScaleLabel(double);
+ void updateCoordinateLabel(const QgsPointXY&);
+ void onMapExtentsChanged();
+
+
+
+ // ݹչʾ
+ void onshowDatamanagerActionTriggered();
+ void setupLayerTreeContextMenu();
+ void onLayerTreeContextMenu(const QPoint& pos);
+ void onshowSARInversionAtionTriggered();
+ void onMapToolActionTriggered(QAction* action);
+
+public: // ͼ
+ void AddLayers(QgsMapLayer* layer);
+
+
+public: // ñ
+
+
+};
+
diff --git a/Manual-Label-Tool-Widget/ManualLabelToolWidget.qrc b/Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.qrc
similarity index 100%
rename from Manual-Label-Tool-Widget/ManualLabelToolWidget.qrc
rename to Manual-Labeling-Client/Manual-Label-Tool-Widget/ManualLabelToolWidget.qrc
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.cpp
new file mode 100644
index 0000000..8395836
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.cpp
@@ -0,0 +1,230 @@
+#include "QBatchStaticEchoDialog.h"
+#include
+#include
+#include
+//#include "EchoReader.h"
+
+
+QStringList readFilePaths(const QString& filePath) {
+ QStringList pathList; // 用于存储文件路径的列表
+
+ // 1. 创建QFile对象并打开文件
+ QFile file(filePath);
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ qDebug() << "无法打开文件:" << file.errorString();
+ return pathList; // 返回空列表
+ }
+
+ QTextStream in(&file);
+
+ in.setCodec("UTF-8");
+
+ while (!in.atEnd()) {
+ QString line = in.readLine().trimmed(); // 读取一行并去除首尾空白字符
+ if (!line.isEmpty()) { // 确保不是空行
+ pathList.append(line);
+ }
+ }
+
+ // 4. 关闭文件
+ file.close();
+
+ return pathList;
+}
+
+
+QBatchStaticEchoDialog::QBatchStaticEchoDialog(QWidget* parent)
+ : QDialog(parent)
+{
+ setupUI();
+ setupConnections();
+}
+
+QBatchStaticEchoDialog::~QBatchStaticEchoDialog()
+{
+ // Qt的父子对象机制会自动处理内存释放
+}
+
+void QBatchStaticEchoDialog::setupUI()
+{
+ // 设置对话框属性
+ setWindowTitle(u8"风场数据处理");
+ setMinimumSize(600, 500);
+
+ // 创建主布局
+ QVBoxLayout* mainLayout = new QVBoxLayout(this);
+
+ // 创建文件列表区域
+ QLabel* listLabel = new QLabel(u8"文件列表:", this);
+ fileListWidget = new QListWidget(this);
+ fileListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); // 支持多选
+
+ // 创建按钮区域
+ QHBoxLayout* buttonLayout = new QHBoxLayout();
+ addButton = new QPushButton(u8"添加文件", this);
+ addTextButton = new QPushButton(u8"添加数据条目文件", this);
+ removeButton = new QPushButton(u8"移除选中", this);
+ processButton = new QPushButton(u8"开始处理", this);
+
+ buttonLayout->addWidget(addButton);
+ buttonLayout->addWidget(addTextButton);
+ buttonLayout->addWidget(removeButton);
+ buttonLayout->addStretch(); // 添加弹性空间
+ buttonLayout->addWidget(processButton);
+
+ // 创建复选框区域
+ QHBoxLayout* checkBoxLayout = new QHBoxLayout();
+ statisticCheckBox = new QCheckBox(u8"风能计算", this);
+ echoCheckBox = new QCheckBox(u8"风能统计", this);
+ statisticCheckBox->setChecked(true); // 默认选中
+
+ checkBoxLayout->addWidget(statisticCheckBox);
+ checkBoxLayout->addWidget(echoCheckBox);
+ checkBoxLayout->addStretch();
+
+ // 创建进度条区域
+ QLabel* progressLabel = new QLabel(u8"处理进度:", this);
+ progressBar = new QProgressBar(this);
+ progressBar->setMinimum(0);
+ progressBar->setMaximum(100);
+ progressBar->setValue(0);
+ progressBar->setVisible(true); // 默认显示
+
+ // 将组件添加到主布局
+ mainLayout->addWidget(listLabel);
+ mainLayout->addWidget(fileListWidget);
+ mainLayout->addLayout(buttonLayout);
+ mainLayout->addLayout(checkBoxLayout);
+ mainLayout->addWidget(progressLabel);
+ mainLayout->addWidget(progressBar);
+
+ setLayout(mainLayout);
+}
+
+void QBatchStaticEchoDialog::setupConnections()
+{
+ // 连接按钮信号槽
+ connect(addButton, &QPushButton::clicked, this, &QBatchStaticEchoDialog::onAddFiles);
+ connect(addTextButton, &QPushButton::clicked, this, &QBatchStaticEchoDialog::onAddTextFiles);
+ connect(removeButton, &QPushButton::clicked, this, &QBatchStaticEchoDialog::onRemoveFile);
+ connect(processButton, &QPushButton::clicked, this, &QBatchStaticEchoDialog::onProcessFiles);
+}
+
+void QBatchStaticEchoDialog::onAddFiles()
+{
+ // 使用QFileDialog选择多个文件[2,5](@ref)
+ QStringList files = QFileDialog::getOpenFileNames(
+ this,
+ u8"选择要处理的文件",
+ QDir::homePath(),
+ u8"All Files (*.*)"
+ );
+
+ if (!files.isEmpty()) {
+ foreach(QString file, files) {
+ QFileInfo fileInfo(file);
+ // 避免重复添加
+ if (fileListWidget->findItems(fileInfo.fileName(), Qt::MatchExactly).isEmpty()) {
+ QListWidgetItem* item = new QListWidgetItem(fileInfo.fileName());
+ item->setData(Qt::UserRole, file); // 存储完整路径
+ fileListWidget->addItem(item);
+ }
+ }
+ }
+}
+
+void QBatchStaticEchoDialog::onAddTextFiles()
+{
+ QString filePath = QFileDialog::getOpenFileName(
+ this, // 父窗口
+ u8"请选择一个文件", // 对话框标题
+ "./", // 初始目录(这里设为程序当前目录)
+ u8"txt (*.txt);;" // 文件过滤器
+ );
+
+ QStringList dataliststr = readFilePaths(filePath);
+ foreach(QString file, dataliststr) {
+ QFileInfo fileInfo(file);
+ if (fileInfo.exists()) {
+ // 避免重复添加
+ if (fileListWidget->findItems(fileInfo.fileName(), Qt::MatchExactly).isEmpty()) {
+ QListWidgetItem* item = new QListWidgetItem(fileInfo.fileName());
+ item->setData(Qt::UserRole, file); // 存储完整路径
+ fileListWidget->addItem(item);
+ }
+ }
+ }
+}
+
+void QBatchStaticEchoDialog::onRemoveFile()
+{
+ // 移除选中的项目[3](@ref)
+ QList selectedItems = fileListWidget->selectedItems();
+ foreach(QListWidgetItem * item, selectedItems) {
+ delete fileListWidget->takeItem(fileListWidget->row(item));
+ }
+}
+
+void QBatchStaticEchoDialog::onProcessFiles()
+{
+ QString selectedDir = "";
+ QFileDialog dialog(this);
+ dialog.setFileMode(QFileDialog::Directory); // 设置模式为选择目录
+ dialog.setOption(QFileDialog::ShowDirsOnly, true);
+ dialog.setViewMode(QFileDialog::Detail); // 设置视图为详细信息模式
+ if (dialog.exec() == QDialog::Accepted) {
+ selectedDir=dialog.selectedFiles().first();
+ }
+ else {
+ return;
+ }
+
+
+
+ if (fileListWidget->count() == 0) {
+ QMessageBox::warning(this, u8"警告", u8"请先添加要处理的文件!");
+ return;
+ }
+
+ bool enableStatistic = statisticCheckBox->isChecked();
+ bool enableEcho = echoCheckBox->isChecked();
+
+ if (!enableStatistic && !enableEcho) {
+ QMessageBox::warning(this, u8"警告", u8"请至少选择一个处理选项(统计或接回波)!");
+ return;
+ }
+
+ progressBar->setValue(0);
+ int totalFiles = fileListWidget->count();
+ for (int i = 0; i < totalFiles; ++i) {
+
+ QListWidgetItem* item = fileListWidget->item(i);
+ QString filePath = item->data(Qt::UserRole).toString();
+
+ if (this->echoCheckBox->isChecked()) {
+ QString echodatafilepath = QString(u8"%1\\%2").arg(selectedDir).arg(QFileInfo(filePath).fileName());
+ std::string infilepath = filePath.toUtf8().constData();
+ std::string outfilepath = echodatafilepath.toUtf8().constData();
+ //ParseEchoData(infilepath, outfilepath);
+
+ }
+
+ if (this->statisticCheckBox->isChecked()) {
+ QString staticfilepath = QString(u8"%1\\%2").arg(selectedDir).arg(u8"staticResult.dat");
+ std::string infilepath = filePath.toUtf8().constData();
+ std::string outfilepath = staticfilepath.toUtf8().constData();
+ //StaticEchoData(infilepath, outfilepath);
+ //ReadEchoInfoFile(outfilepath);
+ }
+ // 更新进度
+ int progress = (i + 1) * 100 / totalFiles;
+ progressBar->setValue(progress);
+ }
+
+ QMessageBox::information(this, u8"完成", u8"文件处理完成!");
+}
+
+void QBatchStaticEchoDialog::updateProgress(int value)
+{
+ progressBar->setValue(value);
+}
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.h
new file mode 100644
index 0000000..c530f25
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class QBatchStaticEchoDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit QBatchStaticEchoDialog(QWidget* parent = nullptr);
+ ~QBatchStaticEchoDialog();
+
+private slots:
+ void onAddFiles(); // 添加文件
+ void onAddTextFiles(); // 添加文件
+ void onRemoveFile(); // 移除选中文件
+ void onProcessFiles(); // 处理文件(根据复选框状态)
+ void updateProgress(int value); // 更新进度条
+
+private:
+ void setupUI(); // 初始化界面
+ void setupConnections(); // 连接信号槽
+
+ // 界面组件
+ QListWidget* fileListWidget;
+ QPushButton* addButton;
+ QPushButton* addTextButton;
+ QPushButton* removeButton;
+ QPushButton* processButton;
+ QCheckBox* statisticCheckBox;
+ QCheckBox* echoCheckBox;
+ QProgressBar* progressBar;
+};
+QStringList readFilePaths(const QString& filePath);
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.ui b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.ui
new file mode 100644
index 0000000..6a08c9f
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QBatchStaticEchoDialog.ui
@@ -0,0 +1,22 @@
+
+ QBatchStaticEchoDialogClass
+
+
+ QBatchStaticEchoDialogClass
+
+
+
+ 0
+ 0
+ 600
+ 400
+
+
+
+ QBatchStaticEchoDialog
+
+
+
+
+
+
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QImageCursorWidget.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QImageCursorWidget.cpp
new file mode 100644
index 0000000..90b4a4a
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QImageCursorWidget.cpp
@@ -0,0 +1,181 @@
+#include "QImageCursorWidget.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+
+QImageCursorWidget::QImageCursorWidget(QWidget *parent)
+ : QDialog(parent)
+{
+ maplayer_treewidgetItem.clear();
+ this->initUi();
+ this->setWindowTitle(u8"α괰");
+ this->resize(400, 600);
+}
+
+QImageCursorWidget::~QImageCursorWidget()
+{}
+
+void QImageCursorWidget::initUi()
+{
+ // ֱֲ֣
+ QVBoxLayout* mainLayout = new QVBoxLayout(this);
+
+ // 1. ˵ťʹQToolBarQWidgetQHBoxLayoutģ⣩
+ QWidget* toolBarWidget = new QWidget(this);
+ QHBoxLayout* toolBarLayout = new QHBoxLayout(toolBarWidget);
+ toolBarLayout->setContentsMargins(0, 0, 0, 0); // ѡƳ߾ʹָ
+
+ // ѡťʱͼͼ
+ QCheckBox* checkBoxTimeSeries = new QCheckBox(tr(u8"ʱͼ"), toolBarWidget);
+ QCheckBox* checkBoxDirection = new QCheckBox(tr(u8"ͼ"), toolBarWidget);
+
+ // ѡӵť
+ toolBarLayout->addWidget(checkBoxTimeSeries);
+ toolBarLayout->addWidget(checkBoxDirection);
+ toolBarLayout->addStretch(); // һԿռ䣬ʹť
+
+ // 2. TreeView
+ treewidgetResults = new QTreeWidget(this);
+ treewidgetResults->setColumnCount(2);
+ treewidgetResults->setHeaderLabels(QStringList() << u8"" << u8"ֵ");
+ // 3. ťTreeViewӵֱ
+ mainLayout->addWidget(toolBarWidget);
+ mainLayout->addWidget(treewidgetResults);
+
+ // 4. ѡòֵıTreeViewռݸռ
+ mainLayout->setStretchFactor(toolBarWidget, 0); //
+ mainLayout->setStretchFactor(treewidgetResults, 1); // TreeView
+
+
+ // õǰڵIJΪ
+ this->setLayout(mainLayout);
+
+}
+
+void QImageCursorWidget::showCursor(QList result)
+{
+ maplayer_treewidgetItem.clear();
+ treewidgetResults->clear();
+ treewidgetResults->setColumnCount(2);
+ treewidgetResults->setHeaderLabels(QStringList() << u8"" << u8"ֵ");
+ int32_t layerCount = result.count();
+ for (int32_t i = 0; i < layerCount; i++) {
+ if (result[i].mLayer->type() == Qgis::LayerType::Raster) {
+
+ }
+ else if (result[i].mLayer->type() == Qgis::LayerType::Mesh) {
+
+ }
+ }
+ this->populateTreeWidget(result);
+}
+
+void QImageCursorWidget::populateTreeWidget(const QList& results)
+{
+ for (const QgsMapToolIdentify::IdentifyResult& result : results) {
+ if (result.mLayer->type() == Qgis::LayerType::Raster) {
+ addFeature(qobject_cast(result.mLayer), result.mLabel, result.mAttributes, result.mDerivedAttributes, result.mFields, result.mFeature, result.mParams);
+ }
+ else if (result.mLayer->type() == Qgis::LayerType::Mesh) {
+ addFeature(qobject_cast(result.mLayer), result.mLabel, result.mAttributes, result.mDerivedAttributes);
+ }
+ else {
+
+ }
+ }
+ treewidgetResults->expandAll();
+}
+
+void QImageCursorWidget::addKeyValuePair(QTreeWidgetItem* parent, const QString& key, const QString& value)
+{
+ QTreeWidgetItem* item = new QTreeWidgetItem(parent);
+ item->setText(0, key);
+ item->setText(1, value);
+}
+
+QTreeWidgetItem* QImageCursorWidget::layerItem(QgsMapLayer* layer)
+{
+
+ QTreeWidgetItem* layItem = nullptr;
+ if (maplayer_treewidgetItem.contains(layer)) {
+ layItem = maplayer_treewidgetItem[layer];
+ treewidgetResults->addTopLevelItem(layItem);
+ }
+ else {
+ layItem = new QTreeWidgetItem(treewidgetResults);
+ layItem->setText(0, layer->name());
+ maplayer_treewidgetItem.insert(layer, layItem);
+ treewidgetResults->addTopLevelItem(layItem);
+ }
+ return layItem;
+
+}
+
+
+
+void QImageCursorWidget::addFeature(QgsRasterLayer* layer,
+ const QString& label, const QMap& attributes,
+ const QMap& derivedAttributes, const QgsFields& fields,
+ const QgsFeature& feature, const QMap& params)
+{
+ QTreeWidgetItem* layItem = layerItem(layer);
+ QTreeWidgetItem* labelNode = new QTreeWidgetItem();
+ labelNode->setText(0, label);
+ // attributes
+ for (auto it = attributes.begin(); it != attributes.end(); ++it) {
+ QTreeWidgetItem* tempnode = new QTreeWidgetItem();
+ tempnode->setText(0, it.key());
+ tempnode->setText(1, it.value());
+ labelNode->addChild(tempnode);
+ }
+ layItem->addChild(labelNode);
+ // derivedAttributes
+ QTreeWidgetItem* driverNode = new QTreeWidgetItem();
+ for (auto it = derivedAttributes.begin(); it != derivedAttributes.end(); ++it) {
+ QTreeWidgetItem* tempnode = new QTreeWidgetItem();
+ tempnode->setText(0, it.key());
+ tempnode->setText(1, it.value());
+ driverNode->addChild(tempnode);
+ }
+ layItem->addChild(driverNode);
+}
+
+void QImageCursorWidget::addFeature(QgsMeshLayer* layer, const QString& label, const QMap& attributes, const QMap& derivedAttributes)
+{
+ QTreeWidgetItem* layItem = layerItem(layer);
+ QTreeWidgetItem* labelNode = new QTreeWidgetItem();
+ labelNode->setText(0, label);
+ // attributes
+ for (auto it = attributes.begin(); it != attributes.end(); ++it) {
+ QTreeWidgetItem* tempnode = new QTreeWidgetItem();
+ tempnode->setText(0, it.key());
+ tempnode->setText(1, it.value());
+ labelNode->addChild(tempnode);
+ }
+ layItem->addChild(labelNode);
+ // derivedAttributes
+ QTreeWidgetItem* driverNode = new QTreeWidgetItem();
+ driverNode->setText(0, u8"(derivedAttributes)");
+ for (auto it = derivedAttributes.begin(); it != derivedAttributes.end(); ++it) {
+ QTreeWidgetItem* tempnode = new QTreeWidgetItem();
+ tempnode->setText(0, it.key());
+ tempnode->setText(1, it.value());
+ driverNode->addChild(tempnode);
+ }
+ layItem->addChild(driverNode);
+}
+
+
+
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QImageCursorWidget.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QImageCursorWidget.h
new file mode 100644
index 0000000..ab35ccd
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QImageCursorWidget.h
@@ -0,0 +1,58 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+//#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class QCheckBox;
+class QTreeView;
+class QTreeWidgetItem;
+class QgsHighlight;
+
+
+
+
+
+
+
+class QImageCursorWidget : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QImageCursorWidget(QWidget *parent = nullptr);
+ ~QImageCursorWidget();
+
+ void initUi();
+
+public slots:
+ void showCursor(QList result);
+ void populateTreeWidget(const QList& results);
+ void addKeyValuePair(QTreeWidgetItem* parent, const QString& key, const QString& value);
+
+public:
+ void addFeature(QgsMeshLayer* layer, const QString& label, const QMap& attributes, const QMap& derivedAttributes);
+ void addFeature(QgsRasterLayer* layer, const QString& label, const QMap& attributes, const QMap& derivedAttributes, const QgsFields& fields = QgsFields(), const QgsFeature& feature = QgsFeature(), const QMap& params = (QMap()));
+ QTreeWidgetItem* layerItem(QgsMapLayer* object);
+
+private:
+ QCheckBox* checkBoxTimeSeries;
+ QCheckBox* checkBoxDirection;
+ QTreeWidget* treewidgetResults;
+ QHash maplayer_treewidgetItem;
+
+};
+
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.cpp
new file mode 100644
index 0000000..39d8b4a
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.cpp
@@ -0,0 +1,11 @@
+#include "QtWindComputer.h"
+
+QtWindComputer::QtWindComputer(QWidget *parent)
+ : QMainWindow(parent)
+{
+ ui.setupUi(this);
+}
+
+QtWindComputer::~QtWindComputer()
+{}
+
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.h
new file mode 100644
index 0000000..649a532
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include
+#include "ui_QtWindComputer.h"
+
+class QtWindComputer : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ QtWindComputer(QWidget *parent = nullptr);
+ ~QtWindComputer();
+
+private:
+ Ui::QtWindComputerClass ui;
+};
+
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.ui b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.ui
new file mode 100644
index 0000000..c0628e0
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/QtWindComputer.ui
@@ -0,0 +1,22 @@
+
+ QtWindComputerClass
+
+
+ QtWindComputerClass
+
+
+
+ 0
+ 0
+ 600
+ 400
+
+
+
+ QtWindComputer
+
+
+
+
+
+
diff --git a/Manual-Label-Tool-Widget/RasterOperator.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/RasterOperator.cpp
similarity index 100%
rename from Manual-Label-Tool-Widget/RasterOperator.cpp
rename to Manual-Labeling-Client/Manual-Label-Tool-Widget/RasterOperator.cpp
diff --git a/Manual-Label-Tool-Widget/RasterOperator.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/RasterOperator.h
similarity index 100%
rename from Manual-Label-Tool-Widget/RasterOperator.h
rename to Manual-Labeling-Client/Manual-Label-Tool-Widget/RasterOperator.h
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/UnitTest.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/UnitTest.cpp
new file mode 100644
index 0000000..22446f9
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/UnitTest.cpp
@@ -0,0 +1,34 @@
+#include "UnitTest.h"
+#include
+
+#include
+#include
+#include
+#include "ManualLabelToolWidget.h"
+#include "LAMPDataManagerDialog.h"
+#include "WindConverTools.h"
+
+
+
+void TestManualLabelToolWidget()
+{
+ ManualLabelToolWidget labeltoolwidget;
+ labeltoolwidget.show();
+}
+
+
+void TestNc2WindDataTool() {
+ QString ncfilepath = u8"D:\\Programs\\SpacetyLabelAIPlante\\Manual-Labeling-Tool\\WindFileData\\data\\total_precipitation202001.nc";
+ QString binfilepath = u8"D:\\Programs\\SpacetyLabelAIPlante\\Manual-Labeling-Tool\\WindFileData\\output\\converted_wind_data.bin";
+ nc2windataTool* tool=new nc2windataTool(ncfilepath,binfilepath,nullptr);
+ tool->Excute();
+}
+
+
+
+void TestALL()
+{
+ TestManualLabelToolWidget();
+ //TestLampDataManagerWidget();
+ //TestNc2WindDataTool();
+}
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/UnitTest.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/UnitTest.h
new file mode 100644
index 0000000..40ce1f5
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/UnitTest.h
@@ -0,0 +1,6 @@
+#pragma once
+
+void TestALL();
+
+
+
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/WidgetSettingClass.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WidgetSettingClass.cpp
new file mode 100644
index 0000000..4cd9bf7
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WidgetSettingClass.cpp
@@ -0,0 +1,124 @@
+#include "WidgetSettingClass.h"
+#include
+#include
+
+
+WidgetSettingClass::~WidgetSettingClass()
+{
+}
+
+WidgetSettingClass& WidgetSettingClass::instance()
+{
+ static WidgetSettingClass instance;
+ return instance;
+}
+
+// ʵֹ캯...
+WidgetSettingClass::WidgetSettingClass(QObject* parent)
+ : QObject(parent), m_settings(new QSettings(this))
+{
+ lastFileDialogPath = QString();
+
+ iniPath = this->getExeDirectionApplicationPath()+u8"\\LAMPWINDData.ini";
+
+ if (!QFileInfo(iniPath).exists()) {
+ QSettings writeSettings(iniPath, QSettings::IniFormat);
+ writeSettings.setValue("Application/Name", u8"糡");
+ writeSettings.setValue("Application/Version", 1.0);
+ writeSettings.setValue("Application/LastfilePath", this->getExeDirectionApplicationPath());
+ }
+
+
+ QSettings readSettings(iniPath, QSettings::IniFormat);
+ QString appName = readSettings.value("Application/Name").toString();
+ double version = readSettings.value("Application/Version").toDouble();
+ this->lastFileDialogPath= readSettings.value("Application/LastfilePath").toString();
+
+}
+
+QString WidgetSettingClass::getWindTool_nc2WindDataToolPath()
+{
+ QString appDir = QCoreApplication::applicationDirPath();
+ QDir baseDir(appDir);
+ QString toolPyPath = baseDir.absoluteFilePath(u8"tools\\windTools\\ERA5ToWindDataConverter.py");
+ toolPyPath = QDir::cleanPath(toolPyPath);
+ return toolPyPath;
+}
+
+QString WidgetSettingClass::getWindTool_PythonEnvPath()
+{
+ QString appDir = QCoreApplication::applicationDirPath();
+ QDir baseDir(appDir);
+ QString pythonExePath = baseDir.absoluteFilePath(u8"pyEnv\\lampprocess\\python.exe");
+ pythonExePath = QDir::cleanPath(pythonExePath);
+
+ qDebug() << "Python executable path:" << pythonExePath;
+ return pythonExePath;
+}
+
+QString WidgetSettingClass::getExeApplicationPath()
+{
+ // ȵõĿִļ·
+ QString appFilePath = QCoreApplication::applicationFilePath();
+ // ʹQFileInfoȡڵľ·
+ QFileInfo fileInfo(appFilePath);
+ return fileInfo.absolutePath(); // Ŀ¼·
+}
+
+QString WidgetSettingClass::getExeDirectionApplicationPath()
+{
+ return QCoreApplication::applicationDirPath();
+}
+
+QString WidgetSettingClass::getWindReaddLLApplicationPath()
+{
+ QString appDir = QCoreApplication::applicationDirPath();
+ QDir baseDir(appDir);
+ QString toolPath = baseDir.absoluteFilePath(u8"WindDataOperator.dll");
+ toolPath = QDir::cleanPath(toolPath);
+ return toolPath;
+}
+
+QString WidgetSettingClass::getLastFileDialogPath()
+{
+ return this->lastFileDialogPath;
+}
+
+void WidgetSettingClass::setLastFileDialogPath(QString path)
+{
+ lastFileDialogPath = path;
+ iniPath = this->getExeDirectionApplicationPath() + u8"\\LAMPWINDData.ini";
+
+ if (!QFileInfo(iniPath).exists()) {
+ QSettings writeSettings(iniPath, QSettings::IniFormat);
+ writeSettings.setValue("Application/LastfilePath", lastFileDialogPath);
+ }
+ else {
+ QSettings writeSettings(iniPath, QSettings::IniFormat);
+ writeSettings.setValue("Application/LastfilePath", lastFileDialogPath);
+ }
+
+
+}
+
+QString WidgetSettingClass::getTempFolder()
+{
+ QString tempPath2 = QDir::tempPath();
+ qDebug() << u8"ϵͳʱļ· (QDir): " << tempPath2;
+ QString tempfolderpath= tempPath2 + "\\lampwind";
+
+ QDir dir;
+
+ // ȼ·ǷѾ
+ if (dir.exists(tempfolderpath)) {
+ qDebug() << "Ŀ¼Ѵڣ" << tempfolderpath;
+ }
+ else if (dir.mkpath(tempfolderpath)) {
+ qDebug() << "Ŀ¼ɹ" << tempfolderpath;
+ }
+ else {
+ qDebug() << "Ŀ¼ʧܣ" << tempfolderpath;
+ }
+
+ return tempfolderpath;
+}
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/WidgetSettingClass.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WidgetSettingClass.h
new file mode 100644
index 0000000..daee1d3
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WidgetSettingClass.h
@@ -0,0 +1,55 @@
+#pragma once
+#ifndef __WIDGETSETTINGCLASS__H__
+#define __WIDGETSETTINGCLASS__H__
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+// ʲ
+#define RASTERFILEFILTER u8"ļ (*.*);;TIF (*.tif);;TIFF (*.tiff);;bin (*.bin);;dat (*.dat);;"
+#define LAMPWINDDATAFILEFILTER u8"ļ (*.*);;糡ļ (*.lampwind);;TIF (*.tif);;TIFF (*.tiff);;bin (*.bin);;dat (*.dat);;"
+
+
+class WidgetSettingClass : public QObject
+{
+ Q_OBJECT
+public:
+ // ȡʵľ̬
+ static WidgetSettingClass& instance();
+
+
+ // ֵֹ
+ WidgetSettingClass(const WidgetSettingClass&) = delete;
+ WidgetSettingClass& operator=(const WidgetSettingClass&) = delete;
+
+public:
+ static QScopedPointer m_instance;
+
+public:
+ // ˽й캯
+ explicit WidgetSettingClass(QObject* parent = nullptr);
+ ~WidgetSettingClass();
+
+private:
+ QSettings* m_settings;
+ QString lastFileDialogPath;
+ QString iniPath;
+public:
+ QString getWindTool_nc2WindDataToolPath();
+ QString getWindTool_PythonEnvPath();
+ QString getExeApplicationPath();
+ QString getExeDirectionApplicationPath();
+ QString getWindReaddLLApplicationPath();
+ QString getLastFileDialogPath();
+ void setLastFileDialogPath(QString path);
+ QString getTempFolder();
+};
+
+
+
+#endif
\ No newline at end of file
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/WindConverTools.cpp b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WindConverTools.cpp
new file mode 100644
index 0000000..b4dc424
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WindConverTools.cpp
@@ -0,0 +1,80 @@
+#include "WindConverTools.h"
+#include "WidgetSettingClass.h"
+#include
+#include
+
+nc2windataTool::nc2windataTool(QString Inncfilepath, QString InwindBinPath, LAMPDataManagerDialog* IndatamanagerDiglog)
+{
+ this->ncfilepath = Inncfilepath;
+ this->windBinPath = InwindBinPath;
+ this->datamanagerDiglog = IndatamanagerDiglog;
+
+}
+
+nc2windataTool::~nc2windataTool()
+{
+}
+
+int32_t nc2windataTool::Excute()
+{
+ WidgetSettingClass& config = WidgetSettingClass::instance();
+ QString pythonPath = config.getWindTool_PythonEnvPath();
+ QString nc2windToolPath = config.getWindTool_nc2WindDataToolPath();
+ QString dllPath = config.getWindReaddLLApplicationPath();
+
+
+
+ // 2. ļǷ
+ if (!QFileInfo(pythonPath).exists()) {
+ qDebug() << u8"Python· -" << pythonPath;
+ return -1;
+ }
+ if (!QFileInfo(nc2windToolPath).exists()) {
+ qDebug() << u8"Pythonű· -" << nc2windToolPath;
+ return -1;
+ }
+ if (!QFileInfo(ncfilepath).exists()) {
+ qDebug() << u8"ļ· -" << ncfilepath;
+ return -1;
+ }
+ if (!QFileInfo(dllPath).exists()) {
+ qDebug() << u8"ļ· -" << dllPath;
+ return -1;
+ }
+ // б
+ QStringList arguments;
+ arguments
+ //<< "/c"
+ //<< pythonPath
+ << nc2windToolPath // Pythonű·
+ << "-i" << ncfilepath
+ << "-o" << windBinPath
+ << "-d" << dllPath;
+ // finishedźŵԱۺ
+ //connect(m_process, QOverload::of(&QProcess::finished),
+ // this, &nc2windataTool::on_process_finished);
+ m_process= new QProcess(this);
+ //m_process->execute("cmd.exe", arguments);
+ m_process->start(pythonPath, arguments);
+ if (!m_process->waitForStarted(3000)) { // ȴʱ3
+ qDebug() << u8"ʧܣ" << m_process->errorString();
+ }
+ else {
+ qDebug() << u8"...";
+ }
+
+ return 0;
+}
+
+void nc2windataTool::on_process_finished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+ if (!QFileInfo(windBinPath).exists()) {
+ qDebug() << u8"ļ -" << windBinPath;
+ return ;
+ }
+
+ // ݼ
+ // LAMPDataManagerDialog* IndatamanagerDiglog
+
+
+}
diff --git a/Manual-Labeling-Client/Manual-Label-Tool-Widget/WindConverTools.h b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WindConverTools.h
new file mode 100644
index 0000000..387ac70
--- /dev/null
+++ b/Manual-Labeling-Client/Manual-Label-Tool-Widget/WindConverTools.h
@@ -0,0 +1,31 @@
+#pragma once
+#include
+#include
+#include