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.org/sumo
3 // Copyright (C) 2001-2022 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, double pos, const double length,
53  bool friendlyPos, const Parameterised::Map& parameters);
54 
56  ~GNEAccess();
57 
62 
64  bool isAccessPositionFixed() const;
65 
67  GNEEdge* getEdge() const;
68 
72  void writeAdditional(OutputDevice& device) const;
73 
77  void updateGeometry();
78 
81 
83  void updateCenteringBoundary(const bool updateGrid);
84 
86  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
88 
92  std::string getParentName() const;
93 
95 
99  void drawGL(const GUIVisualizationSettings& s) const;
101 
104  /* @brief method for getting the Attribute of an XML key
105  * @param[in] key The attribute key
106  * @return string with the value associated to key
107  */
108  std::string getAttribute(SumoXMLAttr key) const;
109 
110  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
111  * @param[in] key The attribute key
112  * @return double with the value associated to key
113  */
114  double getAttributeDouble(SumoXMLAttr key) const;
115 
117  const Parameterised::Map& getACParametersMap() const;
118 
119  /* @brief method for setting the attribute and letting the object perform additional changes
120  * @param[in] key The attribute key
121  * @param[in] value The new value
122  * @param[in] undoList The undoList on which to register changes
123  */
124  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
125 
126  /* @brief method for checking if the key and their correspond attribute are valids
127  * @param[in] key The attribute key
128  * @param[in] value The value associated to key key
129  * @return true if the value is valid, false in other case
130  */
131  bool isValid(SumoXMLAttr key, const std::string& value);
132 
134  std::string getPopUpID() const;
135 
137  std::string getHierarchyName() const;
139 
140 protected:
143 
145  double myLength;
146 
149 
150 private:
152  void setAttribute(SumoXMLAttr key, const std::string& value);
153 
155  void setMoveShape(const GNEMoveResult& moveResult);
156 
158  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
159 
161  GNEAccess(const GNEAccess&) = delete;
162 
164  GNEAccess& operator=(const GNEAccess&) = delete;
165 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
~GNEAccess()
Destructor.
Definition: GNEAccess.cpp:61
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNEAccess.cpp:155
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
Definition: GNEAccess.cpp:282
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEAccess.cpp:108
GNEAccess & operator=(const GNEAccess &)=delete
Invalidated assignment operator.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEAccess.cpp:381
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Definition: GNEAccess.cpp:134
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEAccess.cpp:325
void updateGeometry()
update pre-computed geometry information
Definition: GNEAccess.cpp:74
bool isAccessPositionFixed() const
check if Position of Access is fixed
Definition: GNEAccess.cpp:119
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:148
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEAccess.cpp:251
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEAccess.cpp:392
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEAccess.cpp:66
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEAccess.cpp:331
GNEEdge * getEdge() const
get edge in which this Access is placed
Definition: GNEAccess.cpp:149
GNEAccess(GNENet *net)
Default constructor.
Definition: GNEAccess.cpp:39
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEAccess.cpp:257
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEAccess.cpp:224
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEAccess.cpp:92
GNEAccess(const GNEAccess &)=delete
Invalidated copy constructor.
double myLength
Access length.
Definition: GNEAccess.h:145
double myPositionOverLane
position over lane
Definition: GNEAccess.h:142
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:263
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEAccess.cpp:161
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
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