63 FixOptions(fixDemandElementsParent, fixDemandElementsParent->myLeftFrame,
TL("Routes")) {
66 TL(
"Remove invalid routes"),
"",
67 TL(
"Remove invalid routes and save"),
71 TL(
"Save invalid routes"),
"",
72 TL(
"Save invalid routes"),
76 TL(
"Select invalid routes"),
"",
77 TL(
"Select invalid routes and stop saving"),
81 TL(
"Remove stops out of route"),
"",
82 TL(
"Remove stops out of route"),
85 registerOption(myRemoveInvalidRoutes);
86 registerOption(mySaveInvalidRoutes);
87 registerOption(mySelectRouteInvalids);
88 registerOption(myRemoveStopsOutOfRoute);
90 myRemoveInvalidRoutes->setCheck(
true);
92 myRemoveStopsOutOfRoute->setCheck(TRUE);
99 if (solution ==
"saveRouteInvalids") {
101 }
else if (solution ==
"removeRouteInvalids") {
103 }
else if (solution ==
"selectRouteInvalids") {
111 if (myConflictedElements.size() > 0) {
112 auto net = myFixElementDialogParent->getApplicationWindow()->getViewNet()->getNet();
113 auto undoList = myFixElementDialogParent->getApplicationWindow()->getUndoList();
115 if (myRemoveInvalidRoutes->getCheck() == TRUE) {
119 for (
const auto& conflictedElement : myConflictedElements) {
122 net->deleteDemandElement(conflictedElement.getElement()->getParentDemandElements().front(), undoList);
124 net->deleteDemandElement(conflictedElement.getElement(), undoList);
129 }
else if (mySelectRouteInvalids->getCheck() == TRUE) {
133 for (
const auto& conflictedElement : myConflictedElements) {
134 conflictedElement.getElement()->setAttribute(
GNE_ATTR_SELECTED,
"true", undoList);
142 if (myRemoveStopsOutOfRoute->getCheck() == TRUE) {
144 std::vector<GNEDemandElement*> stopsToRemove;
145 for (
const auto& conflictedElement : myConflictedElements) {
146 const auto invaldstops = conflictedElement.getElement()->getInvalidStops();
148 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
153 for (
const auto& stopToRemove : stopsToRemove) {
154 net->deleteDemandElement(stopToRemove, undoList);
166 if (obj == myRemoveInvalidRoutes) {
167 myRemoveInvalidRoutes->setCheck(
true);
168 mySaveInvalidRoutes->setCheck(
false);
169 mySelectRouteInvalids->setCheck(
false);
170 }
else if (obj == mySaveInvalidRoutes) {
171 myRemoveInvalidRoutes->setCheck(
false);
172 mySaveInvalidRoutes->setCheck(
true);
173 mySelectRouteInvalids->setCheck(
false);
174 }
else if (obj == mySelectRouteInvalids) {
175 myRemoveInvalidRoutes->setCheck(
false);
176 mySaveInvalidRoutes->setCheck(
false);
177 mySelectRouteInvalids->setCheck(
true);
187 FixOptions(fixDemandElementsParent, fixDemandElementsParent->
myLeftFrame,
TL(
"Vehicles")) {
190 TL(
"Remove invalid vehicles"),
"",
191 TL(
"Remove invalid vehicles and save"),
195 TL(
"Save invalid vehicles"),
"",
196 TL(
"Save invalid vehicles"),
200 TL(
"Select invalid vehicles"),
"",
201 TL(
"Select invalid vehicles and stop saving"),
205 TL(
"Remove stops out of route"),
"",
206 TL(
"Remove stops out of vehicle's route"),
227 if (myConflictedElements.size() > 0) {
228 auto net = myFixElementDialogParent->getApplicationWindow()->getViewNet()->getNet();
229 auto undoList = myFixElementDialogParent->getApplicationWindow()->getUndoList();
231 if (myRemoveInvalidVehicles->getCheck() == TRUE) {
235 for (
const auto& conflictedElement : myConflictedElements) {
237 if (net->getAttributeCarriers()->retrieveDemandElement(conflictedElement.getElement()->getTagProperty()->getTag(), conflictedElement.getID(),
false) !=
nullptr) {
238 net->deleteDemandElement(conflictedElement.getElement(), undoList);
243 }
else if (mySelectInvalidVehicles->getCheck() == TRUE) {
247 for (
const auto& conflictedElement : myConflictedElements) {
248 conflictedElement.getElement()->setAttribute(
GNE_ATTR_SELECTED,
"true", undoList);
256 if (myRemoveStopsOutOfVehicle->getCheck() == TRUE) {
258 std::vector<GNEDemandElement*> stopsToRemove;
259 for (
const auto& conflictedElement : myConflictedElements) {
260 const auto invaldstops = conflictedElement.getElement()->getInvalidStops();
262 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
267 for (
const auto& stopToRemove : stopsToRemove) {
268 net->deleteDemandElement(stopToRemove, undoList);
280 if (obj == myRemoveInvalidVehicles) {
281 myRemoveInvalidVehicles->setCheck(
true);
282 mySaveInvalidVehicles->setCheck(
false);
283 mySelectInvalidVehicles->setCheck(
false);
284 }
else if (obj == mySaveInvalidVehicles) {
285 myRemoveInvalidVehicles->setCheck(
false);
286 mySaveInvalidVehicles->setCheck(
true);
287 mySelectInvalidVehicles->setCheck(
false);
288 }
else if (obj == mySelectInvalidVehicles) {
289 myRemoveInvalidVehicles->setCheck(
false);
290 mySaveInvalidVehicles->setCheck(
false);
291 mySelectInvalidVehicles->setCheck(
true);
301 FixOptions(fixDemandElementsParent, fixDemandElementsParent->
myRightFrame,
TL(
"Stop positions")) {
304 TL(
"Activate friendlyPos"),
"",
305 TL(
"Activate friendlyPos and save"),
309 TL(
"Save invalid stops"),
"",
310 TL(
"Save elements with invalid positions"),
314 TL(
"Select conflicted stops"),
"",
315 TL(
"Select conflicted stops and abort saving"),
319 TL(
"Fix positions and save"),
"",
320 TL(
"Fix stop positions and save"),
340 if (myConflictedElements.size() > 0) {
341 auto undoList = myFixElementDialogParent->getApplicationWindow()->getUndoList();
343 if (myActivateFriendlyPosition->getCheck() == TRUE) {
347 for (
const auto& conflictedElement : myConflictedElements) {
351 }
else if (myFixPositions->getCheck() == TRUE) {
354 for (
const auto& conflictedElement : myConflictedElements) {
355 conflictedElement.getElement()->fixDemandElementProblem();
358 }
else if (mySelectInvalidStops->getCheck() == TRUE) {
361 for (
const auto& conflictedElement : myConflictedElements) {
362 conflictedElement.getElement()->setAttribute(
GNE_ATTR_SELECTED,
"true", undoList);
376 if (obj == myActivateFriendlyPosition) {
377 myActivateFriendlyPosition->setCheck(
true);
378 myFixPositions->setCheck(
false);
379 mySaveInvalid->setCheck(
false);
380 mySelectInvalidStops->setCheck(
false);
381 }
else if (obj == myFixPositions) {
382 myActivateFriendlyPosition->setCheck(
false);
383 myFixPositions->setCheck(
true);
384 mySaveInvalid->setCheck(
false);
385 mySelectInvalidStops->setCheck(
false);
386 }
else if (obj == mySaveInvalid) {
387 myActivateFriendlyPosition->setCheck(
false);
388 myFixPositions->setCheck(
false);
389 mySaveInvalid->setCheck(
true);
390 mySelectInvalidStops->setCheck(
false);
391 }
else if (obj == mySelectInvalidStops) {
392 myActivateFriendlyPosition->setCheck(
false);
393 myFixPositions->setCheck(
false);
394 mySaveInvalid->setCheck(
false);
395 mySelectInvalidStops->setCheck(
true);
405 FixOptions(fixDemandElementsParent, fixDemandElementsParent->
myRightFrame,
TL(
"Person/container plans")) {
408 TL(
"Remove invalid plans"),
"",
409 TL(
"Remove invalid plans"),
413 TL(
"Save invalid plans"),
"",
414 TL(
"Save invalid plans"),
418 TL(
"Select conflicted plans"),
"",
419 TL(
"Select conflicted plans and abort saving"),
438 if (myConflictedElements.size() > 0) {
439 auto net = myFixElementDialogParent->getApplicationWindow()->getViewNet()->getNet();
440 auto undoList = myFixElementDialogParent->getApplicationWindow()->getUndoList();
442 if (myRemoveInvalidPlan->getCheck() == TRUE) {
446 for (
const auto& conflictedElement : myConflictedElements) {
447 net->deleteDemandElement(conflictedElement.getElement(), undoList);
450 }
else if (mySelectInvalidPlans->getCheck() == TRUE) {
453 for (
const auto& conflictedElement : myConflictedElements) {
454 conflictedElement.getElement()->setAttribute(
GNE_ATTR_SELECTED,
"true", undoList);
468 if (obj == myRemoveInvalidPlan) {
469 myRemoveInvalidPlan->setCheck(
true);
470 mySaveInvalid->setCheck(
false);
471 mySelectInvalidPlans->setCheck(
false);
472 }
else if (obj == mySaveInvalid) {
473 myRemoveInvalidPlan->setCheck(
false);
474 mySaveInvalid->setCheck(
true);
475 mySelectInvalidPlans->setCheck(
false);
476 }
else if (obj == mySelectInvalidPlans) {
477 myRemoveInvalidPlan->setCheck(
false);
478 mySaveInvalid->setCheck(
false);
479 mySelectInvalidPlans->setCheck(
true);
489 const std::vector<GNEDemandElement*>& elements) :
500 std::vector<ConflictElement> invalidRoutes, invalidVehicles, invalidStops, invalidPlans;
502 for (
const auto& invalidDemandElement : elements) {
504 auto fixElement = ConflictElement(invalidDemandElement,
505 invalidDemandElement->getID(),
506 invalidDemandElement->getACIcon(),
507 invalidDemandElement->getDemandElementProblem());
509 if (invalidDemandElement->getTagProperty()->isRoute()) {
510 invalidRoutes.push_back(fixElement);
511 }
else if (invalidDemandElement->getTagProperty()->isVehicle()) {
512 invalidVehicles.push_back(fixElement);
513 }
else if (invalidDemandElement->getTagProperty()->isVehicleStop()) {
514 invalidStops.push_back(fixElement);
516 invalidPlans.push_back(fixElement);
FXDEFMAP(GNEFixDemandElementsDialog::FixRouteOptions) FixRouteOptionsMap[]
@ MID_CHOOSEN_OPERATION
set type of selection
#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)
GUIIcon
An enumeration of icons used by the gui applications.
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
@ GNE_ATTR_SELECTED
element is selected
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
The main window of Netedit.
void openDialog(FXWindow *focusableElement=nullptr)
open dialog
groupbox for all radio buttons related with fix person plan options
FXRadioButton * mySelectInvalidPlans
Option "Select invalid person plans and cancel".
void selectInternalTestSolution(const std::string &solution)
select internal test solution
FixPlanOptions(GNEFixDemandElementsDialog *fixDemandElementsParent)
FOX-declaration.
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
called when user select a option
FXRadioButton * myRemoveInvalidPlan
FOX needs this.
FXRadioButton * mySaveInvalid
Option "Save invalid".
bool applyFixOption()
apply selected fix option
groupbox for all radio buttons related with fix route options
FXRadioButton * myRemoveInvalidRoutes
FOX needs this.
FXRadioButton * mySelectRouteInvalids
Option "Select invalid routes and cancel".
FXRadioButton * mySaveInvalidRoutes
Option "Save invalid routes".
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
called when user select a option
void selectInternalTestSolution(const std::string &solution)
select internal test solution
bool applyFixOption()
apply selected fix option
groupbox for all radio buttons related with fix stop options
bool applyFixOption()
apply selected fix option
FXRadioButton * mySaveInvalid
Option "Save invalid".
FXRadioButton * myActivateFriendlyPosition
FOX needs this.
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
called when user select a option
FXRadioButton * myFixPositions
Option "Fix Positions and save".
void selectInternalTestSolution(const std::string &solution)
select internal test solution
FXRadioButton * mySelectInvalidStops
Option "Select invalid stops and cancel".
FixStopPositionOptions(GNEFixDemandElementsDialog *fixDemandElementsParent)
FOX-declaration.
groupbox for all radio buttons related with fix vehicle options
void selectInternalTestSolution(const std::string &solution)
select internal test solution
FixVehicleOptions(GNEFixDemandElementsDialog *fixDemandElementsParent)
FOX-declaration.
FXRadioButton * mySelectInvalidVehicles
Option "Select invalid vehicles and cancel".
bool applyFixOption()
apply selected fix option
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
called when user select a option
FXCheckButton * myRemoveStopsOutOfVehicle
Option "Remove stops out of vehicle".
FXRadioButton * mySaveInvalidVehicles
Option "save invalid vehicles".
FXRadioButton * myRemoveInvalidVehicles
FOX needs this.
GNEFixDemandElementsDialog(GNEApplicationWindow *mainWindow, const std::vector< GNEDemandElement * > &elements)
Constructor.
FixPlanOptions * myFixPlanOptions
fix person plan options
FixRouteOptions * myFixRouteOptions
fix route options
~GNEFixDemandElementsDialog()
destructor
FixStopPositionOptions * myFixStopPositionOptions
fix stop options
FixVehicleOptions * myFixVehicleOptions
fix vehicle options
void registerOption(FXWindow *option)
add option to options container (used for adjust width and enable/disable)
void setInvalidElements(const std::vector< ConflictElement > &conflictedElements)
set invalid elements to fix
FXVerticalFrame * myRightFrameOptions
vertical right frame for options
FXVerticalFrame * myLeftFrameOptions
vertical left frame for options
FXVerticalFrame * myRightFrame
right frame for fix options
FXVerticalFrame * myLeftFrame
left frame for fix options
static FXCheckButton * buildFXCheckButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXObject *tgt, FXSelector sel, FXuint opts=CHECKBUTTON_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 check button
static FXRadioButton * buildFXRadioButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXObject *tgt, FXSelector sel, FXuint opts=RADIOBUTTON_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 radio button
MFXGroupBoxModule (based on FXGroupBox)