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