41FXIMPLEMENT(
GNEFixNetworkElements, FXDialogBox, GNEFixNetworkElementsMap, ARRAYNUMBER(GNEFixNetworkElementsMap))
69 std::vector<GNENetworkElement*> invalidEdges, invalidCrossings;
71 for (
const auto& invalidNetworkElement : invalidNetworkElements) {
72 if (invalidNetworkElement->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
73 invalidEdges.push_back(invalidNetworkElement);
74 }
else if (invalidNetworkElement->getTagProperty().getTag() ==
SUMO_TAG_CROSSING) {
75 invalidCrossings.push_back(invalidNetworkElement);
79 myFixEdgeOptions->setInvalidElements(invalidEdges);
80 myFixCrossingOptions->setInvalidElements(invalidCrossings);
99 bool abortSaving =
false;
106 getApp()->stopModal(
this, FALSE);
109 getApp()->stopModal(
this, TRUE);
118 getApp()->stopModal(
this, FALSE);
143 myInvalidElements = invalidElements;
145 myTable->setTableSize((
int)(myInvalidElements.size()), 3);
146 myTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
147 myTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
148 myTable->setEditable(
false);
150 myTable->setVisibleColumns(4);
152 myTable->setColumnWidth(1, 150);
153 myTable->setColumnWidth(2, 390);
154 myTable->setColumnText(0,
"");
156 myTable->setColumnText(2,
TL(
"Conflict"));
157 myTable->getRowHeader()->setWidth(0);
159 FXTableItem* item =
nullptr;
161 for (
int i = 0; i < (int)myInvalidElements.size(); i++) {
163 item =
new FXTableItem(
"", myInvalidElements.at(i)->getACIcon());
164 item->setIconPosition(FXTableItem::CENTER_X);
165 myTable->setItem(i, 0, item);
167 item =
new FXTableItem(myInvalidElements.at(i)->getID().c_str());
168 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
169 myTable->setItem(i, 1, item);
171 item =
new FXTableItem(myInvalidElements.at(i)->getNetworkElementProblem().c_str());
172 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
173 myTable->setItem(i, 2, item);
176 if (invalidElements.size() > 0) {
178 toggleSaveButton(
true);
181 toggleSaveButton(
false);
189 TL(
"Save list of conflicted items"),
".txt",
198 for (
const auto& invalidElement : myInvalidElements) {
199 dev << invalidElement->getID() <<
":" << invalidElement->getNetworkElementProblem() <<
"\n";
204 WRITE_DEBUG(
"Opening FXMessageBox 'Saving list of conflicted items successfully'");
206 FXMessageBox::information(myTable, MBOX_OK,
TL(
"Saving successfully"),
"%s",
"List of conflicted items was successfully saved");
208 WRITE_DEBUG(
"Closed FXMessageBox 'Saving list of conflicted items successfully' with 'OK'");
211 WRITE_DEBUG(
"Opening FXMessageBox 'error saving list of conflicted items'");
213 FXMessageBox::error(myTable, MBOX_OK,
TL(
"Saving list of conflicted items failed"),
"%s", e.what());
215 WRITE_DEBUG(
"Closed FXMessageBox 'error saving list of conflicted items' with 'OK'");
242 if (option == removeInvalidEdges) {
243 removeInvalidEdges->setCheck(
true);
244 saveInvalidEdges->setCheck(
false);
245 selectInvalidEdgesAndCancel->setCheck(
false);
246 }
else if (option == saveInvalidEdges) {
247 removeInvalidEdges->setCheck(
false);
248 saveInvalidEdges->setCheck(
true);
249 selectInvalidEdgesAndCancel->setCheck(
false);
250 }
else if (option == selectInvalidEdgesAndCancel) {
251 removeInvalidEdges->setCheck(
false);
252 saveInvalidEdges->setCheck(
false);
253 selectInvalidEdgesAndCancel->setCheck(
true);
260 if (myInvalidElements.size() > 0) {
261 if (removeInvalidEdges->getCheck() == TRUE) {
265 for (
const auto& invalidEdge : myInvalidElements) {
270 }
else if (selectInvalidEdgesAndCancel->getCheck() == TRUE) {
274 for (
const auto& invalidEdge : myInvalidElements) {
288 removeInvalidEdges->enable();
289 saveInvalidEdges->enable();
290 selectInvalidEdgesAndCancel->enable();
296 removeInvalidEdges->disable();
297 saveInvalidEdges->disable();
298 selectInvalidEdgesAndCancel->disable();
323 if (option == removeInvalidCrossings) {
324 removeInvalidCrossings->setCheck(
true);
325 saveInvalidCrossings->setCheck(
false);
326 selectInvalidCrossingsAndCancel->setCheck(
false);
327 }
else if (option == saveInvalidCrossings) {
328 removeInvalidCrossings->setCheck(
false);
329 saveInvalidCrossings->setCheck(
true);
330 selectInvalidCrossingsAndCancel->setCheck(
false);
331 }
else if (option == selectInvalidCrossingsAndCancel) {
332 removeInvalidCrossings->setCheck(
false);
333 saveInvalidCrossings->setCheck(
false);
334 selectInvalidCrossingsAndCancel->setCheck(
true);
341 if (myInvalidElements.size() > 0) {
342 if (removeInvalidCrossings->getCheck() == TRUE) {
346 for (
const auto& invalidCrossing : myInvalidElements) {
351 }
else if (selectInvalidCrossingsAndCancel->getCheck() == TRUE) {
355 for (
const auto& invalidCrossing : myInvalidElements) {
369 removeInvalidCrossings->enable();
370 saveInvalidCrossings->enable();
371 selectInvalidCrossingsAndCancel->enable();
377 removeInvalidCrossings->disable();
378 saveInvalidCrossings->disable();
379 selectInvalidCrossingsAndCancel->disable();
FXDEFMAP(GNEFixNetworkElements) GNEFixNetworkElementsMap[]
@ MID_GNE_BUTTON_CANCEL
cancel button
@ MID_CHOOSEN_OPERATION
set type of selection
@ MID_GNE_BUTTON_ACCEPT
accept button
#define GUIDesignRadioButtonFix
design for radio button with fixed height (used in fix elements dialogs)
#define GUIDesignButtonAccept
Accept Button.
#define GUIDesignButtonCancel
Cancel Button.
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignTableFixElements
design for tables used in GNEFixDemandElements dialogs
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
#define GUIDesignDialogBoxExplicitStretchable(width, height)
design for dialog box with specific width and height that can be stretched (But not shrunk)
FXString gCurrentFolder
The folder used as last.
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_SELECTED
element is selected
int GUIDesignHeight
the default size for GUI elements
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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 enableOptions()
enable crossing options
void disableOptions()
disable crossing options
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 disableOptions()
disable edge options
void fixElements(bool &abortSaving)
fix elements
FXRadioButton * saveInvalidEdges
Option "Save invalid edges".
FXRadioButton * removeInvalidEdges
Option "Remove invalid edges".
FixEdgeOptions(GNEFixNetworkElements *fixNetworkElementsParent, GNEViewNet *viewNet)
constructor
void enableOptions()
enable edge options
bool saveContents() const
save contents
FixOptions(FXVerticalFrame *frameParent, const std::string &title, GNEViewNet *viewNet)
constructor
FXTable * myTable
Table with the network elements.
FXVerticalFrame * myLeftFrame
vertical left frame
void setInvalidElements(const std::vector< GNENetworkElement * > &invalidElements)
set invalid network elements
FXVerticalFrame * myRightFrame
vertical right frame
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
GNEViewNet * myViewNet
view net
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
FXVerticalFrame * myLeftFrame
vertical left frame
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
~GNEFixNetworkElements()
destructor
GNECrossing * retrieveCrossing(const GUIGlObject *glObject, bool hardFail=true) const
get Crossing by AC
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
GNENet * getNet() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXGroupBoxModule (based on FXGroupBox)
Options
GroupBoxModule options.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
Static storage of an output device and its base (abstract) implementation.
void close()
Closes the device and removes it from the dictionary.
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.