Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEDistributionFrame.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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/****************************************************************************/
18// The Widget for edit distribution elements
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
26
27// ===========================================================================
28// class definitions
29// ===========================================================================
30
32
33public:
34 // ===========================================================================
35 // class declaration
36 // ===========================================================================
37
40
41 // ===========================================================================
42 // class DistributionEditor
43 // ===========================================================================
44
48
49
51
52 public:
54 DistributionEditor(GNEFrame* frameParent, SumoXMLTag distributionTag, GUIIcon icon);
55
58
61
64
66 long onCmdCreateDistribution(FXObject*, FXSelector, void*);
67
69 long onCmdDeleteDistribution(FXObject*, FXSelector, void*);
70
72 long onUpdDeleteDistribution(FXObject* sender, FXSelector, void*);
73
75
76 protected:
78 FOX_CONSTRUCTOR(DistributionEditor)
79
80 private:
83
86
89
92
95 };
96
97 // ===========================================================================
98 // class DistributionSelector
99 // ===========================================================================
100
104
105
107
108 public:
110 DistributionSelector(GNEFrame* frameParent);
111
114
116 void setDistribution(GNEDemandElement* distribution);
117
119 GNEDemandElement* getCurrentDistribution() const;
120
122 void refreshDistributionIDs();
123
125 void refreshDistributionSelector();
126
129
131 long onCmdSelectDistribution(FXObject*, FXSelector, void*);
132
134 long onCmdUpdateDistribution(FXObject* sender, FXSelector, void*);
135
137
138 protected:
140 FOX_CONSTRUCTOR(DistributionSelector)
141
143 std::map<std::string, GNEDemandElement*> fillDistributionComboBox();
144
145 private:
148
150 DistributionEditor* myDistributionEditor = nullptr;
151
153 GNEFrameAttributeModules::AttributesEditor* myAttributesEditor = nullptr;
154
156 DistributionValuesEditor* myDistributionValuesEditor = nullptr;
157
159 MFXComboBoxIcon* myDistributionsComboBox = nullptr;
160
162 GNEDemandElement* myCurrentDistribution = nullptr;
163 };
164
165 // ===========================================================================
166 // class DistributionRow
167 // ===========================================================================
168
169 class DistributionRow : protected FXHorizontalFrame {
172
173 public:
175 DistributionRow(DistributionValuesEditor* attributeEditorParent,
176 const GNEDemandElement* key, const double probability);
177
179 void destroy();
180
182 void refreshRow();
183
185 double getProbability() const;
186
189
191 long onCmdSetKey(FXObject*, FXSelector, void*);
192
194 long onCmdSetProbability(FXObject*, FXSelector, void*);
195
197 long onCmdRemoveRow(FXObject*, FXSelector, void*);
198
200
201 protected:
203 FOX_CONSTRUCTOR(DistributionRow)
204
205
206 bool isValidNewKey() const;
207
208 private:
211
213 MFXButtonTooltip* myDeleteRowButton = nullptr;
214
216 FXLabel* myIconLabel = nullptr;
217
219 MFXComboBoxIcon* myComboBoxKeys = nullptr;
220
222 MFXTextFieldTooltip* myProbabilityTextField = nullptr;
223
225 const GNEDemandElement* myKey = nullptr;
226
228 double myProbability = 0;
229 };
230
231 // ===========================================================================
232 // class DistributionValuesEditor
233 // ===========================================================================
234
238
239
241
242 public:
244 DistributionValuesEditor(GNEFrame* frameParent, DistributionEditor* distributionEditor,
245 DistributionSelector* distributionSelector,
246 GNEFrameAttributeModules::AttributesEditor* attributesEditor,
247 SumoXMLTag distributionValueTag);
248
250 void showDistributionValuesEditor();
251
253 void hideDistributionValuesEditor();
254
256 void remakeRows();
257
259 void refreshRows();
260
262 GNEFrame* getFrameParent() const;
263
265 void updateSumLabel();
266
269
271 long onCmdAddRow(FXObject*, FXSelector, void*);
272
274 long onUpdAddRow(FXObject* sender, FXSelector, void*);
275
277
278 protected:
280 FOX_CONSTRUCTOR(DistributionValuesEditor)
281
282 private:
285
287 DistributionEditor* myDistributionEditor;
288
291
293 GNEFrameAttributeModules::AttributesEditor* myAttributesEditor;
294
296 SumoXMLTag myDistributionValueTag;
297
299 std::vector<DistributionRow*> myDistributionRows;
300
302 FXHorizontalFrame* myBotFrame = nullptr;
303
305 FXLabel* mySumLabel = nullptr;
306 };
307};
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
SumoXMLTag
Numbers representing SUMO-XML - element names.
long onCmdDeleteDistribution(FXObject *, FXSelector, void *)
Called when "Delete distribution" button is clicked.
SumoXMLTag getDistributionTag() const
get distribution tag
MFXButtonTooltip * myCreateDistributionButton
"create Distribution" button
MFXButtonTooltip * myDeleteDistributionButton
"delete Distribution" button
SumoXMLTag myDistributionTag
@briuef distribution tag
long onUpdDeleteDistribution(FXObject *sender, FXSelector, void *)
Called when "Delete distribution" button is updated.
long onCmdCreateDistribution(FXObject *, FXSelector, void *)
Called when "create distribution" button is clicked.
DistributionSelector * myDistributionSelector
distribution selector
DistributionValuesEditor * myDistributionValuesEditorParent
pointer to DistributionValuesEditor parent
ComboBox with icon.
MFXGroupBoxModule (based on FXGroupBox)
Definition json.hpp:4471
every row value