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 "GNEFrame.h"
25 
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNEAdditionalFrame : public GNEFrame {
35 
36 public:
37 
38  // ===========================================================================
39  // class SelectorLaneParents
40  // ===========================================================================
41 
42  class SelectorLaneParents : protected FXGroupBox {
45  public:
47  SelectorLaneParents(GNEAdditionalFrame* additionalFrameParent);
48 
51 
54 
57 
59  void startConsecutiveLaneSelector(GNELane *lane, const Position &clickedPosition);
60 
63 
66 
68  bool addSelectedLane(GNELane *lane, const Position &clickedPosition);
69 
72 
74  bool isSelectingLanes() const;
75 
77  bool isShown() const;
78 
80  const RGBColor &getSelectedLaneColor() const;
81 
83  const std::vector<std::pair<GNELane*, double> > &getSelectedLanes() const;
84 
88  long onCmdStopSelection(FXObject*, FXSelector, void*);
89 
91  long onCmdAbortSelection(FXObject*, FXSelector, void*);
93 
94  protected:
97 
98  private:
101 
104 
107 
109  std::vector<std::pair<GNELane*, double> > mySelectedLanes;
110 
112  std::vector<GNELane*> myCandidateLanes;
113 
116 
119 
121  bool isLaneSelected(GNELane *lane) const;
122  };
123 
124  // ===========================================================================
125  // class SelectorAdditionalParent
126  // ===========================================================================
127 
128  class SelectorAdditionalParent : protected FXGroupBox {
129  public:
131  SelectorAdditionalParent(GNEAdditionalFrame* additionalFrameParent);
132 
135 
137  std::string getIdSelected() const;
138 
140  void setIDSelected(const std::string& id);
141 
143  bool showSelectorAdditionalParentModul(SumoXMLTag additionalTypeParent);
144 
146  void hideSelectorAdditionalParentModul();
147 
149  void refreshSelectorAdditionalParentModul();
150 
151  private:
154 
157 
160 
163  };
164 
165  // ===========================================================================
166  // class SelectorEdgeChilds
167  // ===========================================================================
168 
169  class SelectorEdgeChilds : protected FXGroupBox {
172 
173  public:
175  SelectorEdgeChilds(GNEAdditionalFrame* additionalFrameParent);
176 
179 
181  std::string getEdgeIdsSelected() const;
182 
184  void showSelectorEdgeChildsModul(std::string search = "");
185 
187  void hideSelectorEdgeChildsModul();
188 
190  void updateUseSelectedEdges();
191 
195  long onCmdUseSelectedEdges(FXObject*, FXSelector, void*);
196 
198  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
199 
201  long onCmdSelectEdge(FXObject*, FXSelector, void*);
202 
204  long onCmdClearSelection(FXObject*, FXSelector, void*);
205 
207  long onCmdInvertSelection(FXObject*, FXSelector, void*);
209 
210  protected:
213 
214  private:
217 
220 
222  FXList* myList;
223 
225  FXTextField* myEdgesSearch;
226 
229 
232  };
233 
234  // ===========================================================================
235  // class SelectorLaneChilds
236  // ===========================================================================
237 
238  class SelectorLaneChilds : protected FXGroupBox {
241 
242  public:
244  SelectorLaneChilds(GNEAdditionalFrame* additionalFrameParent);
245 
248 
250  std::string getLaneIdsSelected() const;
251 
253  void showSelectorLaneChildsModul(std::string search = "");
254 
256  void hideSelectorLaneChildsModul();
257 
258  // @brief Update use selectedLanes
259  void updateUseSelectedLanes();
260 
264  long onCmdUseSelectedLanes(FXObject*, FXSelector, void*);
265 
267  long onCmdTypeInSearchBox(FXObject*, FXSelector, void*);
268 
270  long onCmdSelectLane(FXObject*, FXSelector, void*);
271 
273  long onCmdClearSelection(FXObject*, FXSelector, void*);
274 
276  long onCmdInvertSelection(FXObject*, FXSelector, void*);
278 
279  protected:
282 
283  private:
286 
289 
291  FXList* myList;
292 
294  FXTextField* myLanesSearch;
295 
298 
301  };
302 
307  GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
308 
311 
313  void show();
314 
319  bool addAdditional(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor);
320 
324  void removeAdditional(GNEAdditional* additional);
325 
328 
331 
332 protected:
334  void enableModuls(const GNEAttributeCarrier::TagProperties &tagProperties);
335 
337  void disableModuls();
338 
339 private:
341  std::string generateID(GNENetElement* netElement) const;
342 
344  bool buildAdditionalCommonAttributes(std::map<SumoXMLAttr, std::string> &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues);
345 
347  bool buildAdditionalWithParent(std::map<SumoXMLAttr, std::string> &valuesMap, GNEAdditional* parent, const GNEAttributeCarrier::TagProperties &tagValues);
348 
350  bool buildAdditionalOverEdge(std::map<SumoXMLAttr, std::string> &valuesMap, GNELane* lane, const GNEAttributeCarrier::TagProperties &tagValues);
351 
353  bool buildAdditionalOverLane(std::map<SumoXMLAttr, std::string> &valuesMap, GNELane* lane, const GNEAttributeCarrier::TagProperties &tagValues);
354 
356  bool buildAdditionalOverLanes(std::map<SumoXMLAttr, std::string> &valuesMap, GNELane* lane, const GNEAttributeCarrier::TagProperties &tagValues);
357 
359  bool buildAdditionalOverView(std::map<SumoXMLAttr, std::string> &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues);
360 
363 
365  ACAttributes* myAdditionalAttributes;
366 
369 
372 
375 
378 
381 };
382 
383 
384 #endif
385 
386 /****************************************************************************/
void enableModuls(const GNEAttributeCarrier::TagProperties &tagProperties)
enable moduls depending of item selected in ItemSelector
SumoXMLTag
Numbers representing SUMO-XML - element names.
const RGBColor & getSelectedLaneColor() const
get selected lane color
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additional frame parent
void showSelectorLaneParentsModul()
show SelectorLaneParents modul
FXButton * myInvertEdgesSelection
button for invert selection
FXTextField * myEdgesSearch
text field for search edge IDs
SumoXMLTag myAdditionalTypeParent
current additional type parent
bool buildAdditionalCommonAttributes(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build common additional attributes
FXLabel * myFirstAdditionalParentsLabel
Label with the name of additional.
struct with the attribute Properties
FXList * myList
List of SelectorLaneChilds.
bool isShown() const
return true if modul is shown
long onCmdAbortSelection(FXObject *, FXSelector, void *)
Called when the user press abort selection button.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
bool stopConsecutiveLaneSelector()
stop selection of consecutive lanes
long onCmdStopSelection(FXObject *, FXSelector, void *)
std::vector< GNELane * > myCandidateLanes
Vector with the colored lanes.
ACAttributes * myAdditionalAttributes
internal additional attributes
const std::vector< std::pair< GNELane *, double > > & getSelectedLanes() const
get current selected lanes
RGBColor myCandidateLaneColor
color for candidate lanes
FXList * myFirstAdditionalParentsList
List of additional sets.
bool buildAdditionalOverEdge(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over an edge (parent of lane)
GNEAdditionalFrame * myAdditionalFrameParent
pointer to Additional Frame Parent
FXButton * invertLanesSelection
button for invert selection
bool isLaneSelected(GNELane *lane) const
check if certain lane is selected
GNEAdditionalFrame::SelectorLaneParents * getConsecutiveLaneSelector() const
getConsecutive Lane Selector
bool addAdditional(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
add additional element
void removeLastSelectedLane()
remove last added point
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
SelectorLaneChilds * mySelectorLaneChilds
Modul for select lane childs.
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additionalFrameParent
FXButton * myStopSelectingButton
button for stop selecting
bool buildAdditionalOverLane(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over a single lane
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
~GNEAdditionalFrame()
Destructor.
void showSelectorLaneChildsModul()
show selector lane child and update use selected edges/lanes
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
FXList * myList
List of SelectorEdgeChilds.
FXButton * myAbortSelectingButton
button for abort selecting
std::vector< std::pair< GNELane *, double > > mySelectedLanes
Vector with the selected lanes and the clicked position.
FXTextField * myLanesSearch
text field for search lane IDs
FXButton * clearLanesSelection
button for clear selection
ItemSelector * myItemSelector
item selector
bool addSelectedLane(GNELane *lane, const Position &clickedPosition)
return true if lane can be selected as consecutive lane
void show()
show Frame
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
void disableModuls()
disable moduls if element selected in itemSelector isn&#39;t valid
NeteditAttributes * myNeteditAttributes
Netedit parameter.
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
SelectorLaneParents * mySelectorLaneParents
Modul for select lane parents (currently only consecutives)
RGBColor mySelectedLaneColor
color for selected lanes
bool buildAdditionalOverView(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over view
void hideSelectorLaneParentsModul()
hide SelectorLaneParents
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
bool buildAdditionalWithParent(std::map< SumoXMLAttr, std::string > &valuesMap, GNEAdditional *parent, const GNEAttributeCarrier::TagProperties &tagValues)
build additional with Parent
SelectorAdditionalParent * mySelectorAdditionalParent
Modul for select a single additional parent (Used only for first Additional parent) ...
bool isSelectingLanes() const
return true if modul is selecting lane
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additional frame parent
void startConsecutiveLaneSelector(GNELane *lane, const Position &clickedPosition)
start selection of consecutive lanes
bool buildAdditionalOverLanes(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over lanes
FXButton * myClearEdgesSelection
button for clear selection
SelectorEdgeChilds * mySelectorEdgeChilds
Modul for select edge childs.
GNEAdditionalFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
void abortConsecutiveLaneSelector()
abort selection of consecutive lanes