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
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
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEAdditional.h
GNEStoppingPlace::drawGL
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNEStoppingPlace::mySignPos
Position mySignPos
The position of the sign.
Definition: GNEStoppingPlace.h:167
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.
GNEViewNet
Definition: GNEViewNet.h:43
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNEStoppingPlace::myCircleInWidth
static const double myCircleInWidth
inner circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:176
GNEStoppingPlace::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:40
GNEStoppingPlace::myFriendlyPosition
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEStoppingPlace.h:164
GNEStoppingPlace::GNEStoppingPlace
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.
Definition: GNEStoppingPlace.cpp:46
GNEStoppingPlace::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEStoppingPlace.cpp:212
GNEStoppingPlace::getStartPosition
double getStartPosition() const
get start Position
Definition: GNEStoppingPlace.cpp:310
GNEStoppingPlace::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStoppingPlace.cpp:394
GNEStoppingPlace::updateGeometry
virtual void updateGeometry()=0
update pre-computed geometry information
GNEStoppingPlace
Definition: GNEStoppingPlace.h:35
GNEStoppingPlace::myCircleWidthSquared
static const double myCircleWidthSquared
squared circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:173
GNEStoppingPlace::setStoppingPlaceGeometry
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
Definition: GNEStoppingPlace.cpp:336
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
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:320
GNEStoppingPlace::myStartPosition
std::string myStartPosition
The relative start position this stopping place is located at (optional, if empty takes 0)
Definition: GNEStoppingPlace.h:158
GNEStoppingPlace::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStoppingPlace.cpp:388
GNEStoppingPlace::getEndGeometryPositionOverLane
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStoppingPlace.cpp:373
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:59
GNEStoppingPlace::getStartGeometryPositionOverLane
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStoppingPlace.cpp:358
GNEStoppingPlace::fixStoppinPlacePosition
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
Definition: GNEStoppingPlace.cpp:168
GNEStoppingPlace::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEStoppingPlace.cpp:230
GNEStoppingPlace::fixAdditionalProblem
void fixAdditionalProblem()
fix additional problem
Definition: GNEStoppingPlace.cpp:126
GNEStoppingPlace::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEStoppingPlace.cpp:283
GNEStoppingPlace::myCircleInText
static const double myCircleInText
text inner circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:179
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEStoppingPlace::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNEStoppingPlace.cpp:330
GNEStoppingPlace::~GNEStoppingPlace
~GNEStoppingPlace()
Destructor.
Definition: GNEStoppingPlace.cpp:55
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNEStoppingPlace::getAdditionalProblem
std::string getAdditionalProblem() const
return a string with the current additional problem
Definition: GNEStoppingPlace.cpp:91
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEStoppingPlace::myCircleWidth
static const double myCircleWidth
circle width resolution for all stopping places
Definition: GNEStoppingPlace.h:170
GNEStoppingPlace::checkStoppinPlacePosition
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)
Definition: GNEStoppingPlace.cpp:139
GNEStoppingPlace::myEndPosition
std::string myEndPosition
The position this stopping place is located at (optional, if empty takes the lane lenght)
Definition: GNEStoppingPlace.h:161