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