26#include <QMutexLocker>
82 QDir baseDir = file.absoluteDir();
89 QVector<QString> qscenarios;
90 for(uint i=0;i<scenarios.size();i++){
91 qscenarios.push_back(scenarios.at(i).c_str());
110 emit
upgradeLogArea(
"**INFO: Model has stopped or rised an error (read previous line).");
120 cout <<
"Selected scenario: "+
scenarioName.toStdString() << endl;
131 QDir baseDir = file.absoluteDir();
133 cout <<
"Using base directory: "<<
baseDirectory.toStdString() << endl;
138 if( scenarioName_h ==
""){
154 QDir baseDir = file.absoluteDir();
166 if (
DO) {
delete DO;
DO=0;}
170 if (
MD) {
delete MD;
MD=0;}
246 QString message = message_h.c_str();
260 QString layerName = layerName_h.c_str();
261 QString layerLabel = layerLabel_h.c_str();
283 temp=
i2s(year).c_str();
294 QMutexLocker locker(&
mutex);
317 vector<Layers*> layers;
328 emit
publishQueryResults(
"Query result: Spatial data is not yet ready in the model. Please click again later.");
336 emit
publishQueryResults(
"Query result: Spatial data is not yet ready in the model. Please click again later.");
340 result +=
i2s(realID).c_str();
342 result +=
i2s(px->
getX()).c_str();
344 result +=
i2s(px->
getY()).c_str();
346 result +=
"<p><table>";
347 uint countVisibleLayers = 0;
348 for (uint i=0;i<layers.size();i++){
349 if(!layers[i]->getDisplay()){
352 QString boldStart=
"";
353 QString boldEnd =
"";
354 if (countVisibleLayers == currentLayerIndex){
359 string layerName = layers[i]->getName();
361 string category = layers[i]->getCategory(value);
365 result += layerName.c_str();
367 result +=
"</td><td>";
369 result += category.c_str();
373 if(layers[i]->getDisplay()){
374 countVisibleLayers++;
377 result +=
"</table>";
This file is the header of BaseClass and it is included by ALL compiled code.
@ MSG_INFO
Print an INFO message.
string i2s(const int &int_h) const
integer to string conversion
vector< Layers * > getLayerPointers()
Return a vector of pointers of existing layers.
Pixel * getPixel(int x_h, int y_h)
int sub2realID(int id_h)
Transform the ID of a pixel in subregion coordinates to the real (and model used) coordinates.
Main program scheleton. It control the flow of the program.
void run()
Run the program.
vector< string > getScenarios()
double getDoubleValue(const string &layerName_h, const bool &returnZeroForNoValue=false) const
Return the value for a specific layer.
void activateTab(int pos_h)
void sendScenarioOptionsToGUI(const QVector< QString > &scenarios_h)
Init * INIT
the Init object (pre-simulation scheduler)
void upgradeMainSBLabelToGui(const QString &logMessage)
void resetGUIForNewSimulation()
void upgradeMainSBLabel(const string message_h)
void updateImage(string layerName_h, const QImage &image_h)
void updatePixel(string layerName_h, int x_h, int y_h, QColor color)
void runFromConsole(QString inputFileName_h, QString scenarioName_h)
Re-draw the map making it to fit (with the right proportions) to the widget.
Carbon * CBAL
Module for the Carbon Balance.
Scheduler * SCD
the scheduler object (simulation-loops scheduler)
ModelCoreSpatial * SCORE
Core of the model (spatial version)
void publishQueryResults(const QString &results)
Sandbox * TEST
Various debugging code for development.
void addLayerToGui(QString layerName, QString layerLabel)
void upgradeYearSBLabelToGui(const QString &logMessage)
void msgOut(const int msgCode_h, const string message_h)
Gis * GIS
GIS information and methods.
volatile int layerQueryPos
ModelData * MD
the model data object
void updateImageToGui(QString layerName_h, QImage image_h)
std::mt19937 * gen
used in the sampling from normal distribution
void setGUIUnsavedStatus(bool status_h)
void addLayer(string layerName_h, string layerLabel_h)
void deleteDeadOldPointers()
Useful for several model running without leaving the GUI.
ModelCore * CORE
Core of the model.
void upgradeYearSBLabel(int year)
void setInputFileName(QString inputFileName_h)
void setMessage(const QString &message)
void checkQuery(int px_ID, int currentLayerIndex, bool newRequest=true)
Switch and control the access to pxQueryID and layerQueryPos members.
void setOutputDirNameToGui(string outputDirname_h)
void upgradeLogArea(const QString &logMessage)
void retrieveScenarioNameFromGUI(const QString &scenarioName_h)
void updatePixelToGui(QString layerName_h, int x_h, int y_h, QColor color)
void computeQuery(int px_ID, int currentLayerIndex)
Compute the pixel query and return it to the GUI (with a signal)
void setOutputDirName(string outputDirname_h)