Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature geoid #34

Merged
merged 27 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6ea80bd
Add geographiclib v1.52
till213 Apr 10, 2022
314f439
Add GeographicLib as dependency (WIP - won't compile on Windows)
till213 Apr 10, 2022
e77a503
Update README.md
till213 Apr 12, 2022
6b4f255
Update README.md
till213 Apr 12, 2022
017977d
Refactor CMakeLists.txt
till213 Apr 26, 2022
0adc937
Add EGM2008 geoid with 5' resolution
till213 Apr 26, 2022
0e73365
Add GeographicLib info
till213 Apr 26, 2022
cba5f12
Fix latitude/longitude range
till213 Apr 26, 2022
9db41cb
Add altitude conversion option to IGC import
till213 Apr 27, 2022
a72ce67
Add altitude conversion geoid -> WGS84 ellipsoid to IGC export
till213 Apr 27, 2022
cb99196
Bump logbook version to 0.11
till213 Apr 27, 2022
c678435
GPX export: convert to height above WGS84 ellipsoid
till213 Apr 27, 2022
fee22f3
Move the WGS84 ellipsoid <-> EGM geoid height conversions to Convert
till213 Apr 27, 2022
3a11d86
Fix initialisation order
till213 Apr 23, 2022
86e509f
Remove -lc++ linker dependency (macOS)
till213 Apr 27, 2022
7631018
Prepare download of EGM file (cmake)
till213 Apr 27, 2022
e59b2a6
Fix logbook date selection column width
till213 Apr 27, 2022
4542fe5
Update
till213 Apr 27, 2022
95a11d7
Modernise cmake
till213 Apr 28, 2022
807b94f
Update build instructions: GIT_INIT_SUBMODULE option
till213 Apr 28, 2022
09e4ecb
Optionally download earth gravity model (EGM)
till213 Apr 28, 2022
075edbb
Place EGM files into app bundle (macOS)
till213 Apr 29, 2022
1cd241e
Delete singletons only after main window
till213 Apr 29, 2022
d19e277
EGM file path settings
till213 Apr 29, 2022
1a304e5
Disable altitude conversion checkbox if no EGM available
till213 Apr 29, 2022
8ddfebb
INTERFACE targets do not support POST custom commands
till213 Apr 29, 2022
a6cad7d
Can only link to actual targets
till213 Apr 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "3rdParty/ordered-map"]
path = 3rdParty/ordered-map
url = https://github.com/Tessil/ordered-map
[submodule "3rdParty/geographiclib"]
path = 3rdParty/geographiclib
url = https://github.com/geographiclib/geographiclib.git
1 change: 1 addition & 0 deletions 3rdParty/geographiclib
Submodule geographiclib added at 920702
52 changes: 52 additions & 0 deletions 3rdParty/geoids/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
set(TARGET_NAME "Geoids")

include(FetchEarthGravityModel)

if (${PLATFORM_IS_MACOS})
add_library(${TARGET_NAME} INTERFACE)
endif()

# Option: SD_FETCH_EGM (default: OFF)
if (egm_POPULATED)

message(STATUS "[SD_FETCH_EGM=ON] Using earth gravity model egm2008-5.pgm.")

if (${PLATFORM_IS_MACOS})
set(EGM_FILE_PATHS
"${egm_SOURCE_DIR}/egm2008-5.pgm"
"${egm_SOURCE_DIR}/egm2008-5.pgm.aux.xml"
"${egm_SOURCE_DIR}/egm2008-5.wld"
)
set_source_files_properties(
${EGM_FILE_PATHS}
TARGET_DIRECTORY
SkyDolly
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources/geoids)
set_target_properties(
${TARGET_NAME}
PROPERTIES
INTERFACE_SOURCES "${EGM_FILE_PATHS}"
)
else()
add_custom_target(${TARGET_NAME} ALL)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${egm_SOURCE_DIR}/egm2008-5.pgm
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Resources/geoids/egm2008-5.pgm
)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${egm_SOURCE_DIR}/egm2008-5.pgm.aux.xml
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Resources/geoids/egm2008-5.pgm.aux.xml
)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${egm_SOURCE_DIR}/egm2008-5.wld
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Resources/geoids/egm2008-5.wld
)
endif()

