Eclipse SUMO - Simulation of Urban MObility
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>
26 #include <netedit/GNEViewParent.h>
37 
39 #include "GNEFlowEditor.h"
40 
41 
42 // ===========================================================================
43 // FOX callback mapping
44 // ===========================================================================
45 
54 };
55 
58 };
59 
62 };
63 
67 };
68 
72 };
73 
74 // Object implementation
75 FXIMPLEMENT(GNEFrameAttributeModules::AttributesEditorRow, FXHorizontalFrame, AttributesEditorRowMap, ARRAYNUMBER(AttributesEditorRowMap))
76 FXIMPLEMENT(GNEFrameAttributeModules::AttributesEditor, MFXGroupBoxModule, AttributesEditorMap, ARRAYNUMBER(AttributesEditorMap))
77 FXIMPLEMENT(GNEFrameAttributeModules::AttributesEditorExtended, MFXGroupBoxModule, AttributesEditorExtendedMap, ARRAYNUMBER(AttributesEditorExtendedMap))
78 FXIMPLEMENT(GNEFrameAttributeModules::GenericDataAttributes, MFXGroupBoxModule, GenericDataAttributesMap, ARRAYNUMBER(GenericDataAttributesMap))
79 FXIMPLEMENT(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 
167 void
169  // only destroy if parent was created
170  if (getParent()->id()) {
171  FXHorizontalFrame::destroy();
172  }
173 }
174 
175 
176 void
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 
187 bool
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 
194 long
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 
236 long
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 
267 long
269  auto viewnet = myAttributesEditorParent->getFrameParent()->getViewNet();
270  viewnet->getViewParent()->getInspectorFrame()->inspectChild(myACParent, viewnet->getInspectedAttributeCarriers().front());
271  return 1;
272 }
273 
274 
275 long
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 
291 long
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 
307 long
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 
436 long
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 
468 std::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 
478 bool
479 GNEFrameAttributeModules::AttributesEditorRow::mergeJunction(SumoXMLAttr attr, const std::vector<GNEAttributeCarrier*>& inspectedACs, const std::string& newVal) const {
480  // check if we're editing junction position
481  if ((inspectedACs.size() == 1) && (inspectedACs.front()->getTagProperty().getTag() == SUMO_TAG_JUNCTION) && (attr == SUMO_ATTR_POSITION)) {
482  // retrieve original junction
483  GNEJunction* movedJunction = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(inspectedACs.front()->getID());
484  // parse position
485  const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
486  // iterate over network junction
487  for (const auto& junction : myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
488  // check distance position
489  if ((junction.second.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
490  myAttributesEditorParent->getFrameParent()->getViewNet()->mergeJunctions(movedJunction, junction.second.second)) {
491  return true;
492  }
493  }
494  }
495  // nothing to merge
496  return false;
497 }
498 
499 
500 void
501 GNEFrameAttributeModules::AttributesEditorRow::buildAttributeElements(const bool attributeEnabled, const bool computed) {
502  // get static tooltip menu
503  const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
504  // check if disable element
505  const bool disableRow = !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
506  // continue depending of attribute
507  if (myACParent) {
508  myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(),
509  myACParent->getACIcon(), this, MID_GNE_SET_ATTRIBUTE_INSPECTPARENT, GUIDesignButtonAttribute);
510  // set color text depending of computed
511  myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
512  // set tip text
513  myAttributeButton->setTipText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
514  myAttributeButton->setHelpText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
515  // check if disable
516  if (disableRow) {
517  myAttributeButton->disable();
518  }
519  } else if (myACAttr.isActivatable()) {
520  myAttributeCheckButton = new FXCheckButton(this, myACAttr.getAttrStr().c_str(), this, MID_GNE_SET_ATTRIBUTE_BOOL, GUIDesignCheckButtonAttribute);
521  // check
522  if (attributeEnabled) {
523  myAttributeCheckButton->setCheck(TRUE);
524  } else {
525  myAttributeCheckButton->setCheck(FALSE);
526  }
527  // set color text depending of computed
528  myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
529  // check if disable
530  if (disableRow) {
531  myAttributeCheckButton->disable();
532  }
533  } else if (myACAttr.isSVCPermission() && (myACAttr.getAttr() != SUMO_ATTR_DISALLOW)) {
534  myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, this, MID_GNE_SET_ATTRIBUTE_ALLOW, GUIDesignButtonAttribute);
535  // set tip text
536  myAttributeButton->setTipText(TL("Open dialog for editing vClasses"));
537  myAttributeButton->setHelpText(TL("Open dialog for editing vClasses"));
538  // check if disable
539  if (!attributeEnabled || disableRow) {
540  myAttributeButton->disable();
541  }
542  } else if (myACAttr.isColor()) {
543  myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, this, MID_GNE_SET_ATTRIBUTE_COLOR, GUIDesignButtonAttribute);
544  // set icon
545  myAttributeButton->setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
546  // set color text depending of computed
547  myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
548  // set tip text
549  myAttributeButton->setTipText(TL("Open dialog for editing color"));
550  myAttributeButton->setHelpText(TL("Open dialog for editing color"));
551  // check if disable
552  if (disableRow) {
553  myAttributeButton->disable();
554  }
555  } else {
556  // Create label
557  myAttributeLabel = new MFXLabelTooltip(this, tooltipMenu, myACAttr.getAttrStr().c_str(), nullptr, GUIDesignLabelThickedFixed(100));
558  // set tip text
559  myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
560  myAttributeLabel->setHelpText(myACAttr.getDefinition().c_str());
561  }
562 }
563 
564 
565 void
566 GNEFrameAttributeModules::AttributesEditorRow::buildValueElements(const bool attributeEnabled, const bool computed) {
567  // Create and hide MFXTextFieldTooltip for string attributes
568  myValueTextField = new MFXTextFieldTooltip(this,
569  myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
571  myValueTextField->hide();
572  // set color text depending of computed
573  myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
574  // Create and hide ComboBox
577  myValueComboBox->hide();
578  // set color text depending of computed
579  myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
580  // Create and hide checkButton
581  myValueCheckButton = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
582  myValueCheckButton->hide();
583  // set color text depending of computed
584  myValueCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
585  // check if create move up/down lanes
586  if ((myACAttr.getAttr() == SUMO_ATTR_LANE) && !myACAttr.getTagPropertyParent().isNetworkElement()) {
587  // get static tooltip menu
588  const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
589  // create move lane up
590  myValueLaneUpButton = new MFXButtonTooltip(this, tooltipMenu, "",
592  // set tip texts
593  myValueLaneUpButton->setTipText(TL("Move element up one lane"));
594  myValueLaneUpButton->setHelpText(TL("Move element up one lane"));
595  // create move lane down
596  myValueLaneDownButton = new MFXButtonTooltip(this, tooltipMenu, "",
598  // set tip texts
599  myValueLaneDownButton->setTipText(TL("Move element down one lane"));
600  myValueLaneDownButton->setHelpText(TL("Move element down one lane"));
601  }
602  // check if disable
603  if (!attributeEnabled || !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
604  myValueTextField->disable();
605  myValueComboBox->disable();
606  myValueCheckButton->disable();
607  if (myValueLaneUpButton) {
608  myValueLaneUpButton->disable();
609  }
610  if (myValueLaneDownButton) {
611  myValueLaneDownButton->disable();
612  }
613  }
614 }
615 
616 
617 void
618 GNEFrameAttributeModules::AttributesEditorRow::refreshAttributeElements(const std::string& value, const bool attributeEnabled, const bool computed) {
619  // check if disable element
620  const bool disableElement = !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
621  // continue depending of attribute element
622  if (myAttributeCheckButton) {
623  // set color text depending of computed
624  myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
625  // check
626  if (attributeEnabled) {
627  myAttributeCheckButton->setCheck(TRUE);
628  } else {
629  myAttributeCheckButton->setCheck(FALSE);
630  }
631  // check if disable
632  if (disableElement) {
633  myAttributeCheckButton->disable();
634  } else {
635  myAttributeCheckButton->enable();
636  }
637  } else if (myAttributeButton) {
638  if (myAttributeButton->getSelector() == MID_GNE_SET_ATTRIBUTE_INSPECTPARENT) {
639  // update text and icon
640  if (myACParent->getTagProperty().getTag() == SUMO_TAG_VTYPE_DISTRIBUTION) {
641  myAttributeButton->setText("vTypeDist.");
642  } else {
643  myAttributeButton->setText(myACParent->getTagStr().c_str());
644  }
645  myAttributeButton->setIcon(myACParent->getACIcon());
646  // set tip text
647  myAttributeButton->setTipText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
648  myAttributeButton->setHelpText(TLF("Inspect % parent", myACAttr.getAttrStr()).c_str());
649  // set color text depending of computed
650  myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
651  } else {
652  // set color text depending of computed
653  myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
654  }
655  // check if disable
656  if (!attributeEnabled || disableElement) {
657  myAttributeButton->disable();
658  } else {
659  myAttributeButton->enable();
660  }
661  }
662  // check if update lane buttons
663  if (myValueLaneUpButton && myValueLaneDownButton) {
664  updateMoveLaneButtons(value);
665  }
666 }
667 
668 
669 void
670 GNEFrameAttributeModules::AttributesEditorRow::refreshValueElements(const std::string& value, const bool attributeEnabled, const bool computed, const bool forceRefreshAttribute) {
671  // check if disable element
672  const bool disableElement = !attributeEnabled || !isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
673  // continue depending of shown element
674  if (myValueTextField->shown()) {
675  // set last valid value and restore color if onlyValid is disabled
676  if (forceRefreshAttribute ||
677  (myValueTextField->getTextColor() == FXRGB(0, 0, 0)) ||
678  (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) {
679  myValueTextField->setText(value.c_str());
680  }
681  // set color text depending of computed
682  myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
683  // check if disable
684  if (disableElement) {
685  myValueTextField->disable();
686  } else {
687  myValueTextField->enable();
688  }
689  } else if (myValueComboBox->shown()) {
690  // fill comboBox
691  fillComboBox(value);
692  // set color text depending of computed
693  myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
694  // check if disable
695  if (disableElement) {
696  myValueComboBox->disable();
697  } else {
698  myValueComboBox->enable();
699  }
700  } else if (myValueCheckButton->shown()) {
701  if (GNEAttributeCarrier::canParse<bool>(value)) {
702  myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
703  } else {
704  myValueCheckButton->setCheck(false);
705  }
706  // check if disable
707  if (myValueCheckButton) {
708  myValueComboBox->disable();
709  } else {
710  myValueComboBox->enable();
711  }
712  }
713 }
714 
715 
716 void
718  const auto inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
719  // clear and enable comboBox
720  myValueComboBox->clearItems();
721  // fill depeding of ACAttr
722  if (myACAttr.getAttr() == SUMO_ATTR_VCLASS) {
723  // add all vClasses with their icons
724  for (const auto& vClassStr : SumoVehicleClassStrings.getStrings()) {
725  myValueComboBox->appendIconItem(vClassStr.c_str(), VClassIcons::getVClassIcon(getVehicleClassID(vClassStr)));
726  }
727  } else if (myACAttr.isVType()) {
728  // get ACs
729  const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
730  // fill comboBox with all vTypes and vType distributions sorted by ID
731  std::map<std::string, GNEDemandElement*> sortedTypes;
732  for (const auto& type : ACs->getDemandElements().at(SUMO_TAG_VTYPE)) {
733  sortedTypes[type.second->getID()] = type.second;
734  }
735  for (const auto& sortedType : sortedTypes) {
736  myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
737  }
738  sortedTypes.clear();
739  for (const auto& typeDistribution : ACs->getDemandElements().at(SUMO_TAG_VTYPE_DISTRIBUTION)) {
740  sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
741  }
742  for (const auto& sortedType : sortedTypes) {
743  myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
744  }
745  } else if (myACAttr.getAttr() == SUMO_ATTR_ICON) {
746  // add all POIIcons with their icons
747  for (const auto& POIIcon : SUMOXMLDefinitions::POIIcons.getValues()) {
748  myValueComboBox->appendIconItem(SUMOXMLDefinitions::POIIcons.getString(POIIcon).c_str(), POIIcons::getPOIIcon(POIIcon));
749  }
750  } else if ((myACAttr.getAttr() == SUMO_ATTR_RIGHT_OF_WAY) && (inspectedACs.size() == 1) &&
751  (inspectedACs.front()->getTagProperty().getTag() == SUMO_TAG_JUNCTION)) {
752  // special case for junction types
753  if (inspectedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "priority") {
754  myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::DEFAULT).c_str(), nullptr);
755  myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::EDGEPRIORITY).c_str(), nullptr);
756  } else if (inspectedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "traffic_light") {
757  myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::DEFAULT).c_str(), nullptr);
758  myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::MIXEDPRIORITY).c_str(), nullptr);
759  myValueComboBox->appendIconItem(SUMOXMLDefinitions::RightOfWayValues.getString(RightOfWay::ALLWAYSTOP).c_str(), nullptr);
760  } else {
761  myValueComboBox->disable();
762  }
763  } else {
764  // fill comboBox with discrete values
765  for (const auto& discreteValue : myACAttr.getDiscreteValues()) {
766  myValueComboBox->appendIconItem(discreteValue.c_str(), nullptr);
767  }
768  }
769  // set current value
770  const auto index = myValueComboBox->findItem(value.c_str());
771  if (index < 0) {
772  if (myValueComboBox->getNumItems() > 0) {
773  myValueComboBox->setCurrentItem(0);
774  } else {
775  myValueComboBox->disable();
776  }
777  } else {
778  myValueComboBox->setCurrentItem(index);
779  }
780 }
781 
782 
783 void
785  // first extract lane
786  const auto lane = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(value, false);
787  // check lane
788  if (lane) {
789  // check if disable move up
790  if ((lane->getIndex() + 1) >= (int)lane->getParentEdge()->getLanes().size()) {
791  myValueLaneUpButton->disable();
792  } else {
793  myValueLaneUpButton->enable();
794  }
795  // check if disable move down
796  if ((lane->getIndex() - 1) < 0) {
797  myValueLaneDownButton->disable();
798  } else {
799  myValueLaneDownButton->enable();
800  }
801  }
802  if (!isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
803  myValueLaneUpButton->disable();
804  myValueLaneDownButton->disable();
805  }
806 }
807 
808 // ---------------------------------------------------------------------------
809 // GNEFrameAttributeModules::AttributesEditor - methods
810 // ---------------------------------------------------------------------------
811 
813  MFXGroupBoxModule(frameParent, TL("Internal attributes")),
814  myFrameParent(frameParent),
815  myIncludeExtended(true) {
816  // resize myAttributesEditorRows
818  // create myAttributesFlowEditor
819  myAttributesEditorFlow = new GNEFlowEditor(frameParent->getViewNet(), frameParent);
820  // leave it hidden
822  // Create help button
824 }
825 
826 
827 void
829  myIncludeExtended = includeExtended;
830  // first remove all rows
831  for (auto& row : myAttributesEditorRows) {
832  // destroy and delete all rows
833  if (row != nullptr) {
834  row->destroy();
835  delete row;
836  row = nullptr;
837  }
838  }
839  // get inspected ACs
840  const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
841  // declare flag to check if flow editor has to be shown
842  bool showFlowEditor = false;
843  if (ACs.size() > 0) {
844  // Iterate over attributes
845  for (const auto& attrProperty : ACs.front()->getTagProperty()) {
846  // declare flag to show/hide attribute
847  bool editAttribute = true;
848  // disable editing for unique attributes in case of multi-selection
849  if ((ACs.size() > 1) && attrProperty.isUnique()) {
850  editAttribute = false;
851  }
852  // disable editing of extended attributes if includeExtended isn't enabled
853  if (attrProperty.isExtended() && !includeExtended) {
854  editAttribute = false;
855  }
856  // disable editing of flow definition attributes, but enable flow editor
857  if (attrProperty.isFlowDefinition()) {
858  editAttribute = false;
859  showFlowEditor = true;
860  }
861  // continue if attribute is editable
862  if (editAttribute) {
863  // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
864  std::set<std::string> occurringValues;
865  // iterate over edited attributes
866  for (const auto& inspectedAC : ACs) {
867  occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
868  }
869  // get current value
870  std::ostringstream oss;
871  for (auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
872  if (values != occurringValues.begin()) {
873  oss << " ";
874  }
875  oss << *values;
876  }
877  // obtain value to be shown in row
878  std::string value = oss.str();
879  // declare a flag for enabled attributes
880  bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
881  // overwrite value if attribute is disabled (used by LinkIndex)
882  if (!attributeEnabled) {
883  value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
884  }
885  // for types, the following attributes must be always enabled
886  if (ACs.front()->getTagProperty().isType() &&
887  ((attrProperty.getAttr() == SUMO_ATTR_LENGTH) ||
888  (attrProperty.getAttr() == SUMO_ATTR_MINGAP) ||
889  (attrProperty.getAttr() == SUMO_ATTR_MAXSPEED) ||
890  (attrProperty.getAttr() == SUMO_ATTR_DESIRED_MAXSPEED))) {
891  attributeEnabled = true;
892  }
893  // extra check for Triggered and container Triggered
894  if (ACs.front()->getTagProperty().isVehicleStop()) {
895  if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_TRIGGERED) == false)) {
896  attributeEnabled = false;
897  } else if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED_CONTAINERS) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_CONTAINER_TRIGGERED) == false)) {
898  attributeEnabled = false;
899  }
900  }
901  // check if this attribute is computed
902  const bool computed = (ACs.size() > 1) ? false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
903  // if is a Vtype, obtain icon
904  GNEAttributeCarrier* ACParent = nullptr;
905  if ((ACs.size() == 1) && attrProperty.isVType()) {
906  if (attrProperty.getAttr() == SUMO_ATTR_TYPE) {
907  ACParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
908  if (ACParent == nullptr) {
909  ACParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
910  }
911  }
912  }
913  // create attribute editor row
914  myAttributesEditorRows[attrProperty.getPositionListed()] = new AttributesEditorRow(this, attrProperty, value, attributeEnabled, computed, ACParent);
915  }
916  }
917  // check if Flow editor has to be shown
918  if (showFlowEditor) {
919  myAttributesEditorFlow->showFlowEditor(ACs);
920  } else {
921  myAttributesEditorFlow->hideFlowEditor();
922  }
923  // show AttributesEditor
924  show();
925  } else {
926  myAttributesEditorFlow->hideFlowEditor();
927  }
928  // reparent help button (to place it at bottom)
929  myHelpButton->reparent(this);
930 }
931 
932 
933 void
935  // hide AttributesEditorFlowModule
936  myAttributesEditorFlow->hideFlowEditor();
937  // hide also AttributesEditor
938  hide();
939 }
940 
941 
942 void
943 GNEFrameAttributeModules::AttributesEditor::refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition) {
944  // get inspected ACs
945  const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
946  // first check if there is inspected attribute carriers
947  if (ACs.size() > 0) {
948  // Iterate over inspected attribute carriers
949  for (const auto& attrProperty : ACs.front()->getTagProperty()) {
950  // declare flag to show/hide attribute
951  bool editAttribute = true;
952  // disable editing for unique attributes in case of multi-selection
953  if ((ACs.size() > 1) && attrProperty.isUnique()) {
954  editAttribute = false;
955  }
956  // disable editing of extended attributes if includeExtended isn't enabled
957  if (attrProperty.isExtended() && !myIncludeExtended) {
958  editAttribute = false;
959  }
960  // disable editing of flow definition attributes, but enable flow editor
961  if (attrProperty.isFlowDefinition()) {
962  editAttribute = false;
963  }
964  // continue if attribute is editable
965  if (editAttribute) {
966  // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
967  std::set<std::string> occurringValues;
968  // iterate over edited attributes
969  for (const auto& inspectedAC : ACs) {
970  occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
971  }
972  // get current value
973  std::ostringstream oss;
974  for (auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
975  if (values != occurringValues.begin()) {
976  oss << " ";
977  }
978  oss << *values;
979  }
980  // obtain value to be shown in row
981  std::string value = oss.str();
982  // declare a flag for enabled attributes
983  bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
984  // for types, the following attributes must be always enabled
985  if (ACs.front()->getTagProperty().isType() &&
986  ((attrProperty.getAttr() == SUMO_ATTR_LENGTH) ||
987  (attrProperty.getAttr() == SUMO_ATTR_MINGAP) ||
988  (attrProperty.getAttr() == SUMO_ATTR_MAXSPEED) ||
989  (attrProperty.getAttr() == SUMO_ATTR_DESIRED_MAXSPEED))) {
990  attributeEnabled = true;
991  }
992  // overwrite value if attribute is disabled (used by LinkIndex)
993  if (!attributeEnabled) {
994  value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
995  }
996  // extra check for Triggered and container Triggered
997  if (ACs.front()->getTagProperty().isVehicleStop()) {
998  if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_TRIGGERED) == false)) {
999  attributeEnabled = false;
1000  } else if ((attrProperty.getAttr() == SUMO_ATTR_EXPECTED_CONTAINERS) && (ACs.front()->isAttributeEnabled(SUMO_ATTR_CONTAINER_TRIGGERED) == false)) {
1001  attributeEnabled = false;
1002  }
1003  }
1004  // check if this attribute is computed
1005  const bool computed = (ACs.size() > 1) ? false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
1006  // Check if Position or Shape refresh has to be forced
1007  if ((attrProperty.getAttr() == SUMO_ATTR_SHAPE) && forceRefreshShape) {
1008  myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, true, attributeEnabled, computed, nullptr);
1009  } else if ((attrProperty.getAttr() == SUMO_ATTR_POSITION) && forceRefreshPosition) {
1010  myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, true, attributeEnabled, computed, nullptr);
1011  } else if (attrProperty.isVType() && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
1012  attrProperty.getTagPropertyParent().isContainer())) {
1013  // get type/distribution parent
1014  auto typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
1015  if (typeParent == nullptr) {
1016  typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, ACs.front()->getAttribute(SUMO_ATTR_TYPE), false);
1017  }
1018  myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, false, attributeEnabled, computed, typeParent);
1019  } else {
1020  // Refresh attributes maintain invalid values
1021  myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value, false, attributeEnabled, computed, nullptr);
1022  }
1023  }
1024  }
1025  // check if flow editor has to be update
1026  if (myAttributesEditorFlow->shownFlowEditor()) {
1027  myAttributesEditorFlow->refreshFlowEditor();
1028  }
1029  }
1030 }
1031 
1032 
1033 GNEFrame*
1035  return myFrameParent;
1036 }
1037 
1038 
1039 long
1041  // open Help attributes dialog if there is inspected ACs
1042  if (myFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
1043  // open Help attributes dialog
1044  myFrameParent->openHelpAttributesDialog(myFrameParent->getViewNet()->getInspectedAttributeCarriers().front());
1045  }
1046  return 1;
1047 }
1048 
1049 // ---------------------------------------------------------------------------
1050 // GNEFrameAttributeModules::AttributesEditorExtended- methods
1051 // ---------------------------------------------------------------------------
1052 
1054  MFXGroupBoxModule(frameParent, TL("Extended attributes")),
1055  myFrameParent(frameParent) {
1056  // Create open dialog button
1057  GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Open attributes editor"), "", "", nullptr, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButton);
1058 }
1059 
1060 
1062 
1063 
1064 void
1066  show();
1067 }
1068 
1069 
1070 void
1072  hide();
1073 }
1074 
1075 
1076 long
1078  // open GNEAttributesCreator extended dialog
1079  myFrameParent->attributesEditorExtendedDialogOpened();
1080  return 1;
1081 }
1082 
1083 // ---------------------------------------------------------------------------
1084 // GNEFrameAttributeModules::GenericDataAttributes - methods
1085 // ---------------------------------------------------------------------------
1086 
1088  MFXGroupBoxModule(frameParent, TL("Attributes")),
1089  myFrameParent(frameParent) {
1090  // create textfield and buttons
1093 }
1094 
1095 
1097 
1098 
1099 void
1101  // refresh GenericDataAttributes
1102  refreshGenericDataAttributes();
1103  // show groupbox
1104  show();
1105 }
1106 
1107 
1108 void
1110  // hide groupbox
1111  hide();
1112 }
1113 
1114 
1115 void
1117  myTextFieldParameters->setText(getParametersStr().c_str());
1118  myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1119  myTextFieldParameters->killFocus();
1120 }
1121 
1122 
1123 const Parameterised::Map&
1125  return myParameters;
1126 }
1127 
1128 
1129 std::string
1131  std::string result;
1132  // Generate an string using the following structure: "key1=value1|key2=value2|...
1133  for (const auto& parameter : myParameters) {
1134  result += parameter.first + "=" + parameter.second + "|";
1135  }
1136  // remove the last "|"
1137  if (!result.empty()) {
1138  result.pop_back();
1139  }
1140  return result;
1141 }
1142 
1143 
1144 std::vector<std::pair<std::string, std::string> >
1146  std::vector<std::pair<std::string, std::string> > result;
1147  // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
1148  for (const auto& parameter : myParameters) {
1149  result.push_back(std::make_pair(parameter.first, parameter.second));
1150  }
1151  return result;
1152 }
1153 
1154 
1155 void
1156 GNEFrameAttributeModules::GenericDataAttributes::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
1157  // declare result string
1158  std::string result;
1159  // Generate an string using the following structure: "key1=value1|key2=value2|...
1160  for (const auto& parameter : parameters) {
1161  result += parameter.first + "=" + parameter.second + "|";
1162  }
1163  // remove the last "|"
1164  if (!result.empty()) {
1165  result.pop_back();
1166  }
1167  // set result in textField (and call onCmdEditParameters)
1168  myTextFieldParameters->setText(result.c_str(), TRUE);
1169 }
1170 
1171 
1172 GNEFrame*
1174  return myFrameParent;
1175 }
1176 
1177 
1178 bool
1180  if (myTextFieldParameters->getText().empty()) {
1181  return true;
1182  } else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1183  return false;
1184  } else {
1185  return Parameterised::areAttributesValid(getParametersStr());
1186  }
1187 }
1188 
1189 
1190 long
1192  // write debug information
1193  WRITE_DEBUG("Open single parameters dialog");
1194  if (GNESingleParametersDialog(this).execute()) {
1195  // write debug information
1196  WRITE_DEBUG("Close single parameters dialog");
1197  // Refresh parameter EditorCreator
1198  refreshGenericDataAttributes();
1199  } else {
1200  // write debug information
1201  WRITE_DEBUG("Cancel single parameters dialog");
1202  }
1203  return 1;
1204 }
1205 
1206 
1207 long
1209  // clear current existent parameters
1210  myParameters.clear();
1211  // check if current given string is valid
1212  if (Parameterised::areParametersValid(myTextFieldParameters->getText().text(), true)) {
1213  // parsed parameters ok, then set text field black and continue
1214  myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1215  myTextFieldParameters->killFocus();
1216  // obtain parameters "key=value"
1217  std::vector<std::string> parameters = StringTokenizer(myTextFieldParameters->getText().text(), "|", true).getVector();
1218  // iterate over parameters
1219  for (const auto& parameter : parameters) {
1220  // obtain key, value
1221  std::vector<std::string> keyParam = StringTokenizer(parameter, "=", true).getVector();
1222  // save it in myParameters
1223  myParameters[keyParam.front()] = keyParam.back();
1224  }
1225  // overwrite myTextFieldParameters (to remove duplicated parameters
1226  myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1227  } else {
1228  myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1229  }
1230  return 1;
1231 }
1232 
1233 // ---------------------------------------------------------------------------
1234 // GNEFrameAttributeModules::ParametersEditor - methods
1235 // ---------------------------------------------------------------------------
1236 
1238  MFXGroupBoxModule(inspectorFrameParent, TL("Parameters")),
1239  myInspectorFrameParent(inspectorFrameParent) {
1240  // create textfield and buttons
1243 }
1244 
1245 
1247  MFXGroupBoxModule(typeFrameParent, TL("Parameters")),
1248  myTypeFrameParent(typeFrameParent) {
1249  // create textfield and buttons
1252 }
1253 
1254 
1256 
1257 
1258 GNEViewNet*
1260  return myInspectorFrameParent ? myInspectorFrameParent->getViewNet() : myTypeFrameParent->getViewNet();
1261 }
1262 
1263 
1264 void
1266  if (myInspectorFrameParent) {
1267  // get inspected ACs
1268  const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1269  if ((inspectedACs.size() > 0) && inspectedACs.front()->getTagProperty().hasParameters()) {
1270  // refresh ParametersEditor
1271  refreshParametersEditor();
1272  // show groupbox
1273  show();
1274  } else {
1275  hideParametersEditor();
1276  }
1277  } else if (myTypeFrameParent) {
1278  if (myTypeFrameParent->getTypeSelector()->getCurrentType() != nullptr) {
1280  refreshParametersEditor();
1281  // show groupbox
1282  show();
1283  } else {
1284  hideParametersEditor();
1285  }
1286  } else {
1287  hideParametersEditor();
1288  }
1289 }
1290 
1291 
1292 void
1294  // hide groupbox
1295  hide();
1296 }
1297 
1298 
1299 void
1301  if (myInspectorFrameParent) {
1302  // get inspected ACs
1303  const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1304  // get front AC
1305  const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1306  // continue depending of frontAC
1307  if (frontAC && frontAC->getTagProperty().hasParameters()) {
1308  // check if we're editing a single or a multiple AC
1309  if (inspectedACs.size() == 1) {
1310  // set text field parameters
1311  myTextFieldParameters->setText(frontAC->getAttribute(GNE_ATTR_PARAMETERS).c_str());
1312  } else if (inspectedACs.size() > 0) {
1313  // check if parameters of all inspected ACs are different
1314  std::string parameters = frontAC->getAttribute(GNE_ATTR_PARAMETERS);
1315  for (const auto& AC : inspectedACs) {
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(), frontAC)) {
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 
1362 GNETypeFrame*
1364  return myTypeFrameParent;
1365 }
1366 
1367 
1368 long
1370  if (myInspectorFrameParent) {
1371  // get inspected ACs
1372  const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1373  // get front AC
1374  const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1375  // continue depending of frontAC
1376  if (frontAC && frontAC->getTagProperty().hasParameters()) {
1377  if (inspectedACs.size() > 1) {
1378  // write debug information
1379  WRITE_DEBUG("Open multiple parameters dialog");
1380  // open multiple parameters dialog
1381  if (GNEMultipleParametersDialog(this).execute()) {
1382  // write debug information
1383  WRITE_DEBUG("Close multiple parameters dialog");
1384  // update frame parent after attribute successfully set
1385  myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1386  // Refresh parameter EditorInspector
1387  refreshParametersEditor();
1388  } else {
1389  // write debug information
1390  WRITE_DEBUG("Cancel multiple parameters dialog");
1391  }
1392  } else {
1393  // write debug information
1394  WRITE_DEBUG("Open single parameters dialog");
1395  if (GNESingleParametersDialog(this).execute()) {
1396  // write debug information
1397  WRITE_DEBUG("Close single parameters dialog");
1398  // update frame parent after attribute successfully set
1399  myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1400  // Refresh parameter EditorInspector
1401  refreshParametersEditor();
1402  } else {
1403  // write debug information
1404  WRITE_DEBUG("Cancel single parameters dialog");
1405  }
1406  }
1407  }
1408  } else if (myTypeFrameParent) {
1409  // get type
1410  GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1411  // continue depending of type
1412  if (type) {
1413  // write debug information
1414  WRITE_DEBUG("Open single parameters dialog");
1415  if (GNESingleParametersDialog(this).execute()) {
1416  // write debug information
1417  WRITE_DEBUG("Close single parameters dialog");
1418  // Refresh parameter EditorInspector
1419  refreshParametersEditor();
1420  } else {
1421  // write debug information
1422  WRITE_DEBUG("Cancel single parameters dialog");
1423  }
1424  }
1425  }
1426  return 1;
1427 }
1428 
1429 
1430 long
1432  if (myInspectorFrameParent) {
1433  const auto& inspectedACs = myInspectorFrameParent->getAttributesEditor()->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1434  // get front AC
1435  GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1436  // continue depending of frontAC
1437  if (frontAC && frontAC->getTagProperty().hasParameters()) {
1438  // check if current given string is valid
1439  if (frontAC->isValid(GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
1440  // parsed parameters ok, then set text field black and continue
1441  myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1442  myTextFieldParameters->killFocus();
1443  // check inspected parameters
1444  if (inspectedACs.size() == 1) {
1445  // begin undo list
1446  myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC, "change parameters");
1447  // set parameters
1448  frontAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1449  // end undo list
1450  myInspectorFrameParent->getViewNet()->getUndoList()->end();
1451  } else if (inspectedACs.size() > 0) {
1452  // begin undo list
1453  myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC, "change multiple parameters");
1454  // set parameters in all ACs
1455  for (const auto& inspectedAC : inspectedACs) {
1456  inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1457  }
1458  // end undo list
1459  myInspectorFrameParent->getViewNet()->getUndoList()->end();
1460  }
1461  // update frame parent after attribute successfully set
1462  myInspectorFrameParent->attributeUpdated(GNE_ATTR_PARAMETERS);
1463  } else {
1464  myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1465  }
1466  }
1467  } else if (myTypeFrameParent) {
1468  // get type
1469  GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1470  // continue depending of frontAC
1471  if (type) {
1472  // check if current given string is valid
1473  if (type->isValid(GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
1474  // parsed parameters ok, then set text field black and continue
1475  myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1476  myTextFieldParameters->killFocus();
1477  // begin undo list
1478  myTypeFrameParent->getViewNet()->getUndoList()->begin(type, "change parameters");
1479  // set parameters
1480  type->setACParameters(myTextFieldParameters->getText().text(), myTypeFrameParent->getViewNet()->getUndoList());
1481  // end undo list
1482  myTypeFrameParent->getViewNet()->getUndoList()->end();
1483  } else {
1484  myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1485  }
1486  }
1487  }
1488  return 1;
1489 }
1490 
1491 
1492 bool
1494  if (viewNet->getEditModes().isCurrentSupermodeNetwork() &&
1496  return true;
1497  } else if (viewNet->getEditModes().isCurrentSupermodeDemand() &&
1498  AC->getTagProperty().isDemandElement()) {
1499  return true;
1500  } else if (viewNet->getEditModes().isCurrentSupermodeData() &&
1501  (AC->getTagProperty().isDataElement() || AC->getTagProperty().isMeanData())) {
1502  return true;
1503  } else {
1504  return false;
1505  }
1506 }
1507 
1508 
1509 bool
1512  return (viewNet->getEditModes().isCurrentSupermodeNetwork());
1513  } else if (ACAttr.getTagPropertyParent().isDemandElement()) {
1514  return (viewNet->getEditModes().isCurrentSupermodeDemand());
1515  } else if (ACAttr.getTagPropertyParent().isDataElement() || ACAttr.getTagPropertyParent().isMeanData()) {
1516  return (viewNet->getEditModes().isCurrentSupermodeData());
1517  } else {
1518  return false;
1519  }
1520 }
1521 
1522 /****************************************************************************/
FXDEFMAP(GNEFrameAttributeModules::AttributesEditorRow) AttributesEditorRowMap[]
@ MID_GNE_MOVEUP
move up
Definition: GUIAppEnum.h:1031
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:931
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition: GUIAppEnum.h:975
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
Definition: GUIAppEnum.h:967
@ MID_HELP
help button
Definition: GUIAppEnum.h:649
@ MID_GNE_SET_ATTRIBUTE_INSPECTPARENT
inspect attribute parent element
Definition: GUIAppEnum.h:969
@ MID_GNE_SET_ATTRIBUTE_COLOR
edit attribute color
Definition: GUIAppEnum.h:973
@ MID_GNE_SET_ATTRIBUTE_ALLOW
edit attribute allow
Definition: GUIAppEnum.h:971
@ MID_GNE_SET_ATTRIBUTE_BOOL
bool attribute edited
Definition: GUIAppEnum.h:965
@ MID_GNE_MOVEDOWN
move down
Definition: GUIAppEnum.h:1033
#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
long onCmdEditParameters(FXObject *, FXSelector, void *)
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
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:122
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
Definition: GNEViewNet.cpp:703
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
Definition: GUIDesigns.cpp:128
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
Definition: Parameterised.h:45
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< 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: VClassIcons.cpp:35
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