FireSTARR
Loading...
Searching...
No Matches
fs::ConstantGrid< T, V > Class Template Reference

A GridData<T, V, vector<T>> that cannot change once initialized. More...

#include <ConstantGrid.h>

Inheritance diagram for fs::ConstantGrid< T, V >:
Collaboration diagram for fs::ConstantGrid< T, V >:

Public Member Functions

constexpr T at (const XYIdx &location) const noexcept override
 
 ~ConstantGrid () override=default
 Throw an error because ConstantGrid can't change values.
 
 ConstantGrid (const ConstantGrid &rhs) noexcept=default
 
 ConstantGrid (ConstantGrid &&rhs) noexcept=default
 
ConstantGrid & operator= (const ConstantGrid &rhs) noexcept=default
 
ConstantGrid & operator= (ConstantGrid &&rhs) noexcept=default
 
 ConstantGrid (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, vector< T > &&data)
 
 ConstantGrid (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 string_view proj4, const T &initialization_value) noexcept
 
- Public Member Functions inherited from fs::GridData< T, T, vector< T > >
 GridData (const MathSize cell_size, const Idx width, const Idx height, const T nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, const string_view proj4, vector< T > &&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.
 
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.
 
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.
 
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.
 
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.
 
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, T >
constexpr Idx height () const noexcept
 
constexpr Idx width () const noexcept
 
constexpr T nodataInput () const noexcept
 Value used for grid locations that have no data.
 
constexpr T nodataValue () const noexcept
 Value representing no data.
 
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
 

Static Public Member Functions

static ConstantGrid< T, V > readTiff (const string_view filename, const Point &point, std::function< T(V, V)> convert)
 Read a section of a TIFF into a ConstantGrid.
 
static ConstantGrid< T, T > readTiff (const string_view filename, const Point &point)
 Read a section of a TIFF into a ConstantGrid.
 

Protected Member Functions

tuple< Idx, Idx, Idx, Idx > dataBounds () const override
 
- Protected Member Functions inherited from fs::GridData< T, T, vector< T > >
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.
 
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.
 
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, T >
 Grid (const MathSize cell_size, const Idx width, const Idx height, const T 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, T no_data) noexcept
 Construct based on GridBase and no data value.
 

Private Member Functions

 ConstantGrid (const GridBase &grid_info, const V nodata_input, const T nodata_value, vector< T > &&values)
 Constructor.
 

Additional Inherited Members

- Public Attributes inherited from fs::GridData< T, T, vector< T > >
vector< T > data
 Structure that holds data represented by this GridData.
 

Detailed Description

template<class T, class V = T>
class fs::ConstantGrid< T, V >

A GridData<T, V, vector<T>> that cannot change once initialized.

Template Parameters
TThe initialization value type.
VThe initialized value type.

Constructor & Destructor Documentation

◆ ConstantGrid()

template<class T , class V = T>
fs::ConstantGrid< T, V >::ConstantGrid ( const GridBase & grid_info,
const V nodata_input,
const T nodata_value,
vector< T > && values )
inlineprivate

Constructor.

Parameters
grid_infoGridBase defining Grid area
nodata_inputValue that represents no data for type V
nodata_valueValue that represents no data for type T
valuesValues to initialize grid with

Member Function Documentation

◆ at()

template<class T , class V = T>
T fs::ConstantGrid< T, V >::at ( const XYIdx & location) const
inlinenodiscardconstexproverridevirtualnoexcept

Implements fs::Grid< T, T >.

◆ dataBounds()

template<class T , class V = T>
tuple< Idx, Idx, Idx, Idx > fs::ConstantGrid< T, V >::dataBounds ( ) const
inlineoverrideprotectedvirtual

◆ readTiff() [1/2]

template<class T , class V = T>
static ConstantGrid< T, T > fs::ConstantGrid< T, V >::readTiff ( const string_view filename,
const Point & point )
inlinestaticnodiscard

Read a section of a TIFF into a ConstantGrid.

Parameters
filenameFile name to read from
pointPoint to center ConstantGrid on
Returns
ConstantGrid containing clipped data for TIFF
Here is the call graph for this function:

◆ readTiff() [2/2]

template<class T , class V = T>
static ConstantGrid< T, V > fs::ConstantGrid< T, V >::readTiff ( const string_view filename,
const Point & point,
std::function< T(V, V)> convert )
inlinestaticnodiscard

Read a section of a TIFF into a ConstantGrid.

Parameters
filenameFile name to read from
pointPoint to center ConstantGrid on
convertFunction taking int and nodata int value that returns T
Returns
ConstantGrid containing clipped data for TIFF
Here is the caller graph for this function:

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