Subversion Repositories public iLand

Rev

Rev 375 | Rev 391 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef SEEDDISPERSAL_H
#define SEEDDISPERSAL_H

#include "grid.h"
class Species;

class SeedDispersal
{
public:
    SeedDispersal(Species *species=0): mIndexFactor(10), mSetup(false), mSpecies(species) {}
    ~SeedDispersal();
    bool isSetup() const { return mSetup; }
    void setup();
    // access
    const Grid<float> seedMap() const { return mSeedMap; } ///< access to the seedMap
    const Species *species() const {return mSpecies; }
    void setMatureTree(const QPoint &lip_index) { mSeedMap.valueAtIndex(lip_index.x()/mIndexFactor, lip_index.y()/mIndexFactor)=1.f; }
    // operations
    void clear(); ///< clears the grid
    void execute(); ///< execute the seed dispersal
    void loadFromImage(const QString &fileName); ///< debug function...
    void edgeDetection();
    void distribute();
private:
    int mIndexFactor;
    Grid<float> mSeedMap; ///< (large) seedmap. Is filled by individual trees and then processed
    Grid<float> mSeedKernel; ///< species specific "seed kernel" (small)
    int mOffset; ///< index of center pixel of kernel
    bool mSetup;
    Species *mSpecies;
};

#endif // SEEDDISPERSAL_H