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, FileBucket* fileBucket, GNEDemandElement* pType,
115 const SUMOVehicleParameter& containerparameters);
116
119
122
124 GNEMoveElement* getMoveElement() const override;
125
127 Parameterised* getParameters() override;
128
130 const Parameterised* getParameters() const override;
131
133
137 void writeDemandElement(OutputDevice& device) const override;
138
140 Problem isDemandElementValid() const override;
141
143 std::string getDemandElementProblem() const override;
144
146 void fixDemandElementProblem() override;
147
151 SUMOVehicleClass getVClass() const override;
152
154 const RGBColor& getColor() const override;
155
157
161 void updateGeometry() override;
162
164 Position getPositionInView() const override;
166
169
177
181 std::string getParentName() const override;
182
184 double getExaggeration(const GUIVisualizationSettings& s) const override;
185
189 Boundary getCenteringBoundary() const override;
190
192 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
193
198 void drawGL(const GUIVisualizationSettings& s) const override;
199
201
204
206 void computePathElement() override;
207
213 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
214
220 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
221
223 GNELane* getFirstPathLane() const override;
224
226 GNELane* getLastPathLane() const override;
228
231 /* @brief method for getting the Attribute of an XML key
232 * @param[in] key The attribute key
233 * @return string with the value associated to key
234 */
235 std::string getAttribute(SumoXMLAttr key) const override;
236
237 /* @brief method for getting the Attribute of an XML key in double format
238 * @param[in] key The attribute key
239 * @return double with the value associated to key
240 */
241 double getAttributeDouble(SumoXMLAttr key) const override;
242
243 /* @brief method for getting the Attribute of an XML key in position format
244 * @param[in] key The attribute key
245 * @return position with the value associated to key
246 */
247 Position getAttributePosition(SumoXMLAttr key) const override;
248
249 /* @brief method for setting the attribute and letting the object perform demand element changes
250 * @param[in] key The attribute key
251 * @param[in] value The new value
252 * @param[in] undoList The undoList on which to register changes
253 * @param[in] net optionally the GNENet to inform about gui updates
254 */
255 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
256
257 /* @brief method for setting the attribute and letting the object perform demand element changes
258 * @param[in] key The attribute key
259 * @param[in] value The new value
260 * @param[in] undoList The undoList on which to register changes
261 */
262 bool isValid(SumoXMLAttr key, const std::string& value) override;
263
264 /* @brief method for enable 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 enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
270
271 /* @brief method for disable attribute
272 * @param[in] key The attribute key
273 * @param[in] undoList The undoList on which to register changes
274 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
275 */
276 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
277
278 /* @brief method for check if the value for certain attribute is set
279 * @param[in] key The attribute key
280 */
281 bool isAttributeEnabled(SumoXMLAttr key) const override;
282
284 std::string getPopUpID() const override;
285
287 std::string getHierarchyName() const override;
289
290protected:
293
296
299
301 void drawAction_drawAsPoly() const;
302
305
306private:
307 // @brief struct used for calculating container plan geometry segments
310 containerPlanSegment(GNEDemandElement* _containerPlan);
311
314
317
319 std::vector<GNEAdditional*> busStops;
320
322 std::vector<GNEDemandElement*> stops;
323
326
327 private:
330 };
331
333 void setAttribute(SumoXMLAttr key, const std::string& value) override;
334
336 void toggleAttribute(SumoXMLAttr key, const bool value) override;
337
339 GNEContainer(const GNEContainer&) = delete;
340
343};
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
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