Subversion Repositories public iLand

Rev

Rev 600 | Rev 639 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
106 Werner 2
#ifndef STANDLOADER_H
3
#define STANDLOADER_H
287 werner 4
#include <QtCore/QString>
106 Werner 5
 
6
class Model;
187 iland 7
class ResourceUnit;
290 werner 8
class RandomCustomPDF;
9
class Species;
603 werner 10
class MapGrid;
11
 
106 Werner 12
class StandLoader
13
{
14
public:
603 werner 15
    StandLoader(Model *model): mModel(model), mRandom(0), mCurrentMap(0) {}
290 werner 16
    ~StandLoader();
603 werner 17
    void setMap(const MapGrid *map) { mCurrentMap = map; }
106 Werner 18
    void processInit();
393 werner 19
    /// load a single tree file (picus or iland style). return number of trees loaded.
20
    int loadPicusFile(const QString &fileName, ResourceUnit *ru=NULL);
21
    /// load a tree distribution based on dbh classes. return number of trees loaded.
549 werner 22
    int loadiLandFile(const QString &fileName, ResourceUnit *ru=NULL, int stand_id=0);
389 werner 23
    int loadSingleTreeList(const QString &content, ResourceUnit*ru = NULL, const QString &fileName="");
549 werner 24
    int loadDistributionList(const QString &content, ResourceUnit *ru = NULL, int stand_id=0, const QString &fileName="");
600 werner 25
    // load regeneration in stands
26
    int loadSaplings(const QString &content, int stand_id, const QString &fileName=QString());
106 Werner 27
private:
290 werner 28
    struct InitFileItem
29
    {
30
        Species *species;
31
        int count;
32
        double dbh_from, dbh_to;
33
        double hd;
34
        int age;
311 werner 35
        double density;
290 werner 36
    };
393 werner 37
    /// load tree initialization from a file. return number of trees loaded.
549 werner 38
    int loadInitFile(const QString &fileName, const QString &type, int stand_id=0, ResourceUnit *ru=NULL);
393 werner 39
    void executeiLandInit(ResourceUnit *ru); ///< shuffle tree positions
549 werner 40
    void executeiLandInitStand(int stand_id); ///< shuffle tree positions
393 werner 41
    void copyTrees(); ///< helper function to quickly fill up the landscape by copying trees
42
    void evaluateDebugTrees(); ///< set debug-flag for trees by evaluating the param-value expression "debug_tree"
106 Werner 43
    Model *mModel;
290 werner 44
    RandomCustomPDF *mRandom;
600 werner 45
    QVector<InitFileItem> mInitItems;
603 werner 46
    const MapGrid *mCurrentMap;
106 Werner 47
};
48
 
49
#endif // STANDLOADER_H