76 myTextFieldJunctionID->disable();
85 if (junctionID.empty()) {
86 myTextFieldJunctionID->setText(
"");
88 myTextFieldJunctionID->setText(junctionID.c_str());
98 myCrossingFrameParent(crossingFrameParent),
128 myCrossingFrameParent->getViewNet()->updateViewNet();
130 myUseSelectedEdges->disable();
132 if (edge->isAttributeCarrierSelected()) {
133 myUseSelectedEdges->enable();
137 myClearEdgesSelection->enable();
138 myInvertEdgesSelection->enable();
147 myUseSelectedEdges->disable();
148 myClearEdgesSelection->disable();
149 myInvertEdgesSelection->disable();
151 myCrossingFrameParent->myCrossingParameters->disableCrossingParameters();
160 edge->resetCandidateFlags();
163 myCrossingFrameParent->getViewNet()->updateViewNet();
171 myCrossingFrameParent->myCrossingParameters->useSelectedEdges(
myCurrentJunction);
178 myCrossingFrameParent->myCrossingParameters->clearEdges();
195 myCrossingFrameParent(crossingFrameParent),
196 myCrossingTemplate(nullptr),
197 myCurrentParametersValid(true) {
200 FXHorizontalFrame* crossingParameter =
nullptr;
226 delete myCrossingTemplate;
235 myCrossingEdgesLabel->enable();
236 myCrossingEdges->enable();
237 myCrossingPriorityLabel->enable();
240 myCrossingPriorityCheckButton->disable();
242 myCrossingPriorityCheckButton->enable();
244 myCrossingWidthLabel->enable();
245 myCrossingWidth->enable();
246 myHelpCrossingAttribute->enable();
248 onCmdSetAttribute(
nullptr, 0,
nullptr);
251 myCrossingPriorityCheckButton->setCheck(TRUE);
253 myCrossingPriorityCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(tagProperties.getDefaultValue(
SUMO_ATTR_PRIORITY)));
255 myCrossingWidth->setText(tagProperties.getDefaultValue(
SUMO_ATTR_WIDTH).c_str());
256 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
263 myCrossingEdges->setText(
"");
264 myCrossingPriorityCheckButton->setCheck(
false);
265 myCrossingPriorityCheckButton->setText(
TL(
"false"));
266 myCrossingWidth->setText(
"");
268 myCrossingEdgesLabel->disable();
269 myCrossingEdges->disable();
270 myCrossingPriorityLabel->disable();
271 myCrossingPriorityCheckButton->disable();
272 myCrossingWidthLabel->disable();
273 myCrossingWidth->disable();
274 myHelpCrossingAttribute->disable();
275 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(
false);
281 return myCrossingEdgesLabel->isEnabled();
287 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
288 if (currentJunction !=
nullptr) {
292 std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
294 std::vector<std::string>::iterator itFinder = std::find(crossingEdges.begin(), crossingEdges.end(), edge->
getID());
295 if (itFinder == crossingEdges.end()) {
296 crossingEdges.push_back(edge->
getID());
298 crossingEdges.erase(itFinder);
300 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
303 onCmdSetAttribute(
nullptr, 0,
nullptr);
310 myCrossingEdges->setText(
"");
312 onCmdSetAttribute(
nullptr, 0,
nullptr);
318 std::vector<std::string> crossingEdges;
320 if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), i) == myCurrentSelectedEdges.end()) {
321 crossingEdges.push_back(i->getID());
324 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
326 onCmdSetAttribute(
nullptr, 0,
nullptr);
332 std::vector<std::string> crossingEdges;
334 if (i->isAttributeCarrierSelected()) {
335 crossingEdges.push_back(i->getID());
338 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
340 onCmdSetAttribute(
nullptr, 0,
nullptr);
346 std::vector<NBEdge*> NBEdgeVector;
348 for (
auto i : myCurrentSelectedEdges) {
349 NBEdgeVector.push_back(i->getNBEdge());
357 if (myCrossingPriorityCheckButton->getCheck()) {
367 return myCurrentParametersValid;
373 return GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text());
379 myCurrentParametersValid =
true;
381 std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
383 myCurrentSelectedEdges.clear();
385 for (
auto i : crossingEdges) {
387 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
389 if (edge ==
nullptr) {
390 myCurrentParametersValid =
false;
392 myCurrentParametersValid =
false;
395 auto itFinder = std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge);
396 if (itFinder == myCurrentSelectedEdges.end()) {
397 myCurrentSelectedEdges.push_back(edge);
399 myCurrentSelectedEdges.erase(itFinder);
404 if (myCurrentParametersValid) {
405 myCrossingEdges->setTextColor(FXRGB(0, 0, 0));
406 myCrossingEdges->killFocus();
408 myCrossingEdges->setTextColor(FXRGB(255, 0, 0));
409 myCurrentParametersValid =
false;
412 for (
const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
414 edge->resetCandidateFlags();
416 if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) != myCurrentSelectedEdges.end()) {
417 edge->setTargetCandidate(
true);
419 edge->setPossibleCandidate(
true);
423 myCrossingFrameParent->getViewNet()->updateViewNet();
426 if (crossingEdges.empty()) {
427 myCurrentParametersValid =
false;
431 if (myCrossingPriorityCheckButton->getCheck()) {
432 myCrossingPriorityCheckButton->setText(
TL(
"true"));
434 myCrossingPriorityCheckButton->setText(
TL(
"false"));
438 if (GNEAttributeCarrier::canParse<double>(myCrossingWidth->getText().text()) &&
439 GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text()) > 0) {
440 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
441 myCrossingWidth->killFocus();
443 myCrossingWidth->setTextColor(FXRGB(255, 0, 0));
444 myCurrentParametersValid =
false;
448 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(myCurrentParametersValid);
455 myCrossingFrameParent->openHelpAttributesDialog(myCrossingTemplate);
465 myCrossingFrameParent(crossingFrameParent) {
478 if (myCrossingFrameParent->myCrossingParameters->isCurrentParametersValid()) {
480 if (myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode()->checkCrossingDuplicated(myCrossingFrameParent->myCrossingParameters->getCrossingEdges()) ==
false) {
482 myCrossingFrameParent->myViewNet->getUndoList()->add(
new GNEChange_Crossing(myCrossingFrameParent->myEdgeSelector->getCurrentJunction(),
483 myCrossingFrameParent->myCrossingParameters->getCrossingEdges(),
484 myCrossingFrameParent->myCrossingParameters->getCrossingWidth(),
485 myCrossingFrameParent->myCrossingParameters->getCrossingPriority(),
490 myCrossingFrameParent->myEdgeSelector->onCmdClearSelection(0, 0, 0);
492 myCrossingFrameParent->getViewNet()->getViewParent()->getCreateEdgeFrame()->getEdgeTypeSelector()->enableCheckBoxDisablePedestrians();
494 WRITE_WARNING(
TL(
"There is already another crossing with the same edges in the junction; Duplicated crossing aren't allowed."));
504 myCreateCrossingButton->enable();
506 myCreateCrossingButton->disable();
533 GNEFrame(viewParent, viewNet,
"Crossings") {
FXDEFMAP(GNECrossingFrame::EdgesSelector) EdgesSelectorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_GNE_CLEARSELECTION
clear selection of elements
@ MID_GNE_USESELECTED
use selected elements
@ MID_GNE_CREATE
create element
@ MID_GNE_SELECT
select element
@ MID_GNE_INVERTSELECTION
invert selection of elements
#define GUIDesignLabelLeft
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
#define GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define WRITE_WARNING(msg)
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_EDGES
the edges of a route
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string getID() const
get ID (all Attribute Carriers have one)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
void setCreateCrossingButton(bool value)
enable or disable button create crossing
CreateCrossing(GNECrossingFrame *crossingFrameParent)
FOX-declaration.
~CreateCrossing()
destructor
FXButton * myCreateCrossingButton
@field FXButton for create Crossing
long onCmdCreateCrossing(FXObject *, FXSelector, void *)
void enableCrossingParameters(bool hasTLS)
enable crossing parameters and set the default value of parameters
std::vector< NBEdge * > getCrossingEdges() const
get crossing NBedges
double getCrossingWidth() const
get crossing width
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
FXLabel * myCrossingWidthLabel
Label for width.
void markEdge(GNEEdge *edge)
mark or dismark edge
bool getCrossingPriority() const
get crossing priority
CrossingParameters(GNECrossingFrame *crossingFrameParent)
FOX-declaration.
void disableCrossingParameters()
disable crossing parameters and clear parameters
FXTextField * myCrossingWidth
TextField for width.
void useSelectedEdges(GNEJunction *parentJunction)
use selected eges
void invertEdges(GNEJunction *parentJunction)
invert edges
bool isCrossingParametersEnabled() const
check if currently the CrossingParameters is enabled
FXButton * myHelpCrossingAttribute
button for help
FXTextField * myCrossingEdges
TextField for edges.
GNECrossing * myCrossingTemplate
crossing template
FXCheckButton * myCrossingPriorityCheckButton
CheckBox for Priority.
void clearEdges()
clear edges
FXLabel * myCrossingEdgesLabel
Label for edges.
bool isCurrentParametersValid() const
check if current parameters are valid
FXLabel * myCrossingPriorityLabel
Label for Priority.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
~CrossingParameters()
destructor
~CurrentJunction()
destructor
void updateCurrentJunctionLabel(const std::string &junctionID)
set current junction label
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
EdgesSelector(GNECrossingFrame *crossingFrameParent)
FOX-declaration.
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
~EdgesSelector()
destructor
FXButton * myInvertEdgesSelection
button for invert selection
GNEJunction * getCurrentJunction() const
get current junction
FXButton * myClearEdgesSelection
button for clear selection
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
void restoreEdgeColors()
restore colors of all edges
void enableEdgeSelector(GNEJunction *currentJunction)
enable edgeSelector
void disableEdgeSelector()
disable edgeSelector
FXButton * myUseSelectedEdges
CheckBox for selected edges.
GNECrossingFrame::CreateCrossing * myCreateCrossing
create crossing modul
GNECrossingFrame::Information * myInformation
information modul
GNECrossingFrame::EdgesSelector * myEdgeSelector
edge selector modul
~GNECrossingFrame()
Destructor.
GNECrossingFrame::CurrentJunction * myCurrentJunction
FOX need this.
GNECrossingFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
void hide()
hide crossing frame
GNECrossingFrame::CrossingParameters * myCrossingParameters
crossing parameters modul
void addCrossing(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
add Crossing element
void createCrossingHotkey()
create crossing (used when user press ENTER key in Crossing mode)
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
A road/street connecting two junctions (netedit-version)
GNEViewNet * getViewNet() const
get view net
GNEViewNet * myViewNet
FOX need this.
virtual void hide()
hide Frame
const std::vector< GNEEdge * > & getChildEdges() const
get child edges
NBNode * getNBNode() const
Return net build node.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
class used to group all variables related with objects under cursor after a click over view
GNEJunction * getJunctionFront() const
get front junction or a pointer to nullptr
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNENet * getNet() const
get the net object
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
A single child window which contains a view of the simulation area.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
bool isTLControlled() const
Returns whether this node is controlled by any tls.
static const PositionVector EMPTY
empty Vector
static const RGBColor WHITE
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element