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

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

#include <ConstantGrid.h>

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

Public Member Functions

constexpr T at (const Location &location) const noexcept override
 Value for grid at given Location.
 
template<class P >
constexpr T at (const Position< P > &position) const noexcept
 
 ~ConstantGrid ()=default
 Value for grid at given Location.
 
 ConstantGrid (const ConstantGrid &rhs) noexcept=delete
 
 ConstantGrid (ConstantGrid &&rhs) noexcept=delete
 
ConstantGridoperator= (const ConstantGrid &rhs) noexcept=delete
 
ConstantGridoperator= (ConstantGrid &&rhs) noexcept=delete
 
 ConstantGrid (const MathSize cell_size, const Idx rows, const Idx columns, const V nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4, vector< T > &&data)
 Constructor.
 
 ConstantGrid (const MathSize cell_size, const Idx rows, const Idx columns, const V nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const string &proj4, const T &initialization_value) noexcept
 Constructor.
 
- Public Member Functions inherited from fs::data::GridData< T, T, const vector< T > >
 GridData (const MathSize cell_size, const Idx rows, const Idx columns, const T nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4, const vector< T > &&data)
 Constructor.
 
 GridData (const GridData &rhs)
 Copy constructor.
 
 GridData (GridData &&rhs) noexcept
 Move constructor.
 
GridDataoperator= (const GridData &rhs) noexcept
 Copy assignment.
 
GridDataoperator= (GridData &&rhs) noexcept
 Move assignment.
 
size_t size () const
 Size of data structure storing values.
 
