Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/data/GNEMeanDataHandler.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 GNEMeanDataHandler.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 22
17
///
18
// Builds meanData objects for netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/handlers/MeanDataHandler.h>
24
25
// ===========================================================================
26
// class declarations
27
// ===========================================================================
28
29
class GNENet;
30
class GNEEdge;
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
36
/// @class GNEMeanDataHandler
37
class GNEMeanDataHandler : public MeanDataHandler {
38
39
public:
40
/// @brief Constructor
41
GNEMeanDataHandler(GNENet* net, const std::string& filename, const bool allowUndoRedo);
42
43
/// @brief Destructor
44
virtual ~GNEMeanDataHandler();
45
46
/// @brief run post parser tasks
47
bool postParserTasks();
48
49
/// @name build functions
50
/// @{
51
/// @brief Builds edgeMeanData
52
bool buildEdgeMeanData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id,
53
const std::string& file, SUMOTime period, SUMOTime begin, SUMOTime end, const bool trackVehicles,
54
const std::vector<std::string>& writtenAttributes, const bool aggregate, const std::vector<std::string>& edgeIDs,
55
const std::string& edgeFile, std::string excludeEmpty, const bool withInternal,
56
const std::vector<std::string>& detectPersons, const double minSamples, const double maxTravelTime,
57
const std::vector<std::string>& vTypes, const double speedThreshold);
58
59
/// @brief Builds laneMeanData
60
bool buildLaneMeanData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id,
61
const std::string& file, SUMOTime period, SUMOTime begin, SUMOTime end, const bool trackVehicles,
62
const std::vector<std::string>& writtenAttributes, const bool aggregate, const std::vector<std::string>& edgeIDs,
63
const std::string& edgeFile, std::string excludeEmpty, const bool withInternal,
64
const std::vector<std::string>& detectPersons, const double minSamples, const double maxTravelTime,
65
const std::vector<std::string>& vTypes, const double speedThreshold);
66
67
/// @}
68
69
protected:
70
/// @brief pointer to GNENet
71
GNENet* myNet;
72
73
/// @brief allow undo/redo
74
const bool myAllowUndoRedo;
75
76
/// @brief parse edges
77
std::vector<GNEEdge*> parseEdges(const SumoXMLTag tag, const std::vector<std::string>& edgeIDs);
78
79
/// @brief parse attributes
80
std::vector<SumoXMLAttr> parseAttributes(const SumoXMLTag tag, const std::vector<std::string>& attrStrs);
81
82
/// @brief check if given ID correspond to a duplicated mean data element
83
bool checkDuplicatedMeanDataElement(const SumoXMLTag tag, const std::string& id);
84
85
/// @brief check if given excludeEmpty is valid
86
bool checkExcludeEmpty(const SumoXMLTag tag, const std::string& id, const std::string& excludeEmpty);
87
88
private:
89
/// @brief invalidate default onstructor
90
GNEMeanDataHandler() = delete;
91
92
/// @brief invalidate copy constructor
93
GNEMeanDataHandler(const GNEMeanDataHandler& s) = delete;
94
95
/// @brief invalidate assignment operator
96
GNEMeanDataHandler& operator=(const GNEMeanDataHandler& s) = delete;
97
};
98
99