Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/GNEConsecutiveSelector.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 GNEConsecutiveSelector.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Mar 2022
17
///
18
// Consecutive lane selector module
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/foxtools/MFXGroupBoxModule.h>
24
25
// ===========================================================================
26
// class declaration
27
// ===========================================================================
28
29
class GNEFrame;
30
class GNELane;
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
36
class GNEConsecutiveSelector : public MFXGroupBoxModule {
37
/// @brief FOX-declaration
38
FXDECLARE(GNEConsecutiveSelector)
39
40
public:
41
/// @brief default constructor
42
GNEConsecutiveSelector(GNEFrame* frameParent, const bool allowOneLane);
43
44
/// @brief destructor
45
~GNEConsecutiveSelector();
46
47
/// @brief show GNEConsecutiveSelector
48
void showConsecutiveLaneSelectorModule();
49
50
/// @brief show GNEConsecutiveSelector
51
void hideConsecutiveLaneSelectorModule();
52
53
/// @brief get vector with lanes and clicked positions
54
const std::vector<std::pair<GNELane*, double> >& getLanePath() const;
55
56
/// @brief get lane IDs
57
const std::vector<std::string> getLaneIDPath() const;
58
59
/// @brief add lane
60
bool addLane(GNELane* lane);
61
62
/// @brief draw candidate lanes with special color (Only for candidates, special and conflicted)
63
bool drawCandidateLanesWithSpecialColor() const;
64
65
/// @brief update lane colors
66
void updateLaneColors();
67
68
/// @brief draw temporal consecutive lane path
69
void drawTemporalConsecutiveLanePath() const;
70
71
/// @brief abort path creation
72
void abortPathCreation();
73
74
/// @brief remove path element
75
void removeLastElement();
76
77
/// @name FOX-callbacks
78
/// @{
79
/// @brief Called when the user click over button "Finish route creation"
80
long onCmdCreatePath(FXObject*, FXSelector, void*);
81
82
/// @brief Called when the user click over button "Abort route creation"
83
long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
84
85
/// @brief Called when the user click over button "Remove las inserted lane"
86
long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
87
88
/// @brief Called when the user click over check button "show candidate lanes"
89
long onCmdShowCandidateLanes(FXObject*, FXSelector, void*);
90
/// @}
91
92
protected:
93
/// @brief FOX need this
94
GNEConsecutiveSelector();
95
96
/// @brief update InfoRouteLabel
97
void updateInfoRouteLabel();
98
99
/// @brief clear lanes (and restore colors)
100
void clearPath();
101
102
private:
103
/// @brief pointer to frame parent
104
GNEFrame* myFrameParent;
105
106
/// @brief vector with lanes and clicked positions
107
std::vector<std::pair<GNELane*, double> > myLanePath;
108
109
/// @brief label with path info
110
FXLabel* myInfoPathLabel = nullptr;
111
112
/// @brief button for finish route creation
113
FXButton* myFinishCreationButton = nullptr;
114
115
/// @brief button for abort route creation
116
FXButton* myAbortCreationButton = nullptr;
117
118
/// @brief button for removing last inserted element
119
FXButton* myRemoveLastInsertedElement = nullptr;
120
121
/// @brief CheckBox for show candidate lanes
122
FXCheckButton* myShowCandidateLanes = nullptr;
123
124
/// @brief allow one lane
125
const bool myAllowOneLane;
126
127
private:
128
/// @brief Invalidated copy constructor.
129
GNEConsecutiveSelector(GNEConsecutiveSelector*) = delete;
130
131
/// @brief Invalidated assignment operator.
132
GNEConsecutiveSelector& operator=(GNEConsecutiveSelector*) = delete;
133
};
134
135