Skip to content

Commit d755caa

Browse files
authored
Merge pull request #46 from JanCaha/development
Development
2 parents 5a5e0a7 + 3e5016e commit d755caa

File tree

7 files changed

+41
-9
lines changed

7 files changed

+41
-9
lines changed

.github/workflows/create_releases.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525

2626
- name: Checkout
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828
with:
2929
submodules: true
3030

@@ -60,7 +60,7 @@ jobs:
6060
sudo apt update
6161
sudo apt-get -y install gdal-bin libgdal-dev
6262
63-
- uses: robinraju/release-downloader@v1.8
63+
- uses: robinraju/release-downloader@v1.10
6464
with:
6565
repository: "JanCaha/cpp-simplerasters"
6666
latest: true
@@ -154,7 +154,7 @@ jobs:
154154
steps:
155155

156156
- name: Checkout
157-
uses: actions/checkout@v3
157+
uses: actions/checkout@v4
158158

159159
- name: Download artifact
160160
uses: actions/download-artifact@v3
@@ -166,7 +166,7 @@ jobs:
166166
mkdir docker/install
167167
mv viewshed_*.deb docker/install/
168168
169-
- uses: robinraju/release-downloader@v1
169+
- uses: robinraju/release-downloader@v1.10
170170
with:
171171
repository: "JanCaha/cpp-simplerasters"
172172
latest: true
@@ -240,7 +240,7 @@ jobs:
240240
steps:
241241

242242
- name: Checkout
243-
uses: actions/checkout@v3
243+
uses: actions/checkout@v4
244244
with:
245245
submodules: true
246246

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.20.0)
22

3-
project(viewshed VERSION 4.0.1 DESCRIPTION "C++ Viewshed library based on GDAL and Qt" LANGUAGES CXX)
3+
project(viewshed VERSION 4.0.2 DESCRIPTION "C++ Viewshed library based on GDAL and Qt" LANGUAGES CXX)
44

55
SET(LIBRARY_NAME "viewshed")
66

debian/changelog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
viewshed (4.0.1-0) jammy; urgency=low
1+
viewshed (4.0.2-0) jammy; urgency=low
22

3+
* fix segmentation fault for some scenarios
34
* fix build setting
45

56
-- Jan Caha <jan.caha@outlook.com> Tue, 21 May 2024 12:58:57 +0200

src/library/visibility/abstractviewshed.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,4 +367,11 @@ std::vector<LoSNode> AbstractViewshed::prepareLoSWithPoint( OGRPoint point )
367367

368368
void AbstractViewshed::saveVisibilityRaster( std::string filePath ) { mVisibilityRaster->saveFile( filePath ); };
369369

370-
void AbstractViewshed::calculateVisibilityMask() { mVisibilityMask = mVisibilityRaster; };
370+
void AbstractViewshed::calculateVisibilityMask()
371+
{
372+
if ( !mVisibilityRaster )
373+
{
374+
calculateVisibilityRaster();
375+
}
376+
mVisibilityMask = mVisibilityRaster;
377+
};

tests/testinverseviewshed.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ TEST_F( InverseViewshedTest, testVisibilityRaster )
8787
v.saveVisibilityRaster( TEST_DATA_RESULTS_VISIBILITY_RASTER );
8888
}
8989

90+
TEST_F( InverseViewshedTest, testCalculateVisibilityMask )
91+
{
92+
OGRPoint poiPoint = OGRPoint( -336428.767, -1189102.785 );
93+
94+
InverseViewshed v( tp, 2, dem, algs );
95+
v.initEventList();
96+
v.sortEventList();
97+
98+
v.calculateVisibilityMask();
99+
v.saveVisibilityRaster( TEST_DATA_RESULTS_VISIBILITY_RASTER );
100+
}
101+
90102
int main( int argc, char **argv )
91103
{
92104
testing::InitGoogleTest( &argc, argv );

tests/testviewshed.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ TEST_F( ViewshedTest, testVisibilityRaster )
103103
v.saveVisibilityRaster( TEST_DATA_RESULTS_VISIBILITY_RASTER );
104104
}
105105

106+
TEST_F( ViewshedTest, testCalculateVisibilityMask )
107+
{
108+
OGRPoint poiPoint = OGRPoint( -336428.767, -1189102.785 );
109+
110+
Viewshed v( vp, dem, algs );
111+
v.initEventList();
112+
v.sortEventList();
113+
114+
v.calculateVisibilityMask();
115+
v.saveVisibilityRaster( TEST_DATA_RESULTS_VISIBILITY_RASTER );
116+
}
117+
106118
int main( int argc, char **argv )
107119
{
108120
testing::InitGoogleTest( &argc, argv );

uninstall.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
sudo rm /usr/local/bin/inverseviewshed /usr/local/bin/viewshed /usr/local/bin/viewshedcalculator /usr/local/bin/losextractor
2-
sudo rm /usr/local/lib/libviewshed.so /usr/local/lib/libviewshed.so.*
2+
sudo rm /usr/local/lib/libviewshed.so /usr/local/lib/libviewshed.so.* /usr/local/lib/libviewshedwidgets.so /usr/local/lib/libviewshedwidgets.so.*
33
sudo rm -rf /usr/local/include/viewshed

0 commit comments

Comments
 (0)