SUMO - Simulation of Urban MObility
GNEFrame.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 // Abstract class for lateral frames in NetEdit
16 /****************************************************************************/
17 #ifndef GNEFrame_h
18 #define GNEFrame_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <fx.h>
28 #include <netedit/GNEViewNet.h>
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
33 
38 class GNEFrame : public FXVerticalFrame {
39 
40 public:
41 
42  // ===========================================================================
43  // class ItemSelector
44  // ===========================================================================
45 
46  class ItemSelector : protected FXGroupBox {
48  FXDECLARE(GNEFrame::ItemSelector)
49 
50  public:
52  ItemSelector(GNEFrame* frameParent, GNEAttributeCarrier::TAGProperty type, bool onlyDrawables = true);
53 
55  ~ItemSelector();
56 
59 
61  void setCurrentTypeTag(SumoXMLTag typeTag);
62 
64  void refreshTagProperties();
65 
69  long onCmdSelectItem(FXObject*, FXSelector, void*);
71 
72  protected:
75 
76  private:
79 
81  FXComboBox* myTypeMatchBox;
82 
85 
87  std::vector<SumoXMLTag> myListOfTags;
88 
91  };
92 
94  class ACAttributes;
95 
96  // ===========================================================================
97  // class ACAttributeRow
98  // ===========================================================================
99 
100  class ACAttributeRow : public FXHorizontalFrame {
102  FXDECLARE(GNEFrame::ACAttributeRow)
103 
104  public:
106  ACAttributeRow(ACAttributes* ACAttributesParent);
107 
109  ~ACAttributeRow();
110 
112  void showParameter(SumoXMLAttr const attr, const GNEAttributeCarrier::AttributeProperties &attrProperties, const std::string &value);
113 
115  void hideParameter();
116 
118  SumoXMLAttr getAttr() const;
119 
121  std::string getValue() const;
122 
124  const std::string& isAttributeValid() const;
125 
127  ACAttributes* getACAttributesParent() const;
128 
132  long onCmdSetAttribute(FXObject*, FXSelector, void*);
133 
135  long onCmdSetBooleanAttribute(FXObject*, FXSelector, void*);
136 
138  long onCmdSetColorAttribute(FXObject*, FXSelector, void*);
140 
141  protected:
144 
145  private:
148 
151 
154 
156  FXLabel* myLabel;
157 
159  FXTextField* myTextFieldInt;
160 
162  FXTextField* myTextFieldReal;
163 
165  FXTextField* myTextFieldStrings;
166 
168  FXCheckButton* myBoolCheckButton;
169 
171  FXButton* myColorEditor;
172 
174  std::string myInvalidValue;
175  };
176 
177  // ===========================================================================
178  // class ACAttributes
179  // ===========================================================================
180 
181  class ACAttributes : protected FXGroupBox {
183  FXDECLARE(GNEFrame::ACAttributes)
184 
185  // declare friend class
186  friend class ACAttributeRow;
187 
188  public:
190  ACAttributes(GNEFrame* frameParent);
191 
193  ~ACAttributes();
194 
196  void showACAttributesModul(const GNEAttributeCarrier::TagProperties &myTagProperties);
197 
199  void hideACAttributesModul();
200 
202  std::map<SumoXMLAttr, std::string> getAttributesAndValues() const;
203 
205  bool areValuesValid() const;
206 
208  void showWarningMessage(std::string extra = "") const;
209 
211  int getNumberOfAddedAttributes() const;
212 
216  long onCmdHelp(FXObject*, FXSelector, void*);
218 
219  protected:
222 
223  private:
226 
229 
231  std::vector<ACAttributeRow*> myACAttributeRows;
232  };
233 
234  // ===========================================================================
235  // class ACHierarchy
236  // ===========================================================================
237 
238  class ACHierarchy : private FXGroupBox {
240  FXDECLARE(GNEFrame::ACHierarchy)
241 
242  public:
244  ACHierarchy(GNEFrame* frameParent);
245 
247  ~ACHierarchy();
248 
250  void showACHierarchy(GNEAttributeCarrier* AC);
251 
253  void hideACHierarchy();
254 
256  void refreshACHierarchy();
257 
261  long onCmdShowChildMenu(FXObject*, FXSelector, void* data);
262 
264  long onCmdCenterItem(FXObject*, FXSelector, void*);
265 
267  long onCmdInspectItem(FXObject*, FXSelector, void*);
268 
270  long onCmdDeleteItem(FXObject*, FXSelector, void*);
272 
273  protected:
276 
277  // @brief create pop-up menu in the positions X-Y for the attribute carrier ac
278  void createPopUpMenu(int X, int Y, GNEAttributeCarrier* ac);
279 
281  FXTreeItem* showAttributeCarrierParents();
282 
284  void showAttributeCarrierChilds(GNEAttributeCarrier* AC, FXTreeItem* itemParent);
285 
287  FXTreeItem* addACIntoList(GNEAttributeCarrier* AC, FXTreeItem* itemParent);
288 
289  private:
292 
295 
297  FXTreeList* myTreelist;
298 
300  std::map<FXTreeItem*, GNEAttributeCarrier*> myTreeItemToACMap;
301 
303  std::set<FXTreeItem*> myTreeItemsConnections;
304 
307  };
308 
309  // ===========================================================================
310  // class GenericParametersEditor
311  // ===========================================================================
312 
313  class GenericParametersEditor : private FXGroupBox {
316 
317  public:
319  GenericParametersEditor(GNEFrame* frameParent);
320 
323 
325  void showGenericParametersEditor(GNEAttributeCarrier* AC);
326 
328  void showGenericParametersEditor(std::vector<GNEAttributeCarrier*> ACs);
329 
331  void hideGenericParametersEditor();
332 
334  void refreshGenericParametersEditor();
335 
337  std::string getGenericParametersStr() const;
338 
342  long onCmdEditGenericParameter(FXObject*, FXSelector, void*);
343 
345  long onCmdSetGenericParameter(FXObject*, FXSelector, void*);
347 
348  protected:
351 
352  private:
355 
358 
360  std::vector<GNEAttributeCarrier*> myACs;
361 
363  std::vector<std::pair<std::string, std::string> >* myGenericParameters;
364 
367 
370  };
371 
372  // ===========================================================================
373  // class DrawingShape
374  // ===========================================================================
375 
376  class DrawingShape : private FXGroupBox {
378  FXDECLARE(GNEFrame::DrawingShape)
379 
380  public:
382  DrawingShape(GNEFrame* frameParent);
383 
385  ~DrawingShape();
386 
388  void showDrawingShape();
389 
391  void hideDrawingShape();
392 
394  void startDrawing();
395 
397  void stopDrawing();
398 
400  void abortDrawing();
401 
403  void addNewPoint(const Position& P);
404 
406  void removeLastPoint();
407 
409  const PositionVector& getTemporalShape() const;
410 
412  bool isDrawing() const;
413 
415  void setDeleteLastCreatedPoint(bool value);
416 
418  bool getDeleteLastCreatedPoint();
419 
423  long onCmdStartDrawing(FXObject*, FXSelector, void*);
424 
426  long onCmdStopDrawing(FXObject*, FXSelector, void*);
427 
429  long onCmdAbortDrawing(FXObject*, FXSelector, void*);
431 
432  protected:
435 
436  private:
439 
442 
445 
448 
451 
454 
457  };
458 
459  // ===========================================================================
460  // class NeteditAttributes
461  // ===========================================================================
462 
463  class NeteditAttributes : protected FXGroupBox {
465  FXDECLARE(GNEFrame::NeteditAttributes)
466 
467  public:
469  NeteditAttributes(GNEFrame* frameParent);
470 
473 
475  void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties& tagValue);
476 
478  void hideNeteditAttributesModul();
479 
481  bool getNeteditAttributesAndValues(std::map<SumoXMLAttr, std::string> &valuesMap, GNELane *lane) const;
482 
486  long onCmdSetNeteditAttribute(FXObject*, FXSelector, void*);
487 
489  long onCmdHelp(FXObject*, FXSelector, void*);
491 
492  protected:
495 
496  private:
502  GNE_ADDITIONALREFERENCEPOINT_INVALID
503  };
504 
506  double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional) const;
507 
509  double setEndPosition(double positionOfTheMouseOverLane, double lengthOfAdditional) const;
510 
513 
516 
518  FXLabel* myLengthLabel;
519 
521  FXTextField* myLengthTextField;
522 
525 
528 
531 
533  FXCheckButton* myBlockShapeCheckButton;
534 
537 
539  FXCheckButton* myCloseShapeCheckButton;
540 
543 
546 
549  };
550 
556  GNEFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet, const std::string& frameLabel);
557 
559  ~GNEFrame();
560 
562  void focusUpperElement();
563 
567  virtual void show();
568 
572  virtual void hide();
573 
575  void setFrameWidth(int newWidth);
576 
578  GNEViewNet* getViewNet() const;
579 
581  FXLabel* getFrameHeaderLabel() const;
582 
584  FXFont* getFrameHeaderFont() const;
585 
586 protected:
588  GNEFrame() {}
589 
594  virtual bool buildShape();
595 
597  virtual void enableModuls(const GNEAttributeCarrier::TagProperties &tagProperties);
598 
600  virtual void disableModuls();
601 
603  void openHelpAttributesDialog(const GNEAttributeCarrier::TagProperties &tagProperties) const;
604 
606  const RGBColor& getEdgeCandidateColor() const;
607 
610 
613 
615  FXVerticalFrame* myContentFrame;
616 
618  FXHorizontalFrame* myHeaderFrame;
619 
621  FXHorizontalFrame* myHeaderLeftFrame;
622 
624  FXHorizontalFrame* myHeaderRightFrame;
625 
626 private:
628  FXScrollWindow* myScrollWindowsContents;
629 
632 
635 
638 
641 
643  GNEFrame(const GNEFrame&) = delete;
644 
646  GNEFrame& operator=(const GNEFrame&) = delete;
647 };
648 
649 
650 #endif
651 
652 /****************************************************************************/
GNEFrame()
FOX needs this.
Definition: GNEFrame.h:588
bool myDeleteLastCreatedPoint
flag to enable/disable delete point mode
Definition: GNEFrame.h:441
const RGBColor & getEdgeCandidateColor() const
get edge candidate color
Definition: GNEFrame.cpp:1824
SumoXMLTag
Numbers representing SUMO-XML - element names.
FXTextField * myLengthTextField
textField for length
Definition: GNEFrame.h:521
FXButton * myStartDrawingButton
button for start drawing
Definition: GNEFrame.h:447
virtual void enableModuls(const GNEAttributeCarrier::TagProperties &tagProperties)
enable moduls depending of item selected in ItemSelector (can be reimplemented in frame childs) ...
Definition: GNEFrame.cpp:1745
GNEFrame & operator=(const GNEFrame &)=delete
Invalidated assignment operator.
FXLabel * getFrameHeaderLabel() const
get the label for the frame&#39;s header
Definition: GNEFrame.cpp:1726
FXLabel * myBlockShapeLabel
Label for block shape.
Definition: GNEFrame.h:530
FXLabel * myLabel
lael with the name of the parameter
Definition: GNEFrame.h:156
FXFont * myFrameHeaderFont
Font for the Header.
Definition: GNEFrame.h:631
FXHorizontalFrame * myHeaderRightFrame
fame for right header elements
Definition: GNEFrame.h:624
ItemSelector()
FOX needs this.
Definition: GNEFrame.h:74
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the Tree items with their AC
Definition: GNEFrame.h:300
struct with the attribute Properties
GNEFrame * myFrameParent
pointer to inspector frame parent
Definition: GNEFrame.h:354
GNEAttributeCarrier * myRightClickedAC
pointer to current right clicked Attribute Carrier
Definition: GNEFrame.h:306
const RGBColor & getEdgeCandidateSelectedColor() const
get selected color
Definition: GNEFrame.cpp:1830
FXComboBox * myTypeMatchBox
comboBox with the list of elements type
Definition: GNEFrame.h:81
FXCheckButton * myBoolCheckButton
check button to enable/disable the value of boolean parameters
Definition: GNEFrame.h:168
FXScrollWindow * myScrollWindowsContents
scroll windows that holds the content frame
Definition: GNEFrame.h:628
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
GNEFrame * myFrameParent
pointer to Frame Parent
Definition: GNEFrame.h:78
std::vector< ACAttributeRow * > myACAttributeRows
vector with the ACAttribute Rows
Definition: GNEFrame.h:231
FXFont * getFrameHeaderFont() const
get font of the header&#39;s frame
Definition: GNEFrame.cpp:1732
FXHorizontalFrame * myHeaderFrame
fame for header elements
Definition: GNEFrame.h:618
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show ...
Definition: GNEFrame.cpp:176
RGBColor myEdgeCandidateSelectedColor
selected edge candidate color (used by some modulds to selected mark edges)
Definition: GNEFrame.h:640
FXCheckButton * myBlockMovementCheckButton
checkBox for block movement
Definition: GNEFrame.h:527
GNEAttributeCarrier::TagProperties myTagProperties
current edited Tag Properties
Definition: GNEFrame.h:228
FXButton * myColorEditor
Button for open color editor.
Definition: GNEFrame.h:171
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:1720
GNEFrame * myFrameParent
Frame Parent.
Definition: GNEFrame.h:291
GNEAttributeCarrier::TagProperties myInvalidTagProperty
dummy tag properties used if user select an invalid tag
Definition: GNEFrame.h:90
std::set< FXTreeItem * > myTreeItemsConnections
set used to save tree items without AC assigned, the Incoming/Outcoming connections ...
Definition: GNEFrame.h:303
GNEViewNet * myViewNet
View Net for changes.
Definition: GNEFrame.h:612
std::vector< GNEAttributeCarrier * > myACs
list of edited ACs
Definition: GNEFrame.h:360
FXButton * myAbortDrawingButton
button for abort drawing
Definition: GNEFrame.h:453
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
Definition: GNEFrame.cpp:149
GNEAttributeCarrier::AttributeProperties myAttrProperties
attribute properties
Definition: GNEFrame.h:150
FXCheckButton * myCloseShapeCheckButton
checkbox to enable/disable closing polygon
Definition: GNEFrame.h:539
FXCheckButton * myBlockShapeCheckButton
checkBox for block shape
Definition: GNEFrame.h:533
GNEAttributeCarrier * myAC
edited Attribute Carrier
Definition: GNEFrame.h:357
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:615
SumoXMLAttr myXMLAttr
current XML attribute
Definition: GNEFrame.h:153
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
FXComboBox * myReferencePointMatchBox
match box with the list of reference points
Definition: GNEFrame.h:515
std::vector< SumoXMLTag > myListOfTags
list of tags that will be shown in Match Box
Definition: GNEFrame.h:87
FXLabel * myFrameHeaderLabel
the label for the frame&#39;s header
Definition: GNEFrame.h:634
std::vector< std::pair< std::string, std::string > > * myGenericParameters
pointer to current vector of generic parameters
Definition: GNEFrame.h:363
bool myCurrentLengthValid
Flag to check if current length is valid.
Definition: GNEFrame.h:545
FXButton * myStopDrawingButton
button for stop drawing
Definition: GNEFrame.h:450
void setFrameWidth(int newWidth)
set width of GNEFrame
Definition: GNEFrame.cpp:1713
FXLabel * myBlockMovementLabel
Label for block movement.
Definition: GNEFrame.h:524
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:1689
GNEAttributeCarrier * myAC
Attribute carrier.
Definition: GNEFrame.h:294
ACHierarchy()
FOX needs this.
Definition: GNEFrame.h:275
RGBColor myEdgeCandidateColor
edge candidate color (used by some modulds to mark edges)
Definition: GNEFrame.h:637
~GNEFrame()
destructor
Definition: GNEFrame.cpp:1683
DrawingShape()
FOX needs this.
Definition: GNEFrame.h:434
GenericParametersEditor()
FOX needs this.
Definition: GNEFrame.h:350
GNEFrame * myFrameParent
pointer to frame parent
Definition: GNEFrame.h:438
FXButton * helpReferencePoint
Button for help about the reference point.
Definition: GNEFrame.h:542
~ItemSelector()
destructor
Definition: GNEFrame.cpp:145
virtual void show()
show Frame
Definition: GNEFrame.cpp:1695
FXTextField * myTextFieldStrings
textField to modify the default value of string parameters
Definition: GNEFrame.h:165
GNEFrame * myFrameParent
pointer to Polygon Frame Parent
Definition: GNEFrame.h:221
struct with the attribute Properties
GNEFrame * myFrameParent
pointer to frame parent
Definition: GNEFrame.h:512
FXLabel * myClosePolygonLabel
Label for open/close polygon.
Definition: GNEFrame.h:536
ACAttributeRow()
FOX needs this.
Definition: GNEFrame.h:143
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:1704
long onCmdSelectItem(FXObject *, FXSelector, void *)
Definition: GNEFrame.cpp:183
FXTextField * myTextFieldGenericParameter
text field for write generic parameter
Definition: GNEFrame.h:366
FXLabel * myLengthLabel
Label for length.
Definition: GNEFrame.h:518
FXTextField * myTextFieldInt
textField to modify the default value of int/float/string parameters
Definition: GNEFrame.h:159
FXTreeList * myTreelist
tree list to show the childs of the element to erase
Definition: GNEFrame.h:297
virtual bool buildShape()
build a shaped element using the drawed shape (can be reimplemented in frame childs) return true if w...
Definition: GNEFrame.cpp:1738
void openHelpAttributesDialog(const GNEAttributeCarrier::TagProperties &tagProperties) const
Open help attributes dialog.
Definition: GNEFrame.cpp:1757
GNEAttributeCarrier::TagProperties myCurrentTagProperties
current tag properties
Definition: GNEFrame.h:84
virtual void disableModuls()
disable moduls if element selected in itemSelector isn&#39;t valid (can be reimplemented in frame childs)...
Definition: GNEFrame.cpp:1751
FXTextField * myTextFieldReal
textField to modify the default value of real/times parameters
Definition: GNEFrame.h:162
AdditionalReferencePoint
list of the reference points
Definition: GNEFrame.h:498
FXLabel * myInformationLabel
Label with information.
Definition: GNEFrame.h:456
void setCurrentTypeTag(SumoXMLTag typeTag)
set current type manually
Definition: GNEFrame.cpp:155
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
Definition: GNEFrame.h:621
NeteditAttributes()
FOX needs this.
Definition: GNEFrame.h:494
FXButton * myEditGenericParameterButton
button for add generic parameter
Definition: GNEFrame.h:369
std::string myInvalidValue
string which indicates the reason due current value is invalid
Definition: GNEFrame.h:174
AdditionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
Definition: GNEFrame.h:548
ACAttributes * myACAttributesParent
pointer to ACAttributes
Definition: GNEFrame.h:147
PositionVector myTemporalShapeShape
current drawed shape
Definition: GNEFrame.h:444