Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNESingleParametersDialog.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 parameters
19/****************************************************************************/
20
24#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
31#include <utils/xml/XMLSubSys.h>
32
34
35// ===========================================================================
36// FOX callback mapping
37// ===========================================================================
38
39FXDEFMAP(GNESingleParametersDialog) GNESingleParametersDialogMap[] = {
43 FXMAPFUNC(SEL_CHORE, FXDialogBox::ID_CANCEL, GNESingleParametersDialog::onCmdCancel),
44 FXMAPFUNC(SEL_TIMEOUT, FXDialogBox::ID_CANCEL, GNESingleParametersDialog::onCmdCancel),
45 FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_CANCEL, GNESingleParametersDialog::onCmdCancel),
46 FXMAPFUNC(SEL_CLOSE, 0, GNESingleParametersDialog::onCmdCancel),
47};
48
54
62
63// Object implementation
64FXIMPLEMENT(GNESingleParametersDialog, MFXDialogBox, GNESingleParametersDialogMap, ARRAYNUMBER(GNESingleParametersDialogMap))
65FXIMPLEMENT(GNESingleParametersDialog::ParametersValues, FXGroupBox, ParametersValuesMap, ARRAYNUMBER(ParametersValuesMap))
66FXIMPLEMENT(GNESingleParametersDialog::ParametersOperations, FXGroupBox, ParametersOperationsMap, ARRAYNUMBER(ParametersOperationsMap))
67
68// ===========================================================================
69// member method definitions
70// ===========================================================================
71
72// ---------------------------------------------------------------------------
73// GNESingleParametersDialog::ParametersValues - methods
74// ---------------------------------------------------------------------------
75
76GNESingleParametersDialog::ParametersValues::ParametersValues(FXHorizontalFrame* frame, const std::string& name) :
77 FXGroupBox(frame, name.c_str(), GUIDesignGroupBoxFrameFill) {
78 // create labels for keys and values
79 FXHorizontalFrame* horizontalFrameLabels = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
80 myKeyLabel = new FXLabel(horizontalFrameLabels, "key", nullptr, GUIDesignLabelThickedFixed(100));
81 new FXLabel(horizontalFrameLabels, "value", nullptr, GUIDesignLabelThick(JUSTIFY_NORMAL));
82 // create scroll windows
83 FXScrollWindow* scrollWindow = new FXScrollWindow(this, LAYOUT_FILL);
84 // create vertical frame for rows
85 myVerticalFrameRow = new FXVerticalFrame(scrollWindow, GUIDesignAuxiliarFrame);
86}
87
88
90
91
92void
93GNESingleParametersDialog::ParametersValues::setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters) {
94 // clear rows
95 clearParameters();
96 // iterate over parameteres
97 for (const auto& newParameter : newParameters) {
98 addParameter(newParameter);
99 }
100}
101
102
103void
104GNESingleParametersDialog::ParametersValues::addParameter(std::pair<std::string, std::string> newParameter) {
105 // enable last row
106 myParameterRows.back()->enableRow(newParameter.first, newParameter.second);
107 // add row
108 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
109 // enable add button in the last row
110 myParameterRows.back()->toggleAddButton();
111}
112
113
114void
116 // iterate over all rows
117 for (const auto& parameterRow : myParameterRows) {
118 delete parameterRow;
119 }
120 //clear myParameterRows;
121 myParameterRows.clear();
122 // add row
123 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
124 // enable add button in the last row
125 myParameterRows.back()->toggleAddButton();
126}
127
128
129const std::vector<GNESingleParametersDialog::ParametersValues::ParameterRow*>
131 return myParameterRows;
132}
133
134
135bool
137 // just interate over myParameterRows and compare key
138 for (const auto& row : myParameterRows) {
139 if (row->keyField->getText().text() == key) {
140 return true;
141 }
142 }
143 return false;
144}
145
146
147long
148GNESingleParametersDialog::ParametersValues::onPaint(FXObject* o, FXSelector f, void* p) {
149 // size of key label has to be updated in every interation
150 if (myParameterRows.size() > 0) {
151 myKeyLabel->setWidth(myParameterRows.front()->keyField->getWidth());
152 }
153 return FXGroupBox::onPaint(o, f, p);
154}
155
156
157long
159 // find what value was changed
160 for (int i = 0; i < (int)myParameterRows.size(); i++) {
161 if (myParameterRows.at(i)->keyField == obj) {
162 // change color of text field depending if key is valid or empty
163 if (myParameterRows.at(i)->keyField->getText().empty() || SUMOXMLDefinitions::isValidParameterKey(myParameterRows.at(i)->keyField->getText().text())) {
164 myParameterRows.at(i)->keyField->setTextColor(FXRGB(0, 0, 0));
165 } else {
166 myParameterRows.at(i)->keyField->setTextColor(FXRGB(255, 0, 0));
167 myParameterRows.at(i)->keyField->killFocus();
168 }
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 horizontalFrame = new FXHorizontalFrame(verticalFrameParent, GUIDesignAuxiliarHorizontalFrame);
201 keyField = new FXTextField(horizontalFrame, GUIDesignTextFieldNCol, ParametersValues, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
202 valueField = new FXTextField(horizontalFrame, GUIDesignTextFieldNCol, ParametersValues, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
204 // only create elements if vertical frame was previously created
205 if (verticalFrameParent->id()) {
206 horizontalFrame->create();
207 }
208 // by defaults rows are disabled
209 disableRow();
210}
211
212
214 // simply delete horizontalFrame (rest of elements will be automatic deleted due they are children of horizontal frame)
215 delete horizontalFrame;
216}
217
218
219void
221 // hide all
222 keyField->setText("");
223 keyField->disable();
224 valueField->setText("");
225 valueField->disable();
226 button->disable();
227 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
228}
229
230
231void
232GNESingleParametersDialog::ParametersValues::ParameterRow::enableRow(const std::string& parameter, const std::string& value) const {
233 // restore color and enable key field
234 keyField->setText(parameter.c_str());
235 if (parameter.empty() || SUMOXMLDefinitions::isValidParameterKey(parameter)) {
236 keyField->setTextColor(FXRGB(0, 0, 0));
237 } else {
238 keyField->setTextColor(FXRGB(255, 0, 0));
239 }
240 keyField->enable();
241 // restore color and enable value field
242 valueField->setText(value.c_str());
243 valueField->enable();
244 // enable button and set icon remove
245 button->enable();
246 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
247}
248
249
250void
252 // clear and disable parameter and value fields
253 keyField->setText("");
254 keyField->disable();
255 valueField->setText("");
256 valueField->disable();
257 // enable remove button and set "add" icon and focus
258 button->enable();
259 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::ADD));
260 button->setFocus();
261}
262
263
264bool
268
269
270void
272 keyField->setText(other.keyField->getText());
273 valueField->setText(other.valueField->getText());
274}
275
276// ---------------------------------------------------------------------------
277// GNESingleParametersDialog::ParametersOperations - methods
278// ---------------------------------------------------------------------------
279
290
291
293
294
295long
297 // get the Additional file name
298 FXFileDialog opendialog(this, TL("Open Parameter Template"));
300 opendialog.setSelectMode(SELECTFILE_EXISTING);
301 opendialog.setPatternList(SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str());
302 if (gCurrentFolder.length() != 0) {
303 opendialog.setDirectory(gCurrentFolder);
304 }
305 if (opendialog.execute()) {
306 gCurrentFolder = opendialog.getDirectory();
307 std::string file = opendialog.getFilename().text();
308 // save current number of parameters
309 const int numberOfParametersbeforeLoad = (int)myParameterDialogParent->myParametersValues->getParameterRows().size();
310 // Create additional handler and run parser
311 GNEParameterHandler handler(this, file);
312 if (!XMLSubSys::runParser(handler, file, false)) {
313 WRITE_MESSAGEF(TL("Loading of Parameters From % failed."), file);
314 }
315 // show loaded attributes
316 WRITE_MESSAGEF(TL("Loaded % Parameters."), toString((int)myParameterDialogParent->myParametersValues->getParameterRows().size() - numberOfParametersbeforeLoad));
317 }
318 return 1;
319}
320
321
322long
324 // obtain file to save parameters
325 FXString file = MFXUtils::getFilename2Write(this,
326 TL("Save Parameter Template file"),
327 SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str(),
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 MFXDialogBox* ParameterHelpDialog = new MFXDialogBox(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 GUIDesigns::buildFXButton(myHorizontalFrameOKButton, TL("OK"), "", TL("close"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), ParameterHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
416 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
417 // create Dialog
418 ParameterHelpDialog->create();
419 // show in the given position
420 ParameterHelpDialog->show(PLACEMENT_CURSOR);
421 // refresh APP
422 getApp()->refresh();
423 // open as modal dialog (will block all windows until stop() or stopModal() is called)
424 getApp()->runModalFor(ParameterHelpDialog);
425 return 1;
426}
427
428
430 SUMOSAXHandler(file),
431 myParametersOperationsParent(ParametersOperationsParent) {
432}
433
434
436
437
438void
440 // only continue if tag is valid
441 if (element != SUMO_TAG_NOTHING) {
442 // Call parse and build depending of tag
443 switch (element) {
444 case SUMO_TAG_PARAM:
445 // Check that format of Parameter is correct
446 if (!attrs.hasAttribute(SUMO_ATTR_KEY)) {
447 WRITE_WARNING(TL("Key of Parameter not defined"));
448 } else if (!attrs.hasAttribute(SUMO_ATTR_VALUE)) {
449 WRITE_WARNING(TL("Value of Parameter not defined"));
450 } else {
451 // obtain Key and value
452 std::string key = attrs.getString(SUMO_ATTR_KEY);
453 std::string value = attrs.getString(SUMO_ATTR_VALUE);
454 // check that parsed values are correct
456 if (key.size() == 0) {
457 WRITE_WARNING(TL("Key of Parameter cannot be empty"));
458 } else {
459 WRITE_WARNINGF(TL("Key '%' of Parameter contains invalid characters"), key);
460 }
461 } else if (myParametersOperationsParent->myParameterDialogParent->myParametersValues->keyExist(key)) {
462 WRITE_WARNINGF(TL("Key '%' already exist"), key);
463 } else {
464 // add parameter to vector of myParameterDialogParent
465 myParametersOperationsParent->myParameterDialogParent->myParametersValues->addParameter(std::make_pair(key, value));
466 }
467 }
468 break;
469 default:
470 break;
471 }
472 }
473}
474
475// ---------------------------------------------------------------------------
476// GNESingleParametersDialog - methods
477// ---------------------------------------------------------------------------
478
480 MFXDialogBox(attributesEditor->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getApp(), "Edit parameters", GUIDesignDialogBoxExplicitStretchable(400, 300)),
481 myAttributesEditor(attributesEditor) {
482 // call auxiliar constructor
483 constructor("Parameters");
484 // fill myParametersValues
485 myParametersValues->setParameters(attributesEditor->getEditedAttributeCarriers().front()->getACParameters<std::vector<std::pair<std::string, std::string> > >());
486}
487
488
490 MFXDialogBox(viewNet->getApp(), "Edit parameters", GUIDesignDialogBoxExplicitStretchable(400, 300)),
491 VTypeAttributeRow(VTypeAttributeRow) {
492 // call auxiliar constructor
493 constructor("Parameters");
494 // fill myEditedParameters
496}
497
498
500 MFXDialogBox(attributeCarrier->getNet()->getViewNet()->getApp(), "Edit parameters", GUIDesignDialogBoxExplicitStretchable(400, 300)),
501 myAttributeCarrier(attributeCarrier) {
502 // call auxiliar constructor
503 constructor("Parameters");
504 // fill myEditedParameters
505 myParametersValues->setParameters(myAttributeCarrier->getACParameters<std::vector<std::pair<std::string, std::string> > >());
506}
507
508
510 MFXDialogBox(app, "Edit parameters", GUIDesignDialogBoxExplicitStretchable(400, 300)),
511 myTLDef(TLDef) {
512 // call auxiliar constructor
513 constructor("Parameters");
514 // transform parameters to a=b|c=d... format
515 std::vector<std::pair<std::string, std::string> > parametersStr;
516 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
517 for (const auto& parameter : TLDef->getParametersMap()) {
518 parametersStr.push_back(std::make_pair(parameter.first, parameter.second));
519 }
520 // set parameters
521 myParametersValues->setParameters(parametersStr);
522}
523
524
526
527
528void
532
533
534long
535GNESingleParametersDialog::onCmdAccept(FXObject*, FXSelector, void*) {
536 // declare vector for parameters in stringvector format
537 std::vector<std::pair<std::string, std::string> > parameters;
538 // check if all edited parameters are valid
539 for (const auto& parameterRow : myParametersValues->getParameterRows()) {
540 // ignore last row
541 if (parameterRow != myParametersValues->getParameterRows().back()) {
542 if (parameterRow->keyField->getText().empty()) {
543 // open warning Box
544 FXMessageBox::warning(getApp(), MBOX_OK, "Empty Parameter key", "%s", "Parameters with empty keys aren't allowed");
545 return 1;
546 } else if (!SUMOXMLDefinitions::isValidParameterKey(parameterRow->keyField->getText().text())) {
547 // open warning Box
548 FXMessageBox::warning(getApp(), MBOX_OK, "Invalid Parameter key", "%s", "There are keys with invalid characters");
549 return 1;
550 }
551 // insert in parameters
552 parameters.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
553 }
554 }
555 // sort sortedParameters
556 std::sort(parameters.begin(), parameters.end());
557 // check if there is duplicated keys
558 for (auto i = parameters.begin(); i != parameters.end(); i++) {
559 if (((i + 1) != parameters.end()) && (i->first) == (i + 1)->first) {
560 // open warning Box
561 FXMessageBox::warning(getApp(), MBOX_OK, "Duplicated Parameters", "%s", "Parameters with the same Key aren't allowed");
562 return 1;
563 }
564 }
565 // set parameters in Parameters editor parents
566 if (myAttributesEditor) {
567 auto editedAC = myAttributesEditor->getEditedAttributeCarriers().front();
568 // set parameter in AC using undoList
569 myAttributesEditor->getFrameParent()->getViewNet()->getUndoList()->begin(editedAC, "change parameters");
570 editedAC->setACParameters(parameters, myAttributesEditor->getFrameParent()->getViewNet()->getUndoList());
572 } else if (VTypeAttributeRow) {
573 // set parameter in VTypeAttributeRow
574 VTypeAttributeRow->setParameters(parameters);
575 } else if (myAttributeCarrier) {
576 // set parameter in AC using undoList
580 } else if (myTLDef) {
582 for (const auto& parameter : parameters) {
583 myTLDef->setParameter(parameter.first, parameter.second);
584 }
585 }
586 // all ok, then close dialog
587 getApp()->stopModal(this, TRUE);
588 return 1;
589}
590
591
592long
593GNESingleParametersDialog::onCmdCancel(FXObject*, FXSelector, void*) {
594 // Stop Modal
595 getApp()->stopModal(this, FALSE);
596 return 1;
597}
598
599
600long
601GNESingleParametersDialog::onCmdReset(FXObject*, FXSelector, void*) {
602 // restore original parameters
603 if (myAttributesEditor) {
604 myParametersValues->setParameters(myAttributesEditor->getEditedAttributeCarriers().front()->getACParameters<std::vector<std::pair<std::string, std::string> > >());
605 } else if (VTypeAttributeRow) {
607 } else if (myAttributeCarrier) {
608 myParametersValues->setParameters(myAttributeCarrier->getACParameters<std::vector<std::pair<std::string, std::string> > >());
609 } else if (myTLDef) {
610 // transform parameters to a=b|c=d... format
611 std::vector<std::pair<std::string, std::string> > parametersStr;
612 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
613 for (const auto& parameter : myTLDef->getParametersMap()) {
614 parametersStr.push_back(std::make_pair(parameter.first, parameter.second));
615 }
616 // set parameters
617 myParametersValues->setParameters(parametersStr);
618 }
619 return 1;
620}
621
622
623void
625 // set vehicle icon for this dialog
627 // create main frame
628 FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
629 // create frame for Parameters and operations
630 FXHorizontalFrame* horizontalFrameExtras = new FXHorizontalFrame(mainFrame, GUIDesignAuxiliarFrame);
631 // create parameters values
632 myParametersValues = new ParametersValues(horizontalFrameExtras, name);
633 // create parameters operations
634 myParametersOperations = new ParametersOperations(horizontalFrameExtras, this);
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(GNESingleParametersDialog) GNESingleParametersDialogMap[]
@ 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
#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 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 GUIDesignDialogBoxExplicitStretchable(width, height)
design for dialog box with specific width and height that can be stretched (But not shrunk)
Definition GUIDesigns.h:617
#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_NOTHING
invalid tag, must be the last one
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_ATTR_VALUE
@ SUMO_ATTR_KEY
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
void setACParameters(const std::string &parameters, GNEUndoList *undoList)
set parameters (string)
GNENet * getNet() const
get pointer to net
T getACParameters() const
get parameters
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
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2195
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
GNEParameterHandler(ParametersOperations *ParametersOperationsParent, const std::string &file)
Constructor.
ParametersOperations(FXHorizontalFrame *frame, GNESingleParametersDialog *ParameterDialogParent)
FOX-declaration.
long onCmdSaveParameters(FXObject *, FXSelector, void *)
event when user press save parameters button
long onCmdClearParameters(FXObject *, FXSelector, void *)
event when user press clear parameters button
long onCmdSortParameters(FXObject *, FXSelector, void *)
event when user press sort parameters button
long onCmdHelpParameter(FXObject *, FXSelector, void *)
event when user press help parameters button
bool isButtonInAddMode() const
check if remove button is in mode "add"
ParameterRow(ParametersValues *ParametersValues, FXVerticalFrame *verticalFrameParent)
constructor
void copyValues(const ParameterRow &other)
copy values of other parameter Row
void enableRow(const std::string &parameter, const std::string &value) const
enable row
long onPaint(FXObject *o, FXSelector f, void *p)
long onCmdSetAttribute(FXObject *, FXSelector, void *)
event when user change an attribute
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
void setParameters(const std::vector< std::pair< std::string, std::string > > &newParameters)
set parameters
bool keyExist(const std::string &key) const
check if given key exist already
long onCmdButtonPress(FXObject *, FXSelector, void *)
event when user press a remove (or add) button
void addParameter(std::pair< std::string, std::string > newParameter)
add a single parameter
Dialog for edit parameters.
FXButton * myResetButton
cancel button
ParametersValues * myParametersValues
pointer to parameters values
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
FXButton * myKeepOldButton
accept button
GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow * VTypeAttributeRow
pointer to VTypeAttributeRow
FXButton * myCancelButton
cancel button
GNESingleParametersDialog(GNEAttributesEditorType *attributesEditor)
Constructor for attributes editor.
void constructor(const std::string &name)
auxiliar constructor
ParametersOperations * myParametersOperations
pointer to parameters operations
GNEAttributeCarrier * myAttributeCarrier
pointer to GNEAttributeCarrier
void runInternalTest(const InternalTestStep::DialogTest *modalArguments)
run internal test
NBLoadedSUMOTLDef * myTLDef
pointer to TLDef
GNEAttributesEditorType * myAttributesEditor
FOX need this.
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept 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...
class used for represent rows with Vehicle Type parameters
std::vector< std::pair< std::string, std::string > > getParametersVectorStr() const
get parameters as vector of strings
void setParameters(const std::vector< std::pair< std::string, std::string > > &parameters)
set parameters
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
A loaded (complete) traffic light logic.
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.
void clearParameter()
Clears the parameter map.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
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.
Definition json.hpp:4471