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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // The Widget for add additional elements
15 /****************************************************************************/
16 
17 // ===========================================================================
18 // included modules
19 // ===========================================================================
20 #include <config.h>
21 
30 #include <netedit/GNENet.h>
31 #include <netedit/GNEViewNet.h>
32 
33 #include "GNEAdditionalFrame.h"
34 
35 
36 // ===========================================================================
37 // FOX callback mapping
38 // ===========================================================================
39 
40 FXDEFMAP(GNEAdditionalFrame::SelectorParentLanes) ConsecutiveLaneSelectorMap[] = {
43 };
44 
45 FXDEFMAP(GNEAdditionalFrame::SelectorChildEdges) SelectorParentEdgesMap[] = {
51 };
52 
53 FXDEFMAP(GNEAdditionalFrame::SelectorChildLanes) SelectorParentLanesMap[] = {
59 };
60 
61 // Object implementation
62 FXIMPLEMENT(GNEAdditionalFrame::SelectorParentLanes, FXGroupBox, ConsecutiveLaneSelectorMap, ARRAYNUMBER(ConsecutiveLaneSelectorMap))
63 FXIMPLEMENT(GNEAdditionalFrame::SelectorChildEdges, FXGroupBox, SelectorParentEdgesMap, ARRAYNUMBER(SelectorParentEdgesMap))
64 FXIMPLEMENT(GNEAdditionalFrame::SelectorChildLanes, FXGroupBox, SelectorParentLanesMap, ARRAYNUMBER(SelectorParentLanesMap))
65 
66 
67 // ---------------------------------------------------------------------------
68 // GNEAdditionalFrame::SelectorParentLanes - methods
69 // ---------------------------------------------------------------------------
70 
72  FXGroupBox(additionalFrameParent->myContentFrame, "Lane Selector", GUIDesignGroupBoxFrame),
73  myAdditionalFrameParent(additionalFrameParent) {
74  // create start and stop buttons
75  myStopSelectingButton = new FXButton(this, "Stop selecting", nullptr, this, MID_GNE_ADDITIONALFRAME_STOPSELECTION, GUIDesignButton);
76  myAbortSelectingButton = new FXButton(this, "Abort selecting", nullptr, this, MID_GNE_ADDITIONALFRAME_ABORTSELECTION, GUIDesignButton);
77  // disable stop and abort functions as init
78  myStopSelectingButton->disable();
79  myAbortSelectingButton->disable();
80  // define colors
81  myCandidateLaneColor = RGBColor(0, 64, 0, 255);
82  mySelectedLaneColor = RGBColor::GREEN;
83 }
84 
85 
87 
88 
89 void
91  // abort current selection before show
92  abortConsecutiveLaneSelector();
93  // show FXGroupBox
94  FXGroupBox::show();
95 }
96 
97 
98 void
100  // abort current selection before hide
101  abortConsecutiveLaneSelector();
102  // hide FXGroupBox
103  FXGroupBox::hide();
104 }
105 
106 
107 void
109  // Only start selection if SelectorParentLanes modul is shown
110  if (shown()) {
111  // change buttons
112  myStopSelectingButton->enable();
113  myAbortSelectingButton->enable();
114  // add lane
115  addSelectedLane(lane, clickedPosition);
116  }
117 }
118 
119 
120 bool
122  // obtain tagproperty (only for improve code legibility)
123  const auto& tagValues = myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties();
124  // abort if there isn't at least two lanes
125  if (mySelectedLanes.size() < 2) {
126  WRITE_WARNING(myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties().getTagStr() + " requires at least two lanes.");
127  // abort consecutive lane selector
128  abortConsecutiveLaneSelector();
129  return false;
130  }
131  // Declare map to keep attributes from Frames from Frame
132  std::map<SumoXMLAttr, std::string> valuesMap = myAdditionalFrameParent->myAdditionalAttributes->getAttributesAndValues(true);
133  // fill valuesOfElement with Netedit attributes from Frame
134  myAdditionalFrameParent->myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, nullptr);
135  // Check if ID has to be generated
136  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
137  valuesMap[SUMO_ATTR_ID] = myAdditionalFrameParent->generateID(nullptr);
138  }
139  // obtain lane IDs
140  std::vector<std::string> laneIDs;
141  for (auto i : mySelectedLanes) {
142  laneIDs.push_back(i.first->getID());
143  }
144  valuesMap[SUMO_ATTR_LANES] = joinToString(laneIDs, " ");
145  // Obtain clicked position over first lane
146  valuesMap[SUMO_ATTR_POSITION] = toString(mySelectedLanes.front().second);
147  // Obtain clicked position over last lane
148  valuesMap[SUMO_ATTR_ENDPOS] = toString(mySelectedLanes.back().second);
149  // parse common attributes
150  if (!myAdditionalFrameParent->buildAdditionalCommonAttributes(valuesMap, tagValues)) {
151  return false;
152  }
153  // show warning dialogbox and stop check if input parameters are valid
154  if (myAdditionalFrameParent->myAdditionalAttributes->areValuesValid() == false) {
155  myAdditionalFrameParent->myAdditionalAttributes->showWarningMessage();
156  return false;
157  } else {
158  // declare SUMOSAXAttributesImpl_Cached to convert valuesMap into SUMOSAXAttributes
159  SUMOSAXAttributesImpl_Cached SUMOSAXAttrs(valuesMap, myAdditionalFrameParent->getPredefinedTagsMML(), toString(tagValues.getTag()));
160  // try to build additional
161  if (GNEAdditionalHandler::buildAdditional(myAdditionalFrameParent->myViewNet, true, myAdditionalFrameParent->myAdditionalTagSelector->getCurrentTagProperties().getTag(), SUMOSAXAttrs, nullptr)) {
162  // abort consecutive lane selector
163  abortConsecutiveLaneSelector();
164  // refresh additional attributes
165  myAdditionalFrameParent->myAdditionalAttributes->refreshRows();
166  return true;
167  } else {
168  return false;
169  }
170  }
171 }
172 
173 
174 void
176  // reset color of all candidate lanes
177  for (auto i : myCandidateLanes) {
178  i->setSpecialColor(nullptr);
179  }
180  // clear candidate colors
181  myCandidateLanes.clear();
182  // reset color of all selected lanes
183  for (auto i : mySelectedLanes) {
184  i.first->setSpecialColor(nullptr);
185  }
186  // clear selected lanes
187  mySelectedLanes.clear();
188  // disable buttons
189  myStopSelectingButton->disable();
190  myAbortSelectingButton->disable();
191  // update view (due colors)
192  myAdditionalFrameParent->getViewNet()->update();
193 }
194 
195 
196 bool
198  // first check that lane exist
199  if (lane == nullptr) {
200  return false;
201  }
202  // check that lane wasn't already selected
203  for (auto i : mySelectedLanes) {
204  if (i.first == lane) {
205  WRITE_WARNING("Duplicated lanes aren't allowed");
206  return false;
207  }
208  }
209  // check that there is candidate lanes
210  if (mySelectedLanes.size() > 0) {
211  if (myCandidateLanes.empty()) {
212  WRITE_WARNING("Only candidate lanes are allowed");
213  return false;
214  } else if ((myCandidateLanes.size() > 0) && (std::find(myCandidateLanes.begin(), myCandidateLanes.end(), lane) == myCandidateLanes.end())) {
215  WRITE_WARNING("Only consecutive lanes are allowed");
216  return false;
217  }
218  }
219  // select lane and save the clicked position
220  mySelectedLanes.push_back(std::make_pair(lane, lane->getLaneShape().nearest_offset_to_point2D(clickedPosition) / lane->getLengthGeometryFactor()));
221  // change color of selected lane
222  lane->setSpecialColor(&mySelectedLaneColor);
223  // restore original color of candidates (except already selected)
224  for (auto i : myCandidateLanes) {
225  if (!isLaneSelected(i)) {
226  i->setSpecialColor(nullptr);
227  }
228  }
229  // clear candidate lanes
230  myCandidateLanes.clear();
231  // fill candidate lanes
232  for (auto i : lane->getParentEdge()->getGNEConnections()) {
233  // check that possible candidate lane isn't already selected
234  if ((lane == i->getLaneFrom()) && (!isLaneSelected(i->getLaneTo()))) {
235  // set candidate lane
236  i->getLaneTo()->setSpecialColor(&myCandidateLaneColor);
237  myCandidateLanes.push_back(i->getLaneTo());
238  }
239  }
240  // update view (due colors)
241  myAdditionalFrameParent->getViewNet()->update();
242  return true;
243 }
244 
245 
246 void
248  if (mySelectedLanes.size() > 1) {
249  mySelectedLanes.pop_back();
250  } else {
251  WRITE_WARNING("First lane cannot be removed");
252  }
253 }
254 
255 
256 bool
258  return myStopSelectingButton->isEnabled();
259 }
260 
261 
262 bool
264  return shown();
265 }
266 
267 
268 const RGBColor&
270  return mySelectedLaneColor;
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  FXGroupBox(additionalFrameParent->myContentFrame, "Edges", GUIDesignGroupBoxFrame),
310  myAdditionalFrameParent(additionalFrameParent) {
311  // Create menuCheck for selected edges
312  myUseSelectedEdgesCheckButton = new FXCheckButton(this, ("Use selected " + toString(SUMO_TAG_EDGE) + "s").c_str(), this, MID_GNE_ADDITIONALFRAME_USESELECTED, GUIDesignCheckButton);
313 
314  // Create search box
316 
317  // Create list
318  myList = new FXList(this, this, MID_GNE_ADDITIONALFRAME_SELECT, GUIDesignListFixedHeight, 0, 0, 0, 100);
319 
320  // Create horizontal frame
321  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, 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::string
339  std::vector<std::string> vectorOfIds;
340  if (myUseSelectedEdgesCheckButton->getCheck()) {
341  // get Selected edges
342  std::vector<GNEEdge*> selectedEdges = myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(true);
343  // Iterate over selectedEdges and getId
344  for (auto i : selectedEdges) {
345  vectorOfIds.push_back(i->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 joinToString(vectorOfIds, " ");
356 }
357 
358 
359 void
361  // clear list of egdge ids
362  myList->clearItems();
363  // get all edges of net
365  std::vector<GNEEdge*> vectorOfEdges = myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(false);
366  // iterate over edges of net
367  for (auto i : vectorOfEdges) {
368  // If search criterium is correct, then append ittem
369  if (i->getID().find(search) != std::string::npos) {
370  myList->appendItem(i->getID().c_str());
371  }
372  }
373  // By default, CheckBox for useSelectedEdges isn't checked
374  myUseSelectedEdgesCheckButton->setCheck(false);
375  // Recalc Frame
376  recalc();
377  // Update Frame
378  update();
379  // Show dialog
380  show();
381 }
382 
383 
384 void
386  FXGroupBox::hide();
387 }
388 
389 
390 void
392  // Enable or disable use selected edges
393  if (myAdditionalFrameParent->getViewNet()->getNet()->retrieveEdges(true).size() > 0) {
394  myUseSelectedEdgesCheckButton->enable();
395  } else {
396  myUseSelectedEdgesCheckButton->disable();
397  }
398 }
399 
400 
401 long
403  if (myUseSelectedEdgesCheckButton->getCheck()) {
404  myEdgesSearch->hide();
405  myList->hide();
406  myClearEdgesSelection->hide();
407  myInvertEdgesSelection->hide();
408  } else {
409  myEdgesSearch->show();
410  myList->show();
411  myClearEdgesSelection->show();
412  myInvertEdgesSelection->show();
413  }
414  // Recalc Frame
415  recalc();
416  // Update Frame
417  update();
418  return 1;
419 }
420 
421 
422 long
424  // Show only Id's of SelectorChildEdges that contains the searched string
425  showSelectorChildEdgesModul(myEdgesSearch->getText().text());
426  return 1;
427 }
428 
429 
430 long
432  return 1;
433 }
434 
435 
436 long
438  for (int i = 0; i < myList->getNumItems(); i++) {
439  if (myList->getItem(i)->isSelected()) {
440  myList->deselectItem(i);
441  }
442  }
443  return 1;
444 }
445 
446 
447 long
449  for (int i = 0; i < myList->getNumItems(); i++) {
450  if (myList->getItem(i)->isSelected()) {
451  myList->deselectItem(i);
452  } else {
453  myList->selectItem(i);
454  }
455  }
456  return 1;
457 }
458 
459 // ---------------------------------------------------------------------------
460 // GNEAdditionalFrame::SelectorChildLanes - methods
461 // ---------------------------------------------------------------------------
462 
464  FXGroupBox(additionalFrameParent->myContentFrame, "Lanes", GUIDesignGroupBoxFrame),
465  myAdditionalFrameParent(additionalFrameParent) {
466  // Create CheckBox for selected lanes
467  myUseSelectedLanesCheckButton = new FXCheckButton(this, ("Use selected " + toString(SUMO_TAG_LANE) + "s").c_str(), this, MID_GNE_ADDITIONALFRAME_USESELECTED, GUIDesignCheckButton);
468 
469  // Create search box
471 
472  // Create list
473  myList = new FXList(this, this, MID_GNE_ADDITIONALFRAME_SELECT, GUIDesignListFixedHeight, 0, 0, 0, 100);
474 
475  // Create horizontal frame
476  FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
477 
478  // Create button for clear selection
479  clearLanesSelection = new FXButton(buttonsFrame, "clear", nullptr, this, MID_GNE_ADDITIONALFRAME_CLEARSELECTION, GUIDesignButtonRectangular);
480 
481  // Create button for invert selection
482  invertLanesSelection = new FXButton(buttonsFrame, "invert", nullptr, this, MID_GNE_ADDITIONALFRAME_INVERTSELECTION, GUIDesignButtonRectangular);
483 
484  // Hide List
486 }
487 
488 
490 
491 
492 std::string
494  std::vector<std::string> vectorOfIds;
495  if (myUseSelectedLanesCheckButton->getCheck()) {
496  // get Selected lanes
497  std::vector<GNELane*> selectedLanes = myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(true);
498  // Iterate over selectedLanes and getId
499  for (auto i : selectedLanes) {
500  vectorOfIds.push_back(i->getID());
501  }
502  } else {
503  // Obtain Id's of list
504  for (int i = 0; i < myList->getNumItems(); i++) {
505  if (myList->isItemSelected(i)) {
506  vectorOfIds.push_back(myList->getItem(i)->getText().text());
507  }
508  }
509  }
510  return joinToString(vectorOfIds, " ");
511 }
512 
513 
514 void
516  myList->clearItems();
517  std::vector<GNELane*> vectorOfLanes = myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(false);
518  for (auto i : vectorOfLanes) {
519  if (i->getID().find(search) != std::string::npos) {
520  myList->appendItem(i->getID().c_str());
521  }
522  }
523  // By default, CheckBox for useSelectedLanes isn't checked
524  myUseSelectedLanesCheckButton->setCheck(false);
525  // Show list
526  show();
527 }
528 
529 
530 void
532  FXGroupBox::hide();
533 }
534 
535 
536 void
538  // Enable or disable use selected Lanes
539  if (myAdditionalFrameParent->getViewNet()->getNet()->retrieveLanes(true).size() > 0) {
540  myUseSelectedLanesCheckButton->enable();
541  } else {
542  myUseSelectedLanesCheckButton->disable();
543  }
544 }
545 
546 
547 long
549  if (myUseSelectedLanesCheckButton->getCheck()) {
550  myLanesSearch->hide();
551  myList->hide();
552  clearLanesSelection->hide();
553  invertLanesSelection->hide();
554  } else {
555  myLanesSearch->show();
556  myList->show();
557  clearLanesSelection->show();
558  invertLanesSelection->show();
559  }
560  // Recalc Frame
561  recalc();
562  // Update Frame
563  update();
564  return 1;
565 }
566 
567 
568 long
570  // Show only Id's of SelectorChildLanes that contains the searched string
571  showSelectorChildLanesModul(myLanesSearch->getText().text());
572  return 1;
573 }
574 
575 
576 long
578  return 1;
579 }
580 
581 
582 long
584  for (int i = 0; i < myList->getNumItems(); i++) {
585  if (myList->getItem(i)->isSelected()) {
586  myList->deselectItem(i);
587  }
588  }
589  return 1;
590 }
591 
592 
593 long
595  for (int i = 0; i < myList->getNumItems(); i++) {
596  if (myList->getItem(i)->isSelected()) {
597  myList->deselectItem(i);
598  } else {
599  myList->selectItem(i);
600  }
601  }
602  return 1;
603 }
604 
605 // ===========================================================================
606 // method definitions
607 // ===========================================================================
608 
609 GNEAdditionalFrame::GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
610  GNEFrame(horizontalFrameParent, viewNet, "Additionals") {
611 
612  // create item Selector modul for additionals
613  myAdditionalTagSelector = new GNEFrameModuls::TagSelector(this, GNEAttributeCarrier::TagType::TAGTYPE_ADDITIONAL);
614 
615  // Create additional parameters
617 
618  // Create Netedit parameter
620 
621  // Create consecutive Lane Selector
623 
624  // Create selector parent
626 
629 
632 
633  // set BusStop as default additional
635 }
636 
637 
639 
640 
641 void
643  // refresh item selector
645  // show frame
646  GNEFrame::show();
647 }
648 
649 
650 bool
652  // first check that current selected additional is valid
654  myViewNet->setStatusBarText("Current selected additional isn't valid.");
655  return false;
656  }
657  // obtain tagproperty (only for improve code legibility)
658  const auto& tagValues = myAdditionalTagSelector->getCurrentTagProperties();
659  // Declare map to keep attributes obtained in frame
660  std::map<SumoXMLAttr, std::string> valuesMap = myAdditionalAttributes->getAttributesAndValues(true);
661  // fill netedit attributes
662  if (!myNeteditAttributes->getNeteditAttributesAndValues(valuesMap, objectsUnderCursor.getLaneFront())) {
663  return false;
664  }
665  // If element owns an parent additional, get id of parent from ParentAdditionalSelector
666  if (tagValues.hasParent() && !buildAdditionalWithParent(valuesMap, objectsUnderCursor.getAdditionalFront(), tagValues)) {
667  return false;
668  }
669  // If consecutive Lane Selector is enabled, it means that either we're selecting lanes or we're finished or we'rent started
670  if (tagValues.hasAttribute(SUMO_ATTR_EDGE) || (tagValues.getTag() == SUMO_TAG_VAPORIZER)) {
671  return buildAdditionalOverEdge(valuesMap, objectsUnderCursor.getLaneFront(), tagValues);
672  } else if (tagValues.hasAttribute(SUMO_ATTR_LANE)) {
673  return buildAdditionalOverLane(valuesMap, objectsUnderCursor.getLaneFront(), tagValues);
674  } else if (tagValues.getTag() == SUMO_TAG_E2DETECTOR_MULTILANE) {
675  return buildAdditionalOverLanes(valuesMap, objectsUnderCursor.getLaneFront(), tagValues);
676  } else {
677  return buildAdditionalOverView(valuesMap, tagValues);
678  }
679 }
680 
681 
682 void
684  // Show frame
685  GNEFrame::show();
686  // Update UseSelectedLane CheckBox
688  // Update UseSelectedLane CheckBox
690 }
691 
692 
695  return mySelectorParentLanes;
696 }
697 
698 
699 void
702  // show additional attributes modul
704  // show netedit attributes
706  // Show myAdditionalFrameParent if we're adding a additional with parent
709  } else {
711  }
712  // Show SelectorChildEdges if we're adding an additional that own the attribute SUMO_ATTR_EDGES
715  } else {
717  }
718  // Show SelectorChildLanes or consecutive lane selector if we're adding an additional that own the attribute SUMO_ATTR_LANES
722  // show selector parent lane and hide selector child lane
725  } else {
726  // show selector child lane and hide selector parent lane
729  }
730  } else {
733  }
734  } else {
735  // hide all moduls if additional isn't valid
742  }
743 }
744 
745 
746 std::string
748  // obtain current number of additionals to generate a new index faster
750  // obtain tag Properties (only for improve code legilibility
751  const auto& tagProperties = myAdditionalTagSelector->getCurrentTagProperties();
752  if (netElement) {
753  // special case for vaporizers
754  if (tagProperties.getTag() == SUMO_TAG_VAPORIZER) {
755  return netElement->getID();
756  } else {
757  // generate ID using netElement
758  while (myViewNet->getNet()->retrieveAdditional(tagProperties.getTag(), tagProperties.getTagStr() + "_" + netElement->getID() + "_" + toString(additionalIndex), false) != nullptr) {
759  additionalIndex++;
760  }
761  return tagProperties.getTagStr() + "_" + netElement->getID() + "_" + toString(additionalIndex);
762  }
763  } else {
764  // generate ID without netElement
765  while (myViewNet->getNet()->retrieveAdditional(tagProperties.getTag(), tagProperties.getTagStr() + "_" + toString(additionalIndex), false) != nullptr) {
766  additionalIndex++;
767  }
768  return tagProperties.getTagStr() + "_" + toString(additionalIndex);
769  }
770 }
771 
772 
773 bool
774 GNEAdditionalFrame::buildAdditionalWithParent(std::map<SumoXMLAttr, std::string>& valuesMap, GNEAdditional* additionalParent, const GNEAttributeCarrier::TagProperties& tagValues) {
775  // if user click over an additional element parent, mark int in ParentAdditionalSelector
776  if (additionalParent && (additionalParent->getTagProperty().getTag() == tagValues.getParentTag())) {
777  valuesMap[GNE_ATTR_PARENT] = additionalParent->getID();
778  myParentAdditional->setIDSelected(additionalParent->getID());
779  }
780  // stop if currently there isn't a valid selected parent
781  if (myParentAdditional->getIdSelected() != "") {
783  } else {
784  myAdditionalAttributes->showWarningMessage("A " + toString(tagValues.getParentTag()) + " must be selected before insertion of " + myAdditionalTagSelector->getCurrentTagProperties().getTagStr() + ".");
785  return false;
786  }
787  return true;
788 }
789 
790 
791 bool
792 GNEAdditionalFrame::buildAdditionalCommonAttributes(std::map<SumoXMLAttr, std::string>& valuesMap, const GNEAttributeCarrier::TagProperties& tagValues) {
793  // If additional has a interval defined by a begin or end, check that is valid
794  if (tagValues.hasAttribute(SUMO_ATTR_STARTTIME) && tagValues.hasAttribute(SUMO_ATTR_END)) {
795  double begin = GNEAttributeCarrier::parse<double>(valuesMap[SUMO_ATTR_STARTTIME]);
796  double end = GNEAttributeCarrier::parse<double>(valuesMap[SUMO_ATTR_END]);
797  if (begin > end) {
798  myAdditionalAttributes->showWarningMessage("Attribute '" + toString(SUMO_ATTR_STARTTIME) + "' cannot be greater than attribute '" + toString(SUMO_ATTR_END) + "'.");
799  return false;
800  }
801  }
802  // If additional own the attribute SUMO_ATTR_FILE but was't defined, will defined as <ID>.xml
803  if (tagValues.hasAttribute(SUMO_ATTR_FILE) && valuesMap[SUMO_ATTR_FILE] == "") {
805  // SUMO_ATTR_FILE is optional for calibrators and rerouters (fails to load in sumo when given and the file does not exist)
806  valuesMap[SUMO_ATTR_FILE] = (valuesMap[SUMO_ATTR_ID] + ".xml");
807  }
808  }
809  // If element own a list of SelectorChildEdges as attribute
810  if (tagValues.hasAttribute(SUMO_ATTR_EDGES) && valuesMap[SUMO_ATTR_EDGES].empty()) {
811  // obtain edge IDs
813  // check if attribute has at least one edge
814  if (valuesMap[SUMO_ATTR_EDGES] == "") {
815  myAdditionalAttributes->showWarningMessage("List of " + toString(SUMO_TAG_EDGE) + "s cannot be empty");
816  return false;
817  }
818  }
819  // get values of mySelectorChildLanes, if tag correspond to an element that has lanes as children
820  if (tagValues.hasAttribute(SUMO_ATTR_LANES) && valuesMap[SUMO_ATTR_LANES].empty()) {
821  // obtain lane IDs
823  // check if attribute has at least a lane
824  if (valuesMap[SUMO_ATTR_LANES] == "") {
825  myAdditionalAttributes->showWarningMessage("List of " + toString(SUMO_TAG_LANE) + "s cannot be empty");
826  return false;
827  }
828  }
829  // all ok, continue building additionals
830  return true;
831 }
832 
833 
834 bool
835 GNEAdditionalFrame::buildAdditionalOverEdge(std::map<SumoXMLAttr, std::string>& valuesMap, GNELane* lane, const GNEAttributeCarrier::TagProperties& tagValues) {
836  // check that edge exist
837  if (lane) {
838  // Get attribute lane's edge
839  valuesMap[SUMO_ATTR_EDGE] = lane->getParentEdge()->getID();
840  // Check if ID has to be generated
841  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
842  valuesMap[SUMO_ATTR_ID] = generateID(lane->getParentEdge());
843  }
844  } else {
845  return false;
846  }
847  // parse common attributes
848  if (!buildAdditionalCommonAttributes(valuesMap, tagValues)) {
849  return false;
850  }
851  // show warning dialogbox and stop check if input parameters are valid
854  return false;
855  } else {
856  // declare SUMOSAXAttributesImpl_Cached to convert valuesMap into SUMOSAXAttributes
857  SUMOSAXAttributesImpl_Cached SUMOSAXAttrs(valuesMap, getPredefinedTagsMML(), toString(tagValues.getTag()));
858  // try to build additional
860  // Refresh additional Parent Selector (For additionals that have a limited number of children)
862  // clear selected eddges and lanes
863  mySelectorChildEdges->onCmdClearSelection(nullptr, 0, nullptr);
864  mySelectorChildLanes->onCmdClearSelection(nullptr, 0, nullptr);
865  // refresh additional attributes
867  return true;
868  } else {
869  return false;
870  }
871  }
872 }
873 
874 
875 bool
876 GNEAdditionalFrame::buildAdditionalOverLane(std::map<SumoXMLAttr, std::string>& valuesMap, GNELane* lane, const GNEAttributeCarrier::TagProperties& tagValues) {
877  // check that lane exist
878  if (lane != nullptr) {
879  // Get attribute lane
880  valuesMap[SUMO_ATTR_LANE] = lane->getID();
881  // Check if ID has to be generated
882  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
883  valuesMap[SUMO_ATTR_ID] = generateID(lane);
884  }
885  } else {
886  return false;
887  }
888  // Obtain position of the mouse over lane (limited over grid)
890  // set attribute position as mouse position over lane
891  valuesMap[SUMO_ATTR_POSITION] = toString(mousePositionOverLane);
892  // parse common attributes
893  if (!buildAdditionalCommonAttributes(valuesMap, tagValues)) {
894  return false;
895  }
896  // show warning dialogbox and stop check if input parameters are valid
899  return false;
900  } else {
901  // declare SUMOSAXAttributesImpl_Cached to convert valuesMap into SUMOSAXAttributes
902  SUMOSAXAttributesImpl_Cached SUMOSAXAttrs(valuesMap, getPredefinedTagsMML(), toString(tagValues.getTag()));
903  // try to build additional
905  // Refresh additional Parent Selector (For additionals that have a limited number of children)
907  // clear selected eddges and lanes
908  mySelectorChildEdges->onCmdClearSelection(nullptr, 0, nullptr);
909  mySelectorChildLanes->onCmdClearSelection(nullptr, 0, nullptr);
910  // refresh additional attributes
912  return true;
913  } else {
914  return false;
915  }
916  }
917 }
918 
919 
920 bool
921 GNEAdditionalFrame::buildAdditionalOverLanes(std::map<SumoXMLAttr, std::string>& valuesMap, GNELane* lane, const GNEAttributeCarrier::TagProperties& tagValues) {
922  // stop if lane isn't valid
923  if (lane == nullptr) {
924  return false;
925  }
927  // select clicked lane, but don't build additional
929  return false;
930  } else if (mySelectorParentLanes->getSelectedLanes().empty()) {
931  // if there isn't selected lanes, that means that we will be start selecting lanes
933  return false;
934  } else {
935  // Check if ID has to be generated
936  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
937  valuesMap[SUMO_ATTR_ID] = generateID(mySelectorParentLanes->getSelectedLanes().front().first);
938  }
939  // obtain lane IDs
940  std::vector<std::string> laneIDs;
941  for (auto i : mySelectorParentLanes->getSelectedLanes()) {
942  laneIDs.push_back(i.first->getID());
943  }
944  valuesMap[SUMO_ATTR_LANES] = joinToString(laneIDs, " ");
945  // Check if clicked position over first lane has to be obtained
946  if (tagValues.hasAttribute(SUMO_ATTR_POSITION)) {
947  valuesMap[SUMO_ATTR_POSITION] = toString(mySelectorParentLanes->getSelectedLanes().front().second);
948  }
949  // Check if clicked position over last lane has to be obtained
950  if (tagValues.hasAttribute(SUMO_ATTR_ENDPOS)) {
951  valuesMap[SUMO_ATTR_ENDPOS] = toString(mySelectorParentLanes->getSelectedLanes().back().second);
952  }
953  // parse common attributes
954  if (!buildAdditionalCommonAttributes(valuesMap, tagValues)) {
955  return false;
956  }
957  // show warning dialogbox and stop check if input parameters are valid
958  if (myAdditionalAttributes->areValuesValid() == false) {
960  return false;
961  } else {
962  // declare SUMOSAXAttributesImpl_Cached to convert valuesMap into SUMOSAXAttributes
963  SUMOSAXAttributesImpl_Cached SUMOSAXAttrs(valuesMap, getPredefinedTagsMML(), toString(tagValues.getTag()));
964  // try to build additional
966  // Refresh additional Parent Selector (For additionals that have a limited number of children)
968  // abort lane selector
970  // refresh additional attributes
972  return true;
973  } else {
974  // additional cannot be build
975  return false;
976  }
977  }
978  }
979 }
980 
981 
982 bool
983 GNEAdditionalFrame::buildAdditionalOverView(std::map<SumoXMLAttr, std::string>& valuesMap, const GNEAttributeCarrier::TagProperties& tagValues) {
984  // Check if ID has to be generated
985  if (valuesMap.count(SUMO_ATTR_ID) == 0) {
986  valuesMap[SUMO_ATTR_ID] = generateID(nullptr);
987  }
988  // Obtain position as the clicked position over view
990  // parse common attributes
991  if (!buildAdditionalCommonAttributes(valuesMap, tagValues)) {
992  return false;
993  }
994  // show warning dialogbox and stop check if input parameters are valid
995  if (myAdditionalAttributes->areValuesValid() == false) {
997  return false;
998  } else {
999  // declare SUMOSAXAttributesImpl_Cached to convert valuesMap into SUMOSAXAttributes
1000  SUMOSAXAttributesImpl_Cached SUMOSAXAttrs(valuesMap, getPredefinedTagsMML(), toString(tagValues.getTag()));
1001  // try to build additional
1003  // Refresh additional Parent Selector (For additionals that have a limited number of children)
1005  // clear selected eddges and lanes
1006  mySelectorChildEdges->onCmdClearSelection(nullptr, 0, nullptr);
1007  mySelectorChildLanes->onCmdClearSelection(nullptr, 0, nullptr);
1008  // refresh additional attributes
1010  return true;
1011  } else {
1012  return false;
1013  }
1014  }
1015 }
1016 
1017 /****************************************************************************/
GNEFrameModuls::SelectorParent::showSelectorParentModul
bool showSelectorParentModul(SumoXMLTag additionalTypeParent)
Show list of SelectorParent Modul.
Definition: GNEFrameModuls.cpp:1764
GNEAdditionalFrame
Definition: GNEAdditionalFrame.h:34
GNEAdditionalFrame::SelectorParentLanes::getSelectedLanes
const std::vector< std::pair< GNELane *, double > > & getSelectedLanes() const
get current selected lanes
Definition: GNEAdditionalFrame.cpp:275
GUIDesignAuxiliarHorizontalFrame
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:273
GNENet::retrieveAdditional
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2183
GNEAdditionalFrame::myAdditionalAttributes
GNEFrameAttributesModuls::AttributesCreator * myAdditionalAttributes
internal additional attributes
Definition: GNEAdditionalFrame.h:313
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEAdditionalFrame::SelectorParentLanes::getSelectedLaneColor
const RGBColor & getSelectedLaneColor() const
get selected lane color
Definition: GNEAdditionalFrame.cpp:269
GNEAdditionalFrame::SelectorChildEdges::myUseSelectedEdgesCheckButton
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
Definition: GNEAdditionalFrame.h:176
GUIDesignTextFieldNCol
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:42
GNEAdditionalFrame::SelectorParentLanes::showSelectorParentLanesModul
void showSelectorParentLanesModul()
show SelectorParentLanes modul
Definition: GNEAdditionalFrame.cpp:90
GNEAdditional.h
GNEAttributeCarrier::TagProperties
struct with the attribute Properties
Definition: GNEAttributeCarrier.h:317
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
GNEAdditionalFrame::SelectorParentLanes::onCmdStopSelection
long onCmdStopSelection(FXObject *, FXSelector, void *)
Definition: GNEAdditionalFrame.cpp:281
GNEAdditionalFrame::SelectorChildEdges::SelectorChildEdges
SelectorChildEdges(GNEAdditionalFrame *additionalFrameParent)
FOX-declaration.
Definition: GNEAdditionalFrame.cpp:308
MID_GNE_ADDITIONALFRAME_USESELECTED
use selected elements
Definition: GUIAppEnum.h:792
GNEAttributeCarrier::TagProperties::getTagStr
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
Definition: GNEAttributeCarrier.cpp:529
GNEAdditionalFrame::buildAdditionalCommonAttributes
bool buildAdditionalCommonAttributes(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build common additional attributes
Definition: GNEAdditionalFrame.cpp:792
GNEAdditionalFrame::SelectorChildEdges::hideSelectorChildEdgesModul
void hideSelectorChildEdgesModul()
hide SelectorChildEdges Modul
Definition: GNEAdditionalFrame.cpp:385
GNELane::getParentEdge
GNEEdge * getParentEdge() const
Returns underlying parent edge.
Definition: GNELane.cpp:1371
GNEAdditionalFrame::SelectorParentLanes::onCmdAbortSelection
long onCmdAbortSelection(FXObject *, FXSelector, void *)
Called when the user press abort selection button.
Definition: GNEAdditionalFrame.cpp:288
GNEFrameModuls::SelectorParent::setIDSelected
void setIDSelected(const std::string &id)
select manually a element of the list
Definition: GNEFrameModuls.cpp:1747
GNEFrameAttributesModuls::NeteditAttributes
Definition: GNEFrameAttributesModuls.h:714
GNEAdditionalFrame::myAdditionalTagSelector
GNEFrameModuls::TagSelector * myAdditionalTagSelector
item selector
Definition: GNEAdditionalFrame.h:310
GNEAdditionalFrame::addAdditional
bool addAdditional(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
add additional element
Definition: GNEAdditionalFrame.cpp:651
GNEFrameAttributesModuls::AttributesCreator
Definition: GNEFrameAttributesModuls.h:148
GNEFrameAttributesModuls::AttributesCreator::areValuesValid
bool areValuesValid() const
check if parameters of attributes are valid
Definition: GNEFrameAttributesModuls.cpp:731
GNEAdditionalFrame::myNeteditAttributes
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
Definition: GNEAdditionalFrame.h:316
SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:49
GNEViewNet::setStatusBarText
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:523
GNEAdditionalFrame::SelectorChildLanes::invertLanesSelection
FXButton * invertLanesSelection
button for invert selection
Definition: GNEAdditionalFrame.h:256
SUMO_ATTR_EDGE
Definition: SUMOXMLDefinitions.h:423
GNEAdditionalFrame::showSelectorChildLanesModul
void showSelectorChildLanesModul()
show selector child lane and update use selected edges/lanes
Definition: GNEAdditionalFrame.cpp:683
GNEAdditionalFrame::SelectorChildLanes::clearLanesSelection
FXButton * clearLanesSelection
button for clear selection
Definition: GNEAdditionalFrame.h:253
GNEAdditionalFrame::SelectorChildLanes::onCmdClearSelection
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
Definition: GNEAdditionalFrame.cpp:583
GUIDesignListFixedHeight
#define GUIDesignListFixedHeight
design for FXLists with height fixed
Definition: GUIDesigns.h:516
GNEAdditionalFrame::SelectorChildEdges::myClearEdgesSelection
FXButton * myClearEdgesSelection
button for clear selection
Definition: GNEAdditionalFrame.h:185
GNEFrame
Definition: GNEFrame.h:34
GNEViewNet
Definition: GNEViewNet.h:42
MID_GNE_ADDITIONALFRAME_SEARCH
search element
Definition: GUIAppEnum.h:790
GNEEdge::getGNEConnections
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:880
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
SUMO_TAG_NOTHING
invalid tag
Definition: SUMOXMLDefinitions.h:43
GNEAdditionalFrame::mySelectorParentLanes
SelectorParentLanes * mySelectorParentLanes
Modul for select parent lanes (currently only consecutives)
Definition: GNEAdditionalFrame.h:319
GUIDesigns.h
SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
GNEAdditionalFrame::buildAdditionalOverEdge
bool buildAdditionalOverEdge(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over an edge (parent of lane)
Definition: GNEAdditionalFrame.cpp:835
GNEAdditionalFrame::SelectorChildEdges::onCmdClearSelection
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
Definition: GNEAdditionalFrame.cpp:437
SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:798
GUIDesignTextField
#define GUIDesignTextField
Definition: GUIDesigns.h:33
GNEAdditionalFrame::SelectorChildEdges::onCmdTypeInSearchBox
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
Definition: GNEAdditionalFrame.cpp:423
GNEFrame::myContentFrame
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:124
SUMO_ATTR_FILE
Definition: SUMOXMLDefinitions.h:664
GNEAdditionalFrame::SelectorChildEdges::getEdgeIdsSelected
std::string getEdgeIdsSelected() const
get list of selecte id's in string format
Definition: GNEAdditionalFrame.cpp:338
GNEAdditionalFrame::SelectorParentLanes::isShown
bool isShown() const
return true if modul is shown
Definition: GNEAdditionalFrame.cpp:263
GNEAdditionalFrame::SelectorParentLanes::stopConsecutiveLaneSelector
bool stopConsecutiveLaneSelector()
stop selection of consecutive lanes
Definition: GNEAdditionalFrame.cpp:121
GUISUMOAbstractView::snapToActiveGrid
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.
Definition: GUISUMOAbstractView.cpp:196
GUIDesignButton
#define GUIDesignButton
Definition: GUIDesigns.h:50
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:523
GUIAppEnum.h
GNEFrameAttributesModuls::AttributesCreator::hideAttributesCreatorModul
void hideAttributesCreatorModul()
hide group box
Definition: GNEFrameAttributesModuls.cpp:659
GNEAdditionalFrame::SelectorParentLanes
Definition: GNEAdditionalFrame.h:42
GNEAttributeCarrier::TagProperties::hasAttribute
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
Definition: GNEAttributeCarrier.cpp:680
GUIDesignButtonRectangular
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:56
GNEFrameAttributesModuls::AttributesCreator::getAttributesAndValues
std::map< SumoXMLAttr, std::string > getAttributesAndValues(bool includeAll) const
get attributes and their values
Definition: GNEFrameAttributesModuls.cpp:671
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNEAdditionalHandler::buildAdditional
static bool buildAdditional(GNEViewNet *viewNet, bool allowUndoRedo, SumoXMLTag tag, const SUMOSAXAttributes &attrs, HierarchyInsertedAdditionals *insertedAdditionals)
Build additionals.
Definition: GNEAdditionalHandler.cpp:168
PositionVector::nearest_offset_to_point2D
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Definition: PositionVector.cpp:817
RGBColor
Definition: RGBColor.h:39
MID_GNE_ADDITIONALFRAME_CLEARSELECTION
clear selection of elements
Definition: GUIAppEnum.h:796
GNEAdditionalFrame::SelectorChildLanes::onCmdTypeInSearchBox
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
Definition: GNEAdditionalFrame.cpp:569
GNEAdditionalFrame::SelectorParentLanes::isLaneSelected
bool isLaneSelected(GNELane *lane) const
check if certain lane is selected
Definition: GNEAdditionalFrame.cpp:295
GNEAdditionalFrame::SelectorChildEdges::onCmdSelectEdge
long onCmdSelectEdge(FXObject *, FXSelector, void *)
called when user select a edge of the list
Definition: GNEAdditionalFrame.cpp:431
GNEFrameModuls::SelectorParent
Definition: GNEFrameModuls.h:479
MID_GNE_ADDITIONALFRAME_SELECT
select element
Definition: GUIAppEnum.h:794
GNEAttributeCarrier::getTagProperty
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Definition: GNEAttributeCarrier.cpp:1273
GNEAdditionalFrame::SelectorChildLanes::~SelectorChildLanes
~SelectorChildLanes()
destructor
Definition: GNEAdditionalFrame.cpp:489
GNEAdditionalFrame::SelectorParentLanes::abortConsecutiveLaneSelector
void abortConsecutiveLaneSelector()
abort selection of consecutive lanes
Definition: GNEAdditionalFrame.cpp:175
GNEAdditionalFrame::SelectorChildEdges::myList
FXList * myList
List of SelectorChildEdges.
Definition: GNEAdditionalFrame.h:179
GNELane::getLaneShape
const PositionVector & getLaneShape() const
Definition: GNELane.cpp:86
SUMOSAXAttributesImpl_Cached
Encapsulated Xerces-SAX-attributes.
Definition: SUMOSAXAttributesImpl_Cached.h:43
GNEViewNetHelper::ObjectsUnderCursor
class used to group all variables related with objects under cursor after a click over view
Definition: GNEViewNetHelper.h:148
GNEFrameModuls::TagSelector
Definition: GNEFrameModuls.h:44
MID_GNE_ADDITIONALFRAME_ABORTSELECTION
abort selection of consecutive egdes/lanes
Definition: GUIAppEnum.h:804
GNEAdditionalFrame::SelectorChildEdges
Definition: GNEAdditionalFrame.h:127
GNEAdditionalFrame::buildAdditionalOverLane
bool buildAdditionalOverLane(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over a single lane
Definition: GNEAdditionalFrame.cpp:876
GNEViewNet.h
GNEAdditionalHandler.h
GNELane::getLengthGeometryFactor
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1428
GNEAdditionalFrame::SelectorChildLanes::updateUseSelectedLanes
void updateUseSelectedLanes()
Definition: GNEAdditionalFrame.cpp:537
update
SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
GNEAdditionalFrame::~GNEAdditionalFrame
~GNEAdditionalFrame()
Destructor.
Definition: GNEAdditionalFrame.cpp:638
SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
GNEAttributeCarrier::TagProperties::getParentTag
SumoXMLTag getParentTag() const
if Tag owns a parent, return parent tag
Definition: GNEAttributeCarrier.cpp:660
GUIDesignCheckButton
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:115
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEEdge.h
GNEFrame::myViewNet
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:121
GNEAdditionalFrame::SelectorChildEdges::onCmdUseSelectedEdges
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
Definition: GNEAdditionalFrame.cpp:402
GNEFrame::getPredefinedTagsMML
const std::map< int, std::string > & getPredefinedTagsMML() const
get predefinedTagsMML
Definition: GNEFrame.cpp:281
GNEAdditionalFrame::SelectorChildLanes
Definition: GNEAdditionalFrame.h:195
GUIDesignGroupBoxFrame
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:239
SUMO_TAG_REROUTER
A rerouter.
Definition: SUMOXMLDefinitions.h:95
GNEFrameAttributesModuls::NeteditAttributes::showNeteditAttributesModul
void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties &tagValue)
show Netedit attributes modul
Definition: GNEFrameAttributesModuls.cpp:2537
GNEFrameModuls::TagSelector::getCurrentTagProperties
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
Definition: GNEFrameModuls.cpp:203
GNENetElement
Definition: GNENetElement.h:43
GNEAdditionalFrame::mySelectorChildLanes
SelectorChildLanes * mySelectorChildLanes
Modul for select child lanes.
Definition: GNEAdditionalFrame.h:328
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:190
GNEAdditionalFrame::SelectorChildEdges::updateUseSelectedEdges
void updateUseSelectedEdges()
Update use selectedEdges.
Definition: GNEAdditionalFrame.cpp:391
GNELane.h
SUMO_ATTR_STARTTIME
Definition: SUMOXMLDefinitions.h:889
GNEFrameAttributesModuls::NeteditAttributes::getNeteditAttributesAndValues
bool getNeteditAttributesAndValues(std::map< SumoXMLAttr, std::string > &valuesMap, const GNELane *lane) const
fill valuesMap with netedit attributes
Definition: GNEFrameAttributesModuls.cpp:2594
GNELane::setSpecialColor
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:934
GNEFrameModuls::SelectorParent::getIdSelected
std::string getIdSelected() const
get currently parent additional selected
Definition: GNEFrameModuls.cpp:1736
SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
GNEAdditionalFrame::SelectorChildEdges::showSelectorChildEdgesModul
void showSelectorChildEdgesModul(std::string search="")
Show SelectorChildEdges Modul.
Definition: GNEAdditionalFrame.cpp:360
GNEAdditionalFrame::SelectorChildLanes::hideSelectorChildLanesModul
void hideSelectorChildLanesModul()
hide SelectorChildLanes Modul
Definition: GNEAdditionalFrame.cpp:531
GNEAdditionalFrame::SelectorChildLanes::myLanesSearch
FXTextField * myLanesSearch
text field for search lane IDs
Definition: GNEAdditionalFrame.h:250
SUMO_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (used by Netedit)
Definition: SUMOXMLDefinitions.h:69
GNEAdditionalFrame::SelectorChildLanes::myUseSelectedLanesCheckButton
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
Definition: GNEAdditionalFrame.h:244
SUMO_ATTR_LANES
Definition: SUMOXMLDefinitions.h:638
GNEAdditionalFrame::mySelectorChildEdges
SelectorChildEdges * mySelectorChildEdges
Modul for select child edges.
Definition: GNEAdditionalFrame.h:325
GNEFrameAttributesModuls::AttributesCreator::refreshRows
void refreshRows()
refresh rows (called after creating an element)
Definition: GNEFrameAttributesModuls.cpp:744
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:97
GNEFrameModuls::TagSelector::setCurrentTag
void setCurrentTag(SumoXMLTag newTag)
set current type manually
Definition: GNEFrameModuls.cpp:234
FXDEFMAP
FXDEFMAP(GNEAdditionalFrame::SelectorParentLanes) ConsecutiveLaneSelectorMap[]
GNEAdditionalFrame::tagSelected
void tagSelected()
Tag selected in TagSelector.
Definition: GNEAdditionalFrame.cpp:700
GNEFrameModuls::TagSelector::refreshTagProperties
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show
Definition: GNEFrameModuls.cpp:251
GNEAdditionalFrame::SelectorChildLanes::myList
FXList * myList
List of SelectorChildLanes.
Definition: GNEAdditionalFrame.h:247
SUMO_TAG_VAPORIZER
vaporizer of vehicles
Definition: SUMOXMLDefinitions.h:218
GNEAdditionalFrame::buildAdditionalOverView
bool buildAdditionalOverView(std::map< SumoXMLAttr, std::string > &valuesMap, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over view
Definition: GNEAdditionalFrame.cpp:983
GNEAdditionalFrame::SelectorChildEdges::myEdgesSearch
FXTextField * myEdgesSearch
text field for search edge IDs
Definition: GNEAdditionalFrame.h:182
GNEAdditionalFrame::generateID
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
Definition: GNEAdditionalFrame.cpp:747
GNEAdditionalFrame::getConsecutiveLaneSelector
GNEAdditionalFrame::SelectorParentLanes * getConsecutiveLaneSelector() const
getConsecutive Lane Selector
Definition: GNEAdditionalFrame.cpp:694
SUMOSAXAttributesImpl_Cached.h
GNEAdditionalFrame::show
void show()
show Frame
Definition: GNEAdditionalFrame.cpp:642
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:246
MID_GNE_ADDITIONALFRAME_STOPSELECTION
stop selection of consecutive egdes/lanes
Definition: GUIAppEnum.h:802
GNEAdditionalFrame::SelectorParentLanes::hideSelectorParentLanesModul
void hideSelectorParentLanesModul()
hide SelectorParentLanes
Definition: GNEAdditionalFrame.cpp:99
GNEAdditionalFrame::SelectorParentLanes::removeLastSelectedLane
void removeLastSelectedLane()
remove last added point
Definition: GNEAdditionalFrame.cpp:247
MID_GNE_ADDITIONALFRAME_INVERTSELECTION
invert selection of eleents
Definition: GUIAppEnum.h:798
GNEAdditionalFrame::SelectorChildLanes::showSelectorChildLanesModul
void showSelectorChildLanesModul(std::string search="")
Show list of SelectorChildLanes Modul.
Definition: GNEAdditionalFrame.cpp:515
GNEAdditionalFrame::myParentAdditional
GNEFrameModuls::SelectorParent * myParentAdditional
Modul for select a single parent additional.
Definition: GNEAdditionalFrame.h:322
GNEAdditionalFrame::buildAdditionalOverLanes
bool buildAdditionalOverLanes(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane, const GNEAttributeCarrier::TagProperties &tagValues)
build additional over lanes
Definition: GNEAdditionalFrame.cpp:921
GNEViewNetHelper::ObjectsUnderCursor::getLaneFront
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
Definition: GNEViewNetHelper.cpp:278
config.h
GNEAdditionalFrame::SelectorParentLanes::startConsecutiveLaneSelector
void startConsecutiveLaneSelector(GNELane *lane, const Position &clickedPosition)
start selection of consecutive lanes
Definition: GNEAdditionalFrame.cpp:108
GNEAdditionalFrame::SelectorChildLanes::SelectorChildLanes
SelectorChildLanes(GNEAdditionalFrame *additionalFrameParent)
FOX-declaration.
Definition: GNEAdditionalFrame.cpp:463
GNEAdditionalFrame::SelectorParentLanes::~SelectorParentLanes
~SelectorParentLanes()
destructor
Definition: GNEAdditionalFrame.cpp:86
GNEAdditionalFrame.h
GNEAdditionalFrame::SelectorChildLanes::onCmdInvertSelection
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
Definition: GNEAdditionalFrame.cpp:594
SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:680
Lane
C++ TraCI client API implementation.
GNEAdditionalFrame::SelectorChildLanes::onCmdUseSelectedLanes
long onCmdUseSelectedLanes(FXObject *, FXSelector, void *)
Definition: GNEAdditionalFrame.cpp:548
GNEAttributeCarrier::TagProperties::hasParent
bool hasParent() const
return true if tag correspond to an element that can had another element as parent
Definition: GNEAttributeCarrier.cpp:834
RGBColor::GREEN
static const RGBColor GREEN
Definition: RGBColor.h:190
GNEAdditionalFrame::SelectorChildLanes::onCmdSelectLane
long onCmdSelectLane(FXObject *, FXSelector, void *)
called when user select a lane of the list
Definition: GNEAdditionalFrame.cpp:577
GNEAdditionalFrame::GNEAdditionalFrame
GNEAdditionalFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
Definition: GNEAdditionalFrame.cpp:609
GNEAdditionalFrame::buildAdditionalWithParent
bool buildAdditionalWithParent(std::map< SumoXMLAttr, std::string > &valuesMap, GNEAdditional *parent, const GNEAttributeCarrier::TagProperties &tagValues)
build additional with Parent
Definition: GNEAdditionalFrame.cpp:774
GNEAdditionalFrame::SelectorChildEdges::myInvertEdgesSelection
FXButton * myInvertEdgesSelection
button for invert selection
Definition: GNEAdditionalFrame.h:188
GNEFrameAttributesModuls::NeteditAttributes::hideNeteditAttributesModul
void hideNeteditAttributesModul()
hide Netedit attributes modul
Definition: GNEFrameAttributesModuls.cpp:2588
SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
Definition: SUMOXMLDefinitions.h:91
GNEAdditionalFrame::SelectorChildLanes::getLaneIdsSelected
std::string getLaneIdsSelected() const
get list of selecte lane ids in string format
Definition: GNEAdditionalFrame.cpp:493
GNENet::getNumberOfAdditionals
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
Definition: GNENet.cpp:2210
GNEAdditionalFrame::SelectorChildEdges::~SelectorChildEdges
~SelectorChildEdges()
destructor
Definition: GNEAdditionalFrame.cpp:334
GNEFrame::show
virtual void show()
show Frame
Definition: GNEFrame.cpp:107
GNEAdditionalFrame::SelectorParentLanes::isSelectingLanes
bool isSelectingLanes() const
return true if modul is selecting lane
Definition: GNEAdditionalFrame.cpp:257
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEAdditionalFrame::SelectorParentLanes::addSelectedLane
bool addSelectedLane(GNELane *lane, const Position &clickedPosition)
return true if lane can be selected as consecutive lane
Definition: GNEAdditionalFrame.cpp:197
GNEFrameAttributesModuls::AttributesCreator::showAttributesCreatorModul
void showAttributesCreatorModul(const GNEAttributeCarrier::TagProperties &tagProperties, const std::vector< SumoXMLAttr > &hiddenAttributes)
show AttributesCreator modul
Definition: GNEFrameAttributesModuls.cpp:603
GNEFrameAttributesModuls::AttributesCreator::showWarningMessage
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
Definition: GNEFrameAttributesModuls.cpp:704
GNEViewNetHelper::ObjectsUnderCursor::getAdditionalFront
GNEAdditional * getAdditionalFront() const
get front additional element (or a pointer to nullptr if there isn't)
Definition: GNEViewNetHelper.cpp:228
GNEAdditionalFrame::SelectorChildEdges::onCmdInvertSelection
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
Definition: GNEAdditionalFrame.cpp:448
GNEFrameModuls::SelectorParent::refreshSelectorParentModul
void refreshSelectorParentModul()
Refresh list of Additional Parents Modul.
Definition: GNEFrameModuls.cpp:1788
GNENet.h
GNEFrameModuls::SelectorParent::hideSelectorParentModul
void hideSelectorParentModul()
hide SelectorParent Modul
Definition: GNEFrameModuls.cpp:1781
GNE_ATTR_PARENT
parent of an additional element
Definition: SUMOXMLDefinitions.h:987
GNEConnection.h