Eclipse SUMO - Simulation of Urban MObility
GNELaneType.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 /****************************************************************************/
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include "GNENetworkElement.h"
24 
25 #include <netbuild/NBTypeCont.h>
26 
27 class GNEEdgeType;
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
32 
34 
35 public:
37  friend class GNECreateEdgeFrame;
38  friend class GNEEdgeType;
39 
41  GNELaneType(GNEEdgeType* edgeTypeParent);
42 
44  GNELaneType(GNEEdgeType* edgeTypeParent, const NBTypeCont::LaneTypeDefinition& laneType);
45 
47  ~GNELaneType();
48 
51 
53  void copyLaneType(GNELaneType* originalLaneType, GNEUndoList* undoList);
54 
57 
59  void updateGeometry();
60 
63 
65 
68 
70  bool checkDrawFromContour() const;
71 
73  bool checkDrawToContour() const;
74 
76  bool checkDrawRelatedContour() const;
77 
79  bool checkDrawOverContour() const;
80 
82  bool checkDrawDeleteContour() const;
83 
85  bool checkDrawSelectContour() const;
86 
88  bool checkDrawMoveContour() const;
89 
91 
96 
98  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
100 
103 
111 
114 
116  void updateCenteringBoundary(const bool updateGrid);
117 
122  void drawGL(const GUIVisualizationSettings& s) const;
123 
125  void deleteGLObject();
126 
128  void updateGLObject();
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  std::string getAttribute(SumoXMLAttr key) const;
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  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
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 associated to key key
149  * @return true if the value is valid, false in other case
150  */
151  bool isValid(SumoXMLAttr key, const std::string& value);
152 
154 
156  const Parameterised::Map& getACParametersMap() const;
157 
158 protected:
161 
162 private:
164  void setAttribute(SumoXMLAttr key, const std::string& value);
165 
167  void setMoveShape(const GNEMoveResult& moveResult);
168 
170  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
171 
173  GNELaneType(const GNELaneType& s) = delete;
174 
176  GNELaneType& operator=(const GNELaneType& s) = delete;
177 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
GNEEdgeType * myEdgeTypeParent
pointer to EdgeTypeParent
Definition: GNELaneType.h:160
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
bool checkDrawOverContour() const
check if draw over contour (orange)
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNELaneType.cpp:79
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void updateGeometry()
update pre-computed geometry information
Definition: GNELaneType.cpp:73
bool checkDrawMoveContour() const
check if draw move contour (red)
bool isValid(SumoXMLAttr key, const std::string &value)
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
Definition: GNELaneType.cpp:98
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::string getAttribute(SumoXMLAttr key) const
void deleteGLObject()
delete element
const Parameterised::Map & getACParametersMap() const
get parameters map
GNELaneType(GNEEdgeType *edgeTypeParent)
Constructor.
Definition: GNELaneType.cpp:36
void copyLaneType(GNELaneType *originalLaneType, GNEUndoList *undoList)
copy values of given laneType in current laneType
Definition: GNELaneType.cpp:60
GNEMoveOperation * getMoveOperation()
get move operation
GNEEdgeType * getEdgeTypeParent() const
get edge type parent
Definition: GNELaneType.cpp:54
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
bool checkDrawSelectContour() const
check if draw select contour (blue)
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
~GNELaneType()
Destructor.
Definition: GNELaneType.cpp:49
bool checkDrawToContour() const
check if draw from contour (magenta)
Definition: GNELaneType.cpp:92
GNELaneType & operator=(const GNELaneType &s)=delete
invalidated assignment operator
void updateGLObject()
update GLObject (geometry, ID, etc.)
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool checkDrawFromContour() const
check if draw from contour (green)
Definition: GNELaneType.cpp:86
GNELaneType(const GNELaneType &s)=delete
invalidated copy constructor
move operation
move result
The popup menu of a globject.
Stores the information about how to visualize structures.
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
laneType definition
Definition: NBTypeCont.h:59