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-sim.org/
10 // Copyright (C) 2001-2013 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 #ifdef HAVE_VERSION_H
31 #include <version.h>
32 #endif
33 
34 #include <iostream>
43 #include "GNEAdditionalFrame.h"
44 #include "GNEViewNet.h"
45 #include "GNEViewParent.h"
46 #include "GNENet.h"
47 #include "GNEJunction.h"
48 #include "GNEEdge.h"
49 #include "GNELane.h"
50 #include "GNECrossing.h"
51 #include "GNEUndoList.h"
52 #include "GNEChange_Selection.h"
53 #include "GNEAttributeCarrier.h"
54 #include "GNEChange_Additional.h"
55 #include "GNEAdditional.h"
56 #include "GNEAdditionalSet.h"
57 #include "GNEAdditionalHandler.h"
58 
59 #ifdef CHECK_MEMORY_LEAKS
60 #include <foreign/nvwa/debug_new.h>
61 #endif // CHECK_MEMORY_LEAKS
62 
63 
64 // ===========================================================================
65 // FOX callback mapping
66 // ===========================================================================
67 
68 FXDEFMAP(GNEAdditionalFrame) GNEAdditionalMap[] = {
70 };
71 
72 FXDEFMAP(GNEAdditionalFrame::additionalParameterList) GNEAdditionalParameterListMap[] = {
75 };
76 
77 FXDEFMAP(GNEAdditionalFrame::additionalParameters) GNEAdditionalParametersMap[] = {
79 };
80 
81 FXDEFMAP(GNEAdditionalFrame::editorParameters) GNEEditorParametersMap[] = {
84 };
85 
86 FXDEFMAP(GNEAdditionalFrame::additionalSet) GNEAdditionalSetMap[] = {
89 };
90 
98 };
99 
107 };
108 
109 // Object implementation
110 FXIMPLEMENT(GNEAdditionalFrame, FXScrollWindow, GNEAdditionalMap, ARRAYNUMBER(GNEAdditionalMap))
111 FXIMPLEMENT(GNEAdditionalFrame::additionalParameterList, FXMatrix, GNEAdditionalParameterListMap, ARRAYNUMBER(GNEAdditionalParameterListMap))
112 FXIMPLEMENT(GNEAdditionalFrame::additionalParameters, FXGroupBox, GNEAdditionalParametersMap, ARRAYNUMBER(GNEAdditionalParametersMap))
113 FXIMPLEMENT(GNEAdditionalFrame::editorParameters, FXGroupBox, GNEEditorParametersMap, ARRAYNUMBER(GNEEditorParametersMap))
114 FXIMPLEMENT(GNEAdditionalFrame::additionalSet, FXGroupBox, GNEAdditionalSetMap, ARRAYNUMBER(GNEAdditionalSetMap))
115 FXIMPLEMENT(GNEAdditionalFrame::edgesSelector, FXGroupBox, GNEEdgesMap, ARRAYNUMBER(GNEEdgesMap))
116 FXIMPLEMENT(GNEAdditionalFrame::lanesSelector, FXGroupBox, GNELanesMap, ARRAYNUMBER(GNELanesMap))
117 
118 // ===========================================================================
119 // method definitions
120 // ===========================================================================
121 
122 GNEAdditionalFrame::GNEAdditionalFrame(FXComposite* parent, GNEViewNet* viewNet):
123  GNEFrame(parent, viewNet, "Additionals"),
124  myActualAdditionalType(SUMO_TAG_NOTHING) {
125 
126  // Create groupBox for myAdditionalMatchBox
127  myGroupBoxForMyAdditionalMatchBox = new FXGroupBox(myContentFrame, "Additional element", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
128 
129  // Create FXListBox in myGroupBoxForMyAdditionalMatchBox
130  myAdditionalMatchBox = new FXComboBox(myGroupBoxForMyAdditionalMatchBox, 12, this, MID_GNE_MODE_ADDITIONAL_ITEM, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC | LAYOUT_CENTER_Y | LAYOUT_FILL_X);
131 
132  // Create additional parameters
133  myAdditionalParameters = new GNEAdditionalFrame::additionalParameters(myContentFrame, this);
134 
135  // Create editor parameter
136  myEditorParameters = new GNEAdditionalFrame::editorParameters(myContentFrame, this);
137 
138  // Create create list for additional Set
139  myAdditionalSet = new GNEAdditionalFrame::additionalSet(myContentFrame, this, myViewNet);
140 
142  myEdgesSelector = new GNEAdditionalFrame::edgesSelector(myContentFrame, myViewNet);
143 
145  myLanesSelector = new GNEAdditionalFrame::lanesSelector(myContentFrame, myViewNet);
146 
147  // Add options to myAdditionalMatchBox
148  const std::vector<SumoXMLTag>& additionalTags = GNEAttributeCarrier::allowedAdditionalTags();
149  for (std::vector<SumoXMLTag>::const_iterator i = additionalTags.begin(); i != additionalTags.end(); i++) {
150  myAdditionalMatchBox->appendItem(toString(*i).c_str());
151  }
152 
153  // Set visible items
154  myAdditionalMatchBox->setNumVisible((int)myAdditionalMatchBox->getNumItems());
155 
156  // If there are additionals
157  if (additionalTags.size() > 0) {
158  // Set myActualAdditionalType and show
159  myActualAdditionalType = additionalTags.front();
160  setParametersOfAdditional(myActualAdditionalType);
161  }
162 }
163 
164 
167 }
168 
169 
170 bool
172  // Declare map to keep values
173  std::map<SumoXMLAttr, std::string> valuesOfElement = myAdditionalParameters->getAttributes();
174 
175  // Declare pointer to netElements
176  GNEJunction* pointed_junction = NULL;
177  GNEEdge* pointed_edge = NULL;
178  GNELane* pointed_lane = NULL;
179  GNECrossing* pointed_crossing = NULL;
180 
181  // Check if additional should be placed over a junction
183  pointed_junction = dynamic_cast<GNEJunction*>(netElement);
184  if (pointed_junction != NULL) {
185  // Get attribute junction
186  valuesOfElement[SUMO_ATTR_JUNCTION] = pointed_junction->getID();
187  // Generate id of element based on the junction
188  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_junction);
189  } else {
190  return false;
191  }
192  }
193  // Check if additional should be placed over a edge
195  // Due a edge is composed of lanes, its neccesary check if clicked element is an lane
196  if (dynamic_cast<GNELane*>(netElement) != NULL) {
197  pointed_edge = &(dynamic_cast<GNELane*>(netElement)->getParentEdge());
198  }
199  if (pointed_edge != NULL) {
200  // Get attribute edge
201  valuesOfElement[SUMO_ATTR_EDGE] = pointed_edge->getID();
202  // Generate id of element based on the edge
203  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_edge);
204  } else {
205  return false;
206  }
207  }
208  // Check if additional should be placed over a lane
210  pointed_lane = dynamic_cast<GNELane*>(netElement);
211  if (pointed_lane != NULL) {
212  // Get attribute lane
213  valuesOfElement[SUMO_ATTR_LANE] = pointed_lane->getID();
214  // Generate id of element based on the lane
215  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_lane);
216  } else {
217  return false;
218  }
219  }
220  // Check if additional should be placed over a crossing
222  pointed_crossing = dynamic_cast<GNECrossing*>(netElement);
223  if (pointed_crossing != NULL) {
224  // Get attribute crossing
225  valuesOfElement[SUMO_ATTR_CROSSING] = pointed_crossing->getID();
226  // Generate id of element based on the crossing
227  valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_crossing);
228  } else {
229  return false;
230  }
231  } else {
232  // Generate id of element
233  valuesOfElement[SUMO_ATTR_ID] = generateID(NULL);
234  }
235 
236  // Obtain position attribute
237  if (pointed_edge) {
238  // Obtain position of the mouse over edge
239  SUMOReal positionOfTheMouseOverEdge = pointed_edge->getLanes().at(0)->getShape().nearest_offset_to_point2D(parent->getPositionInformation());
240  // If element has a StartPosition and EndPosition over edge, extract attributes
242  valuesOfElement[SUMO_ATTR_STARTPOS] = toString(setStartPosition(positionOfTheMouseOverEdge, myEditorParameters->getLenght()));
243  valuesOfElement[SUMO_ATTR_ENDPOS] = toString(setEndPosition(pointed_edge->getLanes().at(0)->getLaneShapeLenght(), positionOfTheMouseOverEdge, myEditorParameters->getLenght()));
244  }
245  // Extract position of lane
246  valuesOfElement[SUMO_ATTR_POSITION] = toString(positionOfTheMouseOverEdge);
247  } else if (pointed_lane) {
248  // Obtain position of the mouse over lane
249  SUMOReal positionOfTheMouseOverLane = pointed_lane->getShape().nearest_offset_to_point2D(parent->getPositionInformation());
250  // If element has a StartPosition and EndPosition over lane, extract attributes
252  valuesOfElement[SUMO_ATTR_STARTPOS] = toString(setStartPosition(positionOfTheMouseOverLane, myEditorParameters->getLenght()));
253  valuesOfElement[SUMO_ATTR_ENDPOS] = toString(setEndPosition(pointed_lane->getLaneShapeLenght(), positionOfTheMouseOverLane, myEditorParameters->getLenght()));
254  }
255  // Extract position of lane
256  valuesOfElement[SUMO_ATTR_POSITION] = toString(positionOfTheMouseOverLane);
257  } else {
258  // get position in map
259  valuesOfElement[SUMO_ATTR_POSITION] = toString(parent->getPositionInformation());
260  }
261 
262  // If additional own the attribute SUMO_ATTR_FILE but was't defined, will defined as <ID>.txt
264  valuesOfElement[SUMO_ATTR_FILE] = (valuesOfElement[SUMO_ATTR_ID] + ".txt");
265  }
266 
267  // If additional own the attribute SUMO_ATTR_OUTPUT but was't defined, will defined as <ID>.txt
269  valuesOfElement[SUMO_ATTR_OUTPUT] = (valuesOfElement[SUMO_ATTR_ID] + ".txt");
270  }
271 
272  // Save block value
274 
275  // If element belongst to an additional Set, get id of parent from myAdditionalSet
277  if (myAdditionalSet->getIdSelected() != "") {
278  valuesOfElement[GNE_ATTR_PARENT] = myAdditionalSet->getIdSelected();
279  } else {
280  WRITE_WARNING("A " + toString(myAdditionalSet->getCurrentlyTag()) + " must be selected before insertion of " + toString(myActualAdditionalType) + ".");
281  return false;
282  }
283  }
284 
285  // If element own a list of edgesSelector as attribute
288  // Declare a vector of Id's
289  std::vector<std::string> vectorOfIds;
290  // get Selected edges
291  std::vector<GNEEdge*> selectedEdges = myViewNet->getNet()->retrieveEdges(true);
292  // Iterate over selectedEdges and getId
293  for (std::vector<GNEEdge*>::iterator i = selectedEdges.begin(); i != selectedEdges.end(); i++) {
294  vectorOfIds.push_back((*i)->getID());
295  }
296  // Set saved Ids in attribute edges
297  valuesOfElement[SUMO_ATTR_EDGES] = joinToString(vectorOfIds, " ");
298  } else {
299  valuesOfElement[SUMO_ATTR_EDGES] = myEdgesSelector->getIdsSelected();
300  }
301  // check if attribute has at least an Edge
302  if (valuesOfElement[SUMO_ATTR_EDGES] == "") {
303  WRITE_WARNING("A " + toString(myActualAdditionalType) + " must have at least one edge associated.");
304  return false;
305  }
306  }
307 
308  // If element own a list of lanesSelector as attribute
311  // Declare a vector of Id's
312  std::vector<std::string> vectorOfIds;
313  // get Selected lanes
314  std::vector<GNELane*> selectedLanes = myViewNet->getNet()->retrieveLanes(true);
315  // Iterate over selectedLanes and getId
316  for (std::vector<GNELane*>::iterator i = selectedLanes.begin(); i != selectedLanes.end(); i++) {
317  vectorOfIds.push_back((*i)->getID());
318  }
319  // Set saved Ids in attribute lanes
320  valuesOfElement[SUMO_ATTR_LANES] = joinToString(vectorOfIds, " ");
321  } else {
322  valuesOfElement[SUMO_ATTR_LANES] = myLanesSelector->getIdsSelected();
323  }
324  // check if attribute has at least a lane
325  if (valuesOfElement[SUMO_ATTR_LANES] == "") {
326  WRITE_WARNING("A " + toString(myActualAdditionalType) + " must have at least one lane associated.");
327  return false;
328  }
329  }
330 
331  // Create additional
333 }
334 
335 void
337  myViewNet->getUndoList()->p_begin("delete " + additional->getDescription());
338  myViewNet->getUndoList()->add(new GNEChange_Additional(myViewNet->getNet(), additional, false), true);
340 }
341 
342 
343 long
344 GNEAdditionalFrame::onCmdSelectAdditional(FXObject*, FXSelector, void*) {
345  // set myActualAdditionalType
346  const std::vector<SumoXMLTag>& additionalTags = GNEAttributeCarrier::allowedAdditionalTags();
347  for (std::vector<SumoXMLTag>::const_iterator i = additionalTags.begin(); i != additionalTags.end(); i++) {
348  if (toString(*i) == myAdditionalMatchBox->getText().text()) {
350  }
351  }
352  return 1;
353 }
354 
355 
356 void
358  // Show Scroll window
359  FXScrollWindow::show();
360  // Show Frame Area in which this GNEFrame is placed
362  // Update UseAelectedLane CheckBox
364  // Update UseAelectedLane CheckBox
366 }
367 
368 
369 void
371  // Hide ScrollWindow
372  FXScrollWindow::hide();
373  // Hide Frame Area in which this GNEFrame is placed
375 }
376 
377 
378 void
380  // Set new actualAdditionalType
381  myActualAdditionalType = actualAdditionalType;
382  // Clear default parameters
384  // Hide lenght field and reference point
387  // Obtain attributes of actual myActualAdditionalType
388  std::vector<std::pair <SumoXMLAttr, std::string> > attrs = GNEAttributeCarrier::allowedAttributes(myActualAdditionalType);
389  // Iterate over attributes of myActualAdditionalType
390  for (std::vector<std::pair <SumoXMLAttr, std::string> >::iterator i = attrs.begin(); i != attrs.end(); i++) {
391  if (!GNEAttributeCarrier::isUnique(i->first)) {
393  } else if (i->first == SUMO_ATTR_ENDPOS) {
396  }
397  }
398  // if there are parmeters, show and Recalc groupBox
401  } else {
403  }
404  // Show set parameter if we're adding an additional with parent
407  } else {
409  }
410  // Show edgesSelector if we're adding an additional that own the attribute SUMO_ATTR_EDGES
413  } else {
415  }
416  // Show lanesSelector if we're adding an additional that own the attribute SUMO_ATTR_LANES
419  } else {
421  }
422 }
423 
424 
425 std::string
428  if (netElement) {
429  // generate ID using netElement
430  while (myViewNet->getNet()->getAdditional(myActualAdditionalType, toString(myActualAdditionalType) + "_" + netElement->getID() + "_" + toString(additionalIndex)) != NULL) {
431  additionalIndex++;
432  }
433  return toString(myActualAdditionalType) + "_" + netElement->getID() + "_" + toString(additionalIndex);
434  } else {
435  // generate ID without netElement
436  while (myViewNet->getNet()->getAdditional(myActualAdditionalType, toString(myActualAdditionalType) + "_" + toString(additionalIndex)) != NULL) {
437  additionalIndex++;
438  }
439  return toString(myActualAdditionalType) + "_" + toString(additionalIndex);
440  }
441 }
442 
443 
444 SUMOReal
445 GNEAdditionalFrame::setStartPosition(SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional) {
448  return positionOfTheMouseOverLane;
450  if (positionOfTheMouseOverLane - lenghtOfAdditional >= 0.01) {
451  return positionOfTheMouseOverLane - lenghtOfAdditional;
453  return 0.01;
454  } else {
455  return -1;
456  }
457  }
459  if (positionOfTheMouseOverLane - lenghtOfAdditional / 2 >= 0.01) {
460  return positionOfTheMouseOverLane - lenghtOfAdditional / 2;
462  return 0;
463  } else {
464  return -1;
465  }
466  }
467  default:
468  return -1;
469  }
470 }
471 
472 
473 SUMOReal
474 GNEAdditionalFrame::setEndPosition(SUMOReal laneLenght, SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional) {
477  if (positionOfTheMouseOverLane + lenghtOfAdditional <= laneLenght - 0.01) {
478  return positionOfTheMouseOverLane + lenghtOfAdditional;
480  return laneLenght - 0.01;
481  } else {
482  return -1;
483  }
484  }
486  return positionOfTheMouseOverLane;
488  if (positionOfTheMouseOverLane + lenghtOfAdditional / 2 <= laneLenght - 0.01) {
489  return positionOfTheMouseOverLane + lenghtOfAdditional / 2;
491  return laneLenght - 0.01;
492  } else {
493  return -1;
494  }
495  }
496  default:
497  return -1;
498  }
499 }
500 
501 // ---------------------------------------------------------------------------
502 // GNEAdditionalFrame::additionalParameter - methods
503 // ---------------------------------------------------------------------------
504 
506  FXMatrix(parent, 3, MATRIX_BY_COLUMNS | LAYOUT_FILL_X),
507  myAttr(SUMO_ATTR_NOTHING) {
508  // Create elements
509  myLabel = new FXLabel(this, "name", 0, JUSTIFY_RIGHT | LAYOUT_FIX_WIDTH, 0, 0, 60, 0);
510  myTextField = new FXTextField(this, 10, tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X);
511  myMenuCheck = new FXMenuCheck(this, "", tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_BOOL, LAYOUT_FIX_WIDTH);
512  // Set widht of menuCheck manually
513  myMenuCheck->setWidth(20);
514  // Hide elements
515  hideParameter();
516 }
517 
518 
520 
521 
522 void
524  myAttr = attr;
525  myLabel->setText(toString(myAttr).c_str());
526  myLabel->show();
527  myTextField->setText(value.c_str());
528  myTextField->show();
529  show();
530 }
531 
532 
533 void
535  myAttr = attr;
536  myLabel->setText(toString(myAttr).c_str());
537  myLabel->show();
538  myTextField->setText(toString(value).c_str());
539  myTextField->show();
540  show();
541 }
542 
543 
544 void
546  myAttr = attr;
547  myLabel->setText(toString(myAttr).c_str());
548  myLabel->show();
549  myTextField->setText(toString(value).c_str());
550  myTextField->show();
551  show();
552 }
553 
554 
555 void
557  myAttr = attr;
558  myLabel->setText(toString(myAttr).c_str());
559  myLabel->show();
560  myMenuCheck->setCheck(value);
561  myMenuCheck->show();
562  show();
563 }
564 
565 
566 void
569  myLabel->hide();
570  myTextField->hide();
571  myMenuCheck->hide();
572  hide();
573 }
574 
575 
578  return myAttr;
579 }
580 
581 
582 std::string
585  return (myMenuCheck->getCheck() == 1) ? "true" : "false";
586  } else {
587  return myTextField->getText().text();
588  }
589 }
590 
591 // ---------------------------------------------------------------------------
592 // GNEAdditionalFrame::additionalParameterList - methods
593 // ---------------------------------------------------------------------------
594 
596  FXMatrix(parent, 2, MATRIX_BY_COLUMNS | LAYOUT_FILL_X),
597  numberOfVisibleTextfields(1),
598  myMaxNumberOfValuesInParameterList(20),
600  // Create elements
601  for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) {
602  myLabels.push_back(new FXLabel(this, "name", 0, JUSTIFY_RIGHT | LAYOUT_FIX_WIDTH, 0, 0, 60, 0));
603  myTextFields.push_back(new FXTextField(this, 10, tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X));
604  }
605  // Create label Row
606  myLabels.push_back(new FXLabel(this, "Rows", 0, JUSTIFY_RIGHT | LAYOUT_FIX_WIDTH, 0, 0, 60, 0));
607  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X);
608  // Create add button
609  add = new FXButton(buttonsFrame, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_ADDROW,
610  ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED,
611  0, 0, 20, 20);
612  // Create delete buttons
613  remove = new FXButton(buttonsFrame, "", GUIIconSubSys::getIcon(ICON_REMOVE), this, MID_GNE_REMOVEROW,
614  ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED,
615  0, 0, 20, 20);
616  // Hide all para meters
617  hideParameter();
618 }
619 
620 
622 
623 
624 void
626  myAttr = attr;
627  std::cout << "FINISH" << std::endl;
628 }
629 
630 void
632  myAttr = attr;
633  std::cout << "FINISH" << std::endl;
634 }
635 
636 void
638  myAttr = attr;
639  std::cout << "FINISH" << std::endl;
640 }
641 
642 void
644  if ((int)value.size() < myMaxNumberOfValuesInParameterList) {
645  myAttr = attr;
646  numberOfVisibleTextfields = (int)value.size();
647  if (numberOfVisibleTextfields == 0) {
649  }
650  for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) {
651  myLabels.at(i)->setText((toString(attr) + ": " + toString(i)).c_str());
652  }
653  for (int i = 0; i < numberOfVisibleTextfields; i++) {
654  myLabels.at(i)->show();
655  myTextFields.at(i)->show();
656  }
657  add->show();
658  remove->show();
659  show();
660  }
661 }
662 
663 
664 void
667  for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) {
668  myLabels.at(i)->hide();
669  myTextFields.at(i)->hide();
670  myTextFields.at(i)->setText("");
671  }
672  add->hide();
673  remove->hide();
674  hide();
675 }
676 
677 
680  return myAttr;
681 }
682 
683 
684 std::string
686  // Declare, fill and return a string with the list values
687  std::string value;
688  for (int i = 0; i < numberOfVisibleTextfields; i++) {
689  if (!myTextFields.at(i)->getText().empty()) {
690  value += (myTextFields.at(i)->getText().text() + std::string(" "));
691  }
692  }
693  return value;
694 }
695 
696 
697 long
703  getParent()->recalc();
704  }
705  return 1;
706 }
707 
708 
709 long
711  if (numberOfVisibleTextfields > 1) {
715  myTextFields.at(numberOfVisibleTextfields)->setText("");
716 
717  getParent()->recalc();
718  }
719  return 1;
720 }
721 
722 // ---------------------------------------------------------------------------
723 // GNEAdditionalFrame::editorParameters- methods
724 // ---------------------------------------------------------------------------
725 
727  FXGroupBox(parent, "Default parameters", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X),
728  myIndexParameter(0),
729  myIndexParameterList(0),
730  maxNumberOfParameters(GNEAttributeCarrier::getHigherNumberOfAttributes()),
731  maxNumberOfListParameters(2) {
732 
733  // Create widgets for parameters
734  for (int i = 0; i < maxNumberOfParameters; i++) {
735  myVectorOfAdditionalParameter.push_back(new additionalParameter(this, tgt));
736  }
737 
738  // Create widgets for parameters
739  for (int i = 0; i < maxNumberOfListParameters; i++) {
741  }
742 
743  // Create help button
744  helpAdditional = new FXButton(this, "Help", 0, this, MID_HELP);
745 }
746 
747 
749 }
750 
751 
752 void
754  // Hidde al fields
755  for (int i = 0; i < maxNumberOfParameters; i++) {
756  myVectorOfAdditionalParameter.at(i)->hideParameter();
757  }
758 
759  // Hidde al list fields
760  for (int i = 0; i < maxNumberOfListParameters; i++) {
761  myVectorOfAdditionalParameterList.at(i)->hideParameter();
762  }
763 
764  // Reset indexs
766  myIndexParameter = 0;
767 }
768 
769 
770 void
772  // Set current additional
773  myAdditional = additional;
774  // If parameter is of type list
775  if (GNEAttributeCarrier::isList(attribute)) {
776  // If parameter can be show
778  // Check type of attribute list
779  if (GNEAttributeCarrier::isInt(attribute)) {
780  myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector<int> >(additional, attribute));
781  } else if (GNEAttributeCarrier::isFloat(attribute)) {
782  myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector<SUMOReal> >(additional, attribute));
783  } else if (GNEAttributeCarrier::isBool(attribute)) {
784  myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector<bool> >(additional, attribute));
785  } else if (GNEAttributeCarrier::isString(attribute)) {
786  myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector<std::string> >(additional, attribute));
787  }
788  // Update index
790  } else {
791  WRITE_ERROR("Max number of list attributes reached (" + toString(maxNumberOfListParameters) + ").");
792  }
793  } else {
795  // Check type of attribute list
796  if (GNEAttributeCarrier::isInt(attribute)) {
797  myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue<int>(additional, attribute));
798  } else if (GNEAttributeCarrier::isFloat(attribute)) {
799  myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue<SUMOReal>(additional, attribute));
800  } else if (GNEAttributeCarrier::isBool(attribute)) {
801  myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue<bool>(additional, attribute));
802  } else if (GNEAttributeCarrier::isString(attribute)) {
803  myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue<std::string>(additional, attribute));
804  } else {
805  WRITE_WARNING("Attribute '" + toString(attribute) + "' don't have a defined type. Check definition in GNEAttributeCarrier");
806  }
807  // Update index parameter
809  } else {
810  WRITE_ERROR("Max number of attributes reached (" + toString(maxNumberOfParameters) + ").");
811  }
812  }
813 }
814 
815 
816 void
818  recalc();
819  show();
820 }
821 
822 
823 void
825  hide();
826 }
827 
828 
829 std::map<SumoXMLAttr, std::string>
831  std::map<SumoXMLAttr, std::string> values;
832  // get standar Parameters
833  for (int i = 0; i < myIndexParameter; i++) {
834  values[myVectorOfAdditionalParameter.at(i)->getAttr()] = myVectorOfAdditionalParameter.at(i)->getValue();
835  }
836  // get list parameters
837  for (int i = 0; i < myIndexParameterList; i++) {
838  values[myVectorOfAdditionalParameterList.at(i)->getAttr()] = myVectorOfAdditionalParameterList.at(i)->getListValues();
839  }
840  return values;
841 }
842 
843 
844 int
847 }
848 
849 
850 long
852  // Create help dialog
853  FXDialogBox* helpDialog = new FXDialogBox(this, ("Parameters of " + toString(myAdditional)).c_str(), DECOR_CLOSE | DECOR_TITLE);
854  // Create FXTable
855  FXTable* myTable = new FXTable(helpDialog, this, MID_TABLE, TABLE_READONLY);
856  myTable->setVisibleRows((FXint)(myIndexParameter + myIndexParameterList));
857  myTable->setVisibleColumns(3);
858  myTable->setTableSize((FXint)(myIndexParameter + myIndexParameterList), 3);
859  myTable->setBackColor(FXRGB(255, 255, 255));
860  myTable->setColumnText(0, "Name");
861  myTable->setColumnText(1, "Value");
862  myTable->setColumnText(2, "Definition");
863  myTable->getRowHeader()->setWidth(0);
864  FXHeader* header = myTable->getColumnHeader();
865  header->setItemJustify(0, JUSTIFY_CENTER_X);
866  header->setItemSize(0, 120);
867  header->setItemJustify(1, JUSTIFY_CENTER_X);
868  header->setItemSize(1, 80);
869  int maxSizeColumnDefinitions = 0;
870  // Iterate over vector of additional parameters
871  for (int i = 0; i < myIndexParameter; i++) {
872  SumoXMLAttr attr = myVectorOfAdditionalParameter.at(i)->getAttr();
873  // Set name of attribute
874  myTable->setItem(i, 0, new FXTableItem(toString(attr).c_str()));
875  // Set type
876  FXTableItem* type = new FXTableItem("");
877  if (GNEAttributeCarrier::isInt(attr)) {
878  type->setText("int");
879  } else if (GNEAttributeCarrier::isFloat(attr)) {
880  type->setText("float");
881  } else if (GNEAttributeCarrier::isBool(attr)) {
882  type->setText("bool");
883  } else if (GNEAttributeCarrier::isString(attr)) {
884  type->setText("string");
885  }
886  type->setJustify(FXTableItem::CENTER_X);
887  myTable->setItem(i, 1, type);
888  // Set definition
889  FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditional, attr).c_str());
890  definition->setJustify(FXTableItem::LEFT);
891  myTable->setItem(i, 2, definition);
892  if ((int)GNEAttributeCarrier::getDefinition(myAdditional, attr).size() > maxSizeColumnDefinitions) {
893  maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditional, attr).size());
894  }
895  }
896  // Iterate over vector of additional parameters list
897  for (int i = 0; i < myIndexParameterList; i++) {
898  SumoXMLAttr attr = myVectorOfAdditionalParameterList.at(i)->getAttr();
899  // Set name of attribute
900  myTable->setItem(i, 0, new FXTableItem(toString(attr).c_str()));
901  // Set type
902  FXTableItem* type = new FXTableItem("");
903  if (GNEAttributeCarrier::isInt(attr)) {
904  type->setText("list of int");
905  } else if (GNEAttributeCarrier::isFloat(attr)) {
906  type->setText("list of float");
907  } else if (GNEAttributeCarrier::isBool(attr)) {
908  type->setText("list of bool");
909  } else if (GNEAttributeCarrier::isString(attr)) {
910  type->setText("list of string");
911  }
912  type->setJustify(FXTableItem::CENTER_X);
913  myTable->setItem(i, 1, type);
914  // Set definition
915  FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditional, attr).c_str());
916  definition->setJustify(FXTableItem::LEFT);
917  myTable->setItem(i, 2, definition);
918  if ((int)GNEAttributeCarrier::getDefinition(myAdditional, attr).size() > maxSizeColumnDefinitions) {
919  maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditional, attr).size());
920  }
921  }
922  // Set size of column
923  header->setItemJustify(2, JUSTIFY_CENTER_X);
924  header->setItemSize(2, maxSizeColumnDefinitions * 6);
925  // Button Close
926  new FXButton(helpDialog, "OK\t\tclose", 0, helpDialog, FXDialogBox::ID_ACCEPT, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3);
927  helpDialog->create();
928  helpDialog->show();
929  return 1;
930 }
931 
932 // ---------------------------------------------------------------------------
933 // GNEAdditionalFrame::editorParameters- methods
934 // ---------------------------------------------------------------------------
935 
936 GNEAdditionalFrame::editorParameters::editorParameters(FXComposite* parent, FXObject* tgt) :
937  FXGroupBox(parent, "editor parameters", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X),
938  myActualAdditionalReferencePoint(GNE_ADDITIONALREFERENCEPOINT_LEFT) {
939  // Create FXListBox for the reference points
940  myReferencePointMatchBox = new FXComboBox(this, 12, this, MID_GNE_MODE_ADDITIONAL_REFERENCEPOINT,
941  FRAME_SUNKEN | LAYOUT_LEFT | COMBOBOX_STATIC | LAYOUT_FILL_X);
942 
943  // Create Frame for Label and TextField
944  FXHorizontalFrame* lengthFrame = new FXHorizontalFrame(this, LAYOUT_FILL_X | LAYOUT_LEFT);
945 
946  // Create length label
947  myLengthLabel = new FXLabel(lengthFrame, "Length:", 0, JUSTIFY_LEFT | LAYOUT_FILL_X);
948 
949  // Create length text field
950  myLengthTextField = new FXTextField(lengthFrame, 10, tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X);
951 
952  // Set default value of length
953  myLengthTextField->setText("10");
954 
955  // Create FXMenuCheck for the force option
956  myCheckForcePosition = new FXMenuCheck(this, "Force position", this, MID_GNE_MODE_ADDITIONAL_FORCEPOSITION,
957  LAYOUT_LEFT | LAYOUT_FILL_X);
958 
959  // Create FXMenuCheck for the force option
960  myCheckBlock = new FXMenuCheck(this, "Block movement", this, MID_GNE_SET_BLOCKING,
961  LAYOUT_LEFT | LAYOUT_FILL_X);
962 
963  // Create help button
964  helpReferencePoint = new FXButton(this, "Help", 0, this, MID_HELP);
965 
966  // Add options to myReferencePointMatchBox
967  myReferencePointMatchBox->appendItem("reference left");
968  myReferencePointMatchBox->appendItem("reference right");
969  myReferencePointMatchBox->appendItem("reference center");
970 
971  // Set visible items
972  myReferencePointMatchBox->setNumVisible((int)myReferencePointMatchBox->getNumItems());
973 }
974 
975 
977 
978 
979 void
981  myLengthLabel->show();
982  myLengthTextField->show();
983 }
984 
985 
986 void
988  myLengthLabel->hide();
989  myLengthTextField->hide();
990 }
991 
992 
993 void
995  myReferencePointMatchBox->show();
996  myCheckForcePosition->show();
997 }
998 
999 
1000 void
1002  myReferencePointMatchBox->hide();
1003  myCheckForcePosition->hide();
1004 }
1005 
1006 
1010 }
1011 
1012 
1013 SUMOReal
1015  return GNEAttributeCarrier::parse<SUMOReal>(myLengthTextField->getText().text());
1016 }
1017 
1018 
1019 bool
1021  return myCheckBlock->getCheck() == 1 ? true : false;
1022 }
1023 
1024 
1025 bool
1027  return myCheckForcePosition->getCheck() == 1 ? true : false;
1028 }
1029 
1030 
1031 long
1033  // Cast actual reference point type
1035  return 1;
1036 }
1037 
1038 
1039 long
1041  FXDialogBox* helpDialog = new FXDialogBox(this, "Parameter editor Help", DECOR_CLOSE | DECOR_TITLE);
1042  std::ostringstream help;
1043  help
1044  << "Referece point: Mark the initial position of the additional element.\n"
1045  << "Example: If you want to create a busStop with a lenght of 30 in the point 100 of the lane:\n"
1046  << "- Reference Left will create it with startPos = 70 and endPos = 100.\n"
1047  << "- Reference Right will create it with startPos = 100 and endPos = 130.\n"
1048  << "- Reference Center will create it with startPos = 85 and endPos = 115.\n"
1049  << "\n"
1050  << "Force position: if is enabled, will create the additional adapting size of additional element to lane.\n"
1051  << "Example: If you have a lane with lenght = 100, but you try to create a busStop with size = 50\n"
1052  << "in the position 80 of the lane, a busStop with startPos = 80 and endPos = 100 will be created\n"
1053  << "instead of a busStop with startPos = 80 and endPos = 130.\n"
1054  << "\n"
1055  << "Block movement: if is enabled, the created additional element will be blocked. i.e. cannot be moved with\n"
1056  << "the mouse. This option can be modified with the Inspector.";
1057  new FXLabel(helpDialog, help.str().c_str(), 0, JUSTIFY_LEFT);
1058  // "OK"
1059  new FXButton(helpDialog, "OK\t\tclose", 0, helpDialog, FXDialogBox::ID_ACCEPT,
1060  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
1061  0, 0, 0, 0, 4, 4, 3, 3);
1062  helpDialog->create();
1063  helpDialog->show();
1064  return 1;
1065 }
1066 
1067 
1068 std::string
1070  // Obtain Id's of list
1071  std::string vectorOfIds;
1072  for (int i = 0; i < list->getNumItems(); i++) {
1073  if (list->isItemSelected(i)) {
1074  if (vectorOfIds.size() > 0) {
1075  vectorOfIds += " ";
1076  }
1077  vectorOfIds += (list->getItem(i)->getText()).text();
1078  }
1079  }
1080  return vectorOfIds;
1081 }
1082 
1083 
1084 
1085 // ---------------------------------------------------------------------------
1086 // GNEAdditionalFrame::additionalSet - methods
1087 // ---------------------------------------------------------------------------
1088 
1089 GNEAdditionalFrame::additionalSet::additionalSet(FXComposite* parent, FXObject* tgt, GNEViewNet* viewNet) :
1090  FXGroupBox(parent, "Additional Set", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X),
1091  myViewNet(viewNet),
1092  myType(SUMO_TAG_NOTHING) {
1093 
1094  // Create label with the type of additionalSet
1095  mySetLabel = new FXLabel(this, "Set Type:", 0, JUSTIFY_LEFT | LAYOUT_FILL_X);
1096 
1097  // Create list
1098  myList = new FXList(this, tgt, MID_GNE_SELECTADDITIONALSET, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT, 0, 0, 0, 100);
1099 
1100  // Create help button
1101  helpAdditionalSet = new FXButton(this, "Help", 0, this, MID_HELP);
1102 
1103  // Hide List
1104  hideList();
1105 }
1106 
1107 
1109 
1110 
1111 std::string
1113  for (int i = 0; i < myList->getNumItems(); i++) {
1114  if (myList->isItemSelected(i)) {
1115  return myList->getItem(i)->getText().text();
1116  }
1117  }
1118  return "";
1119 }
1120 
1121 
1122 SumoXMLTag
1124  return myType;
1125 }
1126 
1127 
1128 void
1130  myType = type;
1131  mySetLabel->setText(("Type of set: " + toString(myType)).c_str());
1132  myList->clearItems();
1133  const std::vector<GNEAdditional*>& vectorOfAdditionalSets = myViewNet->getNet()->getAdditionals(myType);
1134  for (std::vector<GNEAdditional*>::const_iterator i = vectorOfAdditionalSets.begin(); i != vectorOfAdditionalSets.end(); i++) {
1135  myList->appendItem((*i)->getID().c_str());
1136  }
1137  show();
1138 }
1139 
1140 
1141 void
1144  hide();
1145 }
1146 
1147 
1148 long
1150  return 1;
1151 }
1152 
1153 
1154 long
1155 GNEAdditionalFrame::additionalSet::onCmdHelp(FXObject*, FXSelector, void*) {
1156  return 1;
1157 }
1158 
1159 
1160 // ---------------------------------------------------------------------------
1161 // GNEAdditionalFrame::edgesSelector - methods
1162 // ---------------------------------------------------------------------------
1163 
1165  FXGroupBox(parent, "Edges", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X),
1166  myViewNet(viewNet) {
1167  // Create CheckBox for selected edges
1168  myUseSelectedEdges = new FXMenuCheck(this, "Use selected Edges", this, MID_GNE_USESELECTEDEDGES);
1169 
1170  // Create search box
1171  myEdgesSearch = new FXTextField(this, 10, this, MID_GNE_SEARCHEDGE, LAYOUT_FILL_X);
1172 
1173  // Create list
1174  myList = new FXList(this, this, MID_GNE_SELECTEDGE, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT, 0, 0, 0, 100);
1175 
1176  // Create horizontal frame
1177  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, LAYOUT_FILL_X);
1178 
1179  // Create button for clear selection
1180  clearEdgesSelection = new FXButton(buttonsFrame, "clear", 0, this, MID_GNE_CLEAREDGESELECTION);
1181 
1182  // Create button for invert selection
1183  invertEdgesSelection = new FXButton(buttonsFrame, "invert", 0, this, MID_GNE_INVERTEDGESELECTION);
1184 
1185  // Create help button
1186  helpEdges = new FXButton(this, "Help", 0, this, MID_HELP);
1187 
1188  // Hide List
1189  hideList();
1190 }
1191 
1192 
1194 
1195 
1196 std::string
1199 }
1200 
1201 
1202 void
1204  // FIll list
1205  myList->clearItems();
1206  std::vector<GNEEdge*> vectorOfEdges = myViewNet->getNet()->retrieveEdges(false);
1207  for (std::vector<GNEEdge*>::iterator i = vectorOfEdges.begin(); i != vectorOfEdges.end(); i++) {
1208  if ((*i)->getID().find(search) != std::string::npos) {
1209  myList->appendItem((*i)->getID().c_str());
1210  }
1211  }
1212  // By default, CheckBox for useSelectedEdges isn't checked
1213  myUseSelectedEdges->setCheck(false);
1214  // Recalc Frame
1215  recalc();
1216  // Update Frame
1217  update();
1218  // Show dialog
1219  show();
1220 }
1221 
1222 
1223 void
1225  FXGroupBox::hide();
1226 }
1227 
1228 
1229 void
1231  // Enable or disable use selected edges
1232  if (myViewNet->getNet()->retrieveEdges(true).size() > 0) {
1233  myUseSelectedEdges->enable();
1234  } else {
1235  myUseSelectedEdges->disable();
1236  }
1237 }
1238 
1239 
1240 bool
1242  if (myUseSelectedEdges->getCheck()) {
1243  return true;
1244  } else {
1245  return false;
1246  }
1247 }
1248 
1249 
1250 long
1252  if (myUseSelectedEdges->getCheck()) {
1253  myEdgesSearch->hide();
1254  myList->hide();
1255  clearEdgesSelection->hide();
1256  invertEdgesSelection->hide();
1257  helpEdges->hide();
1258  } else {
1259  myEdgesSearch->show();
1260  myList->show();
1261  clearEdgesSelection->show();
1262  invertEdgesSelection->show();
1263  helpEdges->show();
1264  }
1265  // Recalc Frame
1266  recalc();
1267  // Update Frame
1268  update();
1269  return 1;
1270 }
1271 
1272 
1273 long
1275  // Show only Id's of edgesSelector that contains the searched string
1276  showList(myEdgesSearch->getText().text());
1277  return 1;
1278 }
1279 
1280 
1281 long
1283  return 1;
1284 }
1285 
1286 
1287 long
1289  for (int i = 0; i < myList->getNumItems(); i++) {
1290  if (myList->getItem(i)->isSelected()) {
1291  myList->deselectItem(i);
1292  }
1293  }
1294  return 1;
1295 }
1296 
1297 
1298 long
1300  for (int i = 0; i < myList->getNumItems(); i++) {
1301  if (myList->getItem(i)->isSelected()) {
1302  myList->deselectItem(i);
1303  } else {
1304  myList->selectItem(i);
1305  }
1306  }
1307  return 1;
1308 }
1309 
1310 
1311 long
1312 GNEAdditionalFrame::edgesSelector::onCmdHelp(FXObject*, FXSelector, void*) {
1313  std::cout << "IMPLEMENT" << std::endl;
1314  return 1;
1315 }
1316 
1317 // ---------------------------------------------------------------------------
1318 // GNEAdditionalFrame::lanesSelector - methods
1319 // ---------------------------------------------------------------------------
1320 
1322  FXGroupBox(parent, "lanesSelector", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X),
1323  myViewNet(viewNet) {
1324  // Create CheckBox for selected lanes
1325  myUseSelectedLanes = new FXMenuCheck(this, "Use selected Lanes", this, MID_GNE_USESELECTEDLANES);
1326 
1327  // Create search box
1328  myLanesSearch = new FXTextField(this, 10, this, MID_GNE_SEARCHLANE, LAYOUT_FILL_X);
1329 
1330  // Create list
1331  myList = new FXList(this, this, MID_GNE_SELECTLANE, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT, 0, 0, 0, 100);
1332 
1333  // Create horizontal frame
1334  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, LAYOUT_FILL_X);
1335 
1336  // Create button for clear selection
1337  clearLanesSelection = new FXButton(buttonsFrame, "clear", 0, this, MID_GNE_CLEARLANESELECTION);
1338 
1339  // Create button for invert selection
1340  invertLanesSelection = new FXButton(buttonsFrame, "invert", 0, this, MID_GNE_INVERTLANESELECTION);
1341 
1342  // Create help button
1343  helpLanes = new FXButton(this, "Help", 0, this, MID_HELP);
1344 
1345  // Hide List
1346  hideList();
1347 }
1348 
1349 
1351 
1352 
1353 std::string
1356 }
1357 
1358 
1359 void
1361  myList->clearItems();
1362  std::vector<GNELane*> vectorOfLanes = myViewNet->getNet()->retrieveLanes(false);
1363  for (std::vector<GNELane*>::iterator i = vectorOfLanes.begin(); i != vectorOfLanes.end(); i++) {
1364  if ((*i)->getID().find(search) != std::string::npos) {
1365  myList->appendItem((*i)->getID().c_str());
1366  }
1367  }
1368  // By default, CheckBox for useSelectedLanes isn't checked
1369  myUseSelectedLanes->setCheck(false);
1370  // Show list
1371  show();
1372 }
1373 
1374 
1375 void
1377  hide();
1378 }
1379 
1380 
1381 void
1383  // Enable or disable use selected Lanes
1384  if (myViewNet->getNet()->retrieveLanes(true).size() > 0) {
1385  myUseSelectedLanes->enable();
1386  } else {
1387  myUseSelectedLanes->disable();
1388  }
1389 }
1390 
1391 
1392 bool
1394  if (myUseSelectedLanes->getCheck()) {
1395  return true;
1396  } else {
1397  return false;
1398  }
1399 }
1400 
1401 
1402 long
1404  if (myUseSelectedLanes->getCheck()) {
1405  myLanesSearch->hide();
1406  myList->hide();
1407  clearLanesSelection->hide();
1408  invertLanesSelection->hide();
1409  helpLanes->hide();
1410  } else {
1411  myLanesSearch->show();
1412  myList->show();
1413  clearLanesSelection->show();
1414  invertLanesSelection->show();
1415  helpLanes->show();
1416  }
1417  // Recalc Frame
1418  recalc();
1419  // Update Frame
1420  update();
1421  return 1;
1422 }
1423 
1424 
1425 long
1427  // Show only Id's of lanesSelector that contains the searched string
1428  showList(myLanesSearch->getText().text());
1429  return 1;
1430 }
1431 
1432 
1433 long
1435  return 1;
1436 }
1437 
1438 
1439 long
1441  for (int i = 0; i < myList->getNumItems(); i++) {
1442  if (myList->getItem(i)->isSelected()) {
1443  myList->deselectItem(i);
1444  }
1445  }
1446  return 1;
1447 }
1448 
1449 
1450 long
1452  for (int i = 0; i < myList->getNumItems(); i++) {
1453  if (myList->getItem(i)->isSelected()) {
1454  myList->deselectItem(i);
1455  } else {
1456  myList->selectItem(i);
1457  }
1458  }
1459  return 1;
1460 }
1461 
1462 
1463 long
1464 GNEAdditionalFrame::lanesSelector::onCmdHelp(FXObject*, FXSelector, void*) {
1465  return 1;
1466 }
1467 
1468 /****************************************************************************/
static bool isList(SumoXMLAttr attr)
whether an attribute is of type bool
long onCmdSelectReferencePoint(FXObject *, FXSelector, void *)
std::string getValue() const
return value
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:643
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::vector< additionalParameterList * > myVectorOfAdditionalParameterList
vector with the additional parameters of type list
FXMenuCheck * myCheckForcePosition
checkBox for the option "force position"
int maxNumberOfListParameters
max number of parameters (Defined in constructor)
void hideFramesArea()
hide frames area if all GNEFrames are hidden
FXLabel * myLabel
lael with the name of the parameter
SumoXMLTag getCurrentlyTag() const
get current tag
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
SumoXMLTag myAdditional
current additional
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
int myIndexParameterList
index for myIndexParameterList
void addAttribute(SumoXMLTag additional, SumoXMLAttr attribute)
add attribute
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
bool isBlockEnabled()
check if block is enabled
int getNumberOfAddedAttributes() const
get number of added attributes
FXDEFMAP(GNEAdditionalFrame) GNEAdditionalMap[]
FXButton * add
Button to increase the number of textFields.
void showFramesArea()
show frames area if at least a GNEFrame is showed
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
long onCmdSelectEdge(FXObject *, FXSelector, void *)
called when user select a edge of the list
FXButton * clearEdgesSelection
button for clear selection
FXMenuCheck * myUseSelectedEdges
CheckBox for selected edges.
FXTextField * myLengthTextField
textField for lenght
FXButton * helpAdditionalSet
button for help
additionalReferencePoint getActualReferencePoint()
get actual reference point
FXButton * invertEdgesSelection
button for invert selection
static bool buildAdditional(GNEViewNet *viewNet, SumoXMLTag tag, std::map< SumoXMLAttr, std::string > values)
Builds additional / additionalSet.
void remove2Update()
Removes the dialog to be updated.
GNEAdditionalFrame::lanesSelector * myLanesSelector
list of lanesSelector
long onCmdSelectAdditional(FXObject *, FXSelector, void *)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:86
bool addAdditional(GNENetElement *netElement, GUISUMOAbstractView *parent)
add additional element
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:839
bool isUseSelectedLanesEnable() const
get status of checkBox UseSelectedLanes
int myIndexParameter
Index for myVectorOfAdditionalParameter.
std::string getIdsSelected() const
get list of selecte id&#39;s in string format
GNEAdditionalFrame::additionalParameters * myAdditionalParameters
additional default parameters
static const std::vector< std::pair< SumoXMLAttr, std::string > > & allowedAttributes(SumoXMLTag tag)
get all editable attributes for tag and their default values.
void setParametersOfAdditional(SumoXMLTag actualAdditionalType)
set parameters depending of the new additionalType
void showListParameter(SumoXMLAttr attr, std::vector< int > value)
show name and value of parameters of type int
FXTextField * myLanesSearch
text field for search lane IDs
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
std::vector< FXLabel * > myLabels
vector with with the name of every parameter
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:851
additional match box messages
Definition: GUIAppEnum.h:424
std::string getIdSelected() const
get if currently additional Set
void hide()
hidde additional frame
GNEViewNet * myViewNet
the window to inform when the tls is modfied
Definition: GNEFrame.h:85
void showReferencePoint()
show refence point comboBox
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
FXList * myList
List of lanesSelector.
FXTextField * myTextField
textField to modify the value of parameter
GNEAdditionalFrame::editorParameters * myEditorParameters
editor parameter
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
SUMOReal setEndPosition(SUMOReal laneLenght, SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional)
obtain the End position values of StoppingPlaces and E2 detector over the lane
long onCmdRemoveRow(FXObject *, FXSelector, void *)
add a new row int the list
SUMOReal getLenght()
get value of lenght
the edges of a route
static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr)
check if a element with certain tag has a certain attribute
std::map< SumoXMLAttr, std::string > getAttributes() const
get attributes
The Table.
Definition: GUIAppEnum.h:289
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:51
static bool hasParent(SumoXMLTag tag)
check if a element with certain tag has another additional element as parent
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:93
FXList * myList
List of edgesSelector.
SumoXMLTag myActualAdditionalType
actual additional type selected in the match Box
virtual std::string getDescription()
how should this attribute carrier be called
int numberOfVisibleTextfields
number of visible text fields
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
static T getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr)
return the default value of the attribute of an element
std::vector< GNEAdditional * > getAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING)
get vector with additionals
Definition: GNENet.cpp:1116
SumoXMLAttr getAttr() const
return attribute of list
void showList(std::string search="")
Show list of edgesSelector.
~GNEAdditionalFrame()
Destructor.
FXButton * helpReferencePoint
Button for help about the reference point.
FXComboBox * myAdditionalMatchBox
combo box with the list of additional elements
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING)
Returns the number of additionals of the net.
Definition: GNENet.cpp:1128
long onCmdUseSelectedLanes(FXObject *, FXSelector, void *)
long onCmdAddRow(FXObject *, FXSelector, void *)
GNEAdditionalFrame::additionalSet * myAdditionalSet
list of additional Set
const std::string getID() const
function to support debugging
SUMOReal setStartPosition(SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional)
obtain the Start position values of StoppingPlaces and E2 detector over the lane
FXLabel * myLengthLabel
Label for lenght.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
long onCmdHelp(FXObject *, FXSelector, void *)
FXMenuCheck * myCheckBlock
checkBox for blocking movement
static bool isFloat(SumoXMLAttr attr)
whether an attribute is numerical of type float
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
std::string getListValues()
return the value of list
bool isForcePositionEnabled()
check if force position is enabled
std::vector< FXTextField * > myTextFields
vector textField to modify the value of parameter
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1093
FXTextField * myEdgesSearch
text field for search edge IDs
FXButton * helpEdges
button for help
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
FXButton * clearLanesSelection
button for clear selection
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:456
SUMOReal getLaneShapeLenght() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:524
int myMaxNumberOfValuesInParameterList
Number max of values in a parameter of type list.
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:424
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
static const std::vector< SumoXMLTag > & allowedAdditionalTags()
get all editable tags for additionals
void show()
show additional frame
static bool isInt(SumoXMLAttr attr)
whether an attribute is numerical or type int
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:631
FXList * myList
List of additional sets.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:63
void hideReferencePoint()
hide refence point comboBox
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
additionalParameter(FXComposite *parent, FXObject *tgt)
constructor
std::vector< additionalParameter * > myVectorOfAdditionalParameter
vector with the additional parameters
SumoXMLAttr getAttr() const
return Attr
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
void updateUseSelectedEdges()
Update use selectedEdges.
static std::string getDefinition(SumoXMLTag tag, SumoXMLAttr attr)
return definition of a certain SumoXMLAttr
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:845
std::string getIdsSelected() const
get list of selecte id&#39;s in string format
FXMenuCheck * myMenuCheck
menuCheck to enable/disable the value of parameter
static SumoXMLTag getParentType(SumoXMLTag tag)
get parent&#39;s tag of a certain additional element
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:188
#define SUMOReal
Definition: config.h:213
static bool isUnique(SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection)
static bool isString(SumoXMLAttr attr)
whether an attribute is of type string
additionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
long onCmdSelectLane(FXObject *, FXSelector, void *)
called when user select a lane of the list
void showList(SumoXMLTag type)
Show list of additionalSet.
void showList(std::string search="")
Show list of lanesSelector.
FXMenuCheck * myUseSelectedLanes
CheckBox for selected lanes.
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
static std::string getIdsSelected(const FXList *list)
get list of selecte id&#39;s in string format
bool isUseSelectedEdgesEnable() const
get status of checkBox UseSelectedEdges
int maxNumberOfParameters
max number of parameters (Defined in constructor)
void showParameter(SumoXMLAttr attr, std::string value)
show name and value of attribute of type string
GUISelectedStorage gSelected
A global holder of selected objects.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXLabel * mySetLabel
Label with the name of Set.
static bool isBool(SumoXMLAttr attr)
whether an attribute is of type bool
long onCmdSelectAdditionalSet(FXObject *, FXSelector, void *)
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
FXButton * invertLanesSelection
button for invert selection
GNEAdditionalFrame::edgesSelector * myEdgesSelector
list of edgesSelector
FXButton * helpLanes
button for help
FXComboBox * myReferencePointMatchBox
match box with the list of reference points