SUMO - Simulation of Urban MObility
GNEAdditionalFrame.h
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 #ifndef GNEAdditionalFrame_h
21 #define GNEAdditionalFrame_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "GNEFrame.h"
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
39 class GNENetElement;
40 class GNEAdditional;
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
49 class GNEAdditionalFrame : public GNEFrame {
51  FXDECLARE(GNEAdditionalFrame)
52 
53 public:
54 
55  // ===========================================================================
56  // class singleAdditionalParameter
57  // ===========================================================================
58 
59  class singleAdditionalParameter : public FXMatrix {
62 
63  public:
65  singleAdditionalParameter(FXComposite* parent);
66 
69 
71  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value);
72 
74  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, int value);
75 
77  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, SUMOReal value, bool isTime = false);
78 
80  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, bool value);
81 
83  void hideParameter();
84 
86  SumoXMLTag getTag() const;
87 
89  SumoXMLAttr getAttr() const;
90 
92  std::string getValue() const;
93 
95  bool isCurrentValueValid() const;
96 
100  long onCmdSetAttribute(FXObject*, FXSelector, void*);
101 
103  long onCmdSetBooleanAttribute(FXObject*, FXSelector, void*);
105 
106  protected:
109 
110  private:
113 
116 
118  FXLabel* myLabel;
119 
121  FXTextField* myTextField;
122 
124  FXSpinner* myTimeSpinDial;
125 
127  FXMenuCheck* myMenuCheck;
128 
131  };
132 
133  // ===========================================================================
134  // class singleAdditionalParameterList
135  // ===========================================================================
136 
137  class singleAdditionalParameterList : public FXMatrix {
140 
141  public:
143  singleAdditionalParameterList(FXComposite* parent);
144 
147 
149  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<int> value);
150 
152  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<SUMOReal> value, bool isTime = false);
153 
155  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<bool> value);
156 
158  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<std::string> value);
159 
161  void hideParameter();
162 
164  SumoXMLTag getTag() const;
165 
167  SumoXMLAttr getAttr() const;
168 
170  std::string getListValues();
171 
173  bool isCurrentListValid() const;
174 
178  long onCmdAddRow(FXObject*, FXSelector, void*);
179 
181  long onCmdRemoveRow(FXObject*, FXSelector, void*);
183 
184  protected:
187 
188  private:
191 
194 
196  std::vector<FXLabel*> myLabels;
197 
199  std::vector<FXTextField*> myTextFields;
200 
202  FXButton* add;
203 
205  FXButton* remove;
206 
209 
212  };
213 
214  // ===========================================================================
215  // class additionalParameters
216  // ===========================================================================
217 
218  class additionalParameters : public FXGroupBox {
221 
222  public:
224  additionalParameters(FXComposite* parent);
225 
228 
230  void clearAttributes();
231 
233  void addAttribute(SumoXMLTag additionalTag, SumoXMLAttr additionalAttribute);
234 
236  void showAdditionalParameters();
237 
239  void hideAdditionalParameters();
240 
242  std::map<SumoXMLAttr, std::string> getAttributesAndValues() const;
243 
245  bool isValuesValid() const;
246 
248  int getNumberOfAddedAttributes() const;
249 
253  long onCmdHelp(FXObject*, FXSelector, void*);
255 
256  protected:
259 
260  private:
263 
265  std::vector<singleAdditionalParameter*> myVectorOfsingleAdditionalParameter;
266 
269 
271  std::vector<singleAdditionalParameterList*> myVectorOfsingleAdditionalParameterList;
272 
275 
278 
281 
283  FXButton* helpAdditional;
284  };
285 
286  // ===========================================================================
287  // class editorParameters
288  // ===========================================================================
289 
290  class editorParameters : public FXGroupBox {
293 
294  public:
299  GNE_ADDITIONALREFERENCEPOINT_CENTER
300  };
301 
303  editorParameters(FXComposite* parent);
304 
306  ~editorParameters();
307 
309  void showLengthField();
310 
312  void hideLengthField();
313 
315  void showReferencePoint();
316 
318  void hideReferencePoint();
319 
321  additionalReferencePoint getActualReferencePoint();
322 
324  SUMOReal getLenght();
325 
327  bool isBlockEnabled();
328 
330  bool isForcePositionEnabled();
331 
333  bool isCurrentLenghtValid() const;
334 
338  long onCmdSetLength(FXObject*, FXSelector, void*);
339 
341  long onCmdSelectReferencePoint(FXObject*, FXSelector, void*);
342 
344  long onCmdHelp(FXObject*, FXSelector, void*);
346 
347  protected:
350 
351  private:
354 
357 
360 
362  FXLabel* myLengthLabel;
363 
365  FXTextField* myLengthTextField;
366 
368  FXMenuCheck* myCheckForcePosition;
369 
371  FXMenuCheck* myCheckBlock;
372 
375  };
376 
377  // ===========================================================================
378  // class additionalParentSelector
379  // ===========================================================================
380 
381  class additionalParentSelector : public FXGroupBox {
384 
385  public:
387  additionalParentSelector(FXComposite* parent, GNEViewNet* viewNet);
388 
391 
393  std::string getIdSelected() const;
394 
396  void showListOfAdditionals(SumoXMLTag type, bool uniqueSelection);
397 
399  void hideListOfAdditionals();
400 
404  long onCmdSelectAdditionalParent(FXObject*, FXSelector, void*);
405 
407  long onCmdHelp(FXObject*, FXSelector, void*);
409 
410  protected:
413 
414  private:
415 
417  FXList* myList;
418 
420  FXLabel* mySetLabel;
421 
424 
427 
430  };
431 
432  // ===========================================================================
433  // class edgeParentsSelector
434  // ===========================================================================
435 
436  class edgeParentsSelector : public FXGroupBox {
439 
440  public:
442  edgeParentsSelector(FXComposite* parent, GNEViewNet* viewNet);
443 
446 
448  std::string getIdsSelected() const;
449 
451  void showList(std::string search = "");
452 
454  void hideList();
455 
457  void updateUseSelectedEdges();
458 
460  bool isUseSelectedEdgesEnable() const;
461 
465  long onCmdUseSelectedEdges(FXObject*, FXSelector, void*);
466 
468  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
469 
471  long onCmdSelectEdge(FXObject*, FXSelector, void*);
472 
474  long onCmdClearSelection(FXObject*, FXSelector, void*);
475 
477  long onCmdInvertSelection(FXObject*, FXSelector, void*);
478 
480  long onCmdHelp(FXObject*, FXSelector, void*);
482 
483  protected:
486 
487  private:
489  FXMenuCheck* myUseSelectedEdges;
490 
492  FXList* myList;
493 
495  FXTextField* myEdgesSearch;
496 
499 
502 
505 
508  };
509 
510  // ===========================================================================
511  // class laneParentsSelector
512  // ===========================================================================
513 
514  class laneParentsSelector : public FXGroupBox {
517 
518  public:
520  laneParentsSelector(FXComposite* parent, GNEViewNet* viewNet);
521 
524 
526  std::string getIdsSelected() const;
527 
529  void showList(std::string search = "");
530 
532  void hideList();
533 
534  // @brief Update use selectedLanes
535  void updateUseSelectedLanes();
536 
538  bool isUseSelectedLanesEnable() const;
539 
543  long onCmdUseSelectedLanes(FXObject*, FXSelector, void*);
544 
546  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
547 
549  long onCmdSelectLane(FXObject*, FXSelector, void*);
550 
552  long onCmdClearSelection(FXObject*, FXSelector, void*);
553 
555  long onCmdInvertSelection(FXObject*, FXSelector, void*);
556 
558  long onCmdHelp(FXObject*, FXSelector, void*);
560 
561  protected:
564 
565  private:
567  FXMenuCheck* myUseSelectedLanes;
568 
570  FXList* myList;
571 
573  FXTextField* myLanesSearch;
574 
576  FXButton* helpLanes;
577 
580 
583 
586  };
587 
592  GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
593 
596 
602  bool addAdditional(GNENetElement* netElement, GUISUMOAbstractView* parent);
603 
607  void removeAdditional(GNEAdditional* additional);
608 
612  long onCmdSelectAdditional(FXObject*, FXSelector, void*);
614 
616  void show();
617 
619  static std::string getIdsSelected(const FXList* list);
620 
621 protected:
624 
625 private:
627  void setParametersOfAdditional(SumoXMLTag actualAdditionalType);
628 
630  std::string generateID(GNENetElement* netElement) const;
631 
633  SUMOReal setStartPosition(SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional);
634 
636  SUMOReal setEndPosition(SUMOReal laneLenght, SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional);
637 
640 
642  FXComboBox* myAdditionalMatchBox;
643 
646 
649 
652 
655 
658 
661 };
662 
663 
664 #endif
665 
666 /****************************************************************************/
bool isCurrentValueValid() const
check if the current value is valid
SumoXMLTag
Numbers representing SUMO-XML - element names.
FXMenuCheck * myCheckForcePosition
checkBox for the option "force position"
int maxNumberOfListParameters
max number of parameters (Defined in constructor)
SumoXMLTag myAdditionalTag
current XML attribute
FXList * myList
List of additional sets.
FXLabel * mySetLabel
Label with the name of additional.
int myMaxNumberOfValuesInParameterList
Number max of values in a parameter of type list.
FXButton * myHelpAdditionalParentSelector
button for help
int myIndexParameterList
index for myIndexParameterList
FXList * myList
List of laneParentsSelector.
GNEAdditionalFrame::laneParentsSelector * mylaneParentsSelector
list of laneParentsSelector
FXTextField * myTextField
textField to modify the value of int/float/string parameters
FXTextField * myLengthTextField
textField for lenght
bool myUniqueSelection
flag to check if only a single parent is allowed
long onCmdSetBooleanAttribute(FXObject *, FXSelector, void *)
called when user change the value of myMenuCheck
long onCmdSelectAdditional(FXObject *, FXSelector, void *)
std::vector< FXLabel * > myLabels
vector with with the name of every parameter
bool addAdditional(GNENetElement *netElement, GUISUMOAbstractView *parent)
add additional element
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNEAdditionalFrame::edgeParentsSelector * myedgeParentsSelector
list of edgeParentsSelector
int myIndexParameter
Index for myVectorOfsingleAdditionalParameter.
void setParametersOfAdditional(SumoXMLTag actualAdditionalType)
set parameters depending of the new additionalType
int numberOfVisibleTextfields
number of visible text fields
std::vector< FXTextField * > myTextFields
vector textField to modify the value of parameter
SumoXMLTag myAdditionalTag
current additional tag
FXButton * myInvertEdgesSelection
button for invert selection
FXMenuCheck * myMenuCheck
menuCheck to enable/disable the value of boolean parameters
GNEAdditionalFrame::editorParameters * myEditorParameters
editor parameter
SUMOReal setEndPosition(SUMOReal laneLenght, SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional)
obtain the End position values of StoppingPlaces and E2 detector over the lane
void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value)
show name and value of attribute of type string
FXButton * invertLanesSelection
button for invert selection
GNEAdditionalFrame::additionalParameters * myadditionalParameters
additional default parameters
FXButton * add
Button to increase the number of textFields.
FXButton * myClearEdgesSelection
button for clear selection
SumoXMLTag myActualAdditionalType
actual additional type selected in the match Box
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
long onCmdSetAttribute(FXObject *, FXSelector, void *)
FXMenuCheck * myUseSelectedLanes
CheckBox for selected lanes.
~GNEAdditionalFrame()
Destructor.
FXButton * helpReferencePoint
Button for help about the reference point.
FXComboBox * myAdditionalMatchBox
combo box with the list of additional elements
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
bool myCurrentLengthValid
Flag to check if current lenght is valid.
SUMOReal setStartPosition(SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional)
obtain the Start position values of StoppingPlaces and E2 detector over the lane
FXLabel * myLabel
lael with the name of the parameter
SumoXMLAttr myAdditionalAttr
current XML attribute
GNEAdditionalFrame::additionalParentSelector * myAdditionalParentSelector
list of additional Set
FXLabel * myLengthLabel
Label for lenght.
FXMenuCheck * myCheckBlock
checkBox for blocking movement
FXGroupBox * myGroupBoxForMyAdditionalMatchBox
groupBox for Match Box of additionals
bool myCurrentValueValid
Flag which indicates that the current value is correct.
FXList * myList
List of edgeParentsSelector.
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
GNEAdditionalFrame()
FOX needs this.
void show()
show additional frame and update use selected edges/lanes
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
std::vector< singleAdditionalParameter * > myVectorOfsingleAdditionalParameter
vector with the additional parameters
std::string getValue() const
return value
FXTextField * myLanesSearch
text field for search lane IDs
SumoXMLAttr myAdditionalAttr
current XML attribute
FXSpinner * myTimeSpinDial
spindial to modify the value of time parameters
FXButton * clearLanesSelection
button for clear selection
#define SUMOReal
Definition: config.h:208
std::vector< singleAdditionalParameterList * > myVectorOfsingleAdditionalParameterList
vector with the additional parameters of type list
additionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
FXMenuCheck * myUseSelectedEdges
CheckBox for selected edges.
static std::string getIdsSelected(const FXList *list)
get list of selecte id&#39;s in string format
FXTextField * myEdgesSearch
text field for search edge IDs
int maxNumberOfParameters
max number of parameters (Defined in constructor)
FXButton * myHelpedgeParentsSelector
button for help
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
FXComboBox * myReferencePointMatchBox
match box with the list of reference points