Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNENetworkElement.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-2023 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// A abstract class for network elements
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class GNEAdditional;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
41public:
54 GNENetworkElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon,
55 const std::vector<GNEJunction*>& junctionParents,
56 const std::vector<GNEEdge*>& edgeParents,
57 const std::vector<GNELane*>& laneParents,
58 const std::vector<GNEAdditional*>& additionalParents,
59 const std::vector<GNEDemandElement*>& demandElementParents,
60 const std::vector<GNEGenericData*>& genericDataParents);
61
63 virtual ~GNENetworkElement();
64
69
72
74 void setShapeEdited(const bool value);
75
77 bool isShapeEdited() const;
78
80 virtual bool isNetworkElementValid() const;
81
83 virtual std::string getNetworkElementProblem() const;
84
88 virtual void updateGeometry() = 0;
89
91 virtual Position getPositionInView() const = 0;
93
96
105
114
117
119 virtual void updateCenteringBoundary(const bool updateGrid) = 0;
120
125 virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
126
128 bool isGLObjectLocked();
129
131 void markAsFrontElement();
132
134 virtual void deleteGLObject() = 0;
135
137 void selectGLObject();
138
140 virtual const std::string getOptionalName() const;
142
145 /* @brief method for getting the Attribute of an XML key
146 * @param[in] key The attribute key
147 * @return string with the value associated to key
148 */
149 virtual std::string getAttribute(SumoXMLAttr key) const = 0;
150
151 /* @brief method for setting the attribute and letting the object perform additional changes
152 * @param[in] key The attribute key
153 * @param[in] value The new value
154 * @param[in] undoList The undoList on which to register changes
155 */
156 virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
157
158 /* @brief method for checking if the key and their conrrespond attribute are valids
159 * @param[in] key The attribute key
160 * @param[in] value The value associated to key key
161 * @return true if the value is valid, false in other case
162 */
163 virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
164
166 std::string getPopUpID() const;
167
169 std::string getHierarchyName() const;
171
173 virtual const Parameterised::Map& getACParametersMap() const = 0;
174
175protected:
178
181
182private:
184 virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
185
188
191};
GUIGlObjectType
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
An Element which don't belong to GNENet but has influence in the simulation.
An Element which don't belong to GNENet but has influence in the simulation.
move element
move operation
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNENetworkElement(const GNENetworkElement &)=delete
Invalidated copy constructor.
virtual bool isNetworkElementValid() const
check if current network element is valid to be written into XML (by default true,...
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool isGLObjectLocked()
check if element is locked
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
GNENetworkElement & operator=(const GNENetworkElement &)=delete
Invalidated assignment operator.
void selectGLObject()
select element
void setShapeEdited(const bool value)
set shape edited
virtual void deleteGLObject()=0
delete element
void markAsFrontElement()
mark element as front element
bool myShapeEdited
flag to check if element shape is being edited
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
virtual const Parameterised::Map & getACParametersMap() const =0
get parameters map
virtual const std::string getOptionalName() const
Returns the name of the object (default "")
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
virtual void updateGeometry()=0
update pre-computed geometry information
bool isShapeEdited() const
check if shape is being edited
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
virtual GNEMoveOperation * getMoveOperation()=0
get move operation
virtual ~GNENetworkElement()
Destructor.
virtual void updateCenteringBoundary(const bool updateGrid)=0
update centering boundary (implies change in RTREE)
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
set attribute after validation
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
virtual std::string getNetworkElementProblem() const
return a string with the current network element problem (by default empty, can be reimplemented in c...
Boundary myBoundary
object boundary
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37