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    GNEBusStop.h
11 /// @author  Pablo Alvarez Lopez
12 /// @date    Nov 2015
13 /// @version $Id$
14 ///
15 // A class for visualizing busStop geometry (adapted from GUILaneWrapper)
16 /****************************************************************************/
17 #ifndef GNEBusStop_h
18 #define GNEBusStop_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEStoppingPlace.h"
25 
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
30 
31 /**
32  * @class GNEBusStop
33  * @brief A lane area vehicles can halt at (netedit-version)
34  */
35 class GNEBusStop : public GNEStoppingPlace {
36 
37 public:
38     /**@brief Constructor
39      * @param[in] id The storage of gl-ids to get the one for this lane representation from
40      * @param[in] lane Lane of this StoppingPlace belongs
41      * @param[in] viewNet pointer to GNEViewNet of this additional element belongs
42      * @param[in] startPos Start position of the StoppingPlace
43      * @param[in] endPos End position of the StoppingPlace
44      * @param[in] name Name of busStop
45      * @param[in] lines lines of the busStop
46      * @param[in] friendlyPos enable or disable friendly position
47      * @param[in] block movement enable or disable additional movement
48      */
49     GNEBusStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, const std::string& startPos, const std::string& endPos, const std::string& name, const std::vector<std::string>& lines, int personCapacity, bool friendlyPosition, bool blockMovement);
50 
51     /// @brief Destructor
52     ~GNEBusStop();
53 
54     /// @name Functions related with geometry of element
55     /// @{
56     /// @brief update pre-computed geometry information
57     void updateGeometry(bool updateGrid);
58     /// @}
59 
60     /// @name inherited from GUIGlObject
61     /// @{
62     /**@brief Draws the object
63      * @param[in] s The settings for the current view (may influence drawing)
64      * @see GUIGlObject::drawGL
65      */
66     void drawGL(const GUIVisualizationSettings& s) const;
67     /// @}
68 
69     /// @name inherited from GNEAttributeCarrier
70     /// @{
71     /* @brief method for getting the Attribute of an XML key
72      * @param[in] key The attribute key
73      * @return string with the value associated to key
74      */
75     std::string getAttribute(SumoXMLAttr key) const;
76 
77     /* @brief method for setting the attribute and letting the object perform additional changes
78      * @param[in] key The attribute key
79      * @param[in] value The new value
80      * @param[in] undoList The undoList on which to register changes
81      */
82     void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
83 
84     /* @brief method for checking if the key and their correspond attribute are valids
85      * @param[in] key The attribute key
86      * @param[in] value The value asociated to key key
87      * @return true if the value is valid, false in other case
88      */
89     bool isValid(SumoXMLAttr key, const std::string& value);
90     /// @}
91 
92 protected:
93     /// @brief The list of lines that are assigned to this stop
94     std::vector<std::string> myLines;
95 
96     /// @brief maximum number of persons that can wait at this stop
97     int myPersonCapacity;
98 
99 private:
100     /// @brief set attribute after validation
101     void setAttribute(SumoXMLAttr key, const std::string& value);
102 
103     /// @brief Invalidated copy constructor.
104     GNEBusStop(const GNEBusStop&) = delete;
105 
106     /// @brief Invalidated assignment operator.
107     GNEBusStop& operator=(const GNEBusStop&) = delete;
108 };
109 
110 
111 #endif
112