Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEContainer.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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>
22
25
26#include "GNEDemandElement.h"
28
29// ===========================================================================
30// class declaration
31// ===========================================================================
32
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
40
41public:
44 FXDECLARE(GNEContainerPopupMenu)
45
46 public:
53
56
58 long onCmdTransform(FXObject* obj, FXSelector, void*);
59
60 protected:
61 FOX_CONSTRUCTOR(GNEContainerPopupMenu)
62
63 private:
66
68 FXMenuCommand* myTransformToContainer;
69
72 };
73
77
78 public:
85 GNESelectedContainersPopupMenu(GNEContainer* container, const std::vector<GNEContainer*>& selectedContainer, GUIMainWindow& app, GUISUMOAbstractView& parent);
86
89
91 long onCmdTransform(FXObject* obj, FXSelector, void*);
92
93 protected:
94 FOX_CONSTRUCTOR(GNESelectedContainersPopupMenu)
95
96 private:
99
101 std::vector<GNEContainer*> mySelectedContainers;
102
105
108 };
109
112
114 GNEContainer(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* pType, const SUMOVehicleParameter& containerparameters);
115
118
121
123 GNEMoveElement* getMoveElement() const override;
124
126 Parameterised* getParameters() override;
127
129 const Parameterised* getParameters() const override;
130
132
136 void writeDemandElement(OutputDevice& device) const override;
137
139 Problem isDemandElementValid() const override;
140
142 std::string getDemandElementProblem() const override;
143
145 void fixDemandElementProblem() override;
146
150 SUMOVehicleClass getVClass() const override;
151
153 const RGBColor& getColor() const override;
154
156
160 void updateGeometry() override;
161
163 Position getPositionInView() const override;
165
168
176
180 std::string getParentName() const override;
181
183 double getExaggeration(const GUIVisualizationSettings& s) const override;
184
188 Boundary getCenteringBoundary() const override;
189
191 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
192
197 void drawGL(const GUIVisualizationSettings& s) const override;
198
200
203
205 void computePathElement() override;
206
212 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
213
219 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
220
222 GNELane* getFirstPathLane() const override;
223
225 GNELane* getLastPathLane() const override;
227
230 /* @brief method for getting the Attribute of an XML key
231 * @param[in] key The attribute key
232 * @return string with the value associated to key
233 */
234 std::string getAttribute(SumoXMLAttr key) const override;
235
236 /* @brief method for getting the Attribute of an XML key in double format
237 * @param[in] key The attribute key
238 * @return double with the value associated to key
239 */
240 double getAttributeDouble(SumoXMLAttr key) const override;
241
242 /* @brief method for getting the Attribute of an XML key in position format
243 * @param[in] key The attribute key
244 * @return position with the value associated to key
245 */
246 Position getAttributePosition(SumoXMLAttr key) const override;
247
248 /* @brief method for setting the attribute and letting the object perform demand element changes
249 * @param[in] key The attribute key
250 * @param[in] value The new value
251 * @param[in] undoList The undoList on which to register changes
252 * @param[in] net optionally the GNENet to inform about gui updates
253 */
254 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
255
256 /* @brief method for setting the attribute and letting the object perform demand element changes
257 * @param[in] key The attribute key
258 * @param[in] value The new value
259 * @param[in] undoList The undoList on which to register changes
260 */
261 bool isValid(SumoXMLAttr key, const std::string& value) override;
262
263 /* @brief method for enable attribute
264 * @param[in] key The attribute key
265 * @param[in] undoList The undoList on which to register changes
266 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
267 */
268 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
269
270 /* @brief method for disable attribute
271 * @param[in] key The attribute key
272 * @param[in] undoList The undoList on which to register changes
273 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
274 */
275 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
276
277 /* @brief method for check if the value for certain attribute is set
278 * @param[in] key The attribute key
279 */
280 bool isAttributeEnabled(SumoXMLAttr key) const override;
281
283 std::string getPopUpID() const override;
284
286 std::string getHierarchyName() const override;
288
289protected:
292
295
298
300 void drawAction_drawAsPoly() const;
301
304
305private:
306 // @brief struct used for calculating container plan geometry segments
309 containerPlanSegment(GNEDemandElement* _containerPlan);
310
313
316
318 std::vector<GNEAdditional*> busStops;
319
321 std::vector<GNEDemandElement*> stops;
322
325
326 private:
329 };
330
332 void setAttribute(SumoXMLAttr key, const std::string& value) override;
333
335 void toggleAttribute(SumoXMLAttr key, const bool value) override;
336
338 GNEContainer(const GNEContainer&) = delete;
339
342};
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
FXMenuCommand * myTransformToContainer
menu command for transform to container
GNEContainer * myContainer
current container
FXMenuCommand * myTransformToContainerFlow
menu command for transform to containerFlow
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current container to another container type.
class used in GUIGLObjectPopupMenu for single container transformations
SumoXMLTag myContainerTag
tag of clicked container
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current container to another container type.
FXMenuCommand * myTransformToContainer
menu command for transform to container
FXMenuCommand * myTransformToContainerFlow
menu command for transform to containerFlow
std::vector< GNEContainer * > mySelectedContainers
current selected containers
GNELane * getLastPathLane() const override
get last path lane
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
std::string getDemandElementProblem() const override
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
GNEContainer & operator=(const GNEContainer &)=delete
Invalidated assignment operator.
void updateGeometry() override
update pre-computed geometry information
Parameterised * getParameters() override
get parameters associated with this container
void writeDemandElement(OutputDevice &device) const override
write demand element element into a xml file
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
Problem isDemandElementValid() const override
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
SUMOVehicleClass getVClass() const override
obtain VClass related with this demand element
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this container
void toggleAttribute(SumoXMLAttr key, const bool value) override
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
void fixDemandElementProblem() override
fix demand element problem (by default throw an exception, has to be reimplemented in children)
bool isAttributeEnabled(SumoXMLAttr key) const override
double getAttributeDouble(SumoXMLAttr key) const override
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
bool isValid(SumoXMLAttr key, const std::string &value) override
void drawAction_drawAsPoly() const
draw container as poly
std::string getParentName() const override
Returns the name of the parent object.
GNEMoveElementPlanParent * myMoveElementPlanParent
move element plan parent
Position getPositionInView() const override
Returns position of demand element in view.
Position getAttributePosition(SumoXMLAttr key) const override
GNELane * getFirstPathLane() const override
get first path lane
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
draw container as image
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
~GNEContainer()
destructor
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
void computePathElement() override
compute pathElement
GNEContainer(const GNEContainer &)=delete
Invalidated copy constructor.
GNEContour myContainerContour
variable used for contours
const RGBColor & getColor() const override
get color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
Problem
enum class for demandElement problems
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.
An upper class for objects with additional parameters.
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
std::vector< GNEAdditional * > busStops
busStops placed in this segment
const GNEDemandElement * containerPlan
container plan
double arrivalPos
arrival position