Rev 962 | Rev 1015 | 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 | #include "global.h" |
||
22 | #include "barkbeetleplugin.h" |
||
1014 | werner | 23 | #include "barkbeetleout.h" |
24 | |||
961 | werner | 25 | #include "barkbeetlescript.h" |
959 | werner | 26 | #include "outputmanager.h" |
27 | |||
28 | #include <QObject> |
||
29 | #include <QJSValue> |
||
30 | #include <QJSEngine> |
||
31 | |||
32 | #if QT_VERSION < 0x050000 |
||
33 | Q_EXPORT_PLUGIN2(iland_barkbeetle, BarkBeetlePlugin) |
||
34 | #endif |
||
35 | |||
36 | QString BarkBeetlePlugin::name() |
||
37 | { |
||
38 | return "barkbeetle"; |
||
39 | } |
||
40 | |||
41 | QString BarkBeetlePlugin::version() |
||
42 | { |
||
43 | return "1.0"; |
||
44 | } |
||
45 | |||
46 | QString BarkBeetlePlugin::description() |
||
47 | { |
||
48 | return "bark beetle module for iLand."; |
||
49 | } |
||
50 | |||
51 | |||
52 | BarkBeetlePlugin::BarkBeetlePlugin() |
||
53 | { |
||
54 | qDebug() << "Bark beetle plugin created"; |
||
55 | DBGMODE( qDebug("(bark beetle plugin in debug mode)");); |
||
56 | |||
57 | // foreach (const ResourceUnit *ru, GlobalSettings::instance()->model()->ruList()) |
||
58 | // qDebug() << ru->boundingBox() << ru->constTrees().count(); |
||
59 | } |
||
60 | |||
61 | void BarkBeetlePlugin::setup() |
||
62 | { |
||
1014 | werner | 63 | // setup of the fire related outputs: note: here the fire module is passed directly to the output |
64 | BarkBeetleOut *bb_output = new BarkBeetleOut(); |
||
65 | bb_output->setBarkBeetleModule(&mBeetle); |
||
66 | GlobalSettings::instance()->outputManager()->addOutput(bb_output); |
||
67 | // setup of the fire module: load parameters from project file, etc. |
||
959 | werner | 68 | mBeetle.setup(); |
69 | } |
||
70 | |||
71 | //Q_SCRIPT_DECLARE_QMETAOBJECT(FireScript, QObject*) |
||
72 | |||
73 | // add the fire script interface |
||
74 | void BarkBeetlePlugin::setupScripting(QJSEngine *engine) |
||
75 | { |
||
961 | werner | 76 | BarkBeetleScript *script = new BarkBeetleScript(); |
77 | script->setBBModule(&mBeetle); |
||
78 | QJSValue obj = engine->newQObject(script); |
||
79 | engine->globalObject().setProperty("BarkBeetle", obj); |
||
959 | werner | 80 | |
1014 | werner | 81 | |
961 | werner | 82 | qDebug() << "setup scripting called..."; |
959 | werner | 83 | } |
84 | |||
85 | |||
86 | |||
87 | |||
88 |