Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEEntryExitDetector.h
193874 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 GNEEntryExitDetector.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 declarations
27
// ===========================================================================
28
29
class GNEMoveElementLaneSingle;
30
class GNEMultiEntryExitDetector;
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
36
class GNEEntryExitDetector : public GNEDetector {
37
38
public:
39
/// @brief default Constructor
40
GNEEntryExitDetector(SumoXMLTag entryExitTag, GNENet* net);
41
42
/**@brief Constructor
43
* @param[in] entryExitTag Child Tag (Either SUMO_TAG_DET_ENTRY or SUMO_TAG_DET_EXIT)
44
* @param[in] parent pointer to GNEMultiEntryExitDetector of this GNEEntryExitDetector belongs
45
* @param[in] lane Lane of this detector is placed
46
* @param[in] pos position of the detector on the lane
47
* @param[in] friendlyPos enable or disable friendly positions
48
* @param[in] parameters generic parameters
49
*/
50
GNEEntryExitDetector(SumoXMLTag entryExitTag, GNEAdditional* parent, GNELane* lane, const double pos,
51
const bool friendlyPos, const Parameterised::Map& parameters);
52
53
/// @brief destructor
54
~GNEEntryExitDetector();
55
56
/// @brief methods to retrieve the elements linked to this GNEAdditional
57
/// @{
58
59
/// @brief get GNEMoveElement associated with this GNEAdditional
60
GNEMoveElement* getMoveElement() const override;
61
62
/// @}
63
64
/// @name members and functions relative to write additionals into XML
65
/// @{
66
67
/**@brief write additional element into a xml file
68
* @param[in] device device in which write parameters of additional element
69
*/
70
void writeAdditional(OutputDevice& device) const override;
71
72
/// @brief check if current additional is valid to be written into XML
73
bool isAdditionalValid() const override;
74
75
/// @brief return a string with the current additional problem
76
std::string getAdditionalProblem() const override;
77
78
/// @brief fix additional problem
79
void fixAdditionalProblem() override;
80
81
/// @}
82
83
/// @brief update pre-computed geometry information
84
void updateGeometry() override;
85
86
/// @name inherited from GUIGlObject
87
/// @{
88
89
/**@brief Draws the object
90
* @param[in] s The settings for the current view (may influence drawing)
91
* @see GUIGlObject::drawGL
92
*/
93
void drawGL(const GUIVisualizationSettings& s) const override;
94
95
/// @}
96
97
/// @name inherited from GNEAttributeCarrier
98
/// @{
99
100
/* @brief method for getting the Attribute of an XML key
101
* @param[in] key The attribute key
102
* @return string with the value associated to key
103
*/
104
std::string getAttribute(SumoXMLAttr key) const override;
105
106
/* @brief method for getting the Attribute of an XML key in double format
107
* @param[in] key The attribute key
108
* @return double with the value associated to key
109
*/
110
double getAttributeDouble(SumoXMLAttr key) const override;
111
112
/* @brief method for getting the Attribute of an XML key in position format
113
* @param[in] key The attribute key
114
* @return position with the value associated to key
115
*/
116
Position getAttributePosition(SumoXMLAttr key) const override;
117
118
/* @brief method for setting the attribute and letting the object perform additional changes
119
* @param[in] key The attribute key
120
* @param[in] value The new value
121
* @param[in] undoList The undoList on which to register changes
122
*/
123
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
124
125
/* @brief method for checking if the key and their correspond attribute are valids
126
* @param[in] key The attribute key
127
* @param[in] value The value associated to key key
128
* @return true if the value is valid, false in other case
129
*/
130
bool isValid(SumoXMLAttr key, const std::string& value) override;
131
132
/// @}
133
134
protected:
135
/// @brief position over lane
136
double myPosOverLane = 0;
137
138
/// @brief friendly position
139
bool myFriendlyPos = false;
140
141
/// @brief move element lane single
142
GNEMoveElementLaneSingle* myMoveElementLaneSingle = nullptr;
143
144
private:
145
/// @brief draw body
146
void drawBody(const GUIVisualizationSettings::Detail d, const RGBColor& color, const double exaggeration) const;
147
148
/// @brief draw entry logo
149
void drawEntryLogo(const GUIVisualizationSettings::Detail d, const RGBColor& color, const double exaggeration) const;
150
151
/// @brief draw E3 logo
152
void drawE3Logo(const GUIVisualizationSettings::Detail d, const RGBColor& color, const double exaggeration) const;
153
154
/// @brief set attribute after validation
155
void setAttribute(SumoXMLAttr key, const std::string& value) override;
156
157
/// @brief Invalidated copy constructor.
158
GNEEntryExitDetector(const GNEEntryExitDetector&) = delete;
159
160
/// @brief Invalidated assignment operator.
161
GNEEntryExitDetector& operator=(const GNEEntryExitDetector&) = delete;
162
};
163
164