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