Eclipse 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.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // The Widget for modifying network-element attributes (i.e. lane speed)
20 /****************************************************************************/
21 #include <config.h>
22 
23 #include <netedit/GNENet.h>
24 #include <netedit/GNEUndoList.h>
25 #include <netedit/GNEViewNet.h>
26 #include <netedit/GNEViewParent.h>
40 
41 #include "GNEInspectorFrame.h"
42 #include "GNEDeleteFrame.h"
43 
44 
45 // ===========================================================================
46 // FOX callback mapping
47 // ===========================================================================
48 
49 FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[] = {
51 };
52 
53 FXDEFMAP(GNEInspectorFrame::NeteditAttributesEditor) NeteditAttributesEditorMap[] = {
57 };
58 
59 FXDEFMAP(GNEInspectorFrame::GEOAttributesEditor) GEOAttributesEditorMap[] = {
62 };
63 
68 };
69 
70 
71 
74 };
75 
76 // Object implementation
77 FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
78 FXIMPLEMENT(GNEInspectorFrame::NeteditAttributesEditor, MFXGroupBoxModule, NeteditAttributesEditorMap, ARRAYNUMBER(NeteditAttributesEditorMap))
79 FXIMPLEMENT(GNEInspectorFrame::GEOAttributesEditor, MFXGroupBoxModule, GEOAttributesEditorMap, ARRAYNUMBER(GEOAttributesEditorMap))
80 FXIMPLEMENT(GNEInspectorFrame::TemplateEditor, MFXGroupBoxModule, TemplateEditorMap, ARRAYNUMBER(TemplateEditorMap))
81 FXIMPLEMENT(GNEInspectorFrame::AdditionalDialog, MFXGroupBoxModule, AdditionalDialogMap, ARRAYNUMBER(AdditionalDialogMap))
82 
83 
84 // ===========================================================================
85 // method definitions
86 // ===========================================================================
87 
88 // ---------------------------------------------------------------------------
89 // GNEInspectorFrame::NeteditAttributesEditor - methods
90 // ---------------------------------------------------------------------------
91 
93  MFXGroupBoxModule(inspectorFrameParent, TL("Netedit attributes")),
94  myInspectorFrameParent(inspectorFrameParent) {
95  // Create mark as front element button
96  myMarkFrontElementButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Mark as front element"), "", "", GUIIconSubSys::getIcon(GUIIcon::FRONTELEMENT),
98  // Create elements for parent additional
99  myLabelParentAdditional = new FXLabel(getCollapsableFrame(), "Parent", nullptr, GUIDesignLabelThick(JUSTIFY_NORMAL));
100  myTextFieldParentAdditional = new FXTextField(getCollapsableFrame(), GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
101  mySetNewParentButton = new MFXCheckableButton(false, getCollapsableFrame(),
102  inspectorFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
103  "Set new parent", nullptr, this, MID_GNE_SET_ATTRIBUTE, GUIDesignMFXCheckableButton);
104  // Create elements for close shape
105  myHorizontalFrameCloseShape = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
106  myLabelCloseShape = new FXLabel(myHorizontalFrameCloseShape, "Close shape", nullptr, GUIDesignLabelThickedFixed(100));
107  myCheckBoxCloseShape = new FXCheckButton(myHorizontalFrameCloseShape, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
108  // Create help button
109  myHelpButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Help"), "", "", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
110 }
111 
112 
114 
115 
116 void
118  // get ACs
119  const auto& ACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
120  // continue if there is edited ACs
121  if (ACs.size() > 0) {
122  // enable all editable elements
123  myTextFieldParentAdditional->enable();
124  myCheckBoxCloseShape->enable();
125  // obtain tag property (only for improve code legibility)
126  const auto& tagValue = ACs.front()->getTagProperty();
127  // check if item can be mark as front element
128  if (ACs.size() == 1) {
129  // show NeteditAttributesEditor
130  show();
131  // show button
132  myMarkFrontElementButton->show();
133  // enable or disable
134  if (myInspectorFrameParent->getViewNet()->getFrontAttributeCarrier() == ACs.front()) {
135  myMarkFrontElementButton->disable();
136  } else {
137  myMarkFrontElementButton->enable();
138  }
139  }
140  // check if item can block their shape
141  if (tagValue.canCloseShape()) {
142  // show NeteditAttributesEditor
143  show();
144  // Iterate over AC to obtain values
145  bool value = true;
146  for (const auto& inspectedAC : ACs) {
147  value &= GNEAttributeCarrier::parse<bool>(inspectedAC->getAttribute(GNE_ATTR_CLOSE_SHAPE));
148  }
149  // show close shape frame
150  myHorizontalFrameCloseShape->show();
151  // show help button
152  myHelpButton->show();
153  // set check box value and update label
154  if (value) {
155  myCheckBoxCloseShape->setCheck(true);
156  myCheckBoxCloseShape->setText("true");
157  } else {
158  myCheckBoxCloseShape->setCheck(false);
159  myCheckBoxCloseShape->setText("false");
160  }
161  }
162  // Check if item has another item as parent and can be reparent
163  if (tagValue.isChild() && tagValue.canBeReparent()) {
164  // show NeteditAttributesEditor
165  show();
166  // obtain additional Parent
167  std::set<std::string> parents;
168  for (const auto& inspectedAC : ACs) {
169  parents.insert(inspectedAC->getAttribute(GNE_ATTR_PARENT));
170  }
171  // show parent additional elements
172  myLabelParentAdditional->show();
173  myTextFieldParentAdditional->show();
174  mySetNewParentButton->show();
175  // reset new parent button
176  mySetNewParentButton->setChecked(false);
177  mySetNewParentButton->setText(TL("Set new parent"));
178  // set parent tag icon
179  const auto& parentTagProperty = GNEAttributeCarrier::getTagProperty(ACs.front()->getTagProperty().getParentTags().front());
180  mySetNewParentButton->setIcon(GUIIconSubSys::getIcon(parentTagProperty.getGUIIcon()));
181  // show help button
182  myHelpButton->show();
183  // set Label and TextField with the Tag and ID of parent
184  myLabelParentAdditional->setText((parentTagProperty.getTagStr() + " parent").c_str());
185  myTextFieldParentAdditional->setText(toString(parents).c_str());
186  }
187  // disable all editable elements if we're in demand mode and inspected AC isn't a demand element
188  if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), ACs.front()) == false) {
189  myTextFieldParentAdditional->disable();
190  myCheckBoxCloseShape->disable();
191  }
192  }
193 }
194 
195 
196 void
198  // hide all elements of GroupBox
199  myLabelParentAdditional->hide();
200  myTextFieldParentAdditional->hide();
201  mySetNewParentButton->hide();
202  myHorizontalFrameCloseShape->hide();
203  myMarkFrontElementButton->hide();
204  myHelpButton->hide();
205  // hide groupbox
206  hide();
207 }
208 
209 
210 void
212  // get inspected Attribute carriers
213  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
214  if (ACs.size() > 0) {
215  // enable or disable mark front element button
216  if (myInspectorFrameParent->getViewNet()->getFrontAttributeCarrier() == ACs.front()) {
217  myMarkFrontElementButton->disable();
218  } else {
219  myMarkFrontElementButton->enable();
220  }
221  // refresh close shape
222  if (myHorizontalFrameCloseShape->shown()) {
223  // Iterate over AC to obtain values
224  bool value = true;
225  for (const auto& i : ACs) {
226  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
227  }
228  // set check box value and update label
229  if (value) {
230  myCheckBoxCloseShape->setCheck(true);
231  myCheckBoxCloseShape->setText("true");
232  } else {
233  myCheckBoxCloseShape->setCheck(false);
234  myCheckBoxCloseShape->setText("false");
235  }
236  }
237  // Check if item has another item as parent (Currently only for single Additionals)
238  if (myTextFieldParentAdditional->shown() && ((myTextFieldParentAdditional->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
239  // set Label and TextField with the Tag and ID of parent
240  myLabelParentAdditional->setText((toString(ACs.front()->getTagProperty().getParentTags().front()) + " parent").c_str());
241  myTextFieldParentAdditional->setText(ACs.front()->getAttribute(GNE_ATTR_PARENT).c_str());
242  }
243  }
244 }
245 
246 
247 bool
249  if (!shown()) {
250  return false;
251  } else {
252  return (mySetNewParentButton->shown() && mySetNewParentButton->amChecked());
253  }
254 }
255 
256 
257 void
259  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
260  // check number of inspected ACs
261  if ((ACs.size() > 0) && clickedAC) {
262  // check parent tags
263  for (const auto& parentTag : ACs.front()->getTagProperty().getParentTags()) {
264  if (parentTag == clickedAC->getTagProperty().getTag()) {
265  // check if we're changing multiple attributes
266  if (ACs.size() > 1) {
267  myInspectorFrameParent->myViewNet->getUndoList()->begin(ACs.front(), "Change multiple attributes");
268  }
269  // replace the parent of all inspected elements
270  for (const auto& AC : ACs) {
271  AC->setAttribute(GNE_ATTR_PARENT, clickedAC->getID(), myInspectorFrameParent->myViewNet->getUndoList());
272  }
273  // finish change multiple attributes
274  if (ACs.size() > 1) {
275  myInspectorFrameParent->myViewNet->getUndoList()->end();
276  }
277  // stop select parent
278  stopSelectParent();
279  // refresh netedit attributes editor
280  refreshNeteditAttributesEditor(true);
281  }
282  }
283  }
284 }
285 
286 
287 void
289  if (mySetNewParentButton->amChecked()) {
290  onCmdSetNeteditAttribute(mySetNewParentButton, 0, nullptr);
291  }
292 }
293 
294 
295 long
297  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
298  // make sure that ACs has elements
299  if (ACs.size() > 0) {
300  // check if we're changing multiple attributes
301  if (ACs.size() > 1) {
302  myInspectorFrameParent->myViewNet->getUndoList()->begin(ACs.front(), "Change multiple attributes");
303  }
304  if (obj == mySetNewParentButton) {
305  if (mySetNewParentButton->amChecked()) {
306  mySetNewParentButton->setText(TL("Set new parent"));
307  mySetNewParentButton->setChecked(false);
308  } else {
309  mySetNewParentButton->setText(("Click over " + toString(ACs.front()->getTagProperty().getParentTags().front())).c_str());
310  mySetNewParentButton->setChecked(true);
311  }
312  } else if (obj == myCheckBoxCloseShape) {
313  // set new values in all inspected Attribute Carriers
314  for (const auto& AC : ACs) {
315  if (myCheckBoxCloseShape->getCheck() == 1) {
316  AC->setAttribute(GNE_ATTR_CLOSE_SHAPE, "true", myInspectorFrameParent->myViewNet->getUndoList());
317  myCheckBoxCloseShape->setText("true");
318  } else {
319  AC->setAttribute(GNE_ATTR_CLOSE_SHAPE, "false", myInspectorFrameParent->myViewNet->getUndoList());
320  myCheckBoxCloseShape->setText("false");
321  }
322  }
323  } else if (obj == myTextFieldParentAdditional) {
324  if (ACs.front()->isValid(GNE_ATTR_PARENT, myTextFieldParentAdditional->getText().text())) {
325  // replace the parent of all inspected elements
326  for (const auto& AC : ACs) {
327  AC->setAttribute(GNE_ATTR_PARENT, myTextFieldParentAdditional->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
328  }
329  myTextFieldParentAdditional->setTextColor(FXRGB(0, 0, 0));
330  myTextFieldParentAdditional->killFocus();
331  } else {
332  myTextFieldParentAdditional->setTextColor(FXRGB(255, 0, 0));
333  }
334  }
335  // finish change multiple attributes
336  if (ACs.size() > 1) {
337  myInspectorFrameParent->myViewNet->getUndoList()->end();
338  }
339  // force refresh values of AttributesEditor and GEOAttributesEditor
340  myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
341  myInspectorFrameParent->myGEOAttributesEditor->refreshGEOAttributesEditor(true);
342  }
343  return 1;
344 }
345 
346 
347 long
349  // check number of elements
350  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
351  // mark AC as front element
352  myInspectorFrameParent->getViewNet()->setFrontAttributeCarrier(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front());
353  // disable button
354  myMarkFrontElementButton->disable();
355  }
356  return 1;
357 }
358 
359 
360 long
362  // Create dialog box
363  FXDialogBox* additionalNeteditAttributesHelpDialog = new FXDialogBox(getCollapsableFrame(), "Netedit Attributes Help", GUIDesignDialogBox);
364  additionalNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::MODEADDITIONAL));
365  // set help text
366  std::ostringstream help;
367  help
368  << TL("- Mark as front element: Mark element as front element (Will be drawn over all other elements)\n")
369  << TL("- Block movement: disable movement in move mode\n")
370  << TL("- Block shape: Disable moving of shape's vertices and edges. Entire shape can be moved'.\n")
371  << TL("- Close shape: Add or remove the last vertex with the same position of first edge'.");
372  // Create label with the help text
373  new FXLabel(additionalNeteditAttributesHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
374  // Create horizontal separator
375  new FXHorizontalSeparator(additionalNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
376  // Create frame for OK Button
377  FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(additionalNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
378  // Create Button Close (And two more horizontal frames to center it)
379  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
380  GUIDesigns::buildFXButton(myHorizontalFrameOKButton, TL("OK"), "", TL("close"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), additionalNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
381  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
382  // Write Warning in console if we're in testing mode
383  WRITE_DEBUG("Opening NeteditAttributesEditor help dialog");
384  // create Dialog
385  additionalNeteditAttributesHelpDialog->create();
386  // show in the given position
387  additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
388  // refresh APP
389  getApp()->refresh();
390  // open as modal dialog (will block all windows until stop() or stopModal() is called)
391  getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
392  // Write Warning in console if we're in testing mode
393  WRITE_DEBUG("Closing NeteditAttributesEditor help dialog");
394  return 1;
395 }
396 
397 // ---------------------------------------------------------------------------
398 // GNEInspectorFrame::GEOAttributesEditor - methods
399 // ---------------------------------------------------------------------------
400 
402  MFXGroupBoxModule(inspectorFrameParent, TL("GEO Attributes")),
403  myInspectorFrameParent(inspectorFrameParent) {
404 
405  // Create Frame for GEOAttribute
407  myGEOAttributeLabel = new FXLabel(myGEOAttributeFrame, "Undefined GEO Attribute", nullptr, GUIDesignLabelThickedFixed(100));
409 
410  // Create Frame for use GEO
412  myUseGEOLabel = new FXLabel(myUseGEOFrame, toString(SUMO_ATTR_GEO).c_str(), nullptr, GUIDesignLabelThickedFixed(100));
413  myUseGEOCheckButton = new FXCheckButton(myUseGEOFrame, "false", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
414 
415  // Create help button
417 }
418 
419 
421 
422 
423 void
425  // make sure that ACs has elements
426  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
427  // enable all editable elements
428  myGEOAttributeTextField->enable();
429  myUseGEOCheckButton->enable();
430  // obtain tag property (only for improve code legibility)
431  const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
432  // check if item can use a geo position
433  if (tagProperty.hasGEOShape()) {
434  // show GEOAttributesEditor
435  show();
436  // Iterate over AC to obtain values
437  bool value = true;
438  for (const auto& i : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
439  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(SUMO_ATTR_GEO));
440  }
441  // show use geo frame
442  myUseGEOFrame->show();
443  // set UseGEOCheckButton value of and update label (only if geo conversion is defined)
444  if (GeoConvHelper::getFinal().getProjString() != "!") {
445  myUseGEOCheckButton->enable();
446  if (value) {
447  myUseGEOCheckButton->setCheck(true);
448  myUseGEOCheckButton->setText("true");
449  } else {
450  myUseGEOCheckButton->setCheck(false);
451  myUseGEOCheckButton->setText("false");
452  }
453  } else {
454  myUseGEOCheckButton->disable();
455  }
456  if (tagProperty.hasGEOShape() && myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
457  myGEOAttributeFrame->show();
458  myGEOAttributeLabel->setText(toString(SUMO_ATTR_GEOSHAPE).c_str());
459  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
460  // only allow edit if geo conversion is defined
461  if (GeoConvHelper::getFinal().getProjString() != "!") {
462  myGEOAttributeTextField->enable();
463  myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
464  } else {
465  myGEOAttributeTextField->disable();
466  myGEOAttributeTextField->setText(TL("No geo-conversion defined"));
467  }
468  }
469  }
470  // disable all editable elements if we're in demand mode and inspected AC isn't a demand element
471  if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()) == false) {
472  myGEOAttributeTextField->disable();
473  myUseGEOCheckButton->disable();
474  }
475  }
476 }
477 
478 
479 void
481  // hide all elements of GroupBox
482  myGEOAttributeFrame->hide();
483  myUseGEOFrame->hide();
484  // hide groupbox
485  hide();
486 }
487 
488 
489 void
491  // obtain tag property (only for improve code legibility)
492  const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
493  // Check that myGEOAttributeFrame is shown
494  if ((GeoConvHelper::getFinal().getProjString() != "!") && myGEOAttributeFrame->shown() && ((myGEOAttributeTextField->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
495  if (tagProperty.hasGEOShape()) {
496  myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
497  }
498  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
499  }
500 }
501 
502 
503 long
505  // make sure that ACs has elements
506  if ((GeoConvHelper::getFinal().getProjString() != "!") && (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0)) {
507  if (obj == myGEOAttributeTextField) {
508  // obtain tag property (only for improve code legibility)
509  const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
510  // Change GEO Attribute depending of type (Position or shape)
511  if (tagProperty.hasGEOShape()) {
512  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->isValid(SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text())) {
513  myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->setAttribute(SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
514  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
515  myGEOAttributeTextField->killFocus();
516  } else {
517  myGEOAttributeTextField->setTextColor(FXRGB(255, 0, 0));
518  }
519  } else {
520  throw ProcessError("myGEOAttributeTextField must be hidden because there isn't GEO Attribute to edit");
521  }
522  } else if (obj == myUseGEOCheckButton) {
523  // update GEO Attribute of entire selection
524  for (const auto& i : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
525  if (myUseGEOCheckButton->getCheck() == 1) {
526  i->setAttribute(SUMO_ATTR_GEO, "true", myInspectorFrameParent->myViewNet->getUndoList());
527  myUseGEOCheckButton->setText("true");
528  } else {
529  i->setAttribute(SUMO_ATTR_GEO, "false", myInspectorFrameParent->myViewNet->getUndoList());
530  myUseGEOCheckButton->setText("false");
531  }
532  }
533  }
534  // force refresh values of Attributes editor and NeteditAttributesEditor
535  myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
536  myInspectorFrameParent->myNeteditAttributesEditor->refreshNeteditAttributesEditor(true);
537  }
538  return 1;
539 }
540 
541 
542 long
544  FXDialogBox* helpDialog = new FXDialogBox(getCollapsableFrame(), "GEO attributes Help", GUIDesignDialogBox);
545  std::ostringstream help;
546  help
547  << TL(" SUMO uses the World Geodetic System 84 (WGS84/UTM).\n")
548  << TL(" For a GEO-referenced network, geo coordinates are represented as pairs of Longitude and Latitude\n")
549  << TL(" in decimal degrees without extra symbols. (N,W..)\n")
550  << TL(" - Longitude: East-west position of a point on the Earth's surface.\n")
551  << TL(" - Latitude: North-south position of a point on the Earth's surface.\n")
552  << TL(" - CheckBox 'geo' enables or disables saving position in GEO coordinates\n");
553  new FXLabel(helpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
554  // "OK"
555  GUIDesigns::buildFXButton(helpDialog, TL("OK"), "", TL("close"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
556  helpDialog->create();
557  helpDialog->show();
558  return 1;
559 }
560 
561 // ---------------------------------------------------------------------------
562 // GNEInspectorFrame::TemplateEditor - methods
563 // ---------------------------------------------------------------------------
564 
566  MFXGroupBoxModule(inspectorFrameParent, TL("Templates")),
567  myInspectorFrameParent(inspectorFrameParent),
568  myEdgeTemplate(nullptr) {
569  // Create set template button
571  // Create copy template button
573  // Create copy template button
575 }
576 
577 
579 }
580 
581 
582 bool
584  // show template editor only if we're editing an edge in Network mode AND we have at least one inspected edge
585  if (myInspectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
586  for (const auto& AC : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
587  if (AC->getTagProperty().getTag() == SUMO_TAG_EDGE) {
588  // update buttons and show module
589  updateButtons();
590  show();
591  return true;
592  }
593  }
594  }
595  return false;
596 }
597 
598 
599 void
601  // hide template editor
602  hide();
603 }
604 
605 
608  return myEdgeTemplate;
609 }
610 
611 
612 void
614  // delete previous template edge
615  if (myEdgeTemplate) {
616  delete myEdgeTemplate;
617  myEdgeTemplate = nullptr;
618  }
619  // update edge template
620  if (edge) {
621  myEdgeTemplate = new GNEEdgeTemplate(edge);
622  // use template by default
623  myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getCreateEdgeFrame()->setUseEdgeTemplate();
624  }
625 }
626 
627 
628 void
630  if (myEdgeTemplate) {
631  myEdgeTemplate->updateLaneTemplates();
632  // use template by default
633  myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getCreateEdgeFrame()->setUseEdgeTemplate();
634  }
635 }
636 
637 void
639  // check if template editor AND mySetTemplateButton is enabled
640  if (shown() && mySetTemplateButton->isEnabled()) {
641  onCmdSetTemplate(nullptr, 0, nullptr);
642  }
643 }
644 
645 
646 void
648  // check if template editor AND myCopyTemplateButton is enabled
649  if (shown() && myCopyTemplateButton->isEnabled()) {
650  onCmdCopyTemplate(nullptr, 0, nullptr);
651  }
652 }
653 
654 
655 void
657  // check if template editor AND myClearTemplateButton is enabled
658  if (shown() && myClearTemplateButton->isEnabled()) {
659  onCmdClearTemplate(nullptr, 0, nullptr);
660  }
661 }
662 
663 
664 long
666  // apply to all selected edges
667  for (const auto& AC : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
668  if (AC->getTagProperty().getTag() == SUMO_TAG_EDGE) {
669  // set template
670  setEdgeTemplate(myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(AC->getID()));
671  // update buttons
672  updateButtons();
673  }
674  }
675  return 1;
676 }
677 
678 
679 long
681  // first check
682  if (myEdgeTemplate) {
683  // begin copy template
684  myInspectorFrameParent->myViewNet->getUndoList()->begin(myEdgeTemplate, "copy edge template");
685  // iterate over inspected ACs
686  for (const auto& inspectedAC : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
687  // avoid copy template in the same edge
688  if (inspectedAC->getID() != myEdgeTemplate->getID()) {
689  // retrieve edge ID (and throw exception if edge doesn't exist)
690  myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(inspectedAC->getID())->copyTemplate(myEdgeTemplate, myInspectorFrameParent->myViewNet->getUndoList());
691  }
692  }
693  // end copy template
694  myInspectorFrameParent->myViewNet->getUndoList()->end();
695  // refresh inspector parent
696  myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
697  // update view (to see visual changes)
698  myInspectorFrameParent->myViewNet->updateViewNet();
699  }
700  return 1;
701 }
702 
703 
704 long
706  // set null edge
707  setEdgeTemplate(nullptr);
708  // update buttons
709  updateButtons();
710  return 1;
711 }
712 
713 
714 void
716  const auto& inspectedACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
717  // only show set template button if we have exactly one inspected edge
718  if (inspectedACs.size() == 1) {
719  mySetTemplateButton->setText((TLF("Set edge '%' as Template", inspectedACs.front()->getID())).c_str());
720  mySetTemplateButton->show();
721  } else {
722  mySetTemplateButton->hide();
723  }
724  // enable or disable clear buttons depending of myEdgeTemplate
725  if (myEdgeTemplate) {
726  // update caption of copy button
727  if (inspectedACs.size() == 1) {
728  myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into edge '" + inspectedACs.front()->getID() + "'").c_str());
729  } else {
730  myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into " + toString(inspectedACs.size()) + " selected edges").c_str());
731  }
732  // enable set and clear buttons
733  myCopyTemplateButton->enable();
734  myClearTemplateButton->enable();
735  } else {
736  // update caption of copy button
737  myCopyTemplateButton->setText(TL("No edge Template Set"));
738  // disable set and clear buttons
739  myCopyTemplateButton->disable();
740  myClearTemplateButton->disable();
741  }
742 }
743 
744 // ---------------------------------------------------------------------------
745 // GNEInspectorFrame::AdditionalDialog - methods
746 // ---------------------------------------------------------------------------
747 
749  MFXGroupBoxModule(inspectorFrameParent, TL("Additional dialog")),
750  myInspectorFrameParent(inspectorFrameParent) {
751  // Create mark as front element button
753 }
754 
755 
757 
758 
759 void
761  // check number of inspected elements
762  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
763  // get AC
764  const GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
765  // check AC
766  if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
767  // update button
768  myOpenAdditionalDialog->setText(TL("Open rerouter dialog"));
769  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::REROUTER));
770  // show module
771  show();
772  } else if (AC->getTagProperty().getTag() == SUMO_TAG_CALIBRATOR) {
773  // update button
774  myOpenAdditionalDialog->setText(TL("Open calibrator dialog"));
775  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
776  // show module
777  show();
778  } else if (AC->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_LANE) {
779  // update button
780  myOpenAdditionalDialog->setText(TL("Open calibrator lane dialog"));
781  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
782  // show module
783  show();
784  } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
785  // update button
786  myOpenAdditionalDialog->setText(TL("Open VSS dialog"));
787  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::VARIABLESPEEDSIGN));
788  // show module
789  show();
790  }
791  } else {
792  // hide module
793  hide();
794  }
795 }
796 
797 
798 void
800  // hide groupbox
801  hide();
802 }
803 
804 
805 long
807  // check number of inspected elements
808  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
809  // get AC
810  GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
811  // check AC
812  if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
813  // Open rerouter dialog
814  GNERerouterDialog(dynamic_cast<GNERerouter*>(AC));
815  } else if ((AC->getTagProperty().getTag() == SUMO_TAG_CALIBRATOR) || (AC->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_LANE)) {
816  // Open calibrator dialog
817  GNECalibratorDialog(dynamic_cast<GNECalibrator*>(AC));
818  } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
819  // Open VSS dialog
821  }
822  }
823  return 1;
824 }
825 
826 // ---------------------------------------------------------------------------
827 // GNEInspectorFrame - methods
828 // ---------------------------------------------------------------------------
829 
831  GNEFrame(viewParent, viewNet, "Inspector"),
832  myPreviousElementInspect(nullptr),
833  myPreviousElementDelete(nullptr),
835 
836  // Create back button
838  myHeaderLeftFrame->hide();
839  myBackButton->hide();
840 
841  // Create Overlapped Inspection module
843 
844  // Create Attributes Editor module
846 
847  // Create GEO Parameters Editor module
849 
850  // create parameters Editor module
852 
853  // create additional dialog
855 
856  // Create Netedit Attributes Editor module
858 
859  // Create Template editor module
860  myTemplateEditor = new TemplateEditor(this);
861 
862  // Create GNEElementTree module
864 }
865 
866 
868 
869 
870 void
872  // inspect a null element to reset inspector frame
873  inspectSingleElement(nullptr);
874  // stop select new element
876  // show
877  GNEFrame::show();
878 }
879 
880 
881 void
884  GNEFrame::hide();
885 }
886 
887 
888 bool
890  // get unlocked attribute carrier front
891  auto AC = viewObjects.getAttributeCarrierFront();
892  // first check if we have clicked over an Attribute Carrier
893  if (AC) {
894  // if Control key is Pressed, select instead inspect element
896  // toggle networkElement selection
897  if (AC->isAttributeCarrierSelected()) {
899  } else {
900  AC->selectAttributeCarrier();
901  }
902  } else {
903  // first check if we clicked over a GNEOverlappedInspection point
905  if (!myOverlappedInspection->previousElement(clickedPosition)) {
906  // inspect attribute carrier, (or multiselection if AC is selected)
907  inspectClickedElement(viewObjects, clickedPosition);
908  }
909  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
910  // inspect attribute carrier, (or multiselection if AC is selected)
911  inspectClickedElement(viewObjects, clickedPosition);
912  }
913  // focus upper element of inspector frame
915  }
916  return true;
917  } else {
918  return false;
919  }
920 }
921 
922 
923 bool
925  // get unlocked attribute carrier front
926  auto AC = viewObjects.getAttributeCarrierFront();
927  // first check if we have clicked over a demand element
928  if (AC) {
929  // if Control key is Pressed, select instead inspect element
931  // toggle networkElement selection
932  if (AC->isAttributeCarrierSelected()) {
934  } else {
935  AC->selectAttributeCarrier();
936  }
937  } else {
938  // first check if we clicked over a GNEOverlappedInspection point
940  if (!myOverlappedInspection->previousElement(clickedPosition)) {
941  // inspect attribute carrier, (or multiselection if AC is selected)
942  inspectClickedElement(viewObjects, clickedPosition);
943  }
944  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
945  // inspect attribute carrier, (or multiselection if AC is selected)
946  inspectClickedElement(viewObjects, clickedPosition);
947  }
948  // focus upper element of inspector frame
950  }
951  return true;
952  } else {
953  return false;
954  }
955 }
956 
957 
958 bool
960  // get unlocked attribute carrier front
961  auto AC = viewObjects.getAttributeCarrierFront();
962  // first check if we have clicked over a data element
963  if (AC) {
964  // if Control key is Pressed, select instead inspect element
966  // toggle networkElement selection
967  if (AC->isAttributeCarrierSelected()) {
969  } else {
970  AC->selectAttributeCarrier();
971  }
972  } else {
973  // first check if we clicked over a GNEOverlappedInspection point
975  if (!myOverlappedInspection->previousElement(clickedPosition)) {
976  // inspect attribute carrier, (or multiselection if AC is selected)
977  inspectClickedElement(viewObjects, clickedPosition);
978  }
979  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
980  // inspect attribute carrier, (or multiselection if AC is selected)
981  inspectClickedElement(viewObjects, clickedPosition);
982  }
983  // focus upper element of inspector frame
985  }
986  return true;
987  } else {
988  return false;
989  }
990 }
991 
992 
993 void
995  // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
996  std::vector<GNEAttributeCarrier*> itemsToInspect;
997  if (AC != nullptr) {
1000  // obtain selected ACs depending of current supermode
1001  const auto selectedACs = myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(false);
1002  // iterate over selected ACs
1003  for (const auto& selectedAC : selectedACs) {
1004  // filter ACs to inspect using Tag as criterion
1005  if (selectedAC->getTagProperty().getTag() == AC->getTagProperty().getTag()) {
1006  itemsToInspect.push_back(selectedAC);
1007  }
1008  }
1009  } else {
1010  itemsToInspect.push_back(AC);
1011  }
1012  }
1013  inspectMultisection(itemsToInspect);
1014 }
1015 
1016 
1017 void
1018 GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
1019  // update inspected ACs in viewNet
1021  // hide back button
1022  myHeaderLeftFrame->hide();
1023  myBackButton->hide();
1024  // Hide all elements
1033  // If vector of attribute Carriers contain data
1034  if (ACs.size() > 0) {
1035  // Set header
1036  std::string headerString;
1037  if (ACs.front()->getTagProperty().isNetworkElement()) {
1038  headerString = "Net: ";
1039  } else if (ACs.front()->getTagProperty().isAdditionalElement()) {
1040  headerString = "Additional: ";
1041  } else if (ACs.front()->getTagProperty().isShapeElement()) {
1042  headerString = "Shape: ";
1043  } else if (ACs.front()->getTagProperty().isTAZElement()) {
1044  headerString = "TAZ: ";
1045  } else if (ACs.front()->getTagProperty().isWireElement()) {
1046  headerString = "WIRE: ";
1047  } else if (ACs.front()->getTagProperty().isVehicle()) {
1048  headerString = "Vehicle: ";
1049  } else if (ACs.front()->getTagProperty().isRoute()) {
1050  headerString = "Route: ";
1051  } else if (ACs.front()->getTagProperty().isPerson()) {
1052  headerString = "Person: ";
1053  } else if (ACs.front()->getTagProperty().isPlanPerson()) {
1054  headerString = "PersonPlan: ";
1055  } else if (ACs.front()->getTagProperty().isContainer()) {
1056  headerString = "Container: ";
1057  } else if (ACs.front()->getTagProperty().isPlanContainer()) {
1058  headerString = "ContainerPlan: ";
1059  } else if (ACs.front()->getTagProperty().isVehicleStop()) {
1060  headerString = "Stop: ";
1061  } else if (ACs.front()->getTagProperty().isDataElement()) {
1062  headerString = "Data: ";
1063  }
1064  if (ACs.size() > 1) {
1065  headerString += toString(ACs.size()) + " ";
1066  }
1067  headerString += ACs.front()->getTagStr();
1068  if (ACs.size() > 1) {
1069  headerString += "s";
1070  }
1071  // Set headerString into header label
1072  getFrameHeaderLabel()->setText(headerString.c_str());
1073 
1074  // Show attributes editor
1076 
1077  // show netedit attributes editor if we're inspecting elements with Netedit Attributes
1079 
1080  // Show GEO Attributes Editor if we're inspecting elements with GEO Attributes
1082 
1083  // show parameters editor
1085 
1086  // show additional dialog
1088 
1089  // If attributes correspond to an Edge and we aren't in demand mode, show template editor
1091 
1092  // if we inspect a single Attribute carrier vector, show their children
1093  if (ACs.size() == 1) {
1095  }
1096  } else {
1097  getFrameHeaderLabel()->setText(TL("Inspect"));
1098  }
1099  // update frame width
1101  // update viewNet
1102  myViewNet->update();
1103 }
1104 
1105 
1106 void
1108  // Show back button if myPreviousElementInspect was defined
1109  myPreviousElementInspect = previousElement;
1110  if (myPreviousElementInspect != nullptr) {
1111  // disable myPreviousElementDelete to avoid inconsistences
1112  myPreviousElementDelete = nullptr;
1114  myHeaderLeftFrame->show();
1115  myBackButton->show();
1116  }
1117 }
1118 
1119 
1120 void
1121 GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
1122  myPreviousElementDelete = previousElement;
1123  myPreviousElementDeleteWasMarked = previousElementWasMarked;
1124  // Show back button if myPreviousElementDelete is valid
1125  if (myPreviousElementDelete != nullptr) {
1126  // disable myPreviousElementInspect to avoid inconsistences
1127  myPreviousElementInspect = nullptr;
1129  myHeaderLeftFrame->show();
1130  myBackButton->show();
1131  }
1132 }
1133 
1134 
1135 void
1137  // Only remove if there is inspected ACs
1140  // Inspect empty selection (to hide all Editors)
1141  inspectMultisection({});
1142  }
1143 }
1144 
1145 
1148  return myAttributesEditor;
1149 }
1150 
1151 
1155 }
1156 
1157 
1160  return myTemplateEditor;
1161 }
1162 
1163 
1166  return myOverlappedInspection;
1167 }
1168 
1169 
1173 }
1174 
1175 
1176 long
1177 GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
1178  // Inspect previous element or go back to Delete Frame
1181  myPreviousElementInspect = nullptr;
1182  } else if (myPreviousElementDelete != nullptr) {
1183  myPreviousElementDelete = nullptr;
1184  // Hide inspect frame and show delete frame
1185  hide();
1187  }
1188  return 1;
1189 }
1190 
1191 
1192 void
1194  // refresh Attribute Editor
1196  // refresh parametersEditor
1198  // refresh AC Hierarchy
1200 }
1201 
1202 
1203 void
1206  // update view (due dotted contour)
1208 }
1209 
1210 
1211 void
1213  // get front unlocked AC
1214  const auto AC = viewObjects.getAttributeCarrierFront();
1215  // check if selection is blocked
1216  if (AC) {
1217  // inspect front element
1219  // show Overlapped Inspection module
1220  myOverlappedInspection->showOverlappedInspection(viewObjects, clickedPosition);
1221  }
1222 }
1223 
1224 
1225 void
1230 }
1231 
1232 
1233 
1234 /****************************************************************************/
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:935
@ MID_HELP
help button
Definition: GUIAppEnum.h:653
@ MID_GNE_INSPECTORFRAME_GOBACK
go back to the previous element
Definition: GUIAppEnum.h:1087
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:469
@ MID_HOTKEY_SHIFT_F2_TEMPLATE_COPY
copy template
Definition: GUIAppEnum.h:264
@ MID_GNE_MARKFRONTELEMENT
mark item as front element
Definition: GUIAppEnum.h:1021
@ MID_HOTKEY_SHIFT_F1_TEMPLATE_SET
set template
Definition: GUIAppEnum.h:262
@ MID_HOTKEY_SHIFT_F3_TEMPLATE_CLEAR
clear template
Definition: GUIAppEnum.h:266
#define GUIDesignMFXCheckableButton
checkable button extended over frame
Definition: GUIDesigns.h:149
#define GUIDesignButton
Definition: GUIDesigns.h:88
#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 GUIDesignDialogBox
Definition: GUIDesigns.h:602
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:100
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:80
#define GUIDesignButtonOK
Definition: GUIDesigns.h:159
#define GUIDesignLabelThick(justify)
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:255
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:198
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:466
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition: GUIDesigns.h:258
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:285
@ MODEADDITIONAL
@ BIGARROWLEFT
@ FRONTELEMENT
@ VARIABLESPEEDSIGN
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:306
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
@ SUMO_TAG_REROUTER
A rerouter.
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_GEO
@ SUMO_ATTR_GEOSHAPE
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Dialog for edit calibrators.
void show()
show delete frame
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
void hideHierarchicalElementTree()
hide GNEElementTree
void refreshHierarchicalElementTree()
refresh GNEElementTree
void showHierarchicalElementTree(GNEAttributeCarrier *AC)
show GNEElementTree
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
void showAttributeEditorModule(bool includeExtended)
show attributes of multiple ACs
void refreshParametersEditor()
refresh netedit attributes
void hideParametersEditor()
hide netedit attributes EditorInspector
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
void setFrameWidth(const int newWidth)
set width of GNEFrame
Definition: GNEFrame.cpp:133
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:109
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:150
FXLabel * getFrameHeaderLabel() const
get the label for the frame's header
Definition: GNEFrame.cpp:162
GNEViewNet * myViewNet
FOX need this.
Definition: GNEFrame.h:117
virtual void show()
show Frame
Definition: GNEFrame.cpp:115
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:124
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
Definition: GNEFrame.h:126
FXButton * myOpenAdditionalDialog
button for open additional dialog
long onCmdOpenAdditionalDialog(FXObject *, FXSelector, void *)
void hideAdditionalDialog()
hide netedit attributes editor
AdditionalDialog(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
void showAdditionalDialog()
show netedit attributes editor
FXCheckButton * myUseGEOCheckButton
checkBox for use GEO
long onCmdGEOAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
FXButton * myHelpButton
button for help
void showGEOAttributesEditor()
show GEO attributes editor
FXTextField * myGEOAttributeTextField
textField for GEOAttribute
FXLabel * myUseGEOLabel
Label for use GEO.
FXHorizontalFrame * myUseGEOFrame
horizontal frame for use GEO
GEOAttributesEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
long onCmdSetGEOAttribute(FXObject *, FXSelector, void *)
Called when user change the current GEO Attribute.
FXLabel * myGEOAttributeLabel
Label for GEOAttribute.
void refreshGEOAttributesEditor(bool forceRefresh)
refresh GEO attributes editor
void hideGEOAttributesEditor()
hide GEO attributes editor
FXHorizontalFrame * myGEOAttributeFrame
horizontal frame for GEOAttribute
bool isSelectingParent() const
check if we're selecting a new parent
long onCmdNeteditAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
long onCmdSetNeteditAttribute(FXObject *, FXSelector, void *)
long onCmdMarkFrontElement(FXObject *, FXSelector, void *)
Called when user press button "Mark front element".
void refreshNeteditAttributesEditor(bool forceRefresh)
refresh netedit attributes
void setNewParent(GNEAttributeCarrier *clickedAC)
set new parent
void hideNeteditAttributesEditor()
hide netedit attributes editor
void stopSelectParent()
stop select new parent
void showNeteditAttributesEditor()
show netedit attributes editor
void hideTemplateEditor()
hide template editor
void clearTemplate()
clear template (used by shortcut)
void setEdgeTemplate(const GNEEdge *edge)
set edge template
FXButton * myClearTemplateButton
clear template button
FXButton * mySetTemplateButton
set template button
long onCmdCopyTemplate(FXObject *, FXSelector, void *)
copy edge attributes from edge template
void setTemplate()
set template (used by shortcut)
TemplateEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
FXButton * myCopyTemplateButton
copy template button
long onCmdSetTemplate(FXObject *, FXSelector, void *)
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
void copyTemplate()
copy template (used by shortcut)
void updateEdgeTemplate()
update edge template
bool showTemplateEditor()
show template editor
long onCmdClearTemplate(FXObject *, FXSelector, void *)
clear current edge template
NeteditAttributesEditor * myNeteditAttributesEditor
Netedit Attributes editor.
GNEAttributeCarrier * myPreviousElementDelete
pointer to previous element called by Delete Frame
GNEFrameAttributeModules::AttributesEditor * getAttributesEditor() const
get AttributesEditor
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
void inspectSingleElement(GNEAttributeCarrier *AC)
Inspect a single element.
GNEFrameAttributeModules::AttributesEditor * myAttributesEditor
Attribute editor.
void selectedOverlappedElement(GNEAttributeCarrier *AC)
open GNEAttributesCreator extended dialog (can be reimplemented in frame children)
TemplateEditor * getTemplateEditor() const
get template editor
GNEInspectorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
bool processDemandSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ViewObjectsSelector &viewObjects)
process click over Viewnet in Supermode Demand
GNEElementTree * getHierarchicalElementTree() const
get GNEElementTree modul
void clearInspectedAC()
Clear all current inspected ACs.
long onCmdGoBack(FXObject *, FXSelector, void *)
called when user toggle the go back button
void attributeUpdated(SumoXMLAttr attribute)
function called after set a valid attribute in AttributeEditor
void show()
show inspector frame
GNEFrameAttributeModules::ParametersEditor * myParametersEditor
Parameters editor inspector.
GEOAttributesEditor * myGEOAttributesEditor
GEO Attributes editor.
GNEAttributeCarrier * myPreviousElementInspect
Pointer to previous element called by Inspector Frame.
bool myPreviousElementDeleteWasMarked
flag to ckec if myPreviousElementDelete was marked in Delete Frame
GNEOverlappedInspection * myOverlappedInspection
Overlapped Inspection.
GNEOverlappedInspection * getOverlappedInspection() const
get GNEOverlappedInspection modul
AdditionalDialog * myAdditionalDialog
Additional dialog.
void hide()
hide inspector frame
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
GNEInspectorFrame::NeteditAttributesEditor * getNeteditAttributesEditor() const
get Netedit Attributes editor
bool processNetworkSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ViewObjectsSelector &viewObjects)
process click over Viewnet in Supermode Network
FXButton * myBackButton
Back Button.
GNEElementTree * myHierarchicalElementTree
Attribute Carrier Hierarchy.
void inspectClickedElement(const GNEViewNetHelper::ViewObjectsSelector &viewObjects, const Position &clickedPosition)
FOX need this.
void inspectMultisection(const std::vector< GNEAttributeCarrier * > &ACs)
Inspect the given multi-selection.
~GNEInspectorFrame()
Destructor.
TemplateEditor * myTemplateEditor
Template editor.
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame (can be reimplemented in frame children)
bool processDataSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ViewObjectsSelector &viewObjects)
process click over Viewnet in Supermode Data
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(const bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:123
void hideOverlappedInspection()
hide template editor
void showOverlappedInspection(const GNEViewNetHelper::ViewObjectsSelector &viewObjects, const Position &clickedPosition)
show template editor
bool nextElement(const Position &clickedPosition)
try to go to next element if clicked position is near to saved position
bool previousElement(const Position &clickedPosition)
try to go to previous element if clicked position is near to saved position
Dialog for edit rerouters.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
class used to group all variables related with objects under cursor after a click over view
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier or a pointer to nullptr
GNENet * getNet() const
get the net object
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:753
GNEViewParent * getViewParent() const
get the net object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
Definition: GNEViewNet.cpp:419
void setInspectedAttributeCarriers(const std::vector< GNEAttributeCarrier * > ACs)
set inspected attributeCarrier
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:88
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
int getFrameAreaWidth() const
get frame area width
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
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool altKeyPressed() const
check if ALT is pressed during current event
bool controlKeyPressed() const
check if CONTROL is pressed during current event