61 FXDialogBox(viewNet->getApp(), ("Fix stoppingPlaces positions"),
GUIDesignDialogBoxExplicit, 0, 0, 458, 300, 0, 0, 0, 0),
63 myInvalidStoppingPlaces(invalidStoppingPlaces),
64 myInvalidDetectors(invalidDetectors) {
73 myTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
74 myTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
75 myTable->setEditable(
false);
77 myTable->clearItems();
79 myTable->setTableSize(
int(myInvalidStoppingPlaces.size() + myInvalidDetectors.size()), 3);
81 myTable->setVisibleColumns(4);
83 myTable->setColumnWidth(1, 160);
84 myTable->setColumnWidth(2, 260);
85 myTable->setColumnText(0,
"");
87 myTable->setColumnText(2,
"Conflict");
88 myTable->getRowHeader()->setWidth(0);
91 FXTableItem* item = 0;
93 for (
auto i : myInvalidStoppingPlaces) {
95 item =
new FXTableItem(
"", i->getIcon());
96 item->setIconPosition(FXTableItem::CENTER_X);
97 myTable->setItem(indexRow, 0, item);
99 item =
new FXTableItem(i->getID().c_str());
100 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
101 myTable->setItem(indexRow, 1, item);
103 std::string errorStartPosition, errorEndPosition, separator;
105 if (i->getStartPosition() < 0) {
109 if (i->getEndPosition() > i->getLane()->getParentEdge().getNBEdge()->getFinalLength()) {
113 if ((errorStartPosition.size() > 0) && (errorEndPosition.size() > 0)) {
116 item =
new FXTableItem((errorStartPosition + separator + errorEndPosition).c_str());
117 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
118 myTable->setItem(indexRow, 2, item);
123 for (
auto i : myInvalidDetectors) {
125 item =
new FXTableItem(
"", i->getIcon());
126 item->setIconPosition(FXTableItem::CENTER_X);
127 myTable->setItem(indexRow, 0, item);
129 item =
new FXTableItem(i->getID().c_str());
130 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
131 myTable->setItem(indexRow, 1, item);
133 std::string errorPosition, errorLenght, separator;
135 if (i->getPositionOverLane() < 0) {
137 }
else if (i->getPositionOverLane() > i->getLane()->getParentEdge().getNBEdge()->getFinalLength()) {
141 if ((E2Detector !=
nullptr) && ((E2Detector->
getPositionOverLane() + E2Detector->
getLength()) > i->getLane()->getParentEdge().getNBEdge()->getFinalLength())) {
146 if ((errorPosition.size() > 0) && (errorLenght.size() > 0)) {
149 item =
new FXTableItem((errorPosition + separator + errorLenght).c_str());
150 item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y);
151 myTable->setItem(indexRow, 2, item);
161 myOptionA =
new FXRadioButton(RadioButtonsLeft,
"Activate friendlyPos and save\t\tFriendly pos parameter will be activated in all stopping places and E2 detectors",
163 myOptionC =
new FXRadioButton(RadioButtonsLeft,
"Save invalid positions\t\tSave stopping places and E2 detectors with invalid positions",
167 myOptionB =
new FXRadioButton(RadioButtonsRight,
"Fix positions and save\t\tPosition of stopping places and E2 detectors will be fixed",
169 myOptionD =
new FXRadioButton(RadioButtonsRight,
"Select invalid additionals\t\tCancel saving of additionals and select invalid stopping places and E2 detectors",
172 myOptionA->setCheck(
true);
180 myAcceptButton->setFocus();
234 getApp()->stopModal(
this, TRUE);
236 }
else if (
myOptionB->getCheck() == TRUE) {
241 if (stoppingPlace !=
nullptr) {
256 if (E2Detector !=
nullptr) {
276 getApp()->stopModal(
this, TRUE);
278 }
else if (
myOptionC->getCheck() == TRUE) {
280 getApp()->stopModal(
this, TRUE);
282 }
else if (
myOptionD->getCheck() == TRUE) {
283 std::set<GUIGlID> GLIDsToSelect;
290 getApp()->stopModal(
this, FALSE);
294 getApp()->stopModal(
this, FALSE);
303 getApp()->stopModal(
this, FALSE);
#define GUIDesignTableIconCellWidth
width of cells that only contains an Icon
#define GUIDesignHorizontalFrame
double getPositionOverLane() const
get position over lane
static bool fixStoppinPlacePosition(std::string &startPos, std::string &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check if the position of an stoppingPlace over a lane is valid
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...
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
FixStoppingPlaces dialog.
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)
GNEEdge & getParentEdge()
Returns underlying parent edge.
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
#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 ...
double getFinalLength() const
get length that will be assigned to the lanes in the final network
#define GUIDesignButtonAccept
Accept Button.
std::string getAttribute(SumoXMLAttr key) const
double getLength() const
get length of E2 Detector
#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".
FXDEFMAP(GNEDialog_FixAdditionalPositions) GNEDialog_FixAdditionalPositionsMap[]
GNELane * getLane() const
get lane
std::vector< GNEDetector * > myInvalidDetectors
vector with the invalid stoppingplaces
NBEdge * getNBEdge()
returns the internal NBEdge
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
#define GUIDesignRadioButton
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon