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 #include <iostream>
32 #include <cassert>
33 #include <cmath>
34 #include <regex>
47 
48 #include "GNEAdditional.h"
49 #include "GNEAdditionalFrame.h"
50 #include "GNEAttributeCarrier.h"
51 #include "GNEChange_Selection.h"
52 #include "GNEConnection.h"
53 #include "GNECrossing.h"
54 #include "GNEDeleteFrame.h"
55 #include "GNEEdge.h"
56 #include "GNEInspectorFrame.h"
57 #include "GNEJunction.h"
58 #include "GNELane.h"
59 #include "GNENet.h"
60 #include "GNEPOI.h"
61 #include "GNEPoly.h"
62 #include "GNEUndoList.h"
63 #include "GNEViewNet.h"
64 #include "GNEViewParent.h"
66 
67 
68 // ===========================================================================
69 // FOX callback mapping
70 // ===========================================================================
71 
72 FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[] = {
77  FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, MID_GNE_CHILDS, GNEInspectorFrame::onCmdShowChildMenu),
81 };
82 
83 
84 FXDEFMAP(GNEInspectorFrame::AttributeInput) AttributeInputMap[] = {
87 };
88 
89 
90 FXDEFMAP(GNEInspectorFrame::NeteditParameters) NeteditParameterstMap[] = {
94 };
95 
96 // Object implementation
97 FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
98 FXIMPLEMENT(GNEInspectorFrame::AttributeInput, FXHorizontalFrame, AttributeInputMap, ARRAYNUMBER(AttributeInputMap))
99 FXIMPLEMENT(GNEInspectorFrame::NeteditParameters, FXGroupBox, NeteditParameterstMap, ARRAYNUMBER(NeteditParameterstMap))
100 
101 // ===========================================================================
102 // method definitions
103 // ===========================================================================
104 
105 GNEInspectorFrame::GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
106  GNEFrame(horizontalFrameParent, viewNet, "Inspector"),
107  myEdgeTemplate(NULL),
108  myPreviousElementInspect(NULL),
109  myPreviousElementDelete(NULL) {
110 
111  // Create back button
112  myBackButton = new FXButton(myHeaderLeftFrame, "", GUIIconSubSys::getIcon(ICON_NETEDITARROW), this, MID_GNE_INSPECT_GOBACK, GUIDesignButtonIconRectangular);
113  myHeaderLeftFrame->hide();
114  myBackButton->hide();
115 
116  // Create groupBox for attributes
117  myGroupBoxForAttributes = new FXGroupBox(myContentFrame, "Internal attributes", GUIDesignGroupBoxFrame);
118  myGroupBoxForAttributes->hide();
119 
120  // Create sufficient AttributeInput for all types of AttributeCarriers
121  for (int i = 0; i < (int)GNEAttributeCarrier::getHigherNumberOfAttributes(); i++) {
122  myVectorOfAttributeInputs.push_back(new AttributeInput(myGroupBoxForAttributes, this));
123  }
124 
125  // Create netedit parameters
126  myNeteditParameters = new NeteditParameters(this);
127 
128  // Create groupbox and tree list
129  myGroupBoxForTreeList = new FXGroupBox(myContentFrame, "Childs", GUIDesignGroupBoxFrame);
130  myTreelist = new FXTreeList(myGroupBoxForTreeList, this, MID_GNE_CHILDS, GUIDesignTreeListFrame);
131  myGroupBoxForTreeList->hide();
132 
133  // Create groupBox for templates
134  myGroupBoxForTemplates = new FXGroupBox(myContentFrame, "Templates", GUIDesignGroupBoxFrame);
135  myGroupBoxForTemplates->hide();
136 
137  // Create copy template button
138  myCopyTemplateButton = new FXButton(myGroupBoxForTemplates, "", 0, this, MID_GNE_COPY_TEMPLATE, GUIDesignButton);
139  myCopyTemplateButton->hide();
140 
141  // Create set template button
142  mySetTemplateButton = new FXButton(myGroupBoxForTemplates, "Set as Template\t\t", 0, this, MID_GNE_SET_TEMPLATE, GUIDesignButton);
143  mySetTemplateButton->hide();
144 }
145 
146 
148  if (myEdgeTemplate) {
149  myEdgeTemplate->decRef("GNEInspectorFrame::~GNEInspectorFrame");
150  if (myEdgeTemplate->unreferenced()) {
151  delete myEdgeTemplate;
152  }
153  }
154 }
155 
156 
157 void
159  inspectElement(NULL);
160  GNEFrame::show();
161 }
162 
163 
164 void
166  // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
167  std::vector<GNEAttributeCarrier*> itemToInspect;
168  if (AC != NULL) {
169  itemToInspect.push_back(AC);
170  }
171  inspectMultisection(itemToInspect);
172 }
173 
174 
175 void
176 GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
177  // hide back button
178  myHeaderLeftFrame->hide();
179  myBackButton->hide();
180  // Assing ACs to myACs
181  myACs = ACs;
182  // Hide all elements
183  myGroupBoxForAttributes->hide();
184  myGroupBoxForTemplates->hide();
185  myCopyTemplateButton->hide();
186  mySetTemplateButton->hide();
188  myGroupBoxForTreeList->hide();
189  // If vector of attribute Carriers contain data
190  if (myACs.size() > 0) {
191  // Set header
192  std::string headerString;
193  if (myACs.size() > 1) {
194  headerString = "Selection: " + toString(myACs.size()) + " " + toString(myACs.front()->getTag()) + "s";
195  } else {
196  if (dynamic_cast<GNENetElement*>(myACs.front())) {
197  headerString = "Net: " + toString(myACs.front()->getTag());
198  } else if (dynamic_cast<GNEAdditional*>(myACs.front())) {
199  headerString = "Additional: " + toString(myACs.front()->getTag());
200  } else if (dynamic_cast<GNEShape*>(myACs.front())) {
201  headerString = "Shape: " + toString(myACs.front()->getTag());
202  } else {
203  headerString = toString(myACs.front()->getTag());
204  }
205  }
206  // Set headerString into header label
207  getFrameHeaderLabel()->setText(headerString.c_str());
208 
209  //Show myGroupBoxForAttributes
210  myGroupBoxForAttributes->show();
211 
212  // Hide all AttributeInput
213  for (auto i : myVectorOfAttributeInputs) {
214  i->hideAttribute();
215  }
216 
217  // Gets tag and attributes of element
218  SumoXMLTag ACFrontTag = myACs.front()->getTag();
219  const std::vector<SumoXMLAttr>& ACFrontAttrs = myACs.front()->getAttrs();
220 
221  // Declare iterator over AttrInput
222  std::vector<GNEInspectorFrame::AttributeInput*>::iterator itAttrs = myVectorOfAttributeInputs.begin();
223 
224  // check if current AC is a Junction without TLSs (needed to hidde TLS options)
225  bool disableTLSinJunctions = (dynamic_cast<GNEJunction*>(myACs.front()) && (dynamic_cast<GNEJunction*>(myACs.front())->getNBNode()->getControllingTLS().empty()));
226 
227  // Iterate over attributes
228  for (auto it : ACFrontAttrs) {
229  if (myACs.size() > 1 && GNEAttributeCarrier::isUnique(ACFrontTag, it)) {
230  // disable editing for some attributes in case of multi-selection
231  // even displaying is problematic because of string rendering restrictions
232  continue;
233  }
234  // Declare a set of occuring values and insert attribute's values of item
235  std::set<std::string> occuringValues;
236  for (auto it_ac : myACs) {
237  occuringValues.insert(it_ac->getAttribute(it));
238  }
239  // get current value
240  std::ostringstream oss;
241  for (auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
242  if (it_val != occuringValues.begin()) {
243  oss << " ";
244  }
245  oss << *it_val;
246  }
247  // Show attribute
248  if ((disableTLSinJunctions && (ACFrontTag == SUMO_TAG_JUNCTION) && ((it == SUMO_ATTR_TLTYPE) || (it == SUMO_ATTR_TLID))) == false) {
249  (*itAttrs)->showAttribute(myACs.front()->getTag(), (it), oss.str());
250  }
251  // update attribute iterator
252  itAttrs++;
253  }
254 
255  // show netedit parameters
257 
258  // if we inspect a single Attribute carrier vector, show their childs
259  if (myACs.size() == 1) {
261  }
262 
263  // If attributes correspond to an Edge
264  if (dynamic_cast<GNEEdge*>(myACs.front())) {
265  // show groupBox for templates
266  myGroupBoxForTemplates->show();
267  // show "Copy Template" (caption supplied via onUpdate)
268  myCopyTemplateButton->show();
269  // show "Set As Template"
270  if (myACs.size() == 1) {
271  mySetTemplateButton->show();
272  }
273  }
274  } else {
275  getFrameHeaderLabel()->setText("No Object selected");
276  myContentFrame->recalc();
277  }
278 }
279 
280 
281 void
283  // Show back button if myPreviousElementInspect was defined
284  myPreviousElementInspect = previousElement;
285  if (myPreviousElementInspect != NULL) {
286  // disable myPreviousElementDelete to avoid inconsistences
288  inspectElement(AC);
289  myHeaderLeftFrame->show();
290  myBackButton->show();
291  }
292 }
293 
294 
295 void GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
296  myPreviousElementDelete = previousElement;
297  myPreviousElementDeleteWasMarked = previousElementWasMarked;
298  // Show back button if myPreviousElementDelete is valid
299  if (myPreviousElementDelete != NULL) {
300  // disable myPreviousElementInspect to avoid inconsistences
302  inspectElement(AC);
303  myHeaderLeftFrame->show();
304  myBackButton->show();
305  }
306 }
307 
308 
309 GNEEdge*
311  return myEdgeTemplate;
312 }
313 
314 
315 void
317  if (myEdgeTemplate) {
318  myEdgeTemplate->decRef("GNEInspectorFrame::setEdgeTemplate");
319  if (myEdgeTemplate->unreferenced()) {
320  delete myEdgeTemplate;
321  }
322  }
323  myEdgeTemplate = tpl;
324  myEdgeTemplate->incRef("GNEInspectorFrame::setEdgeTemplate");
325 }
326 
327 
328 long
329 GNEInspectorFrame::onCmdCopyTemplate(FXObject*, FXSelector, void*) {
330  for (auto it : myACs) {
331  GNEEdge* edge = dynamic_cast<GNEEdge*>(it);
332  assert(edge);
334  inspectMultisection(myACs);
335  }
336  return 1;
337 }
338 
339 
340 long
341 GNEInspectorFrame::onCmdSetTemplate(FXObject*, FXSelector, void*) {
342  assert(myACs.size() == 1);
343  GNEEdge* edge = dynamic_cast<GNEEdge*>(myACs.front());
344  assert(edge);
345  setEdgeTemplate(edge);
346  return 1;
347 }
348 
349 
350 long
351 GNEInspectorFrame::onUpdCopyTemplate(FXObject* sender, FXSelector, void*) {
352  FXString caption;
353  if (myEdgeTemplate) {
354  caption = ("Copy '" + myEdgeTemplate->getMicrosimID() + "'").c_str();
355  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), NULL);
356  } else {
357  caption = "No Template Set";
358  sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), NULL);
359  }
360  sender->handle(this, FXSEL(SEL_COMMAND, FXLabel::ID_SETSTRINGVALUE), (void*)&caption);
361  return 1;
362 }
363 
364 
365 long
366 GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
367  // Inspect previous element or go back to Delete Frame
371  } else if (myPreviousElementDelete != NULL) {
375  }
377  // Hide inspect frame and show delete frame
378  hide();
380  }
381  return 1;
382 }
383 
384 
385 const std::vector<GNEAttributeCarrier*>&
387  return myACs;
388 }
389 
390 
391 long
392 GNEInspectorFrame::onCmdShowChildMenu(FXObject*, FXSelector, void* eventData) {
393  // Obtain event
394  FXEvent* e = (FXEvent*) eventData;
395  FXTreeItem* item = myTreelist->getItemAt(e->win_x, e->win_y);
396  // Check if there are an item in the position and create pop-up menu
397  if (item && (myTreeItemsWithoutAC.find(item) == myTreeItemsWithoutAC.end())) {
398  createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[myTreelist->getItemAt(e->win_x, e->win_y)]);
399  }
400  return 1;
401 }
402 
403 
404 long
405 GNEInspectorFrame::onCmdCenterItem(FXObject*, FXSelector, void*) {
406  if (dynamic_cast<GNENetElement*>(myRightClickedAC)) {
407  myViewNet->centerTo(dynamic_cast<GNENetElement*>(myRightClickedAC)->getGlID(), false);
408  } else if (dynamic_cast<GNEAdditional*>(myRightClickedAC)) {
409  myViewNet->centerTo(dynamic_cast<GNEAdditional*>(myRightClickedAC)->getGlID(), false);
410  } else if (dynamic_cast<GNEPOI*>(myRightClickedAC)) {
411  myViewNet->centerTo(dynamic_cast<GNEPOI*>(myRightClickedAC)->getGlID(), false);
412  } else if (dynamic_cast<GNEPoly*>(myRightClickedAC)) {
413  myViewNet->centerTo(dynamic_cast<GNEPoly*>(myRightClickedAC)->getGlID(), false);
414  }
415  myViewNet->update();
416  return 1;
417 }
418 
419 
420 long
421 GNEInspectorFrame::onCmdInspectItem(FXObject*, FXSelector, void*) {
422  assert(myACs.size() == 1);
424  return 1;
425 }
426 
427 
428 long
429 GNEInspectorFrame::onCmdDeleteItem(FXObject*, FXSelector, void*) {
430  // Remove Attribute Carrier
434  // show again childs of attribute carrier
436  return 1;
437 }
438 
439 
440 void
442  // create FXMenuPane
443  FXMenuPane* pane = new FXMenuPane(myTreelist);
444  // set current clicked AC
445  myRightClickedAC = ac;
446  // set name
448  new FXMenuSeparator(pane);
449  // Fill FXMenuCommand
450  new FXMenuCommand(pane, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_GNE_INSPECTFRAME_CENTER);
451  new FXMenuCommand(pane, "Inspect", GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_INSPECTFRAME_INSPECT);
452  new FXMenuCommand(pane, "Delete", GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_INSPECTFRAME_DELETE);
453  // Center in the mouse position and create pane
454  pane->setX(X);
455  pane->setY(Y);
456  pane->create();
457  pane->show();
458 }
459 
460 
461 void
463  // Only show attributes of ONE attribute carrier
464  assert(myACs.size() == 1);
465  // clear items
466  myTreelist->clearItems();
467  myTreeItemToACMap.clear();
468  myTreeItemsWithoutAC.clear();
469  myGroupBoxForTreeList->show();
470  // Switch gl type of ac
471  switch (dynamic_cast<GUIGlObject*>(myACs.front())->getType()) {
472  case GLO_JUNCTION: {
473  // insert junction root
474  GNEJunction* junction = dynamic_cast<GNEJunction*>(myACs.front());
475  FXTreeItem* junctionItem = myTreelist->insertItem(0, 0, toString(junction->getTag()).c_str(), junction->getIcon(), junction->getIcon());
476  myTreeItemToACMap[junctionItem] = junction;
477  junctionItem->setExpanded(true);
478  // insert edges
479  for (int i = 0; i < (int)junction->getGNEEdges().size(); i++) {
480  GNEEdge* edge = junction->getGNEEdges().at(i);
481  FXTreeItem* edgeItem = myTreelist->insertItem(0, junctionItem, (toString(edge->getTag()) + " " + toString(i)).c_str(), edge->getIcon(), edge->getIcon());
482  myTreeItemToACMap[edgeItem] = edge;
483  edgeItem->setExpanded(true);
484  // insert lanes
485  for (int j = 0; j < (int)edge->getLanes().size(); j++) {
486  GNELane* lane = edge->getLanes().at(j);
487  FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(j)).c_str(), lane->getIcon(), lane->getIcon());
488  myTreeItemToACMap[laneItem] = lane;
489  laneItem->setExpanded(true);
490  // insert additionals of lanes
491  for (int k = 0; k < (int)lane->getAdditionalChilds().size(); k++) {
492  GNEAdditional* additional = lane->getAdditionalChilds().at(k);
493  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(k)).c_str(), additional->getIcon(), additional->getIcon());
494  myTreeItemToACMap[additionalItem] = additional;
495  additionalItem->setExpanded(true);
496  }
497  // insert incoming connections of lanes (by default isn't expanded)
498  if (lane->getGNEIncomingConnections().size() > 0) {
499  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
500  myTreeItemsWithoutAC.insert(incomingConnections);
501  incomingConnections->setExpanded(false);
502  for (int k = 0; k < (int)lane->getGNEIncomingConnections().size(); k++) {
503  GNEConnection* connection = lane->getGNEIncomingConnections().at(k);
504  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon());
505  myTreeItemToACMap[connectionItem] = connection;
506  connectionItem->setExpanded(true);
507  }
508  }
509  // insert outcoming connections of lanes (by default isn't expanded)
510  if (lane->getGNEOutcomingConnections().size() > 0) {
511  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
512  myTreeItemsWithoutAC.insert(outgoingConnections);
513  outgoingConnections->setExpanded(false);
514  for (int k = 0; k < (int)lane->getGNEOutcomingConnections().size(); k++) {
515  GNEConnection* connection = lane->getGNEOutcomingConnections().at(k);
516  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon());
517  myTreeItemToACMap[connectionItem] = connection;
518  connectionItem->setExpanded(true);
519  }
520  }
521  }
522  // insert additionals of edge
523  for (int j = 0; j < (int)edge->getAdditionalChilds().size(); j++) {
524  GNEAdditional* additional = edge->getAdditionalChilds().at(j);
525  FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon());
526  myTreeItemToACMap[additionalItem] = additional;
527  additionalItem->setExpanded(true);
528  }
529 
530  }
531  // insert crossings
532  for (int i = 0; i < (int)junction->getGNECrossings().size(); i++) {
533  GNECrossing* crossing = junction->getGNECrossings().at(i);
534  FXTreeItem* crossingItem = myTreelist->insertItem(0, junctionItem, (toString(crossing->getTag()) + " " + toString(i)).c_str(), crossing->getIcon(), crossing->getIcon());
535  myTreeItemToACMap[crossingItem] = crossing;
536  crossingItem->setExpanded(true);
537  }
538  break;
539  }
540  case GLO_EDGE: {
541  // insert edge root
542  GNEEdge* edge = dynamic_cast<GNEEdge*>(myACs.front());
543  FXTreeItem* edgeItem = myTreelist->insertItem(0, 0, toString(edge->getTag()).c_str(), edge->getIcon(), edge->getIcon());
544  myTreeItemToACMap[edgeItem] = edge;
545  edgeItem->setExpanded(true);
546  // insert lanes
547  for (int i = 0; i < (int)edge->getLanes().size(); i++) {
548  GNELane* lane = edge->getLanes().at(i);
549  FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(i)).c_str(), lane->getIcon(), lane->getIcon());
550  myTreeItemToACMap[laneItem] = lane;
551  laneItem->setExpanded(true);
552  // insert additionals of lanes
553  for (int j = 0; j < (int)lane->getAdditionalChilds().size(); j++) {
554  GNEAdditional* additional = lane->getAdditionalChilds().at(j);
555  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon());
556  myTreeItemToACMap[additionalItem] = additional;
557  additionalItem->setExpanded(true);
558  }
559  // insert incoming connections of lanes (by default isn't expanded)
560  if (lane->getGNEIncomingConnections().size() > 0) {
561  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
562  myTreeItemsWithoutAC.insert(incomingConnections);
563  incomingConnections->setExpanded(false);
564  for (int j = 0; j < (int)lane->getGNEIncomingConnections().size(); j++) {
565  GNEConnection* connection = lane->getGNEIncomingConnections().at(j);
566  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon());
567  myTreeItemToACMap[connectionItem] = connection;
568  connectionItem->setExpanded(true);
569  }
570  }
571  // insert outcoming connections of lanes (by default isn't expanded)
572  if (lane->getGNEOutcomingConnections().size() > 0) {
573  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
574  myTreeItemsWithoutAC.insert(outgoingConnections);
575  outgoingConnections->setExpanded(false);
576  for (int j = 0; j < (int)lane->getGNEOutcomingConnections().size(); j++) {
577  GNEConnection* connection = lane->getGNEOutcomingConnections().at(j);
578  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon());
579  myTreeItemToACMap[connectionItem] = connection;
580  connectionItem->setExpanded(true);
581  }
582  }
583  }
584  // insert additionals of edge
585  for (int i = 0; i < (int)edge->getAdditionalChilds().size(); i++) {
586  GNEAdditional* additional = edge->getAdditionalChilds().at(i);
587  FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon());
588  myTreeItemToACMap[additionalItem] = additional;
589  additionalItem->setExpanded(true);
590  }
591  break;
592  }
593  case GLO_LANE: {
594  // insert lane root
595  GNELane* lane = dynamic_cast<GNELane*>(myACs.front());
596  FXTreeItem* laneItem = myTreelist->insertItem(0, 0, toString(lane->getTag()).c_str(), lane->getIcon(), lane->getIcon());
597  myTreeItemToACMap[laneItem] = lane;
598  laneItem->setExpanded(true);
599  // insert additionals of lanes
600  for (int i = 0; i < (int)lane->getAdditionalChilds().size(); i++) {
601  GNEAdditional* additional = lane->getAdditionalChilds().at(i);
602  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon());
603  myTreeItemToACMap[additionalItem] = additional;
604  additionalItem->setExpanded(true);
605  }
606  // insert incoming connections of lanes (by default isn't expanded)
607  if (lane->getGNEIncomingConnections().size() > 0) {
608  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
609  myTreeItemsWithoutAC.insert(incomingConnections);
610  incomingConnections->setExpanded(false);
611  for (int i = 0; i < (int)lane->getGNEIncomingConnections().size(); i++) {
612  GNEConnection* connection = lane->getGNEIncomingConnections().at(i);
613  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon());
614  myTreeItemToACMap[connectionItem] = connection;
615  connectionItem->setExpanded(true);
616  }
617  }
618  // insert outcoming connections of lanes (by default isn't expanded)
619  if (lane->getGNEOutcomingConnections().size() > 0) {
620  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
621  myTreeItemsWithoutAC.insert(outgoingConnections);
622  outgoingConnections->setExpanded(false);
623  for (int i = 0; i < (int)lane->getGNEOutcomingConnections().size(); i++) {
624  GNEConnection* connection = lane->getGNEOutcomingConnections().at(i);
625  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon());
626  myTreeItemToACMap[connectionItem] = connection;
627  connectionItem->setExpanded(true);
628  }
629  }
630  break;
631  }
632  case GLO_POI: {
633  // insert POI root
634  GNEPOI* POI = dynamic_cast<GNEPOI*>(myACs.front());
635  FXTreeItem* POIItem = myTreelist->insertItem(0, 0, toString(POI->getTag()).c_str(), POI->getIcon(), POI->getIcon());
636  myTreeItemToACMap[POIItem] = POI;
637  POIItem->setExpanded(true);
638  break;
639  }
640  case GLO_POLYGON: {
641  // insert polygon root
642  GNEPoly* polygon = dynamic_cast<GNEPoly*>(myACs.front());
643  FXTreeItem* polygonItem = myTreelist->insertItem(0, 0, toString(polygon->getTag()).c_str(), polygon->getIcon(), polygon->getIcon());
644  myTreeItemToACMap[polygonItem] = polygon;
645  polygonItem->setExpanded(true);
646  break;
647  }
648  case GLO_CROSSING: {
649  // insert crossing root
650  GNECrossing* crossing = dynamic_cast<GNECrossing*>(myACs.front());
651  FXTreeItem* crossingItem = myTreelist->insertItem(0, 0, toString(crossing->getTag()).c_str(), crossing->getIcon(), crossing->getIcon());
652  myTreeItemToACMap[crossingItem] = crossing;
653  crossingItem->setExpanded(true);
654  break;
655  }
656  case GLO_ADDITIONAL: {
657  // insert additional root
658  GNEAdditional* additional = dynamic_cast<GNEAdditional*>(myACs.front());
659  FXTreeItem* additionalItem = myTreelist->insertItem(0, 0, toString(additional->getTag()).c_str(), additional->getIcon(), additional->getIcon());
660  myTreeItemToACMap[additionalItem] = additional;
661  additionalItem->setExpanded(true);
662  break;
663  }
664  case GLO_CONNECTION: {
665  // insert connection root
666  GNEConnection* connection = dynamic_cast<GNEConnection*>(myACs.front());
667  FXTreeItem* connectionItem = myTreelist->insertItem(0, 0, toString(connection->getTag()).c_str(), connection->getIcon(), connection->getIcon());
668  myTreeItemToACMap[connectionItem] = connection;
669  connectionItem->setExpanded(true);
670  break;
671  }
672  default: {
673  myGroupBoxForTreeList->hide();
674  break;
675  }
676  }
677 }
678 
679 
680 const std::vector<GNEAttributeCarrier*>&
682  return myACs;
683 }
684 
685 // ===========================================================================
686 // AttributeInput method definitions
687 // ===========================================================================
688 
689 GNEInspectorFrame::AttributeInput::AttributeInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent) :
690  FXHorizontalFrame(parent, GUIDesignAuxiliarHorizontalFrame),
691  myInspectorFrameParent(inspectorFrameParent),
692  myTag(SUMO_TAG_NOTHING),
693  myAttr(SUMO_ATTR_NOTHING) {
694  // Create and hide ButtonCombinableChoices
695  myButtonCombinableChoices = new FXButton(this, "AttributeButton", 0, this, MID_GNE_OPEN_ATTRIBUTE_EDITOR, GUIDesignButtonAttribute);
697  // Create and hide label
698  myLabel = new FXLabel(this, "attributeLabel", 0, GUIDesignLabelAttribute);
699  myLabel->hide();
700  // Create and hide textField for int attributes
702  myTextFieldInt->hide();
703  // Create and hide textField for real/time attributes
705  myTextFieldReal->hide();
706  // Create and hide textField for string attributes
708  myTextFieldStrings->hide();
709  // Create and hide ComboBox
711  myChoicesCombo->hide();
712  // Create and hide checkButton
713  myBoolCheckButton = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute);
714  myBoolCheckButton->hide();
715 }
716 
717 
718 void
720  // Set actual Tag and attribute
721  myTag = ACTag;
722  myAttr = ACAttr;
723  // Show attribute Label
724  myLabel->setText(toString(myAttr).c_str());
725  myLabel->show();
726  // Set field depending of the type of value
728  // this is an special case for inspection of multiple attribute carriers with bools
729  std::vector<bool> boolValues = GNEAttributeCarrier::parse<std::vector<bool> >(value);
730  // set value of checkbox
731  if (boolValues.size() == 1) {
732  myBoolCheckButton->setCheck(boolValues.front());
733  } else {
734  int sum = 0;
735  for (auto i : boolValues) {
736  sum += (int)(i);
737  }
738  // only set true if all checkbox are true
739  if ((sum == 0) || (sum != (int)boolValues.size())) {
740  myBoolCheckButton->setCheck(false);
741  } else {
742  myBoolCheckButton->setCheck(true);
743  }
744  }
745  // set text
746  if (myBoolCheckButton->getCheck()) {
747  myBoolCheckButton->setText("true");
748  } else {
749  myBoolCheckButton->setText("false");
750  }
751  myBoolCheckButton->show();
753  // Obtain choices
754  const std::vector<std::string> choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr);
755  // Check if are combinable coices
756  if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) {
757  // hide label
758  myLabel->hide();
759  // Show button combinable choices
760  myButtonCombinableChoices->setText(toString(myAttr).c_str());
762  // Show string with the values
763  myTextFieldStrings->setText(value.c_str());
764  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
765  myTextFieldStrings->show();
766  } else {
767  // fill comboBox
768  myChoicesCombo->clearItems();
769  for (auto it : choices) {
770  myChoicesCombo->appendItem(it.c_str());
771  }
772  myChoicesCombo->setNumVisible((int)choices.size());
773  myChoicesCombo->setCurrentItem(myChoicesCombo->findItem(value.c_str()));
774  myChoicesCombo->show();
775  }
777  // show TextField for real/time values
778  myTextFieldReal->setText(value.c_str());
779  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
780  myTextFieldReal->show();
781  } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) {
782  // Show textField for int attributes
783  myTextFieldInt->setText(value.c_str());
784  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
785  myTextFieldInt->show();
786  } else {
787  // In any other case (String, list, etc.), show value as String
788  myTextFieldStrings->setText(value.c_str());
789  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
790  myTextFieldStrings->show();
791  }
792  // Show AttributeInput
793  show();
794 }
795 
796 
797 void
799  // Hide all elements
800  myLabel->hide();
801  myTextFieldInt->hide();
802  myTextFieldReal->hide();
803  myTextFieldStrings->hide();
804  myChoicesCombo->hide();
805  myBoolCheckButton->hide();
807  // hide AttributeInput
808  hide();
809 }
810 
811 
812 void
814  // Declare a set of occuring values and insert attribute's values of item
815  std::set<std::string> occuringValues;
816  for (auto it_ac : myInspectorFrameParent->getACs()) {
817  occuringValues.insert(it_ac->getAttribute(myAttr));
818  }
819  // get current value
820  std::ostringstream oss;
821  for (auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
822  if (it_val != occuringValues.begin()) {
823  oss << " ";
824  }
825  oss << *it_val;
826  }
827  // show attribute again
828  showAttribute(myTag, myAttr, oss.str());
829 }
830 
831 
834  return myTag;
835 }
836 
837 
840  return myAttr;
841 }
842 
843 
844 long
846  // obtain vehicles of text field and check if are valid
847  std::string vehicles = myTextFieldStrings->getText().text();
848  // check if values can parse
849  if (canParseVehicleClasses(vehicles) == false) {
850  if (myAttr == SUMO_ATTR_ALLOW) {
851  vehicles = getVehicleClassNames(SVCAll, true);
852  } else {
853  vehicles = "";
854  }
855  }
856  // open GNEDialog_AllowDisallow
857  GNEDialog_AllowDisallow(getApp(), &vehicles).execute();
858  // set obtained vehicles into TextField Strings
859  myTextFieldStrings->setText((vehicles).c_str());
860  onCmdSetAttribute(0, 0, 0);
861  return 1;
862 }
863 
864 
865 long
867  // Declare changed value
868  std::string newVal;
869  // First, obtain the string value of the new attribute depending of their type
871  // Set true o false depending of the checBox
872  if (myBoolCheckButton->getCheck()) {
873  myBoolCheckButton->setText("true");
874  newVal = "true";
875  } else {
876  myBoolCheckButton->setText("false");
877  newVal = "false";
878  }
880  // Obtain choices
881  const std::vector<std::string>& choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr);
882  // Check if are combinable choices (for example, Vehicle Types)
883  if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) {
884  // Get value obtained using AttributeEditor
885  newVal = myTextFieldStrings->getText().text();
886  } else {
887  // Get value of ComboBox
888  newVal = myChoicesCombo->getText().text();
889  }
891  // Check if default value of attribute must be set
893  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
894  myTextFieldReal->setText(newVal.c_str());
895  } else {
896  // obtain value of myTextFieldReal
897  newVal = myTextFieldReal->getText().text();
898  }
899  } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) {
900  // Check if default value of attribute must be set
901  if (myTextFieldInt->getText().empty() && GNEAttributeCarrier::hasDefaultValue(myTag, myAttr)) {
902  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
903  myTextFieldInt->setText(newVal.c_str());
904  } else {
905  // obtain value of myTextFieldInt
906  newVal = myTextFieldInt->getText().text();
907  }
909  // Check if default value of attribute must be set
911  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
912  myTextFieldStrings->setText(newVal.c_str());
913  } else {
914  // obtain value of myTextFieldStrings
915  newVal = myTextFieldStrings->getText().text();
916  }
917  }
918 
919  // we need a extra check for Position and Shape Values, due #2658
920  if ((myAttr == SUMO_ATTR_POSITION) || (myAttr == SUMO_ATTR_SHAPE)) {
921  newVal = stripWhitespaceAfterComma(newVal);
922  }
923 
924  // Check if attribute must be changed
925  if (myInspectorFrameParent->getACs().front()->isValid(myAttr, newVal)) {
926  // if its valid for the first AC than its valid for all (of the same type)
927  if (myInspectorFrameParent->getACs().size() > 1) {
928  myInspectorFrameParent->getViewNet()->getUndoList()->p_begin("Change multiple attributes");
929  }
930  // Set new value of attribute in all selected ACs
931  for (auto it_ac : myInspectorFrameParent->getACs()) {
932  it_ac->setAttribute(myAttr, newVal, myInspectorFrameParent->getViewNet()->getUndoList());
933  }
934  // finish change multiple attributes
935  if (myInspectorFrameParent->getACs().size() > 1) {
937  }
938  // If previously value was incorrect, change font color to black
940  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
941  myTextFieldStrings->killFocus();
942  // in this case, we need to refresh the other opposited value
944  if (((myAttr == SUMO_ATTR_ALLOW) && (i->getAttr() == SUMO_ATTR_DISALLOW)) ||
945  ((myAttr == SUMO_ATTR_DISALLOW) && (i->getAttr() == SUMO_ATTR_ALLOW))) {
946  i->refreshAttribute();
947  }
948  }
950  myChoicesCombo->setTextColor(FXRGB(0, 0, 0));
951  myChoicesCombo->killFocus();
953  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
954  myTextFieldReal->killFocus();
956  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
957  myTextFieldInt->killFocus();
958  } else if (myTextFieldStrings != 0) {
959  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
960  myTextFieldStrings->killFocus();
961  }
962  } else {
963  // If value of TextField isn't valid, change color to Red depending of type
965  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
966  myTextFieldStrings->killFocus();
968  myChoicesCombo->setTextColor(FXRGB(255, 0, 0));
969  myChoicesCombo->killFocus();
971  myTextFieldReal->setTextColor(FXRGB(255, 0, 0));
973  myTextFieldInt->setTextColor(FXRGB(255, 0, 0));
974  } else if (myTextFieldStrings != 0) {
975  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
976  }
977  // Write Warning in console if we're in testing mode
978  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
979  WRITE_WARNING("Value '" + newVal + "' for attribute " + toString(myAttr) + " of " + toString(myTag) + " isn't valid");
980  }
981  }
982  // Update view net
983  myInspectorFrameParent->getViewNet()->update();
984  return 1;
985 }
986 
987 
988 void
990  FXHorizontalFrame::show();
991 }
992 
993 
994 void
996  FXHorizontalFrame::hide();
997 }
998 
999 
1000 std::string
1002  std::string result(stringValue);
1003  while (result.find(", ") != std::string::npos) {
1004  result = StringUtils::replace(result, ", ", ",");
1005  }
1006  return result;
1007 }
1008 
1009 // ===========================================================================
1010 // NeteditParameters method definitions
1011 // ===========================================================================
1012 
1014  FXGroupBox(inspectorFrameParent->myContentFrame, "Netedit attributes", GUIDesignGroupBoxFrame),
1015  myInspectorFrameParent(inspectorFrameParent) {
1016  // Create check box and for block movement
1017  FXHorizontalFrame* blockMovementHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1018  myLabelBlockMovement = new FXLabel(blockMovementHorizontalFrame, "Block move", 0, GUIDesignLabelAttribute);
1019  myCheckBoxBlockMovement = new FXCheckButton(blockMovementHorizontalFrame, "", this, MID_GNE_SET_BLOCKING_MOVEMENT, GUIDesignCheckButtonAttribute);
1020  // Create check box and for block shape
1021  FXHorizontalFrame* blockShapeHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1022  myLabelBlockShape = new FXLabel(blockShapeHorizontalFrame, "Block shape", 0, GUIDesignLabelAttribute);
1023  myCheckBoxBlockShape = new FXCheckButton(blockShapeHorizontalFrame, "", this, MID_GNE_SET_BLOCKING_SHAPE, GUIDesignCheckButtonAttribute);
1024  // Create check box and for close shape
1025  FXHorizontalFrame* closeShapeHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1026  myLabelCloseShape = new FXLabel(closeShapeHorizontalFrame, "Close shape", 0, GUIDesignLabelAttribute);
1027  myCheckBoxCloseShape = new FXCheckButton(closeShapeHorizontalFrame, "", this, MID_GNE_SET_CLOSING_SHAPE, GUIDesignCheckButtonAttribute);
1028 }
1029 
1030 
1032 
1033 
1034 void
1036  // If item can be moved
1038  // show groupBox
1039  FXGroupBox::show();
1040  // Check if all elements have movement blocked
1041  bool movementBlocked = true;
1042  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1043  movementBlocked &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_MOVEMENT));
1044  }
1045  // show block movement
1046  myLabelBlockMovement->show();
1047  myCheckBoxBlockMovement->show();
1048  myCheckBoxBlockMovement->setCheck(movementBlocked);
1049  // update label
1050  if (movementBlocked) {
1051  myCheckBoxBlockMovement->setText("true");
1052  } else {
1053  myCheckBoxBlockMovement->setText("false");
1054  }
1055  }
1056  // check if item can block their shape
1058  // show groupBox
1059  FXGroupBox::show();
1060  // Check if all elements have shape blocked
1061  bool shapeBlocked = true;
1062  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1063  shapeBlocked &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_SHAPE));
1064  }
1065  // show block shape
1066  myLabelBlockShape->show();
1067  myCheckBoxBlockShape->show();
1068  myCheckBoxBlockShape->setCheck(shapeBlocked);
1069  // update label
1070  if (shapeBlocked) {
1071  myCheckBoxBlockShape->setText("true");
1072  } else {
1073  myCheckBoxBlockShape->setText("false");
1074  }
1075  // Check if all elements have shape closed
1076  bool shapeClosed = true;
1077  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1078  shapeClosed &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
1079  }
1080  // show close shape
1081  myLabelCloseShape->show();
1082  myCheckBoxCloseShape->show();
1083  myCheckBoxCloseShape->setCheck(shapeClosed);
1084  // update label
1085  if (shapeClosed) {
1086  myCheckBoxCloseShape->setText("true");
1087  } else {
1088  myCheckBoxCloseShape->setText("false");
1089  }
1090  }
1091 }
1092 
1093 
1094 void
1096  // hide all elements of GroupBox
1097  myLabelBlockMovement->hide();
1098  myCheckBoxBlockMovement->hide();
1099  myLabelBlockShape->hide();
1100  myCheckBoxBlockShape->hide();
1101  myLabelCloseShape->hide();
1102  myCheckBoxCloseShape->hide();
1103  FXGroupBox::hide();
1104 }
1105 
1106 
1107 long
1109  // set new values in all inspected Attribute Carriers
1110  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1111  if (myCheckBoxBlockMovement->getCheck() == 1) {
1112  i->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1113  } else {
1114  i->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1115  }
1116  }
1117  // change text of check box movement
1118  if (myCheckBoxBlockMovement->getCheck() == 1) {
1119  myCheckBoxBlockMovement->setText("true");
1120  } else {
1121  myCheckBoxBlockMovement->setText("false");
1122  }
1123  return 1;
1124 }
1125 
1126 
1127 long
1129  // set new values in all inspected Attribute Carriers
1130  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1131  if (myCheckBoxBlockShape->getCheck() == 1) {
1132  i->setAttribute(GNE_ATTR_BLOCK_SHAPE, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1133  } else {
1134  i->setAttribute(GNE_ATTR_BLOCK_SHAPE, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1135  }
1136  }
1137  // change text of check box shape
1138  if (myCheckBoxBlockShape->getCheck() == 1) {
1139  myCheckBoxBlockShape->setText("true");
1140  } else {
1141  myCheckBoxBlockShape->setText("false");
1142  }
1143  return 1;
1144 }
1145 
1146 
1147 long
1149  // set new values in all inspected Attribute Carriers
1150  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1151  if (myCheckBoxCloseShape->getCheck() == 1) {
1152  i->setAttribute(GNE_ATTR_CLOSE_SHAPE, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1153  } else {
1154  i->setAttribute(GNE_ATTR_CLOSE_SHAPE, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1155  }
1156  }
1157  // change text of check box shape
1158  if (myCheckBoxCloseShape->getCheck() == 1) {
1159  myCheckBoxCloseShape->setText("true");
1160  } else {
1161  myCheckBoxCloseShape->setText("false");
1162  }
1163  return 1;
1164 }
1165 
1166 /****************************************************************************/
go back to the previous element
Definition: GUIAppEnum.h:598
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
Definition: GNEEdge.cpp:567
std::string stripWhitespaceAfterComma(const std::string &stringValue)
removed invalid spaces of Positions and shapes
std::string getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a &#39; &#39;.
a tl-logic
SumoXMLTag
Numbers representing SUMO-XML - element names.
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:197
FXCheckButton * myCheckBoxBlockMovement
pointer to check box "Block movement"
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:117
static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical of type float
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
Definition: GUIDesigns.h:60
FXButton * myButtonCombinableChoices
pointer to buttonCombinableChoices
void show()
set show as private function
a polygon
set object as template
Definition: GUIAppEnum.h:688
void inspectElement(GNEAttributeCarrier *AC)
Inspect a single element.
begin/end of the description of a junction
GNEInspectorFrame * myInspectorFrameParent
pointer to inspector frame parent
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_MODE_DELETE
block shape of a graphic element (Used mainly in GNEShapes)
static bool isDiscrete(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is Discrete
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
void refreshAttribute()
refresh attribute
FXGroupBox * myGroupBoxForTemplates
groupBox for templates
void removeAttributeCarrier(GNEAttributeCarrier *ac)
remove attribute carrier (element)
FXButton * myCopyTemplateButton
copy template button
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
Definition: GUIDesigns.h:193
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
Definition: GNEPOI.h:52
a connection
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
Definition: GNELane.cpp:758
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
Close shape of a polygon (Used by GNEPolys)
link,node: the traffic light id responsible for this link
NeteditParameters * myNeteditParameters
Netedit Parameters.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
void showChildsOfMarkedAttributeCarrier()
show childs of marked attribute carrier
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:85
long onCmdShowChildMenu(FXObject *, FXSelector, void *data)
called when user press right click over an item of list of childs
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
#define GUIDesignTreeListFrame
Tree list used in frames to represent childs of elements.
Definition: GUIDesigns.h:416
FXLabel * myLabelBlockMovement
Label for Check blocked movement.
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return list of additionals associated with this edge
Definition: GNEEdge.cpp:1212
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
attribute close shape
Definition: GUIAppEnum.h:592
const SVCPermissions SVCAll
all VClasses are allowed
FXLabel * myLabelCloseShape
Label for close shape.
GNEViewParent * getViewParent() const
get the net object
FXButton * mySetTemplateButton
set template button
void show()
show NeteditParameters
In GNEInspectFrame, center element.
Definition: GUIAppEnum.h:372
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
attribute block shape
Definition: GUIAppEnum.h:590
~GNEInspectorFrame()
Destructor.
GNEUndoList * getUndoList() const
get the undoList object
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
GNEViewNet * myViewNet
the window to inform when the tls is modfied
Definition: GNEFrame.h:95
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
bool myPreviousElementDeleteWasMarked
flag to ckec if myPreviousElementDelete was marked in Delete Frame
#define GUIDesignButtonIconRectangular
button only with icon (46x23)
Definition: GUIDesigns.h:69
void showAttributeCarrierChilds()
show child of current attributeCarrier
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
void hide()
set hide as private function
attribute edited
Definition: GUIAppEnum.h:586
FXLabel * myLabel
pointer to label
#define GUIDesignTextField
Definition: GUIDesigns.h:41
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:104
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:52
static bool canBlockMovement(SumoXMLTag tag)
return true if element tag can block their movement
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:92
GNEEdge * myEdgeTemplate
the edge template
std::set< FXTreeItem * > myTreeItemsWithoutAC
set used to save tree items without AC assigned (for example, Incoming/Outcoming connections) ...
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
Definition: GUIDesigns.h:244
In GNEInspectFrame, delete element.
Definition: GUIAppEnum.h:376
GNEAttributeCarrier * myRightClickedAC
pointer to current right clicked Attribute Carrier
GNEInspectorFrame * myInspectorFrameParent
pointer to GNEInspectorFrame parent
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
attribute block movement
Definition: GUIAppEnum.h:588
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1091
void setEdgeTemplate(GNEEdge *tpl)
seh the template edge (we assume shared responsibility via reference counting)
block movement of a graphic element
invalid attribute
FXLabel * myLabelBlockShape
Label for Check blocked shape.
FXFont * getBoldFont()
void markAttributeCarrier(GNEAttributeCarrier *ac)
mark attribute carrier (element)
node: the type of traffic light
edge: the shape in xml-definition
long onCmdSetBlockingMovement(FXObject *, FXSelector, void *)
long onCmdSetBlockingShape(FXObject *, FXSelector, void *)
called when user toogle the blocking shape CheckBox
const std::string getID() const
function to support debugging
FXCheckButton * myCheckBoxCloseShape
pointer to check box "Block movement"
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1112
void incRef(const std::string &debugMsg="")
Increarse reference.
Dialog for edit rerouters.
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:123
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="")
Decrease reference.
long onCmdInspectItem(FXObject *, FXSelector, void *)
called when user select option "inspect item" of child menu
FXCheckButton * myCheckBoxBlockShape
pointer to check box "Block Shape"
long onCmdSetClosingShape(FXObject *, FXSelector, void *)
called when user toogle the closiong shape CheckBox
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:58
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:50
long onUpdCopyTemplate(FXObject *, FXSelector, void *)
update the copy button with the name of the template
compound additional
FXGroupBox * myGroupBoxForTreeList
groupBox for AttrConnection
static std::string replace(std::string str, const char *what, const char *by)
void hide()
hide all NeteditParameters
FXTreeList * myTreelist
tree list to show the childs of the element to erase
copy template
Definition: GUIAppEnum.h:690
long onCmdOpenAllowDisallowEditor(FXObject *, FXSelector, void *)
open model dialog for more comfortable attribute editing
#define GUIDesignButton
Definition: GUIDesigns.h:57
void createPopUpMenu(int X, int Y, GNEAttributeCarrier *ac)
FXIcon * getIcon() const
get FXIcon assigned to this object
FXCheckButton * myBoolCheckButton
pointer to menu check
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:599
virtual void show()
show Frame
Definition: GNEFrame.cpp:98
SumoXMLAttr myAttr
current Attr
const std::vector< GNEAttributeCarrier * > & getInspectedACs() const
get reference to current inspected Attribute carriers
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:219
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)
SumoXMLTag getTag() const
get current tag
FXComboBox * myChoicesCombo
pointer to combo box choices
an edge
void showAttribute(SumoXMLTag ACTag, SumoXMLAttr ACAttribute, const std::string &value)
show attribute of ac
FXLabel * getFrameHeaderLabel() const
get the label for the frame&#39;s header
Definition: GNEFrame.cpp:129
std::vector< GNEInspectorFrame::AttributeInput * > myVectorOfAttributeInputs
list of Attribute inputs
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
Definition: GUIDesigns.h:44
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:107
void show()
show inspector frame
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:47
SumoXMLTag getTag() const
get XML Tag assigned to this object
SumoXMLAttr getAttr() const
get current Attr
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
const std::vector< GNEAttributeCarrier * > & getACs() const
get current list of ACs
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
std::vector< GNEAttributeCarrier * > myACs
the multi-selection currently being inspected
tree list with the childs
Definition: GUIAppEnum.h:364
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the Tree items with their AC
In GNEInspectFrame, inspect element.
Definition: GUIAppEnum.h:374
FXTextField * myTextFieldStrings
textField to modify the value of string attributes
FXTextField * myTextFieldInt
textField to modify the value of int attributes
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:165
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
bool unreferenced()
check if object ins&#39;t referenced
static bool canBlockShape(SumoXMLTag tag)
return true if element tag can block their shape
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
Definition: GNEFrame.h:110
FXTextField * myTextFieldReal
textField to modify the value of real/Time attributes
FXGroupBox * myGroupBoxForAttributes
groupBox for attributes
long onCmdSetAttribute(FXObject *, FXSelector, void *)
a junction