parent
1e2ef91da8
commit
a22dbd4b46
@ -0,0 +1,86 @@
|
||||
#ifndef VISUALIZATION_INTERFACE_H
|
||||
#define VISUALIZATION_INTERFACE_H
|
||||
|
||||
#include "DataStructures.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
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<DecisionSuggestion>& decisions) = 0;
|
||||
|
||||
// 更新地图数据
|
||||
virtual void updateMapData(const std::vector<GeoCoordinate>& terrain,
|
||||
const std::vector<std::string>& labels) = 0;
|
||||
|
||||
// 设置事件回调
|
||||
virtual void setClickCallback(std::function<void(double, double)> callback) = 0;
|
||||
virtual void setSelectCallback(std::function<void(int)> callback) = 0;
|
||||
|
||||
// 获取用户输入
|
||||
virtual std::vector<std::string> getUserInput() = 0;
|
||||
|
||||
// 显示/隐藏图层
|
||||
virtual void setLayerVisible(const std::string& layerName, bool visible) = 0;
|
||||
|
||||
// 添加自定义覆盖物
|
||||
virtual void addOverlay(const std::vector<GeoCoordinate>& 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<DecisionSuggestion>& decisions) override;
|
||||
void updateMapData(const std::vector<GeoCoordinate>& terrain,
|
||||
const std::vector<std::string>& labels) override;
|
||||
void setClickCallback(std::function<void(double, double)> callback) override;
|
||||
void setSelectCallback(std::function<void(int)> callback) override;
|
||||
std::vector<std::string> getUserInput() override;
|
||||
void setLayerVisible(const std::string& layerName, bool visible) override;
|
||||
void addOverlay(const std::vector<GeoCoordinate>& 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<Impl> pImpl;
|
||||
};
|
||||
|
||||
} // namespace Battlefield
|
||||
|
||||
#endif // VISUALIZATION_INTERFACE_H
|
||||
Loading…
Reference in new issue