Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2025 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
21#include <netedit/GNENet.h>
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
27
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, TL("Save list of conflicted items"),
202 SUMOXMLDefinitions::TXTFileExtensions.getMultilineString().c_str(),
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 // open message box error
217 FXMessageBox::information(myTable, MBOX_OK, "Saving successfully", "%s", "List of conflicted items was successfully saved");
218 } catch (IOError& e) {
219 // open message box error
220 FXMessageBox::error(myTable, MBOX_OK, "Saving list of conflicted items failed", "%s", e.what());
221 }
222 return true;
223}
224
225// ---------------------------------------------------------------------------
226// GNEFixDemandElements::FixRouteOptions - methods
227// ---------------------------------------------------------------------------
228
230 FixOptions(fixDemandElementsParent->myLeftFrame, "Routes", viewNet) {
231 // Remove invalid routes
232 removeInvalidRoutes = new FXRadioButton(myLeftFrame, TL("Remove invalid routes"),
233 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
234 // Save invalid routes
235 saveInvalidRoutes = new FXRadioButton(myLeftFrame, TL("Save invalid routes"),
236 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
237 // Select invalid routes
238 selectInvalidRoutesAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted routes"),
239 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
240 // Remove stops out of route
241 removeStopsOutOfRoute = new FXCheckButton(myRightFrame, TL("Remove stops out of route"),
242 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignCheckButtonFix);
243 // leave option "removeInvalidRoutes" as default
244 removeInvalidRoutes->setCheck(true);
245 // ... and remove stops out of route
246 removeStopsOutOfRoute->setCheck(TRUE);
247}
248
249
250void
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);
264 }
265}
266
267
268void
270 if (myInvalidElements.size() > 0) {
271 if (removeInvalidRoutes->getCheck() == TRUE) {
272 // begin undo list
273 myViewNet->getUndoList()->begin(GUIIcon::ROUTE, "delete invalid routes");
274 // iterate over invalid routes to delete it
275 for (const auto& invalidRoute : myInvalidElements) {
276 // special case for embedded routes
277 if (invalidRoute->getTagProperty()->getTag() == GNE_TAG_ROUTE_EMBEDDED) {
278 myViewNet->getNet()->deleteDemandElement(invalidRoute->getParentDemandElements().front(), myViewNet->getUndoList());
279 } else {
281 }
282 }
283 // end undo list
285 } else if (selectInvalidRoutesAndCancel->getCheck() == TRUE) {
286 // begin undo list
287 myViewNet->getUndoList()->begin(GUIIcon::ROUTE, "select invalid routes");
288 // iterate over invalid single lane elements to select all elements
289 for (const auto& invalidRoute : myInvalidElements) {
290 invalidRoute->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
291 }
292 // end undo list
294 // abort saving
295 abortSaving = true;
296 }
297 // check if remove stops
298 if (removeStopsOutOfRoute->getCheck() == TRUE) {
299 // get all stops to remove
300 std::vector<GNEDemandElement*> stopsToRemove;
301 for (const auto& invalidRoute : myInvalidElements) {
302 const auto invaldstops = invalidRoute->getInvalidStops();
303 // append to stopsToRemove
304 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
305 }
306 // begin undo list
307 myViewNet->getUndoList()->begin(GUIIcon::STOP, "delete invalid stops");
308 // remove all
309 for (const auto& stopToRemove : stopsToRemove) {
311 }
312 // end undo list
314 }
315 }
316}
317
318
319void
321 removeInvalidRoutes->enable();
322 saveInvalidRoutes->enable();
323 selectInvalidRoutesAndCancel->enable();
324 removeStopsOutOfRoute->enable();
325}
326
327
328void
330 removeInvalidRoutes->disable();
331 saveInvalidRoutes->disable();
332 selectInvalidRoutesAndCancel->disable();
333 removeStopsOutOfRoute->disable();
334}
335
336// ---------------------------------------------------------------------------
337// GNEFixDemandElements::FixVehicleOptions - methods
338// ---------------------------------------------------------------------------
339
341 FixOptions(fixDemandElementsParent->myLeftFrame, "Vehicles", viewNet) {
342 // Remove invalid vehicles
343 removeInvalidVehicles = new FXRadioButton(myLeftFrame, TL("Remove invalid vehicles"),
344 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
345 // Save invalid vehicles
346 saveInvalidVehicles = new FXRadioButton(myLeftFrame, TL("Save invalid vehicles"),
347 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
348 // Select invalid vehicle
349 selectInvalidVehiclesAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted vehicle"),
350 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
351 // Remove stops out of route
352 removeStopsOutOfVehicle = new FXCheckButton(myRightFrame, TL("Remove stops out of vehicle's route"),
353 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignCheckButtonFix);
354 // by default remove invalid vehicles
355 removeInvalidVehicles->setCheck(TRUE);
356 // ... and remove stops out of route
357 removeStopsOutOfVehicle->setCheck(TRUE);
358}
359
360
361void
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);
375 }
376}
377
378
379void
381 if (myInvalidElements.size() > 0) {
382 if (removeInvalidVehicles->getCheck() == TRUE) {
383 // begin undo list
384 myViewNet->getUndoList()->begin(GUIIcon::VEHICLE, "delete invalid vehicles");
385 // iterate over invalid vehicles to delete it
386 for (const auto& invalidVehicle : myInvalidElements) {
388 }
389 // end undo list
391 } else if (selectInvalidVehiclesAndCancel->getCheck() == TRUE) {
392 // begin undo list
393 myViewNet->getUndoList()->begin(GUIIcon::ROUTE, "select invalid routes");
394 // iterate over invalid single lane elements to select all elements
395 for (const auto& invalidVehicle : myInvalidElements) {
396 invalidVehicle->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
397 }
398 // end undo list
400 // abort saving
401 abortSaving = true;
402 }
403 // check if remove stops
404 if (removeStopsOutOfVehicle->getCheck() == TRUE) {
405 // get all stops to remove
406 std::vector<GNEDemandElement*> stopsToRemove;
407 for (const auto& invalidVehicle : myInvalidElements) {
408 const auto invaldstops = invalidVehicle->getInvalidStops();
409 // append to stopsToRemove
410 stopsToRemove.insert(stopsToRemove.end(), invaldstops.begin(), invaldstops.end());
411 }
412 // begin undo list
413 myViewNet->getUndoList()->begin(GUIIcon::STOP, "delete invalid stops");
414 // remove all
415 for (const auto& stopToRemove : stopsToRemove) {
417 }
418 // end undo list
420 }
421 }
422}
423
424
425void
427 removeInvalidVehicles->enable();
428 saveInvalidVehicles->enable();
429 selectInvalidVehiclesAndCancel->enable();
430 removeStopsOutOfVehicle->enable();
431}
432
433
434void
436 removeInvalidVehicles->disable();
437 saveInvalidVehicles->disable();
438 selectInvalidVehiclesAndCancel->disable();
439 removeStopsOutOfVehicle->disable();
440}
441
442// ---------------------------------------------------------------------------
443// GNEFixDemandElements::FixStopPositionOptions - methods
444// ---------------------------------------------------------------------------
445
447 FixOptions(fixDemandElementsParent->myRightFrame, "Stop positions", viewNet) {
448 // Activate friendlyPos and save
449 activateFriendlyPositionAndSave = new FXRadioButton(myLeftFrame, TL("Activate friendlyPos and save"),
450 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
451 // Save invalid position
452 saveInvalid = new FXRadioButton(myLeftFrame, TL("Save invalid positions"),
453 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
454 // Select invalid Stops
455 selectInvalidStopsAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted Stops"),
456 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
457 // Fix positions and save
458 fixPositionsAndSave = new FXRadioButton(myRightFrame, TL("Fix positions and save"),
459 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
460 // leave option "activateFriendlyPositionAndSave" as default
461 activateFriendlyPositionAndSave->setCheck(true);
462}
463
464
465void
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);
487 }
488}
489
490
491void
493 // check options for stops
494 if (myInvalidElements.size() > 0) {
495 if (activateFriendlyPositionAndSave->getCheck() == TRUE) {
496 // begin undo list
497 myViewNet->getUndoList()->begin(GUIIcon::STOP, "change " + toString(SUMO_ATTR_FRIENDLY_POS) + " of invalid stops");
498 // iterate over invalid stops to enable friendly position
499 for (const auto& stop : myInvalidElements) {
500 stop->setAttribute(SUMO_ATTR_FRIENDLY_POS, "true", myViewNet->getUndoList());
501 }
503 } else if (fixPositionsAndSave->getCheck() == TRUE) {
504 myViewNet->getUndoList()->begin(GUIIcon::STOP, "fix positions of invalid stops");
505 // iterate over invalid stops to fix positions
506 for (const auto& stop : myInvalidElements) {
507 stop->fixDemandElementProblem();
508 }
510 } else if (selectInvalidStopsAndCancel->getCheck() == TRUE) {
511 myViewNet->getUndoList()->begin(GUIIcon::STOP, "select invalid stops");
512 // iterate over invalid stops to select all elements
513 for (const auto& stop : myInvalidElements) {
514 stop->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
515 }
516 // end undo list
518 // abort saving
519 abortSaving = true;
520 }
521 }
522}
523
524
525void
527 activateFriendlyPositionAndSave->enable();
528 fixPositionsAndSave->enable();
529 saveInvalid->enable();
530 selectInvalidStopsAndCancel->enable();
531}
532
533
534void
536 activateFriendlyPositionAndSave->disable();
537 fixPositionsAndSave->disable();
538 saveInvalid->disable();
539 selectInvalidStopsAndCancel->disable();
540}
541
542// ---------------------------------------------------------------------------
543// GNEFixDemandElements::FixPersonPlanOptions - methods
544// ---------------------------------------------------------------------------
545
547 FixOptions(fixDemandElementsParent->myRightFrame, "Person/container plans", viewNet) {
548 // Delete person plan
549 deletePersonPlan = new FXRadioButton(myLeftFrame, TL("Delete person plan"),
550 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
551 // Save invalid person plans
552 saveInvalid = new FXRadioButton(myLeftFrame, TL("Save invalid person plans"),
553 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
554 // Select invalid person plans
555 selectInvalidPersonPlansAndCancel = new FXRadioButton(myRightFrame, TL("Select conflicted person plans"),
556 fixDemandElementsParent, MID_CHOOSEN_OPERATION, GUIDesignRadioButtonFix);
557 // leave option "activateFriendlyPositionAndSave" as default
558 deletePersonPlan->setCheck(true);
559}
560
561
562void
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);
577 }
578}
579
580
581void
583 // check options for person plans
584 if (myInvalidElements.size() > 0) {
585 if (deletePersonPlan->getCheck() == TRUE) {
586 // begin undo list
587 myViewNet->getUndoList()->begin(GUIIcon::MODEPERSONPLAN, "delete invalid person plans");
588 // remove all invalid person plans
589 for (const auto& personPlan : myInvalidElements) {
591 }
593 } else if (selectInvalidPersonPlansAndCancel->getCheck() == TRUE) {
594 myViewNet->getUndoList()->begin(GUIIcon::MODEPERSONPLAN, "select invalid person plans");
595 // iterate over invalid person plans to select all elements
596 for (const auto& personPlan : myInvalidElements) {
597 personPlan->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
598 }
599 // end undo list
601 // abort saving
602 abortSaving = false;
603 }
604 }
605}
606
607
608void
610 deletePersonPlan->enable();
611 saveInvalid->enable();
612 selectInvalidPersonPlansAndCancel->enable();
613}
614
615
616void
618 deletePersonPlan->disable();
619 saveInvalid->disable();
620 selectInvalidPersonPlansAndCancel->disable();
621}
622
623// ---------------------------------------------------------------------------
624// GNEFixDemandElements::Buttons - methods
625// ---------------------------------------------------------------------------
626
628 FXHorizontalFrame(fixDemandElementsParent->myMainFrame, GUIDesignHorizontalFrame) {
629 new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
632 new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
633 // set focus in accept button
634 myKeepOldButton->setFocus();
635}
636
637/****************************************************************************/
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 TL(string)
Definition MsgHandler.h:305
@ 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:748
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 &currentFolder)
Returns the file name to write.
Definition MFXUtils.cpp:116
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.
Definition json.hpp:4471