#include <Layers.h>
Inheritance diagram for Layers:
Public Member Functions | |
Layers (ThreadManager *MTHREAD_h, string name_h, string label_h, bool isInteger_h, bool dynamicContent_h, string fullFilename_h) | |
In the constructor we set the main layer properties. | |
~Layers () | |
void | addLegendItem (int ID_h, string label_h, int rColor_h, int gColor_h, int bColor_h, double minValue_h, double maxValue_h) |
Add a legend item. | |
QColor | getColor (double ID_h) |
Evaluates all the legend items to find the one that match the input code, and return its color as a QColor. | |
string | getCategory (double ID_h) |
Evaluates all the legend items to find the one that match the input code, and return its label. | |
void | addReclassificationRule (int inCode_h, int outCode_h, double p_h) |
Add a reclassification filter rule. | |
double | filterExogenousDataset (double code_h) |
Used to reclassify the land use map for "generic" categories. | |
void | countMyPixels (bool debug=false) |
Count the pixels going to each legend item and print them if debug==true. | |
void | randomShuffle () |
For some sensitivity analisys, random the values for this layer for not-empty values (only integer layers). | |
bool | getIsInteger () |
Return if the layer is integer or not (If integer on each legend item: minValue==maxValue==ID). | |
void | print () |
Print the layer content as an ASCII grid map with its companion files (classification and colors). It always print the whole region, even when subregion is actived. | |
void | printBinMap () |
Print a binary reppresentation of the data (a standard image, e.g. a .png file). It prints only the subregion if this is active. | |
string | getName () |
string | getFilename () |
Return the filename of the associated dataset. | |
bool | getDynamicContent () |
Return true if the content may change during simulation period. | |
Private Attributes | |
string | name |
ID of the layer (no spaces allowed). | |
string | label |
Label of the layer (spaces allowed). | |
bool | isInteger |
Type of the layer (true==integer, false==double. If true, on each legend item: minValue==maxValue==ID). | |
bool | dynamicContent |
True if the content may change during simulation year. | |
string | fullFileName |
Filename of the associated dataset (map). | |
vector< LegendItems > | legendItems |
Vector of legend items. | |
vector< ReclassRules > | reclassRulesVector |
Vector of initial reclassification rules. |
Layer class (setting, legend...)
This class define layer objects, including:
Definition at line 47 of file Layers.h.
Layers | ( | ThreadManager * | MTHREAD_h, | |
string | name_h, | |||
string | label_h, | |||
bool | isInteger_h, | |||
bool | dynamicContent_h, | |||
string | fullFilename_h | |||
) |
~Layers | ( | ) |
Definition at line 40 of file Layers.cpp.
void addLegendItem | ( | int | ID_h, | |
string | label_h, | |||
int | rColor_h, | |||
int | gColor_h, | |||
int | bColor_h, | |||
double | minValue_h, | |||
double | maxValue_h | |||
) |
QColor getColor | ( | double | ID_h | ) |
Evaluates all the legend items to find the one that match the input code, and return its color as a QColor.
This function take as input the value stored in the pixel for the specific layer, loops over the legend item and find the one that match it, returning its color.
If the layer is of type integer, the match is agains legendItem IDs, otherwise we compare the legendItem ranges.
Definition at line 118 of file Layers.cpp.
Referenced by printBinMap().
Here is the caller graph for this function:
string getCategory | ( | double | ID_h | ) |
Evaluates all the legend items to find the one that match the input code, and return its label.
This function take as input the value stored in the pixel for the specific layer, loops over the legend item and find the one that match it, returning its label.
If the layer is of type integer, the match is agains legendItem IDs, otherwise we compare the legendItem ranges.
Definition at line 148 of file Layers.cpp.
void addReclassificationRule | ( | int | inCode_h, | |
int | outCode_h, | |||
double | p_h | |||
) |
double filterExogenousDataset | ( | double | code_h | ) |
Used to reclassify the land use map for "generic" categories.
Used in the init stage, this function take as input the real map code as just read from the map file, and filter it according to the reclassification rules.
Definition at line 83 of file Layers.cpp.
void countMyPixels | ( | bool | debug = false |
) |
Count the pixels going to each legend item and print them if debug==true.
Definition at line 174 of file Layers.cpp.
void randomShuffle | ( | ) |
For some sensitivity analisys, random the values for this layer for not-empty values (only integer layers).
Definition at line 210 of file Layers.cpp.
bool getIsInteger | ( | ) | [inline] |
void print | ( | ) |
Print the layer content as an ASCII grid map with its companion files (classification and colors). It always print the whole region, even when subregion is actived.
Definition at line 265 of file Layers.cpp.
void printBinMap | ( | ) |
Print a binary reppresentation of the data (a standard image, e.g. a .png file). It prints only the subregion if this is active.
Definition at line 367 of file Layers.cpp.
string getFilename | ( | ) | [inline] |
bool getDynamicContent | ( | ) | [inline] |
string name [private] |
ID of the layer (no spaces allowed).
Definition at line 93 of file Layers.h.
Referenced by countMyPixels(), getName(), Layers(), print(), printBinMap(), and randomShuffle().
string label [private] |
Label of the layer (spaces allowed).
Definition at line 94 of file Layers.h.
Referenced by addLegendItem(), countMyPixels(), Layers(), and print().
bool isInteger [private] |
Type of the layer (true==integer, false==double. If true, on each legend item: minValue==maxValue==ID).
Definition at line 95 of file Layers.h.
Referenced by countMyPixels(), getCategory(), getColor(), getIsInteger(), Layers(), and print().
bool dynamicContent [private] |
True if the content may change during simulation year.
Definition at line 96 of file Layers.h.
Referenced by getDynamicContent(), and Layers().
string fullFileName [private] |
Filename of the associated dataset (map).
Definition at line 97 of file Layers.h.
Referenced by getFilename(), and Layers().
vector<LegendItems> legendItems [private] |
Vector of legend items.
Definition at line 98 of file Layers.h.
Referenced by addLegendItem(), countMyPixels(), getCategory(), getColor(), and print().
vector<ReclassRules> reclassRulesVector [private] |
Vector of initial reclassification rules.
Definition at line 99 of file Layers.h.
Referenced by addReclassificationRule(), and filterExogenousDataset().