Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/activitygen/AGActivityGenHandler.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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 AGActivityGenHandler.h
17
/// @author Piotr Woznica
18
/// @author Daniel Krajzewicz
19
/// @author Jakob Erdmann
20
/// @author Walter Bamberger
21
/// @date July 2010
22
///
23
// The handler for parsing the statistics file.
24
/****************************************************************************/
25
#pragma once
26
#include <config.h>
27
28
#include <string>
29
#include <utils/xml/SUMOSAXHandler.h>
30
#include <utils/common/UtilExceptions.h>
31
#include "city/AGCity.h"
32
#include "city/AGBusLine.h"
33
34
35
// ===========================================================================
36
// class declarations
37
// ===========================================================================
38
class RONet;
39
40
41
// ===========================================================================
42
// class definitions
43
// ===========================================================================
44
class AGActivityGenHandler : public SUMOSAXHandler {
45
public:
46
/** @brief Constructor
47
*
48
* @param[in] net The City instance to fill
49
*/
50
AGActivityGenHandler(AGCity& city, RONet* net);
51
52
53
/// @brief Destructor
54
virtual ~AGActivityGenHandler();
55
56
57
protected:
58
/// @name inherited from GenericSAXHandler
59
//@{
60
61
/** @brief Called on the opening of a tag;
62
*
63
* @param[in] element ID of the currently opened element
64
* @param[in] attrs Attributes within the currently opened element
65
* @exception ProcessError If something fails
66
* @see GenericSAXHandler::myStartElement
67
*/
68
virtual void myStartElement(int element,
69
const SUMOSAXAttributes& attrs);
70
//@}
71
72
protected:
73
/// @name called from myStartElement
74
//@{
75
76
/**
77
* Parses attributes from an "general"-element in city file.
78
*/
79
void parseGeneralCityInfo(const SUMOSAXAttributes& attrs);
80
/*void parseInhabitants(const SUMOSAXAttributes &attrs);
81
void parseHouseholds(const SUMOSAXAttributes &attrs);
82
void parseChildrenAgeLimit(const SUMOSAXAttributes &attrs);
83
void parseRetirementAgeLimit(const SUMOSAXAttributes &attrs);
84
void parseCarRate(const SUMOSAXAttributes &attrs);
85
void parseUnemployment(const SUMOSAXAttributes &attrs);
86
void parseFootDistanceLimit(const SUMOSAXAttributes &attrs);
87
void parseIncomingTraffic(const SUMOSAXAttributes &attrs);
88
void parseOutgoingTraffic(const SUMOSAXAttributes &attrs);*/
89
90
/**
91
* parse parameters, all are optional, default values are given.
92
*/
93
void parseParameters(const SUMOSAXAttributes& attrs);
94
95
/**
96
* streets are extracted: it fills the streets list of the City object
97
* an additional computation is needed to normalize the number of inhabitants (and workpositions) in each street
98
*/
99
void parseStreets(const SUMOSAXAttributes& attrs);
100
101
/**
102
* parse city entrances: the gates of the city, used for incoming and outgoing traffic
103
*/
104
void parseCityGates(const SUMOSAXAttributes& attrs);
105
106
/**
107
* extraction of work opening and closing hours
108
*/
109
void parseWorkHours();
110
void parseOpeningHour(const SUMOSAXAttributes& attrs);
111
void parseClosingHour(const SUMOSAXAttributes& attrs);
112
113
/**
114
* School extraction
115
*/
116
void parseSchools();
117
void parseSchool(const SUMOSAXAttributes& attrs);
118
119
/**
120
* Bus stations and Bus extraction
121
* an additional computation have to be done to create buses' names and buses in the return way
122
*/
123
void parseBusStation(const SUMOSAXAttributes& attrs);
124
void parseBusLine(const SUMOSAXAttributes& attrs);
125
void parseStations();
126
void parseRevStations();
127
void parseStation(const SUMOSAXAttributes& attrs);
128
void parseFrequency(const SUMOSAXAttributes& attrs);
129
130
/**
131
* population and children accompaniment bracket extraction
132
* then households and all population data will be computable
133
*/
134
void parsePopulation();
135
//void parseChildrenAccompaniment();
136
void parseBracket(const SUMOSAXAttributes& attrs);
137
138
139
protected:
140
/// @brief The city to store the information into
141
AGCity& myCity;
142
143
/// @brief The name of the object that is currently processed
144
std::string myCurrentObject;
145
AGBusLine* currentBusLine;
146
147
/// @brief indicator whether the current station (in bus line context) is a reverse station or not.
148
bool isRevStation;
149
150
/// @brief The loaded network
151
RONet* net;
152
153
/** @brief An indicator whether the next edge shall be read (internal edges are not read by now) */
154
bool myProcess;
155
156
157
private:
158
/// @brief Invalidated copy constructor
159
AGActivityGenHandler(const AGActivityGenHandler& src);
160
161
/// @brief Invalidated assignment operator
162
AGActivityGenHandler& operator=(const AGActivityGenHandler& src);
163
164
};
165
166