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.dev/sumo
3 // Copyright (C) 2001-2024 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 
28 #include <netedit/GNENet.h>
29 #include <netedit/GNEViewNet.h>
30 #include <netedit/GNEViewParent.h>
31 #include <netedit/GNEUndoList.h>
32 
33 #include "GNECrossingFrame.h"
34 
35 
36 // ===========================================================================
37 // FOX callback mapping
38 // ===========================================================================
39 
44 };
45 
46 FXDEFMAP(GNECrossingFrame::CrossingParameters) CrossingParametersMap[] = {
49 };
50 
53 };
54 
55 // Object implementation
56 FXIMPLEMENT(GNECrossingFrame::EdgesSelector, MFXGroupBoxModule, EdgesSelectorMap, ARRAYNUMBER(EdgesSelectorMap))
57 FXIMPLEMENT(GNECrossingFrame::CrossingParameters, MFXGroupBoxModule, CrossingParametersMap, ARRAYNUMBER(CrossingParametersMap))
58 FXIMPLEMENT(GNECrossingFrame::CreateCrossing, MFXGroupBoxModule, CreateCrossingMap, ARRAYNUMBER(CreateCrossingMap))
59 
60 
61 // ===========================================================================
62 // method definitions
63 // ===========================================================================
64 
65 // ---------------------------------------------------------------------------
66 // GNECrossingFrame::CurrentJunction - methods
67 // ---------------------------------------------------------------------------
68 
70  MFXGroupBoxModule(crossingFrameParent, TL("Junction")) {
71  // Create frame for junction ID
72  FXHorizontalFrame* junctionIDFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
73  // create label
74  new FXLabel(junctionIDFrame, "", nullptr, GUIDesignLabelThickedFixed(100));
75  // create text field and disable it
76  myTextFieldJunctionID = new FXTextField(junctionIDFrame, GUIDesignTextFieldNCol, this, MID_GNE_SELECT, GUIDesignTextField);
77  myTextFieldJunctionID->disable();
78 }
79 
80 
82 
83 
84 void
86  if (junctionID.empty()) {
87  myTextFieldJunctionID->setText("");
88  } else {
89  myTextFieldJunctionID->setText(junctionID.c_str());
90  }
91 }
92 
93 // ---------------------------------------------------------------------------
94 // GNECrossingFrame::EdgesSelector - methods
95 // ---------------------------------------------------------------------------
96 
98  MFXGroupBoxModule(crossingFrameParent, TL("selection of edges")),
99  myCrossingFrameParent(crossingFrameParent),
100  myCurrentJunction(nullptr) {
101 
102  // Create button for selected edges
103  myUseSelectedEdges = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Use selected edges"), "", "", nullptr, this, MID_GNE_USESELECTED, GUIDesignButton);
104 
105  // Create button for clear selection
107 
108  // Create button for invert selection
110 }
111 
112 
114 
115 
118  return myCurrentJunction;
119 }
120 
121 
122 void
124  // restore color of all lanes of edge candidates
125  restoreEdgeColors();
126  // Set current junction
127  myCurrentJunction = currentJunction;
128  // Update view net to show the new colors
129  myCrossingFrameParent->getViewNet()->updateViewNet();
130  // check if use selected eges must be enabled
131  myUseSelectedEdges->disable();
132  for (const auto& edge : myCurrentJunction->getChildEdges()) {
133  if (edge->isAttributeCarrierSelected()) {
134  myUseSelectedEdges->enable();
135  }
136  }
137  // Enable rest of elements
138  myClearEdgesSelection->enable();
139  myInvertEdgesSelection->enable();
140 }
141 
142 
143 void
145  // disable current junction
146  myCurrentJunction = nullptr;
147  // disable all elements of the EdgesSelector
148  myUseSelectedEdges->disable();
149  myClearEdgesSelection->disable();
150  myInvertEdgesSelection->disable();
151  // Disable crossing parameters
152  myCrossingFrameParent->myCrossingParameters->disableCrossingParameters();
153  // Update view net to show the new colors
154  myCrossingFrameParent->getViewNet()->updateViewNet();
155 }
156 
157 
158 void
160  if (myCurrentJunction != nullptr) {
161  // restore color of all lanes of edge candidates
162  for (const auto& edge : myCurrentJunction->getChildEdges()) {
163  edge->resetCandidateFlags();
164  }
165  // Update view net to show the new colors
166  myCrossingFrameParent->getViewNet()->updateViewNet();
167  myCurrentJunction = nullptr;
168  }
169 }
170 
171 
172 long
174  myCrossingFrameParent->myCrossingParameters->useSelectedEdges(myCurrentJunction);
175  return 1;
176 }
177 
178 
179 long
181  myCrossingFrameParent->myCrossingParameters->clearEdges();
182  return 1;
183 }
184 
185 
186 long
188  myCrossingFrameParent->myCrossingParameters->invertEdges(myCurrentJunction);
189  return 1;
190 }
191 
192 // ---------------------------------------------------------------------------
193 // GNECrossingFrame::GNENeteditAttributes- methods
194 // ---------------------------------------------------------------------------
195 
197  MFXGroupBoxModule(crossingFrameParent, TL("Crossing parameters")),
198  myCrossingFrameParent(crossingFrameParent),
199  myCrossingTemplate(nullptr),
200  myCurrentParametersValid(true) {
201  // createcrossing template
202  myCrossingTemplate = new GNECrossing(crossingFrameParent->getViewNet()->getNet());
203  FXHorizontalFrame* crossingParameter = nullptr;
204  // create label and string textField for edges
205  crossingParameter = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
206  myCrossingEdgesLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_EDGES).c_str(), nullptr, GUIDesignLabelThickedFixed(100));
207  myCrossingEdges = new FXTextField(crossingParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
208  myCrossingEdgesLabel->disable();
209  myCrossingEdges->disable();
210  // create label and checkbox for Priority
211  crossingParameter = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
212  myCrossingPriorityLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_PRIORITY).c_str(), nullptr, GUIDesignLabelThickedFixed(100));
213  myCrossingPriorityCheckButton = new FXCheckButton(crossingParameter, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
214  myCrossingPriorityLabel->disable();
216  // create label and textfield for width
217  crossingParameter = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
218  myCrossingWidthLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_WIDTH).c_str(), nullptr, GUIDesignLabelThickedFixed(100));
219  myCrossingWidth = new FXTextField(crossingParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
220  myCrossingWidthLabel->disable();
221  myCrossingWidth->disable();
222  // Create help button
224  myHelpCrossingAttribute->disable();
225 }
226 
227 
229  delete myCrossingTemplate;
230 }
231 
232 
233 void
235  // obtain Tag Values
236  const auto& tagProperties = GNEAttributeCarrier::getTagProperty(SUMO_TAG_CROSSING);
237  // Enable all elements of the crossing frames
238  myCrossingEdgesLabel->enable();
239  myCrossingEdges->enable();
240  myCrossingPriorityLabel->enable();
241  // only enable priority check button if junction's crossing doesn't have TLS
242  if (hasTLS) {
243  myCrossingPriorityCheckButton->disable();
244  } else {
245  myCrossingPriorityCheckButton->enable();
246  }
247  myCrossingWidthLabel->enable();
248  myCrossingWidth->enable();
249  myHelpCrossingAttribute->enable();
250  // set values of parameters
251  onCmdSetAttribute(nullptr, 0, nullptr);
252  // Crossings placed in junctinos with TLS always has priority
253  if (hasTLS) {
254  myCrossingPriorityCheckButton->setCheck(TRUE);
255  } else {
256  myCrossingPriorityCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(tagProperties.getDefaultValue(SUMO_ATTR_PRIORITY)));
257  }
258  myCrossingWidth->setText(tagProperties.getDefaultValue(SUMO_ATTR_WIDTH).c_str());
259  myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
260 }
261 
262 
263 void
265  // clear all values of parameters
266  myCrossingEdges->setText("");
267  myCrossingPriorityCheckButton->setCheck(false);
268  myCrossingPriorityCheckButton->setText("false");
269  myCrossingWidth->setText("");
270  // Disable all elements of the crossing frames
271  myCrossingEdgesLabel->disable();
272  myCrossingEdges->disable();
273  myCrossingPriorityLabel->disable();
274  myCrossingPriorityCheckButton->disable();
275  myCrossingWidthLabel->disable();
276  myCrossingWidth->disable();
277  myHelpCrossingAttribute->disable();
278  myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(false);
279 }
280 
281 
282 bool
284  return myCrossingEdgesLabel->isEnabled();
285 }
286 
287 
288 void
290  GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
291  if (currentJunction != nullptr) {
292  // Check if edge belongs to junction's edge
293  if (std::find(currentJunction->getChildEdges().begin(), currentJunction->getChildEdges().end(), edge) != currentJunction->getChildEdges().end()) {
294  // Update text field with the new edge
295  std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
296  // Check if new edge must be added or removed
297  std::vector<std::string>::iterator itFinder = std::find(crossingEdges.begin(), crossingEdges.end(), edge->getID());
298  if (itFinder == crossingEdges.end()) {
299  crossingEdges.push_back(edge->getID());
300  } else {
301  crossingEdges.erase(itFinder);
302  }
303  myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str());
304  }
305  // Update colors and attributes
306  onCmdSetAttribute(nullptr, 0, nullptr);
307  }
308 }
309 
310 
311 void
313  myCrossingEdges->setText("");
314  // Update colors and attributes
315  onCmdSetAttribute(nullptr, 0, nullptr);
316 }
317 
318 
319 void
321  std::vector<std::string> crossingEdges;
322  for (const auto& edge : parentJunction->getChildEdges()) {
323  if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) == myCurrentSelectedEdges.end()) {
324  crossingEdges.push_back(edge->getID());
325  }
326  }
327  myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str());
328  // Update colors and attributes
329  onCmdSetAttribute(nullptr, 0, nullptr);
330 }
331 
332 
333 void
335  std::vector<std::string> crossingEdges;
336  for (const auto& edge : parentJunction->getChildEdges()) {
337  if (edge->isAttributeCarrierSelected()) {
338  crossingEdges.push_back(edge->getID());
339  }
340  }
341  myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str());
342  // Update colors and attributes
343  onCmdSetAttribute(nullptr, 0, nullptr);
344 }
345 
346 
347 std::vector<NBEdge*>
349  std::vector<NBEdge*> NBEdgeVector;
350  // Iterate over myCurrentSelectedEdges
351  for (const auto& edge : myCurrentSelectedEdges) {
352  NBEdgeVector.push_back(edge->getNBEdge());
353  }
354  return NBEdgeVector;
355 }
356 
357 
358 bool
360  if (myCrossingPriorityCheckButton->getCheck()) {
361  return true;
362  } else {
363  return false;
364  }
365 }
366 
367 
368 bool
370  return myCurrentParametersValid;
371 }
372 
373 
374 double
376  return GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text());
377 }
378 
379 
380 long
382  myCurrentParametersValid = true;
383  // get string vector with the edges
384  const auto& crossingEdgeIDs = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
385  // Clear selected edges
386  myCurrentSelectedEdges.clear();
387  // iterate over vector of edge IDs
388  for (const auto& crossingEdgeID : crossingEdgeIDs) {
389  GNEEdge* edge = myCrossingFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(crossingEdgeID, false);
390  GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
391  // Check that edge exists and belongs to Junction
392  if (edge == nullptr) {
393  myCurrentParametersValid = false;
394  } else if (std::find(currentJunction->getChildEdges().begin(), currentJunction->getChildEdges().end(), edge) == currentJunction->getChildEdges().end()) {
395  myCurrentParametersValid = false;
396  } else {
397  // select or unselected edge
398  auto itFinder = std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge);
399  if (itFinder == myCurrentSelectedEdges.end()) {
400  myCurrentSelectedEdges.push_back(edge);
401  } else {
402  myCurrentSelectedEdges.erase(itFinder);
403  }
404  }
405  }
406  // change color of textfield dependig of myCurrentParametersValid
407  if (myCurrentParametersValid) {
408  myCrossingEdges->setTextColor(FXRGB(0, 0, 0));
409  myCrossingEdges->killFocus();
410  } else {
411  myCrossingEdges->setTextColor(FXRGB(255, 0, 0));
412  myCurrentParametersValid = false;
413  }
414  // Update edge colors
415  if (myCurrentSelectedEdges.empty()) {
416  for (const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
417  // restore colors
418  edge->resetCandidateFlags();
419  // mark all edges as possible candidate
420  edge->setPossibleCandidate(true);
421  }
422  } else {
423  EdgeVector selected;
424  for (GNEEdge* e : myCurrentSelectedEdges) {
425  selected.push_back(e->getNBEdge());
426  }
427  NBNode* node = myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode();
428  for (const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
429  // restore colors
430  edge->resetCandidateFlags();
431  // set selected or candidate color
432  if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) != myCurrentSelectedEdges.end()) {
433  edge->setTargetCandidate(true);
434  } else {
435  EdgeVector newCandidates = selected;;
436  newCandidates.push_back(edge->getNBEdge());
437  if (node->checkCrossing(newCandidates, true) == 0) {
438  edge->setInvalidCandidate(true);
439  } else {
440  edge->setPossibleCandidate(true);
441  }
442  }
443  }
444  }
445  // Update view net
446  myCrossingFrameParent->getViewNet()->updateViewNet();
447  // Check that at least there are one selected edge
448  if (crossingEdgeIDs.empty()) {
449  myCurrentParametersValid = false;
450  }
451  // change label of crossing priority
452  if (myCrossingPriorityCheckButton->getCheck()) {
453  myCrossingPriorityCheckButton->setText("true");
454  } else {
455  myCrossingPriorityCheckButton->setText("false");
456  }
457 
458  // Check width
459  if (GNEAttributeCarrier::canParse<double>(myCrossingWidth->getText().text()) &&
460  GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text()) > 0) {
461  myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
462  myCrossingWidth->killFocus();
463  } else {
464  myCrossingWidth->setTextColor(FXRGB(255, 0, 0));
465  myCurrentParametersValid = false;
466  }
467 
468  // Enable or disable create crossing button depending of the current parameters
469  myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(myCurrentParametersValid);
470  return 0;
471 }
472 
473 
474 long
475 GNECrossingFrame::CrossingParameters::onCmdHelp(FXObject*, FXSelector, void*) {
476  myCrossingFrameParent->openHelpAttributesDialog(myCrossingTemplate);
477  return 1;
478 }
479 
480 // ---------------------------------------------------------------------------
481 // GNECrossingFrame::CreateCrossing - methods
482 // ---------------------------------------------------------------------------
483 
485  MFXGroupBoxModule(crossingFrameParent, TL("Create")),
486  myCrossingFrameParent(crossingFrameParent) {
487  // Create groupbox for create crossings
489  myCreateCrossingButton->disable();
490 }
491 
492 
494 
495 
496 long
498  // First check that current parameters are valid
499  if (myCrossingFrameParent->myCrossingParameters->isCurrentParametersValid()) {
500  // iterate over junction's crossing to find duplicated crossings
501  if (myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode()->checkCrossingDuplicated(myCrossingFrameParent->myCrossingParameters->getCrossingEdges()) == false) {
502  // create new crossing
503  myCrossingFrameParent->myViewNet->getUndoList()->add(new GNEChange_Crossing(myCrossingFrameParent->myEdgeSelector->getCurrentJunction(),
504  myCrossingFrameParent->myCrossingParameters->getCrossingEdges(),
505  myCrossingFrameParent->myCrossingParameters->getCrossingWidth(),
506  myCrossingFrameParent->myCrossingParameters->getCrossingPriority(),
507  -1, -1,
509  false, true), true);
510  // clear selected edges
511  myCrossingFrameParent->myEdgeSelector->onCmdClearSelection(0, 0, 0);
512  // update default create edge option
513  myCrossingFrameParent->getViewNet()->getViewParent()->getCreateEdgeFrame()->getEdgeTypeSelector()->enableCheckBoxDisablePedestrians();
514  } else {
515  WRITE_WARNING(TL("There is already another crossing with the same edges in the junction; Duplicated crossing aren't allowed."));
516  }
517  }
518  return 1;
519 }
520 
521 
522 void
524  if (value) {
525  myCreateCrossingButton->enable();
526  } else {
527  myCreateCrossingButton->disable();
528  }
529 }
530 
531 // ---------------------------------------------------------------------------
532 // GNECrossingFrame::Legend - methods
533 // ---------------------------------------------------------------------------
534 
536  MFXGroupBoxModule(crossingFrameParent, TL("Information")) {
537 
538  // create label
539  new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Click over junction to mark candidate edges.") + std::string("\n- ") + TL("Click over candidate edges for selecting.")).c_str(), 0, GUIDesignLabelFrameInformation);
540  // candidate
541  FXLabel* colorCandidateLabel = new FXLabel(getCollapsableFrame(), TL(" Candidate"), 0, GUIDesignLabel(JUSTIFY_LEFT));
542  colorCandidateLabel->setBackColor(MFXUtils::getFXColor(crossingFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
543  colorCandidateLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
544  // selected
545  FXLabel* colorSelectedLabel = new FXLabel(getCollapsableFrame(), TL(" Selected"), 0, GUIDesignLabel(JUSTIFY_LEFT));
546  colorSelectedLabel->setBackColor(MFXUtils::getFXColor(crossingFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
547  // invalid
548  FXLabel* colorInvalidLabel = new FXLabel(getCollapsableFrame(), TL(" Invalid"), 0, GUIDesignLabel(JUSTIFY_LEFT));
549  colorInvalidLabel->setBackColor(MFXUtils::getFXColor(crossingFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.invalid));
550  colorInvalidLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
551 }
552 
553 
555 
556 // ---------------------------------------------------------------------------
557 // GNECrossingFrame - methods
558 // ---------------------------------------------------------------------------
559 
561  GNEFrame(viewParent, viewNet, TL("Crossings")) {
562  // create JunctionInformation module
564 
565  // Create edge Selector module
566  myEdgeSelector = new EdgesSelector(this);
567 
568  // Create CrossingParameters module
570 
571  // create CreateCrossing module
572  myCreateCrossing = new CreateCrossing(this);
573 
574  // create information module
575  myInformation = new Information(this);
576 
577  // disable edge selector
579 }
580 
581 
583 }
584 
585 
586 void
588  // restore color of all lanes of edge candidates
590  // hide frame
591  GNEFrame::hide();
592 }
593 
594 
595 void
597  // If current element is a junction
598  if (viewObjects.getJunctionFront()) {
599  // change label
601  // Enable edge selector and crossing parameters
604  // clears selected edges
606  } else if (viewObjects.getEdgeFront()) {
607  // check if mark edge
608  if (!viewObjects.getEdgeFront()->isInvalidCandidate()) {
610  }
611  } else {
612  // set default label
614  // restore color of all lanes of edge candidates
616  // Disable edge selector
618  }
619  // always update view after an operation
621 }
622 
623 
624 void
627  // simply call onCmdCreateCrossing of CreateCrossing module
629  }
630 }
631 
632 
633 void
635  if (myCrossingParameters->getCrossingEdges().size() > 0) {
637  } else if (myEdgeSelector->getCurrentJunction()) {
640  }
641 }
642 
643 /****************************************************************************/
FXDEFMAP(GNECrossingFrame::EdgesSelector) EdgesSelectorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:930
@ MID_GNE_CLEARSELECTION
clear selection of elements
Definition: GUIAppEnum.h:1177
@ MID_GNE_USESELECTED
use selected elements
Definition: GUIAppEnum.h:1175
@ MID_GNE_CREATE
create element
Definition: GUIAppEnum.h:932
@ MID_HELP
help button
Definition: GUIAppEnum.h:648
@ MID_GNE_SELECT
select element
Definition: GUIAppEnum.h:948
@ MID_GNE_INVERTSELECTION
invert selection of elements
Definition: GUIAppEnum.h:1179
#define GUIDesignButton
Definition: GUIDesigns.h:88
#define GUIDesignTextField
Definition: GUIDesigns.h:65
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:405
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:100
#define GUIDesignLabel(justify)
Definition: GUIDesigns.h:249
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:80
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:198
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition: GUIDesigns.h:258
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:285
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:295
#define TL(string)
Definition: MsgHandler.h:315
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ 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:283
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
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
bool isInvalidCandidate() const
check if this element is a invalid candidate
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 *)
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
void updateCurrentJunctionLabel(const std::string &junctionID)
set current junction label
GNECrossingFrame::CreateCrossing * myCreateCrossing
create crossing modul
GNECrossingFrame::Information * myInformation
information modul
GNECrossingFrame::EdgesSelector * myEdgeSelector
edge selector modul
~GNECrossingFrame()
Destructor.
void clearEdgesHotkey()
clear edges (used when user press ESC key in Crossing mode)
GNECrossingFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
void hide()
hide crossing frame
GNECrossingFrame::CrossingParameters * myCrossingParameters
crossing parameters modul
void createCrossingHotkey()
create crossing (used when user press ENTER key in Crossing mode)
void addCrossing(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
add Crossing element
GNECrossingFrame::JunctionInformation * myJunctionInformation
FOX need this.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:44
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:150
GNEViewNet * myViewNet
FOX need this.
Definition: GNEFrame.h:117
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:124
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:121
class used to group all variables related with objects under cursor after a click over view
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNEJunction * getJunctionFront() const
get front junction 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:410
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:88
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
Definition: GUIDesigns.cpp:128
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
Definition: Junction.h:34
A list item which allows for custom coloring.
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
Definition: MFXUtils.cpp:112
Represents a single node (junction) during network building.
Definition: NBNode.h:66
int checkCrossing(EdgeVector candidates, bool checkOnly=false)
Definition: NBNode.cpp:2764
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:331
static const PositionVector EMPTY
empty Vector
static const RGBColor WHITE
Definition: RGBColor.h:192
static const RGBColor invalid
color for invalid elements
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element