mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:40:05 +00:00
Use GeographicLib
This commit is contained in:
parent
c3037d6d38
commit
5ff7202c3e
3 changed files with 9 additions and 18 deletions
|
|
@ -13,10 +13,10 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
|||
include(${PROJECT_SOURCE_DIR}/external/cmake-conan/conan.cmake)
|
||||
|
||||
conan_cmake_configure(REQUIRES boost/1.76.0
|
||||
geographiclib/1.52
|
||||
glm/0.9.9.8
|
||||
gtest/cci.20210126
|
||||
openssl/1.1.1k
|
||||
proj/8.1.0
|
||||
vulkan-loader/1.2.172
|
||||
GENERATORS cmake
|
||||
cmake_find_package
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ set(CMAKE_CXX_STANDARD 17)
|
|||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Boost)
|
||||
find_package(geographiclib)
|
||||
find_package(glm)
|
||||
find_package(proj)
|
||||
|
||||
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
|
||||
# Check https://doc.qt.io/qt/deployment-android.html for more information.
|
||||
|
|
@ -105,5 +105,5 @@ target_link_libraries(scwx-qt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
|
|||
Boost::log
|
||||
qmapboxgl
|
||||
opengl32
|
||||
glm::glm
|
||||
PROJ::proj)
|
||||
GeographicLib::GeographicLib
|
||||
glm::glm)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
#include <scwx/qt/map/radar_range_layer.hpp>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <geodesic.h>
|
||||
#include <GeographicLib/Geodesic.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -12,14 +11,12 @@ namespace qt
|
|||
|
||||
static const std::string logPrefix_ = "[scwx::qt::map::radar_range_layer] ";
|
||||
|
||||
static constexpr double EARTH_FLATTENING = 1 / 298.257223563;
|
||||
|
||||
void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map, const QString& before)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Add()";
|
||||
|
||||
geod_geodesic g;
|
||||
geod_init(&g, mbgl::util::EARTH_RADIUS_M, EARTH_FLATTENING);
|
||||
GeographicLib::Geodesic geodesic(GeographicLib::Constants::WGS84_a(),
|
||||
GeographicLib::Constants::WGS84_f());
|
||||
|
||||
constexpr float range = 460.0f * 1000.0f;
|
||||
|
||||
|
|
@ -37,14 +34,8 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map, const QString& before)
|
|||
double latitude;
|
||||
double longitude;
|
||||
|
||||
geod_direct(&g,
|
||||
radar.first,
|
||||
radar.second,
|
||||
angle,
|
||||
range,
|
||||
&latitude,
|
||||
&longitude,
|
||||
nullptr);
|
||||
geodesic.Direct(
|
||||
radar.first, radar.second, angle, range, latitude, longitude);
|
||||
|
||||
geometry.append({latitude, longitude});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue