Layers Class Reference

Define layer objects at the regional level. More...

#include <Layers.h>

Inheritance diagram for Layers:

Inheritance graph
[legend]
Collaboration diagram for Layers:

Collaboration graph
[legend]
List of all members.

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< LegendItemslegendItems
 Vector of legend items.
vector< ReclassRulesreclassRulesVector
 Vector of initial reclassification rules.

Detailed Description

Define layer objects at the regional level.

Layer class (setting, legend...)
This class define layer objects, including:

Definition at line 47 of file Layers.h.


Constructor & Destructor Documentation

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.

Definition at line 30 of file Layers.cpp.

~Layers (  ) 

Definition at line 40 of file Layers.cpp.


Member Function Documentation

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.

See also:
LegendItems

Definition at line 45 of file Layers.cpp.

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.

See also:
LegendItems

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.

See also:
LegendItems

Definition at line 148 of file Layers.cpp.

void addReclassificationRule ( int  inCode_h,
int  outCode_h,
double  p_h 
)

Add a reclassification filter rule.

See also:
ReclassRules

Definition at line 69 of file Layers.cpp.

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.

See also:
ReclassRules

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]

Return if the layer is integer or not (If integer on each legend item: minValue==maxValue==ID).

Definition at line 79 of file Layers.h.

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 getName (  )  [inline]

Definition at line 85 of file Layers.h.

string getFilename (  )  [inline]

Return the filename of the associated dataset.

Definition at line 87 of file Layers.h.

bool getDynamicContent (  )  [inline]

Return true if the content may change during simulation period.

Definition at line 89 of file Layers.h.


Member Data Documentation

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.

See also:
LegendItems

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.

See also:
ReclassRules

Definition at line 99 of file Layers.h.

Referenced by addReclassificationRule(), and filterExogenousDataset().


The documentation for this class was generated from the following files: