Eclipse SUMO - Simulation of Urban MObility
GNEVTypeDistribution.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // VehicleType distribution used in NETEDIT
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include "GNEDemandElement.h"
24 
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
29 
31 
32 public:
35 
37  GNEVTypeDistribution(GNENet* net, const std::string& vTypeID);
38 
41 
46 
50  void writeDemandElement(OutputDevice& device) const;
51 
54 
56  std::string getDemandElementProblem() const;
57 
60 
65 
67  const RGBColor& getColor() const;
68 
70 
74  void updateGeometry();
75 
79 
82 
85  std::string getParentName() const;
86 
88  double getExaggeration(const GUIVisualizationSettings& s) const;
89 
94 
96  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
97 
102  void drawGL(const GUIVisualizationSettings& s) const;
103 
105 
108 
110  void computePathElement();
111 
118  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
119 
127  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
128 
130  GNELane* getFirstPathLane() const;
131 
133  GNELane* getLastPathLane() const;
135 
138  /* @brief method for getting the Attribute of an XML key
139  * @param[in] key The attribute key
140  * @return string with the value associated to key
141  */
142  std::string getAttribute(SumoXMLAttr key) const;
143 
144  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
145  * @param[in] key The attribute key
146  * @return double with the value associated to key
147  */
148  double getAttributeDouble(SumoXMLAttr key) const;
149 
150  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
151  * @param[in] key The attribute key
152  * @return double with the value associated to key
153  */
155 
156  /* @brief method for setting the attribute and letting the object perform additional changes
157  * @param[in] key The attribute key
158  * @param[in] value The new value
159  * @param[in] undoList The undoList on which to register changes
160  * @param[in] net optionally the GNENet to inform about gui updates
161  */
162  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
163 
164  /* @brief method for setting the attribute and letting the object perform additional changes
165  * @param[in] key The attribute key
166  * @param[in] value The new value
167  * @param[in] undoList The undoList on which to register changes
168  */
169  bool isValid(SumoXMLAttr key, const std::string& value);
170 
171  /* @brief method for enable attribute
172  * @param[in] key The attribute key
173  * @param[in] undoList The undoList on which to register changes
174  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
175  */
176  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
177 
178  /* @brief method for disable attribute
179  * @param[in] key The attribute key
180  * @param[in] undoList The undoList on which to register changes
181  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
182  */
183  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
184 
185  /* @brief method for check if the value for certain attribute is set
186  * @param[in] key The attribute key
187  */
188  bool isAttributeEnabled(SumoXMLAttr key) const;
189 
191  std::string getPopUpID() const;
192 
194  std::string getHierarchyName() const;
196 
198  const std::map<std::string, std::string>& getACParametersMap() const;
199 
200 private:
202  void setAttribute(SumoXMLAttr key, const std::string& value);
203 
205  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
206 
208  void setMoveShape(const GNEMoveResult& moveResult);
209 
211  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
212 
215 
218 };
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
An Element which don't belongs to GNENet but has influency in the simulation.
Problem
enum class for demandElement problems
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
std::string getParentName() const
Returns the name of the parent object.
void computePathElement()
compute pathElement
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
GNELane * getFirstPathLane() const
get first path lane
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Position getPositionInView() const
Returns position of additional in view.
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void updateGeometry()
update pre-computed geometry information
GNEVTypeDistribution(GNENet *net)
default constructor
const RGBColor & getColor() const
get color
double getAttributeDouble(SumoXMLAttr key) const
GNEVTypeDistribution * operator=(GNEVTypeDistribution *)=delete
Invalidated assignment operator.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
SUMOVehicleClass getVClass() const
GNEVTypeDistribution(GNEVTypeDistribution *)=delete
Invalidated copy constructor.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNELane * getLastPathLane() const
get last path lane
Position getAttributePosition(SumoXMLAttr key) const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNEMoveOperation * getMoveOperation()
get move operation
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
bool isAttributeEnabled(SumoXMLAttr key) const
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
void fixDemandElementProblem()
fix demand element problem
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
std::string getDemandElementProblem() const
return a string with the current demand element problem
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37