|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Represents a SUMO edge and contains people and work densities 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 // activitygen module 00012 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) 00013 /****************************************************************************/ 00014 // 00015 // This program is free software; you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation; either version 2 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include "AGStreet.h" 00033 #include "router/ROEdge.h" 00034 #include <iostream> 00035 00036 00037 // =========================================================================== 00038 // method definitions 00039 // =========================================================================== 00040 AGStreet::AGStreet(const ROEdge* edge, SUMOReal popDensity, SUMOReal workDensity) throw() : 00041 edge(edge) { 00042 pop = static_cast<int>(popDensity * edge->getLength()); 00043 work = static_cast<int>(workDensity * edge->getLength()); 00044 } 00045 00046 /****************************************************************************/ 00047 00048 void 00049 AGStreet::print() const throw() { 00050 std::cout << "- AGStreet: Name=" << edge->getID() << " Length=" << edge->getLength() << " pop=" << pop << " work=" << work << std::endl; 00051 } 00052 00053 /****************************************************************************/ 00054 00055 SUMOReal 00056 AGStreet::getLength() const throw() { 00057 return edge->getLength(); 00058 } 00059 00060 /****************************************************************************/ 00061 00062 const std::string& 00063 AGStreet::getName() const throw() { 00064 return edge->getID(); 00065 } 00066 00067 /****************************************************************************/ 00068 00069 int 00070 AGStreet::getPopulation() const throw() { 00071 return pop; 00072 } 00073 00074 /****************************************************************************/ 00075 00076 void 00077 AGStreet::setPopulation(const int& population) throw() { 00078 pop = population; 00079 } 00080 00081 /****************************************************************************/ 00082 00083 int 00084 AGStreet::getWorkplaceNumber() const throw() { 00085 return work; 00086 } 00087 00088 /****************************************************************************/ 00089 00090 void 00091 AGStreet::setWorkplaceNumber(const int& workPositions) throw() { 00092 work = workPositions; 00093 } 00094 00095 /****************************************************************************/