iLand
Classes | Public Member Functions | Static Public Member Functions | List of all members
StampContainer Class Reference

Collection of Stamp for one tree species. More...

#include <stampcontainer.h>

Public Member Functions

 StampContainer ()
 
 ~StampContainer ()
 
void useLookup (const bool use)
 
void addStamp (Stamp *stamp, const float dbh, const float hd_value, const float crown_radius)
 addStamp() add a pre-allocated stamp More...
 
void addReaderStamp (Stamp *stamp, const float crown_radius_m)
 
const Stampstamp (const float bhd_cm, const float height_m) const
 fast access for an individual stamp using a lookup table. More...
 
const StampreaderStamp (const float crown_radius_m) const
 retrieve reader-stamp. More...
 
int count () const
 
void save (QDataStream &out)
 save the content of the StampContainer to the output stream (binary encoding) More...
 
void load (QDataStream &in)
 load the content of the StampContainer to the output stream (binary encoding) More...
 
void load (const QString &fileName)
 convenience function that loads stamps directly from a single file. More...
 
void attachReaderStamps (const StampContainer &source)
 this functions attaches the appropriate reader (dep. More...
 
void invert ()
 invert stamps (value = 1. - value) (for multiplicative overlay) More...
 
const QString & description ()
 
void setDescription (const QString s)
 
QString dump ()
 

Static Public Member Functions

static const Grid< float > & distanceGrid ()
 static function to retrieve distance grid. See Stamp::distanceToCenter More...
 

Detailed Description

Collection of Stamp for one tree species.

Per species several stamps are stored (different BHD, different HD relations). This class encapsulates storage and access to these stamps. The design goal is to deliver high access speeds for the "stamp()" method. Use getStamp(bhd, hd) or getStamp(bhd, height) to access.

Constructor & Destructor Documentation

◆ StampContainer()

StampContainer::StampContainer ( )

◆ ~StampContainer()

StampContainer::~StampContainer ( )

Member Function Documentation

◆ addReaderStamp()

void StampContainer::addReaderStamp ( Stamp stamp,
const float  crown_radius_m 
)

◆ addStamp()

void StampContainer::addStamp ( Stamp stamp,
const float  dbh,
const float  hd_value,
const float  crown_radius 
)

addStamp() add a pre-allocated stamp

add a stamp to the internal storage.

Parameters
stampto internal collection. Caller must allocate stamp on the heap, freeing is done by this class.

After loading the function finalizeSetup() must be called to ensure that gaps in the matrix get filled.

◆ attachReaderStamps()

void StampContainer::attachReaderStamps ( const StampContainer source)

this functions attaches the appropriate reader (dep.

on crown radius) to each stamp of the container. The reader-stamp is returned by a call to the reader()-function of the Stamp itself.

Parameters
Containerholding the reader stamps.

◆ count()

int StampContainer::count ( ) const
inline

◆ description()

const QString & StampContainer::description ( )
inline

◆ distanceGrid()

static const Grid< float > & StampContainer::distanceGrid ( )
inlinestatic

static function to retrieve distance grid. See Stamp::distanceToCenter

◆ dump()

QString StampContainer::dump ( )

◆ invert()

void StampContainer::invert ( )

invert stamps (value = 1. - value) (for multiplicative overlay)

◆ load() [1/2]

void StampContainer::load ( const QString &  fileName)

convenience function that loads stamps directly from a single file.

◆ load() [2/2]

void StampContainer::load ( QDataStream &  in)

load the content of the StampContainer to the output stream (binary encoding)

◆ readerStamp()

const Stamp * StampContainer::readerStamp ( const float  crown_radius_m) const

retrieve reader-stamp.

retrieve a read-out-stamp.

Parameters
radiusof crown in m.
Returns
the appropriate stamp or NULL if not found.

Readers depend solely on a crown radius. Internally, readers are stored in the same lookup-table, but using a encoding/decoding trick.

◆ save()

void StampContainer::save ( QDataStream &  out)

save the content of the StampContainer to the output stream (binary encoding)

Saves all stamps of the container to a binary stream.

Format: * count of stamps (int32) a string containing a description (free text) (QString) for each stamp:

  • type (enum Stamp::StampType, 4, 8, 12, 16, ...)
  • bhd of the stamp (float)
  • hd-value of the tree (float)
  • crownradius of the stamp (float) in [m]
  • the sum of values in the center of the stamp (used for read out)
  • the dominance value of the stamp
  • individual data values (Stamp::save() / Stamp::load()) – offset (int) no. of pixels away from center – list of data items (type*type items) see also stamp creation (FonStudio application, MainWindow.cpp).

◆ setDescription()

void StampContainer::setDescription ( const QString  s)
inline

◆ stamp()

const Stamp * StampContainer::stamp ( const float  bhd_cm,
const float  height_m 
) const

fast access for an individual stamp using a lookup table.

the dimensions of the lookup table are defined by class-constants. If stamp is not found there, the more complete list of stamps is searched.

◆ useLookup()

void StampContainer::useLookup ( const bool  use)
inline

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