Eclipse SUMO - Simulation of Urban MObility
GNEStop.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 // Representation of Stops in NETEDIT
19 /****************************************************************************/
20 #pragma once
22 
23 #include "GNEDemandElement.h"
24 
25 // ===========================================================================
26 // class definitions
27 // ===========================================================================
32 
33 public:
35  GNEStop(SumoXMLTag tag, GNENet* net, const SUMOVehicleParameter::Stop& stopParameter, GNEAdditional* stoppingPlace, GNEDemandElement* stopParent);
36 
38  GNEStop(GNENet* net, const SUMOVehicleParameter::Stop& stopParameter, GNELane* lane, GNEDemandElement* stopParent);
39 
41  ~GNEStop();
42 
47  std::string getBegin() const;
48 
52  void writeDemandElement(OutputDevice& device) const;
53 
55  bool isDemandElementValid() const;
56 
58  std::string getDemandElementProblem() const;
59 
62 
67 
69  const RGBColor& getColor() const;
70 
72 
76  void startGeometryMoving();
77 
79  void endGeometryMoving();
80 
84  void moveGeometry(const Position& offset);
85 
89  void commitGeometryMoving(GNEUndoList* undoList);
90 
92  void updateGeometry();
93 
95  void computePath();
96 
98  void invalidatePath();
99 
101  Position getPositionInView() const;
103 
106 
109  std::string getParentName() const;
110 
115 
117  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
118 
123  void drawGL(const GUIVisualizationSettings& s) const;
124 
130  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const;
131 
138  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const;
140 
143  /* @brief method for getting the Attribute of an XML key
144  * @param[in] key The attribute key
145  * @return string with the value associated to key
146  */
147  std::string getAttribute(SumoXMLAttr key) const;
148 
149  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
150  * @param[in] key The attribute key
151  * @return double with the value associated to key
152  */
153  double getAttributeDouble(SumoXMLAttr key) const;
154 
155  /* @brief method for setting the attribute and letting the object perform demand element changes
156  * @param[in] key The attribute key
157  * @param[in] value The new value
158  * @param[in] undoList The undoList on which to register changes
159  * @param[in] net optionally the GNENet to inform about gui updates
160  */
161  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
162 
163  /* @brief method for setting the attribute and letting the object perform demand element changes
164  * @param[in] key The attribute key
165  * @param[in] value The new value
166  * @param[in] undoList The undoList on which to register changes
167  */
168  bool isValid(SumoXMLAttr key, const std::string& value);
169 
170  /* @brief method for enable attribute
171  * @param[in] key The attribute key
172  * @param[in] undoList The undoList on which to register changes
173  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
174  */
175  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
176 
177  /* @brief method for disable attribute
178  * @param[in] key The attribute key
179  * @param[in] undoList The undoList on which to register changes
180  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
181  */
182  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
183 
184  /* @brief method for check if the value for certain attribute is set
185  * @param[in] key The attribute key
186  */
187  bool isAttributeEnabled(SumoXMLAttr key) const;
188 
190  std::string getPopUpID() const;
191 
193  std::string getHierarchyName() const;
195 
197  const std::map<std::string, std::string>& getACParametersMap() const;
198 
200  double getStartGeometryPositionOverLane() const;
201 
203  double getEndGeometryPositionOverLane() const;
204 
205 protected:
208 
209 private:
211  void setAttribute(SumoXMLAttr key, const std::string& value);
212 
214  void setEnabledAttribute(const int enabledAttributes);
215 
217  GNEStop(const GNEStop&) = delete;
218 
220  GNEStop& operator=(const GNEStop&) = delete;
221 };
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
An Element which don't belongs to GNENet but has influency in the simulation.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
const RGBColor & getColor() const
get color
Definition: GNEStop.cpp:148
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEStop.cpp:593
std::string getBegin() const
get begin time of demand element
Definition: GNEStop.cpp:54
SUMOVehicleClass getVClass() const
Definition: GNEStop.cpp:142
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:732
~GNEStop()
destructor
Definition: GNEStop.cpp:50
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStop.cpp:801
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEStop.cpp:266
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEStop.cpp:321
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStop.cpp:770
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEStop.cpp:179
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEStop.cpp:66
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEStop.cpp:60
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStop.cpp:807
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEStop.cpp:290
GNEStop & operator=(const GNEStop &)=delete
Invalidated assignment operator.
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:672
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStop.cpp:536
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEStop.cpp:445
void computePath()
compute path
Definition: GNEStop.cpp:254
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEStop.cpp:304
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEStop.cpp:327
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNEStop.cpp:557
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEStop.cpp:221
void endGeometryMoving()
end movement
Definition: GNEStop.cpp:169
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEStop.cpp:136
GNEStop(SumoXMLTag tag, GNENet *net, const SUMOVehicleParameter::Stop &stopParameter, GNEAdditional *stoppingPlace, GNEDemandElement *stopParent)
constructor used for stops over stoppingPlaces
Definition: GNEStop.cpp:36
void invalidatePath()
invalidate path
Definition: GNEStop.cpp:260
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStop.cpp:822
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
Definition: GNEStop.cpp:433
DemandElementMove myStopMove
variable demand element move
Definition: GNEStop.h:207
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEStop.cpp:817
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEStop.cpp:991
void updateGeometry()
update pre-computed geometry information
Definition: GNEStop.cpp:237
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStop.cpp:840
GNEStop(const GNEStop &)=delete
Invalidated copy constructor.
void startGeometryMoving()
Definition: GNEStop.cpp:154
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEStop.cpp:101
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
Definition of vehicle stop (position and duration)
std::string lane
The lane to stop at.
struct for pack all variables related with Demand Element moving