Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEParametersDialog.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 parameters
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
25
26#include "GNEDialog.h"
27
28// ===========================================================================
29// class definitions
30// ===========================================================================
31
34class GNEViewNet;
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
40
43 FXDECLARE(GNEParametersDialog)
44
45public:
46
47 // ===========================================================================
48 // class ParametersValues
49 // ===========================================================================
50
51 class ParametersValues : protected FXGroupBox {
54
55
56 class ParameterRow;
57
58 public:
60 ParametersValues(FXHorizontalFrame* frame, const std::string& name);
61
64
66 void setParameters(const Parameterised::Map& newParameters);
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, GNEParametersDialog* 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
192 public:
194 GNEParameterHandler(ParametersOperations* ParametersOperationsParent, const std::string& file);
195
198
201
207 void myStartElement(int element, const SUMOSAXAttributes& attrs);
208
209 private:
212 };
213
216
218 FXButton* mySortButton;
219
221 FXButton* myClearButton;
222
224 FXButton* myLoadButton;
225
227 FXButton* mySaveButton;
228
230 FXButton* myHelpButton;
231 };
232
234 GNEParametersDialog(GNEApplicationWindow* applicationWindow, const Parameterised::Map& parameters);
235
238
240 void runInternalTest(const InternalTestStep::DialogArgument* dialogArgument);
241
243 std::vector<std::pair<std::string, std::string> > getEditedParameters() const;
244
247
249 long onCmdAccept(FXObject*, FXSelector, void*);
250
252 long onCmdReset(FXObject*, FXSelector, void*);
253
255
256protected:
258 FOX_CONSTRUCTOR(GNEParametersDialog)
259
260
262
265
268
269private:
272
274 GNEParametersDialog& operator=(const GNEParametersDialog&) = delete;
275};
The main window of Netedit.
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 onCmdClearParameters(FXObject *, FXSelector, void *)
event when user press clear parameters button
long onCmdSaveParameters(FXObject *, FXSelector, void *)
event when user press save parameters button
GNEParametersDialog * myParameterDialogParent
pointer to Shape Frame Parent
long onCmdLoadParameters(FXObject *, FXSelector, void *)
void copyValues(const ParameterRow &other)
copy values of other parameter Row
FXButton * button
Button for add or remove row.
FXHorizontalFrame * horizontalFrame
frame in which elements of ParameterRow are placed
bool isButtonInAddMode() const
check if remove button is in mode "add"
void enableRow(const std::string &parameter, const std::string &value) const
enable row
bool keyExist(const std::string &key) const
check if given key exist already
long onCmdSetAttribute(FXObject *, FXSelector, void *)
event when user change an attribute
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
void setParameters(const Parameterised::Map &newParameters)
set parameters map
FXVerticalFrame * myVerticalFrameRow
vertical frame in which rows are placed
void addParameter(std::pair< std::string, std::string > newParameter)
add a single parameter
long onPaint(FXObject *o, FXSelector f, void *p)
long onCmdButtonPress(FXObject *, FXSelector, void *)
event when user press a remove (or add) button
FXLabel * myKeyLabel
label for key (its neccesary because has to be resized in every onPaint() iteration)
std::vector< ParameterRow * > myParameterRows
vector with the ParameterRows
ParametersOperations * myParametersOperations
pointer to parameters operations
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
const Parameterised::Map myOriginalParameters
FOX need this.
std::vector< std::pair< std::string, std::string > > getEditedParameters() const
get edited parameters
ParametersValues * myParametersValues
pointer to parameters values
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
dialog arguments, used for certain modal dialogs that can not be edited using tab
A loaded (complete) traffic light logic.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.