Skip to content

Commit

Permalink
简单的更新一下,增加视野调整的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
SindenDev committed Nov 10, 2021
1 parent b619c90 commit ef232fa
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Vladyslav Stelmakhovskyi http://www.vladest.org
Copyright (c) 2021 Sinden https://github.com/SindenDev/amap

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Amap Maps plugin for QtLocation
## 高德地图Qt插件 plugin for QtLocation module
* Qt地图插件,使用简单方便,不用浏览器内核,运行高效迅猛;
* 跨平台支持,(Qt Windows(MinGW, VS),Linux(桌面、嵌入式)Android, ios, qnx都可以的而且测试过);
* 跨平台支持,(Qt Windows(MinGW, MSVC)\Linux(桌面、嵌入式)\Android\IOS\QNX都可以的亲测试过),鸿蒙(还没试过);
* 在线更新下载,支持离线地图;
* 由于我国家安全,GPS定位数据是加密过的,加入纠偏算法会有2m左右误差,精度要求高可以使用高德api进行在线纠偏;
* 经过测试的最新支持Qt5.15.0;
* 支持地图倾斜、旋转、方位调整等;

## 编译工程
1.将在生成目录编译出插件(以使用MinGW为例子)
Expand All @@ -18,7 +17,7 @@
```
C:\Qt\Qt5.13.2\5.13.2\mingw53_32\plugins\geoservices
```
## 配合使用QML建立地图(example目录的测试工程)
## 接下来就可以非常容易的使用,QML建立地图高德地图(example目录的测试工程)
```
import QtQuick 2.12
import QtQuick.Window 2.12
Expand All @@ -34,14 +33,14 @@
Map{
anchors.fill:parent
plugin: Plugin{
name: "amap" // "osm"
name: "amap"
}
}
}
```
MapType:街景
![](amap1.png)
![](example/amap1.png)
MapType:室内
![](amap2.png)
![](example/amap2.png)
MapType:卫星
![](amap3.png)
![](example/amap3.png)
3 changes: 3 additions & 0 deletions amap.pro
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ SOURCES += \
OTHER_FILES += \
amap_plugin.json

DISTFILES += \
README.md

Binary file removed amap1.png
Binary file not shown.
4 changes: 2 additions & 2 deletions amap_plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
{
"Keys": ["amap"],
"Provider": "amap",
"Version": 100,
"Version": 200,
"Experimental": false,
"Features": [
"OnlineGeocodingFeature",
Expand Down
Binary file added example/amap1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
21 changes: 14 additions & 7 deletions qgeotiledmappingmanagerengineamap.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "QtLocation/private/qgeocameracapabilities_p.h"
#include "QtLocation/private/qgeocameracapabilities_p.h"
#include "qgeotiledmappingmanagerengineamap.h"
#include "qgeotiledmapamap.h"
#include "qgeotilefetcheramap.h"
Expand All @@ -25,8 +25,15 @@ QGeoTiledMappingManagerEngineAmap::QGeoTiledMappingManagerEngineAmap(const QVari
Q_UNUSED(errorString);

QGeoCameraCapabilities capabilities;
capabilities.setMinimumZoomLevel(0.0);
capabilities.setMaximumZoomLevel(21.0);
capabilities.setMinimumZoomLevel(1.96);
capabilities.setMaximumZoomLevel(20.88);
capabilities.setSupportsBearing(true);
capabilities.setSupportsTilting(true);
capabilities.setMinimumTilt(0);
capabilities.setMaximumTilt(80);
capabilities.setMinimumFieldOfView(20.0);
capabilities.setMaximumFieldOfView(120.0);
capabilities.setOverzoomEnabled(true);

setCameraCapabilities(capabilities);

Expand All @@ -47,10 +54,10 @@ QGeoTiledMappingManagerEngineAmap::QGeoTiledMappingManagerEngineAmap(const QVari
types << QGeoMapType(QGeoMapType::HybridMap, tr("Hybrid"), tr("Satellite map view with streets in daylight mode"), false, false, 4, "amap");
#else
//QGeoCameraCapabilities cameraCapabilities;
types << QGeoMapType(QGeoMapType::StreetMap, tr("Road Map"), tr("Normal map view in daylight mode"), false,false, 1, "amap",capabilities);
types << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Satellite"), tr("Satellite map view in daylight mode"), false, false, 2, "amap",capabilities);
types << QGeoMapType(QGeoMapType::TerrainMap, tr("Terrain"), tr("Terrain map view in daylight mode"), false, false, 3, "amap",capabilities);
types << QGeoMapType(QGeoMapType::HybridMap, tr("Hybrid"), tr("Satellite map view with streets in daylight mode"), false, false, 4, "amap",capabilities);
types << QGeoMapType(QGeoMapType::StreetMap, tr("Road Map"), tr("Normal map view in daylight mode"), false,false, 1, "amap", capabilities);
types << QGeoMapType(QGeoMapType::TerrainMap, tr("Terrain"), tr("Terrain map view in daylight mode"), false, false, 2, "amap", capabilities);
types << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Satellite"), tr("Satellite map view in daylight mode"), false, false, 3, "amap", capabilities);
types << QGeoMapType(QGeoMapType::HybridMap, tr("Hybrid"), tr("Satellite map view with streets in daylight mode"), false, false, 4, "amap", capabilities);
#endif

setSupportedMapTypes(types);
Expand Down

0 comments on commit ef232fa

Please sign in to comment.