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-2020 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 "GNEAdditional.h"
22 
23 // ===========================================================================
24 // class declarations
25 // ===========================================================================
26 class GNEBusStop;
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 class GNEAccess : public GNEAdditional {
36 
37 public:
48  GNEAccess(GNEAdditional* busStop, GNELane* lane, GNENet* net, double pos, const std::string& length, bool friendlyPos, bool blockMovement);
49 
51  ~GNEAccess();
52 
56  GNEMoveOperation* getMoveOperation(const double shapeOffset);
57 
59  bool isAccessPositionFixed() const;
60 
62  GNEEdge* getEdge() const;
63 
67  void updateGeometry();
68 
70  void updateCenteringBoundary(const bool updateGrid);
71 
73  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
75 
79  std::string getParentName() const;
80 
82 
86  void drawGL(const GUIVisualizationSettings& s) const;
88 
91  /* @brief method for getting the Attribute of an XML key
92  * @param[in] key The attribute key
93  * @return string with the value associated to key
94  */
95  std::string getAttribute(SumoXMLAttr key) const;
96 
97  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
98  * @param[in] key The attribute key
99  * @return double with the value associated to key
100  */
101  double getAttributeDouble(SumoXMLAttr key) const;
102 
103  /* @brief method for setting the attribute and letting the object perform additional changes
104  * @param[in] key The attribute key
105  * @param[in] value The new value
106  * @param[in] undoList The undoList on which to register changes
107  */
108  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
109 
110  /* @brief method for checking if the key and their correspond attribute are valids
111  * @param[in] key The attribute key
112  * @param[in] value The value asociated to key key
113  * @return true if the value is valid, false in other case
114  */
115  bool isValid(SumoXMLAttr key, const std::string& value);
116 
117  /* @brief method for check if the value for certain attribute is set
118  * @param[in] key The attribute key
119  */
120  bool isAttributeEnabled(SumoXMLAttr key) const;
121 
123  std::string getPopUpID() const;
124 
126  std::string getHierarchyName() const;
128 
129 protected:
132 
134  std::string myLength;
135 
138 
139 private:
141  void setAttribute(SumoXMLAttr key, const std::string& value);
142 
144  void setMoveShape(const GNEMoveResult& moveResult);
145 
147  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
148 
150  GNEAccess(const GNEAccess&) = delete;
151 
153  GNEAccess& operator=(const GNEAccess&) = delete;
154 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
~GNEAccess()
Destructor.
Definition: GNEAccess.cpp:47
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNEAccess.cpp:126
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEAccess.cpp:231
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNEAccess.cpp:52
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEAccess.cpp:94
GNEAccess & operator=(const GNEAccess &)=delete
Invalidated assignment operator.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEAccess.cpp:327
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEAccess.cpp:278
void updateGeometry()
update pre-computed geometry information
Definition: GNEAccess.cpp:65
bool isAccessPositionFixed() const
check if Position of Access is fixed
Definition: GNEAccess.cpp:105
GNEAccess(GNEAdditional *busStop, GNELane *lane, GNENet *net, double pos, const std::string &length, bool friendlyPos, bool blockMovement)
Constructor.
Definition: GNEAccess.cpp:36
std::string myLength
Acces length.
Definition: GNEAccess.h:134
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEAccess.cpp:83
bool myFriendlyPosition
flag to check if friendly position is enabled
Definition: GNEAccess.h:137
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEAccess.cpp:204
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEAccess.cpp:336
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEAccess.cpp:284
GNEEdge * getEdge() const
get edge in which this Access is placed
Definition: GNEAccess.cpp:120
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEAccess.cpp:177
GNEAccess(const GNEAccess &)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEAccess.cpp:272
double myPositionOverLane
position over lane
Definition: GNEAccess.h:131
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:210
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEAccess.cpp:132
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
A lane area vehicles can halt at (netedit-version)
Definition: GNEBusStop.h:32
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
Stores the information about how to visualize structures.