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.org/sumo
3 // Copyright (C) 2001-2022 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 
73 };
74 
77 };
78 
79 // Object implementation
80 FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
81 FXIMPLEMENT(GNEInspectorFrame::NeteditAttributesEditor, FXGroupBoxModule, NeteditAttributesEditorMap, ARRAYNUMBER(NeteditAttributesEditorMap))
82 FXIMPLEMENT(GNEInspectorFrame::GEOAttributesEditor, FXGroupBoxModule, GEOAttributesEditorMap, ARRAYNUMBER(GEOAttributesEditorMap))
83 FXIMPLEMENT(GNEInspectorFrame::TemplateEditor, FXGroupBoxModule, TemplateEditorMap, ARRAYNUMBER(TemplateEditorMap))
84 FXIMPLEMENT(GNEInspectorFrame::ParametersEditor, FXGroupBoxModule, ParametersEditorMap, ARRAYNUMBER(ParametersEditorMap))
85 FXIMPLEMENT(GNEInspectorFrame::AdditionalDialog, FXGroupBoxModule, AdditionalDialogMap, ARRAYNUMBER(AdditionalDialogMap))
86 
87 
88 // ===========================================================================
89 // method definitions
90 // ===========================================================================
91 
92 // ---------------------------------------------------------------------------
93 // GNEInspectorFrame::NeteditAttributesEditor - methods
94 // ---------------------------------------------------------------------------
95 
97  FXGroupBoxModule(inspectorFrameParent->myContentFrame, "Netedit attributes"),
98  myInspectorFrameParent(inspectorFrameParent) {
99 
100  // Create mark as front element button
101  myMarkFrontElementButton = new FXButton(getCollapsableFrame(), "Mark as front element", GUIIconSubSys::getIcon(GUIIcon::FRONTELEMENT), this, MID_GNE_MARKFRONTELEMENT, GUIDesignButton);
102 
103  // Create elements for parent additional
104  myHorizontalFrameParentAdditional = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
105  myLabelParentAdditional = new FXLabel(myHorizontalFrameParentAdditional, "Block move", nullptr, GUIDesignLabelAttribute);
106  myTextFieldParentAdditional = new FXTextField(myHorizontalFrameParentAdditional, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
107 
108  // Create elements for close shape
109  myHorizontalFrameCloseShape = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
110  myLabelCloseShape = new FXLabel(myHorizontalFrameCloseShape, "Close shape", nullptr, GUIDesignLabelAttribute);
111  myCheckBoxCloseShape = new FXCheckButton(myHorizontalFrameCloseShape, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
112 
113  // Create help button
114  myHelpButton = new FXButton(getCollapsableFrame(), "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
115 }
116 
117 
119 
120 
121 void
123  // continue if there is edited ACs
124  if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
125  // enable all editable elements
126  myTextFieldParentAdditional->enable();
127  myCheckBoxCloseShape->enable();
128  // obtain tag property (only for improve code legibility)
129  const auto& tagValue = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
130  // check if item can be mark as front elmenet
131  if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
132  // show NeteditAttributesEditor
133  show();
134  // show button
135  myMarkFrontElementButton->show();
136  // enable or disable
137  if (myInspectorFrameParent->getViewNet()->getFrontAttributeCarrier() == myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front()) {
138  myMarkFrontElementButton->disable();
139  } else {
140  myMarkFrontElementButton->enable();
141  }
142  }
143  // check if item can block their shape
144  if (tagValue.canCloseShape()) {
145  // show NeteditAttributesEditor
146  show();
147  // Iterate over AC to obtain values
148  bool value = true;
149  for (const auto& i : myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers()) {
150  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
151  }
152  // show close shape frame
153  myHorizontalFrameCloseShape->show();
154  // show help button
155  myHelpButton->show();
156  // set check box value and update label
157  if (value) {
158  myCheckBoxCloseShape->setCheck(true);
159  myCheckBoxCloseShape->setText("true");
160  } else {
161  myCheckBoxCloseShape->setCheck(false);
162  myCheckBoxCloseShape->setText("false");
163  }
164  }
165  // Check if item has another item as parent and can be reparemt
166  if (tagValue.isChild() && tagValue.canBeReparent()) {
167  // show NeteditAttributesEditor
168  show();
169  // obtain additional Parent
170  std::set<std::string> parents;
171  for (const auto& i : myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers()) {
172  parents.insert(i->getAttribute(GNE_ATTR_PARENT));
173  }
174  // show parent additional frame
175  myHorizontalFrameParentAdditional->show();
176  // show help button
177  myHelpButton->show();
178  // set Label and TextField with the Tag and ID of parent
179  myLabelParentAdditional->setText((toString(myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().isChild()) + " parent").c_str());
180  myTextFieldParentAdditional->setText(toString(parents).c_str());
181  }
182  // disable all editable elements if we're in demand mode and inspected AC isn't a demand element
183  if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front()) == false) {
184  myTextFieldParentAdditional->disable();
185  myCheckBoxCloseShape->disable();
186  }
187  }
188 }
189 
190 
191 void
193  // hide all elements of GroupBox
194  myHorizontalFrameParentAdditional->hide();
195  myHorizontalFrameCloseShape->hide();
196  myMarkFrontElementButton->hide();
197  myHelpButton->hide();
198  // hide groupbox
199  hide();
200 }
201 
202 
203 void
205  // get inspected Attribute carriers
206  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
207  if (ACs.size() > 0) {
208  // enable or disable mark front element button
209  if (myInspectorFrameParent->getViewNet()->getFrontAttributeCarrier() == ACs.front()) {
210  myMarkFrontElementButton->disable();
211  } else {
212  myMarkFrontElementButton->enable();
213  }
214  // refresh close shape
215  if (myHorizontalFrameCloseShape->shown()) {
216  // Iterate over AC to obtain values
217  bool value = true;
218  for (const auto& i : ACs) {
219  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
220  }
221  // set check box value and update label
222  if (value) {
223  myCheckBoxCloseShape->setCheck(true);
224  myCheckBoxCloseShape->setText("true");
225  } else {
226  myCheckBoxCloseShape->setCheck(false);
227  myCheckBoxCloseShape->setText("false");
228  }
229  }
230  // Check if item has another item as parent (Currently only for single Additionals)
231  if (myHorizontalFrameParentAdditional->shown() && ((myTextFieldParentAdditional->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
232  // set Label and TextField with the Tag and ID of parent
233  myLabelParentAdditional->setText((toString(ACs.front()->getTagProperty().getParentTags().front()) + " parent").c_str());
234  myTextFieldParentAdditional->setText(ACs.front()->getAttribute(GNE_ATTR_PARENT).c_str());
235  }
236  }
237 }
238 
239 
240 long
242  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
243  // make sure that ACs has elements
244  if (ACs.size() > 0) {
245  // check if we're changing multiple attributes
246  if (ACs.size() > 1) {
247  myInspectorFrameParent->myViewNet->getUndoList()->begin(ACs.front()->getTagProperty().getGUIIcon(), "Change multiple attributes");
248  }
249  if (obj == myCheckBoxCloseShape) {
250  // set new values in all inspected Attribute Carriers
251  for (const auto& AC : ACs) {
252  if (myCheckBoxCloseShape->getCheck() == 1) {
253  AC->setAttribute(GNE_ATTR_CLOSE_SHAPE, "true", myInspectorFrameParent->myViewNet->getUndoList());
254  myCheckBoxCloseShape->setText("true");
255  } else {
256  AC->setAttribute(GNE_ATTR_CLOSE_SHAPE, "false", myInspectorFrameParent->myViewNet->getUndoList());
257  myCheckBoxCloseShape->setText("false");
258  }
259  }
260  } else if (obj == myTextFieldParentAdditional) {
261  if (ACs.front()->isValid(GNE_ATTR_PARENT, myTextFieldParentAdditional->getText().text())) {
262  // replace the parent of all inspected elements
263  for (const auto& AC : ACs) {
264  AC->setAttribute(GNE_ATTR_PARENT, myTextFieldParentAdditional->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
265  }
266  myTextFieldParentAdditional->setTextColor(FXRGB(0, 0, 0));
267  myTextFieldParentAdditional->killFocus();
268  } else {
269  myTextFieldParentAdditional->setTextColor(FXRGB(255, 0, 0));
270  }
271  }
272  // finish change multiple attributes
273  if (ACs.size() > 1) {
274  myInspectorFrameParent->myViewNet->getUndoList()->end();
275  }
276  // force refresh values of AttributesEditor and GEOAttributesEditor
277  myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
278  myInspectorFrameParent->myGEOAttributesEditor->refreshGEOAttributesEditor(true);
279  }
280  return 1;
281 }
282 
283 
284 long
286  // check number of elements
287  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
288  // mark AC as front elemnet
289  myInspectorFrameParent->getViewNet()->setFrontAttributeCarrier(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front());
290  // disable button
291  myMarkFrontElementButton->disable();
292  }
293  return 1;
294 }
295 
296 
297 long
299  // Create dialog box
300  FXDialogBox* additionalNeteditAttributesHelpDialog = new FXDialogBox(getCollapsableFrame(), "Netedit Attributes Help", GUIDesignDialogBox);
301  additionalNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::MODEADDITIONAL));
302  // set help text
303  std::ostringstream help;
304  help
305  << "- Mark as front element: Mark element as front element (Will be drawn over all other elements)\n"
306  << "- Block movement: disable movement in move mode\n"
307  << "- Block shape: Disable moving of shape's vertices and edges. Entire shape can be moved'.\n"
308  << "- Close shape: Add or remove the last vertex with the same position of first edge'.";
309  // Create label with the help text
310  new FXLabel(additionalNeteditAttributesHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
311  // Create horizontal separator
312  new FXHorizontalSeparator(additionalNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
313  // Create frame for OK Button
314  FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(additionalNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
315  // Create Button Close (And two more horizontal frames to center it)
316  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
317  new FXButton(myHorizontalFrameOKButton, "OK\t\tclose", GUIIconSubSys::getIcon(GUIIcon::ACCEPT), additionalNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
318  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
319  // Write Warning in console if we're in testing mode
320  WRITE_DEBUG("Opening NeteditAttributesEditor help dialog");
321  // create Dialog
322  additionalNeteditAttributesHelpDialog->create();
323  // show in the given position
324  additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
325  // refresh APP
326  getApp()->refresh();
327  // open as modal dialog (will block all windows until stop() or stopModal() is called)
328  getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
329  // Write Warning in console if we're in testing mode
330  WRITE_DEBUG("Closing NeteditAttributesEditor help dialog");
331  return 1;
332 }
333 
334 // ---------------------------------------------------------------------------
335 // GNEInspectorFrame::GEOAttributesEditor - methods
336 // ---------------------------------------------------------------------------
337 
339  FXGroupBoxModule(inspectorFrameParent->myContentFrame, "GEO Attributes"),
340  myInspectorFrameParent(inspectorFrameParent) {
341 
342  // Create Frame for GEOAttribute
344  myGEOAttributeLabel = new FXLabel(myGEOAttributeFrame, "Undefined GEO Attribute", nullptr, GUIDesignLabelAttribute);
346 
347  // Create Frame for use GEO
349  myUseGEOLabel = new FXLabel(myUseGEOFrame, toString(SUMO_ATTR_GEO).c_str(), nullptr, GUIDesignLabelAttribute);
350  myUseGEOCheckButton = new FXCheckButton(myUseGEOFrame, "false", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
351 
352  // Create help button
353  myHelpButton = new FXButton(getCollapsableFrame(), "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
354 }
355 
356 
358 
359 
360 void
362  // make sure that ACs has elements
363  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
364  // enable all editable elements
365  myGEOAttributeTextField->enable();
366  myUseGEOCheckButton->enable();
367  // obtain tag property (only for improve code legibility)
368  const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
369  // check if item can use a geo position
370  if (tagProperty.hasGEOShape()) {
371  // show GEOAttributesEditor
372  show();
373  // Iterate over AC to obtain values
374  bool value = true;
375  for (const auto& i : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
376  value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(SUMO_ATTR_GEO));
377  }
378  // show use geo frame
379  myUseGEOFrame->show();
380  // set UseGEOCheckButton value of and update label (only if geo conversion is defined)
381  if (GeoConvHelper::getFinal().getProjString() != "!") {
382  myUseGEOCheckButton->enable();
383  if (value) {
384  myUseGEOCheckButton->setCheck(true);
385  myUseGEOCheckButton->setText("true");
386  } else {
387  myUseGEOCheckButton->setCheck(false);
388  myUseGEOCheckButton->setText("false");
389  }
390  } else {
391  myUseGEOCheckButton->disable();
392  }
393  if (tagProperty.hasGEOShape() && myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
394  myGEOAttributeFrame->show();
395  myGEOAttributeLabel->setText(toString(SUMO_ATTR_GEOSHAPE).c_str());
396  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
397  // only allow edit if geo conversion is defined
398  if (GeoConvHelper::getFinal().getProjString() != "!") {
399  myGEOAttributeTextField->enable();
400  myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
401  } else {
402  myGEOAttributeTextField->disable();
403  myGEOAttributeTextField->setText("No geo-conversion defined");
404  }
405  }
406  }
407  // disable all editable elements if we're in demand mode and inspected AC isn't a demand element
408  if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()) == false) {
409  myGEOAttributeTextField->disable();
410  myUseGEOCheckButton->disable();
411  }
412  }
413 }
414 
415 
416 void
418  // hide all elements of GroupBox
419  myGEOAttributeFrame->hide();
420  myUseGEOFrame->hide();
421  // hide groupbox
422  hide();
423 }
424 
425 
426 void
428  // obtain tag property (only for improve code legibility)
429  const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
430  // Check that myGEOAttributeFrame is shown
431  if ((GeoConvHelper::getFinal().getProjString() != "!") && myGEOAttributeFrame->shown() && ((myGEOAttributeTextField->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
432  if (tagProperty.hasGEOShape()) {
433  myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
434  }
435  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
436  }
437 }
438 
439 
440 long
442  // make sure that ACs has elements
443  if ((GeoConvHelper::getFinal().getProjString() != "!") && (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0)) {
444  if (obj == myGEOAttributeTextField) {
445  // obtain tag property (only for improve code legibility)
446  const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
447  // Change GEO Attribute depending of type (Position or shape)
448  if (tagProperty.hasGEOShape()) {
449  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->isValid(SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text())) {
450  myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->setAttribute(SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
451  myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
452  myGEOAttributeTextField->killFocus();
453  } else {
454  myGEOAttributeTextField->setTextColor(FXRGB(255, 0, 0));
455  }
456  } else {
457  throw ProcessError("myGEOAttributeTextField must be hidden becaurse there isn't GEO Attribute to edit");
458  }
459  } else if (obj == myUseGEOCheckButton) {
460  // update GEO Attribute of entire selection
461  for (const auto& i : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
462  if (myUseGEOCheckButton->getCheck() == 1) {
463  i->setAttribute(SUMO_ATTR_GEO, "true", myInspectorFrameParent->myViewNet->getUndoList());
464  myUseGEOCheckButton->setText("true");
465  } else {
466  i->setAttribute(SUMO_ATTR_GEO, "false", myInspectorFrameParent->myViewNet->getUndoList());
467  myUseGEOCheckButton->setText("false");
468  }
469  }
470  }
471  // force refresh values of Attributes editor and NeteditAttributesEditor
472  myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
473  myInspectorFrameParent->myNeteditAttributesEditor->refreshNeteditAttributesEditor(true);
474  }
475  return 1;
476 }
477 
478 
479 long
481  FXDialogBox* helpDialog = new FXDialogBox(getCollapsableFrame(), "GEO attributes Help", GUIDesignDialogBox);
482  std::ostringstream help;
483  help
484  << " SUMO uses the World Geodetic System 84 (WGS84/UTM).\n"
485  << " For a GEO-referenced network, geo coordinates are represented as pairs of Longitude and Latitude\n"
486  << " in decimal degrees without extra symbols. (N,W..)\n"
487  << " - Longitude: East-west position of a point on the Earth's surface.\n"
488  << " - Latitude: North-south position of a point on the Earth's surface.\n"
489  << " - CheckBox 'geo' enables or disables saving position in GEO coordinates\n";
490  new FXLabel(helpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
491  // "OK"
492  new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(GUIIcon::ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
493  helpDialog->create();
494  helpDialog->show();
495  return 1;
496 }
497 
498 // ---------------------------------------------------------------------------
499 // GNEInspectorFrame::TemplateEditor - methods
500 // ---------------------------------------------------------------------------
501 
503  FXGroupBoxModule(inspectorFrameParent->myContentFrame, "Templates"),
504  myInspectorFrameParent(inspectorFrameParent),
505  myEdgeTemplate(nullptr) {
506  // Create set template button
507  mySetTemplateButton = new FXButton(getCollapsableFrame(), "Set as Template\t\t", nullptr, this, MID_HOTKEY_SHIFT_F1_TEMPLATE_SET, GUIDesignButton);
508  // Create copy template button
510  // Create copy template button
511  myClearTemplateButton = new FXButton(getCollapsableFrame(), "clear Edge Template", nullptr, this, MID_HOTKEY_SHIFT_F3_TEMPLATE_CLEAR, GUIDesignButton);
512 }
513 
514 
516 }
517 
518 
519 void
521  // show template editor only if we're editing an edge in Network mode
522  if ((myInspectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) &&
523  (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().getTag() == SUMO_TAG_EDGE)) {
524  // show "Set As Template"
525  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
526  mySetTemplateButton->show();
527  mySetTemplateButton->setText(("Set edge '" + myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getID() + "' as Template").c_str());
528  }
529  // update buttons
530  updateButtons();
531  // show modul
532  show();
533  }
534 }
535 
536 
537 void
539  // hide template editor
540  hide();
541 }
542 
543 
546  return myEdgeTemplate;
547 }
548 
549 
550 void
552  // delete previous template edge
553  if (myEdgeTemplate) {
554  delete myEdgeTemplate;
555  myEdgeTemplate = nullptr;
556  }
557  // update edge template
558  if (edge) {
559  myEdgeTemplate = new GNEEdgeTemplate(edge);
560  // use template by default
561  myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getCreateEdgeFrame()->setUseEdgeTemplate();
562  }
563 }
564 
565 
566 void
568  // check if template editor AND mySetTemplateButton is enabled
569  if (shown() && mySetTemplateButton->isEnabled()) {
570  onCmdSetTemplate(nullptr, 0, nullptr);
571  }
572 }
573 
574 
575 void
577  // check if template editor AND myCopyTemplateButton is enabled
578  if (shown() && myCopyTemplateButton->isEnabled()) {
579  onCmdCopyTemplate(nullptr, 0, nullptr);
580  }
581 }
582 
583 
584 void
586  // check if template editor AND myClearTemplateButton is enabled
587  if (shown() && myClearTemplateButton->isEnabled()) {
588  onCmdClearTemplate(nullptr, 0, nullptr);
589  }
590 }
591 
592 
593 long
595  // first check that there is exactly an inspected edge
596  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() != 1) {
597  throw ProcessError("Only one edge must be inspected");
598  }
599  // retrieve edge ID (and throw exception if edge doesn't exist)
600  GNEEdge* edge = myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getID());
601  // set template
602  setEdgeTemplate(edge);
603  // update buttons
604  updateButtons();
605  return 1;
606 }
607 
608 
609 long
611  // first check
612  if (myEdgeTemplate) {
613  // begin copy template
614  myInspectorFrameParent->myViewNet->getUndoList()->begin(GUIIcon::EDGE, "copy edge template");
615  // iterate over inspected ACs
616  for (const auto& inspectedAC : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
617  // retrieve edge ID (and throw exception if edge doesn't exist)
618  myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(inspectedAC->getID())->copyTemplate(myEdgeTemplate, myInspectorFrameParent->myViewNet->getUndoList());
619  }
620  // end copy template
621  myInspectorFrameParent->myViewNet->getUndoList()->end();
622  // refresh inspector parent
623  myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
624  // update view (to see visual changes)
625  myInspectorFrameParent->myViewNet->updateViewNet();
626  }
627  return 1;
628 }
629 
630 
631 long
633  // set null edge
634  setEdgeTemplate(nullptr);
635  // update buttons
636  updateButtons();
637  return 1;
638 }
639 
640 
641 void
643  // enable or disable clear buttons depending of myEdgeTemplate
644  if (myEdgeTemplate) {
645  // get inspected ACs
646  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
647  // update caption of copy button
648  if (ACs.size() == 1) {
649  myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into edge '" + ACs.front()->getID() + "'").c_str());
650  } else {
651  myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into " + toString(ACs.size()) + " selected edges").c_str());
652  }
653  // enable set and clear buttons
654  myCopyTemplateButton->enable();
655  myClearTemplateButton->enable();
656  } else {
657  // update caption of copy button
658  myCopyTemplateButton->setText("No edge Template Set");
659  // disable set and clear buttons
660  myCopyTemplateButton->disable();
661  myClearTemplateButton->disable();
662  }
663 }
664 
665 // ---------------------------------------------------------------------------
666 // GNEFrameAttributeModules::ParametersEditor - methods
667 // ---------------------------------------------------------------------------
668 
670  FXGroupBoxModule(inspectorFrameParent->myContentFrame, "Parameters"),
671  myInspectorFrameParent(inspectorFrameParent) {
672  // create textfield and buttons
674  myButtonEditParameters = new FXButton(getCollapsableFrame(), "Edit parameters", nullptr, this, MID_GNE_OPEN_PARAMETERS_DIALOG, GUIDesignButton);
675 }
676 
677 
679 
680 
681 void
683  // firt check if there is
684  if ((myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) &&
685  myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().hasParameters()) {
686  // refresh ParametersEditor
687  refreshParametersEditor();
688  // show groupbox
689  show();
690  } else {
691  hide();
692  }
693 }
694 
695 
696 void
698  // hide groupbox
699  hide();
700 }
701 
702 
703 void
705  // get front AC
706  const GNEAttributeCarrier* frontAC = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0 ? myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front() : nullptr;
707  // continue depending of frontAC
708  if (frontAC && frontAC->getTagProperty().hasParameters()) {
709  // check if we're editing a single or a multiple AC
710  if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
711  // set text field parameters
712  myTextFieldParameters->setText(frontAC->getAttribute(GNE_ATTR_PARAMETERS).c_str());
713  } else if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
714  // check if parameters of all inspected ACs are different
715  std::string parameters = frontAC->getAttribute(GNE_ATTR_PARAMETERS);
716  for (const auto& AC : myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers()) {
717  if (parameters != AC->getAttribute(GNE_ATTR_PARAMETERS)) {
718  parameters = "different parameters";
719  }
720  }
721  // set text field
722  myTextFieldParameters->setText(parameters.c_str());
723  }
724  // reset color
725  myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
726  // disable myTextFieldParameters if Tag correspond to an network element but we're in demand mode (or vice versa), disable all elements
727  if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->myViewNet, frontAC)) {
728  myTextFieldParameters->enable();
729  myButtonEditParameters->enable();
730  } else {
731  myTextFieldParameters->disable();
732  myButtonEditParameters->disable();
733  }
734  }
735 }
736 
737 
740  return myInspectorFrameParent;
741 }
742 
743 
744 long
746  // get front AC
747  const GNEAttributeCarrier* frontAC = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0 ? myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front() : nullptr;
748  // continue depending of frontAC
749  if (frontAC && frontAC->getTagProperty().hasParameters()) {
750  if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 1) {
751  // write debug information
752  WRITE_DEBUG("Open multiple parameters dialog");
753  // open multiple parameters dialog
754  if (GNEMultipleParametersDialog(this).execute()) {
755  // write debug information
756  WRITE_DEBUG("Close multiple parameters dialog");
757  // update frame parent after attribute sucesfully set
758  myInspectorFrameParent->attributeUpdated();
759  // Refresh parameter EditorInspector
760  refreshParametersEditor();
761  } else {
762  // write debug information
763  WRITE_DEBUG("Cancel multiple parameters dialog");
764  }
765  } else {
766  // write debug information
767  WRITE_DEBUG("Open single parameters dialog");
768  if (GNESingleParametersDialog(this).execute()) {
769  // write debug information
770  WRITE_DEBUG("Close single parameters dialog");
771  // update frame parent after attribute sucesfully set
772  myInspectorFrameParent->attributeUpdated();
773  // Refresh parameter EditorInspector
774  refreshParametersEditor();
775  } else {
776  // write debug information
777  WRITE_DEBUG("Cancel single parameters dialog");
778  }
779  }
780  }
781  return 1;
782 }
783 
784 
785 long
787  const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
788  // get front AC
789  GNEAttributeCarrier* frontAC = ACs.size() > 0 ? ACs.front() : nullptr;
790  // continue depending of frontAC
791  if (frontAC && frontAC->getTagProperty().hasParameters()) {
792  // check if current given string is valid
793  if (Parameterised::areParametersValid(myTextFieldParameters->getText().text(), true)) {
794  // parsed parameters ok, then set text field black and continue
795  myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
796  myTextFieldParameters->killFocus();
797  // check inspected parameters
798  if (ACs.size() == 1) {
799  // begin undo list
800  myInspectorFrameParent->myViewNet->getUndoList()->begin(frontAC->getTagProperty().getGUIIcon(), "change parameters");
801  // set parameters
802  frontAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
803  // end undo list
804  myInspectorFrameParent->myViewNet->getUndoList()->end();
805  } else if (ACs.size() > 0) {
806  // begin undo list
807  myInspectorFrameParent->myViewNet->getUndoList()->begin(frontAC->getTagProperty().getGUIIcon(), "change multiple parameters");
808  // set parameters in all ACs
809  for (const auto& inspectedAC : ACs) {
810  inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
811  }
812  // end undo list
813  myInspectorFrameParent->myViewNet->getUndoList()->end();
814  }
815  // update frame parent after attribute sucesfully set
816  myInspectorFrameParent->attributeUpdated();
817  } else {
818  myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
819  }
820  }
821  return 1;
822 }
823 
824 // ---------------------------------------------------------------------------
825 // GNEInspectorFrame::AdditionalDialog - methods
826 // ---------------------------------------------------------------------------
827 
829  FXGroupBoxModule(inspectorFrameParent->myContentFrame, "Additional dialog"),
830  myInspectorFrameParent(inspectorFrameParent) {
831  // Create mark as front element button
832  myOpenAdditionalDialog = new FXButton(getCollapsableFrame(), "Additional dialog", nullptr, this, MID_OPEN_ADDITIONAL_DIALOG, GUIDesignButton);
833 }
834 
835 
837 
838 
839 void
841  // check number of inspected elements
842  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
843  // get AC
844  const GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
845  // check AC
846  if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
847  // update button
848  myOpenAdditionalDialog->setText("Open Rerouter dialog");
849  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::REROUTER));
850  // show modul
851  show();
852  } else if (AC->getTagProperty().getTag() == SUMO_TAG_CALIBRATOR) {
853  // update button
854  myOpenAdditionalDialog->setText("Open Calibrator dialog");
855  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
856  // show modul
857  show();
858  } else if (AC->getTagProperty().getTag() == SUMO_TAG_LANECALIBRATOR) {
859  // update button
860  myOpenAdditionalDialog->setText("Open Lane Calibrator dialog");
861  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
862  // show modul
863  show();
864  } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
865  // update button
866  myOpenAdditionalDialog->setText("Open VSS dialog");
867  myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::VARIABLESPEEDSIGN));
868  // show modul
869  show();
870  }
871  } else {
872  // hide modul
873  hide();
874  }
875 }
876 
877 
878 void
880  // hide groupbox
881  hide();
882 }
883 
884 
885 long
887  // check number of inspected elements
888  if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
889  // get AC
890  GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
891  // check AC
892  if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
893  // Open rerouter dialog
894  GNERerouterDialog(dynamic_cast<GNERerouter*>(AC));
895  } else if ((AC->getTagProperty().getTag() == SUMO_TAG_CALIBRATOR) || (AC->getTagProperty().getTag() == SUMO_TAG_LANECALIBRATOR)) {
896  // Open calibrator dialog
897  GNECalibratorDialog(dynamic_cast<GNECalibrator*>(AC));
898  } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
899  // Open VSS dialog
901  }
902  }
903  return 1;
904 }
905 
906 // ---------------------------------------------------------------------------
907 // GNEInspectorFrame - methods
908 // ---------------------------------------------------------------------------
909 
910 GNEInspectorFrame::GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
911  GNEFrame(horizontalFrameParent, viewNet, "Inspector"),
912  myPreviousElementInspect(nullptr),
913  myPreviousElementDelete(nullptr),
915 
916  // Create back button
918  myHeaderLeftFrame->hide();
919  myBackButton->hide();
920 
921  // Create Overlapped Inspection modul
923 
924  // Create Attributes Editor modul
926 
927  // Create GEO Parameters Editor modul
929 
930  // create parameters Editor modul
932 
933  // create additional dialog
935 
936  // Create Netedit Attributes Editor modul
938 
939  // Create Template editor modul
940  myTemplateEditor = new TemplateEditor(this);
941 
942  // Create HierarchicalElementTree modul
944 }
945 
946 
948 
949 
950 void
952  // inspect a null element to reset inspector frame
953  inspectSingleElement(nullptr);
954  GNEFrame::show();
955 }
956 
957 
958 void
961  GNEFrame::hide();
962 }
963 
964 
965 bool
967  // first check if we have clicked over an Attribute Carrier
968  if (objectsUnderCursor.getAttributeCarrierFront()) {
969  // if Control key is Pressed, select instead inspect element
971  // Check if this GLobject type is locked
972  if (!myViewNet->getLockManager().isObjectLocked(objectsUnderCursor.getGlTypeFront(), objectsUnderCursor.getAttributeCarrierFront()->isAttributeCarrierSelected())) {
973  // toggle networkElement selection
974  if (objectsUnderCursor.getAttributeCarrierFront()->isAttributeCarrierSelected()) {
975  objectsUnderCursor.getAttributeCarrierFront()->unselectAttributeCarrier();
976  } else {
977  objectsUnderCursor.getAttributeCarrierFront()->selectAttributeCarrier();
978  }
979  }
980  } else {
981  // first check if we clicked over a OverlappedInspection point
983  if (!myOverlappedInspection->previousElement(clickedPosition)) {
984  // inspect attribute carrier, (or multiselection if AC is selected)
985  inspectClickedElement(objectsUnderCursor, clickedPosition);
986  }
987  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
988  // inspect attribute carrier, (or multiselection if AC is selected)
989  inspectClickedElement(objectsUnderCursor, clickedPosition);
990  }
991  // focus upper element of inspector frame
993  }
994  return true;
995  } else {
996  return false;
997  }
998 }
999 
1000 
1001 bool
1003  // first check if we have clicked over a demand element
1004  if (objectsUnderCursor.getDemandElementFront()) {
1005  // if Control key is Pressed, select instead inspect element
1007  // Check if this GLobject type is locked
1008  if (!myViewNet->getLockManager().isObjectLocked(objectsUnderCursor.getGlTypeFront(), objectsUnderCursor.getAttributeCarrierFront()->isAttributeCarrierSelected())) {
1009  // toggle networkElement selection
1010  if (objectsUnderCursor.getAttributeCarrierFront()->isAttributeCarrierSelected()) {
1011  objectsUnderCursor.getAttributeCarrierFront()->unselectAttributeCarrier();
1012  } else {
1013  objectsUnderCursor.getAttributeCarrierFront()->selectAttributeCarrier();
1014  }
1015  }
1016  } else {
1017  // first check if we clicked over a OverlappedInspection point
1019  if (!myOverlappedInspection->previousElement(clickedPosition)) {
1020  // inspect attribute carrier, (or multiselection if AC is selected)
1021  inspectClickedElement(objectsUnderCursor, clickedPosition);
1022  }
1023  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
1024  // inspect attribute carrier, (or multiselection if AC is selected)
1025  inspectClickedElement(objectsUnderCursor, clickedPosition);
1026  }
1027  // focus upper element of inspector frame
1029  }
1030  return true;
1031  } else {
1032  return false;
1033  }
1034 }
1035 
1036 
1037 bool
1039  // first check if we have clicked over a data element
1040  if (objectsUnderCursor.getGenericDataElementFront()) {
1041  // if Control key is Pressed, select instead inspect element
1043  // Check if this GLobject type is locked
1044  if (!myViewNet->getLockManager().isObjectLocked(objectsUnderCursor.getGlTypeFront(), objectsUnderCursor.getAttributeCarrierFront()->isAttributeCarrierSelected())) {
1045  // toggle networkElement selection
1046  if (objectsUnderCursor.getAttributeCarrierFront()->isAttributeCarrierSelected()) {
1047  objectsUnderCursor.getAttributeCarrierFront()->unselectAttributeCarrier();
1048  } else {
1049  objectsUnderCursor.getAttributeCarrierFront()->selectAttributeCarrier();
1050  }
1051  }
1052  } else {
1053  // first check if we clicked over a OverlappedInspection point
1055  if (!myOverlappedInspection->previousElement(clickedPosition)) {
1056  // inspect attribute carrier, (or multiselection if AC is selected)
1057  inspectClickedElement(objectsUnderCursor, clickedPosition);
1058  }
1059  } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
1060  // inspect attribute carrier, (or multiselection if AC is selected)
1061  inspectClickedElement(objectsUnderCursor, clickedPosition);
1062  }
1063  // focus upper element of inspector frame
1065  }
1066  return true;
1067  } else {
1068  return false;
1069  }
1070 }
1071 
1072 
1073 void
1075  // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
1076  std::vector<GNEAttributeCarrier*> itemsToInspect;
1077  if (AC != nullptr) {
1079  if (AC->isAttributeCarrierSelected()) {
1080  // obtain selected ACs depending of current supermode
1081  const auto selectedACs = myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(false);
1082  // iterate over selected ACs
1083  for (const auto& selectedAC : selectedACs) {
1084  // filter ACs to inspect using Tag as criterium
1085  if (selectedAC->getTagProperty().getTag() == AC->getTagProperty().getTag()) {
1086  itemsToInspect.push_back(selectedAC);
1087  }
1088  }
1089  } else {
1090  itemsToInspect.push_back(AC);
1091  }
1092  }
1093  inspectMultisection(itemsToInspect);
1094 }
1095 
1096 
1097 void
1098 GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
1099  // update inspected ACs in viewNet
1101  // hide back button
1102  myHeaderLeftFrame->hide();
1103  myBackButton->hide();
1104  // Hide all elements
1113  // If vector of attribute Carriers contain data
1114  if (ACs.size() > 0) {
1115  // Set header
1116  std::string headerString;
1117  if (ACs.front()->getTagProperty().isNetworkElement()) {
1118  headerString = "Net: ";
1119  } else if (ACs.front()->getTagProperty().isAdditionalElement()) {
1120  headerString = "Additional: ";
1121  } else if (ACs.front()->getTagProperty().isShape()) {
1122  headerString = "Shape: ";
1123  } else if (ACs.front()->getTagProperty().isTAZElement()) {
1124  headerString = "TAZ: ";
1125  } else if (ACs.front()->getTagProperty().isVehicle()) {
1126  headerString = "Vehicle: ";
1127  } else if (ACs.front()->getTagProperty().isRoute()) {
1128  headerString = "Route: ";
1129  } else if (ACs.front()->getTagProperty().isPerson()) {
1130  headerString = "Person: ";
1131  } else if (ACs.front()->getTagProperty().isPersonPlan()) {
1132  headerString = "PersonPlan: ";
1133  } else if (ACs.front()->getTagProperty().isStop()) {
1134  headerString = "Stop: ";
1135  } else if (ACs.front()->getTagProperty().isDataElement()) {
1136  headerString = "Data: ";
1137  }
1138  if (ACs.size() > 1) {
1139  headerString += toString(ACs.size()) + " ";
1140  }
1141  headerString += ACs.front()->getTagStr();
1142  if (ACs.size() > 1) {
1143  headerString += "s";
1144  }
1145  // Set headerString into header label
1146  getFrameHeaderLabel()->setText(headerString.c_str());
1147 
1148  // Show attributes editor
1150 
1151  // show netedit attributes editor if we're inspecting elements with Netedit Attributes
1153 
1154  // Show GEO Attributes Editor if we're inspecting elements with GEO Attributes
1156 
1157  // show parameters editor
1159 
1160  // show additional dialog
1162 
1163  // If attributes correspond to an Edge and we aren't in demand mode, show template editor
1165 
1166  // if we inspect a single Attribute carrier vector, show their children
1167  if (ACs.size() == 1) {
1169  }
1170  } else {
1171  getFrameHeaderLabel()->setText("Inspect");
1172  myContentFrame->recalc();
1173  }
1174 }
1175 
1176 
1177 void
1179  // Show back button if myPreviousElementInspect was defined
1180  myPreviousElementInspect = previousElement;
1181  if (myPreviousElementInspect != nullptr) {
1182  // disable myPreviousElementDelete to avoid inconsistences
1183  myPreviousElementDelete = nullptr;
1185  myHeaderLeftFrame->show();
1186  myBackButton->show();
1187  }
1188 }
1189 
1190 
1191 void
1192 GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
1193  myPreviousElementDelete = previousElement;
1194  myPreviousElementDeleteWasMarked = previousElementWasMarked;
1195  // Show back button if myPreviousElementDelete is valid
1196  if (myPreviousElementDelete != nullptr) {
1197  // disable myPreviousElementInspect to avoid inconsistences
1198  myPreviousElementInspect = nullptr;
1200  myHeaderLeftFrame->show();
1201  myBackButton->show();
1202  }
1203 }
1204 
1205 
1206 void
1208  // Only remove if there is inspected ACs
1211  // Inspect empty selection (to hide all Editors)
1212  inspectMultisection({});
1213  }
1214 }
1215 
1216 
1219  return myAttributesEditor;
1220 }
1221 
1222 
1226 }
1227 
1228 
1231  return myTemplateEditor;
1232 }
1233 
1234 
1237  return myOverlappedInspection;
1238 }
1239 
1240 
1244 }
1245 
1246 
1247 long
1248 GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
1249  // Inspect previous element or go back to Delete Frame
1252  myPreviousElementInspect = nullptr;
1253  } else if (myPreviousElementDelete != nullptr) {
1254  myPreviousElementDelete = nullptr;
1255  // Hide inspect frame and show delete frame
1256  hide();
1258  }
1259  return 1;
1260 }
1261 
1262 
1263 void
1265  // refresh Attribute Editor
1267  // refresh parametersEditor
1269  // refresh AC Hierarchy
1271 }
1272 
1273 
1274 void
1276  // if AC is a lane but selectEdges checkBox is enabled, then inspect their parent edge
1278  inspectSingleElement(dynamic_cast<GNELane*>(AC)->getParentEdge());
1279  } else {
1281  }
1282  // update view (due dotted contour)
1284 }
1285 
1286 
1287 void
1289  const auto AC = objectsUnderCursor.getAttributeCarrierFront();
1290  // check if selection is blocked
1291  if (AC && !myViewNet->getLockManager().isObjectLocked(AC->getGUIGlObject()->getType(), AC->isAttributeCarrierSelected())) {
1292  // inspect front element
1293  inspectSingleElement(objectsUnderCursor.getAttributeCarrierFront());
1294  // show Overlapped Inspection modul
1295  myOverlappedInspection->showOverlappedInspection(objectsUnderCursor, clickedPosition);
1296  }
1297 }
1298 
1299 
1300 void
1305 }
1306 
1307 
1308 
1309 /****************************************************************************/
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:797
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition: GUIAppEnum.h:833
@ MID_HELP
help button
Definition: GUIAppEnum.h:600
@ MID_GNE_INSPECTORFRAME_GOBACK
go back to the previous element
Definition: GUIAppEnum.h:923
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:423
@ MID_HOTKEY_SHIFT_F2_TEMPLATE_COPY
copy template
Definition: GUIAppEnum.h:216
@ MID_GNE_MARKFRONTELEMENT
mark item as front element
Definition: GUIAppEnum.h:873
@ MID_HOTKEY_SHIFT_F1_TEMPLATE_SET
set template
Definition: GUIAppEnum.h:214
@ MID_HOTKEY_SHIFT_F3_TEMPLATE_CLEAR
clear template
Definition: GUIAppEnum.h:218
#define GUIDesignButton
Definition: GUIDesigns.h:68
#define GUIDesignTextField
Definition: GUIDesigns.h:42
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:343
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:217
#define GUIDesignDialogBox
Definition: GUIDesigns.h:527
#define GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:74
#define GUIDesignButtonIconRectangular
button only with icon
Definition: GUIDesigns.h:80
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:60
#define GUIDesignButtonOK
Definition: GUIDesigns.h:124
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:145
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:395
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:244
@ MODEADDITIONAL
@ BIGARROWLEFT
@ FRONTELEMENT
@ VARIABLESPEEDSIGN
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:290
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_LANECALIBRATOR
A calibrator placed over lane (used in netedit)
@ SUMO_TAG_LANE
begin/end of the description of a single 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
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ 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
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void setACParameters(const std::string &parameters, GNEUndoList *undoList)
set parameters (string)
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
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
virtual std::string getAttribute(SumoXMLAttr key) const =0
Dialog for edit calibrators.
void show()
show delete frame
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
void showAttributeEditorModule(bool includeExtended, bool forceAttributeEnabled)
show attributes of multiple ACs
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
static bool isSupermodeValid(const GNEViewNet *viewNet, const GNEAttributeCarrier *AC)
return true if AC can be edited in the current supermode
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:102
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:133
FXLabel * getFrameHeaderLabel() const
get the label for the frame's header
Definition: GNEFrame.cpp:139
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:114
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:117
virtual void show()
show Frame
Definition: GNEFrame.cpp:108
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:117
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
Definition: GNEFrame.h:123
void hideHierarchicalElementTree()
hide HierarchicalElementTree
void refreshHierarchicalElementTree()
refresh HierarchicalElementTree
void showHierarchicalElementTree(GNEAttributeCarrier *AC)
show HierarchicalElementTree
void showOverlappedInspection(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
show template editor
void hideOverlappedInspection()
hide template editor
bool previousElement(const Position &clickedPosition)
try to go to previous element if clicked position is near to saved position
bool nextElement(const Position &clickedPosition)
try to go to next element if clicked position is near to saved position
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
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 hideNeteditAttributesEditor()
hide netedit attributes editor
void showNeteditAttributesEditor()
show netedit attributes editor
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
long onCmdEditParameters(FXObject *, FXSelector, void *)
void showParametersEditor()
show netedit attributes EditorInspector
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
FXTextField * myTextFieldParameters
text field for write parameters
GNEInspectorFrame * getInspectorFrameParent() const
get inspector frame parent
void refreshParametersEditor()
refresh netedit attributes
ParametersEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
void hideParametersEditor()
hide netedit attributes EditorInspector
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 showTemplateEditor()
show template editor
long onCmdClearTemplate(FXObject *, FXSelector, void *)
clear current edge template
NeteditAttributesEditor * myNeteditAttributesEditor
Netedit Attributes editor.
GNEFrameModules::OverlappedInspection * myOverlappedInspection
Overlapped Inspection.
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.
GNEInspectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
void selectedOverlappedElement(GNEAttributeCarrier *AC)
open AttributesCreator extended dialog (can be reimplemented in frame children)
TemplateEditor * getTemplateEditor() const
get template editor
void clearInspectedAC()
Clear all current inspected ACs.
long onCmdGoBack(FXObject *, FXSelector, void *)
called when user toggle the go back button
bool processDataSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet in Supermode Data
void show()
show inspector frame
GEOAttributesEditor * myGEOAttributesEditor
GEO Attributes editor.
ParametersEditor * myParametersEditor
Parameters editor inspector.
GNEAttributeCarrier * myPreviousElementInspect
Pointer to previous element called by Inspector Frame.
void attributeUpdated()
function called after set a valid attribute in AttributeEditor
bool myPreviousElementDeleteWasMarked
flag to ckec if myPreviousElementDelete was marked in Delete Frame
GNEFrameModules::HierarchicalElementTree * getHierarchicalElementTree() const
get HierarchicalElementTree modul
void inspectClickedElement(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
FOX need this.
AdditionalDialog * myAdditionalDialog
Additional dialog.
void hide()
hide inspector frame
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
GNEFrameModules::OverlappedInspection * getOverlappedInspection() const
get OverlappedInspection modul
GNEInspectorFrame::NeteditAttributesEditor * getNeteditAttributesEditor() const
get Netedit Attributes editor
FXButton * myBackButton
Back Button.
bool processNetworkSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet in Supermode Network
void inspectMultisection(const std::vector< GNEAttributeCarrier * > &ACs)
Inspect the given multi-selection.
~GNEInspectorFrame()
Destructor.
TemplateEditor * myTemplateEditor
Template editor.
GNEFrameModules::HierarchicalElementTree * myHierarchicalElementTree
Attribute Carrier Hierarchy.
bool processDemandSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet in Supermode Demand
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame (can be reimplemented in frame children)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
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:125
Dialog for edit rerouters.
Dialog for edit parameters.
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
bool hasParameters() const
return true if Tag correspond to an element that supports parameters "key1=value1|key2=value2|....
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isObjectLocked(GUIGlObjectType objectType, const bool selected) const
check if given GLObject is locked for inspect, select, delete and move
class used to group all variables related with objects under cursor after a click over view
GNEGenericData * getGenericDataElementFront() const
get generic data element or a pointer to nullptr
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier or a pointer to nullptr
GUIGlObjectType getGlTypeFront() const
get front GUI GL object type or a pointer to nullptr
GNEDemandElement * getDemandElementFront() const
get front demand element or a pointer to nullptr
GNENet * getNet() const
get the net object
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed modul
Definition: GNEViewNet.cpp:543
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
GNEViewParent * getViewParent() const
get the net object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
GNEViewNetHelper::LockManager & getLockManager()
get lock manager
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
Definition: GNEViewNet.cpp:372
void setInspectedAttributeCarriers(const std::vector< GNEAttributeCarrier * > ACs)
set inspected attributeCarrier
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
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...
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
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 controlKeyPressed() const
check if CONTROL is pressed during current event
bool selectEdges() const
check if select edges checkbox is enabled