41FXIMPLEMENT(
GNEFixDemandElements, FXDialogBox, GNEFixDemandElementsMap, ARRAYNUMBER(GNEFixDemandElementsMap))
73 std::vector<GNEDemandElement*> invalidRoutes, invalidVehicles, invalidStops, invalidPlans;
75 for (
const auto& invalidDemandElement : invalidDemandElements) {
76 if (invalidDemandElement->getTagProperty().isRoute()) {
77 invalidRoutes.push_back(invalidDemandElement);
78 }
else if (invalidDemandElement->getTagProperty().isVehicle()) {
79 invalidVehicles.push_back(invalidDemandElement);
80 }
else if (invalidDemandElement->getTagProperty().isVehicleStop()) {
81 invalidStops.push_back(invalidDemandElement);
83 invalidPlans.push_back(invalidDemandElement);
87 myFixRouteOptions->setInvalidElements(invalidRoutes);
88 myFixVehicleOptions->setInvalidElements(invalidVehicles);
89 myFixStopPositionOptions->setInvalidElements(invalidStops);
90 myFixPersonPlanOptions->setInvalidElements(invalidPlans);
111 bool abortSaving =
false;
120 getApp()->stopModal(
this, FALSE);
123 getApp()->stopModal(
this, TRUE);
132 getApp()->stopModal(
this, FALSE);
157 myInvalidElements = invalidElements;
159 myTable->setTableSize((
int)(myInvalidElements.size()), 3);
160 myTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
161 myTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
162 myTable->setEditable(
false);
164 myTable->setVisibleColumns(4);
166 myTable->setColumnWidth(1, 150);
167 myTable->setColumnWidth(2, 200);
168 myTable->setColumnText(0,
"");
170 myTable->setColumnText(2,
"Conflict");
171 myTable->getRowHeader()->setWidth(0);
173 FXTableItem* item =
nullptr;
175 for (
int i = 0; i < (int)myInvalidElements.size(); i++) {
177 item =
new FXTableItem(
"", myInvalidElements.at(i)->getACIcon());
178 item->setIconPosition(FXTableItem::CENTER_X);
179 myTable->setItem(i, 0, item);
181 item =
new FXTableItem(myInvalidElements.at(i)->getID().c_str());
182 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
183 myTable->setItem(i, 1, item);
185 item =
new FXTableItem(myInvalidElements.at(i)->getDemandElementProblem().c_str());
186 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
187 myTable->setItem(i, 2, item);
190 if (invalidElements.size() > 0) {
192 toggleSaveButton(
true);
195 toggleSaveButton(
false);
202 TL(
"Save list of conflicted items"),
".txt",
211 for (
const auto& invalidElement : myInvalidElements) {
212 dev << invalidElement->getID() <<
":" << invalidElement->getDemandElementProblem() <<
"\n";
217 WRITE_DEBUG(
"Opening FXMessageBox 'Saving list of conflicted items successfully'");
219 FXMessageBox::information(myTable, MBOX_OK,
"Saving successfully",
"%s",
"List of conflicted items was successfully saved");
221 WRITE_DEBUG(
"Closed FXMessageBox 'Saving list of conflicted items successfully' with 'OK'");
224 WRITE_DEBUG(
"Opening FXMessageBox 'error saving list of conflicted items'");
226 FXMessageBox::error(myTable, MBOX_OK,
"Saving list of conflicted items failed",
"%s", e.what());
228 WRITE_DEBUG(
"Closed FXMessageBox 'error saving list of conflicted items' with 'OK'");
260 if (option == removeInvalidRoutes) {
261 removeInvalidRoutes->setCheck(
true);
262 saveInvalidRoutes->setCheck(
false);
263 selectInvalidRoutesAndCancel->setCheck(
false);
264 }
else if (option == saveInvalidRoutes) {
265 removeInvalidRoutes->setCheck(
false);
266 saveInvalidRoutes->setCheck(
true);
267 selectInvalidRoutesAndCancel->setCheck(
false);
268 }
else if (option == selectInvalidRoutesAndCancel) {
269 removeInvalidRoutes->setCheck(
false);
270 saveInvalidRoutes->setCheck(
false);
271 selectInvalidRoutesAndCancel->setCheck(
true);
278 if (myInvalidElements.size() > 0) {
279 if (removeInvalidRoutes->getCheck() == TRUE) {
283 for (
const auto& invalidRoute : myInvalidElements) {
293 }
else if (selectInvalidRoutesAndCancel->getCheck() == TRUE) {
297 for (
const auto& invalidRoute : myInvalidElements) {
306 if (removeStopsOutOfRoute->getCheck() == TRUE) {
308 std::vector<GNEDemandElement*> stopsToRemove;
309 for (
const auto& invalidRoute : myInvalidElements) {
310 const auto invaldstops = invalidRoute->getInvalidStops();
312 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
317 for (
const auto& stopToRemove : stopsToRemove) {
329 removeInvalidRoutes->enable();
330 saveInvalidRoutes->enable();
331 selectInvalidRoutesAndCancel->enable();
332 removeStopsOutOfRoute->enable();
338 removeInvalidRoutes->disable();
339 saveInvalidRoutes->disable();
340 selectInvalidRoutesAndCancel->disable();
341 removeStopsOutOfRoute->disable();
371 if (option == removeInvalidVehicles) {
372 removeInvalidVehicles->setCheck(
true);
373 saveInvalidVehicles->setCheck(
false);
374 selectInvalidVehiclesAndCancel->setCheck(
false);
375 }
else if (option == saveInvalidVehicles) {
376 removeInvalidVehicles->setCheck(
false);
377 saveInvalidVehicles->setCheck(
true);
378 selectInvalidVehiclesAndCancel->setCheck(
false);
379 }
else if (option == selectInvalidVehiclesAndCancel) {
380 removeInvalidVehicles->setCheck(
false);
381 saveInvalidVehicles->setCheck(
false);
382 selectInvalidVehiclesAndCancel->setCheck(
true);
389 if (myInvalidElements.size() > 0) {
390 if (removeInvalidVehicles->getCheck() == TRUE) {
394 for (
const auto& invalidVehicle : myInvalidElements) {
399 }
else if (selectInvalidVehiclesAndCancel->getCheck() == TRUE) {
403 for (
const auto& invalidVehicle : myInvalidElements) {
412 if (removeStopsOutOfVehicle->getCheck() == TRUE) {
414 std::vector<GNEDemandElement*> stopsToRemove;
415 for (
const auto& invalidVehicle : myInvalidElements) {
416 const auto invaldstops = invalidVehicle->getInvalidStops();
418 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
423 for (
const auto& stopToRemove : stopsToRemove) {
435 removeInvalidVehicles->enable();
436 saveInvalidVehicles->enable();
437 selectInvalidVehiclesAndCancel->enable();
438 removeStopsOutOfVehicle->enable();
444 removeInvalidVehicles->disable();
445 saveInvalidVehicles->disable();
446 selectInvalidVehiclesAndCancel->disable();
447 removeStopsOutOfVehicle->disable();
475 if (option == activateFriendlyPositionAndSave) {
476 activateFriendlyPositionAndSave->setCheck(
true);
477 fixPositionsAndSave->setCheck(
false);
478 saveInvalid->setCheck(
false);
479 selectInvalidStopsAndCancel->setCheck(
false);
480 }
else if (option == fixPositionsAndSave) {
481 activateFriendlyPositionAndSave->setCheck(
false);
482 fixPositionsAndSave->setCheck(
true);
483 saveInvalid->setCheck(
false);
484 selectInvalidStopsAndCancel->setCheck(
false);
485 }
else if (option == saveInvalid) {
486 activateFriendlyPositionAndSave->setCheck(
false);
487 fixPositionsAndSave->setCheck(
false);
488 saveInvalid->setCheck(
true);
489 selectInvalidStopsAndCancel->setCheck(
false);
490 }
else if (option == selectInvalidStopsAndCancel) {
491 activateFriendlyPositionAndSave->setCheck(
false);
492 fixPositionsAndSave->setCheck(
false);
493 saveInvalid->setCheck(
false);
494 selectInvalidStopsAndCancel->setCheck(
true);
502 if (myInvalidElements.size() > 0) {
503 if (activateFriendlyPositionAndSave->getCheck() == TRUE) {
507 for (
const auto& stop : myInvalidElements) {
511 }
else if (fixPositionsAndSave->getCheck() == TRUE) {
514 for (
const auto& stop : myInvalidElements) {
515 stop->fixDemandElementProblem();
518 }
else if (selectInvalidStopsAndCancel->getCheck() == TRUE) {
521 for (
const auto& stop : myInvalidElements) {
535 activateFriendlyPositionAndSave->enable();
536 fixPositionsAndSave->enable();
537 saveInvalid->enable();
538 selectInvalidStopsAndCancel->enable();
544 activateFriendlyPositionAndSave->disable();
545 fixPositionsAndSave->disable();
546 saveInvalid->disable();
547 selectInvalidStopsAndCancel->disable();
572 if (option == deletePersonPlan) {
573 deletePersonPlan->setCheck(
true);
574 saveInvalid->setCheck(
false);
575 selectInvalidPersonPlansAndCancel->setCheck(
false);
576 selectInvalidPersonPlansAndCancel->setCheck(
false);
577 }
else if (option == saveInvalid) {
578 deletePersonPlan->setCheck(
false);
579 saveInvalid->setCheck(
true);
580 selectInvalidPersonPlansAndCancel->setCheck(
false);
581 }
else if (option == selectInvalidPersonPlansAndCancel) {
582 deletePersonPlan->setCheck(
false);
583 saveInvalid->setCheck(
false);
584 selectInvalidPersonPlansAndCancel->setCheck(
true);
592 if (myInvalidElements.size() > 0) {
593 if (deletePersonPlan->getCheck() == TRUE) {
597 for (
const auto& personPlan : myInvalidElements) {
601 }
else if (selectInvalidPersonPlansAndCancel->getCheck() == TRUE) {
604 for (
const auto& personPlan : myInvalidElements) {
618 deletePersonPlan->enable();
619 saveInvalid->enable();
620 selectInvalidPersonPlansAndCancel->enable();
626 deletePersonPlan->disable();
627 saveInvalid->disable();
628 selectInvalidPersonPlansAndCancel->disable();
FXDEFMAP(GNEFixDemandElements) GNEFixDemandElementsMap[]
@ 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 GUIDesignCheckButtonFix
design for check button with fixed height (used in fix elements dialogs)
#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.
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
@ GNE_ATTR_SELECTED
element is selected
int GUIDesignHeight
the default size for GUI elements
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool saveContents() const
save contents
FXVerticalFrame * myRightFrame
vertical right frame
FXTable * myTable
Table with the demand elements.
void setInvalidElements(const std::vector< GNEDemandElement * > &invalidElements)
set invalid demand elements
FXVerticalFrame * myLeftFrame
vertical left frame
FixOptions(FXVerticalFrame *frameParent, const std::string &title, GNEViewNet *viewNet)
constructor
groupbox for all radio buttons related with fix person plan options
FXRadioButton * deletePersonPlan
Option "delete person plan".
FixPersonPlanOptions(GNEFixDemandElements *fixDemandElementsParent, GNEViewNet *viewNet)
build Position Options
void disableOptions()
disable personPlan options
void selectOption(FXObject *option)
select option
FXRadioButton * selectInvalidPersonPlansAndCancel
Option "Select invalid person plans and cancel".
void enableOptions()
enable personPlan options
void fixElements(bool &abortSaving)
fix elements
FXRadioButton * saveInvalid
Option "Save invalid".
groupbox for all radio buttons related with fix route options
void selectOption(FXObject *option)
select option
void fixElements(bool &abortSaving)
fix elements
FXRadioButton * removeInvalidRoutes
Option "Remove invalid routes".
FXRadioButton * saveInvalidRoutes
Option "Save invalid routes".
FXRadioButton * selectInvalidRoutesAndCancel
Option "Select invalid routes and cancel".
void enableOptions()
enable route options
FXCheckButton * removeStopsOutOfRoute
Option "Remove stops out of route".
void disableOptions()
disable route options
FixRouteOptions(GNEFixDemandElements *fixDemandElementsParent, GNEViewNet *viewNet)
constructor
groupbox for all radio buttons related with fix stop options
FXRadioButton * saveInvalid
Option "Save invalid".
void fixElements(bool &abortSaving)
fix elements
void disableOptions()
disable stop options
FixStopPositionOptions(GNEFixDemandElements *fixDemandElementsParent, GNEViewNet *viewNet)
build Position Options
FXRadioButton * fixPositionsAndSave
Option "Fix Positions and save".
FXRadioButton * selectInvalidStopsAndCancel
Option "Select invalid stops and cancel".
void selectOption(FXObject *option)
select option
void enableOptions()
enable stop options
FXRadioButton * activateFriendlyPositionAndSave
Option "Activate friendlyPos and save".
groupbox for all radio buttons related with fix vehicle options
FXRadioButton * saveInvalidVehicles
Option "save invalid vehicles".
FXCheckButton * removeStopsOutOfVehicle
Option "Remove stops out of vehicle".
void selectOption(FXObject *option)
select option
FXRadioButton * selectInvalidVehiclesAndCancel
Option "Select invalid vehicles and cancel".
void fixElements(bool &abortSaving)
fix elements
FXRadioButton * removeInvalidVehicles
Option "remove invalid elements".
FixVehicleOptions(GNEFixDemandElements *fixDemandElementsParent, GNEViewNet *viewNet)
constructor
void enableOptions()
enable vehicle options
void disableOptions()
disable vehicle options
Dialog for edit rerouters.
FixStopPositionOptions * myFixStopPositionOptions
fix stop options
~GNEFixDemandElements()
destructor
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
FixRouteOptions * myFixRouteOptions
fix route options
FXVerticalFrame * myRightFrame
vertical right frame
FXVerticalFrame * myMainFrame
main frame
FixVehicleOptions * myFixVehicleOptions
fix vehicle options
GNEViewNet * myViewNet
view net
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
FixPersonPlanOptions * myFixPersonPlanOptions
fix person plan options
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
FXVerticalFrame * myLeftFrame
vertical left frame
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
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.