Eclipse SUMO - Simulation of Urban MObility
GNEAdditionalFrame.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 additional elements
19 /****************************************************************************/
20 #include <config.h>
21 
24 #include <netedit/GNENet.h>
25 #include <netedit/GNEViewNet.h>
26 #include <netedit/GNEViewParent.h>
29 #include <utils/gui/div/GLHelper.h>
34 
35 #include "GNEAdditionalFrame.h"
36 
37 
38 // ===========================================================================
39 // FOX callback mapping
40 // ===========================================================================
41 
42 FXDEFMAP(GNEAdditionalFrame::SelectorParentLanes) ConsecutiveLaneSelectorMap[] = {
45 };
46 
47 FXDEFMAP(GNEAdditionalFrame::SelectorChildEdges) SelectorParentEdgesMap[] = {
53 };
54 
55 FXDEFMAP(GNEAdditionalFrame::SelectorChildLanes) SelectorParentLanesMap[] = {
61 };
62 
63 FXDEFMAP(GNEAdditionalFrame::E2MultilaneLaneSelector) E2MultilaneLaneSelectorMap[] = {
68 };
69 
70 // Object implementation
71 FXIMPLEMENT(GNEAdditionalFrame::SelectorParentLanes, FXGroupBoxModule, ConsecutiveLaneSelectorMap, ARRAYNUMBER(ConsecutiveLaneSelectorMap))
72 FXIMPLEMENT(GNEAdditionalFrame::SelectorChildEdges, FXGroupBoxModule, SelectorParentEdgesMap, ARRAYNUMBER(SelectorParentEdgesMap))
73 FXIMPLEMENT(GNEAdditionalFrame::SelectorChildLanes, FXGroupBoxModule, SelectorParentLanesMap, ARRAYNUMBER(SelectorParentLanesMap))
74 FXIMPLEMENT(GNEAdditionalFrame::E2MultilaneLaneSelector, FXGroupBoxModule, E2MultilaneLaneSelectorMap, ARRAYNUMBER(E2MultilaneLaneSelectorMap))
75 
76 
77 // ---------------------------------------------------------------------------
78 // GNEAdditionalFrame::SelectorParentLanes - methods
79 // ---------------------------------------------------------------------------
80 
82  FXGroupBoxModule(additionalFrameParent->myContentFrame, "Lane Selector"),
83  myAdditionalFrameParent(additionalFrameParent) {
84  // create start and stop buttons
85  myStopSelectingButton = new FXButton(getCollapsableFrame(), "Stop selecting", nullptr, this, MID_GNE_ADDITIONALFRAME_STOPSELECTION, GUIDesignButton);
86  myAbortSelectingButton = new FXButton(getCollapsableFrame(), "Abort selecting", nullptr, this, MID_GNE_ADDITIONALFRAME_ABORTSELECTION, GUIDesignButton);
87  // disable stop and abort functions as init
88  myStopSelectingButton->disable();
89  myAbortSelectingButton->disable();
90 }
91 
92 
94 
95 
96 void
98  // abort current selection before show
99  abortConsecutiveLaneSelector();
100  // show FXGroupBoxModule
101  FXGroupBoxModule::show();
102 }
103 
104 
105 void
107  // abort current selection before hide
108  abortConsecutiveLaneSelector();
109  // hide FXGroupBoxModule
110  FXGroupBoxModule::hide();
111 }
112 
113 
114 void
116  // Only start selection if SelectorParentLanes modul is shown
117  if (shown()) {
118  // change buttons
119  myStopSelectingButton->enable();
120  myAbortSelectingButton->enable();
121  // add lane
122  addSelectedLane(lane, clickedPosition);
123  }
124 }
125 
126 
127 bool
129  // obtain tagproperty (only for improve code legibility)
130  const auto& tagProperties = myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTemplateAC()->getTagProperty();
131  // abort if there isn't at least two lanes
132  if (mySelectedLanes.size() < 2) {
133  WRITE_WARNING(myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTemplateAC()->getTagProperty().getTagStr() + " requires at least two lanes.");
134  // abort consecutive lane selector
135  abortConsecutiveLaneSelector();
136  return false;
137  }
138  // create base additional
139  if (!myAdditionalFrameParent->createBaseAdditionalObject(tagProperties)) {
140  return false;
141  }
142  // get attributes and values
143  myAdditionalFrameParent->myAdditionalAttributes->getAttributesAndValues(myAdditionalFrameParent->myBaseAdditional, true);
144  // fill valuesOfElement with Netedit attributes from Frame
145  myAdditionalFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(myAdditionalFrameParent->myBaseAdditional, nullptr);
146  // Check if ID has to be generated
147  if (!myAdditionalFrameParent->myBaseAdditional->hasStringAttribute(SUMO_ATTR_ID)) {
148  myAdditionalFrameParent->myBaseAdditional->addStringAttribute(SUMO_ATTR_ID, myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->generateAdditionalID(tagProperties.getTag()));
149  }
150  // obtain lane IDs
151  std::vector<std::string> laneIDs;
152  for (const auto& selectedlane : mySelectedLanes) {
153  laneIDs.push_back(selectedlane.first->getID());
154  }
155  myAdditionalFrameParent->myBaseAdditional->addStringListAttribute(SUMO_ATTR_LANES, laneIDs);
156  // Obtain clicked position over first lane
157  myAdditionalFrameParent->myBaseAdditional->addDoubleAttribute(SUMO_ATTR_POSITION, mySelectedLanes.front().second);
158  // Obtain clicked position over last lane
159  myAdditionalFrameParent->myBaseAdditional->addDoubleAttribute(SUMO_ATTR_ENDPOS, mySelectedLanes.back().second);
160  // parse common attributes
161  if (!myAdditionalFrameParent->buildAdditionalCommonAttributes(tagProperties)) {
162  return false;
163  }
164  // show warning dialogbox and stop check if input parameters are valid
165  if (myAdditionalFrameParent->myAdditionalAttributes->areValuesValid() == false) {
166  myAdditionalFrameParent->myAdditionalAttributes->showWarningMessage();
167  return false;
168  } else {
169  // declare additional handler
170  GNEAdditionalHandler additionalHandler(myAdditionalFrameParent->getViewNet()->getNet(), true);
171  // build additional
172  additionalHandler.parseSumoBaseObject(myAdditionalFrameParent->myBaseAdditional);
173  // abort consecutive lane selector
174  abortConsecutiveLaneSelector();
175  // refresh additional attributes
176  myAdditionalFrameParent->myAdditionalAttributes->refreshAttributesCreator();
177  return true;
178  }
179 }
180 
181 
182 void
184  // reset color of all candidate lanes
185  for (const auto& lane : myCandidateLanes) {
186  lane->resetCandidateFlags();
187  }
188  // clear candidate colors
189  myCandidateLanes.clear();
190  // reset color of all selected lanes
191  for (const auto& lane : mySelectedLanes) {
192  lane.first->resetCandidateFlags();
193  }
194  // clear selected lanes
195  mySelectedLanes.clear();
196  // disable buttons
197  myStopSelectingButton->disable();
198  myAbortSelectingButton->disable();
199  // update view (due colors)
200  myAdditionalFrameParent->getViewNet()->updateViewNet();
201 }
202 
203 
204 bool
206  // first check that lane exist
207  if (lane == nullptr) {
208  return false;
209  }
210  // check that lane wasn't already selected
211  for (auto i : mySelectedLanes) {
212  if (i.first == lane) {
213  WRITE_WARNING("Duplicated lanes aren't allowed");
214  return false;
215  }
216  }
217  // check that there is candidate lanes
218  if (mySelectedLanes.size() > 0) {
219  if (myCandidateLanes.empty()) {
220  WRITE_WARNING("Only candidate lanes are allowed");
221  return false;
222  } else if ((myCandidateLanes.size() > 0) && (std::find(myCandidateLanes.begin(), myCandidateLanes.end(), lane) == myCandidateLanes.end())) {
223  WRITE_WARNING("Only consecutive lanes are allowed");
224  return false;
225  }
226  }
227  // select lane and save the clicked position
228  mySelectedLanes.push_back(std::make_pair(lane, lane->getLaneShape().nearest_offset_to_point2D(clickedPosition) / lane->getLengthGeometryFactor()));
229  // change color of selected lane
230  lane->setTargetCandidate(true);
231  // restore original color of candidates (except already selected)
232  for (const auto& candidateLane : myCandidateLanes) {
233  candidateLane->setPossibleCandidate(false);
234  }
235  // clear candidate lanes
236  myCandidateLanes.clear();
237  // fill candidate lanes
238  for (const auto& connection : lane->getParentEdge()->getGNEConnections()) {
239  // check that possible candidate lane isn't already selected
240  if ((lane == connection->getLaneFrom()) && (!isLaneSelected(connection->getLaneTo()))) {
241  // set candidate lane
242  connection->getLaneTo()->setPossibleCandidate(true);
243  myCandidateLanes.push_back(connection->getLaneTo());
244  }
245  }
246  // update view (due colors)
247  myAdditionalFrameParent->getViewNet()->updateViewNet();
248  return true;
249 }
250 
251 
252 void
254  if (mySelectedLanes.size() > 1) {
255  mySelectedLanes.pop_back();
256  } else {
257  WRITE_WARNING("First lane cannot be removed");
258  }
259 }
260 
261 
262 bool
264  return myStopSelectingButton->isEnabled();
265 }
266 
267 
268 bool
270  return shown();
271 }
272 
273 
274 const std::vector<std::pair<GNELane*, double> >&
276  return mySelectedLanes;
277 }
278 
279 
280 long
282  stopConsecutiveLaneSelector();
283  return 0;
284 }
285 
286 
287 long
289  abortConsecutiveLaneSelector();
290  return 0;
291 }
292 
293 
294 bool
296  for (auto i : mySelectedLanes) {
297  if (i.first == lane) {
298  return true;
299  }
300  }
301  return false;
302 }
303 
304 // ---------------------------------------------------------------------------
305 // GNEAdditionalFrame::SelectorChildEdges - methods
306 // ---------------------------------------------------------------------------
307 
309  FXGroupBoxModule(additionalFrameParent->myContentFrame, "Edges"),
310  myAdditionalFrameParent(additionalFrameParent) {
311  // Create menuCheck for selected edges
313 
314  // Create search box
316 
317  // Create list
319 
320  // Create horizontal frame
321  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
322 
323  // Create button for clear selection
324  myClearEdgesSelection = new FXButton(buttonsFrame, "Clear", nullptr, this, MID_GNE_ADDITIONALFRAME_CLEARSELECTION, GUIDesignButtonRectangular);
325 
326  // Create button for invert selection
327  myInvertEdgesSelection = new FXButton(buttonsFrame, "Invert", nullptr, this, MID_GNE_ADDITIONALFRAME_INVERTSELECTION, GUIDesignButtonRectangular);
328 
329  // Hide List
331 }
332 
333 
335 
336 
337 std::vector<std::string>
339  std::vector<std::string> vectorOfIds;
340  if (myUseSelectedEdgesCheckButton->getCheck()) {
341  // get Selected edges
342  const auto selectedEdges = myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
343  // Iterate over selectedEdges and getId
344  for (const auto& edge : selectedEdges) {
345  vectorOfIds.push_back(edge->getID());
346  }
347  } else {
348  // Obtain Id's of list
349  for (int i = 0; i < myList->getNumItems(); i++) {
350  if (myList->isItemSelected(i)) {
351  vectorOfIds.push_back(myList->getItem(i)->getText().text());
352  }
353  }
354  }
355  return vectorOfIds;
356 }
357 
358 
359 void
361  // clear list of egdge ids
362  myList->clearItems();
363  // iterate over edges of net
364  for (const auto& edge : myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
365  // If search criterium is correct, then append ittem
366  if (edge.second->getID().find(search) != std::string::npos) {
367  myList->appendItem(edge.second->getID().c_str());
368  }
369  }
370  // By default, CheckBox for useSelectedEdges isn't checked
371  myUseSelectedEdgesCheckButton->setCheck(false);
372  // Recalc Frame
373  recalc();
374  // Update Frame
375  update();
376  // Show dialog
377  show();
378 }
379 
380 
381 void
383  FXGroupBoxModule::hide();
384 }
385 
386 
387 void
389  // Enable or disable use selected edges
390  if (myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getNumberOfSelectedEdges() > 0) {
391  myUseSelectedEdgesCheckButton->enable();
392  } else {
393  myUseSelectedEdgesCheckButton->disable();
394  }
395 }
396 
397 
398 long
400  if (myUseSelectedEdgesCheckButton->getCheck()) {
401  myEdgesSearch->hide();
402  myList->hide();
403  myClearEdgesSelection->hide();
404  myInvertEdgesSelection->hide();
405  } else {
406  myEdgesSearch->show();
407  myList->show();
408  myClearEdgesSelection->show();
409  myInvertEdgesSelection->show();
410  }
411  // Recalc Frame
412  recalc();
413  // Update Frame
414  update();
415  return 1;
416 }
417 
418 
419 long
421  // Show only Id's of SelectorChildEdges that contains the searched string
422  showSelectorChildEdgesModule(myEdgesSearch->getText().text());
423  return 1;
424 }
425 
426 
427 long
429  return 1;
430 }
431 
432 
433 long
435  for (int i = 0; i < myList->getNumItems(); i++) {
436  if (myList->getItem(i)->isSelected()) {
437  myList->deselectItem(i);
438  }
439  }
440  return 1;
441 }
442 
443 
444 long
446  for (int i = 0; i < myList->getNumItems(); i++) {
447  if (myList->getItem(i)->isSelected()) {
448  myList->deselectItem(i);
449  } else {
450  myList->selectItem(i);
451  }
452  }
453  return 1;
454 }
455 
456 // ---------------------------------------------------------------------------
457 // GNEAdditionalFrame::SelectorChildLanes - methods
458 // ---------------------------------------------------------------------------
459 
461  FXGroupBoxModule(additionalFrameParent->myContentFrame, "Lanes"),
462  myAdditionalFrameParent(additionalFrameParent) {
463  // Create CheckBox for selected lanes
465 
466  // Create search box
468 
469  // Create list
471 
472  // Create horizontal frame
473  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
474 
475  // Create button for clear selection
476  clearLanesSelection = new FXButton(buttonsFrame, "clear", nullptr, this, MID_GNE_ADDITIONALFRAME_CLEARSELECTION, GUIDesignButtonRectangular);
477 
478  // Create button for invert selection
479  invertLanesSelection = new FXButton(buttonsFrame, "invert", nullptr, this, MID_GNE_ADDITIONALFRAME_INVERTSELECTION, GUIDesignButtonRectangular);
480 
481  // Hide List
483 }
484 
485 
487 
488 
489 std::vector<std::string>
491  std::vector<std::string> vectorOfIds;
492  if (myUseSelectedLanesCheckButton->getCheck()) {
493  // get Selected lanes
494  const auto selectedLanes = myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
495  // Iterate over selectedLanes and getId
496  for (const auto& lane : selectedLanes) {
497  vectorOfIds.push_back(lane->getID());
498  }
499  } else {
500  // Obtain Id's of list
501  for (int i = 0; i < myList->getNumItems(); i++) {
502  if (myList->isItemSelected(i)) {
503  vectorOfIds.push_back(myList->getItem(i)->getText().text());
504  }
505  }
506  }
507  return vectorOfIds;
508 }
509 
510 
511 void
513  myList->clearItems();
514  // add all network lanes
515  for (const auto& lane : myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getLanes()) {
516  if (lane->getID().find(search) != std::string::npos) {
517  myList->appendItem(lane->getID().c_str());
518  }
519  }
520  // By default, CheckBox for useSelectedLanes isn't checked
521  myUseSelectedLanesCheckButton->setCheck(false);
522  // Show list
523  show();
524 }
525 
526 
527 void
529  FXGroupBoxModule::hide();
530 }
531 
532 
533 void
535  // Enable or disable use selected Lanes
536  if (myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getNumberOfSelectedLanes() > 0) {
537  myUseSelectedLanesCheckButton->enable();
538  } else {
539  myUseSelectedLanesCheckButton->disable();
540  }
541 }
542 
543 
544 long
546  if (myUseSelectedLanesCheckButton->getCheck()) {
547  myLanesSearch->hide();
548  myList->hide();
549  clearLanesSelection->hide();
550  invertLanesSelection->hide();
551  } else {
552  myLanesSearch->show();
553  myList->show();
554  clearLanesSelection->show();
555  invertLanesSelection->show();
556  }
557  // Recalc Frame
558  recalc();
559  // Update Frame
560  update();
561  return 1;
562 }
563 
564 
565 long
567  // Show only Id's of SelectorChildLanes that contains the searched string
568  showSelectorChildLanesModule(myLanesSearch->getText().text());
569  return 1;
570 }
571 
572 
573 long
575  return 1;
576 }
577 
578 
579 long
581  for (int i = 0; i < myList->getNumItems(); i++) {
582  if (myList->getItem(i)->isSelected()) {
583  myList->deselectItem(i);
584  }
585  }
586  return 1;
587 }
588 
589 
590 long
592  for (int i = 0; i < myList->getNumItems(); i++) {
593  if (myList->getItem(i)->isSelected()) {
594  myList->deselectItem(i);
595  } else {
596  myList->selectItem(i);
597  }
598  }
599  return 1;
600 }
601 
602 // ---------------------------------------------------------------------------
603 // GNEAdditionalFrame::E2MultilaneLaneSelector - methods
604 // ---------------------------------------------------------------------------
605 
607  FXGroupBoxModule(additionalFrameParent->myContentFrame, "E2Multilane lane selector"),
608  myAdditionalFrameParent(additionalFrameParent) {
609  // create label for route info
610  myInfoRouteLabel = new FXLabel(getCollapsableFrame(), "No lanes selected", 0, GUIDesignLabelFrameThicked);
611  // create button for finish route creation
612  myFinishCreationButton = new FXButton(getCollapsableFrame(), "Finish route creation", nullptr, this, MID_GNE_LANEPATH_FINISH, GUIDesignButton);
613  myFinishCreationButton->disable();
614  // create button for abort route creation
615  myAbortCreationButton = new FXButton(getCollapsableFrame(), "Abort route creation", nullptr, this, MID_GNE_LANEPATH_ABORT, GUIDesignButton);
616  myAbortCreationButton->disable();
617  // create button for remove last inserted lane
618  myRemoveLastInsertedElement = new FXButton(getCollapsableFrame(), "Remove last inserted lane", nullptr, this, MID_GNE_LANEPATH_REMOVELAST, GUIDesignButton);
619  myRemoveLastInsertedElement->disable();
620  // create check button
621  myShowCandidateLanes = new FXCheckButton(getCollapsableFrame(), "Show candidate lanes", this, MID_GNE_LANEPATH_SHOWCANDIDATES, GUIDesignCheckButton);
622  myShowCandidateLanes->setCheck(TRUE);
623  // create backspace label (always shown)
624  new FXLabel(this,
625  "BACKSPACE: undo click",
627 }
628 
629 
631 
632 
633 void
635  // first abort creation
636  abortPathCreation();
637  // disable buttons
638  myFinishCreationButton->disable();
639  myAbortCreationButton->disable();
640  myRemoveLastInsertedElement->disable();
641  // update lane colors
642  updateLaneColors();
643  // recalc before show (to avoid graphic problems)
644  recalc();
645  // show modul
646  show();
647 }
648 
649 
650 void
652  // clear path
653  clearPath();
654  // hide modul
655  hide();
656 }
657 
658 
659 bool
661  // first check if lane is valid
662  if (lane == nullptr) {
663  return false;
664  }
665  // continue depending of number of selected eges
666  if ((myLanePath.size() > 0) && (myLanePath.back().first == lane)) {
667  // Write warning
668  WRITE_WARNING("Double lanes aren't allowed");
669  // abort add lane
670  return false;
671  }
672  // check candidate lane
673  if ((myShowCandidateLanes->getCheck() == TRUE) && !lane->isPossibleCandidate()) {
674  if (lane->isSpecialCandidate() || lane->isConflictedCandidate()) {
675  // Write warning
676  WRITE_WARNING("Invalid lane");
677  // abort add lane
678  return false;
679  }
680  }
681  // get mouse position
682  const Position mousePos = myAdditionalFrameParent->getViewNet()->snapToActiveGrid(myAdditionalFrameParent->getViewNet()->getPositionInformation());
683  // calculate lane offset
684  const double offset = lane->getLaneShape().nearest_offset_to_point2D(mousePos);
685  // All checks ok, then add it in selected elements
686  myLanePath.push_back(std::make_pair(lane, offset));
687  // enable abort route button
688  myAbortCreationButton->enable();
689  // enable finish button
690  myFinishCreationButton->enable();
691  // disable undo/redo
692  myAdditionalFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->disableUndoRedo("route creation");
693  // enable or disable remove last lane button
694  if (myLanePath.size() > 1) {
695  myRemoveLastInsertedElement->enable();
696  } else {
697  myRemoveLastInsertedElement->disable();
698  }
699  // update info route label
700  updateInfoRouteLabel();
701  // update lane colors
702  updateLaneColors();
703  return true;
704 }
705 
706 
707 bool
709  return (myShowCandidateLanes->getCheck() == TRUE);
710 }
711 
712 
713 void
715  // reset all flags
716  for (const auto& edge : myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
717  for (const auto& lane : edge.second->getLanes()) {
718  lane->resetCandidateFlags();
719  }
720  }
721  // set reachability
722  if (myLanePath.size() > 0 && (myShowCandidateLanes->getCheck() == TRUE)) {
723  // first mark all lanes as invalid
724  for (const auto& edge : myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
725  for (const auto& lane : edge.second->getLanes()) {
726  lane->setConflictedCandidate(true);
727  }
728  }
729  // now mark lane paths as valid
730  for (const auto& lane : myLanePath) {
731  // disable conflicted candidate
732  lane.first->setConflictedCandidate(false);
733  if (lane == myLanePath.back()) {
734  lane.first->setSourceCandidate(true);
735  } else {
736  lane.first->setTargetCandidate(true);
737  }
738  }
739  // get parent edge
740  const GNEEdge* edge = myLanePath.back().first->getParentEdge();
741  // iterate over connections
742  for (const auto& connection : edge->getGNEConnections()) {
743  // mark possible candidates
744  if (connection->getLaneFrom() == myLanePath.back().first) {
745  connection->getLaneTo()->setConflictedCandidate(false);
746  connection->getLaneTo()->setPossibleCandidate(true);
747  }
748  }
749  }
750  // update view net
751  myAdditionalFrameParent->getViewNet()->updateViewNet();
752 }
753 
754 
755 void
757  if (myLanePath.size() > 0) {
758  // check if draw start und end
759  const bool drawExtremeSymbols = myAdditionalFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
760  myAdditionalFrameParent->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE;
761  // get widths
762  const double lineWidth = 0.35;
763  const double lineWidthin = 0.25;
764  // Add a draw matrix
766  // Start with the drawing of the area traslating matrix to origin
767  glTranslated(0, 0, GLO_TEMPORALSHAPE);
768  // set first color
770  // iterate over path
771  for (int i = 0; i < (int)myLanePath.size(); i++) {
772  // get lane
773  const GNELane* lane = myLanePath.at(i).first;
774  // draw box lines
775  GLHelper::drawBoxLines(lane->getLaneShape(), lineWidth);
776  // draw connection between lanes
777  if ((i + 1) < (int)myLanePath.size()) {
778  // get next lane
779  const GNELane* nextLane = myLanePath.at(i + 1).first;
780  if (lane->getLane2laneConnections().exist(nextLane)) {
782  } else {
783  GLHelper::drawBoxLines({lane->getLaneShape().back(), nextLane->getLaneShape().front()}, lineWidth);
784  }
785  }
786  }
787  // move to front
788  glTranslated(0, 0, 0.1);
789  // set color
791  // iterate over path again
792  for (int i = 0; i < (int)myLanePath.size(); i++) {
793  // get lane
794  const GNELane* lane = myLanePath.at(i).first;
795  // draw box lines
796  GLHelper::drawBoxLines(lane->getLaneShape(), lineWidthin);
797  // draw connection between lanes
798  if ((i + 1) < (int)myLanePath.size()) {
799  // get next lane
800  const GNELane* nextLane = myLanePath.at(i + 1).first;
801  if (lane->getLane2laneConnections().exist(nextLane)) {
803  } else {
804  GLHelper::drawBoxLines({lane->getLaneShape().back(), nextLane->getLaneShape().front()}, lineWidthin);
805  }
806  }
807  }
808  // draw points
809  const RGBColor pointColor = RGBColor::RED;
810  const RGBColor darkerColor = pointColor.changedBrightness(-32);
811  // positions
812  const Position firstPosition = myLanePath.front().first->getLaneShape().positionAtOffset2D(myLanePath.front().second);
813  const Position secondPosition = myLanePath.back().first->getLaneShape().positionAtOffset2D(myLanePath.back().second);
814  // draw geometry points
815  GUIGeometry::drawGeometryPoints(s, myAdditionalFrameParent->getViewNet()->getPositionInformation(), {firstPosition, secondPosition},
816  pointColor, darkerColor, s.neteditSizeSettings.polylineWidth, 1,
817  myAdditionalFrameParent->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
818  // Pop last matrix
820  }
821 }
822 
823 
824 bool
826  // obtain tagproperty (only for improve code legibility)
827  const auto& tagProperties = myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTemplateAC()->getTagProperty();
828  // first check that current tag is valid
829  if (tagProperties.getTag() != GNE_TAG_E2DETECTOR_MULTILANE) {
830  return false;
831  }
832  // now check number of lanes
833  if (myLanePath.size() < 2) {
834  WRITE_WARNING("E2 multilane detectors need at least two consecutive lanes");
835  return false;
836  }
837  // create base additional
838  if (!myAdditionalFrameParent->createBaseAdditionalObject(tagProperties)) {
839  return false;
840  }
841  // get attributes and values
842  myAdditionalFrameParent->myAdditionalAttributes->getAttributesAndValues(myAdditionalFrameParent->myBaseAdditional, true);
843  // fill netedit attributes
844  if (!myAdditionalFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(myAdditionalFrameParent->myBaseAdditional, nullptr)) {
845  return false;
846  }
847  // Check if ID has to be generated
848  if (!myAdditionalFrameParent->myBaseAdditional->hasStringAttribute(SUMO_ATTR_ID)) {
849  myAdditionalFrameParent->myBaseAdditional->addStringAttribute(SUMO_ATTR_ID, myAdditionalFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateAdditionalID(GNE_TAG_E2DETECTOR_MULTILANE));
850  }
851  // obtain lane IDs
852  std::vector<std::string> laneIDs;
853  for (const auto& lane : myLanePath) {
854  laneIDs.push_back(lane.first->getID());
855  }
856  myAdditionalFrameParent->myBaseAdditional->addStringListAttribute(SUMO_ATTR_LANES, laneIDs);
857  // set positions
858  myAdditionalFrameParent->myBaseAdditional->addDoubleAttribute(SUMO_ATTR_POSITION, myLanePath.front().second);
859  myAdditionalFrameParent->myBaseAdditional->addDoubleAttribute(SUMO_ATTR_ENDPOS, myLanePath.back().second);
860  // parse common attributes
861  if (!myAdditionalFrameParent->buildAdditionalCommonAttributes(myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTemplateAC()->getTagProperty())) {
862  return false;
863  }
864  // show warning dialogbox and stop check if input parameters are valid
865  if (myAdditionalFrameParent->myAdditionalAttributes->areValuesValid() == false) {
866  myAdditionalFrameParent->myAdditionalAttributes->showWarningMessage();
867  return false;
868  }
869  // declare additional handler
870  GNEAdditionalHandler additionalHandler(myAdditionalFrameParent->getViewNet()->getNet(), true);
871  // build additional
872  additionalHandler.parseSumoBaseObject(myAdditionalFrameParent->myBaseAdditional);
873  // Refresh additional Parent Selector (For additionals that have a limited number of children)
874  myAdditionalFrameParent->mySelectorAdditionalParent->refreshSelectorParentModule();
875  // abort E2 creation
876  abortPathCreation();
877  // refresh additional attributes
878  myAdditionalFrameParent->myAdditionalAttributes->refreshAttributesCreator();
879  return true;
880 }
881 
882 
883 void
885  // first check that there is elements
886  if (myLanePath.size() > 0) {
887  // unblock undo/redo
888  myAdditionalFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->enableUndoRedo();
889  // clear lanes
890  clearPath();
891  // disable buttons
892  myFinishCreationButton->disable();
893  myAbortCreationButton->disable();
894  myRemoveLastInsertedElement->disable();
895  // update info route label
896  updateInfoRouteLabel();
897  // update reachability
898  updateLaneColors();
899  // update view (to see the new route)
900  myAdditionalFrameParent->getViewNet()->updateViewNet();
901  }
902 }
903 
904 
905 void
907  if (myLanePath.size() > 1) {
908  // remove special color of last selected lane
909  myLanePath.back().first->resetCandidateFlags();
910  // remove last lane
911  myLanePath.pop_back();
912  // change last lane flag
913  if ((myLanePath.size() > 0) && myLanePath.back().first->isSourceCandidate()) {
914  myLanePath.back().first->setSourceCandidate(false);
915  myLanePath.back().first->setTargetCandidate(true);
916  }
917  // enable or disable remove last lane button
918  if (myLanePath.size() > 1) {
919  myRemoveLastInsertedElement->enable();
920  } else {
921  myRemoveLastInsertedElement->disable();
922  }
923  // update info route label
924  updateInfoRouteLabel();
925  // update reachability
926  updateLaneColors();
927  // update view
928  myAdditionalFrameParent->getViewNet()->updateViewNet();
929  }
930 }
931 
932 
933 long
935  // just call create path
936  createPath();
937  return 1;
938 }
939 
940 
941 long
943  // just call abort path creation
944  abortPathCreation();
945  return 1;
946 }
947 
948 
949 long
951  // just call remove last element
952  removeLastElement();
953  return 1;
954 }
955 
956 
957 long
959  // recalc frame
960  recalc();
961  // update lane colors (view will be updated within function)
962  updateLaneColors();
963  return 1;
964 }
965 
966 
967 void
969  if (myLanePath.size() > 0) {
970  // declare variables for route info
971  double length = 0;
972  for (const auto& lane : myLanePath) {
973  length += lane.first->getParentEdge()->getNBEdge()->getLength();
974  }
975  // declare ostringstream for label and fill it
976  std::ostringstream information;
977  information
978  << "- Selected lanes: " << toString(myLanePath.size()) << "\n"
979  << "- Length: " << toString(length);
980  // set new label
981  myInfoRouteLabel->setText(information.str().c_str());
982  } else {
983  myInfoRouteLabel->setText("No lanes selected");
984  }
985 }
986 
987 
988 void
990  // reset all flags
991  for (const auto& edge : myAdditionalFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
992  for (const auto& lane : edge.second->getLanes()) {
993  lane->resetCandidateFlags();
994  }
995  }
996  // clear path
997  myLanePath.clear();
998  // update info route label
999  updateInfoRouteLabel();
1000 }
1001 
1002 // ===========================================================================
1003 // method definitions
1004 // ===========================================================================
1005 
1006 GNEAdditionalFrame::GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
1007  GNEFrame(horizontalFrameParent, viewNet, "Additionals"),
1008  myBaseAdditional(nullptr) {
1009 
1010  // create item Selector modul for additionals
1011  myAdditionalTagSelector = new GNEFrameModules::TagSelector(this, GNETagProperties::TagType::ADDITIONALELEMENT, SUMO_TAG_BUS_STOP);
1012 
1013  // Create additional parameters
1015 
1016  // Create Netedit parameter
1018 
1019  // Create consecutive Lane Selector
1021 
1022  // Create selector parent
1024 
1025  // Create selector child edges
1027 
1028  // Create selector child lanes
1030 
1031  // Create list for E2Multilane lane selector
1033 }
1034 
1035 
1037  // check if we have to delete base additional object
1038  if (myBaseAdditional) {
1039  delete myBaseAdditional;
1040  }
1041 }
1042 
1043 
1044 void
1046  // refresh tag selector
1048  // show frame
1049  GNEFrame::show();
1050 }
1051 
1052 
1053 bool
1055  // first check that current selected additional is valid
1056  if (myAdditionalTagSelector->getCurrentTemplateAC() == nullptr) {
1057  myViewNet->setStatusBarText("Current selected additional isn't valid.");
1058  return false;
1059  }
1060  // show warning dialogbox and stop check if input parameters are valid
1063  return false;
1064  }
1065  // obtain tagproperty (only for improve code legibility)
1066  const auto& tagProperties = myAdditionalTagSelector->getCurrentTemplateAC()->getTagProperty();
1067  // create base additional
1068  if (!createBaseAdditionalObject(tagProperties)) {
1069  return false;
1070  }
1071  // obtain attributes and values
1073  // fill netedit attributes
1075  return false;
1076  }
1077  // If consecutive Lane Selector is enabled, it means that either we're selecting lanes or we're finished or we'rent started
1078  if (tagProperties.hasAttribute(SUMO_ATTR_EDGE) || (tagProperties.getTag() == SUMO_TAG_VAPORIZER)) {
1079  return buildAdditionalOverEdge(objectsUnderCursor.getLaneFront(), tagProperties);
1080  } else if (tagProperties.hasAttribute(SUMO_ATTR_LANE)) {
1081  return buildAdditionalOverLane(objectsUnderCursor.getLaneFront(), tagProperties);
1082  } else if (tagProperties.getTag() == GNE_TAG_E2DETECTOR_MULTILANE) {
1083  return myE2MultilaneLaneSelector->addLane(objectsUnderCursor.getLaneFront());
1084  } else {
1085  return buildAdditionalOverView(tagProperties);
1086  }
1087 }
1088 
1089 
1090 void
1092  // Show frame
1093  GNEFrame::show();
1094  // Update UseSelectedLane CheckBox
1096  // Update UseSelectedLane CheckBox
1098 }
1099 
1100 
1103  return mySelectorLaneParents;
1104 }
1105 
1106 
1110 }
1111 
1112 
1113 void
1116  // show additional attributes modul
1118  // show netedit attributes
1120  // Show myAdditionalFrameParent if we're adding an slave element
1123  } else {
1125  }
1126  // Show SelectorChildEdges if we're adding an additional that own the attribute SUMO_ATTR_EDGES
1129  } else {
1131  }
1132  // check if we must show E2 multilane lane selector
1137  // Show SelectorChildLanes or consecutive lane selector if we're adding an additional that own the attribute SUMO_ATTR_LANES
1140  // show selector parent lane and hide selector child lane
1143  } else {
1144  // show selector child lane and hide selector parent lane
1147  }
1148  } else {
1152  }
1153  } else {
1154  // hide all moduls if additional isn't valid
1162  }
1163 }
1164 
1165 
1166 bool
1168  // check if baseAdditional exist, and if yes, delete it
1169  if (myBaseAdditional) {
1170  // go to base additional root
1173  }
1174  // delete baseAdditional (and all children)
1175  delete myBaseAdditional;
1176  // reset baseAdditional
1177  myBaseAdditional = nullptr;
1178  }
1179  // declare tag for base additional
1180  SumoXMLTag baseAdditionalTag = tagProperty.getTag();
1181  // check if baseAdditionalTag has to be updated
1182  if (baseAdditionalTag == GNE_TAG_E2DETECTOR_MULTILANE) {
1183  baseAdditionalTag = SUMO_TAG_E2DETECTOR;
1184  } else if (baseAdditionalTag == GNE_TAG_FLOW_CALIBRATOR) {
1185  baseAdditionalTag = SUMO_TAG_FLOW;
1186  }
1187  // check if additional is child
1188  if (tagProperty.isChild()) {
1189  // get additional under cursor
1190  const GNEAdditional* additionalUnderCursor = myViewNet->getObjectsUnderCursor().getAdditionalFront();
1191  // if user click over an additional element parent, mark int in ParentAdditionalSelector
1192  if (additionalUnderCursor && (additionalUnderCursor->getTagProperty().getTag() == tagProperty.getParentTags().front())) {
1193  // update parent additional selected
1194  mySelectorAdditionalParent->setIDSelected(additionalUnderCursor->getID());
1195  }
1196  // stop if currently there isn't a valid selected parent
1197  if (mySelectorAdditionalParent->getIdSelected().empty()) {
1198  myAdditionalAttributes->showWarningMessage("A " + toString(tagProperty.getParentTags().front()) + " must be selected before insertion of " + myAdditionalTagSelector->getCurrentTemplateAC()->getTagProperty().getTagStr() + ".");
1199  return false;
1200  } else {
1201  // create baseAdditional parent
1203  // set parent tag
1204  myBaseAdditional->setTag(tagProperty.getParentTags().front());
1205  // add ID
1207  // create baseAdditional again as child of current myBaseAdditional
1209  }
1210  } else {
1211  // just create a base additional
1213  }
1214  // set baseAdditionalTag
1215  myBaseAdditional->setTag(baseAdditionalTag);
1216  // BaseAdditional created, then return true
1217  return true;
1218 }
1219 
1220 
1221 bool
1223  // If additional has a interval defined by a begin or end, check that is valid
1224  if (tagProperties.hasAttribute(SUMO_ATTR_STARTTIME) && tagProperties.hasAttribute(SUMO_ATTR_END)) {
1226  const double end = myBaseAdditional->getDoubleAttribute(SUMO_ATTR_END);
1227  if (begin > end) {
1228  myAdditionalAttributes->showWarningMessage("Attribute '" + toString(SUMO_ATTR_STARTTIME) + "' cannot be greater than attribute '" + toString(SUMO_ATTR_END) + "'.");
1229  return false;
1230  }
1231  }
1232  // If additional own the attribute SUMO_ATTR_FILE but was't defined, will defined as <ID>.xml
1235  // SUMO_ATTR_FILE is optional for calibrators and rerouters (fails to load in sumo when given and the file does not exist)
1237  }
1238  }
1239  // check edge children
1241  // obtain edge IDs
1243  // check if attribute has at least one edge
1245  myAdditionalAttributes->showWarningMessage("List of " + toString(SUMO_TAG_EDGE) + "s cannot be empty");
1246  return false;
1247  }
1248  }
1249  // check lane children
1251  // obtain lane IDs
1253  // check if attribute has at least one lane
1255  myAdditionalAttributes->showWarningMessage("List of " + toString(SUMO_TAG_LANE) + "s cannot be empty");
1256  return false;
1257  }
1258  }
1259  // all ok, continue building additional
1260  return true;
1261 }
1262 
1263 
1264 bool
1266  // check that lane exist
1267  if (lane) {
1268  // Get attribute lane's edge
1270  // Check if ID has to be generated
1273  }
1274  } else {
1275  return false;
1276  }
1277  // parse common attributes
1278  if (!buildAdditionalCommonAttributes(tagProperties)) {
1279  return false;
1280  }
1281  // show warning dialogbox and stop check if input parameters are valid
1284  return false;
1285  } else {
1286  // declare additional handler
1287  GNEAdditionalHandler additionalHandler(myViewNet->getNet(), true);
1288  // build additional
1289  additionalHandler.parseSumoBaseObject(myBaseAdditional);
1290  // Refresh additional Parent Selector (For additionals that have a limited number of children)
1292  // clear selected eddges and lanes
1293  mySelectorChildEdges->onCmdClearSelection(nullptr, 0, nullptr);
1294  mySelectorChildLanes->onCmdClearSelection(nullptr, 0, nullptr);
1295  // refresh additional attributes
1297  return true;
1298  }
1299 }
1300 
1301 
1302 bool
1304  // check that lane exist
1305  if (lane != nullptr) {
1306  // Get attribute lane
1308  // Check if ID has to be generated
1311  }
1312  } else {
1313  return false;
1314  }
1315  // Obtain position of the mouse over lane (limited over grid)
1317  // set attribute position as mouse position over lane
1318  myBaseAdditional->addDoubleAttribute(SUMO_ATTR_POSITION, mousePositionOverLane);
1319  // parse common attributes
1320  if (!buildAdditionalCommonAttributes(tagProperties)) {
1321  return false;
1322  }
1323  // show warning dialogbox and stop check if input parameters are valid
1326  return false;
1327  } else {
1328  // declare additional handler
1329  GNEAdditionalHandler additionalHandler(myViewNet->getNet(), true);
1330  // build additional
1331  additionalHandler.parseSumoBaseObject(myBaseAdditional);
1332  // Refresh additional Parent Selector (For additionals that have a limited number of children)
1334  // clear selected eddges and lanes
1335  mySelectorChildEdges->onCmdClearSelection(nullptr, 0, nullptr);
1336  mySelectorChildLanes->onCmdClearSelection(nullptr, 0, nullptr);
1337  // refresh additional attributes
1339  return true;
1340  }
1341 }
1342 
1343 
1344 bool
1346  // disable intervals (temporal)
1347  if ((tagProperties.getTag() == SUMO_TAG_INTERVAL) ||
1348  (tagProperties.getTag() == SUMO_TAG_DEST_PROB_REROUTE) ||
1349  (tagProperties.getTag() == SUMO_TAG_CLOSING_REROUTE) ||
1350  (tagProperties.getTag() == SUMO_TAG_CLOSING_LANE_REROUTE) ||
1351  (tagProperties.getTag() == SUMO_TAG_ROUTE_PROB_REROUTE) ||
1352  (tagProperties.getTag() == SUMO_TAG_PARKING_AREA_REROUTE)) {
1353  WRITE_WARNING("Currently unsuported. Create rerouter elements using rerouter dialog");
1354  return false;
1355  }
1356  // disable intervals (temporal)
1357  if (tagProperties.getTag() == SUMO_TAG_STEP) {
1358  WRITE_WARNING("Currently unsuported. Create VSS steps elements using VSS dialog");
1359  return false;
1360  }
1361  // Check if ID has to be generated
1364  }
1365  // Obtain position as the clicked position over view
1367  // add position and X-Y-Z attributes
1372  // parse common attributes
1373  if (!buildAdditionalCommonAttributes(tagProperties)) {
1374  return false;
1375  }
1376  // special case for VSS Steps
1378  // get VSS parent
1381  // get last step
1382  GNEAdditional* step = nullptr;
1383  for (const auto& additionalChild : VSSParent->getChildAdditionals()) {
1384  if (!additionalChild->getTagProperty().isSymbol()) {
1385  step = additionalChild;
1386  }
1387  }
1388  // set time
1389  if (step) {
1391  } else {
1393  }
1394  }
1395  // show warning dialogbox and stop check if input parameters are valid
1396  if (myAdditionalAttributes->areValuesValid() == false) {
1398  return false;
1399  } else {
1400  // declare additional handler
1401  GNEAdditionalHandler additionalHandler(myViewNet->getNet(), true);
1402  // build additional
1403  additionalHandler.parseSumoBaseObject(myBaseAdditional);
1404  // Refresh additional Parent Selector (For additionals that have a limited number of children)
1406  // clear selected eddges and lanes
1407  mySelectorChildEdges->onCmdClearSelection(nullptr, 0, nullptr);
1408  mySelectorChildLanes->onCmdClearSelection(nullptr, 0, nullptr);
1409  // refresh additional attributes
1411  return true;
1412  }
1413 }
1414 
1415 /****************************************************************************/
FXDEFMAP(GNEAdditionalFrame::SelectorParentLanes) ConsecutiveLaneSelectorMap[]
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_ADDITIONALFRAME_CLEARSELECTION
clear selection of elements
Definition: GUIAppEnum.h:1004
@ MID_GNE_LANEPATH_ABORT
abort lane path creation
Definition: GUIAppEnum.h:845
@ MID_GNE_ADDITIONALFRAME_STOPSELECTION
stop selection of consecutive egdes/lanes
Definition: GUIAppEnum.h:1010
@ MID_GNE_ADDITIONALFRAME_USESELECTED
use selected elements
Definition: GUIAppEnum.h:1000
@ MID_GNE_LANEPATH_FINISH
finish lane path creation
Definition: GUIAppEnum.h:847
@ MID_GNE_ADDITIONALFRAME_INVERTSELECTION
invert selection of eleents
Definition: GUIAppEnum.h:1006
@ MID_GNE_ADDITIONALFRAME_ABORTSELECTION
abort selection of consecutive egdes/lanes
Definition: GUIAppEnum.h:1012
@ MID_GNE_LANEPATH_REMOVELAST
remove last inserted element in path
Definition: GUIAppEnum.h:849
@ MID_GNE_ADDITIONALFRAME_SELECT
select element
Definition: GUIAppEnum.h:1002
@ MID_GNE_ADDITIONALFRAME_SEARCH
search element
Definition: GUIAppEnum.h:998
@ MID_GNE_LANEPATH_SHOWCANDIDATES
enable or disable show path candidates
Definition: GUIAppEnum.h:851
#define GUIDesignButton
Definition: GUIDesigns.h:68
#define GUIDesignListFixedHeight
design for FXLists with height fixed
Definition: GUIDesigns.h:618
#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 GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:74
#define GUIDesignLabelFrameThicked
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:247
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:60
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:145
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:244
@ GLO_TEMPORALSHAPE
temporal shape (used in NETEDIT)
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_CLOSING_REROUTE
reroute of type closing
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_E2DETECTOR
an e2 detector
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ SUMO_TAG_BUS_STOP
A bus stop.
@ GNE_TAG_FLOW_CALIBRATOR
a flow definition within in Calibrator
@ SUMO_TAG_STEP
trigger: a step description
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ GNE_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_DEST_PROB_REROUTE
probability of destiny of a reroute
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_CLOSING_LANE_REROUTE
lane of a reroute of type closing
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_LANE
@ SUMO_ATTR_FILE
@ SUMO_ATTR_Y
@ SUMO_ATTR_Z
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_X
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_LANES
@ SUMO_ATTR_STARTTIME
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ID
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_TIME
trigger: the time of the step
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
bool hasStringAttribute(const SumoXMLAttr attr) const
has function
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
SumoBaseObject * getParentSumoBaseObject() const
get pointer to mySumoBaseObjectParent SumoBaseObject (if is null, then is the root)
void addTimeAttribute(const SumoXMLAttr attr, const SUMOTime value)
add time attribute into current SumoBaseObject node
void addStringListAttribute(const SumoXMLAttr attr, const std::vector< std::string > &value)
add string list attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addPositionAttribute(const SumoXMLAttr attr, const Position &value)
add Position attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
double getDoubleAttribute(const SumoXMLAttr attr) const
get double attribute
const std::vector< std::string > & getStringListAttribute(const SumoXMLAttr attr) const
get string list attribute
bool hasStringListAttribute(const SumoXMLAttr attr) const
check if current SumoBaseObject has the given string list attribute
const std::string & getStringAttribute(const SumoXMLAttr attr) const
get string attribute
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:277
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
bool drawCandidateLanesWithSpecialColor() const
draw candidate lanes with special color (Only for candidates, special and conflicted)
long onCmdCreatePath(FXObject *, FXSelector, void *)
E2MultilaneLaneSelector(GNEAdditionalFrame *additionalFrameParent)
FOX-declaration.
long onCmdRemoveLastElement(FXObject *, FXSelector, void *)
Called when the user click over button "Remove las inserted lane".
void drawTemporalE2Multilane(const GUIVisualizationSettings &s) const
draw temporal E2Multilane
FXButton * myRemoveLastInsertedElement
button for removing last inserted element
FXLabel * myInfoRouteLabel
label with route info
void showE2MultilaneLaneSelectorModule()
show E2MultilaneLaneSelector
FXButton * myFinishCreationButton
button for finish route creation
void clearPath()
clear lanes (and restore colors)
void hideE2MultilaneLaneSelectorModule()
show E2MultilaneLaneSelector
FXButton * myAbortCreationButton
button for abort route creation
long onCmdShowCandidateLanes(FXObject *, FXSelector, void *)
Called when the user click over check button "show candidate lanes".
FXCheckButton * myShowCandidateLanes
CheckBox for show candidate lanes.
long onCmdAbortPathCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Abort route creation".
std::vector< std::string > getEdgeIdsSelected() const
get list of selecte id's in string format
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
long onCmdSelectEdge(FXObject *, FXSelector, void *)
called when user select a edge of the list
FXButton * myClearEdgesSelection
button for clear selection
FXButton * myInvertEdgesSelection
button for invert selection
void updateUseSelectedEdges()
Update use selectedEdges.
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
void showSelectorChildEdgesModule(std::string search="")
Show SelectorChildEdges Module.
void hideSelectorChildEdgesModule()
hide SelectorChildEdges Module
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
FXList * myList
List of SelectorChildEdges.
FXTextField * myEdgesSearch
text field for search edge IDs
SelectorChildEdges(GNEAdditionalFrame *additionalFrameParent)
FOX-declaration.
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
FXList * myList
List of SelectorChildLanes.
void hideSelectorChildLanesModule()
hide SelectorChildLanes Module
void showSelectorChildLanesModule(std::string search="")
Show list of SelectorChildLanes Module.
long onCmdUseSelectedLanes(FXObject *, FXSelector, void *)
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
FXTextField * myLanesSearch
text field for search lane IDs
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
std::vector< std::string > getLaneIdsSelected() const
get list of selecte lane ids in string format
FXButton * clearLanesSelection
button for clear selection
SelectorChildLanes(GNEAdditionalFrame *additionalFrameParent)
FOX-declaration.
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
long onCmdSelectLane(FXObject *, FXSelector, void *)
called when user select a lane of the list
FXButton * invertLanesSelection
button for invert selection
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
bool isSelectingLanes() const
return true if modul is selecting lane
const std::vector< std::pair< GNELane *, double > > & getSelectedLanes() const
get current selected lanes
bool isShown() const
return true if modul is shown
bool isLaneSelected(GNELane *lane) const
check if certain lane is selected
void showSelectorParentLanesModule()
show SelectorParentLanes modul
long onCmdStopSelection(FXObject *, FXSelector, void *)
bool stopConsecutiveLaneSelector()
stop selection of consecutive lanes
void removeLastSelectedLane()
remove last added point
void hideSelectorParentLanesModule()
hide SelectorParentLanes
long onCmdAbortSelection(FXObject *, FXSelector, void *)
Called when the user press abort selection button.
void startConsecutiveLaneSelector(GNELane *lane, const Position &clickedPosition)
start selection of consecutive lanes
bool addSelectedLane(GNELane *lane, const Position &clickedPosition)
return true if lane can be selected as consecutive lane
void abortConsecutiveLaneSelector()
abort selection of consecutive lanes
GNEFrameModules::TagSelector * myAdditionalTagSelector
item selector
SelectorChildEdges * mySelectorChildEdges
Module for select child edges.
GNEAdditionalFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
bool buildAdditionalOverLane(GNELane *lane, const GNETagProperties &tagValues)
build additional over a single lane
SelectorChildLanes * mySelectorChildLanes
Module for select child lanes.
GNEAdditionalFrame::SelectorParentLanes * getConsecutiveLaneSelector() const
get consecutive Lane Selector
SelectorParentLanes * mySelectorLaneParents
Module for select parent lanes (currently only consecutives)
void tagSelected()
Tag selected in TagSelector.
bool buildAdditionalOverView(const GNETagProperties &tagValues)
build additional over view
GNEFrameModules::SelectorParent * mySelectorAdditionalParent
Module for select a single parent additional.
bool buildAdditionalCommonAttributes(const GNETagProperties &tagValues)
build common additional attributes
void showSelectorChildLanesModule()
show selector child lane and update use selected edges/lanes
E2MultilaneLaneSelector * myE2MultilaneLaneSelector
Module for E2Multilane lane selector.
~GNEAdditionalFrame()
Destructor.
GNEFrameAttributeModules::NeteditAttributes * myNeteditAttributes
Netedit parameter.
GNEAdditionalFrame::E2MultilaneLaneSelector * getE2MultilaneLaneSelector() const
getConsecutive Lane Selector
CommonXMLStructure::SumoBaseObject * myBaseAdditional
SumoBaseObject used for create additional.
bool addAdditional(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
add additional element
bool createBaseAdditionalObject(const GNETagProperties &tagProperty)
bool buildAdditionalOverEdge(GNELane *lane, const GNETagProperties &tagValues)
build additional over an edge (parent of lane)
GNEFrameAttributeModules::AttributesCreator * myAdditionalAttributes
internal additional attributes
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
const std::string & getID() const
get ID
virtual std::string getAttribute(SumoXMLAttr key) const =0
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isSpecialCandidate() const
check if this element is a special candidate
void setTargetCandidate(const bool value)
set element as target candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isConflictedCandidate() const
check if this element is a conflicted candidate
void setConflictedCandidate(const bool value)
set element as conflicted candidate
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:788
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
bool areValuesValid() const
check if parameters of attributes are valid
void refreshAttributesCreator()
refresh attribute creator
void showAttributesCreatorModule(GNEAttributeCarrier *templateAC, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
void getAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, bool includeAll) const
get attributes and their values
void hideNeteditAttributesModule()
hide Netedit attributes modul
bool getNeteditAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, const GNELane *lane) const
fill valuesMap with netedit attributes
void showNeteditAttributesModule(const GNETagProperties &tagValue)
show Netedit attributes modul
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:114
virtual void createPath()
create path (can be reimplemented in frame children)
Definition: GNEFrame.cpp:197
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:117
virtual void show()
show Frame
Definition: GNEFrame.cpp:108
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:117
void setIDSelected(const std::string &id)
select manually a element of the list
std::string getIdSelected() const
get currently parent additional selected
void refreshSelectorParentModule()
Refresh list of Additional Parents Module.
void hideSelectorParentModule()
hide SelectorParent Module
bool showSelectorParentModule(const std::vector< SumoXMLTag > &additionalTypeParents)
Show list of SelectorParent Module.
void refreshTagSelector()
refresh tagSelector (used when frameParent is show)
GNEAttributeCarrier * getCurrentTemplateAC() const
get current templateAC
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:838
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1713
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:113
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
const std::string & getID() const
get ID
const std::vector< SumoXMLTag > & getParentTags() const
get parent tags
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool isChild() const
return true if tag correspond to an element child of another element (Example: E3->Entry/Exit)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
class used to group all variables related with objects under cursor after a click over view
GNELane * getLaneFront() const
get front lane or a pointer to nullptr
GNEAdditional * getAdditionalFront() const
get front additional element or a pointer to nullptr
GNENet * getNet() const
get the net object
const GNEViewNetHelper::ObjectsUnderCursor & getObjectsUnderCursor() const
get objects under cursor
Definition: GNEViewNet.cpp:420
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:629
static void drawGeometryPoints(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
draw geometry points
const PositionVector & getShape() const
The shape of the additional element.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
C++ TraCI client API implementation.
Definition: Lane.h:33
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double x() const
Returns the x-position.
Definition: Position.h:55
double z() const
Returns the z-position.
Definition: Position.h:65
double y() const
Returns the y-position.
Definition: Position.h:60
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static const RGBColor GREY
Definition: RGBColor.h:194
static const RGBColor ORANGE
Definition: RGBColor.h:191
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:197
static const RGBColor RED
named colors
Definition: RGBColor.h:185
static const double polylineWidth
poly line width