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