73 myTextFieldJunctionID->disable();
82 if (junctionID.empty()) {
83 myTextFieldJunctionID->setText(
"");
85 myTextFieldJunctionID->setText(junctionID.c_str());
95 myCrossingFrameParent(crossingFrameParent),
125 myCrossingFrameParent->getViewNet()->updateViewNet();
127 myUseSelectedEdges->disable();
129 if (edge->isAttributeCarrierSelected()) {
130 myUseSelectedEdges->enable();
134 myClearEdgesSelection->enable();
135 myInvertEdgesSelection->enable();
144 myUseSelectedEdges->disable();
145 myClearEdgesSelection->disable();
146 myInvertEdgesSelection->disable();
148 myCrossingFrameParent->myCrossingParameters->disableCrossingParameters();
157 edge->resetCandidateFlags();
160 myCrossingFrameParent->getViewNet()->updateViewNet();
168 myCrossingFrameParent->myCrossingParameters->useSelectedEdges(
myCurrentJunction);
175 myCrossingFrameParent->myCrossingParameters->clearEdges();
192 myCrossingFrameParent(crossingFrameParent),
193 myCurrentParametersValid(true) {
194 FXHorizontalFrame* crossingParameter =
nullptr;
227 myCrossingEdgesLabel->enable();
228 myCrossingEdges->enable();
229 myCrossingPriorityLabel->enable();
232 myCrossingPriorityCheckButton->disable();
234 myCrossingPriorityCheckButton->enable();
236 myCrossingWidthLabel->enable();
237 myCrossingWidth->enable();
238 myHelpCrossingAttribute->enable();
240 onCmdSetAttribute(
nullptr, 0,
nullptr);
243 myCrossingPriorityCheckButton->setCheck(TRUE);
245 myCrossingPriorityCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(tagProperties.getDefaultValue(
SUMO_ATTR_PRIORITY)));
247 myCrossingWidth->setText(tagProperties.getDefaultValue(
SUMO_ATTR_WIDTH).c_str());
248 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
255 myCrossingEdges->setText(
"");
256 myCrossingPriorityCheckButton->setCheck(
false);
257 myCrossingPriorityCheckButton->setText(
"false");
258 myCrossingWidth->setText(
"");
260 myCrossingEdgesLabel->disable();
261 myCrossingEdges->disable();
262 myCrossingPriorityLabel->disable();
263 myCrossingPriorityCheckButton->disable();
264 myCrossingWidthLabel->disable();
265 myCrossingWidth->disable();
266 myHelpCrossingAttribute->disable();
267 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(
false);
273 return myCrossingEdgesLabel->isEnabled();
279 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
280 if (currentJunction !=
nullptr) {
284 std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
286 std::vector<std::string>::iterator itFinder = std::find(crossingEdges.begin(), crossingEdges.end(), edge->
getID());
287 if (itFinder == crossingEdges.end()) {
288 crossingEdges.push_back(edge->
getID());
290 crossingEdges.erase(itFinder);
292 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
295 onCmdSetAttribute(
nullptr, 0,
nullptr);
302 myCrossingEdges->setText(
"");
304 onCmdSetAttribute(
nullptr, 0,
nullptr);
310 std::vector<std::string> crossingEdges;
312 if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), i) == myCurrentSelectedEdges.end()) {
313 crossingEdges.push_back(i->getID());
316 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
318 onCmdSetAttribute(
nullptr, 0,
nullptr);
324 std::vector<std::string> crossingEdges;
326 if (i->isAttributeCarrierSelected()) {
327 crossingEdges.push_back(i->getID());
330 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
332 onCmdSetAttribute(
nullptr, 0,
nullptr);
338 std::vector<NBEdge*> NBEdgeVector;
340 for (
auto i : myCurrentSelectedEdges) {
341 NBEdgeVector.push_back(i->getNBEdge());
349 if (myCrossingPriorityCheckButton->getCheck()) {
359 return myCurrentParametersValid;
365 return GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text());
371 myCurrentParametersValid =
true;
373 std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
375 myCurrentSelectedEdges.clear();
377 for (
auto i : crossingEdges) {
379 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
381 if (edge ==
nullptr) {
382 myCurrentParametersValid =
false;
384 myCurrentParametersValid =
false;
387 auto itFinder = std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge);
388 if (itFinder == myCurrentSelectedEdges.end()) {
389 myCurrentSelectedEdges.push_back(edge);
391 myCurrentSelectedEdges.erase(itFinder);
396 if (myCurrentParametersValid) {
397 myCrossingEdges->setTextColor(FXRGB(0, 0, 0));
398 myCrossingEdges->killFocus();
400 myCrossingEdges->setTextColor(FXRGB(255, 0, 0));
401 myCurrentParametersValid =
false;
404 for (
const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
406 edge->resetCandidateFlags();
408 if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) != myCurrentSelectedEdges.end()) {
409 edge->setTargetCandidate(
true);
411 edge->setPossibleCandidate(
true);
415 myCrossingFrameParent->getViewNet()->updateViewNet();
418 if (crossingEdges.empty()) {
419 myCurrentParametersValid =
false;
423 if (myCrossingPriorityCheckButton->getCheck()) {
424 myCrossingPriorityCheckButton->setText(
"true");
426 myCrossingPriorityCheckButton->setText(
"false");
430 if (GNEAttributeCarrier::canParse<double>(myCrossingWidth->getText().text()) &&
431 GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text()) > 0) {
432 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
433 myCrossingWidth->killFocus();
435 myCrossingWidth->setTextColor(FXRGB(255, 0, 0));
436 myCurrentParametersValid =
false;
440 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(myCurrentParametersValid);
457 myCrossingFrameParent(crossingFrameParent) {
470 if (myCrossingFrameParent->myCrossingParameters->isCurrentParametersValid()) {
472 if (myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode()->checkCrossingDuplicated(myCrossingFrameParent->myCrossingParameters->getCrossingEdges()) ==
false) {
474 myCrossingFrameParent->myViewNet->getUndoList()->add(
new GNEChange_Crossing(myCrossingFrameParent->myEdgeSelector->getCurrentJunction(),
475 myCrossingFrameParent->myCrossingParameters->getCrossingEdges(),
476 myCrossingFrameParent->myCrossingParameters->getCrossingWidth(),
477 myCrossingFrameParent->myCrossingParameters->getCrossingPriority(),
482 myCrossingFrameParent->myEdgeSelector->onCmdClearSelection(0, 0, 0);
484 WRITE_WARNING(
"There is already another crossing with the same edges in the junction; Duplicated crossing aren't allowed.");
494 myCreateCrossingButton->enable();
496 myCreateCrossingButton->disable();
505 GNEFrame(horizontalFrameParent, viewNet,
"Crossings") {
520 FXLabel* colorCandidateLabel =
new FXLabel(groupBoxLegend,
" Candidate", 0,
GUIDesignLabelLeft);
523 FXLabel* colorSelectedLabel =
new FXLabel(groupBoxLegend,
" Selected", 0,
GUIDesignLabelLeft);
FXDEFMAP(GNECrossingFrame::EdgesSelector) EdgesSelectorMap[]
@ MID_GNE_ADDITIONALFRAME_CLEARSELECTION
clear selection of elements
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_GNE_CREATE
create element
@ MID_GNE_ADDITIONALFRAME_USESELECTED
use selected elements
@ MID_GNE_ADDITIONALFRAME_INVERTSELECTION
invert selection of eleents
@ MID_GNE_TLSFRAME_SELECT_JUNCTION
selected junction von TLS
#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 GUIDesignGroupBoxFrame
Group box design extended over frame.
#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)
static const GNETagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
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.
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::EdgesSelector * myEdgeSelector
edge selector modul
~GNECrossingFrame()
Destructor.
GNECrossingFrame::CurrentJunction * myCurrentJunction
current junction modul
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)
GNECrossingFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
A road/street connecting two junctions (netedit-version)
GNEViewNet * myViewNet
View Net.
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
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 failHard=true) const
get edge by id
const std::string & getID() const
get ID
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
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
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