Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEFlowEditor.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
19/****************************************************************************/
20#include <config.h>
21
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
31
32#include "GNEFlowEditor.h"
33
34
35// ===========================================================================
36// FOX callback mapping
37// ===========================================================================
38
39FXDEFMAP(GNEFlowEditor) FlowEditorMap[] = {
41};
42
43// Object implementation
44FXIMPLEMENT(GNEFlowEditor, MFXGroupBoxModule, FlowEditorMap, ARRAYNUMBER(FlowEditorMap))
45
46
47// ===========================================================================
48// method definitions
49// ===========================================================================
50
52 MFXGroupBoxModule(frameParent, TL("Flow attributes")),
53 myViewNet(viewNet) {
54 const auto staticTooltip = frameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
55 // create comboBox for option A
56 FXHorizontalFrame* auxiliarHorizontalFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
57 auto terminatelabel = new FXLabel(auxiliarHorizontalFrame, "terminate", nullptr, GUIDesignLabelThickedFixed(100));
58 terminatelabel->setTipText("Terminate attribute");
59 myTerminateComboBox = new MFXComboBoxIcon(auxiliarHorizontalFrame, GUIDesignComboBoxNCol, false, GUIDesignComboBoxVisibleItems,
61 // create comboBox for spacing
62 mySpacingFrameComboBox = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
63 auto spacingAttribute = new FXLabel(mySpacingFrameComboBox, "spacing", nullptr, GUIDesignLabelThickedFixed(100));
64 spacingAttribute->setTipText("Terminate attribute");
65 mySpacingComboBox = new MFXComboBoxIcon(mySpacingFrameComboBox, GUIDesignComboBoxNCol, false, GUIDesignComboBoxVisibleItems,
67 // create textField for option A
68 myTerminateFrameTextField = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
69 myTerminateLabel = new MFXLabelTooltip(myTerminateFrameTextField, staticTooltip, "A", nullptr, GUIDesignLabelThickedFixed(100));
70 myTerminateTextField = new FXTextField(myTerminateFrameTextField, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
71 // create textField for spacing
72 mySpacingFrameTextField = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
73 mySpacingLabel = new MFXLabelTooltip(mySpacingFrameTextField, staticTooltip, "B", nullptr, GUIDesignLabelThickedFixed(100));
74 mySpacingTextField = new FXTextField(mySpacingFrameTextField, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
75 // fill terminate
76 myTerminateComboBox->appendIconItem(toString(SUMO_ATTR_END).c_str());
77 myTerminateComboBox->appendIconItem(toString(SUMO_ATTR_NUMBER).c_str());
78 myTerminateComboBox->appendIconItem((toString(SUMO_ATTR_END) + "-" + toString(SUMO_ATTR_NUMBER)).c_str());
79 // fill comboBox B
80 mySpacingComboBox->appendIconItem(toString(SUMO_ATTR_VEHSPERHOUR).c_str());
81 mySpacingComboBox->appendIconItem(toString(SUMO_ATTR_PERIOD).c_str());
82 mySpacingComboBox->appendIconItem(toString(GNE_ATTR_POISSON).c_str());
83 mySpacingComboBox->appendIconItem(toString(SUMO_ATTR_PROB).c_str());
84}
85
86
88
89
90void
91GNEFlowEditor::showFlowEditor(GNEAttributeCarrier* firstEditedFlow, const std::unordered_set<GNEAttributeCarrier*> editedFlows) {
92 // update flows
93 myEditedFlows = editedFlows;
94 myFirstEditedFlow = firstEditedFlow;
95 // check number of flows
97 // update per hour attr
102 } else {
104 }
105 // clear and update comboBoxB
111 // refresh
113 // show
114 show();
115 }
116}
117
118
119void
121 hide();
122}
123
124
125bool
127 return shown();
128}
129
130
131void
133 // show both attributes
136 // reset colors
137 myTerminateTextField->setTextColor(FXRGB(0, 0, 0));
138 myTerminateTextField->killFocus();
139 mySpacingTextField->setTextColor(FXRGB(0, 0, 0));
140 mySpacingTextField->killFocus();
141 // continue depending of number of flow
142 if (myEditedFlows.size() == 1) {
144 } else if (myEditedFlows.size() > 1) {
146 }
147 // recalc
148 recalc();
149}
150
151
152void
154 // case end-number
155 if (myTerminateLabel->getText().text() == toString(SUMO_ATTR_END)) {
156 baseObject->addTimeAttribute(SUMO_ATTR_END, GNEAttributeCarrier::parse<SUMOTime>(myTerminateTextField->getText().text()));
157 }
158 if (mySpacingLabel->getText().text() == toString(SUMO_ATTR_NUMBER)) {
159 baseObject->addIntAttribute(SUMO_ATTR_NUMBER, GNEAttributeCarrier::parse<int>(mySpacingTextField->getText().text()));
160 }
161 // other cases
162 if (myTerminateLabel->getText().text() == toString(SUMO_ATTR_NUMBER)) {
163 baseObject->addIntAttribute(SUMO_ATTR_NUMBER, GNEAttributeCarrier::parse<int>(myTerminateTextField->getText().text()));
164 }
165 if (mySpacingLabel->getText().text() == toString(myPerHourAttr)) {
166 baseObject->addTimeAttribute(myPerHourAttr, GNEAttributeCarrier::parse<SUMOTime>(mySpacingTextField->getText().text()));
167 }
168 if (mySpacingLabel->getText().text() == toString(SUMO_ATTR_PERIOD)) {
169 baseObject->addTimeAttribute(SUMO_ATTR_PERIOD, GNEAttributeCarrier::parse<SUMOTime>(mySpacingTextField->getText().text()));
170 }
171 if (mySpacingLabel->getText() == TL("rate")) {
172 baseObject->addTimeAttribute(GNE_ATTR_POISSON, GNEAttributeCarrier::parse<SUMOTime>(mySpacingTextField->getText().text()));
173 }
174 if (mySpacingLabel->getText().text() == toString(SUMO_ATTR_PROB)) {
175 baseObject->addDoubleAttribute(SUMO_ATTR_PROB, GNEAttributeCarrier::parse<double>(mySpacingTextField->getText().text()));
176 }
177}
178
179
180bool
182 // check text fields
183 if (myTerminateFrameTextField->shown() && (myTerminateTextField->getTextColor() == FXRGB(0, 0, 0)) &&
184 mySpacingFrameTextField->shown() && (mySpacingTextField->getTextColor() == FXRGB(0, 0, 0))) {
185 return true;
186 } else {
187 return false;
188 }
189}
190
191
192long
193GNEFlowEditor::onCmdSetFlowAttribute(FXObject* obj, FXSelector, void*) {
194 // check number of flows
195 if (myFirstEditedFlow) {
196 // declare vectors for enable/disable attributes
197 std::vector<SumoXMLAttr> enableAttrs, disableAttrs;
198 // check if all spacing attributes are disabled
199 const bool spacingEnabled = myFirstEditedFlow->isAttributeEnabled(myPerHourAttr) ||
203 // get special case endNumber
204 const bool endNumber = (myTerminateComboBox->getText().text() == (toString(SUMO_ATTR_END) + "-" + toString(SUMO_ATTR_NUMBER)));
205 // get terminate attribute
206 SumoXMLAttr terminateAttribute = SUMO_ATTR_NOTHING;
207 if (myTerminateComboBox->getText().text() == toString(SUMO_ATTR_END) || endNumber) {
208 terminateAttribute = SUMO_ATTR_END;
209 } else if (myTerminateComboBox->getText().text() == toString(SUMO_ATTR_NUMBER)) {
210 terminateAttribute = SUMO_ATTR_NUMBER;
211 }
212 // get spacing attribute
213 SumoXMLAttr spacingAttribute = SUMO_ATTR_NOTHING;
214 if (endNumber) {
215 spacingAttribute = SUMO_ATTR_NUMBER;
216 } else if (mySpacingComboBox->getText().text() == toString(myPerHourAttr)) {
217 spacingAttribute = myPerHourAttr;
218 } else if (mySpacingComboBox->getText().text() == toString(SUMO_ATTR_PERIOD)) {
219 spacingAttribute = SUMO_ATTR_PERIOD;
220 } else if (mySpacingComboBox->getText().text() == toString(GNE_ATTR_POISSON)) {
221 spacingAttribute = GNE_ATTR_POISSON;
222 } else if (mySpacingComboBox->getText().text() == toString(SUMO_ATTR_PROB)) {
223 spacingAttribute = SUMO_ATTR_PROB;
224 }
225 // check if obj is a comboBox or a text field
226 if (obj == myTerminateComboBox) {
227 if (endNumber) {
228 enableAttrs.push_back(SUMO_ATTR_END);
229 enableAttrs.push_back(SUMO_ATTR_NUMBER);
230 // disable others
231 disableAttrs.push_back(myPerHourAttr);
232 disableAttrs.push_back(SUMO_ATTR_PERIOD);
233 disableAttrs.push_back(GNE_ATTR_POISSON);
234 disableAttrs.push_back(SUMO_ATTR_PROB);
235 // reset color
236 myTerminateComboBox->setTextColor(FXRGB(0, 0, 0));
237 myTerminateComboBox->killFocus();
238 } else if (terminateAttribute == SUMO_ATTR_END) {
239 enableAttrs.push_back(SUMO_ATTR_END);
240 disableAttrs.push_back(SUMO_ATTR_NUMBER);
241 // at least enable one spacing attribute
242 if (!spacingEnabled) {
243 enableAttrs.push_back(myPerHourAttr);
244 }
245 // reset color
246 myTerminateComboBox->setTextColor(FXRGB(0, 0, 0));
247 myTerminateComboBox->killFocus();
248 } else if (terminateAttribute == SUMO_ATTR_NUMBER) {
249 disableAttrs.push_back(SUMO_ATTR_END);
250 enableAttrs.push_back(SUMO_ATTR_NUMBER);
251 // at least enable one spacing attribute
252 if (!spacingEnabled) {
253 enableAttrs.push_back(myPerHourAttr);
254 }
255 // reset color
256 myTerminateComboBox->setTextColor(FXRGB(0, 0, 0));
257 myTerminateComboBox->killFocus();
258 } else {
259 // disable both
260 disableAttrs.push_back(SUMO_ATTR_END);
261 disableAttrs.push_back(SUMO_ATTR_NUMBER);
262 // set invalid color
263 myTerminateComboBox->setTextColor(FXRGB(255, 0, 0));
264 }
265 } else if (obj == mySpacingComboBox) {
266 if (spacingAttribute == myPerHourAttr) {
267 enableAttrs.push_back(myPerHourAttr);
268 disableAttrs.push_back(SUMO_ATTR_PERIOD);
269 disableAttrs.push_back(GNE_ATTR_POISSON);
270 disableAttrs.push_back(SUMO_ATTR_PROB);
271 // reset color
272 mySpacingComboBox->setTextColor(FXRGB(0, 0, 0));
273 mySpacingComboBox->killFocus();
274 } else if (spacingAttribute == SUMO_ATTR_PERIOD) {
275 disableAttrs.push_back(myPerHourAttr);
276 enableAttrs.push_back(SUMO_ATTR_PERIOD);
277 disableAttrs.push_back(GNE_ATTR_POISSON);
278 disableAttrs.push_back(SUMO_ATTR_PROB);
279 // reset color
280 mySpacingComboBox->setTextColor(FXRGB(0, 0, 0));
281 mySpacingComboBox->killFocus();
282 } else if (spacingAttribute == GNE_ATTR_POISSON) {
283 disableAttrs.push_back(myPerHourAttr);
284 disableAttrs.push_back(SUMO_ATTR_PERIOD);
285 enableAttrs.push_back(GNE_ATTR_POISSON);
286 disableAttrs.push_back(SUMO_ATTR_PROB);
287 // reset color
288 mySpacingComboBox->setTextColor(FXRGB(0, 0, 0));
289 mySpacingComboBox->killFocus();
290 } else if (spacingAttribute == SUMO_ATTR_PROB) {
291 disableAttrs.push_back(myPerHourAttr);
292 disableAttrs.push_back(SUMO_ATTR_PERIOD);
293 disableAttrs.push_back(GNE_ATTR_POISSON);
294 enableAttrs.push_back(SUMO_ATTR_PROB);
295 // reset color
296 mySpacingComboBox->setTextColor(FXRGB(0, 0, 0));
297 mySpacingComboBox->killFocus();
298 } else {
299 // disable all
300 disableAttrs.push_back(myPerHourAttr);
301 disableAttrs.push_back(SUMO_ATTR_PERIOD);
302 disableAttrs.push_back(GNE_ATTR_POISSON);
303 disableAttrs.push_back(SUMO_ATTR_PROB);
304 // set invalid color
305 mySpacingComboBox->setTextColor(FXRGB(255, 0, 0));
306 }
307 } else if ((obj == myTerminateTextField) && (terminateAttribute != SUMO_ATTR_NOTHING)) {
308 if (myFirstEditedFlow->isValid(terminateAttribute, myTerminateTextField->getText().text())) {
309 // continue depending of flow
311 // change attribute directly
312 myFirstEditedFlow->setAttribute(terminateAttribute, myTerminateTextField->getText().text());
313 } else if (myEditedFlows.size() == 1) {
314 // change using undoList
315 myFirstEditedFlow->setAttribute(terminateAttribute, myTerminateTextField->getText().text(), myViewNet->getUndoList());
316 } else {
317 // change all flows using undoList
318 myViewNet->getUndoList()->begin(myFirstEditedFlow, "change multiple flow attributes");
319 for (const auto& flow : myEditedFlows) {
320 flow->setAttribute(terminateAttribute, myTerminateTextField->getText().text(), myViewNet->getUndoList());
321 }
323 }
324 // reset color
325 myTerminateTextField->setTextColor(FXRGB(0, 0, 0));
326 myTerminateTextField->killFocus();
327 } else {
328 // set invalid color
329 myTerminateTextField->setTextColor(FXRGB(255, 0, 0));
330 // stop
331 return 1;
332 }
333 } else if ((obj == mySpacingTextField) && (spacingAttribute != SUMO_ATTR_NOTHING)) {
334 if (myFirstEditedFlow->isValid(spacingAttribute, mySpacingTextField->getText().text())) {
335 // continue depending of flow
337 // change attribute directly
338 myFirstEditedFlow->setAttribute(spacingAttribute, mySpacingTextField->getText().text());
339 } else if (myEditedFlows.size() == 1) {
340 // change using undoList
341 myFirstEditedFlow->setAttribute(spacingAttribute, mySpacingTextField->getText().text(), myViewNet->getUndoList());
342 } else {
343 // change all flows using undoList
344 myViewNet->getUndoList()->begin(myFirstEditedFlow, TL("change multiple flow attributes"));
345 for (const auto& flow : myEditedFlows) {
346 flow->setAttribute(spacingAttribute, mySpacingTextField->getText().text(), myViewNet->getUndoList());
347 }
349 }
350 // reset color
351 mySpacingTextField->setTextColor(FXRGB(0, 0, 0));
352 mySpacingTextField->killFocus();
353 } else {
354 // set invalid color
355 mySpacingTextField->setTextColor(FXRGB(255, 0, 0));
356 // stop
357 return 1;
358 }
359 }
360 // enable and disable attributes
361 for (const auto& attr : enableAttrs) {
363 // enable directly
365 } else if (myEditedFlows.size() == 1) {
366 // enable using undoList
368 } else {
369 // enable in all flow using undoList
370 myViewNet->getUndoList()->begin(myFirstEditedFlow, TL("enable multiple flow attributes"));
371 for (const auto& flow : myEditedFlows) {
372 flow->enableAttribute(attr, myViewNet->getUndoList());
373 }
375 }
376 }
377 for (const auto& attr : disableAttrs) {
379 // disable directly
381 } else if (myEditedFlows.size() == 1) {
382 // disable using undoList
384 } else {
385 // disable in all flow using undoList
386 myViewNet->getUndoList()->begin(myFirstEditedFlow, TL("disable multiple flow attributes"));
387 for (const auto& flow : myEditedFlows) {
388 flow->disableAttribute(attr, myViewNet->getUndoList());
389 }
391 }
392 }
393 // refresh flow editor
395 }
396 return 1;
397}
398
399
400void
402 if (myFirstEditedFlow) {
403 // continue depending of combinations
405 // set first comboBox
407 // hide second comboBox
409 // set label
410 myTerminateLabel->setText(toString(SUMO_ATTR_END).c_str());
412 mySpacingLabel->setText(toString(SUMO_ATTR_NUMBER).c_str());
414 // set text fields
417 } else {
418 // show second comboBox
420 // set first attribute
421 if (myTerminateComboBox->getTextColor() == FXRGB(255, 0, 0)) {
422 // invalid combination, disable text field
425 // set first comboBox
427 // set label
428 myTerminateLabel->setText(toString(SUMO_ATTR_END).c_str());
429 // set definition
431 // set text fields
434 // set first comboBox
436 // set label
437 myTerminateLabel->setText(toString(SUMO_ATTR_NUMBER).c_str());
438 // set definition
440 // set text fields
442 }
443 // set second attribute
444 if (mySpacingComboBox->getTextColor() == FXRGB(255, 0, 0)) {
445 // invalid combination, disable text field
448 // set first comboBox
450 // set label
451 mySpacingLabel->setText(toString(myPerHourAttr).c_str());
452 // set tip text
454 // set text fields
457 // set first comboBox
459 // set label
460 mySpacingLabel->setText(toString(SUMO_ATTR_PERIOD).c_str());
461 // set tip text
463 // set text fields
466 // set first comboBox
468 // set label
469 mySpacingLabel->setText(TL("rate"));
470 // set definition
472 // set text fields
475 // set first comboBox
477 // set label
478 mySpacingLabel->setText(toString(SUMO_ATTR_PROB).c_str());
479 // set tip text
481 // set text fields
483 }
484 }
485 }
486}
487
488
489void
491 if (myFirstEditedFlow) {
492 // get values of first flow
498 const bool probability = myFirstEditedFlow->isAttributeEnabled(SUMO_ATTR_PROB);
499 // we need to check if attributes are defined differents in flows
500 std::vector<std::string> terminateDifferent;
501 std::vector<std::string> spacingDifferent;
502 // iterate over all flows
503 for (const auto& flow : myEditedFlows) {
504 if (flow->isAttributeEnabled(SUMO_ATTR_END) != end) {
505 terminateDifferent.push_back(toString(SUMO_ATTR_END));
506 }
507 if (flow->isAttributeEnabled(SUMO_ATTR_NUMBER) != number) {
508 terminateDifferent.push_back(toString(SUMO_ATTR_NUMBER));
509 }
510 if (flow->isAttributeEnabled(myPerHourAttr) != perhour) {
511 spacingDifferent.push_back(toString(myPerHourAttr));
512 }
513 if (flow->isAttributeEnabled(SUMO_ATTR_PERIOD) != period) {
514 spacingDifferent.push_back(toString(SUMO_ATTR_PERIOD));
515 }
516 if (flow->isAttributeEnabled(GNE_ATTR_POISSON) != poisson) {
517 spacingDifferent.push_back(toString(GNE_ATTR_POISSON));
518 }
519 if (flow->isAttributeEnabled(SUMO_ATTR_PROB) != probability) {
520 spacingDifferent.push_back(toString(SUMO_ATTR_PROB));
521 }
522 }
523 // special case for end and number
524 if (end && number && terminateDifferent.empty() && spacingDifferent.empty()) {
525 // set first comboBox
527 // hide second comboBox
529 // set label
530 myTerminateLabel->setText(toString(SUMO_ATTR_END).c_str());
531 mySpacingLabel->setText(toString(SUMO_ATTR_NUMBER).c_str());
532 // set text fields
535 } else {
536 // show second comboBox
538 // check terminateDifferent
539 if (terminateDifferent.size() > 0) {
540 myTerminateComboBox->setText((TL("different: ") + terminateDifferent.front() + " " + terminateDifferent.back()).c_str());
541 // hide textField
543 } else {
544 // show textField
546 // set first attribute
547 if (myTerminateComboBox->getTextColor() == FXRGB(255, 0, 0)) {
548 // invalid combination, disable text field
550 } else if (end) {
551 // set first comboBox
553 // set label
554 myTerminateLabel->setText(toString(SUMO_ATTR_END).c_str());
555 // set text fields
557 } else if (number) {
558 // set first comboBox
560 // set label
561 myTerminateLabel->setText(toString(SUMO_ATTR_NUMBER).c_str());
562 // set text fields
564 }
565 }
566 // check terminateDifferent
567 if (spacingDifferent.size() > 0) {
568 mySpacingComboBox->setText((TL("different: ") + spacingDifferent.front() + " " + spacingDifferent.back()).c_str());
569 // hide textField
571 } else {
572 // show textField
574 // set second attribute
575 if (mySpacingComboBox->getTextColor() == FXRGB(255, 0, 0)) {
576 // invalid combination, disable text field
578 } else if (perhour) {
579 // set first comboBox
581 // set label
582 mySpacingLabel->setText(toString(myPerHourAttr).c_str());
583 // set text fields
585 } else if (period) {
586 // set first comboBox
588 // set label
589 mySpacingLabel->setText(toString(SUMO_ATTR_PERIOD).c_str());
590 // set text fields
592 } else if (poisson) {
593 // set first comboBox
595 // set label
596 mySpacingLabel->setText(TL("rate"));
597 // set text fields
599 } else if (probability) {
600 // set first comboBox
602 // set label
603 mySpacingLabel->setText(toString(SUMO_ATTR_PROB).c_str());
604 // set text fields
606 }
607 }
608 }
609 }
610}
611
612
613const std::string
615 if (myFirstEditedFlow == nullptr) {
616 return "";
617 } else if (myEditedFlows.size() == 1) {
618 return myFirstEditedFlow->getAttribute(attr);
619 } else {
620 std::string solution;
621 std::set<std::string> values;
622 // extract all values (avoiding duplicated)
623 for (const auto& flow : myEditedFlows) {
624 values.insert(flow->getAttribute(attr));
625 }
626 // insert value and space
627 for (const auto& value : values) {
628 solution.append(value + " ");
629 }
630 // remove last space
631 if (solution.size() > 0) {
632 solution.pop_back();
633 }
634 return solution;
635 }
636}
637
638
639/****************************************************************************/
FXDEFMAP(GNEFlowEditor) FlowEditorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:939
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
Definition GUIDesigns.h:302
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:311
#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 GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:74
#define GUIDesignComboBoxVisibleItems
Definition GUIDesigns.h:49
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:252
#define TL(string)
Definition MsgHandler.h:315
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_NUMBER
@ SUMO_ATTR_VEHSPERHOUR
@ GNE_ATTR_POISSON
poisson definition (used in flow)
@ SUMO_ATTR_CONTAINERSPERHOUR
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_PROB
@ SUMO_ATTR_NOTHING
invalid attribute, must be the last one
@ SUMO_ATTR_PERSONSPERHOUR
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
void addIntAttribute(const SumoXMLAttr attr, const int value)
add int attribute into current SumoBaseObject node
void addTimeAttribute(const SumoXMLAttr attr, const SUMOTime value)
add time attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
virtual void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
virtual void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
virtual bool isAttributeEnabled(SumoXMLAttr key) const
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
virtual void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual std::string getAttribute(SumoXMLAttr key) const =0
const std::string & getDefinition() const
get default value
void getFlowAttributes(CommonXMLStructure::SumoBaseObject *baseObject)
get flow attributes
long onCmdSetFlowAttribute(FXObject *, FXSelector, void *)
std::unordered_set< GNEAttributeCarrier * > myEditedFlows
edited flows
void refreshSingleFlow()
refresh single flow
MFXLabelTooltip * mySpacingLabel
Label for spacing.
FXTextField * myTerminateTextField
textField for terminate attribute
MFXComboBoxIcon * myTerminateComboBox
ComboBox for terminate options (end, number, end/number)
SumoXMLAttr myPerHourAttr
per hours attr (vehicles/person/container)
MFXComboBoxIcon * mySpacingComboBox
ComboBox for spacing comboBox (perHour, period, probability)
GNEViewNet * myViewNet
pointer to viewNet
const std::string getFlowAttribute(SumoXMLAttr attr)
get flow attribute (of the current edited flows)
void showFlowEditor(GNEAttributeCarrier *firstEditedFlow, const std::unordered_set< GNEAttributeCarrier * > editedFlows)
show GNEFlowEditor modul
void refreshFlowEditor()
refresh GNEFlowEditor
FXHorizontalFrame * mySpacingFrameTextField
horizontal frame for spacing textField
MFXLabelTooltip * myTerminateLabel
Label for terminate definition.
~GNEFlowEditor()
destructor
void hideFlowEditor()
hide group box
FXTextField * mySpacingTextField
textField for spacing attribute
void refreshMultipleFlows()
refresh multiple flows
bool shownFlowEditor() const
shown GNEFlowEditor modul
GNEAttributeCarrier * myFirstEditedFlow
first edited flow
FXHorizontalFrame * mySpacingFrameComboBox
horizontal frame for terminate options
FXHorizontalFrame * myTerminateFrameTextField
horizontal frame for terminate definition
bool areFlowValuesValid() const
check if parameters of attributes are valid
const GNEAttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute propety associated with the given Sumo XML Attribute (throw error if doesn't exist)
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
GNEUndoList * getUndoList() const
get the undoList object
ComboBox with icon.
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
void clearItems()
Remove all items from the list.
void setText(const FXString &text)
Set the text in the textField.
FXColor getTextColor() const
Return text color.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
MFXGroupBoxModule (based on FXGroupBox)