66 FXDialogBox(viewNet->getApp(), ("Fix stoppingPlaces positions"),
GUIDesignDialogBoxExplicit, 0, 0, 458, 300, 0, 0, 0, 0),
68 myInvalidStoppingPlaces(invalidStoppingPlaces),
69 myInvalidDetectors(invalidDetectors) {
78 myTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
79 myTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
80 myTable->setEditable(
false);
82 myTable->clearItems();
84 myTable->setTableSize(
int(myInvalidStoppingPlaces.size() + myInvalidDetectors.size()), 3);
86 myTable->setVisibleColumns(4);
88 myTable->setColumnWidth(1, 160);
89 myTable->setColumnWidth(2, 260);
90 myTable->setColumnText(0,
"");
92 myTable->setColumnText(2,
"Conflict");
93 myTable->getRowHeader()->setWidth(0);
96 FXTableItem* item = 0;
98 for (
auto i : myInvalidStoppingPlaces) {
100 item =
new FXTableItem(
"", i->getIcon());
101 item->setIconPosition(FXTableItem::CENTER_X);
102 myTable->setItem(indexRow, 0, item);
104 item =
new FXTableItem(i->getID().c_str());
105 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
106 myTable->setItem(indexRow, 1, item);
108 std::string errorStartPosition, errorEndPosition, separator;
110 if (i->getAbsoluteStartPosition() < 0) {
114 if (i->getAbsoluteEndPosition() > i->getLane()->getLaneParametricLength()) {
118 if ((errorStartPosition.size() > 0) && (errorEndPosition.size() > 0)) {
121 item =
new FXTableItem((errorStartPosition + separator + errorEndPosition).c_str());
122 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
123 myTable->setItem(indexRow, 2, item);
128 for (
auto i : myInvalidDetectors) {
130 item =
new FXTableItem(
"", i->getIcon());
131 item->setIconPosition(FXTableItem::CENTER_X);
132 myTable->setItem(indexRow, 0, item);
134 item =
new FXTableItem(i->getID().c_str());
135 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
136 myTable->setItem(indexRow, 1, item);
138 std::string errorPosition, errorLenght, separator;
140 if (i->getAbsolutePositionOverLane() < 0) {
142 }
else if (i->getAbsolutePositionOverLane() > i->getLane()->getLaneParametricLength()) {
151 if ((errorPosition.size() > 0) && (errorLenght.size() > 0)) {
154 item =
new FXTableItem((errorPosition + separator + errorLenght).c_str());
155 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
156 myTable->setItem(indexRow, 2, item);
166 myOptionA =
new FXRadioButton(RadioButtonsLeft,
"Activate friendlyPos and save\t\tFriendly pos parameter will be activated in all stopping places and E2 detectors",
168 myOptionC =
new FXRadioButton(RadioButtonsLeft,
"Save invalid positions\t\tSave stopping places and E2 detectors with invalid positions",
172 myOptionB =
new FXRadioButton(RadioButtonsRight,
"Fix positions and save\t\tPosition of stopping places and E2 detectors will be fixed",
174 myOptionD =
new FXRadioButton(RadioButtonsRight,
"Select invalid additionals\t\tCancel saving of additionals and select invalid stopping places and E2 detectors",
177 myOptionA->setCheck(
true);
185 myAcceptButton->setFocus();
239 getApp()->stopModal(
this, TRUE);
241 }
else if (
myOptionB->getCheck() == TRUE) {
246 if (stoppingPlace != NULL) {
261 if (E2Detector != NULL) {
281 getApp()->stopModal(
this, TRUE);
283 }
else if (
myOptionC->getCheck() == TRUE) {
285 getApp()->stopModal(
this, TRUE);
287 }
else if (
myOptionD->getCheck() == TRUE) {
288 std::set<GUIGlID> GLIDsToSelect;
294 GLIDsToSelect.insert((*i)->getGlID());
298 GLIDsToSelect.insert((*i)->getGlID());
304 getApp()->stopModal(
this, FALSE);
308 getApp()->stopModal(
this, FALSE);
317 getApp()->stopModal(
this, FALSE);
#define GUIDesignTableIconCellWidth
width of cells that only contains an Icon
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
#define GUIDesignHorizontalFrame
FixStoppingPlaces dialog.
FXRadioButton * myOptionD
Option "Select invalid stops and cancel".
FXRadioButton * myOptionA
Option "Activate friendlyPos and save".
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
~GNEDialog_FixAdditionalPositions()
destructor
static bool checkAndFixDetectorPositionPosition(double &pos, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
#define GUIDesignButtonCancel
Cancel Button.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
double getAbsoluteLenght() const
get absolute lenght
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes ...
FXRadioButton * myOptionC
Option "Save invalid".
std::vector< GNEStoppingPlace * > myInvalidStoppingPlaces
vector with the invalid stoppingplaces
GNELane * getLane() const
get Lane
GNEUndoList * getUndoList() const
get the undoList object
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions ...
double getLaneParametricLength() const
returns the parameteric length of the lane
#define GUIDesignDialogBoxExplicit
design for dialog box with specift width and height (for example, additional dialogs) ...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in all GNEAttributeCarriers.
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
Dialog for edit rerouters.
#define GUIDesignTableAdditionals
design for tables used in additional dialogs
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
#define GUIDesignButtonAccept
Accept Button.
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in all GNEAttributeCarriers.
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center and height of 23 ...
GNEViewNet * myViewNet
view net
static bool fixE2DetectorPositionPosition(double &pos, double &length, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
FXRadioButton * myOptionB
Option "Fix Positions and save".
GNENet * getNet() const
get the net object
FXDEFMAP(GNEDialog_FixAdditionalPositions) GNEDialog_FixAdditionalPositionsMap[]
GNELane * getLane() const
get lane
std::vector< GNEDetector * > myInvalidDetectors
vector with the invalid stoppingplaces
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
static bool fixStoppinPlacePosition(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check if the position of an stoppingPlace over a lane is valid
#define GUIDesignRadioButton
GUISelectedStorage gSelected
A global holder of selected objects.
double getAbsolutePositionOverLane() const
get absolute position over Lane
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon