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 GNETAZSourceSink.h 11 /// @author Pablo Alvarez Lopez 12 /// @date Apr 2017 13 /// @version $Id$ 14 /// 15 // 16 /****************************************************************************/ 17 #ifndef GNETAZSourceSink_h 18 #define GNETAZSourceSink_h 19 20 21 // =========================================================================== 22 // included modules 23 // =========================================================================== 24 25 #include "GNEAdditional.h" 26 27 // =========================================================================== 28 // class declarations 29 // =========================================================================== 30 31 class GNETAZ; 32 class GNETAZSink; 33 34 // =========================================================================== 35 // class definitions 36 // =========================================================================== 37 /** 38 * @class GNETAZSourceSink 39 * class used to represent a interval used in Traffic Assignment Zones 40 */ 41 class GNETAZSourceSink : public GNEAdditional { 42 43 public: 44 /**@brief Constructor 45 * @param[in] sourceSinkTag Child Tag (Either SUMO_TAG_TAZSOURCE or SUMO_TAG_TAZINK) 46 * @param[in] parent pointer to TAZ of this TAZSourceSinks belongs 47 * @param[in] edge Edge of this TAZ Child belongs 48 * @param[in] departWeight depart weight of this TAZ child 49 */ 50 GNETAZSourceSink(SumoXMLTag sourceSinkTag, GNEAdditional* TAZParent, GNEEdge* edge, double departWeight); 51 52 /// @brief destructor 53 ~GNETAZSourceSink(); 54 55 /// @brief get depart weight 56 double getDepartWeight() const; 57 58 /// @name Functions related with geometry of element 59 /// @{ 60 /**@brief change the position of the element geometry without saving in undoList 61 * @param[in] offset Position used for calculate new position of geometry without updating RTree 62 */ 63 void moveGeometry(const Position& offset); 64 65 /**@brief commit geometry changes in the attributes of an element after use of moveGeometry(...) 66 * @param[in] undoList The undoList on which to register changes 67 */ 68 void commitGeometryMoving(GNEUndoList* undoList); 69 70 /// @brief update pre-computed geometry information 71 void updateGeometry(bool updateGrid); 72 73 /// @brief Returns position of additional in view 74 Position getPositionInView() const; 75 /// @} 76 77 /// @name inherited from GUIGlObject 78 /// @{ 79 /**@brief Returns the name of the parent object 80 * @return This object's parent id 81 */ 82 std::string getParentName() const; 83 84 /**@brief Draws the object 85 * @param[in] s The settings for the current view (may influence drawing) 86 * @see GUIGlObject::drawGL 87 */ 88 void drawGL(const GUIVisualizationSettings& s) const; 89 /// @} 90 91 /// @brief inherited from GNEAttributeCarrier 92 /// @{ 93 /* @brief method for getting the Attribute of an XML key 94 * @param[in] key The attribute key 95 * @return string with the value associated to key 96 */ 97 std::string getAttribute(SumoXMLAttr key) const; 98 99 /* @brief method for setting the attribute and letting the object perform additional changes 100 * @param[in] key The attribute key 101 * @param[in] value The new value 102 * @param[in] undoList The undoList on which to register changes 103 * @param[in] net optionally the GNENet to inform about gui updates 104 */ 105 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList); 106 107 /* @brief method for setting the attribute and letting the object perform additional changes 108 * @param[in] key The attribute key 109 * @param[in] value The new value 110 * @param[in] undoList The undoList on which to register changes 111 */ 112 bool isValid(SumoXMLAttr key, const std::string& value); 113 114 /// @brief get PopPup ID (Used in AC Hierarchy) 115 std::string getPopUpID() const; 116 117 /// @brief get Hierarchy Name (Used in AC Hierarchy) 118 std::string getHierarchyName() const; 119 120 /**@brief Returns the boundary to which the view shall be centered in order to show the object 121 * @return The boundary the object is within 122 */ 123 Boundary getCenteringBoundary() const; 124 /// @} 125 126 protected: 127 /// @brief depart Weight 128 double myDepartWeight; 129 130 private: 131 /// @brief method for setting the attribute and nothing else 132 void setAttribute(SumoXMLAttr key, const std::string& value); 133 134 /// @brief Invalidated copy constructor. 135 GNETAZSourceSink(const GNETAZSourceSink&) = delete; 136 137 /// @brief Invalidated assignment operator 138 GNETAZSourceSink& operator=(const GNETAZSourceSink&) = delete; 139 }; 140 141 #endif 142 143 /****************************************************************************/ 144