Eclipse SUMO - Simulation of Urban MObility
GNECrossingFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 // The Widget for add Crossing elements
19 /****************************************************************************/
20 #include <config.h>
21 
26 #include <netedit/GNENet.h>
27 #include <netedit/GNEViewNet.h>
28 #include <netedit/GNEUndoList.h>
29 
30 #include "GNECrossingFrame.h"
31 
32 
33 // ===========================================================================
34 // FOX callback mapping
35 // ===========================================================================
36 
41 };
42 
43 FXDEFMAP(GNECrossingFrame::CrossingParameters) CrossingParametersMap[] = {
46 };
47 
50 };
51 
52 // Object implementation
53 FXIMPLEMENT(GNECrossingFrame::EdgesSelector, FXGroupBoxModule, EdgesSelectorMap, ARRAYNUMBER(EdgesSelectorMap))
54 FXIMPLEMENT(GNECrossingFrame::CrossingParameters, FXGroupBoxModule, CrossingParametersMap, ARRAYNUMBER(CrossingParametersMap))
55 FXIMPLEMENT(GNECrossingFrame::CreateCrossing, FXGroupBoxModule, CreateCrossingMap, ARRAYNUMBER(CreateCrossingMap))
56 
57 
58 // ===========================================================================
59 // method definitions
60 // ===========================================================================
61 
62 // ---------------------------------------------------------------------------
63 // GNECrossingFrame::CurrentJunction - methods
64 // ---------------------------------------------------------------------------
65 
67  FXGroupBoxModule(crossingFrameParent->myContentFrame, "Junction") {
68  // Create frame for junction ID
69  FXHorizontalFrame* junctionIDFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
70  // create label
71  new FXLabel(junctionIDFrame, "", nullptr, GUIDesignLabelAttribute);
72  // create text field and disable it
73  myTextFieldJunctionID = new FXTextField(junctionIDFrame, GUIDesignTextFieldNCol, this, MID_GNE_TLSFRAME_SELECT_JUNCTION, GUIDesignTextField);
74  myTextFieldJunctionID->disable();
75 }
76 
77 
79 
80 
81 void
83  if (junctionID.empty()) {
84  myTextFieldJunctionID->setText("");
85  } else {
86  myTextFieldJunctionID->setText(junctionID.c_str());
87  }
88 }
89 
90 // ---------------------------------------------------------------------------
91 // GNECrossingFrame::EdgesSelector - methods
92 // ---------------------------------------------------------------------------
93 
95  FXGroupBoxModule(crossingFrameParent->myContentFrame, ("selection of " + toString(SUMO_TAG_EDGE) + "s").c_str()),
96  myCrossingFrameParent(crossingFrameParent),
97  myCurrentJunction(nullptr) {
98 
99  // Create button for selected edges
100  myUseSelectedEdges = new FXButton(getCollapsableFrame(), ("Use selected " + toString(SUMO_TAG_EDGE) + "s").c_str(), nullptr, this, MID_GNE_ADDITIONALFRAME_USESELECTED, GUIDesignButton);
101 
102  // Create button for clear selection
103  myClearEdgesSelection = new FXButton(getCollapsableFrame(), ("Clear " + toString(SUMO_TAG_EDGE) + "s").c_str(), nullptr, this, MID_GNE_ADDITIONALFRAME_CLEARSELECTION, GUIDesignButton);
104 
105  // Create button for invert selection
106  myInvertEdgesSelection = new FXButton(getCollapsableFrame(), ("Invert " + toString(SUMO_TAG_EDGE) + "s").c_str(), nullptr, this, MID_GNE_ADDITIONALFRAME_INVERTSELECTION, GUIDesignButton);
107 }
108 
109 
111 
112 
115  return myCurrentJunction;
116 }
117 
118 
119 void
121  // restore color of all lanes of edge candidates
122  restoreEdgeColors();
123  // Set current junction
124  myCurrentJunction = currentJunction;
125  // Update view net to show the new colors
126  myCrossingFrameParent->getViewNet()->updateViewNet();
127  // check if use selected eges must be enabled
128  myUseSelectedEdges->disable();
129  for (const auto& edge : myCurrentJunction->getChildEdges()) {
130  if (edge->isAttributeCarrierSelected()) {
131  myUseSelectedEdges->enable();
132  }
133  }
134  // Enable rest of elements
135  myClearEdgesSelection->enable();
136  myInvertEdgesSelection->enable();
137 }
138 
139 
140 void
142  // disable current junction
143  myCurrentJunction = nullptr;
144  // disable all elements of the EdgesSelector
145  myUseSelectedEdges->disable();
146  myClearEdgesSelection->disable();
147  myInvertEdgesSelection->disable();
148  // Disable crossing parameters
149  myCrossingFrameParent->myCrossingParameters->disableCrossingParameters();
150 }
151 
152 
153 void
155  if (myCurrentJunction != nullptr) {
156  // restore color of all lanes of edge candidates
157  for (const auto& edge : myCurrentJunction->getChildEdges()) {
158  edge->resetCandidateFlags();
159  }
160  // Update view net to show the new colors
161  myCrossingFrameParent->getViewNet()->updateViewNet();
162  myCurrentJunction = nullptr;
163  }
164 }
165 
166 
167 long
169  myCrossingFrameParent->myCrossingParameters->useSelectedEdges(myCurrentJunction);
170  return 1;
171 }
172 
173 
174 long
176  myCrossingFrameParent->myCrossingParameters->clearEdges();
177  return 1;
178 }
179 
180 
181 long
183  myCrossingFrameParent->myCrossingParameters->invertEdges(myCurrentJunction);
184  return 1;
185 }
186 
187 // ---------------------------------------------------------------------------
188 // GNECrossingFrame::NeteditAttributes- methods
189 // ---------------------------------------------------------------------------
190 
192  FXGroupBoxModule(crossingFrameParent->myContentFrame, "Crossing parameters"),
193  myCrossingFrameParent(crossingFrameParent),
194  myCrossingTemplate(nullptr),
195  myCurrentParametersValid(true) {
196  // createcrossing template
197  myCrossingTemplate = new GNECrossing(crossingFrameParent->getViewNet()->getNet());
198  FXHorizontalFrame* crossingParameter = nullptr;
199  // create label and string textField for edges
200  crossingParameter = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
201  myCrossingEdgesLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_EDGES).c_str(), nullptr, GUIDesignLabelAttribute);
202  myCrossingEdges = new FXTextField(crossingParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
203  myCrossingEdgesLabel->disable();
204  myCrossingEdges->disable();
205  // create label and checkbox for Priority
206  crossingParameter = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
207  myCrossingPriorityLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_PRIORITY).c_str(), nullptr, GUIDesignLabelAttribute);
208  myCrossingPriorityCheckButton = new FXCheckButton(crossingParameter, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
209  myCrossingPriorityLabel->disable();
211  // create label and textfield for width
212  crossingParameter = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
213  myCrossingWidthLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_WIDTH).c_str(), nullptr, GUIDesignLabelAttribute);
214  myCrossingWidth = new FXTextField(crossingParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
215  myCrossingWidthLabel->disable();
216  myCrossingWidth->disable();
217  // Create help button
218  myHelpCrossingAttribute = new FXButton(getCollapsableFrame(), "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
219  myHelpCrossingAttribute->disable();
220 }
221 
222 
224  delete myCrossingTemplate;
225 }
226 
227 
228 void
230  // obtain Tag Values
231  const auto& tagProperties = GNEAttributeCarrier::getTagProperty(SUMO_TAG_CROSSING);
232  // Enable all elements of the crossing frames
233  myCrossingEdgesLabel->enable();
234  myCrossingEdges->enable();
235  myCrossingPriorityLabel->enable();
236  // only enable priority check button if junction's crossing doesn't have TLS
237  if (hasTLS) {
238  myCrossingPriorityCheckButton->disable();
239  } else {
240  myCrossingPriorityCheckButton->enable();
241  }
242  myCrossingWidthLabel->enable();
243  myCrossingWidth->enable();
244  myHelpCrossingAttribute->enable();
245  // set values of parameters
246  onCmdSetAttribute(nullptr, 0, nullptr);
247  // Crossings placed in junctinos with TLS always has priority
248  if (hasTLS) {
249  myCrossingPriorityCheckButton->setCheck(TRUE);
250  } else {
251  myCrossingPriorityCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(tagProperties.getDefaultValue(SUMO_ATTR_PRIORITY)));
252  }
253  myCrossingWidth->setText(tagProperties.getDefaultValue(SUMO_ATTR_WIDTH).c_str());
254  myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
255 }
256 
257 
258 void
260  // clear all values of parameters
261  myCrossingEdges->setText("");
262  myCrossingPriorityCheckButton->setCheck(false);
263  myCrossingPriorityCheckButton->setText("false");
264  myCrossingWidth->setText("");
265  // Disable all elements of the crossing frames
266  myCrossingEdgesLabel->disable();
267  myCrossingEdges->disable();
268  myCrossingPriorityLabel->disable();
269  myCrossingPriorityCheckButton->disable();
270  myCrossingWidthLabel->disable();
271  myCrossingWidth->disable();
272  myHelpCrossingAttribute->disable();
273  myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(false);
274 }
275 
276 
277 bool
279  return myCrossingEdgesLabel->isEnabled();
280 }
281 
282 
283 void
285  GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
286  if (currentJunction != nullptr) {
287  // Check if edge belongs to junction's edge
288  if (std::find(currentJunction->getChildEdges().begin(), currentJunction->getChildEdges().end(), edge) != currentJunction->getChildEdges().end()) {
289  // Update text field with the new edge
290  std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
291  // Check if new edge must be added or removed
292  std::vector<std::string>::iterator itFinder = std::find(crossingEdges.begin(), crossingEdges.end(), edge->getID());
293  if (itFinder == crossingEdges.end()) {
294  crossingEdges.push_back(edge->getID());
295  } else {
296  crossingEdges.erase(itFinder);
297  }
298  myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str());
299  }
300  // Update colors and attributes
301  onCmdSetAttribute(nullptr, 0, nullptr);
302  }
303 }
304 
305 
306 void
308  myCrossingEdges->setText("");
309  // Update colors and attributes
310  onCmdSetAttribute(nullptr, 0, nullptr);
311 }
312 
313 
314 void
316  std::vector<std::string> crossingEdges;
317  for (auto i : parentJunction->getChildEdges()) {
318  if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), i) == myCurrentSelectedEdges.end()) {
319  crossingEdges.push_back(i->getID());
320  }
321  }
322  myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str());
323  // Update colors and attributes
324  onCmdSetAttribute(nullptr, 0, nullptr);
325 }
326 
327 
328 void
330  std::vector<std::string> crossingEdges;
331  for (auto i : parentJunction->getChildEdges()) {
332  if (i->isAttributeCarrierSelected()) {
333  crossingEdges.push_back(i->getID());
334  }
335  }
336  myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str());
337  // Update colors and attributes
338  onCmdSetAttribute(nullptr, 0, nullptr);
339 }
340 
341 
342 std::vector<NBEdge*>
344  std::vector<NBEdge*> NBEdgeVector;
345  // Iterate over myCurrentSelectedEdges
346  for (auto i : myCurrentSelectedEdges) {
347  NBEdgeVector.push_back(i->getNBEdge());
348  }
349  return NBEdgeVector;
350 }
351 
352 
353 bool
355  if (myCrossingPriorityCheckButton->getCheck()) {
356  return true;
357  } else {
358  return false;
359  }
360 }
361 
362 
363 bool
365  return myCurrentParametersValid;
366 }
367 
368 
369 double
371  return GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text());
372 }
373 
374 
375 long
377  myCurrentParametersValid = true;
378  // get string vector with the edges
379  std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
380  // Clear selected edges
381  myCurrentSelectedEdges.clear();
382  // iterate over vector of edge IDs
383  for (auto i : crossingEdges) {
384  GNEEdge* edge = myCrossingFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(i, false);
385  GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
386  // Check that edge exists and belongs to Junction
387  if (edge == nullptr) {
388  myCurrentParametersValid = false;
389  } else if (std::find(currentJunction->getChildEdges().begin(), currentJunction->getChildEdges().end(), edge) == currentJunction->getChildEdges().end()) {
390  myCurrentParametersValid = false;
391  } else {
392  // select or unselected edge
393  auto itFinder = std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge);
394  if (itFinder == myCurrentSelectedEdges.end()) {
395  myCurrentSelectedEdges.push_back(edge);
396  } else {
397  myCurrentSelectedEdges.erase(itFinder);
398  }
399  }
400  }
401  // change color of textfield dependig of myCurrentParametersValid
402  if (myCurrentParametersValid) {
403  myCrossingEdges->setTextColor(FXRGB(0, 0, 0));
404  myCrossingEdges->killFocus();
405  } else {
406  myCrossingEdges->setTextColor(FXRGB(255, 0, 0));
407  myCurrentParametersValid = false;
408  }
409  // Update edge colors
410  for (const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
411  // restore colors
412  edge->resetCandidateFlags();
413  // set selected or candidate color
414  if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) != myCurrentSelectedEdges.end()) {
415  edge->setTargetCandidate(true);
416  } else {
417  edge->setPossibleCandidate(true);
418  }
419  }
420  // Update view net
421  myCrossingFrameParent->getViewNet()->updateViewNet();
422 
423  // Check that at least there are a selected edge
424  if (crossingEdges.empty()) {
425  myCurrentParametersValid = false;
426  }
427 
428  // change label of crossing priority
429  if (myCrossingPriorityCheckButton->getCheck()) {
430  myCrossingPriorityCheckButton->setText("true");
431  } else {
432  myCrossingPriorityCheckButton->setText("false");
433  }
434 
435  // Check width
436  if (GNEAttributeCarrier::canParse<double>(myCrossingWidth->getText().text()) &&
437  GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text()) > 0) {
438  myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
439  myCrossingWidth->killFocus();
440  } else {
441  myCrossingWidth->setTextColor(FXRGB(255, 0, 0));
442  myCurrentParametersValid = false;
443  }
444 
445  // Enable or disable create crossing button depending of the current parameters
446  myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(myCurrentParametersValid);
447  return 0;
448 }
449 
450 
451 long
452 GNECrossingFrame::CrossingParameters::onCmdHelp(FXObject*, FXSelector, void*) {
453  myCrossingFrameParent->openHelpAttributesDialog(myCrossingTemplate);
454  return 1;
455 }
456 
457 // ---------------------------------------------------------------------------
458 // GNECrossingFrame::CreateCrossing - methods
459 // ---------------------------------------------------------------------------
460 
462  FXGroupBoxModule(crossingFrameParent->myContentFrame, "Create"),
463  myCrossingFrameParent(crossingFrameParent) {
464  // Create groupbox for create crossings
465  myCreateCrossingButton = new FXButton(getCollapsableFrame(), "Create crossing", 0, this, MID_GNE_CREATE, GUIDesignButton);
466  myCreateCrossingButton->disable();
467 }
468 
469 
471 
472 
473 long
475  // First check that current parameters are valid
476  if (myCrossingFrameParent->myCrossingParameters->isCurrentParametersValid()) {
477  // iterate over junction's crossing to find duplicated crossings
478  if (myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode()->checkCrossingDuplicated(myCrossingFrameParent->myCrossingParameters->getCrossingEdges()) == false) {
479  // create new crossing
480  myCrossingFrameParent->myViewNet->getUndoList()->add(new GNEChange_Crossing(myCrossingFrameParent->myEdgeSelector->getCurrentJunction(),
481  myCrossingFrameParent->myCrossingParameters->getCrossingEdges(),
482  myCrossingFrameParent->myCrossingParameters->getCrossingWidth(),
483  myCrossingFrameParent->myCrossingParameters->getCrossingPriority(),
484  -1, -1,
486  false, true), true);
487  // clear selected edges
488  myCrossingFrameParent->myEdgeSelector->onCmdClearSelection(0, 0, 0);
489  } else {
490  WRITE_WARNING("There is already another crossing with the same edges in the junction; Duplicated crossing aren't allowed.");
491  }
492  }
493  return 1;
494 }
495 
496 
497 void
499  if (value) {
500  myCreateCrossingButton->enable();
501  } else {
502  myCreateCrossingButton->disable();
503  }
504 }
505 
506 // ---------------------------------------------------------------------------
507 // GNECrossingFrame::Legend - methods
508 // ---------------------------------------------------------------------------
509 
511  FXGroupBoxModule(crossingFrameParent->myContentFrame, "Information") {
512  // candidate
513  FXLabel* colorCandidateLabel = new FXLabel(getCollapsableFrame(), " Candidate", 0, GUIDesignLabelLeft);
514  colorCandidateLabel->setBackColor(MFXUtils::getFXColor(crossingFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
515  colorCandidateLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
516  // selected
517  FXLabel* colorSelectedLabel = new FXLabel(getCollapsableFrame(), " Selected", 0, GUIDesignLabelLeft);
518  colorSelectedLabel->setBackColor(MFXUtils::getFXColor(crossingFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
519 }
520 
521 
523 
524 // ---------------------------------------------------------------------------
525 // GNECrossingFrame - methods
526 // ---------------------------------------------------------------------------
527 
528 GNECrossingFrame::GNECrossingFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
529  GNEFrame(horizontalFrameParent, viewNet, "Crossings") {
530  // create CurrentJunction modul
532 
533  // Create edge Selector modul
534  myEdgeSelector = new EdgesSelector(this);
535 
536  // Create CrossingParameters modul
538 
539  // create CreateCrossing modul
540  myCreateCrossing = new CreateCrossing(this);
541 
542  // create information modul
543  myInformation = new Information(this);
544 
545  // disable edge selector
547 }
548 
549 
551 }
552 
553 
554 void
556  // restore color of all lanes of edge candidates
558  // hide frame
559  GNEFrame::hide();
560 }
561 
562 
563 void
565  // If current element is a junction
566  if (objectsUnderCursor.getJunctionFront()) {
567  // change label
569  // Enable edge selector and crossing parameters
570  myEdgeSelector->enableEdgeSelector(objectsUnderCursor.getJunctionFront());
572  // clears selected edges
574  } else if (objectsUnderCursor.getEdgeFront()) {
575  // mark edge
576  myCrossingParameters->markEdge(objectsUnderCursor.getEdgeFront());
577  } else {
578  // set default label
580  // restore color of all lanes of edge candidates
582  // Disable edge selector
584  }
585  // always update view after an operation
587 }
588 
589 
590 void
593  // simply call onCmdCreateCrossing of CreateCrossing modul
595  }
596 }
597 
598 
599 /****************************************************************************/
FXDEFMAP(GNECrossingFrame::EdgesSelector) EdgesSelectorMap[]
@ MID_GNE_ADDITIONALFRAME_CLEARSELECTION
clear selection of elements
Definition: GUIAppEnum.h:1004
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:797
@ MID_GNE_CREATE
create element
Definition: GUIAppEnum.h:799
@ MID_HELP
help button
Definition: GUIAppEnum.h:600
@ MID_GNE_ADDITIONALFRAME_USESELECTED
use selected elements
Definition: GUIAppEnum.h:1000
@ MID_GNE_ADDITIONALFRAME_INVERTSELECTION
invert selection of eleents
Definition: GUIAppEnum.h:1006
@ MID_GNE_TLSFRAME_SELECT_JUNCTION
selected junction von TLS
Definition: GUIAppEnum.h:946
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:193
#define GUIDesignButton
Definition: GUIDesigns.h:68
#define GUIDesignTextField
Definition: GUIDesigns.h:42
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:343
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:217
#define GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:74
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:60
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:145
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
@ 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
@ SUMO_ATTR_PRIORITY
@ SUMO_ATTR_WIDTH
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:269
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
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.
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.
FXLabel * myCrossingEdgesLabel
Label for edges.
bool isCurrentParametersValid() const
check if current parameters are valid
FXLabel * myCrossingPriorityLabel
Label for Priority.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
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
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.
Information(GNECrossingFrame *crossingFrameParent)
constructor
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.
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.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:42
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:133
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:114
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:117
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:117
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
Definition: GNENet.cpp:125
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
GNENet * getNet() const
get the net object
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
Definition: GNEViewNet.cpp:372
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
Definition: Junction.h:34
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:112
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:319
static const PositionVector EMPTY
empty Vector
static const RGBColor WHITE
Definition: RGBColor.h:192
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element