else()
message(STATUS "[SD_FETCH_EGM=OFF] No earth gravity model downloaded: enable option SD_FETCH_EGM and/or check internet connection.")
endif()
37 changes: 29 additions & 8 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,29 @@ Sky Dolly is developed against Qt 5.15, but also compiles fine with Qt 5.12 (whi

Install cmake and the Qt 5 default package which should also install the basic Qt development tools and headers:

- sudo apt-get install cmake
- sudo apt-get install qt5-default
- `sudo apt-get install cmake`
- `sudo apt-get install qt5-default`

Optionally also install QtCreator:

- sudo apt-get install qtcreator
- `sudo apt-get install qtcreator`

## All Platforms

- Clone (or download) this project, including submodules: `git clone https://github.com/till213/SkyDolly.git --recurse-submodules`
- For existing cloned repositories initialise and update the submodules with: `git submodule update --init --recursive`
- Clone (or download) this project, including submodules: `git clone https://github.com/till213/SkyDolly.git`

### Git Submodules

Whenever `cmake` is executed it tries to automatically initialise and update all git submodules. This can be disabled with the option GIT_INIT_SUBMODULE set to OFF, e.g.:

```
$> mkdir build
$> cd build
$> cmake -DGIT_INIT_SUBMODULE=OFF ..
```

- The git submodules may also be initialised when cloning the repository: `git clone https://github.com/till213/SkyDolly.git --recurse-submodules`
- For an already cloned repository the submodules may also be initialised and updated with: `git submodule update --init --recursive`

## Qt Creator (All Platforms)

Expand All @@ -44,9 +56,18 @@ Optionally also install QtCreator:

## Command Line

### Linux & macOS
The provided Makefile generates a `build` subdirectory and invokes `cmake` followed by `make -j8` in that subdirectory.

- cd SkyDolly
- make
### Linux & macOS
```
$> cd SkyDolly
$> make
```

### Windows (MinGW)
```
$> cd SkyDolly
$> mingw32-make
```

The binaries will be in the 'build' directory, in the 'bin' and 'lib' subdirectories.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.11.0

### Improvements

- All export plugins
* No sequence numbers added anymore to export filename in case the flight has only one aircraft and "All aircraft" is selected
- IGC & GXP import
* An option to convert from the WGS84 reference ellipsoid to the earth gravity model (EGM) geoid altitude has been added (enabled by default)
* Note: both the IGC and GPX specifications state that the GNSS altitude (elevation) refer to the WGS84 reference ellipsoid, but not every IGC/GPX file necessarily conforms to the specification and may contain earth gravity model (EGM) geoid altitudes ("above sea level") instead

### Bug Fixes
- The IGC and GPX export plugins now properly convert GNSS altitude (elevation) data to height above the WGS84 ellipsoid
- In the logbook module the date selection column width is now properly calculated (no month name is truncated)

## 0.10.0

### New Features
Expand Down
53 changes: 40 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16...3.23)

set(SKYDOLLY_DESCRIPTION "Sky Dolly - The Black Sheep for your Flight Recordings")
project(SkyDolly LANGUAGES CXX VERSION 0.11.0 DESCRIPTION ${SKYDOLLY_DESCRIPTION})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

include(CMakePrintHelpers)

project(
SkyDolly
VERSION 0.11.0
LANGUAGES CXX
DESCRIPTION "Sky Dolly - The Black Sheep for your Flight Recordings"
)
# Used to populate the Info.plist.in and SkyDolly.rc.in
set(PROJECT_APPLICATION_NAME "Sky Dolly")
set(PROJECT_ORGANISATION_NAME till213)

include(InitSubmodules)

# Enables testing: 'ctest' needs to be run in the "build" directory
include(CTest)

Expand All @@ -27,7 +38,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
string(COMPARE EQUAL "Windows" ${CMAKE_SYSTEM_NAME} PLATFORM_IS_WINDOWS)
string(COMPARE EQUAL "Darwin" ${CMAKE_SYSTEM_NAME} PLATFORM_IS_MACOS)
string(COMPARE EQUAL "Linux" ${CMAKE_SYSTEM_NAME} PLATFORM_IS_LINUX)
message(STATUS PLATFORM="${CMAKE_SYSTEM_NAME}")
cmake_print_variables(CMAKE_SYSTEM_NAME)

# Definitions

