Eclipse SUMO - Simulation of Urban MObility
GNEMultipleParametersDialog.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 multiple parameters
19/****************************************************************************/
20
23#include <utils/xml/XMLSubSys.h>
24#include <netedit/GNEViewNet.h>
25#include <netedit/GNEUndoList.h>
26
28
29
30// ===========================================================================
31// FOX callback mapping
32// ===========================================================================
33
34FXDEFMAP(GNEMultipleParametersDialog) GNEMultipleParametersDialogMap[] = {
38 FXMAPFUNC(SEL_CHORE, FXDialogBox::ID_CANCEL, GNEMultipleParametersDialog::onCmdCancel),
39 FXMAPFUNC(SEL_TIMEOUT, FXDialogBox::ID_CANCEL, GNEMultipleParametersDialog::onCmdCancel),
40 FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_CANCEL, GNEMultipleParametersDialog::onCmdCancel),
41 FXMAPFUNC(SEL_CLOSE, 0, GNEMultipleParametersDialog::onCmdCancel),
42};
43
48};
49
56};
57
58// Object implementation
59FXIMPLEMENT(GNEMultipleParametersDialog, FXDialogBox, GNEMultipleParametersDialogMap, ARRAYNUMBER(GNEMultipleParametersDialogMap))
60FXIMPLEMENT(GNEMultipleParametersDialog::ParametersValues, FXGroupBox, ParametersValuesMap, ARRAYNUMBER(ParametersValuesMap))
61FXIMPLEMENT(GNEMultipleParametersDialog::ParametersOperations, FXGroupBox, ParametersOperationsMap, ARRAYNUMBER(ParametersOperationsMap))
62
63// ===========================================================================
64// member method definitions
65// ===========================================================================
66
67// ---------------------------------------------------------------------------
68// GNEMultipleParametersDialog::ParametersValues - methods
69// ---------------------------------------------------------------------------
70
72 FXGroupBox(frame, "Parameters", GUIDesignGroupBoxFrameFill) {
73 // create labels for keys and values
74 FXHorizontalFrame* horizontalFrameLabels = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
75 myKeyLabel = new FXLabel(horizontalFrameLabels, "key", nullptr, GUIDesignLabelThick100);
76 new FXLabel(horizontalFrameLabels, "value", nullptr, GUIDesignLabelCenterThick);
77 new FXLabel(horizontalFrameLabels, "", nullptr, GUIDesignLabelIconThick);
78 // create scroll windows
79 FXScrollWindow* scrollWindow = new FXScrollWindow(this, LAYOUT_FILL);
80 // create vertical frame for rows
81 myVerticalFrameRow = new FXVerticalFrame(scrollWindow, GUIDesignAuxiliarFrame);
82}
83
84
86
87
88void
89GNEMultipleParametersDialog::ParametersValues::setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters) {
90 // clear rows
91 clearParameters();
92 // iterate over parameteres
93 for (const auto& newParameter : newParameters) {
94 addParameter(newParameter);
95 }
96}
97
98
99void
100GNEMultipleParametersDialog::ParametersValues::addParameter(std::pair<std::string, std::string> newParameter) {
101 // enable last row
102 myParameterRows.back()->enableRow(newParameter.first, newParameter.second);
103 // add row
104 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
105 // enable add button in the last row
106 myParameterRows.back()->toggleAddButton();
107}
108
109
110void
112 // iterate over all rows
113 for (const auto& parameterRow : myParameterRows) {
114 delete parameterRow;
115 }
116 //clear myParameterRows;
117 myParameterRows.clear();
118 // add row
119 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
120 // enable add button in the last row
121 myParameterRows.back()->toggleAddButton();
122}
123
124
125const std::vector<GNEMultipleParametersDialog::ParametersValues::ParameterRow*>
127 return myParameterRows;
128}
129
130
131bool
133 // just interate over myParameterRows and compare key
134 for (const auto& row : myParameterRows) {
135 if (row->keyField->getText().text() == key) {
136 return true;
137 }
138 }
139 return false;
140}
141
142
143long
145 // size of key label has to be updated in every interation
146 if (myParameterRows.size() > 0) {
147 myKeyLabel->setWidth(myParameterRows.front()->keyField->getWidth());
148 }
149 return FXGroupBox::onPaint(o, f, p);
150}
151
152
153long
155 // find what value was changed
156 for (int i = 0; i < (int)myParameterRows.size(); i++) {
157 if (myParameterRows.at(i)->keyField == obj) {
158 // change color of text field depending if key is valid or empty
159 if (myParameterRows.at(i)->keyField->getText().empty() || SUMOXMLDefinitions::isValidParameterKey(myParameterRows.at(i)->keyField->getText().text())) {
160 myParameterRows.at(i)->keyField->setTextColor(FXRGB(0, 0, 255));
161 myParameterRows.at(i)->valueChanged = true;
162 } else {
163 myParameterRows.at(i)->keyField->setTextColor(FXRGB(255, 0, 0));
164 myParameterRows.at(i)->keyField->killFocus();
165 }
166 } else if (myParameterRows.at(i)->valueField == obj) {
167 myParameterRows.at(i)->valueField->setTextColor(FXRGB(0, 0, 255));
168 myParameterRows.at(i)->valueChanged = true;
169 }
170 }
171 return 1;
172}
173
174
175long
177 // first check if add button was pressed
178 if (myParameterRows.back()->button == obj) {
179 // create new parameter
180 addParameter(std::make_pair("", ""));
181 return 1;
182 } else {
183 // in other case, button press was a "remove button". Find id and remove the Parameter
184 for (int i = 0; i < (int)myParameterRows.size(); i++) {
185 if (myParameterRows.at(i)->button == obj) {
186 // delete row
187 delete myParameterRows.at(i);
188 // just remove row
189 myParameterRows.erase(myParameterRows.begin() + i);
190 return 1;
191 }
192 }
193 }
194 // Nothing to do
195 return 1;
196}
197
198
200 valueChanged(false) {
201 horizontalFrame = new FXHorizontalFrame(verticalFrameParent, GUIDesignAuxiliarHorizontalFrame);
205 // only create elements if vertical frame was previously created
206 if (verticalFrameParent->id()) {
207 horizontalFrame->create();
208 }
209 // by defaults rows are disabled
210 disableRow();
211}
212
213
215 // simply delete horizontalFrame (rest of elements will be automatic deleted due they are children of horizontal frame)
216 delete horizontalFrame;
217}
218
219
220void
222 // hide all
223 keyField->setText("");
224 keyField->disable();
225 valueField->setText("");
226 valueField->disable();
227 button->disable();
228 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
229}
230
231
232void
233GNEMultipleParametersDialog::ParametersValues::ParameterRow::enableRow(const std::string& parameter, const std::string& value) const {
234 // restore color and enable key field
235 keyField->setText(parameter.c_str());
236 if (parameter.empty() || SUMOXMLDefinitions::isValidParameterKey(parameter)) {
237 keyField->setTextColor(FXRGB(0, 0, 0));
238 } else {
239 keyField->setTextColor(FXRGB(255, 0, 0));
240 }
241 keyField->enable();
242 // restore color and enable value field
243 valueField->setText(value.c_str());
244 valueField->enable();
245 // enable button and set icon remove
246 button->enable();
247 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
248}
249
250
251void
253 // clear and disable parameter and value fields
254 keyField->setText("");
255 keyField->disable();
256 valueField->setText("");
257 valueField->disable();
258 // enable remove button and set "add" icon and focus
259 button->enable();
260 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::ADD));
261 button->setFocus();
262}
263
264
265bool
267 return (button->getIcon() == GUIIconSubSys::getIcon(GUIIcon::ADD));
268}
269
270
271void
273 keyField->setText(other.keyField->getText());
274 valueField->setText(other.valueField->getText());
275}
276
277// ---------------------------------------------------------------------------
278// GNEMultipleParametersDialog::ParametersOperations - methods
279// ---------------------------------------------------------------------------
280
282 FXGroupBox(frame, "Operations", GUIDesignGroupBoxFrame100),
283 myParameterDialogParent(ParameterDialogParent) {
284 // create buttons
290}
291
292
294
295
296long
298 // get the Additional file name
299 FXFileDialog opendialog(this, TL("Open Parameter Template"));
301 opendialog.setSelectMode(SELECTFILE_EXISTING);
302 opendialog.setPatternList(" Parameter Template files (*.xml,*.xml.gz)\nAll files (*)");
303 if (gCurrentFolder.length() != 0) {
304 opendialog.setDirectory(gCurrentFolder);
305 }
306 if (opendialog.execute()) {
307 gCurrentFolder = opendialog.getDirectory();
308 std::string file = opendialog.getFilename().text();
309 // save current number of parameters
310 const int numberOfParametersbeforeLoad = (int)myParameterDialogParent->myParametersValues->getParameterRows().size();
311 // Create additional handler and run parser
312 GNEParameterHandler handler(this, file);
313 if (!XMLSubSys::runParser(handler, file, false)) {
314 WRITE_MESSAGE("Loading of Parameters From " + file + " failed.");
315 }
316 // show loaded attributes
317 WRITE_MESSAGE("Loaded " + toString((int)myParameterDialogParent->myParametersValues->getParameterRows().size() - numberOfParametersbeforeLoad) + " Parameters.");
318 }
319 return 1;
320}
321
322
323long
325 // obtain file to save parameters
326 FXString file = MFXUtils::getFilename2Write(this,
327 TL("Save Parameter Template file"), ".xml",
330 if (file == "") {
331 // None parameter file was selected, then stop function
332 return 1;
333 } else {
334 // open device
335 OutputDevice& device = OutputDevice::getDevice(file.text());
336 // write header
337 device.writeXMLHeader("Parameter", "parameter_file.xsd");
338 // iterate over all parameters and save it in the filename
339 for (const auto& row : myParameterDialogParent->myParametersValues->getParameterRows()) {
340 // write all except last
341 if (row != myParameterDialogParent->myParametersValues->getParameterRows().back()) {
342 // open tag
343 device.openTag(SUMO_TAG_PARAM);
344 // write key
345 device.writeAttr(SUMO_ATTR_KEY, row->keyField->getText().text());
346 // write value
347 device.writeAttr(SUMO_ATTR_VALUE, row->valueField->getText().text());
348 // close tag
349 device.closeTag();
350 }
351 }
352 // close device
353 device.close();
354 }
355 return 1;
356}
357
358
359long
361 // simply clear parameters from ParametersValues
362 myParameterDialogParent->myParametersValues->clearParameters();
363 return 1;
364}
365
366
367long
369 // declare two containers for parameters
370 std::vector<std::pair<std::string, std::string> > nonEmptyKeyValues;
371 std::vector<std::string> emptyKeyValues;
372 // first extract empty values
373 for (const auto& parameterRow : myParameterDialogParent->myParametersValues->getParameterRows()) {
374 // check if key is empty
375 if (!parameterRow->keyField->getText().empty()) {
376 nonEmptyKeyValues.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
377 } else if (!parameterRow->valueField->getText().empty()) {
378 emptyKeyValues.push_back(parameterRow->valueField->getText().text());
379 }
380 }
381 // sort non-empty parameters
382 std::sort(nonEmptyKeyValues.begin(), nonEmptyKeyValues.end());
383 // sort non-empty parameters
384 std::sort(emptyKeyValues.begin(), emptyKeyValues.end());
385 // add values without key
386 for (const auto& emptyKeyValue : emptyKeyValues) {
387 nonEmptyKeyValues.push_back(std::make_pair("", emptyKeyValue));
388 }
389 // finally setparameters in myParametersValues
390 myParameterDialogParent->myParametersValues->setParameters(nonEmptyKeyValues);
391 return 1;
392}
393
394
395long
397 // Create dialog box
398 FXDialogBox* ParameterHelpDialog = new FXDialogBox(this, " Parameters Help", GUIDesignDialogBox);
399 ParameterHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::APP_TABLE));
400 // set help text
401 std::ostringstream help;
402 help
403 << TL("- Parameters are defined by a Key and a Value.\n")
404 << TL("- In Netedit can be defined using format key1=parameter1|key2=parameter2|...\n")
405 << TL(" - Duplicated and empty Keys aren't valid.\n")
406 << TL(" - Whitespace and certain characters aren't allowed (@$%^&/|\\....)\n");
407 // Create label with the help text
408 new FXLabel(ParameterHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
409 // Create horizontal separator
410 new FXHorizontalSeparator(ParameterHelpDialog, GUIDesignHorizontalSeparator);
411 // Create frame for OK Button
412 FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(ParameterHelpDialog, GUIDesignAuxiliarHorizontalFrame);
413 // Create Button Close (And two more horizontal frames to center it)
414 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
415 new FXButton(myHorizontalFrameOKButton, TL("OK\t\tclose"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), ParameterHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
416 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
417 // Write Warning in console if we're in testing mode
418 WRITE_DEBUG("Opening Parameter help dialog");
419 // create Dialog
420 ParameterHelpDialog->create();
421 // show in the given position
422 ParameterHelpDialog->show(PLACEMENT_CURSOR);
423 // refresh APP
424 getApp()->refresh();
425 // open as modal dialog (will block all windows until stop() or stopModal() is called)
426 getApp()->runModalFor(ParameterHelpDialog);
427 // Write Warning in console if we're in testing mode
428 WRITE_DEBUG("Closing Parameter help dialog");
429 return 1;
430}
431
432
434 SUMOSAXHandler(file),
435 myParametersOperationsParent(ParametersOperationsParent) {
436}
437
438
440
441
442void
444 // only continue if tag is valid
445 if (element == SUMO_TAG_PARAM) {
446 // Check that format of Parameter is correct
447 if (!attrs.hasAttribute(SUMO_ATTR_KEY)) {
448 WRITE_WARNING(TL("Key of Parameter not defined"));
449 } else if (!attrs.hasAttribute(SUMO_ATTR_VALUE)) {
450 WRITE_WARNING(TL("Value of Parameter not defined"));
451 } else {
452 // obtain Key and value
453 const std::string key = attrs.getString(SUMO_ATTR_KEY);
454 const std::string value = attrs.getString(SUMO_ATTR_VALUE);
455 // check that parsed values are correct
457 if (key.size() == 0) {
458 WRITE_WARNING(TL("Key of Parameter cannot be empty"));
459 } else {
460 WRITE_WARNING("Key '" + key + "' of Parameter contains invalid characters");
461 }
462 } else if (myParametersOperationsParent->myParameterDialogParent->myParametersValues->keyExist(key)) {
463 WRITE_WARNING("Key '" + key + "' already exist");
464 } else {
465 // add parameter to vector of myParameterDialogParent
466 myParametersOperationsParent->myParameterDialogParent->myParametersValues->addParameter(std::make_pair(key, value));
467 }
468 }
469 }
470}
471
472// ---------------------------------------------------------------------------
473// GNEMultipleParametersDialog::ParametersOptions - methods
474// ---------------------------------------------------------------------------
475
477 FXGroupBox(frame, "Options", GUIDesignGroupBoxFrame100) {
478 myOnlyForExistentKeys = new FXCheckButton(this, TL("Only for\nexistent keys"), this, MID_GNE_SET_ATTRIBUTE_BOOL, GUIDesignCheckButtonExtraHeight);
479}
480
481
483
484
485bool
487 return (myOnlyForExistentKeys->getCheck() == TRUE);
488}
489
490// ---------------------------------------------------------------------------
491// GNEMultipleParametersDialog - methods
492// ---------------------------------------------------------------------------
493
495 FXDialogBox(parametersEditorInspector->getInspectorFrameParent()->getViewNet()->getApp(), "Edit parameters", GUIDesignDialogBoxExplicitStretchable(430, 300)),
496 myParametersEditor(parametersEditorInspector) {
497 // call auxiliar constructor
498 constructor();
499 // reset
500 onCmdReset(nullptr, 0, nullptr);
501}
502
503
505
506
507long
508GNEMultipleParametersDialog::onCmdAccept(FXObject*, FXSelector, void*) {
510 if (ACs.size() > 0) {
511 // get undo list
513 // declare vector for parameters in stringvector format
514 std::vector<std::pair<std::string, std::string> > parametersChanged;
515 // declare keep keys vector
516 std::vector<std::string> keepKeys;
517 // check if all edited parameters are valid
518 for (const auto& parameterRow : myParametersValues->getParameterRows()) {
519 // ignore last row
520 if (parameterRow != myParametersValues->getParameterRows().back()) {
521 // insert in keepKeys
522 keepKeys.push_back(parameterRow->keyField->getText().text());
523 // continue if we're going to modify key
524 if (parameterRow->valueChanged) {
525 if (parameterRow->keyField->getText().empty()) {
526 // write warning if netedit is running in testing mode
527 WRITE_DEBUG("Opening FXMessageBox of type 'warning'");
528 // open warning Box
529 FXMessageBox::warning(getApp(), MBOX_OK, "Empty Parameter key", "%s", "Parameters with empty keys aren't allowed");
530 // write warning if netedit is running in testing mode
531 WRITE_DEBUG("Closed FXMessageBox of type 'warning' with 'OK'");
532 return 1;
533 } else if (!SUMOXMLDefinitions::isValidParameterKey(parameterRow->keyField->getText().text())) {
534 // write warning if netedit is running in testing mode
535 WRITE_DEBUG("Opening FXMessageBox of type 'warning'");
536 // open warning Box
537 FXMessageBox::warning(getApp(), MBOX_OK, "Invalid Parameter key", "%s", "There are keys with invalid characters");
538 // write warning if netedit is running in testing mode
539 WRITE_DEBUG("Closed FXMessageBox of type 'warning' with 'OK'");
540 return 1;
541 }
542 // insert in parameters
543 parametersChanged.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
544 }
545 }
546 }
547 // sort sortedParameters
548 std::sort(parametersChanged.begin(), parametersChanged.end());
549 // check if there is duplicated keys
550 for (auto i = parametersChanged.begin(); i != parametersChanged.end(); i++) {
551 if (((i + 1) != parametersChanged.end()) && (i->first) == (i + 1)->first) {
552 // write warning if netedit is running in testing mode
553 WRITE_DEBUG("Opening FXMessageBox of type 'warning'");
554 // open warning Box
555 FXMessageBox::warning(getApp(), MBOX_OK, "Duplicated Parameters", "%s", "Parameters with the same Key aren't allowed");
556 // write warning if netedit is running in testing mode
557 WRITE_DEBUG("Closed FXMessageBox of type 'warning' with 'OK'");
558 return 1;
559 }
560 }
561 // begin change
562 undoList->begin(ACs.front()->getTagProperty().getGUIIcon(), "change parameters");
563 // iterate over ACs
564 for (const auto& AC : ACs) {
565 // remove keys
566 AC->removeACParametersKeys(keepKeys, undoList);
567 // update parameters
568 for (const auto& parameter : parametersChanged) {
569 if (myParametersOptions->onlyForExistentKeys() && (AC->getACParametersMap().count(parameter.first) == 0)) {
570 continue;
571 } else {
572 AC->addACParameters(parameter.first, parameter.second, undoList);
573 }
574 }
575 }
576 // end change
577 undoList->end();
578 }
579 // all ok, then close dialog
580 getApp()->stopModal(this, TRUE);
581 return 1;
582}
583
584
585long
586GNEMultipleParametersDialog::onCmdCancel(FXObject*, FXSelector, void*) {
587 // Stop Modal
588 getApp()->stopModal(this, FALSE);
589 return 1;
590}
591
592
593long
594GNEMultipleParametersDialog::onCmdReset(FXObject*, FXSelector, void*) {
595 // declare a map for key-values
596 std::map<std::string, std::vector<std::string> > keyValuesMap;
597 // fill keys
599 for (const auto& keyAttribute : AC->getACParametersMap()) {
600 keyValuesMap[keyAttribute.first].push_back(keyAttribute.second);
601 }
602 }
603 // transform map to string vector
604 std::vector<std::pair<std::string, std::string> > keyValues;
605 for (const auto& keyAttribute : keyValuesMap) {
606 // remove duplicated values
607 std::set<std::string> valuesNonDuplicated;
608 for (const auto& value : keyAttribute.second) {
609 valuesNonDuplicated.insert(value);
610 }
611 // merge values
612 std::string values;
613 for (const auto& value : valuesNonDuplicated) {
614 values.append(value + " ");
615 }
616 if (!values.empty()) {
617 values.pop_back();
618 }
619 // update key values
620 keyValues.push_back(std::make_pair(keyAttribute.first, values));
621 }
622 // fill myParametersValues
624 return 1;
625}
626
627
628void
630 // set vehicle icon for this dialog
632 // create main frame
633 FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
634 // create frame for Parameters, operations and options
635 FXHorizontalFrame* horizontalFrameExtras = new FXHorizontalFrame(mainFrame, GUIDesignAuxiliarFrame);
636 // create parameters values
637 myParametersValues = new ParametersValues(horizontalFrameExtras);
638 // create vertical frame frame
639 FXVerticalFrame* verticalFrameExtras = new FXVerticalFrame(horizontalFrameExtras, GUIDesignAuxiliarVerticalFrame);
640 // create parameters operations
641 myParametersOperations = new ParametersOperations(verticalFrameExtras, this);
642 // create parameters options
643 myParametersOptions = new ParametersOptions(verticalFrameExtras);
644 // add separator
645 new FXHorizontalSeparator(mainFrame, GUIDesignHorizontalSeparator);
646 // create dialog buttons bot centered
647 FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(mainFrame, GUIDesignHorizontalFrame);
648 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
649 myAcceptButton = new FXButton(buttonsFrame, TL("accept\t\tclose"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), this, MID_GNE_BUTTON_ACCEPT, GUIDesignButtonAccept);
650 myCancelButton = new FXButton(buttonsFrame, TL("cancel\t\tclose"), GUIIconSubSys::getIcon(GUIIcon::CANCEL), this, MID_GNE_BUTTON_CANCEL, GUIDesignButtonCancel);
651 myResetButton = new FXButton(buttonsFrame, "reset\t\tclose", GUIIconSubSys::getIcon(GUIIcon::RESET), this, MID_GNE_BUTTON_RESET, GUIDesignButtonReset);
652 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
653}
654
655/****************************************************************************/
FXDEFMAP(GNEMultipleParametersDialog) GNEMultipleParametersDialogMap[]
@ 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_RESET
reset button
Definition: GUIAppEnum.h:1298
@ 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
@ MID_GNE_SET_ATTRIBUTE_BOOL
bool attribute edited
Definition: GUIAppEnum.h:902
#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 GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:403
#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 GUIDesignButtonReset
Reset Button.
Definition: GUIDesigns.h:151
#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 GUIDesignCheckButtonExtraHeight
checkButton placed in left position with double size
Definition: GUIDesigns.h:172
#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 GUIDesignLabelIconThick
label squared over frame with thick and with text justify to center
Definition: GUIDesigns.h:238
#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_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
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:150
GNEInspectorFrame * getInspectorFrameParent() const
get inspector frame parent
GNEParameterHandler(ParametersOperations *ParametersOperationsParent, const std::string &file)
Constructor.
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 onCmdSaveParameters(FXObject *, FXSelector, void *)
event when user press save parameters button
long onCmdClearParameters(FXObject *, FXSelector, void *)
event when user press clear parameters button
ParametersOperations(FXVerticalFrame *frame, GNEMultipleParametersDialog *ParameterDialogParent)
FOX-declaration.
FXCheckButton * myOnlyForExistentKeys
apply changes only for existent keys
bool onlyForExistentKeys() const
apply changes to all elements
void enableRow(const std::string &parameter, const std::string &value) const
enable row
void copyValues(const ParameterRow &other)
copy values of other parameter Row
FXHorizontalFrame * horizontalFrame
frame in which elements of ParameterRow are placed
bool isButtonInAddMode() const
check if remove button is in mode "add"
ParameterRow(ParametersValues *ParametersValues, FXVerticalFrame *verticalFrameParent)
constructor
bool keyExist(const std::string &key) const
check if given key exist already
long onPaint(FXObject *o, FXSelector f, void *p)
void setParameters(const std::vector< std::pair< std::string, std::string > > &newParameters)
set parameters
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
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
ParametersOperations * myParametersOperations
pointer to parameters operations
long onCmdAccept(FXObject *, FXSelector, void *)
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
GNEMultipleParametersDialog(GNEInspectorFrame::ParametersEditor *parametersEditorInspector)
Constructor for parameter editor inspector.
GNEInspectorFrame::ParametersEditor * myParametersEditor
FOX need this.
ParametersOptions * myParametersOptions
pointer to parameters options
ParametersValues * myParametersValues
pointer to parameters values
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
void constructor()
auxiliar constructor
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
GNEUndoList * getUndoList() const
get the undoList object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
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