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.org/sumo
3// Copyright (C) 2001-2022 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
34FXDEFMAP(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
58FXIMPLEMENT(GNEVTypeDistributionsDialog, FXDialogBox, GNEVTypeDistributionsDialogMap, ARRAYNUMBER(GNEVTypeDistributionsDialogMap))
59FXIMPLEMENT(GNEVTypeDistributionsDialog::ParametersValues, FXGroupBox, ParametersValuesMap, ARRAYNUMBER(ParametersValuesMap))
60FXIMPLEMENT(GNEVTypeDistributionsDialog::ParametersOperations, FXGroupBox, ParametersOperationsMap, ARRAYNUMBER(ParametersOperationsMap))
61
62// ===========================================================================
63// member method definitions
64// ===========================================================================
65
66// ---------------------------------------------------------------------------
67// GNEVTypeDistributionsDialog::ParametersValues - methods
68// ---------------------------------------------------------------------------
69
70GNEVTypeDistributionsDialog::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, GUIDesignLabelThick100);
75 new FXLabel(horizontalFrameLabels, "value", nullptr, GUIDesignLabelCenterThick);
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
86void
87GNEVTypeDistributionsDialog::ParametersValues::setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters) {
88 // clear rows
89 clearParameters();
90 // iterate over parameteres
91 for (const auto& newParameter : newParameters) {
92 addParameter(newParameter);
93 }
94}
95
96
97void
98GNEVTypeDistributionsDialog::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
108void
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
123const std::vector<GNEVTypeDistributionsDialog::ParametersValues::ParameterRow*>
125 return myParameterRows;
126}
127
128
129bool
131 // just interate 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
141long
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
151long
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
169long
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
213void
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
225void
226GNEVTypeDistributionsDialog::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
244void
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
258bool
260 return (button->getIcon() == GUIIconSubSys::getIcon(GUIIcon::ADD));
261}
262
263
264void
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
289long
291 // get the Additional file name
292 FXFileDialog opendialog(this, TL("Open Parameter Template"));
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_MESSAGE("Loading of Parameters From " + file + " failed.");
308 }
309 // show loaded attributes
310 WRITE_MESSAGE("Loaded " + toString((int)myParameterDialogParent->myParametersValues->getParameterRows().size() - numberOfParametersbeforeLoad) + " Parameters.");
311 }
312 return 1;
313}
314
315
316long
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
352long
354 // simply clear parameters from ParametersValues
355 myParameterDialogParent->myParametersValues->clearParameters();
356 return 1;
357}
358
359
360long
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
388long
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 new FXButton(myHorizontalFrameOKButton, TL("OK\t\tclose"), 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
435void
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_WARNING("Key '" + key + "' of Parameter contains invalid characters");
457 }
458 } else if (myParametersOperationsParent->myParameterDialogParent->myParametersValues->keyExist(key)) {
459 WRITE_WARNING("Key '" + key + "' already exist");
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);
494 myAcceptButton = new FXButton(buttonsFrame, TL("accept\t\tclose"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), this, MID_GNE_BUTTON_ACCEPT, GUIDesignButtonAccept);
495 myCancelButton = new FXButton(buttonsFrame, TL("cancel\t\tclose"), GUIIconSubSys::getIcon(GUIIcon::CANCEL), this, MID_GNE_BUTTON_CANCEL, GUIDesignButtonCancel);
496 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
497 // create dialog
498 create();
499}
500
501
503
504
505void
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
514void
516 // hide
517 hide();
518 // close dialog
519 //getApp()->stopModal(this, TRUE);
520}
521
522
523long
524GNEVTypeDistributionsDialog::onCmdAccept(FXObject*, FXSelector, void*) {
525 // close dialog
526 closeDialog();
527 return 1;
528}
529
530
531long
532GNEVTypeDistributionsDialog::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:870
@ MID_GNE_REMOVE_ATTRIBUTE
attribute removed
Definition: GUIAppEnum.h:868
@ MID_GNE_BUTTON_CANCEL
cancel button
Definition: GUIAppEnum.h:1296
@ MID_GNE_BUTTON_SAVE
save button
Definition: GUIAppEnum.h:1302
@ MID_GNE_BUTTON_SORT
sort button
Definition: GUIAppEnum.h:1306
@ MID_HELP
help button
Definition: GUIAppEnum.h:641
@ MID_GNE_BUTTON_LOAD
load button
Definition: GUIAppEnum.h:1300
@ MID_GNE_BUTTON_CLEAR
clear button
Definition: GUIAppEnum.h:1304
@ MID_GNE_BUTTON_ACCEPT
accept button
Definition: GUIAppEnum.h:1294
#define GUIDesignGroupBoxFrame100
Group box design for elements of width 100.
Definition: GUIDesigns.h:356
#define GUIDesignButtonIcon
button only with icon
Definition: GUIDesigns.h:86
#define GUIDesignButtonAccept
Accept Button.
Definition: GUIDesigns.h:145
#define GUIDesignButtonCancel
Cancel Button.
Definition: GUIDesigns.h:148
#define GUIDesignTextField
Definition: GUIDesigns.h:48
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:397
#define GUIDesignDialogBox
Definition: GUIDesigns.h:584
#define GUIDesignButtonRectangular100
button rectangular with thick and raise frame with a width of 100
Definition: GUIDesigns.h:92
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:69
#define GUIDesignButtonOK
Definition: GUIDesigns.h:142
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center
Definition: GUIDesigns.h:235
#define GUIDesignGroupBoxFrameFill
Group box design extended over frame (X and Y)
Definition: GUIDesigns.h:353
#define GUIDesignLabelThick100
label with thick, text justify to left and width of 100
Definition: GUIDesigns.h:277
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:452
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions
Definition: GUIDesigns.h:394
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent.
Definition: GUIDesigns.h:335
#define GUIDesignDialogBoxExplicitStretchable(width, height)
design for dialog box with specift width and height that can be stretched (But not shrinked)
Definition: GUIDesigns.h:599
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:271
FXString gCurrentFolder
The folder used as last.
@ CLEANJUNCTIONS
@ GREENVEHICLE
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:276
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:267
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
#define TL(string)
Definition: MsgHandler.h:282
@ 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 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
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
void close()
Closes the device and removes it from the dictionary.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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)
Runs the given handler on the given file; returns if everything's ok.
Definition: XMLSubSys.cpp:137
Definition: json.hpp:4471