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 AGStreet.h
17 : /// @author Piotr Woznica
18 : /// @author Walter Bamberger
19 : /// @author Daniel Krajzewicz
20 : /// @author Michael Behrisch
21 : /// @date July 2010
22 : ///
23 : // Represents a SUMO edge and contains people and work densities
24 : /****************************************************************************/
25 : #pragma once
26 : #include <config.h>
27 :
28 : #include <string>
29 : #include <utils/common/SUMOVehicleClass.h>
30 : #include <router/ROAbstractEdgeBuilder.h>
31 : #include <router/ROEdge.h>
32 :
33 :
34 : // ===========================================================================
35 : // class declarations
36 : // ===========================================================================
37 : class AGPosition;
38 :
39 :
40 : // ===========================================================================
41 : // class definitions
42 : // ===========================================================================
43 : /**
44 : * @class AGStreet
45 : * @brief A model of the street in the city.
46 : *
47 : * AGStreet represents a street in the city. It contains all model relevant
48 : * properties and is associated with a ROEdge of the routing network.
49 : */
50 : class AGStreet : public ROEdge {
51 : public:
52 10 : class Builder : public ROAbstractEdgeBuilder {
53 : public:
54 : /** @brief Builds an edge with the given name
55 : *
56 : * @param[in] name The name of the edge
57 : * @param[in] from The node the edge begins at
58 : * @param[in] to The node the edge ends at
59 : * @param[in] priority The edge priority (road class)
60 : * @return A proper instance of the named edge
61 : */
62 2660 : ROEdge* buildEdge(const std::string& name, RONode* from, RONode* to, const int priority) {
63 2660 : return new AGStreet(name, from, to, getNextIndex(), priority);
64 : }
65 : };
66 :
67 : AGStreet(const std::string& id, RONode* from, RONode* to, int index, const int priority);
68 :
69 : /** @brief Provides the number of persons living in this street.
70 : *
71 : * @return the number of inhabitants
72 : */
73 : double getPopulation() const;
74 :
75 : /** @brief Modifies the number of persons living in this street.
76 : *
77 : * @param[in] pop the new number of inhabitants
78 : */
79 : void setPopulation(const double pop);
80 :
81 : /** @brief Provides the number of work places in this street.
82 : *
83 : * @return the number of work places
84 : */
85 : double getWorkplaceNumber() const;
86 :
87 : /** @brief Modifies the number of work places in this street.
88 : *
89 : * @param[in] work the new number of work places
90 : */
91 : void setWorkplaceNumber(const double work);
92 :
93 : /** @brief Prints a summary of the properties of this street to standard
94 : * output.
95 : */
96 : void print() const;
97 :
98 : /** @brief Returns whether the given vehicle class is allowed on this street.
99 : *
100 : * @param[in] vclass the class (passenger or bus) in question
101 : * @return whether it is allowed on any of the lanes
102 : */
103 : bool allows(const SUMOVehicleClass vclass) const;
104 :
105 : private:
106 : double myPopulation;
107 : double myNumWorkplaces;
108 : };
|