Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEVTypeDistributionsDialog.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// Dialog for edit VType distributions
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
28
29// ===========================================================================
30// class definitions
31// ===========================================================================
32
34class GNETypeFrame;
35class GNEViewNet;
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
40
44
45public:
46 // ===========================================================================
47 // class ParametersValues
48 // ===========================================================================
49
50 class ParametersValues : protected FXGroupBox {
53
54
55 class ParameterRow;
56
57 public:
59 ParametersValues(FXHorizontalFrame* frame, const std::string& name);
60
63
65 void setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters);
66
68 void addParameter(std::pair<std::string, std::string> newParameter);
69
71 void clearParameters();
72
74 const std::vector<ParameterRow*> getParameterRows() const;
75
77 bool keyExist(const std::string& key) const;
78
82 long onPaint(FXObject* o, FXSelector f, void* p);
83
85 long onCmdSetAttribute(FXObject*, FXSelector, void*);
86
88 long onCmdButtonPress(FXObject*, FXSelector, void*);
89
91
92 protected:
94 FOX_CONSTRUCTOR(ParametersValues)
95
96 private:
99
100 public:
102 ParameterRow(ParametersValues* ParametersValues, FXVerticalFrame* verticalFrameParent);
103
106
108 void disableRow();
109
111 void enableRow(const std::string& parameter, const std::string& value) const;
112
114 void toggleAddButton();
115
117 bool isButtonInAddMode() const;
118
120 void copyValues(const ParameterRow& other);
121
123 FXTextField* keyField;
124
126 FXTextField* valueField;
127
129 FXButton* button;
130 private:
132 FXHorizontalFrame* horizontalFrame;
133 };
134
136 FXLabel* myKeyLabel;
137
139 FXVerticalFrame* myVerticalFrameRow;
140
142 std::vector<ParameterRow*> myParameterRows;
143 };
144
145 // ===========================================================================
146 // class ParametersOperations
147 // ===========================================================================
148
149 class ParametersOperations : protected FXGroupBox {
152
153 public:
155 ParametersOperations(FXHorizontalFrame* frame, GNEVTypeDistributionsDialog* ParameterDialogParent);
156
159
163 long onCmdLoadParameters(FXObject*, FXSelector, void*);
164
166 long onCmdSaveParameters(FXObject*, FXSelector, void*);
167
169 long onCmdClearParameters(FXObject*, FXSelector, void*);
170
172 long onCmdSortParameters(FXObject*, FXSelector, void*);
173
175 long onCmdHelpParameter(FXObject*, FXSelector, void*);
176
178
179 protected:
181 FOX_CONSTRUCTOR(ParametersOperations)
182
183 private:
187 public:
189 GNEParameterHandler(ParametersOperations* ParametersOperationsParent, const std::string& file);
190
193
196
202 void myStartElement(int element, const SUMOSAXAttributes& attrs);
203
204 private:
207 };
208
211
213 FXButton* mySortButton;
214
216 FXButton* myClearButton;
217
219 FXButton* myLoadButton;
220
222 FXButton* mySaveButton;
223
225 FXButton* myHelpButton;
226 };
227
230
233
235 void openDialog();
236
238 void closeDialog();
239
241 void runInternalTest(const InternalTestStep::DialogTest* modalArguments);
242
245
247 long onCmdAccept(FXObject*, FXSelector, void*);
248
250 long onCmdCancel(FXObject*, FXSelector, void*);
251
253
254protected:
256 FOX_CONSTRUCTOR(GNEVTypeDistributionsDialog)
257
258
260
263
266
269
271 FXButton* myCancelButton;
272
273private:
276
279};
ParametersOperations * myParametersOperationsParent
pointer to ParametersOperations parent
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
GNEVTypeDistributionsDialog * myParameterDialogParent
pointer to Shape Frame Parent
long onCmdHelpParameter(FXObject *, FXSelector, void *)
event when user press help parameters button
long onCmdSaveParameters(FXObject *, FXSelector, void *)
event when user press save parameters button
long onCmdClearParameters(FXObject *, FXSelector, void *)
event when user press clear parameters button
long onCmdSortParameters(FXObject *, FXSelector, void *)
event when user press sort parameters button
void enableRow(const std::string &parameter, const std::string &value) const
enable row
bool isButtonInAddMode() const
check if remove button is in mode "add"
void copyValues(const ParameterRow &other)
copy values of other parameter Row
FXHorizontalFrame * horizontalFrame
frame in which elements of ParameterRow are placed
void setParameters(const std::vector< std::pair< std::string, std::string > > &newParameters)
set parameters
FXLabel * myKeyLabel
label for key (its neccesary because has to be resized in every onPaint() iteration)
long onCmdSetAttribute(FXObject *, FXSelector, void *)
event when user change an attribute
void addParameter(std::pair< std::string, std::string > newParameter)
add a single parameter
long onCmdButtonPress(FXObject *, FXSelector, void *)
event when user press a remove (or add) button
std::vector< ParameterRow * > myParameterRows
vector with the ParameterRows
FXVerticalFrame * myVerticalFrameRow
vertical frame in which rows are placed
bool keyExist(const std::string &key) const
check if given key exist already
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
void runInternalTest(const InternalTestStep::DialogTest *modalArguments)
run internal test
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
ParametersValues * myParametersValues
pointer to parameters values
ParametersOperations * myParametersOperations
pointer to parameters operations
GNETypeFrame * myTypeFrameParent
FOX need this.
dialog arguments (used for certain functions that opens modal dialogs)
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.