#pragma once

#include <QtWidgets/QMainWindow>
#include <memory>
#include <qgspointxy.h>
 

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: // 常用变量区


};

