42 FXIMPLEMENT(
GNEFixDemandElements, FXDialogBox, GNEFixDemandElementsMap, ARRAYNUMBER(GNEFixDemandElementsMap))
74 std::vector<GNEDemandElement*> invalidRoutes, invalidVehicles, invalidStops, invalidPlans;
76 for (
const auto& invalidDemandElement : invalidDemandElements) {
77 if (invalidDemandElement->getTagProperty().isRoute()) {
78 invalidRoutes.push_back(invalidDemandElement);
79 }
else if (invalidDemandElement->getTagProperty().isVehicle()) {
80 invalidVehicles.push_back(invalidDemandElement);
81 }
else if (invalidDemandElement->getTagProperty().isStop()) {
82 invalidStops.push_back(invalidDemandElement);
84 invalidPlans.push_back(invalidDemandElement);
88 myFixRouteOptions->setInvalidElements(invalidRoutes);
89 myFixVehicleOptions->setInvalidElements(invalidVehicles);
90 myFixStopPositionOptions->setInvalidElements(invalidStops);
91 myFixPersonPlanOptions->setInvalidElements(invalidPlans);
112 bool abortSaving =
false;
121 getApp()->stopModal(
this, FALSE);
124 getApp()->stopModal(
this, TRUE);
133 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)->getIcon());
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 toogleSaveButton(
true);
195 toogleSaveButton(
false);
202 "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 sucesfully'");
219 FXMessageBox::information(myTable, MBOX_OK,
"Saving sucesfully",
"%s",
"List of conflicted items was sucesfully saved");
221 WRITE_DEBUG(
"Closed FXMessageBox 'Saving list of conflicted items sucesfully' 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) {
288 }
else if (selectInvalidRoutesAndCancel->getCheck() == TRUE) {
292 for (
const auto& invalidRoute : myInvalidElements) {
301 if (removeStopsOutOfRoute->getCheck() == TRUE) {
303 std::vector<GNEDemandElement*> stopsToRemove;
304 for (
const auto& invalidRoute : myInvalidElements) {
305 const auto invaldstops = invalidRoute->getInvalidStops();
307 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
312 for (
const auto& stopToRemove : stopsToRemove) {
324 removeInvalidRoutes->enable();
325 saveInvalidRoutes->enable();
326 selectInvalidRoutesAndCancel->enable();
327 removeStopsOutOfRoute->enable();
333 removeInvalidRoutes->disable();
334 saveInvalidRoutes->disable();
335 selectInvalidRoutesAndCancel->disable();
336 removeStopsOutOfRoute->disable();
366 if (option == removeInvalidVehicles) {
367 removeInvalidVehicles->setCheck(
true);
368 saveInvalidVehicles->setCheck(
false);
369 selectInvalidVehiclesAndCancel->setCheck(
false);
370 }
else if (option == saveInvalidVehicles) {
371 removeInvalidVehicles->setCheck(
false);
372 saveInvalidVehicles->setCheck(
true);
373 selectInvalidVehiclesAndCancel->setCheck(
false);
374 }
else if (option == selectInvalidVehiclesAndCancel) {
375 removeInvalidVehicles->setCheck(
false);
376 saveInvalidVehicles->setCheck(
false);
377 selectInvalidVehiclesAndCancel->setCheck(
true);
384 if (myInvalidElements.size() > 0) {
385 if (removeInvalidVehicles->getCheck() == TRUE) {
389 for (
const auto& invalidVehicle : myInvalidElements) {
394 }
else if (selectInvalidVehiclesAndCancel->getCheck() == TRUE) {
398 for (
const auto& invalidVehicle : myInvalidElements) {
407 if (removeStopsOutOfVehicle->getCheck() == TRUE) {
409 std::vector<GNEDemandElement*> stopsToRemove;
410 for (
const auto& invalidVehicle : myInvalidElements) {
411 const auto invaldstops = invalidVehicle->getInvalidStops();
413 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
418 for (
const auto& stopToRemove : stopsToRemove) {
430 removeInvalidVehicles->enable();
431 saveInvalidVehicles->enable();
432 selectInvalidVehiclesAndCancel->enable();
433 removeStopsOutOfVehicle->enable();
439 removeInvalidVehicles->disable();
440 saveInvalidVehicles->disable();
441 selectInvalidVehiclesAndCancel->disable();
442 removeStopsOutOfVehicle->disable();
470 if (option == activateFriendlyPositionAndSave) {
471 activateFriendlyPositionAndSave->setCheck(
true);
472 fixPositionsAndSave->setCheck(
false);
473 saveInvalid->setCheck(
false);
474 selectInvalidStopsAndCancel->setCheck(
false);
475 }
else if (option == fixPositionsAndSave) {
476 activateFriendlyPositionAndSave->setCheck(
false);
477 fixPositionsAndSave->setCheck(
true);
478 saveInvalid->setCheck(
false);
479 selectInvalidStopsAndCancel->setCheck(
false);
480 }
else if (option == saveInvalid) {
481 activateFriendlyPositionAndSave->setCheck(
false);
482 fixPositionsAndSave->setCheck(
false);
483 saveInvalid->setCheck(
true);
484 selectInvalidStopsAndCancel->setCheck(
false);
485 }
else if (option == selectInvalidStopsAndCancel) {
486 activateFriendlyPositionAndSave->setCheck(
false);
487 fixPositionsAndSave->setCheck(
false);
488 saveInvalid->setCheck(
false);
489 selectInvalidStopsAndCancel->setCheck(
true);
497 if (myInvalidElements.size() > 0) {
498 if (activateFriendlyPositionAndSave->getCheck() == TRUE) {
502 for (
const auto& stop : myInvalidElements) {
506 }
else if (fixPositionsAndSave->getCheck() == TRUE) {
509 for (
const auto& stop : myInvalidElements) {
510 stop->fixDemandElementProblem();
513 }
else if (selectInvalidStopsAndCancel->getCheck() == TRUE) {
516 for (
const auto& stop : myInvalidElements) {
530 activateFriendlyPositionAndSave->enable();
531 fixPositionsAndSave->enable();
532 saveInvalid->enable();
533 selectInvalidStopsAndCancel->enable();
539 activateFriendlyPositionAndSave->disable();
540 fixPositionsAndSave->disable();
541 saveInvalid->disable();
542 selectInvalidStopsAndCancel->disable();
567 if (option == deletePersonPlan) {
568 deletePersonPlan->setCheck(
true);
569 saveInvalid->setCheck(
false);
570 selectInvalidPersonPlansAndCancel->setCheck(
false);
571 selectInvalidPersonPlansAndCancel->setCheck(
false);
572 }
else if (option == saveInvalid) {
573 deletePersonPlan->setCheck(
false);
574 saveInvalid->setCheck(
true);
575 selectInvalidPersonPlansAndCancel->setCheck(
false);
576 }
else if (option == selectInvalidPersonPlansAndCancel) {
577 deletePersonPlan->setCheck(
false);
578 saveInvalid->setCheck(
false);
579 selectInvalidPersonPlansAndCancel->setCheck(
true);
587 if (myInvalidElements.size() > 0) {
588 if (deletePersonPlan->getCheck() == TRUE) {
592 for (
const auto& personPlan : myInvalidElements) {
596 }
else if (selectInvalidPersonPlansAndCancel->getCheck() == TRUE) {
599 for (
const auto& personPlan : myInvalidElements) {
613 deletePersonPlan->enable();
614 saveInvalid->enable();
615 selectInvalidPersonPlansAndCancel->enable();
621 deletePersonPlan->disable();
622 saveInvalid->disable();
623 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 GUIDesignDialogBoxExplicit(width, height)
design for dialog box with specift width and height (for example, additional dialogs)
#define GUIDesignRadioButtonFix
design for radio button with fixed height (used in fix elements dialogs)
#define GUIDesignButtonAccept
Accept Button.
#define GUIDesignButtonCancel
Cancel Button.
#define GUIDesignHeight
define a standard height for all elements (Change it carefully)
#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) frames used to pack another frames extended in all directions
#define GUIDesignHorizontalFrame
FXString gCurrentFolder
The folder used as last.
@ GNE_ATTR_SELECTED
element is selected
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
FXGroupBoxModule (based on FXGroupBox)
Options
GroupBoxModule options.
An Element which don't belongs to GNENet but has influency in the simulation.
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 FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
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)
Returns the described OutputDevice.