diff --git a/.github/workflows/test_library.yaml b/.github/workflows/test_library.yaml index 9a8e496..fae83f9 100644 --- a/.github/workflows/test_library.yaml +++ b/.github/workflows/test_library.yaml @@ -7,7 +7,7 @@ concurrency: on: [push, pull_request] jobs: - Tests-Viewshed-library: + Tests-Viewshed-library-linux: runs-on: ubuntu-26.04 env: @@ -33,8 +33,45 @@ jobs: - uses: actions/checkout@v6 with: - # Repository name with owner. For example, actions/checkout - # Default: ${{ github.repository }} + repository: "JanCaha/cpp-simplerasters" + path: "cpp-simplerasters" + + - name: Install simplerasters + run: | + cd cpp-simplerasters + sudo cmake --workflow --preset workflow-release-install + cd .. + sudo rm -rf cpp-simplerasters + + - name: Checkout + uses: actions/checkout@v6 + with: + submodules: true + + - name: Test + run: | + cmake --workflow --preset workflow-debug-tests + + - name: Install + run: | + sudo cmake --workflow --preset workflow-release-install + + Tests-Viewshed-library-macos: + runs-on: macos-latest + + env: + QT_QPA_PLATFORM: "offscreen" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CMAKE_PREFIX_PATH: "/opt/homebrew/opt/qt@6" + + steps: + - name: Install dependencies + run: | + brew update + brew install ninja doxygen googletest gdal qt@6 + + - uses: actions/checkout@v6 + with: repository: "JanCaha/cpp-simplerasters" path: "cpp-simplerasters" diff --git a/CMakeLists.txt b/CMakeLists.txt index 29c0a6c..b10c606 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24.0) # Project Information -project(viewshed VERSION 6.0.0 DESCRIPTION "C++ Viewshed library based on GDAL and Qt" LANGUAGES CXX) +project(viewshed VERSION 6.1.0 DESCRIPTION "C++ Viewshed library based on GDAL and Qt" LANGUAGES CXX) # Library Name SET(LIBRARY_NAME "Viewshed") diff --git a/CMakePresets.json b/CMakePresets.json index 00ffb25..7d7bb1b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -29,7 +29,7 @@ "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", "BUILD_TESTS": "OFF", - "CMAKE_INSTALL_PREFIX": "/usr", + "CMAKE_INSTALL_PREFIX": "/usr/local", "BUILD_DOCUMENTATION": "ON" } } diff --git a/README.md b/README.md index 00a842f..e83779e 100644 --- a/README.md +++ b/README.md @@ -107,8 +107,8 @@ If you use the library, please cite it accordingly: author = {Jan Caha}, title = {viewshed ({C++ Viewshed library based on GDAL and Qt})}, year = {2026} - date = {2026-07-05} - version = {6.0.0} + date = {2026-07-06} + version = {6.1.0} url = {https://github.com/JanCaha/cpp-viewshed-library}, } ``` diff --git a/conda/meta.yaml b/conda/meta.yaml index e5f022d..61b7b69 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,6 +1,6 @@ package: name: libviewshed - version: "6.0.0" + version: "6.1.0" source: path: .. diff --git a/scripts/build_docker.sh b/scripts/build_docker.sh deleted file mode 100755 index 94cad64..0000000 --- a/scripts/build_docker.sh +++ /dev/null @@ -1,29 +0,0 @@ -set -u -set -e - -PWD=`pwd` - -cd docker - -IMAGE_NAME=viewshed - -DOCKER_IMAGE_NAME=cahik/viewshed:latest - -docker build -t $IMAGE_NAME . - -docker tag $IMAGE_NAME $DOCKER_IMAGE_NAME - -docker login --username cahik - -docker push $DOCKER_IMAGE_NAME - - -# DOCKER_IMAGE_NAME=cahik/viewshed:latest-python - -# docker build -t $IMAGE_NAME -f viewshed_install_from_ppa.dockerfile . - -# docker tag $IMAGE_NAME $DOCKER_IMAGE_NAME - -# docker login --username cahik - -# docker push $DOCKER_IMAGE_NAME \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh index a73c2fd..f801340 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,2 +1,6 @@ +#!/bin/bash + +set -e + # install sudo cmake --workflow --preset workflow-release-install diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index 27c25b1..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,30 +0,0 @@ -FOLDER=cpp-viewshed-library -PACKAGE=viewshed -VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+" | head -n 1) -DEBIAN_VERSION=$(grep "viewshed (" debian/changelog | grep -E -o -e "[0-9\.-]+" | head -n 1) - -cmake \ - -S. \ - -B build \ - -G Ninja \ - -DCMAKE_CXX_COMPILER=clang++-13 \ - -D CMAKE_INSTALL_PREFIX=debian/tmp/ \ - -D CMAKE_BUILD_TYPE=Release \ - -D BUILD_TESTS:bool=off \ - -D CMAKE_INSTALL_PREFIX=/usr - -cmake --build build --config Release --target all -# cmake --build build --config Release --target install - -cd .. -dir -tar -acf "${PACKAGE}"_"${DEBIAN_VERSION}".orig.tar.gz $FOLDER -ls -l - -cd $FOLDER - -debuild -S -sa -d - -cd .. - -dput ppa:jancaha/gis-tools "${PACKAGE}"_"${DEBIAN_VERSION}"_source.changes \ No newline at end of file diff --git a/scripts/release_to_ppa.sh b/scripts/release_to_ppa.sh deleted file mode 100755 index a378b9e..0000000 --- a/scripts/release_to_ppa.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!bin/bash - -set -u -set -e - -PWD=`pwd` - -FOLDER=cpp-viewshed-library -PACKAGE=viewshed -VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+" | head -n 1) -DEBIAN_VERSION=$(grep "viewshed (" debian/changelog | grep -E -o -e "[0-9\.-]+" | head -n 1) - -rm -rf build -cd .. -tar -acf "${PACKAGE}"_"${VERSION}".orig.tar.gz $FOLDER -cd $FOLDER -debuild -S -sa -d -cd .. -dput ppa:jancaha/gis-tools "${PACKAGE}"_"${DEBIAN_VERSION}"_source.changes -# rm $PACKAGE* \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh index 7e05e12..bd16fd3 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1 +1,5 @@ +#!/bin/bash + +set -e + cmake --workflow --preset workflow-debug-tests diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 6773ec1..20ac283 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -1,4 +1,8 @@ -sudo rm /usr/local/bin/inverseviewshed /usr/local/bin/viewshed /usr/local/bin/viewshedcalculator /usr/local/bin/losextractor -sudo rm /usr/local/lib/libviewshed.so /usr/local/lib/libviewshed.so.* /usr/local/lib/libviewshedwidgets.so /usr/local/lib/libviewshedwidgets.so.* +#!/bin/bash + +set -e + +sudo rm -f /usr/local/bin/inverseviewshed /usr/local/bin/viewshed /usr/local/bin/viewshedcalculator /usr/local/bin/losextractor +sudo rm -f /usr/local/lib/libviewshed.so /usr/local/lib/libviewshed.so.* /usr/local/lib/libviewshedwidgets.so /usr/local/lib/libviewshedwidgets.so.* sudo rm -rf /usr/local/include/Viewshed -sudo rm -rf /usr/local/lib/cmake/Viewshed \ No newline at end of file +sudo rm -rf /usr/local/lib/cmake/Viewshed diff --git a/src/library/structures/cellevent.cpp b/src/library/structures/cellevent.cpp index 36ba9b8..b62bdd8 100644 --- a/src/library/structures/cellevent.cpp +++ b/src/library/structures/cellevent.cpp @@ -34,32 +34,35 @@ bool CellEvent::operator==( const CellEvent &other ) const mBehindTargetForInverseLoS == other.mBehindTargetForInverseLoS; } -bool CellEvent::operator<( const CellEvent &other ) const +// order of events at equal angle: EXIT first, then CENTER, then ENTER +static int eventTypeSortRank( CellEventPositionType eventType ) { - - if ( mRow == other.mRow && mCol == other.mCol && mEventType == other.mEventType && mBehindTargetForInverseLoS && - other.mBehindTargetForInverseLoS ) - return false; - - if ( mAngle > other.mAngle ) + switch ( eventType ) { - return false; + case CellEventPositionType::EXIT: + return 0; + case CellEventPositionType::CENTER: + return 1; + default: + return 2; } - else if ( mAngle < other.mAngle ) +} + +// must be a strict weak ordering, otherwise std::sort is undefined behaviour +// (the previous version returned true for `a