iLand
biteimpact.h
Go to the documentation of this file.
1/********************************************************************************************
2** iLand - an individual based forest landscape and disturbance model
3** http://iland-model.org
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#ifndef BITEIMPACT_H
20#define BITEIMPACT_H
21
22#include "biteitem.h"
23#include "bitecellscript.h"
24
25namespace BITE {
26
27
28class BiteImpact: public BiteItem
29{
30 Q_OBJECT
31
32public:
33 Q_INVOKABLE BiteImpact(QJSValue obj);
34 void setup(BiteAgent *parent_agent);
35 QString info();
36 // void notify(BiteCell *cell, BiteCell::ENotification what);
37
38public slots:
39 void afterSetup();
40 void runCell(BiteCell *cell, ABE::FMTreeList *treelist, ABE::FMSaplingList *saplist);
41
42protected:
43 QStringList allowedProperties();
44private:
45 struct BiteImpactItem {
46 void setup(QJSValue obj, int index, BiteAgent *parent_agent);
47 enum ImpactTarget {Tree, Foliage, Root, Sapling, Browsing, Invalid};
48 ImpactTarget target;
49 DynamicExpression fractionOfTrees;
50 DynamicExpression fractionPerTree;
51 DynamicExpression maxTrees;
52 DynamicExpression maxBiomass;
53 Expression treeFilter;
54 double fineRootMultiplier;
55 bool hasMaxTrees() const { return maxTrees.isValid(); }
56 bool hasMaxBiomass() const { return maxBiomass.isValid(); }
57 bool hasFractionOfTrees() const { return fractionOfTrees.isValid(); }
58 bool hasFractionPerTree() const { return fractionPerTree.isValid(); }
59 QString order;
60 int id;
61 };
62 bool runImpact(BiteImpactItem *item, BiteCell *cell, ABE::FMTreeList *treelist, ABE::FMSaplingList *saplist);
63 bool runImpactTrees(BiteImpactItem *item, BiteCell *cell, ABE::FMTreeList *treelist);
64 bool runImpactSaplings(BiteImpactItem *item, BiteCell *cell, ABE::FMSaplingList *saplist);
65
66 DynamicExpression mImpactFilter;
67 QString mHostTreeFilter;
68 bool mSimulate;
69 Events mEvents;
70 QString mImportOrder;
71 bool mVerbose;
72
73 QVector<BiteImpactItem *> mItems;
74
75};
76
77
78} // end namespace
79
80#endif // BITEIMPACT_H
Definition: fmsaplinglist.h:12
The FMTreeList class implements low-level functionality for selecting and harvesting of trees.
Definition: fmtreelist.h:34
Definition: biteagent.h:71
Definition: bitecell.h:38
Definition: biteimpact.h:29
QStringList allowedProperties()
Definition: biteimpact.cpp:143
Q_INVOKABLE BiteImpact(QJSValue obj)
Definition: biteimpact.cpp:26
void runCell(BiteCell *cell, ABE::FMTreeList *treelist, ABE::FMSaplingList *saplist)
Definition: biteimpact.cpp:91
void afterSetup()
Definition: biteimpact.cpp:85
void setup(BiteAgent *parent_agent)
Definition: biteimpact.cpp:31
QString info()
Definition: biteimpact.cpp:78
Definition: biteitem.h:37
Definition: bitecellscript.h:88
An expression engine for mathematical expressions provided as strings.
Definition: expression.h:29
saplings from 5cm to 4m
Definition: sapling.h:48
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44
Definition: biteagent.cpp:32
DynamicExpression encapsulates an "expression" that can be either a iLand expression,...
Definition: bitecellscript.h:111
bool isValid() const
Definition: bitecellscript.h:127