FomeScript provides general helping functions for the Javascript world.
More...
#include <fomescript.h>
|
void | log (QJSValue value) |
| logging function (which includes exeuction context) More...
|
|
void | abort (QJSValue message) |
| abort execution More...
|
|
bool | addManagement (QJSValue program, QString name) |
| adds a management program (STP) that is provided as the Javascript object 'program'. 'name' is used internally. More...
|
|
bool | updateManagement (QJSValue program, QString name) |
| set the STP with the name 'name' to the (new) 'program'. More...
|
|
bool | addManagementToAgentType (QString name, QString agentname) |
| add a certain stp (given by 'name') to the agent 'agentname'. Returns false if either stp or agent were not found. More...
|
|
bool | addAgentType (QJSValue program, QString name) |
| add an agent definition (Javascript). 'name' is used internally. Returns true on success. More...
|
|
QJSValue | addAgent (QString agent_type, QString agent_name) |
| create an agent of type 'agent_type' (the name of an agent type) and give the name 'agent_name'. 'agent_name' needs to be unique. More...
|
|
QJSValue | addAgent (QJSValue program, QString name) |
| create an agent with name 'name' and implicitly an AgentType with the same name More...
|
|
bool | runActivity (int stand_id, QString activity) |
| executes an activity for stand 'stand_id'. More...
|
|
bool | runActivityEvaluate (int stand_id, QString activity) |
| executes an the "evaluate" part of the activity for stand 'stand_id'. More...
|
|
bool | runAgent (int stand_id, QString function) |
| execute 'function' of the agent for the given stand; this is primarily aimed at testing/debugging. More...
|
|
bool | isValidStand (int stand_id) |
|
QJSValue | activity (QString stp_name, QString activity_name) |
|
void | runPlanting (int stand_id, QJSValue planting_item) |
|
QJSValue | test (QJSValue val) |
|
|
static void | setExecutionContext (FMStand *stand, bool add_agent=false) |
| prepares the context for executing javascript functions by setting up all internal structures for the forest stand 'stand'. More...
|
|
static void | setActivity (Activity *act) |
| special function for setting context without a valid stand More...
|
|
static FomeScript * | bridge () |
| static accessor function for the responsible script bridge More...
|
|
static QString | JStoString (QJSValue value) |
| convert a javascript object to a string (for debug output) More...
|
|
static int | levelIndex (const QString &level_label) |
|
static const QString | levelLabel (const int level_index) |
|
FomeScript provides general helping functions for the Javascript world.
The FomeScript class is visible to Javascript via the 'fmengine' object.
the object is known as 'fmengine'.
The main functions of ABE are available through this class.
◆ FomeScript()
ABE::FomeScript::FomeScript |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
◆ ~FomeScript()
ABE::FomeScript::~FomeScript |
( |
| ) |
|
◆ abort
void ABE::FomeScript::abort |
( |
QJSValue |
message | ) |
|
|
slot |
◆ activity
QJSValue ABE::FomeScript::activity |
( |
QString |
stp_name, |
|
|
QString |
activity_name |
|
) |
| |
|
slot |
◆ activityObj()
◆ addAgent [1/2]
QJSValue ABE::FomeScript::addAgent |
( |
QJSValue |
program, |
|
|
QString |
name |
|
) |
| |
|
slot |
create an agent with name 'name' and implicitly an AgentType with the same name
◆ addAgent [2/2]
QJSValue ABE::FomeScript::addAgent |
( |
QString |
agent_type, |
|
|
QString |
agent_name |
|
) |
| |
|
slot |
create an agent of type 'agent_type' (the name of an agent type) and give the name 'agent_name'. 'agent_name' needs to be unique.
◆ addAgentType
bool ABE::FomeScript::addAgentType |
( |
QJSValue |
program, |
|
|
QString |
name |
|
) |
| |
|
slot |
add an agent definition (Javascript). 'name' is used internally. Returns true on success.
◆ addManagement
bool ABE::FomeScript::addManagement |
( |
QJSValue |
program, |
|
|
QString |
name |
|
) |
| |
|
slot |
adds a management program (STP) that is provided as the Javascript object 'program'. 'name' is used internally.
◆ addManagementToAgentType
bool ABE::FomeScript::addManagementToAgentType |
( |
QString |
name, |
|
|
QString |
agentname |
|
) |
| |
|
slot |
add a certain stp (given by 'name') to the agent 'agentname'. Returns false if either stp or agent were not found.
◆ bridge()
static accessor function for the responsible script bridge
◆ context()
const QString & ABE::FomeScript::context |
( |
| ) |
const |
|
inline |
returns a string for debug/trace messages
◆ enabled()
bool ABE::FomeScript::enabled |
( |
| ) |
const |
◆ isValidStand
bool ABE::FomeScript::isValidStand |
( |
int |
stand_id | ) |
|
|
slot |
◆ JStoString()
QString ABE::FomeScript::JStoString |
( |
QJSValue |
value | ) |
|
|
static |
convert a javascript object to a string (for debug output)
◆ levelIndex()
int ABE::FomeScript::levelIndex |
( |
const QString & |
level_label | ) |
|
|
static |
◆ levelLabel()
const QString ABE::FomeScript::levelLabel |
( |
const int |
level_index | ) |
|
|
static |
◆ log
void ABE::FomeScript::log |
( |
QJSValue |
value | ) |
|
|
slot |
logging function (which includes exeuction context)
◆ runActivity
bool ABE::FomeScript::runActivity |
( |
int |
stand_id, |
|
|
QString |
activity |
|
) |
| |
|
slot |
executes an activity for stand 'stand_id'.
force execution of an activity (outside of the usual execution context, e.g. for debugging)
This bypasses the normal scheduling (useful for debugging/testing). returns false if activity could not be found for the stand.
◆ runActivityEvaluate
bool ABE::FomeScript::runActivityEvaluate |
( |
int |
stand_id, |
|
|
QString |
activity |
|
) |
| |
|
slot |
executes an the "evaluate" part of the activity for stand 'stand_id'.
This bypasses the normal scheduling (useful for debugging/testing). returns false if activity could not be found for the stand.
◆ runAgent
bool ABE::FomeScript::runAgent |
( |
int |
stand_id, |
|
|
QString |
function |
|
) |
| |
|
slot |
execute 'function' of the agent for the given stand; this is primarily aimed at testing/debugging.
◆ runPlanting
void ABE::FomeScript::runPlanting |
( |
int |
stand_id, |
|
|
QJSValue |
planting_item |
|
) |
| |
|
slot |
◆ setActivity()
void ABE::FomeScript::setActivity |
( |
Activity * |
act | ) |
|
|
static |
special function for setting context without a valid stand
◆ setEnabled()
void ABE::FomeScript::setEnabled |
( |
bool |
enable | ) |
|
◆ setExecutionContext()
void ABE::FomeScript::setExecutionContext |
( |
FMStand * |
stand, |
|
|
bool |
add_agent = false |
|
) |
| |
|
static |
prepares the context for executing javascript functions by setting up all internal structures for the forest stand 'stand'.
◆ setStandId()
void ABE::FomeScript::setStandId |
( |
int |
new_stand_id | ) |
|
◆ setStandVisualization()
void ABE::FomeScript::setStandVisualization |
( |
QString |
vis | ) |
|
|
inline |
◆ setupScriptEnvironment()
void ABE::FomeScript::setupScriptEnvironment |
( |
| ) |
|
◆ setVerbose()
void ABE::FomeScript::setVerbose |
( |
bool |
arg | ) |
|
◆ siteObj()
UnitObj * ABE::FomeScript::siteObj |
( |
| ) |
const |
|
inline |
◆ standId()
int ABE::FomeScript::standId |
( |
| ) |
const |
◆ standIds()
QVariantList ABE::FomeScript::standIds |
( |
| ) |
|
a list of all stand-ids that are currently in the landscape
◆ standObj()
StandObj * ABE::FomeScript::standObj |
( |
| ) |
const |
|
inline |
◆ standVisualization()
QString ABE::FomeScript::standVisualization |
( |
| ) |
const |
|
inline |
◆ test
QJSValue ABE::FomeScript::test |
( |
QJSValue |
val | ) |
|
|
slot |
◆ treeRef()
QJSValue ABE::FomeScript::treeRef |
( |
Tree * |
tree | ) |
|
get a JS-Object referencing a single tree
◆ treesObj()
◆ updateManagement
bool ABE::FomeScript::updateManagement |
( |
QJSValue |
program, |
|
|
QString |
name |
|
) |
| |
|
slot |
set the STP with the name 'name' to the (new) 'program'.
This reloads the STP definition (and all activities). if 'name' is not present, nothing happens.
◆ verbose()
bool ABE::FomeScript::verbose |
( |
| ) |
const |
verbose: when true, the logging intensity is increased significantly.
◆ enabled
bool ABE::FomeScript::enabled |
|
readwrite |
◆ standId
int ABE::FomeScript::standId |
|
readwrite |
◆ standIds
QVariantList ABE::FomeScript::standIds |
|
read |
◆ standVisualization
QString ABE::FomeScript::standVisualization |
|
readwrite |
◆ verbose
bool ABE::FomeScript::verbose |
|
readwrite |
The documentation for this class was generated from the following files: