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-2025 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// 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
49
57
58// Object implementation
59FXIMPLEMENT(GNEMultipleParametersDialog, MFXDialogBox, 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, GUIDesignLabelThickedFixed(100));
76 new FXLabel(horizontalFrameLabels, "value", nullptr, GUIDesignLabelThick(JUSTIFY_NORMAL));
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*>
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
269
270
271void
273 keyField->setText(other.keyField->getText());
274 valueField->setText(other.valueField->getText());
275}
276
277// ---------------------------------------------------------------------------
278// GNEMultipleParametersDialog::ParametersOperations - methods
279// ---------------------------------------------------------------------------
280
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(SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str());
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_MESSAGEF(TL("Loading of Parameters From % failed."), file);
315 }
316 // show loaded attributes
317 WRITE_MESSAGEF(TL("Loaded % Parameters."), toString((int)myParameterDialogParent->myParametersValues->getParameterRows().size() - numberOfParametersbeforeLoad));
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"),
328 SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str(),
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 MFXDialogBox* ParameterHelpDialog = new MFXDialogBox(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 // create Dialog
419 ParameterHelpDialog->create();
420 // show in the given position
421 ParameterHelpDialog->show(PLACEMENT_CURSOR);
422 // refresh APP
423 getApp()->refresh();
424 // open as modal dialog (will block all windows until stop() or stopModal() is called)
425 getApp()->runModalFor(ParameterHelpDialog);
426 return 1;
427}
428
429
431 SUMOSAXHandler(file),
432 myParametersOperationsParent(ParametersOperationsParent) {
433}
434
435
437
438
439void
441 // only continue if tag is valid
442 if (element == SUMO_TAG_PARAM) {
443 // Check that format of Parameter is correct
444 if (!attrs.hasAttribute(SUMO_ATTR_KEY)) {
445 WRITE_WARNING(TL("Key of Parameter not defined"));
446 } else if (!attrs.hasAttribute(SUMO_ATTR_VALUE)) {
447 WRITE_WARNING(TL("Value of Parameter not defined"));
448 } else {
449 // obtain Key and value
450 const std::string key = attrs.getString(SUMO_ATTR_KEY);
451 const std::string value = attrs.getString(SUMO_ATTR_VALUE);
452 // check that parsed values are correct
454 if (key.size() == 0) {
455 WRITE_WARNING(TL("Key of Parameter cannot be empty"));
456 } else {
457 WRITE_WARNINGF(TL("Key '%' of Parameter contains invalid characters"), key);
458 }
459 } else if (myParametersOperationsParent->myParameterDialogParent->myParametersValues->keyExist(key)) {
460 WRITE_WARNINGF(TL("Key '%' already exist"), key);
461 } else {
462 // add parameter to vector of myParameterDialogParent
463 myParametersOperationsParent->myParameterDialogParent->myParametersValues->addParameter(std::make_pair(key, value));
464 }
465 }
466 }
467}
468
469// ---------------------------------------------------------------------------
470// GNEMultipleParametersDialog::ParametersOptions - methods
471// ---------------------------------------------------------------------------
472
474 FXGroupBox(frame, "Options", GUIDesignGroupBoxFrame100) {
475 myOnlyForExistentKeys = new FXCheckButton(this, TL("Only for\nexistent keys"), this, MID_GNE_SET_ATTRIBUTE_BOOL, GUIDesignCheckButtonExtraHeight);
476}
477
478
480
481
482bool
484 return (myOnlyForExistentKeys->getCheck() == TRUE);
485}
486
487// ---------------------------------------------------------------------------
488// GNEMultipleParametersDialog - methods
489// ---------------------------------------------------------------------------
490
492 MFXDialogBox(attributesEditor->getFrameParent()->getViewNet()->getApp(), "Edit parameters", GUIDesignDialogBoxExplicitStretchable(430, 300)),
493 myAttributesEditor(attributesEditor) {
494 // call auxiliar constructor
495 constructor();
496 // reset
497 onCmdReset(nullptr, 0, nullptr);
498}
499
500
502
503
504void
508
509
510long
511GNEMultipleParametersDialog::onCmdAccept(FXObject*, FXSelector, void*) {
512 const auto& inspectedElements = myAttributesEditor->getFrameParent()->getViewNet()->getInspectedElements();
513 if (inspectedElements.isInspectingElements()) {
514 // get undo list
516 // declare vector for parameters in stringvector format
517 std::vector<std::pair<std::string, std::string> > parametersChanged;
518 // declare keep keys vector
519 std::vector<std::string> keepKeys;
520 // check if all edited parameters are valid
521 for (const auto& parameterRow : myParametersValues->getParameterRows()) {
522 // ignore last row
523 if (parameterRow != myParametersValues->getParameterRows().back()) {
524 // insert in keepKeys
525 keepKeys.push_back(parameterRow->keyField->getText().text());
526 // continue if we're going to modify key
527 if (parameterRow->valueChanged) {
528 if (parameterRow->keyField->getText().empty()) {
529 // open warning Box
530 FXMessageBox::warning(getApp(), MBOX_OK, "Empty Parameter key", "%s", "Parameters with empty keys aren't allowed");
531 return 1;
532 } else if (!SUMOXMLDefinitions::isValidParameterKey(parameterRow->keyField->getText().text())) {
533 // open warning Box
534 FXMessageBox::warning(getApp(), MBOX_OK, "Invalid Parameter key", "%s", "There are keys with invalid characters");
535 return 1;
536 }
537 // insert in parameters
538 parametersChanged.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
539 }
540 }
541 }
542 // sort sortedParameters
543 std::sort(parametersChanged.begin(), parametersChanged.end());
544 // check if there is duplicated keys
545 for (auto i = parametersChanged.begin(); i != parametersChanged.end(); i++) {
546 if (((i + 1) != parametersChanged.end()) && (i->first) == (i + 1)->first) {
547 // open warning Box
548 FXMessageBox::warning(getApp(), MBOX_OK, "Duplicated Parameters", "%s", "Parameters with the same Key aren't allowed");
549 return 1;
550 }
551 }
552 // begin change
553 undoList->begin(inspectedElements.getFirstAC(), "change parameters");
554 // iterate over ACs
555 for (const auto& AC : inspectedElements.getACs()) {
556 // remove keys
557 AC->removeACParametersKeys(keepKeys, undoList);
558 // update parameters
559 for (const auto& parameter : parametersChanged) {
560 if (myParametersOptions->onlyForExistentKeys() && (AC->getACParametersMap().count(parameter.first) == 0)) {
561 continue;
562 } else {
563 AC->addACParameters(parameter.first, parameter.second, undoList);
564 }
565 }
566 }
567 // end change
568 undoList->end();
569 }
570 // all ok, then close dialog
571 getApp()->stopModal(this, TRUE);
572 return 1;
573}
574
575
576long
577GNEMultipleParametersDialog::onCmdCancel(FXObject*, FXSelector, void*) {
578 // Stop Modal
579 getApp()->stopModal(this, FALSE);
580 return 1;
581}
582
583
584long
585GNEMultipleParametersDialog::onCmdReset(FXObject*, FXSelector, void*) {
586 // declare a map for key-values
587 std::map<std::string, std::vector<std::string> > keyValuesMap;
588 // fill keys
589 for (const auto& AC : myAttributesEditor->getEditedAttributeCarriers()) {
590 for (const auto& keyAttribute : AC->getACParametersMap()) {
591 keyValuesMap[keyAttribute.first].push_back(keyAttribute.second);
592 }
593 }
594 // transform map to string vector
595 std::vector<std::pair<std::string, std::string> > keyValues;
596 for (const auto& keyAttribute : keyValuesMap) {
597 // remove duplicated values
598 std::set<std::string> valuesNonDuplicated;
599 for (const auto& value : keyAttribute.second) {
600 valuesNonDuplicated.insert(value);
601 }
602 // merge values
603 std::string values;
604 for (const auto& value : valuesNonDuplicated) {
605 values.append(value + " ");
606 }
607 if (!values.empty()) {
608 values.pop_back();
609 }
610 // update key values
611 keyValues.push_back(std::make_pair(keyAttribute.first, values));
612 }
613 // fill myParametersValues
615 return 1;
616}
617
618
619void
621 // set vehicle icon for this dialog
623 // create main frame
624 FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
625 // create frame for Parameters, operations and options
626 FXHorizontalFrame* horizontalFrameExtras = new FXHorizontalFrame(mainFrame, GUIDesignAuxiliarFrame);
627 // create parameters values
628 myParametersValues = new ParametersValues(horizontalFrameExtras);
629 // create vertical frame frame
630 FXVerticalFrame* verticalFrameExtras = new FXVerticalFrame(horizontalFrameExtras, GUIDesignAuxiliarVerticalFrame);
631 // create parameters operations
632 myParametersOperations = new ParametersOperations(verticalFrameExtras, this);
633 // create parameters options
634 myParametersOptions = new ParametersOptions(verticalFrameExtras);
635 // add separator
636 new FXHorizontalSeparator(mainFrame, GUIDesignHorizontalSeparator);
637 // create dialog buttons bot centered
638 FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(mainFrame, GUIDesignHorizontalFrame);
639 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
643 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
644}
645
646/****************************************************************************/
FXDEFMAP(GNEMultipleParametersDialog) GNEMultipleParametersDialogMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:991
@ MID_GNE_REMOVE_ATTRIBUTE
attribute removed
Definition GUIAppEnum.h:989
@ 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
#define GUIDesignGroupBoxFrame100
Group box design for elements of width 100.
Definition GUIDesigns.h:352
#define GUIDesignButtonIcon
button only with icon
Definition GUIDesigns.h:91
#define GUIDesignButtonAccept
Accept Button.
Definition GUIDesigns.h:156
#define GUIDesignButtonCancel
Cancel Button.
Definition GUIDesigns.h:162
#define GUIDesignTextField
Definition GUIDesigns.h:59
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:399
#define GUIDesignDialogBox
Definition GUIDesigns.h:599
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:74
#define GUIDesignButtonOK
Definition GUIDesigns.h:153
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:408
#define GUIDesignLabelThick(justify)
label extended over frame with thick and with text justify to left
Definition GUIDesigns.h:249
#define GUIDesignGroupBoxFrameFill
Group box design extended over frame (X and Y)
Definition GUIDesigns.h:349
#define GUIDesignButtonReset
Reset Button.
Definition GUIDesigns.h:165
#define GUIDesignHorizontalSeparator
Definition GUIDesigns.h:463
#define GUIDesignButtonFixed(width)
button rectangular with thick and raise frame with the given width
Definition GUIDesigns.h:97
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:390
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:252
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
Definition GUIDesigns.h:328
#define GUIDesignCheckButtonExtraHeight
checkButton placed in left position with double size
Definition GUIDesigns.h:198
#define GUIDesignDialogBoxExplicitStretchable(width, height)
design for dialog box with specific width and height that can be stretched (But not shrunk)
Definition GUIDesigns.h:617
#define GUIDesignLabelIconThick
label squared over frame with thick and with text justify to center
Definition GUIDesigns.h:255
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition GUIDesigns.h:279
FXString gCurrentFolder
The folder used as last.
@ CLEANJUNCTIONS
@ GREENVEHICLE
@ OPEN
open icons
@ SAVE
save icons
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:288
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:290
#define WRITE_WARNING(msg)
Definition MsgHandler.h:287
#define TL(string)
Definition MsgHandler.h:305
@ 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
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
const std::vector< GNEAttributeCarrier * > & getEditedAttributeCarriers() const
get edited attribute carriers
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:155
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 *)
event after press accept button
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
GNEAttributesEditorType * myAttributesEditor
FOX need this.
GNEMultipleParametersDialog(GNEAttributesEditorType *attributesEditor)
Constructor for parameter editor inspector.
ParametersOptions * myParametersOptions
pointer to parameters options
ParametersValues * myParametersValues
pointer to parameters values
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
void runInternalTest(const InternalTestStep::DialogTest *modalArguments)
run internal test
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...
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
GNEUndoList * getUndoList() const
get the undoList object
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
dialog arguments (used for certain functions that opens modal dialogs)
MFXDialogBox()
FOX needs this.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extensions, FXIcon *icon, FXString &currentFolder)
Returns the file name to write.
Definition MFXUtils.cpp:116
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 StringBijection< XMLFileExtension > XMLFileExtensions
XML file Extensions.
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.