Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEFrameAttributeModules.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/****************************************************************************/
18// Auxiliary class for GNEFrame Modules (only for attributes edition)
19/****************************************************************************/
20#include <config.h>
21
23#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNEViewNet.h>
37
39#include "GNEFlowEditor.h"
40
41
42// ===========================================================================
43// FOX callback mapping
44// ===========================================================================
45
55
59
63
68
73
74// Object implementation
75FXIMPLEMENT(GNEFrameAttributeModules::AttributesEditorRow, FXHorizontalFrame, AttributesEditorRowMap, ARRAYNUMBER(AttributesEditorRowMap))
76FXIMPLEMENT(GNEFrameAttributeModules::AttributesEditor, MFXGroupBoxModule, AttributesEditorMap, ARRAYNUMBER(AttributesEditorMap))
77FXIMPLEMENT(GNEFrameAttributeModules::AttributesEditorExtended, MFXGroupBoxModule, AttributesEditorExtendedMap, ARRAYNUMBER(AttributesEditorExtendedMap))
78FXIMPLEMENT(GNEFrameAttributeModules::GenericDataAttributes, MFXGroupBoxModule, GenericDataAttributesMap, ARRAYNUMBER(GenericDataAttributesMap))
79FXIMPLEMENT(GNEFrameAttributeModules::ParametersEditor, MFXGroupBoxModule, ParametersEditorMap, ARRAYNUMBER(ParametersEditorMap))
80
81
82// ===========================================================================
83// method definitions
84// ===========================================================================
85
86// ---------------------------------------------------------------------------
87// GNEFrameAttributeModules::AttributesEditorRow - methods
88// ---------------------------------------------------------------------------
89
91 const std::string& value, const bool attributeEnabled, const bool computed, GNEAttributeCarrier* ACParent) :
92 FXHorizontalFrame(attributeEditorParent->getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame),
93 myAttributesEditorParent(attributeEditorParent),
94 myACAttr(ACAttr),
95 myACParent(ACParent) {
96 // build attribute elements
97 buildAttributeElements(attributeEnabled, computed);
98 // build value elements
99 buildValueElements(attributeEnabled, computed);
100 // only create if parent was created
101 if (getParent()->id()) {
102 // create AttributesEditorRow
103 FXHorizontalFrame::create();
104 // Set field depending of the type of value
105 if (myACAttr.isBool()) {
106 // first we need to check if all boolean values are equal
107 bool allBooleanValuesEqual = true;
108 // declare boolean vector
109 std::vector<bool> booleanVector;
110 // check if value can be parsed to a boolean vector
111 if (GNEAttributeCarrier::canParse<std::vector<bool> >(value)) {
112 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
113 }
114 // iterate over passed booleans comparing all element with the first
115 for (const auto& booleanValue : booleanVector) {
116 if (booleanValue != booleanVector.front()) {
117 allBooleanValuesEqual = false;
118 }
119 }
120 // use checkbox or textfield depending if all booleans are equal
121 if (allBooleanValuesEqual) {
122 // set check button
123 if ((booleanVector.size() > 0) && booleanVector.front()) {
124 myValueCheckButton->setCheck(true);
125 myValueCheckButton->setText("true");
126 } else {
127 myValueCheckButton->setCheck(false);
128 myValueCheckButton->setText("false");
129 }
130 // show check button
131 myValueCheckButton->show();
132 } else {
133 // show list of bools (0 1)
134 myValueTextField->setText(value.c_str());
135 myValueTextField->show();
136 }
137 } else if (myACAttr.isDiscrete()) {
138 // Check if are VClasses
139 if (myAttributeButton) {
140 // Show string with the values
141 myValueTextField->setText(value.c_str());
142 myValueTextField->show();
143 } else {
144 // fill comboBox
145 fillComboBox(value);
146 myValueComboBox->show();
147 }
148 } else if (myACAttr.isVType()) {
149 // fill comboBox
150 fillComboBox(value);
151 myValueComboBox->show();
152 } else {
153 // In any other case (String, list, etc.), show value as String
154 myValueTextField->setText(value.c_str());
155 myValueTextField->show();
156 }
157 // check if update lane buttons
158 if (myValueLaneUpButton && myValueLaneDownButton) {
159 updateMoveLaneButtons(value);
160 }
161 // Show AttributesEditorRow
162 show();
163 }
164}
165
166
167void
169 // only destroy if parent was created
170 if (getParent()->id()) {
171 FXHorizontalFrame::destroy();
172 }
173}
174
175
176void
178 const bool forceRefreshAttribute, const bool attributeEnabled, const bool computed, GNEAttributeCarrier* ACParent) {
179 // update ACParent
180 myACParent = ACParent;
181 // refresh attribute elements
182 refreshAttributeElements(value, attributeEnabled, computed);
183 refreshValueElements(value, attributeEnabled, computed, forceRefreshAttribute);
184}
185
186
187bool
189 return ((myValueTextField->getTextColor() == FXRGB(0, 0, 0)) || (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) &&
190 ((myValueComboBox->getTextColor() == FXRGB(0, 0, 0)) || (myValueComboBox->getTextColor() == FXRGB(0, 0, 255)));
191}
192
193
194long
196 GNEViewNet* viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
197 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
198 // create FXColorDialog
199 FXColorDialog colordialog(this, TL("Color Dialog"));
200 colordialog.setTarget(this);
201 colordialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
202 // If previous attribute wasn't correct, set black as default color
203 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
204 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
205 } else if (!myACAttr.getDefaultValue().empty()) {
206 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myACAttr.getDefaultValue())));
207 } else {
208 colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
209 }
210 // execute dialog to get a new color
211 if (colordialog.execute()) {
212 std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
213 myValueTextField->setText(newValue.c_str());
214 if (viewNet->getInspectedAttributeCarriers().front()->isValid(myACAttr.getAttr(), newValue)) {
215 // if its valid for the first AC than its valid for all (of the same type)
216 if (ACs.size() > 1) {
217 viewNet->getUndoList()->begin(ACs.front(), TL("change multiple attributes"));
218 }
219 // Set new value of attribute in all selected ACs
220 for (const auto& inspectedAC : viewNet->getInspectedAttributeCarriers()) {
221 inspectedAC->setAttribute(myACAttr.getAttr(), newValue, viewNet->getUndoList());
222 }
223 // finish change multiple attributes
224 if (ACs.size() > 1) {
225 viewNet->getUndoList()->end();
226 }
227 // If previously value was incorrect, change font color to black
228 myValueTextField->setTextColor(FXRGB(0, 0, 0));
229 myValueTextField->killFocus();
230 }
231 }
232 return 1;
233}
234
235
236long
238 GNEViewNet* viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
239 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
240 // if its valid for the first AC than its valid for all (of the same type)
241 if (ACs.size() > 1) {
242 viewNet->getUndoList()->begin(ACs.front(), TL("change multiple attributes"));
243 }
244 // declare accept changes
245 bool acceptChanges = false;
246 // open GNEAllowVClassesDialog (also used to modify SUMO_ATTR_CHANGE_LEFT etc
247 GNEAllowVClassesDialog(viewNet, viewNet->getInspectedAttributeCarriers().front(),
248 myACAttr.getAttr(), &acceptChanges).execute();
249 // continue depending of acceptChanges
250 if (acceptChanges) {
251 std::string allowed = viewNet->getInspectedAttributeCarriers().front()->getAttribute(myACAttr.getAttr());
252 // Set new value of attribute in all selected ACs
253 for (const auto& inspectedAC : viewNet->getInspectedAttributeCarriers()) {
254 inspectedAC->setAttribute(myACAttr.getAttr(), allowed, viewNet->getUndoList());
255 }
256 // finish change multiple attributes
257 if (ACs.size() > 1) {
258 viewNet->getUndoList()->end();
259 }
260 // update frame parent after attribute successfully set
261 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
262 }
263 return 1;
264}
265
266
267long
269 auto viewnet = myAttributesEditorParent->getFrameParent()->getViewNet();
270 viewnet->getViewParent()->getInspectorFrame()->inspectChild(myACParent, viewnet->getInspectedAttributeCarriers().front());
271 return 1;
272}
273
274
275long
277 // get view net
278 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
279 // get inspected ACs (for code cleaning)
280 auto AC = viewNet->getInspectedAttributeCarriers().front();
281 // extract lane
282 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(AC->getAttribute(SUMO_ATTR_LANE));
283 // set next lane
284 AC->setAttribute(SUMO_ATTR_LANE, lane->getParentEdge()->getID() + "_" + toString(lane->getIndex() + 1), viewNet->getUndoList());
285 // update frame parent after attribute successfully set
286 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
287 return 1;
288}
289
290
291long
293 // get view net
294 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
295 // get inspected ACs (for code cleaning)
296 auto AC = viewNet->getInspectedAttributeCarriers().front();
297 // extract lane
298 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(AC->getAttribute(SUMO_ATTR_LANE));
299 // set next lane
300 AC->setAttribute(SUMO_ATTR_LANE, lane->getParentEdge()->getID() + "_" + toString(lane->getIndex() - 1), viewNet->getUndoList());
301 // update frame parent after attribute successfully set
302 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
303 return 1;
304}
305
306
307long
309 // Declare changed value
310 std::string newVal;
311 // First, obtain the string value of the new attribute depending of their type
312 if (myACAttr.isBool()) {
313 // first check if we're editing boolean as a list of string or as a checkbox
314 if (myValueCheckButton->shown()) {
315 // Set true o false depending of the checkBox
316 if (myValueCheckButton->getCheck()) {
317 myValueCheckButton->setText("true");
318 newVal = "true";
319 } else {
320 myValueCheckButton->setText("false");
321 newVal = "false";
322 }
323 } else {
324 // obtain boolean value of myValueTextField (because we're inspecting multiple attribute carriers with different values)
325 newVal = myValueTextField->getText().text();
326 }
327 } else if (myACAttr.isDiscrete()) {
328 // check if we have the new value in a text field or in the combo box
329 if (myValueTextField->shown()) {
330 // Get value obtained using AttributesEditor
331 newVal = myValueTextField->getText().text();
332 } else {
333 // Get value of ComboBox
334 newVal = myValueComboBox->getText().text();
335 }
336 } else if (myACAttr.isVType()) {
337 // Get value of ComboBox
338 newVal = myValueComboBox->getText().text();
339 } else {
340 // Check if default value of attribute must be set
341 if (myValueTextField->getText().empty() && myACAttr.hasDefaultValue()) {
342 newVal = myACAttr.getDefaultValue();
343 myValueTextField->setText(newVal.c_str());
344 } else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
345 // filter int attributes
346 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
347 // check if myValueTextField has to be updated
348 if ((doubleValue - (int)doubleValue) == 0) {
349 newVal = toString((int)doubleValue);
350 myValueTextField->setText(newVal.c_str(), FALSE);
351 }
352 } else if ((myACAttr.getAttr() == SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
353 // filter angle
354 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
355 // filter if angle isn't between [0,360]
356 if ((angle < 0) || (angle > 360)) {
357 // apply module
358 angle = fmod(angle, 360);
359 }
360 // set newVal
361 newVal = toString(angle);
362 // update Textfield
363 myValueTextField->setText(newVal.c_str(), FALSE);
364 } else {
365 // obtain value of myValueTextField
366 newVal = myValueTextField->getText().text();
367 }
368 }
369 // we need a extra check for Position and Shape Values, due #2658
370 if ((myACAttr.getAttr() == SUMO_ATTR_POSITION) || (myACAttr.getAttr() == SUMO_ATTR_SHAPE)) {
371 newVal = stripWhitespaceAfterComma(newVal);
372 }
373 // get inspected ACs (for code cleaning)
374 const auto& inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
375 // check if use default value
376 const bool useDefaultValue = (newVal.empty() && myACAttr.hasDefaultValue());
377 // Check if attribute must be changed
378 if ((inspectedACs.size() > 0) && (inspectedACs.front()->isValid(myACAttr.getAttr(), newVal) || useDefaultValue)) {
379 // check if we're merging junction
380 if (!mergeJunction(myACAttr.getAttr(), inspectedACs, newVal)) {
381 // if its valid for the first AC than its valid for all (of the same type)
382 if (inspectedACs.size() > 1) {
383 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front(), TL("change multiple attributes"));
384 } else if (myACAttr.getAttr() == SUMO_ATTR_ID) {
385 // IDs attribute has to be encapsulated
386 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front(), TLF("change % attribute", myACAttr.getTagPropertyParent().getTagStr()));
387 }
388 // Set new value of attribute in all selected ACs
389 for (const auto& inspectedAC : inspectedACs) {
390 if (useDefaultValue) {
391 inspectedAC->setAttribute(myACAttr.getAttr(), myACAttr.getDefaultValue(), myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
392 } else {
393 inspectedAC->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
394 }
395 }
396 // finish change multiple attributes or ID Attributes
397 if (inspectedACs.size() > 1) {
398 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
399 } else if (myACAttr.getAttr() == SUMO_ATTR_ID) {
400 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
401 }
402 // reset colors
403 if (myValueTextField->shown()) {
404 myValueTextField->setTextColor(FXRGB(0, 0, 0));
405 myValueTextField->setBackColor(FXRGB(255, 255, 255));
406 myValueTextField->killFocus();
407 } else if (myValueComboBox->shown()) {
408 myValueComboBox->setTextColor(FXRGB(0, 0, 0));
409 myValueComboBox->setBackColor(FXRGB(255, 255, 255));
410 }
411 // in this case, we need to refresh the other values (For example, allow/Disallow objects)
412 myAttributesEditorParent->refreshAttributeEditor(false, false);
413 // update frame parent after attribute successfully set
414 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
415 }
416 } else {
417 // If value of TextField isn't valid, change color to Red depending of type
418 if (myValueTextField->shown()) {
419 myValueTextField->setTextColor(FXRGB(255, 0, 0));
420 if (newVal.empty()) {
421 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
422 }
423 } else if (myValueComboBox->shown()) {
424 myValueComboBox->setTextColor(FXRGB(255, 0, 0));
425 if (newVal.empty()) {
426 myValueComboBox->setBackColor(FXRGBA(255, 213, 213, 255));
427 }
428 }
429 // Write Warning in console if we're in testing mode
430 WRITE_DEBUG(TLF("Value '%' for attribute % of % isn't valid", newVal, myACAttr.getAttrStr(), myACAttr.getTagPropertyParent().getTagStr()));
431 }
432 return 1;
433}
434
435
436long
438 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
439 // obtain undoList (To improve code legibly)
440 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList();
441 // check if we have to enable or disable
442 if (myAttributeCheckButton->getCheck()) {
443 // enable input values
444 myValueCheckButton->enable();
445 myValueTextField->enable();
446 // enable attribute
447 undoList->begin(ACs.front(), TL("enable attribute '") + myACAttr.getAttrStr() + "'");
448 ACs.front()->enableAttribute(myACAttr.getAttr(), undoList);
449 undoList->end();
450 } else {
451 // disable input values
452 myValueCheckButton->disable();
453 myValueTextField->disable();
454 // disable attribute
455 undoList->begin(ACs.front(), TL("disable attribute '") + myACAttr.getAttrStr() + "'");
456 ACs.front()->disableAttribute(myACAttr.getAttr(), undoList);
457 undoList->end();
458 }
459 return 0;
460}
461
462
464 myAttributesEditorParent(nullptr) {
465}
466
467
468std::string
470 std::string result(stringValue);
471 while (result.find(", ") != std::string::npos) {
472 result = StringUtils::replace(result, ", ", ",");
473 }
474 return result;
475}
476
477
478bool
479GNEFrameAttributeModules::AttributesEditorRow::mergeJunction(SumoXMLAttr attr, const std::vector<GNEAttributeCarrier*>& inspectedACs, const std::string& newVal) const {
480 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
481 // check if we're editing junction position
482 if ((inspectedACs.size() == 1) && (inspectedACs.front()->getTagProperty().getTag() == SUMO_TAG_JUNCTION) && (attr == SUMO_ATTR_POSITION)) {
483 // retrieve original junction
484 GNEJunction* movedJunction = viewNet->getNet()->getAttributeCarriers()->retrieveJunction(inspectedACs.front()->getID());
485 // parse position
486 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
487 // iterate over network junction
488 for (const auto& targetjunction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
489 // check distance position
490 if ((targetjunction.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
491 viewNet->askMergeJunctions(movedJunction, targetjunction.second)) {
492 viewNet->getNet()->mergeJunctions(movedJunction, targetjunction.second, viewNet->getUndoList());
493 return true;
494 }
495 }
496 }
497 // nothing to merge
498 return false;
499}
500
501
502void
503GNEFrameAttributeModules::AttributesEditorRow::buildAttributeElements(const bool attributeEnabled, const bool computed) {
504 // get static tooltip menu
505 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
506 // check if disable element
507 const bool disableRow = !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
508 // continue depending of attribute
509 if (myACParent) {
510 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(),
511 myACParent->getACIcon(), this, MID_GNE_SET_ATTRIBUTE_INSPECTPARENT, GUIDesignButtonAttribute);
512 // set color text depending of computed
513 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
514 // set tip text
515 myAttributeButton->setTipText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
516 myAttributeButton->setHelpText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
517 // check if disable
518 if (disableRow) {
519 myAttributeButton->disable();
520 }
521 } else if (myACAttr.isActivatable()) {
522 myAttributeCheckButton = new FXCheckButton(this, myACAttr.getAttrStr().c_str(), this, MID_GNE_SET_ATTRIBUTE_BOOL, GUIDesignCheckButtonAttribute);
523 // check
524 if (attributeEnabled) {
525 myAttributeCheckButton->setCheck(TRUE);
526 } else {
527 myAttributeCheckButton->setCheck(FALSE);
528 }
529 // set color text depending of computed
530 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
531 // check if disable
532 if (disableRow) {
533 myAttributeCheckButton->disable();
534 }
535 } else if (myACAttr.isSVCPermission() && (myACAttr.getAttr() != SUMO_ATTR_DISALLOW)) {
536 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, this, MID_GNE_SET_ATTRIBUTE_ALLOW, GUIDesignButtonAttribute);
537 // set tip text
538 myAttributeButton->setTipText(TL("Open dialog for editing vClasses"));
539 myAttributeButton->setHelpText(TL("Open dialog for editing vClasses"));
540 // check if disable
541 if (!attributeEnabled || disableRow) {
542 myAttributeButton->disable();
543 }
544 } else if (myACAttr.isColor()) {
545 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, this, MID_GNE_SET_ATTRIBUTE_COLOR, GUIDesignButtonAttribute);
546 // set icon
547 myAttributeButton->setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
548 // set color text depending of computed
549 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
550 // set tip text
551 myAttributeButton->setTipText(TL("Open dialog for editing color"));
552 myAttributeButton->setHelpText(TL("Open dialog for editing color"));
553 // check if disable
554 if (disableRow) {
555 myAttributeButton->disable();
556 }
557 } else {
558 // Create label
559 myAttributeLabel = new MFXLabelTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, GUIDesignLabelThickedFixed(100));
560 // set tip text
561 myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
562 myAttributeLabel->setHelpText(myACAttr.getDefinition().c_str());
563 }
564}
565
566
567void
568GNEFrameAttributeModules::AttributesEditorRow::buildValueElements(const bool attributeEnabled, const bool computed) {
569 // Create and hide MFXTextFieldTooltip for string attributes
570 myValueTextField = new MFXTextFieldTooltip(this,
571 myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
573 myValueTextField->hide();
574 // set color text depending of computed
575 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
576 // Create and hide ComboBox
579 myValueComboBox->hide();
580 // set color text depending of computed
581 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
582 // Create and hide checkButton
583 myValueCheckButton = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
584 myValueCheckButton->hide();
585 // set color text depending of computed
586 myValueCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
587 // check if create move up/down lanes
588 if ((myACAttr.getAttr() == SUMO_ATTR_LANE) && !myACAttr.getTagPropertyParent().isNetworkElement()) {
589 // get static tooltip menu
590 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
591 // create move lane up
592 myValueLaneUpButton = new MFXButtonTooltip(this, tooltipMenu, "",
594 // set tip texts
595 myValueLaneUpButton->setTipText(TL("Move element up one lane"));
596 myValueLaneUpButton->setHelpText(TL("Move element up one lane"));
597 // create move lane down
598 myValueLaneDownButton = new MFXButtonTooltip(this, tooltipMenu, "",
600 // set tip texts
601 myValueLaneDownButton->setTipText(TL("Move element down one lane"));
602 myValueLaneDownButton->setHelpText(TL("Move element down one lane"));
603 }
604 // check if disable
605 if (!attributeEnabled || !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
606 myValueTextField->disable();
607 myValueComboBox->disable();
608 myValueCheckButton->disable();
609 if (myValueLaneUpButton) {
610 myValueLaneUpButton->disable();
611 }
612 if (myValueLaneDownButton) {
613 myValueLaneDownButton->disable();
614 }
615 }
616}
617
618
619void
620GNEFrameAttributeModules::AttributesEditorRow::refreshAttributeElements(const std::string& value, const bool attributeEnabled, const bool computed) {
621 // check if disable element
622 const bool disableElement = !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
623 // continue depending of attribute element
624 if (myAttributeCheckButton) {
625 // set color text depending of computed
626 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
627 // check
628 if (attributeEnabled) {
629 myAttributeCheckButton->setCheck(TRUE);
630 } else {
631 myAttributeCheckButton->setCheck(FALSE);
632 }
633 // check if disable
634 if (disableElement) {
635 myAttributeCheckButton->disable();
636 } else {
637 myAttributeCheckButton->enable();
638 }
639 } else if (myAttributeButton) {
640 if (myAttributeButton->getSelector() == MID_GNE_SET_ATTRIBUTE_INSPECTPARENT) {
641 // update text and icon
642 if (myACParent->getTagProperty().getTag() == SUMO_TAG_VTYPE_DISTRIBUTION) {
643 myAttributeButton->setText("vTypeDist.");
644 } else {
645 myAttributeButton->setText(myACParent->getTagStr().c_str());
646 }
647 myAttributeButton->setIcon(myACParent->getACIcon());
648 // set tip text
649 myAttributeButton->setTipText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
650 myAttributeButton->setHelpText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
651 // set color text depending of computed
652 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
653 } else {
654 // set color text depending of computed
655 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
656 }
657 // check if disable
658 if (!attributeEnabled || disableElement) {
659 myAttributeButton->disable();
660 } else {
661 myAttributeButton->enable();
662 }
663 }
664 // check if update lane buttons
665 if (myValueLaneUpButton && myValueLaneDownButton) {
666 updateMoveLaneButtons(value);
667 }
668}
669
670
671void
672GNEFrameAttributeModules::AttributesEditorRow::refreshValueElements(const std::string& value, const bool attributeEnabled, const bool computed, const bool forceRefreshAttribute) {
673 // check if disable element
674 const bool disableElement = !attributeEnabled || !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
675 // continue depending of shown element
676 if (myValueTextField->shown()) {
677 // set last valid value and restore color if onlyValid is disabled
678 if (forceRefreshAttribute ||
679 (myValueTextField->getTextColor() == FXRGB(0, 0, 0)) ||
680 (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) {
681 myValueTextField->setText(value.c_str());
682 }
683 // set color text depending of computed
684 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
685 // check if disable
686 if (disableElement) {
687 myValueTextField->disable();
688 } else {
689 myValueTextField->enable();
690 }
691 } else if (myValueComboBox->shown()) {
692 // fill comboBox
693 fillComboBox(value);
694 // set color text depending of computed
695 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
696 // check if disable
697 if (disableElement) {
698 myValueComboBox->disable();
699 } else {
700 myValueComboBox->enable();
701 }
702 } else if (myValueCheckButton->shown()) {
703 if (GNEAttributeCarrier::canParse<bool>(value)) {
704 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
705 } else {
706 myValueCheckButton->setCheck(false);
707 }
708 // check if disable
709 if (myValueCheckButton) {
710 myValueComboBox->disable();
711 } else {
712 myValueComboBox->enable();
713 }
714 }
715}
716
717
718void
720 const auto inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
721 // clear and enable comboBox
722 myValueComboBox->clearItems();
723 // fill depeding of ACAttr
724 if (myACAttr.getAttr() == SUMO_ATTR_VCLASS) {
725 // add all vClasses with their icons
726 for (const auto& vClassStr : SumoVehicleClassStrings.getStrings()) {
727 myValueComboBox->appendIconItem(vClassStr.c_str(), VClassIcons::getVClassIcon(getVehicleClassID(vClassStr)));
728 }
729 } else if (myACAttr.isVType()) {
730 // get ACs
731 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
732 // fill comboBox with all vTypes and vType distributions sorted by ID
733 std::map<std::string, GNEDemandElement*> sortedTypes;
734 for (const auto& type : ACs->getDemandElements().at(SUMO_TAG_VTYPE)) {
735 sortedTypes[type.second->getID()] = type.second;
736 }
737 for (const auto& sortedType : sortedTypes) {
738 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
739 }
740 sortedTypes.clear();
741 for (const auto& typeDistribution : ACs->getDemandElements().at(SUMO_TAG_VTYPE_DISTRIBUTION)) {
742 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
743 }
744 for (const auto& sortedType : sortedTypes) {
745 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
746 }
747 } else if (myACAttr.getAttr() == SUMO_ATTR_ICON) {
748 // add all POIIcons with their icons
749 for (const auto& POIIcon : SUMOXMLDefinitions::POIIcons.getValues()) {
750 myValueComboBox->appendIconItem(SUMOXMLDefinitions::POIIcons.getString(POIIcon).c_str(), POIIcons::getPOIIcon(POIIcon));
751 }
752 } else if ((myACAttr.getAttr() == SUMO_ATTR_RIGHT_OF_WAY) && (inspectedACs.size() == 1) &&
753 (inspectedACs.front()->getTagProperty().getTag() == SUMO_TAG_JUNCTION)) {
754 // special case for junction types
755 if (inspectedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "priority") {
756 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::DEFAULT).c_str(), nullptr);
757 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::EDGEPRIORITY).c_str(), nullptr);
758 } else if (inspectedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "traffic_light") {
759 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::DEFAULT).c_str(), nullptr);
760 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::MIXEDPRIORITY).c_str(), nullptr);
761 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::ALLWAYSTOP).c_str(), nullptr);
762 } else {
763 myValueComboBox->disable();
764 }
765 } else {
766 // fill comboBox with discrete values
767 for (const auto& discreteValue : myACAttr.getDiscreteValues()) {
768 myValueComboBox->appendIconItem(discreteValue.c_str(), nullptr);
769 }
770 }
771 // set current value
772 const auto index = myValueComboBox->findItem(value.c_str());
773 if (index < 0) {
774 if (myValueComboBox->getNumItems() > 0) {
775 myValueComboBox->setCurrentItem(0);
776 } else {
777 myValueComboBox->disable();
778 }
779 } else {
780 myValueComboBox->setCurrentItem(index);
781 }
782}
783
784
785void
787 // first extract lane
788 const auto lane = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(value, false);
789 // check lane
790 if (lane) {
791 // check if disable move up
792 if ((lane->getIndex() + 1) >= (int)lane->getParentEdge()->getLanes().size()) {
793 myValueLaneUpButton->disable();
794 } else {
795 myValueLaneUpButton->enable();
796 }
797 // check if disable move down
798 if ((lane->getIndex() - 1) < 0) {
799 myValueLaneDownButton->disable();
800 } else {
801 myValueLaneDownButton->enable();
802 }
803 }
804 if (!isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
805 myValueLaneUpButton->disable();
806 myValueLaneDownButton->disable();
807 }
808}
809
810// ---------------------------------------------------------------------------
811// GNEFrameAttributeModules::AttributesEditor - methods
812// ---------------------------------------------------------------------------
813
815 MFXGroupBoxModule(frameParent, TL("Internal attributes")),
816 myFrameParent(frameParent),
817 myIncludeExtended(true) {
818 // resize myAttributesEditorRows
820 // create myAttributesFlowEditor
821 myAttributesEditorFlow = new GNEFlowEditor(frameParent->getViewNet(), frameParent);
822 // leave it hidden
824 // Create help button
826}
827
828
829void
831 myIncludeExtended = includeExtended;
832 // first remove all rows
833 for (auto& row : myAttributesEditorRows) {
834 // destroy and delete all rows
835 if (row != nullptr) {
836 row->destroy();
837 delete row;
838 row = nullptr;
839 }
840 }
841 // get inspected ACs
842 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
843 // declare flag to check if flow editor has to be shown
844 bool showFlowEditor = false;
845 if (ACs.size() > 0) {
846 // Iterate over attributes
847 for (const auto& attrProperty : ACs.front()->getTagProperty()) {
848 // declare flag to show/hide attribute
849 bool editAttribute = true;
850 // disable editing for unique attributes in case of multi-selection
851 if ((ACs.size() > 1) && attrProperty.isUnique()) {
852 editAttribute = false;
853 }
854 // disable editing of extended attributes if includeExtended isn't enabled
855 if (attrProperty.isExtended() && !includeExtended) {
856 editAttribute = false;
857 }
858 // disable editing of flow definition attributes, but enable flow editor
859 if (attrProperty.isFlowDefinition()) {
860 editAttribute = false;
861 showFlowEditor = true;
862 }
863 // continue if attribute is editable
864 if (editAttribute) {
865 // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
866 std::set<std::string> occurringValues;
867 // iterate over edited attributes
868 for (const auto& inspectedAC : ACs) {
869 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
870 }
871 // get current value
872 std::ostringstream oss;
873 for (auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
874 if (values != occurringValues.begin()) {
875 oss << " ";
876 }
877 oss << *values;
878 }
879 // obtain value to be shown in row
880 std::string value = oss.str();
881 // declare a flag for enabled attributes
882 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
883 // overwrite value if attribute is disabled (used by LinkIndex)
884 if (!attributeEnabled) {
885 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
886 }
887 // for types, the following attributes must be always enabled
888 if (ACs.front()->getTagProperty().isType() &&
889 ((attrProperty.getAttr() == SUMO_ATTR_LENGTH) ||
890 (attrProperty.getAttr() == SUMO_ATTR_MINGAP) ||
891 (attrProperty.getAttr() == SUMO_ATTR_MAXSPEED) ||
892 (attrProperty.getAttr() == SUMO_ATTR_DESIRED_MAXSPEED))) {
893 attributeEnabled = true;
894 }
895 // extra check for Triggered and container Triggered
896 if (ACs.front()->getTagProperty().isVehicleStop()) {
897 if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_TRIGGERED) == false)) {
898 attributeEnabled = false;
899 } else if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED_CONTAINERS) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_CONTAINER_TRIGGERED) == false)) {
900 attributeEnabled = false;
901 }
902 }
903 // check if this attribute is computed
904 const bool computed = (ACs.size() > 1) ? false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
905 // if is a Vtype, obtain icon
906 GNEAttributeCarrier* ACParent = nullptr;
907 if ((ACs.size() == 1) && attrProperty.isVType()) {
908 if (attrProperty.getAttr() == SUMO_ATTR_TYPE) {
909 ACParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
910 if (ACParent == nullptr) {
911 ACParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
912 }
913 }
914 }
915 // create attribute editor row
916 myAttributesEditorRows[attrProperty.getPositionListed()] = new AttributesEditorRow(this, attrProperty, value, attributeEnabled, computed, ACParent);
917 }
918 }
919 // check if Flow editor has to be shown
920 if (showFlowEditor) {
921 myAttributesEditorFlow->showFlowEditor(ACs);
922 } else {
923 myAttributesEditorFlow->hideFlowEditor();
924 }
925 // show AttributesEditor
926 show();
927 } else {
928 myAttributesEditorFlow->hideFlowEditor();
929 }
930 // reparent help button (to place it at bottom)
931 myHelpButton->reparent(this);
932}
933
934
935void
937 // hide AttributesEditorFlowModule
938 myAttributesEditorFlow->hideFlowEditor();
939 // hide also AttributesEditor
940 hide();
941}
942
943
944void
945GNEFrameAttributeModules::AttributesEditor::refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition) {
946 // get inspected ACs
947 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
948 // first check if there is inspected attribute carriers
949 if (ACs.size() > 0) {
950 // Iterate over inspected attribute carriers
951 for (const auto& attrProperty : ACs.front()->getTagProperty()) {
952 // declare flag to show/hide attribute
953 bool editAttribute = true;
954 // disable editing for unique attributes in case of multi-selection
955 if ((ACs.size() > 1) && attrProperty.isUnique()) {
956 editAttribute = false;
957 }
958 // disable editing of extended attributes if includeExtended isn't enabled
959 if (attrProperty.isExtended() && !myIncludeExtended) {
960 editAttribute = false;
961 }
962 // disable editing of flow definition attributes, but enable flow editor
963 if (attrProperty.isFlowDefinition()) {
964 editAttribute = false;
965 }
966 // continue if attribute is editable
967 if (editAttribute) {
968 // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
969 std::set<std::string> occurringValues;
970 // iterate over edited attributes
971 for (const auto& inspectedAC : ACs) {
972 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
973 }
974 // get current value
975 std::ostringstream oss;
976 for (auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
977 if (values != occurringValues.begin()) {
978 oss << " ";
979 }
980 oss << *values;
981 }
982 // obtain value to be shown in row
983 std::string value = oss.str();
984 // declare a flag for enabled attributes
985 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
986 // for types, the following attributes must be always enabled
987 if (ACs.front()->getTagProperty().isType() &&
988 ((attrProperty.getAttr() == SUMO_ATTR_LENGTH) ||
989 (attrProperty.getAttr() == SUMO_ATTR_MINGAP) ||
990 (attrProperty.getAttr() == SUMO_ATTR_MAXSPEED) ||
991 (attrProperty.getAttr() == SUMO_ATTR_DESIRED_MAXSPEED))) {
992 attributeEnabled = true;
993 }
994 // overwrite value if attribute is disabled (used by LinkIndex)
995 if (!attributeEnabled) {
996 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
997 }
998 // extra check for Triggered and container Triggered
999 if (ACs.front()->getTagProperty().isVehicleStop()) {
1000 if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_TRIGGERED) == false)) {
1001 attributeEnabled = false;
1002 } else if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED_CONTAINERS) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_CONTAINER_TRIGGERED) == false)) {
1003 attributeEnabled = false;
1004 }
1005 }
1006 // check if this attribute is computed
1007 const bool computed = (ACs.size() > 1) ? false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
1008 // Check if Position or Shape refresh has to be forced
1009 if ((attrProperty.getAttr() == SUMO_ATTR_SHAPE) && forceRefreshShape) {
1010 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, true, attributeEnabled, computed, nullptr);
1011 } else if ((attrProperty.getAttr() == SUMO_ATTR_POSITION) && forceRefreshPosition) {
1012 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, true, attributeEnabled, computed, nullptr);
1013 } else if (attrProperty.isVType() && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
1014 attrProperty.getTagPropertyParent().isContainer())) {
1015 // get type/distribution parent
1016 auto typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
1017 if (typeParent == nullptr) {
1018 typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
1019 }
1020 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, false, attributeEnabled, computed, typeParent);
1021 } else {
1022 // Refresh attributes maintain invalid values
1023 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, false, attributeEnabled, computed, nullptr);
1024 }
1025 }
1026 }
1027 // check if flow editor has to be update
1028 if (myAttributesEditorFlow->shownFlowEditor()) {
1029 myAttributesEditorFlow->refreshFlowEditor();
1030 }
1031 }
1032}
1033
1034
1035GNEFrame*
1037 return myFrameParent;
1038}
1039
1040
1041long
1043 // open Help attributes dialog if there is inspected ACs
1044 if (myFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
1045 // open Help attributes dialog
1046 myFrameParent->openHelpAttributesDialog(myFrameParent->getViewNet()->getInspectedAttributeCarriers().front());
1047 }
1048 return 1;
1049}
1050
1051// ---------------------------------------------------------------------------
1052// GNEFrameAttributeModules::AttributesEditorExtended- methods
1053// ---------------------------------------------------------------------------
1054
1056 MFXGroupBoxModule(frameParent, TL("Extended attributes")),
1057 myFrameParent(frameParent) {
1058 // Create open dialog button
1059 GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Open attributes editor"), "", "", nullptr, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButton);
1060}
1061
1062
1064
1065
1066void
1070
1071
1072void
1076
1077
1078long
1080 // open GNEAttributesCreator extended dialog
1081 myFrameParent->attributesEditorExtendedDialogOpened();
1082 return 1;
1083}
1084
1085// ---------------------------------------------------------------------------
1086// GNEFrameAttributeModules::GenericDataAttributes - methods
1087// ---------------------------------------------------------------------------
1088
1090 MFXGroupBoxModule(frameParent, TL("Attributes")),
1091 myFrameParent(frameParent) {
1092 // create textfield and buttons
1095}
1096
1097
1099
1100
1101void
1103 // refresh GenericDataAttributes
1104 refreshGenericDataAttributes();
1105 // show groupbox
1106 show();
1107}
1108
1109
1110void
1115
1116
1117void
1119 myTextFieldParameters->setText(getParametersStr().c_str());
1120 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1121 myTextFieldParameters->killFocus();
1122}
1123
1124
1125const Parameterised::Map&
1129
1130
1131std::string
1133 std::string result;
1134 // Generate an string using the following structure: "key1=value1|key2=value2|...
1135 for (const auto& parameter : myParameters) {
1136 result += parameter.first + "=" + parameter.second + "|";
1137 }
1138 // remove the last "|"
1139 if (!result.empty()) {
1140 result.pop_back();
1141 }
1142 return result;
1143}
1144
1145
1146std::vector<std::pair<std::string, std::string> >
1148 std::vector<std::pair<std::string, std::string> > result;
1149 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
1150 for (const auto& parameter : myParameters) {
1151 result.push_back(std::make_pair(parameter.first, parameter.second));
1152 }
1153 return result;
1154}
1155
1156
1157void
1158GNEFrameAttributeModules::GenericDataAttributes::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
1159 // declare result string
1160 std::string result;
1161 // Generate an string using the following structure: "key1=value1|key2=value2|...
1162 for (const auto& parameter : parameters) {
1163 result += parameter.first + "=" + parameter.second + "|";
1164 }
1165 // remove the last "|"
1166 if (!result.empty()) {
1167 result.pop_back();
1168 }
1169 // set result in textField (and call onCmdEditParameters)
1170 myTextFieldParameters->setText(result.c_str(), TRUE);
1171}
1172
1173
1174GNEFrame*
1178
1179
1180bool
1182 if (myTextFieldParameters->getText().empty()) {
1183 return true;
1184 } else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1185 return false;
1186 } else {
1187 return Parameterised::areAttributesValid(getParametersStr());
1188 }
1189}
1190
1191
1192long
1194 // write debug information
1195 WRITE_DEBUG("Open single parameters dialog");
1196 if (GNESingleParametersDialog(this).execute()) {
1197 // write debug information
1198 WRITE_DEBUG("Close single parameters dialog");
1199 // Refresh parameter EditorCreator
1200 refreshGenericDataAttributes();
1201 } else {
1202 // write debug information
1203 WRITE_DEBUG("Cancel single parameters dialog");
1204 }
1205 return 1;
1206}
1207
1208
1209long
1211 // clear current existent parameters
1212 myParameters.clear();
1213 // check if current given string is valid
1214 if (Parameterised::areParametersValid(myTextFieldParameters->getText().text(), true)) {
1215 // parsed parameters ok, then set text field black and continue
1216 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1217 myTextFieldParameters->killFocus();
1218 // obtain parameters "key=value"
1219 std::vector<std::string> parameters = StringTokenizer(myTextFieldParameters->getText().text(), "|", true).getVector();
1220 // iterate over parameters
1221 for (const auto& parameter : parameters) {
1222 // obtain key, value
1223 std::vector<std::string> keyParam = StringTokenizer(parameter, "=", true).getVector();
1224 // save it in myParameters
1225 myParameters[keyParam.front()] = keyParam.back();
1226 }
1227 // overwrite myTextFieldParameters (to remove duplicated parameters
1228 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1229 } else {
1230 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1231 }
1232 return 1;
1233}
1234
1235// ---------------------------------------------------------------------------
1236// GNEFrameAttributeModules::ParametersEditor - methods
1237// ---------------------------------------------------------------------------
1238
1240 MFXGroupBoxModule(inspectorFrameParent, TL("Parameters")),
1241 myInspectorFrameParent(inspectorFrameParent) {
1242 // create textfield and buttons
1245}
1246
1247
1249 MFXGroupBoxModule(typeFrameParent, TL("Parameters")),
1250 myTypeFrameParent(typeFrameParent) {
1251 // create textfield and buttons
1254}
1255
1256
1258
1259
1262 return myInspectorFrameParent ? myInspectorFrameParent->getViewNet() : myTypeFrameParent->getViewNet();
1263}
1264
1265
1266void
1268 if (myInspectorFrameParent) {
1269 // get inspected ACs
1270 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1271 if ((inspectedACs.size() > 0) && inspectedACs.front()->getTagProperty().hasParameters()) {
1272 // refresh ParametersEditor
1273 refreshParametersEditor();
1274 // show groupbox
1275 show();
1276 } else {
1277 hideParametersEditor();
1278 }
1279 } else if (myTypeFrameParent) {
1280 if (myTypeFrameParent->getTypeSelector()->getCurrentType() != nullptr) {
1282 refreshParametersEditor();
1283 // show groupbox
1284 show();
1285 } else {
1286 hideParametersEditor();
1287 }
1288 } else {
1289 hideParametersEditor();
1290 }
1291}
1292
1293
1294void
1296 // hide groupbox
1297 hide();
1298}
1299
1300
1301void
1303 if (myInspectorFrameParent) {
1304 // get inspected ACs
1305 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1306 // get front AC
1307 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1308 // continue depending of frontAC
1309 if (frontAC && frontAC->getTagProperty().hasParameters()) {
1310 // check if we're editing a single or a multiple AC
1311 if (inspectedACs.size() == 1) {
1312 // set text field parameters
1313 myTextFieldParameters->setText(frontAC->getAttribute(GNE_ATTR_PARAMETERS).c_str());
1314 } else if (inspectedACs.size() > 0) {
1315 // check if parameters of all inspected ACs are different
1316 std::string parameters = frontAC->getAttribute(GNE_ATTR_PARAMETERS);
1317 for (const auto& AC : inspectedACs) {
1318 if (parameters != AC->getAttribute(GNE_ATTR_PARAMETERS)) {
1319 parameters = "different parameters";
1320 }
1321 }
1322 // set text field
1323 myTextFieldParameters->setText(parameters.c_str());
1324 }
1325 // reset color
1326 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1327 // disable myTextFieldParameters if Tag correspond to an network element but we're in demand mode (or vice versa), disable all elements
1328 if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), frontAC)) {
1329 myTextFieldParameters->enable();
1330 myButtonEditParameters->enable();
1331 } else {
1332 myTextFieldParameters->disable();
1333 myButtonEditParameters->disable();
1334 }
1335 }
1336 } else if (myTypeFrameParent) {
1337 // get type
1338 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1339 // continue depending of frontAC
1340 if (type) {
1341 // set text field parameters
1342 myTextFieldParameters->setText(type->getAttribute(GNE_ATTR_PARAMETERS).c_str());
1343 // reset color
1344 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1345 // disable myTextFieldParameters if Tag correspond to an network element but we're in demand mode (or vice versa), disable all elements
1346 if (GNEFrameAttributeModules::isSupermodeValid(myTypeFrameParent->getViewNet(), type)) {
1347 myTextFieldParameters->enable();
1348 myButtonEditParameters->enable();
1349 } else {
1350 myTextFieldParameters->disable();
1351 myButtonEditParameters->disable();
1352 }
1353 }
1354 }
1355}
1356
1357
1360 return myInspectorFrameParent;
1361}
1362
1363
1366 return myTypeFrameParent;
1367}
1368
1369
1370long
1372 if (myInspectorFrameParent) {
1373 // get inspected ACs
1374 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1375 // get front AC
1376 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1377 // continue depending of frontAC
1378 if (frontAC && frontAC->getTagProperty().hasParameters()) {
1379 if (inspectedACs.size() > 1) {
1380 // write debug information
1381 WRITE_DEBUG("Open multiple parameters dialog");
1382 // open multiple parameters dialog
1383 if (GNEMultipleParametersDialog(this).execute()) {
1384 // write debug information
1385 WRITE_DEBUG("Close multiple parameters dialog");
1386 // update frame parent after attribute successfully set
1387 myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1388 // Refresh parameter EditorInspector
1389 refreshParametersEditor();
1390 } else {
1391 // write debug information
1392 WRITE_DEBUG("Cancel multiple parameters dialog");
1393 }
1394 } else {
1395 // write debug information
1396 WRITE_DEBUG("Open single parameters dialog");
1397 if (GNESingleParametersDialog(this).execute()) {
1398 // write debug information
1399 WRITE_DEBUG("Close single parameters dialog");
1400 // update frame parent after attribute successfully set
1401 myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1402 // Refresh parameter EditorInspector
1403 refreshParametersEditor();
1404 } else {
1405 // write debug information
1406 WRITE_DEBUG("Cancel single parameters dialog");
1407 }
1408 }
1409 }
1410 } else if (myTypeFrameParent) {
1411 // get type
1412 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1413 // continue depending of type
1414 if (type) {
1415 // write debug information
1416 WRITE_DEBUG("Open single parameters dialog");
1417 if (GNESingleParametersDialog(this).execute()) {
1418 // write debug information
1419 WRITE_DEBUG("Close single parameters dialog");
1420 // Refresh parameter EditorInspector
1421 refreshParametersEditor();
1422 } else {
1423 // write debug information
1424 WRITE_DEBUG("Cancel single parameters dialog");
1425 }
1426 }
1427 }
1428 return 1;
1429}
1430
1431
1432long
1434 if (myInspectorFrameParent) {
1435 const auto& inspectedACs = myInspectorFrameParent->getAttributesEditor()->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1436 // get front AC
1437 GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1438 // continue depending of frontAC
1439 if (frontAC && frontAC->getTagProperty().hasParameters()) {
1440 // check if current given string is valid
1441 if (frontAC->isValid(GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
1442 // parsed parameters ok, then set text field black and continue
1443 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1444 myTextFieldParameters->killFocus();
1445 // check inspected parameters
1446 if (inspectedACs.size() == 1) {
1447 // begin undo list
1448 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC, "change parameters");
1449 // set parameters
1450 frontAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1451 // end undo list
1452 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1453 } else if (inspectedACs.size() > 0) {
1454 // begin undo list
1455 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC, "change multiple parameters");
1456 // set parameters in all ACs
1457 for (const auto& inspectedAC : inspectedACs) {
1458 inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1459 }
1460 // end undo list
1461 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1462 }
1463 // update frame parent after attribute successfully set
1464 myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1465 } else {
1466 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1467 }
1468 }
1469 } else if (myTypeFrameParent) {
1470 // get type
1471 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1472 // continue depending of frontAC
1473 if (type) {
1474 // check if current given string is valid
1475 if (type->isValid(GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
1476 // parsed parameters ok, then set text field black and continue
1477 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1478 myTextFieldParameters->killFocus();
1479 // begin undo list
1480 myTypeFrameParent->getViewNet()->getUndoList()->begin(type, "change parameters");
1481 // set parameters
1482 type->setACParameters(myTextFieldParameters->getText().text(), myTypeFrameParent->getViewNet()->getUndoList());
1483 // end undo list
1484 myTypeFrameParent->getViewNet()->getUndoList()->end();
1485 } else {
1486 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1487 }
1488 }
1489 }
1490 return 1;
1491}
1492
1493
1494bool
1496 if (viewNet->getEditModes().isCurrentSupermodeNetwork() &&
1498 return true;
1499 } else if (viewNet->getEditModes().isCurrentSupermodeDemand() &&
1501 return true;
1502 } else if (viewNet->getEditModes().isCurrentSupermodeData() &&
1504 return true;
1505 } else {
1506 return false;
1507 }
1508}
1509
1510
1511bool
1514 return (viewNet->getEditModes().isCurrentSupermodeNetwork());
1515 } else if (ACAttr.getTagPropertyParent().isDemandElement()) {
1516 return (viewNet->getEditModes().isCurrentSupermodeDemand());
1517 } else if (ACAttr.getTagPropertyParent().isDataElement() || ACAttr.getTagPropertyParent().isMeanData()) {
1518 return (viewNet->getEditModes().isCurrentSupermodeData());
1519 } else {
1520 return false;
1521 }
1522}
1523
1524/****************************************************************************/
FXDEFMAP(GNEFrameAttributeModules::AttributesEditorRow) AttributesEditorRowMap[]
@ MID_GNE_MOVEUP
move up
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:939
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition GUIAppEnum.h:983
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
Definition GUIAppEnum.h:975
@ MID_HELP
help button
Definition GUIAppEnum.h:653
@ MID_GNE_SET_ATTRIBUTE_INSPECTPARENT
inspect attribute parent element
Definition GUIAppEnum.h:977
@ MID_GNE_SET_ATTRIBUTE_COLOR
edit attribute color
Definition GUIAppEnum.h:981
@ MID_GNE_SET_ATTRIBUTE_ALLOW
edit attribute allow
Definition GUIAppEnum.h:979
@ MID_GNE_SET_ATTRIBUTE_BOOL
bool attribute edited
Definition GUIAppEnum.h:973
@ MID_GNE_MOVEDOWN
move down
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
Definition GUIDesigns.h:94
#define GUIDesignButtonIcon
button only with icon
Definition GUIDesigns.h:97
#define GUIDesignButton
Definition GUIDesigns.h:88
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
Definition GUIDesigns.h:308
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:317
#define GUIDesignTextField
Definition GUIDesigns.h:65
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:405
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
Definition GUIDesigns.h:100
#define GUIDesignComboBoxVisibleItemsMedium
combo box medium small
Definition GUIDesigns.h:53
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:80
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:198
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition GUIDesigns.h:207
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:258
#define WRITE_DEBUG(msg)
Definition MsgHandler.h:306
#define TL(string)
Definition MsgHandler.h:315
#define TLF(string,...)
Definition MsgHandler.h:317
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
POIIcon
POI icons.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_CONTAINER_TRIGGERED
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_ICON
icon
@ SUMO_ATTR_LANE
@ SUMO_ATTR_MINGAP
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_DESIRED_MAXSPEED
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_VCLASS
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_MAXSPEED
@ SUMO_ATTR_ID
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_POSITION
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
Dialog for edit rerouters.
void setACParameters(const std::string &parameters, GNEUndoList *undoList)
set parameters (string)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
static const size_t MAXNUMBEROFATTRIBUTES
max number of attributes allowed for every tag
const GNETagProperties & getTagPropertyParent() const
get reference to tagProperty parent
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
void hideFlowEditor()
hide group box
void showAttributesEditorExtendedModule()
show AttributesEditorExtended modul
AttributesEditorExtended(GNEFrame *frameParent)
FOX-declaration.
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
GNEFlowEditor * myAttributesEditorFlow
GNEFlowEditor modul.
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
long onCmdAttributesEditorHelp(FXObject *, FXSelector, void *)
void showAttributeEditorModule(bool includeExtended)
show attributes of multiple ACs
std::vector< AttributesEditorRow * > myAttributesEditorRows
list of Attribute editor rows
AttributesEditor(GNEFrame *inspectorFrameParent)
FOX-declaration.
bool mergeJunction(SumoXMLAttr attr, const std::vector< GNEAttributeCarrier * > &inspectedACs, const std::string &newVal) const
check junction merging
long onCmdSetAttribute(FXObject *, FXSelector, void *)
try to set new attribute value
long onCmdMoveElementLaneDown(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
std::string stripWhitespaceAfterComma(const std::string &stringValue)
removed invalid spaces of Positions and shapes
long onCmdOpenAllowDialog(FXObject *, FXSelector, void *)
open model dialog for edit allow
void refreshValueElements(const std::string &value, const bool attributeEnabled, const bool computed, const bool forceRefreshAttribute)
build value elements();
bool isAttributesEditorRowValid() const
check if current attribute of TextField/ComboBox is valid
void destroy()
destroy GNEAttributesCreatorRow (but don't delete)
long onCmdInspectParent(FXObject *, FXSelector, void *)
inspect parent
void fillComboBox(const std::string &value)
fill comboBox with discrete values
long onCmdSelectCheckButton(FXObject *, FXSelector, void *)
called when user press a check button
long onCmdMoveElementLaneUp(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
void buildAttributeElements(const bool attributeEnabled, const bool computed)
build Attribute elements
void refreshAttributeElements(const std::string &value, const bool attributeEnabled, const bool computed)
refresh Attribute elements
long onCmdOpenColorDialog(FXObject *, FXSelector, void *)
open model dialog for edit color
void updateMoveLaneButtons(const std::string &value)
update move lane buttons
void buildValueElements(const bool attributeEnabled, const bool computed)
build value elements();
void refreshAttributesEditorRow(const std::string &value, const bool forceRefreshAttribute, const bool attributeEnabled, const bool computed, GNEAttributeCarrier *ACParent)
refresh current row
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
bool areAttributesValid() const
check if current attributes are valid
const Parameterised::Map & getParametersMap() const
get parameters as map
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
FXTextField * myTextFieldParameters
text field for write parameters
void showGenericDataAttributes()
show netedit attributes EditorCreator
GNEFrame * getFrameParent() const
pointer to frame parent
std::vector< std::pair< std::string, std::string > > getParameters() const
get parameters as vector of strings
std::string getParametersStr() const
get parameters as string
GenericDataAttributes(GNEFrame *frameParent)
FOX-declaration.
void hideGenericDataAttributes()
hide netedit attributes EditorCreator
void setParameters(const std::vector< std::pair< std::string, std::string > > &parameters)
set parameters
void refreshParametersEditor()
refresh netedit attributes
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
long onCmdEditParameters(FXObject *, FXSelector, void *)
ParametersEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
void hideParametersEditor()
hide netedit attributes EditorInspector
GNEInspectorFrame * getInspectorFrameParent() const
get inspector frame parent
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
FXTextField * myTextFieldParameters
text field for write parameters
GNETypeFrame * getTypeFrameParent() const
get type frame parent
void showParametersEditor()
show netedit attributes EditorInspector
static bool isSupermodeValid(const GNEViewNet *viewNet, const GNEAttributeCarrier *AC)
return true if AC can be edited in the current supermode
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:150
void openHelpAttributesDialog(const GNEAttributeCarrier *AC) const
Open help attributes dialog.
Definition GNEFrame.cpp:184
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:125
Dialog for edit parameters.
bool isMeanData() const
return true if tag correspond to a mean data element
bool isNetworkElement() const
element sets
bool isDataElement() const
return true if tag correspond to a data element
bool hasParameters() const
return true if Tag correspond to an element that supports parameters "key1=value1|key2=value2|....
bool isDemandElement() const
return true if tag correspond to a demand element
bool isAdditionalElement() const
return true if tag correspond to an additional element (note: this include TAZ, shapes and wires)
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...
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEUndoList * getUndoList() const
get the undoList object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
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
ComboBox with icon.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:112
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:106
static FXIcon * getPOIIcon(POIIcon iconType)
returns icon associated to the given POI image
Definition POIIcons.cpp:30
static bool areAttributesValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to an attributes map "key1=value1|key2=value2|....
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const RGBColor BLACK
Definition RGBColor.h:193
static StringBijection< POIIcon > POIIcons
POI icon values.
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
std::vector< T > getValues() const
std::vector< std::string > getVector()
return vector of strings
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
Definition json.hpp:4471
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network