Manager_space.cpp

Go to the documentation of this file.
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 #include "Manager_space.h"
00021 #include "Agent_space.h"
00022 #include "Pixel.h"
00023 #include "ThreadManager.h"
00024 
00025 //constructor
00026 Manager_space::Manager_space(ThreadManager* MTHREAD_h, string name_h): Manager_base(MTHREAD_h, name_h){
00027 
00028 }
00029 
00030 //destructor
00031 Manager_space::~Manager_space(){
00032 
00033 }
00034 
00038 void
00039 Manager_space::assignSpatialObjectsToAgents(){
00040     msgOut(MSG_DEBUG,"Manager_space::assignSpatialObjectsToAgents()");
00041     /*for (uint i=0;i<managedAgents.size();i++){
00042         Agent_space * currentAgent = ((Agent_space*)managedAgents.at(i));
00043         vector <Pixel *> pixels = currentAgent->getPlots();
00044         for (uint j=0;j<pixels.size();j++){
00045             pixels.at(j)->initObjects();
00046         }
00047     }*/
00048     // 20080201, changed Antonello: really spatial objects are assigned to individual plots, not to their agents. It is wrong to iterate trough agents.. plots that are not rented nor owned by any farmer in this way arenot initializzated.. resulting e.g. in lot of vineyards on wine suitable plots on the first year
00049     vector <Pixel *> pixels = MTHREAD->GIS->getAllPlots();
00050     for(uint i=0;i<pixels.size();i++){
00051         pixels.at(i)->initObjects();
00052     }
00053 }
00054