00001 /*************************************************************************** 00002 * Copyright (C) 2006-2008 by Antonello Lobianco * 00003 * http://regmas.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef MODELOBJECT_H 00021 #define MODELOBJECT_H 00022 00023 #include <map> 00024 00025 // regams headers... 00026 #include "BaseRegmas.h" 00027 #include "RegData.h" 00028 00029 class Pixel; 00030 class Agent_base; 00031 00033 00039 class ModelObject : public BaseRegmas 00040 { 00041 00042 public: 00043 ModelObject(ThreadManager* MTHREAD_h); 00044 ~ModelObject(); 00045 00046 double getResourceValue(string resourceName_h); 00047 void setRandomAge(); 00048 //void newYear(); ///< objects no nonger got a counter of their age. The counter is dynamically generated confronting the init year with the current year. No risks of forgetting or doubling calling of this function! 00049 00050 string getName() const {return name;}; 00051 string getObjectTypology() const {return type;}; 00052 string getObjectSubTypology() const {return subType;}; 00053 string getComment() const {return comment;}; 00054 double getMatrixGrossMargin() const {return matrixGrossMargin;}; 00055 double getInitialCost() const {return initialCost;};; 00056 map<string, double> getMatrixObjRes() const {return matrixObjRes;}; 00057 vector <int> getRequiredLandUseCodes() const {return requiredLandUseCodes;}; 00058 string getRequiredFor() const {return requiredFor;}; 00059 vector <double> getMatrixCoefficients(); 00060 bool getSpatiallyExplicit() const {return spatiallyExplicit;}; 00061 Agent_base* getOwner(){return owner;}; 00062 00064 double getCurrentValue(bool endOfYear=false); 00066 int getLastYear(){return startYear+lifeTerm-1;}; 00067 int getStartYear(){return startYear;}; 00068 int getLifeTerm() {return lifeTerm;}; 00069 int getAge(); 00070 int getRemainingAge() {return getLifeTerm()-getAge();}; 00071 00072 void setName(string name_h){name=name_h;}; 00073 void setType(string type_h){type=type_h;}; 00074 void setSubType(string subType_h){subType=subType_h;}; 00075 void setComment(string comment_h){comment=comment_h;}; 00076 void setLifeTerm(int lifeTerm_h){lifeTerm=lifeTerm_h;}; 00077 void setStartYear(int year_h){startYear = year_h;}; 00078 void setMatrixGrossMargin(double matrixGrossMargin_h){matrixGrossMargin=matrixGrossMargin_h;}; 00079 void setInitialCost(double initialCost_h){initialCost=initialCost_h;}; 00080 void setMatrixObjRes(map <string, double> matrixObjRes_h){matrixObjRes=matrixObjRes_h;}; 00081 void setRequiredFor(string activityName_h){requiredFor = activityName_h;}; 00082 void setOwner(Agent_base * owner_h){owner=owner_h;}; 00083 friend void RegData::setObjectsDefinitions(); 00084 00085 protected: 00086 string name; 00087 string type; 00088 string subType; 00089 string comment; 00091 int lifeTerm; 00093 int startYear; 00094 double matrixGrossMargin; 00095 double initialCost; 00096 map<string, double> matrixObjRes; 00097 00098 vector<int> requiredLandUseCodes; 00100 bool spatiallyExplicit; 00101 Agent_base* owner; 00102 Agent_base* user; //not used !!! 00103 string requiredFor; 00104 00105 }; 00106 00107 #endif