Eclipse SUMO - Simulation of Urban MObility
GNEAccess.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 /****************************************************************************/
18 //
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include "GNEAdditional.h"
23 
24 // ===========================================================================
25 // class declarations
26 // ===========================================================================
27 class GNEBusStop;
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
36 class GNEAccess : public GNEAdditional, public Parameterised {
37 
38 public:
40  GNEAccess(GNENet* net);
41 
52  GNEAccess(GNEAdditional* busStop, GNELane* lane, GNENet* net, const double pos, const std::string& specialPos,
53  const bool friendlyPos, const double length, const Parameterised::Map& parameters);
54 
56  ~GNEAccess();
57 
62 
64  bool isAccessPositionFixed() const;
65 
67  GNEEdge* getEdge() const;
68 
71 
75  void writeAdditional(OutputDevice& device) const;
76 
78  bool isAdditionalValid() const;
79 
81  std::string getAdditionalProblem() const;
82 
84  void fixAdditionalProblem();
85 
87 
90 
92  bool checkDrawMoveContour() const;
93 
95 
98 
100  void updateGeometry();
101 
103  Position getPositionInView() const;
104 
106  void updateCenteringBoundary(const bool updateGrid);
107 
109  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
110 
112 
115 
117  std::string getParentName() const;
118 
123  void drawGL(const GUIVisualizationSettings& s) const;
124 
126 
129 
130  /* @brief method for getting the Attribute of an XML key
131  * @param[in] key The attribute key
132  * @return string with the value associated to key
133  */
134  std::string getAttribute(SumoXMLAttr key) const;
135 
136  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
137  * @param[in] key The attribute key
138  * @return double with the value associated to key
139  */
140  double getAttributeDouble(SumoXMLAttr key) const;
141 
143  const Parameterised::Map& getACParametersMap() const;
144 
145  /* @brief method for setting the attribute and letting the object perform additional changes
146  * @param[in] key The attribute key
147  * @param[in] value The new value
148  * @param[in] undoList The undoList on which to register changes
149  */
150  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
151 
152  /* @brief method for checking if the key and their correspond attribute are valid
153  * @param[in] key The attribute key
154  * @param[in] value The value associated to key key
155  * @return true if the value is valid, false in other case
156  */
157  bool isValid(SumoXMLAttr key, const std::string& value);
158 
160  std::string getPopUpID() const;
161 
163  std::string getHierarchyName() const;
164 
166 
167 protected:
170 
172  std::string mySpecialPosition;
173 
175  double myLength;
176 
179 
180 private:
182  void setAttribute(SumoXMLAttr key, const std::string& value);
183 
185  void setMoveShape(const GNEMoveResult& moveResult);
186 
188  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
189 
191  GNEAccess(const GNEAccess&) = delete;
192 
194  GNEAccess& operator=(const GNEAccess&) = delete;
195 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
~GNEAccess()
Destructor.
Definition: GNEAccess.cpp:63
std::string getParentName() const
Returns the name (ID) of the parent object.
Definition: GNEAccess.cpp:213
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
Definition: GNEAccess.cpp:327
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEAccess.cpp:104
GNEAccess & operator=(const GNEAccess &)=delete
Invalidated assignment operator.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEAccess.cpp:432
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Definition: GNEAccess.cpp:130
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEAccess.cpp:369
void updateGeometry()
update pre-computed geometry information
Definition: GNEAccess.cpp:76
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
Definition: GNEAccess.cpp:145
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
Definition: GNEAccess.cpp:178
bool isAccessPositionFixed() const
check if Position of Access is fixed
Definition: GNEAccess.cpp:115
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEAccess.cpp:98
bool myFriendlyPosition
flag to check if friendly position is enabled
Definition: GNEAccess.h:178
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEAccess.cpp:296
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEAccess.cpp:443
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEAccess.cpp:68
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEAccess.cpp:375
GNEEdge * getEdge() const
get edge in which this Access is placed
Definition: GNEAccess.cpp:207
GNEAccess(GNENet *net)
Default constructor.
Definition: GNEAccess.cpp:40
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEAccess.cpp:302
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEAccess.cpp:265
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEAccess.cpp:92
GNEAccess(const GNEAccess &)=delete
Invalidated copy constructor.
std::string mySpecialPosition
position over lane
Definition: GNEAccess.h:172
double myLength
Access length.
Definition: GNEAccess.h:175
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
Definition: GNEAccess.cpp:157
double myPositionOverLane
position over lane
Definition: GNEAccess.h:169
bool checkDrawMoveContour() const
check if draw move contour (red)
Definition: GNEAccess.cpp:191
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEAccess.cpp:308
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEAccess.cpp:219
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
A lane area vehicles can halt at (netedit-version)
Definition: GNEBusStop.h:33
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37