Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEInductionLoopDetector.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 GNEInductionLoopDetector.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
//
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEDetector.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNEInductionLoopDetector : public GNEDetector {
30
31
public:
32
/// @brief default constructor
33
GNEInductionLoopDetector(GNENet* net);
34
35
/**@brief Constructor
36
* @param[in] id The storage of gl-ids to get the one for this lane representation from
37
* @param[in] net pointer to GNENet of this additional element belongs
38
* @param[in] filename file in which this element is stored
39
* @param[in] lane Lane of this StoppingPlace belongs
40
* @param[in] pos position of the detector on the lane
41
* @param[in] freq the aggregation period the values the detector collects shall be summed up.
42
* @param[in] filename The path to the output file.
43
* @param[in] name E1 detector name
44
* @param[in] vehicleTypes space separated list of vehicle type ids to consider
45
* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection
46
* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)
47
* @param[in] friendlyPos enable or disable friendly positions
48
* @param[in] show detector in sumo-gui
49
* @param[in] parameters generic parameters
50
*/
51
GNEInductionLoopDetector(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double pos, const SUMOTime freq,
52
const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
53
const std::string& detectPersons, const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters);
54
55
/// @brief Destructor
56
~GNEInductionLoopDetector();
57
58
/// @name members and functions relative to write additionals into XML
59
/// @{
60
61
/**@brief write additional element into a xml file
62
* @param[in] device device in which write parameters of additional element
63
*/
64
void writeAdditional(OutputDevice& device) const;
65
66
/// @brief check if current additional is valid to be written into XML
67
bool isAdditionalValid() const;
68
69
/// @brief return a string with the current additional problem
70
std::string getAdditionalProblem() const;
71
72
/// @brief fix additional problem
73
void fixAdditionalProblem();
74
75
/// @}
76
77
/// @brief update pre-computed geometry information
78
void updateGeometry();
79
80
/// @name Function related with drawing
81
/// @{
82
83
/// @brief check if draw related contour (cyan)
84
bool checkDrawRelatedContour() const;
85
86
/// @}
87
88
/// @name inherited from GUIGlObject
89
/// @{
90
91
/**@brief Draws the object
92
* @param[in] s The settings for the current view (may influence drawing)
93
* @see GUIGlObject::drawGL
94
*/
95
void drawGL(const GUIVisualizationSettings& s) const;
96
97
/// @}
98
99
/// @name inherited from GNEAttributeCarrier
100
/// @{
101
102
/* @brief method for getting the Attribute of an XML key
103
* @param[in] key The attribute key
104
* @return string with the value associated to key
105
*/
106
std::string getAttribute(SumoXMLAttr key) const;
107
108
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
109
* @param[in] key The attribute key
110
* @return double with the value associated to key
111
*/
112
double getAttributeDouble(SumoXMLAttr key) const;
113
114
/* @brief method for setting the attribute and letting the object perform additional changes
115
* @param[in] key The attribute key
116
* @param[in] value The new value
117
* @param[in] undoList The undoList on which to register changes
118
*/
119
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
120
121
/* @brief method for checking if the key and their correspond attribute are valids
122
* @param[in] key The attribute key
123
* @param[in] value The value associated to key key
124
* @return true if the value is valid, false in other case
125
*/
126
bool isValid(SumoXMLAttr key, const std::string& value);
127
128
/// @}
129
130
private:
131
/// @brief set attribute after validation
132
void setAttribute(SumoXMLAttr key, const std::string& value);
133
134
/// @brief set move shape
135
void setMoveShape(const GNEMoveResult& moveResult);
136
137
/// @brief commit move shape
138
void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
139
140
/// @brief Invalidated copy constructor.
141
GNEInductionLoopDetector(const GNEInductionLoopDetector&) = delete;
142
143
/// @brief Invalidated assignment operator.
144
GNEInductionLoopDetector& operator=(const GNEInductionLoopDetector&) = delete;
145
};
146
147