QT离线三维地图插件


QT三维离线地图插件是一款功能强大的离线三维地图插件,支持多图源切换、海量点绘制、星历外推、航迹仿真、模型加载、倾斜数据加载,能够实现真实感的卫星仿真及航迹平滑处理。此外,该插件设计为便于二次开发,允许开发者根据特定需求扩展和定制功能,满足多样化的应用场景。

支持Windows、Linux(x86、ARM),支持在线地图以及离线地图。另一篇文章提供地图资源下载、发布、压缩工具。

无偿提供SDK,需要可以加群906146817

1.多图源切换
1.1Goole卫星图
​​​​​​​​

1.2ArcGis卫星图

1.3ArcGis海图

2.点位绘制与选择
2.1绘制选择

2.2绘制航迹

2.3航迹平滑

3.态势仿真
3.1航迹仿真

3.2卫星仿真

3.3动画控制

4.扩展功能

5.代码示例
5.1 初始化示例

    Map3DControl *map3D = new Map3DControl(this);   //初始化
    map3D->InitMapServer(CommonParam::MapPathList); //设置地图资源信息
    map3D->SetTerrain(CommonParam::TerrainResource);//设置高程数据
    connect(map3D, &Map3DControl::ClickLeftEvent,       this, &MapView::MapClickLeft);        //鼠标左键点击
    connect(map3D, &Map3DControl::ClickRightEvent,      this, &MapView::MapClickRight);       //鼠标右键点击
    connect(map3D, &Map3DControl::SelectEvent,          this, &MapView::MapSelect);           //地图选择
    connect(map3D, &Map3DControl::PointCompleteEvent,   this, &MapView::PointComplete);       //绘制点完成
    connect(map3D, &Map3DControl::RectCompleteEvent,    this, &MapView::RectComplete);        //绘制矩形完成
    connect(map3D, &Map3DControl::EllipseCompleteEvent, this, &MapView::EllipseComplete);     //绘制圆完成
    connect(map3D, &Map3DControl::OperatoinChange,      this, &MapView::MapOperatoinChange);  //地图操作模式改变
    connect(map3D, &Map3DControl::FullscreenEvent,      this, &MapView::FullscreenClicked);   //控制全屏显示

5.2 头文件示例

/**
* @brief 设置高程数据
* @terrain 高程数据信息
*/
void SetTerrain(MapResourceModel terrain);

/**
* @brief 绘制一个点
* @lonLat 点信息
*/
QString DrawPointEfficient(LonLatModel lonLat, float alpha);

/**
* @brief 绘制点集合
* @lonLatList 点集合信息
* @clean 是否清理历史点位
*/
QStringList DrawPointListEfficient(QList lonLatList, float alpha, bool clean = true);

/**
* @brief 绘制线集合(使用点信息中的颜色进行分段颜色)
* @lonLatList 线对应点集合
* @alpha 透明度
* @width 线宽
*/
QString DrawLineListEfficient(QList lonLatList, float alpha, short width);

/**
* @brief 绘制线集合
* @lonLatList 线对应点集合
* @color 颜色
* @alpha 透明度
* @width 线宽
*/
QString DrawLineListEfficient(QList lonLatList, QColor color, float alpha, short width);

/**
* @brief 绘制根据惯性坐标系线集合
* @lonLatList 线对应点集合
* @color 颜色
* @alpha 透明度
* @width 线宽
*/
QString DrawLineListEfficientInertial(QList lonLatList, QColor color, float alpha, short width);

/**
* @brief 更新线
* @lonLatList 线对应点集合
* @alpha 透明度
* @width 线宽
* @id 线ID
* @toolTip 显示距离ToolTip
*/
void UpdateLineListEfficient(QList lonLatList, float alpha, short width, QString id, bool toolTip);

/**
* @brief 绘制箭头
* @lonLatList 箭头点集合
* @color 颜色
* @width 线宽
*/
QString DrawArrow(QList lonLatList, QColor color, short width = 5);//绘制箭头

/**
* @brief 绘制矩形
* @startLonLat 矩形开始点信息
* @endLonLat 矩形结束点信息
* @color 颜色
*/
QString DrawRect(LonLatModel startLonLat, LonLatModel endLonLat, QColor color);

