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 GNEParkingArea.h 11 /// @author Pablo Alvarez Lopez 12 /// @date Feb 2018 13 /// @version $Id$ 14 /// 15 // A class for visualizing ParkingArea geometry (adapted from GUILaneWrapper) 16 /****************************************************************************/ 17 #ifndef GNEParkingArea_h 18 #define GNEParkingArea_h 19 20 // =========================================================================== 21 // included modules 22 // =========================================================================== 23 24 #include "GNEStoppingPlace.h" 25 26 27 // =========================================================================== 28 // class definitions 29 // =========================================================================== 30 31 /** 32 * @class GNEParkingArea 33 * @brief A lane area vehicles can park at (netedit-version) 34 */ 35 class GNEParkingArea : 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 ParkingArea 45 * @param[in] friendlyPos enable or disable friendly position 46 * @param[in] roadSideCapacity road side capacity of ParkingArea 47 * @param[in] width ParkingArea's length 48 * @param[in] length ParkingArea's length 49 * @param[in] angle ParkingArea's angle 50 * @param[in] block movement enable or disable additional movement 51 */ 52 GNEParkingArea(const std::string& id, GNELane* lane, GNEViewNet* viewNet, const std::string& startPos, const std::string& endPos, const std::string& name, bool friendlyPosition, int roadSideCapacity, 53 bool onRoad, double width, const std::string& length, double angle, bool blockMovement); 54 55 /// @brief Destructor 56 ~GNEParkingArea(); 57 58 /// @name Functions related with geometry of element 59 /// @{ 60 /// @brief update pre-computed geometry information 61 void updateGeometry(bool updateGrid); 62 /// @} 63 64 /// @name inherited from GUIGlObject 65 /// @{ 66 /**@brief Draws the object 67 * @param[in] s The settings for the current view (may influence drawing) 68 * @see GUIGlObject::drawGL 69 */ 70 void drawGL(const GUIVisualizationSettings& s) const; 71 /// @} 72 73 /// @name inherited from GNEAttributeCarrier 74 /// @{ 75 /* @brief method for getting the Attribute of an XML key 76 * @param[in] key The attribute key 77 * @return string with the value associated to key 78 */ 79 std::string getAttribute(SumoXMLAttr key) const; 80 81 /* @brief method for setting the attribute and letting the object perform additional changes 82 * @param[in] key The attribute key 83 * @param[in] value The new value 84 * @param[in] undoList The undoList on which to register changes 85 */ 86 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList); 87 88 /* @brief method for checking if the key and their correspond attribute are valids 89 * @param[in] key The attribute key 90 * @param[in] value The value asociated to key key 91 * @return true if the value is valid, false in other case 92 */ 93 bool isValid(SumoXMLAttr key, const std::string& value); 94 /// @} 95 96 protected: 97 /// @brief roadside capacity of Parking Area 98 int myRoadSideCapacity; 99 100 /// @brief Whether vehicles stay on the road 101 bool myOnRoad; 102 103 /// @brief width of Parking Area 104 double myWidth; 105 106 /// @brief Lenght of Parking Area (by default (endPos - startPos) / roadsideCapacity 107 std::string myLength; 108 109 /// @brief Angle of Parking Area 110 double myAngle; 111 112 private: 113 /// @brief set attribute after validation 114 void setAttribute(SumoXMLAttr key, const std::string& value); 115 116 /// @brief Invalidated copy constructor. 117 GNEParkingArea(const GNEParkingArea&) = delete; 118 119 /// @brief Invalidated assignment operator. 120 GNEParkingArea& operator=(const GNEParkingArea&) = delete; 121 }; 122 123 124 #endif 125