85 void addLayer(
string name_h,
string label_h,
bool isInteger_h,
bool dynamicContent_h,
string fullFileName_h =
"",
bool display_h=
true);
89 bool layerExist(
const string & layerName_h,
bool exactMatch =
true)
const;
103 void countItems(
const string& layerName_h,
const bool& debug=
false);
148 string pack(
const string& parName,
const string& forName,
const string& dClass,
const int& year)
const {
return parName+
"#"+forName+
"#"+dClass+
"#"+
i2s(year)+
"#";};
149 void unpack(
const string& key,
string& parName,
string& forName,
string& dClass,
int& year)
const;
151 void swap(
const int &swap_what);
This file is the header of BaseClass and it is included by ALL compiled code.
@ DATA_NOW
The required data is for the current year.
@ MSG_WARNING
Print a WARNING message.
Base class for the regmas application.
string i2s(const int &int_h) const
integer to string conversion
Class to manage the spatial dimension.
vector< Layers * > getLayerPointers()
Return a vector of pointers of existing layers.
string pack(const string &parName, const string &forName, const string &dClass, const int &year) const
int yNPixels
number of pixels along the Y dimension
void printDebugValues(string layerName_h, int min_h=0, int max_h=0)
void initLayersModelData(const int &year_h=DATA_NOW)
int subXL
sub region left X
void addLayer(string name_h, string label_h, bool isInteger_h, bool dynamicContent_h, string fullFileName_h="", bool display_h=true)
Fill a layer with empty values.
double getYMetersByPixel() const
void applyForestReclassification()
Apply the forest reclassification with the rules defined in reclRules sheet.
double geoRightX
geo-coordinates of the map right border
int getYNPixels() const
Return the number of pixels on X.
vector< Pixel * > getAllPlots(bool masked=true, int outputLevel=MSG_WARNING)
Return the vector (shuffled) of all plots. It is also possible to specify the level in case of failur...
int xNPixels
number of pixels along the X dimension
double noValue
value internally use as novalue (individual layer maps can have other values)
void unpack(const string &key, string &parName, string &forName, string &dClass, int &year) const
double xMetersByPixel
pixel dimension (meters), X
double xyNPixels
total number of pixels
double getXyNPixels() const
Return the number of pixels on Y.
vector< Layers > layerVector
array of Layer objects
double geoLeftX
geo-coordinates of the map left border
Pixel * getRandomPlotByValue(string layer_h, int layerValue__h)
Return a pointer to a plot with a specific value for the specified layer.
void applyStochasticRiskAdversion()
Give to each agend a stochastic risk adversion. For now Pixel = Agent.
double getNoValue() const
double yMetersByPixel
pixel dimension (meters), Y
vector< double > lUseTotals
totals, in ha, of area in the region for each type (cached values)
double getHaByPixel() const
Return the total number of pixels.
Pixel * getPixel(int x_h, int y_h)
double getGeoTopY() const
Return a pixel pointer from its ID.
double getGeoLeftX() const
void swap(const int &swap_what)
void initLayers()
Init the layers.
void setSpace()
Set the initial space environment, including loading data from files.
int subYT
sub region top Y
void printBinMaps(string layerName_h="")
Save an image in standard png format.
int sub2realID(int id_h)
Transform the ID of a pixel in subregion coordinates to the real (and model used) coordinates.
double geoTopY
geo-coordinates of the map upper border
vector< Pixel > pxVector
array of Pixel objects
int subXR
sub region right X
double getDistance(const Pixel *px1, const Pixel *px2)
void initLayersPixelData()
double geoBottomY
geo-coordinates of the map bottom border
void resetLayer(string layerName_h)
Check if a layer with a certain name is loaded in the model. Used e.g. to check if the dtm layer (opt...
void applySpatialStochasticValues()
Apply stochastic simulation, e.g. regional volume growth s.d. -> tp multipliers.
Pixel * getPixel(int ID_h)
Return a pixel pointer from its coordinates.
int subYB
sub region bottom Y
double getGeoRightX() const
vector< Pixel * > getAllPlotsByRegion(ModelRegion ®ion_h, bool shuffle=false)
Return the vector of all plots by a specific region (main region or subregion), optionally shuffled;.
vector< string > getLayerNames()
Return a vector of the layer ids (as string)
vector< Pixel * > getAllPlotsByValue(string layer_h, int layerValue_h, int outputLevel=MSG_WARNING)
Return the vector (shuffled) of all plots with a specific value for a specified layer....
double getXMetersByPixel() const
void printLayers(string layerName_h="")
Print the specified layer or all layers (if param layerName_h is missing).
void loadLayersDataFromFile()
Load the data of a layer its datafile.
Layers * getLayer(const string &layerName_h)
Add a legend item to an existing layer.
double getGeoBottomY() const
void countItems(const string &layerName_h, const bool &debug=false)
Count the pixels within each legend item for the selected layer.
bool layerExist(const string &layerName_h, bool exactMatch=true) const
Return a pointer to a layer given its name.
void addLegendItem(string name_h, int D_h, string label_h, int rColor_h, int gColor_h, int bColor_h, double minValue_h, double maxValue_h)
void filterSubRegion(string layerName_h)
If subregion mode is on, this function place noValues on the selected layer for all out-of-region pix...
void updateImage(string layerName_h)
Add one layer to the system.
Define layer objects at the regional level.
Thread manager. Responsable to manage the main thread and "speak" with the GUI.