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 void
584  // show template editor only if we're editing an edge in Network mode
585  if ((myInspectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) &&
586  (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().getTag() == SUMO_TAG_EDGE)) {
587  // show "Set As Template"
588  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
589  mySetTemplateButton->show();
590  mySetTemplateButton->setText((TLF("Set edge '%' as Template", myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getID())).c_str());
591  }
592  // update buttons
593  updateButtons();
594  // show module
595  show();
596  }
597 }
598 
599 
600 void
602  // hide template editor
603  hide();
604 }
605 
606 
609  return myEdgeTemplate;
610 }
611 
612 
613 void
615  // delete previous template edge
616  if (myEdgeTemplate) {
617  delete myEdgeTemplate;
618  myEdgeTemplate = nullptr;
619  }
620  // update edge template
621  if (edge) {
622  myEdgeTemplate = new GNEEdgeTemplate(edge);
623  // use template by default
624  myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getCreateEdgeFrame()->setUseEdgeTemplate();
625  }
626 }
627 
628 
629 void
631  if (myEdgeTemplate) {
632  myEdgeTemplate->updateLaneTemplates();
633  // use template by default
634  myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getCreateEdgeFrame()->setUseEdgeTemplate();
635  }
636 }
637 
638 void
640  // check if template editor AND mySetTemplateButton is enabled
641  if (shown() && mySetTemplateButton->isEnabled()) {
642  onCmdSetTemplate(nullptr, 0, nullptr);
643  }
644 }
645 
646 
647 void
649  // check if template editor AND myCopyTemplateButton is enabled
650  if (shown() && myCopyTemplateButton->isEnabled()) {
651  onCmdCopyTemplate(nullptr, 0, nullptr);
652  }
653 }
654 
655 
656 void
658  // check if template editor AND myClearTemplateButton is enabled
659  if (shown() && myClearTemplateButton->isEnabled()) {
660  onCmdClearTemplate(nullptr, 0, nullptr);
661  }
662 }
663 
664 
665 long
667  // first check that there is exactly an inspected edge
668  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() != 1) {
669  throw ProcessError(TL("Only one edge must be inspected"));
670  }
671  // retrieve edge ID (and throw exception if edge doesn't exist)
672  GNEEdge* edge = myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getID());
673  // set template
674  setEdgeTemplate(edge);
675  // update buttons
676  updateButtons();
677  return 1;
678 }
679 
680 
681 long
683  // first check
684  if (myEdgeTemplate) {
685  // begin copy template
686  myInspectorFrameParent->myViewNet->getUndoList()->begin(myEdgeTemplate, "copy edge template");
687  // iterate over inspected ACs
688  for (const auto& inspectedAC : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
689  // avoid copy template in the same edge
690  if (inspectedAC->getID() != myEdgeTemplate->getID()) {
691  // retrieve edge ID (and throw exception if edge doesn't exist)
692  myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(inspectedAC->getID())->copyTemplate(myEdgeTemplate, myInspectorFrameParent->myViewNet->getUndoList());
693  }
694  }
695  // end copy template
696  myInspectorFrameParent->myViewNet->getUndoList()->end();
697  // refresh inspector parent
698  myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
699  // update view (to see visual changes)
700  myInspectorFrameParent->myViewNet->updateViewNet();
701  }
702  return 1;
703 }
704 
705 
706 long
708  // set null edge
709  setEdgeTemplate(nullptr);
710  // update buttons
711  updateButtons();
712  return 1;
713 }
714 
715 
716 void
718  // enable or disable clear buttons depending of myEdgeTemplate
719  if (myEdgeTemplate) {
720  // get inspected ACs
721  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
722  // update caption of copy button
723  if (ACs.size() == 1) {
724  myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into edge '" + ACs.front()->getID() + "'").c_str());
725  } else {
726  myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into " + toString(ACs.size()) + " selected edges").c_str());
727  }
728  // enable set and clear buttons
729  myCopyTemplateButton->enable();
730  myClearTemplateButton->enable();
731  } else {
732  // update caption of copy button
733  myCopyTemplateButton->setText(TL("No edge Template Set"));
734  // disable set and clear buttons
735  myCopyTemplateButton->disable();
736  myClearTemplateButton->disable();
737  }
738 }
739 
740 // ---------------------------------------------------------------------------
741 // GNEInspectorFrame::AdditionalDialog - methods
742 // ---------------------------------------------------------------------------
743 
745  MFXGroupBoxModule(inspectorFrameParent, TL("Additional dialog")),
746  myInspectorFrameParent(inspectorFrameParent) {
747  // Create mark as front element button
749 }
750 
751 
753 
754 
755 void
757  // check number of inspected elements
758  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
759  // get AC
760  const GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
761  // check AC
762  if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
763  // update button
764  myOpenAdditionalDialog->setText(TL("Open rerouter dialog"));
765  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::REROUTER));
766  // show module
767  show();
768  } else if (AC->getTagProperty().getTag() == SUMO_TAG_CALIBRATOR) {
769  // update button
770  myOpenAdditionalDialog->setText(TL("Open calibrator dialog"));
771  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
772  // show module
773  show();
774  } else if (AC->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_LANE) {
775  // update button
776  myOpenAdditionalDialog->setText(TL("Open calibrator lane dialog"));
777  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
778  // show module
779  show();
780  } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
781  // update button
782  myOpenAdditionalDialog->setText(TL("Open VSS dialog"));
783  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::VARIABLESPEEDSIGN));
784  // show module
785  show();
786  }
787  } else {
788  // hide module
789  hide();
790  }
791 }
792 
793 
794 void
796  // hide groupbox
797  hide();
798 }
799 
800 
801 long
803  // check number of inspected elements
804  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
805  // get AC
806  GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
807  // check AC
808  if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
809  // Open rerouter dialog
810  GNERerouterDialog(dynamic_cast<GNERerouter*>(AC));
811  } else if ((AC->getTagProperty().getTag() == SUMO_TAG_CALIBRATOR) || (AC->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_LANE)) {
812  // Open calibrator dialog
813  GNECalibratorDialog(dynamic_cast<GNECalibrator*>(AC));
814  } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
815  // Open VSS dialog
817  }
818  }
819  return 1;
820 }
821 
822 // ---------------------------------------------------------------------------
823 // GNEInspectorFrame - methods
824 // ---------------------------------------------------------------------------
825 
827  GNEFrame(viewParent, viewNet, "Inspector"),
828  myPreviousElementInspect(nullptr),
829  myPreviousElementDelete(nullptr),
831 
832  // Create back button
834  myHeaderLeftFrame->hide();
835  myBackButton->hide();
836 
837  // Create Overlapped Inspection module
839 
840  // Create Attributes Editor module
842 
843  // Create GEO Parameters Editor module
845 
846  // create parameters Editor module
848 
849  // create additional dialog
851 
852  // Create Netedit Attributes Editor module
854 
855  // Create Template editor module
856  myTemplateEditor = new TemplateEditor(this);
857 
858  // Create GNEElementTree module
860 }
861 
862 
864 
865 
866 void
868  // inspect a null element to reset inspector frame
869  inspectSingleElement(nullptr);
870  // stop select new element
872  // show
873  GNEFrame::show();
874 }
875 
876 
877 void
880  GNEFrame::hide();
881 }
882 
883 
884 bool
886  // get unlocked attribute carrier front
887  auto AC = viewObjects.getAttributeCarrierFront();
888  // first check if we have clicked over an Attribute Carrier
889  if (AC) {
890  // if Control key is Pressed, select instead inspect element
892  // toggle networkElement selection
893  if (AC->isAttributeCarrierSelected()) {
895  } else {
896  AC->selectAttributeCarrier();
897  }
898  } else {
899  // first check if we clicked over a GNEOverlappedInspection point
901  if (!myOverlappedInspection->previousElement(clickedPosition)) {
902  // inspect attribute carrier, (or multiselection if AC is selected)
903  inspectClickedElement(viewObjects, clickedPosition);
904  }
905  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
906  // inspect attribute carrier, (or multiselection if AC is selected)
907  inspectClickedElement(viewObjects, clickedPosition);
908  }
909  // focus upper element of inspector frame
911  }
912  return true;
913  } else {
914  return false;
915  }
916 }
917 
918 
919 bool
921  // get unlocked attribute carrier front
922  auto AC = viewObjects.getAttributeCarrierFront();
923  // first check if we have clicked over a demand element
924  if (AC) {
925  // if Control key is Pressed, select instead inspect element
927  // toggle networkElement selection
928  if (AC->isAttributeCarrierSelected()) {
930  } else {
931  AC->selectAttributeCarrier();
932  }
933  } else {
934  // first check if we clicked over a GNEOverlappedInspection point
936  if (!myOverlappedInspection->previousElement(clickedPosition)) {
937  // inspect attribute carrier, (or multiselection if AC is selected)
938  inspectClickedElement(viewObjects, clickedPosition);
939  }
940  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
941  // inspect attribute carrier, (or multiselection if AC is selected)
942  inspectClickedElement(viewObjects, clickedPosition);
943  }
944  // focus upper element of inspector frame
946  }
947  return true;
948  } else {
949  return false;
950  }
951 }
952 
953 
954 bool
956  // get unlocked attribute carrier front
957  auto AC = viewObjects.getAttributeCarrierFront();
958  // first check if we have clicked over a data element
959  if (AC) {
960  // if Control key is Pressed, select instead inspect element
962  // toggle networkElement selection
963  if (AC->isAttributeCarrierSelected()) {
965  } else {
966  AC->selectAttributeCarrier();
967  }
968  } else {
969  // first check if we clicked over a GNEOverlappedInspection point
971  if (!myOverlappedInspection->previousElement(clickedPosition)) {
972  // inspect attribute carrier, (or multiselection if AC is selected)
973  inspectClickedElement(viewObjects, clickedPosition);
974  }
975  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
976  // inspect attribute carrier, (or multiselection if AC is selected)
977  inspectClickedElement(viewObjects, clickedPosition);
978  }
979  // focus upper element of inspector frame
981  }
982  return true;
983  } else {
984  return false;
985  }
986 }
987 
988 
989 void
991  // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
992  std::vector<GNEAttributeCarrier*> itemsToInspect;
993  if (AC != nullptr) {
996  // obtain selected ACs depending of current supermode
997  const auto selectedACs = myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(false);
998  // iterate over selected ACs
999  for (const auto& selectedAC : selectedACs) {
1000  // filter ACs to inspect using Tag as criterion
1001  if (selectedAC->getTagProperty().getTag() == AC->getTagProperty().getTag()) {
1002  itemsToInspect.push_back(selectedAC);
1003  }
1004  }
1005  } else {
1006  itemsToInspect.push_back(AC);
1007  }
1008  }
1009  inspectMultisection(itemsToInspect);
1010 }
1011 
1012 
1013 void
1014 GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
1015  // update inspected ACs in viewNet
1017  // hide back button
1018  myHeaderLeftFrame->hide();
1019  myBackButton->hide();
1020  // Hide all elements
1029  // If vector of attribute Carriers contain data
1030  if (ACs.size() > 0) {
1031  // Set header
1032  std::string headerString;
1033  if (ACs.front()->getTagProperty().isNetworkElement()) {
1034  headerString = "Net: ";
1035  } else if (ACs.front()->getTagProperty().isAdditionalElement()) {
1036  headerString = "Additional: ";
1037  } else if (ACs.front()->getTagProperty().isShapeElement()) {
1038  headerString = "Shape: ";
1039  } else if (ACs.front()->getTagProperty().isTAZElement()) {
1040  headerString = "TAZ: ";
1041  } else if (ACs.front()->getTagProperty().isWireElement()) {
1042  headerString = "WIRE: ";
1043  } else if (ACs.front()->getTagProperty().isVehicle()) {
1044  headerString = "Vehicle: ";
1045  } else if (ACs.front()->getTagProperty().isRoute()) {
1046  headerString = "Route: ";
1047  } else if (ACs.front()->getTagProperty().isPerson()) {
1048  headerString = "Person: ";
1049  } else if (ACs.front()->getTagProperty().isPlanPerson()) {
1050  headerString = "PersonPlan: ";
1051  } else if (ACs.front()->getTagProperty().isContainer()) {
1052  headerString = "Container: ";
1053  } else if (ACs.front()->getTagProperty().isPlanContainer()) {
1054  headerString = "ContainerPlan: ";
1055  } else if (ACs.front()->getTagProperty().isVehicleStop()) {
1056  headerString = "Stop: ";
1057  } else if (ACs.front()->getTagProperty().isDataElement()) {
1058  headerString = "Data: ";
1059  }
1060  if (ACs.size() > 1) {
1061  headerString += toString(ACs.size()) + " ";
1062  }
1063  headerString += ACs.front()->getTagStr();
1064  if (ACs.size() > 1) {
1065  headerString += "s";
1066  }
1067  // Set headerString into header label
1068  getFrameHeaderLabel()->setText(headerString.c_str());
1069 
1070  // Show attributes editor
1072 
1073  // show netedit attributes editor if we're inspecting elements with Netedit Attributes
1075 
1076  // Show GEO Attributes Editor if we're inspecting elements with GEO Attributes
1078 
1079  // show parameters editor
1081 
1082  // show additional dialog
1084 
1085  // If attributes correspond to an Edge and we aren't in demand mode, show template editor
1087 
1088  // if we inspect a single Attribute carrier vector, show their children
1089  if (ACs.size() == 1) {
1091  }
1092  } else {
1093  getFrameHeaderLabel()->setText(TL("Inspect"));
1094  }
1095  // update frame width
1097  // update viewNet
1098  myViewNet->update();
1099 }
1100 
1101 
1102 void
1104  // Show back button if myPreviousElementInspect was defined
1105  myPreviousElementInspect = previousElement;
1106  if (myPreviousElementInspect != nullptr) {
1107  // disable myPreviousElementDelete to avoid inconsistences
1108  myPreviousElementDelete = nullptr;
1110  myHeaderLeftFrame->show();
1111  myBackButton->show();
1112  }
1113 }
1114 
1115 
1116 void
1117 GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
1118  myPreviousElementDelete = previousElement;
1119  myPreviousElementDeleteWasMarked = previousElementWasMarked;
1120  // Show back button if myPreviousElementDelete is valid
1121  if (myPreviousElementDelete != nullptr) {
1122  // disable myPreviousElementInspect to avoid inconsistences
1123  myPreviousElementInspect = nullptr;
1125  myHeaderLeftFrame->show();
1126  myBackButton->show();
1127  }
1128 }
1129 
1130 
1131 void
1133  // Only remove if there is inspected ACs
1136  // Inspect empty selection (to hide all Editors)
1137  inspectMultisection({});
1138  }
1139 }
1140 
1141 
1144  return myAttributesEditor;
1145 }
1146 
1147 
1151 }
1152 
1153 
1156  return myTemplateEditor;
1157 }
1158 
1159 
1162  return myOverlappedInspection;
1163 }
1164 
1165 
1169 }
1170 
1171 
1172 long
1173 GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
1174  // Inspect previous element or go back to Delete Frame
1177  myPreviousElementInspect = nullptr;
1178  } else if (myPreviousElementDelete != nullptr) {
1179  myPreviousElementDelete = nullptr;
1180  // Hide inspect frame and show delete frame
1181  hide();
1183  }
1184  return 1;
1185 }
1186 
1187 
1188 void
1190  // refresh Attribute Editor
1192  // refresh parametersEditor
1194  // refresh AC Hierarchy
1196 }
1197 
1198 
1199 void
1202  // update view (due dotted contour)
1204 }
1205 
1206 
1207 void
1209  // get front unlocked AC
1210  const auto AC = viewObjects.getAttributeCarrierFront();
1211  // check if selection is blocked
1212  if (AC) {
1213  // inspect front element
1215  // show Overlapped Inspection module
1216  myOverlappedInspection->showOverlappedInspection(viewObjects, clickedPosition);
1217  }
1218 }
1219 
1220 
1221 void
1226 }
1227 
1228 
1229 
1230 /****************************************************************************/
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:930
@ MID_HELP
help button
Definition: GUIAppEnum.h:648
@ MID_GNE_INSPECTORFRAME_GOBACK
go back to the previous element
Definition: GUIAppEnum.h:1082
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:465
@ MID_HOTKEY_SHIFT_F2_TEMPLATE_COPY
copy template
Definition: GUIAppEnum.h:264
@ MID_GNE_MARKFRONTELEMENT
mark item as front element
Definition: GUIAppEnum.h:1016
@ 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
GNENet * getNet() const
get pointer to net
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
void 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
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
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:121
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:733
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:410
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