Eclipse SUMO - Simulation of Urban MObility
GNENetworkElement.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-2020 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 
24 #include <netedit/GNEGeometry.h>
27 #include <netedit/GNEMoveElement.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 
34 class GNEAdditional;
35 class GNEDemandElement;
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
40 
42 
43 public:
58  GNENetworkElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag,
59  const std::vector<GNEJunction*>& junctionParents,
60  const std::vector<GNEEdge*>& edgeParents,
61  const std::vector<GNELane*>& laneParents,
62  const std::vector<GNEAdditional*>& additionalParents,
63  const std::vector<GNEShape*>& shapeParents,
64  const std::vector<GNETAZElement*>& TAZElementParents,
65  const std::vector<GNEDemandElement*>& demandElementParents,
66  const std::vector<GNEGenericData*>& genericDataParents);
67 
69  virtual ~GNENetworkElement();
70 
74  virtual GNEMoveOperation* getMoveOperation(const double shapeOffset) = 0;
75 
77  const std::string& getID() const;
78 
81 
83  void setShapeEdited(const bool value);
84 
86  bool isShapeEdited() const;
87 
91  virtual void updateGeometry() = 0;
92 
94  virtual Position getPositionInView() const = 0;
96 
99 
108 
117 
120 
122  virtual void updateCenteringBoundary(const bool updateGrid) = 0;
123 
128  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
130 
133  /* @brief method for getting the Attribute of an XML key
134  * @param[in] key The attribute key
135  * @return string with the value associated to key
136  */
137  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
138 
139  /* @brief method for setting the attribute and letting the object perform additional changes
140  * @param[in] key The attribute key
141  * @param[in] value The new value
142  * @param[in] undoList The undoList on which to register changes
143  */
144  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
145 
146  /* @brief method for checking if the key and their conrrespond attribute are valids
147  * @param[in] key The attribute key
148  * @param[in] value The value asociated to key key
149  * @return true if the value is valid, false in other case
150  */
151  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
152 
153  /* @brief method for enable attribute
154  * @param[in] key The attribute key
155  * @param[in] undoList The undoList on which to register changes
156  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
157  */
158  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
159 
160  /* @brief method for disable attribute
161  * @param[in] key The attribute key
162  * @param[in] undoList The undoList on which to register changes
163  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
164  */
165  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
166 
167  /* @brief method for check if the value for certain attribute is set
168  * @param[in] key The attribute key
169  */
170  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
171 
173  std::string getPopUpID() const;
174 
176  std::string getHierarchyName() const;
178 
180  virtual const std::map<std::string, std::string>& getACParametersMap() const = 0;
181 
182 protected:
185 
188 
189 private:
191  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
192 
194  void setEnabledAttribute(const int enabledAttributes);
195 
198 
201 };
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 belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
An Element which don't belongs to GNENet but has influency in the simulation.
move element
move operation
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNENetworkElement(const GNENetworkElement &)=delete
Invalidated copy constructor.
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNENetworkElement & operator=(const GNENetworkElement &)=delete
Invalidated assignment operator.
void setShapeEdited(const bool value)
set shape edited
bool myShapeEdited
flag to check if element shape is being edited
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNENetworkElement(GNENet *net, const std::string &id, GUIGlObjectType type, SumoXMLTag tag, const std::vector< GNEJunction * > &junctionParents, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNEShape * > &shapeParents, const std::vector< GNETAZElement * > &TAZElementParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents)
Constructor.
virtual GNEMoveOperation * getMoveOperation(const double shapeOffset)=0
get move operation for the given shapeOffset
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
virtual const std::map< std::string, std::string > & getACParametersMap() const =0
get parameters map
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
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 ~GNENetworkElement()
Destructor.
virtual void updateCenteringBoundary(const bool updateGrid)=0
update centering boundary (implies change in RTREE)
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
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
const std::string & getID() const
get ID
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
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.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36