Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNESingleParametersDialog.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 parameters
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
27
28// ===========================================================================
29// class definitions
30// ===========================================================================
31
34class GNEViewNet;
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
39
44class GNESingleParametersDialog : public FXDialogBox {
47
48public:
49
50 // ===========================================================================
51 // class ParametersValues
52 // ===========================================================================
53
54 class ParametersValues : protected FXGroupBox {
57
58
59 class ParameterRow;
60
61 public:
63 ParametersValues(FXHorizontalFrame* frame, const std::string& name);
64
67
69 void setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters);
70
72 void addParameter(std::pair<std::string, std::string> newParameter);
73
75 void clearParameters();
76
78 const std::vector<ParameterRow*> getParameterRows() const;
79
81 bool keyExist(const std::string& key) const;
82
86 long onPaint(FXObject* o, FXSelector f, void* p);
87
89 long onCmdSetAttribute(FXObject*, FXSelector, void*);
90
92 long onCmdButtonPress(FXObject*, FXSelector, void*);
93
95
96 protected:
98 FOX_CONSTRUCTOR(ParametersValues)
99
100 private:
103
104 public:
106 ParameterRow(ParametersValues* ParametersValues, FXVerticalFrame* verticalFrameParent);
107
110
112 void disableRow();
113
115 void enableRow(const std::string& parameter, const std::string& value) const;
116
118 void toggleAddButton();
119
121 bool isButtonInAddMode() const;
122
124 void copyValues(const ParameterRow& other);
125
127 FXTextField* keyField;
128
130 FXTextField* valueField;
131
133 FXButton* button;
134 private:
136 FXHorizontalFrame* horizontalFrame;
137 };
138
140 FXLabel* myKeyLabel;
141
143 FXVerticalFrame* myVerticalFrameRow;
144
146 std::vector<ParameterRow*> myParameterRows;
147 };
148
149 // ===========================================================================
150 // class ParametersOperations
151 // ===========================================================================
152
153 class ParametersOperations : protected FXGroupBox {
156
157 public:
159 ParametersOperations(FXHorizontalFrame* frame, GNESingleParametersDialog* ParameterDialogParent);
160
163
167 long onCmdLoadParameters(FXObject*, FXSelector, void*);
168
170 long onCmdSaveParameters(FXObject*, FXSelector, void*);
171
173 long onCmdClearParameters(FXObject*, FXSelector, void*);
174
176 long onCmdSortParameters(FXObject*, FXSelector, void*);
177
179 long onCmdHelpParameter(FXObject*, FXSelector, void*);
180
182
183 protected:
185 FOX_CONSTRUCTOR(ParametersOperations)
186
187 private:
191 public:
193 GNEParameterHandler(ParametersOperations* ParametersOperationsParent, const std::string& file);
194
197
200
206 void myStartElement(int element, const SUMOSAXAttributes& attrs);
207
208 private:
211 };
212
215
217 FXButton* mySortButton;
218
220 FXButton* myClearButton;
221
223 FXButton* myLoadButton;
224
226 FXButton* mySaveButton;
227
229 FXButton* myHelpButton;
230 };
231
234
237
240
243
246
249
253 long onCmdAccept(FXObject*, FXSelector, void*);
254
256 long onCmdCancel(FXObject*, FXSelector, void*);
257
259 long onCmdReset(FXObject*, FXSelector, void*);
261
262protected:
264 FOX_CONSTRUCTOR(GNESingleParametersDialog)
265
266
268
271
274
277
280
283
286
288 FXButton* myAcceptButton;
289
291 FXButton* myCancelButton;
292
294 FXButton* myResetButton;
295
296private:
298 void constructor(const std::string& name);
299
302
305};
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
ParametersOperations * myParametersOperationsParent
pointer to ParametersOperations parent
long onCmdSaveParameters(FXObject *, FXSelector, void *)
event when user press save parameters button
long onCmdClearParameters(FXObject *, FXSelector, void *)
event when user press clear parameters button
GNESingleParametersDialog * myParameterDialogParent
pointer to Shape Frame Parent
long onCmdSortParameters(FXObject *, FXSelector, void *)
event when user press sort parameters button
long onCmdHelpParameter(FXObject *, FXSelector, void *)
event when user press help parameters button
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 enableRow(const std::string &parameter, const std::string &value) const
enable row
long onPaint(FXObject *o, FXSelector f, void *p)
std::vector< ParameterRow * > myParameterRows
vector with the ParameterRows
long onCmdSetAttribute(FXObject *, FXSelector, void *)
event when user change an attribute
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
FXVerticalFrame * myVerticalFrameRow
vertical frame in which rows 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)
bool keyExist(const std::string &key) const
check if given key exist already
long onCmdButtonPress(FXObject *, FXSelector, void *)
event when user press a remove (or add) button
void addParameter(std::pair< std::string, std::string > newParameter)
add a single parameter
Dialog for edit parameters.
FXButton * myResetButton
cancel button
ParametersValues * myParametersValues
pointer to parameters values
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow * VTypeAttributeRow
pointer to VTypeAttributeRow
FXButton * myAcceptButton
accept button
FXButton * myCancelButton
cancel button
void constructor(const std::string &name)
auxiliar constructor
ParametersOperations * myParametersOperations
pointer to parameters operations
GNEFrameAttributeModules::ParametersEditor * myParametersEditor
pointer to ParametersEditor
GNEAttributeCarrier * myAttributeCarrier
pointer to GNEAttributeCarrier
NBLoadedSUMOTLDef * myTLDef
pointer to TLDef
GNEFrameAttributeModules::GenericDataAttributes * myGenericDataAttributes
FOX need this.
long onCmdAccept(FXObject *, FXSelector, void *)
class used for represent rows with Vehicle Type parameters
Dialog for editing calibrator vehicle types.
A loaded (complete) traffic light logic.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.
Definition json.hpp:4471