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