Subversion Repositories public iLand

Rev

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