diff --git a/可视化模块接口 VisualizationInterface.h b/可视化模块接口 VisualizationInterface.h new file mode 100644 index 0000000..e5b3577 --- /dev/null +++ b/可视化模块接口 VisualizationInterface.h @@ -0,0 +1,86 @@ +#ifndef VISUALIZATION_INTERFACE_H +#define VISUALIZATION_INTERFACE_H + +#include "DataStructures.h" +#include +#include +#include + +namespace Battlefield { + +class VisualizationInterface { +public: + virtual ~VisualizationInterface() = default; + + // 初始化可视化系统 + virtual bool initialize(int width, int height, const std::string& title) = 0; + + // 渲染战场态势 + virtual void renderSituation(const BattlefieldSituation& situation) = 0; + + // 渲染决策建议 + virtual void renderDecisions(const std::vector& decisions) = 0; + + // 更新地图数据 + virtual void updateMapData(const std::vector& terrain, + const std::vector& labels) = 0; + + // 设置事件回调 + virtual void setClickCallback(std::function callback) = 0; + virtual void setSelectCallback(std::function callback) = 0; + + // 获取用户输入 + virtual std::vector getUserInput() = 0; + + // 显示/隐藏图层 + virtual void setLayerVisible(const std::string& layerName, bool visible) = 0; + + // 添加自定义覆盖物 + virtual void addOverlay(const std::vector& points, + const std::string& color, + const std::string& label) = 0; + + // 清除覆盖物 + virtual void clearOverlays() = 0; + + // 保存态势图 + virtual bool saveImage(const std::string& filename) = 0; + + // 获取视口信息 + virtual struct { + GeoCoordinate center; + double zoomLevel; + double rotation; + } getViewport() = 0; +}; + +// 基于Qt的3D可视化实现 +class Qt3DVisualization : public VisualizationInterface { +public: + Qt3DVisualization(); + ~Qt3DVisualization() override; + + bool initialize(int width, int height, const std::string& title) override; + void renderSituation(const BattlefieldSituation& situation) override; + void renderDecisions(const std::vector& decisions) override; + void updateMapData(const std::vector& terrain, + const std::vector& labels) override; + void setClickCallback(std::function callback) override; + void setSelectCallback(std::function callback) override; + std::vector getUserInput() override; + void setLayerVisible(const std::string& layerName, bool visible) override; + void addOverlay(const std::vector& points, + const std::string& color, + const std::string& label) override; + void clearOverlays() override; + bool saveImage(const std::string& filename) override; + struct { GeoCoordinate center; double zoomLevel; double rotation; } getViewport() override; + +private: + class Impl; + std::unique_ptr pImpl; +}; + +} // namespace Battlefield + +#endif // VISUALIZATION_INTERFACE_H \ No newline at end of file