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