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/GNEUndoList.h>
28#include <utils/xml/XMLSubSys.h>
29
31
32// ===========================================================================
33// FOX callback mapping
34// ===========================================================================
35
36FXDEFMAP(GNEMultipleParametersDialog) GNEMultipleParametersDialogMap[] = {
40 FXMAPFUNC(SEL_CHORE, FXDialogBox::ID_CANCEL, GNEMultipleParametersDialog::onCmdCancel),
41 FXMAPFUNC(SEL_TIMEOUT, FXDialogBox::ID_CANCEL, GNEMultipleParametersDialog::onCmdCancel),
42 FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_CANCEL, GNEMultipleParametersDialog::onCmdCancel),
43 FXMAPFUNC(SEL_CLOSE, 0, GNEMultipleParametersDialog::onCmdCancel),
44};
45
51
59
60// Object implementation
61FXIMPLEMENT(GNEMultipleParametersDialog, GNEDialog, GNEMultipleParametersDialogMap, ARRAYNUMBER(GNEMultipleParametersDialogMap))
62FXIMPLEMENT(GNEMultipleParametersDialog::ParametersValues, FXGroupBox, ParametersValuesMap, ARRAYNUMBER(ParametersValuesMap))
63FXIMPLEMENT(GNEMultipleParametersDialog::ParametersOperations, FXGroupBox, ParametersOperationsMap, ARRAYNUMBER(ParametersOperationsMap))
64
65// ===========================================================================
66// member method definitions
67// ===========================================================================
68
69// ---------------------------------------------------------------------------
70// GNEMultipleParametersDialog::ParametersValues - methods
71// ---------------------------------------------------------------------------
72
74 FXGroupBox(frame, "Parameters", GUIDesignGroupBoxFrameFill) {
75 // create labels for keys and values
76 FXHorizontalFrame* horizontalFrameLabels = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
77 myKeyLabel = new FXLabel(horizontalFrameLabels, "key", nullptr, GUIDesignLabelThickedFixed(100));
78 new FXLabel(horizontalFrameLabels, "value", nullptr, GUIDesignLabelThick(JUSTIFY_NORMAL));
79 new FXLabel(horizontalFrameLabels, "", nullptr, GUIDesignLabelIconThick);
80 // create scroll windows
81 FXScrollWindow* scrollWindow = new FXScrollWindow(this, LAYOUT_FILL);
82 // create vertical frame for rows
83 myVerticalFrameRow = new FXVerticalFrame(scrollWindow, GUIDesignAuxiliarFrame);
84}
85
86
88
89
90void
91GNEMultipleParametersDialog::ParametersValues::setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters) {
92 // clear rows
93 clearParameters();
94 // iterate over parameteres
95 for (const auto& newParameter : newParameters) {
96 addParameter(newParameter);
97 }
98}
99
100
101void
102GNEMultipleParametersDialog::ParametersValues::addParameter(std::pair<std::string, std::string> newParameter) {
103 // enable last row
104 myParameterRows.back()->enableRow(newParameter.first, newParameter.second);
105 // add row
106 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
107 // enable add button in the last row
108 myParameterRows.back()->toggleAddButton();
109}
110
111
112void
114 // iterate over all rows
115 for (const auto& parameterRow : myParameterRows) {
116 delete parameterRow;
117 }
118 //clear myParameterRows;
119 myParameterRows.clear();
120 // add row
121 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
122 // enable add button in the last row
123 myParameterRows.back()->toggleAddButton();
124}
125
126
127const std::vector<GNEMultipleParametersDialog::ParametersValues::ParameterRow*>
131
132
133bool
135 // just interate over myParameterRows and compare key
136 for (const auto& row : myParameterRows) {
137 if (row->keyField->getText().text() == key) {
138 return true;
139 }
140 }
141 return false;
142}
143
144
145long
147 // size of key label has to be updated in every interation
148 if (myParameterRows.size() > 0) {
149 myKeyLabel->setWidth(myParameterRows.front()->keyField->getWidth());
150 }
151 return FXGroupBox::onPaint(o, f, p);
152}
153
154
155long
157 // find what value was changed
158 for (int i = 0; i < (int)myParameterRows.size(); i++) {
159 if (myParameterRows.at(i)->keyField == obj) {
160 // change color of text field depending if key is valid or empty
161 if (myParameterRows.at(i)->keyField->getText().empty() || SUMOXMLDefinitions::isValidParameterKey(myParameterRows.at(i)->keyField->getText().text())) {
162 myParameterRows.at(i)->keyField->setTextColor(GUIDesignTextColorBlue);
163 myParameterRows.at(i)->valueChanged = true;
164 } else {
165 myParameterRows.at(i)->keyField->setTextColor(GUIDesignTextColorRed);
166 myParameterRows.at(i)->keyField->killFocus();
167 }
168 } else if (myParameterRows.at(i)->valueField == obj) {
169 myParameterRows.at(i)->valueField->setTextColor(GUIDesignTextColorBlue);
170 myParameterRows.at(i)->valueChanged = true;
171 }
172 }
173 return 1;
174}
175
176
177long
179 // first check if add button was pressed
180 if (myParameterRows.back()->button == obj) {
181 // create new parameter
182 addParameter(std::make_pair("", ""));
183 return 1;
184 } else {
185 // in other case, button press was a "remove button". Find id and remove the Parameter
186 for (int i = 0; i < (int)myParameterRows.size(); i++) {
187 if (myParameterRows.at(i)->button == obj) {
188 // delete row
189 delete myParameterRows.at(i);
190 // just remove row
191 myParameterRows.erase(myParameterRows.begin() + i);
192 return 1;
193 }
194 }
195 }
196 // Nothing to do
197 return 1;
198}
199
200
202 valueChanged(false) {
203 horizontalFrame = new FXHorizontalFrame(verticalFrameParent, GUIDesignAuxiliarHorizontalFrame);
207 // only create elements if vertical frame was previously created
208 if (verticalFrameParent->id()) {
209 horizontalFrame->create();
210 }
211 // by defaults rows are disabled
212 disableRow();
213}
214
215
217 // simply delete horizontalFrame (rest of elements will be automatic deleted due they are children of horizontal frame)
218 delete horizontalFrame;
219}
220
221
222void
224 // hide all
225 keyField->setText("");
226 keyField->disable();
227 valueField->setText("");
228 valueField->disable();
229 button->disable();
230 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
231}
232
233
234void
235GNEMultipleParametersDialog::ParametersValues::ParameterRow::enableRow(const std::string& parameter, const std::string& value) const {
236 // restore color and enable key field
237 keyField->setText(parameter.c_str());
238 if (parameter.empty() || SUMOXMLDefinitions::isValidParameterKey(parameter)) {
239 keyField->setTextColor(GUIDesignTextColorBlack);
240 } else {
241 keyField->setTextColor(GUIDesignTextColorRed);
242 }
243 keyField->enable();
244 // restore color and enable value field
245 valueField->setText(value.c_str());
246 valueField->enable();
247 // enable button and set icon remove
248 button->enable();
249 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
250}
251
252
253void
255 // clear and disable parameter and value fields
256 keyField->setText("");
257 keyField->disable();
258 valueField->setText("");
259 valueField->disable();
260 // enable remove button and set "add" icon and focus
261 button->enable();
262 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::ADD));
263 button->setFocus();
264}
265
266
267bool
271
272
273void
275 keyField->setText(other.keyField->getText());
276 valueField->setText(other.valueField->getText());
277}
278
279// ---------------------------------------------------------------------------
280// GNEMultipleParametersDialog::ParametersOperations - methods
281// ---------------------------------------------------------------------------
282
293
294
296
297
298long
300 // get the Additional file name
301 FXFileDialog opendialog(this, TL("Open Parameter Template"));
303 opendialog.setSelectMode(SELECTFILE_EXISTING);
304 opendialog.setPatternList(SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str());
305 if (gCurrentFolder.length() != 0) {
306 opendialog.setDirectory(gCurrentFolder);
307 }
308 if (opendialog.execute()) {
309 gCurrentFolder = opendialog.getDirectory();
310 std::string file = opendialog.getFilename().text();
311 // save current number of parameters
312 const int numberOfParametersbeforeLoad = (int)myParameterDialogParent->myParametersValues->getParameterRows().size();
313 // Create additional handler and run parser
314 GNEParameterHandler handler(this, file);
315 if (!XMLSubSys::runParser(handler, file, false)) {
316 WRITE_MESSAGEF(TL("Loading of Parameters From % failed."), file);
317 }
318 // show loaded attributes
319 WRITE_MESSAGEF(TL("Loaded % Parameters."), toString((int)myParameterDialogParent->myParametersValues->getParameterRows().size() - numberOfParametersbeforeLoad));
320 }
321 return 1;
322}
323
324
325long
327 // obtain file to save parameters
328 FXString file = MFXUtils::getFilename2Write(this,
329 TL("Save Parameter Template file"),
330 SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str(),
333 if (file == "") {
334 // None parameter file was selected, then stop function
335 return 1;
336 } else {
337 // open device
338 OutputDevice& device = OutputDevice::getDevice(file.text());
339 // write header
340 device.writeXMLHeader("Parameter", "parameter_file.xsd");
341 // iterate over all parameters and save it in the filename
342 for (const auto& row : myParameterDialogParent->myParametersValues->getParameterRows()) {
343 // write all except last
344 if (row != myParameterDialogParent->myParametersValues->getParameterRows().back()) {
345 // open tag
346 device.openTag(SUMO_TAG_PARAM);
347 // write key
348 device.writeAttr(SUMO_ATTR_KEY, row->keyField->getText().text());
349 // write value
350 device.writeAttr(SUMO_ATTR_VALUE, row->valueField->getText().text());
351 // close tag
352 device.closeTag();
353 }
354 }
355 // close device
356 device.close();
357 }
358 return 1;
359}
360
361
362long
364 // simply clear parameters from ParametersValues
365 myParameterDialogParent->myParametersValues->clearParameters();
366 return 1;
367}
368
369
370long
372 // declare two containers for parameters
373 std::vector<std::pair<std::string, std::string> > nonEmptyKeyValues;
374 std::vector<std::string> emptyKeyValues;
375 // first extract empty values
376 for (const auto& parameterRow : myParameterDialogParent->myParametersValues->getParameterRows()) {
377 // check if key is empty
378 if (!parameterRow->keyField->getText().empty()) {
379 nonEmptyKeyValues.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
380 } else if (!parameterRow->valueField->getText().empty()) {
381 emptyKeyValues.push_back(parameterRow->valueField->getText().text());
382 }
383 }
384 // sort non-empty parameters
385 std::sort(nonEmptyKeyValues.begin(), nonEmptyKeyValues.end());
386 // sort non-empty parameters
387 std::sort(emptyKeyValues.begin(), emptyKeyValues.end());
388 // add values without key
389 for (const auto& emptyKeyValue : emptyKeyValues) {
390 nonEmptyKeyValues.push_back(std::make_pair("", emptyKeyValue));
391 }
392 // finally setparameters in myParametersValues
393 myParameterDialogParent->myParametersValues->setParameters(nonEmptyKeyValues);
394 return 1;
395}
396
397
398long
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 (@$%^&/|\\....)");
407 // create help dialog
408 GNEHelpBasicDialog(myParameterDialogParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows(),
409 TL("Parameters Help"), help);
410 return 1;
411}
412
413
415 SUMOSAXHandler(file),
416 myParametersOperationsParent(ParametersOperationsParent) {
417}
418
419
421
422
423void
425 // only continue if tag is valid
426 if (element == SUMO_TAG_PARAM) {
427 // Check that format of Parameter is correct
428 if (!attrs.hasAttribute(SUMO_ATTR_KEY)) {
429 WRITE_WARNING(TL("Key of Parameter not defined"));
430 } else if (!attrs.hasAttribute(SUMO_ATTR_VALUE)) {
431 WRITE_WARNING(TL("Value of Parameter not defined"));
432 } else {
433 // obtain Key and value
434 const std::string key = attrs.getString(SUMO_ATTR_KEY);
435 const std::string value = attrs.getString(SUMO_ATTR_VALUE);
436 // check that parsed values are correct
438 if (key.size() == 0) {
439 WRITE_WARNING(TL("Key of Parameter cannot be empty"));
440 } else {
441 WRITE_WARNINGF(TL("Key '%' of Parameter contains invalid characters"), key);
442 }
443 } else if (myParametersOperationsParent->myParameterDialogParent->myParametersValues->keyExist(key)) {
444 WRITE_WARNINGF(TL("Key '%' already exist"), key);
445 } else {
446 // add parameter to vector of myParameterDialogParent
447 myParametersOperationsParent->myParameterDialogParent->myParametersValues->addParameter(std::make_pair(key, value));
448 }
449 }
450 }
451}
452
453// ---------------------------------------------------------------------------
454// GNEMultipleParametersDialog::ParametersOptions - methods
455// ---------------------------------------------------------------------------
456
458 FXGroupBox(frame, "Options", GUIDesignGroupBoxFrame100) {
459 myOnlyForExistentKeys = new FXCheckButton(this, TL("Only for\nexistent keys"), this, MID_GNE_SET_ATTRIBUTE_BOOL, GUIDesignCheckButtonExtraHeight);
460}
461
462
464
465
466bool
468 return (myOnlyForExistentKeys->getCheck() == TRUE);
469}
470
471// ---------------------------------------------------------------------------
472// GNEMultipleParametersDialog - methods
473// ---------------------------------------------------------------------------
474
476 GNEDialog(attributesEditor->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows(),
479 myAttributesEditor(attributesEditor) {
480 // create frame for Parameters, operations and options
481 FXHorizontalFrame* horizontalFrame = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarFrame);
482 // create parameters values
483 myParametersValues = new ParametersValues(horizontalFrame);
484 // create vertical frame frame
485 FXVerticalFrame* verticalFrame = new FXVerticalFrame(horizontalFrame, GUIDesignAuxiliarVerticalFrame);
486 // create parameters operations
487 myParametersOperations = new ParametersOperations(verticalFrame, this);
488 // create parameters options
489 myParametersOptions = new ParametersOptions(verticalFrame);
490 // reset
491 onCmdReset(nullptr, 0, nullptr);
492 // open modal dialog
493 openDialog();
494}
495
496
498
499
500void
502 // nothing to do
503}
504
505
506long
507GNEMultipleParametersDialog::onCmdAccept(FXObject*, FXSelector, void*) {
508 const auto& inspectedElements = myAttributesEditor->getFrameParent()->getViewNet()->getInspectedElements();
509 if (inspectedElements.isInspectingElements()) {
510 // get undo list
512 // declare vector for parameters in stringvector format
513 std::vector<std::pair<std::string, std::string> > parametersChanged;
514 // declare keep keys vector
515 std::vector<std::string> keepKeys;
516 // check if all edited parameters are valid
517 for (const auto& parameterRow : myParametersValues->getParameterRows()) {
518 // ignore last row
519 if (parameterRow != myParametersValues->getParameterRows().back()) {
520 // insert in keepKeys
521 keepKeys.push_back(parameterRow->keyField->getText().text());
522 // continue if we're going to modify key
523 if (parameterRow->valueChanged) {
524 if (parameterRow->keyField->getText().empty()) {
525 // open warning Box
526 GNEWarningBasicDialog(myApplicationWindow, TL("Empty Parameter key"), TL("Parameters with empty keys aren't allowed"));
527 return 1;
528 } else if (!SUMOXMLDefinitions::isValidParameterKey(parameterRow->keyField->getText().text())) {
529 // open warning Box
530 GNEWarningBasicDialog(myApplicationWindow, TL("Invalid Parameter key"), TL("There are keys with invalid characters"));
531 return 1;
532 }
533 // insert in parameters
534 parametersChanged.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
535 }
536 }
537 }
538 // sort sortedParameters
539 std::sort(parametersChanged.begin(), parametersChanged.end());
540 // check if there is duplicated keys
541 for (auto i = parametersChanged.begin(); i != parametersChanged.end(); i++) {
542 if (((i + 1) != parametersChanged.end()) && (i->first) == (i + 1)->first) {
543 // open warning Box
544 GNEWarningBasicDialog(myApplicationWindow, TL("Duplicated Parameters"), TL("Parameters with the same Key aren't allowed"));
545 return 1;
546 }
547 }
548 // begin change
549 undoList->begin(inspectedElements.getFirstAC(), "change parameters");
550 // iterate over ACs
551 for (const auto& AC : inspectedElements.getACs()) {
552 // remove keys
553 AC->removeACParametersKeys(keepKeys, undoList);
554 // update parameters
555 for (const auto& parameter : parametersChanged) {
556 if (myParametersOptions->onlyForExistentKeys() && (AC->getACParametersMap().count(parameter.first) == 0)) {
557 continue;
558 } else {
559 AC->addACParameters(parameter.first, parameter.second, undoList);
560 }
561 }
562 }
563 // end change
564 undoList->end();
565 }
566 // all ok, then close dialog
567 getApp()->stopModal(this, TRUE);
568 return 1;
569}
570
571
572long
573GNEMultipleParametersDialog::onCmdCancel(FXObject*, FXSelector, void*) {
574 // Stop Modal
575 getApp()->stopModal(this, FALSE);
576 return 1;
577}
578
579
580long
581GNEMultipleParametersDialog::onCmdReset(FXObject*, FXSelector, void*) {
582 // declare a map for key-values
583 std::map<std::string, std::vector<std::string> > keyValuesMap;
584 // fill keys
585 for (const auto& AC : myAttributesEditor->getEditedAttributeCarriers()) {
586 for (const auto& keyAttribute : AC->getACParametersMap()) {
587 keyValuesMap[keyAttribute.first].push_back(keyAttribute.second);
588 }
589 }
590 // transform map to string vector
591 std::vector<std::pair<std::string, std::string> > keyValues;
592 for (const auto& keyAttribute : keyValuesMap) {
593 // remove duplicated values
594 std::set<std::string> valuesNonDuplicated;
595 for (const auto& value : keyAttribute.second) {
596 valuesNonDuplicated.insert(value);
597 }
598 // merge values
599 std::string values;
600 for (const auto& value : valuesNonDuplicated) {
601 values.append(value + " ");
602 }
603 if (!values.empty()) {
604 values.pop_back();
605 }
606 // update key values
607 keyValues.push_back(std::make_pair(keyAttribute.first, values));
608 }
609 // fill myParametersValues
611 return 1;
612}
613
614/****************************************************************************/
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:365
#define GUIDesignTextColorRed
red color (for invalid text)
Definition GUIDesigns.h:44
#define GUIDesignButtonIcon
button only with icon
Definition GUIDesigns.h:106
#define GUIDesignTextField
Definition GUIDesigns.h:74
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:418
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:89
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:427
#define GUIDesignTextColorBlue
blue color (for default text)
Definition GUIDesigns.h:41
#define GUIDesignLabelThick(justify)
label extended over frame with thick and with text justify to left
Definition GUIDesigns.h:245
#define GUIDesignTextColorBlack
black color (for correct text)
Definition GUIDesigns.h:38
#define GUIDesignGroupBoxFrameFill
Group box design extended over frame (X and Y)
Definition GUIDesigns.h:362
#define GUIDesignButtonFixed(width)
button rectangular with thick and raise frame with the given width
Definition GUIDesigns.h:112
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:403
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:248
#define GUIDesignCheckButtonExtraHeight
checkButton placed in left position with double size
Definition GUIDesigns.h:194
#define GUIDesignLabelIconThick
label squared over frame with thick and with text justify to center
Definition GUIDesigns.h:251
FXString gCurrentFolder
The folder used as last.
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ 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
FXVerticalFrame * myContentFrame
content frame
Definition GNEDialog.h:136
GNEApplicationWindow * myApplicationWindow
FOX needs this.
Definition GNEDialog.h:133
OpenType
Open dialog type.
Definition GNEDialog.h:56
void openDialog()
open dialog
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:152
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
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
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...
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 modal dialogs that can not be edited using tab
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.