@@ -301,14 +301,14 @@ TEST_F(test_alg, GDALIsLineOfSightVisible_single_point_dataset)
301
301
ASSERT_TRUE (poDS->RasterIO (GF_Write, 0 , 0 , 1 , 1 , &val, 1 , 1 , GDT_Int8, 1 ,
302
302
nullptr , 0 , 0 , 0 , nullptr ) == CE_None);
303
303
// Both points below terrain
304
- EXPECT_FALSE (
305
- GDALIsLineOfSightVisible (pBand, 0 , 0 , 0.0 , 0 , 0 , 0.0 , nullptr ));
304
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 0 , 0 , 0.0 , 0 , 0 , 0.0 , nullptr ,
305
+ nullptr , nullptr ));
306
306
// One point below terrain
307
- EXPECT_FALSE (
308
- GDALIsLineOfSightVisible (pBand, 0 , 0 , 0.0 , 0 , 0 , 43.0 , nullptr ));
307
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 0 , 0 , 0.0 , 0 , 0 , 43.0 , nullptr ,
308
+ nullptr , nullptr ));
309
309
// Both points above terrain
310
- EXPECT_TRUE (
311
- GDALIsLineOfSightVisible (pBand, 0 , 0 , 44.0 , 0 , 0 , 43.0 , nullptr ));
310
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, 0 , 0 , 44.0 , 0 , 0 , 43.0 , nullptr ,
311
+ nullptr , nullptr ));
312
312
}
313
313
314
314
// Test GDALIsLineOfSightVisible() with 10x10 default dataset
@@ -331,25 +331,25 @@ TEST_F(test_alg, GDALIsLineOfSightVisible_default_square_dataset)
331
331
const int y2 = 2 ;
332
332
333
333
// Both points are above terrain.
334
- EXPECT_TRUE (
335
- GDALIsLineOfSightVisible (pBand, x1, y1, 1.0 , x2, y2, 1.0 , nullptr ));
334
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, x1, y1, 1.0 , x2, y2, 1.0 ,
335
+ nullptr , nullptr , nullptr ));
336
336
// Flip the order, same result.
337
- EXPECT_TRUE (
338
- GDALIsLineOfSightVisible (pBand, x2, y2, 1.0 , x1, y1, 1.0 , nullptr ));
337
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, x2, y2, 1.0 , x1, y1, 1.0 ,
338
+ nullptr , nullptr , nullptr ));
339
339
340
340
// One point is below terrain.
341
- EXPECT_FALSE (
342
- GDALIsLineOfSightVisible (pBand, x1, y1, - 1.0 , x2, y2, 1.0 , nullptr ));
341
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, x1, y1, - 1.0 , x2, y2, 1.0 ,
342
+ nullptr , nullptr , nullptr ));
343
343
// Flip the order, same result.
344
- EXPECT_FALSE (
345
- GDALIsLineOfSightVisible (pBand, x2, y2, - 1.0 , x1, y1, 1.0 , nullptr ));
344
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, x2, y2, - 1.0 , x1, y1, 1.0 ,
345
+ nullptr , nullptr , nullptr ));
346
346
347
347
// Both points are below terrain.
348
- EXPECT_FALSE (
349
- GDALIsLineOfSightVisible (pBand, x1, y1, - 1.0 , x2, y2, - 1.0 , nullptr ));
348
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, x1, y1, - 1.0 , x2, y2, - 1.0 ,
349
+ nullptr , nullptr , nullptr ));
350
350
// Flip the order, same result.
351
- EXPECT_FALSE (
352
- GDALIsLineOfSightVisible (pBand, x2, y2, - 1.0 , x1, y1, - 1.0 , nullptr ));
351
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, x2, y2, - 1.0 , x1, y1, - 1.0 ,
352
+ nullptr , nullptr , nullptr ));
353
353
}
354
354
355
355
// Test GDALIsLineOfSightVisible() through a mountain (not a unit test)
@@ -397,57 +397,57 @@ TEST_F(test_alg, GDALIsLineOfSightVisible_through_mountain)
397
397
// Both points are just above terrain, with terrain between.
398
398
EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, iMesaTopX, iMesaTopY, 222 ,
399
399
iMesaBottomX, iMesaBottomY, 199 ,
400
- nullptr ));
400
+ nullptr , nullptr , nullptr ));
401
401
// Flip the order, same result.
402
402
EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, iMesaBottomX, iMesaBottomY,
403
403
199 , iMesaTopX, iMesaTopY, 222 ,
404
- nullptr ));
404
+ nullptr , nullptr , nullptr ));
405
405
406
406
// Both points above terrain.
407
407
EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, iMesaTopX, iMesaTopY, 322 ,
408
408
iMesaBottomX, iMesaBottomY, 322 ,
409
- nullptr ));
409
+ nullptr , nullptr , nullptr ));
410
410
411
411
// Both points below terrain.
412
412
EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, iMesaTopX, iMesaTopY, 0 ,
413
413
iMesaBottomX, iMesaBottomY, 0 ,
414
- nullptr ));
414
+ nullptr , nullptr , nullptr ));
415
415
416
416
// Test negative slope bresenham diagonals across the whole raster.
417
417
// Both high above terrain.
418
- EXPECT_TRUE (
419
- GDALIsLineOfSightVisible (pBand, 0 , 0 , 460 , 120 , 120 , 460 , nullptr ));
418
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, 0 , 0 , 460 , 120 , 120 , 460 ,
419
+ nullptr , nullptr , nullptr ));
420
420
// Both heights are 1m above in the corners, but middle terrain violates LOS.
421
- EXPECT_FALSE (
422
- GDALIsLineOfSightVisible (pBand, 0 , 0 , 295 , 120 , 120 , 183 , nullptr ));
421
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 0 , 0 , 295 , 120 , 120 , 183 ,
422
+ nullptr , nullptr , nullptr ));
423
423
424
424
// Test positive slope bresenham diagnoals across the whole raster.
425
425
// Both high above terrain.
426
- EXPECT_TRUE (
427
- GDALIsLineOfSightVisible (pBand, 0 , 120 , 460 , 120 , 0 , 460 , nullptr ));
426
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, 0 , 120 , 460 , 120 , 0 , 460 ,
427
+ nullptr , nullptr , nullptr ));
428
428
// Both heights are 1m above in the corners, but middle terrain violates LOS.
429
- EXPECT_FALSE (
430
- GDALIsLineOfSightVisible (pBand, 0 , 120 , 203 , 120 , 0 , 247 , nullptr ));
429
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 0 , 120 , 203 , 120 , 0 , 247 ,
430
+ nullptr , nullptr , nullptr ));
431
431
432
432
// Vertical line tests with hill between two points, in both directions.
433
- EXPECT_FALSE (
434
- GDALIsLineOfSightVisible (pBand, 83 , 111 , 154 , 83 , 117 , 198 , nullptr ));
435
- EXPECT_FALSE (
436
- GDALIsLineOfSightVisible (pBand, 83 , 117 , 198 , 83 , 111 , 154 , nullptr ));
437
- EXPECT_TRUE (
438
- GDALIsLineOfSightVisible (pBand, 83 , 111 , 460 , 83 , 117 , 460 , nullptr ));
439
- EXPECT_TRUE (
440
- GDALIsLineOfSightVisible (pBand, 83 , 117 , 460 , 83 , 111 , 460 , nullptr ));
433
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 83 , 111 , 154 , 83 , 117 , 198 ,
434
+ nullptr , nullptr , nullptr ));
435
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 83 , 117 , 198 , 83 , 111 , 154 ,
436
+ nullptr , nullptr , nullptr ));
437
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, 83 , 111 , 460 , 83 , 117 , 460 ,
438
+ nullptr , nullptr , nullptr ));
439
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, 83 , 117 , 460 , 83 , 111 , 460 ,
440
+ nullptr , nullptr , nullptr ));
441
441
442
442
// Horizontal line tests with hill between two points, in both directions.
443
- EXPECT_FALSE (
444
- GDALIsLineOfSightVisible (pBand, 75 , 115 , 192 , 89 , 115 , 191 , nullptr ));
445
- EXPECT_FALSE (
446
- GDALIsLineOfSightVisible (pBand, 89 , 115 , 191 , 75 , 115 , 192 , nullptr ));
447
- EXPECT_TRUE (
448
- GDALIsLineOfSightVisible (pBand, 75 , 115 , 460 , 89 , 115 , 460 , nullptr ));
449
- EXPECT_TRUE (
450
- GDALIsLineOfSightVisible (pBand, 89 , 115 , 460 , 75 , 115 , 460 , nullptr ));
443
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 75 , 115 , 192 , 89 , 115 , 191 ,
444
+ nullptr , nullptr , nullptr ));
445
+ EXPECT_FALSE (GDALIsLineOfSightVisible (pBand, 89 , 115 , 191 , 75 , 115 , 192 ,
446
+ nullptr , nullptr , nullptr ));
447
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, 75 , 115 , 460 , 89 , 115 , 460 ,
448
+ nullptr , nullptr , nullptr ));
449
+ EXPECT_TRUE (GDALIsLineOfSightVisible (pBand, 89 , 115 , 460 , 75 , 115 , 460 ,
450
+ nullptr , nullptr , nullptr ));
451
451
}
452
452
453
453
} // namespace
0 commit comments