FireSTARR
Loading...
Searching...
No Matches
fs::GridData< T, V, D > Class Template Referenceabstract

A Grid that defines the data structure used for storing values. More...

#include <Grid.h>

Inheritance diagram for fs::GridData< T, V, D >:
Collaboration diagram for fs::GridData< T, V, D >:

Public Member Functions

 GridData (const MathSize cell_size, const Idx width, const Idx height, const V nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, const string_view proj4, D &&data)
 
 GridData (const GridData &rhs)
 
 GridData (GridData &&rhs) noexcept
 
GridData & operator= (const GridData &rhs) noexcept
 
GridData & operator= (GridData &&rhs) noexcept
 
size_t size () const
 Size of data structure storing values.
 
template<class R >
FileList saveToFileWithoutRetry (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
template<class R >
FileList saveToFileWithRetry (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
template<class R >
FileList saveToFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
template<class R >
FileList saveToFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert) const
 Save GridMap contents to file based on settings.
 
template<class R = V>
FileList saveToFile (const string_view dir, const string_view base_name) const
 Save GridMap contents to file based on settings.
 
- Public Member Functions inherited from fs::Grid< T, V >
constexpr Idx height () const noexcept
 
constexpr Idx width () const noexcept
 
constexpr V nodataInput () const noexcept
 Value used for grid locations that have no data.
 
constexpr T nodataValue () const noexcept
 Value representing no data.
 
virtual T at (const XYIdx &location) const=0
 
virtual void set (const XYIdx &location, T value)=0
 
- Public Member Functions inherited from fs::GridBase
 GridBase (GridBase &&rhs) noexcept=default
 
 GridBase (const GridBase &rhs)=default
 
GridBase & operator= (const GridBase &rhs)=default
 
GridBase & operator= (GridBase &&rhs) noexcept=default
 
constexpr MathSize cellSize () const noexcept
 Cell size used for GridBase.
 
constexpr FullIdx calculateHeight () const noexcept
 
constexpr FullIdx calculateWidth () const noexcept
 
constexpr MathSize xllcorner () const noexcept
 Lower left corner X coordinate in metres.
 
constexpr MathSize yllcorner () const noexcept
 Lower left corner Y coordinate in metres.
 
constexpr MathSize xurcorner () const noexcept
 Upper right corner X coordinate in metres.
 
constexpr MathSize yurcorner () const noexcept
 Upper right corner Y coordinate in metres.
 
constexpr const string & proj4 () const noexcept
 Proj4 string defining coordinate system for this grid. Must be a UTM projection.
 
 GridBase (MathSize cell_size, MathSize xllcorner, MathSize yllcorner, MathSize xurcorner, MathSize yurcorner, const string_view proj4) noexcept
 Constructor.
 
void createPrj (const string_view dir, const string_view base_name) const
 Create .prj file in directory with base name for file.
 
std::optional< Coordinates > findCoordinates (const Point &point, bool flipped) const
 Find Coordinates for Point.
 
std::optional< FullCoordinates > findFullCoordinates (const Point &point, bool flipped) const
 Find FullCoordinates for Point.
 
bool validate (const Point &point) const
 
string saveToTiffFileInt (const Idx width, const Idx height, const tuple< Idx, Idx, Idx, Idx > bounds, const string_view dir, const string_view base_name, const uint16_t bits_per_sample, const bool is_unsigned, std::function< int(const XYIdx &)> value_at, const int nodata_as_int) const
 
string saveToTiffFileFloat (const Idx width, const Idx height, const tuple< Idx, Idx, Idx, Idx > bounds, const string_view dir, const string_view base_name, std::function< double(const XYIdx &)> value_at, const int nodata_as_int) const
 

Public Attributes

D data {}
 Structure that holds data represented by this GridData.
 

Protected Member Functions

virtual tuple< Idx, Idx, Idx, Idx > dataBounds () const =0
 
template<class R >
string saveToAsciiFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .asc file.
 
template<class R >
requires (std::is_floating_point_v<R>)
string saveToTiffFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .tif file.
 
template<class R >
requires (std::is_integral_v<R>)
string saveToTiffFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 
- Protected Member Functions inherited from fs::Grid< T, V >
 Grid (const MathSize cell_size, const Idx width, const Idx height, const V nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, const string_view proj4) noexcept
 
 Grid (const GridBase &grid_info, V no_data) noexcept
 Construct based on GridBase and no data value.
 

Detailed Description

template<class T, class V, class D>
class fs::GridData< T, V, D >

A Grid that defines the data structure used for storing values.

Template Parameters
TType of data after conversion from initialization type.
VType of data used as an input when initializing.
DThe data type that stores the values.

Member Function Documentation

◆ saveToAsciiFile()

template<class T , class V , class D >
template<class R >
string fs::GridData< T, V, D >::saveToAsciiFile ( const string_view dir,
const string_view base_name,
std::function< R(T value)> convert,
const R no_data ) const
inlineprotected

Save GridMap contents to .asc file.

Template Parameters
RType to be written to .asc file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToFile() [1/3]

template<class T , class V , class D >
template<class R = V>
FileList fs::GridData< T, V, D >::saveToFile ( const string_view dir,
const string_view base_name ) const
inlinenodiscard

Save GridMap contents to file based on settings.

Parameters
dirDirectory to save into
base_nameFile base name to use
Returns
FileList of file names saved to
Here is the call graph for this function:

◆ saveToFile() [2/3]

template<class T , class V , class D >
template<class R >
FileList fs::GridData< T, V, D >::saveToFile ( const string_view dir,
const string_view base_name,
std::function< R(T value)> convert ) const
inlinenodiscard

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
Returns
FileList of file names saved to
Here is the call graph for this function:

◆ saveToFile() [3/3]

template<class T , class V , class D >
template<class R >
FileList fs::GridData< T, V, D >::saveToFile ( const string_view dir,
const string_view base_name,
std::function< R(T value)> convert,
const R no_data ) const
inlinenodiscard

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output
Returns
FileList of file names saved to
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToFileWithoutRetry()

template<class T , class V , class D >
template<class R >
FileList fs::GridData< T, V, D >::saveToFileWithoutRetry ( const string_view dir,
const string_view base_name,
std::function< R(T value)> convert,
const R no_data ) const
inlinenodiscard

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output
Returns
FileList of file names saved to
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToFileWithRetry()

template<class T , class V , class D >
template<class R >
FileList fs::GridData< T, V, D >::saveToFileWithRetry ( const string_view dir,
const string_view base_name,
std::function< R(T value)> convert,
const R no_data ) const
inlinenodiscard

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output
Returns
FileList of file names saved to
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToTiffFile()

template<class T , class V , class D >
template<class R >
requires (std::is_floating_point_v<R>)
string fs::GridData< T, V, D >::saveToTiffFile ( const string_view dir,
const string_view base_name,
std::function< R(T value)> convert,
const R no_data ) const
inlineprotected

Save GridMap contents to .tif file.

Template Parameters
RType to be written to .tif file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
Here is the caller graph for this function:

◆ size()

template<class T , class V , class D >
size_t fs::GridData< T, V, D >::size ( ) const
inlinenodiscard

Size of data structure storing values.

Returns
Size of data structure storing values

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