SUMO - Simulation of Urban MObility
GNEInspectorFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // The Widget for modifying network-element attributes (i.e. lane speed)
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
29 #include <netedit/GNENet.h>
30 #include <netedit/GNEUndoList.h>
31 #include <netedit/GNEViewParent.h>
39 
40 #include "GNEInspectorFrame.h"
41 #include "GNEDeleteFrame.h"
42 
43 
44 // ===========================================================================
45 // FOX callback mapping
46 // ===========================================================================
47 
48 FXDEFMAP(GNEInspectorFrame::OverlappedInspection) OverlappedInspectionMap[] = {
52 };
53 
54 FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[] = {
56 };
57 
61 };
62 
63 FXDEFMAP(GNEInspectorFrame::AttributesEditor) AttributesEditorMap[] = {
65 };
66 
67 FXDEFMAP(GNEInspectorFrame::NeteditAttributesEditor) NeteditAttributesEditorMap[] = {
70 };
71 
72 FXDEFMAP(GNEInspectorFrame::GEOAttributesEditor) GEOAttributesEditorMap[] = {
75 };
76 
77 FXDEFMAP(GNEInspectorFrame::TemplateEditor) TemplateEditorMap[] = {
81 };
82 
83 
84 // Object implementation
85 FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
86 FXIMPLEMENT(GNEInspectorFrame::OverlappedInspection, FXGroupBox, OverlappedInspectionMap, ARRAYNUMBER(OverlappedInspectionMap))
87 FXIMPLEMENT(GNEInspectorFrame::AttributesEditor::AttributeInput, FXHorizontalFrame, AttributeInputMap, ARRAYNUMBER(AttributeInputMap))
88 FXIMPLEMENT(GNEInspectorFrame::AttributesEditor, FXGroupBox, AttributesEditorMap, ARRAYNUMBER(AttributesEditorMap))
89 FXIMPLEMENT(GNEInspectorFrame::NeteditAttributesEditor, FXGroupBox, NeteditAttributesEditorMap, ARRAYNUMBER(NeteditAttributesEditorMap))
90 FXIMPLEMENT(GNEInspectorFrame::GEOAttributesEditor, FXGroupBox, GEOAttributesEditorMap, ARRAYNUMBER(GEOAttributesEditorMap))
91 FXIMPLEMENT(GNEInspectorFrame::TemplateEditor, FXGroupBox, TemplateEditorMap, ARRAYNUMBER(TemplateEditorMap))
92 
93 
94 // ===========================================================================
95 // method definitions
96 // ===========================================================================
97 
98 GNEInspectorFrame::GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
99  GNEFrame(horizontalFrameParent, viewNet, "Inspector"),
100  myPreviousElementInspect(nullptr),
101  myPreviousElementDelete(nullptr) {
102 
103  // Create back button
104  myBackButton = new FXButton(myHeaderLeftFrame, "", GUIIconSubSys::getIcon(ICON_NETEDITARROWLEFT), this, MID_GNE_INSPECTORFRAME_GOBACK, GUIDesignButtonIconRectangular);
105  myHeaderLeftFrame->hide();
106  myBackButton->hide();
107 
108  // Create Overlapped Inspection modul
109  myOverlappedInspection = new OverlappedInspection(this);
110 
111  // Create Attributes Editor modul
112  myAttributesEditor = new AttributesEditor(this);
113 
114  // Create GEO Parameters Editor modul
115  myGEOAttributesEditor = new GEOAttributesEditor(this);
116 
117  // create Generic parameters Editor modul
118  myGenericParametersEditor = new GenericParametersEditor(this);
119 
120  // Create Netedit Attributes Editor modul
121  myNeteditAttributesEditor = new NeteditAttributesEditor(this);
122 
123  // Create Template editor modul
124  myTemplateEditor = new TemplateEditor(this);
125 
126  // Create ACHierarchy modul
127  myACHierarchy = new GNEFrame::ACHierarchy(this);
128 }
129 
130 
132 
133 
134 void
136  // inspect a null element to reset inspector frame
137  inspectSingleElement(nullptr);
138  GNEFrame::show();
139 }
140 
141 
142 void
144  myInspectedACs.clear();
145  myViewNet->setDottedAC(nullptr);
146  GNEFrame::hide();
147 }
148 
149 
150 bool
151 GNEInspectorFrame::processClick(const Position& clickedPosition, GNEViewNet::ObjectsUnderCursor &objectsUnderCursor) {
152  if (objectsUnderCursor.getAttributeCarrierFront()) {
153  // change the selected attribute carrier if mySelectEdges is enabled and clicked element is a getLaneFront() and shift key isn't pressed
155  objectsUnderCursor.swapLane2Edge();
156  }
157  // if Control key is Pressed, select instead inspect element
159  // Check if this GLobject type is locked
161  // toogle netElement selection
162  if (objectsUnderCursor.getAttributeCarrierFront()->isAttributeCarrierSelected()) {
163  objectsUnderCursor.getAttributeCarrierFront()->unselectAttributeCarrier();
164  } else {
165  objectsUnderCursor.getAttributeCarrierFront()->selectAttributeCarrier();
166  }
167  }
168  } else {
169  // first check if we clicked over a OverlappedInspection point
171  if(!myOverlappedInspection->previousElement(clickedPosition)) {
172  // inspect attribute carrier, (or multiselection if AC is selected)
173  inspectClickedElement(objectsUnderCursor, clickedPosition);
174  }
175  } else if(!myOverlappedInspection->nextElement(clickedPosition)) {
176  // inspect attribute carrier, (or multiselection if AC is selected)
177  inspectClickedElement(objectsUnderCursor, clickedPosition);
178  }
179  // focus upper element of inspector frame
181  }
182  return true;
183  } else {
184  return false;
185  }
186 }
187 
188 
189 void
191  // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
192  std::vector<GNEAttributeCarrier*> itemsToInspect;
193  if (AC != nullptr) {
194  myViewNet->setDottedAC(AC);
195  if (AC->isAttributeCarrierSelected()) {
196  std::vector<GNEAttributeCarrier*> selectedACs = myViewNet->getNet()->getSelectedAttributeCarriers();
197  for (const auto &i : selectedACs) {
198  if (i->getTagProperty().getTag() == AC->getTagProperty().getTag()) {
199  itemsToInspect.push_back(i);
200  }
201  }
202  } else {
203  itemsToInspect.push_back(AC);
204  }
205  }
206  inspectMultisection(itemsToInspect);
207 }
208 
209 
210 void
211 GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
212  // hide back button
213  myHeaderLeftFrame->hide();
214  myBackButton->hide();
215  // Assing ACs to myACs
216  myInspectedACs = ACs;
217  // Hide all elements
225  // If vector of attribute Carriers contain data
226  if (myInspectedACs.size() > 0) {
227  // Set header
228  std::string headerString;
229  if (dynamic_cast<GNENetElement*>(myInspectedACs.front())) {
230  headerString = "Net: ";
231  } else if (dynamic_cast<GNEAdditional*>(myInspectedACs.front())) {
232  headerString = "Additional: ";
233  } else if (dynamic_cast<GNEShape*>(myInspectedACs.front())) {
234  headerString = "Shape: ";
235  }
236  if (myInspectedACs.size() > 1) {
237  headerString += toString(myInspectedACs.size()) + " ";
238  }
239  headerString += myInspectedACs.front()->getTagStr();
240  if (myInspectedACs.size() > 1) {
241  headerString += "s";
242  }
243  // Set headerString into header label
244  getFrameHeaderLabel()->setText(headerString.c_str());
245 
246  // Show attributes editor
248 
249  // show netedit attributes editor if we're inspecting elements with Netedit Attributes
251 
252  // Show GEO Attributes Editor if we're inspecting elements with GEO Attributes
254 
255  // show generic attributes editor
256  if (myInspectedACs.size() == 1) {
258  } else {
260  }
261 
262  // If attributes correspond to an Edge, show template editor
264 
265  // if we inspect a single Attribute carrier vector, show their childs
266  if (myInspectedACs.size() == 1) {
268  }
269  } else {
270  getFrameHeaderLabel()->setText("Inspect");
271  myContentFrame->recalc();
272  }
273 }
274 
275 
276 void
278  // Show back button if myPreviousElementInspect was defined
279  myPreviousElementInspect = previousElement;
280  if (myPreviousElementInspect != nullptr) {
281  // disable myPreviousElementDelete to avoid inconsistences
282  myPreviousElementDelete = nullptr;
284  myHeaderLeftFrame->show();
285  myBackButton->show();
286  }
287 }
288 
289 
290 void
291 GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
292  myPreviousElementDelete = previousElement;
293  myPreviousElementDeleteWasMarked = previousElementWasMarked;
294  // Show back button if myPreviousElementDelete is valid
295  if (myPreviousElementDelete != nullptr) {
296  // disable myPreviousElementInspect to avoid inconsistences
297  myPreviousElementInspect = nullptr;
299  myHeaderLeftFrame->show();
300  myBackButton->show();
301  }
302 }
303 
304 void
306  // Only remove if there is inspected ACs
307  if (myInspectedACs.size() > 0) {
308  // Try to find AC in myACs
309  auto i = std::find(myInspectedACs.begin(), myInspectedACs.end(), ac);
310  // if was found
311  if (i != myInspectedACs.end()) {
312  // erase AC from inspected ACs
313  myInspectedACs.erase(i);
314  // Write Warning in console if we're in testing mode
315  WRITE_DEBUG("Removed inspected element from Inspected ACs. " + toString(myInspectedACs.size()) + " ACs remains.");
316  // Inspect multi selection again
318  }
319  }
320 }
321 
322 
323 void
325  // Only remove if there is inspected ACs
326  if (myInspectedACs.size() > 0) {
327  // clear ACs
328  myInspectedACs.clear();
329  myViewNet->setDottedAC(nullptr);
330  // Inspect multi selection again (to hide all Editors)
332  }
333 }
334 
335 
338  return myACHierarchy;
339 }
340 
341 
344  return myTemplateEditor;
345 }
346 
347 
350  return myOverlappedInspection;
351 }
352 
353 
354 long
355 GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
356  // Inspect previous element or go back to Delete Frame
359  myPreviousElementInspect = nullptr;
360  } else if (myPreviousElementDelete != nullptr) {
361  myPreviousElementDelete = nullptr;
362  // Hide inspect frame and show delete frame
363  hide();
365  }
366  return 1;
367 }
368 
369 
370 const std::vector<GNEAttributeCarrier*>&
372  return myInspectedACs;
373 }
374 
375 // ---------------------------------------------------------------------------
376 // GNEInspectorFrame::OverlappedInspection - methods
377 // ---------------------------------------------------------------------------
378 
380  FXGroupBox(inspectorFrameParent->myContentFrame, "Overlapped elements", GUIDesignGroupBoxFrame),
381  myInspectorFrameParent(inspectorFrameParent),
382  myItemIndex(0) {
383  FXHorizontalFrame *frameButtons = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
384  // Create previous Item Button
386  myCurrentIndexLabel = new FXLabel(frameButtons, "", nullptr, GUIDesignLabelCenterThick);
387  // Create next Item Button
389  // Create help button
390  myHelpButton = new FXButton(this, "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
391 }
392 
393 
395 
396 
397 void
399  myOverlappedACs = objectsUnderCursor.getClickedAttributeCarriers();
400  mySavedClickedPosition = clickedPosition;
401  myItemIndex = 0;
402  myCurrentIndexLabel->setText(("1 / " + toString(myOverlappedACs.size())).c_str());
403  // show template editor
404  show();
405 }
406 
407 
408 void
410  // hide template editor
411  hide();
412 }
413 
414 
415 bool
417  return shown();
418 }
419 
420 
421 bool
423  return (mySavedClickedPosition.distanceSquaredTo2D(clickedPosition) < 0.25);
424 }
425 
426 bool
428  // first check if OverlappedInspection is shown
429  if(shown()) {
430  // check if given position is near saved position
431  if (checkSavedPosition(clickedPosition)) {
432  // inspect next element
433  onCmdNextElement(0,0,0);
434  return true;
435  } else {
436  return false;
437  }
438  } else {
439  return false;
440  }
441 }
442 
443 
444 bool
446  // first check if OverlappedInspection is shown
447  if(shown()) {
448  // check if given position is near saved position
449  if (checkSavedPosition(clickedPosition)) {
450  // inspect previousElement
451  onCmdPreviousElement(0,0,0);
452  return true;
453  } else {
454  return false;
455  }
456  } else {
457  return false;
458  }
459 }
460 
461 
462 long
464  // set index (it works as a ring)
465  if(myItemIndex > 0) {
466  myItemIndex--;
467  } else {
468  myItemIndex = (myOverlappedACs.size() - 1);
469  }
470  // change current inspected item
472  // if is an lane and selectEdges checkBox is enabled, inspect their edge
474  myInspectorFrameParent->inspectSingleElement(&dynamic_cast<GNELane*>(AC)->getParentEdge());
475  } else {
477  }
478  // show OverlappedInspection again (because it's hidden in inspectSingleElement)
479  show();
480  // update current label
481  myCurrentIndexLabel->setText((toString(myItemIndex+1) + " / " + toString(myOverlappedACs.size())).c_str());
482  // update view (due dotted contour)
483  myInspectorFrameParent->getViewNet()->update();
484  return 1;
485 }
486 
487 
488 long
490  // set index (it works as a ring)
491  myItemIndex = (myItemIndex + 1) % myOverlappedACs.size();
492  // change current inspected item
494  // if is an lane and selectEdges checkBox is enabled, inspect their edge
496  myInspectorFrameParent->inspectSingleElement(&dynamic_cast<GNELane*>(AC)->getParentEdge());
497  } else {
499  }
500  // show OverlappedInspection again (because it's hidden in inspectSingleElement)
501  show();
502  // update current label
503  myCurrentIndexLabel->setText((toString(myItemIndex+1) + " / " + toString(myOverlappedACs.size())).c_str());
504  // update view (due dotted contour)
505  myInspectorFrameParent->getViewNet()->update();
506  return 1;
507 }
508 
509 
510 long
512  FXDialogBox* helpDialog = new FXDialogBox(this, "GEO attributes Help", GUIDesignDialogBox);
513  std::ostringstream help;
514  help
515  << " - Click in the same position\n"
516  << " for inspect next element\n"
517  << " - Shift + Click in the same\n"
518  << " position for inspect\n"
519  << " previous element";
520  new FXLabel(helpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
521  // "OK"
522  new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
523  helpDialog->create();
524  helpDialog->show();
525  return 1;
526 }
527 
528 
529 void
530 GNEInspectorFrame::inspectClickedElement(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition) {
531  if(objectsUnderCursor.getAttributeCarrierFront()) {
532  // inspect front element
533  inspectSingleElement(objectsUnderCursor.getAttributeCarrierFront());
534  // if element has overlapped elements, show Overlapped Inspection modul
535  if(objectsUnderCursor.getClickedAttributeCarriers().size() > 1) {
536  myOverlappedInspection->showOverlappedInspection(objectsUnderCursor, clickedPosition);
537  } else {
539  }
540  }
541 }
542 
543 
544 // ---------------------------------------------------------------------------
545 // GNEInspectorFrame::AttributesEditor::AttributeInput - methods
546 // ---------------------------------------------------------------------------
547 
549  FXHorizontalFrame(attributeEditorParent, GUIDesignAuxiliarHorizontalFrame),
550  myAttributesEditorParent(attributeEditorParent),
551  myTag(SUMO_TAG_NOTHING),
552  myAttr(SUMO_ATTR_NOTHING),
553  myMultiple(false) {
554  // Create and hide label
555  myLabel = new FXLabel(this, "attributeLabel", nullptr, GUIDesignLabelAttribute);
556  myLabel->hide();
557  // Create and hide ButtonCombinableChoices
558  myButtonCombinableChoices = new FXButton(this, "AttributeButton", nullptr, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonAttribute);
560  // create and hidde color editor
561  myColorEditor = new FXButton(this, "ColorButton", nullptr, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonAttribute);
562  myColorEditor->hide();
563  // Create and hide textField for int attributes
565  myTextFieldInt->hide();
566  // Create and hide textField for real/time attributes
568  myTextFieldReal->hide();
569  // Create and hide textField for string attributes
571  myTextFieldStrings->hide();
572  // Create and hide ComboBox
574  myChoicesCombo->hide();
575  // Create and hide checkButton
576  myBoolCheckButton = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute);
577  myBoolCheckButton->hide();
578 }
579 
580 
581 void
583  // Set actual Tag, Attribute and multiple
584  myTag = ACTag;
585  myAttr = ACAttr;
586  // set multiple
587  myMultiple = GNEAttributeCarrier::parse<std::vector<std::string>>(value).size() > 1;
588  // obtain attribute property (only for improve code legibility)
590  // enable all input values
592  if (attrValue.isColor()) {
593  myColorEditor->setTextColor(FXRGB(0, 0, 0));
594  myColorEditor->setText(toString(ACAttr).c_str());
595  myColorEditor->show();
596  } else {
597  // Show attribute Label
598  myLabel->setText(toString(myAttr).c_str());
599  myLabel->show();
600  }
601  // Set field depending of the type of value
602  if (attrValue.isBool()) {
603  // first we need to check if all boolean values are equal
604  bool allBooleanValuesEqual = true;
605  // obtain boolean vector
606  auto booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
607  // iterate over pased booleans comparing all element with the first
608  for (const auto &i : booleanVector) {
609  if (i != booleanVector.front()) {
610  allBooleanValuesEqual = false;
611  }
612  }
613  // use checkbox or textfield depending if all booleans are equal
614  if(allBooleanValuesEqual) {
615  // set check button
616  if (booleanVector.front()) {
617  myBoolCheckButton->setCheck(true);
618  myBoolCheckButton->setText("true");
619  } else {
620  myBoolCheckButton->setCheck(false);
621  myBoolCheckButton->setText("false");
622  }
623  // show check button
624  myBoolCheckButton->show();
625  // enable or disable depending if attribute is editable
626  if (attrValue.isNonEditable()) {
627  myBoolCheckButton->disable();
628  } else {
629  myBoolCheckButton->enable();
630  }
631  } else {
632  // show list of bools (0 1)
633  myTextFieldStrings->setText(value.c_str());
634  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
635  myTextFieldStrings->show();
636  // enable or disable depending if attribute is editable
637  if (attrValue.isNonEditable()) {
638  myTextFieldStrings->disable();
639  } else {
640  myTextFieldStrings->enable();
641  }
642  }
643  } else if (attrValue.isDiscrete()) {
644  // Check if are combinable choices
645  if ((attrValue.getDiscreteValues().size() > 0) && attrValue.isCombinable()) {
646  // hide label
647  myLabel->hide();
648  // Show button combinable choices
649  myButtonCombinableChoices->setText(toString(myAttr).c_str());
651  // Show string with the values
652  myTextFieldStrings->setText(value.c_str());
653  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
654  myTextFieldStrings->show();
655  } else if (!myMultiple) {
656  // fill comboBox
657  myChoicesCombo->clearItems();
658  for (const auto &it : attrValue.getDiscreteValues()) {
659  myChoicesCombo->appendItem(it.c_str());
660  }
661  // show combo box with values
662  myChoicesCombo->setNumVisible((int)attrValue.getDiscreteValues().size());
663  myChoicesCombo->setCurrentItem(myChoicesCombo->findItem(value.c_str()));
664  myChoicesCombo->setTextColor(FXRGB(0, 0, 0));
665  myChoicesCombo->show();
666  // enable or disable depending if attribute is editable
667  if (attrValue.isNonEditable()) {
668  myChoicesCombo->disable();
669  } else {
670  myChoicesCombo->enable();
671  }
672  } else {
673  // represent combinable choices in multiple selections always with a textfield instead with a comboBox
674  myTextFieldStrings->setText(value.c_str());
675  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
676  myTextFieldStrings->show();
677  // enable or disable depending if attribute is editable
678  if (attrValue.isNonEditable()) {
679  myTextFieldStrings->disable();
680  } else {
681  myTextFieldStrings->enable();
682  }
683  }
684  } else if (attrValue.isFloat() || attrValue.isTime()) {
685  // show TextField for real/time values
686  myTextFieldReal->setText(value.c_str());
687  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
688  myTextFieldReal->show();
689  // enable or disable depending if attribute is editable
690  if (attrValue.isNonEditable()) {
691  myTextFieldReal->disable();
692  } else {
693  myTextFieldReal->enable();
694  }
695  } else if (attrValue.isInt()) {
696  // Show textField for int attributes
697  myTextFieldInt->setText(value.c_str());
698  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
699  myTextFieldInt->show();
700  // enable or disable depending if attribute is editable
701  if (attrValue.isNonEditable()) {
702  myTextFieldInt->disable();
703  } else {
704  myTextFieldInt->enable();
705  }
706  // we need an extra check for connection attribute "TLIndex", because it cannot be edited if junction's connection doesn' have a TLS
707  if((ACTag == SUMO_TAG_CONNECTION) && (ACAttr == SUMO_ATTR_TLLINKINDEX) && (value == "No TLS")) {
708  myTextFieldInt->disable();
709  }
710  } else {
711  // In any other case (String, list, etc.), show value as String
712  myTextFieldStrings->setText(value.c_str());
713  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
714  myTextFieldStrings->show();
715  // enable or disable depending if attribute is editable
716  if (attrValue.isNonEditable()) {
717  myTextFieldStrings->disable();
718  } else {
719  myTextFieldStrings->enable();
720  }
721  }
722  // Show AttributeInput
723  show();
724  // recalc after show elements
725  recalc();
726 }
727 
728 
729 void
731  // Hide all elements
732  myLabel->hide();
733  myTextFieldInt->hide();
734  myTextFieldReal->hide();
735  myTextFieldStrings->hide();
736  myChoicesCombo->hide();
737  myBoolCheckButton->hide();
739  myColorEditor->hide();
740  // hide AttributeInput
741  hide();
742  // recalc after hide all elements
743  recalc();
744 }
745 
746 
747 void
749  if (myTextFieldInt->shown()) {
750  // set last valid value and restore color if onlyValid is disabled
751  if (myTextFieldInt->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
752  myTextFieldInt->setText(value.c_str());
753  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
754  }
755  } else if (myTextFieldReal->shown()) {
756  // set last valid value and restore color if onlyValid is disabled
757  if (myTextFieldReal->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
758  myTextFieldReal->setText(value.c_str());
759  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
760  }
761  } else if (myTextFieldStrings->shown()) {
762  // set last valid value and restore color if onlyValid is disabled
763  if (myTextFieldStrings->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
764  myTextFieldStrings->setText(value.c_str());
765  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
766  }
767  } else if (myChoicesCombo->shown()) {
768  // set last valid value and restore color if onlyValid is disabled
769  if (myChoicesCombo->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
770  myChoicesCombo->setText(value.c_str());
771  myChoicesCombo->setTextColor(FXRGB(0, 0, 0));
772  }
773  } else if (myBoolCheckButton->shown()) {
774  myBoolCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
775  }
776 }
777 
778 
779 bool
781  return ((myTextFieldInt->getTextColor() == FXRGB(0, 0, 0)) && (myTextFieldReal->getTextColor() == FXRGB(0, 0, 0)) &&
782  (myTextFieldStrings->getTextColor() == FXRGB(0, 0, 0)) && (myChoicesCombo->getTextColor() == FXRGB(0, 0, 0)));
783 }
784 
785 
786 long
788  if (obj == myColorEditor) {
789  // create FXColorDialog
790  FXColorDialog colordialog(this, tr("Color Dialog"));
791  colordialog.setTarget(this);
792  // If previous attribute wasn't correct, set black as default color
793  if (GNEAttributeCarrier::canParse<RGBColor>(myTextFieldStrings->getText().text())) {
794  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::parseColor(myTextFieldStrings->getText().text())));
795  } else {
796  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::parseColor(myAttributesEditorParent->getInspectorFrameParent()->getInspectedACs().front()->getTagProperty().getDefaultValue(myAttr))));
797  }
798  // execute dialog to get a new color
799  if (colordialog.execute()) {
800  std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
801  myTextFieldStrings->setText(newValue.c_str());
802  if (myAttributesEditorParent->getInspectorFrameParent()->getInspectedACs().front()->isValid(myAttr, newValue)) {
803  // if its valid for the first AC than its valid for all (of the same type)
805  myAttributesEditorParent->getInspectorFrameParent()->getViewNet()->getUndoList()->p_begin("Change multiple attributes");
806  }
807  // Set new value of attribute in all selected ACs
808  for (const auto &it_ac : myAttributesEditorParent->getInspectorFrameParent()->getInspectedACs()) {
809  it_ac->setAttribute(myAttr, newValue, myAttributesEditorParent->getInspectorFrameParent()->getViewNet()->getUndoList());
810  }
811  // If previously value was incorrect, change font color to black
812  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
813  myTextFieldStrings->killFocus();
814  }
815  }
816  return 0;
817  } else if (obj == myButtonCombinableChoices) {
818  // if its valid for the first AC than its valid for all (of the same type)
820  myAttributesEditorParent->getInspectorFrameParent()->getViewNet()->getUndoList()->p_begin("Change multiple attributes");
821  }
822  // open GNEDialog_AllowDisallow
824  std::string allowed = myAttributesEditorParent->getInspectorFrameParent()->getInspectedACs().front()->getAttribute(SUMO_ATTR_ALLOW);
825  // Set new value of attribute in all selected ACs
826  for (const auto &it_ac : myAttributesEditorParent->getInspectorFrameParent()->getInspectedACs()) {
828  }
829  // finish change multiple attributes
832  }
833  return 1;
834  } else {
835  throw ProcessError("Invalid call to onCmdOpenAttributeDialog");
836  }
837 }
838 
839 
840 long
842  // Declare changed value
843  std::string newVal;
844  bool refreshGEOAndNeteditEditors = false;
845  // get Tag and attribute Values (only for improve efficiency)
846  const auto& tagValues = GNEAttributeCarrier::getTagProperties(myTag);
847  const auto& attrValues = tagValues.getAttributeProperties(myAttr);
848  // First, obtain the string value of the new attribute depending of their type
849  if (attrValues.isBool()) {
850  // first check if we're editing boolean as a list of string or as a checkbox
851  if(myBoolCheckButton->shown()) {
852  // Set true o false depending of the checkBox
853  if (myBoolCheckButton->getCheck()) {
854  myBoolCheckButton->setText("true");
855  newVal = "true";
856  } else {
857  myBoolCheckButton->setText("false");
858  newVal = "false";
859  }
860  } else {
861  // obtain boolean value of myTextFieldStrings (because we're inspecting multiple attribute carriers with different values)
862  newVal = myTextFieldStrings->getText().text();
863  }
864  } else if (attrValues.isDiscrete()) {
865  // Check if are combinable choices (for example, Vehicle Types)
866  if ((attrValues.getDiscreteValues().size() > 0) &&
867  attrValues.isCombinable()) {
868  // Get value obtained using AttributesEditor
869  newVal = myTextFieldStrings->getText().text();
870  } else if (!myMultiple) {
871  // Get value of ComboBox
872  newVal = myChoicesCombo->getText().text();
873  } else {
874  // due this is a multiple selection, obtain value of myTextFieldStrings instead of comboBox
875  newVal = myTextFieldStrings->getText().text();
876  }
877  } else if (attrValues.isFloat() || attrValues.isTime()) {
878  // Check if default value of attribute must be set
879  if (myTextFieldReal->getText().empty() && attrValues.hasDefaultValue()) {
880  newVal = tagValues.getDefaultValue(myAttr);
881  myTextFieldReal->setText(newVal.c_str());
882  } else {
883  // obtain value of myTextFieldReal
884  newVal = myTextFieldReal->getText().text();
885  }
886  } else if (attrValues.isInt()) {
887  // Check if default value of attribute must be set
888  if (myTextFieldInt->getText().empty() && attrValues.hasDefaultValue()) {
889  newVal = tagValues.getDefaultValue(myAttr);
890  myTextFieldInt->setText(newVal.c_str());
891  } else {
892  // obtain value of myTextFieldInt
893  newVal = myTextFieldInt->getText().text();
894  }
895  } else if (attrValues.isString()) {
896  // Check if default value of attribute must be set
897  if (myTextFieldStrings->getText().empty() && attrValues.hasDefaultValue()) {
898  newVal = tagValues.getDefaultValue(myAttr);
899  myTextFieldStrings->setText(newVal.c_str());
900  } else {
901  // obtain value of myTextFieldStrings
902  newVal = myTextFieldStrings->getText().text();
903  }
904  }
905 
906  // we need a extra check for Position and Shape Values, due #2658
907  if ((myAttr == SUMO_ATTR_POSITION) || (myAttr == SUMO_ATTR_SHAPE)) {
908  newVal = stripWhitespaceAfterComma(newVal);
909  // due we're changing a Position and Shape attribute, GEO and Netedit Editors must be refresh
910  refreshGEOAndNeteditEditors = true;
911  }
912 
913  // Check if attribute must be changed
914  if (myAttributesEditorParent->getInspectorFrameParent()->getInspectedACs().front()->isValid(myAttr, newVal)) {
915  // if its valid for the first AC than its valid for all (of the same type)
917  myAttributesEditorParent->getInspectorFrameParent()->getViewNet()->getUndoList()->p_begin("Change multiple attributes");
918  } else if (myAttr == SUMO_ATTR_ID) {
919  // IDs attribute has to be encapsulated
921  }
922  // Set new value of attribute in all selected ACs
923  for (const auto &it_ac : myAttributesEditorParent->getInspectorFrameParent()->getInspectedACs()) {
924  it_ac->setAttribute(myAttr, newVal, myAttributesEditorParent->getInspectorFrameParent()->getViewNet()->getUndoList());
925  }
926  // finish change multiple attributes or ID Attributes
929  } else if (myAttr == SUMO_ATTR_ID) {
931  }
932  // If previously value was incorrect, change font color to black
933  if (attrValues.isCombinable()) {
934  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
935  myTextFieldStrings->killFocus();
936  // in this case, we need to refresh the other values (For example, allow/Disallow objects)
938  } else if (attrValues.isDiscrete()) {
939  myChoicesCombo->setTextColor(FXRGB(0, 0, 0));
940  myChoicesCombo->killFocus();
941  } else if (attrValues.isFloat() || attrValues.isTime()) {
942  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
943  myTextFieldReal->killFocus();
944  } else if (attrValues.isInt() && myTextFieldStrings != nullptr) {
945  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
946  myTextFieldInt->killFocus();
947  } else if (myTextFieldStrings != nullptr) {
948  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
949  myTextFieldStrings->killFocus();
950  }
951  // Check if GEO and Netedit editors must be refresh
952  if (refreshGEOAndNeteditEditors) {
955  }
956  } else {
957  // If value of TextField isn't valid, change color to Red depending of type
958  if (attrValues.isCombinable()) {
959  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
960  myTextFieldStrings->killFocus();
961  } else if (attrValues.isDiscrete()) {
962  myChoicesCombo->setTextColor(FXRGB(255, 0, 0));
963  myChoicesCombo->killFocus();
964  } else if (attrValues.isFloat() || attrValues.isTime()) {
965  myTextFieldReal->setTextColor(FXRGB(255, 0, 0));
966  } else if (attrValues.isInt() && myTextFieldStrings != nullptr) {
967  myTextFieldInt->setTextColor(FXRGB(255, 0, 0));
968  } else if (myTextFieldStrings != nullptr) {
969  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
970  }
971  // Write Warning in console if we're in testing mode
972  WRITE_DEBUG("Value '" + newVal + "' for attribute " + toString(myAttr) + " of " + toString(myTag) + " isn't valid");
973  }
974  return 1;
975 }
976 
977 
978 std::string
980  std::string result(stringValue);
981  while (result.find(", ") != std::string::npos) {
982  result = StringUtils::replace(result, ", ", ",");
983  }
984  return result;
985 }
986 
987 
988 void
990  myTextFieldInt->enable();
991  myTextFieldReal->enable();
992  myTextFieldStrings->enable();
993  myChoicesCombo->enable();
994  myBoolCheckButton->enable();
995 }
996 
997 
998 void
1000  myTextFieldInt->disable();
1001  myTextFieldReal->disable();
1002  myTextFieldStrings->disable();
1003  myChoicesCombo->disable();
1004  myBoolCheckButton->disable();
1005 }
1006 
1007 // ---------------------------------------------------------------------------
1008 // GNEInspectorFrame::AttributesEditor - methods
1009 // ---------------------------------------------------------------------------
1010 
1012  FXGroupBox(inspectorFrameParent->myContentFrame, "Internal attributes", GUIDesignGroupBoxFrame),
1013  myInspectorFrameParent(inspectorFrameParent) {
1014  // Create sufficient AttributeInput for all types of AttributeCarriers
1015  for (int i = 0; i < (int)GNEAttributeCarrier::getHigherNumberOfAttributes(); i++) {
1016  myVectorOfAttributeInputs.push_back(new AttributeInput(this));
1017  }
1018  // Create help button
1019  myHelpButton = new FXButton(this, "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
1020 }
1021 
1022 
1023 void
1025  if (myInspectorFrameParent->getInspectedACs().size() > 0) {
1026  // Gets tag (only for simplify code)
1027  SumoXMLTag ACFrontTag = myInspectorFrameParent->getInspectedACs().front()->getTagProperty().getTag();
1028  // check if current AC is a Junction without TLSs (needed to hidde TLS options)
1029  bool disableTLSinJunctions = (dynamic_cast<GNEJunction*>(myInspectorFrameParent->getInspectedACs().front()) && (dynamic_cast<GNEJunction*>(myInspectorFrameParent->getInspectedACs().front())->getNBNode()->getControllingTLS().empty()));
1030  // Iterate over attributes
1031  for (const auto &i : GNEAttributeCarrier::getTagProperties(ACFrontTag)) {
1032  // disable editing for unique attributes in case of multi-selection
1033  if ((myInspectorFrameParent->getInspectedACs().size() > 1) && i.second.isUnique()) {
1034  continue;
1035  }
1036  // Declare a set of occuring values and insert attribute's values of item (note: We use a set to avoid repeated values)
1037  std::set<std::string> occuringValues;
1038  for (const auto &it_ac : myInspectorFrameParent->getInspectedACs()) {
1039  occuringValues.insert(it_ac->getAttribute(i.first));
1040  }
1041  // get current value
1042  std::ostringstream oss;
1043  for (auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1044  if (it_val != occuringValues.begin()) {
1045  oss << " ";
1046  }
1047  oss << *it_val;
1048  }
1049  std::string value = oss.str();
1050  if ((ACFrontTag == SUMO_TAG_CONNECTION) && (i.first == SUMO_ATTR_TLLINKINDEX)
1051  && value == toString(NBConnection::InvalidTlIndex)) {
1052  // possibly the connections are newly created (allow assigning
1053  // tlIndex if the junction(s) have a traffic light
1054  for (const auto &it_ac : myInspectorFrameParent->getInspectedACs()) {
1055  if (!it_ac->isValid(SUMO_ATTR_TLLINKINDEX, "0")) {
1056  value = "No TLS";
1057  break;
1058  }
1059  }
1060  }
1061  // Show attribute
1062  if ((disableTLSinJunctions && (ACFrontTag == SUMO_TAG_JUNCTION) && ((i.first == SUMO_ATTR_TLTYPE) || (i.first == SUMO_ATTR_TLID))) == false) {
1063  // first show AttributesEditor
1064  show();
1065  // show attribute
1066  myVectorOfAttributeInputs[i.second.getPositionListed()]->showAttribute(ACFrontTag, i.first, value);
1067  }
1068  }
1069  }
1070 }
1071 
1072 
1073 void
1075  // hide al attributes
1076  for (const auto &i : myVectorOfAttributeInputs) {
1077  i->hideAttribute();
1078  }
1079  // hide also AttributesEditor
1080  hide();
1081 }
1082 
1083 
1084 void
1085 GNEInspectorFrame::AttributesEditor::refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition) {
1086  if (myInspectorFrameParent->getInspectedACs().size() > 0) {
1087  // Declare pointer for allow/Disallow vehicles
1088  std::pair<GNEInspectorFrame::AttributesEditor::AttributeInput*, std::string> myAllowAttribute(nullptr, "");
1089  std::pair<GNEInspectorFrame::AttributesEditor::AttributeInput*, std::string> myDisallowAttribute(nullptr, "");
1090  // Gets tag (only for simplify code)
1091  SumoXMLTag ACFrontTag = myInspectorFrameParent->getInspectedACs().front()->getTagProperty().getTag();
1092  // check if current AC is a Junction without TLSs (needed to hidde TLS options)
1093  bool disableTLSinJunctions = (dynamic_cast<GNEJunction*>(myInspectorFrameParent->getInspectedACs().front()) && (dynamic_cast<GNEJunction*>(myInspectorFrameParent->getInspectedACs().front())->getNBNode()->getControllingTLS().empty()));
1094  // Iterate over attributes
1095  for (const auto &i : myInspectorFrameParent->getInspectedACs().front()->getTagProperty()) {
1096  // disable editing for unique attributes in case of multi-selection
1097  if ((myInspectorFrameParent->getInspectedACs().size() > 1) && i.second.isUnique()) {
1098  continue;
1099  }
1100  // Declare a set of occuring values and insert attribute's values of item
1101  std::set<std::string> occuringValues;
1102  for (const auto &it_ac : myInspectorFrameParent->getInspectedACs()) {
1103  occuringValues.insert(it_ac->getAttribute(i.first));
1104  }
1105  // get current value
1106  std::ostringstream oss;
1107  for (auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1108  if (it_val != occuringValues.begin()) {
1109  oss << " ";
1110  }
1111  oss << *it_val;
1112  }
1113  // Show attribute
1114  if ((disableTLSinJunctions && (ACFrontTag == SUMO_TAG_JUNCTION) && ((i.first == SUMO_ATTR_TLTYPE) || (i.first == SUMO_ATTR_TLID))) == false) {
1115  // refresh attribute, with a special case for allow/disallow vehicles
1116  if (i.first == SUMO_ATTR_ALLOW) {
1117  myAllowAttribute.first = myVectorOfAttributeInputs[i.second.getPositionListed()];
1118  myAllowAttribute.second = oss.str();
1119  } else if (i.first == SUMO_ATTR_DISALLOW) {
1120  myDisallowAttribute.first = myVectorOfAttributeInputs[i.second.getPositionListed()];
1121  myDisallowAttribute.second = oss.str();
1122  } else {
1123  // Check if refresh of Position or Shape has to be forced
1124  if ((i.first == SUMO_ATTR_SHAPE) && forceRefreshShape) {
1125  myVectorOfAttributeInputs[i.second.getPositionListed()]->refreshAttributeInput(oss.str(), true);
1126  } else if ((i.first == SUMO_ATTR_POSITION) && forceRefreshPosition) {
1127  // Refresh attributes maintain invalid values
1128  myVectorOfAttributeInputs[i.second.getPositionListed()]->refreshAttributeInput(oss.str(), true);
1129  } else {
1130  // Refresh attributes maintain invalid values
1131  myVectorOfAttributeInputs[i.second.getPositionListed()]->refreshAttributeInput(oss.str(), false);
1132  }
1133  }
1134  }
1135  }
1136  // Check special case for Allow/Disallow attributes
1137  if (myAllowAttribute.first && myDisallowAttribute.first) {
1138  // if allow attribute is valid but disallow attribute is invalid
1139  if (myAllowAttribute.first->isCurrentAttributeValid() && !myDisallowAttribute.first->isCurrentAttributeValid()) {
1140  // force refresh of disallow attribute
1141  myDisallowAttribute.first->refreshAttributeInput(myDisallowAttribute.second, true);
1142  }
1143  // if disallow attribute is valid but allow attribute is invalid
1144  if (myDisallowAttribute.first->isCurrentAttributeValid() && !myAllowAttribute.first->isCurrentAttributeValid()) {
1145  // force refresh of disallow attribute
1146  myAllowAttribute.first->refreshAttributeInput(myAllowAttribute.second, true);
1147  }
1148  }
1149  }
1150 }
1151 
1152 
1155  return myInspectorFrameParent;
1156 }
1157 
1158 
1159 long
1161  // open Help attributes dialog if there is inspected ACs
1162  if (myInspectorFrameParent->getInspectedACs().size() > 0) {
1163  // open Help attributes dialog
1165  }
1166  return 1;
1167 }
1168 
1169 // ---------------------------------------------------------------------------
1170 // GNEInspectorFrame::NeteditAttributesEditor - methods
1171 // ---------------------------------------------------------------------------
1172 
1174  FXGroupBox(inspectorFrameParent->myContentFrame, "Netedit attributes", GUIDesignGroupBoxFrame),
1175  myInspectorFrameParent(inspectorFrameParent) {
1176 
1177  // Create elements for additional parent
1181 
1182  // Create elements for block movement
1184  myLabelBlockMovement = new FXLabel(myHorizontalFrameBlockMovement, "Block move", nullptr, GUIDesignLabelAttribute);
1186 
1187  // Create elements for block shape
1188  myHorizontalFrameBlockShape = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1189  myLabelBlockShape = new FXLabel(myHorizontalFrameBlockShape, "Block shape", nullptr, GUIDesignLabelAttribute);
1191 
1192  // Create elements for close shape
1193  myHorizontalFrameCloseShape = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1194  myLabelCloseShape = new FXLabel(myHorizontalFrameCloseShape, "Close shape", nullptr, GUIDesignLabelAttribute);
1196 
1197  // Create help button
1198  myHelpButton = new FXButton(this, "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
1199 }
1200 
1201 
1203 
1204 
1205 void
1207  if (myInspectorFrameParent->getInspectedACs().size() > 0) {
1208  // obtain tag property (only for improve code legibility)
1209  const auto& tagValue = myInspectorFrameParent->getInspectedACs().front()->getTagProperty();
1210  // Check if item can be moved
1211  if (tagValue.canBlockMovement()) {
1212  // show NeteditAttributesEditor
1213  show();
1214  // Iterate over AC to obtain values
1215  bool value = true;
1216  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1217  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_MOVEMENT));
1218  }
1219  // show block movement frame
1221  // set check box value and update label
1222  if (value) {
1223  myCheckBoxBlockMovement->setCheck(true);
1224  myCheckBoxBlockMovement->setText("true");
1225  } else {
1226  myCheckBoxBlockMovement->setCheck(false);
1227  myCheckBoxBlockMovement->setText("false");
1228  }
1229  }
1230  // check if item can block their shape
1231  if (tagValue.canBlockShape()) {
1232  // show NeteditAttributesEditor
1233  show();
1234  // Iterate over AC to obtain values
1235  bool value = true;
1236  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1237  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_SHAPE));
1238  }
1239  // show block shape frame
1241  // set check box value and update label
1242  if (value) {
1243  myCheckBoxBlockShape->setCheck(true);
1244  myCheckBoxBlockShape->setText("true");
1245  } else {
1246  myCheckBoxBlockShape->setCheck(false);
1247  myCheckBoxBlockShape->setText("false");
1248  }
1249  }
1250  // check if item can block their shape
1251  if (tagValue.canCloseShape()) {
1252  // show NeteditAttributesEditor
1253  show();
1254  // Iterate over AC to obtain values
1255  bool value = true;
1256  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1257  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
1258  }
1259  // show close shape frame
1261  // set check box value and update label
1262  if (value) {
1263  myCheckBoxCloseShape->setCheck(true);
1264  myCheckBoxCloseShape->setText("true");
1265  } else {
1266  myCheckBoxCloseShape->setCheck(false);
1267  myCheckBoxCloseShape->setText("false");
1268  }
1269  }
1270  // Check if item has another item as parent and can be reparemt
1271  if (tagValue.hasParent() && tagValue.canBeReparent()) {
1272  // show NeteditAttributesEditor
1273  show();
1274  // obtain additional Parent
1275  std::set<std::string> parents;
1276  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1277  parents.insert(i->getAttribute(GNE_ATTR_PARENT));
1278  }
1279  // show additional parent frame
1281  // set Label and TextField with the Tag and ID of parent
1282  myLabelAdditionalParent->setText((toString(myInspectorFrameParent->getInspectedACs().front()->getTagProperty().getParentTag()) + " parent").c_str());
1283  myTextFieldAdditionalParent->setText(toString(parents).c_str());
1284  }
1285  }
1286 }
1287 
1288 
1289 void
1291  // hide all elements of GroupBox
1296  // hide groupbox
1297  hide();
1298 }
1299 
1300 
1301 void
1303  if (myInspectorFrameParent->getInspectedACs().size() > 0) {
1304  // refresh block movement
1305  if (myHorizontalFrameBlockMovement->shown()) {
1306  // Iterate over AC to obtain values
1307  bool value = true;
1308  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1309  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_MOVEMENT));
1310  }
1311  // set check box value and update label
1312  if (value) {
1313  myCheckBoxBlockMovement->setCheck(true);
1314  myCheckBoxBlockMovement->setText("true");
1315  } else {
1316  myCheckBoxBlockMovement->setCheck(false);
1317  myCheckBoxBlockMovement->setText("false");
1318  }
1319  }
1320  // refresh block shape
1321  if (myHorizontalFrameBlockShape->shown()) {
1322  // Iterate over AC to obtain values
1323  bool value = true;
1324  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1325  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_SHAPE));
1326  }
1327  // set check box value and update label
1328  if (value) {
1329  myCheckBoxBlockShape->setCheck(true);
1330  myCheckBoxBlockShape->setText("true");
1331  } else {
1332  myCheckBoxBlockShape->setCheck(false);
1333  myCheckBoxBlockShape->setText("false");
1334  }
1335  }
1336  // refresh close shape
1337  if (myHorizontalFrameCloseShape->shown()) {
1338  // Iterate over AC to obtain values
1339  bool value = true;
1340  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1341  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
1342  }
1343  // set check box value and update label
1344  if (value) {
1345  myCheckBoxCloseShape->setCheck(true);
1346  myCheckBoxCloseShape->setText("true");
1347  } else {
1348  myCheckBoxCloseShape->setCheck(false);
1349  myCheckBoxCloseShape->setText("false");
1350  }
1351  }
1352  // Check if item has another item as parent (Currently only for single Additionals)
1353  if (myHorizontalFrameAdditionalParent->shown() && ((myTextFieldAdditionalParent->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
1354  // set Label and TextField with the Tag and ID of parent
1355  myLabelAdditionalParent->setText((toString(myInspectorFrameParent->getInspectedACs().front()->getTagProperty().getParentTag()) + " parent").c_str());
1356  myTextFieldAdditionalParent->setText(myInspectorFrameParent->getInspectedACs().front()->getAttribute(GNE_ATTR_PARENT).c_str());
1357  }
1358  }
1359 }
1360 
1361 
1362 long
1364  // make sure that ACs has elements
1365  if (myInspectorFrameParent->getInspectedACs().size() > 0) {
1366  // check if we're changing multiple attributes
1367  if (myInspectorFrameParent->getInspectedACs().size() > 1) {
1368  myInspectorFrameParent->getViewNet()->getUndoList()->p_begin("Change multiple attributes");
1369  }
1370  if (obj == myCheckBoxBlockMovement) {
1371  // set new values in all inspected Attribute Carriers
1372  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1373  if (myCheckBoxBlockMovement->getCheck() == 1) {
1374  i->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1375  myCheckBoxBlockMovement->setText("true");
1376  } else {
1377  i->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1378  myCheckBoxBlockMovement->setText("false");
1379  }
1380  }
1381  } else if (obj == myCheckBoxBlockShape) {
1382  // set new values in all inspected Attribute Carriers
1383  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1384  if (myCheckBoxBlockShape->getCheck() == 1) {
1385  i->setAttribute(GNE_ATTR_BLOCK_SHAPE, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1386  myCheckBoxBlockShape->setText("true");
1387  } else {
1388  i->setAttribute(GNE_ATTR_BLOCK_SHAPE, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1389  myCheckBoxBlockShape->setText("false");
1390  }
1391  }
1392  } else if (obj == myCheckBoxCloseShape) {
1393  // set new values in all inspected Attribute Carriers
1394  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1395  if (myCheckBoxCloseShape->getCheck() == 1) {
1396  i->setAttribute(GNE_ATTR_CLOSE_SHAPE, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1397  myCheckBoxCloseShape->setText("true");
1398  } else {
1399  i->setAttribute(GNE_ATTR_CLOSE_SHAPE, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1400  myCheckBoxCloseShape->setText("false");
1401  }
1402  }
1403  } else if (obj == myTextFieldAdditionalParent) {
1404  if (myInspectorFrameParent->getInspectedACs().front()->isValid(GNE_ATTR_PARENT, myTextFieldAdditionalParent->getText().text())) {
1405  // change parent of all inspected elements
1406  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1408  }
1409  myTextFieldAdditionalParent->setTextColor(FXRGB(0, 0, 0));
1410  } else {
1411  myTextFieldAdditionalParent->setTextColor(FXRGB(255, 0, 0));
1412  myTextFieldAdditionalParent->killFocus();
1413  }
1414  }
1415  // finish change multiple attributes
1416  if (myInspectorFrameParent->getInspectedACs().size() > 1) {
1418  }
1419  // force refresh values of AttributesEditor and GEOAttributesEditor
1422  }
1423  return 1;
1424 }
1425 
1426 
1427 long
1429  return 0;
1430 }
1431 
1432 // ---------------------------------------------------------------------------
1433 // GNEInspectorFrame::GEOAttributesEditor - methods
1434 // ---------------------------------------------------------------------------
1435 
1437  FXGroupBox(inspectorFrameParent->myContentFrame, "GEO Attributes", GUIDesignGroupBoxFrame),
1438  myInspectorFrameParent(inspectorFrameParent) {
1439 
1440  // Create Frame for GEOAttribute
1441  myGEOAttributeFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1442  myGEOAttributeLabel = new FXLabel(myGEOAttributeFrame, "Undefined GEO Attribute", nullptr, GUIDesignLabelAttribute);
1444 
1445  // Create Frame for use GEO
1446  myUseGEOFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1447  myUseGEOLabel = new FXLabel(myUseGEOFrame, toString(SUMO_ATTR_GEO).c_str(), nullptr, GUIDesignLabelAttribute);
1449 
1450  // Create help button
1451  myHelpButton = new FXButton(this, "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
1452 }
1453 
1454 
1456 
1457 
1458 void
1460  // make sure that ACs has elements
1461  if (myInspectorFrameParent->getInspectedACs().size() > 0) {
1462  // obtain tag property (only for improve code legibility)
1463  const auto& tagProperty = myInspectorFrameParent->getInspectedACs().front()->getTagProperty();
1464  // check if item can use a geo position
1465  if (tagProperty.hasGEOPosition() || tagProperty.hasGEOShape()) {
1466  // show GEOAttributesEditor
1467  show();
1468  // Iterate over AC to obtain values
1469  bool value = true;
1470  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1471  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(SUMO_ATTR_GEO));
1472  }
1473  // show use geo frame
1474  myUseGEOFrame->show();
1475  // set UseGEOCheckButton value of and update label (only if geo conversion is defined)
1476  if (GeoConvHelper::getFinal().getProjString() != "!") {
1477  myUseGEOCheckButton->enable();
1478  if (value) {
1479  myUseGEOCheckButton->setCheck(true);
1480  myUseGEOCheckButton->setText("true");
1481  } else {
1482  myUseGEOCheckButton->setCheck(false);
1483  myUseGEOCheckButton->setText("false");
1484  }
1485  } else {
1486  myUseGEOCheckButton->disable();
1487  }
1488  // now specify if a single position or an entire shape must be shown (note: cannot be shown both at the same time, and GEO Shape/Position only works for single selections)
1489  if (tagProperty.hasGEOPosition() && myInspectorFrameParent->getInspectedACs().size() == 1) {
1490  myGEOAttributeFrame->show();
1492  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1493  // only allow edit if geo conversion is defined
1494  if (GeoConvHelper::getFinal().getProjString() != "!") {
1495  myGEOAttributeTextField->enable();
1496  myGEOAttributeTextField->setText(myInspectorFrameParent->getInspectedACs().front()->getAttribute(SUMO_ATTR_GEOPOSITION).c_str());
1497  } else {
1498  myGEOAttributeTextField->disable();
1499  myGEOAttributeTextField->setText("No geo-conversion defined");
1500  }
1501  } else if (tagProperty.hasGEOShape() && myInspectorFrameParent->getInspectedACs().size() == 1) {
1502  myGEOAttributeFrame->show();
1503  myGEOAttributeLabel->setText(toString(SUMO_ATTR_GEOSHAPE).c_str());
1504  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1505  // only allow edit if geo conversion is defined
1506  if (GeoConvHelper::getFinal().getProjString() != "!") {
1507  myGEOAttributeTextField->enable();
1508  myGEOAttributeTextField->setText(myInspectorFrameParent->getInspectedACs().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
1509  } else {
1510  myGEOAttributeTextField->disable();
1511  myGEOAttributeTextField->setText("No geo-conversion defined");
1512  }
1513  }
1514  }
1515  }
1516 }
1517 
1518 
1519 void
1521  // hide all elements of GroupBox
1522  myGEOAttributeFrame->hide();
1523  myUseGEOFrame->hide();
1524  // hide groupbox
1525  hide();
1526 }
1527 
1528 
1529 void
1531  // obtain tag property (only for improve code legibility)
1532  const auto& tagProperty = myInspectorFrameParent->getInspectedACs().front()->getTagProperty();
1533  // Check that myGEOAttributeFrame is shown
1534  if ((GeoConvHelper::getFinal().getProjString() != "!") && myGEOAttributeFrame->shown() && ((myGEOAttributeTextField->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
1535  if (tagProperty.hasGEOPosition()) {
1536  myGEOAttributeTextField->setText(myInspectorFrameParent->getInspectedACs().front()->getAttribute(SUMO_ATTR_GEOPOSITION).c_str());
1537  } else if (tagProperty.hasGEOShape()) {
1538  myGEOAttributeTextField->setText(myInspectorFrameParent->getInspectedACs().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
1539  }
1540  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1541  }
1542 }
1543 
1544 
1545 long
1547  // make sure that ACs has elements
1548  if ((GeoConvHelper::getFinal().getProjString() != "!") && (myInspectorFrameParent->getInspectedACs().size() > 0)) {
1549  if (obj == myGEOAttributeTextField) {
1550  // obtain tag property (only for improve code legibility)
1551  const auto& tagProperty = myInspectorFrameParent->getInspectedACs().front()->getTagProperty();
1552  // Change GEO Attribute depending of type (Position or shape)
1553  if (tagProperty.hasGEOPosition()) {
1554  if (myInspectorFrameParent->getInspectedACs().front()->isValid(SUMO_ATTR_GEOPOSITION, myGEOAttributeTextField->getText().text())) {
1556  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1557  } else {
1558  myGEOAttributeTextField->setTextColor(FXRGB(255, 0, 0));
1559  myGEOAttributeTextField->killFocus();
1560  }
1561  } else if (tagProperty.hasGEOShape()) {
1562  if (myInspectorFrameParent->getInspectedACs().front()->isValid(SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text())) {
1564  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1565  } else {
1566  myGEOAttributeTextField->setTextColor(FXRGB(255, 0, 0));
1567  myGEOAttributeTextField->killFocus();
1568  }
1569  } else {
1570  throw ProcessError("myGEOAttributeTextField must be hidden becaurse there isn't GEO Attribute to edit");
1571  }
1572  } else if (obj == myUseGEOCheckButton) {
1573  // update GEO Attribute of entire selection
1574  for (const auto &i : myInspectorFrameParent->getInspectedACs()) {
1575  if (myUseGEOCheckButton->getCheck() == 1) {
1576  i->setAttribute(SUMO_ATTR_GEO, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1577  myUseGEOCheckButton->setText("true");
1578  } else {
1579  i->setAttribute(SUMO_ATTR_GEO, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1580  myUseGEOCheckButton->setText("false");
1581  }
1582  }
1583  }
1584  // force refresh values of Attributes editor and NeteditAttributesEditor
1587  }
1588  return 1;
1589 }
1590 
1591 
1592 long
1594  FXDialogBox* helpDialog = new FXDialogBox(this, "GEO attributes Help", GUIDesignDialogBox);
1595  std::ostringstream help;
1596  help
1597  << " SUMO uses the World Geodetic System 84 (WGS84/UTM).\n"
1598  << " For a GEO-referenced network, geo coordinates are represented as pairs of Longitude and Latitude\n"
1599  << " in decimal degrees without extra symbols. (N,W..)\n"
1600  << " - Longitude: East-west position of a point on the Earth's surface.\n"
1601  << " - Latitude: North-south position of a point on the Earth's surface.\n"
1602  << " - CheckBox 'geo' enables or disables saving position in GEO coordinates\n";
1603  new FXLabel(helpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
1604  // "OK"
1605  new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
1606  helpDialog->create();
1607  helpDialog->show();
1608  return 1;
1609 }
1610 
1611 // ---------------------------------------------------------------------------
1612 // GNEInspectorFrame::TemplateEditor - methods
1613 // ---------------------------------------------------------------------------
1614 
1616  FXGroupBox(inspectorFrameParent->myContentFrame, "Templates", GUIDesignGroupBoxFrame),
1617  myInspectorFrameParent(inspectorFrameParent),
1618  myEdgeTemplate(nullptr) {
1619 
1620  // Create copy template button
1621  myCopyTemplateButton = new FXButton(this, "", nullptr, this, MID_GNE_INSPECTORFRAME_COPYTEMPLATE, GUIDesignButton);
1622  myCopyTemplateButton->hide();
1623 
1624  // Create set template button
1625  mySetTemplateButton = new FXButton(this, "Set as Template\t\t", nullptr, this, MID_GNE_INSPECTORFRAME_SETTEMPLATE, GUIDesignButton);
1626  mySetTemplateButton->hide();
1627 }
1628 
1629 
1631  if (myEdgeTemplate) {
1632  // delete template
1633  myEdgeTemplate->decRef("GNEInspectorFrame::~GNEInspectorFrame");
1634  if (myEdgeTemplate->unreferenced()) {
1635  delete myEdgeTemplate;
1636  }
1637  }
1638 }
1639 
1640 
1641 void
1643  if (myInspectorFrameParent->getInspectedACs().front()->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1644  // show template editor
1645  show();
1646  // show "Copy Template" (caption supplied via onUpdate)
1647  myCopyTemplateButton->show();
1648  // show "Set As Template"
1649  if (myInspectorFrameParent->getInspectedACs().size() == 1) {
1650  mySetTemplateButton->show();
1651  mySetTemplateButton->setText(("Set edge '" + myInspectorFrameParent->getInspectedACs().front()->getID() + "' as Template").c_str());
1652  }
1653  }
1654 }
1655 
1656 
1657 void
1659  // hide buttons
1660  myCopyTemplateButton->hide();
1661  mySetTemplateButton->hide();
1662  // hide template editor
1663  hide();
1664 }
1665 
1666 
1667 GNEEdge*
1669  return myEdgeTemplate;
1670 }
1671 
1672 
1673 void
1675  if (myEdgeTemplate) {
1676  myEdgeTemplate->decRef("GNEInspectorFrame::setEdgeTemplate");
1677  if (myEdgeTemplate->unreferenced()) {
1678  delete myEdgeTemplate;
1679  }
1680  }
1681  myEdgeTemplate = tpl;
1682  myEdgeTemplate->incRef("GNEInspectorFrame::setEdgeTemplate");
1683 }
1684 
1685 
1686 long
1688  for (const auto &it : myInspectorFrameParent->getInspectedACs()) {
1689  GNEEdge* edge = dynamic_cast<GNEEdge*>(it);
1690  assert(edge);
1693  }
1694  return 1;
1695 }
1696 
1697 
1698 long
1700  assert(myInspectorFrameParent->getInspectedACs().size() == 1);
1701  GNEEdge* edge = dynamic_cast<GNEEdge*>(myInspectorFrameParent->getInspectedACs().front());
1702  assert(edge);
1703  setEdgeTemplate(edge);
1704  return 1;
1705 }
1706 
1707 
1708 long
1709 GNEInspectorFrame::TemplateEditor::onUpdCopyTemplate(FXObject* sender, FXSelector, void*) {
1710  // declare caption for button
1711  FXString caption;
1712  if (myEdgeTemplate) {
1713  if (myInspectorFrameParent->getInspectedACs().size() == 1) {
1714  caption = ("Copy '" + myEdgeTemplate->getMicrosimID() + "' into edge '" + myInspectorFrameParent->getInspectedACs().front()->getID() + "'").c_str();
1715  } else {
1716  caption = ("Copy '" + myEdgeTemplate->getMicrosimID() + "' into " + toString(myInspectorFrameParent->getInspectedACs().size()) + " selected edges").c_str();
1717  }
1718  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);
1719  } else {
1720  caption = "No edge Template Set";
1721  sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);
1722  }
1723  sender->handle(this, FXSEL(SEL_COMMAND, FXLabel::ID_SETSTRINGVALUE), (void*)&caption);
1724  return 1;
1725 }
1726 
1727 /****************************************************************************/
void hideGenericParametersEditor()
hide netedit attributes editor
Definition: GNEFrame.cpp:1057
long onCmdSetAttribute(FXObject *, FXSelector, void *)
try to set new attribute value
void refreshNeteditAttributesEditor(bool forceRefresh)
refresh netedit attributes
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
Definition: GNEEdge.cpp:841
void showTemplateEditor()
show template editor
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
FXLabel * myLabelBlockMovement
Label for Check blocked movement.
bool nextElement(const Position &clickedPosition)
try to go to next element if clicked position is near to saved position
SumoXMLTag
Numbers representing SUMO-XML - element names.
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:205
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:177
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:115
void removeInspectedAC(GNEAttributeCarrier *ac)
remove AC from current inspected ACs
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
Definition: GUIDesigns.h:57
GNEInspectorFrame * myInspectorFrameParent
current GNEInspectorFrame parent
FXHorizontalFrame * myHorizontalFrameBlockMovement
horizontal frame for block movement
bool selectEdges() const
whether inspection, selection and inversion should apply to edges or to lanes
Definition: GNEViewNet.cpp:733
long onCmdNeteditAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
inspect next element
Definition: GUIAppEnum.h:603
GNEInspectorFrame * myInspectorFrameParent
pointer to GNEInspectorFrame parent
const KeyPressed & getKeyPressed() const
get Key Pressed modul
std::vector< GNEAttributeCarrier * > myInspectedACs
the multi-selection currently being inspected
begin/end of the description of a junction
begin/end of the description of a single lane
FXLabel * getFrameHeaderLabel() const
get the label for the frame&#39;s header
Definition: GNEFrame.cpp:1726
FXButton * mySetTemplateButton
set template button
AttributesEditor * myAttributesEditor
Attribute editor.
long onCmdPreviousElement(FXObject *, FXSelector, void *)
Inspect previous element (from top to bot)
void inspectClickedElement(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
Inspect a singe element (the front of AC AttributeCarriers of ObjectUnderCursor.
block shape of a graphic element (Used mainly in GNEShapes)
const AttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn&#39;t exist)
FXTextField * myTextFieldInt
textField to modify the value of int attributes
FXLabel * myLabel
pointer to attribute label
FXHorizontalFrame * myGEOAttributeFrame
horizontal frame for GEOAttribute
bool isCurrentAttributeValid() const
check if current attribute of TextField/ComboBox is valid
Position mySavedClickedPosition
saved clicked position
void showACHierarchy(GNEAttributeCarrier *AC)
show ACHierarchy
Definition: GNEFrame.cpp:576
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
Definition: GUIDesigns.h:201
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
void show()
show delete frame
connectio between two lanes
void hideACHierarchy()
hide ACHierarchy
Definition: GNEFrame.cpp:587
const std::vector< GNEAttributeCarrier * > & getClickedAttributeCarriers() const
get vector with clicked ACs
Definition: GNEViewNet.cpp:427
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:108
GNEViewParent * getViewParent() const
get the net object
void inspectSingleElement(GNEAttributeCarrier *AC)
Inspect a single element.
go back to the previous element
Definition: GUIAppEnum.h:601
FXTextField * myGEOAttributeTextField
textField for GEOAttribute
bool processClick(const Position &clickedPosition, GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
void refreshGEOAttributesEditor(bool forceRefresh)
refresh GEO attributes editor
Close shape of a polygon (Used by GNEPolys)
link,node: the traffic light id responsible for this link
void refreshAttributeInput(const std::string &value, bool forceRefresh)
refresh current attribute input
void hideOverlappedInspection()
hide template editor
FXCheckButton * myUseGEOCheckButton
checkBox for use GEO
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:73
GNEFrame::ACHierarchy * myACHierarchy
Attribute Carrier Hierarchy.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
FXTextField * myTextFieldStrings
textField to modify the value of string attributes
FXHorizontalFrame * myUseGEOFrame
horizontal frame for use GEO
void hideTemplateEditor()
hide template editor
GNEInspectorFrame * myInspectorFrameParent
current GNEInspectorFrame parent
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers()
get all selected attribute carriers
Definition: GNENet.cpp:1736
void showNeteditAttributesEditor()
show netedit attributes editor
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:1720
long onCmdSetGEOAttribute(FXObject *, FXSelector, void *)
Called when user change the current GEO Attribute.
virtual void selectAttributeCarrier(bool changeFlag=true)=0
GUIGlObjectType getGlTypeFront() const
get front GUI GL object type (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:297
FXTextField * myTextFieldAdditionalParent
pointer for change additional parent
FXLabel * myLabelCloseShape
Label for close shape.
~GNEInspectorFrame()
Destructor.
OverlappedInspection * getOverlappedInspection() const
get OverlappedInspection modul
GenericParametersEditor * myGenericParametersEditor
Generic parameters editor.
long onCmdSetNeteditAttribute(FXObject *, FXSelector, void *)
Called when user change the current GEO Attribute.
GNEViewNet * myViewNet
View Net for changes.
Definition: GNEFrame.h:612
long onCmdSetTemplate(FXObject *, FXSelector, void *)
set current edge as new template
const std::vector< GNEAttributeCarrier * > & getInspectedACs() const
get current list of inspected ACs
void hide()
hide inspector frame
FXHorizontalFrame * myHorizontalFrameAdditionalParent
horizontal frame for change additional parent
bool previousElement(const Position &clickedPosition)
try to go to previous element if clicked position is near to saved position
bool myPreviousElementDeleteWasMarked
flag to ckec if myPreviousElementDelete was marked in Delete Frame
FXLabel * myCurrentIndexLabel
label for current index
FXButton * myHelpButton
button for help
#define GUIDesignButtonIconRectangular
button only with icon (46x23)
Definition: GUIDesigns.h:66
void showGEOAttributesEditor()
show GEO attributes editor
GNEUndoList * getUndoList() const
get the undoList object
FXButton * myColorEditor
Button for open color editor.
static const int InvalidTlIndex
Definition: NBConnection.h:120
void enableAttributeInputElements()
enable attribute input elements
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items
long onCmdOpenAttributeDialog(FXObject *, FXSelector, void *)
open model dialog for more comfortable attribute editing
#define GUIDesignTextField
Definition: GUIDesigns.h:34
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
FXHorizontalFrame * myHorizontalFrameBlockShape
horizontal frame for block shape
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:615
help button
Definition: GUIAppEnum.h:400
FXCheckButton * myBoolCheckButton
pointer to menu check
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
FXButton * myHelpButton
button for help
GNEInspectorFrame * myInspectorFrameParent
current GNEInspectorFrame parent
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
Definition: GUIDesigns.h:261
void disableAttributeInputElements()
disable attribute input elements
FXTextField * myTextFieldReal
textField to modify the value of real/Time attributes
set object as template
Definition: GUIAppEnum.h:597
GNEFrame::ACHierarchy * getACHierarchy() const
get ACHierarchy
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
FXButton * myCopyTemplateButton
copy template button
block movement of a graphic element
invalid attribute
void setDottedAC(const GNEAttributeCarrier *AC)
set attributeCarrier under cursor
attribute edited trought dialog
Definition: GUIAppEnum.h:547
bool controlKeyPressed() const
check if CONTROL key was pressed during click
Definition: GNEViewNet.cpp:475
node: the type of traffic light
FXLabel * myLabelAdditionalParent
Label for additional parent.
edge: the shape in xml-definition
long onCmdCopyTemplate(FXObject *, FXSelector, void *)
copy edge attributes from edge template
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
FXHorizontalFrame * myHorizontalFrameCloseShape
horizontal frame for close shape
FXDEFMAP(GNEInspectorFrame::OverlappedInspection) OverlappedInspectionMap[]
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
FXButton * myHelpButton
button for help
void clearInspectedAC()
Clear all current inspected ACs.
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:248
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:1689
std::vector< GNEAttributeCarrier * > myOverlappedACs
objects under cursor
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:184
void incRef(const std::string &debugMsg="")
Increarse reference.
Dialog for edit rerouters.
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
Definition: GUIDesigns.h:60
FXComboBox * myChoicesCombo
pointer to combo box choices
long onUpdCopyTemplate(FXObject *, FXSelector, void *)
update the copy button with the name of the template
GNEAttributeCarrier * myPreviousElementInspect
pointer to previous element called by Inspector Frame
long onCmdGoBack(FXObject *, FXSelector, void *)
called when user toogle the go back button
FXCheckButton * myCheckBoxBlockShape
pointer to check box "Block Shape"
void decRef(const std::string &debugMsg="")
Decrease reference.
GNEEdge * myEdgeTemplate
the edge template
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
long onCmdNextElement(FXObject *, FXSelector, void *)
Inspect next Element (from top to bot)
begin/end of the description of an edge
void showAttribute(SumoXMLTag ACTag, SumoXMLAttr ACAttribute, const std::string &value)
show attribute of ac
FXCheckButton * myCheckBoxBlockMovement
pointer to check box "Block movement"
bool overlappedInspectionShown() const
check if overlappedInspection modul is shown
void showOverlappedInspection(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
show template editor
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center and height of 23 ...
Definition: GUIDesigns.h:163
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
FXButton * myPreviousElement
Previous element button.
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:46
long onCmdGEOAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
static std::string replace(std::string str, const char *what, const char *by)
bool checkSavedPosition(const Position &clickedPosition) const
check if given position is near to saved position
#define GUIDesignButton
Definition: GUIDesigns.h:54
GNEAttributeCarrier * myPreviousElementDelete
pointer to previous element called by Delete Frame
long onCmdOverlappingHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
inspect previous element
Definition: GUIAppEnum.h:605
virtual void show()
show Frame
Definition: GNEFrame.cpp:1695
FXButton * myNextElement
Next element button.
#define GUIDesignDialogBox
Definition: GUIDesigns.h:410
FXButton * myButtonCombinableChoices
pointer to buttonCombinableChoices
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:227
std::string stripWhitespaceAfterComma(const std::string &stringValue)
removed invalid spaces of Positions and shapes
GEOAttributesEditor * myGEOAttributesEditor
GEO Attributes editor.
void showGenericParametersEditor(GNEAttributeCarrier *AC)
show netedit attributes editor (used for edit generic parameters of an existent AC) ...
Definition: GNEFrame.cpp:1013
FXLabel * myUseGEOLabel
Label for use GEO.
TemplateEditor * getTemplateEditor() const
get template editor
NeteditAttributesEditor * myNeteditAttributesEditor
Netedit Attributes editor.
GNEInspectorFrame * getInspectorFrameParent() const
get InspectorFrame Parent
TemplateEditor * myTemplateEditor
Template editor.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions) ...
Definition: Position.h:249
FXLabel * myLabelBlockShape
Label for Check blocked shape.
bool IsObjectTypeLocked(const GUIGlObjectType type) const
check if an object is locked
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
Definition: GUIDesigns.h:37
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:1704
void setEdgeTemplate(GNEEdge *tpl)
seh the template edge (we assume shared responsibility via reference counting)
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:307
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_MODE_DELETE
void show()
show inspector frame
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:40
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:114
void hideNeteditAttributesEditor()
hide netedit attributes editor
attribute edited
Definition: GUIAppEnum.h:537
FXCheckButton * myCheckBoxCloseShape
pointer to check box "Block movement"
#define GUIDesignButtonOK
Definition: GUIDesigns.h:96
void swapLane2Edge()
swap lane to edge
Definition: GNEViewNet.cpp:260
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
link: the index of the link within the traffic light
void openHelpAttributesDialog(const GNEAttributeCarrier::TagProperties &tagProperties) const
Open help attributes dialog.
Definition: GNEFrame.cpp:1757
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
parent of an additional element
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
void hideGEOAttributesEditor()
hide GEO attributes editor
FXButton * myBackButton
back Button
bool myMultiple
flag to check if input element contains multiple values
void inspectMultisection(const std::vector< GNEAttributeCarrier *> &ACs)
Inspect the given multi-selection.
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
Definition: GNEViewNet.cpp:465
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
Definition: GUIDesigns.h:166
FXLabel * myGEOAttributeLabel
Label for GEOAttribute.
void hideAttributesEditorModul()
hide attribute editor
std::vector< GNEInspectorFrame::AttributesEditor::AttributeInput * > myVectorOfAttributeInputs
list of Attribute inputs
GNEInspectorFrame * myInspectorFrameParent
pointer to inspector frame parent
void showAttributeEditorModul()
show attributes of ac
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
long onCmdAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
bool unreferenced()
check if object ins&#39;t referenced
GNEInspectorFrame::AttributesEditor * myAttributesEditorParent
pointer to AttributesEditor parent
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
Definition: GNEFrame.h:621
OverlappedInspection * myOverlappedInspection
Overlapped Inspection.