Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2010-2024 German Aerospace Center (DLR) and others. 4 : // activitygen module 5 : // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) 6 : // This program and the accompanying materials are made available under the 7 : // terms of the Eclipse Public License 2.0 which is available at 8 : // https://www.eclipse.org/legal/epl-2.0/ 9 : // This Source Code may also be made available under the following Secondary 10 : // Licenses when the conditions for such availability set forth in the Eclipse 11 : // Public License 2.0 are satisfied: GNU General Public License, version 2 12 : // or later which is available at 13 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html 14 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later 15 : /****************************************************************************/ 16 : /// @file AGCity.h 17 : /// @author Piotr Woznica 18 : /// @author Daniel Krajzewicz 19 : /// @author Walter Bamberger 20 : /// @author Michael Behrisch 21 : /// @date July 2010 22 : /// 23 : // City class that contains all other objects of the city: in particular 24 : // streets, households, bus lines, work positions and schools 25 : /****************************************************************************/ 26 : #pragma once 27 : #include <config.h> 28 : 29 : #include <iostream> 30 : #include <vector> 31 : #include <list> 32 : #include "AGPosition.h" 33 : #include "AGDataAndStatistics.h" 34 : #include "AGSchool.h" 35 : #include "AGBusLine.h" 36 : #include "AGWorkPosition.h" 37 : #include "AGHousehold.h" 38 : 39 : 40 : // =========================================================================== 41 : // class declarations 42 : // =========================================================================== 43 : class AGHousehold; 44 : class RONet; 45 : 46 : 47 : // =========================================================================== 48 : // class definitions 49 : // =========================================================================== 50 : class AGCity { 51 : public: 52 10 : AGCity(RONet* net) : 53 10 : statData(AGDataAndStatistics::getDataAndStatistics()), 54 10 : net(net), 55 10 : streetsCompleted(false) {}; 56 : 57 : /** 58 : * generates streets: complete the "streets" vector using the DataAndStat's map edges. 59 : */ 60 : void completeStreets(); 61 : void generateWorkPositions(); 62 : void completeBusLines(); 63 : //void generateSchools(); 64 : void generatePopulation(); 65 : void schoolAllocation(); 66 : void workAllocation(); 67 : void carAllocation(); 68 : 69 : /** 70 : * manipulation functions 71 : */ 72 : const AGStreet& getStreet(const std::string& edge); 73 : /** 74 : * returns a random street 75 : */ 76 : const AGStreet& getRandomStreet(); 77 : 78 : AGDataAndStatistics& statData; 79 : std::vector<AGStreet*> streets; 80 : std::vector<AGStreet*> passengerStreets; 81 : std::vector<AGWorkPosition> workPositions; 82 : std::list<AGSchool> schools; 83 : std::list<AGBusLine> busLines; 84 : std::list<AGHousehold> households; 85 : std::vector<AGPosition> cityGates; 86 : std::list<AGAdult> peopleIncoming; 87 : 88 : private: 89 : AGSchool closestSchoolTo(AGPosition pos); 90 : /** 91 : * generates workpositions on the city's gates (entrances) for the outgoing work traffic. 92 : */ 93 : void generateOutgoingWP(); 94 : /** 95 : * generates people from outside the city for incoming traffic generation 96 : */ 97 : void generateIncomingPopulation(); 98 : 99 : // @brief network of the city 100 : RONet* net; 101 : /** 102 : * false until the function completeStreets is called 103 : * this function completes streets and turn this parameter to true 104 : */ 105 : bool streetsCompleted; 106 : 107 : int nbrCars; 108 : 109 : private: 110 : /// @brief invalidated assignment operator 111 : AGCity& operator=(const AGCity&); 112 : };