#include <Pixel.h>
Inheritance diagram for Pixel:
Public Member Functions | |
Pixel (double ID_h, ThreadManager *MTHREAD_h) | |
~Pixel () | |
double | getDoubleValue (string layerName_h) const |
Return the value for a specific layer. | |
void | initObjects () |
void | acquireObject (ModelObject acquiredObject_h, int case_h=STAGE_NORMAL) |
Associate a new object to the agent. | |
void | newYear () |
void | setRandomRenting (string contractType) |
Set a new, random-duration, rental contract. For now only "agrContract" is implemented. Take account of objects included in the plots. | |
bool | isAgricultural () const |
double | getStartingRentalCosts () const |
Return the initial renting costs for this plot type (exogenous). | |
void | destroyRentalContract () |
Destroy the rental contract when it goes out-of-scope or when the farm leave freeing the land. | |
int | getLastRentingYear () const |
last year before the rental contract will be ended | |
int | getStartRentingYear () const |
int | getRentingTerm () const |
int | getRentingAge () const |
int | getRemainingRentingAge () const |
double | getID () const |
int | getX () const |
int | getY () const |
vector< Pixel * > | getPixelsAtDistLevel (int distLevel_h) const |
Return a vector of pixels at the specified distance (in levels, not in physical units). | |
Agent_space * | getOwner () |
Agent_space * | getTenant () |
string | getPxComments () const |
Agent_space * | getCachedAgent () |
double | getCachedDouble () const |
vector< ModelObject * > | getIncludedObjects () |
Return pointers to objects located on this pixel. | |
vector< string > | getIncludedObjectNames () const |
int | countMyObjects () const |
double | getRentalCosts () const |
double | getShRentalPriceCoeff () const |
void | setValue (string layerName_h, double value_h) |
Insert a new layer and its value. | |
void | changeValue (string layerName_h, double value_h) |
Change the value of an existing layer. | |
void | setCoordinates (int x_h, int y_h) |
void | setOwner (Agent_space *owner_h) |
void | setTenant (Agent_space *tenant_h) |
void | setPxComments (std::string pxComments_h) |
void | setCachedAgent (Agent_space *cachedAgent_h) |
void | setCachedDouble (double cachedDouble_h) |
void | clearCache () |
void | setRemainingRentingTerm (int years_h) |
void | setRentingTerm (int years) |
void | setRentalCosts (double rentalCosts_h) |
void | setShRentalPriceCoeff (double shRentalPriceCoeff_h) |
Private Attributes | |
map< string, double > | values |
Map of values for each layer. | |
double | ID |
int | pxX |
int | pxY |
string | pxComments |
Agent_space * | pxOwner |
Agent_space * | pxTenant |
Agent_space * | cachedAgent |
Cachable pointer to Agent_space used in some optimized algorithms. | |
double | cachedDouble |
Cachable double used in some optimized algorithms. | |
vector< ModelObject > | myObjects |
Vector of spacial objects guested on this plot. | |
int | rentingTerm |
how many years the object can live. rentingTerm= lastYear-startYear The object start with age=0 and is destroied at the end of year when it reach lifeTerm-1.. currentAge never go to lifeTerm | |
int | startRentingYear |
year when the object was created | |
double | rentalCosts |
double | shRentalPriceCoeff |
Ratio between the shadow price of this plot in comparition with the avg rental price of its type (calculted on the first year). |
This class manage the info at the pixel level. A vector of pixel objects is owned by the class Gis.
Definition at line 44 of file Pixel.h.
Pixel | ( | double | ID_h, | |
ThreadManager * | MTHREAD_h | |||
) |
double getDoubleValue | ( | string | layerName_h | ) | const |
Return the value for a specific layer.
Definition at line 129 of file Pixel.cpp.
Referenced by Opt::addPixel(), ThreadManager::computeQuery(), Layers::countMyPixels(), Agent_farmer::filterActivity(), Manager_farmers::locateMyAgents(), Layers::print(), Layers::printBinMap(), and Layers::randomShuffle().
Here is the caller graph for this function:
void initObjects | ( | ) |
void acquireObject | ( | ModelObject | acquiredObject_h, | |
int | case_h = STAGE_NORMAL | |||
) |
Associate a new object to the agent.
case_h | stage (STAGE_INIT or STAGE_NORMAL) |
Definition at line 144 of file Pixel.cpp.
Referenced by Agent_farmer::collectProductionEffects(), and initObjects().
Here is the caller graph for this function:
void newYear | ( | ) |
Definition at line 204 of file Pixel.cpp.
Referenced by Scheduler::run(), and SuperAgentManager::update().
Here is the caller graph for this function:
void setRandomRenting | ( | string | contractType | ) |
Set a new, random-duration, rental contract. For now only "agrContract" is implemented. Take account of objects included in the plots.
This function set a new renting contract for the plot. There could be more type of contract, but now only the "agrContract" type is implemented. Normally contracts are randomly choosed betweer a minimum and a maximum. However, if objects are present in such plots and we are not in the init stage, contracts can not be longer than the object remaining age.
Definition at line 242 of file Pixel.cpp.
Referenced by Manager_farmers::assignPlot().
Here is the caller graph for this function:
double getStartingRentalCosts | ( | ) | const |
Return the initial renting costs for this plot type (exogenous).
Definition at line 314 of file Pixel.cpp.
Referenced by Manager_farmers::locateMyAgents().
Here is the caller graph for this function:
void destroyRentalContract | ( | ) |
int getLastRentingYear | ( | ) | const [inline] |
last year before the rental contract will be ended
Definition at line 65 of file Pixel.h.
Referenced by acquireObject(), and newYear().
Here is the caller graph for this function:
int getRentingTerm | ( | ) | const [inline] |
Definition at line 67 of file Pixel.h.
Referenced by getRemainingRentingAge().
Here is the caller graph for this function:
int getRentingAge | ( | ) | const |
Definition at line 309 of file Pixel.cpp.
Referenced by getRemainingRentingAge().
Here is the caller graph for this function:
double getID | ( | ) | const [inline] |
Definition at line 73 of file Pixel.h.
Referenced by Opt::addPixel(), and Agent_base::answerStats().
Here is the caller graph for this function:
int getX | ( | ) | const [inline] |
Definition at line 74 of file Pixel.h.
Referenced by Agent_base::answerStats(), ThreadManager::computeQuery(), Gis::getDistance(), getDoubleValue(), and getPixelsAtDistLevel().
Here is the caller graph for this function:
int getY | ( | ) | const [inline] |
Definition at line 75 of file Pixel.h.
Referenced by Agent_base::answerStats(), ThreadManager::computeQuery(), Gis::getDistance(), getDoubleValue(), and getPixelsAtDistLevel().
Here is the caller graph for this function:
vector< Pixel * > getPixelsAtDistLevel | ( | int | distLevel_h | ) | const |
Return a vector of pixels at the specified distance (in levels, not in physical units).
The function return a vector of pointers to Pixels at the gived distance from the caller pixel.\ The list start with those on the Top, then add those on the right, those on the bottom and those on the left. Finally it had the corner pixels (that are more far).\ It takes into consideration borders correctly.
Fully tested on internal points as well semi-border cases, border cases and corner cases. ALL OK.
distLevel_h | Distance in number of adiacent pixels. It has to be at least 1 (the function return an error if it is 0). |
Agent_space* getOwner | ( | ) | [inline] |
Definition at line 78 of file Pixel.h.
Referenced by Manager_farmers::quotePlot().
Here is the caller graph for this function:
Agent_space* getTenant | ( | ) | [inline] |
Agent_space* getCachedAgent | ( | ) | [inline] |
vector< ModelObject * > getIncludedObjects | ( | ) |
vector< string > getIncludedObjectNames | ( | ) | const |
Definition at line 195 of file Pixel.cpp.
Referenced by Opt::addPixel().
Here is the caller graph for this function:
void setValue | ( | string | layerName_h, | |
double | value_h | |||
) |
void changeValue | ( | string | layerName_h, | |
double | value_h | |||
) |
Change the value of an existing layer.
Definition at line 118 of file Pixel.cpp.
Referenced by Manager_farmers::assignPlot(), Agent_farmer::collectProductionEffects(), Manager_farmers::locateMyAgents(), Layers::randomShuffle(), and Manager_farmers::removeFromModel().
Here is the caller graph for this function:
void setOwner | ( | Agent_space * | owner_h | ) | [inline] |
Definition at line 96 of file Pixel.h.
Referenced by Manager_farmers::assignPlot().
Here is the caller graph for this function:
void setTenant | ( | Agent_space * | tenant_h | ) | [inline] |
Definition at line 97 of file Pixel.h.
Referenced by Manager_farmers::assignPlot().
Here is the caller graph for this function:
void setCachedAgent | ( | Agent_space * | cachedAgent_h | ) | [inline] |
void setRemainingRentingTerm | ( | int | years_h | ) |
Definition at line 301 of file Pixel.cpp.
Referenced by Manager_farmers::locateMyAgents(), and setRandomRenting().
Here is the caller graph for this function:
void setRentingTerm | ( | int | years | ) | [inline] |
Definition at line 103 of file Pixel.h.
Referenced by acquireObject().
Here is the caller graph for this function:
void setRentalCosts | ( | double | rentalCosts_h | ) | [inline] |
Definition at line 104 of file Pixel.h.
Referenced by Manager_farmers::assignPlot().
Here is the caller graph for this function:
void setShRentalPriceCoeff | ( | double | shRentalPriceCoeff_h | ) | [inline] |
map<string, double> values [private] |
Map of values for each layer.
Definition at line 105 of file Pixel.h.
Referenced by changeValue(), getDoubleValue(), and setValue().
int pxX [private] |
int pxY [private] |
string pxComments [private] |
Agent_space* pxOwner [private] |
Definition at line 115 of file Pixel.h.
Referenced by acquireObject(), getOwner(), Pixel(), and setOwner().
Agent_space* pxTenant [private] |
Definition at line 116 of file Pixel.h.
Referenced by acquireObject(), destroyRentalContract(), getTenant(), Pixel(), and setTenant().
Agent_space* cachedAgent [private] |
Cachable pointer to Agent_space used in some optimized algorithms.
Definition at line 117 of file Pixel.h.
Referenced by clearCache(), getCachedAgent(), Pixel(), and setCachedAgent().
double cachedDouble [private] |
Cachable double used in some optimized algorithms.
Definition at line 118 of file Pixel.h.
Referenced by clearCache(), getCachedDouble(), and setCachedDouble().
vector<ModelObject> myObjects [private] |
Vector of spacial objects guested on this plot.
Definition at line 119 of file Pixel.h.
Referenced by acquireObject(), countMyObjects(), getIncludedObjectNames(), getIncludedObjects(), newYear(), and setRandomRenting().
int rentingTerm [private] |
how many years the object can live. rentingTerm= lastYear-startYear The object start with age=0 and is destroied at the end of year when it reach lifeTerm-1.. currentAge never go to lifeTerm
Definition at line 122 of file Pixel.h.
Referenced by destroyRentalContract(), getLastRentingYear(), getRentingTerm(), Pixel(), setRemainingRentingTerm(), and setRentingTerm().
int startRentingYear [private] |
year when the object was created
Definition at line 124 of file Pixel.h.
Referenced by destroyRentalContract(), getLastRentingYear(), getRentingAge(), getStartRentingYear(), Pixel(), and setRemainingRentingTerm().
double rentalCosts [private] |
Definition at line 125 of file Pixel.h.
Referenced by destroyRentalContract(), getRentalCosts(), Pixel(), and setRentalCosts().
double shRentalPriceCoeff [private] |
Ratio between the shadow price of this plot in comparition with the avg rental price of its type (calculted on the first year).
Definition at line 126 of file Pixel.h.
Referenced by getShRentalPriceCoeff(), and Pixel().