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& inspectedElements = viewNet->getInspectedElements();
198 if (inspectedElements.getFirstAC()) {
199 // create FXColorDialog
200 FXColorDialog colordialog(this, TL("Color Dialog"));
201 colordialog.setTarget(this);
202 colordialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
203 // If previous attribute wasn't correct, set black as default color
204 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
205 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
206 } else if (!myACAttr.getDefaultValue().empty()) {
207 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myACAttr.getDefaultValue())));
208 } else {
209 colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
210 }
211 // execute dialog to get a new color
212 if (colordialog.execute()) {
213 std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
214 myValueTextField->setText(newValue.c_str());
215 if (inspectedElements.getFirstAC()->isValid(myACAttr.getAttr(), newValue)) {
216 // if its valid for the first AC than its valid for all (of the same type)
217 if (inspectedElements.isInspectingMultipleElements()) {
218 viewNet->getUndoList()->begin(inspectedElements.getFirstAC(), TL("change multiple attributes"));
219 }
220 // Set new value of attribute in all selected ACs
221 for (const auto& inspectedAC : inspectedElements.getACs()) {
222 inspectedAC->setAttribute(myACAttr.getAttr(), newValue, viewNet->getUndoList());
223 }
224 // finish change multiple attributes
225 if (inspectedElements.isInspectingMultipleElements()) {
226 viewNet->getUndoList()->end();
227 }
228 // If previously value was incorrect, change font color to black
229 myValueTextField->setTextColor(FXRGB(0, 0, 0));
230 myValueTextField->killFocus();
231 }
232 }
233 }
234 return 1;
235}
236
237
238long
240 GNEViewNet* viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
241 const auto& inspectedElements = viewNet->getInspectedElements();
242 if (inspectedElements.getFirstAC()) {
243 // if its valid for the first AC than its valid for all (of the same type)
244 if (inspectedElements.isInspectingMultipleElements()) {
245 viewNet->getUndoList()->begin(inspectedElements.getFirstAC(), TL("change multiple attributes"));
246 }
247 // declare accept changes
248 bool acceptChanges = false;
249 // open GNEAllowVClassesDialog (also used to modify SUMO_ATTR_CHANGE_LEFT etc
250 GNEAllowVClassesDialog(viewNet, inspectedElements.getFirstAC(), myACAttr.getAttr(), &acceptChanges).execute();
251 // continue depending of acceptChanges
252 if (acceptChanges) {
253 std::string allowed = inspectedElements.getFirstAC()->getAttribute(myACAttr.getAttr());
254 // Set new value of attribute in all selected ACs
255 for (const auto& inspectedAC : inspectedElements.getACs()) {
256 inspectedAC->setAttribute(myACAttr.getAttr(), allowed, viewNet->getUndoList());
257 }
258 // finish change multiple attributes
259 if (inspectedElements.isInspectingMultipleElements()) {
260 viewNet->getUndoList()->end();
261 }
262 // update frame parent after attribute successfully set
263 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
264 }
265 }
266 return 1;
267}
268
269
270long
272 auto viewnet = myAttributesEditorParent->getFrameParent()->getViewNet();
273 viewnet->getViewParent()->getInspectorFrame()->inspectChild(myACParent, viewnet->getInspectedElements().getFirstAC());
274 return 1;
275}
276
277
278long
280 // get view net
281 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
282 const auto& inspectedElements = viewNet->getInspectedElements();
283 if (inspectedElements.getFirstAC()) {
284 // extract lane
285 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_LANE));
286 // set next lane
287 inspectedElements.getFirstAC()->setAttribute(SUMO_ATTR_LANE, lane->getParentEdge()->getID() + "_" + toString(lane->getIndex() + 1), viewNet->getUndoList());
288 // update frame parent after attribute successfully set
289 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
290 }
291 return 1;
292}
293
294
295long
297 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
298 const auto& inspectedElements = viewNet->getInspectedElements();
299 if (inspectedElements.getFirstAC()) {
300 // extract lane
301 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_LANE));
302 // set next lane
303 inspectedElements.getFirstAC()->setAttribute(SUMO_ATTR_LANE, lane->getParentEdge()->getID() + "_" + toString(lane->getIndex() - 1), viewNet->getUndoList());
304 // update frame parent after attribute successfully set
305 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
306 }
307 return 1;
308}
309
310
311long
313 const auto& inspectedElements = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedElements();
314 // Declare changed value
315 std::string newVal;
316 // First, obtain the string value of the new attribute depending of their type
317 if (myACAttr.isBool()) {
318 // first check if we're editing boolean as a list of string or as a checkbox
319 if (myValueCheckButton->shown()) {
320 // Set true o false depending of the checkBox
321 if (myValueCheckButton->getCheck()) {
322 myValueCheckButton->setText("true");
323 newVal = "true";
324 } else {
325 myValueCheckButton->setText("false");
326 newVal = "false";
327 }
328 } else {
329 // obtain boolean value of myValueTextField (because we're inspecting multiple attribute carriers with different values)
330 newVal = myValueTextField->getText().text();
331 }
332 } else if (myACAttr.isDiscrete()) {
333 // check if we have the new value in a text field or in the combo box
334 if (myValueTextField->shown()) {
335 // Get value obtained using AttributesEditor
336 newVal = myValueTextField->getText().text();
337 } else {
338 // Get value of ComboBox
339 newVal = myValueComboBox->getText().text();
340 }
341 } else if (myACAttr.isVType()) {
342 // Get value of ComboBox
343 newVal = myValueComboBox->getText().text();
344 } else {
345 // Check if default value of attribute must be set
346 if (myValueTextField->getText().empty() && myACAttr.hasDefaultValue()) {
347 newVal = myACAttr.getDefaultValue();
348 myValueTextField->setText(newVal.c_str());
349 } else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
350 // filter int attributes
351 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
352 // check if myValueTextField has to be updated
353 if ((doubleValue - (int)doubleValue) == 0) {
354 newVal = toString((int)doubleValue);
355 myValueTextField->setText(newVal.c_str(), FALSE);
356 }
357 } else if ((myACAttr.getAttr() == SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
358 // filter angle
359 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
360 // filter if angle isn't between [0,360]
361 if ((angle < 0) || (angle > 360)) {
362 // apply module
363 angle = fmod(angle, 360);
364 }
365 // set newVal
366 newVal = toString(angle);
367 // update Textfield
368 myValueTextField->setText(newVal.c_str(), FALSE);
369 } else {
370 // obtain value of myValueTextField
371 newVal = myValueTextField->getText().text();
372 }
373 }
374 // we need a extra check for Position and Shape Values, due #2658
375 if ((myACAttr.getAttr() == SUMO_ATTR_POSITION) || (myACAttr.getAttr() == SUMO_ATTR_SHAPE)) {
376 newVal = stripWhitespaceAfterComma(newVal);
377 }
378 // check if use default value
379 const bool useDefaultValue = (newVal.empty() && myACAttr.hasDefaultValue());
380 // Check if attribute must be changed
381 if ((inspectedElements.isInspectingElements()) && (inspectedElements.getFirstAC()->isValid(myACAttr.getAttr(), newVal) || useDefaultValue)) {
382 // check if we're merging junction
383 if (!mergeJunction(myACAttr.getAttr(), newVal)) {
384 // if its valid for the first AC than its valid for all (of the same type)
385 if (inspectedElements.isInspectingMultipleElements()) {
386 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(), TL("change multiple attributes"));
387 } else if (myACAttr.getAttr() == SUMO_ATTR_ID) {
388 // IDs attribute has to be encapsulated
389 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(), TLF("change % attribute", myACAttr.getTagPropertyParent().getTagStr()));
390 }
391 // Set new value of attribute in all selected ACs
392 for (const auto& inspectedAC : inspectedElements.getACs()) {
393 if (useDefaultValue) {
394 inspectedAC->setAttribute(myACAttr.getAttr(), myACAttr.getDefaultValue(), myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
395 } else {
396 inspectedAC->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
397 }
398 }
399 // finish change multiple attributes or ID Attributes
400 if (inspectedElements.isInspectingMultipleElements()) {
401 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
402 } else if (myACAttr.getAttr() == SUMO_ATTR_ID) {
403 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
404 }
405 // reset colors
406 if (myValueTextField->shown()) {
407 myValueTextField->setTextColor(FXRGB(0, 0, 0));
408 myValueTextField->setBackColor(FXRGB(255, 255, 255));
409 myValueTextField->killFocus();
410 } else if (myValueComboBox->shown()) {
411 myValueComboBox->setTextColor(FXRGB(0, 0, 0));
412 myValueComboBox->setBackColor(FXRGB(255, 255, 255));
413 }
414 // in this case, we need to refresh the other values (For example, allow/Disallow objects)
415 myAttributesEditorParent->refreshAttributeEditor(false, false);
416 // update frame parent after attribute successfully set
417 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
418 }
419 } else {
420 // If value of TextField isn't valid, change color to Red depending of type
421 if (myValueTextField->shown()) {
422 myValueTextField->setTextColor(FXRGB(255, 0, 0));
423 if (newVal.empty()) {
424 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
425 }
426 } else if (myValueComboBox->shown()) {
427 myValueComboBox->setTextColor(FXRGB(255, 0, 0));
428 if (newVal.empty()) {
429 myValueComboBox->setBackColor(FXRGBA(255, 213, 213, 255));
430 }
431 }
432 // Write Warning in console if we're in testing mode
433 WRITE_DEBUG(TLF("Value '%' for attribute % of % isn't valid", newVal, myACAttr.getAttrStr(), myACAttr.getTagPropertyParent().getTagStr()));
434 }
435 return 1;
436}
437
438
439long
441 const auto& inspectedElements = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedElements();
442 // obtain undoList (To improve code legibly)
443 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList();
444 // check if we have to enable or disable
445 if (myAttributeCheckButton->getCheck()) {
446 // enable input values
447 myValueCheckButton->enable();
448 myValueTextField->enable();
449 // enable attribute
450 undoList->begin(inspectedElements.getFirstAC(), TL("enable attribute '") + myACAttr.getAttrStr() + "'");
451 inspectedElements.getFirstAC()->enableAttribute(myACAttr.getAttr(), undoList);
452 undoList->end();
453 } else {
454 // disable input values
455 myValueCheckButton->disable();
456 myValueTextField->disable();
457 // disable attribute
458 undoList->begin(inspectedElements.getFirstAC(), TL("disable attribute '") + myACAttr.getAttrStr() + "'");
459 inspectedElements.getFirstAC()->disableAttribute(myACAttr.getAttr(), undoList);
460 undoList->end();
461 }
462 return 0;
463}
464
465
467 myAttributesEditorParent(nullptr) {
468}
469
470
471std::string
473 std::string result(stringValue);
474 while (result.find(", ") != std::string::npos) {
475 result = StringUtils::replace(result, ", ", ",");
476 }
477 return result;
478}
479
480
481bool
483 const auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
484 const auto& inspectedElements = viewNet->getInspectedElements();
485 // check if we're editing junction position
486 if (inspectedElements.isInspectingSingleElement() && (inspectedElements.getFirstAC()->getTagProperty().getTag() == SUMO_TAG_JUNCTION) && (attr == SUMO_ATTR_POSITION)) {
487 // retrieve original junction
488 GNEJunction* movedJunction = viewNet->getNet()->getAttributeCarriers()->retrieveJunction(inspectedElements.getFirstAC()->getID());
489 // parse position
490 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
491 // iterate over network junction
492 for (const auto& targetjunction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
493 // check distance position
494 if ((targetjunction.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
495 viewNet->askMergeJunctions(movedJunction, targetjunction.second)) {
496 viewNet->getNet()->mergeJunctions(movedJunction, targetjunction.second, viewNet->getUndoList());
497 return true;
498 }
499 }
500 }
501 // nothing to merge
502 return false;
503}
504
505
506void
507GNEFrameAttributeModules::AttributesEditorRow::buildAttributeElements(const bool attributeEnabled, const bool computed) {
508 // get static tooltip menu
509 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
510 // check if disable element
511 const bool disableRow = !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
512 // continue depending of attribute
513 if (myACParent) {
514 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(),
515 myACParent->getACIcon(), this, MID_GNE_SET_ATTRIBUTE_INSPECTPARENT, GUIDesignButtonAttribute);
516 // set color text depending of computed
517 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
518 // set tip text
519 myAttributeButton->setTipText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
520 myAttributeButton->setHelpText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
521 // check if disable
522 if (disableRow) {
523 myAttributeButton->disable();
524 }
525 } else if (myACAttr.isActivatable()) {
526 myAttributeCheckButton = new FXCheckButton(this, myACAttr.getAttrStr().c_str(), this, MID_GNE_SET_ATTRIBUTE_BOOL, GUIDesignCheckButtonAttribute);
527 // check
528 if (attributeEnabled) {
529 myAttributeCheckButton->setCheck(TRUE);
530 } else {
531 myAttributeCheckButton->setCheck(FALSE);
532 }
533 // set color text depending of computed
534 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
535 // check if disable
536 if (disableRow) {
537 myAttributeCheckButton->disable();
538 }
539 } else if (myACAttr.isSVCPermission() && (myACAttr.getAttr() != SUMO_ATTR_DISALLOW)) {
540 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, this, MID_GNE_SET_ATTRIBUTE_ALLOW, GUIDesignButtonAttribute);
541 // set tip text
542 myAttributeButton->setTipText(TL("Open dialog for editing vClasses"));
543 myAttributeButton->setHelpText(TL("Open dialog for editing vClasses"));
544 // check if disable
545 if (!attributeEnabled || disableRow) {
546 myAttributeButton->disable();
547 }
548 } else if (myACAttr.isColor()) {
549 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, this, MID_GNE_SET_ATTRIBUTE_COLOR, GUIDesignButtonAttribute);
550 // set icon
551 myAttributeButton->setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
552 // set color text depending of computed
553 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
554 // set tip text
555 myAttributeButton->setTipText(TL("Open dialog for editing color"));
556 myAttributeButton->setHelpText(TL("Open dialog for editing color"));
557 // check if disable
558 if (disableRow) {
559 myAttributeButton->disable();
560 }
561 } else {
562 // Create label
563 myAttributeLabel = new MFXLabelTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, GUIDesignLabelThickedFixed(100));
564 // set tip text
565 myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
566 myAttributeLabel->setHelpText(myACAttr.getDefinition().c_str());
567 }
568}
569
570
571void
572GNEFrameAttributeModules::AttributesEditorRow::buildValueElements(const bool attributeEnabled, const bool computed) {
573 // Create and hide MFXTextFieldTooltip for string attributes
574 myValueTextField = new MFXTextFieldTooltip(this,
575 myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
577 myValueTextField->hide();
578 // set color text depending of computed
579 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
580 // Create and hide ComboBox
583 myValueComboBox->hide();
584 // set color text depending of computed
585 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
586 // Create and hide checkButton
587 myValueCheckButton = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
588 myValueCheckButton->hide();
589 // set color text depending of computed
590 myValueCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
591 // check if create move up/down lanes
592 if ((myACAttr.getAttr() == SUMO_ATTR_LANE) && !myACAttr.getTagPropertyParent().isNetworkElement()) {
593 // get static tooltip menu
594 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
595 // create move lane up
596 myValueLaneUpButton = new MFXButtonTooltip(this, tooltipMenu, "",
598 // set tip texts
599 myValueLaneUpButton->setTipText(TL("Move element up one lane"));
600 myValueLaneUpButton->setHelpText(TL("Move element up one lane"));
601 // create move lane down
602 myValueLaneDownButton = new MFXButtonTooltip(this, tooltipMenu, "",
604 // set tip texts
605 myValueLaneDownButton->setTipText(TL("Move element down one lane"));
606 myValueLaneDownButton->setHelpText(TL("Move element down one lane"));
607 }
608 // check if disable
609 if (!attributeEnabled || !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
610 myValueTextField->disable();
611 myValueComboBox->disable();
612 myValueCheckButton->disable();
613 if (myValueLaneUpButton) {
614 myValueLaneUpButton->disable();
615 }
616 if (myValueLaneDownButton) {
617 myValueLaneDownButton->disable();
618 }
619 }
620}
621
622
623void
624GNEFrameAttributeModules::AttributesEditorRow::refreshAttributeElements(const std::string& value, const bool attributeEnabled, const bool computed) {
625 // check if disable element
626 const bool disableElement = !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
627 // continue depending of attribute element
628 if (myAttributeCheckButton) {
629 // set color text depending of computed
630 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
631 // check
632 if (attributeEnabled) {
633 myAttributeCheckButton->setCheck(TRUE);
634 } else {
635 myAttributeCheckButton->setCheck(FALSE);
636 }
637 // check if disable
638 if (disableElement) {
639 myAttributeCheckButton->disable();
640 } else {
641 myAttributeCheckButton->enable();
642 }
643 } else if (myAttributeButton) {
644 if (myAttributeButton->getSelector() == MID_GNE_SET_ATTRIBUTE_INSPECTPARENT) {
645 // update text and icon
646 if (myACParent->getTagProperty().getTag() == SUMO_TAG_VTYPE_DISTRIBUTION) {
647 myAttributeButton->setText("vTypeDist.");
648 } else {
649 myAttributeButton->setText(myACParent->getTagStr().c_str());
650 }
651 myAttributeButton->setIcon(myACParent->getACIcon());
652 // set tip text
653 myAttributeButton->setTipText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
654 myAttributeButton->setHelpText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
655 // set color text depending of computed
656 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
657 } else {
658 // set color text depending of computed
659 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
660 }
661 // check if disable
662 if (!attributeEnabled || disableElement) {
663 myAttributeButton->disable();
664 } else {
665 myAttributeButton->enable();
666 }
667 }
668 // check if update lane buttons
669 if (myValueLaneUpButton && myValueLaneDownButton) {
670 updateMoveLaneButtons(value);
671 }
672}
673
674
675void
676GNEFrameAttributeModules::AttributesEditorRow::refreshValueElements(const std::string& value, const bool attributeEnabled, const bool computed, const bool forceRefreshAttribute) {
677 // check if disable element
678 const bool disableElement = !attributeEnabled || !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
679 // continue depending of shown element
680 if (myValueTextField->shown()) {
681 // set last valid value and restore color if onlyValid is disabled
682 if (forceRefreshAttribute ||
683 (myValueTextField->getTextColor() == FXRGB(0, 0, 0)) ||
684 (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) {
685 myValueTextField->setText(value.c_str());
686 }
687 // set color text depending of computed
688 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
689 // check if disable
690 if (disableElement) {
691 myValueTextField->disable();
692 } else {
693 myValueTextField->enable();
694 }
695 } else if (myValueComboBox->shown()) {
696 // fill comboBox
697 fillComboBox(value);
698 // set color text depending of computed
699 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
700 // check if disable
701 if (disableElement) {
702 myValueComboBox->disable();
703 } else {
704 myValueComboBox->enable();
705 }
706 } else if (myValueCheckButton->shown()) {
707 if (GNEAttributeCarrier::canParse<bool>(value)) {
708 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
709 } else {
710 myValueCheckButton->setCheck(false);
711 }
712 // check if disable
713 if (myValueCheckButton) {
714 myValueComboBox->disable();
715 } else {
716 myValueComboBox->enable();
717 }
718 }
719}
720
721
722void
724 const auto& inspectedElements = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedElements();
725 // clear and enable comboBox
726 myValueComboBox->clearItems();
727 // fill depeding of ACAttr
728 if (myACAttr.getAttr() == SUMO_ATTR_VCLASS) {
729 // add all vClasses with their icons
730 for (const auto& vClassStr : SumoVehicleClassStrings.getStrings()) {
731 myValueComboBox->appendIconItem(vClassStr.c_str(), VClassIcons::getVClassIcon(getVehicleClassID(vClassStr)));
732 }
733 } else if (myACAttr.isVType()) {
734 // get ACs
735 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
736 // fill comboBox with all vTypes and vType distributions sorted by ID
737 std::map<std::string, GNEDemandElement*> sortedTypes;
738 for (const auto& type : ACs->getDemandElements().at(SUMO_TAG_VTYPE)) {
739 sortedTypes[type.second->getID()] = type.second;
740 }
741 for (const auto& sortedType : sortedTypes) {
742 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
743 }
744 sortedTypes.clear();
745 for (const auto& typeDistribution : ACs->getDemandElements().at(SUMO_TAG_VTYPE_DISTRIBUTION)) {
746 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
747 }
748 for (const auto& sortedType : sortedTypes) {
749 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
750 }
751 } else if (myACAttr.getAttr() == SUMO_ATTR_ICON) {
752 // add all POIIcons with their icons
753 for (const auto& POIIcon : SUMOXMLDefinitions::POIIcons.getValues()) {
754 myValueComboBox->appendIconItem(SUMOXMLDefinitions::POIIcons.getString(POIIcon).c_str(), POIIcons::getPOIIcon(POIIcon));
755 }
756 } else if ((myACAttr.getAttr() == SUMO_ATTR_RIGHT_OF_WAY) && (inspectedElements.isInspectingSingleElement()) &&
757 (inspectedElements.getFirstAC()->getTagProperty().getTag() == SUMO_TAG_JUNCTION)) {
758 // special case for junction types
759 if (inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_TYPE) == "priority") {
760 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::DEFAULT).c_str(), nullptr);
761 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::EDGEPRIORITY).c_str(), nullptr);
762 } else if (inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_TYPE) == "traffic_light") {
763 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::DEFAULT).c_str(), nullptr);
764 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::MIXEDPRIORITY).c_str(), nullptr);
765 myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::ALLWAYSTOP).c_str(), nullptr);
766 } else {
767 myValueComboBox->disable();
768 }
769 } else {
770 // fill comboBox with discrete values
771 for (const auto& discreteValue : myACAttr.getDiscreteValues()) {
772 myValueComboBox->appendIconItem(discreteValue.c_str(), nullptr);
773 }
774 }
775 // set current value
776 const auto index = myValueComboBox->findItem(value.c_str());
777 if (index < 0) {
778 if (myValueComboBox->getNumItems() > 0) {
779 myValueComboBox->setCurrentItem(0);
780 } else {
781 myValueComboBox->disable();
782 }
783 } else {
784 myValueComboBox->setCurrentItem(index);
785 }
786}
787
788
789void
791 // first extract lane
792 const auto lane = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(value, false);
793 // check lane
794 if (lane) {
795 // check if disable move up
796 if ((lane->getIndex() + 1) >= (int)lane->getParentEdge()->getLanes().size()) {
797 myValueLaneUpButton->disable();
798 } else {
799 myValueLaneUpButton->enable();
800 }
801 // check if disable move down
802 if ((lane->getIndex() - 1) < 0) {
803 myValueLaneDownButton->disable();
804 } else {
805 myValueLaneDownButton->enable();
806 }
807 }
808 if (!isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
809 myValueLaneUpButton->disable();
810 myValueLaneDownButton->disable();
811 }
812}
813
814// ---------------------------------------------------------------------------
815// GNEFrameAttributeModules::AttributesEditor - methods
816// ---------------------------------------------------------------------------
817
819 MFXGroupBoxModule(frameParent, TL("Internal attributes")),
820 myFrameParent(frameParent),
821 myIncludeExtended(true) {
822 // resize myAttributesEditorRows
824 // create myAttributesFlowEditor
825 myAttributesEditorFlow = new GNEFlowEditor(frameParent->getViewNet(), frameParent);
826 // leave it hidden
828 // Create help button
830}
831
832
833void
835 const auto& inspectedElements = myFrameParent->getViewNet()->getInspectedElements();
836 myIncludeExtended = includeExtended;
837 // first remove all rows
838 for (auto& row : myAttributesEditorRows) {
839 // destroy and delete all rows
840 if (row != nullptr) {
841 row->destroy();
842 delete row;
843 row = nullptr;
844 }
845 }
846 // declare flag to check if flow editor has to be shown
847 bool showFlowEditor = false;
848 if (inspectedElements.isInspectingElements()) {
849 // Iterate over attributes
850 for (const auto& attrProperty : inspectedElements.getFirstAC()->getTagProperty()) {
851 // declare flag to show/hide attribute
852 bool editAttribute = true;
853 // disable editing for unique attributes in case of multi-selection
854 if (inspectedElements.isInspectingMultipleElements() && attrProperty.isUnique()) {
855 editAttribute = false;
856 }
857 // disable editing of extended attributes if includeExtended isn't enabled
858 if (attrProperty.isExtended() && !includeExtended) {
859 editAttribute = false;
860 }
861 // disable editing of flow definition attributes, but enable flow editor
862 if (attrProperty.isFlowDefinition()) {
863 editAttribute = false;
864 showFlowEditor = true;
865 }
866 // continue if attribute is editable
867 if (editAttribute) {
868 // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
869 std::set<std::string> occurringValues;
870 // iterate over edited attributes
871 for (const auto& inspectedAC : inspectedElements.getACs()) {
872 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
873 }
874 // get current value
875 std::ostringstream oss;
876 for (auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
877 if (values != occurringValues.begin()) {
878 oss << " ";
879 }
880 oss << *values;
881 }
882 // obtain value to be shown in row
883 std::string value = oss.str();
884 // declare a flag for enabled attributes
885 bool attributeEnabled = inspectedElements.getFirstAC()->isAttributeEnabled(attrProperty.getAttr());
886 // overwrite value if attribute is disabled (used by LinkIndex)
887 if (!attributeEnabled) {
888 value = inspectedElements.getFirstAC()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
889 }
890 // for types, the following attributes must be always enabled
891 if (inspectedElements.getFirstAC()->getTagProperty().isType() &&
892 ((attrProperty.getAttr() == SUMO_ATTR_LENGTH) ||
893 (attrProperty.getAttr() == SUMO_ATTR_MINGAP) ||
894 (attrProperty.getAttr() == SUMO_ATTR_MAXSPEED) ||
895 (attrProperty.getAttr() == SUMO_ATTR_DESIRED_MAXSPEED))) {
896 attributeEnabled = true;
897 }
898 // extra check for Triggered and container Triggered
899 if (inspectedElements.getFirstAC()->getTagProperty().isVehicleStop()) {
900 if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED) && (inspectedElements.getFirstAC()->isAttributeEnabled(SUMO_ATTR_TRIGGERED) == false)) {
901 attributeEnabled = false;
902 } else if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED_CONTAINERS) && (inspectedElements.getFirstAC()->isAttributeEnabled(SUMO_ATTR_CONTAINER_TRIGGERED) == false)) {
903 attributeEnabled = false;
904 }
905 }
906 // check if this attribute is computed
907 const bool computed = inspectedElements.isInspectingMultipleElements() ? false : inspectedElements.getFirstAC()->isAttributeComputed(attrProperty.getAttr());
908 // if is a Vtype, obtain icon
909 GNEAttributeCarrier* ACParent = nullptr;
910 if (inspectedElements.isInspectingSingleElement() && attrProperty.isVType()) {
911 if (attrProperty.getAttr() == SUMO_ATTR_TYPE) {
912 ACParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_TYPE), false);
913 if (ACParent == nullptr) {
914 ACParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_TYPE), false);
915 }
916 }
917 }
918 // create attribute editor row
919 myAttributesEditorRows[attrProperty.getPositionListed()] = new AttributesEditorRow(this, attrProperty, value, attributeEnabled, computed, ACParent);
920 }
921 }
922 // check if Flow editor has to be shown
923 if (showFlowEditor) {
924 myAttributesEditorFlow->showFlowEditor(inspectedElements.getFirstAC(), inspectedElements.getACs());
925 } else {
926 myAttributesEditorFlow->hideFlowEditor();
927 }
928 // show AttributesEditor
929 show();
930 } else {
931 myAttributesEditorFlow->hideFlowEditor();
932 }
933 // reparent help button (to place it at bottom)
934 myHelpButton->reparent(this);
935}
936
937
938void
940 // hide AttributesEditorFlowModule
941 myAttributesEditorFlow->hideFlowEditor();
942 // hide also AttributesEditor
943 hide();
944}
945
946
947void
948GNEFrameAttributeModules::AttributesEditor::refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition) {
949 const auto& inspectedElements = myFrameParent->getViewNet()->getInspectedElements();
950 // first check if there is inspected attribute carriers
951 if (inspectedElements.isInspectingElements()) {
952 // Iterate over inspected attribute carriers
953 for (const auto& attrProperty : inspectedElements.getFirstAC()->getTagProperty()) {
954 // declare flag to show/hide attribute
955 bool editAttribute = true;
956 // disable editing for unique attributes in case of multi-selection
957 if (inspectedElements.isInspectingMultipleElements() && attrProperty.isUnique()) {
958 editAttribute = false;
959 }
960 // disable editing of extended attributes if includeExtended isn't enabled
961 if (attrProperty.isExtended() && !myIncludeExtended) {
962 editAttribute = false;
963 }
964 // disable editing of flow definition attributes, but enable flow editor
965 if (attrProperty.isFlowDefinition()) {
966 editAttribute = false;
967 }
968 // continue if attribute is editable
969 if (editAttribute) {
970 // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
971 std::set<std::string> occurringValues;
972 // iterate over edited attributes
973 for (const auto& inspectedAC : inspectedElements.getACs()) {
974 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
975 }
976 // get current value
977 std::ostringstream oss;
978 for (auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
979 if (values != occurringValues.begin()) {
980 oss << " ";
981 }
982 oss << *values;
983 }
984 // obtain value to be shown in row
985 std::string value = oss.str();
986 // declare a flag for enabled attributes
987 bool attributeEnabled = inspectedElements.getFirstAC()->isAttributeEnabled(attrProperty.getAttr());
988 // for types, the following attributes must be always enabled
989 if (inspectedElements.getFirstAC()->getTagProperty().isType() &&
990 ((attrProperty.getAttr() == SUMO_ATTR_LENGTH) ||
991 (attrProperty.getAttr() == SUMO_ATTR_MINGAP) ||
992 (attrProperty.getAttr() == SUMO_ATTR_MAXSPEED) ||
993 (attrProperty.getAttr() == SUMO_ATTR_DESIRED_MAXSPEED))) {
994 attributeEnabled = true;
995 }
996 // overwrite value if attribute is disabled (used by LinkIndex)
997 if (!attributeEnabled) {
998 value = inspectedElements.getFirstAC()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
999 }
1000 // extra check for Triggered and container Triggered
1001 if (inspectedElements.getFirstAC()->getTagProperty().isVehicleStop()) {
1002 if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED) && (inspectedElements.getFirstAC()->isAttributeEnabled(SUMO_ATTR_TRIGGERED) == false)) {
1003 attributeEnabled = false;
1004 } else if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED_CONTAINERS) && (inspectedElements.getFirstAC()->isAttributeEnabled(SUMO_ATTR_CONTAINER_TRIGGERED) == false)) {
1005 attributeEnabled = false;
1006 }
1007 }
1008 // check if this attribute is computed
1009 const bool computed = inspectedElements.isInspectingMultipleElements() ? false : inspectedElements.getFirstAC()->isAttributeComputed(attrProperty.getAttr());
1010 // Check if Position or Shape refresh has to be forced
1011 if ((attrProperty.getAttr() == SUMO_ATTR_SHAPE) && forceRefreshShape) {
1012 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, true, attributeEnabled, computed, nullptr);
1013 } else if ((attrProperty.getAttr() == SUMO_ATTR_POSITION) && forceRefreshPosition) {
1014 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, true, attributeEnabled, computed, nullptr);
1015 } else if (attrProperty.isVType() && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
1016 attrProperty.getTagPropertyParent().isContainer())) {
1017 // get type/distribution parent
1018 auto typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_TYPE), false);
1019 if (typeParent == nullptr) {
1020 typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_TYPE), false);
1021 }
1022 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, false, attributeEnabled, computed, typeParent);
1023 } else {
1024 // Refresh attributes maintain invalid values
1025 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, false, attributeEnabled, computed, nullptr);
1026 }
1027 }
1028 }
1029 // check if flow editor has to be update
1030 if (myAttributesEditorFlow->shownFlowEditor()) {
1031 myAttributesEditorFlow->refreshFlowEditor();
1032 }
1033 }
1034}
1035
1036
1037GNEFrame*
1039 return myFrameParent;
1040}
1041
1042
1043long
1045 // open Help attributes dialog if there is inspected ACs
1046 if (myFrameParent->getViewNet()->getInspectedElements().getFirstAC()) {
1047 // open Help attributes dialog
1048 myFrameParent->openHelpAttributesDialog(myFrameParent->getViewNet()->getInspectedElements().getFirstAC());
1049 }
1050 return 1;
1051}
1052
1053// ---------------------------------------------------------------------------
1054// GNEFrameAttributeModules::AttributesEditorExtended- methods
1055// ---------------------------------------------------------------------------
1056
1058 MFXGroupBoxModule(frameParent, TL("Extended attributes")),
1059 myFrameParent(frameParent) {
1060 // Create open dialog button
1061 GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Open attributes editor"), "", "", nullptr, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButton);
1062}
1063
1064
1066
1067
1068void
1072
1073
1074void
1078
1079
1080long
1082 // open GNEAttributesCreator extended dialog
1083 myFrameParent->attributesEditorExtendedDialogOpened();
1084 return 1;
1085}
1086
1087// ---------------------------------------------------------------------------
1088// GNEFrameAttributeModules::GenericDataAttributes - methods
1089// ---------------------------------------------------------------------------
1090
1092 MFXGroupBoxModule(frameParent, TL("Attributes")),
1093 myFrameParent(frameParent) {
1094 // create textfield and buttons
1097}
1098
1099
1101
1102
1103void
1105 // refresh GenericDataAttributes
1106 refreshGenericDataAttributes();
1107 // show groupbox
1108 show();
1109}
1110
1111
1112void
1117
1118
1119void
1121 myTextFieldParameters->setText(getParametersStr().c_str());
1122 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1123 myTextFieldParameters->killFocus();
1124}
1125
1126
1127const Parameterised::Map&
1131
1132
1133std::string
1135 std::string result;
1136 // Generate an string using the following structure: "key1=value1|key2=value2|...
1137 for (const auto& parameter : myParameters) {
1138 result += parameter.first + "=" + parameter.second + "|";
1139 }
1140 // remove the last "|"
1141 if (!result.empty()) {
1142 result.pop_back();
1143 }
1144 return result;
1145}
1146
1147
1148std::vector<std::pair<std::string, std::string> >
1150 std::vector<std::pair<std::string, std::string> > result;
1151 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
1152 for (const auto& parameter : myParameters) {
1153 result.push_back(std::make_pair(parameter.first, parameter.second));
1154 }
1155 return result;
1156}
1157
1158
1159void
1160GNEFrameAttributeModules::GenericDataAttributes::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
1161 // declare result string
1162 std::string result;
1163 // Generate an string using the following structure: "key1=value1|key2=value2|...
1164 for (const auto& parameter : parameters) {
1165 result += parameter.first + "=" + parameter.second + "|";
1166 }
1167 // remove the last "|"
1168 if (!result.empty()) {
1169 result.pop_back();
1170 }
1171 // set result in textField (and call onCmdEditParameters)
1172 myTextFieldParameters->setText(result.c_str(), TRUE);
1173}
1174
1175
1176GNEFrame*
1180
1181
1182bool
1184 if (myTextFieldParameters->getText().empty()) {
1185 return true;
1186 } else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1187 return false;
1188 } else {
1189 return Parameterised::areAttributesValid(getParametersStr());
1190 }
1191}
1192
1193
1194long
1196 // write debug information
1197 WRITE_DEBUG("Open single parameters dialog");
1198 if (GNESingleParametersDialog(this).execute()) {
1199 // write debug information
1200 WRITE_DEBUG("Close single parameters dialog");
1201 // Refresh parameter EditorCreator
1202 refreshGenericDataAttributes();
1203 } else {
1204 // write debug information
1205 WRITE_DEBUG("Cancel single parameters dialog");
1206 }
1207 return 1;
1208}
1209
1210
1211long
1213 // clear current existent parameters
1214 myParameters.clear();
1215 // check if current given string is valid
1216 if (Parameterised::areParametersValid(myTextFieldParameters->getText().text(), true)) {
1217 // parsed parameters ok, then set text field black and continue
1218 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1219 myTextFieldParameters->killFocus();
1220 // obtain parameters "key=value"
1221 std::vector<std::string> parameters = StringTokenizer(myTextFieldParameters->getText().text(), "|", true).getVector();
1222 // iterate over parameters
1223 for (const auto& parameter : parameters) {
1224 // obtain key, value
1225 std::vector<std::string> keyParam = StringTokenizer(parameter, "=", true).getVector();
1226 // save it in myParameters
1227 myParameters[keyParam.front()] = keyParam.back();
1228 }
1229 // overwrite myTextFieldParameters (to remove duplicated parameters
1230 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1231 } else {
1232 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1233 }
1234 return 1;
1235}
1236
1237// ---------------------------------------------------------------------------
1238// GNEFrameAttributeModules::ParametersEditor - methods
1239// ---------------------------------------------------------------------------
1240
1242 MFXGroupBoxModule(inspectorFrameParent, TL("Parameters")),
1243 myInspectorFrameParent(inspectorFrameParent) {
1244 // create textfield and buttons
1247}
1248
1249
1251 MFXGroupBoxModule(typeFrameParent, TL("Parameters")),
1252 myTypeFrameParent(typeFrameParent) {
1253 // create textfield and buttons
1256}
1257
1258
1260
1261
1264 return myInspectorFrameParent ? myInspectorFrameParent->getViewNet() : myTypeFrameParent->getViewNet();
1265}
1266
1267
1268void
1270 if (myInspectorFrameParent) {
1271 const auto& inspectedElements = myInspectorFrameParent->getViewNet()->getInspectedElements();
1272 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1273 // refresh ParametersEditor
1274 refreshParametersEditor();
1275 // show groupbox
1276 show();
1277 } else {
1278 hideParametersEditor();
1279 }
1280 } else if (myTypeFrameParent) {
1281 if (myTypeFrameParent->getTypeSelector()->getCurrentType() != nullptr) {
1283 refreshParametersEditor();
1284 // show groupbox
1285 show();
1286 } else {
1287 hideParametersEditor();
1288 }
1289 } else {
1290 hideParametersEditor();
1291 }
1292}
1293
1294
1295void
1297 // hide groupbox
1298 hide();
1299}
1300
1301
1302void
1304 if (myInspectorFrameParent) {
1305 const auto& inspectedElements = myInspectorFrameParent->getViewNet()->getInspectedElements();
1306 // continue depending of frontAC
1307 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1308 // check if we're editing a single or a multiple AC
1309 if (inspectedElements.isInspectingSingleElement()) {
1310 // set text field parameters
1311 myTextFieldParameters->setText(inspectedElements.getFirstAC()->getAttribute(GNE_ATTR_PARAMETERS).c_str());
1312 } else {
1313 // check if parameters of all inspected ACs are different
1314 std::string parameters = inspectedElements.getFirstAC()->getAttribute(GNE_ATTR_PARAMETERS);
1315 for (const auto& AC : inspectedElements.getACs()) {
1316 if (parameters != AC->getAttribute(GNE_ATTR_PARAMETERS)) {
1317 parameters = "different parameters";
1318 }
1319 }
1320 // set text field
1321 myTextFieldParameters->setText(parameters.c_str());
1322 }
1323 // reset color
1324 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1325 // disable myTextFieldParameters if Tag correspond to an network element but we're in demand mode (or vice versa), disable all elements
1326 if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), inspectedElements.getFirstAC())) {
1327 myTextFieldParameters->enable();
1328 myButtonEditParameters->enable();
1329 } else {
1330 myTextFieldParameters->disable();
1331 myButtonEditParameters->disable();
1332 }
1333 }
1334 } else if (myTypeFrameParent) {
1335 // get type
1336 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1337 // continue depending of frontAC
1338 if (type) {
1339 // set text field parameters
1340 myTextFieldParameters->setText(type->getAttribute(GNE_ATTR_PARAMETERS).c_str());
1341 // reset color
1342 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1343 // disable myTextFieldParameters if Tag correspond to an network element but we're in demand mode (or vice versa), disable all elements
1344 if (GNEFrameAttributeModules::isSupermodeValid(myTypeFrameParent->getViewNet(), type)) {
1345 myTextFieldParameters->enable();
1346 myButtonEditParameters->enable();
1347 } else {
1348 myTextFieldParameters->disable();
1349 myButtonEditParameters->disable();
1350 }
1351 }
1352 }
1353}
1354
1355
1358 return myInspectorFrameParent;
1359}
1360
1361
1364 return myTypeFrameParent;
1365}
1366
1367
1368long
1370 if (myInspectorFrameParent) {
1371 const auto& inspectedElements = myInspectorFrameParent->getViewNet()->getInspectedElements();
1372 // continue depending of frontAC
1373 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1374 if (inspectedElements.isInspectingMultipleElements()) {
1375 // write debug information
1376 WRITE_DEBUG("Open multiple parameters dialog");
1377 // open multiple parameters dialog
1378 if (GNEMultipleParametersDialog(this).execute()) {
1379 // write debug information
1380 WRITE_DEBUG("Close multiple parameters dialog");
1381 // update frame parent after attribute successfully set
1382 myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1383 // Refresh parameter EditorInspector
1384 refreshParametersEditor();
1385 } else {
1386 // write debug information
1387 WRITE_DEBUG("Cancel multiple parameters dialog");
1388 }
1389 } else {
1390 // write debug information
1391 WRITE_DEBUG("Open single parameters dialog");
1392 if (GNESingleParametersDialog(this).execute()) {
1393 // write debug information
1394 WRITE_DEBUG("Close single parameters dialog");
1395 // update frame parent after attribute successfully set
1396 myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1397 // Refresh parameter EditorInspector
1398 refreshParametersEditor();
1399 } else {
1400 // write debug information
1401 WRITE_DEBUG("Cancel single parameters dialog");
1402 }
1403 }
1404 }
1405 } else if (myTypeFrameParent) {
1406 // get type
1407 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1408 // continue depending of type
1409 if (type) {
1410 // write debug information
1411 WRITE_DEBUG("Open single parameters dialog");
1412 if (GNESingleParametersDialog(this).execute()) {
1413 // write debug information
1414 WRITE_DEBUG("Close single parameters dialog");
1415 // Refresh parameter EditorInspector
1416 refreshParametersEditor();
1417 } else {
1418 // write debug information
1419 WRITE_DEBUG("Cancel single parameters dialog");
1420 }
1421 }
1422 }
1423 return 1;
1424}
1425
1426
1427long
1429 if (myInspectorFrameParent) {
1430 const auto& inspectedElements = myInspectorFrameParent->getViewNet()->getInspectedElements();
1431 // continue depending of frontAC
1432 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1433 // check if current given string is valid
1434 if (inspectedElements.getFirstAC()->isValid(GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
1435 // parsed parameters ok, then set text field black and continue
1436 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1437 myTextFieldParameters->killFocus();
1438 // check inspected parameters
1439 if (inspectedElements.isInspectingSingleElement()) {
1440 // begin undo list
1441 myInspectorFrameParent->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(), "change parameters");
1442 // set parameters
1443 inspectedElements.getFirstAC()->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1444 // end undo list
1445 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1446 } else if (inspectedElements.isInspectingMultipleElements()) {
1447 // begin undo list
1448 myInspectorFrameParent->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(), "change multiple parameters");
1449 // set parameters in all ACs
1450 for (const auto& inspectedAC : inspectedElements.getACs()) {
1451 inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1452 }
1453 // end undo list
1454 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1455 }
1456 // update frame parent after attribute successfully set
1457 myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1458 } else {
1459 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1460 }
1461 }
1462 } else if (myTypeFrameParent) {
1463 // get type
1464 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1465 // continue depending of frontAC
1466 if (type) {
1467 // check if current given string is valid
1468 if (type->isValid(GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
1469 // parsed parameters ok, then set text field black and continue
1470 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1471 myTextFieldParameters->killFocus();
1472 // begin undo list
1473 myTypeFrameParent->getViewNet()->getUndoList()->begin(type, "change parameters");
1474 // set parameters
1475 type->setACParameters(myTextFieldParameters->getText().text(), myTypeFrameParent->getViewNet()->getUndoList());
1476 // end undo list
1477 myTypeFrameParent->getViewNet()->getUndoList()->end();
1478 } else {
1479 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1480 }
1481 }
1482 }
1483 return 1;
1484}
1485
1486
1487bool
1489 if (viewNet->getEditModes().isCurrentSupermodeNetwork() &&
1491 return true;
1492 } else if (viewNet->getEditModes().isCurrentSupermodeDemand() &&
1494 return true;
1495 } else if (viewNet->getEditModes().isCurrentSupermodeData() &&
1497 return true;
1498 } else {
1499 return false;
1500 }
1501}
1502
1503
1504bool
1507 return (viewNet->getEditModes().isCurrentSupermodeNetwork());
1508 } else if (ACAttr.getTagPropertyParent().isDemandElement()) {
1509 return (viewNet->getEditModes().isCurrentSupermodeDemand());
1510 } else if (ACAttr.getTagPropertyParent().isDataElement() || ACAttr.getTagPropertyParent().isMeanData()) {
1511 return (viewNet->getEditModes().isCurrentSupermodeData());
1512 } else {
1513 return false;
1514 }
1515}
1516
1517/****************************************************************************/
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
GNENet * getNet() const
get pointer to net
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.
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
bool mergeJunction(SumoXMLAttr attr, const std::string &newVal) const
check junction merging
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:127
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 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
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
GNEUndoList * getUndoList() const
get the undoList object
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
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