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>
23 
24 
25 #include "GNEDemandElement.h"
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 
35 public:
38  FXDECLARE(GNEContainerPopupMenu)
39 
40  public:
47 
50 
52  long onCmdTransform(FXObject* obj, FXSelector, void*);
53 
54  protected:
55  FOX_CONSTRUCTOR(GNEContainerPopupMenu)
56 
57  private:
60 
62  FXMenuCommand* myTransformToContainer;
63 
66  };
67 
71 
72  public:
79  GNESelectedContainersPopupMenu(GNEContainer* container, const std::vector<GNEContainer*>& selectedContainer, GUIMainWindow& app, GUISUMOAbstractView& parent);
80 
83 
85  long onCmdTransform(FXObject* obj, FXSelector, void*);
86 
87  protected:
88  FOX_CONSTRUCTOR(GNESelectedContainersPopupMenu)
89 
90  private:
93 
95  std::vector<GNEContainer*> mySelectedContainers;
96 
98  FXMenuCommand* myTransformToContainer;
99 
102  };
103 
106 
108  GNEContainer(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& containerparameters);
109 
111  ~GNEContainer();
112 
117 
122  std::string getBegin() const;
123 
127  void writeDemandElement(OutputDevice& device) const;
128 
131 
133  std::string getDemandElementProblem() const;
134 
137 
141  SUMOVehicleClass getVClass() const;
142 
144  const RGBColor& getColor() const;
145 
147 
151  void updateGeometry();
152 
154  Position getPositionInView() const;
156 
159 
167 
171  std::string getParentName() const;
172 
174  double getExaggeration(const GUIVisualizationSettings& s) const;
175 
180 
182  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
183 
188  void drawGL(const GUIVisualizationSettings& s) const;
189 
191 
194 
196  void computePathElement();
197 
204  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
205 
213  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
214 
216  GNELane* getFirstPathLane() const;
217 
219  GNELane* getLastPathLane() const;
221 
224  /* @brief method for getting the Attribute of an XML key
225  * @param[in] key The attribute key
226  * @return string with the value associated to key
227  */
228  std::string getAttribute(SumoXMLAttr key) const;
229 
230  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
231  * @param[in] key The attribute key
232  * @return double with the value associated to key
233  */
234  double getAttributeDouble(SumoXMLAttr key) const;
235 
236  /* @brief method for getting the Attribute of an XML key in Position format (used in container plans)
237  * @param[in] key The attribute key
238  * @return double with the value associated to key
239  */
241 
242  /* @brief method for setting the attribute and letting the object perform demand element changes
243  * @param[in] key The attribute key
244  * @param[in] value The new value
245  * @param[in] undoList The undoList on which to register changes
246  * @param[in] net optionally the GNENet to inform about gui updates
247  */
248  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
249 
250  /* @brief method for setting the attribute and letting the object perform demand element changes
251  * @param[in] key The attribute key
252  * @param[in] value The new value
253  * @param[in] undoList The undoList on which to register changes
254  */
255  bool isValid(SumoXMLAttr key, const std::string& value);
256 
257  /* @brief method for enable attribute
258  * @param[in] key The attribute key
259  * @param[in] undoList The undoList on which to register changes
260  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
261  */
262  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
263 
264  /* @brief method for disable attribute
265  * @param[in] key The attribute key
266  * @param[in] undoList The undoList on which to register changes
267  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
268  */
269  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
270 
271  /* @brief method for check if the value for certain attribute is set
272  * @param[in] key The attribute key
273  */
274  bool isAttributeEnabled(SumoXMLAttr key) const;
275 
277  std::string getPopUpID() const;
278 
280  std::string getHierarchyName() const;
282 
284  const Parameterised::Map& getACParametersMap() const;
285 
286 protected:
288  void drawAction_drawAsPoly() const;
289 
292 
293 private:
294  // @brief struct used for calculating container plan geometry segments
297  containerPlanSegment(GNEDemandElement* _containerPlan);
298 
301 
304 
306  std::vector<GNEAdditional*> busStops;
307 
309  std::vector<GNEDemandElement*> stops;
310 
312  double arrivalPos;
313 
314  private:
317  };
318 
320  void setAttribute(SumoXMLAttr key, const std::string& value);
321 
323  void toggleAttribute(SumoXMLAttr key, const bool value);
324 
326  void setMoveShape(const GNEMoveResult& moveResult);
327 
329  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
330 
332  GNEContainer(const GNEContainer&) = delete;
333 
336 };
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:37
FXMenuCommand * myTransformToContainer
menu command for transform to container
Definition: GNEContainer.h:62
GNEContainer * myContainer
current container
Definition: GNEContainer.h:59
GNEContainerPopupMenu(GNEContainer *container, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
FXMenuCommand * myTransformToContainerFlow
menu command for transform to containerFlow
Definition: GNEContainer.h:65
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:69
SumoXMLTag myContainerTag
tag of clicked container
Definition: GNEContainer.h:92
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:98
FXMenuCommand * myTransformToContainerFlow
menu command for transform to containerFlow
Definition: GNEContainer.h:101
std::vector< GNEContainer * > mySelectedContainers
current selected containers
Definition: GNEContainer.h:95
Position getPositionInView() const
Returns position of demand element in view.
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 toggleAttribute(SumoXMLAttr key, const bool value)
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 drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
void drawAction_drawAsPoly() const
draw container as poly
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
write demand element element into a xml file
void computePathElement()
compute pathElement
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
draw container as image
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 associated 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 Parameterised::Map & 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 belong to GNENet but has influence 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
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
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:309
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEContainer.h:306
const GNEDemandElement * containerPlan
container plan
Definition: GNEContainer.h:300
double arrivalPos
arrival position
Definition: GNEContainer.h:312