Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/data/GNEDataHandler.h
169684 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
// 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 GNEDataHandler.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2020
17
///
18
// Builds data objects for netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/handlers/DataHandler.h>
24
25
26
// ===========================================================================
27
// class declarations
28
// ===========================================================================
29
class GNENet;
30
31
// ===========================================================================
32
// class definitions
33
// ===========================================================================
34
35
class GNEDataHandler : public DataHandler {
36
37
public:
38
/**@brief Constructor
39
* @param[in] net GNENet
40
* @param[in] file Name of the parsed file
41
* @param[in] allowUndoRedo enable or disable undoRedo
42
*/
43
GNEDataHandler(GNENet* net, const std::string& file, const bool allowUndoRedo);
44
45
/// @brief Destructor
46
~GNEDataHandler();
47
48
/// @brief run post parser tasks
49
bool postParserTasks();
50
51
/// @name build functions
52
/// @{
53
/**@brief Builds DataSet (exclusive of netedit)
54
* @param[in] dataSetID new dataSet
55
*/
56
bool buildDataSet(const std::string& id);
57
58
/**@brief Builds DataInterval
59
* @param[in] sumoBaseObject sumo base object used for build
60
* @param[in] dataSetID interval's dataSet
61
* @param[in] begin interval begin
62
* @param[in] end interval end
63
*/
64
bool buildDataInterval(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& dataSetID,
65
const double begin, const double end);
66
67
/**@brief Builds edgeData
68
* @param[in] sumoBaseObject sumo base object used for build
69
* @param[in] edgeID edge ID
70
* @param[in] parameters parameters map
71
*/
72
bool buildEdgeData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID,
73
const Parameterised::Map& parameters);
74
75
/**@brief Builds edgeRelationData
76
* @param[in] sumoBaseObject sumo base object used for build
77
* @param[in] fromEdge edge from
78
* @param[in] toEdge edge to
79
* @param[in] parameters parameters map
80
*/
81
bool buildEdgeRelationData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& fromEdgeID,
82
const std::string& toEdgeID, const Parameterised::Map& parameters);
83
84
/**@brief Builds TAZRelationData
85
* @param[in] sumoBaseObject sumo base object used for build
86
* @param[in] fromTAZ TAZ from
87
* @param[in] toTAZ TAZ to
88
* @param[in] parameters parameters map
89
*/
90
bool buildTAZRelationData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& fromTAZID,
91
const std::string& toTAZID, const Parameterised::Map& parameters);
92
/// @}
93
94
protected:
95
/// @brief pointer to GNENet
96
GNENet* myNet;
97
98
/// @brief allow undo/redo
99
const bool myAllowUndoRedo;
100
101
/// @brief check if given ID correspond to a duplicated dataSet
102
bool checkDuplicatedDataSet(const std::string& id);
103
104
private:
105
/// @brief invalidate default constructor
106
GNEDataHandler() = delete;
107
108
/// @brief invalidate copy constructor
109
GNEDataHandler(const GNEDataHandler& s) = delete;
110
111
/// @brief invalidate assignment operator
112
GNEDataHandler& operator=(const GNEDataHandler& s) = delete;
113
};
114
115