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