string saveToFileWithoutRetry (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
string saveToFileWithRetry (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
string saveToFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
string saveToFile (const string &dir, const string &base_name, std::function< R(T value)> convert) const
 Save GridMap contents to file based on settings.
 
string saveToFile (const string &dir, const string &base_name) const
 Save GridMap contents to file based on settings.
 
- Public Member Functions inherited from fs::data::Grid< T, T >
constexpr Idx rows () const noexcept
 Number of rows in the GridBase.
 
constexpr Idx columns () const noexcept
 Number of columns in the GridBase.
 
constexpr T nodataInput () const noexcept
 Value used for grid locations that have no data.
 
constexpr T nodataValue () const noexcept
 Value representing no data.
 
at (const Position< P > &position) const
 
virtual void set (const Location &location, T value)=0
 Set value for grid at given Location.
 
void set (const Position< P > &position, const T value)
 
- Public Member Functions inherited from fs::data::GridBase
 GridBase (GridBase &&rhs) noexcept=default
 Move constructor.
 
 GridBase (const GridBase &rhs)=default
 Copy constructor.
 
GridBaseoperator= (const GridBase &rhs)=default
 Copy assignment.
 
GridBaseoperator= (GridBase &&rhs) noexcept=default
 Move assignment.
 
constexpr MathSize cellSize () const noexcept
 Cell size used for GridBase.
 
constexpr FullIdx calculateRows () const noexcept
 Number of rows in the GridBase.
 
constexpr FullIdx calculateColumns () const noexcept
 Number of columns in the GridBase.
 
constexpr MathSize xllcorner () const noexcept
 Lower left corner X coordinate in meters.
 
constexpr MathSize yllcorner () const noexcept
 Lower left corner Y coordinate in meters.
 
constexpr MathSize xurcorner () const noexcept
 Upper right corner X coordinate in meters.
 
constexpr MathSize yurcorner () const noexcept
 Upper right corner Y coordinate in meters.
 
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, string &&proj4) noexcept
 Constructor.
 
 GridBase () noexcept
 Default constructor.
 
void createPrj (const string &dir, const string &base_name) const
 Create .prj file in directory with base name for file.
 
unique_ptr< Coordinates > findCoordinates (const topo::Point &point, bool flipped) const
 Find Coordinates for Point.
 
unique_ptr< FullCoordinates > findFullCoordinates (const topo::Point &point, bool flipped) const
 Find FullCoordinates for Point.
 

Static Public Member Functions

static ConstantGrid< T, V > * readTiff (const string &filename, TIFF *tif, GTIF *gtif, const topo::Point &point, std::function< T(V, V)> convert)
 Read a section of a TIFF into a ConstantGrid.
 
static ConstantGrid< T, V > * readTiff (const string &filename, const topo::Point &point, std::function< T(V, V)> convert)
 Read a section of a TIFF into a ConstantGrid.
 
static ConstantGrid< T, T > * readTiff (const string &filename, const topo::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::data::GridData< T, T, const vector< T > >
string saveToAsciiFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .asc file.
 
string saveToTiffFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .tif file.
 
- Protected Member Functions inherited from fs::data::Grid< T, T >
 Grid (const MathSize cell_size, const Idx rows, const Idx columns, const T nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4) noexcept
 Constructor.
 
 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::data::GridData< T, T, const vector< T > >
const vector< T > data
 Structure that holds data represented by this GridData.
 

Detailed Description

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

A GridData<T, V, const 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::data::ConstantGrid< T, V >::~ConstantGrid ( )
default

Value for grid at given Location.

Parameters
hashHashSize hash for Location to get value for.
Returns
Value at grid Location.

Throw an error because ConstantGrid can't change values.

◆ ConstantGrid() [1/3]

template<class T , class V = T>
fs::data::ConstantGrid< T, V >::ConstantGrid ( const MathSize cell_size,
const Idx rows,
const Idx columns,
const V nodata_input,
const T nodata_value,
const MathSize xllcorner,
const MathSize yllcorner,
const MathSize xurcorner,
const MathSize yurcorner,
string && proj4,
vector< T > && data )
inline

Constructor.

Parameters
cell_sizeCell width and height (m)
rowsNumber of rows
columnsNumber of columns
nodata_inputValue that represents no data for type V
nodata_valueValue that represents no data for type T
xllcornerLower left corner X coordinate (m)
yllcornerLower left corner Y coordinate (m)
xurcornerUpper right corner X coordinate (m)
yurcornerUpper right corner Y coordinate (m)
proj4Proj4 projection definition
dataData to set as grid data

◆ ConstantGrid() [2/3]

template<class T , class V = T>
fs::data::ConstantGrid< T, V >::ConstantGrid ( const MathSize cell_size,
const Idx rows,
const Idx columns,
const V nodata_input,
const T nodata_value,
const MathSize xllcorner,
const MathSize yllcorner,
const string & proj4,
const T & initialization_value )
inlinenoexcept

Constructor.

Parameters
cell_sizeCell width and height (m)
rowsNumber of rows
columnsNumber of columns
nodata_inputValue that represents no data for type V
nodata_valueValue that represents no data for type T
xllcornerLower left corner X coordinate (m)
yllcornerLower left corner Y coordinate (m)
proj4Proj4 projection definition
initialization_valueValue to initialize entire grid with

◆ ConstantGrid() [3/3]

template<class T , class V = T>
fs::data::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::data::ConstantGrid< T, V >::at ( const Location & location) const
inlinenodiscardconstexproverridevirtualnoexcept

Value for grid at given Location.

Parameters
locationLocation to get value for.
Returns
Value at grid Location.

Implements fs::data::Grid< T, T >.

Here is the caller graph for this function:

◆ dataBounds()

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

◆ readTiff() [1/3]

template<class T , class V = T>
static ConstantGrid< T, T > * fs::data::ConstantGrid< T, V >::readTiff ( const string & filename,
const topo::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/3]

template<class T , class V = T>
static ConstantGrid< T, V > * fs::data::ConstantGrid< T, V >::readTiff ( const string & filename,
const topo::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 V and nodata V value that returns T
Returns
ConstantGrid containing clipped data for TIFF
Here is the call graph for this function:

◆ readTiff() [3/3]

template<class T , class V = T>
static ConstantGrid< T, V > * fs::data::ConstantGrid< T, V >::readTiff ( const string & filename,
TIFF * tif,
GTIF * gtif,
const topo::Point & point,
std::function< T(V, V)> convert )
inlinestaticnodiscard

Read a section of a TIFF into a ConstantGrid.

Parameters
filenameFile name to read from
tifPointer to open TIFF denoted by filename
gtifPointer to open geotiff denoted by filename
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 call graph for this function:
Here is the caller graph for this function:

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