1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    GNEClosingLaneReroute.h
11 /// @author  Pablo Alvarez Lopez
12 /// @date    Jan 2017
13 /// @version $Id$
14 ///
15 //
16 /****************************************************************************/
17 #ifndef GNEClosingLaneReroute_h
18 #define GNEClosingLaneReroute_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNEAdditional.h"
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 
31 class GNELane;
32 class GNERerouterInterval;
33 class GNERerouterIntervalDialog;
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
38 /**
39  * @class GNEClosingLaneReroute
40  * forces the rerouter to close the lane
41  */
42 class GNEClosingLaneReroute : public GNEAdditional {
43 
44 public:
45     /// @brief constructor (Used in GNERerouterIntervalDialog)
46     GNEClosingLaneReroute(GNERerouterIntervalDialog* rerouterIntervalDialog);
47 
48     /// @brief parameter constructor
49     GNEClosingLaneReroute(GNEAdditional* rerouterIntervalParent, GNELane* closedLane, SVCPermissions permissions);
50 
51     /// @brief destructor
52     ~GNEClosingLaneReroute();
53 
54     /// @name Functions related with geometry of element
55     /// @{
56     /**@brief change the position of the element geometry without saving in undoList
57      * @param[in] offset Position used for calculate new position of geometry without updating RTree
58      */
59     void moveGeometry(const Position& offset);
60 
61     /**@brief commit geometry changes in the attributes of an element after use of moveGeometry(...)
62      * @param[in] undoList The undoList on which to register changes
63      */
64     void commitGeometryMoving(GNEUndoList* undoList);
65 
66     /// @brief update pre-computed geometry information
67     void updateGeometry(bool updateGrid);
68 
69     /// @brief Returns position of additional in view
70     Position getPositionInView() const;
71     /// @}
72 
73     /// @name inherited from GUIGlObject
74     /// @{
75     /**@brief Returns the name of the parent object
76      * @return This object's parent id
77      */
78     std::string getParentName() const;
79 
80     /**@brief Draws the object
81      * @param[in] s The settings for the current view (may influence drawing)
82      * @see GUIGlObject::drawGL
83      */
84     void drawGL(const GUIVisualizationSettings& s) const;
85     /// @}
86 
87     /// @name inherited from GNEAttributeCarrier
88     /// @{
89     /* @brief method for getting the Attribute of an XML key
90     * @param[in] key The attribute key
91     * @return string with the value associated to key
92     */
93     std::string getAttribute(SumoXMLAttr key) const;
94 
95     /* @brief method for setting the attribute and letting the object perform additional changes
96     * @param[in] key The attribute key
97     * @param[in] value The new value
98     * @param[in] undoList The undoList on which to register changes
99     */
100     void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
101 
102     /* @brief method for checking if the key and their correspond attribute are valids
103     * @param[in] key The attribute key
104     * @param[in] value The value asociated to key key
105     * @return true if the value is valid, false in other case
106     */
107     bool isValid(SumoXMLAttr key, const std::string& value);
108 
109     /// @brief get PopPup ID (Used in AC Hierarchy)
110     std::string getPopUpID() const;
111 
112     /// @brief get Hierarchy Name (Used in AC Hierarchy)
113     std::string getHierarchyName() const;
114     /// @}
115 
116 protected:
117     /// @brief closed lane
118     GNELane* myClosedLane;
119 
120     // @brief Permissions of This Closing Lane Reroute
121     SVCPermissions myPermissions;
122 
123 private:
124     /// @brief set attribute after validation
125     void setAttribute(SumoXMLAttr key, const std::string& value);
126 
127     /// @brief Invalidated copy constructor.
128     GNEClosingLaneReroute(const GNEClosingLaneReroute&) = delete;
129 
130     /// @brief Invalidated assignment operator.
131     GNEClosingLaneReroute& operator=(const GNEClosingLaneReroute&) = delete;
132 };
133 
134 #endif
135 
136 /****************************************************************************/
137