Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
671 werner 1
/********************************************************************************************
2
**    iLand - an individual based forest landscape and disturbance model
3
**    http://iland.boku.ac.at
4
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
5
**
6
**    This program is free software: you can redistribute it and/or modify
7
**    it under the terms of the GNU General Public License as published by
8
**    the Free Software Foundation, either version 3 of the License, or
9
**    (at your option) any later version.
10
**
11
**    This program is distributed in the hope that it will be useful,
12
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
**    GNU General Public License for more details.
15
**
16
**    You should have received a copy of the GNU General Public License
17
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
********************************************************************************************/
19
 
641 werner 20
#include "global.h"
21
#include "fireplugin.h"
665 werner 22
#include "outputmanager.h"
23
#include "fireout.h"
674 werner 24
#include "firescript.h"
641 werner 25
 
674 werner 26
#include <QObject>
793 werner 27
#include <QJSValue>
28
#include <QJSEngine>
674 werner 29
 
780 werner 30
#if QT_VERSION < 0x050000
641 werner 31
Q_EXPORT_PLUGIN2(iland_fire, FirePlugin)
780 werner 32
#endif
641 werner 33
 
34
QString FirePlugin::name()
35
{
36
    return "fire";
37
}
38
 
39
QString FirePlugin::version()
40
{
701 werner 41
    return "1.0";
641 werner 42
}
43
 
44
QString FirePlugin::description()
45
{
46
    return "Fire disturbance module for iLand. The fire ignition and fire spread follows the FireBGC v2 model (Keane et al 2011), " \
47
            "the estimation of severity and fire effects Schumacher et al (2006). See http://iland.boku.ac.at/wildfire for details.\n" \
48
            "Designed and written by by Rupert Seidl/Werner Rammer.";
49
}
50
 
51
 
52
FirePlugin::FirePlugin()
53
{
54
    qDebug() << "Fire plugin created";
678 werner 55
    DBGMODE( qDebug("(Fire plugin in debug mode)"););
56
 
641 werner 57
//    foreach (const ResourceUnit *ru, GlobalSettings::instance()->model()->ruList())
645 werner 58
    //        qDebug() << ru->boundingBox() << ru->constTrees().count();
641 werner 59
}
645 werner 60
 
665 werner 61
void FirePlugin::setup()
62
{
63
    // setup of the fire related outputs: note: here the fire module is passed directly to the output
1054 werner 64
    GlobalSettings::instance()->outputManager()->removeOutput("fire");
665 werner 65
    FireOut *fire_output = new FireOut();
66
    fire_output->setFireModule(&mFire);
67
    GlobalSettings::instance()->outputManager()->addOutput(fire_output);
68
    // setup of the fire module: load parameters from project file, etc.
69
    mFire.setup();
70
}
645 werner 71
 
793 werner 72
//Q_SCRIPT_DECLARE_QMETAOBJECT(FireScript, QObject*)
645 werner 73
 
674 werner 74
// add the fire script interface
793 werner 75
void FirePlugin::setupScripting(QJSEngine *engine)
674 werner 76
{
77
    FireScript *fire_script = new FireScript();
78
    fire_script->setFireModule(&mFire);
793 werner 79
    QJSValue obj = engine->newQObject(fire_script);
674 werner 80
    engine->globalObject().setProperty("Fire", obj);
645 werner 81
 
674 werner 82
    qDebug() << "setup scripting called...";
83
}
645 werner 84
 
665 werner 85
 
674 werner 86
 
87
 
88