Eclipse SUMO - Simulation of Urban MObility
GNEVTypeDistributionsDialog.cpp
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 VType distributions
19 /****************************************************************************/
20 
22 #include <netedit/GNEViewNet.h>
25 #include <utils/xml/XMLSubSys.h>
26 
28 
29 
30 // ===========================================================================
31 // FOX callback mapping
32 // ===========================================================================
33 
34 FXDEFMAP(GNEVTypeDistributionsDialog) GNEVTypeDistributionsDialogMap[] = {
37  FXMAPFUNC(SEL_CHORE, FXDialogBox::ID_CANCEL, GNEVTypeDistributionsDialog::onCmdCancel),
38  FXMAPFUNC(SEL_TIMEOUT, FXDialogBox::ID_CANCEL, GNEVTypeDistributionsDialog::onCmdCancel),
39  FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_CANCEL, GNEVTypeDistributionsDialog::onCmdCancel),
40  FXMAPFUNC(SEL_CLOSE, 0, GNEVTypeDistributionsDialog::onCmdCancel),
41 };
42 
47 };
48 
55 };
56 
57 // Object implementation
58 FXIMPLEMENT(GNEVTypeDistributionsDialog, FXDialogBox, GNEVTypeDistributionsDialogMap, ARRAYNUMBER(GNEVTypeDistributionsDialogMap))
59 FXIMPLEMENT(GNEVTypeDistributionsDialog::ParametersValues, FXGroupBox, ParametersValuesMap, ARRAYNUMBER(ParametersValuesMap))
60 FXIMPLEMENT(GNEVTypeDistributionsDialog::ParametersOperations, FXGroupBox, ParametersOperationsMap, ARRAYNUMBER(ParametersOperationsMap))
61 
62 // ===========================================================================
63 // member method definitions
64 // ===========================================================================
65 
66 // ---------------------------------------------------------------------------
67 // GNEVTypeDistributionsDialog::ParametersValues - methods
68 // ---------------------------------------------------------------------------
69 
70 GNEVTypeDistributionsDialog::ParametersValues::ParametersValues(FXHorizontalFrame* frame, const std::string& name) :
71  FXGroupBox(frame, name.c_str(), GUIDesignGroupBoxFrameFill) {
72  // create labels for keys and values
73  FXHorizontalFrame* horizontalFrameLabels = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
74  myKeyLabel = new FXLabel(horizontalFrameLabels, "key", nullptr, GUIDesignLabelThickedFixed(100));
75  new FXLabel(horizontalFrameLabels, "value", nullptr, GUIDesignLabelThick(JUSTIFY_NORMAL));
76  // create scroll windows
77  FXScrollWindow* scrollWindow = new FXScrollWindow(this, LAYOUT_FILL);
78  // create vertical frame for rows
79  myVerticalFrameRow = new FXVerticalFrame(scrollWindow, GUIDesignAuxiliarFrame);
80 }
81 
82 
84 
85 
86 void
87 GNEVTypeDistributionsDialog::ParametersValues::setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters) {
88  // clear rows
89  clearParameters();
90  // iterate over parameters
91  for (const auto& newParameter : newParameters) {
92  addParameter(newParameter);
93  }
94 }
95 
96 
97 void
98 GNEVTypeDistributionsDialog::ParametersValues::addParameter(std::pair<std::string, std::string> newParameter) {
99  // enable last row
100  myParameterRows.back()->enableRow(newParameter.first, newParameter.second);
101  // add row
102  myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
103  // enable add button in the last row
104  myParameterRows.back()->toggleAddButton();
105 }
106 
107 
108 void
110  // iterate over all rows
111  for (const auto& parameterRow : myParameterRows) {
112  delete parameterRow;
113  }
114  //clear myParameterRows;
115  myParameterRows.clear();
116  // add row
117  myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
118  // enable add button in the last row
119  myParameterRows.back()->toggleAddButton();
120 }
121 
122 
123 const std::vector<GNEVTypeDistributionsDialog::ParametersValues::ParameterRow*>
125  return myParameterRows;
126 }
127 
128 
129 bool
131  // just iterate over myParameterRows and compare key
132  for (const auto& row : myParameterRows) {
133  if (row->keyField->getText().text() == key) {
134  return true;
135  }
136  }
137  return false;
138 }
139 
140 
141 long
142 GNEVTypeDistributionsDialog::ParametersValues::onPaint(FXObject* o, FXSelector f, void* p) {
143  // size of key label has to be updated in every interation
144  if (myParameterRows.size() > 0) {
145  myKeyLabel->setWidth(myParameterRows.front()->keyField->getWidth());
146  }
147  return FXGroupBox::onPaint(o, f, p);
148 }
149 
150 
151 long
153  // find what value was changed
154  for (int i = 0; i < (int)myParameterRows.size(); i++) {
155  if (myParameterRows.at(i)->keyField == obj) {
156  // change color of text field depending if key is valid or empty
157  if (myParameterRows.at(i)->keyField->getText().empty() || SUMOXMLDefinitions::isValidParameterKey(myParameterRows.at(i)->keyField->getText().text())) {
158  myParameterRows.at(i)->keyField->setTextColor(FXRGB(0, 0, 0));
159  } else {
160  myParameterRows.at(i)->keyField->setTextColor(FXRGB(255, 0, 0));
161  myParameterRows.at(i)->keyField->killFocus();
162  }
163  }
164  }
165  return 1;
166 }
167 
168 
169 long
171  // first check if add button was pressed
172  if (myParameterRows.back()->button == obj) {
173  // create new parameter
174  addParameter(std::make_pair("", ""));
175  return 1;
176  } else {
177  // in other case, button press was a "remove button". Find id and remove the Parameter
178  for (int i = 0; i < (int)myParameterRows.size(); i++) {
179  if (myParameterRows.at(i)->button == obj) {
180  // delete row
181  delete myParameterRows.at(i);
182  // just remove row
183  myParameterRows.erase(myParameterRows.begin() + i);
184  return 1;
185  }
186  }
187  }
188  // Nothing to do
189  return 1;
190 }
191 
192 
194  horizontalFrame = new FXHorizontalFrame(verticalFrameParent, GUIDesignAuxiliarHorizontalFrame);
195  keyField = new FXTextField(horizontalFrame, GUIDesignTextFieldNCol, ParametersValues, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
196  valueField = new FXTextField(horizontalFrame, GUIDesignTextFieldNCol, ParametersValues, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
198  // only create elements if vertical frame was previously created
199  if (verticalFrameParent->id()) {
200  horizontalFrame->create();
201  }
202  // by defaults rows are disabled
203  disableRow();
204 }
205 
206 
208  // simply delete horizontalFrame (rest of elements will be automatic deleted due they are children of horizontal frame)
209  delete horizontalFrame;
210 }
211 
212 
213 void
215  // hide all
216  keyField->setText("");
217  keyField->disable();
218  valueField->setText("");
219  valueField->disable();
220  button->disable();
221  button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
222 }
223 
224 
225 void
226 GNEVTypeDistributionsDialog::ParametersValues::ParameterRow::enableRow(const std::string& parameter, const std::string& value) const {
227  // restore color and enable key field
228  keyField->setText(parameter.c_str());
229  if (parameter.empty() || SUMOXMLDefinitions::isValidParameterKey(parameter)) {
230  keyField->setTextColor(FXRGB(0, 0, 0));
231  } else {
232  keyField->setTextColor(FXRGB(255, 0, 0));
233  }
234  keyField->enable();
235  // restore color and enable value field
236  valueField->setText(value.c_str());
237  valueField->enable();
238  // enable button and set icon remove
239  button->enable();
240  button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
241 }
242 
243 
244 void
246  // clear and disable parameter and value fields
247  keyField->setText("");
248  keyField->disable();
249  valueField->setText("");
250  valueField->disable();
251  // enable remove button and set "add" icon and focus
252  button->enable();
253  button->setIcon(GUIIconSubSys::getIcon(GUIIcon::ADD));
254  button->setFocus();
255 }
256 
257 
258 bool
260  return (button->getIcon() == GUIIconSubSys::getIcon(GUIIcon::ADD));
261 }
262 
263 
264 void
266  keyField->setText(other.keyField->getText());
267  valueField->setText(other.valueField->getText());
268 }
269 
270 // ---------------------------------------------------------------------------
271 // GNEVTypeDistributionsDialog::ParametersOperations - methods
272 // ---------------------------------------------------------------------------
273 
275  FXGroupBox(frame, "Operations", GUIDesignGroupBoxFrame100),
276  myParameterDialogParent(ParameterDialogParent) {
277  // create buttons
283 }
284 
285 
287 
288 
289 long
291  // get the Additional file name
292  FXFileDialog opendialog(this, TL("Open Parameter Template"));
293  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE));
294  opendialog.setSelectMode(SELECTFILE_EXISTING);
295  opendialog.setPatternList(" Parameter Template files (*.xml,*.xml.gz)\nAll files (*)");
296  if (gCurrentFolder.length() != 0) {
297  opendialog.setDirectory(gCurrentFolder);
298  }
299  if (opendialog.execute()) {
300  gCurrentFolder = opendialog.getDirectory();
301  std::string file = opendialog.getFilename().text();
302  // save current number of parameters
303  const int numberOfParametersbeforeLoad = (int)myParameterDialogParent->myParametersValues->getParameterRows().size();
304  // Create additional handler and run parser
305  GNEParameterHandler handler(this, file);
306  if (!XMLSubSys::runParser(handler, file, false)) {
307  WRITE_MESSAGEF(TL("Loading of Parameters From % failed."), file);
308  }
309  // show loaded attributes
310  WRITE_MESSAGEF(TL("Loaded % Parameters."), toString((int)myParameterDialogParent->myParametersValues->getParameterRows().size() - numberOfParametersbeforeLoad));
311  }
312  return 1;
313 }
314 
315 
316 long
318  // obtain file to save parameters
319  FXString file = MFXUtils::getFilename2Write(this,
320  TL("Save Parameter Template file"), ".xml",
323  if (file == "") {
324  // None parameter file was selected, then stop function
325  return 1;
326  } else {
327  // open device
328  OutputDevice& device = OutputDevice::getDevice(file.text());
329  // write header
330  device.writeXMLHeader("Parameter", "parameter_file.xsd");
331  // iterate over all parameters and save it in the filename
332  for (const auto& row : myParameterDialogParent->myParametersValues->getParameterRows()) {
333  // write all except last
334  if (row != myParameterDialogParent->myParametersValues->getParameterRows().back()) {
335  // open tag
336  device.openTag(SUMO_TAG_PARAM);
337  // write key
338  device.writeAttr(SUMO_ATTR_KEY, row->keyField->getText().text());
339  // write value
340  device.writeAttr(SUMO_ATTR_VALUE, row->valueField->getText().text());
341  // close tag
342  device.closeTag();
343  }
344  }
345  // close device
346  device.close();
347  }
348  return 1;
349 }
350 
351 
352 long
354  // simply clear parameters from ParametersValues
355  myParameterDialogParent->myParametersValues->clearParameters();
356  return 1;
357 }
358 
359 
360 long
362  // declare two containers for parameters
363  std::vector<std::pair<std::string, std::string> > nonEmptyKeyValues;
364  std::vector<std::string> emptyKeyValues;
365  // first extract empty values
366  for (const auto& parameterRow : myParameterDialogParent->myParametersValues->getParameterRows()) {
367  // check if key is empty
368  if (!parameterRow->keyField->getText().empty()) {
369  nonEmptyKeyValues.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
370  } else if (!parameterRow->valueField->getText().empty()) {
371  emptyKeyValues.push_back(parameterRow->valueField->getText().text());
372  }
373  }
374  // sort non-empty parameters
375  std::sort(nonEmptyKeyValues.begin(), nonEmptyKeyValues.end());
376  // sort non-empty parameters
377  std::sort(emptyKeyValues.begin(), emptyKeyValues.end());
378  // add values without key
379  for (const auto& emptyKeyValue : emptyKeyValues) {
380  nonEmptyKeyValues.push_back(std::make_pair("", emptyKeyValue));
381  }
382  // finally setparameters in myParametersValues
383  myParameterDialogParent->myParametersValues->setParameters(nonEmptyKeyValues);
384  return 1;
385 }
386 
387 
388 long
390  // Create dialog box
391  FXDialogBox* ParameterHelpDialog = new FXDialogBox(this, " Parameters Help", GUIDesignDialogBox);
392  ParameterHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::APP_TABLE));
393  // set help text
394  std::ostringstream help;
395  help
396  << TL("- Parameters are defined by a Key and a Value.\n")
397  << TL("- In Netedit can be defined using format key1=parameter1|key2=parameter2|...\n")
398  << TL(" - Duplicated and empty Keys aren't valid.\n")
399  << TL(" - Whitespace and certain characters aren't allowed (@$%^&/|\\....)\n");
400  // Create label with the help text
401  new FXLabel(ParameterHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
402  // Create horizontal separator
403  new FXHorizontalSeparator(ParameterHelpDialog, GUIDesignHorizontalSeparator);
404  // Create frame for OK Button
405  FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(ParameterHelpDialog, GUIDesignAuxiliarHorizontalFrame);
406  // Create Button Close (And two more horizontal frames to center it)
407  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
408  GUIDesigns::buildFXButton(myHorizontalFrameOKButton, TL("OK"), "", TL("close"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), ParameterHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
409  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
410  // Write Warning in console if we're in testing mode
411  WRITE_DEBUG("Opening Parameter help dialog");
412  // create Dialog
413  ParameterHelpDialog->create();
414  // show in the given position
415  ParameterHelpDialog->show(PLACEMENT_CURSOR);
416  // refresh APP
417  getApp()->refresh();
418  // open as modal dialog (will block all windows until stop() or stopModal() is called)
419  getApp()->runModalFor(ParameterHelpDialog);
420  // Write Warning in console if we're in testing mode
421  WRITE_DEBUG("Closing Parameter help dialog");
422  return 1;
423 }
424 
425 
427  SUMOSAXHandler(file),
428  myParametersOperationsParent(ParametersOperationsParent) {
429 }
430 
431 
433 
434 
435 void
437  // only continue if tag is valid
438  if (element != SUMO_TAG_NOTHING) {
439  // Call parse and build depending of tag
440  switch (element) {
441  case SUMO_TAG_PARAM:
442  // Check that format of Parameter is correct
443  if (!attrs.hasAttribute(SUMO_ATTR_KEY)) {
444  WRITE_WARNING(TL("Key of Parameter not defined"));
445  } else if (!attrs.hasAttribute(SUMO_ATTR_VALUE)) {
446  WRITE_WARNING(TL("Value of Parameter not defined"));
447  } else {
448  // obtain Key and value
449  std::string key = attrs.getString(SUMO_ATTR_KEY);
450  std::string value = attrs.getString(SUMO_ATTR_VALUE);
451  // check that parsed values are correct
453  if (key.size() == 0) {
454  WRITE_WARNING(TL("Key of Parameter cannot be empty"));
455  } else {
456  WRITE_WARNINGF(TL("Key '%' of Parameter contains invalid characters"), key);
457  }
458  } else if (myParametersOperationsParent->myParameterDialogParent->myParametersValues->keyExist(key)) {
459  WRITE_WARNINGF(TL("Key '%' already exists"), key);
460  } else {
461  // add parameter to vector of myParameterDialogParent
462  myParametersOperationsParent->myParameterDialogParent->myParametersValues->addParameter(std::make_pair(key, value));
463  }
464  }
465  break;
466  default:
467  break;
468  }
469  }
470 }
471 
472 // ---------------------------------------------------------------------------
473 // GNEVTypeDistributionsDialog - methods
474 // ---------------------------------------------------------------------------
475 
477  FXDialogBox(typeFrameParent->getViewNet()->getApp(), "Edit attributes", GUIDesignDialogBoxExplicitStretchable(400, 300)),
478  myTypeFrameParent(typeFrameParent) {
479  // set vehicle icon for this dialog
481  // create main frame
482  FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
483  // create frame for Parameters and operations
484  FXHorizontalFrame* horizontalFrameExtras = new FXHorizontalFrame(mainFrame, GUIDesignAuxiliarFrame);
485  // create parameters values
486  myParametersValues = new ParametersValues(horizontalFrameExtras, "test");
487  // create parameters operations
488  myParametersOperations = new ParametersOperations(horizontalFrameExtras, this);
489  // add separator
490  new FXHorizontalSeparator(mainFrame, GUIDesignHorizontalSeparator);
491  // create dialog buttons bot centered
492  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(mainFrame, GUIDesignHorizontalFrame);
493  new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
496  new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
497  // create dialog
498  create();
499 }
500 
501 
503 
504 
505 void
507  // show
508  show(PLACEMENT_SCREEN);
509  // open as modal dialog (will block all windows until stop() or stopModal() is called)
510  //getApp()->runModalFor(this);
511 }
512 
513 
514 void
516  // hide
517  hide();
518  // close dialog
519  //getApp()->stopModal(this, TRUE);
520 }
521 
522 
523 long
524 GNEVTypeDistributionsDialog::onCmdAccept(FXObject*, FXSelector, void*) {
525  // close dialog
526  closeDialog();
527  return 1;
528 }
529 
530 
531 long
532 GNEVTypeDistributionsDialog::onCmdCancel(FXObject*, FXSelector, void*) {
533  // close dialog
534  closeDialog();
535  return 1;
536 }
537 
538 /****************************************************************************/
FXDEFMAP(GNEVTypeDistributionsDialog) GNEVTypeDistributionsDialogMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:930
@ MID_GNE_REMOVE_ATTRIBUTE
attribute removed
Definition: GUIAppEnum.h:928
@ MID_GNE_BUTTON_CANCEL
cancel button
Definition: GUIAppEnum.h:1394
@ MID_GNE_BUTTON_SAVE
save button
Definition: GUIAppEnum.h:1400
@ MID_GNE_BUTTON_SORT
sort button
Definition: GUIAppEnum.h:1404
@ MID_HELP
help button
Definition: GUIAppEnum.h:648
@ MID_GNE_BUTTON_LOAD
load button
Definition: GUIAppEnum.h:1398
@ MID_GNE_BUTTON_CLEAR
clear button
Definition: GUIAppEnum.h:1402
@ MID_GNE_BUTTON_ACCEPT
accept button
Definition: GUIAppEnum.h:1392
#define GUIDesignGroupBoxFrame100
Group box design for elements of width 100.
Definition: GUIDesigns.h:358
#define GUIDesignButtonIcon
button only with icon
Definition: GUIDesigns.h:97
#define GUIDesignButtonAccept
Accept Button.
Definition: GUIDesigns.h:162
#define GUIDesignButtonCancel
Cancel Button.
Definition: GUIDesigns.h:168
#define GUIDesignTextField
Definition: GUIDesigns.h:65
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:405
#define GUIDesignDialogBox
Definition: GUIDesigns.h:602
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:80
#define GUIDesignButtonOK
Definition: GUIDesigns.h:159
#define GUIDesignLabelThick(justify)
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:255
#define GUIDesignGroupBoxFrameFill
Group box design extended over frame (X and Y)
Definition: GUIDesigns.h:355
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:466
#define GUIDesignButtonFixed(width)
button rectangular with thick and raise frame with the given width
Definition: GUIDesigns.h:103
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition: GUIDesigns.h:396
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition: GUIDesigns.h:258
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
Definition: GUIDesigns.h:334
#define GUIDesignDialogBoxExplicitStretchable(width, height)
design for dialog box with specific width and height that can be stretched (But not shrunk)
Definition: GUIDesigns.h:620
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:285
FXString gCurrentFolder
The folder used as last.
@ CLEANJUNCTIONS
@ GREENVEHICLE
@ OPEN
open icons
@ SAVE
save icons
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:306
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define WRITE_MESSAGEF(...)
Definition: MsgHandler.h:298
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:295
#define TL(string)
Definition: MsgHandler.h:315
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_ATTR_VALUE
@ SUMO_ATTR_KEY
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
GNEParameterHandler(ParametersOperations *ParametersOperationsParent, const std::string &file)
Constructor.
long onCmdHelpParameter(FXObject *, FXSelector, void *)
event when user press help parameters button
ParametersOperations(FXHorizontalFrame *frame, GNEVTypeDistributionsDialog *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
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
ParameterRow(ParametersValues *ParametersValues, FXVerticalFrame *verticalFrameParent)
constructor
void setParameters(const std::vector< std::pair< std::string, std::string > > &newParameters)
set parameters
long onPaint(FXObject *o, FXSelector f, void *p)
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
bool keyExist(const std::string &key) const
check if given key exist already
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
long onCmdAccept(FXObject *, FXSelector, void *)
GNEVTypeDistributionsDialog(GNETypeFrame *typeFrameParent)
Constructor.
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.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
Definition: GUIDesigns.cpp:128
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString &currentFolder)
Returns the file name to write.
Definition: MFXUtils.cpp:82
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
void close()
Closes the device and removes it from the dictionary.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
SAX-handler base for SUMO-files.
static bool isValidParameterKey(const std::string &value)
whether the given string is a valid key for a parameter
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
Definition: XMLSubSys.cpp:148
Definition: json.hpp:4471