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