Subversion Repositories public iLand

Rev

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

Rev Author Line No. Line
1033 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
 
716 werner 20
#ifndef WINDSCRIPT_H
21
#define WINDSCRIPT_H
22
 
23
#include <QObject>
1085 werner 24
#include <QJSValue>
25
 
716 werner 26
class WindModule; // forward
27
 
28
class WindScript : public QObject
29
{
30
    Q_OBJECT
31
public:
32
    explicit WindScript(QObject *parent = 0);
33
    void setModule(WindModule *module) { mModule = module; }
34
signals:
35
 
36
public slots:
37
    /** trigger a wind event from javascript.
38
      @param windspeed average wind speed (m/s)
959 werner 39
      @param winddireciton wind direction (0=N..180=S..270=W)
716 werner 40
      @param maximum_iterations maximum number of iterations
41
      @param simulate if true, trees are not really affected
42
      @param iteration if given a value >=0, then only one iteration is calculated ("interactive mode")
43
    */
44
    int windEvent(double windspeed, double winddirection, int max_iteration, bool simulate=false, int iteration=-1);
717 werner 45
    /// create a "ESRI-grid" text file 'grid_type' is one of a fixed list of names, 'file_name' the ouptut file location
46
    bool gridToFile(QString grid_type, QString file_name);
1085 werner 47
    /// returns a ScriptGrid with the requested type
48
    QJSValue grid(QString type);
748 werner 49
    /// initialize/ reset the wind module
50
    void initialize();
1157 werner 51
    /// initialize/reset the age of edges
52
    void initializeEdgeAge(int years);
717 werner 53
 
1081 werner 54
    /// number of damaged pixels with a patchsize>'threshold'; save to grid to "fileName" (if not empty)
55
    int damagedArea(int threshold, QString fileName);
1080 werner 56
 
716 werner 57
private:
58
    WindModule *mModule;
59
};
60
 
61
#endif // WINDSCRIPT_H