SUMO - Simulation of Urban MObility
GNEInspectorFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // The Widget for modifying network-element attributes (i.e. lane speed)
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <iostream>
31 #include <cassert>
32 #include <cmath>
33 #include <regex>
46 
47 #include "GNEAdditional.h"
48 #include "GNEAdditionalFrame.h"
49 #include "GNEAttributeCarrier.h"
50 #include "GNEChange_Selection.h"
51 #include "GNEConnection.h"
52 #include "GNECrossing.h"
53 #include "GNEDeleteFrame.h"
54 #include "GNEEdge.h"
55 #include "GNEInspectorFrame.h"
56 #include "GNEJunction.h"
57 #include "GNELane.h"
58 #include "GNENet.h"
59 #include "GNEPOI.h"
60 #include "GNEPOILane.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[] = {
80  FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, MID_GNE_DELETEFRAME_CHILDS, GNEInspectorFrame::onCmdShowChildMenu),
81 
82 };
83 
84 
85 FXDEFMAP(GNEInspectorFrame::AttributeInput) AttributeInputMap[] = {
88 };
89 
90 
91 FXDEFMAP(GNEInspectorFrame::NeteditParameters) NeteditParameterstMap[] = {
96 };
97 
98 // Object implementation
99 FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
100 FXIMPLEMENT(GNEInspectorFrame::AttributeInput, FXHorizontalFrame, AttributeInputMap, ARRAYNUMBER(AttributeInputMap))
101 FXIMPLEMENT(GNEInspectorFrame::NeteditParameters, FXGroupBox, NeteditParameterstMap, ARRAYNUMBER(NeteditParameterstMap))
102 
103 // ===========================================================================
104 // method definitions
105 // ===========================================================================
106 
107 GNEInspectorFrame::GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
108  GNEFrame(horizontalFrameParent, viewNet, "Inspector"),
109  myEdgeTemplate(NULL),
110  myPreviousElementInspect(NULL),
111  myPreviousElementDelete(NULL) {
112 
113  // Create back button
114  myBackButton = new FXButton(myHeaderLeftFrame, "", GUIIconSubSys::getIcon(ICON_NETEDITARROW), this, MID_GNE_INSPECTORFRAME_GOBACK, GUIDesignButtonIconRectangular);
115  myHeaderLeftFrame->hide();
116  myBackButton->hide();
117 
118  // Create groupBox for attributes
119  myGroupBoxForAttributes = new FXGroupBox(myContentFrame, "Internal attributes", GUIDesignGroupBoxFrame);
120  myGroupBoxForAttributes->hide();
121 
122  // Create sufficient AttributeInput for all types of AttributeCarriers
123  for (int i = 0; i < (int)GNEAttributeCarrier::getHigherNumberOfAttributes(); i++) {
124  myVectorOfAttributeInputs.push_back(new AttributeInput(myGroupBoxForAttributes, this));
125  }
126 
127  // Create GEO Parameters
128  myGEOAttributes = new GNEFrame::GEOAttributes(this);
129 
130  // Create netedit parameters
131  myNeteditParameters = new NeteditParameters(this);
132 
133  // Create groupbox and tree list
134  myGroupBoxForTreeList = new FXGroupBox(myContentFrame, "Childs", GUIDesignGroupBoxFrame);
135  myTreelist = new FXTreeList(myGroupBoxForTreeList, this, MID_GNE_DELETEFRAME_CHILDS, GUIDesignTreeListFrame);
136  myGroupBoxForTreeList->hide();
137 
138  // Create groupBox for templates
139  myGroupBoxForTemplates = new FXGroupBox(myContentFrame, "Templates", GUIDesignGroupBoxFrame);
140  myGroupBoxForTemplates->hide();
141 
142  // Create copy template button
143  myCopyTemplateButton = new FXButton(myGroupBoxForTemplates, "", 0, this, MID_GNE_INSPECTORFRAME_COPYTEMPLATE, GUIDesignButton);
144  myCopyTemplateButton->hide();
145 
146  // Create set template button
147  mySetTemplateButton = new FXButton(myGroupBoxForTemplates, "Set as Template\t\t", 0, this, MID_GNE_INSPECTORFRAME_SETTEMPLATE, GUIDesignButton);
148  mySetTemplateButton->hide();
149 }
150 
151 
153  if (myEdgeTemplate) {
154  myEdgeTemplate->decRef("GNEInspectorFrame::~GNEInspectorFrame");
155  if (myEdgeTemplate->unreferenced()) {
156  delete myEdgeTemplate;
157  }
158  }
159 }
160 
161 
162 void
164  inspectElement(NULL);
165  GNEFrame::show();
166 }
167 
168 
169 void
171  // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
172  std::vector<GNEAttributeCarrier*> itemToInspect;
173  if (AC != NULL) {
174  itemToInspect.push_back(AC);
175  }
176  inspectMultisection(itemToInspect);
177 }
178 
179 
180 void
181 GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
182  // hide back button
183  myHeaderLeftFrame->hide();
184  myBackButton->hide();
185  // Assing ACs to myACs
186  myACs = ACs;
187  // Hide all elements
188  myGroupBoxForAttributes->hide();
189  myGroupBoxForTemplates->hide();
190  myCopyTemplateButton->hide();
191  mySetTemplateButton->hide();
194  myGroupBoxForTreeList->hide();
195  // If vector of attribute Carriers contain data
196  if (myACs.size() > 0) {
197  // Set header
198  std::string headerString;
199  if (dynamic_cast<GNENetElement*>(myACs.front())) {
200  headerString = "Net: ";
201  } else if (dynamic_cast<GNEAdditional*>(myACs.front())) {
202  headerString = "Additional: ";
203  } else if (dynamic_cast<GNEShape*>(myACs.front())) {
204  headerString = "Shape: ";
205  }
206  if (myACs.size() > 1) {
207  headerString += toString(myACs.size()) + " ";
208  }
209  headerString += toString(myACs.front()->getTag());
210  if (myACs.size() > 1) {
211  headerString += "s";
212  }
213  // Set headerString into header label
214  getFrameHeaderLabel()->setText(headerString.c_str());
215 
216  //Show myGroupBoxForAttributes
217  myGroupBoxForAttributes->show();
218 
219  // Hide all AttributeInput
220  for (auto i : myVectorOfAttributeInputs) {
221  i->hideAttribute();
222  }
223 
224  // Gets tag and attributes of element
225  SumoXMLTag ACFrontTag = myACs.front()->getTag();
226  const std::vector<SumoXMLAttr>& ACFrontAttrs = myACs.front()->getAttrs();
227 
228  // Declare iterator over AttrInput
229  std::vector<GNEInspectorFrame::AttributeInput*>::iterator itAttrs = myVectorOfAttributeInputs.begin();
230 
231  // check if current AC is a Junction without TLSs (needed to hidde TLS options)
232  bool disableTLSinJunctions = (dynamic_cast<GNEJunction*>(myACs.front()) && (dynamic_cast<GNEJunction*>(myACs.front())->getNBNode()->getControllingTLS().empty()));
233 
234  // Iterate over attributes
235  for (auto it : ACFrontAttrs) {
236  // disable editing for unique attributes in case of multi-selection
237  if (myACs.size() > 1 && GNEAttributeCarrier::isUnique(ACFrontTag, it)) {
238  continue;
239  }
240  // Declare a set of occuring values and insert attribute's values of item
241  std::set<std::string> occuringValues;
242  for (auto it_ac : myACs) {
243  occuringValues.insert(it_ac->getAttribute(it));
244  }
245  // get current value
246  std::ostringstream oss;
247  for (auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
248  if (it_val != occuringValues.begin()) {
249  oss << " ";
250  }
251  oss << *it_val;
252  }
253  // Show attribute
254  if ((disableTLSinJunctions && (ACFrontTag == SUMO_TAG_JUNCTION) && ((it == SUMO_ATTR_TLTYPE) || (it == SUMO_ATTR_TLID))) == false) {
255  (*itAttrs)->showAttribute(myACs.front()->getTag(), it, oss.str());
256  }
257  // update attribute iterator
258  itAttrs++;
259  }
260 
261  // show netedit parameters
263 
264  // Show myGEOAttributes if we're inspecting elements with GEO Attributes
266 
267  // if we inspect a single Attribute carrier vector, show their childs
268  if (myACs.size() == 1) {
270  }
271 
272  // If attributes correspond to an Edge
273  if (dynamic_cast<GNEEdge*>(myACs.front())) {
274  // show groupBox for templates
275  myGroupBoxForTemplates->show();
276  // show "Copy Template" (caption supplied via onUpdate)
277  myCopyTemplateButton->show();
278  // show "Set As Template"
279  if (myACs.size() == 1) {
280  mySetTemplateButton->show();
281  }
282  }
283  } else {
284  getFrameHeaderLabel()->setText("Inspect");
285  myContentFrame->recalc();
286  }
287 }
288 
289 
290 void
292  // Show back button if myPreviousElementInspect was defined
293  myPreviousElementInspect = previousElement;
294  if (myPreviousElementInspect != NULL) {
295  // disable myPreviousElementDelete to avoid inconsistences
297  inspectElement(AC);
298  myHeaderLeftFrame->show();
299  myBackButton->show();
300  }
301 }
302 
303 
304 void
305 GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
306  myPreviousElementDelete = previousElement;
307  myPreviousElementDeleteWasMarked = previousElementWasMarked;
308  // Show back button if myPreviousElementDelete is valid
309  if (myPreviousElementDelete != NULL) {
310  // disable myPreviousElementInspect to avoid inconsistences
312  inspectElement(AC);
313  myHeaderLeftFrame->show();
314  myBackButton->show();
315  }
316 }
317 
318 
319 void
321  for (auto i : myVectorOfAttributeInputs) {
322  if (i->getAttr() != SUMO_ATTR_NOTHING) {
323  i->refreshAttribute();
324  }
325  }
326 }
327 
328 
329 GNEEdge*
331  return myEdgeTemplate;
332 }
333 
334 
335 void
337  if (myEdgeTemplate) {
338  myEdgeTemplate->decRef("GNEInspectorFrame::setEdgeTemplate");
339  if (myEdgeTemplate->unreferenced()) {
340  delete myEdgeTemplate;
341  }
342  }
343  myEdgeTemplate = tpl;
344  myEdgeTemplate->incRef("GNEInspectorFrame::setEdgeTemplate");
345 }
346 
347 
348 long
349 GNEInspectorFrame::onCmdCopyTemplate(FXObject*, FXSelector, void*) {
350  for (auto it : myACs) {
351  GNEEdge* edge = dynamic_cast<GNEEdge*>(it);
352  assert(edge);
354  inspectMultisection(myACs);
355  }
356  return 1;
357 }
358 
359 
360 long
361 GNEInspectorFrame::onCmdSetTemplate(FXObject*, FXSelector, void*) {
362  assert(myACs.size() == 1);
363  GNEEdge* edge = dynamic_cast<GNEEdge*>(myACs.front());
364  assert(edge);
365  setEdgeTemplate(edge);
366  return 1;
367 }
368 
369 
370 long
371 GNEInspectorFrame::onUpdCopyTemplate(FXObject* sender, FXSelector, void*) {
372  FXString caption;
373  if (myEdgeTemplate) {
374  caption = ("Copy '" + myEdgeTemplate->getMicrosimID() + "'").c_str();
375  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), NULL);
376  } else {
377  caption = "No Template Set";
378  sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), NULL);
379  }
380  sender->handle(this, FXSEL(SEL_COMMAND, FXLabel::ID_SETSTRINGVALUE), (void*)&caption);
381  return 1;
382 }
383 
384 
385 long
386 GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
387  // Inspect previous element or go back to Delete Frame
391  } else if (myPreviousElementDelete != NULL) {
395  }
397  // Hide inspect frame and show delete frame
398  hide();
400  }
401  return 1;
402 }
403 
404 
405 const std::vector<GNEAttributeCarrier*>&
407  return myACs;
408 }
409 
410 
411 long
412 GNEInspectorFrame::onCmdShowChildMenu(FXObject*, FXSelector, void* eventData) {
413  // Obtain event
414  FXEvent* e = (FXEvent*) eventData;
415  FXTreeItem* item = myTreelist->getItemAt(e->win_x, e->win_y);
416  // Check if there are an item in the position and create pop-up menu
417  if (item && (myTreeItemsWithoutAC.find(item) == myTreeItemsWithoutAC.end())) {
418  createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[myTreelist->getItemAt(e->win_x, e->win_y)]);
419  }
420  return 1;
421 }
422 
423 
424 long
425 GNEInspectorFrame::onCmdCenterItem(FXObject*, FXSelector, void*) {
426  if (myRightClickedAC != NULL) {
428  myViewNet->update();
429  }
430  return 1;
431 }
432 
433 
434 long
435 GNEInspectorFrame::onCmdInspectItem(FXObject*, FXSelector, void*) {
436  if ((myACs.size() > 0) && (myRightClickedAC != NULL)) {
438  }
439  return 1;
440 }
441 
442 
443 long
444 GNEInspectorFrame::onCmdDeleteItem(FXObject*, FXSelector, void*) {
445  // Remove Attribute Carrier
449  // show again childs of attribute carrier
451  return 1;
452 }
453 
454 
455 void
457  // create FXMenuPane
458  FXMenuPane* pane = new FXMenuPane(myTreelist);
459  // set current clicked AC
460  myRightClickedAC = ac;
461  // set name
463  new FXMenuSeparator(pane);
464  // Fill FXMenuCommand
465  new FXMenuCommand(pane, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_GNE_INSPECTORFRAME_CENTER);
466  new FXMenuCommand(pane, "Inspect", GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_INSPECTORFRAME_INSPECT);
467  new FXMenuCommand(pane, "Delete", GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_INSPECTORFRAME_DELETE);
468  // Center in the mouse position and create pane
469  pane->setX(X);
470  pane->setY(Y);
471  pane->create();
472  pane->show();
473 }
474 
475 
476 void
478 
481  // Only show attributes of ONE attribute carrier
482  assert(myACs.size() == 1);
483  // clear items
484  myTreelist->clearItems();
485  myTreeItemToACMap.clear();
486  myTreeItemsWithoutAC.clear();
487  myGroupBoxForTreeList->show();
488  // Switch gl type of ac
489  switch (myACs.front()->getGUIGLObject()->getType()) {
490  case GLO_JUNCTION: {
491  // insert junction root
492  GNEJunction* junction = dynamic_cast<GNEJunction*>(myACs.front());
493  FXTreeItem* junctionItem = myTreelist->insertItem(0, 0, toString(junction->getTag()).c_str(), junction->getIcon(), junction->getIcon());
494  myTreeItemToACMap[junctionItem] = junction;
495  junctionItem->setExpanded(true);
496  // insert edges
497  for (int i = 0; i < (int)junction->getGNEEdges().size(); i++) {
498  GNEEdge* edge = junction->getGNEEdges().at(i);
499  FXTreeItem* edgeItem = myTreelist->insertItem(0, junctionItem, (toString(edge->getTag()) + " " + toString(i)).c_str(), edge->getIcon(), edge->getIcon());
500  myTreeItemToACMap[edgeItem] = edge;
501  edgeItem->setExpanded(true);
502  // insert lanes
503  for (int j = 0; j < (int)edge->getLanes().size(); j++) {
504  GNELane* lane = edge->getLanes().at(j);
505  FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(j)).c_str(), lane->getIcon(), lane->getIcon());
506  myTreeItemToACMap[laneItem] = lane;
507  laneItem->setExpanded(true);
508  // insert additionals of lanes
509  for (int k = 0; k < (int)lane->getAdditionalChilds().size(); k++) {
510  GNEAdditional* additional = lane->getAdditionalChilds().at(k);
511  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(k)).c_str(), additional->getIcon(), additional->getIcon());
512  myTreeItemToACMap[additionalItem] = additional;
513  additionalItem->setExpanded(true);
514  }
515  // insert incoming connections of lanes (by default isn't expanded)
516  if (lane->getGNEIncomingConnections().size() > 0) {
517  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
518  myTreeItemsWithoutAC.insert(incomingConnections);
519  incomingConnections->setExpanded(false);
520  for (int k = 0; k < (int)lane->getGNEIncomingConnections().size(); k++) {
521  GNEConnection* connection = lane->getGNEIncomingConnections().at(k);
522  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon());
523  myTreeItemToACMap[connectionItem] = connection;
524  connectionItem->setExpanded(true);
525  }
526  }
527  // insert outcoming connections of lanes (by default isn't expanded)
528  if (lane->getGNEOutcomingConnections().size() > 0) {
529  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
530  myTreeItemsWithoutAC.insert(outgoingConnections);
531  outgoingConnections->setExpanded(false);
532  for (int k = 0; k < (int)lane->getGNEOutcomingConnections().size(); k++) {
533  GNEConnection* connection = lane->getGNEOutcomingConnections().at(k);
534  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon());
535  myTreeItemToACMap[connectionItem] = connection;
536  connectionItem->setExpanded(true);
537  }
538  }
539  }
540  // insert additionals of edge
541  for (int j = 0; j < (int)edge->getAdditionalChilds().size(); j++) {
542  GNEAdditional* additional = edge->getAdditionalChilds().at(j);
543  FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon());
544  myTreeItemToACMap[additionalItem] = additional;
545  additionalItem->setExpanded(true);
546  }
547 
548  }
549  // insert crossings
550  for (int i = 0; i < (int)junction->getGNECrossings().size(); i++) {
551  GNECrossing* crossing = junction->getGNECrossings().at(i);
552  FXTreeItem* crossingItem = myTreelist->insertItem(0, junctionItem, (toString(crossing->getTag()) + " " + toString(i)).c_str(), crossing->getIcon(), crossing->getIcon());
553  myTreeItemToACMap[crossingItem] = crossing;
554  crossingItem->setExpanded(true);
555  }
556  break;
557  }
558  case GLO_EDGE: {
559  // insert edge root
560  GNEEdge* edge = dynamic_cast<GNEEdge*>(myACs.front());
561  FXTreeItem* edgeItem = myTreelist->insertItem(0, 0, toString(edge->getTag()).c_str(), edge->getIcon(), edge->getIcon());
562  myTreeItemToACMap[edgeItem] = edge;
563  edgeItem->setExpanded(true);
564  // insert lanes
565  for (int i = 0; i < (int)edge->getLanes().size(); i++) {
566  GNELane* lane = edge->getLanes().at(i);
567  FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(i)).c_str(), lane->getIcon(), lane->getIcon());
568  myTreeItemToACMap[laneItem] = lane;
569  laneItem->setExpanded(true);
570  // insert additionals of lanes
571  for (int j = 0; j < (int)lane->getAdditionalChilds().size(); j++) {
572  GNEAdditional* additional = lane->getAdditionalChilds().at(j);
573  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon());
574  myTreeItemToACMap[additionalItem] = additional;
575  additionalItem->setExpanded(true);
576  }
577  // insert incoming connections of lanes (by default isn't expanded)
578  if (lane->getGNEIncomingConnections().size() > 0) {
579  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
580  myTreeItemsWithoutAC.insert(incomingConnections);
581  incomingConnections->setExpanded(false);
582  for (int j = 0; j < (int)lane->getGNEIncomingConnections().size(); j++) {
583  GNEConnection* connection = lane->getGNEIncomingConnections().at(j);
584  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon());
585  myTreeItemToACMap[connectionItem] = connection;
586  connectionItem->setExpanded(true);
587  }
588  }
589  // insert outcoming connections of lanes (by default isn't expanded)
590  if (lane->getGNEOutcomingConnections().size() > 0) {
591  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
592  myTreeItemsWithoutAC.insert(outgoingConnections);
593  outgoingConnections->setExpanded(false);
594  for (int j = 0; j < (int)lane->getGNEOutcomingConnections().size(); j++) {
595  GNEConnection* connection = lane->getGNEOutcomingConnections().at(j);
596  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon());
597  myTreeItemToACMap[connectionItem] = connection;
598  connectionItem->setExpanded(true);
599  }
600  }
601  }
602  // insert additionals of edge
603  for (int i = 0; i < (int)edge->getAdditionalChilds().size(); i++) {
604  GNEAdditional* additional = edge->getAdditionalChilds().at(i);
605  FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon());
606  myTreeItemToACMap[additionalItem] = additional;
607  additionalItem->setExpanded(true);
608  }
609  break;
610  }
611  case GLO_LANE: {
612  // insert lane root
613  GNELane* lane = dynamic_cast<GNELane*>(myACs.front());
614  FXTreeItem* laneItem = myTreelist->insertItem(0, 0, toString(lane->getTag()).c_str(), lane->getIcon(), lane->getIcon());
615  myTreeItemToACMap[laneItem] = lane;
616  laneItem->setExpanded(true);
617  // insert additionals of lanes
618  for (int i = 0; i < (int)lane->getAdditionalChilds().size(); i++) {
619  GNEAdditional* additional = lane->getAdditionalChilds().at(i);
620  FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon());
621  myTreeItemToACMap[additionalItem] = additional;
622  additionalItem->setExpanded(true);
623  }
624  // insert incoming connections of lanes (by default isn't expanded)
625  if (lane->getGNEIncomingConnections().size() > 0) {
626  FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon());
627  myTreeItemsWithoutAC.insert(incomingConnections);
628  incomingConnections->setExpanded(false);
629  for (int i = 0; i < (int)lane->getGNEIncomingConnections().size(); i++) {
630  GNEConnection* connection = lane->getGNEIncomingConnections().at(i);
631  FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon());
632  myTreeItemToACMap[connectionItem] = connection;
633  connectionItem->setExpanded(true);
634  }
635  }
636  // insert outcoming connections of lanes (by default isn't expanded)
637  if (lane->getGNEOutcomingConnections().size() > 0) {
638  FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon());
639  myTreeItemsWithoutAC.insert(outgoingConnections);
640  outgoingConnections->setExpanded(false);
641  for (int i = 0; i < (int)lane->getGNEOutcomingConnections().size(); i++) {
642  GNEConnection* connection = lane->getGNEOutcomingConnections().at(i);
643  FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon());
644  myTreeItemToACMap[connectionItem] = connection;
645  connectionItem->setExpanded(true);
646  }
647  }
648  break;
649  }
650  case GLO_POI: {
651  // check type of POI
652  if (myACs.front()->getTag() == SUMO_TAG_POI) {
653  // insert POI root
654  GNEPOI* POI = dynamic_cast<GNEPOI*>(myACs.front());
655  FXTreeItem* POIItem = myTreelist->insertItem(0, 0, toString(POI->getTag()).c_str(), POI->getIcon(), POI->getIcon());
656  myTreeItemToACMap[POIItem] = POI;
657  POIItem->setExpanded(true);
658  break;
659  } else {
660  // insert POILane root
661  GNEPOILane* POILane = dynamic_cast<GNEPOILane*>(myACs.front());
662  FXTreeItem* POILaneItem = myTreelist->insertItem(0, 0, toString(POILane->getTag()).c_str(), POILane->getIcon(), POILane->getIcon());
663  myTreeItemToACMap[POILaneItem] = POILane;
664  POILaneItem->setExpanded(true);
665  break;
666  }
667  }
668  case GLO_POLYGON: {
669  // insert polygon root
670  GNEPoly* polygon = dynamic_cast<GNEPoly*>(myACs.front());
671  FXTreeItem* polygonItem = myTreelist->insertItem(0, 0, toString(polygon->getTag()).c_str(), polygon->getIcon(), polygon->getIcon());
672  myTreeItemToACMap[polygonItem] = polygon;
673  polygonItem->setExpanded(true);
674  break;
675  }
676  case GLO_CROSSING: {
677  // insert crossing root
678  GNECrossing* crossing = dynamic_cast<GNECrossing*>(myACs.front());
679  FXTreeItem* crossingItem = myTreelist->insertItem(0, 0, toString(crossing->getTag()).c_str(), crossing->getIcon(), crossing->getIcon());
680  myTreeItemToACMap[crossingItem] = crossing;
681  crossingItem->setExpanded(true);
682  break;
683  }
684  case GLO_ADDITIONAL: {
685  // insert additional root
686  GNEAdditional* additional = dynamic_cast<GNEAdditional*>(myACs.front());
687  FXTreeItem* additionalItem = myTreelist->insertItem(0, 0, toString(additional->getTag()).c_str(), additional->getIcon(), additional->getIcon());
688  myTreeItemToACMap[additionalItem] = additional;
689  additionalItem->setExpanded(true);
690  break;
691  }
692  case GLO_CONNECTION: {
693  // insert connection root
694  GNEConnection* connection = dynamic_cast<GNEConnection*>(myACs.front());
695  FXTreeItem* connectionItem = myTreelist->insertItem(0, 0, toString(connection->getTag()).c_str(), connection->getIcon(), connection->getIcon());
696  myTreeItemToACMap[connectionItem] = connection;
697  connectionItem->setExpanded(true);
698  break;
699  }
700  default: {
701  myGroupBoxForTreeList->hide();
702  break;
703  }
704  }
705 }
706 
707 
708 const std::vector<GNEAttributeCarrier*>&
710  return myACs;
711 }
712 
713 // ===========================================================================
714 // AttributeInput method definitions
715 // ===========================================================================
716 
717 GNEInspectorFrame::AttributeInput::AttributeInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent) :
718  FXHorizontalFrame(parent, GUIDesignAuxiliarHorizontalFrame),
719  myInspectorFrameParent(inspectorFrameParent),
720  myTag(SUMO_TAG_NOTHING),
721  myAttr(SUMO_ATTR_NOTHING) {
722  // Create and hide ButtonCombinableChoices
723  myButtonCombinableChoices = new FXButton(this, "AttributeButton", 0, this, MID_GNE_INSPECTORFRAME_ATTRIBUTEEDITOR, GUIDesignButtonAttribute);
725  // Create and hide label
726  myLabel = new FXLabel(this, "attributeLabel", 0, GUIDesignLabelAttribute);
727  myLabel->hide();
728  // Create and hide textField for int attributes
730  myTextFieldInt->hide();
731  // Create and hide textField for real/time attributes
733  myTextFieldReal->hide();
734  // Create and hide textField for string attributes
736  myTextFieldStrings->hide();
737  // Create and hide ComboBox
739  myChoicesCombo->hide();
740  // Create and hide checkButton
741  myBoolCheckButton = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute);
742  myBoolCheckButton->hide();
743 }
744 
745 
746 void
748  // Set actual Tag and attribute
749  myTag = ACTag;
750  myAttr = ACAttr;
751  // Show attribute Label
752  myLabel->setText(toString(myAttr).c_str());
753  myLabel->show();
754  // Set field depending of the type of value
756  // this is an special case for inspection of multiple attribute carriers with bools
757  std::vector<bool> boolValues = GNEAttributeCarrier::parse<std::vector<bool> >(value);
758  // set value of checkbox
759  if (boolValues.size() == 1) {
760  myBoolCheckButton->setCheck(boolValues.front());
761  } else {
762  int sum = 0;
763  for (auto i : boolValues) {
764  sum += (int)(i);
765  }
766  // only set true if all checkbox are true
767  if ((sum == 0) || (sum != (int)boolValues.size())) {
768  myBoolCheckButton->setCheck(false);
769  } else {
770  myBoolCheckButton->setCheck(true);
771  }
772  }
773  // set text
774  if (myBoolCheckButton->getCheck()) {
775  myBoolCheckButton->setText("true");
776  } else {
777  myBoolCheckButton->setText("false");
778  }
779  myBoolCheckButton->show();
781  // Obtain choices
782  const std::vector<std::string> choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr);
783  // Check if are combinable coices
784  if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) {
785  // hide label
786  myLabel->hide();
787  // Show button combinable choices
788  myButtonCombinableChoices->setText(toString(myAttr).c_str());
790  // Show string with the values
791  myTextFieldStrings->setText(value.c_str());
792  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
793  myTextFieldStrings->show();
794  } else {
795  // fill comboBox
796  myChoicesCombo->clearItems();
797  for (auto it : choices) {
798  myChoicesCombo->appendItem(it.c_str());
799  }
800  myChoicesCombo->setNumVisible((int)choices.size());
801  myChoicesCombo->setCurrentItem(myChoicesCombo->findItem(value.c_str()));
802  myChoicesCombo->show();
803  }
805  // show TextField for real/time values
806  myTextFieldReal->setText(value.c_str());
807  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
808  myTextFieldReal->show();
809  } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) {
810  // Show textField for int attributes
811  myTextFieldInt->setText(value.c_str());
812  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
813  myTextFieldInt->show();
814  } else {
815  // In any other case (String, list, etc.), show value as String
816  myTextFieldStrings->setText(value.c_str());
817  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
818  myTextFieldStrings->show();
819  }
820  // Show AttributeInput
821  show();
822 }
823 
824 
825 void
827  // Hide all elements
828  myLabel->hide();
829  myTextFieldInt->hide();
830  myTextFieldReal->hide();
831  myTextFieldStrings->hide();
832  myChoicesCombo->hide();
833  myBoolCheckButton->hide();
835  // hide AttributeInput
836  hide();
837 }
838 
839 
840 void
842  // Declare a set of occuring values and insert attribute's values of item
843  std::set<std::string> occuringValues;
844  for (auto it_ac : myInspectorFrameParent->getACs()) {
845  occuringValues.insert(it_ac->getAttribute(myAttr));
846  }
847  // get current value
848  std::ostringstream oss;
849  for (auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
850  if (it_val != occuringValues.begin()) {
851  oss << " ";
852  }
853  oss << *it_val;
854  }
855  // show attribute again
856  showAttribute(myTag, myAttr, oss.str());
857 }
858 
859 
862  return myTag;
863 }
864 
865 
868  return myAttr;
869 }
870 
871 
872 long
874  // obtain vehicles of text field and check if are valid
875  std::string vehicles = myTextFieldStrings->getText().text();
876  // check if values can parse
877  if (canParseVehicleClasses(vehicles) == false) {
878  if (myAttr == SUMO_ATTR_ALLOW) {
879  vehicles = getVehicleClassNames(SVCAll, true);
880  } else {
881  vehicles = "";
882  }
883  }
884  // open GNEDialog_AllowDisallow
885  GNEDialog_AllowDisallow(getApp(), &vehicles).execute();
886  // set obtained vehicles into TextField Strings
887  myTextFieldStrings->setText((vehicles).c_str());
888  onCmdSetAttribute(0, 0, 0);
889  return 1;
890 }
891 
892 
893 long
895  // Declare changed value
896  std::string newVal;
897  // First, obtain the string value of the new attribute depending of their type
899  // Set true o false depending of the checBox
900  if (myBoolCheckButton->getCheck()) {
901  myBoolCheckButton->setText("true");
902  newVal = "true";
903  } else {
904  myBoolCheckButton->setText("false");
905  newVal = "false";
906  }
908  // Obtain choices
909  const std::vector<std::string>& choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr);
910  // Check if are combinable choices (for example, Vehicle Types)
911  if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) {
912  // Get value obtained using AttributeEditor
913  newVal = myTextFieldStrings->getText().text();
914  } else {
915  // Get value of ComboBox
916  newVal = myChoicesCombo->getText().text();
917  }
919  // Check if default value of attribute must be set
921  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
922  myTextFieldReal->setText(newVal.c_str());
923  } else {
924  // obtain value of myTextFieldReal
925  newVal = myTextFieldReal->getText().text();
926  }
927  } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) {
928  // Check if default value of attribute must be set
929  if (myTextFieldInt->getText().empty() && GNEAttributeCarrier::hasDefaultValue(myTag, myAttr)) {
930  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
931  myTextFieldInt->setText(newVal.c_str());
932  } else {
933  // obtain value of myTextFieldInt
934  newVal = myTextFieldInt->getText().text();
935  }
937  // Check if default value of attribute must be set
939  newVal = GNEAttributeCarrier::getDefaultValue<std::string>(myTag, myAttr);
940  myTextFieldStrings->setText(newVal.c_str());
941  } else {
942  // obtain value of myTextFieldStrings
943  newVal = myTextFieldStrings->getText().text();
944  }
945  }
946 
947  // we need a extra check for Position and Shape Values, due #2658
948  if ((myAttr == SUMO_ATTR_POSITION) || (myAttr == SUMO_ATTR_SHAPE)) {
949  newVal = stripWhitespaceAfterComma(newVal);
950  }
951 
952  // Check if attribute must be changed
953  if (myInspectorFrameParent->getACs().front()->isValid(myAttr, newVal)) {
954  // if its valid for the first AC than its valid for all (of the same type)
955  if (myInspectorFrameParent->getACs().size() > 1) {
956  myInspectorFrameParent->getViewNet()->getUndoList()->p_begin("Change multiple attributes");
957  }
958  // Set new value of attribute in all selected ACs
959  for (auto it_ac : myInspectorFrameParent->getACs()) {
960  it_ac->setAttribute(myAttr, newVal, myInspectorFrameParent->getViewNet()->getUndoList());
961  }
962  // finish change multiple attributes
963  if (myInspectorFrameParent->getACs().size() > 1) {
965  }
966  // If previously value was incorrect, change font color to black
968  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
969  myTextFieldStrings->killFocus();
970  // in this case, we need to refresh the other opposited value
972  if (((myAttr == SUMO_ATTR_ALLOW) && (i->getAttr() == SUMO_ATTR_DISALLOW)) ||
973  ((myAttr == SUMO_ATTR_DISALLOW) && (i->getAttr() == SUMO_ATTR_ALLOW))) {
974  i->refreshAttribute();
975  }
976  }
978  myChoicesCombo->setTextColor(FXRGB(0, 0, 0));
979  myChoicesCombo->killFocus();
981  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
982  myTextFieldReal->killFocus();
984  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
985  myTextFieldInt->killFocus();
986  } else if (myTextFieldStrings != 0) {
987  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
988  myTextFieldStrings->killFocus();
989  }
990  } else {
991  // If value of TextField isn't valid, change color to Red depending of type
993  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
994  myTextFieldStrings->killFocus();
996  myChoicesCombo->setTextColor(FXRGB(255, 0, 0));
997  myChoicesCombo->killFocus();
999  myTextFieldReal->setTextColor(FXRGB(255, 0, 0));
1001  myTextFieldInt->setTextColor(FXRGB(255, 0, 0));
1002  } else if (myTextFieldStrings != 0) {
1003  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
1004  }
1005  // Write Warning in console if we're in testing mode
1006  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
1007  WRITE_WARNING("Value '" + newVal + "' for attribute " + toString(myAttr) + " of " + toString(myTag) + " isn't valid");
1008  }
1009  }
1010  // refresh GEO Attributes
1012  // Update view net
1013  myInspectorFrameParent->getViewNet()->update();
1014  return 1;
1015 }
1016 
1017 
1018 void
1020  FXHorizontalFrame::show();
1021 }
1022 
1023 
1024 void
1026  FXHorizontalFrame::hide();
1027 }
1028 
1029 
1030 std::string
1032  std::string result(stringValue);
1033  while (result.find(", ") != std::string::npos) {
1034  result = StringUtils::replace(result, ", ", ",");
1035  }
1036  return result;
1037 }
1038 
1039 // ===========================================================================
1040 // NeteditParameters method definitions
1041 // ===========================================================================
1042 
1044  FXGroupBox(inspectorFrameParent->myContentFrame, "Netedit attributes", GUIDesignGroupBoxFrame),
1045  myInspectorFrameParent(inspectorFrameParent) {
1046 
1047  // Create elements for additional parent
1051 
1052  // Create elements for block movement
1056 
1057  // Create elements for block shape
1058  myHorizontalFrameBlockShape = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1059  myLabelBlockShape = new FXLabel(myHorizontalFrameBlockShape, "Block shape", 0, GUIDesignLabelAttribute);
1061 
1062  // Create elements for close shape
1063  myHorizontalFrameCloseShape = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1064  myLabelCloseShape = new FXLabel(myHorizontalFrameCloseShape, "Close shape", 0, GUIDesignLabelAttribute);
1066 }
1067 
1068 
1070 
1071 
1072 void
1074  // If item can be moved
1076  // show groupBox
1077  FXGroupBox::show();
1078  // Check if all elements have movement blocked
1079  bool movementBlocked = true;
1080  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1081  movementBlocked &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_MOVEMENT));
1082  }
1083  // show block movement
1085  myCheckBoxBlockMovement->setCheck(movementBlocked);
1086  // update label
1087  if (movementBlocked) {
1088  myCheckBoxBlockMovement->setText("true");
1089  } else {
1090  myCheckBoxBlockMovement->setText("false");
1091  }
1092  }
1093  // check if item can block their shape
1095  // show groupBox
1096  FXGroupBox::show();
1097  // Check if all elements have shape blocked
1098  bool shapeBlocked = true;
1099  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1100  shapeBlocked &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_BLOCK_SHAPE));
1101  }
1102  // show block shape
1104  myCheckBoxBlockShape->setCheck(shapeBlocked);
1105  // update label
1106  if (shapeBlocked) {
1107  myCheckBoxBlockShape->setText("true");
1108  } else {
1109  myCheckBoxBlockShape->setText("false");
1110  }
1111  // Check if all elements have shape closed
1112  bool shapeClosed = true;
1113  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1114  shapeClosed &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
1115  }
1116  // show close shape
1118  myCheckBoxCloseShape->setCheck(shapeClosed);
1119  // update label
1120  if (shapeClosed) {
1121  myCheckBoxCloseShape->setText("true");
1122  } else {
1123  myCheckBoxCloseShape->setText("false");
1124  }
1125  }
1126  // If item is an additional and has another additional as parent
1127  if (myInspectorFrameParent->getInspectedACs().size() == 1) {
1128  // check if is an additional AND has an additional parent
1129  GNEAdditional* additional = dynamic_cast<GNEAdditional*>(myInspectorFrameParent->getInspectedACs().front());
1130  if (additional && additional->getAdditionalParent()) {
1131  // show groupBox
1132  FXGroupBox::show();
1133  // show block movement
1135  myLabelAdditionalParent->setText((toString(additional->getAdditionalParent()->getTag()) + " parent").c_str());
1136  myTextFieldAdditionalParent->setText(additional->getAdditionalParent()->getID().c_str());
1137  }
1138  }
1139 }
1140 
1141 
1142 void
1144  // hide all elements of GroupBox
1149  FXGroupBox::hide();
1150 }
1151 
1152 
1153 long
1155  if (myInspectorFrameParent->getInspectedACs().front()->isValid(GNE_ATTR_PARENT, myTextFieldAdditionalParent->getText().text())) {
1157  myTextFieldAdditionalParent->setTextColor(FXRGB(0, 0, 0));
1158  } else {
1159  myTextFieldAdditionalParent->setTextColor(FXRGB(255, 0, 0));
1160  myTextFieldAdditionalParent->killFocus();
1161  }
1162  return 1;
1163 }
1164 
1165 
1166 long
1168  // set new values in all inspected Attribute Carriers
1169  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1170  if (myCheckBoxBlockMovement->getCheck() == 1) {
1171  i->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1172  } else {
1173  i->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1174  }
1175  }
1176  // change text of check box movement
1177  if (myCheckBoxBlockMovement->getCheck() == 1) {
1178  myCheckBoxBlockMovement->setText("true");
1179  } else {
1180  myCheckBoxBlockMovement->setText("false");
1181  }
1182  return 1;
1183 }
1184 
1185 
1186 long
1188  // set new values in all inspected Attribute Carriers
1189  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1190  if (myCheckBoxBlockShape->getCheck() == 1) {
1191  i->setAttribute(GNE_ATTR_BLOCK_SHAPE, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1192  } else {
1193  i->setAttribute(GNE_ATTR_BLOCK_SHAPE, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1194  }
1195  }
1196  // change text of check box shape
1197  if (myCheckBoxBlockShape->getCheck() == 1) {
1198  myCheckBoxBlockShape->setText("true");
1199  } else {
1200  myCheckBoxBlockShape->setText("false");
1201  }
1202  return 1;
1203 }
1204 
1205 
1206 long
1208  // set new values in all inspected Attribute Carriers
1209  for (auto i : myInspectorFrameParent->getInspectedACs()) {
1210  if (myCheckBoxCloseShape->getCheck() == 1) {
1211  i->setAttribute(GNE_ATTR_CLOSE_SHAPE, "true", myInspectorFrameParent->getViewNet()->getUndoList());
1212  } else {
1213  i->setAttribute(GNE_ATTR_CLOSE_SHAPE, "false", myInspectorFrameParent->getViewNet()->getUndoList());
1214  }
1215  }
1216  // change text of check box shape
1217  if (myCheckBoxCloseShape->getCheck() == 1) {
1218  myCheckBoxCloseShape->setText("true");
1219  } else {
1220  myCheckBoxCloseShape->setText("false");
1221  }
1222  return 1;
1223 }
1224 
1225 /****************************************************************************/
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
Definition: GNEEdge.cpp:621
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:199
FXCheckButton * myCheckBoxBlockMovement
pointer to check box "Block movement"
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:116
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:59
FXButton * myButtonCombinableChoices
pointer to buttonCombinableChoices
void show()
set show as private function
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
GNEFrame::GEOAttributes * myGEOAttributes
GEO Parameters.
Definition: GNEFrame.h:355
a polygon
void inspectElement(GNEAttributeCarrier *AC)
Inspect a single element.
FXHorizontalFrame * myHorizontalFrameAdditionalParent
horizontal frame for change additional parent
begin/end of the description of a junction
FXHorizontalFrame * myHorizontalFrameBlockMovement
horizontal frame for block movement
FXLabel * getFrameHeaderLabel() const
get the label for the frame&#39;s header
Definition: GNEFrame.cpp:577
GNEInspectorFrame * myInspectorFrameParent
pointer to inspector frame parent
In GNEINSPECTORFRAME, delete element.
Definition: GUIAppEnum.h:571
block shape of a graphic element (Used mainly in GNEShapes)
static bool isDiscrete(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is Discrete
void refreshAttribute()
refresh attribute
FXGroupBox * myGroupBoxForTemplates
groupBox for templates
void removeAttributeCarrier(GNEAttributeCarrier *ac)
remove attribute carrier (element)
attribute edited
Definition: GUIAppEnum.h:526
void refreshValues()
Refresh inspected values (used when values can be changed externally by other modul) ...
FXButton * myCopyTemplateButton
copy template button
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
Definition: GUIDesigns.h:195
FXLabel * myLabelAdditionalParent
Label for additional parent.
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
Definition: GNEPOI.h:46
a connection
GNEViewParent * getViewParent() const
get the net object
const std::vector< GNEAttributeCarrier * > & getACs() const
get current list of ACs
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.
FXIcon * getIcon() const
get FXIcon assigned to this object
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:53
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:84
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.
begin/end of the description of a Point of interest
#define GUIDesignTreeListFrame
Tree list used in frames to represent childs of elements.
Definition: GUIDesigns.h:418
FXLabel * myLabelBlockMovement
Label for Check blocked movement.
const SVCPermissions SVCAll
all VClasses are allowed
FXLabel * myLabelCloseShape
Label for close shape.
set object as template
Definition: GUIAppEnum.h:573
FXButton * mySetTemplateButton
set template button
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
void show()
show NeteditParameters
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:571
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:199
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
~GNEInspectorFrame()
Destructor.
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
GNEViewNet * myViewNet
View Net for changes.
Definition: GNEFrame.h:337
const std::vector< GNEAttributeCarrier * > & getInspectedACs() const
get reference to current inspected Attribute carriers
void refreshGEOAttributes()
refresh TextFields with the new GEO Attributes
Definition: GNEFrame.cpp:246
static const std::vector< std::string > & discreteChoices(SumoXMLTag tag, SumoXMLAttr attr)
return a list of discrete choices for this attribute or an empty vector
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
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
#define GUIDesignButtonIconRectangular
button only with icon (46x23)
Definition: GUIDesigns.h:68
void showAttributeCarrierChilds()
show child of current attributeCarrier
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
GNEUndoList * getUndoList() const
get the undoList object
void hide()
set hide as private function
In GNEINSPECTORFRAME, center element.
Definition: GUIAppEnum.h:567
go back to the previous element
Definition: GUIAppEnum.h:577
FXLabel * myLabel
pointer to label
#define GUIDesignTextField
Definition: GUIDesigns.h:40
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:340
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:51
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
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:91
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:246
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
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1127
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
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
long onCmdSetBlockingMovement(FXObject *, FXSelector, void *)
called when user toogle the blocking movement CheckBox
long onCmdSetBlockingShape(FXObject *, FXSelector, void *)
called when user toogle the blocking shape CheckBox
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:1148
void incRef(const std::string &debugMsg="")
Increarse reference.
Dialog for edit rerouters.
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.
open edit attribute dialog
Definition: GUIAppEnum.h:579
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.
SumoXMLAttr getAttr() const
get current Attr
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:56
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:49
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
long onCmdOpenAllowDisallowEditor(FXObject *, FXSelector, void *)
open model dialog for more comfortable attribute editing
#define GUIDesignButton
Definition: GUIDesigns.h:56
void createPopUpMenu(int X, int Y, GNEAttributeCarrier *ac)
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:653
virtual void show()
show Frame
Definition: GNEFrame.cpp:546
long onCmdChangeAdditionalParent(FXObject *, FXSelector, void *)
SumoXMLAttr myAttr
current Attr
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:59
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:221
GUIMainWindow * getApp() const
get App (GUIMainWindow)
GNEAdditional * getAdditionalParent() const
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
attribute block movement
Definition: GUIAppEnum.h:639
void hideGEOAttributes()
hide GEOAttributes
Definition: GNEFrame.cpp:237
In GNEINSPECTORFRAME, inspect element.
Definition: GUIAppEnum.h:569
FXComboBox * myChoicesCombo
pointer to combo box choices
an edge
void showAttribute(SumoXMLTag ACTag, SumoXMLAttr ACAttribute, const std::string &value)
show attribute of ac
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:43
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:555
attribute block shape
Definition: GUIAppEnum.h:528
FXHorizontalFrame * myHorizontalFrameBlockShape
horizontal frame for block shape
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_MODE_DELETE
void show()
show inspector frame
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:46
GUIGlID getGlID() const
Returns the numerical id of the object.
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
attribute close shape
Definition: GUIAppEnum.h:530
FXTextField * myTextFieldAdditionalParent
pointer for change additional parent
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
std::vector< GNEAttributeCarrier * > myACs
the multi-selection currently being inspected
parent of an additional element
FXHorizontalFrame * myHorizontalFrameCloseShape
horizontal frame for close shape
SumoXMLTag getTag() const
get current tag
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the Tree items with their AC
FXTextField * myTextFieldStrings
textField to modify the value of string attributes
FXTextField * myTextFieldInt
textField to modify the value of int attributes
FXButton * myBackButton
back Button
long onCmdSetTemplate(FXObject *, FXSelector, void *)
set current edge as new template
void inspectMultisection(const std::vector< GNEAttributeCarrier *> &ACs)
Inspect the given multi-selection.
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
Definition: GUIDesigns.h:164
C++ TraCI client API implementation.
Definition: POI.h:42
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:346
FXTextField * myTextFieldReal
textField to modify the value of real/Time attributes
FXGroupBox * myGroupBoxForAttributes
groupBox for attributes
long onCmdSetAttribute(FXObject *, FXSelector, void *)
void showGEOAttributes(const std::vector< GNEAttributeCarrier *> &ACs)
show GEOAttribute for the current AttributeCarriers
Definition: GNEFrame.cpp:204
const GUIGlObject * getGUIGLObject() const
get const pointer to GUIGlObject vinculated with this Attribute Carrier
a junction
SumoXMLTag getTag() const
get XML Tag assigned to this object