Eclipse SUMO - Simulation of Urban MObility
GNEFixNetworkElements.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Dialog used to fix network elements during saving
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
24 
25 // ===========================================================================
26 // class declarations
27 // ===========================================================================
28 class GNENetworkElement;
29 class GNEViewNet;
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
34 
39 class GNEFixNetworkElements : public FXDialogBox {
41  FXDECLARE(GNEFixNetworkElements)
42 
43 public:
45  GNEFixNetworkElements(GNEViewNet* viewNet, const std::vector<GNENetworkElement*>& invalidNetworkElements);
46 
49 
53  long onCmdSelectOption(FXObject* obj, FXSelector, void*);
54 
56  long onCmdAccept(FXObject*, FXSelector, void*);
57 
59  long onCmdCancel(FXObject*, FXSelector, void*);
61 
62 protected:
64  FOX_CONSTRUCTOR(GNEFixNetworkElements)
65 
66 
68 
69  public:
71  FixOptions(FXVerticalFrame* frameParent, const std::string& title, GNEViewNet* viewNet);
72 
74  void setInvalidElements(const std::vector<GNENetworkElement*>& invalidElements);
75 
77  virtual void fixElements(bool& abortSaving) = 0;
78 
79  protected:
81  bool saveContents() const;
82 
84  FXVerticalFrame* myLeftFrame = nullptr;
85 
87  FXVerticalFrame* myRightFrame = nullptr;
88 
91 
93  std::vector<GNENetworkElement*> myInvalidElements;
94 
95  private:
97  virtual void enableOptions() = 0;
98 
100  virtual void disableOptions() = 0;
101 
103  FXTable* myTable = nullptr;
104  };
105 
107  class FixEdgeOptions : public FixOptions {
108 
109  public:
111  FixEdgeOptions(GNEFixNetworkElements* fixNetworkElementsParent, GNEViewNet* viewNet);
112 
114  void selectOption(FXObject* option);
115 
117  void fixElements(bool& abortSaving);
118 
120  FXRadioButton* removeInvalidEdges;
121 
123  FXRadioButton* saveInvalidEdges;
124 
127  private:
129  void enableOptions();
130 
132  void disableOptions();
133  };
134 
137 
138  public:
140  FixCrossingOptions(GNEFixNetworkElements* fixNetworkElementsParent, GNEViewNet* viewNet);
141 
143  void selectOption(FXObject* option);
144 
146  void fixElements(bool& abortSaving);
147 
149  FXRadioButton* removeInvalidCrossings;
150 
152  FXRadioButton* saveInvalidCrossings;
153 
156 
157  private:
159  void enableOptions();
160 
162  void disableOptions();
163  };
164 
166  class Buttons : public FXHorizontalFrame {
167 
168  public:
170  Buttons(GNEFixNetworkElements* fixNetworkElementsParent);
171 
172  private:
174  FXButton* myAcceptButton = nullptr;
175 
177  FXButton* myCancelButton = nullptr;
178  };
179 
181  GNEViewNet* myViewNet = nullptr;
182 
184  FXVerticalFrame* myMainFrame = nullptr;
185 
187  FXVerticalFrame* myLeftFrame = nullptr;
188 
190  FXVerticalFrame* myRightFrame = nullptr;
191 
194 
197 
199  Buttons* myButtons = nullptr;
200 
201 private:
204 
207 };
horizontal frame for buttons
FXButton * myCancelButton
cancel button
Buttons(GNEFixNetworkElements *fixNetworkElementsParent)
build Position Options
FXButton * myAcceptButton
accept button
groupbox for all radio buttons related with fix crossing options
FXRadioButton * saveInvalidCrossings
Option "save invalid crossings".
FixCrossingOptions(GNEFixNetworkElements *fixNetworkElementsParent, GNEViewNet *viewNet)
constructor
void fixElements(bool &abortSaving)
fix elements
FXRadioButton * removeInvalidCrossings
Option "remove invalid elements".
void selectOption(FXObject *option)
select option
FXRadioButton * selectInvalidCrossingsAndCancel
Option "Select invalid crossings and cancel".
groupbox for all radio buttons related with fix edges options
void selectOption(FXObject *option)
select option
FXRadioButton * selectInvalidEdgesAndCancel
Option "Select invalid edges and cancel".
void fixElements(bool &abortSaving)
fix elements
FXRadioButton * saveInvalidEdges
Option "Save invalid edges".
FXRadioButton * removeInvalidEdges
Option "Remove invalid edges".
FixEdgeOptions(GNEFixNetworkElements *fixNetworkElementsParent, GNEViewNet *viewNet)
constructor
virtual void disableOptions()=0
disable options
GNEViewNet * myViewNet
pointer to viewNet
virtual void fixElements(bool &abortSaving)=0
fix elements
std::vector< GNENetworkElement * > myInvalidElements
vector with the invalid network elements
virtual void enableOptions()=0
enable options
Dialog fix network elements.
FXVerticalFrame * myMainFrame
main frame
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
FixEdgeOptions * myFixEdgeOptions
fix edge options
FixCrossingOptions * myFixCrossingOptions
fix crossing options
FXVerticalFrame * myRightFrame
vertical right frame
GNEFixNetworkElements(const GNEFixNetworkElements &)=delete
Invalidated copy constructor.
GNEViewNet * myViewNet
view net
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
GNEFixNetworkElements(GNEViewNet *viewNet, const std::vector< GNENetworkElement * > &invalidNetworkElements)
FOX-declaration.
FXVerticalFrame * myLeftFrame
vertical left frame
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
GNEFixNetworkElements & operator=(const GNEFixNetworkElements &)=delete
Invalidated assignment operator.
MFXGroupBoxModule (based on FXGroupBox)
every row value