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 {
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 std::map<std::string, std::string>& 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 
116  /* @brief method for setting the attribute and letting the object perform additional changes
117  * @param[in] key The attribute key
118  * @param[in] value The new value
119  * @param[in] undoList The undoList on which to register changes
120  */
121  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
122 
123  /* @brief method for checking if the key and their correspond attribute are valids
124  * @param[in] key The attribute key
125  * @param[in] value The value asociated to key key
126  * @return true if the value is valid, false in other case
127  */
128  bool isValid(SumoXMLAttr key, const std::string& value);
129 
130  /* @brief method for check if the value for certain attribute is set
131  * @param[in] key The attribute key
132  */
133  bool isAttributeEnabled(SumoXMLAttr key) const;
134 
136  std::string getPopUpID() const;
137 
139  std::string getHierarchyName() const;
141 
142 protected:
145 
147  double myLength;
148 
151 
152 private:
154  void setAttribute(SumoXMLAttr key, const std::string& value);
155 
157  void setMoveShape(const GNEMoveResult& moveResult);
158 
160  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
161 
163  GNEAccess(const GNEAccess&) = delete;
164 
166  GNEAccess& operator=(const GNEAccess&) = delete;
167 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
~GNEAccess()
Destructor.
Definition: GNEAccess.cpp:65
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNEAccess.cpp:159
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEAccess.cpp:268
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEAccess.cpp:112
GNEAccess & operator=(const GNEAccess &)=delete
Invalidated assignment operator.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEAccess.cpp:363
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
Definition: GNEAccess.cpp:138
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEAccess.cpp:314
void updateGeometry()
update pre-computed geometry information
Definition: GNEAccess.cpp:78
bool isAccessPositionFixed() const
check if Position of Access is fixed
Definition: GNEAccess.cpp:123
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEAccess.cpp:102
bool myFriendlyPosition
flag to check if friendly position is enabled
Definition: GNEAccess.h:150
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEAccess.cpp:244
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEAccess.cpp:374
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEAccess.cpp:70
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEAccess.cpp:320
GNEEdge * getEdge() const
get edge in which this Access is placed
Definition: GNEAccess.cpp:153
GNEAccess(GNENet *net)
Default constructor.
Definition: GNEAccess.cpp:40
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEAccess.cpp:217
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEAccess.cpp:96
GNEAccess(const GNEAccess &)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEAccess.cpp:308
double myLength
Access length.
Definition: GNEAccess.h:147
double myPositionOverLane
position over lane
Definition: GNEAccess.h:144
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:250
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEAccess.cpp:165
An Element which don't belongs to GNENet but has influency 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
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37