SUMO - Simulation of Urban MObility
GNEInspectorFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // The Widget for modifying network-element attributes (i.e. lane speed)
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #ifdef HAVE_VERSION_H
32 #include <version.h>
33 #endif
34 
35 #include <iostream>
36 #include <cassert>
37 #include <cmath>
50 
51 #include "GNEAdditional.h"
52 #include "GNEAdditionalFrame.h"
53 #include "GNEAttributeCarrier.h"
54 #include "GNEChange_Selection.h"
55 #include "GNEConnection.h"
56 #include "GNECrossing.h"
57 #include "GNEDeleteFrame.h"
58 #include "GNEEdge.h"
59 #include "GNEInspectorFrame.h"
60 #include "GNEJunction.h"
61 #include "GNELane.h"
62 #include "GNENet.h"
63 #include "GNEPOI.h"
64 #include "GNEPoly.h"
65 #include "GNEUndoList.h"
66 #include "GNEViewNet.h"
67 #include "GNEViewParent.h"
68 
69 #ifdef CHECK_MEMORY_LEAKS
70 #include <foreign/nvwa/debug_new.h>
71 #endif // CHECK_MEMORY_LEAKS
72 
73 
74 // ===========================================================================
75 // static
76 // ===========================================================================
77 
79 
80 // ===========================================================================
81 // FOX callback mapping
82 // ===========================================================================
83 
84 FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[] = {
90  FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, MID_GNE_CHILDS, GNEInspectorFrame::onCmdShowChildMenu),
94 };
95 
96 
97 FXDEFMAP(GNEInspectorFrame::AttrInput) AttrInputMap[] = {
100 };
101 
102 FXDEFMAP(GNEInspectorFrame::AttrEditor) AttrEditorMap[] = {
104 };
105 
106 // Object implementation
107 FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
108 FXIMPLEMENT(GNEInspectorFrame::AttrInput, FXMatrix, AttrInputMap, ARRAYNUMBER(AttrInputMap))
109 FXIMPLEMENT(GNEInspectorFrame::AttrEditor, FXDialogBox, AttrEditorMap, ARRAYNUMBER(AttrEditorMap))
110 
111 // ===========================================================================
112 // method definitions
113 // ===========================================================================
114 
115 GNEInspectorFrame::GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
116  GNEFrame(horizontalFrameParent, viewNet, "Inspector"),
117  myEdgeTemplate(NULL),
118  myAdditional(NULL),
119  myPreviousElementInspect(NULL),
120  myPreviousElementDelete(NULL) {
121 
122  // Create back button
123  myBackButton = new FXButton(myHeaderLeftFrame, "", GUIIconSubSys::getIcon(ICON_NETEDITARROW), this, MID_GNE_INSPECT_GOBACK, GUIDesignButtonHelp);
124  myHeaderLeftFrame->hide();
125  myBackButton->hide();
126 
127  // Create groupBox for attributes
128  myGroupBoxForAttributes = new FXGroupBox(myContentFrame, "attributes", GUIDesignGroupBoxFrame);
129  myGroupBoxForAttributes->hide();
130 
131  // Create AttrInput
132  for (int i = 0; i < (int)GNEAttributeCarrier::getHigherNumberOfAttributes(); i++) {
133  vectorOfAttrInput.push_back(new AttrInput(myGroupBoxForAttributes, this));
134  }
135 
136  // Create groupBox for editor parameters
137  myGroupBoxForEditor = new FXGroupBox(myContentFrame, "editor", GUIDesignGroupBoxFrame);
138  myGroupBoxForEditor->hide();
139 
140  // Create check blocked button
141  myCheckBlocked = new FXMenuCheck(myGroupBoxForEditor, "Block movement", this, MID_GNE_SET_BLOCKING, GUIDesignMenuCheck);
142  myCheckBlocked->hide();
143 
144  // Create groupbox and tree list
145  myGroupBoxForTreeList = new FXGroupBox(myContentFrame, "Childs", GUIDesignGroupBoxFrame);
146  myTreelist = new FXTreeList(myGroupBoxForTreeList, this, MID_GNE_CHILDS, GUIDesignTreeListFrame);
147  myGroupBoxForTreeList->hide();
148 
149  // Create groupBox for templates
150  myGroupBoxForTemplates = new FXGroupBox(myContentFrame, "Templates", GUIDesignGroupBoxFrame);
151  myGroupBoxForTemplates->hide();
152 
153  // Create copy template button
154  myCopyTemplateButton = new FXButton(myGroupBoxForTemplates, "", 0, this, MID_GNE_COPY_TEMPLATE, GUIDesignButton);
155  myCopyTemplateButton->hide();
156 
157  // Create set template button
158  mySetTemplateButton = new FXButton(myGroupBoxForTemplates, "Set as Template\t\t", 0, this, MID_GNE_SET_TEMPLATE, GUIDesignButton);
159  mySetTemplateButton->hide();
160 }
161 
163  if (myEdgeTemplate) {
164  myEdgeTemplate->decRef("GNEInspectorFrame::~GNEInspectorFrame");
165  if (myEdgeTemplate->unreferenced()) {
166  delete myEdgeTemplate;
167  }
168  }
169 }
170 
171 
172 void
174  inspectElement(NULL);
175  GNEFrame::show();
176 }
177 
178 
179 void
181  // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
182  std::vector<GNEAttributeCarrier*> itemToInspect;
183  if (AC != NULL) {
184  itemToInspect.push_back(AC);
185  }
186  inspectMultisection(itemToInspect);
187 }
188 
189 
190 void
191 GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
192  // hide back button
193  myHeaderLeftFrame->hide();
194  myBackButton->hide();
195  // Assing ACs to myACs
196  myACs = ACs;
197  // Hide all elements
198  myGroupBoxForAttributes->hide();
199  myGroupBoxForTemplates->hide();
200  myCopyTemplateButton->hide();
201  mySetTemplateButton->hide();
202  myGroupBoxForEditor->hide();
203  myGroupBoxForEditor->hide();
204  myCheckBlocked->hide();
205  myGroupBoxForTreeList->hide();
206  // If vector of attribute Carriers contain data
207  if (myACs.size() > 0) {
208  // Set header
209  std::string headerString;
210  if (myACs.size() > 1) {
211  headerString = "Selection: " + toString(myACs.size()) + " " + toString(myACs.front()->getTag()) + "s";
212  } else {
213  if (dynamic_cast<GNENetElement*>(myACs.front())) {
214  headerString = "Net: " + toString(myACs.front()->getTag());
215  } else if (dynamic_cast<GNEAdditional*>(myACs.front())) {
216  headerString = "Additional: " + toString(myACs.front()->getTag());
217  }
218  }
219  // Set headerString into header label
220  getFrameHeaderLabel()->setText(headerString.c_str());
221 
222  //Show myGroupBoxForAttributes
223  myGroupBoxForAttributes->show();
224 
225  // Hide all AttrInput
226  for (std::vector<GNEInspectorFrame::AttrInput*>::iterator i = vectorOfAttrInput.begin(); i != vectorOfAttrInput.end(); i++) {
227  (*i)->hideAttribute();
228  }
229 
230  // Gets tag and attributes of element
231  SumoXMLTag tag = myACs.front()->getTag();
232  const std::vector<SumoXMLAttr>& attrs = myACs.front()->getAttrs();
233 
234  // Declare iterator over AttrImput
235  std::vector<GNEInspectorFrame::AttrInput*>::iterator itAttrs = vectorOfAttrInput.begin();
236 
237  // Iterate over attributes
238  for (std::vector<SumoXMLAttr>::const_iterator it = attrs.begin(); it != attrs.end(); it++) {
239  if (myACs.size() > 1 && GNEAttributeCarrier::isUnique(tag, *it)) {
240  // disable editing for some attributes in case of multi-selection
241  // even displaying is problematic because of string rendering restrictions
242  continue;
243  }
244  // Declare a set of occuring values and insert attribute's values of item
245  std::set<std::string> occuringValues;
246  for (std::vector<GNEAttributeCarrier*>::const_iterator it_ac = myACs.begin(); it_ac != myACs.end(); it_ac++) {
247  occuringValues.insert((*it_ac)->getAttribute(*it));
248  }
249  // get current value
250  std::ostringstream oss;
251  for (std::set<std::string>::iterator it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
252  if (it_val != occuringValues.begin()) {
253  oss << " ";
254  }
255  oss << *it_val;
256  }
257  // Show attribute
258  (*itAttrs)->showAttribute(myACs.front()->getTag(), *it, oss.str());
259  itAttrs++;
260  }
261 
262  // If attributes correspond to an Additional
263  if (dynamic_cast<GNEAdditional*>(myACs.front())) {
264  // Get pointer to additional
265  myAdditional = dynamic_cast<GNEAdditional*>(myACs.front());
266  bool showGroupBoxForEditor = false;
267 
268  // Show check blocked if additional is movable
271  myCheckBlocked->show();
272  showGroupBoxForEditor = true;
273  }
274  // Show groupBox for editor Attributes if some of additional attributes are editable
275  if (showGroupBoxForEditor == true) {
276  myGroupBoxForEditor->show();
277  }
278  }
279 
280  // if we inspect a single Attribute carrier vector, show their childs
281  if (myACs.size() == 1) {
283  }
284 
285  // If attributes correspond to an Edge
286  if (dynamic_cast<GNEEdge*>(myACs.front())) {
287  // show groupBox for templates
288  myGroupBoxForTemplates->show();
289  // show "Copy Template" (caption supplied via onUpdate)
290  myCopyTemplateButton->show();
291  // show "Set As Template"
292  if (myACs.size() == 1) {
293  mySetTemplateButton->show();
294  }
295  }
296  } else {
297  getFrameHeaderLabel()->setText("No Object selected");
298  myContentFrame->recalc();
299  }
300 }
301 
302 
303 void
305  // Show back button if myPreviousElementInspect was defined
306  myPreviousElementInspect = previousElement;
307  if (myPreviousElementInspect != NULL) {
308  // disable myPreviousElementDelete to avoid inconsistences
310  inspectElement(AC);
311  myHeaderLeftFrame->show();
312  myBackButton->show();
313  }
314 }
315 
316 
317 void GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
318  myPreviousElementDelete = previousElement;
319  myPreviousElementDeleteWasMarked = previousElementWasMarked;
320  // Show back button if myPreviousElementDelete is valid
321  if (myPreviousElementDelete != NULL) {
322  // disable myPreviousElementInspect to avoid inconsistences
324  inspectElement(AC);
325  myHeaderLeftFrame->show();
326  myBackButton->show();
327  }
328 }
329 
330 
331 GNEEdge*
333  return myEdgeTemplate;
334 }
335 
336 
337 void
339  if (myEdgeTemplate) {
340  myEdgeTemplate->decRef("GNEInspectorFrame::setEdgeTemplate");
341  if (myEdgeTemplate->unreferenced()) {
342  delete myEdgeTemplate;
343  }
344  }
345  myEdgeTemplate = tpl;
346  myEdgeTemplate->incRef("GNEInspectorFrame::setEdgeTemplate");
347 }
348 
349 
350 long
351 GNEInspectorFrame::onCmdCopyTemplate(FXObject*, FXSelector, void*) {
352  for (std::vector<GNEAttributeCarrier*>::iterator it = myACs.begin(); it != myACs.end(); it++) {
353  GNEEdge* edge = dynamic_cast<GNEEdge*>(*it);
354  assert(edge);
357  }
358  return 1;
359 }
360 
361 
362 long
363 GNEInspectorFrame::onCmdSetTemplate(FXObject*, FXSelector, void*) {
364  assert(myACs.size() == 1);
365  GNEEdge* edge = dynamic_cast<GNEEdge*>(myACs.front());
366  assert(edge);
367  setEdgeTemplate(edge);
368  return 1;
369 }
370 
371 
372 long
373 GNEInspectorFrame::onUpdCopyTemplate(FXObject* sender, FXSelector, void*) {
374  FXString caption;
375  if (myEdgeTemplate) {
376  caption = ("Copy '" + myEdgeTemplate->getMicrosimID() + "'").c_str();
377  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), NULL);
378  } else {
379  caption = "No Template Set";
380  sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), NULL);
381  }
382  sender->handle(this, FXSEL(SEL_COMMAND, FXLabel::ID_SETSTRINGVALUE), (void*)&caption);
383  return 1;
384 }
385 
386 
387 long
388 GNEInspectorFrame::onCmdSetBlocking(FXObject*, FXSelector, void*) {
389  if (myAdditional) {
390  if (myCheckBlocked->getCheck() == 1) {
391  myAdditional->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "true", getViewNet()->getUndoList());
392  } else {
393  myAdditional->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "false", getViewNet()->getUndoList());
394  }
395  }
396  return 1;
397 }
398 
399 
400 long
401 GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
402  // Inspect previous element or go back to Delete Frame
406  } else if (myPreviousElementDelete != NULL) {
410  }
412  // Hide inspect frame and show delete frame
413  hide();
415  }
416  return 1;
417 }
418 
419 
420 const std::vector<GNEAttributeCarrier*>&
422  return myACs;
423 }
424 
425 
426 long
427 GNEInspectorFrame::onCmdShowChildMenu(FXObject*, FXSelector, void* data) {
428  // Obtain event
429  FXEvent* e = (FXEvent*) data;
430  FXTreeItem* item = myTreelist->getItemAt(e->win_x, e->win_y);
431  // Check if there are an item in the position and create pop-up menu
432  if (item && (myTreeItesmWithoutAC.find(item) == myTreeItesmWithoutAC.end())) {
433  createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[myTreelist->getItemAt(e->win_x, e->win_y)]);
434  }
435  return 1;
436 }
437 
438 
439 long
440 GNEInspectorFrame::onCmdCenterItem(FXObject*, FXSelector, void*) {
441  if (dynamic_cast<GNENetElement*>(myRightClickedAC)) {
442  myViewNet->centerTo(dynamic_cast<GNENetElement*>(myRightClickedAC)->getGlID(), false);
443  } else if (dynamic_cast<GNEAdditional*>(myRightClickedAC)) {
444  myViewNet->centerTo(dynamic_cast<GNEAdditional*>(myRightClickedAC)->getGlID(), false);
445  } else if (dynamic_cast<GNEPOI*>(myRightClickedAC)) {
446  myViewNet->centerTo(dynamic_cast<GNEPOI*>(myRightClickedAC)->getGlID(), false);
447  } else if (dynamic_cast<GNEPoly*>(myRightClickedAC)) {
448  myViewNet->centerTo(dynamic_cast<GNEPoly*>(myRightClickedAC)->getGlID(), false);
449  }
450  myViewNet->update();
451  return 1;
452 }
453 
454 
455 long
456 GNEInspectorFrame::onCmdInspectItem(FXObject*, FXSelector, void*) {
457  assert(myACs.size() == 1);
459  return 1;
460 }
461 
462 
463 long
464 GNEInspectorFrame::onCmdDeleteItem(FXObject*, FXSelector, void*) {
465  // Remove Attribute Carrier
469  // show again childs of attribute carrier
471  return 1;
472 }
473 
474 
475 void
477  // create FXMenuPane
478  FXMenuPane* pane = new FXMenuPane(myTreelist);
479  // set current clicked AC
480  myRightClickedAC = ac;
481  // set name
483  new FXMenuSeparator(pane);
484  // Fill FXMenuCommand
485  new FXMenuCommand(pane, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_GNE_INSPECTFRAME_CENTER);
486  new FXMenuCommand(pane, "Inspect", GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_INSPECTFRAME_INSPECT);
487  new FXMenuCommand(pane, "Delete", GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_INSPECTFRAME_DELETE);
488  // Center in the mouse position and create pane
489  pane->setX(X);
490  pane->setY(Y);
491  pane->create();
492  pane->show();
493 }
494 
495 
496 void
498  // Only show attributes of ONE attribute carrier
499  assert(myACs.size() == 1);
500  // clear items
501  myTreelist->clearItems();
502  myTreeItemToACMap.clear();
503  myTreeItesmWithoutAC.clear();
504  myGroupBoxForTreeList->show();
505  // Switch gl type of ac
506  switch (dynamic_cast<GUIGlObject*>(myACs.front())->getType()) {
507  case GLO_JUNCTION: {
508  // insert junction root
509  GNEJunction* junction = dynamic_cast<GNEJunction*>(myACs.front());
510  FXTreeItem* junctionItem = myTreelist->insertItem(0, 0, toString(junction->getTag()).c_str(), junction->getIcon(), junction->getIcon());
511  myTreeItemToACMap[junctionItem] = junction;
512  junctionItem->setExpanded(true);
513  // insert edges
514  for (int i = 0; i < (int)junction->getGNEEdges().size(); i++) {
515  GNEEdge* edge = junction->getGNEEdges().at(i);
516  FXTreeItem* edgeItem = myTreelist->insertItem(0, junctionItem, (toString(edge->getTag()) + " " + toString(i)).c_str(), edge->getIcon(), edge->getIcon());
517  myTreeItemToACMap[edgeItem] = edge;
518  edgeItem->setExpanded(true);
519  // insert lanes
520  for (int j = 0; j < (int)edge->getLanes().size(); j++) {
521  GNELane* lane = edge->getLanes().at(j);
522  FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(j)).c_str(), lane->getIcon(), lane->getIcon());
523  myTreeItemToACMap[laneItem] = lane;
524  laneItem->setExpanded(true);
525  // insert additionals of lanes
526  for (int k = 0; k < (int)lane->getAdditionalChilds().size(); k++) {
527  GNEAdditional* additional = lane->getAdditionalChilds().at(k);
528  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(k)).c_str(), additional->getIcon(), additional->getIcon());
529  myTreeItemToACMap[additionalItem] = additional;
530  additionalItem->setExpanded(true);
531  }
532  // insert incoming connections of lanes (by default isn't expanded)
533  if (lane->getGNEIncomingConnections().size() > 0) {
534  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
535  myTreeItesmWithoutAC.insert(incomingConnections);
536  incomingConnections->setExpanded(false);
537  for (int k = 0; k < (int)lane->getGNEIncomingConnections().size(); k++) {
538  GNEConnection* connection = lane->getGNEIncomingConnections().at(k);
539  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon());
540  myTreeItemToACMap[connectionItem] = connection;
541  connectionItem->setExpanded(true);
542  }
543  }
544  // insert outcoming connections of lanes (by default isn't expanded)
545  if (lane->getGNEOutcomingConnections().size() > 0) {
546  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
547  myTreeItesmWithoutAC.insert(outgoingConnections);
548  outgoingConnections->setExpanded(false);
549  for (int k = 0; k < (int)lane->getGNEOutcomingConnections().size(); k++) {
550  GNEConnection* connection = lane->getGNEOutcomingConnections().at(k);
551  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon());
552  myTreeItemToACMap[connectionItem] = connection;
553  connectionItem->setExpanded(true);
554  }
555  }
556  }
557  // insert additionals of edge
558  for (int j = 0; j < (int)edge->getAdditionalChilds().size(); j++) {
559  GNEAdditional* additional = edge->getAdditionalChilds().at(j);
560  FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon());
561  myTreeItemToACMap[additionalItem] = additional;
562  additionalItem->setExpanded(true);
563  }
564 
565  }
566  // insert crossings
567  for (int i = 0; i < (int)junction->getGNECrossings().size(); i++) {
568  GNECrossing* crossing = junction->getGNECrossings().at(i);
569  FXTreeItem* crossingItem = myTreelist->insertItem(0, junctionItem, (toString(crossing->getTag()) + " " + toString(i)).c_str(), crossing->getIcon(), crossing->getIcon());
570  myTreeItemToACMap[crossingItem] = crossing;
571  crossingItem->setExpanded(true);
572  }
573  break;
574  }
575  case GLO_EDGE: {
576  // insert edge root
577  GNEEdge* edge = dynamic_cast<GNEEdge*>(myACs.front());
578  FXTreeItem* edgeItem = myTreelist->insertItem(0, 0, toString(edge->getTag()).c_str(), edge->getIcon(), edge->getIcon());
579  myTreeItemToACMap[edgeItem] = edge;
580  edgeItem->setExpanded(true);
581  // insert lanes
582  for (int i = 0; i < (int)edge->getLanes().size(); i++) {
583  GNELane* lane = edge->getLanes().at(i);
584  FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(i)).c_str(), lane->getIcon(), lane->getIcon());
585  myTreeItemToACMap[laneItem] = lane;
586  laneItem->setExpanded(true);
587  // insert additionals of lanes
588  for (int j = 0; j < (int)lane->getAdditionalChilds().size(); j++) {
589  GNEAdditional* additional = lane->getAdditionalChilds().at(j);
590  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon());
591  myTreeItemToACMap[additionalItem] = additional;
592  additionalItem->setExpanded(true);
593  }
594  // insert incoming connections of lanes (by default isn't expanded)
595  if (lane->getGNEIncomingConnections().size() > 0) {
596  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
597  myTreeItesmWithoutAC.insert(incomingConnections);
598  incomingConnections->setExpanded(false);
599  for (int j = 0; j < (int)lane->getGNEIncomingConnections().size(); j++) {
600  GNEConnection* connection = lane->getGNEIncomingConnections().at(j);
601  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon());
602  myTreeItemToACMap[connectionItem] = connection;
603  connectionItem->setExpanded(true);
604  }
605  }
606  // insert outcoming connections of lanes (by default isn't expanded)
607  if (lane->getGNEOutcomingConnections().size() > 0) {
608  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
609  myTreeItesmWithoutAC.insert(outgoingConnections);
610  outgoingConnections->setExpanded(false);
611  for (int j = 0; j < (int)lane->getGNEOutcomingConnections().size(); j++) {
612  GNEConnection* connection = lane->getGNEOutcomingConnections().at(j);
613  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon());
614  myTreeItemToACMap[connectionItem] = connection;
615  connectionItem->setExpanded(true);
616  }
617  }
618  }
619  // insert additionals of edge
620  for (int i = 0; i < (int)edge->getAdditionalChilds().size(); i++) {
621  GNEAdditional* additional = edge->getAdditionalChilds().at(i);
622  FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon());
623  myTreeItemToACMap[additionalItem] = additional;
624  additionalItem->setExpanded(true);
625  }
626  break;
627  }
628  case GLO_LANE: {
629  // insert lane root
630  GNELane* lane = dynamic_cast<GNELane*>(myACs.front());
631  FXTreeItem* laneItem = myTreelist->insertItem(0, 0, toString(lane->getTag()).c_str(), lane->getIcon(), lane->getIcon());
632  myTreeItemToACMap[laneItem] = lane;
633  laneItem->setExpanded(true);
634  // insert additionals of lanes
635  for (int i = 0; i < (int)lane->getAdditionalChilds().size(); i++) {
636  GNEAdditional* additional = lane->getAdditionalChilds().at(i);
637  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon());
638  myTreeItemToACMap[additionalItem] = additional;
639  additionalItem->setExpanded(true);
640  }
641  // insert incoming connections of lanes (by default isn't expanded)
642  if (lane->getGNEIncomingConnections().size() > 0) {
643  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
644  myTreeItesmWithoutAC.insert(incomingConnections);
645  incomingConnections->setExpanded(false);
646  for (int i = 0; i < (int)lane->getGNEIncomingConnections().size(); i++) {
647  GNEConnection* connection = lane->getGNEIncomingConnections().at(i);
648  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon());
649  myTreeItemToACMap[connectionItem] = connection;
650  connectionItem->setExpanded(true);
651  }
652  }
653  // insert outcoming connections of lanes (by default isn't expanded)
654  if (lane->getGNEOutcomingConnections().size() > 0) {
655  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
656  myTreeItesmWithoutAC.insert(outgoingConnections);
657  outgoingConnections->setExpanded(false);
658  for (int i = 0; i < (int)lane->getGNEOutcomingConnections().size(); i++) {
659  GNEConnection* connection = lane->getGNEOutcomingConnections().at(i);
660  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon());
661  myTreeItemToACMap[connectionItem] = connection;
662  connectionItem->setExpanded(true);
663  }
664  }
665  break;
666  }
667  case GLO_POI: {
668  // insert POI root
669  GNEPOI* POI = dynamic_cast<GNEPOI*>(myACs.front());
670  FXTreeItem* POIItem = myTreelist->insertItem(0, 0, toString(POI->getTag()).c_str(), POI->getIcon(), POI->getIcon());
671  myTreeItemToACMap[POIItem] = POI;
672  POIItem->setExpanded(true);
673  break;
674  }
675  case GLO_POLYGON: {
676  // insert polygon root
677  GNEPoly* polygon = dynamic_cast<GNEPoly*>(myACs.front());
678  FXTreeItem* polygonItem = myTreelist->insertItem(0, 0, toString(polygon->getTag()).c_str(), polygon->getIcon(), polygon->getIcon());
679  myTreeItemToACMap[polygonItem] = polygon;
680  polygonItem->setExpanded(true);
681  break;
682  }
683  case GLO_CROSSING: {
684  // insert crossing root
685  GNECrossing* crossing = dynamic_cast<GNECrossing*>(myACs.front());
686  FXTreeItem* crossingItem = myTreelist->insertItem(0, 0, toString(crossing->getTag()).c_str(), crossing->getIcon(), crossing->getIcon());
687  myTreeItemToACMap[crossingItem] = crossing;
688  crossingItem->setExpanded(true);
689  break;
690  }
691  case GLO_ADDITIONAL: {
692  // insert additional root
693  GNEAdditional* additional = dynamic_cast<GNEAdditional*>(myACs.front());
694  FXTreeItem* additionalItem = myTreelist->insertItem(0, 0, toString(additional->getTag()).c_str(), additional->getIcon(), additional->getIcon());
695  myTreeItemToACMap[additionalItem] = additional;
696  additionalItem->setExpanded(true);
697  break;
698  }
699  case GLO_CONNECTION: {
700  // insert connection root
701  GNEConnection* connection = dynamic_cast<GNEConnection*>(myACs.front());
702  FXTreeItem* connectionItem = myTreelist->insertItem(0, 0, toString(connection->getTag()).c_str(), connection->getIcon(), connection->getIcon());
703  myTreeItemToACMap[connectionItem] = connection;
704  connectionItem->setExpanded(true);
705  break;
706  }
707  default: {
708  myGroupBoxForTreeList->hide();
709  break;
710  }
711  }
712 }
713 
714 // ===========================================================================
715 // AttrInput method definitions
716 // ===========================================================================
717 
718 GNEInspectorFrame::AttrInput::AttrInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent) :
719  FXMatrix(parent, 8, GUIDesignMatrixAttributes),
720  myInspectorFrameParent(inspectorFrameParent),
721  myTag(SUMO_TAG_NOTHING),
722  myAttr(SUMO_ATTR_NOTHING) {
723  // Create and hide ButtonCombinableChoices
724  myButtonCombinableChoices = new FXButton(this, "AttributeButton", 0, this, MID_GNE_OPEN_ATTRIBUTE_EDITOR, GUIDesignButtonAttribute);
726  // Create and hide label
727  myLabel = new FXLabel(this, "attributeLabel", 0, GUIDesignLabelAttribute);
728  myLabel->hide();
729  // Create and hide textField for int attributes
731  myTextFieldInt->hide();
732  // Create and hide textField for real attributes
734  myTextFieldReal->hide();
735  // create and hide spindial for time attributes
736  myTimeSpinDial = new FXSpinner(this, 7, this, MID_GNE_SET_ATTRIBUTE, GUIDesignSpinDialAttribute);
737  myTimeSpinDial->hide();
738  // Create and hide textField for string attributes
740  myTextFieldStrings->hide();
741  // Create and hide ComboBox
743  myChoicesCombo->hide();
744  // Create and hide checkButton
745  myCheckBox = new FXMenuCheck(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignMenuCheckAttribute);
746  myCheckBox->setWidth(20);
747  myCheckBox->hide();
748 }
749 
750 
751 void
753  // Set actual Tag and attribute
754  myTag = tag;
755  myAttr = attr;
756  // ShowLabel
757  myLabel->setText(toString(myAttr).c_str());
758  myLabel->show();
759  // Set field depending of the type of value
761  // set value of checkbox
762  myCheckBox->setCheck(GNEAttributeCarrier::parse<bool>(value));
763  if (myCheckBox->getCheck()) {
764  myCheckBox->setText("True");
765  } else {
766  myCheckBox->setText("False");
767  }
768  myCheckBox->show();
770  // Obtain choices
771  const std::vector<std::string>& choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr);
772  // Check if are combinable coices
773  if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) {
774  // hide label
775  myLabel->hide();
776  // Show button combinable choices
777  myButtonCombinableChoices->setText(toString(myAttr).c_str());
779  // Show string with the values
780  myTextFieldStrings->setText(value.c_str());
781  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
782  myTextFieldStrings->show();
783  } else {
784  // fill comboBox
785  myChoicesCombo->clearItems();
786  for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
787  myChoicesCombo->appendItem(it->c_str());
788  }
789  myChoicesCombo->setNumVisible((int)choices.size());
790  myChoicesCombo->setCurrentItem(myChoicesCombo->findItem(value.c_str()));
791  myChoicesCombo->show();
792  }
794  // show TextField for real values
795  myTextFieldReal->setText(value.c_str());
796  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
797  myTextFieldReal->show();
798  } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) {
799  // Show textField for int attributes
800  myTextFieldInt->setText(value.c_str());
801  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
802  myTextFieldInt->show();
804  // Show myTimeSpinDial for Time attributes
805  myTimeSpinDial->setValue((int)GNEAttributeCarrier::parse<SUMOReal>(value));
806  myTimeSpinDial->setTextColor(FXRGB(0, 0, 0));
807  myTimeSpinDial->show();
808  } else {
809  // In any other case (String, list, etc.), show value as String
810  myTextFieldStrings->setText(value.c_str());
811  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
812  myTextFieldStrings->show();
813  }
814  // Show AttrInput
815  show();
816 }
817 
818 
819 void
821  // Hide all elements
822  myLabel->hide();
823  myTextFieldInt->hide();
824  myTextFieldReal->hide();
825  myTimeSpinDial->hide();
826  myTextFieldStrings->hide();
827  myChoicesCombo->hide();
828  myCheckBox->hide();
830  // hide AttrInput
831  hide();
832 }
833 
834 
837  return myTag;
838 }
839 
840 
843  return myAttr;
844 }
845 
846 
847 long
849  // Open AttrEditor
851  return 1;
852 }
853 
854 
855 long
856 GNEInspectorFrame::AttrInput::onCmdSetAttribute(FXObject*, FXSelector, void*) {
857  // Declare changed value
858  std::string newVal;
859  // First, obtain the string value of the new attribute depending of their type
861  // Set true o false depending of the checBox
862  if (myCheckBox->getCheck()) {
863  myCheckBox->setText("True");
864  newVal = "true";
865  } else {
866  myCheckBox->setText("False");
867  newVal = "false";
868  }
870  // Obtain choices
871  const std::vector<std::string>& choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr);
872  // Check if are combinable coices
873  if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) {
874  // Get value obtained using AttrEditor
875  newVal = myTextFieldStrings->getText().text();
876  } else {
877  // Get value of ComboBox
878  newVal = myChoicesCombo->getText().text();
879  }
881  // Check if default value of attribute must be set
883  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
884  myTextFieldReal->setText(newVal.c_str());
885  } else {
886  // obtain value of myTextFieldReal
887  newVal = myTextFieldReal->getText().text();
888  }
889  } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) {
890  // Check if default value of attribute must be set
891  if (myTextFieldInt->getText().empty() && GNEAttributeCarrier::hasDefaultValue(myTag, myAttr)) {
892  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
893  myTextFieldInt->setText(newVal.c_str());
894  } else {
895  // obtain value of myTextFieldInt
896  newVal = myTextFieldInt->getText().text();
897  }
899  // obtain value of myTimeSpinDial
900  newVal = toString(myTimeSpinDial->getValue());
902  // Check if default value of attribute must be set
904  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
905  myTextFieldStrings->setText(newVal.c_str());
906  } else {
907  // obtain value of myTextFieldStrings
908  newVal = myTextFieldStrings->getText().text();
909  }
910  }
911 
912  // Check if attribute must be changed
913  if (myInspectorFrameParent->getACs().front()->isValid(myAttr, newVal)) {
914  // if its valid for the first AC than its valid for all (of the same type)
915  if (myInspectorFrameParent->getACs().size() > 1) {
916  myInspectorFrameParent->getViewNet()->getUndoList()->p_begin("Change multiple attributes");
917  }
918  // Set new value of attribute in all selected ACs
919  for (std::vector<GNEAttributeCarrier*>::const_iterator it_ac = myInspectorFrameParent->getACs().begin(); it_ac != myInspectorFrameParent->getACs().end(); it_ac++) {
920  (*it_ac)->setAttribute(myAttr, newVal, myInspectorFrameParent->getViewNet()->getUndoList());
921  }
922  // finish change multiple attributes
923  if (myInspectorFrameParent->getACs().size() > 1) {
925  }
926  // If previously value of TextField was red, change color to black
928  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
929  myTextFieldReal->killFocus();
931  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
932  myTextFieldInt->killFocus();
934  myTimeSpinDial->setTextColor(FXRGB(0, 0, 0));
935  myTimeSpinDial->killFocus();
937  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
938  myTextFieldStrings->killFocus();
939  }
940  } else {
941  // IF value of TextField isn't valid, change color to Red depending of type
943  myTextFieldReal->setTextColor(FXRGB(255, 0, 0));
945  myTextFieldInt->setTextColor(FXRGB(255, 0, 0));
947  myTimeSpinDial->setTextColor(FXRGB(255, 0, 0));
949  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
950  }
951  }
952  // Update view net
953  myInspectorFrameParent->getViewNet()->update();
954  return 1;
955 }
956 
957 
958 void
960  FXMatrix::show();
961 }
962 
963 
964 void
966  FXMatrix::hide();
967 }
968 
969 // ===========================================================================
970 // AttrEditor method definitions
971 // ===========================================================================
972 
973 GNEInspectorFrame::AttrEditor::AttrEditor(AttrInput* attrInputParent, FXTextField* textFieldAttr) :
974  FXDialogBox(attrInputParent->getApp(), ("Editing attribute '" + toString(attrInputParent->getAttr()) + "'").c_str(), GUIDesignDialogBox),
975  myAttrInputParent(attrInputParent),
976  myTextFieldAttr(textFieldAttr) {
977  // Create matrix
978  myCheckBoxMatrix = new FXMatrix(this, 2, GUIDesignMatrixAttributes);
979 
980  // Obtain vector with the choices
981  const std::vector<std::string>& choices = GNEAttributeCarrier::discreteChoices(myAttrInputParent->getTag(), myAttrInputParent->getAttr());
982 
983  // Get old value
984  const std::string oldValue = myTextFieldAttr->getText().text();
985 
986  // Resize myVectorOfCheckBox
987  myVectorOfCheckBox.resize(choices.size(), NULL);
988 
989  // Iterate over choices
990  for (int i = 0; i < (int)choices.size(); i++) {
991  // Create checkBox
992  myVectorOfCheckBox.at(i) = new FXMenuCheck(myCheckBoxMatrix, choices.at(i).c_str(), NULL, 0, GUIDesignMenuCheckAttribute);
993  // Set initial value
994  if (oldValue.find(choices.at(i)) != std::string::npos) {
995  myVectorOfCheckBox.at(i)->setCheck(true);
996  }
997  }
998 
999  // Add separator
1000  new FXHorizontalSeparator(this, GUIDesignHorizontalSeparator);
1001 
1002  // Create frame for buttons
1003  frameButtons = new FXHorizontalFrame(this, GUIDesignHorizontalFrame);
1004 
1005  // Create accept button
1006  myAcceptButton = new FXButton(frameButtons, "Accept", 0, this, FXDialogBox::ID_ACCEPT, GUIDesignButtonDialog);
1007 
1008  // Create cancel button
1009  myCancelButton = new FXButton(frameButtons, "Cancel", 0, this, FXDialogBox::ID_CANCEL, GUIDesignButtonDialog);
1010 
1011  // Create reset button
1012  myResetButton = new FXButton(frameButtons, "Reset", 0, this, MID_GNE_MODE_INSPECT_RESET, GUIDesignButtonDialog);
1013 
1014  // Execute dialog to make it modal, and if user press button "accept", save attribute
1015  if (execute()) {
1016  std::vector<std::string> attrSolution;
1017  // Iterate over myVectorOfCheckBox
1018  for (int i = 0; i < (int)myVectorOfCheckBox.size(); i++) {
1019  // If checkBox is cheked, save attribute
1020  if (myVectorOfCheckBox.at(i)->getCheck()) {
1021  attrSolution.push_back(std::string(myVectorOfCheckBox.at(i)->getText().text()));
1022  }
1023  }
1024  // join to string
1025  myTextFieldAttr->setText(joinToString(attrSolution, " ").c_str());
1026  // Set attribute
1028  }
1029 }
1030 
1031 
1033 
1034 
1035 long
1036 GNEInspectorFrame::AttrEditor::onCmdReset(FXObject*, FXSelector, void*) {
1037  // Obtain vector with the choices
1038  const std::vector<std::string>& choices = GNEAttributeCarrier::discreteChoices(myAttrInputParent->getTag(), myAttrInputParent->getAttr());
1039  // Get old value
1040  const std::string oldValue = myTextFieldAttr->getText().text();
1041  // Reset values
1042  for (int i = 0; i < (int)choices.size(); i++) {
1043  if (oldValue.find(choices.at(i)) != std::string::npos) {
1044  myVectorOfCheckBox.at(i)->setCheck(true);
1045  } else {
1046  myVectorOfCheckBox.at(i)->setCheck(false);
1047  }
1048  }
1049  return 1;
1050 }
1051 
1052 /****************************************************************************/
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
Definition: GNEEdge.cpp:447
In GNEInspectFrame, center element.
Definition: GUIAppEnum.h:372
a tl-logic
FXHorizontalFrame * frameButtons
frame for the buttons
SumoXMLTag
Numbers representing SUMO-XML - element names.
In GNEInspectFrame, delete element.
Definition: GUIAppEnum.h:376
#define GUIDesignHorizontalFrame
Definition: GUIDesigns.h:186
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:179
FXComboBox * myChoicesCombo
pointer to combo box choices
GNEInspectorFrame * myInspectorFrameParent
pointer to GNEInspectorFrame parent
static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical of type float
tree list with the childs
Definition: GUIAppEnum.h:362
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
Definition: GUIDesigns.h:69
a polygon
FXTextField * myTextFieldStrings
textField to modify the value of string attributes
void inspectElement(GNEAttributeCarrier *AC)
Inspect a single element.
SumoXMLAttr myAttr
current Attr
virtual void centerTo(GUIGlID id, bool applyZoom, SUMOReal zoomDist=20)
centers to the chosen artifact
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_MODE_DELETE
#define GUIDesignTextFieldAttributeStr
text field extended over the matrix column with thick frame
Definition: GUIDesigns.h:56
static bool isDiscrete(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is Discrete
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
FXGroupBox * myGroupBoxForTemplates
groupBox for templates
void removeAttributeCarrier(GNEAttributeCarrier *ac)
remove attribute carrier (element)
FXButton * myCopyTemplateButton
copy template button
long onCmdReset(FXObject *, FXSelector, void *)
call when user press button reset
#define GUIDesignTextFieldAttributeReal
text field extended over the matrix column with thick frame and limited to real
Definition: GUIDesigns.h:53
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
Definition: GUIDesigns.h:176
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
Definition: GNEPOI.h:51
a connection
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
Definition: GNELane.cpp:730
void hide()
set hide as private function
void show()
set show as private function
copy template
Definition: GUIAppEnum.h:645
SumoXMLTag getTag() const
get current tag
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes ...
SumoXMLTag myTag
current tag
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
long onCmdSetAttribute(FXObject *, FXSelector, void *)
try to set new attribute value
long onCmdCopyTemplate(FXObject *, FXSelector, void *)
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:86
FXTextField * myTextFieldReal
textField to modify the value of real attributes
long onCmdShowChildMenu(FXObject *, FXSelector, void *data)
called when user press right click over an item of list of childs
FXButton * myCancelButton
Button Cancel.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
#define GUIDesignTreeListFrame
Tree list used in frames to represent childs of elements.
Definition: GUIDesigns.h:430
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return list of additionals associated with this edge
Definition: GNEEdge.cpp:968
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:983
FXButton * mySetTemplateButton
set template button
GNEAdditional * myAdditional
pointer to additional element
#define GUIDesignMatrixAttributes
Matrix design extended over Frame and used for represent attributes and their values.
Definition: GUIDesigns.h:201
FXButton * myButtonCombinableChoices
pointer to buttonCombinableChoices
long onCmdOpenAttributeEditor(FXObject *, FXSelector, void *)
open model dialog for more comfortable attribute editing
FXButton * myAcceptButton
Button Accept.
void showAttribute(SumoXMLTag tag, SumoXMLAttr attr, const std::string &value)
show attribute
~GNEInspectorFrame()
Destructor.
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:995
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
go back to the previous element
Definition: GUIAppEnum.h:561
GNEViewNet * myViewNet
the window to inform when the tls is modfied
Definition: GNEFrame.h:92
static const std::vector< std::string > & discreteChoices(SumoXMLTag tag, SumoXMLAttr attr)
return a list of discrete choices for this attribute or an empty vector
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
static bool isInt(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical or type int
long onCmdSetBlocking(FXObject *, FXSelector, void *)
called when user toogle the blocking button
bool myPreviousElementDeleteWasMarked
flag to ckec if myPreviousElementDelete was marked in Delete Frame
void showAttributeCarrierChilds()
show child of current attributeCarrier
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
#define GUIDesignButtonDialog
button with size limited by text, centered over Frame with thick and raise frame
Definition: GUIDesigns.h:72
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:266
std::vector< FXMenuCheck * > myVectorOfCheckBox
vector of Menuchecks
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:101
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:51
FXGroupBox * myGroupBoxForEditor
GropuBox for editor attributes.
static bool hasDefaultValue(SumoXMLTag tag, SumoXMLAttr attr)
check if attribute of an element has a default avlue
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:93
GNEEdge * myEdgeTemplate
the edge template
GNEAttributeCarrier * myRightClickedAC
pointer to current right clicked Attribute Carrier
FXTextField * myTextFieldInt
textField to modify the value of int attributes
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1033
void setEdgeTemplate(GNEEdge *tpl)
seh the template edge (we assume shared responsibility via reference counting)
block movement of a graphic element
invalid attribute
AttrInput * myAttrInputParent
Pointer to AttrInput parent.
attribute blocking
Definition: GUIAppEnum.h:555
#define GUIDesignMenuCheck
Definition: GUIDesigns.h:129
FXFont * getBoldFont()
void markAttributeCarrier(GNEAttributeCarrier *ac)
mark attribute carrier (element)
#define GUIDesignMenuCheckAttribute
MenuCheck button for attributes extended over the matrix column.
Definition: GUIDesigns.h:132
#define GUIDesignSpinDialAttribute
spin dial extended over the matrix column with thick frame
Definition: GUIDesigns.h:289
const std::string getID() const
function to support debugging
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1054
void incRef(const std::string &debugMsg="")
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:125
#define GUIDesignTextFieldAttributeInt
text field extended over the matrix column with thick frame and limited to integers ...
Definition: GUIDesigns.h:50
GNEAttributeCarrier * myPreviousElementInspect
pointer to previous element called by Inspector Frame
long onCmdGoBack(FXObject *, FXSelector, void *)
called when user toogle the go back button
void decRef(const std::string &debugMsg="")
FXButton * myResetButton
Button Reset.
long onCmdInspectItem(FXObject *, FXSelector, void *)
called when user select option "inspect item" of child menu
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
static bool isUnique(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection and don&#39;t have a default valu...
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:59
long onUpdCopyTemplate(FXObject *, FXSelector, void *)
update the copy button with the name of the template
compound additional
FXGroupBox * myGroupBoxForTreeList
groupBox for AttrConnection
FXTreeList * myTreelist
tree list to show the childs of the element to erase
FXMenuCheck * myCheckBox
pointer to menu check
#define GUIDesignButton
Definition: GUIDesigns.h:66
void createPopUpMenu(int X, int Y, GNEAttributeCarrier *ac)
FXIcon * getIcon() const
get FXIcon assigned to this object
GNEAttributeCarrier * myPreviousElementDelete
pointer to previous element called by Delete Frame
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:479
#define GUIDesignButtonHelp
little button for help in frames
Definition: GUIDesigns.h:75
virtual void show()
show Frame
Definition: GNEFrame.cpp:100
#define GUIDesignDialogBox
Definition: GUIDesigns.h:407
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:204
long onCmdDeleteItem(FXObject *, FXSelector, void *)
called when user select option "delte item" of child menu
static bool isBool(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool for a certain tag
long onCmdCenterItem(FXObject *, FXSelector, void *)
called when user select option "center item" of child Menu
GUIMainWindow * getApp() const
get App (GUIMainWindow)
set object as template
Definition: GUIAppEnum.h:643
an edge
FXLabel * getFrameHeaderLabel() const
get the label for the frame&#39;s header
Definition: GNEFrame.cpp:131
void showAttributeCarrierChilds(GNEAttributeCarrier *ac)
show child of attributeCarrier in frame if previously there isn&#39;t a marked element ...
attribute edited
Definition: GUIAppEnum.h:553
static bool discreteCombinableChoices(SumoXMLTag tag, SumoXMLAttr attr)
return whether the given attribute allows for a combination of discrete values
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:109
void show()
show inspector frame
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
const int MAXNUMBEROFATTRCONNECTIONS
SumoXMLTag getTag() const
get XML Tag assigned to this object
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
FXMenuCheck * myCheckBlocked
pointer to menu check block
const std::vector< GNEAttributeCarrier * > & getACs() const
get current list of ACs
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
std::vector< GNEAttributeCarrier * > myACs
the multi-selection currently being inspected
std::set< FXTreeItem * > myTreeItesmWithoutAC
set used to save tree items without AC assigned (for example, Incoming/Outcoming connections) ...
FXLabel * myLabel
pointer to label
void hideAttribute()
show attribute
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the Tree items with their AC
FXButton * myBackButton
back Button
void inspectMultisection(const std::vector< GNEAttributeCarrier * > &ACs)
Inspect the given multi-selection.
long onCmdSetTemplate(FXObject *, FXSelector, void *)
set current edge as new template
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:160
FXSpinner * myTimeSpinDial
SpinDial to modify the value of time attributes
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
In GNEInspectFrame, inspect element.
Definition: GUIAppEnum.h:374
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:188
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
Definition: GNEFrame.h:107
SumoXMLAttr getAttr() const
get current Attr
FXGroupBox * myGroupBoxForAttributes
groupBox for attributes
std::vector< GNEInspectorFrame::AttrInput * > vectorOfAttrInput
list of Attribute inputs
bool isAdditionalMovable() const
check if additional element is movable
a junction