Eclipse SUMO - Simulation of Urban MObility
GNEContainer.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-2022 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 containers in NETEDIT
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
24 
25 
26 #include "GNEDemandElement.h"
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 
36 public:
39  FXDECLARE(GNEContainerPopupMenu)
40 
41  public:
48 
51 
53  long onCmdTransform(FXObject* obj, FXSelector, void*);
54 
55  protected:
56  FOX_CONSTRUCTOR(GNEContainerPopupMenu)
57 
58  private:
61 
63  FXMenuCommand* myTransformToContainer;
64 
67  };
68 
72 
73  public:
80  GNESelectedContainersPopupMenu(GNEContainer* container, const std::vector<GNEContainer*>& selectedContainer, GUIMainWindow& app, GUISUMOAbstractView& parent);
81 
84 
86  long onCmdTransform(FXObject* obj, FXSelector, void*);
87 
88  protected:
89  FOX_CONSTRUCTOR(GNESelectedContainersPopupMenu)
90 
91  private:
94 
96  std::vector<GNEContainer*> mySelectedContainers;
97 
99  FXMenuCommand* myTransformToContainer;
100 
103  };
104 
107 
109  GNEContainer(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& containerparameters);
110 
112  ~GNEContainer();
113 
118 
123  std::string getBegin() const;
124 
128  void writeDemandElement(OutputDevice& device) const;
129 
132 
134  std::string getDemandElementProblem() const;
135 
138 
142  SUMOVehicleClass getVClass() const;
143 
145  const RGBColor& getColor() const;
146 
148 
152  void updateGeometry();
153 
155  Position getPositionInView() const;
157 
160 
168 
172  std::string getParentName() const;
173 
175  double getExaggeration(const GUIVisualizationSettings& s) const;
176 
181 
183  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
184 
189  void drawGL(const GUIVisualizationSettings& s) const;
190 
192 
195 
197  void computePathElement();
198 
205  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
206 
214  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
215 
217  GNELane* getFirstPathLane() const;
218 
220  GNELane* getLastPathLane() const;
222 
225  /* @brief method for getting the Attribute of an XML key
226  * @param[in] key The attribute key
227  * @return string with the value associated to key
228  */
229  std::string getAttribute(SumoXMLAttr key) const;
230 
231  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
232  * @param[in] key The attribute key
233  * @return double with the value associated to key
234  */
235  double getAttributeDouble(SumoXMLAttr key) const;
236 
237  /* @brief method for getting the Attribute of an XML key in Position format (used in container plans)
238  * @param[in] key The attribute key
239  * @return double with the value associated to key
240  */
242 
243  /* @brief method for setting the attribute and letting the object perform demand element changes
244  * @param[in] key The attribute key
245  * @param[in] value The new value
246  * @param[in] undoList The undoList on which to register changes
247  * @param[in] net optionally the GNENet to inform about gui updates
248  */
249  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
250 
251  /* @brief method for setting the attribute and letting the object perform demand element changes
252  * @param[in] key The attribute key
253  * @param[in] value The new value
254  * @param[in] undoList The undoList on which to register changes
255  */
256  bool isValid(SumoXMLAttr key, const std::string& value);
257 
258  /* @brief method for enable attribute
259  * @param[in] key The attribute key
260  * @param[in] undoList The undoList on which to register changes
261  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
262  */
263  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
264 
265  /* @brief method for disable attribute
266  * @param[in] key The attribute key
267  * @param[in] undoList The undoList on which to register changes
268  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
269  */
270  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
271 
272  /* @brief method for check if the value for certain attribute is set
273  * @param[in] key The attribute key
274  */
275  bool isAttributeEnabled(SumoXMLAttr key) const;
276 
278  std::string getPopUpID() const;
279 
281  std::string getHierarchyName() const;
283 
285  const std::map<std::string, std::string>& getACParametersMap() const;
286 
287 protected:
289  void setColor(const GUIVisualizationSettings& s) const;
290 
292  bool setFunctionalColor(int activeScheme) const;
293 
294 private:
295  // @brief struct used for calculating container plan geometry segments
298  containerPlanSegment(GNEDemandElement* _containerPlan);
299 
302 
305 
307  std::vector<GNEAdditional*> busStops;
308 
310  std::vector<GNEDemandElement*> stops;
311 
313  double arrivalPos;
314 
315  private:
318  };
319 
321  void setAttribute(SumoXMLAttr key, const std::string& value);
322 
324  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
325 
327  void setMoveShape(const GNEMoveResult& moveResult);
328 
330  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
331 
333  GNEContainer(const GNEContainer&) = delete;
334 
337 };
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
class used in GUIGLObjectPopupMenu for container transformations
Definition: GNEContainer.h:38
FXMenuCommand * myTransformToContainer
menu command for transform to container
Definition: GNEContainer.h:63
GNEContainer * myContainer
current container
Definition: GNEContainer.h:60
GNEContainerPopupMenu(GNEContainer *container, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
FXMenuCommand * myTransformToContainerFlow
menu command for transform to containerFlow
Definition: GNEContainer.h:66
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current container to another container type.
class used in GUIGLObjectPopupMenu for single container transformations
Definition: GNEContainer.h:70
SumoXMLTag myContainerTag
tag of clicked container
Definition: GNEContainer.h:93
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current container to another container type.
GNESelectedContainersPopupMenu(GNEContainer *container, const std::vector< GNEContainer * > &selectedContainer, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
FXMenuCommand * myTransformToContainer
menu command for transform to container
Definition: GNEContainer.h:99
FXMenuCommand * myTransformToContainerFlow
menu command for transform to containerFlow
Definition: GNEContainer.h:102
std::vector< GNEContainer * > mySelectedContainers
current selected containers
Definition: GNEContainer.h:96
Position getPositionInView() const
Returns position of demand element in view.
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
GNELane * getLastPathLane() const
get last path lane
void updateGeometry()
update pre-computed geometry information
std::string getBegin() const
get begin time of demand element
Position getAttributePosition(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
const RGBColor & getColor() const
get color
GNEContainer(SumoXMLTag tag, GNENet *net)
default constructor
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void computePathElement()
compute pathElement
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNEContainer & operator=(const GNEContainer &)=delete
Invalidated assignment operator.
~GNEContainer()
destructor
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getParentName() const
Returns the name of the parent object.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
SUMOVehicleClass getVClass() const
GNEMoveOperation * getMoveOperation()
get move operation
double getAttributeDouble(SumoXMLAttr key) const
bool isAttributeEnabled(SumoXMLAttr key) const
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNEContainer(const GNEContainer &)=delete
Invalidated copy constructor.
GNELane * getFirstPathLane() const
get first path lane
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
An Element which don't belongs to GNENet but has influency in the simulation.
Problem
enum class for demandElement problems
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
The popup menu of a globject.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Structure representing possible vehicle parameter.
SumoXMLTag tag
The vehicle tag.
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition: GNEContainer.h:310
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEContainer.h:307
const GNEDemandElement * containerPlan
container plan
Definition: GNEContainer.h:301
double arrivalPos
arrival position
Definition: GNEContainer.h:313