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-2018 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 /****************************************************************************/
15 // A abstract class to define common parameters of lane area in which vehicles can halt (GNE version)
16 /****************************************************************************/
17 #ifndef GNEStoppingPlace_h
18 #define GNEStoppingPlace_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNEAdditional.h"
26 
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
36 
37 public:
50  GNEStoppingPlace(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane* lane, const std::string& startPos, const std::string& endPos, const std::string& name, bool friendlyPosition, bool blockMovement);
51 
54 
58  bool isAdditionalValid() const;
59 
61  std::string getAdditionalProblem() const;
62 
64  void fixAdditionalProblem();
66 
68  GNELane* getLane() const;
69 
71  double getStartPosition() const;
72 
74  double getEndPosition() const;
75 
78 
81  void moveGeometry(const Position& offset);
82 
86  void commitGeometryMoving(GNEUndoList* undoList);
87 
89  virtual void updateGeometry(bool updateGrid) = 0;
90 
94 
99  std::string getParentName() const;
100 
105  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
107 
110  /* @brief method for getting the Attribute of an XML key
111  * @param[in] key The attribute key
112  * @return string with the value associated to key
113  */
114  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
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  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
122 
123  /* @brief method for checking if the key and their conrrespond 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  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
129 
131  std::string getPopUpID() const;
132 
134  std::string getHierarchyName() const;
136 
137 protected:
140 
142  std::string myStartPosition;
143 
145  std::string myEndPosition;
146 
149 
152 
154  void setStoppingPlaceGeometry(double movingToSide);
155 
157  static const double myCircleWidth;
158 
160  static const double myCircleWidthSquared;
161 
163  static const double myCircleInWidth;
164 
166  static const double myCircleInText;
167 
168 private:
170  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
171 
173  void setPosition(const Position& pos) = delete;
174 };
175 
176 
177 #endif
SumoXMLTag
Numbers representing SUMO-XML - element names.
GUIGlObjectType
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Stores the information about how to visualize structures.
static const double myCircleWidthSquared
squared circle width resolution for all stopping places
static const double myCircleInWidth
inner circle width resolution for all stopping places
Position getPositionInView() const
Returns position of additional in view.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
bool myFriendlyPosition
Flag for friendly position.
std::string myStartPosition
The relative start position this stopping place is located at (optional, if empty takes 0) ...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static const double myCircleInText
text inner circle width resolution for all stopping places
std::string getParentName() const
Returns the name of the parent object (if any)
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes ...
GNELane * getLane() const
get Lane
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
double getEndPosition() const
get end Position
void fixAdditionalProblem()
fix additional problem
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNELane * myLane
The lane in which this lane is placed.
GNEStoppingPlace(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane *lane, const std::string &startPos, const std::string &endPos, const std::string &name, bool friendlyPosition, bool blockMovement)
Constructor.
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
~GNEStoppingPlace()
Destructor.
static const double myCircleWidth
circle width resolution for all stopping places
double getStartPosition() const
get start Position
std::string getAdditionalProblem() const
return a string with the current additional problem
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
virtual void updateGeometry(bool updateGrid)=0
update pre-computed geometry information
std::string myEndPosition
The position this stopping place is located at (optional, if empty takes the lane lenght) ...
Position mySignPos
The position of the sign.
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.