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 /****************************************************************************/
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,
51  const std::string& name, bool friendlyPosition, bool blockMovement);
52 
55 
59  bool isAdditionalValid() const;
60 
62  std::string getAdditionalProblem() const;
63 
65  void fixAdditionalProblem();
67 
75  static bool checkStoppinPlacePosition(const std::string& startPosStr, const std::string& endPosStr, const double laneLength, const bool friendlyPos);
76 
84  static bool fixStoppinPlacePosition(std::string& startPosStr, std::string& endPosStr, const double laneLength, const bool friendlyPos);
85 
87  double getStartPosition() const;
88 
90  double getEndPosition() const;
91 
94 
97  void moveGeometry(const Position& offset);
98 
102  void commitGeometryMoving(GNEUndoList* undoList);
103 
105  virtual void updateGeometry() = 0;
106 
108  Position getPositionInView() const;
109 
111  virtual Boundary getCenteringBoundary() const = 0;
113 
118  std::string getParentName() const;
119 
124  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
126 
129  /* @brief method for getting the Attribute of an XML key
130  * @param[in] key The attribute key
131  * @return string with the value associated to key
132  */
133  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
134 
135  /* @brief method for setting the attribute and letting the object perform additional changes
136  * @param[in] key The attribute key
137  * @param[in] value The new value
138  * @param[in] undoList The undoList on which to register changes
139  */
140  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
141 
142  /* @brief method for checking if the key and their conrrespond attribute are valids
143  * @param[in] key The attribute key
144  * @param[in] value The value asociated to key key
145  * @return true if the value is valid, false in other case
146  */
147  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
148 
150  std::string getPopUpID() const;
151 
153  std::string getHierarchyName() const;
155 
156 protected:
158  std::string myStartPosition;
159 
161  std::string myEndPosition;
162 
165 
168 
170  static const double myCircleWidth;
171 
173  static const double myCircleWidthSquared;
174 
176  static const double myCircleInWidth;
177 
179  static const double myCircleInText;
180 
182  void setStoppingPlaceGeometry(double movingToSide);
183 
185  double getStartGeometryPositionOverLane() const;
186 
188  double getEndGeometryPositionOverLane() const;
189 
190 private:
192  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
193 
195  void setPosition(const Position& pos) = delete;
196 };
197 
198 
199 #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.
static bool checkStoppinPlacePosition(const std::string &startPosStr, const std::string &endPosStr, const double laneLength, const bool friendlyPos)
check if the position of an stoppingPlace over a lane is valid (without modifications) ...
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
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 ...
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
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
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
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:47
virtual void updateGeometry()=0
update pre-computed geometry information
static bool fixStoppinPlacePosition(std::string &startPosStr, std::string &endPosStr, const double laneLength, const bool friendlyPos)
check if the position of an stoppingPlace over a la can be fixed
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 Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
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.