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

#include <mapgrid.h>

Public Member Functions

 MapGrid ()
 
 MapGrid (const GisGrid &source_grid)
 create a MapGrid. the optional parameter "create_index" indicates if a spatial index (e.g. to query all pixels with a given value) should be built. More...
 
 MapGrid (const QString &fileName, const bool create_index=true)
 
bool loadFromFile (const QString &fileName, const bool create_index=true)
 load ESRI style text file More...
 
bool loadFromGrid (const GisGrid &source_grid, const bool create_index=true)
 load from an already present GisGrid More...
 
void createEmptyGrid ()
 create an empty grid with the size of the height grid of iLand (all values are 0, no index is created) More...
 
void createIndex ()
 (re-)creates the internal index (mRUIndex, mRectIndex, ...) More...
 
const QString & name () const
 
bool isValid () const
 
const Grid< int > & grid () const
 
int count () const
 number of stands stored in the index More...
 
bool isValid (const int id) const
 returns true, if 'id' is a valid id in the grid, false otherwise. More...
 
QRectF boundingBox (const int id) const
 returns the bounding box of a polygon More...
 
double area (const int id) const
 return the area (m2) covered by the polygon More...
 
QList< ResourceUnit * > resourceUnits (const int id) const
 returns the list of resource units with at least one pixel within the area designated by 'id' More...
 
QList< QPair< ResourceUnit *, double > > resourceUnitAreas (const int id) const
 returns a list with resource units and area factors per 'id'. More...
 
QList< Tree * > trees (const int id) const
 return a list of all living trees on the area 'id' More...
 
int loadTrees (const int id, QVector< QPair< Tree *, double > > &rList, const QString filter=QString(), int n_estimate=0) const
 load trees and store in list 'rList'. If 'filter'<>"", then the filter criterion is applied More...
 
QList< int > gridIndices (const int id) const
 return a list of grid-indices of a given stand-id More...
 
const QMultiHash< int, int > neighborList () const
 extract a list of neighborhood relationships between all the polygons of the grid More...
 
void updateNeighborList ()
 scan the map and fill the mNeighborList More...
 
QList< int > neighborsOf (const int index) const
 retrieve a list of saplings on a given stand polygon. More...
 
bool hasValue (const int id, const QPoint &lif_grid_coords) const
 return true, if the point 'lif_grid_coords' (x/y integer key within the LIF-Grid) More...
 
int standIDFromLIFCoord (const QPoint &lif_grid_coords) const
 return the stand-ID at the coordinates from the LIF-Grid (i.e., 2m grid). More...
 

Static Public Member Functions

static void freeLocksForStand (const int id)
 free locks for a given stand More...
 

Constructor & Destructor Documentation

◆ MapGrid() [1/3]

MapGrid::MapGrid ( )

◆ MapGrid() [2/3]

MapGrid::MapGrid ( const GisGrid source_grid)
inline

create a MapGrid. the optional parameter "create_index" indicates if a spatial index (e.g. to query all pixels with a given value) should be built.

◆ MapGrid() [3/3]

MapGrid::MapGrid ( const QString &  fileName,
const bool  create_index = true 
)
inline

Member Function Documentation

◆ area()

double MapGrid::area ( const int  id) const
inline

return the area (m2) covered by the polygon

◆ boundingBox()

QRectF MapGrid::boundingBox ( const int  id) const
inline

returns the bounding box of a polygon

◆ count()

int MapGrid::count ( ) const
inline

number of stands stored in the index

◆ createEmptyGrid()

void MapGrid::createEmptyGrid ( )

create an empty grid with the size of the height grid of iLand (all values are 0, no index is created)

◆ createIndex()

void MapGrid::createIndex ( )

(re-)creates the internal index (mRUIndex, mRectIndex, ...)

◆ freeLocksForStand()

void MapGrid::freeLocksForStand ( const int  id)
static

free locks for a given stand

◆ grid()

const Grid< int > & MapGrid::grid ( ) const
inline

◆ gridIndices()

QList< int > MapGrid::gridIndices ( const int  id) const

return a list of grid-indices of a given stand-id

return a list of grid-indices of a given stand-id (a grid-index is the index of 10m x 10m pixels within the internal storage) The selection is limited to pixels within the world's extent

◆ hasValue()

bool MapGrid::hasValue ( const int  id,
const QPoint &  lif_grid_coords 
) const
inline

return true, if the point 'lif_grid_coords' (x/y integer key within the LIF-Grid)

◆ isValid() [1/2]

bool MapGrid::isValid ( ) const
inline

◆ isValid() [2/2]

bool MapGrid::isValid ( const int  id) const
inline

returns true, if 'id' is a valid id in the grid, false otherwise.

◆ loadFromFile()

bool MapGrid::loadFromFile ( const QString &  fileName,
const bool  create_index = true 
)

load ESRI style text file

◆ loadFromGrid()

bool MapGrid::loadFromGrid ( const GisGrid source_grid,
const bool  create_index = true 
)

load from an already present GisGrid

◆ loadTrees()

int MapGrid::loadTrees ( const int  id,
QVector< QPair< Tree *, double > > &  rList,
const QString  filter = QString(),
int  n_estimate = 0 
) const

load trees and store in list 'rList'. If 'filter'<>"", then the filter criterion is applied

◆ name()

const QString & MapGrid::name ( ) const
inline

◆ neighborList()

const QMultiHash< int, int > MapGrid::neighborList ( ) const
inline

extract a list of neighborhood relationships between all the polygons of the grid

◆ neighborsOf()

QList< int > MapGrid::neighborsOf ( const int  index) const

retrieve a list of saplings on a given stand polygon.

retrieve a list of all stands that are neighbors of the stand with ID "index".

◆ resourceUnitAreas()

QList< QPair< ResourceUnit *, double > > MapGrid::resourceUnitAreas ( const int  id) const
inline

returns a list with resource units and area factors per 'id'.

the area is '1' if the resource unit is fully covered by the grid-value.

◆ resourceUnits()

QList< ResourceUnit * > MapGrid::resourceUnits ( const int  id) const

returns the list of resource units with at least one pixel within the area designated by 'id'

◆ standIDFromLIFCoord()

int MapGrid::standIDFromLIFCoord ( const QPoint &  lif_grid_coords) const
inline

return the stand-ID at the coordinates from the LIF-Grid (i.e., 2m grid).

◆ trees()

QList< Tree * > MapGrid::trees ( const int  id) const

return a list of all living trees on the area 'id'

return a list of all living trees on the area denoted by 'id'

◆ updateNeighborList()

void MapGrid::updateNeighborList ( )

scan the map and fill the mNeighborList

scan the map and add neighborhood-relations to the mNeighborList the 4-neighborhood is used to identify neighbors.


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