Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/GNEGeneralHandler.h
193964 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GNEGeneralHandler.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Sep 2021
17
///
18
// General element handler for netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
28
#include <utils/handlers/GeneralHandler.h>
29
#include <netedit/elements/additional/GNEAdditionalHandler.h>
30
#include <netedit/elements/demand/GNERouteHandler.h>
31
#include <netedit/elements/data/GNEMeanDataHandler.h>
32
33
// ===========================================================================
34
// class declarations
35
// ===========================================================================
36
class GNENet;
37
38
// ===========================================================================
39
// class definitions
40
// ===========================================================================
41
42
class GNEGeneralHandler : public GeneralHandler {
43
44
public:
45
/**@brief Constructor
46
* @param[in] net GNENet
47
* @param[in] bucket fileBucket in which save the loaded
48
* @param[in] allowUndoRedo enable or disable undoRedo
49
*/
50
GNEGeneralHandler(GNENet* net, FileBucket* bucket, const bool allowUndoRedo);
51
52
/// @brief Destructor
53
~GNEGeneralHandler();
54
55
/// @brief force overwritte elements (used if we're reloading elements)
56
void forceOverwriteElements();
57
58
/// @brief get flag for check if a element wasn't created
59
bool isErrorCreatingElement() const;
60
61
/// @brief check if the parser file is a additional file
62
bool isAdditionalFile() const;
63
64
/// @brief check if the parser file is a route file
65
bool isRouteFile() const;
66
67
/// @brief check if the parser file is a meanData file
68
bool isMeanDataFile() const;
69
70
private:
71
/// @brief tagType
72
struct TagType {
73
74
enum class Type {
75
NONE,
76
NETWORK,
77
ADDITIONAL,
78
DEMAND,
79
DATA,
80
MEANDATA,
81
};
82
83
/// @brief constructor
84
TagType(SumoXMLTag tag, Type type);
85
86
/// @brief is network element
87
bool isNetwork() const;
88
89
/// @brief is network element
90
bool isAdditional() const;
91
92
/// @brief is network element
93
bool isDemand() const;
94
95
/// @brief is network element
96
bool isData() const;
97
98
/// @brief is network element
99
bool isMeanData() const;
100
101
/// @brief tag related with this TagType
102
const SumoXMLTag tag;
103
104
private:
105
/// @brief tag type
106
const Type myType;
107
};
108
109
/// @brief queue with the inserted tags
110
std::list<TagType> myQueue;
111
112
/// @brief additional handler
113
GNEAdditionalHandler myAdditionalHandler;
114
115
/// @brief demand handler
116
GNERouteHandler myDemandHandler;
117
118
/// @brief meanData handler
119
GNEMeanDataHandler myMeanDataHandler;
120
121
/// @brief flag for set file type
122
TagType::Type fileType = TagType::Type::NONE;
123
124
/// @brief start element
125
void beginTag(SumoXMLTag tag, const SUMOSAXAttributes& attrs);
126
127
/// @brief end element
128
void endTag();
129
130
/// @brief invalidate copy constructor
131
GNEGeneralHandler(const GNEGeneralHandler& s) = delete;
132
133
/// @brief invalidate assignment operator
134
GNEGeneralHandler& operator=(const GNEGeneralHandler& s) = delete;
135
};
136
137
/****************************************************************************/
138
139