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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A abstract class to define common parameters of lane area in which vehicles can halt (GNE version)
19 /****************************************************************************/
20 #pragma once
21 #include "GNEAdditional.h"
22 
23 // ===========================================================================
24 // value definitions
25 // ===========================================================================
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
37 
38 public:
52  GNEStoppingPlace(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, GNELane* lane, double startPos, double endPos,
53  int parametersSet, const std::string& name, bool friendlyPosition, bool blockMovement);
54 
57 
61  GNEMoveOperation* getMoveOperation(const double shapeOffset);
62 
66  bool isAdditionalValid() const;
67 
69  std::string getAdditionalProblem() const;
70 
72  void fixAdditionalProblem();
74 
76  double getStartPosition() const;
77 
79  double getEndPosition() const;
80 
84  virtual void updateGeometry() = 0;
85 
87  void updateCenteringBoundary(const bool updateGrid);
88 
90  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
92 
97  std::string getParentName() const;
98 
103  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
105 
108  /* @brief method for getting the Attribute of an XML key
109  * @param[in] key The attribute key
110  * @return string with the value associated to key
111  */
112  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
113 
114  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
115  * @param[in] key The attribute key
116  * @return double with the value associated to key
117  */
118  double getAttributeDouble(SumoXMLAttr key) const;
119 
120  /* @brief method for setting the attribute and letting the object perform additional changes
121  * @param[in] key The attribute key
122  * @param[in] value The new value
123  * @param[in] undoList The undoList on which to register changes
124  */
125  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
126 
127  /* @brief method for checking if the key and their conrrespond attribute are valids
128  * @param[in] key The attribute key
129  * @param[in] value The value asociated to key key
130  * @return true if the value is valid, false in other case
131  */
132  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
133 
134  /* @brief method for check if the value for certain attribute is set
135  * @param[in] key The attribute key
136  */
137  bool isAttributeEnabled(SumoXMLAttr key) const;
138 
140  std::string getPopUpID() const;
141 
143  std::string getHierarchyName() const;
145 
146 protected:
149 
152 
155 
158 
161 
163  static const double myCircleWidth;
164 
166  static const double myCircleWidthSquared;
167 
169  static const double myCircleInWidth;
170 
172  static const double myCircleInText;
173 
175  void setStoppingPlaceGeometry(double movingToSide);
176 
178  double getStartGeometryPositionOverLane() const;
179 
181  double getEndGeometryPositionOverLane() const;
182 
184  void drawLines(const GUIVisualizationSettings& s, const std::vector<std::string>& lines, const RGBColor& color) const;
185 
187  void drawSign(const GUIVisualizationSettings& s, const double exaggeration,
188  const RGBColor& baseColor, const RGBColor& signColor, const std::string& word) const;
189 
190 private:
192  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
193 
195  void setMoveShape(const GNEMoveResult& moveResult);
196 
198  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
199 
201  void setPosition(const Position& pos) = delete;
202 };
203 
204 
const int STOPPINGPLACE_STARTPOS_SET
const int STOPPINGPLACE_ENDPOS_SET
GUIGlObjectType
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
void fixAdditionalProblem()
fix additional problem
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
GNEStoppingPlace(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, GNELane *lane, double startPos, double endPos, int parametersSet, const std::string &name, bool friendlyPosition, bool blockMovement)
Constructor.
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
double getAttributeDouble(SumoXMLAttr key) const
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
double getEndPosition() const
get end Position
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
set attribute after validation
static const double myCircleWidthSquared
squared circle width resolution for all stopping places
~GNEStoppingPlace()
Destructor.
double getStartPosition() const
get start Position
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
static const double myCircleWidth
circle width resolution for all stopping places
virtual void updateGeometry()=0
update pre-computed geometry information
bool myFriendlyPosition
Flag for friendly position.
static const double myCircleInText
text inner circle width resolution for all stopping places
std::string getAdditionalProblem() const
return a string with the current additional problem
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
static const double myCircleInWidth
inner circle width resolution for all stopping places
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
void drawLines(const GUIVisualizationSettings &s, const std::vector< std::string > &lines, const RGBColor &color) const
draw lines
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
bool isAttributeEnabled(SumoXMLAttr key) const
double myEndPosition
The position this stopping place is located at (optional, if empty takes the lane length)
void drawSign(const GUIVisualizationSettings &s, const double exaggeration, const RGBColor &baseColor, const RGBColor &signColor, const std::string &word) const
draw sign
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
int myParametersSet
Variable used for set/unset start/endPositions.
Position mySignPos
The position of the sign.
std::string getParentName() const
Returns the name of the parent object (if any)
virtual std::string getAttribute(SumoXMLAttr key) const =0
double myStartPosition
The relative start position this stopping place is located at (optional, if empty takes 0)
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36