Subversion Repositories public iLand

Rev

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