Viewshed 6.1.0
A C++ library for calculation of viewshed, inverse viewshed and visibility indices for both of those analyses.
Loading...
Searching...
No Matches
viewshed::ViewshedUtils Class Reference

Class that contains mostly static helper functions. More...

#include <viewshedutils.h>

Static Public Member Functions

static void saveToCsv (std::vector< DataTriplet > data, std::string header, std::string fileName)
 Save data vector of DataTriplets as CSV file.
static void saveToCsv (std::vector< std::string > rows, std::string header, std::string fileName)
 Save arbitrary rows as CSV file.
static std::vector< DataTripletdistanceElevation (std::shared_ptr< AbstractLoS > los)
 Extracts triplets of distance, elevation and target point (boolean) from provided LoS.
static std::vector< std::pair< double, double > > rasterCoordinates (std::shared_ptr< std::vector< LoSNode > > los, LoSNode poi)
static double earthDiameter (OGRSpatialReference crs)
 Extract Earth's diameter from ellipsoid associated with provided coordinate reference system.
static bool validateRaster (std::shared_ptr< SingleBandRaster > r1, std::string &error)
 Validate the raster for viewshed calculation, checks if it fulfills all the requirements.
static bool compareRasters (std::shared_ptr< SingleBandRaster > r1, std::shared_ptr< SingleBandRaster > r2, std::string &error)
 Checks if the two rasters have the same properties and that one can be used visibility calculation mask for the second raster, which should be raster of digital surface model.
static std::shared_ptr< ViewshedAlgorithms > allAlgorithms ()
 Returns list of all implemented viewshed indices as algorithms to be used in viewshed of inverse viewshed calculation.
static std::shared_ptr< ViewshedAlgorithms > allAlgorithms (double invisibleValue)
 Returns list of all implemented viewshed indices as algorithms to be used in viewshed of inverse viewshed calculation. Allows setting specific value to be used in some algorithms as invisible value.
static bool doubleEqual (double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())

Detailed Description

Class that contains mostly static helper functions.

Member Function Documentation

◆ allAlgorithms() [1/2]

std::shared_ptr< ViewshedAlgorithms > ViewshedUtils::allAlgorithms ( )
static

Returns list of all implemented viewshed indices as algorithms to be used in viewshed of inverse viewshed calculation.

Returns
std::shared_ptr<std::vector<std::shared_ptr<AbstractViewshedAlgorithm>>>

◆ allAlgorithms() [2/2]

std::shared_ptr< ViewshedAlgorithms > ViewshedUtils::allAlgorithms ( double invisibleValue)
static

Returns list of all implemented viewshed indices as algorithms to be used in viewshed of inverse viewshed calculation. Allows setting specific value to be used in some algorithms as invisible value.

Parameters
invisibleValue
Returns
std::shared_ptr<std::vector<std::shared_ptr<AbstractViewshedAlgorithm>>>

◆ compareRasters()

bool ViewshedUtils::compareRasters ( std::shared_ptr< SingleBandRaster > r1,
std::shared_ptr< SingleBandRaster > r2,
std::string & error )
static

Checks if the two rasters have the same properties and that one can be used visibility calculation mask for the second raster, which should be raster of digital surface model.

Parameters
r1
r2
errorReturned error message.
Returns
true
false

◆ distanceElevation()

std::vector< DataTriplet > ViewshedUtils::distanceElevation ( std::shared_ptr< AbstractLoS > los)
static

Extracts triplets of distance, elevation and target point (boolean) from provided LoS.

Parameters
los
Returns
std::vector<DataTriplet>

◆ earthDiameter()

double ViewshedUtils::earthDiameter ( OGRSpatialReference crs)
static

Extract Earth's diameter from ellipsoid associated with provided coordinate reference system.

Parameters
crs
Returns
double

◆ saveToCsv() [1/2]

void ViewshedUtils::saveToCsv ( std::vector< DataTriplet > data,
std::string header,
std::string fileName )
static

Save data vector of DataTriplets as CSV file.

Parameters
data
headerformatted header of CSV.
fileNamefilename with path to store data into.

◆ saveToCsv() [2/2]

void ViewshedUtils::saveToCsv ( std::vector< std::string > rows,
std::string header,
std::string fileName )
static

Save arbitrary rows as CSV file.

Parameters
rowsformatted rows of the CSV, "\n" is added automatically at the end of string.
headerformatted header of CSV.
fileNamefilename with path to store data into.

◆ validateRaster()

bool ViewshedUtils::validateRaster ( std::shared_ptr< SingleBandRaster > r1,
std::string & error )
static

Validate the raster for viewshed calculation, checks if it fulfills all the requirements.

Parameters
r1
errorReturned error message.
Returns
true
false

The documentation for this class was generated from the following files: