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-2024 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 definitions
31// ===========================================================================
32
34
35public:
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
112
117
121 void writeDemandElement(OutputDevice& device) const;
122
125
127 std::string getDemandElementProblem() const;
128
131
136
138 const RGBColor& getColor() const;
139
141
145 void updateGeometry();
146
150
153
161
165 std::string getParentName() const;
166
168 double getExaggeration(const GUIVisualizationSettings& s) const;
169
174
176 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
177
182 void drawGL(const GUIVisualizationSettings& s) const;
183
185
188
190 void computePathElement();
191
197 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
198
204 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
205
207 GNELane* getFirstPathLane() const;
208
210 GNELane* getLastPathLane() const;
212
215 /* @brief method for getting the Attribute of an XML key
216 * @param[in] key The attribute key
217 * @return string with the value associated to key
218 */
219 std::string getAttribute(SumoXMLAttr key) const;
220
221 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
222 * @param[in] key The attribute key
223 * @return double with the value associated to key
224 */
225 double getAttributeDouble(SumoXMLAttr key) const;
226
227 /* @brief method for getting the Attribute of an XML key in Position format (used in container plans)
228 * @param[in] key The attribute key
229 * @return double with the value associated to key
230 */
232
233 /* @brief method for setting the attribute and letting the object perform demand element changes
234 * @param[in] key The attribute key
235 * @param[in] value The new value
236 * @param[in] undoList The undoList on which to register changes
237 * @param[in] net optionally the GNENet to inform about gui updates
238 */
239 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
240
241 /* @brief method for setting the attribute and letting the object perform demand element changes
242 * @param[in] key The attribute key
243 * @param[in] value The new value
244 * @param[in] undoList The undoList on which to register changes
245 */
246 bool isValid(SumoXMLAttr key, const std::string& value);
247
248 /* @brief method for enable attribute
249 * @param[in] key The attribute key
250 * @param[in] undoList The undoList on which to register changes
251 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
252 */
253 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
254
255 /* @brief method for disable attribute
256 * @param[in] key The attribute key
257 * @param[in] undoList The undoList on which to register changes
258 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
259 */
260 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
261
262 /* @brief method for check if the value for certain attribute is set
263 * @param[in] key The attribute key
264 */
265 bool isAttributeEnabled(SumoXMLAttr key) const;
266
268 std::string getPopUpID() const;
269
271 std::string getHierarchyName() const;
273
276
277protected:
280
283
285 void drawAction_drawAsPoly() const;
286
289
290private:
291 // @brief struct used for calculating container plan geometry segments
294 containerPlanSegment(GNEDemandElement* _containerPlan);
295
298
301
303 std::vector<GNEAdditional*> busStops;
304
306 std::vector<GNEDemandElement*> stops;
307
310
311 private:
314 };
315
317 void setAttribute(SumoXMLAttr key, const std::string& value);
318
320 void toggleAttribute(SumoXMLAttr key, const bool value);
321
323 void setMoveShape(const GNEMoveResult& moveResult);
324
326 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
327
329 GNEContainer(const GNEContainer&) = delete;
330
333};
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
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
GNEContainer & operator=(const GNEContainer &)=delete
Invalidated assignment operator.
void updateGeometry()
update pre-computed geometry information
Position getAttributePosition(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
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
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
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 drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
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 drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
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()
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)
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
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.
GNEContour myContainerContour
variable used for contours
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)
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.
std::map< std::string, std::string > Map
parameters map
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