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 /****************************************************************************/
15 // Representation of Stops in NETEDIT
16 /****************************************************************************/
17 #ifndef GNEStop_h
18 #define GNEStop_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
26 
27 #include "GNEDemandElement.h"
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
36 
37 public:
39  GNEStop(SumoXMLTag tag, GNEViewNet* viewNet, const SUMOVehicleParameter::Stop& stopParameter, GNEAdditional* stoppingPlace, GNEDemandElement* stopParent);
40 
42  GNEStop(GNEViewNet* viewNet, const SUMOVehicleParameter::Stop& stopParameter, GNELane* lane, bool friendlyPosition, GNEDemandElement* stopParent);
43 
45  ~GNEStop();
46 
51  std::string getBegin() const;
52 
56  void writeDemandElement(OutputDevice& device) const;
57 
59  bool isDemandElementValid() const;
60 
62  std::string getDemandElementProblem() const;
63 
66 
70  GNEEdge* getFromEdge() const;
71 
73  GNEEdge* getToEdge() const;
74 
77 
79  const RGBColor& getColor() const;
80 
82  void compute();
83 
85 
89  void startGeometryMoving();
90 
92  void endGeometryMoving();
93 
97  void moveGeometry(const Position& offset);
98 
102  void commitGeometryMoving(GNEUndoList* undoList);
103 
105  void updateGeometry();
106 
108  Position getPositionInView() const;
110 
113 
116  std::string getParentName() const;
117 
122 
127  void drawGL(const GUIVisualizationSettings& s) const;
129 
133  void selectAttributeCarrier(bool changeFlag = true);
134 
136  void unselectAttributeCarrier(bool changeFlag = true);
137 
138  /* @brief method for getting the Attribute of an XML key
139  * @param[in] key The attribute key
140  * @return string with the value associated to key
141  */
142  std::string getAttribute(SumoXMLAttr key) const;
143 
144  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
145  * @param[in] key The attribute key
146  * @return double with the value associated to key
147  */
148  double getAttributeDouble(SumoXMLAttr key) const;
149 
150  /* @brief method for setting the attribute and letting the object perform demand element changes
151  * @param[in] key The attribute key
152  * @param[in] value The new value
153  * @param[in] undoList The undoList on which to register changes
154  * @param[in] net optionally the GNENet to inform about gui updates
155  */
156  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
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  */
163  bool isValid(SumoXMLAttr key, const std::string& value);
164 
165  /* @brief method for enabling attribute
166  * @param[in] key The attribute key
167  * @param[in] undoList The undoList on which to register changes
168  * @note only certain attributes can be enabled, and can produce the disabling of other attributes
169  */
170  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
171 
172  /* @brief method for check if the value for certain attribute is set
173  * @param[in] key The attribute key
174  */
175  bool isAttributeEnabled(SumoXMLAttr key) const;
176 
178  std::string getPopUpID() const;
179 
181  std::string getHierarchyName() const;
183 
187  std::string getGenericParametersStr() const;
188 
190  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
191 
193  void setGenericParametersStr(const std::string& value);
194 
196 
198  double getStartGeometryPositionOverLane() const;
199 
201  double getEndGeometryPositionOverLane() const;
202 
203 protected:
206 
209 
210 private:
212  void setAttribute(SumoXMLAttr key, const std::string& value);
213 
215  void setEnabledAttribute(const int enabledAttributes);
216 
218  GNEStop(const GNEStop&) = delete;
219 
221  GNEStop& operator=(const GNEStop&) = delete;
222 };
223 
224 #endif
225 /****************************************************************************/
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:78
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNEStop::endGeometryMoving
void endGeometryMoving()
end movement
Definition: GNEStop.cpp:211
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEStop::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEStop.cpp:342
SUMOVehicleParameter::Stop::lane
std::string lane
The lane to stop at.
Definition: SUMOVehicleParameter.h:580
GNEStop::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEStop.cpp:840
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GNEStop::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEStop.cpp:851
GNEStop::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:739
GNEDemandElement::DemandElementMove
struct for pack all variables related with Demand Element moving
Definition: GNEDemandElement.h:155
GNEStop::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEStop.cpp:285
GNEStop::myStopMove
DemandElementMove myStopMove
variable demand element move
Definition: GNEStop.h:205
GNEViewNet
Definition: GNEViewNet.h:43
GNEStop::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEStop.cpp:359
GNEStop::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEStop.cpp:72
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
SUMOVehicleParameter.h
GNEStop::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEStop.cpp:164
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEStop::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStop.cpp:590
RGBColor
Definition: RGBColor.h:40
GNEStop::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStop.cpp:759
GNEStop::myFriendlyPosition
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEStop.h:208
GNEStop::getBegin
std::string getBegin() const
get begin time of demand element
Definition: GNEStop.cpp:66
GNEStop::getEndGeometryPositionOverLane
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStop.cpp:810
GNEStop::startGeometryMoving
void startGeometryMoving()
Definition: GNEStop.cpp:196
GNEStop
Definition: GNEStop.h:35
GNEDemandElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNEStop::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEStop.cpp:497
GNEStop::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEStop.cpp:221
GNEStop::getStartGeometryPositionOverLane
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStop.cpp:795
GNEStop::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEStop.cpp:466
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
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:611
GNEStop::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEStop.cpp:266
GNEStop::compute
void compute()
compute demand element
Definition: GNEStop.cpp:190
GNEStop::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStop.cpp:772
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:180
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:113
GNEStop::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEStop.cpp:154
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:649
GNEStop::~GNEStop
~GNEStop()
destructor
Definition: GNEStop.cpp:62
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:778
GNEStop::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEStop.cpp:148
GNEStop::getPositionInView
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEStop.cpp:304
GNEUndoList
Definition: GNEUndoList.h:49
GNEStop::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEStop.cpp:825
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEStop::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEStop.cpp:481
GNEStop::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEStop.cpp:328
GNEStop::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEStop.cpp:1000
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:566
GNEStop::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEStop.cpp:174