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-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/****************************************************************************/
18// The Widget for edit distribution elements
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
25
26// ===========================================================================
27// class definitions
28// ===========================================================================
29
32class MFXComboBoxIcon;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
40
41public:
42 // ===========================================================================
43 // class declaration
44 // ===========================================================================
45
48
49 // ===========================================================================
50 // class DistributionEditor
51 // ===========================================================================
52
56
57
59
60 public:
62 DistributionEditor(GNEFrame* frameParent, SumoXMLTag distributionTag, GUIIcon icon);
63
66
69
72
74 long onCmdCreateDistribution(FXObject*, FXSelector, void*);
75
77 long onCmdDeleteDistribution(FXObject*, FXSelector, void*);
78
80 long onUpdDeleteDistribution(FXObject* sender, FXSelector, void*);
81
83
84 protected:
86 FOX_CONSTRUCTOR(DistributionEditor)
87
88 private:
91
94
97
100
103 };
104
105 // ===========================================================================
106 // class DistributionSelector
107 // ===========================================================================
108
112
113
115
116 public:
118 DistributionSelector(GNEFrame* frameParent);
119
122
124 void setDistribution(GNEDemandElement* distribution);
125
127 GNEDemandElement* getCurrentDistribution() const;
128
130 void refreshDistributionIDs();
131
133 void refreshDistributionSelector();
134
137
139 long onCmdSelectDistribution(FXObject*, FXSelector, void*);
140
142 long onCmdUpdateDistribution(FXObject* sender, FXSelector, void*);
143
145
146 protected:
148 FOX_CONSTRUCTOR(DistributionSelector)
149
151 std::map<std::string, GNEDemandElement*> fillDistributionComboBox();
152
153 private:
156
158 DistributionEditor* myDistributionEditor = nullptr;
159
161 GNEAttributesEditor* myAttributesEditor = nullptr;
162
164 DistributionValuesEditor* myDistributionValuesEditor = nullptr;
165
167 MFXComboBoxIcon* myDistributionsComboBox = nullptr;
168
170 GNEDemandElement* myCurrentDistribution = nullptr;
171 };
172
173 // ===========================================================================
174 // class DistributionRow
175 // ===========================================================================
176
177 class DistributionRow : protected FXHorizontalFrame {
180
181 public:
183 DistributionRow(DistributionValuesEditor* attributeEditorParent,
184 const GNEDemandElement* key, const double probability);
185
187 void destroy();
188
190 void refreshRow();
191
193 double getProbability() const;
194
197
199 long onCmdSetKey(FXObject*, FXSelector, void*);
200
202 long onCmdSetProbability(FXObject*, FXSelector, void*);
203
205 long onCmdRemoveRow(FXObject*, FXSelector, void*);
206
208
209 protected:
211 FOX_CONSTRUCTOR(DistributionRow)
212
213
214 bool isValidNewKey() const;
215
216 private:
219
221 MFXButtonTooltip* myDeleteRowButton = nullptr;
222
224 FXLabel* myIconLabel = nullptr;
225
227 MFXComboBoxIcon* myComboBoxKeys = nullptr;
228
230 MFXTextFieldIcon* myProbabilityTextField = nullptr;
231
233 const GNEDemandElement* myKey = nullptr;
234
236 double myProbability = 0;
237 };
238
239 // ===========================================================================
240 // class DistributionValuesEditor
241 // ===========================================================================
242
246
247
249
250 public:
252 DistributionValuesEditor(GNEFrame* frameParent, DistributionEditor* distributionEditor,
253 DistributionSelector* distributionSelector,
254 GNEAttributesEditor* attributesEditor,
255 SumoXMLTag distributionValueTag);
256
258 void showDistributionValuesEditor();
259
261 void hideDistributionValuesEditor();
262
264 void remakeRows();
265
267 void refreshRows();
268
270 GNEFrame* getFrameParent() const;
271
273 void updateSumLabel();
274
277
279 long onCmdAddRow(FXObject*, FXSelector, void*);
280
282 long onUpdAddRow(FXObject* sender, FXSelector, void*);
283
285
286 protected:
288 FOX_CONSTRUCTOR(DistributionValuesEditor)
289
290 private:
293
295 DistributionEditor* myDistributionEditor;
296
299
301 GNEAttributesEditor* myAttributesEditor;
302
304 SumoXMLTag myDistributionValueTag;
305
307 std::vector<DistributionRow*> myDistributionRows;
308
310 FXHorizontalFrame* myBotFrame = nullptr;
311
313 FXLabel* mySumLabel = nullptr;
314 };
315};
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
MFXGroupBoxModule (based on FXGroupBox)
Definition json.hpp:4471
every row value