19#ifndef FORESTMANAGEMENTENGINE_H
20#define FORESTMANAGEMENTENGINE_H
62 void run(
int debug_year=-1);
93 const QMultiMap<FMUnit*, FMStand*> &
stands()
const {
return mUnitStandMap; }
94 const QVector<FMUnit*> &
units()
const {
return mUnits; }
97 FMStand *
standAt(QPointF coord)
const {
return mFMStandGrid.constValueAt(coord); }
110 QStringList
evaluateClick(
const QPointF coord,
const QString &grid_name);
114 static int mMaxStandId;
115 void setupScripting();
119 void runJavascript(
bool after_processing);
124 QVector<FMSTP*> mSTP;
130 QVector<FMUnit*> mUnits;
132 QMultiMap<FMUnit*, FMStand*> mUnitStandMap;
133 QVector<FMStand*> mStands;
134 QHash<int, FMStand*> mStandHash;
137 QVector<AgentType*> mAgentTypes;
138 QVector<Agent*> mAgents;
146 bool mStandLayoutChanged;
147 QString mLastErrorMessage;
The Agent is the core element of the agent based forest management model and simulates a foresters de...
Definition: agent.h:35
AgentType is the archtype agent including the agents decision logic.
Definition: agenttype.h:72
The FMSTP class encapsulates a stand treatment program, which is defined in Javascript.
Definition: fmstp.h:39
FMStand encapsulates a forest stand for the forest management engine.
Definition: fmstand.h:49
FomeScript provides general helping functions for the Javascript world.
Definition: fomescript.h:45
the ForestManagementEngine is the container for the agent based forest management engine.
Definition: forestmanagementengine.h:43
bool isCancel() const
Definition: forestmanagementengine.h:58
Agent * agent(const QString &name)
return the Agent with the name 'name' or NULL
Definition: forestmanagementengine.cpp:224
~ForestManagementEngine()
Definition: forestmanagementengine.cpp:93
static ForestManagementEngine * instance()
Definition: forestmanagementengine.h:49
void addSTP(FMSTP *stp)
add a stand treatment programme to the list of programs.
Definition: forestmanagementengine.h:77
QStringList evaluateClick(const QPointF coord, const QString &grid_name)
Definition: forestmanagementengine.cpp:708
void addAgentType(AgentType *at)
add an agent type (called from JS)
Definition: forestmanagementengine.h:79
QVariantList standIds() const
Definition: forestmanagementengine.cpp:745
bool enabled() const
Definition: forestmanagementengine.h:69
void addAgent(Agent *agent)
add an agent (called from JS)
Definition: forestmanagementengine.h:81
void yearEnd()
write outputs, finalize the current year should be called at the end of the year (after all disturban...
Definition: forestmanagementengine.cpp:603
void setup()
setup data structures
Definition: forestmanagementengine.cpp:292
int currentYear()
Definition: forestmanagementengine.h:68
ForestManagementEngine()
Definition: forestmanagementengine.cpp:83
void abortExecution(const QString &message)
Definition: forestmanagementengine.cpp:534
void clear()
delete all objects and free memory
Definition: forestmanagementengine.cpp:515
FMStand * splitExistingStand(FMStand *stand)
Definition: forestmanagementengine.cpp:786
static QJSEngine * scriptEngine()
access to the "global" Javascript engine
Definition: forestmanagementengine.cpp:718
void runOnInit(bool before_init)
run javascript code that can be used to initialize forest stands
Definition: forestmanagementengine.cpp:540
void setEnabled(bool enable)
Definition: forestmanagementengine.h:70
void initialize()
run initial stp
Definition: forestmanagementengine.cpp:479
bool notifyBarkbeetleAttack(const ResourceUnit *ru, const double generations, int n_infested_px)
called when bark beetle are likely going to spread
Definition: forestmanagementengine.cpp:767
void notifyTreeRemoval(Tree *tree, int reason)
called by iLand for every tree that is removed/harvested/died due to disturbance.
Definition: forestmanagementengine.cpp:753
void test()
evalaute forest management activities and select fitting activities for each forest stand
Definition: forestmanagementengine.cpp:648
FMStand * stand(int stand_id) const
get stand with id 'stand_id'. Return 0 if not found.
Definition: forestmanagementengine.cpp:732
FMStand * standAt(QPointF coord) const
Definition: forestmanagementengine.h:97
static const MapGrid * standGrid()
link to stand grid
Definition: forestmanagementengine.cpp:102
FMSTP * stp(QString stp_name) const
retrieve pointer to stand treatment programme. return 0-pointer if not available.
Definition: forestmanagementengine.cpp:724
const QMultiMap< FMUnit *, FMStand * > & stands() const
Definition: forestmanagementengine.h:93
FomeScript * scriptBridge() const
Definition: forestmanagementengine.h:73
const QVector< FMUnit * > & units() const
Definition: forestmanagementengine.h:94
AgentType * agentType(const QString &name)
return the agent type with the name 'name' or NULL
Definition: forestmanagementengine.cpp:216
void run(int debug_year=-1)
this is the main function of the forest management engine.
Definition: forestmanagementengine.cpp:556
ABELayers is a helper class for spatial visualization of ABE data.
Definition: abegrid.h:30
Grid class (template).
Definition: grid.h:44
ResourceUnit is the spatial unit that encapsulates a forest stand and links to several environmental ...
Definition: resourceunit.h:49
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44