Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
959 werner 1
/********************************************************************************************
2
**    iLand - an individual based forest landscape and disturbance model
3
**    http://iland.boku.ac.at
4
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
5
**
6
**    This program is free software: you can redistribute it and/or modify
7
**    it under the terms of the GNU General Public License as published by
8
**    the Free Software Foundation, either version 3 of the License, or
9
**    (at your option) any later version.
10
**
11
**    This program is distributed in the hope that it will be useful,
12
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
**    GNU General Public License for more details.
15
**
16
**    You should have received a copy of the GNU General Public License
17
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
********************************************************************************************/
19
 
20
#ifndef BARKBEETLEPLUGIN_H
21
#define BARKBEETLEPLUGIN_H
22
 
23
#include <QObject>
24
#include "barkbeetlemodule.h"
25
 
26
#include "plugin_interface.h"
27
class BarkBeetlePlugin: public QObject,
28
        public DisturbanceInterface,
1044 werner 29
        public SetupResourceUnitInterface,
30
        public TreeDeathInterface
959 werner 31
{
32
    Q_OBJECT
33
    #if QT_VERSION >= 0x050000
34
    Q_PLUGIN_METADATA(IID "at.ac.boku.iland.barkbeetleplugin" FILE "barkbeetleplugin.json")
35
    #endif
1044 werner 36
    Q_INTERFACES(DisturbanceInterface SetupResourceUnitInterface TreeDeathInterface)
959 werner 37
 
38
 
39
public:
40
    BarkBeetlePlugin();
41
    // general interface details
42
    QString name(); ///< a unique name of the plugin
43
    QString version(); ///< a version identification
44
    QString description(); ///< some additional description. This info is shown in the GUI and is printed to the log file.
45
 
46
    // setup
47
    /// setup after the main iLand model frame is created
48
    void setup();
49
    /// setup resource unit specific parameters
50
    void setupResourceUnit(const ResourceUnit *ru) { mBeetle.setup(ru);}
51
    /// setup additional javascript related features
52
    void setupScripting(QJSEngine *engine);
53
 
1044 werner 54
    /// function is called whenever a tree dies in iLand (in order to track storm damage)
55
    void treeDeath(const Tree *tree, const int removal_type)   {  Q_UNUSED(removal_type); mBeetle.treeDeath(tree);   }
959 werner 56
 
57
    // calculations
58
    void yearBegin() { mBeetle.yearBegin(); }
59
    void run() { mBeetle.run(); }
60
 
61
    // special functions for direct access (testing)
62
    BarkBeetleModule *barkBeetleModule() { return &mBeetle; }
63
private:
64
    BarkBeetleModule mBeetle;
65
};
66
 
67
#endif // BARKBEETLEPLUGIN_H