Eclipse SUMO - Simulation of Urban MObility
GNEFrameModuls.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
16 /****************************************************************************/
17 #ifndef GNEFrameModuls_h
18 #define GNEFrameModuls_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 TagSelector
43  // ===========================================================================
44 
45  class TagSelector : protected FXGroupBox {
48 
49  public:
51  TagSelector(GNEFrame* frameParent, GNEAttributeCarrier::TagType type, bool onlyDrawables = true);
52 
54  ~TagSelector();
55 
57  void showTagSelector();
58 
60  void hideTagSelector();
61 
64 
67 
69  void setCurrentTag(SumoXMLTag newTag);
70 
72  void refreshTagProperties();
73 
77  long onCmdSelectTagType(FXObject*, FXSelector, void*);
78 
80  long onCmdSelectTag(FXObject*, FXSelector, void*);
82 
83  protected:
86 
87  private:
90 
92  FXComboBox* myTagTypesMatchBox;
93 
95  FXComboBox* myTagsMatchBox;
96 
99 
101  std::vector<std::pair<std::string, GNEAttributeCarrier::TagType> > myListOfTagTypes;
102 
104  std::vector<SumoXMLTag> myListOfTags;
105 
108  };
109 
110  // ===========================================================================
111  // class DemandElementSelector
112  // ===========================================================================
113 
114  class DemandElementSelector : protected FXGroupBox {
117 
118  public:
120  DemandElementSelector(GNEFrame* frameParent, SumoXMLTag demandElementTag);
121 
123  DemandElementSelector(GNEFrame* frameParent, const std::vector<GNEAttributeCarrier::TagType>& tagTypes);
124 
127 
129  GNEDemandElement* getCurrentDemandElement() const;
130 
131  // @brief obtain allowed tags (derived from tagTypes)
132  const std::vector<SumoXMLTag>& getAllowedTags() const;
133 
135  void setDemandElement(GNEDemandElement* demandElement);
136 
138  void showDemandElementSelector();
139 
141  void hideDemandElementSelector();
142 
144  bool isDemandElementSelectorShown() const;
145 
147  void refreshDemandElementSelector();
148 
152  long onCmdSelectDemandElement(FXObject*, FXSelector, void*);
154 
155  protected:
158 
159  private:
162 
165 
168 
170  std::vector<SumoXMLTag> myDemandElementTags;
171  };
172 
173  // ===========================================================================
174  // class EdgePathCreator
175  // ===========================================================================
176 
177  class EdgePathCreator : protected FXGroupBox {
180 
181  public:
182 
185  GNE_EDGEPATHCREATOR_CONSECUTIVE = 1 << 0, // Path must be consecutive
186  GNE_EDGEPATHCREATOR_FROM_TO_VIA = 1 << 1, // Path requieres a from-via-to edges
187  GNE_EDGEPATHCREATOR_FROM_BUSSTOP = 1 << 2, // Path start in a BusStop
188  GNE_EDGEPATHCREATOR_TO_BUSSTOP = 1 << 3, // Path ends in a BusStop
189  };
190 
192  EdgePathCreator(GNEFrame* frameParent, int edgePathCreatorModes);
193 
195  ~EdgePathCreator();
196 
198  void edgePathCreatorName(const std::string& name);
199 
201  void showEdgePathCreator();
202 
204  void hideEdgePathCreator();
205 
207  void setVClass(SUMOVehicleClass vClass);
208 
210  void setEdgePathCreatorModes(int edgePathCreatorModes);
211 
213  std::vector<GNEEdge*> getClickedEdges() const;
214 
216  GNEAdditional* getClickedBusStop() const;
217 
219  bool addEdge(GNEEdge* edge);
220 
222  bool addBusStop(GNEAdditional* busStop);
223 
225  void clearEdges();
226 
228  void drawTemporalRoute() const;
229 
231  void abortEdgePathCreation();
232 
234  void finishEdgePathCreation();
235 
237  void removeLastInsertedElement();
238 
242  long onCmdAbortRouteCreation(FXObject*, FXSelector, void*);
243 
245  long onCmdFinishRouteCreation(FXObject*, FXSelector, void*);
246 
248  long onCmdRemoveLastInsertedElement(FXObject*, FXSelector, void*);
250 
251  protected:
254 
255  private:
258 
261 
264 
267 
270 
272  std::vector<GNEEdge*> myClickedEdges;
273 
276 
278  std::vector<GNEEdge*> myTemporalRoute;
279 
282 
284  void restoreEdgeColor(const GNEEdge* edge);
285  };
286 
287  // ===========================================================================
288  // class AttributeCarrierHierarchy
289  // ===========================================================================
290 
291  class AttributeCarrierHierarchy : private FXGroupBox {
294 
295  public:
297  AttributeCarrierHierarchy(GNEFrame* frameParent);
298 
301 
303  void showAttributeCarrierHierarchy(GNEAttributeCarrier* AC);
304 
306  void hideAttributeCarrierHierarchy();
307 
309  void refreshAttributeCarrierHierarchy();
310 
314  long onCmdShowChildMenu(FXObject*, FXSelector, void* data);
315 
317  long onCmdCenterItem(FXObject*, FXSelector, void*);
318 
320  long onCmdInspectItem(FXObject*, FXSelector, void*);
321 
323  long onCmdDeleteItem(FXObject*, FXSelector, void*);
324 
326  long onCmdMoveItemUp(FXObject*, FXSelector, void*);
327 
329  long onCmdMoveItemDown(FXObject*, FXSelector, void*);
331 
332  protected:
335 
336  // @brief create pop-up menu in the positions X-Y for the clicked attribute carrier
337  void createPopUpMenu(int X, int Y, GNEAttributeCarrier* clickedAC);
338 
340  FXTreeItem* showAttributeCarrierParents();
341 
343  void showAttributeCarrierChildren(GNEAttributeCarrier* AC, FXTreeItem* itemParent);
344 
346  FXTreeItem* addListItem(GNEAttributeCarrier* AC, FXTreeItem* itemParent = nullptr, std::string prefix = "", std::string sufix = "");
347 
349  FXTreeItem* addListItem(FXTreeItem* itemParent, const std::string& text, FXIcon* icon, bool expanded);
350  private:
353 
356 
359 
362 
365 
368 
371 
374 
377 
380 
383 
385  FXTreeList* myTreelist;
386 
388  std::map<FXTreeItem*, GNEAttributeCarrier*> myTreeItemToACMap;
389 
391  std::set<FXTreeItem*> myTreeItemsConnections;
392  };
393 
394  // ===========================================================================
395  // class DrawingShape
396  // ===========================================================================
397 
398  class DrawingShape : private FXGroupBox {
401 
402  public:
404  DrawingShape(GNEFrame* frameParent);
405 
407  ~DrawingShape();
408 
410  void showDrawingShape();
411 
413  void hideDrawingShape();
414 
416  void startDrawing();
417 
419  void stopDrawing();
420 
422  void abortDrawing();
423 
425  void addNewPoint(const Position& P);
426 
428  void removeLastPoint();
429 
431  const PositionVector& getTemporalShape() const;
432 
434  bool isDrawing() const;
435 
437  void setDeleteLastCreatedPoint(bool value);
438 
440  bool getDeleteLastCreatedPoint();
441 
445  long onCmdStartDrawing(FXObject*, FXSelector, void*);
446 
448  long onCmdStopDrawing(FXObject*, FXSelector, void*);
449 
451  long onCmdAbortDrawing(FXObject*, FXSelector, void*);
453 
454  protected:
457 
458  private:
461 
464 
467 
470 
473 
476 
479  };
480 
481  // ===========================================================================
482  // class SelectorParent
483  // ===========================================================================
484 
485  class SelectorParent : protected FXGroupBox {
486  public:
488  SelectorParent(GNEFrame* frameParent);
489 
491  ~SelectorParent();
492 
494  std::string getIdSelected() const;
495 
497  void setIDSelected(const std::string& id);
498 
500  bool showSelectorParentModul(SumoXMLTag additionalTypeParent);
501 
503  void hideSelectorParentModul();
504 
506  void refreshSelectorParentModul();
507 
508  private:
511 
514 
516  FXLabel* myParentsLabel;
517 
519  FXList* myParentsList;
520  };
521 };
522 
523 
524 #endif
525 
526 /****************************************************************************/
int myEdgePathCreatorModes
current edge path creator modes
FXButton * myStopDrawingButton
button for stop drawing
SumoXMLTag
Numbers representing SUMO-XML - element names.
GNEFrame * myFrameParent
pointer to frame Parent
FXComboBox * myDemandElementsMatchBox
comboBox with the list of elements type
FXLabel * myInformationLabel
Label with information.
void showTagSelector()
show item selector
GNEAttributeCarrier * myClickedAC
pointer to current clicked Attribute Carrier
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
struct with the attribute Properties
GNEDemandElement * myClickedDemandElement
demand element (casted from myClickedAC)
std::vector< GNEEdge * > myClickedEdges
current clicked edges
GNELane * myClickedLane
lane (casted from myClickedAC)
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the Tree items with their AC
FXButton * myStartDrawingButton
button for start drawing
bool myDeleteLastCreatedPoint
flag to enable/disable delete point mode
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEFrame * myFrameParent
pointer to Frame Parent
PositionVector myTemporalShapeShape
current drawed shape
std::vector< std::pair< std::string, GNEAttributeCarrier::TagType > > myListOfTagTypes
list of tags types that will be shown in Match Box
GNEShape * myClickedShape
shape (casted from myClickedAC)
SumoXMLTag myParentTag
current additional parent tag
EdgePathCreatorModes
FOX-declaration.
std::set< FXTreeItem * > myTreeItemsConnections
set used to save tree items without AC assigned, the Incoming/Outcoming connections ...
TagSelector()
FOX needs this.
void hideTagSelector()
hide item selector
FXTreeList * myTreelist
tree list to show the children of the element to erase
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:45
void setCurrentTagType(GNEAttributeCarrier::TagType tagType)
set current type manually
long onCmdSelectTag(FXObject *, FXSelector, void *)
Called when the user select an elementin ComboBox.
GNEFrame * myFrameParent
pointer to frame parent
GNEConnection * myClickedConnection
junction (casted from myClickedAC)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
GNEJunction * myClickedJunction
junction (casted from myClickedAC)
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show ...
GNEDemandElement * myCurrentDemandElement
current demand element
GNEFrame * myFrameParent
pointer to GNEFrame Parent
FXLabel * myParentsLabel
Label with parent name.
FXComboBox * myTagTypesMatchBox
comboBox with tag type
std::vector< SumoXMLTag > myListOfTags
list of tags that will be shown in Match Box
SUMOVehicleClass myVClass
VClass used for this trip.
FXComboBox * myTagsMatchBox
comboBox with the list of tags
DrawingShape()
FOX needs this.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
FXButton * myRemoveLastInsertedEdge
button for removing last inserted edge
GNEAttributeCarrier::TagProperties myInvalidTagProperty
dummy tag properties used if user select an invalid tag
GNEAdditional * mySelectedBusStop
pointer to selected busStop
GNEFrame * myFrameParent
pointer to Frame Parent
std::vector< GNEEdge * > myTemporalRoute
vector with temporal route edges
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
GNEEdge * myClickedEdge
edge (casted from myClickedAC)
FXButton * myAbortDrawingButton
button for abort drawing
GNECrossing * myClickedCrossing
crossing (casted from myClickedAC)
std::vector< SumoXMLTag > myDemandElementTags
demand element tags
void setCurrentTag(SumoXMLTag newTag)
set current type manually
GNEAdditional * myClickedAdditional
additional (casted from myClickedAC)
FXButton * myAbortCreationButton
button for abort route creation
GNEAttributeCarrier::TagProperties myCurrentTagProperties
current tag properties
long onCmdSelectTagType(FXObject *, FXSelector, void *)
FXButton * myFinishCreationButton
button for finish route creation
FXList * myParentsList
List of parents.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
GNEAttributeCarrier * myAC
Attribute carrier.