Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEFixDemandElements.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Dialog used to fix demand elements during saving
19/****************************************************************************/
20
23#include <netedit/GNENet.h>
24#include <netedit/GNEViewNet.h>
25#include <netedit/GNEUndoList.h>
26
28
29
30// ===========================================================================
31// FOX callback mapping
32// ===========================================================================
33
39
40// Object implementation
41FXIMPLEMENT(GNEFixDemandElements, FXDialogBox, GNEFixDemandElementsMap, ARRAYNUMBER(GNEFixDemandElementsMap))
42
43// ===========================================================================
44// member method definitions
45// ===========================================================================
46
47// ---------------------------------------------------------------------------
48// GNEFixDemandElements - methods
49// ---------------------------------------------------------------------------
50
51GNEFixDemandElements::GNEFixDemandElements(GNEViewNet* viewNet, const std::vector<GNEDemandElement*>& invalidDemandElements) :
52 FXDialogBox(viewNet->getApp(), "Fix demand elements problems", GUIDesignDialogBoxExplicitStretchable(800, 620)),
53 myViewNet(viewNet) {
54 // set busStop icon for this dialog
56 // create main frame
57 myMainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
58 // create frames for options
59 FXHorizontalFrame* optionsFrame = new FXHorizontalFrame(myMainFrame, GUIDesignAuxiliarFrame);
60 myLeftFrame = new FXVerticalFrame(optionsFrame, GUIDesignAuxiliarFrame);
61 myRightFrame = new FXVerticalFrame(optionsFrame, GUIDesignAuxiliarFrame);
62 // create fix route options
63 myFixRouteOptions = new FixRouteOptions(this, viewNet);
64 // create fix vehicle options
65 myFixVehicleOptions = new FixVehicleOptions(this, viewNet);
66 // create fix stops options
67 myFixStopPositionOptions = new FixStopPositionOptions(this, viewNet);
68 // create fix person plans options
69 myFixPersonPlanOptions = new FixPersonPlanOptions(this, viewNet);
70 // create buttons
71 myButtons = new Buttons(this);
72 // split invalidDemandElements in four groups
73 std::vector<GNEDemandElement*> invalidRoutes, invalidVehicles, invalidStops, invalidPlans;
74 // fill groups
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);
82 } else {
83 invalidPlans.push_back(invalidDemandElement);
84 }
85 }
86 // fill options
87 myFixRouteOptions->setInvalidElements(invalidRoutes);
88 myFixVehicleOptions->setInvalidElements(invalidVehicles);
89 myFixStopPositionOptions->setInvalidElements(invalidStops);
90 myFixPersonPlanOptions->setInvalidElements(invalidPlans);
91}
92
93
96
97
98long
99GNEFixDemandElements::onCmdSelectOption(FXObject* obj, FXSelector, void*) {
100 // select options
105 return 1;
106}
107
108
109long
110GNEFixDemandElements::onCmdAccept(FXObject*, FXSelector, void*) {
111 bool abortSaving = false;
112 // fix elements
113 myFixRouteOptions->fixElements(abortSaving);
114 myFixVehicleOptions->fixElements(abortSaving);
117 // check if abort saving
118 if (abortSaving) {
119 // stop modal with TRUE (abort saving)
120 getApp()->stopModal(this, FALSE);
121 } else {
122 // stop modal with TRUE (continue saving)
123 getApp()->stopModal(this, TRUE);
124 }
125 return 1;
126}
127
128
129long
130GNEFixDemandElements::onCmdCancel(FXObject*, FXSelector, void*) {
131 // Stop Modal (abort saving)
132 getApp()->stopModal(this, FALSE);
133 return 1;
134}
135
136// ---------------------------------------------------------------------------
137// GNEFixDemandElements::FixOptions - methods
138// ---------------------------------------------------------------------------
139
140GNEFixDemandElements::FixOptions::FixOptions(FXVerticalFrame* frameParent, const std::string& title, GNEViewNet* viewNet) :
141 MFXGroupBoxModule(frameParent, title, MFXGroupBoxModule::Options::SAVE),
142 myViewNet(viewNet) {
143 // Create table
144 myTable = new FXTable(this, this, MID_TABLE, GUIDesignTableFixElements);
145 myTable->disable();
146 // create horizontal frame
147 FXHorizontalFrame* horizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
148 // create vertical frames
149 myLeftFrame = new FXVerticalFrame(horizontalFrame, GUIDesignAuxiliarVerticalFrame);
150 myRightFrame = new FXVerticalFrame(horizontalFrame, GUIDesignAuxiliarVerticalFrame);
151}
152
153
154void
155GNEFixDemandElements::FixOptions::setInvalidElements(const std::vector<GNEDemandElement*>& invalidElements) {
156 // update invalid elements
157 myInvalidElements = invalidElements;
158 // configure table
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);
163 // configure header
164 myTable->setVisibleColumns(4);
165 myTable->setColumnWidth(0, GUIDesignHeight);
166 myTable->setColumnWidth(1, 150);
167 myTable->setColumnWidth(2, 200);
168 myTable->setColumnText(0, "");
169 myTable->setColumnText(1, toString(SUMO_ATTR_ID).c_str());
170 myTable->setColumnText(2, "Conflict");
171 myTable->getRowHeader()->setWidth(0);
172 // Declare pointer to FXTableItem
173 FXTableItem* item = nullptr;
174 // iterate over invalid routes
175 for (int i = 0; i < (int)myInvalidElements.size(); i++) {
176 // Set icon
177 item = new FXTableItem("", myInvalidElements.at(i)->getACIcon());
178 item->setIconPosition(FXTableItem::CENTER_X);
179 myTable->setItem(i, 0, item);
180 // Set ID
181 item = new FXTableItem(myInvalidElements.at(i)->getID().c_str());
182 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
183 myTable->setItem(i, 1, item);
184 // Set conflict
185 item = new FXTableItem(myInvalidElements.at(i)->getDemandElementProblem().c_str());
186 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
187 myTable->setItem(i, 2, item);
188 }
189 // check if enable or disable options
190 if (invalidElements.size() > 0) {
191 enableOptions();
192 toggleSaveButton(true);
193 } else {
194 disableOptions();
195 toggleSaveButton(false);
196 }
197}
198
199bool
201 const FXString file = MFXUtils::getFilename2Write(myTable,
202 TL("Save list of conflicted items"), ".txt",
204 if (file == "") {
205 return false;
206 }
207 try {
208 // open output device
209 OutputDevice& dev = OutputDevice::getDevice(file.text());
210 // get invalid element ID and problem
211 for (const auto& invalidElement : myInvalidElements) {
212 dev << invalidElement->getID() << ":" << invalidElement->getDemandElementProblem() << "\n";
213 }
214 // close output device
215 dev.close();
216 // write warning if netedit is running in testing mode
217 WRITE_DEBUG("Opening FXMessageBox 'Saving list of conflicted items successfully'");
218 // open message box error
219 FXMessageBox::information(myTable, MBOX_OK, "Saving successfully", "%s", "List of conflicted items was successfully saved");
220 // write warning if netedit is running in testing mode
221 WRITE_DEBUG("Closed FXMessageBox 'Saving list of conflicted items successfully' with 'OK'");
222 } catch (IOError& e) {
223 // write warning if netedit is running in testing mode
224 WRITE_DEBUG("Opening FXMessageBox 'error saving list of conflicted items'");
225 // open message box error
226 FXMessageBox::error(myTable, MBOX_OK, "Saving list of conflicted items failed", "%s", e.what());
227 // write warning if netedit is running in testing mode
228 WRITE_DEBUG("Closed FXMessageBox 'error saving list of conflicted items' with 'OK'");
229 }
230 return true;
231}
232
233// ---------------------------------------------------------------------------
234// GNEFixDemandElements::FixRouteOptions - methods
235// ---------------------------------------------------------------------------
236
238 FixOptions(fixDemandElementsParent->myLeftFrame, "Routes", viewNet) {
239 // Remove invalid routes
240 removeInvalidRoutes = new FXRadioButton(myLeftFrame, TL("Remove invalid routes"),
241 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
242 // Save invalid routes
243 saveInvalidRoutes = new FXRadioButton(myLeftFrame, TL("Save invalid routes"),
244 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
245 // Select invalid routes
246 selectInvalidRoutesAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted routes"),
247 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
248 // Remove stops out of route
249 removeStopsOutOfRoute = new FXCheckButton(myRightFrame, TL("Remove stops out of route"),
250 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignCheckButtonFix);
251 // leave option "removeInvalidRoutes" as default
252 removeInvalidRoutes->setCheck(true);
253 // ... and remove stops out of route
254 removeStopsOutOfRoute->setCheck(TRUE);
255}
256
257
258void
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);
272 }
273}
274
275
276void
278 if (myInvalidElements.size() > 0) {
279 if (removeInvalidRoutes->getCheck() == TRUE) {
280 // begin undo list
281 myViewNet->getUndoList()->begin(GUIIcon::ROUTE, "delete invalid routes");
282 // iterate over invalid routes to delete it
283 for (const auto& invalidRoute : myInvalidElements) {
284 // special case for embedded routes
285 if (invalidRoute->getTagProperty().getTag() == GNE_TAG_ROUTE_EMBEDDED) {
286 myViewNet->getNet()->deleteDemandElement(invalidRoute->getParentDemandElements().front(), myViewNet->getUndoList());
287 } else {
289 }
290 }
291 // end undo list
293 } else if (selectInvalidRoutesAndCancel->getCheck() == TRUE) {
294 // begin undo list
295 myViewNet->getUndoList()->begin(GUIIcon::ROUTE, "select invalid routes");
296 // iterate over invalid single lane elements to select all elements
297 for (const auto& invalidRoute : myInvalidElements) {
298 invalidRoute->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
299 }
300 // end undo list
302 // abort saving
303 abortSaving = true;
304 }
305 // check if remove stops
306 if (removeStopsOutOfRoute->getCheck() == TRUE) {
307 // get all stops to remove
308 std::vector<GNEDemandElement*> stopsToRemove;
309 for (const auto& invalidRoute : myInvalidElements) {
310 const auto invaldstops = invalidRoute->getInvalidStops();
311 // append to stopsToRemove
312 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
313 }
314 // begin undo list
315 myViewNet->getUndoList()->begin(GUIIcon::STOP, "delete invalid stops");
316 // remove all
317 for (const auto& stopToRemove : stopsToRemove) {
319 }
320 // end undo list
322 }
323 }
324}
325
326
327void
329 removeInvalidRoutes->enable();
330 saveInvalidRoutes->enable();
331 selectInvalidRoutesAndCancel->enable();
332 removeStopsOutOfRoute->enable();
333}
334
335
336void
338 removeInvalidRoutes->disable();
339 saveInvalidRoutes->disable();
340 selectInvalidRoutesAndCancel->disable();
341 removeStopsOutOfRoute->disable();
342}
343
344// ---------------------------------------------------------------------------
345// GNEFixDemandElements::FixVehicleOptions - methods
346// ---------------------------------------------------------------------------
347
349 FixOptions(fixDemandElementsParent->myLeftFrame, "Vehicles", viewNet) {
350 // Remove invalid vehicles
351 removeInvalidVehicles = new FXRadioButton(myLeftFrame, TL("Remove invalid vehicles"),
352 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
353 // Save invalid vehicles
354 saveInvalidVehicles = new FXRadioButton(myLeftFrame, TL("Save invalid vehicles"),
355 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
356 // Select invalid vehicle
357 selectInvalidVehiclesAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted vehicle"),
358 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
359 // Remove stops out of route
360 removeStopsOutOfVehicle = new FXCheckButton(myRightFrame, TL("Remove stops out of vehicle's route"),
361 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignCheckButtonFix);
362 // by default remove invalid vehicles
363 removeInvalidVehicles->setCheck(TRUE);
364 // ... and remove stops out of route
365 removeStopsOutOfVehicle->setCheck(TRUE);
366}
367
368
369void
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);
383 }
384}
385
386
387void
389 if (myInvalidElements.size() > 0) {
390 if (removeInvalidVehicles->getCheck() == TRUE) {
391 // begin undo list
392 myViewNet->getUndoList()->begin(GUIIcon::VEHICLE, "delete invalid vehicles");
393 // iterate over invalid vehicles to delete it
394 for (const auto& invalidVehicle : myInvalidElements) {
396 }
397 // end undo list
399 } else if (selectInvalidVehiclesAndCancel->getCheck() == TRUE) {
400 // begin undo list
401 myViewNet->getUndoList()->begin(GUIIcon::ROUTE, "select invalid routes");
402 // iterate over invalid single lane elements to select all elements
403 for (const auto& invalidVehicle : myInvalidElements) {
404 invalidVehicle->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
405 }
406 // end undo list
408 // abort saving
409 abortSaving = true;
410 }
411 // check if remove stops
412 if (removeStopsOutOfVehicle->getCheck() == TRUE) {
413 // get all stops to remove
414 std::vector<GNEDemandElement*> stopsToRemove;
415 for (const auto& invalidVehicle : myInvalidElements) {
416 const auto invaldstops = invalidVehicle->getInvalidStops();
417 // append to stopsToRemove
418 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
419 }
420 // begin undo list
421 myViewNet->getUndoList()->begin(GUIIcon::STOP, "delete invalid stops");
422 // remove all
423 for (const auto& stopToRemove : stopsToRemove) {
425 }
426 // end undo list
428 }
429 }
430}
431
432
433void
435 removeInvalidVehicles->enable();
436 saveInvalidVehicles->enable();
437 selectInvalidVehiclesAndCancel->enable();
438 removeStopsOutOfVehicle->enable();
439}
440
441
442void
444 removeInvalidVehicles->disable();
445 saveInvalidVehicles->disable();
446 selectInvalidVehiclesAndCancel->disable();
447 removeStopsOutOfVehicle->disable();
448}
449
450// ---------------------------------------------------------------------------
451// GNEFixDemandElements::FixStopPositionOptions - methods
452// ---------------------------------------------------------------------------
453
455 FixOptions(fixDemandElementsParent->myRightFrame, "Stop positions", viewNet) {
456 // Activate friendlyPos and save
457 activateFriendlyPositionAndSave = new FXRadioButton(myLeftFrame, TL("Activate friendlyPos and save"),
458 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
459 // Save invalid position
460 saveInvalid = new FXRadioButton(myLeftFrame, TL("Save invalid positions"),
461 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
462 // Select invalid Stops
463 selectInvalidStopsAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted Stops"),
464 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
465 // Fix positions and save
466 fixPositionsAndSave = new FXRadioButton(myRightFrame, TL("Fix positions and save"),
467 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
468 // leave option "activateFriendlyPositionAndSave" as default
469 activateFriendlyPositionAndSave->setCheck(true);
470}
471
472
473void
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);
495 }
496}
497
498
499void
501 // check options for stops
502 if (myInvalidElements.size() > 0) {
503 if (activateFriendlyPositionAndSave->getCheck() == TRUE) {
504 // begin undo list
505 myViewNet->getUndoList()->begin(GUIIcon::STOP, "change " + toString(SUMO_ATTR_FRIENDLY_POS) + " of invalid stops");
506 // iterate over invalid stops to enable friendly position
507 for (const auto& stop : myInvalidElements) {
508 stop->setAttribute(SUMO_ATTR_FRIENDLY_POS, "true", myViewNet->getUndoList());
509 }
511 } else if (fixPositionsAndSave->getCheck() == TRUE) {
512 myViewNet->getUndoList()->begin(GUIIcon::STOP, "fix positions of invalid stops");
513 // iterate over invalid stops to fix positions
514 for (const auto& stop : myInvalidElements) {
515 stop->fixDemandElementProblem();
516 }
518 } else if (selectInvalidStopsAndCancel->getCheck() == TRUE) {
519 myViewNet->getUndoList()->begin(GUIIcon::STOP, "select invalid stops");
520 // iterate over invalid stops to select all elements
521 for (const auto& stop : myInvalidElements) {
522 stop->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
523 }
524 // end undo list
526 // abort saving
527 abortSaving = true;
528 }
529 }
530}
531
532
533void
535 activateFriendlyPositionAndSave->enable();
536 fixPositionsAndSave->enable();
537 saveInvalid->enable();
538 selectInvalidStopsAndCancel->enable();
539}
540
541
542void
544 activateFriendlyPositionAndSave->disable();
545 fixPositionsAndSave->disable();
546 saveInvalid->disable();
547 selectInvalidStopsAndCancel->disable();
548}
549
550// ---------------------------------------------------------------------------
551// GNEFixDemandElements::FixPersonPlanOptions - methods
552// ---------------------------------------------------------------------------
553
555 FixOptions(fixDemandElementsParent->myRightFrame, "Person/container plans", viewNet) {
556 // Delete person plan
557 deletePersonPlan = new FXRadioButton(myLeftFrame, TL("Delete person plan"),
558 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
559 // Save invalid person plans
560 saveInvalid = new FXRadioButton(myLeftFrame, TL("Save invalid person plans"),
561 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
562 // Select invalid person plans
563 selectInvalidPersonPlansAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted person plans"),
564 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
565 // leave option "activateFriendlyPositionAndSave" as default
566 deletePersonPlan->setCheck(true);
567}
568
569
570void
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);
585 }
586}
587
588
589void
591 // check options for person plans
592 if (myInvalidElements.size() > 0) {
593 if (deletePersonPlan->getCheck() == TRUE) {
594 // begin undo list
595 myViewNet->getUndoList()->begin(GUIIcon::MODEPERSONPLAN, "delete invalid person plans");
596 // remove all invalid person plans
597 for (const auto& personPlan : myInvalidElements) {
599 }
601 } else if (selectInvalidPersonPlansAndCancel->getCheck() == TRUE) {
602 myViewNet->getUndoList()->begin(GUIIcon::MODEPERSONPLAN, "select invalid person plans");
603 // iterate over invalid person plans to select all elements
604 for (const auto& personPlan : myInvalidElements) {
605 personPlan->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
606 }
607 // end undo list
609 // abort saving
610 abortSaving = false;
611 }
612 }
613}
614
615
616void
618 deletePersonPlan->enable();
619 saveInvalid->enable();
620 selectInvalidPersonPlansAndCancel->enable();
621}
622
623
624void
626 deletePersonPlan->disable();
627 saveInvalid->disable();
628 selectInvalidPersonPlansAndCancel->disable();
629}
630
631// ---------------------------------------------------------------------------
632// GNEFixDemandElements::Buttons - methods
633// ---------------------------------------------------------------------------
634
636 FXHorizontalFrame(fixDemandElementsParent->myMainFrame, GUIDesignHorizontalFrame) {
637 new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
640 new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
641 // set focus in accept button
642 myKeepOldButton->setFocus();
643}
644
645/****************************************************************************/
FXDEFMAP(GNEFixDemandElements) GNEFixDemandElementsMap[]
@ MID_GNE_BUTTON_CANCEL
cancel button
@ MID_TABLE
The Table.
Definition GUIAppEnum.h:539
@ MID_CHOOSEN_OPERATION
set type of selection
Definition GUIAppEnum.h:597
@ MID_GNE_BUTTON_ACCEPT
accept button
#define GUIDesignRadioButtonFix
design for radio button with fixed height (used in fix elements dialogs)
Definition GUIDesigns.h:235
#define GUIDesignButtonAccept
Accept Button.
Definition GUIDesigns.h:156
#define GUIDesignButtonCancel
Cancel Button.
Definition GUIDesigns.h:162
#define GUIDesignCheckButtonFix
design for check button with fixed height (used in fix elements dialogs)
Definition GUIDesigns.h:210
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:399
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:408
#define GUIDesignTableFixElements
design for tables used in GNEFixDemandElements dialogs
Definition GUIDesigns.h:637
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:390
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
Definition GUIDesigns.h:328
#define GUIDesignDialogBoxExplicitStretchable(width, height)
design for dialog box with specific width and height that can be stretched (But not shrunk)
Definition GUIDesigns.h:617
FXString gCurrentFolder
The folder used as last.
@ MODEPERSONPLAN
@ SUPERMODEDEMAND
@ SAVE
save icons
#define WRITE_DEBUG(msg)
Definition MsgHandler.h:306
#define TL(string)
Definition MsgHandler.h:315
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_ID
int GUIDesignHeight
the default size for GUI elements
Definition StdDefs.cpp:35
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
horizontal frame for buttons
FXButton * myCancelButton
cancel button
Buttons(GNEFixDemandElements *fixDemandElementsParent)
build Position Options
FXButton * myKeepOldButton
accept button
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 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".
FXCheckButton * removeStopsOutOfRoute
Option "Remove stops out of route".
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
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
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
Dialog for edit rerouters.
FixStopPositionOptions * myFixStopPositionOptions
fix stop options
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
Definition GNENet.cpp:697
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 &currentFolder)
Returns the file name to write.
Definition MFXUtils.cpp:82
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.
Definition json.hpp:4471