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 
57  ADDADDITIONAL_INVALID_ARGUMENTS, // Parameters of additionals are invalid
58  ADDADDITIONAL_INVALID_PARENT, // NetElement parent is invalid
59  ADDADDITIONAL_SUCCESS // additional was successfully created
60  };
61 
62  // ===========================================================================
63  // class AdditionalAttributeSingle
64  // ===========================================================================
65 
66  class AdditionalAttributeSingle : public FXHorizontalFrame {
69 
70  public:
72  AdditionalAttributeSingle(FXComposite* parent);
73 
76 
78  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value);
79 
81  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, int value);
82 
84  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, double value);
85 
87  void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, bool value);
88 
90  void hideParameter();
91 
93  SumoXMLTag getTag() const;
94 
96  SumoXMLAttr getAttr() const;
97 
99  std::string getValue() const;
100 
102  const std::string& isAttributeValid() const;
103 
107  long onCmdSetAttribute(FXObject*, FXSelector, void*);
108 
110  long onCmdSetBooleanAttribute(FXObject*, FXSelector, void*);
112 
113  protected:
116 
117  private:
120 
123 
125  FXLabel* myLabel;
126 
128  FXTextField* myTextFieldInt;
129 
131  FXTextField* myTextFieldReal;
132 
134  FXTextField* myTextFieldStrings;
135 
137  FXCheckButton* myBoolCheckButton;
138 
140  std::string myInvalidValue;
141  };
142 
143  // ===========================================================================
144  // class AdditionalAttributeList
145  // ===========================================================================
146 
147  class AdditionalAttributeList : public FXVerticalFrame {
150 
151  public:
153  AdditionalAttributeList(FXComposite* parent);
154 
157 
159  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<int> value);
160 
162  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<double> value, bool isTime = false);
163 
165  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<bool> value);
166 
168  void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector<std::string> value);
169 
171  void hideParameter();
172 
174  SumoXMLTag getTag() const;
175 
177  SumoXMLAttr getAttr() const;
178 
180  std::string getListValues();
181 
183  bool isCurrentListValid() const;
184 
188  long onCmdAddRow(FXObject*, FXSelector, void*);
189 
191  long onCmdRemoveRow(FXObject*, FXSelector, void*);
193 
194  protected:
197 
198  private:
201 
204 
206  std::vector<FXHorizontalFrame*>myHorizontalFrames;
207 
209  std::vector<FXLabel*> myLabels;
210 
212  std::vector<FXTextField*> myTextFields;
213 
215  FXHorizontalFrame* myHorizontalFrameButtons;
216 
218  FXButton* myAddButton;
219 
221  FXButton* myRemoveButton;
222 
225 
228  };
229 
230  // ===========================================================================
231  // class AdditionalAttributes
232  // ===========================================================================
233 
234  class AdditionalAttributes : public FXGroupBox {
237 
238  public:
240  AdditionalAttributes(GNEViewNet* viewNet, FXComposite* parent);
241 
244 
246  void clearAttributes();
247 
249  void addAttribute(SumoXMLTag additionalTag, SumoXMLAttr AdditionalAttributeSingle);
250 
252  void showAdditionalParameters();
253 
255  void hideAdditionalParameters();
256 
258  std::map<SumoXMLAttr, std::string> getAttributesAndValues() const;
259 
261  bool areValuesValid() const;
262 
264  void showWarningMessage(std::string extra = "") const;
265 
267  int getNumberOfAddedAttributes() const;
268 
272  long onCmdHelp(FXObject*, FXSelector, void*);
274 
275  protected:
278 
279  private:
282 
285 
287  std::vector<AdditionalAttributeSingle*> myVectorOfsingleAdditionalParameter;
288 
291 
293  std::vector<AdditionalAttributeList*> myVectorOfsingleAdditionalParameterList;
294 
297 
300 
303 
305  FXButton* helpAdditional;
306  };
307 
308  // ===========================================================================
309  // class NeteditAttributes
310  // ===========================================================================
311 
312  class NeteditAttributes : public FXGroupBox {
315 
316  public:
322  GNE_ADDITIONALREFERENCEPOINT_INVALID
323  };
324 
326  NeteditAttributes(FXComposite* parent);
327 
330 
332  void showLengthField();
333 
335  void hideLengthField();
336 
338  void showReferencePoint();
339 
341  void hideReferencePoint();
342 
344  additionalReferencePoint getActualReferencePoint();
345 
347  double getLength();
348 
350  bool isBlockEnabled();
351 
353  bool isForcePositionEnabled();
354 
356  bool isCurrentLengthValid() const;
357 
361  long onCmdSetLength(FXObject*, FXSelector, void*);
362 
364  long onCmdSelectReferencePoint(FXObject*, FXSelector, void*);
365 
367  long onCmdSetBlocking(FXObject*, FXSelector, void*);
368 
370  long onCmdSetForcePosition(FXObject*, FXSelector, void*);
371 
373  long onCmdHelp(FXObject*, FXSelector, void*);
375 
376  protected:
379 
380  private:
383 
386 
389 
391  FXLabel* myLengthLabel;
392 
394  FXTextField* myLengthTextField;
395 
398 
401 
403  FXLabel* myBlockLabel;
404 
407 
410  };
411 
412  // ===========================================================================
413  // class SelectorParentAdditional
414  // ===========================================================================
415 
416  class SelectorParentAdditional : public FXGroupBox {
419 
420  public:
422  SelectorParentAdditional(FXComposite* parent, GNEViewNet* viewNet);
423 
426 
428  std::string getIdSelected() const;
429 
431  void showListOfAdditionals(SumoXMLTag type, bool uniqueSelection);
432 
434  void hideListOfAdditionals();
435 
439  long onCmdSelectAdditionalParent(FXObject*, FXSelector, void*);
440 
442  long onCmdHelp(FXObject*, FXSelector, void*);
444 
445  protected:
448 
449  private:
450 
452  FXList* myList;
453 
455  FXLabel* mySetLabel;
456 
459 
462 
465  };
466 
467  // ===========================================================================
468  // class SelectorParentEdges
469  // ===========================================================================
470 
471  class SelectorParentEdges : public FXGroupBox {
474 
475  public:
477  SelectorParentEdges(FXComposite* parent, GNEViewNet* viewNet);
478 
481 
483  std::string getIdsSelected() const;
484 
486  void showList(std::string search = "");
487 
489  void hideList();
490 
492  void updateUseSelectedEdges();
493 
495  bool isUseSelectedEdgesEnable() const;
496 
500  long onCmdUseSelectedEdges(FXObject*, FXSelector, void*);
501 
503  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
504 
506  long onCmdSelectEdge(FXObject*, FXSelector, void*);
507 
509  long onCmdClearSelection(FXObject*, FXSelector, void*);
510 
512  long onCmdInvertSelection(FXObject*, FXSelector, void*);
513 
515  long onCmdHelp(FXObject*, FXSelector, void*);
517 
518  protected:
521 
522  private:
525 
527  FXList* myList;
528 
530  FXTextField* myEdgesSearch;
531 
534 
537 
540 
543  };
544 
545  // ===========================================================================
546  // class SelectorParentLanes
547  // ===========================================================================
548 
549  class SelectorParentLanes : public FXGroupBox {
552 
553  public:
555  SelectorParentLanes(FXComposite* parent, GNEViewNet* viewNet);
556 
559 
561  std::string getIdsSelected() const;
562 
564  void showList(std::string search = "");
565 
567  void hideList();
568 
569  // @brief Update use selectedLanes
570  void updateUseSelectedLanes();
571 
573  bool isUseSelectedLanesEnable() const;
574 
578  long onCmdUseSelectedLanes(FXObject*, FXSelector, void*);
579 
581  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
582 
584  long onCmdSelectLane(FXObject*, FXSelector, void*);
585 
587  long onCmdClearSelection(FXObject*, FXSelector, void*);
588 
590  long onCmdInvertSelection(FXObject*, FXSelector, void*);
591 
593  long onCmdHelp(FXObject*, FXSelector, void*);
595 
596  protected:
599 
600  private:
603 
605  FXList* myList;
606 
608  FXTextField* myLanesSearch;
609 
611  FXButton* helpLanes;
612 
615 
618 
621  };
622 
627  GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
628 
631 
638 
642  void removeAdditional(GNEAdditional* additional);
643 
647  long onCmdSelectAdditional(FXObject*, FXSelector, void*);
649 
651  void show();
652 
654  static std::string getIdsSelected(const FXList* list);
655 
656 protected:
659 
660 private:
662  void setParametersOfAdditional(SumoXMLTag actualAdditionalType);
663 
665  std::string generateID(GNENetElement* netElement) const;
666 
668  double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional);
669 
671  double setEndPosition(double laneLength, double positionOfTheMouseOverLane, double lengthOfAdditional);
672 
675 
677  FXComboBox* myAdditionalMatchBox;
678 
681 
684 
687 
690 
693 
696 };
697 
698 
699 #endif
700 
701 /****************************************************************************/
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)
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr myAdditionalAttr
current XML attribute
additionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
int maxNumberOfParameters
max number of parameters (Defined in constructor)
GNEViewNet * myViewNet
pointer to viewNet
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
FXButton * myRemoveButton
Button to decrease the number of textFields.
GNEAdditionalFrame::AdditionalAttributes * myadditionalParameters
additional internal attributes
int myNumberOfVisibleTextfields
number of visible text fields
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
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
FXButton * myClearEdgesSelection
button for clear selection
std::string myInvalidValue
string which indicates the reason due current value is invalid
long onCmdSelectAdditional(FXObject *, FXSelector, void *)
int myIndexParameter
Index for myVectorOfsingleAdditionalParameter.
FXTextField * myLengthTextField
textField for length
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
void setParametersOfAdditional(SumoXMLTag actualAdditionalType)
set parameters depending of the new additionalType
bool myCurrentLengthValid
Flag to check if current length is valid.
FXTextField * myEdgesSearch
text field for search edge IDs
FXButton * myInvertEdgesSelection
button for invert selection
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
FXButton * clearLanesSelection
button for clear selection
FXLabel * myLengthLabel
Label for length.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
FXList * myList
List of SelectorParentLanes.
std::vector< FXLabel * > myLabels
vector with with the name of every parameter
int myIndexParameterList
index for myIndexParameterList
SumoXMLTag myActualAdditionalType
actual additional type selected in the match Box
FXButton * myHelpAdditionalParentSelector
button for help
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
SumoXMLAttr myAdditionalAttr
current XML attribute
~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.
std::vector< FXTextField * > myTextFields
vector textField to modify the value of parameter
FXButton * myAddButton
Button to increase the number of textFields.
FXGroupBox * myGroupBoxForMyAdditionalMatchBox
groupBox for Match Box of additionals
GNEAdditionalFrame::SelectorParentLanes * mylaneParentsSelector
list of SelectorParentLanes
FXLabel * myForcePositionLabel
Label for force position.
GNEAdditionalFrame::SelectorParentEdges * myedgeParentsSelector
list of SelectorParentEdges
FXList * myList
List of SelectorParentEdges.
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.
SumoXMLTag myAdditionalTag
current additional tag
GNEAdditionalFrame()
FOX needs this.
FXLabel * mySetLabel
Label with the name of additional.
void show()
show additional frame and update use selected edges/lanes
void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value)
show name and value of attribute of type string
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
bool myUniqueSelection
flag to check if only a single parent is allowed
long onCmdSetBooleanAttribute(FXObject *, FXSelector, void *)
called when user change the value of myBoolCheckButton
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
const std::string & isAttributeValid() const
returns a empty string if current value is valid, a string with information about invalid value in ot...
FXButton * invertLanesSelection
button for invert selection
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
FXHorizontalFrame * myHorizontalFrameButtons
horizontal frame for buttons
FXCheckButton * myForcePositionCheckButton
checkBox for the option "force position"
std::vector< FXHorizontalFrame * > myHorizontalFrames
Vector with HorizontalFrames.
int myMaxNumberOfValuesInParameterList
Number max of values in a parameter of type list.
GNEViewNet * myViewNet
viewNet associated to GNEAdditionalFrame
std::vector< AdditionalAttributeSingle * > myVectorOfsingleAdditionalParameter
vector with the additional parameters
std::vector< AdditionalAttributeList * > myVectorOfsingleAdditionalParameterList
vector with the additional parameters of type list
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