Eclipse SUMO - Simulation of Urban MObility
GNESingleParametersDialog.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
32 
34 class GNEViewNet;
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
39 
44 class GNESingleParametersDialog : public FXDialogBox {
46  FXDECLARE(GNESingleParametersDialog)
47 
48 public:
49 
50  // ===========================================================================
51  // class ParametersValues
52  // ===========================================================================
53 
54  class ParametersValues : protected FXGroupBox {
57 
58 
59  class ParameterRow;
60 
61  public:
63  ParametersValues(FXHorizontalFrame* frame, GNESingleParametersDialog* ParameterDialogParent);
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:
102  class ParameterRow {
103 
104  public:
106  ParameterRow(ParametersValues* ParametersValues, FXVerticalFrame* verticalFrameParent);
107 
109  ~ParameterRow();
110 
112  void disableRow();
113 
115  void enableRow(const std::string& parameter, const std::string& value) const;
116 
118  void toogleAddButton();
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 
150  };
151 
152  // ===========================================================================
153  // class ParametersOperations
154  // ===========================================================================
155 
156  class ParametersOperations : protected FXGroupBox {
159 
160  public:
162  ParametersOperations(FXHorizontalFrame* frame, GNESingleParametersDialog* ParameterDialogParent);
163 
166 
170  long onCmdLoadParameters(FXObject*, FXSelector, void*);
171 
173  long onCmdSaveParameters(FXObject*, FXSelector, void*);
174 
176  long onCmdClearParameters(FXObject*, FXSelector, void*);
177 
179  long onCmdSortParameters(FXObject*, FXSelector, void*);
180 
182  long onCmdHelpParameter(FXObject*, FXSelector, void*);
183 
185 
186  protected:
188  FOX_CONSTRUCTOR(ParametersOperations)
189 
190  private:
194  public:
196  GNEParameterHandler(ParametersOperations* ParametersOperationsParent, const std::string& file);
197 
200 
203 
209  void myStartElement(int element, const SUMOSAXAttributes& attrs);
210 
211  private:
214  };
215 
218 
220  FXButton* mySortButton;
221 
223  FXButton* myClearButton;
224 
226  FXButton* myLoadButton;
227 
229  FXButton* mySaveButton;
230 
232  FXButton* myHelpButton;
233  };
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 
262 protected:
264  FOX_CONSTRUCTOR(GNESingleParametersDialog)
265 
266 
268 
270  GNEInspectorFrame::ParametersEditorInspector* myParametersEditorInspector;
271 
274 
277 
280 
283 
285  FXButton* myAcceptButton;
286 
288  FXButton* myCancelButton;
289 
291  FXButton* myResetButton;
292 
293 private:
295  void constructor();
296 
299 
302 };
303 
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
ParametersOperations * myParametersOperationsParent
pointer to ParametersOperations parent
GNEParameterHandler(ParametersOperations *ParametersOperationsParent, const std::string &file)
Constructor.
ParametersOperations(FXHorizontalFrame *frame, GNESingleParametersDialog *ParameterDialogParent)
FOX-declaration.
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 onCmdLoadParameters(FXObject *, FXSelector, void *)
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"
ParameterRow(ParametersValues *ParametersValues, FXVerticalFrame *verticalFrameParent)
constructor
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 rlow
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
ParametersValues(FXHorizontalFrame *frame, GNESingleParametersDialog *ParameterDialogParent)
constructor
GNESingleParametersDialog * myParameterDialogParent
pointer to ParameterDialog parent
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::VTypeAtributes::VTypeAttributeRow * VTypeAttributeRow
pointer to VTypeAttributeRow
FXButton * myAcceptButton
accept button
FXButton * myCancelButton
cancel button
GNEInspectorFrame::ParametersEditorInspector * myParametersEditorInspector
pointer to ParametersEditorInspector
ParametersOperations * myParametersOperations
pointer to parameters operations
GNEAttributeCarrier * myAttributeCarrier
pointer to GNEAttributeCarrier
GNEFrameAttributesModuls::ParametersEditorCreator * myParametersEditorCreator
FOX need this.
void constructor()
auxiliar constructor
long onCmdAccept(FXObject *, FXSelector, void *)
GNESingleParametersDialog(GNEFrameAttributesModuls::ParametersEditorCreator *parametersEditorCreator)
Constructor for parameter editor creator.
class used for represent rows with Vehicle Type parameters
Dialog for edit rerouter intervals.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.