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-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 /****************************************************************************/
14 // Representation of Stops in NETEDIT
15 /****************************************************************************/
16 #ifndef GNEStop_h
17 #define GNEStop_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
25 
26 #include "GNEDemandElement.h"
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 
36 public:
38  GNEStop(SumoXMLTag tag, GNEViewNet* viewNet, const SUMOVehicleParameter::Stop& stopParameter, GNEAdditional* stoppingPlace, GNEDemandElement* stopParent);
39 
41  GNEStop(GNEViewNet* viewNet, const SUMOVehicleParameter::Stop& stopParameter, GNELane* lane, GNEDemandElement* stopParent);
42 
44  ~GNEStop();
45 
50  std::string getBegin() const;
51 
55  void writeDemandElement(OutputDevice& device) const;
56 
58  bool isDemandElementValid() const;
59 
61  std::string getDemandElementProblem() const;
62 
65 
69  GNEEdge* getFromEdge() const;
70 
72  GNEEdge* getToEdge() const;
73 
76 
78  const RGBColor& getColor() const;
79 
81 
85  void startGeometryMoving();
86 
88  void endGeometryMoving();
89 
93  void moveGeometry(const Position& offset);
94 
98  void commitGeometryMoving(GNEUndoList* undoList);
99 
101  void updateGeometry();
102 
104  void updatePartialGeometry(const GNEEdge* edge);
105 
107  void computePath();
108 
110  void invalidatePath();
111 
113  Position getPositionInView() const;
115 
118 
121  std::string getParentName() const;
122 
127 
129  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
130 
135  void drawGL(const GUIVisualizationSettings& s) const;
137 
141  void selectAttributeCarrier(bool changeFlag = true);
142 
144  void unselectAttributeCarrier(bool changeFlag = true);
145 
146  /* @brief method for getting the Attribute of an XML key
147  * @param[in] key The attribute key
148  * @return string with the value associated to key
149  */
150  std::string getAttribute(SumoXMLAttr key) const;
151 
152  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
153  * @param[in] key The attribute key
154  * @return double with the value associated to key
155  */
156  double getAttributeDouble(SumoXMLAttr key) const;
157 
158  /* @brief method for setting the attribute and letting the object perform demand element changes
159  * @param[in] key The attribute key
160  * @param[in] value The new value
161  * @param[in] undoList The undoList on which to register changes
162  * @param[in] net optionally the GNENet to inform about gui updates
163  */
164  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
165 
166  /* @brief method for setting the attribute and letting the object perform demand element changes
167  * @param[in] key The attribute key
168  * @param[in] value The new value
169  * @param[in] undoList The undoList on which to register changes
170  */
171  bool isValid(SumoXMLAttr key, const std::string& value);
172 
173  /* @brief method for enable attribute
174  * @param[in] key The attribute key
175  * @param[in] undoList The undoList on which to register changes
176  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
177  */
178  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
179 
180  /* @brief method for disable attribute
181  * @param[in] key The attribute key
182  * @param[in] undoList The undoList on which to register changes
183  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
184  */
185  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
186 
187  /* @brief method for check if the value for certain attribute is set
188  * @param[in] key The attribute key
189  */
190  bool isAttributeEnabled(SumoXMLAttr key) const;
191 
193  std::string getPopUpID() const;
194 
196  std::string getHierarchyName() 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 };
222 
223 #endif
224 /****************************************************************************/
GNEStop::GNEStop
GNEStop(const GNEStop &)=delete
Invalidated copy constructor.
GNEStop::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEStop.cpp:76
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEStop::endGeometryMoving
void endGeometryMoving()
end movement
Definition: GNEStop.cpp:203
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEStop::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEStop.cpp:375
GNEStop::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEStop.cpp:392
SUMOVehicleParameter::Stop::lane
std::string lane
The lane to stop at.
Definition: SUMOVehicleParameter.h:586
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEStop::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:788
GNEDemandElement::DemandElementMove
struct for pack all variables related with Demand Element moving
Definition: GNEDemandElement.h:59
GNEStop::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEStop.cpp:271
GNEStop::myStopMove
DemandElementMove myStopMove
variable demand element move
Definition: GNEStop.h:207
GNEViewNet
Definition: GNEViewNet.h:42
GNEStop::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEStop.cpp:298
GNEStop::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEStop.cpp:398
GNEStop::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEStop.cpp:70
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
SUMOVehicleParameter.h
GNEStop::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEStop.cpp:162
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEStop::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStop.cpp:640
RGBColor
Definition: RGBColor.h:39
GNEStop::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStop.cpp:886
GNEStop::getBegin
std::string getBegin() const
get begin time of demand element
Definition: GNEStop.cpp:64
GNEStop::getEndGeometryPositionOverLane
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStop.cpp:958
GNEStop::startGeometryMoving
void startGeometryMoving()
Definition: GNEStop.cpp:188
GNEStop
Definition: GNEStop.h:34
GNEDemandElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEStop::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEStop.cpp:539
GNEStop::computePath
void computePath()
compute path
Definition: GNEStop.cpp:325
GNEStop::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEStop.cpp:213
GNEStop::getStartGeometryPositionOverLane
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStop.cpp:940
GNEStop::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEStop.cpp:508
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEStop::setAttribute
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:661
GNEStop::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEStop.cpp:255
GNEStop::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:848
GNEStop::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEStop.cpp:331
GNENetElement
Definition: GNENetElement.h:43
GNEStop::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStop.cpp:917
GNEStop::GNEStop
GNEStop(SumoXMLTag tag, GNEViewNet *viewNet, const SUMOVehicleParameter::Stop &stopParameter, GNEAdditional *stoppingPlace, GNEDemandElement *stopParent)
constructor used for stops over stoppingPlaces
Definition: GNEStop.cpp:44
GNEStop::getColor
const RGBColor & getColor() const
get color
Definition: GNEStop.cpp:178
GNEStop::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEStop.cpp:111
GNEStop::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEStop.cpp:152
GNEStop::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEStop.cpp:699
GNEStop::~GNEStop
~GNEStop()
destructor
Definition: GNEStop.cpp:60
GNEStop::operator=
GNEStop & operator=(const GNEStop &)=delete
Invalidated assignment operator.
GNEStop::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStop.cpp:923
GNEStop::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEStop.cpp:146
GNEStop::getPositionInView
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEStop.cpp:337
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEStop::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEStop.cpp:523
GNEStop::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEStop.cpp:361
GNEStop::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEStop.cpp:1112
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:572
GNEStop::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEStop.cpp:172