SUMO - Simulation of Urban MObility
GNEAdditionalFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
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 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <iostream>
40 
41 #include "GNEAdditionalFrame.h"
42 #include "GNEViewNet.h"
43 #include "GNEViewParent.h"
44 #include "GNENet.h"
45 #include "GNEJunction.h"
46 #include "GNEEdge.h"
47 #include "GNELane.h"
48 #include "GNECrossing.h"
49 #include "GNEUndoList.h"
50 #include "GNEChange_Selection.h"
51 #include "GNEAttributeCarrier.h"
52 #include "GNEChange_Additional.h"
53 #include "GNEAdditional.h"
54 #include "GNEAdditionalHandler.h"
55 
56 
57 // ===========================================================================
58 // FOX callback mapping
59 // ===========================================================================
60 
61 FXDEFMAP(GNEAdditionalFrame) GNEAdditionalMap[] = {
63 };
64 
65 FXDEFMAP(GNEAdditionalFrame::AdditionalAttributeSingle) GNEsingleAdditionalParameterMap[] = {
68 };
69 
70 FXDEFMAP(GNEAdditionalFrame::AdditionalAttributeList) GNEsingleAdditionalParameterListMap[] = {
73 };
74 
75 FXDEFMAP(GNEAdditionalFrame::AdditionalAttributes) GNEadditionalParametersMap[] = {
77 };
78 
79 FXDEFMAP(GNEAdditionalFrame::NeteditAttributes) GNEEditorParametersMap[] = {
85 };
86 
87 FXDEFMAP(GNEAdditionalFrame::SelectorParentAdditional) GNEadditionalParentSelectorMap[] = {
90 };
91 
92 FXDEFMAP(GNEAdditionalFrame::SelectorParentEdges) GNEedgeParentsSelectorMap[] = {
99 };
100 
101 FXDEFMAP(GNEAdditionalFrame::SelectorParentLanes) GNElaneParentsSelectorMap[] = {
108 };
109 
110 // Object implementation
111 FXIMPLEMENT(GNEAdditionalFrame, FXVerticalFrame, GNEAdditionalMap, ARRAYNUMBER(GNEAdditionalMap))
112 FXIMPLEMENT(GNEAdditionalFrame::AdditionalAttributeSingle, FXHorizontalFrame, GNEsingleAdditionalParameterMap, ARRAYNUMBER(GNEsingleAdditionalParameterMap))
113 FXIMPLEMENT(GNEAdditionalFrame::AdditionalAttributeList, FXVerticalFrame, GNEsingleAdditionalParameterListMap, ARRAYNUMBER(GNEsingleAdditionalParameterListMap))
114 FXIMPLEMENT(GNEAdditionalFrame::AdditionalAttributes, FXGroupBox, GNEadditionalParametersMap, ARRAYNUMBER(GNEadditionalParametersMap))
115 FXIMPLEMENT(GNEAdditionalFrame::NeteditAttributes, FXGroupBox, GNEEditorParametersMap, ARRAYNUMBER(GNEEditorParametersMap))
116 FXIMPLEMENT(GNEAdditionalFrame::SelectorParentAdditional, FXGroupBox, GNEadditionalParentSelectorMap, ARRAYNUMBER(GNEadditionalParentSelectorMap))
117 FXIMPLEMENT(GNEAdditionalFrame::SelectorParentEdges, FXGroupBox, GNEedgeParentsSelectorMap, ARRAYNUMBER(GNEedgeParentsSelectorMap))
118 FXIMPLEMENT(GNEAdditionalFrame::SelectorParentLanes, FXGroupBox, GNElaneParentsSelectorMap, ARRAYNUMBER(GNElaneParentsSelectorMap))
119 
120 // ===========================================================================
121 // method definitions
122 // ===========================================================================
123 
124 GNEAdditionalFrame::GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
125  GNEFrame(horizontalFrameParent, viewNet, "Additionals"),
126  myActualAdditionalType(SUMO_TAG_NOTHING) {
127 
128  // Create groupBox for myAdditionalMatchBox
129  myGroupBoxForMyAdditionalMatchBox = new FXGroupBox(myContentFrame, "Additional element", GUIDesignGroupBoxFrame);
130 
131  // Create FXListBox in myGroupBoxForMyAdditionalMatchBox
132  myAdditionalMatchBox = new FXComboBox(myGroupBoxForMyAdditionalMatchBox, GUIDesignComboBoxNCol, this, MID_GNE_MODE_ADDITIONAL_ITEM, GUIDesignComboBox);
133 
134  // Create additional parameters
135  myadditionalParameters = new GNEAdditionalFrame::AdditionalAttributes(myViewNet, myContentFrame);
136 
137  // Create Netedit parameter
138  myEditorParameters = new GNEAdditionalFrame::NeteditAttributes(myContentFrame);
139 
140  // Create create list for additional Set
141  myAdditionalParentSelector = new GNEAdditionalFrame::SelectorParentAdditional(myContentFrame, myViewNet);
142 
144  myedgeParentsSelector = new GNEAdditionalFrame::SelectorParentEdges(myContentFrame, myViewNet);
145 
147  mylaneParentsSelector = new GNEAdditionalFrame::SelectorParentLanes(myContentFrame, myViewNet);
148 
149  // Add options to myAdditionalMatchBox
150  const std::vector<SumoXMLTag>& additionalTags = GNEAttributeCarrier::allowedTags(false);
151  for (std::vector<SumoXMLTag>::const_iterator i = additionalTags.begin(); i != additionalTags.end(); i++) {
152  myAdditionalMatchBox->appendItem(toString(*i).c_str());
153  }
154 
155  // Set visible items
156  myAdditionalMatchBox->setNumVisible((int)myAdditionalMatchBox->getNumItems());
157 
158  // If there are additionals
159  if (additionalTags.size() > 0) {
160  // Set myActualAdditionalType and show
161  myActualAdditionalType = additionalTags.front();
162  setParametersOfAdditional(myActualAdditionalType);
163  }
164 }
165 
166 
169 }
170 
171 
174  // check if current selected additional is valid
176  myViewNet->setStatusBarText("Current selected additional isn't valid.");
178  }
179 
180  // Declare map to keep values
181  std::map<SumoXMLAttr, std::string> valuesOfElement = myadditionalParameters->getAttributesAndValues();
182 
183  // limit position depending if show grid is enabled
184  Position currentPosition = parent->snapToActiveGrid(parent->getPositionInformation());
185 
186  // Declare pointer to netElements
187  GNEJunction* pointed_junction = NULL;
188  GNEEdge* pointed_edge = NULL;
189  GNELane* pointed_lane = NULL;
190  GNECrossing* pointed_crossing = NULL;
191 
192  // Check if additional should be placed over a junction
194  pointed_junction = dynamic_cast<GNEJunction*>(netElement);
195  if (pointed_junction != NULL) {
196  // show warning dialogbox and stop check if input parameters are valid
197  if (myadditionalParameters->areValuesValid() == false) {
200  }
201  // Get attribute junction
202  valuesOfElement[SUMO_ATTR_JUNCTION] = pointed_junction->getID();
203  // Generate id of element based on the junction
204  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_junction);
205  } else {
207  }
208  }
209  // Check if additional should be placed over a edge
211  // Due a edge is composed of lanes, its neccesary check if clicked element is an lane
212  if (dynamic_cast<GNELane*>(netElement) != NULL) {
213  pointed_edge = &(dynamic_cast<GNELane*>(netElement)->getParentEdge());
214  }
215  if (pointed_edge != NULL) {
216  // show warning dialogbox and stop check if input parameters are valid
217  if (myadditionalParameters->areValuesValid() == false) {
220  }
221  // Get attribute edge
222  valuesOfElement[SUMO_ATTR_EDGE] = pointed_edge->getID();
223  // Generate id of element based on the edge
224  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_edge);
225  } else {
227  }
228  }
229  // Check if additional should be placed over a lane
231  pointed_lane = dynamic_cast<GNELane*>(netElement);
232  if (pointed_lane != NULL) {
233  // show warning dialogbox and stop check if input parameters are valid
234  if (myadditionalParameters->areValuesValid() == false) {
237  }
238  // Get attribute lane
239  valuesOfElement[SUMO_ATTR_LANE] = pointed_lane->getID();
240  // Generate id of element based on the lane
241  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_lane);
242  } else {
244  }
245  }
246  // Check if additional should be placed over a crossing
248  pointed_crossing = dynamic_cast<GNECrossing*>(netElement);
249  if (pointed_crossing != NULL) {
250  // show warning dialogbox and stop check if input parameters are valid
251  if (myadditionalParameters->areValuesValid() == false) {
254  }
255  // Get attribute crossing
256  valuesOfElement[SUMO_ATTR_CROSSING] = pointed_crossing->getID();
257  // Generate id of element based on the crossing
258  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_crossing);
259  } else {
261  }
262  } else {
263  // Generate id of element
264  valuesOfElement[SUMO_ATTR_ID] = generateID(NULL);
265  }
266 
267  // show warning dialogbox and stop check if input parameters are valid
268  if (myadditionalParameters->areValuesValid() == false) {
271  }
272 
273  // Obtain position attribute
274  if (pointed_edge) {
275  // Obtain position of the mouse over edge
276  double positionOfTheMouseOverEdge = pointed_edge->getLanes().at(0)->getShape().nearest_offset_to_point2D(currentPosition);
277  // If element has a StartPosition and EndPosition over edge, extract attributes
279  // First check that current length is valid
281  // check if current reference point is valid
283  myadditionalParameters->showWarningMessage("Current selected reference point isn't valid");
285  }
286  double startPos = setStartPosition(positionOfTheMouseOverEdge, myEditorParameters->getLength());
287  double endPos = setEndPosition(pointed_edge->getLanes().at(0)->getLaneShapeLength(), positionOfTheMouseOverEdge, myEditorParameters->getLength());
288  // Only set start position if are valid (!= -1)
289  if (startPos != -1) {
290  valuesOfElement[SUMO_ATTR_STARTPOS] = toString(startPos);
291  } else {
292  myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' takes a negative value. Use 'force position' or another reference point.");
294  }
295  // Only set end position if are valid (!= -1)
296  if (endPos != -1) {
297  valuesOfElement[SUMO_ATTR_ENDPOS] = toString(endPos);
298  } else {
299  myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' overpass " + toString(SUMO_TAG_EDGE) + "'s lenght. Use 'force position' or another reference point.");
301  }
302  } else {
304  }
305  }
306  // Extract position of lane
307  valuesOfElement[SUMO_ATTR_POSITION] = toString(positionOfTheMouseOverEdge);
308  } else if (pointed_lane) {
309  // Obtain position of the mouse over lane
310  double positionOfTheMouseOverLane = pointed_lane->getShape().nearest_offset_to_point2D(currentPosition);
311  // If element has a StartPosition and EndPosition over lane, extract attributes
313  // First check that current length is valid
315  // check if current reference point is valid
317  myadditionalParameters->showWarningMessage("Current selected reference point isn't valid");
319  }
320  double startPos = setStartPosition(positionOfTheMouseOverLane, myEditorParameters->getLength());
321  double endPos = setEndPosition(pointed_lane->getLaneShapeLength(), positionOfTheMouseOverLane, myEditorParameters->getLength());
322  // Only set start position if are valid (!= -1)
323  if (startPos != -1) {
324  valuesOfElement[SUMO_ATTR_STARTPOS] = toString(startPos);
325  } else {
326  myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' takes a negative value. Use 'force position' or another reference point.");
328  }
329  // Only set end position if are valid (!= -1)
330  if (endPos != -1) {
331  valuesOfElement[SUMO_ATTR_ENDPOS] = toString(endPos);
332  } else {
333  myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' overpass " + toString(SUMO_TAG_LANE) + "'s lenght. Use 'force position' or another reference point.");
335  }
336  } else {
338  }
339  }
340  // Extract position of lane
341  valuesOfElement[SUMO_ATTR_POSITION] = toString(positionOfTheMouseOverLane);
342  } else {
343  // get position in map
344  valuesOfElement[SUMO_ATTR_POSITION] = toString(currentPosition);
345  }
346 
347  // If additional has a interval defined by a begin or end, check that is valid
349  double begin = GNEAttributeCarrier::parse<double>(valuesOfElement[SUMO_ATTR_STARTTIME]);
350  double end = GNEAttributeCarrier::parse<double>(valuesOfElement[SUMO_ATTR_END]);
351  if (begin > end) {
352  myadditionalParameters->showWarningMessage("Attribute '" + toString(SUMO_ATTR_STARTTIME) + "' cannot be greater than attribute '" + toString(SUMO_ATTR_END) + "'.");
354  }
355  }
356 
357  // If additional own the attribute SUMO_ATTR_FILE but was't defined, will defined as <ID>.txt
359  valuesOfElement[SUMO_ATTR_FILE] = (valuesOfElement[SUMO_ATTR_ID] + ".txt");
360  }
361 
362  // If additional own the attribute SUMO_ATTR_OUTPUT but was't defined, will defined as <ID>.txt
364  valuesOfElement[SUMO_ATTR_OUTPUT] = (valuesOfElement[SUMO_ATTR_ID] + ".txt");
365  }
366 
367  // Save block value
369 
370  // If element belongst to an additional Set, get id of parent from myAdditionalParentSelector
374  } else {
375  myadditionalParameters->showWarningMessage("A " + toString(SUMO_TAG_E3DETECTOR) + " must be selected before insertion of " + toString(myActualAdditionalType) + ".");
377  }
378  }
379 
380  // If element own a list of SelectorParentEdges as attribute
383  // Declare a vector of Id's
384  std::vector<std::string> vectorOfIds;
385  // get Selected edges
386  std::vector<GNEEdge*> selectedEdges = myViewNet->getNet()->retrieveEdges(true);
387  // Iterate over selectedEdges and getId
388  for (std::vector<GNEEdge*>::iterator i = selectedEdges.begin(); i != selectedEdges.end(); i++) {
389  vectorOfIds.push_back((*i)->getID());
390  }
391  // Set saved Ids in attribute edges
392  valuesOfElement[SUMO_ATTR_EDGES] = joinToString(vectorOfIds, " ");
393  } else {
395  }
396  // check if attribute has at least one edge
397  if (valuesOfElement[SUMO_ATTR_EDGES] == "") {
398  myadditionalParameters->showWarningMessage("List of " + toString(SUMO_TAG_EDGE) + "s cannot be empty");
400  }
401  }
402 
403  // If element own a list of SelectorParentLanes as attribute
406  // Declare a vector of Id's
407  std::vector<std::string> vectorOfIds;
408  // get Selected lanes
409  std::vector<GNELane*> selectedLanes = myViewNet->getNet()->retrieveLanes(true);
410  // Iterate over selectedLanes and getId
411  for (std::vector<GNELane*>::iterator i = selectedLanes.begin(); i != selectedLanes.end(); i++) {
412  vectorOfIds.push_back((*i)->getID());
413  }
414  // Set saved Ids in attribute lanes
415  valuesOfElement[SUMO_ATTR_LANES] = joinToString(vectorOfIds, " ");
416  } else {
418  }
419  // check if attribute has at least a lane
420  if (valuesOfElement[SUMO_ATTR_LANES] == "") {
421  myadditionalParameters->showWarningMessage("List of " + toString(SUMO_TAG_LANE) + "s cannot be empty");
423  }
424  }
425 
426  // Create additional
428  return ADDADDITIONAL_SUCCESS;
429  } else {
431  }
432 }
433 
434 void
436  myViewNet->getUndoList()->p_begin("delete " + additional->getDescription());
437  myViewNet->getUndoList()->add(new GNEChange_Additional(additional, false), true);
439 }
440 
441 
442 long
443 GNEAdditionalFrame::onCmdSelectAdditional(FXObject*, FXSelector, void*) {
444  // obtain current allowed additional tags
445  const std::vector<SumoXMLTag>& additionalTags = GNEAttributeCarrier::allowedTags(false);
446  bool additionalNameCorrect = false;
447  // set parameters of additional, if it's correct
448  for (std::vector<SumoXMLTag>::const_iterator i = additionalTags.begin(); i != additionalTags.end(); i++) {
449  if (toString(*i) == myAdditionalMatchBox->getText().text()) {
450  myAdditionalMatchBox->setTextColor(FXRGB(0, 0, 0));
451  myadditionalParameters->show();
452  myEditorParameters->show();
454  additionalNameCorrect = true;
455  }
456  }
457  // if additional name isn't correct, hidde all
458  if (additionalNameCorrect == false) {
460  myAdditionalMatchBox->setTextColor(FXRGB(255, 0, 0));
461  myadditionalParameters->hide();
462  myEditorParameters->hide();
464  myedgeParentsSelector->hide();
465  mylaneParentsSelector->hide();
466  }
467  return 1;
468 }
469 
470 
471 void
473  // Show frame
474  GNEFrame::show();
475  // Update UseSelectedLane CheckBox
477  // Update UseSelectedLane CheckBox
479 }
480 
481 
482 void
484  // Set new actualAdditionalType
485  myActualAdditionalType = actualAdditionalType;
486  // Clear internal attributes
488  // Hide length field and reference point
491  // Obtain attributes of actual myActualAdditionalType
492  std::vector<std::pair <SumoXMLAttr, std::string> > attrs = GNEAttributeCarrier::allowedAttributes(myActualAdditionalType);
493  // Iterate over attributes of myActualAdditionalType
494  for (std::vector<std::pair <SumoXMLAttr, std::string> >::iterator i = attrs.begin(); i != attrs.end(); i++) {
497  } else if (i->first == SUMO_ATTR_ENDPOS) {
500  }
501  }
502  // if there are parmeters, show and Recalc groupBox
505  } else {
507  }
508  // Show myAdditionalParentSelector if we're adding a Entry/Exit
511  } else {
513  }
514  // Show SelectorParentEdges if we're adding an additional that own the attribute SUMO_ATTR_EDGES
517  } else {
519  }
520  // Show SelectorParentLanes if we're adding an additional that own the attribute SUMO_ATTR_LANES
523  } else {
525  }
526 }
527 
528 
529 std::string
532  if (netElement) {
533  // generate ID using netElement
534  while (myViewNet->getNet()->getAdditional(myActualAdditionalType, toString(myActualAdditionalType) + "_" + netElement->getID() + "_" + toString(additionalIndex)) != NULL) {
535  additionalIndex++;
536  }
537  return toString(myActualAdditionalType) + "_" + netElement->getID() + "_" + toString(additionalIndex);
538  } else {
539  // generate ID without netElement
540  while (myViewNet->getNet()->getAdditional(myActualAdditionalType, toString(myActualAdditionalType) + "_" + toString(additionalIndex)) != NULL) {
541  additionalIndex++;
542  }
543  return toString(myActualAdditionalType) + "_" + toString(additionalIndex);
544  }
545 }
546 
547 
548 double
549 GNEAdditionalFrame::setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional) {
552  return positionOfTheMouseOverLane;
554  if (positionOfTheMouseOverLane - lengthOfAdditional >= 0.01) {
555  return positionOfTheMouseOverLane - lengthOfAdditional;
557  return 0.01;
558  } else {
559  return -1;
560  }
561  }
563  if (positionOfTheMouseOverLane - lengthOfAdditional / 2 >= 0.01) {
564  return positionOfTheMouseOverLane - lengthOfAdditional / 2;
566  return 0;
567  } else {
568  return -1;
569  }
570  }
571  default:
572  return -1;
573  }
574 }
575 
576 
577 double
578 GNEAdditionalFrame::setEndPosition(double laneLength, double positionOfTheMouseOverLane, double lengthOfAdditional) {
581  if (positionOfTheMouseOverLane + lengthOfAdditional <= laneLength - 0.01) {
582  return positionOfTheMouseOverLane + lengthOfAdditional;
584  return laneLength - 0.01;
585  } else {
586  return -1;
587  }
588  }
590  return positionOfTheMouseOverLane;
592  if (positionOfTheMouseOverLane + lengthOfAdditional / 2 <= laneLength - 0.01) {
593  return positionOfTheMouseOverLane + lengthOfAdditional / 2;
595  return laneLength - 0.01;
596  } else {
597  return -1;
598  }
599  }
600  default:
601  return -1;
602  }
603 }
604 
605 // ---------------------------------------------------------------------------
606 // GNEAdditionalFrame::AdditionalAttributeSingle - methods
607 // ---------------------------------------------------------------------------
608 
610  FXHorizontalFrame(parent, GUIDesignAuxiliarHorizontalFrame),
611  myAdditionalTag(SUMO_TAG_NOTHING),
612  myAdditionalAttr(SUMO_ATTR_NOTHING) {
613  // Create visual elements
614  myLabel = new FXLabel(this, "name", 0, GUIDesignLabelAttribute);
619  // Hide elements
620  hideParameter();
621 }
622 
623 
625 
626 
627 void
629  myAdditionalTag = additionalTag;
630  myAdditionalAttr = additionalAttr;
631  myInvalidValue = "";
632  myLabel->setText(toString(myAdditionalAttr).c_str());
633  myLabel->show();
634  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
635  myTextFieldStrings->setText(value.c_str());
636  myTextFieldStrings->show();
637  show();
638 }
639 
640 
641 void
643  myAdditionalTag = additionalTag;
644  myAdditionalAttr = additionalAttr;
645  myInvalidValue = "";
646  myLabel->setText(toString(myAdditionalAttr).c_str());
647  myLabel->show();
648  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
649  myTextFieldInt->setText(toString(value).c_str());
650  myTextFieldInt->show();
651  show();
652 }
653 
654 
655 void
657  myAdditionalTag = additionalTag;
658  myAdditionalAttr = additionalAttr;
659  myInvalidValue = "";
660  myLabel->setText(toString(myAdditionalAttr).c_str());
661  myLabel->show();
662  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
663  myTextFieldReal->setText(toString(value).c_str());
664  myTextFieldReal->show();
665  show();
666 }
667 
668 
669 void
671  myAdditionalTag = additionalTag;
672  myAdditionalAttr = additionalAttr;
673  myInvalidValue = "";
674  myLabel->setText(toString(myAdditionalAttr).c_str());
675  myLabel->show();
676  if (value == true) {
677  myBoolCheckButton->setCheck(true);
678  myBoolCheckButton->setText("true");
679  } else {
680  myBoolCheckButton->setCheck(false);
681  myBoolCheckButton->setText("false");
682  }
683  myBoolCheckButton->show();
684  show();
685 }
686 
687 
688 void
692  myLabel->hide();
693  myTextFieldInt->hide();
694  myTextFieldReal->hide();
695  myTextFieldStrings->hide();
696  myBoolCheckButton->hide();
697  hide();
698 }
699 
700 
703  return myAdditionalTag;
704 }
705 
706 
709  return myAdditionalAttr;
710 }
711 
712 
713 std::string
716  return (myBoolCheckButton->getCheck() == 1) ? "true" : "false";
718  return myTextFieldInt->getText().text();
720  return myTextFieldReal->getText().text();
721  } else {
722  return myTextFieldStrings->getText().text();
723  }
724 }
725 
726 
727 const std::string&
729  return myInvalidValue;
730 }
731 
732 
733 long
735  // We assume that current value is valid
736  myInvalidValue = "";
737  // Check if format of current value of myTextField is correct
739  if (GNEAttributeCarrier::canParse<int>(myTextFieldInt->getText().text())) {
740  // convert string to int
741  int intValue = GNEAttributeCarrier::parse<int>(myTextFieldInt->getText().text());
742  // Check if int value must be positive
744  myInvalidValue = "'" + toString(myAdditionalAttr) + "' cannot be negative";
745  }
746  } else {
747  myInvalidValue = "'" + toString(myAdditionalAttr) + "' doesn't have a valid 'int' format";
748  }
750  // time attributes work as positive doubles
751  if (GNEAttributeCarrier::canParse<double>(myTextFieldReal->getText().text())) {
752  // convert string to double
753  double doubleValue = GNEAttributeCarrier::parse<double>(myTextFieldReal->getText().text());
754  // Check if parsed value is negative
755  if (doubleValue < 0) {
756  myInvalidValue = "'" + toString(myAdditionalAttr) + "' cannot be negative";
757  }
758  } else {
759  myInvalidValue = "'" + toString(myAdditionalAttr) + "' doesn't have a valid 'time' format";
760  }
762  if (GNEAttributeCarrier::canParse<double>(myTextFieldReal->getText().text())) {
763  // convert string to double
764  double doubleValue = GNEAttributeCarrier::parse<double>(myTextFieldReal->getText().text());
765  // Check if double value must be positive
767  myInvalidValue = "'" + toString(myAdditionalAttr) + "' cannot be negative";
768  // check if double value is a probability
769  } else if (GNEAttributeCarrier::isProbability(myAdditionalTag, myAdditionalAttr) && ((doubleValue < 0) || doubleValue > 1)) {
770  myInvalidValue = "'" + toString(myAdditionalAttr) + "' takes only values between 0 and 1";
771  }
772  } else {
773  myInvalidValue = "'" + toString(myAdditionalAttr) + "' doesn't have a valid 'float' format";
774  }
776  // check if filename format is valid
777  if (GNEAttributeCarrier::isValidFilename(myTextFieldStrings->getText().text()) == false) {
778  myInvalidValue = "input contains invalid characters for a filename";
779  }
780  }
781  // change color of text field depending of myCurrentValueValid
782  if (myInvalidValue.size() == 0) {
783  myTextFieldInt->setTextColor(FXRGB(0, 0, 0));
784  myTextFieldInt->killFocus();
785  myTextFieldReal->setTextColor(FXRGB(0, 0, 0));
786  myTextFieldReal->killFocus();
787  myTextFieldStrings->setTextColor(FXRGB(0, 0, 0));
788  myTextFieldStrings->killFocus();
789  } else {
790  // IF value of TextField isn't valid, change their color to Red
791  myTextFieldInt->setTextColor(FXRGB(255, 0, 0));
792  myTextFieldReal->setTextColor(FXRGB(255, 0, 0));
793  myTextFieldStrings->setTextColor(FXRGB(255, 0, 0));
794  }
795  // Update aditional frame
796  update();
797  return 1;
798 }
799 
800 
801 long
803  if (myBoolCheckButton->getCheck()) {
804  myBoolCheckButton->setText("true");
805  } else {
806  myBoolCheckButton->setText("false");
807  }
808  return 0;
809 }
810 
811 // ---------------------------------------------------------------------------
812 // GNEAdditionalFrame::AdditionalAttributeList - methods
813 // ---------------------------------------------------------------------------
814 
816  FXVerticalFrame(parent, GUIDesignAuxiliarHorizontalFrame),
819  myNumberOfVisibleTextfields(1),
820  myMaxNumberOfValuesInParameterList(20) {
821  // Create elements
822  for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) {
823  myHorizontalFrames.push_back(new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame));
824  myLabels.push_back(new FXLabel(myHorizontalFrames.back(), "name", 0, GUIDesignLabelAttribute));
826  }
827  // Create label Row
828  myHorizontalFrameButtons = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
829  myLabels.push_back(new FXLabel(myHorizontalFrameButtons, "Rows", 0, GUIDesignLabelAttribute));
830  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(myHorizontalFrameButtons, GUIDesignAuxiliarHorizontalFrame);
831  // Create add button
832  myAddButton = new FXButton(buttonsFrame, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_ADDROW, GUIDesignButtonIcon);
833  // Create remove buttons
835  // Hide all para meters
836  hideParameter();
837 }
838 
839 
841 
842 
843 void
844 GNEAdditionalFrame::AdditionalAttributeList::showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<int> /* value */) {
845  myAdditionalTag = additionalTag;
846  myAdditionalAttr = additionalAttr;
847  // @todo finish
848 }
849 
850 
851 void
852 GNEAdditionalFrame::AdditionalAttributeList::showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<double> /* value */, bool /*isTime*/) {
853  myAdditionalTag = additionalTag;
854  myAdditionalAttr = additionalAttr;
855  // @todo finish
856 }
857 
858 
859 void
860 GNEAdditionalFrame::AdditionalAttributeList::showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<bool> /* value */) {
861  myAdditionalTag = additionalTag;
862  myAdditionalAttr = additionalAttr;
863  // @todo finish
864 }
865 
866 
867 void
869  if ((int)value.size() < myMaxNumberOfValuesInParameterList) {
870  myAdditionalTag = tag;
871  myAdditionalAttr = attr;
872  myNumberOfVisibleTextfields = (int)value.size();
873  if (myNumberOfVisibleTextfields == 0) {
875  }
876  for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) {
877  myLabels.at(i)->setText((toString(attr) + ": " + toString(i)).c_str());
878  }
879  for (int i = 0; i < myNumberOfVisibleTextfields; i++) {
880  myHorizontalFrames.at(i)->show();
881  }
882  myHorizontalFrameButtons->show();
883  FXVerticalFrame::show();
884  }
885 }
886 
887 
888 void
892  for (int i = 0; i < (int)myHorizontalFrames.size(); i++) {
893  myHorizontalFrames.at(i)->hide();
894  }
895  myHorizontalFrameButtons->hide();
896  FXVerticalFrame::hide();
897 }
898 
899 
902  return myAdditionalTag;
903 }
904 
907  return myAdditionalAttr;
908 }
909 
910 
911 std::string
913  // Declare, fill and return a string with the list values
914  std::string value;
915  for (int i = 0; i < myNumberOfVisibleTextfields; i++) {
916  if (!myTextFields.at(i)->getText().empty()) {
917  value += (myTextFields.at(i)->getText().text() + std::string(" "));
918  }
919  }
920  return value;
921 }
922 
923 
924 bool
927  return true;
928 }
929 
930 
931 long
936  getParent()->recalc();
937  }
938  return 1;
939 }
940 
941 
942 long
944  if (myNumberOfVisibleTextfields > 1) {
947  myTextFields.at(myNumberOfVisibleTextfields)->setText("");
948  getParent()->recalc();
949  }
950  return 1;
951 }
952 
953 // ---------------------------------------------------------------------------
954 // GNEAdditionalFrame::NeteditAttributes- methods
955 // ---------------------------------------------------------------------------
956 
958  FXGroupBox(parent, "Internal attributes", GUIDesignGroupBoxFrame),
959  myViewNet(viewNet),
960  myIndexParameter(0),
961  myIndexParameterList(0),
962  maxNumberOfParameters(GNEAttributeCarrier::getHigherNumberOfAttributes()),
963  maxNumberOfListParameters(2) {
964 
965  // Create single parameters
966  for (int i = 0; i < maxNumberOfParameters; i++) {
968  }
969 
970  // Create single list parameters
971  for (int i = 0; i < maxNumberOfListParameters; i++) {
973  }
974 
975  // Create help button
976  helpAdditional = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
977 }
978 
979 
981 }
982 
983 
984 void
986  // Hidde al fields
987  for (int i = 0; i < maxNumberOfParameters; i++) {
988  myVectorOfsingleAdditionalParameter.at(i)->hideParameter();
989  }
990 
991  // Hidde al list fields
992  for (int i = 0; i < maxNumberOfListParameters; i++) {
993  myVectorOfsingleAdditionalParameterList.at(i)->hideParameter();
994  }
995 
996  // Reset indexs
998  myIndexParameter = 0;
999 }
1000 
1001 
1002 void
1004  // Set current additional
1005  myAdditionalTag = additionalTag;
1006  // If parameter is of type list
1007  if (GNEAttributeCarrier::isList(myAdditionalTag, AdditionalAttributeSingle)) {
1008  // If parameter can be show
1010  // Check type of attribute list
1011  if (GNEAttributeCarrier::isInt(myAdditionalTag, AdditionalAttributeSingle)) {
1012  myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector<int> >(myAdditionalTag, AdditionalAttributeSingle));
1013  } else if (GNEAttributeCarrier::isFloat(myAdditionalTag, AdditionalAttributeSingle)) {
1014  myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector<double> >(myAdditionalTag, AdditionalAttributeSingle));
1015  } else if (GNEAttributeCarrier::isTime(myAdditionalTag, AdditionalAttributeSingle)) {
1016  myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector<double> >(myAdditionalTag, AdditionalAttributeSingle), true);
1017  } else if (GNEAttributeCarrier::isBool(myAdditionalTag, AdditionalAttributeSingle)) {
1018  myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector<bool> >(myAdditionalTag, AdditionalAttributeSingle));
1019  } else if (GNEAttributeCarrier::isString(myAdditionalTag, AdditionalAttributeSingle)) {
1020  myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector<std::string> >(myAdditionalTag, AdditionalAttributeSingle));
1021  }
1022  // Update index
1024  } else {
1025  WRITE_ERROR("Max number of list attributes reached (" + toString(maxNumberOfListParameters) + ").");
1026  }
1027  } else {
1029  // Check type of attribute list
1030  if (GNEAttributeCarrier::isInt(myAdditionalTag, AdditionalAttributeSingle)) {
1031  myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue<int>(myAdditionalTag, AdditionalAttributeSingle));
1032  } else if (GNEAttributeCarrier::isFloat(myAdditionalTag, AdditionalAttributeSingle) || GNEAttributeCarrier::isTime(myAdditionalTag, AdditionalAttributeSingle)) {
1033  myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue<double>(myAdditionalTag, AdditionalAttributeSingle));
1034  } else if (GNEAttributeCarrier::isBool(myAdditionalTag, AdditionalAttributeSingle)) {
1035  myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue<bool>(myAdditionalTag, AdditionalAttributeSingle));
1036  } else if (GNEAttributeCarrier::isString(myAdditionalTag, AdditionalAttributeSingle)) {
1037  myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue<std::string>(myAdditionalTag, AdditionalAttributeSingle));
1038  } else {
1039  WRITE_WARNING("Attribute '" + toString(AdditionalAttributeSingle) + "' doesn't have a defined type. Check definition in GNEAttributeCarrier");
1040  }
1041  // Update index parameter
1042  myIndexParameter++;
1043  } else {
1044  WRITE_ERROR("Max number of attributes reached (" + toString(maxNumberOfParameters) + ").");
1045  }
1046  }
1047 }
1048 
1049 
1050 void
1052  recalc();
1053  show();
1054 }
1055 
1056 
1057 void
1059  hide();
1060 }
1061 
1062 
1063 std::map<SumoXMLAttr, std::string>
1065  std::map<SumoXMLAttr, std::string> values;
1066  // get standar Parameters
1067  for (int i = 0; i < myIndexParameter; i++) {
1068  values[myVectorOfsingleAdditionalParameter.at(i)->getAttr()] = myVectorOfsingleAdditionalParameter.at(i)->getValue();
1069  }
1070  // get list parameters
1071  for (int i = 0; i < myIndexParameterList; i++) {
1072  values[myVectorOfsingleAdditionalParameterList.at(i)->getAttr()] = myVectorOfsingleAdditionalParameterList.at(i)->getListValues();
1073  }
1074  return values;
1075 }
1076 
1077 
1078 void
1080  std::string errorMessage;
1081  // iterate over standar parameters
1082  for (int i = 0; (i < myIndexParameter) && (errorMessage.empty() == true); i++) {
1083  // Return string with the error if at least one of the parameter isn't valid
1084  std::string attributeValue = myVectorOfsingleAdditionalParameter.at(i)->isAttributeValid();
1085  if (attributeValue.size() != 0) {
1086  errorMessage = attributeValue;
1087  }
1088  }
1089  // iterate over list parameters
1090  for (int i = 0; i < myIndexParameterList; i++) {
1091  // Return false if at least one of the list parameter isn't valid
1092  if (myVectorOfsingleAdditionalParameterList.at(i)->isCurrentListValid() == false) {
1093  ;
1094  }
1095  }
1096  // show warning box if input parameters aren't invalid
1097  if (extra.size() == 0) {
1098  errorMessage = "Invalid input parameter of " + toString(myAdditionalTag) + ": " + errorMessage;
1099  } else {
1100  errorMessage = "Invalid input parameter of " + toString(myAdditionalTag) + ": " + extra;
1101  }
1102 
1103  // set message in status bar
1104  myViewNet->setStatusBarText(errorMessage);
1105  // Write Warning in console if we're in testing mode
1106  if (myViewNet->isTestingModeEnabled() == true) {
1107  WRITE_WARNING(errorMessage);
1108  }
1109 }
1110 
1111 
1112 bool
1114  // iterate over standar parameters
1115  for (int i = 0; i < myIndexParameter; i++) {
1116  // Return false if error message of attriuve isn't empty
1117  if (myVectorOfsingleAdditionalParameter.at(i)->isAttributeValid().size() != 0) {
1118  return false;
1119  }
1120  }
1121  // iterate over list parameters
1122  for (int i = 0; i < myIndexParameterList; i++) {
1123  // Return false if at least one of the list parameter isn't valid
1124  if (myVectorOfsingleAdditionalParameterList.at(i)->isCurrentListValid() == false) {
1125  return false;
1126  }
1127  }
1128  return true;
1129 }
1130 
1131 
1132 int
1135 }
1136 
1137 
1138 long
1140  // Create help dialog
1141  FXDialogBox* helpDialog = new FXDialogBox(this, ("Parameters of " + toString(myAdditionalTag)).c_str(), GUIDesignDialogBox);
1142  // Create FXTable
1143  FXTable* myTable = new FXTable(helpDialog, this, MID_TABLE, TABLE_READONLY);
1144  myTable->setVisibleRows((FXint)(myIndexParameter + myIndexParameterList));
1145  myTable->setVisibleColumns(3);
1146  myTable->setTableSize((FXint)(myIndexParameter + myIndexParameterList), 3);
1147  myTable->setBackColor(FXRGB(255, 255, 255));
1148  myTable->setColumnText(0, "Name");
1149  myTable->setColumnText(1, "Value");
1150  myTable->setColumnText(2, "Definition");
1151  myTable->getRowHeader()->setWidth(0);
1152  FXHeader* header = myTable->getColumnHeader();
1153  header->setItemJustify(0, JUSTIFY_CENTER_X);
1154  header->setItemSize(0, 120);
1155  header->setItemJustify(1, JUSTIFY_CENTER_X);
1156  header->setItemSize(1, 80);
1157  int maxSizeColumnDefinitions = 0;
1158  // Iterate over vector of additional parameters
1159  for (int i = 0; i < myIndexParameter; i++) {
1160  SumoXMLTag tag = myVectorOfsingleAdditionalParameter.at(i)->getTag();
1161  SumoXMLAttr attr = myVectorOfsingleAdditionalParameter.at(i)->getAttr();
1162  // Set name of attribute
1163  myTable->setItem(i, 0, new FXTableItem(toString(attr).c_str()));
1164  // Set type
1165  FXTableItem* type = new FXTableItem("");
1166  if (GNEAttributeCarrier::isInt(tag, attr)) {
1167  type->setText("int");
1168  } else if (GNEAttributeCarrier::isFloat(tag, attr)) {
1169  type->setText("float");
1170  } else if (GNEAttributeCarrier::isTime(tag, attr)) {
1171  type->setText("time");
1172  } else if (GNEAttributeCarrier::isBool(tag, attr)) {
1173  type->setText("bool");
1174  } else if (GNEAttributeCarrier::isString(tag, attr)) {
1175  type->setText("string");
1176  }
1177  type->setJustify(FXTableItem::CENTER_X);
1178  myTable->setItem(i, 1, type);
1179  // Set definition
1180  FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).c_str());
1181  definition->setJustify(FXTableItem::LEFT);
1182  myTable->setItem(i, 2, definition);
1183  if ((int)GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size() > maxSizeColumnDefinitions) {
1184  maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size());
1185  }
1186  }
1187  // Iterate over vector of additional parameters list
1188  for (int i = 0; i < myIndexParameterList; i++) {
1190  SumoXMLAttr attr = myVectorOfsingleAdditionalParameterList.at(i)->getAttr();
1191  // Set name of attribute
1192  myTable->setItem(i, 0, new FXTableItem(toString(attr).c_str()));
1193  // Set type
1194  FXTableItem* type = new FXTableItem("");
1195  if (GNEAttributeCarrier::isInt(tag, attr)) {
1196  type->setText("list of integers");
1197  } else if (GNEAttributeCarrier::isFloat(tag, attr)) {
1198  type->setText("list of floats");
1199  } else if (GNEAttributeCarrier::isTime(tag, attr)) {
1200  type->setText("list of times");
1201  } else if (GNEAttributeCarrier::isBool(tag, attr)) {
1202  type->setText("list of booleans");
1203  } else if (GNEAttributeCarrier::isString(tag, attr)) {
1204  type->setText("list of strings");
1205  }
1206  type->setJustify(FXTableItem::CENTER_X);
1207  myTable->setItem(i, 1, type);
1208  // Set definition
1209  FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).c_str());
1210  definition->setJustify(FXTableItem::LEFT);
1211  myTable->setItem(i, 2, definition);
1212  if ((int)GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size() > maxSizeColumnDefinitions) {
1213  maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size());
1214  }
1215  }
1216  // Set size of column
1217  header->setItemJustify(2, JUSTIFY_CENTER_X);
1218  header->setItemSize(2, maxSizeColumnDefinitions * 6);
1219  // Button Close
1220  new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
1221  helpDialog->create();
1222  helpDialog->show();
1223  return 1;
1224 }
1225 
1226 // ---------------------------------------------------------------------------
1227 // GNEAdditionalFrame::NeteditAttributes- methods
1228 // ---------------------------------------------------------------------------
1229 
1231  FXGroupBox(parent, "Netedit attributes", GUIDesignGroupBoxFrame),
1232  myActualAdditionalReferencePoint(GNE_ADDITIONALREFERENCEPOINT_LEFT),
1233  myCurrentLengthValid(true) {
1234  // Create FXListBox for the reference points and fill it
1236  myReferencePointMatchBox->appendItem("reference left");
1237  myReferencePointMatchBox->appendItem("reference right");
1238  myReferencePointMatchBox->appendItem("reference center");
1239  // Create Frame for Length Label and textField
1240  FXHorizontalFrame* lengthFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1241  myLengthLabel = new FXLabel(lengthFrame, toString(SUMO_ATTR_LENGTH).c_str(), 0, GUIDesignLabelAttribute);
1243  myLengthTextField->setText("10");
1244  // Create Frame for force position Label and checkBox (By default disabled)
1245  FXHorizontalFrame* forcePositionFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1246  myForcePositionLabel = new FXLabel(forcePositionFrame, "force position", 0, GUIDesignLabelAttribute);
1247  myForcePositionCheckButton = new FXCheckButton(forcePositionFrame, "false", this, MID_GNE_MODE_ADDITIONAL_FORCEPOSITION, GUIDesignCheckButtonAttribute);
1248  myForcePositionCheckButton->setCheck(false);
1249  // Create Frame for block movement label and checkBox (By default disabled)
1250  FXHorizontalFrame* blockMovement = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1251  myBlockLabel = new FXLabel(blockMovement, "block movement", 0, GUIDesignLabelAttribute);
1252  myBlockMovementCheckButton = new FXCheckButton(blockMovement, "false", this, MID_GNE_SET_BLOCKING, GUIDesignCheckButtonAttribute);
1253  myBlockMovementCheckButton->setCheck(false);
1254  // Create help button
1255  helpReferencePoint = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
1256  // Set visible items
1257  myReferencePointMatchBox->setNumVisible((int)myReferencePointMatchBox->getNumItems());
1258 }
1259 
1260 
1262 
1263 
1264 void
1266  myLengthLabel->show();
1267  myLengthTextField->show();
1268 }
1269 
1270 
1271 void
1273  myLengthLabel->hide();
1274  myLengthTextField->hide();
1275 }
1276 
1277 
1278 void
1280  myReferencePointMatchBox->show();
1281  myForcePositionLabel->show();
1283 }
1284 
1285 
1286 void
1288  myReferencePointMatchBox->hide();
1289  myForcePositionLabel->hide();
1291 }
1292 
1293 
1297 }
1298 
1299 
1300 double
1302  return GNEAttributeCarrier::parse<double>(myLengthTextField->getText().text());
1303 }
1304 
1305 
1306 bool
1308  return myBlockMovementCheckButton->getCheck() == 1 ? true : false;
1309 }
1310 
1311 
1312 bool
1314  return myForcePositionCheckButton->getCheck() == 1 ? true : false;
1315 }
1316 
1317 bool
1319  return myCurrentLengthValid;
1320 }
1321 
1322 
1323 long
1325  // change color of text field depending of the input length
1326  if (GNEAttributeCarrier::canParse<double>(myLengthTextField->getText().text()) &&
1327  GNEAttributeCarrier::parse<double>(myLengthTextField->getText().text()) > 0) {
1328  myLengthTextField->setTextColor(FXRGB(0, 0, 0));
1329  myLengthTextField->killFocus();
1330  myCurrentLengthValid = true;
1331  } else {
1332  myLengthTextField->setTextColor(FXRGB(255, 0, 0));
1333  myCurrentLengthValid = false;
1334  }
1335  // Update aditional frame
1336  update();
1337  return 1;
1338 }
1339 
1340 
1341 long
1343  // Cast actual reference point type
1344  if (myReferencePointMatchBox->getText() == "reference left") {
1345  myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
1347  myLengthTextField->enable();
1348  myForcePositionCheckButton->enable();
1349  } else if (myReferencePointMatchBox->getText() == "reference right") {
1350  myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
1352  myLengthTextField->enable();
1353  myForcePositionCheckButton->enable();
1354  } else if (myReferencePointMatchBox->getText() == "reference center") {
1355  myLengthTextField->enable();
1356  myForcePositionCheckButton->enable();
1357  myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
1359  myLengthTextField->enable();
1360  myForcePositionCheckButton->enable();
1361  } else {
1362  myReferencePointMatchBox->setTextColor(FXRGB(255, 0, 0));
1364  myLengthTextField->disable();
1365  myForcePositionCheckButton->disable();
1366  }
1367  return 1;
1368 }
1369 
1370 
1371 long
1373  if (myBlockMovementCheckButton->getCheck()) {
1374  myBlockMovementCheckButton->setText("true");
1375  } else {
1376  myBlockMovementCheckButton->setText("false");
1377  }
1378  return 1;
1379 }
1380 
1381 
1382 long
1384  if (myForcePositionCheckButton->getCheck()) {
1385  myForcePositionCheckButton->setText("true");
1386  } else {
1387  myForcePositionCheckButton->setText("false");
1388  }
1389  return 1;
1390 }
1391 
1392 
1393 long
1395  FXDialogBox* helpDialog = new FXDialogBox(this, "Parameter editor Help", GUIDesignDialogBox);
1396  std::ostringstream help;
1397  help
1398  << "Referece point: Mark the initial position of the additional element.\n"
1399  << "Example: If you want to create a busStop with a length of 30 in the point 100 of the lane:\n"
1400  << "- Reference Left will create it with startPos = 70 and endPos = 100.\n"
1401  << "- Reference Right will create it with startPos = 100 and endPos = 130.\n"
1402  << "- Reference Center will create it with startPos = 85 and endPos = 115.\n"
1403  << "\n"
1404  << "Force position: if is enabled, will create the additional adapting size of additional element to lane.\n"
1405  << "Example: If you have a lane with length = 100, but you try to create a busStop with size = 50\n"
1406  << "in the position 80 of the lane, a busStop with startPos = 80 and endPos = 100 will be created\n"
1407  << "instead of a busStop with startPos = 80 and endPos = 130.\n"
1408  << "\n"
1409  << "Block movement: if is enabled, the created additional element will be blocked. i.e. cannot be moved with\n"
1410  << "the mouse. This option can be modified with the Inspector.";
1411  new FXLabel(helpDialog, help.str().c_str(), 0, GUIDesignLabelLeft);
1412  // "OK"
1413  new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
1414  helpDialog->create();
1415  helpDialog->show();
1416  return 1;
1417 }
1418 
1419 
1420 std::string
1422  // Obtain Id's of list
1423  std::string vectorOfIds;
1424  for (int i = 0; i < list->getNumItems(); i++) {
1425  if (list->isItemSelected(i)) {
1426  if (vectorOfIds.size() > 0) {
1427  vectorOfIds += " ";
1428  }
1429  vectorOfIds += (list->getItem(i)->getText()).text();
1430  }
1431  }
1432  return vectorOfIds;
1433 }
1434 
1435 
1436 
1437 // ---------------------------------------------------------------------------
1438 // GNEAdditionalFrame::SelectorParentAdditional - methods
1439 // ---------------------------------------------------------------------------
1440 
1442  FXGroupBox(parent, "Additional Set selector", GUIDesignGroupBoxFrame),
1443  myUniqueSelection(false),
1444  myViewNet(viewNet) {
1445 
1446  // Create label with the type of SelectorParentAdditional
1447  mySetLabel = new FXLabel(this, "No additional selected", 0, GUIDesignLabelLeftThick);
1448 
1449  // Create list
1450  myList = new FXList(this, this, MID_GNE_SELECTADDITIONALPARENT, GUIDesignList, 0, 0, 0, 100);
1451 
1452  // Create help button
1453  myHelpAdditionalParentSelector = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
1454 
1455  // Hide List
1457 }
1458 
1459 
1461 
1462 
1463 std::string
1465  for (int i = 0; i < myList->getNumItems(); i++) {
1466  if (myList->isItemSelected(i)) {
1467  return myList->getItem(i)->getText().text();
1468  }
1469  }
1470  return "";
1471 }
1472 
1473 
1474 void
1476  myUniqueSelection = uniqueSelection;
1477  mySetLabel->setText(("" + toString(type)).c_str());
1478  myList->clearItems();
1479  // obtain all additionals of class "type"
1480  std::vector<GNEAdditional*> vectorOfAdditionalParents = myViewNet->getNet()->getAdditionals(type);
1481  // fill list with IDs of additionals
1482  for (std::vector<GNEAdditional*>::iterator i = vectorOfAdditionalParents.begin(); i != vectorOfAdditionalParents.end(); i++) {
1483  myList->appendItem((*i)->getID().c_str());
1484  }
1485  show();
1486 }
1487 
1488 
1489 void
1491  hide();
1492 }
1493 
1494 
1495 long
1497  return 1;
1498 }
1499 
1500 
1501 long
1503  return 1;
1504 }
1505 
1506 
1507 // ---------------------------------------------------------------------------
1508 // GNEAdditionalFrame::SelectorParentEdges - methods
1509 // ---------------------------------------------------------------------------
1510 
1512  FXGroupBox(parent, "Edges", GUIDesignGroupBoxFrame),
1513  myViewNet(viewNet) {
1514  // Create menuCheck for selected edges
1515  myUseSelectedEdgesCheckButton = new FXCheckButton(this, ("Use selected " + toString(SUMO_TAG_EDGE) + "s").c_str(), this, MID_GNE_SHOWONLYSELECTEDEDGES, GUIDesignCheckButtonAttribute);
1516 
1517  // Create search box
1519 
1520  // Create list
1521  myList = new FXList(this, this, MID_GNE_SELECTEDGE, GUIDesignList, 0, 0, 0, 100);
1522 
1523  // Create horizontal frame
1524  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1525 
1526  // Create button for clear selection
1527  myClearEdgesSelection = new FXButton(buttonsFrame, "Clear", 0, this, MID_GNE_CLEAREDGESELECTION, GUIDesignButtonRectangular);
1528 
1529  // Create button for invert selection
1530  myInvertEdgesSelection = new FXButton(buttonsFrame, "Invert", 0, this, MID_GNE_INVERTEDGESELECTION, GUIDesignButtonRectangular);
1531 
1532  // Create help button
1533  myHelpedgeParentsSelector = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
1534 
1535  // Hide List
1536  hideList();
1537 }
1538 
1539 
1541 
1542 
1543 std::string
1546 }
1547 
1548 
1549 void
1551  // clear list of egdge ids
1552  myList->clearItems();
1553  // get all edges of net
1555  std::vector<GNEEdge*> vectorOfEdges = myViewNet->getNet()->retrieveEdges(false);
1556  // iterate over edges of net
1557  for (std::vector<GNEEdge*>::iterator i = vectorOfEdges.begin(); i != vectorOfEdges.end(); i++) {
1558  // If search criterium is correct, then append ittem
1559  if ((*i)->getID().find(search) != std::string::npos) {
1560  myList->appendItem((*i)->getID().c_str());
1561  }
1562  }
1563  // By default, CheckBox for useSelectedEdges isn't checked
1564  myUseSelectedEdgesCheckButton->setCheck(false);
1565  // Recalc Frame
1566  recalc();
1567  // Update Frame
1568  update();
1569  // Show dialog
1570  show();
1571 }
1572 
1573 
1574 void
1576  FXGroupBox::hide();
1577 }
1578 
1579 
1580 void
1582  // Enable or disable use selected edges
1583  if (myViewNet->getNet()->retrieveEdges(true).size() > 0) {
1585  } else {
1586  myUseSelectedEdgesCheckButton->disable();
1587  }
1588 }
1589 
1590 
1591 bool
1593  if (myUseSelectedEdgesCheckButton->getCheck()) {
1594  return true;
1595  } else {
1596  return false;
1597  }
1598 }
1599 
1600 
1601 long
1603  if (myUseSelectedEdgesCheckButton->getCheck()) {
1604  myEdgesSearch->hide();
1605  myList->hide();
1606  myClearEdgesSelection->hide();
1607  myInvertEdgesSelection->hide();
1608  myHelpedgeParentsSelector->hide();
1609  } else {
1610  myEdgesSearch->show();
1611  myList->show();
1612  myClearEdgesSelection->show();
1613  myInvertEdgesSelection->show();
1614  myHelpedgeParentsSelector->show();
1615  }
1616  // Recalc Frame
1617  recalc();
1618  // Update Frame
1619  update();
1620  return 1;
1621 }
1622 
1623 
1624 long
1626  // Show only Id's of SelectorParentEdges that contains the searched string
1627  showList(myEdgesSearch->getText().text());
1628  return 1;
1629 }
1630 
1631 
1632 long
1634  return 1;
1635 }
1636 
1637 
1638 long
1640  for (int i = 0; i < myList->getNumItems(); i++) {
1641  if (myList->getItem(i)->isSelected()) {
1642  myList->deselectItem(i);
1643  }
1644  }
1645  return 1;
1646 }
1647 
1648 
1649 long
1651  for (int i = 0; i < myList->getNumItems(); i++) {
1652  if (myList->getItem(i)->isSelected()) {
1653  myList->deselectItem(i);
1654  } else {
1655  myList->selectItem(i);
1656  }
1657  }
1658  return 1;
1659 }
1660 
1661 
1662 long
1664  std::cout << "IMPLEMENT" << std::endl;
1665  return 1;
1666 }
1667 
1668 // ---------------------------------------------------------------------------
1669 // GNEAdditionalFrame::SelectorParentLanes - methods
1670 // ---------------------------------------------------------------------------
1671 
1673  FXGroupBox(parent, "Lanes", GUIDesignGroupBoxFrame),
1674  myViewNet(viewNet) {
1675  // Create CheckBox for selected lanes
1676  myUseSelectedLanesCheckButton = new FXCheckButton(this, ("Use selected " + toString(SUMO_TAG_LANE) + "s").c_str(), this, MID_GNE_USESELECTEDLANES, GUIDesignCheckButtonAttribute);
1677 
1678  // Create search box
1680 
1681  // Create list
1682  myList = new FXList(this, this, MID_GNE_SELECTLANE, GUIDesignList, 0, 0, 0, 100);
1683 
1684  // Create horizontal frame
1685  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1686 
1687  // Create button for clear selection
1688  clearLanesSelection = new FXButton(buttonsFrame, "clear", 0, this, MID_GNE_CLEARLANESELECTION, GUIDesignButtonRectangular);
1689 
1690  // Create button for invert selection
1691  invertLanesSelection = new FXButton(buttonsFrame, "invert", 0, this, MID_GNE_INVERTLANESELECTION, GUIDesignButtonRectangular);
1692 
1693  // Create help button
1694  helpLanes = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
1695 
1696  // Hide List
1697  hideList();
1698 }
1699 
1700 
1702 
1703 
1704 std::string
1707 }
1708 
1709 
1710 void
1712  myList->clearItems();
1713  std::vector<GNELane*> vectorOfLanes = myViewNet->getNet()->retrieveLanes(false);
1714  for (std::vector<GNELane*>::iterator i = vectorOfLanes.begin(); i != vectorOfLanes.end(); i++) {
1715  if ((*i)->getID().find(search) != std::string::npos) {
1716  myList->appendItem((*i)->getID().c_str());
1717  }
1718  }
1719  // By default, CheckBox for useSelectedLanes isn't checked
1720  myUseSelectedLanesCheckButton->setCheck(false);
1721  // Show list
1722  show();
1723 }
1724 
1725 
1726 void
1728  hide();
1729 }
1730 
1731 
1732 void
1734  // Enable or disable use selected Lanes
1735  if (myViewNet->getNet()->retrieveLanes(true).size() > 0) {
1737  } else {
1738  myUseSelectedLanesCheckButton->disable();
1739  }
1740 }
1741 
1742 
1743 bool
1745  if (myUseSelectedLanesCheckButton->getCheck()) {
1746  return true;
1747  } else {
1748  return false;
1749  }
1750 }
1751 
1752 
1753 long
1755  if (myUseSelectedLanesCheckButton->getCheck()) {
1756  myLanesSearch->hide();
1757  myList->hide();
1758  clearLanesSelection->hide();
1759  invertLanesSelection->hide();
1760  helpLanes->hide();
1761  } else {
1762  myLanesSearch->show();
1763  myList->show();
1764  clearLanesSelection->show();
1765  invertLanesSelection->show();
1766  helpLanes->show();
1767  }
1768  // Recalc Frame
1769  recalc();
1770  // Update Frame
1771  update();
1772  return 1;
1773 }
1774 
1775 
1776 long
1778  // Show only Id's of SelectorParentLanes that contains the searched string
1779  showList(myLanesSearch->getText().text());
1780  return 1;
1781 }
1782 
1783 
1784 long
1786  return 1;
1787 }
1788 
1789 
1790 long
1792  for (int i = 0; i < myList->getNumItems(); i++) {
1793  if (myList->getItem(i)->isSelected()) {
1794  myList->deselectItem(i);
1795  }
1796  }
1797  return 1;
1798 }
1799 
1800 
1801 long
1803  for (int i = 0; i < myList->getNumItems(); i++) {
1804  if (myList->getItem(i)->isSelected()) {
1805  myList->deselectItem(i);
1806  } else {
1807  myList->selectItem(i);
1808  }
1809  }
1810  return 1;
1811 }
1812 
1813 
1814 long
1816  return 1;
1817 }
1818 
1819 /****************************************************************************/
search edge
Definition: GUIAppEnum.h:592
double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional)
obtain the Start position values of StoppingPlaces and E2 detector over the lane
int maxNumberOfListParameters
max number of parameters (Defined in constructor)
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:770
SumoXMLTag
Numbers representing SUMO-XML - element names.
long onCmdSelectReferencePoint(FXObject *, FXSelector, void *)
Called when user enters another reference point.
SumoXMLAttr myAdditionalAttr
current XML attribute
additionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:197
search lane
Definition: GUIAppEnum.h:604
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:117
int maxNumberOfParameters
max number of parameters (Defined in constructor)
static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical of type float
GNEViewNet * myViewNet
pointer to viewNet
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
FXButton * myRemoveButton
Button to decrease the number of textFields.
long onCmdSelectLane(FXObject *, FXSelector, void *)
called when user select a lane of the list
begin/end of the description of a single lane
The Table.
Definition: GUIAppEnum.h:291
bool isUseSelectedLanesEnable() const
get status of checkBox UseSelectedLanes
SumoXMLAttr getAttr() const
return attribute of list
select lane
Definition: GUIAppEnum.h:608
GNEAdditionalFrame::AdditionalAttributes * myadditionalParameters
additional internal attributes
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1331
FXDEFMAP(GNEAdditionalFrame) GNEAdditionalMap[]
int myNumberOfVisibleTextfields
number of visible text fields
long onCmdSetForcePosition(FXObject *, FXSelector, void *)
Called when user changes the checkbox "force position".
Position snapToActiveGrid(const Position &pos) const
Returns a position that is mapped to the closest grid point if the grid is active.
FXList * myList
List of additional sets.
FXTextField * myTextFieldStrings
textField to modify the default value of string parameters
FXComboBox * myReferencePointMatchBox
match box with the list of reference points
bool isBlockEnabled()
check if block is enabled
attribute blocking
Definition: GUIAppEnum.h:572
double setEndPosition(double laneLength, double positionOfTheMouseOverLane, double lengthOfAdditional)
obtain the End position values of StoppingPlaces and E2 detector over the lane
FXCheckButton * myBoolCheckButton
check button to enable/disable the value of boolean parameters
long onCmdHelp(FXObject *, FXSelector, void *)
FXButton * myClearEdgesSelection
button for clear selection
std::string myInvalidValue
string which indicates the reason due current value is invalid
static bool buildAdditional(GNEViewNet *viewNet, SumoXMLTag tag, std::map< SumoXMLAttr, std::string > values)
Build additionals.
void remove2Update()
Removes the dialog to be updated.
use selected lanes
Definition: GUIAppEnum.h:606
static bool isPositive(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is only Positive (i.e. cannot take negative values)
void hideList()
hide SelectorParentLanes
SumoXMLTag getTag() const
return tag of list
long onCmdRemoveRow(FXObject *, FXSelector, void *)
add a new row int the list
long onCmdSelectAdditional(FXObject *, FXSelector, void *)
int myIndexParameter
Index for myVectorOfsingleAdditionalParameter.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
long onCmdAddRow(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:82
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
Definition: GNENet.cpp:1366
FXTextField * myLengthTextField
textField for length
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
select additional parent
Definition: GUIAppEnum.h:590
bool areValuesValid() const
check if parameters of attributes are valid
static bool isValidFilename(const std::string &value)
true if value is a valid file value
clear selection of lanes
Definition: GUIAppEnum.h:610
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
static const std::vector< std::pair< SumoXMLAttr, std::string > > & allowedAttributes(SumoXMLTag tag)
get all editable attributes for tag and their default values.
int getNumberOfAddedAttributes() const
get number of added attributes
void setParametersOfAdditional(SumoXMLTag actualAdditionalType)
set parameters depending of the new additionalType
bool myCurrentLengthValid
Flag to check if current length is valid.
show only selected edge in a list
Definition: GUIAppEnum.h:594
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
FXTextField * myEdgesSearch
text field for search edge IDs
additionalReferencePoint getActualReferencePoint()
get actual reference point
void showList(std::string search="")
Show list of SelectorParentEdges.
an e3 entry point
bool isTestingModeEnabled() const
check if netedit is running in testing mode
Definition: GNEViewNet.cpp:405
FXButton * myInvertEdgesSelection
button for invert selection
std::string getIdSelected() const
get if currently additional Set
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
#define GUIDesignComboBox
Definition: GUIDesigns.h:187
help button
Definition: GUIAppEnum.h:404
GNEViewNet * myViewNet
the window to inform when the tls is modfied
Definition: GNEFrame.h:95
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
add row
Definition: GUIAppEnum.h:580
static bool isInt(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical or type int
bool isForcePositionEnabled()
check if force position is enabled
double getLength()
get value of length
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
GNEUndoList * getUndoList() const
get the undoList object
FXButton * clearLanesSelection
button for clear selection
#define GUIDesignList
design for FXLists
Definition: GUIDesigns.h:419
FXLabel * myLengthLabel
Label for length.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
#define GUIDesignTextField
Definition: GUIDesigns.h:41
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr)
check if an element with certain tag has a certain attribute
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get attributes and their values
select edge
Definition: GUIAppEnum.h:598
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:51
bool isCurrentLengthValid() const
check if current length is valid
void addAttribute(SumoXMLTag additionalTag, SumoXMLAttr AdditionalAttributeSingle)
add attribute
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:89
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
Definition: GUIDesigns.h:244
an e3 exit point
FXList * myList
List of SelectorParentLanes.
std::vector< FXLabel * > myLabels
vector with with the name of every parameter
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
int myIndexParameterList
index for myIndexParameterList
additional match box messages
Definition: GUIAppEnum.h:462
static bool isFilename(SumoXMLTag tag, SumoXMLAttr attr)
whether a string attribute is a filename
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
SumoXMLTag myActualAdditionalType
actual additional type selected in the match Box
FXButton * myHelpAdditionalParentSelector
button for help
virtual std::string getDescription()
how should this attribute carrier be called
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
block movement of a graphic element
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
static T getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr)
return the default value of the attribute of an element
SumoXMLAttr myAdditionalAttr
current XML attribute
invalid attribute
static const std::vector< SumoXMLTag > & allowedTags(bool net)
get all editable for tag (net or additional).
~GNEAdditionalFrame()
Destructor.
FXLabel * myBlockLabel
Label for block movement.
FXComboBox * myAdditionalMatchBox
combo box with the list of additional elements
FXTextField * myLanesSearch
text field for search lane IDs
GNEAdditionalFrame::NeteditAttributes * myEditorParameters
Netedit parameter.
const std::string getID() const
function to support debugging
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
Definition: GUIDesigns.h:63
std::vector< FXTextField * > myTextFields
vector textField to modify the value of parameter
double getLaneShapeLength() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:721
void hideListOfAdditionals()
hide SelectorParentAdditional
#define GUIDesignButtonIcon
button only with icon (23x23)
Definition: GUIDesigns.h:66
FXButton * myAddButton
Button to increase the number of textFields.
begin/end of the description of an edge
GNEAdditionalFrame::SelectorParentLanes * mylaneParentsSelector
list of SelectorParentLanes
FXLabel * myForcePositionLabel
Label for force position.
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
GNEAdditionalFrame::SelectorParentEdges * myedgeParentsSelector
list of SelectorParentEdges
void showList(std::string search="")
Show list of SelectorParentLanes.
FXList * myList
List of SelectorParentEdges.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:57
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 WRITE_ERROR(msg)
Definition: MsgHandler.h:206
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:50
SumoXMLTag myAdditionalTag
current XML attribute
FXLabel * myLabel
lael with the name of the parameter
AddAdditionalResult addAdditional(GNENetElement *netElement, GUISUMOAbstractView *parent)
add additional element
AddAdditionalResult
FOX-declaration.
long onCmdSetBlocking(FXObject *, FXSelector, void *)
Called when user changes the checkbox "set blocking".
void hideReferencePoint()
hide refence point comboBox
SumoXMLTag myAdditionalTag
current additional tag
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:621
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:543
virtual void show()
show Frame
Definition: GNEFrame.cpp:98
static bool isProbability(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is a probability (i.e. oly can values between [0, 1])
long onCmdUseSelectedLanes(FXObject *, FXSelector, void *)
#define GUIDesignDialogBox
Definition: GUIDesigns.h:393
FXLabel * mySetLabel
Label with the name of additional.
void show()
show additional frame and update use selected edges/lanes
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:758
void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value)
show name and value of attribute of type string
void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector< int > value)
show name and value of parameters of type int
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
static bool isBool(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool for a certain tag
weights: time range end
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
std::string getListValues()
return the value of list
std::vector< GNEAdditional * > getAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
get vector with additionals
Definition: GNENet.cpp:1354
bool myUniqueSelection
flag to check if only a single parent is allowed
bool isCurrentListValid() const
check that current list is valid
void showListOfAdditionals(SumoXMLTag type, bool uniqueSelection)
Show list of SelectorParentAdditional.
long onCmdSetBooleanAttribute(FXObject *, FXSelector, void *)
called when user change the value of myBoolCheckButton
void updateUseSelectedEdges()
Update use selectedEdges.
static std::string getDefinition(SumoXMLTag tag, SumoXMLAttr attr)
return definition of a certain SumoXMLAttr
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
Definition: GUIDesigns.h:44
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:107
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
long onCmdHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:47
void showReferencePoint()
show refence point comboBox
void hideList()
hide SelectorParentEdges
remove row
Definition: GUIAppEnum.h:582
#define GUIDesignButtonOK
Definition: GUIDesigns.h:98
const std::string & isAttributeValid() const
returns a empty string if current value is valid, a string with information about invalid value in ot...
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:357
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
bool isUseSelectedEdgesEnable() const
get status of checkBox UseSelectedEdges
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
FXButton * invertLanesSelection
button for invert selection
invert selection of lanes
Definition: GUIAppEnum.h:612
parent of an additional element
clear selection of edges
Definition: GUIAppEnum.h:600
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
invert selection of edges
Definition: GUIAppEnum.h:602
std::string getIdsSelected() const
get list of selecte id&#39;s in string format
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:144
GNEAdditionalFrame::SelectorParentAdditional * myAdditionalParentSelector
list of additional Set
FXTextField * myTextFieldInt
textField to modify the default value of int/float/string parameters
static std::string getIdsSelected(const FXList *list)
get list of selecte id&#39;s in string format
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:165
std::string getIdsSelected() const
get list of selecte id&#39;s in string format
long onCmdSetLength(FXObject *, FXSelector, void *)
FXHorizontalFrame * myHorizontalFrameButtons
horizontal frame for buttons
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
FXCheckButton * myForcePositionCheckButton
checkBox for the option "force position"
std::vector< FXHorizontalFrame * > myHorizontalFrames
Vector with HorizontalFrames.
GUISelectedStorage gSelected
A global holder of selected objects.
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
int myMaxNumberOfValuesInParameterList
Number max of values in a parameter of type list.
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
long onCmdSelectAdditionalParent(FXObject *, FXSelector, void *)
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
std::vector< AdditionalAttributeSingle * > myVectorOfsingleAdditionalParameter
vector with the additional parameters
std::vector< AdditionalAttributeList * > myVectorOfsingleAdditionalParameterList
vector with the additional parameters of type list
#define GUIDesignLabelLeftThick
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:156
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:228
long onCmdSelectEdge(FXObject *, FXSelector, void *)
called when user select a edge of the list
static bool isList(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool
FXCheckButton * myBlockMovementCheckButton
checkBox for block movement
FXTextField * myTextFieldReal
textField to modify the default value of real/times parameters
FXButton * helpReferencePoint
Button for help about the reference point.
FXButton * myHelpedgeParentsSelector
button for help