Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/demand/GNERouteFrame.h
169684 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 GNERouteFrame.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Dec 2016
17
///
18
// The Widget for create route elements
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/frames/GNEFrame.h>
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNEAttributesEditor;
30
class GNEPathLegendModule;
31
class GNERoute;
32
class GNEPathCreator;
33
34
// ===========================================================================
35
// class definitions
36
// ===========================================================================
37
38
class GNERouteFrame : public GNEFrame {
39
40
public:
41
42
/// @brief route creation modes
43
enum class RouteMode {
44
INVALID, // invalid RouteMode
45
NONCONSECUTIVE_EDGES, // Create route clicking over non consecutive edges
46
CONSECUTIVE_EDGES // Create route clicking over consecutive edges
47
};
48
49
// ===========================================================================
50
// class RouteModeSelector
51
// ===========================================================================
52
53
class RouteModeSelector : public MFXGroupBoxModule {
54
/// @brief FOX-declaration
55
FXDECLARE(GNERouteFrame::RouteModeSelector)
56
57
public:
58
/// @brief constructor
59
RouteModeSelector(GNERouteFrame* routeFrameParent);
60
61
/// @brief destructor
62
~RouteModeSelector();
63
64
/// @brief get current route mode
65
const RouteMode& getCurrentRouteMode() const;
66
67
/// @brief check if current mode is Valid
68
bool isValidMode() const;
69
70
/// @brief check if current VClass is Valid
71
bool isValidVehicleClass() const;
72
73
/// @brief called after setting a new route or vclass, for showing moduls
74
void areParametersValid();
75
76
/// @name FOX-callbacks
77
/// @{
78
/// @brief Called when the user select another route mode in ComboBox
79
long onCmdSelectRouteMode(FXObject*, FXSelector, void*);
80
81
/// @brief Called when the user select another VClass
82
long onCmdSelectVClass(FXObject*, FXSelector, void*);
83
/// @}
84
85
protected:
86
FOX_CONSTRUCTOR(RouteModeSelector)
87
88
private:
89
/// @brief pointer to Frame Parent
90
GNERouteFrame* myRouteFrameParent;
91
92
/// @brief comboBox with the list of route modes
93
MFXComboBoxIcon* myRouteModeMatchBox = nullptr;
94
95
/// @brief comboBox with the list of VClass
96
MFXComboBoxIcon* myVClassMatchBox = nullptr;
97
98
/// @brief current selected route mode
99
RouteMode myCurrentRouteMode = RouteMode::NONCONSECUTIVE_EDGES;
100
101
/// @brief flag to check if VClass is Valid
102
bool myValidVClass = true;
103
104
/// @brief list of Route modes that will be shown in Match Box
105
std::vector<std::pair<RouteMode, std::string> > myRouteModesStrings;
106
};
107
108
/**@brief Constructor
109
* @brief viewParent GNEViewParent in which this GNEFrame is placed
110
* @brief viewNet viewNet that uses this GNEFrame
111
*/
112
GNERouteFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
113
114
/// @brief Destructor
115
~GNERouteFrame();
116
117
/// @brief show delete frame
118
void show();
119
120
/// @brief hide delete frame
121
void hide();
122
123
/**@brief add route edge
124
* @param edge edge to be added
125
* @param mouseButtonKeyPressed key pressed during click
126
* @return true if element was successfully added
127
*/
128
bool addEdgeRoute(GNEEdge* clickedEdge, const GNEViewNetHelper::MouseButtonKeyPressed& mouseButtonKeyPressed);
129
130
/// @brief get path creator module
131
GNEPathCreator* getPathCreator() const;
132
133
protected:
134
/// @brief create path
135
bool createPath(const bool useLastRoute);
136
137
private:
138
/// @brief route base object
139
CommonXMLStructure::SumoBaseObject* myRouteBaseObject = nullptr;
140
141
/// @brief route mode selector
142
RouteModeSelector* myRouteModeSelector = nullptr;
143
144
/// @brief internal route attributes editor
145
GNEAttributesEditor* myRouteAttributesEditor = nullptr;
146
147
/// @brief path creator modul
148
GNEPathCreator* myPathCreator = nullptr;
149
150
/// @brief path legend modul
151
GNEPathLegendModule* myPathLegend = nullptr;
152
};
153
154