Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEDistribution.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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// abstract 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
32public:
34 GNEDistribution(GNENet* net, GUIGlObjectType type, SumoXMLTag elementTag, GUIIcon icon);
35
37 GNEDistribution(GNENet* net, GUIGlObjectType type, SumoXMLTag elementTag, GUIIcon icon,
38 const std::string& ID, const int deterministic);
39
42
47
51 virtual void writeDemandElement(OutputDevice& device) const = 0;
52
55
57 std::string getDemandElementProblem() const;
58
61
66
68 const RGBColor& getColor() const;
69
71
75 void updateGeometry();
76
80
83
86 std::string getParentName() const;
87
92
94 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
95
100 void drawGL(const GUIVisualizationSettings& s) const;
101
103
106
108 void computePathElement();
109
115 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
116
122 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
123
125 GNELane* getFirstPathLane() const;
126
128 GNELane* getLastPathLane() const;
130
133 /* @brief method for getting the Attribute of an XML key
134 * @param[in] key The attribute key
135 * @return string with the value associated to key
136 */
137 std::string getAttribute(SumoXMLAttr key) const;
138
139 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
140 * @param[in] key The attribute key
141 * @return double with the value associated to key
142 */
143 double getAttributeDouble(SumoXMLAttr key) const;
144
145 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
146 * @param[in] key The attribute key
147 * @return double with the value associated to key
148 */
150
151 /* @brief method for setting the attribute and letting the object perform additional changes
152 * @param[in] key The attribute key
153 * @param[in] value The new value
154 * @param[in] undoList The undoList on which to register changes
155 * @param[in] net optionally the GNENet to inform about gui updates
156 */
157 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
158
159 /* @brief method for setting the attribute and letting the object perform additional changes
160 * @param[in] key The attribute key
161 * @param[in] value The new value
162 * @param[in] undoList The undoList on which to register changes
163 */
164 bool isValid(SumoXMLAttr key, const std::string& value);
165
167 std::string getPopUpID() const;
168
170 std::string getHierarchyName() const;
172
175
176protected:
179
180private:
182 void setAttribute(SumoXMLAttr key, const std::string& value);
183
185 void setMoveShape(const GNEMoveResult& moveResult);
186
188 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
189
192
195};
GUIGlObjectType
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
Problem
enum class for demandElement problems
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
GNEMoveOperation * getMoveOperation()
get move operation
void computePathElement()
compute pathElement
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Position getPositionInView() const
Returns position of additional in view.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
GNEDistribution(GNEDistribution *)=delete
Invalidated copy constructor.
void fixDemandElementProblem()
fix demand element problem
double getAttributeDouble(SumoXMLAttr key) const
GNEDistribution * operator=(GNEDistribution *)=delete
Invalidated assignment operator.
GNELane * getFirstPathLane() const
get first path lane
virtual void writeDemandElement(OutputDevice &device) const =0
write demand element element into a xml file
Position getAttributePosition(SumoXMLAttr key) const
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
~GNEDistribution()
destructor
const RGBColor & getColor() const
get color
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
int myDeterministic
deterministic attribute
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNELane * getLastPathLane() const
get last path lane
std::string getParentName() const
Returns the name of the parent object.
void updateGeometry()
update pre-computed geometry information
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
const Parameterised::Map & getACParametersMap() const
get parameters map
std::string getDemandElementProblem() const
return a string with the current demand element problem
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
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37