Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/GNEPathElement.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file GNEPathElement.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2024
17
///
18
// Class used for path elements (routes, trips, flows...)
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/gui/settings/GUIVisualizationSettings.h>
24
25
// ===========================================================================
26
// class declaration
27
// ===========================================================================
28
29
class GNELane;
30
class GNESegment;
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
36
class GNEPathElement {
37
38
public:
39
enum class Options : int {
40
NETWORK_ELEMENT = 1 << 0, // Network element
41
ADDITIONAL_ELEMENT = 1 << 1, // Additional element
42
DEMAND_ELEMENT = 1 << 2, // Demand element
43
DATA_ELEMENT = 1 << 3, // Data element
44
ROUTE = 1 << 4, // Route (needed for overlapping labels)
45
};
46
47
/// @brief constructor
48
GNEPathElement(const GNEPathElement::Options options);
49
50
/// @brief destructor
51
virtual ~GNEPathElement();
52
53
/// @brief get path element option
54
GNEPathElement::Options getPathElementOptions() const;
55
56
/// @brief check if pathElement is a network element
57
bool isNetworkElement() const;
58
59
/// @brief check if pathElement is an additional element
60
bool isAdditionalElement() const;
61
62
/// @brief check if pathElement is a demand element
63
bool isDemandElement() const;
64
65
/// @brief check if pathElement is a data element
66
bool isDataElement() const;
67
68
/// @brief check if pathElement is a route
69
bool isRoute() const;
70
71
/// @brief implement in children+
72
/// @{
73
74
/// @brief compute pathElement
75
virtual void computePathElement() = 0;
76
77
/// @brief check if path element is selected
78
virtual bool isPathElementSelected() const = 0;
79
80
/**@brief Draws partial object over lane
81
* @param[in] s The settings for the current view (may influence drawing)
82
* @param[in] segment lane segment
83
* @param[in] offsetFront front offset
84
*/
85
virtual void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const = 0;
86
87
/**@brief Draws partial object over junction
88
* @param[in] s The settings for the current view (may influence drawing)
89
* @param[in] segment junction segment
90
* @param[in] offsetFront front offset
91
*/
92
virtual void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const = 0;
93
94
/// @brief get first path lane
95
virtual GNELane* getFirstPathLane() const = 0;
96
97
/// @brief get last path lane
98
virtual GNELane* getLastPathLane() const = 0;
99
100
/// @}
101
102
private:
103
/// @brief pathElement option
104
const GNEPathElement::Options myOptions = GNEPathElement::Options::NETWORK_ELEMENT;
105
106
/// @brief invalidate default constructor
107
GNEPathElement() = delete;
108
109
/// @brief Invalidated copy constructor.
110
GNEPathElement(const GNEPathElement&) = delete;
111
112
/// @brief Invalidated assignment operator.
113
GNEPathElement& operator=(const GNEPathElement&) = delete;
114
};
115
116
/// @brief override tag parent bit operator
117
constexpr GNEPathElement::Options operator|(GNEPathElement::Options a, GNEPathElement::Options b) {
118
return static_cast<GNEPathElement::Options>(static_cast<int>(a) | static_cast<int>(b));
119
}
120
121
/// @brief override tag parent bit operator
122
constexpr bool operator&(GNEPathElement::Options a, GNEPathElement::Options b) {
123
return (static_cast<int>(a) & static_cast<int>(b)) != 0;
124
}
125
126