20#ifndef MODELCONTROLLER_H
21#define MODELCONTROLLER_H
74 void addPaintLayers(QObject *handler,
const QStringList names,
const QVector<GridViewType> view_types=QVector<GridViewType>());
77 QStringList
evaluateClick(QObject *handler,
const QPointF coord,
const QString &grid_name);
79 void setViewport(QPointF center_point,
double scale_px_per_m);
103 void fetchDynamicOutput();
104 void saveDebugOutputs(
bool is_final);
105 void saveDebugOutputsCore(QString p,
bool do_append);
118 bool mDynamicOutputEnabled;
119 QStringList mDynFieldList;
120 QStringList mDynData;
121 QString mLastLoadedJSFile;
Definition: layeredgrid.h:32
The main window of the iLand viewer.
Definition: mainwindow.h:21
Definition: modelcontroller.h:32
QStringList evaluateClick(QObject *handler, const QPointF coord, const QString &grid_name)
Definition: modelcontroller.cpp:690
bool canDestroy()
model may be destroyed
Definition: modelcontroller.cpp:99
double valueAtHandledGrid(QObject *handler, const QPointF coord, const int layer_id)
Definition: modelcontroller.cpp:695
void paintMap(MapGrid *map, double min_value, double max_value)
Definition: modelcontroller.cpp:601
bool runYear()
runs a single time step
Definition: modelcontroller.cpp:341
~ModelController()
Definition: modelcontroller.cpp:63
void setMainWindow(MainWindow *mw)
Definition: modelcontroller.h:37
void run(int years)
run the model
Definition: modelcontroller.cpp:318
void addPaintLayers(QObject *handler, const QStringList names, const QVector< GridViewType > view_types=QVector< GridViewType >())
Definition: modelcontroller.cpp:647
QList< const Species * > availableSpecies()
prepare a list of all (active) species
Definition: modelcontroller.cpp:78
QString lastError()
error message of the last received error
Definition: modelcontroller.h:51
bool isBusy()
model is running an operation (startup or simulation)
Definition: modelcontroller.h:49
void stateChanged()
is emitted when model started/stopped/paused
bool canCreate()
return true if the model can be created (settings loaded and model does not exist)
Definition: modelcontroller.cpp:92
void finished(QString errorMessage)
model has finished run (errorMessage is empty in case of success)
void bufferLogs(bool do_buffer)
signal indicating that logs should be buffered (true, model run mode) or that buffering should stop (...
Model * model() const
Definition: modelcontroller.h:40
void removeLayers(const LayeredGridBase *layers)
Definition: modelcontroller.cpp:636
Grid< double > * preparePaintGrid(QObject *handler, QString name, std::pair< QStringList, QStringList > *rNamesColors)
Definition: modelcontroller.cpp:668
void addGrid(const FloatGrid *grid, const QString &name, const GridViewType view_type, double min_value, double max_value)
Definition: modelcontroller.cpp:613
QString loadedJavascriptFile() const
Definition: modelcontroller.h:65
MainWindow * mainWindow()
Definition: modelcontroller.h:38
bool isPaused()
returns true if the model is currently paused
Definition: modelcontroller.cpp:123
bool pause()
pause execution, and if paused, continue to run. returns state after change, i.e. true=now in paused ...
Definition: modelcontroller.cpp:373
void setLoadedJavascriptFile(QString filename)
Definition: modelcontroller.h:64
QString timeString() const
return a string with elapsed time and estimated remaining time
Definition: modelcontroller.cpp:133
void setUIShortcuts(QVariantMap shortcuts)
Definition: modelcontroller.cpp:710
bool isRunning()
model is running
Definition: modelcontroller.cpp:111
void setFileName(QString initFileName)
set project file name
Definition: modelcontroller.cpp:146
void setDynamicOutputEnabled(bool enabled)
Definition: modelcontroller.h:59
void removePaintLayers(QObject *handler)
Definition: modelcontroller.cpp:658
void setViewport(QPointF center_point, double scale_px_per_m)
Definition: modelcontroller.cpp:700
void setupDynamicOutput(QString fieldList)
Definition: modelcontroller.cpp:427
void connectSignals()
Definition: modelcontroller.cpp:68
bool isFinished()
returns true if there is a valid model state, but the run is finished
Definition: modelcontroller.cpp:116
void saveScreenshot(QString file_name)
saves a screenshot of the central view widget to 'file_name'
Definition: modelcontroller.cpp:589
void repaint()
force a repaint of the main drawing window
Definition: modelcontroller.cpp:720
void year(int year)
signal indicating a year of the simulation has been processed
void create()
create the model
Definition: modelcontroller.cpp:160
bool hasError()
returns true if an error occured during the last operation
Definition: modelcontroller.h:50
bool continueRun()
continues execution if simulation was paused
Definition: modelcontroller.cpp:392
void destroy()
delete the model
Definition: modelcontroller.cpp:208
void cancel()
cancel execution of the model
Definition: modelcontroller.cpp:399
bool canRun()
model may be run
Definition: modelcontroller.cpp:104
bool isStartingUp()
model is in the creation phase
Definition: modelcontroller.h:46
int totalYears() const
returns total number of years to simulate
Definition: modelcontroller.h:54
QString dynamicOutput()
Definition: modelcontroller.cpp:447
int currentYear() const
return current year of the model
Definition: modelcontroller.cpp:128
void saveDebugOutputJs(bool do_clear)
save debug outputs, called from Javascript
Definition: modelcontroller.cpp:576
void addLayers(const LayeredGridBase *layers, const QString &name)
Definition: modelcontroller.cpp:626
void throwError(const QString msg)
Definition: modelcontroller.cpp:409
ModelController()
ModelController is a helper class used to control the flow of operations during a model run.
Definition: modelcontroller.cpp:50
Main object of the iLand model composited of various sub models / sub components.
Definition: model.h:90
The behavior and general properties of tree species.
Definition: species.h:75
GridViewType
Definition: grid.h:193