Expand Down Expand Up @@ -59,6 +70,13 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/src/UserInterface)
# ordered-map (Tessil)
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdParty/ordered-map)

# GeographicLib (https://github.com/geographiclib/geographiclib)
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdParty/geographiclib EXCLUDE_FROM_ALL)
set_target_properties(GeographicLib_SHARED
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)

# Documentation
add_subdirectory(${CMAKE_SOURCE_DIR}/doc)

Expand Down Expand Up @@ -104,13 +122,19 @@ else()
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR}/src ${TS_FILES})
endif()

# Data files
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdParty/geoids)

set(SKYDOLLY_LIBS
Qt${QT_VERSION_MAJOR}::Widgets Kernel Model Persistence SkyConnect Plugin UserInterface
)
if (${PLATFORM_IS_MACOS})
list(APPEND SKYDOLLY_LIBS -lc++)
set_target_properties(SkyDolly PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/res/Info.plist.in")
target_link_libraries(SkyDolly
PRIVATE
Geoids
)
endif()

target_sources(SkyDolly
Expand All @@ -119,19 +143,22 @@ target_sources(SkyDolly
${OTHER_SOURCES}
)

target_include_directories(SkyDolly PUBLIC
"${PROJECT_SOURCE_DIR}/src/SkyConnect/src"
)
target_link_libraries(SkyDolly PRIVATE ${SKYDOLLY_LIBS})
message(STATUS OUTPUT_NAME=${PROJECT_NAME})
target_include_directories(SkyDolly
PRIVATE
"${PROJECT_SOURCE_DIR}/src/SkyConnect/src"
)
target_link_libraries(SkyDolly
PRIVATE
${SKYDOLLY_LIBS}
)

# macOS: copy plugins into app bundle
if (${PLATFORM_IS_MACOS})

# Connect plugins
file(GLOB BUNDLE_IMPORT_PLUGINS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Plugins/Connect/*")
message(STATUS IMPORT_PLUGIN_DIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Plugins/Connect/")
target_sources(SkyDolly PUBLIC ${BUNDLE_IMPORT_PLUGINS})
target_sources(SkyDolly PRIVATE ${BUNDLE_IMPORT_PLUGINS})
set_property(
SOURCE ${BUNDLE_IMPORT_PLUGINS}
PROPERTY MACOSX_PACKAGE_LOCATION "PlugIns/Connect"
Expand All @@ -140,7 +167,7 @@ if (${PLATFORM_IS_MACOS})
# Import plugins
file(GLOB BUNDLE_IMPORT_PLUGINS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Plugins/Import/*")
message(STATUS IMPORT_PLUGIN_DIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Plugins/Import/")
target_sources(SkyDolly PUBLIC ${BUNDLE_IMPORT_PLUGINS})
target_sources(SkyDolly PRIVATE ${BUNDLE_IMPORT_PLUGINS})
set_property(
SOURCE ${BUNDLE_IMPORT_PLUGINS}
PROPERTY MACOSX_PACKAGE_LOCATION "PlugIns/Import"
Expand All @@ -149,7 +176,7 @@ if (${PLATFORM_IS_MACOS})
# Export
file(GLOB BUNDLE_EXPORT_PLUGINS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Plugins/Export/*")
message(STATUS EXPORT_PLUGIN_DIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Plugins/Export/")
target_sources(SkyDolly PUBLIC ${BUNDLE_EXPORT_PLUGINS})
target_sources(SkyDolly PRIVATE ${BUNDLE_EXPORT_PLUGINS})
set_property(
SOURCE ${BUNDLE_EXPORT_PLUGINS}
PROPERTY MACOSX_PACKAGE_LOCATION "PlugIns/Export"
Expand Down
5 changes: 5 additions & 0 deletions THIRD_PARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Sky Dolly uses (or is "inspired by") the following third-party libraries and fun
* Website: https://sqlite.org/
* License: Public Domain

## GeographicLib
* Author: Charles Karney
* Website: https://geographiclib.sourceforge.io/
* License: MIT License

## Ordered-Map
* Author: Thibaut Goetghebuer-Planchon (Tessil)
* Source: https://github.com/Tessil/ordered-map
Expand Down
14 changes: 14 additions & 0 deletions cmake/FetchEarthGravityModel.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include(FetchContent)

set(CMAKE_TLS_VERIFY true)

option(SD_FETCH_EGM "Fetch earth gravity model EGM2008-5" OFF)
if(SD_FETCH_EGM)
FetchContent_Declare(
egm
URL https://downloads.sourceforge.net/project/geographiclib/geoids-distrib/egm2008-5.tar.bz2?use_mirror=autoselect
URL_HASH SHA256=9A57C14330AC609132D324906822A9DA9DE265AD9B9087779793EB7080852970
DOWNLOAD_NO_EXTRACT false
)
FetchContent_MakeAvailable(egm)
endif()
File renamed without changes.
24 changes: 24 additions & 0 deletions cmake/InitSubmodules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_INIT_SUBMODULE "Check submodules during build" ON)
if(GIT_INIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()

set(GIT_SUBMODULE_TEST_FILES
"${PROJECT_SOURCE_DIR}/3rdParty/geographiclib/CMakeLists.txt"
"${PROJECT_SOURCE_DIR}/3rdParty/ordered-map/CMakeLists.txt"
)
foreach(TEST_FILE IN LISTS SUBMODULE_TEST_FILES)
if(NOT EXISTS ${TEST_FILE})
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()
endforeach()
19 changes: 11 additions & 8 deletions src/Flight/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ set(LIBRARY_NAME "Flight")
add_definitions(-DFLIGHT_EXPORT)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_library(${LIBRARY_NAME} SHARED "")
qt_add_library(${LIBRARY_NAME} SHARED)
else()
add_library(${LIBRARY_NAME} SHARED "")
add_library(${LIBRARY_NAME} SHARED)
endif()

set(LIBRARY_DEPENDENCIES
Qt${QT_VERSION_MAJOR}::Core Kernel Model
)
if (${PLATFORM_IS_MACOS})
list(APPEND LIBRARY_DEPENDENCIES -lc++)
endif()

target_sources(${LIBRARY_NAME}
PRIVATE
Expand All @@ -22,6 +19,12 @@ target_sources(${LIBRARY_NAME}
src/Analytics.h src/Analytics.cpp
)

target_link_libraries(${LIBRARY_NAME} PRIVATE ${LIBRARY_DEPENDENCIES})
set_target_properties(${LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
target_link_libraries(${LIBRARY_NAME}
PRIVATE
${LIBRARY_DEPENDENCIES}
)
set_target_properties(${LIBRARY_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
27 changes: 17 additions & 10 deletions src/Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ set(LIBRARY_NAME "Kernel")
add_definitions(-DKERNEL_EXPORT)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_library(${LIBRARY_NAME} SHARED "")
qt_add_library(${LIBRARY_NAME} SHARED)
else()
add_library(${LIBRARY_NAME} SHARED "")
add_library(${LIBRARY_NAME} SHARED)
endif()

set(LIBRARY_DEPENDENCIES
Expand All @@ -14,8 +14,6 @@ set(LIBRARY_DEPENDENCIES
if (${PLATFORM_IS_WINDOWS})
find_library (PSAPI psapi)
list(APPEND LIBRARY_DEPENDENCIES -lpsapi)
elseif (${PLATFORM_IS_MACOS})
list(APPEND LIBRARY_DEPENDENCIES -lc++)
endif()

configure_file(src/VersionConfig.h.in VersionConfig.h)
Expand All @@ -32,7 +30,7 @@ target_sources(${LIBRARY_NAME}
src/Version.h src/Version.cpp
src/Settings.h src/Settings.cpp
src/Replay.h
src/Convert.h
src/Convert.h src/Convert.cpp
src/FlightSimulator.h src/FlightSimulator.cpp
src/Color.h src/Color.cpp
src/File.h src/File.cpp
Expand Down Expand Up @@ -61,9 +59,18 @@ elseif (${PLATFORM_IS_LINUX})
endif()

# For generated VersionConfig.h
target_include_directories(Kernel PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}"
target_include_directories(${LIBRARY_NAME}
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_link_libraries(${LIBRARY_NAME}
PRIVATE
${LIBRARY_DEPENDENCIES}
PUBLIC
GeographicLib::GeographicLib
)
set_target_properties(${LIBRARY_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_link_libraries(${LIBRARY_NAME} PRIVATE ${LIBRARY_DEPENDENCIES})
set_target_properties(${LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
Loading