SUMO - Simulation of Urban MObility
GNEAdditionalFrame.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The Widget for add additional elements
16 /****************************************************************************/
17 #ifndef GNEAdditionalFrame_h
18 #define GNEAdditionalFrame_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "GNEFrame.h"
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
32 class GNENetElement;
33 class GNEAdditional;
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
42 class GNEAdditionalFrame : public GNEFrame {
43 
44 public:
45 
48  ADDADDITIONAL_INVALID_ARGUMENTS, // Parameters of additionals are invalid
49  ADDADDITIONAL_INVALID_PARENT, // NetElement parent is invalid
50  ADDADDITIONAL_SUCCESS // additional was successfully created
51  };
52 
55 
56  // ===========================================================================
57  // class AdditionalSelector
58  // ===========================================================================
59 
60  class AdditionalSelector : protected FXGroupBox {
63 
64  public:
66  AdditionalSelector(GNEAdditionalFrame* additionalFrameParent);
67 
70 
73 
75  void setCurrentAdditional(SumoXMLTag actualAdditionalType);
76 
80  long onCmdselectAttributeCarrier(FXObject*, FXSelector, void*);
82 
83  protected:
86 
87  private:
90 
92  FXComboBox* myAdditionalMatchBox;
93 
96  };
97 
98  // ===========================================================================
99  // class AdditionalAttributeSingle
100  // ===========================================================================
101 
102  class AdditionalAttributeSingle : protected FXHorizontalFrame {
105 
106  public:
108  AdditionalAttributeSingle(AdditionalAttributes* additionalAttributesParent);
109 
112 
114  void showParameter(SumoXMLAttr additionalAttr, std::string value);
115 
117  void hideParameter();
118 
120  SumoXMLAttr getAttr() const;
121 
123  std::string getValue() const;
124 
126  const std::string& isAttributeValid() const;
127 
131  long onCmdSetAttribute(FXObject*, FXSelector, void*);
132 
134  long onCmdSetBooleanAttribute(FXObject*, FXSelector, void*);
136 
137  protected:
140 
141  private:
144 
147 
149  FXLabel* myLabel;
150 
152  FXTextField* myTextFieldInt;
153 
155  FXTextField* myTextFieldReal;
156 
158  FXTextField* myTextFieldStrings;
159 
161  FXCheckButton* myBoolCheckButton;
162 
164  std::string myInvalidValue;
165  };
166 
167  // ===========================================================================
168  // class AdditionalAttributes
169  // ===========================================================================
170 
171  class AdditionalAttributes : protected FXGroupBox {
174 
175 
177 
178  public:
180  AdditionalAttributes(GNEAdditionalFrame* additionalFrameParent);
181 
184 
186  void clearAttributes();
187 
189  void addAttribute(SumoXMLAttr AdditionalAttributeSingle);
190 
192  void showAdditionalParameters();
193 
195  void hideAdditionalParameters();
196 
198  std::map<SumoXMLAttr, std::string> getAttributesAndValues() const;
199 
201  bool areValuesValid() const;
202 
204  void showWarningMessage(std::string extra = "") const;
205 
207  GNEAdditionalFrame* getAdditionalFrameParent() const;
208 
212  long onCmdHelp(FXObject*, FXSelector, void*);
214 
215  protected:
218 
219  private:
222 
224  std::vector<AdditionalAttributeSingle*> myVectorOfsingleAdditionalParameter;
225 
226  };
227 
228  // ===========================================================================
229  // class NeteditAttributes
230  // ===========================================================================
231 
232  class NeteditAttributes : protected FXGroupBox {
235 
236  public:
242  GNE_ADDITIONALREFERENCEPOINT_INVALID
243  };
244 
246  NeteditAttributes(GNEAdditionalFrame* additionalFrameParent);
247 
250 
252  void showNeteditAttributes(bool includeLengthAndReferencePoint);
253 
255  void hideNeteditAttributes();
256 
258  additionalReferencePoint getActualReferencePoint() const;
259 
261  double getLength() const;
262 
264  bool isBlockEnabled() const;
265 
267  bool isCurrentLengthValid() const;
268 
272  long onCmdSetLength(FXObject*, FXSelector, void*);
273 
275  long onCmdSelectReferencePoint(FXObject*, FXSelector, void*);
276 
278  long onCmdSetBlocking(FXObject*, FXSelector, void*);
279 
281  long onCmdHelp(FXObject*, FXSelector, void*);
283 
284  protected:
287 
288  private:
291 
294 
297 
299  FXLabel* myLengthLabel;
300 
302  FXTextField* myLengthTextField;
303 
305  FXLabel* myBlockLabel;
306 
309 
312  };
313 
314  // ===========================================================================
315  // class SelectorParentAdditional
316  // ===========================================================================
317 
318  class SelectorParentAdditional : protected FXGroupBox {
319  public:
321  SelectorParentAdditional(GNEAdditionalFrame* additionalFrameParent);
322 
325 
327  std::string getIdSelected() const;
328 
330  void setIDSelected(const std::string& id);
331 
333  void showListOfAdditionalParents(SumoXMLTag additionalTypeParent);
334 
336  void hideListOfAdditionalParents();
337 
339  void refreshListOfAdditionalParents();
340 
341  private:
344 
347 
350 
353  };
354 
355  // ===========================================================================
356  // class SelectorParentEdges
357  // ===========================================================================
358 
359  class SelectorParentEdges : protected FXGroupBox {
362 
363  public:
365  SelectorParentEdges(GNEAdditionalFrame* additionalFrameParent);
366 
369 
371  std::string getIdsSelected() const;
372 
374  void showList(std::string search = "");
375 
377  void hideList();
378 
380  void updateUseSelectedEdges();
381 
383  bool isUseSelectedEdgesEnable() const;
384 
388  long onCmdUseSelectedEdges(FXObject*, FXSelector, void*);
389 
391  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
392 
394  long onCmdSelectEdge(FXObject*, FXSelector, void*);
395 
397  long onCmdClearSelection(FXObject*, FXSelector, void*);
398 
400  long onCmdInvertSelection(FXObject*, FXSelector, void*);
402 
403  protected:
406 
407  private:
410 
413 
415  FXList* myList;
416 
418  FXTextField* myEdgesSearch;
419 
422 
425  };
426 
427  // ===========================================================================
428  // class SelectorParentLanes
429  // ===========================================================================
430 
431  class SelectorParentLanes : protected FXGroupBox {
434 
435  public:
437  SelectorParentLanes(GNEAdditionalFrame* additionalFrameParent);
438 
441 
443  std::string getIdsSelected() const;
444 
446  void showList(std::string search = "");
447 
449  void hideList();
450 
451  // @brief Update use selectedLanes
452  void updateUseSelectedLanes();
453 
455  bool isUseSelectedLanesEnable() const;
456 
460  long onCmdUseSelectedLanes(FXObject*, FXSelector, void*);
461 
463  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
464 
466  long onCmdSelectLane(FXObject*, FXSelector, void*);
467 
469  long onCmdClearSelection(FXObject*, FXSelector, void*);
470 
472  long onCmdInvertSelection(FXObject*, FXSelector, void*);
474 
475  protected:
478 
479  private:
482 
485 
487  FXList* myList;
488 
490  FXTextField* myLanesSearch;
491 
494 
497  };
498 
503  GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
504 
507 
514 
518  void removeAdditional(GNEAdditional* additional);
519 
521  void show();
522 
524  static std::string getIdsSelected(const FXList* list);
525 
526 protected:
529 
532 
535 
538 
541 
544 
545 private:
547  std::string generateID(GNENetElement* netElement) const;
548 
550  double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional);
551 
553  double setEndPosition(double laneLength, double positionOfTheMouseOverLane, double lengthOfAdditional);
554 
557 
560 
563 
566 
569 
572 };
573 
574 
575 #endif
576 
577 /****************************************************************************/
double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional)
obtain the Start position values of StoppingPlaces and E2 detector over the lane
GNEAdditionalFrame::AdditionalSelector * myAdditionalSelector
additional selector
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr myAdditionalAttr
current XML attribute
additionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
SelectorParentAdditional * getAdditionalParentSelector() const
get additional parent selector
SumoXMLTag getCurrentAdditionalType() const
get current additional type
void setCurrentAdditional(SumoXMLTag actualAdditionalType)
set parameters depending of the given additionalType
AddAdditionalResult addAdditional(GNENetElement *netElement, GNEAdditional *additional)
add additional element
FXLabel * myFirstAdditionalParentsLabel
Label with the name of additional.
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
FXList * myFirstAdditionalParentsList
List of additional sets.
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
GNEAdditionalFrame::SelectorParentEdges * myEdgeParentsSelector
list of SelectorParentEdges
FXTextField * myLengthTextField
textField for length
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool myCurrentLengthValid
Flag to check if current length is valid.
FXTextField * myEdgesSearch
text field for search edge IDs
AdditionalAttributes * myAdditionalAttributesParent
additional attribute parent
FXButton * myInvertEdgesSelection
button for invert selection
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additional frame parent
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
long onCmdselectAttributeCarrier(FXObject *, FXSelector, void *)
FXButton * clearLanesSelection
button for clear selection
SelectorParentLanes * getLaneParentsSelector() const
get lane parents selector
GNEAdditionalFrame::NeteditAttributes * myNeteditParameters
Netedit parameter.
FXLabel * myLengthLabel
Label for length.
SelectorParentEdges * getEdgeParentsSelector() const
get edge parents selector
GNEAdditionalFrame * myAdditionalFrameParent
pointer to Additional Frame Parent
FXList * myList
List of SelectorParentLanes.
GNEAdditionalFrame::SelectorParentAdditional * myFirstAdditionalParentSelector
list of additional Set
FXComboBox * myAdditionalMatchBox
combo box with the list of additional elements
GNEAdditionalFrame::AdditionalAttributes * myAdditionalParameters
additional internal attributes
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
GNEAdditionalFrame::SelectorParentLanes * myLaneParentsSelector
list of SelectorParentLanes
~GNEAdditionalFrame()
Destructor.
FXLabel * myBlockLabel
Label for block movement.
FXTextField * myLanesSearch
text field for search lane IDs
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additionalFrameParent
SumoXMLTag myCurrentAdditionalType
actual additional type selected in the match Box
SumoXMLTag myAdditionalTypeParent
current additional type parent
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additional frame parent
FXList * myList
List of SelectorParentEdges.
FXLabel * myLabel
lael with the name of the parameter
AddAdditionalResult
enum with all possible values after try to create an additional using frame
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:53
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
GNEAdditionalFrame * myAdditionalFrameParent
pointer to Additional Frame Parent
AdditionalSelector * getAdditionalSelector() const
get additional selector
FXButton * invertLanesSelection
button for invert selection
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
GNEAdditionalFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
AdditionalAttributes * getAdditionalParameters() const
get additional attributes
std::vector< AdditionalAttributeSingle * > myVectorOfsingleAdditionalParameter
vector with the additional parameters
NeteditAttributes * getNeteditAttributes() const
get netedit attributes
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.