Subversion Repositories public iLand

Rev

Rev 959 | Rev 962 | 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"
961 werner 23
#include "barkbeetlescript.h"
959 werner 24
#include "outputmanager.h"
25
 
26
#include <QObject>
27
#include <QJSValue>
28
#include <QJSEngine>
29
 
30
#if QT_VERSION < 0x050000
31
Q_EXPORT_PLUGIN2(iland_barkbeetle, BarkBeetlePlugin)
32
#endif
33
 
34
QString BarkBeetlePlugin::name()
35
{
36
    return "barkbeetle";
37
}
38
 
39
QString BarkBeetlePlugin::version()
40
{
41
    return "1.0";
42
}
43
 
44
QString BarkBeetlePlugin::description()
45
{
46
    return "bark beetle module for iLand.";
47
}
48
 
49
 
50
BarkBeetlePlugin::BarkBeetlePlugin()
51
{
52
    qDebug() << "Bark beetle plugin created";
53
    DBGMODE( qDebug("(bark beetle plugin in debug mode)"););
54
 
55
//    foreach (const ResourceUnit *ru, GlobalSettings::instance()->model()->ruList())
56
    //        qDebug() << ru->boundingBox() << ru->constTrees().count();
57
}
58
 
59
void BarkBeetlePlugin::setup()
60
{
61
//    // setup of the fire related outputs: note: here the fire module is passed directly to the output
62
//    FireOut *fire_output = new FireOut();
63
//    fire_output->setFireModule(&mFire);
64
//    GlobalSettings::instance()->outputManager()->addOutput(fire_output);
65
//    // setup of the fire module: load parameters from project file, etc.
66
//    mFire.setup();
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
 
961 werner 80
    qDebug() << "setup scripting called...";
959 werner 81
}
82
 
83
 
84
 
85
 
86