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