Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEVTypeDistributionsDialog.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 VType distributions
19/****************************************************************************/
20
22#include <netedit/GNEViewNet.h>
25#include <utils/xml/XMLSubSys.h>
26
28
29// ===========================================================================
30// FOX callback mapping
31// ===========================================================================
32
33FXDEFMAP(GNEVTypeDistributionsDialog) GNEVTypeDistributionsDialogMap[] = {
36 FXMAPFUNC(SEL_CHORE, FXDialogBox::ID_CANCEL, GNEVTypeDistributionsDialog::onCmdCancel),
37 FXMAPFUNC(SEL_TIMEOUT, FXDialogBox::ID_CANCEL, GNEVTypeDistributionsDialog::onCmdCancel),
38 FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_CANCEL, GNEVTypeDistributionsDialog::onCmdCancel),
39 FXMAPFUNC(SEL_CLOSE, 0, GNEVTypeDistributionsDialog::onCmdCancel),
40};
41
47
55
56// Object implementation
57FXIMPLEMENT(GNEVTypeDistributionsDialog, MFXDialogBox, GNEVTypeDistributionsDialogMap, ARRAYNUMBER(GNEVTypeDistributionsDialogMap))
58FXIMPLEMENT(GNEVTypeDistributionsDialog::ParametersValues, FXGroupBox, ParametersValuesMap, ARRAYNUMBER(ParametersValuesMap))
59FXIMPLEMENT(GNEVTypeDistributionsDialog::ParametersOperations, FXGroupBox, ParametersOperationsMap, ARRAYNUMBER(ParametersOperationsMap))
60
61// ===========================================================================
62// member method definitions
63// ===========================================================================
64
65// ---------------------------------------------------------------------------
66// GNEVTypeDistributionsDialog::ParametersValues - methods
67// ---------------------------------------------------------------------------
68
69GNEVTypeDistributionsDialog::ParametersValues::ParametersValues(FXHorizontalFrame* frame, const std::string& name) :
70 FXGroupBox(frame, name.c_str(), GUIDesignGroupBoxFrameFill) {
71 // create labels for keys and values
72 FXHorizontalFrame* horizontalFrameLabels = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
73 myKeyLabel = new FXLabel(horizontalFrameLabels, "key", nullptr, GUIDesignLabelThickedFixed(100));
74 new FXLabel(horizontalFrameLabels, "value", nullptr, GUIDesignLabelThick(JUSTIFY_NORMAL));
75 // create scroll windows
76 FXScrollWindow* scrollWindow = new FXScrollWindow(this, LAYOUT_FILL);
77 // create vertical frame for rows
78 myVerticalFrameRow = new FXVerticalFrame(scrollWindow, GUIDesignAuxiliarFrame);
79}
80
81
83
84
85void
86GNEVTypeDistributionsDialog::ParametersValues::setParameters(const std::vector<std::pair<std::string, std::string> >& newParameters) {
87 // clear rows
88 clearParameters();
89 // iterate over parameters
90 for (const auto& newParameter : newParameters) {
91 addParameter(newParameter);
92 }
93}
94
95
96void
97GNEVTypeDistributionsDialog::ParametersValues::addParameter(std::pair<std::string, std::string> newParameter) {
98 // enable last row
99 myParameterRows.back()->enableRow(newParameter.first, newParameter.second);
100 // add row
101 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
102 // enable add button in the last row
103 myParameterRows.back()->toggleAddButton();
104}
105
106
107void
109 // iterate over all rows
110 for (const auto& parameterRow : myParameterRows) {
111 delete parameterRow;
112 }
113 //clear myParameterRows;
114 myParameterRows.clear();
115 // add row
116 myParameterRows.push_back(new ParameterRow(this, myVerticalFrameRow));
117 // enable add button in the last row
118 myParameterRows.back()->toggleAddButton();
119}
120
121
122const std::vector<GNEVTypeDistributionsDialog::ParametersValues::ParameterRow*>
126
127
128bool
130 // just iterate over myParameterRows and compare key
131 for (const auto& row : myParameterRows) {
132 if (row->keyField->getText().text() == key) {
133 return true;
134 }
135 }
136 return false;
137}
138
139
140long
142 // size of key label has to be updated in every interation
143 if (myParameterRows.size() > 0) {
144 myKeyLabel->setWidth(myParameterRows.front()->keyField->getWidth());
145 }
146 return FXGroupBox::onPaint(o, f, p);
147}
148
149
150long
152 // find what value was changed
153 for (int i = 0; i < (int)myParameterRows.size(); i++) {
154 if (myParameterRows.at(i)->keyField == obj) {
155 // change color of text field depending if key is valid or empty
156 if (myParameterRows.at(i)->keyField->getText().empty() || SUMOXMLDefinitions::isValidParameterKey(myParameterRows.at(i)->keyField->getText().text())) {
157 myParameterRows.at(i)->keyField->setTextColor(FXRGB(0, 0, 0));
158 } else {
159 myParameterRows.at(i)->keyField->setTextColor(FXRGB(255, 0, 0));
160 myParameterRows.at(i)->keyField->killFocus();
161 }
162 }
163 }
164 return 1;
165}
166
167
168long
170 // first check if add button was pressed
171 if (myParameterRows.back()->button == obj) {
172 // create new parameter
173 addParameter(std::make_pair("", ""));
174 return 1;
175 } else {
176 // in other case, button press was a "remove button". Find id and remove the Parameter
177 for (int i = 0; i < (int)myParameterRows.size(); i++) {
178 if (myParameterRows.at(i)->button == obj) {
179 // delete row
180 delete myParameterRows.at(i);
181 // just remove row
182 myParameterRows.erase(myParameterRows.begin() + i);
183 return 1;
184 }
185 }
186 }
187 // Nothing to do
188 return 1;
189}
190
191
193 horizontalFrame = new FXHorizontalFrame(verticalFrameParent, GUIDesignAuxiliarHorizontalFrame);
194 keyField = new FXTextField(horizontalFrame, GUIDesignTextFieldNCol, ParametersValues, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
195 valueField = new FXTextField(horizontalFrame, GUIDesignTextFieldNCol, ParametersValues, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
197 // only create elements if vertical frame was previously created
198 if (verticalFrameParent->id()) {
199 horizontalFrame->create();
200 }
201 // by defaults rows are disabled
202 disableRow();
203}
204
205
207 // simply delete horizontalFrame (rest of elements will be automatic deleted due they are children of horizontal frame)
208 delete horizontalFrame;
209}
210
211
212void
214 // hide all
215 keyField->setText("");
216 keyField->disable();
217 valueField->setText("");
218 valueField->disable();
219 button->disable();
220 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
221}
222
223
224void
225GNEVTypeDistributionsDialog::ParametersValues::ParameterRow::enableRow(const std::string& parameter, const std::string& value) const {
226 // restore color and enable key field
227 keyField->setText(parameter.c_str());
228 if (parameter.empty() || SUMOXMLDefinitions::isValidParameterKey(parameter)) {
229 keyField->setTextColor(FXRGB(0, 0, 0));
230 } else {
231 keyField->setTextColor(FXRGB(255, 0, 0));
232 }
233 keyField->enable();
234 // restore color and enable value field
235 valueField->setText(value.c_str());
236 valueField->enable();
237 // enable button and set icon remove
238 button->enable();
239 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::REMOVE));
240}
241
242
243void
245 // clear and disable parameter and value fields
246 keyField->setText("");
247 keyField->disable();
248 valueField->setText("");
249 valueField->disable();
250 // enable remove button and set "add" icon and focus
251 button->enable();
252 button->setIcon(GUIIconSubSys::getIcon(GUIIcon::ADD));
253 button->setFocus();
254}
255
256
257bool
261
262
263void
265 keyField->setText(other.keyField->getText());
266 valueField->setText(other.valueField->getText());
267}
268
269// ---------------------------------------------------------------------------
270// GNEVTypeDistributionsDialog::ParametersOperations - methods
271// ---------------------------------------------------------------------------
272
283
284
286
287
288long
290 // get the Additional file name
291 FXFileDialog opendialog(this, TL("Open Parameter Template"));
293 opendialog.setSelectMode(SELECTFILE_EXISTING);
294 opendialog.setPatternList(SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str());
295 if (gCurrentFolder.length() != 0) {
296 opendialog.setDirectory(gCurrentFolder);
297 }
298 if (opendialog.execute()) {
299 gCurrentFolder = opendialog.getDirectory();
300 std::string file = opendialog.getFilename().text();
301 // save current number of parameters
302 const int numberOfParametersbeforeLoad = (int)myParameterDialogParent->myParametersValues->getParameterRows().size();
303 // Create additional handler and run parser
304 GNEParameterHandler handler(this, file);
305 if (!XMLSubSys::runParser(handler, file, false)) {
306 WRITE_MESSAGEF(TL("Loading of Parameters From % failed."), file);
307 }
308 // show loaded attributes
309 WRITE_MESSAGEF(TL("Loaded % Parameters."), toString((int)myParameterDialogParent->myParametersValues->getParameterRows().size() - numberOfParametersbeforeLoad));
310 }
311 return 1;
312}
313
314
315long
317 // obtain file to save parameters
318 FXString file = MFXUtils::getFilename2Write(this, TL("Save Parameter Template file"),
319 SUMOXMLDefinitions::XMLFileExtensions.getMultilineString().c_str(),
321 if (file == "") {
322 // None parameter file was selected, then stop function
323 return 1;
324 } else {
325 // open device
326 OutputDevice& device = OutputDevice::getDevice(file.text());
327 // write header
328 device.writeXMLHeader("Parameter", "parameter_file.xsd");
329 // iterate over all parameters and save it in the filename
330 for (const auto& row : myParameterDialogParent->myParametersValues->getParameterRows()) {
331 // write all except last
332 if (row != myParameterDialogParent->myParametersValues->getParameterRows().back()) {
333 // open tag
334 device.openTag(SUMO_TAG_PARAM);
335 // write key
336 device.writeAttr(SUMO_ATTR_KEY, row->keyField->getText().text());
337 // write value
338 device.writeAttr(SUMO_ATTR_VALUE, row->valueField->getText().text());
339 // close tag
340 device.closeTag();
341 }
342 }
343 // close device
344 device.close();
345 }
346 return 1;
347}
348
349
350long
352 // simply clear parameters from ParametersValues
353 myParameterDialogParent->myParametersValues->clearParameters();
354 return 1;
355}
356
357
358long
360 // declare two containers for parameters
361 std::vector<std::pair<std::string, std::string> > nonEmptyKeyValues;
362 std::vector<std::string> emptyKeyValues;
363 // first extract empty values
364 for (const auto& parameterRow : myParameterDialogParent->myParametersValues->getParameterRows()) {
365 // check if key is empty
366 if (!parameterRow->keyField->getText().empty()) {
367 nonEmptyKeyValues.push_back(std::make_pair(parameterRow->keyField->getText().text(), parameterRow->valueField->getText().text()));
368 } else if (!parameterRow->valueField->getText().empty()) {
369 emptyKeyValues.push_back(parameterRow->valueField->getText().text());
370 }
371 }
372 // sort non-empty parameters
373 std::sort(nonEmptyKeyValues.begin(), nonEmptyKeyValues.end());
374 // sort non-empty parameters
375 std::sort(emptyKeyValues.begin(), emptyKeyValues.end());
376 // add values without key
377 for (const auto& emptyKeyValue : emptyKeyValues) {
378 nonEmptyKeyValues.push_back(std::make_pair("", emptyKeyValue));
379 }
380 // finally setparameters in myParametersValues
381 myParameterDialogParent->myParametersValues->setParameters(nonEmptyKeyValues);
382 return 1;
383}
384
385
386long
388 // Create dialog box
389 MFXDialogBox* ParameterHelpDialog = new MFXDialogBox(this, " Parameters Help", GUIDesignDialogBox);
390 ParameterHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::APP_TABLE));
391 // set help text
392 std::ostringstream help;
393 help
394 << TL("- Parameters are defined by a Key and a Value.\n")
395 << TL("- In Netedit can be defined using format key1=parameter1|key2=parameter2|...\n")
396 << TL(" - Duplicated and empty Keys aren't valid.\n")
397 << TL(" - Whitespace and certain characters aren't allowed (@$%^&/|\\....)\n");
398 // Create label with the help text
399 new FXLabel(ParameterHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
400 // Create horizontal separator
401 new FXHorizontalSeparator(ParameterHelpDialog, GUIDesignHorizontalSeparator);
402 // Create frame for OK Button
403 FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(ParameterHelpDialog, GUIDesignAuxiliarHorizontalFrame);
404 // Create Button Close (And two more horizontal frames to center it)
405 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
406 GUIDesigns::buildFXButton(myHorizontalFrameOKButton, TL("OK"), "", TL("close"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), ParameterHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
407 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
408 // create Dialog
409 ParameterHelpDialog->create();
410 // show in the given position
411 ParameterHelpDialog->show(PLACEMENT_CURSOR);
412 // refresh APP
413 getApp()->refresh();
414 // open as modal dialog (will block all windows until stop() or stopModal() is called)
415 getApp()->runModalFor(ParameterHelpDialog);
416 return 1;
417}
418
419
421 SUMOSAXHandler(file),
422 myParametersOperationsParent(ParametersOperationsParent) {
423}
424
425
427
428
429void
431 // only continue if tag is valid
432 if (element != SUMO_TAG_NOTHING) {
433 // Call parse and build depending of tag
434 switch (element) {
435 case SUMO_TAG_PARAM:
436 // Check that format of Parameter is correct
437 if (!attrs.hasAttribute(SUMO_ATTR_KEY)) {
438 WRITE_WARNING(TL("Key of Parameter not defined"));
439 } else if (!attrs.hasAttribute(SUMO_ATTR_VALUE)) {
440 WRITE_WARNING(TL("Value of Parameter not defined"));
441 } else {
442 // obtain Key and value
443 std::string key = attrs.getString(SUMO_ATTR_KEY);
444 std::string value = attrs.getString(SUMO_ATTR_VALUE);
445 // check that parsed values are correct
447 if (key.size() == 0) {
448 WRITE_WARNING(TL("Key of Parameter cannot be empty"));
449 } else {
450 WRITE_WARNINGF(TL("Key '%' of Parameter contains invalid characters"), key);
451 }
452 } else if (myParametersOperationsParent->myParameterDialogParent->myParametersValues->keyExist(key)) {
453 WRITE_WARNINGF(TL("Key '%' already exists"), key);
454 } else {
455 // add parameter to vector of myParameterDialogParent
456 myParametersOperationsParent->myParameterDialogParent->myParametersValues->addParameter(std::make_pair(key, value));
457 }
458 }
459 break;
460 default:
461 break;
462 }
463 }
464}
465
466// ---------------------------------------------------------------------------
467// GNEVTypeDistributionsDialog - methods
468// ---------------------------------------------------------------------------
469
471 MFXDialogBox(typeFrameParent->getViewNet()->getApp(), "Edit attributes", GUIDesignDialogBoxExplicitStretchable(400, 300)),
472 myTypeFrameParent(typeFrameParent) {
473 // set vehicle icon for this dialog
475 // create main frame
476 FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
477 // create frame for Parameters and operations
478 FXHorizontalFrame* horizontalFrameExtras = new FXHorizontalFrame(mainFrame, GUIDesignAuxiliarFrame);
479 // create parameters values
480 myParametersValues = new ParametersValues(horizontalFrameExtras, "test");
481 // create parameters operations
482 myParametersOperations = new ParametersOperations(horizontalFrameExtras, this);
483 // add separator
484 new FXHorizontalSeparator(mainFrame, GUIDesignHorizontalSeparator);
485 // create dialog buttons bot centered
486 FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(mainFrame, GUIDesignHorizontalFrame);
487 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
490 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
491 // create dialog
492 create();
493}
494
495
497
498
499void
501 // show
502 show(PLACEMENT_SCREEN);
503 // open as modal dialog (will block all windows until stop() or stopModal() is called)
504 //getApp()->runModalFor(this);
505}
506
507
508void
510 // hide
511 hide();
512 // close dialog
513 //getApp()->stopModal(this, TRUE);
514}
515
516
517void
521
522
523long
524GNEVTypeDistributionsDialog::onCmdAccept(FXObject*, FXSelector, void*) {
525 // close dialog
526 closeDialog();
527 return 1;
528}
529
530
531long
532GNEVTypeDistributionsDialog::onCmdCancel(FXObject*, FXSelector, void*) {
533 // close dialog
534 closeDialog();
535 return 1;
536}
537
538/****************************************************************************/
FXDEFMAP(GNEVTypeDistributionsDialog) GNEVTypeDistributionsDialogMap[]
@ 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_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 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 myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
GNEParameterHandler(ParametersOperations *ParametersOperationsParent, const std::string &file)
Constructor.
long onCmdHelpParameter(FXObject *, FXSelector, void *)
event when user press help parameters button
ParametersOperations(FXHorizontalFrame *frame, GNEVTypeDistributionsDialog *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
void enableRow(const std::string &parameter, const std::string &value) const
enable row
bool isButtonInAddMode() const
check if remove button is in mode "add"
void copyValues(const ParameterRow &other)
copy values of other parameter Row
ParameterRow(ParametersValues *ParametersValues, FXVerticalFrame *verticalFrameParent)
constructor
void setParameters(const std::vector< std::pair< std::string, std::string > > &newParameters)
set parameters
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
bool keyExist(const std::string &key) const
check if given key exist already
const std::vector< ParameterRow * > getParameterRows() const
get vector with the ParameterRows
void runInternalTest(const InternalTestStep::DialogTest *modalArguments)
run internal test
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
GNEVTypeDistributionsDialog(GNETypeFrame *typeFrameParent)
Constructor.
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
ParametersValues * myParametersValues
pointer to parameters values
ParametersOperations * myParametersOperations
pointer to parameters operations
GNETypeFrame * myTypeFrameParent
FOX need this.
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.
Definition json.hpp:4471