/**
* @brief 绘制圆
* @centerLonLat 圆心点信息
* @endLonLat 结束点信息
* @color 颜色
*/
QString DrawEllipse(LonLatModel centerLonLat, LonLatModel endLonLat, QColor color);

/**
* @brief 选择点
* @selectList 选择的点ID集合
* @cancelList 需要取消选择的点ID集合
*/
void SelectPointListEfficient(QStringList selectList, QStringList cancelList);

/**
* @brief 获取当前已绘制的点信息
*/
QHash<QString, LonLatModel> GetPointList();

/**
* @brief 更新点
* @lonLat 点信息
* @id 点ID
*/
void UpdatePointEfficient(LonLatModel lonLat, QString id, float alpha);

/**
* @brief 更新点集合 使用LonLatModel中ID进行匹配
* @lonLatList 点信息集合
*/
void UpdatePointListEfficient(QList lonLatList, float alpha);

/**
* @brief 定位
* @lonLat 定位信息
*/
void Location(LonLatModel lonLat);//定位

/**
* @brief 显示等待信息
* @waitText 等待信息
*/
void ShowWait(QString waitText);

/**
* @brief 绘制航迹(动画仿真)
* @trackList 目标航迹集合
* @minTime 最小时间
* @maxTime 最大时间
* @add 是否追加航迹
* @dataRangeList 数据区域
*/
QStringList DrawTrack(QList trackList, QDateTime minTime, QDateTime maxTime, bool add, QList<QPair<QDateTime, QDateTime> > dataRangeList = QList<QPair<QDateTime, QDateTime> >());

/**
* @brief 获取点ID
* @count 获取数量
*/
QStringList GetPointIDList(int count);

/**
* @brief 增加点信息缓存(即由外部绘制 当前进行统一点信息管理)
* @lonLat 点信息
*/
void AddPointInfo(LonLatModel lonLat);

/**
* @brief 异步获取当前可视范围(通过信号槽获取)
*/
void GetVisibleRange();

/**
* @brief 绘制模型
* @lonLat 模型信息
* @model 模型名称
* @angle 角度
*/
QString DrawModel(LonLatModel lonLat, QString model, ushort angle);

/**
* @brief 绘制模型集合
* @lonLatList 模型信息集合
*/
QStringList DrawModelList(QList lonLatList);

/**
* @brief 模型信息
* @lonLat 角度
* @angle ID
*/
void UpdateModel(LonLatModel lonLat, ushort angle, QString id);

/**
* @brief 设置时间轴显示状态
* @visible 时间轴显示状态
*/
void SetTimeLineVisible(bool visible);

/**
* @brief 设置时间轴显示状态
* @operation 操作栏显示状态
* @time 时间轴显示状态
*/
void SetTimeLineVisible(bool operation, bool time);

/**
* @brief 设置时间轴范围
* @minTime 最小时间
* @maxTime 最大时间
*/
void SetTimeRange(QDateTime minTime, QDateTime maxTime);

/**
* @brief 设置操作模式
* @mapEnum 操作模式
*/
void SetOperatoin(MapEnum mapEnum);

/**
* @brief 增加固定标签
* @lonLat 固定标签经纬度 Remark用于内容填充
*/
void AddFixedToolTip(LonLatModel lonLat);

/**
* @brief 增加固定标签集合 单次上限为100
* @lonLatList 固定标签经纬度集合 Remark用于内容填充
*/
void AddFixedToolTipList(QList lonLatList);

/**
* @brief 取消所有固定标签
*/
void CancelFixedToolTip();

/**
* @brief 播放动画
*/
void PlayAnimation();

/**
* @brief 暂停动画
*/
void SuspendAnimation();

/**
* @brief 设置动画时间
*/
void SetAnimationTime(QDateTime currentTime);

/**
* @brief 获取动画开始时间
*/
QDateTime GetAnimationStartTime();

/**
* @brief 获取动画结束时间
*/
QDateTime GetAnimationEndTime();

/**
* @brief 增加倾斜数据
* @url 倾斜数据链接地址
* @height 倾斜数据高度
*/
QString Add3DTileset(QString url, int height = 0);

/**
* @brief 设置倾斜数据显示状态
* @id 倾斜数据ID
* @visible 显示状态
*/
void Set3DTilesetVisible(QString id, bool visible);

posted @ 2024-10-23 18:17  希义  阅读(657)  评论(0)    收藏  举报