SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AGStreet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Represents a SUMO edge and contains people and work densities
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 // activitygen module
14 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include "AGStreet.h"
36 #include "router/ROEdge.h"
37 #include <iostream>
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
43 AGStreet::AGStreet(const ROEdge* edge, SUMOReal popDensity, SUMOReal workDensity) :
44  edge(edge) {
45  pop = static_cast<int>(popDensity * edge->getLength());
46  work = static_cast<int>(workDensity * edge->getLength());
47 }
48 
49 /****************************************************************************/
50 
51 void
52 AGStreet::print() const {
53  std::cout << "- AGStreet: Name=" << edge->getID() << " Length=" << edge->getLength() << " pop=" << pop << " work=" << work << std::endl;
54 }
55 
56 /****************************************************************************/
57 
60  return edge->getLength();
61 }
62 
63 /****************************************************************************/
64 
65 const std::string&
67  return edge->getID();
68 }
69 
70 /****************************************************************************/
71 
72 int
74  return pop;
75 }
76 
77 /****************************************************************************/
78 
79 void
80 AGStreet::setPopulation(const int& population) {
81  pop = population;
82 }
83 
84 /****************************************************************************/
85 
86 int
88  return work;
89 }
90 
91 /****************************************************************************/
92 
93 void
94 AGStreet::setWorkplaceNumber(const int& workPositions) {
95  work = workPositions;
96 }
97 
98 /****************************************************************************/