Eclipse SUMO - Simulation of Urban MObility
GNEFrameAttributesModuls.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-2019 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 // Auxiliar class for GNEFrame Moduls (only for attributes edition)
16 /****************************************************************************/
17 #ifndef GNEFrameAttributesModuls_h
18 #define GNEFrameAttributesModuls_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
27 
28 // ===========================================================================
29 // class declaration
30 // ===========================================================================
31 
32 class GNEFrame;
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
37 
39 
40 public:
41  // ===========================================================================
42  // class declaration
43  // ===========================================================================
44 
45  class AttributesCreator;
46  class AttributesEditor;
47 
48  // ===========================================================================
49  // class AttributesCreatorRow
50  // ===========================================================================
51 
52  class AttributesCreatorRow : public FXHorizontalFrame {
55 
56  public:
58  AttributesCreatorRow(AttributesCreator* AttributesCreatorParent, const GNEAttributeCarrier::AttributeProperties& attrProperties);
59 
61  void destroy();
62 
65 
67  std::string getValue() const;
68 
70  bool getAttributeRadioButtonCheck() const;
71 
73  void setAttributeRadioButtonCheck(bool value);
74 
76  bool getAttributeCheckButtonCheck() const;
77 
79  void setAttributeCheckButtonCheck(bool value);
80 
83 
86 
88  bool isAttributesCreatorRowEnabled() const;
89 
91  const std::string& isAttributeValid() const;
92 
95 
99  long onCmdSetAttribute(FXObject*, FXSelector, void*);
100 
102  long onCmdSelectCheckButton(FXObject*, FXSelector, void*);
103 
105  long onCmdSelectColorButton(FXObject*, FXSelector, void*);
106 
108  long onCmdSelectRadioButton(FXObject*, FXSelector, void*);
110 
111  protected:
114 
116  std::string checkComplexAttribute(const std::string& value);
117 
118  private:
121 
124 
126  std::string myInvalidValue;
127 
130 
132  FXRadioButton* myAttributeRadioButton;
133 
135  FXCheckButton* myAttributeCheckButton;
136 
139 
141  FXTextField* myValueTextFieldInt;
142 
144  FXTextField* myValueTextFieldReal;
145 
148 
150  FXCheckButton* myValueCheckButton;
151  };
152 
153  // ===========================================================================
154  // class AttributesCreator
155  // ===========================================================================
156 
157  class AttributesCreator : public FXGroupBox {
160 
161  // declare friend class
162  friend class Row;
163 
164  public:
166  AttributesCreator(GNEFrame* frameParent);
167 
170 
172  void showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties& myTagProperties);
173 
175  void hideAttributesCreatorModul();
176 
178  std::map<SumoXMLAttr, std::string> getAttributesAndValues(bool includeAll) const;
179 
181  GNEAttributeCarrier::TagProperties getCurrentTagProperties() const;
182 
184  bool areValuesValid() const;
185 
187  void showWarningMessage(std::string extra = "") const;
188 
192  long onCmdHelp(FXObject*, FXSelector, void*);
194 
196  void updateDisjointAttributes(AttributesCreatorRow* row);
197 
198  protected:
201 
202  private:
205 
208 
210  std::vector<AttributesCreatorRow*> myAttributesCreatorRows;
211 
213  FXButton* myHelpButton;
214  };
215 
216  // ===========================================================================
217  // class AttributesEditorRow
218  // ===========================================================================
219 
220  class AttributesEditorRow : protected FXHorizontalFrame {
223 
224  public:
226  AttributesEditorRow(AttributesEditor* attributeEditorParent, const GNEAttributeCarrier::AttributeProperties& ACAttr, const std::string& value, bool attributeEnabled);
227 
229  void destroy();
230 
232  void refreshAttributesEditorRow(const std::string& value, bool forceRefresh, bool disjointAttributeEnabled);
233 
235  bool isAttributesEditorRowValid() const;
236 
239 
241  long onCmdSetAttribute(FXObject*, FXSelector, void*);
242 
244  long onCmdSelectCheckButton(FXObject*, FXSelector, void*);
245 
247  long onCmdSelectRadioButton(FXObject*, FXSelector, void*);
248 
250  long onCmdOpenAttributeDialog(FXObject*, FXSelector, void*);
252 
253  protected:
256 
258  std::string stripWhitespaceAfterComma(const std::string& stringValue);
259 
260  private:
263 
266 
268  const bool myMultiple;
269 
272 
274  FXRadioButton* myAttributeRadioButton;
275 
277  FXCheckButton* myAttributeCheckButton;
278 
281 
284 
286  FXTextField* myValueTextFieldInt;
287 
289  FXTextField* myValueTextFieldReal;
290 
293 
296 
298  FXCheckButton* myValueCheckButton;
299  };
300 
301  // ===========================================================================
302  // class AttributesEditor
303  // ===========================================================================
304 
305  class AttributesEditor : public FXGroupBox {
308 
309  public:
311  AttributesEditor(GNEFrame* inspectorFrameParent);
312 
314  void showAttributeEditorModul(const std::vector<GNEAttributeCarrier*>& ACs, bool includeExtended);
315 
317  void hideAttributesEditorModul();
318 
320  void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition);
321 
323  GNEFrame* getFrameParent() const;
324 
326  const std::vector<GNEAttributeCarrier*>& getEditedACs() const;
327 
329  void removeEditedAC(GNEAttributeCarrier* AC);
330 
334  long onCmdAttributesEditorHelp(FXObject*, FXSelector, void*);
336 
337  protected:
340 
341  private:
344 
346  std::vector<AttributesEditorRow*> myAttributesEditorRows;
347 
349  FXButton* myHelpButton;
350 
352  std::vector<GNEAttributeCarrier*> myEditedACs;
353 
356  };
357 
358  // ===========================================================================
359  // class AttributesEditorExtended
360  // ===========================================================================
361 
362  class AttributesEditorExtended : protected FXGroupBox {
365 
366  public:
368  AttributesEditorExtended(GNEFrame* frameParent);
369 
372 
374  void showAttributesEditorExtendedModul();
375 
377  void hideAttributesEditorExtendedModul();
378 
382  long onCmdOpenDialog(FXObject*, FXSelector, void*);
384 
385  protected:
388 
389  private:
392  };
393 
394  // ===========================================================================
395  // class GenericParametersEditor
396  // ===========================================================================
397 
398  class GenericParametersEditor : private FXGroupBox {
401 
402  public:
404  GenericParametersEditor(GNEFrame* frameParent);
405 
408 
410  void showGenericParametersEditor(GNEAttributeCarrier* AC);
411 
413  void showGenericParametersEditor(std::vector<GNEAttributeCarrier*> ACs);
414 
416  void hideGenericParametersEditor();
417 
419  void refreshGenericParametersEditor();
420 
422  std::string getGenericParametersStr() const;
423 
427  long onCmdEditGenericParameter(FXObject*, FXSelector, void*);
428 
430  long onCmdSetGenericParameter(FXObject*, FXSelector, void*);
432 
433  protected:
436 
437  private:
440 
443 
445  std::vector<GNEAttributeCarrier*> myACs;
446 
448  std::vector<std::pair<std::string, std::string> >* myGenericParameters;
449 
452 
455  };
456 
457  // ===========================================================================
458  // class DrawingShape
459  // ===========================================================================
460 
461  class DrawingShape : private FXGroupBox {
464 
465  public:
467  DrawingShape(GNEFrame* frameParent);
468 
470  ~DrawingShape();
471 
473  void showDrawingShape();
474 
476  void hideDrawingShape();
477 
479  void startDrawing();
480 
482  void stopDrawing();
483 
485  void abortDrawing();
486 
488  void addNewPoint(const Position& P);
489 
491  void removeLastPoint();
492 
494  const PositionVector& getTemporalShape() const;
495 
497  bool isDrawing() const;
498 
500  void setDeleteLastCreatedPoint(bool value);
501 
503  bool getDeleteLastCreatedPoint();
504 
508  long onCmdStartDrawing(FXObject*, FXSelector, void*);
509 
511  long onCmdStopDrawing(FXObject*, FXSelector, void*);
512 
514  long onCmdAbortDrawing(FXObject*, FXSelector, void*);
516 
517  protected:
520 
521  private:
524 
527 
530 
533 
536 
539 
542  };
543 
544  // ===========================================================================
545  // class NeteditAttributes
546  // ===========================================================================
547 
548  class NeteditAttributes : protected FXGroupBox {
551 
552  public:
554  NeteditAttributes(GNEFrame* frameParent);
555 
558 
560  void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties& tagValue);
561 
563  void hideNeteditAttributesModul();
564 
566  bool getNeteditAttributesAndValues(std::map<SumoXMLAttr, std::string>& valuesMap, const GNELane* lane) const;
567 
571  long onCmdSetNeteditAttribute(FXObject*, FXSelector, void*);
572 
574  long onCmdHelp(FXObject*, FXSelector, void*);
576 
577  protected:
580 
581  private:
587  GNE_ADDITIONALREFERENCEPOINT_INVALID
588  };
589 
591  double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional) const;
592 
594  double setEndPosition(double positionOfTheMouseOverLane, double lengthOfAdditional) const;
595 
598 
601 
603  FXLabel* myLengthLabel;
604 
606  FXTextField* myLengthTextField;
607 
610 
613 
616 
618  FXCheckButton* myBlockShapeCheckButton;
619 
622 
624  FXCheckButton* myCloseShapeCheckButton;
625 
628 
631 
634  };
635 };
636 
637 
638 #endif
639 
640 /****************************************************************************/
void destroy()
destroy AttributesCreatorRow (but don&#39;t delete)
const bool myMultiple
flag to check if input element contains multiple values
FXRadioButton * myAttributeRadioButton
Radio button for disjoint attributes.
FXCheckButton * myBlockShapeCheckButton
checkBox for block shape
long onCmdSelectCheckButton(FXObject *, FXSelector, void *)
called when user press a check button
AttributesCreator * myAttributesCreatorParent
pointer to AttributesCreator
PositionVector myTemporalShapeShape
current drawed shape
const GNEAttributeCarrier::AttributeProperties myACAttr
current AC Attribute
FXCheckButton * myValueCheckButton
pointer to menu check
long onCmdSelectRadioButton(FXObject *, FXSelector, void *)
called when user press a radio button
FXLabel * myBlockShapeLabel
Label for block shape.
std::string checkComplexAttribute(const std::string &value)
check if given complex attribute is valid
void setAttributeRadioButtonCheck(bool value)
enable or disable radio button for disjoint attributes
struct with the attribute Properties
std::vector< AttributesCreatorRow * > myAttributesCreatorRows
vector with the AttributesCreatorRow
FXTextField * myValueTextFieldStrings
textField to modify the default value of string parameters
GNEFrame * myFrameParent
pointer to frame parent
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
AttributesEditor * myAttributesEditorParent
pointer to AttributesEditor parent
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
FXCheckButton * myBlockMovementCheckButton
checkBox for block movement
FXButton * myEditGenericParameterButton
button for add generic parameter
long onCmdSelectColorButton(FXObject *, FXSelector, void *)
called when user press the "Color" button
AdditionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
FXButton * myAbortDrawingButton
button for abort drawing
FXButton * myStartDrawingButton
button for start drawing
FXButton * helpReferencePoint
Button for help about the reference point.
FXLabel * myClosePolygonLabel
Label for open/close polygon.
GNEFrame * myFrameParent
pointer to Frame Parent
FXButton * myAttributeColorButton
Button for open color editor.
FXTextField * myValueTextFieldReal
textField to modify the value of real/Time attributes
const GNEAttributeCarrier::AttributeProperties myAttrProperties
attribute properties
GNEFrame * myFrameParent
pointer to GNEFrame parent
std::vector< std::pair< std::string, std::string > > * myGenericParameters
pointer to current vector of generic parameters
FXTextField * myValueTextFieldStrings
textField to modify the value of string attributes
GNEAttributeCarrier * myAC
edited Attribute Carrier
long onCmdSetAttribute(FXObject *, FXSelector, void *)
FXTextField * myValueTextFieldInt
textField to modify the default value of int/float/string parameters
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
FXCheckButton * myCloseShapeCheckButton
checkbox to enable/disable closing polygon
A list of positions.
std::vector< GNEAttributeCarrier * > myEditedACs
the multi-selection currently being inspected
bool myCurrentLengthValid
Flag to check if current length is valid.
bool myIncludeExtended
flag used to mark if current edited ACs are bein edited including extended attribute ...
FXCheckButton * myAttributeCheckButton
check button to enable/disable Label attribute
GNEAttributeCarrier::TagProperties myTagProperties
current edited Tag Properties
AttributesCreator * getAttributesCreatorParent() const
get AttributesCreator parent
FXButton * myAttributeButtonCombinableChoices
pointer to buttonCombinableChoices
FXLabel * myInformationLabel
Label with information.
FXRadioButton * myAttributeRadioButton
Radio button for disjoint attributes.
FXLabel * myAttributeLabel
pointer to attribute label
const std::string & isAttributeValid() const
returns a empty string if current value is valid, a string with information about invalid value in ot...
FXCheckButton * myAttributeCheckButton
pointer to attribute menu check
FXTextField * myTextFieldGenericParameter
text field for write generic parameter
FXCheckButton * myValueCheckButton
check button to enable/disable the value of boolean parameters
FXTextField * myLengthTextField
textField for length
std::vector< GNEAttributeCarrier * > myACs
list of edited ACs
struct with the attribute Properties
GNEFrame * myFrameParent
pointer to frame parent
FXTextField * myValueTextFieldReal
textField to modify the default value of real/times parameters
bool isAttributesCreatorRowEnabled() const
check if row is enabled
FXLabel * myBlockMovementLabel
Label for block movement.
FXComboBox * myValueComboBoxChoices
pointer to combo box choices
const GNEAttributeCarrier::AttributeProperties & getAttrProperties() const
return Attr
FXButton * myStopDrawingButton
button for stop drawing
FXComboBox * myReferencePointMatchBox
match box with the list of reference points
bool getAttributeRadioButtonCheck() const
return status of radio button
FXLabel * myAttributeLabel
Label with the name of the attribute.
bool myDeleteLastCreatedPoint
flag to enable/disable delete point mode
void setAttributeCheckButtonCheck(bool value)
enable or disable label checkbox button for optional attributes
bool getAttributeCheckButtonCheck() const
return status of label checkbox button
std::vector< AttributesEditorRow * > myAttributesEditorRows
list of Attribute editor rows
FXTextField * myValueTextFieldInt
textField to modify the value of int attributes
GNEFrame * myFrameParent
pointer to inspector frame parent
FXButton * myAttributeColorButton
Button for open color editor.
std::string myInvalidValue
string which indicates the reason due current value is invalid