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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 //
15 /****************************************************************************/
16 #ifndef GNEAccess_h
17 #define GNEAccess_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEAdditional.h"
25 
26 // ===========================================================================
27 // class declarations
28 // ===========================================================================
29 class GNEBusStop;
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
38 class GNEAccess : public GNEAdditional {
39 
40 public:
51  GNEAccess(GNEAdditional* busStop, GNELane* lane, GNEViewNet* viewNet, double pos, const std::string& length, bool friendlyPos, bool blockMovement);
52 
54  ~GNEAccess();
55 
57  bool isAccessPositionFixed() const;
58 
60  GNEEdge* getEdge() const;
61 
64 
67  void moveGeometry(const Position& offset);
68 
72  void commitGeometryMoving(GNEUndoList* undoList);
73 
75  void updateGeometry();
76 
78  Position getPositionInView() const ;
79 
82 
84  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
86 
90  std::string getParentName() const;
91 
93 
97  void drawGL(const GUIVisualizationSettings& s) const;
99 
102  /* @brief method for getting the Attribute of an XML key
103  * @param[in] key The attribute key
104  * @return string with the value associated to key
105  */
106  std::string getAttribute(SumoXMLAttr key) const;
107 
108  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
109  * @param[in] key The attribute key
110  * @return double with the value associated to key
111  */
112  double getAttributeDouble(SumoXMLAttr key) const;
113 
114  /* @brief method for setting the attribute and letting the object perform additional changes
115  * @param[in] key The attribute key
116  * @param[in] value The new value
117  * @param[in] undoList The undoList on which to register changes
118  */
119  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
120 
121  /* @brief method for checking if the key and their correspond attribute are valids
122  * @param[in] key The attribute key
123  * @param[in] value The value asociated to key key
124  * @return true if the value is valid, false in other case
125  */
126  bool isValid(SumoXMLAttr key, const std::string& value);
127 
128  /* @brief method for check if the value for certain attribute is set
129  * @param[in] key The attribute key
130  */
131  bool isAttributeEnabled(SumoXMLAttr key) const;
132 
134  std::string getPopUpID() const;
135 
137  std::string getHierarchyName() const;
139 
140 protected:
143 
145  std::string myLength;
146 
149 
150 private:
152  void setAttribute(SumoXMLAttr key, const std::string& value);
153 
155  GNEAccess(const GNEAccess&) = delete;
156 
158  GNEAccess& operator=(const GNEAccess&) = delete;
159 };
160 
161 #endif
162 /****************************************************************************/
GNEAccess
Definition: GNEAccess.h:38
GNEAccess::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEAccess.cpp:159
GNEAccess::operator=
GNEAccess & operator=(const GNEAccess &)=delete
Invalidated assignment operator.
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEAdditional.h
GNEAccess::~GNEAccess
~GNEAccess()
Destructor.
Definition: GNEAccess.cpp:46
GNEAccess::getEdge
GNEEdge * getEdge() const
get edge in which this Access is placed
Definition: GNEAccess.cpp:147
GNEAccess::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEAccess.cpp:115
GNEAccess::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEAccess.cpp:75
GNEViewNet
Definition: GNEViewNet.h:42
GNEAccess::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEAccess.cpp:221
GNEAccess::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEAccess.cpp:99
GNEAccess::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNEAccess.cpp:153
GNEAccess::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEAccess.cpp:121
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEAccess::myLength
std::string myLength
Acces length.
Definition: GNEAccess.h:145
GNEAccess::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEAccess.cpp:298
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEAccess::setAttribute
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:227
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEAccess::myFriendlyPosition
bool myFriendlyPosition
flag to check if friendly position is enabled
Definition: GNEAccess.h:148
GNENetElement
Definition: GNENetElement.h:43
GNEBusStop
A lane area vehicles can halt at (netedit-version)
Definition: GNEBusStop.h:34
GNEAccess::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEAccess.cpp:51
GNEAccess::myPositionOverLane
double myPositionOverLane
position over lane
Definition: GNEAccess.h:142
GNEAccess::isAccessPositionFixed
bool isAccessPositionFixed() const
check if Position of Access is fixed
Definition: GNEAccess.cpp:132
GNEAccess::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEAccess.cpp:304
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEAccess::GNEAccess
GNEAccess(GNEAdditional *busStop, GNELane *lane, GNEViewNet *viewNet, double pos, const std::string &length, bool friendlyPos, bool blockMovement)
Constructor.
Definition: GNEAccess.cpp:38
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEAccess::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEAccess.cpp:292
GNEAccess::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEAccess.cpp:194
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEAccess::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEAccess.cpp:64
GNEAccess::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEAccess.cpp:249