Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/demand/GNEVehicleFrame.h
193784 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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 GNEVehicleFrame.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2018
17
///
18
// The Widget for add Vehicles/Flows/Trips/etc. elements
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/frames/GNEFrame.h>
24
#include <netedit/frames/common/GNEGroupBoxModule.h>
25
26
// ===========================================================================
27
// class declaration
28
// ===========================================================================
29
30
class MFXDynamicLabel;
31
class GNEAttributesEditor;
32
class GNEDemandElementSelector;
33
class GNETagSelector;
34
class GNEPathLegendModule;
35
class GNEPathCreator;
36
37
// ===========================================================================
38
// class definitions
39
// ===========================================================================
40
41
class GNEVehicleFrame : public GNEFrame {
42
43
public:
44
45
// ===========================================================================
46
// class HelpCreation
47
// ===========================================================================
48
49
class HelpCreation : public GNEGroupBoxModule {
50
51
public:
52
/// @brief constructor
53
HelpCreation(GNEVehicleFrame* vehicleFrameParent);
54
55
/// @brief destructor
56
~HelpCreation();
57
58
/// @brief show HelpCreation
59
void showHelpCreation();
60
61
/// @brief hide HelpCreation
62
void hideHelpCreation();
63
64
/// @brief update HelpCreation
65
void updateHelpCreation();
66
67
private:
68
/// @brief pointer to Vehicle Frame Parent
69
GNEVehicleFrame* myVehicleFrameParent;
70
71
/// @brief Label with creation information
72
MFXDynamicLabel* myInformationLabel;
73
};
74
75
/**@brief Constructor
76
* @brief viewParent GNEViewParent in which this GNEFrame is placed
77
* @brief viewNet viewNet that uses this GNEFrame
78
*/
79
GNEVehicleFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
80
81
/// @brief Destructor
82
~GNEVehicleFrame();
83
84
/// @brief show Frame
85
void show();
86
87
/// @brief hide Frame
88
void hide();
89
90
/**@brief add vehicle element
91
* @param viewObjects collection of objects under cursor after click over view
92
* @param mouseButtonKeyPressed key pressed during click
93
* @return true if element was successfully added
94
*/
95
bool addVehicle(const GNEViewNetHelper::ViewObjectsSelector& viewObjects, const GNEViewNetHelper::MouseButtonKeyPressed& mouseButtonKeyPressed);
96
97
/// @brief get vehicle tag selector (needed for transform vehicles)
98
GNETagSelector* getVehicleTagSelector() const;
99
100
/// @brief getVehicle Type selectors
101
GNEDemandElementSelector* getTypeSelector() const;
102
103
/// @brief get GNEPathCreator module
104
GNEPathCreator* getPathCreator() const;
105
106
/// @brief get attributes creator
107
GNEAttributesEditor* getVehicleAttributesEditor() const;
108
109
protected:
110
/// @brief Tag selected in GNETagSelector
111
void tagSelected();
112
113
/// @brief selected vehicle type in DemandElementSelector
114
void demandElementSelected();
115
116
/// @brief create path
117
bool createPath(const bool useLastRoute);
118
119
/// @brief build vehicle over route
120
bool buildVehicleOverRoute(SumoXMLTag vehicleTag, GNEDemandElement* route);
121
122
/// @brief update flow attributes
123
void updateFlowAttributes();
124
125
private:
126
/// @brief vehicle base object
127
CommonXMLStructure::SumoBaseObject* myVehicleBaseObject = nullptr;
128
129
/// @brief vehicle tag selector (used to select diffent kind of vehicles)
130
GNETagSelector* myVehicleTagSelector = nullptr;
131
132
/// @brief Vehicle Type selectors
133
GNEDemandElementSelector* myTypeSelector = nullptr;
134
135
/// @brief attributes editor
136
GNEAttributesEditor* myVehicleAttributesEditor = nullptr;
137
138
/// @brief edge path creator (used for trips and flows)
139
GNEPathCreator* myPathCreator = nullptr;
140
141
/// @brief Help creation
142
HelpCreation* myHelpCreation = nullptr;
143
144
/// @brief path legend modul
145
GNEPathLegendModule* myPathLegend = nullptr;
146
};
147
148