78 std::vector<GNEDemandElement*> invalidRoutes, invalidVehicles, invalidStops, invalidPlans;
80 for (
const auto& invalidDemandElement : invalidDemandElements) {
81 if (invalidDemandElement->getTagProperty()->isRoute()) {
82 invalidRoutes.push_back(invalidDemandElement);
83 }
else if (invalidDemandElement->getTagProperty()->isVehicle()) {
84 invalidVehicles.push_back(invalidDemandElement);
85 }
else if (invalidDemandElement->getTagProperty()->isVehicleStop()) {
86 invalidStops.push_back(invalidDemandElement);
88 invalidPlans.push_back(invalidDemandElement);
106 if (dialogTest->
fixSolution ==
"saveRouteInvalids") {
108 }
else if (dialogTest->
fixSolution ==
"removeRouteInvalids") {
110 }
else if (dialogTest->
fixSolution ==
"selectRouteInvalids") {
131 bool abortSaving =
false;
169 myInvalidElements = invalidElements;
171 myTable->setTableSize((
int)(myInvalidElements.size()), 3);
172 myTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
173 myTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
174 myTable->setEditable(
false);
176 myTable->setVisibleColumns(4);
178 myTable->setColumnWidth(1, 150);
179 myTable->setColumnWidth(2, 200);
180 myTable->setColumnText(0,
"");
182 myTable->setColumnText(2,
"Conflict");
183 myTable->getRowHeader()->setWidth(0);
185 FXTableItem* item =
nullptr;
187 for (
int i = 0; i < (int)myInvalidElements.size(); i++) {
189 item =
new FXTableItem(
"", myInvalidElements.at(i)->getACIcon());
190 item->setIconPosition(FXTableItem::CENTER_X);
191 myTable->setItem(i, 0, item);
193 item =
new FXTableItem(myInvalidElements.at(i)->getID().c_str());
194 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
195 myTable->setItem(i, 1, item);
197 item =
new FXTableItem(myInvalidElements.at(i)->getDemandElementProblem().c_str());
198 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
199 myTable->setItem(i, 2, item);
202 if (invalidElements.size() > 0) {
204 toggleSaveButton(
true);
207 toggleSaveButton(
false);
223 for (
const auto& invalidElement : myInvalidElements) {
224 dev << invalidElement->getID() <<
":" << invalidElement->getDemandElementProblem() <<
"\n";
229 FXMessageBox::information(myTable, MBOX_OK,
"Saving successfully",
"%s",
"List of conflicted items was successfully saved");
232 FXMessageBox::error(myTable, MBOX_OK,
"Saving list of conflicted items failed",
"%s", e.what());
264 if (option == removeInvalidRoutes) {
265 removeInvalidRoutes->setCheck(
true);
266 saveInvalidRoutes->setCheck(
false);
267 selectRouteInvalids->setCheck(
false);
268 }
else if (option == saveInvalidRoutes) {
269 removeInvalidRoutes->setCheck(
false);
270 saveInvalidRoutes->setCheck(
true);
271 selectRouteInvalids->setCheck(
false);
272 }
else if (option == selectRouteInvalids) {
273 removeInvalidRoutes->setCheck(
false);
274 saveInvalidRoutes->setCheck(
false);
275 selectRouteInvalids->setCheck(
true);
282 if (myInvalidElements.size() > 0) {
283 if (removeInvalidRoutes->getCheck() == TRUE) {
287 for (
const auto& invalidRoute : myInvalidElements) {
297 }
else if (selectRouteInvalids->getCheck() == TRUE) {
301 for (
const auto& invalidRoute : myInvalidElements) {
310 if (removeStopsOutOfRoute->getCheck() == TRUE) {
312 std::vector<GNEDemandElement*> stopsToRemove;
313 for (
const auto& invalidRoute : myInvalidElements) {
314 const auto invaldstops = invalidRoute->getInvalidStops();
316 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
321 for (
const auto& stopToRemove : stopsToRemove) {
333 removeInvalidRoutes->enable();
334 saveInvalidRoutes->enable();
335 selectRouteInvalids->enable();
336 removeStopsOutOfRoute->enable();
342 removeInvalidRoutes->disable();
343 saveInvalidRoutes->disable();
344 selectRouteInvalids->disable();
345 removeStopsOutOfRoute->disable();
375 if (option == removeInvalidVehicles) {
376 removeInvalidVehicles->setCheck(
true);
377 saveInvalidVehicles->setCheck(
false);
378 selectInvalidVehiclesAndCancel->setCheck(
false);
379 }
else if (option == saveInvalidVehicles) {
380 removeInvalidVehicles->setCheck(
false);
381 saveInvalidVehicles->setCheck(
true);
382 selectInvalidVehiclesAndCancel->setCheck(
false);
383 }
else if (option == selectInvalidVehiclesAndCancel) {
384 removeInvalidVehicles->setCheck(
false);
385 saveInvalidVehicles->setCheck(
false);
386 selectInvalidVehiclesAndCancel->setCheck(
true);
393 if (myInvalidElements.size() > 0) {
394 if (removeInvalidVehicles->getCheck() == TRUE) {
398 for (
const auto& invalidVehicle : myInvalidElements) {
406 }
else if (selectInvalidVehiclesAndCancel->getCheck() == TRUE) {
410 for (
const auto& invalidVehicle : myInvalidElements) {
419 if (removeStopsOutOfVehicle->getCheck() == TRUE) {
421 std::vector<GNEDemandElement*> stopsToRemove;
422 for (
const auto& invalidVehicle : myInvalidElements) {
423 const auto invaldstops = invalidVehicle->getInvalidStops();
425 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
430 for (
const auto& stopToRemove : stopsToRemove) {
442 removeInvalidVehicles->enable();
443 saveInvalidVehicles->enable();
444 selectInvalidVehiclesAndCancel->enable();
445 removeStopsOutOfVehicle->enable();
451 removeInvalidVehicles->disable();
452 saveInvalidVehicles->disable();
453 selectInvalidVehiclesAndCancel->disable();
454 removeStopsOutOfVehicle->disable();
482 if (option == activateFriendlyPositionAndSave) {
483 activateFriendlyPositionAndSave->setCheck(
true);
484 fixPositionsAndSave->setCheck(
false);
485 saveInvalid->setCheck(
false);
486 selectInvalidStopsAndCancel->setCheck(
false);
487 }
else if (option == fixPositionsAndSave) {
488 activateFriendlyPositionAndSave->setCheck(
false);
489 fixPositionsAndSave->setCheck(
true);
490 saveInvalid->setCheck(
false);
491 selectInvalidStopsAndCancel->setCheck(
false);
492 }
else if (option == saveInvalid) {
493 activateFriendlyPositionAndSave->setCheck(
false);
494 fixPositionsAndSave->setCheck(
false);
495 saveInvalid->setCheck(
true);
496 selectInvalidStopsAndCancel->setCheck(
false);
497 }
else if (option == selectInvalidStopsAndCancel) {
498 activateFriendlyPositionAndSave->setCheck(
false);
499 fixPositionsAndSave->setCheck(
false);
500 saveInvalid->setCheck(
false);
501 selectInvalidStopsAndCancel->setCheck(
true);
509 if (myInvalidElements.size() > 0) {
510 if (activateFriendlyPositionAndSave->getCheck() == TRUE) {
514 for (
const auto& stop : myInvalidElements) {
518 }
else if (fixPositionsAndSave->getCheck() == TRUE) {
521 for (
const auto& stop : myInvalidElements) {
522 stop->fixDemandElementProblem();
525 }
else if (selectInvalidStopsAndCancel->getCheck() == TRUE) {
528 for (
const auto& stop : myInvalidElements) {
542 activateFriendlyPositionAndSave->enable();
543 fixPositionsAndSave->enable();
544 saveInvalid->enable();
545 selectInvalidStopsAndCancel->enable();
551 activateFriendlyPositionAndSave->disable();
552 fixPositionsAndSave->disable();
553 saveInvalid->disable();
554 selectInvalidStopsAndCancel->disable();
579 if (option == deletePersonPlan) {
580 deletePersonPlan->setCheck(
true);
581 saveInvalid->setCheck(
false);
582 selectInvalidPersonPlansAndCancel->setCheck(
false);
583 selectInvalidPersonPlansAndCancel->setCheck(
false);
584 }
else if (option == saveInvalid) {
585 deletePersonPlan->setCheck(
false);
586 saveInvalid->setCheck(
true);
587 selectInvalidPersonPlansAndCancel->setCheck(
false);
588 }
else if (option == selectInvalidPersonPlansAndCancel) {
589 deletePersonPlan->setCheck(
false);
590 saveInvalid->setCheck(
false);
591 selectInvalidPersonPlansAndCancel->setCheck(
true);
599 if (myInvalidElements.size() > 0) {
600 if (deletePersonPlan->getCheck() == TRUE) {
604 for (
const auto& personPlan : myInvalidElements) {
608 }
else if (selectInvalidPersonPlansAndCancel->getCheck() == TRUE) {
611 for (
const auto& personPlan : myInvalidElements) {
625 deletePersonPlan->enable();
626 saveInvalid->enable();
627 selectInvalidPersonPlansAndCancel->enable();
633 deletePersonPlan->disable();
634 saveInvalid->disable();
635 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 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
FXString gCurrentFolder
The folder used as last.
GUIIcon
An enumeration of icons used by the gui applications.
@ 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 * selectRouteInvalids
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
void runInternalTest(const InternalTestStep::DialogTest *dialogTest)
run internal test
FixStopPositionOptions * myFixStopPositionOptions
fix stop options
~GNEFixDemandElements()
destructor
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
event when user select a option
FixRouteOptions * myFixRouteOptions
fix route options
FXVerticalFrame * myRightFrame
vertical right frame
FixVehicleOptions * myFixVehicleOptions
fix vehicle options
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
FXuint openDialog(const std::vector< GNEDemandElement * > &invalidDemandElements)
open fix demand elements dialog
FXVerticalFrame * myLeftFrame
vertical left frame
long openFixDialog()
open dialog
GNEViewNet * myViewNet
view net
Buttons * myButtons
buttons
long closeFixDialog(const bool success)
stop fix elements dialog accepting changes
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
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 FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
dialog arguments (used for certain functions that opens modal dialogs)
const std::string fixSolution
solution for fix dialogs
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.