Eclipse SUMO - Simulation of Urban MObility
GNENetworkElement.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 networkElements
19 /****************************************************************************/
20 #include <config.h>
21 
23 
24 #include "GNENetworkElement.h"
25 
26 
27 // ===========================================================================
28 // method definitions
29 // ===========================================================================
30 
32  const std::vector<GNEJunction*>& junctionParents,
33  const std::vector<GNEEdge*>& edgeParents,
34  const std::vector<GNELane*>& laneParents,
35  const std::vector<GNEAdditional*>& additionalParents,
36  const std::vector<GNEShape*>& shapeParents,
37  const std::vector<GNETAZElement*>& TAZElementParents,
38  const std::vector<GNEDemandElement*>& demandElementParents,
39  const std::vector<GNEGenericData*>& genericDataParents) :
40  GUIGlObject(type, id),
41  GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
42  myShapeEdited(false) {
43 }
44 
45 
47 
48 
49 const std::string&
51  return getMicrosimID();
52 }
53 
54 
57  return this;
58 }
59 
60 
61 void
63  myShapeEdited = value;
64 }
65 
66 
67 bool
69  return myShapeEdited;
70 }
71 
72 
75  // Create table
76  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
77  // Iterate over attributes
78  for (const auto& i : myTagProperty) {
79  // Add attribute and set it dynamic if aren't unique
80  if (i.isUnique()) {
81  ret->mkItem(i.getAttrStr().c_str(), false, getAttribute(i.getAttr()));
82  } else {
83  ret->mkItem(i.getAttrStr().c_str(), true, getAttribute(i.getAttr()));
84  }
85  }
86  // close building
87  ret->closeBuilding();
88  return ret;
89 }
90 
91 
94  return myBoundary;
95 }
96 
97 
98 void
100  //
101 }
102 
103 
104 void
106  //
107 }
108 
109 
110 std::string
114  } else {
115  return getTagStr() + ": " + getID();
116  }
117 }
118 
119 
120 std::string
124  } else if (myTagProperty.getTag() == SUMO_TAG_CONNECTION) {
127  return getPopUpID();
128  } else {
129  return getTagStr();
130  }
131 }
132 
133 
134 void
135 GNENetworkElement::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
136  throw InvalidArgument("Nothing to enable");
137 }
138 
139 /****************************************************************************/
GUIGlObjectType
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_CONNECTION
connectio between two lanes
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_FROM_LANE
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_TO_LANE
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
virtual std::string getAttribute(SumoXMLAttr key) const =0
void setShapeEdited(const bool value)
set shape edited
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
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.
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.
const std::string & getID() const
get ID
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
Boundary myBoundary
object boundary
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.