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);
211 for (
const auto& invalidElement : myInvalidElements) {
212 dev << invalidElement->getID() <<
":" << invalidElement->getDemandElementProblem() <<
"\n";
217 FXMessageBox::information(myTable, MBOX_OK,
"Saving successfully",
"%s",
"List of conflicted items was successfully saved");
220 FXMessageBox::error(myTable, MBOX_OK,
"Saving list of conflicted items failed",
"%s", e.what());
252 if (option == removeInvalidRoutes) {
253 removeInvalidRoutes->setCheck(
true);
254 saveInvalidRoutes->setCheck(
false);
255 selectInvalidRoutesAndCancel->setCheck(
false);
256 }
else if (option == saveInvalidRoutes) {
257 removeInvalidRoutes->setCheck(
false);
258 saveInvalidRoutes->setCheck(
true);
259 selectInvalidRoutesAndCancel->setCheck(
false);
260 }
else if (option == selectInvalidRoutesAndCancel) {
261 removeInvalidRoutes->setCheck(
false);
262 saveInvalidRoutes->setCheck(
false);
263 selectInvalidRoutesAndCancel->setCheck(
true);
270 if (myInvalidElements.size() > 0) {
271 if (removeInvalidRoutes->getCheck() == TRUE) {
275 for (
const auto& invalidRoute : myInvalidElements) {
285 }
else if (selectInvalidRoutesAndCancel->getCheck() == TRUE) {
289 for (
const auto& invalidRoute : myInvalidElements) {
298 if (removeStopsOutOfRoute->getCheck() == TRUE) {
300 std::vector<GNEDemandElement*> stopsToRemove;
301 for (
const auto& invalidRoute : myInvalidElements) {
302 const auto invaldstops = invalidRoute->getInvalidStops();
304 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
309 for (
const auto& stopToRemove : stopsToRemove) {
321 removeInvalidRoutes->enable();
322 saveInvalidRoutes->enable();
323 selectInvalidRoutesAndCancel->enable();
324 removeStopsOutOfRoute->enable();
330 removeInvalidRoutes->disable();
331 saveInvalidRoutes->disable();
332 selectInvalidRoutesAndCancel->disable();
333 removeStopsOutOfRoute->disable();
363 if (option == removeInvalidVehicles) {
364 removeInvalidVehicles->setCheck(
true);
365 saveInvalidVehicles->setCheck(
false);
366 selectInvalidVehiclesAndCancel->setCheck(
false);
367 }
else if (option == saveInvalidVehicles) {
368 removeInvalidVehicles->setCheck(
false);
369 saveInvalidVehicles->setCheck(
true);
370 selectInvalidVehiclesAndCancel->setCheck(
false);
371 }
else if (option == selectInvalidVehiclesAndCancel) {
372 removeInvalidVehicles->setCheck(
false);
373 saveInvalidVehicles->setCheck(
false);
374 selectInvalidVehiclesAndCancel->setCheck(
true);
381 if (myInvalidElements.size() > 0) {
382 if (removeInvalidVehicles->getCheck() == TRUE) {
386 for (
const auto& invalidVehicle : myInvalidElements) {
391 }
else if (selectInvalidVehiclesAndCancel->getCheck() == TRUE) {
395 for (
const auto& invalidVehicle : myInvalidElements) {
404 if (removeStopsOutOfVehicle->getCheck() == TRUE) {
406 std::vector<GNEDemandElement*> stopsToRemove;
407 for (
const auto& invalidVehicle : myInvalidElements) {
408 const auto invaldstops = invalidVehicle->getInvalidStops();
410 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
415 for (
const auto& stopToRemove : stopsToRemove) {
427 removeInvalidVehicles->enable();
428 saveInvalidVehicles->enable();
429 selectInvalidVehiclesAndCancel->enable();
430 removeStopsOutOfVehicle->enable();
436 removeInvalidVehicles->disable();
437 saveInvalidVehicles->disable();
438 selectInvalidVehiclesAndCancel->disable();
439 removeStopsOutOfVehicle->disable();
467 if (option == activateFriendlyPositionAndSave) {
468 activateFriendlyPositionAndSave->setCheck(
true);
469 fixPositionsAndSave->setCheck(
false);
470 saveInvalid->setCheck(
false);
471 selectInvalidStopsAndCancel->setCheck(
false);
472 }
else if (option == fixPositionsAndSave) {
473 activateFriendlyPositionAndSave->setCheck(
false);
474 fixPositionsAndSave->setCheck(
true);
475 saveInvalid->setCheck(
false);
476 selectInvalidStopsAndCancel->setCheck(
false);
477 }
else if (option == saveInvalid) {
478 activateFriendlyPositionAndSave->setCheck(
false);
479 fixPositionsAndSave->setCheck(
false);
480 saveInvalid->setCheck(
true);
481 selectInvalidStopsAndCancel->setCheck(
false);
482 }
else if (option == selectInvalidStopsAndCancel) {
483 activateFriendlyPositionAndSave->setCheck(
false);
484 fixPositionsAndSave->setCheck(
false);
485 saveInvalid->setCheck(
false);
486 selectInvalidStopsAndCancel->setCheck(
true);
494 if (myInvalidElements.size() > 0) {
495 if (activateFriendlyPositionAndSave->getCheck() == TRUE) {
499 for (
const auto& stop : myInvalidElements) {
503 }
else if (fixPositionsAndSave->getCheck() == TRUE) {
506 for (
const auto& stop : myInvalidElements) {
507 stop->fixDemandElementProblem();
510 }
else if (selectInvalidStopsAndCancel->getCheck() == TRUE) {
513 for (
const auto& stop : myInvalidElements) {
527 activateFriendlyPositionAndSave->enable();
528 fixPositionsAndSave->enable();
529 saveInvalid->enable();
530 selectInvalidStopsAndCancel->enable();
536 activateFriendlyPositionAndSave->disable();
537 fixPositionsAndSave->disable();
538 saveInvalid->disable();
539 selectInvalidStopsAndCancel->disable();
564 if (option == deletePersonPlan) {
565 deletePersonPlan->setCheck(
true);
566 saveInvalid->setCheck(
false);
567 selectInvalidPersonPlansAndCancel->setCheck(
false);
568 selectInvalidPersonPlansAndCancel->setCheck(
false);
569 }
else if (option == saveInvalid) {
570 deletePersonPlan->setCheck(
false);
571 saveInvalid->setCheck(
true);
572 selectInvalidPersonPlansAndCancel->setCheck(
false);
573 }
else if (option == selectInvalidPersonPlansAndCancel) {
574 deletePersonPlan->setCheck(
false);
575 saveInvalid->setCheck(
false);
576 selectInvalidPersonPlansAndCancel->setCheck(
true);
584 if (myInvalidElements.size() > 0) {
585 if (deletePersonPlan->getCheck() == TRUE) {
589 for (
const auto& personPlan : myInvalidElements) {
593 }
else if (selectInvalidPersonPlansAndCancel->getCheck() == TRUE) {
596 for (
const auto& personPlan : myInvalidElements) {
610 deletePersonPlan->enable();
611 saveInvalid->enable();
612 selectInvalidPersonPlansAndCancel->enable();
618 deletePersonPlan->disable();
619 saveInvalid->disable();
620 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 &extensions, 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.
static StringBijection< TXTFileExtension > TXTFileExtensions
TXT file Extensions.