Eclipse SUMO - Simulation of Urban MObility
GNEStoppingPlace.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 // A abstract class to define common parameters of lane area in which vehicles can halt (GNE version)
15 /****************************************************************************/
16 #ifndef GNEStoppingPlace_h
17 #define GNEStoppingPlace_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEAdditional.h"
25 
26 // ===========================================================================
27 // value definitions
28 // ===========================================================================
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
40 
41 public:
55  GNEStoppingPlace(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane* lane, double startPos, double endPos,
56  int parametersSet, const std::string& name, bool friendlyPosition, bool blockMovement);
57 
60 
64  bool isAdditionalValid() const;
65 
67  std::string getAdditionalProblem() const;
68 
70  void fixAdditionalProblem();
72 
74  double getStartPosition() const;
75 
77  double getEndPosition() const;
78 
81 
84  void moveGeometry(const Position& offset);
85 
89  void commitGeometryMoving(GNEUndoList* undoList);
90 
92  virtual void updateGeometry() = 0;
93 
96 
98  virtual Boundary getCenteringBoundary() const = 0;
99 
101  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
103 
108  std::string getParentName() const;
109 
114  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
116 
119  /* @brief method for getting the Attribute of an XML key
120  * @param[in] key The attribute key
121  * @return string with the value associated to key
122  */
123  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
124 
125  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
126  * @param[in] key The attribute key
127  * @return double with the value associated to key
128  */
129  double getAttributeDouble(SumoXMLAttr key) const;
130 
131  /* @brief method for setting the attribute and letting the object perform additional changes
132  * @param[in] key The attribute key
133  * @param[in] value The new value
134  * @param[in] undoList The undoList on which to register changes
135  */
136  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
137 
138  /* @brief method for checking if the key and their conrrespond attribute are valids
139  * @param[in] key The attribute key
140  * @param[in] value The value asociated to key key
141  * @return true if the value is valid, false in other case
142  */
143  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
144 
145  /* @brief method for check if the value for certain attribute is set
146  * @param[in] key The attribute key
147  */
148  bool isAttributeEnabled(SumoXMLAttr key) const;
149 
151  std::string getPopUpID() const;
152 
154  std::string getHierarchyName() const;
156 
157 protected:
160 
163 
166 
169 
172 
174  static const double myCircleWidth;
175 
177  static const double myCircleWidthSquared;
178 
180  static const double myCircleInWidth;
181 
183  static const double myCircleInText;
184 
186  void setStoppingPlaceGeometry(double movingToSide);
187 
189  double getStartGeometryPositionOverLane() const;
190 
192  double getEndGeometryPositionOverLane() const;
193 
194 private:
196  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
197 
199  void setPosition(const Position& pos) = delete;
200 };
201 
202 
203 #endif
GNEStoppingPlace::setAttribute
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
GNEStoppingPlace::myStartPosition
double myStartPosition
The relative start position this stopping place is located at (optional, if empty takes 0)
Definition: GNEStoppingPlace.h:159
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEAdditional.h
GNEStoppingPlace::drawGL
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNEStoppingPlace::GNEStoppingPlace
GNEStoppingPlace(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane *lane, double startPos, double endPos, int parametersSet, const std::string &name, bool friendlyPosition, bool blockMovement)
Constructor.
Definition: GNEStoppingPlace.cpp:46
GNEStoppingPlace::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEStoppingPlace.cpp:158
GNEStoppingPlace::mySignPos
Position mySignPos
The position of the sign.
Definition: GNEStoppingPlace.h:171
GNEStoppingPlace::setPosition
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
GNEStoppingPlace::getCenteringBoundary
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
STOPPINGPLACE_STARTPOS_SET
const int STOPPINGPLACE_STARTPOS_SET
Definition: GNEStoppingPlace.h:29
GNEViewNet
Definition: GNEViewNet.h:42
STOPPINGPLACE_ENDPOS_SET
const int STOPPINGPLACE_ENDPOS_SET
Definition: GNEStoppingPlace.h:30
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNEStoppingPlace::myCircleInWidth
static const double myCircleInWidth
inner circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:180
GNEStoppingPlace::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEStoppingPlace::myParametersSet
int myParametersSet
Variable used for set/unset start/endPositions.
Definition: GNEStoppingPlace.h:165
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:39
GNEStoppingPlace::myFriendlyPosition
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEStoppingPlace.h:168
GNEStoppingPlace::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStoppingPlace.cpp:353
GNEStoppingPlace::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEStoppingPlace.cpp:140
GNEStoppingPlace::getStartPosition
double getStartPosition() const
get start Position
Definition: GNEStoppingPlace.cpp:260
GNEStoppingPlace::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStoppingPlace.cpp:366
GNEStoppingPlace::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStoppingPlace.cpp:332
GNEStoppingPlace::updateGeometry
virtual void updateGeometry()=0
update pre-computed geometry information
GNEStoppingPlace
Definition: GNEStoppingPlace.h:39
GNEStoppingPlace::myCircleWidthSquared
static const double myCircleWidthSquared
squared circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:177
GNEStoppingPlace::setStoppingPlaceGeometry
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
Definition: GNEStoppingPlace.cpp:286
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEStoppingPlace::isValid
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
GNEStoppingPlace::getEndPosition
double getEndPosition() const
get end Position
Definition: GNEStoppingPlace.cpp:270
GNENetElement
Definition: GNENetElement.h:43
GNEStoppingPlace::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStoppingPlace.cpp:360
GNEStoppingPlace::getEndGeometryPositionOverLane
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStoppingPlace.cpp:317
GNEStoppingPlace::isAdditionalValid
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
Definition: GNEStoppingPlace.cpp:60
GNEStoppingPlace::getStartGeometryPositionOverLane
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStoppingPlace.cpp:302
GNEStoppingPlace::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEStoppingPlace.cpp:202
GNEStoppingPlace::fixAdditionalProblem
void fixAdditionalProblem()
fix additional problem
Definition: GNEStoppingPlace.cpp:127
GNEStoppingPlace::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEStoppingPlace.cpp:244
GNEStoppingPlace::myEndPosition
double myEndPosition
The position this stopping place is located at (optional, if empty takes the lane length)
Definition: GNEStoppingPlace.h:162
GNEStoppingPlace::myCircleInText
static const double myCircleInText
text inner circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:183
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEStoppingPlace::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNEStoppingPlace.cpp:280
GNEStoppingPlace::~GNEStoppingPlace
~GNEStoppingPlace()
Destructor.
Definition: GNEStoppingPlace.cpp:56
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEStoppingPlace::getAdditionalProblem
std::string getAdditionalProblem() const
return a string with the current additional problem
Definition: GNEStoppingPlace.cpp:92
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEStoppingPlace::myCircleWidth
static const double myCircleWidth
circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:174