Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEMultipleParametersDialog.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// Dialog for edit multiple parameters
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
26
27// ===========================================================================
28// class definitions
29// ===========================================================================
30
32class GNEViewNet;
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
37
42class GNEMultipleParametersDialog : public FXDialogBox {
45
46public:
47
48 // ===========================================================================
49 // class ParametersValues
50 // ===========================================================================
51
52 class ParametersValues : protected FXGroupBox {
55
56
57 class ParameterRow;
58
59 public:
61 ParametersValues(FXHorizontalFrame* frame);
62
65
67 void setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters);
68
70 void addParameter(std::pair<std::string, std::string> newParameter);
71
73 void clearParameters();
74
76 const std::vector<ParameterRow*> getParameterRows() const;
77
79 bool keyExist(const std::string& key) const;
80
84 long onPaint(FXObject* o, FXSelector f, void* p);
85
87 long onCmdSetAttribute(FXObject*, FXSelector, void*);
88
90 long onCmdButtonPress(FXObject*, FXSelector, void*);
91
93
94 protected:
96 FOX_CONSTRUCTOR(ParametersValues)
97
98 private:
101
102 public:
104 ParameterRow(ParametersValues* ParametersValues, FXVerticalFrame* verticalFrameParent);
105
108
110 void disableRow();
111
113 void enableRow(const std::string& parameter, const std::string& value) const;
114
116 void toggleAddButton();
117
119 bool isButtonInAddMode() const;
120
122 void copyValues(const ParameterRow& other);
123
125 FXTextField* keyField;
126
128 FXTextField* valueField;
129
131 FXButton* button;
132
135
136 private:
138 FXHorizontalFrame* horizontalFrame;
139 };
140
142 FXLabel* myKeyLabel;
143
145 FXVerticalFrame* myVerticalFrameRow;
146
148 std::vector<ParameterRow*> myParameterRows;
149 };
150
151 // ===========================================================================
152 // class ParametersOperations
153 // ===========================================================================
154
155 class ParametersOperations : protected FXGroupBox {
158
159 public:
161 ParametersOperations(FXVerticalFrame* frame, GNEMultipleParametersDialog* ParameterDialogParent);
162
165
169 long onCmdLoadParameters(FXObject*, FXSelector, void*);
170
172 long onCmdSaveParameters(FXObject*, FXSelector, void*);
173
175 long onCmdClearParameters(FXObject*, FXSelector, void*);
176
178 long onCmdSortParameters(FXObject*, FXSelector, void*);
179
181 long onCmdHelpParameter(FXObject*, FXSelector, void*);
182
184
185 protected:
187 FOX_CONSTRUCTOR(ParametersOperations)
188
189 private:
193 public:
195 GNEParameterHandler(ParametersOperations* ParametersOperationsParent, const std::string& file);
196
199
202
208 void myStartElement(int element, const SUMOSAXAttributes& attrs);
209
210 private:
213 };
214
217
219 FXButton* mySortButton;
220
222 FXButton* myClearButton;
223
225 FXButton* myLoadButton;
226
228 FXButton* mySaveButton;
229
231 FXButton* myHelpButton;
232 };
233
234 // ===========================================================================
235 // class ParametersOptions
236 // ===========================================================================
237
238 class ParametersOptions : protected FXGroupBox {
239
240 public:
242 ParametersOptions(FXVerticalFrame* frame);
243
246
248 bool onlyForExistentKeys() const;
249
250 private:
252 FXCheckButton* myOnlyForExistentKeys;
253 };
254
257
260
264 long onCmdAccept(FXObject*, FXSelector, void*);
265
267 long onCmdCancel(FXObject*, FXSelector, void*);
268
270 long onCmdReset(FXObject*, FXSelector, void*);
272
273protected:
275 FOX_CONSTRUCTOR(GNEMultipleParametersDialog)
276
277
279
282
285
288
291
293 FXButton* myCancelButton;
294
296 FXButton* myResetButton;
297
298private:
300 void constructor();
301
304
307};
ParametersOperations * myParametersOperationsParent
pointer to ParametersOperations parent
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
long onCmdSortParameters(FXObject *, FXSelector, void *)
event when user press sort parameters button
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
GNEMultipleParametersDialog * myParameterDialogParent
pointer to Shape Frame Parent
FXCheckButton * myOnlyForExistentKeys
apply changes only for existent keys
bool onlyForExistentKeys() const
apply changes to all elements
void enableRow(const std::string &parameter, const std::string &value) const
enable row
void copyValues(const ParameterRow &other)
copy values of other parameter Row
FXHorizontalFrame * horizontalFrame
frame in which elements of ParameterRow are placed
bool isButtonInAddMode() const
check if remove button is in mode "add"
bool keyExist(const std::string &key) const
check if given key exist already
FXVerticalFrame * myVerticalFrameRow
vertical frame in which rows are placed
void setParameters(const std::vector< std::pair< std::string, std::string > > &newParameters)
set parameters
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
std::vector< ParameterRow * > myParameterRows
vector with the ParameterRows
long onCmdSetAttribute(FXObject *, FXSelector, void *)
event when user change an attribute
void addParameter(std::pair< std::string, std::string > newParameter)
add a single parameter
FXLabel * myKeyLabel
label for key (its neccesary because has to be resized in every onPaint() iteration)
long onCmdButtonPress(FXObject *, FXSelector, void *)
event when user press a remove (or add) button
ParametersOperations * myParametersOperations
pointer to parameters operations
long onCmdAccept(FXObject *, FXSelector, void *)
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
GNEFrameAttributeModules::ParametersEditor * myParametersEditor
FOX need this.
ParametersOptions * myParametersOptions
pointer to parameters options
ParametersValues * myParametersValues
pointer to parameters values
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.