SUMO - Simulation of Urban MObility
GNEViewNet.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-2018 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 /****************************************************************************/
16 // A view on the network being edited (adapted from GUIViewTraffic)
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
42 #include <utils/gui/div/GLHelper.h>
54 
55 #include "GNENet.h"
56 #include "GNEUndoList.h"
57 #include "GNEViewNet.h"
58 #include "GNEViewParent.h"
59 
60 
61 // ===========================================================================
62 // FOX callback mapping
63 // ===========================================================================
64 
65 FXDEFMAP(GNEViewNet) GNEViewNetMap[] = {
66  // Modes
68  FXMAPFUNC(SEL_COMMAND, MID_GNE_SETMODE_MOVE, GNEViewNet::onCmdSetModeMove),
73  FXMAPFUNC(SEL_COMMAND, MID_GNE_SETMODE_TLS, GNEViewNet::onCmdSetModeTLS),
76  FXMAPFUNC(SEL_COMMAND, MID_GNE_SETMODE_TAZ, GNEViewNet::onCmdSetModeTAZ),
79  // Viewnet
85  // select elements
86  FXMAPFUNC(SEL_COMMAND, MID_ADDSELECT, GNEViewNet::onCmdAddSelected),
87  FXMAPFUNC(SEL_COMMAND, MID_REMOVESELECT, GNEViewNet::onCmdRemoveSelected),
88  // Junctions
95  // Connections
97  // Crossings
99  // Edges
100  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SPLIT, GNEViewNet::onCmdSplitEdge),
102  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_REVERSE, GNEViewNet::onCmdReverseEdge),
107  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SMOOTH, GNEViewNet::onCmdSmoothEdges),
110  // Lanes
125  // Additionals
127  // Polygons
129  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_CLOSE, GNEViewNet::onCmdClosePolygon),
130  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_OPEN, GNEViewNet::onCmdOpenPolygon),
133  // POIs
134  FXMAPFUNC(SEL_COMMAND, MID_GNE_POI_TRANSFORM, GNEViewNet::onCmdTransformPOI),
135 };
136 
137 // Object implementation
138 FXIMPLEMENT(GNEViewNet, GUISUMOAbstractView, GNEViewNetMap, ARRAYNUMBER(GNEViewNetMap))
139 
140 // ===========================================================================
141 // member method definitions
142 // ===========================================================================
143 
144 // ---------------------------------------------------------------------------
145 // GNEViewNet::ObjectsUnderCursor - methods
146 // ---------------------------------------------------------------------------
147 
149 
150 
151 void
152 GNEViewNet::ObjectsUnderCursor::updateObjectUnderCursor(const std::vector<GUIGlObject*> &GUIGlObjects, GNEPoly* editedPolyShape) {
153  // first clear all containers
154  myAttributeCarriers.clear();
155  myNetElements.clear();
156  myAdditionals.clear();
157  myShapes.clear();
158  myJunctions.clear();
159  myEdges.clear();
160  myLanes.clear();
161  myCrossings.clear();
162  myConnections.clear();
163  myTAZs.clear();
164  myPOIs.clear();
165  myPolys.clear();
166  // set GUIGlObject
167  sortGUIGlObjectsByAltitude(GUIGlObjects);
168  // iterate over GUIGlObjects
169  for (const auto &i : myGUIGlObjects) {
170  // only continue if isn't GLO_NETELEMENT (0)
171  if (i->getType() != GLO_NETELEMENT) {
172  // cast attribute carrier from glObject
173  myAttributeCarriers.push_back(dynamic_cast<GNEAttributeCarrier*>(i));
174  // only continue if attributeCarrier isn't nullptr;
175  if (myAttributeCarriers.back()) {
176  // If we're editing a shape, ignore rest of elements (including other polygons)
177  if (editedPolyShape != nullptr) {
178  if (myAttributeCarriers.back() == editedPolyShape) {
179  // cast Poly from attribute carrier
180  myPolys.push_back(dynamic_cast<GNEPoly*>(myAttributeCarriers.back()));
181  }
182  } else {
183  // obtain tag property (only for improve code legibility)
184  const auto& tagValue = myAttributeCarriers.back()->getTagProperty();
185  // check if attributeCarrier can be casted into netElement, additional or shape
186  if (tagValue.isNetElement()) {
187  // cast netElement from attribute carrier
188  myNetElements.push_back(dynamic_cast<GNENetElement*>(myAttributeCarriers.back()));
189  } else if (tagValue.isAdditional()) {
190  // cast additional element from attribute carrier
191  myAdditionals.push_back(dynamic_cast<GNEAdditional*>(myAttributeCarriers.back()));
192  } else if (tagValue.isShape()) {
193  // cast shape element from attribute carrier
194  myShapes.push_back(dynamic_cast<GNEShape*>(myAttributeCarriers.back()));
195  } else if (tagValue.isTAZ()) {
196  // cast TAZ element from attribute carrier
197  myTAZs.push_back(dynamic_cast<GNETAZ*>(myAttributeCarriers.back()));
198  }
199  // now set specify AC type
200  switch (i->getType()) {
201  case GLO_JUNCTION:
202  myJunctions.push_back(dynamic_cast<GNEJunction*>(myAttributeCarriers.back()));
203  break;
204  case GLO_EDGE: {
205  // fisrt obtain Edge
206  GNEEdge *edge = dynamic_cast<GNEEdge*>(myAttributeCarriers.back());
207  // check if edge parent is already inserted in myEdges (for example, due clicking over Geometry Points)
208  if (std::find(myEdges.begin(), myEdges.end(), edge) == myEdges.end()) {
209  myEdges.push_back(edge);
210  }
211  break;
212  }
213  case GLO_LANE: {
214  myLanes.push_back(dynamic_cast<GNELane*>(myAttributeCarriers.back()));
215  // check if edge's lane parent is already inserted in myEdges (for example, due clicking over Geometry Points)
216  if (std::find(myEdges.begin(), myEdges.end(), &myLanes.back()->getParentEdge()) == myEdges.end()) {
217  myEdges.push_back(&myLanes.back()->getParentEdge());
218  }
219  break;
220  }
221  case GLO_CROSSING:
222  myCrossings.push_back(dynamic_cast<GNECrossing*>(myAttributeCarriers.back()));
223  break;
224  case GLO_CONNECTION:
225  myConnections.push_back(dynamic_cast<GNEConnection*>(myAttributeCarriers.back()));
226  break;
227  case GLO_POI:
228  myPOIs.push_back(dynamic_cast<GNEPOI*>(myAttributeCarriers.back()));
229  break;
230  case GLO_POLYGON:
231  myPolys.push_back(dynamic_cast<GNEPoly*>(myAttributeCarriers.back()));
232  break;
233  default:
234  break;
235  }
236  }
237  } else {
238  myAttributeCarriers.pop_back();
239  }
240  }
241  }
242  // write information in debug mode
243  WRITE_DEBUG("ObjectsUnderCursor: GUIGlObjects: " + toString(GUIGlObjects.size()) +
244  ", AttributeCarriers: " + toString(myAttributeCarriers.size()) +
245  ", NetElements: " + toString(myNetElements.size()) +
246  ", Additionals: " + toString(myAdditionals.size()) +
247  ", Shapes: " + toString(myShapes.size()) +
248  ", Junctions: " + toString(myJunctions.size()) +
249  ", Edges: " + toString(myEdges.size()) +
250  ", Lanes: " + toString(myLanes.size()) +
251  ", Crossings: " + toString(myCrossings.size()) +
252  ", Connections: " + toString(myConnections.size()) +
253  ", TAZs: " + toString(myTAZs.size()) +
254  ", POIs: " + toString(myPOIs.size()) +
255  ", Polys: " + toString(myPolys.size()));
256 }
257 
258 
259 void
261  // clear some containers
262  myGUIGlObjects.clear();
263  myAttributeCarriers.clear();
264  myNetElements.clear();
265  // fill containers using edges
266  for (const auto &i : myEdges) {
267  myGUIGlObjects.push_back(i);
268  myAttributeCarriers.push_back(i);
269  myNetElements.push_back(i);
270  }
271  // write information for debug
272  WRITE_DEBUG("ObjectsUnderCursor: swapped Lanes to edges")
273 }
274 
275 
276 void
278  if (myJunctions.size() > 0) {
279  myJunctions.front() = junction;
280  } else {
281  myJunctions.push_back(junction);
282  }
283 }
284 
285 
286 GUIGlID
288  if (myGUIGlObjects.size() > 0) {
289  return myGUIGlObjects.front()->getGlID();
290  } else {
291  return 0;
292  }
293 }
294 
295 
298  if (myGUIGlObjects.size() > 0) {
299  return myGUIGlObjects.front()->getType();
300  } else {
301  return GLO_NETWORK;
302  }
303 }
304 
305 
308  if (myAttributeCarriers.size() > 0) {
309  return myAttributeCarriers.front();
310  } else {
311  return nullptr;
312  }
313 }
314 
315 
318  if (myNetElements.size() > 0) {
319  return myNetElements.front();
320  } else {
321  return nullptr;
322  }
323 }
324 
325 
328  if (myAdditionals.size() > 0) {
329  return myAdditionals.front();
330  } else {
331  return nullptr;
332  }
333 }
334 
335 
336 GNEShape*
338  if (myShapes.size() > 0) {
339  return myShapes.front();
340  } else {
341  return nullptr;
342  }
343 }
344 
345 
346 GNEJunction*
348  if (myJunctions.size() > 0) {
349  return myJunctions.front();
350  } else {
351  return nullptr;
352  }
353 }
354 
355 
356 GNEEdge*
358  if (myEdges.size() > 0) {
359  return myEdges.front();
360  } else {
361  return nullptr;
362  }
363 }
364 
365 
366 GNELane*
368  if (myLanes.size() > 0) {
369  return myLanes.front();
370  } else {
371  return nullptr;
372  }
373 }
374 
375 
376 GNECrossing*
378  if (myCrossings.size() > 0) {
379  return myCrossings.front();
380  } else {
381  return nullptr;
382  }
383 }
384 
385 
388  if (myConnections.size() > 0) {
389  return myConnections.front();
390  } else {
391  return nullptr;
392  }
393 }
394 
395 
396 GNETAZ*
398  if (myTAZs.size() > 0) {
399  return myTAZs.front();
400  } else {
401  return nullptr;
402  }
403 }
404 
405 
406 GNEPOI*
408  if (myPOIs.size() > 0) {
409  return myPOIs.front();
410  } else {
411  return nullptr;
412  }
413 }
414 
415 
416 GNEPoly*
418  if (myPolys.size() > 0) {
419  return myPolys.front();
420  } else {
421  return nullptr;
422  }
423 }
424 
425 
426 const std::vector<GNEAttributeCarrier*> &
428  return myAttributeCarriers;
429 }
430 
431 
432 void
433 GNEViewNet::ObjectsUnderCursor::sortGUIGlObjectsByAltitude(const std::vector<GUIGlObject*> &GUIGlObjects) {
434  // first clear myGUIGlObjects
435  myGUIGlObjects.clear();
436  // declare a map to save sorted GUIGlObjects
437  std::map<GUIGlObjectType, std::vector<GUIGlObject*> > mySortedGUIGlObjects;
438  for (const auto &i : GUIGlObjects) {
439  mySortedGUIGlObjects[i->getType()].push_back(i);
440  }
441  // move sorted GUIGlObjects into myGUIGlObjects using a reverse iterator
442  for (std::map<GUIGlObjectType, std::vector<GUIGlObject*> >::reverse_iterator i = mySortedGUIGlObjects.rbegin(); i != mySortedGUIGlObjects.rend(); i++) {
443  for (const auto &j : i->second) {
444  myGUIGlObjects.push_back(j);
445  }
446  }
447 }
448 
449 // ---------------------------------------------------------------------------
450 // GNEViewNet::keyPressed - methods
451 // ---------------------------------------------------------------------------
452 
454  myEventInfo(nullptr) {
455 }
456 
457 
458 void
460  myEventInfo = (FXEvent*) eventData;
461 }
462 
463 
464 bool
466  if (myEventInfo) {
467  return (myEventInfo->state & SHIFTMASK) != 0;
468  } else {
469  return false;
470  }
471 }
472 
473 
474 bool
476  if (myEventInfo) {
477  return (myEventInfo->state & CONTROLMASK) != 0;
478  } else {
479  return false;
480  }
481 }
482 
483 // ---------------------------------------------------------------------------
484 // GNEViewNet - methods
485 // ---------------------------------------------------------------------------
486 
487 GNEViewNet::GNEViewNet(FXComposite* tmpParent, FXComposite* actualParent, GUIMainWindow& app,
488  GNEViewParent* viewParent, GNENet* net, GNEUndoList* undoList,
489  FXGLVisual* glVis, FXGLCanvas* share, FXToolBar* toolBar) :
490  GUISUMOAbstractView(tmpParent, app, viewParent, net->getVisualisationSpeedUp(), glVis, share),
491  myViewParent(viewParent),
492  myNet(net),
494  myCurrentFrame(nullptr),
495  myCreateEdgeOptions(this),
498  mySelectingArea(this),
499  myTestingMode(this),
500  myViewOptions(this),
501  myToolbar(toolBar),
502  myEditModeCreateEdge(nullptr),
503  myEditModeMove(nullptr),
504  myEditModeDelete(nullptr),
505  myEditModeInspect(nullptr),
506  myEditModeSelect(nullptr),
507  myEditModeConnection(nullptr),
508  myEditModeTrafficLight(nullptr),
509  myEditModeAdditional(nullptr),
510  myEditModeCrossing(nullptr),
511  myEditModePolygon(nullptr),
512  myEditModeProhibition(nullptr),
513  myUndoList(undoList),
514  myEditShapePoly(nullptr) {
515  // view must be the final member of actualParent
516  reparent(actualParent);
517 
519  myUndoList->mark();
520  myNet->setViewNet(this);
521 
522  ((GUIDanielPerspectiveChanger*)myChanger)->setDragDelay(100000000); // 100 milliseconds
523 
524  // Reset textures
526 
527  // init testing mode
529 }
530 
531 
533 
534 
535 void
537 
538 
539 void
541  // build coloring tools
542  {
543  for (auto it_names : gSchemeStorage.getNames()) {
544  cw.getColoringSchemesCombo().appendItem(it_names.c_str());
545  if (it_names == myVisualizationSettings->name) {
546  cw.getColoringSchemesCombo().setCurrentItem(cw.getColoringSchemesCombo().getNumItems() - 1);
547  }
548  }
549  cw.getColoringSchemesCombo().setNumVisible(MAX2(5, (int)gSchemeStorage.getNames().size() + 1));
550  }
551  // for junctions
552  new FXButton(cw.getLocatorPopup(),
553  "\tLocate Junction\tLocate a junction within the network.",
555  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
556  // for edges
557  new FXButton(cw.getLocatorPopup(),
558  "\tLocate Street\tLocate a street within the network.",
560  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
561  // for tls
562  new FXButton(cw.getLocatorPopup(),
563  "\tLocate TLS\tLocate a tls within the network.",
565  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
566  // for additional stuff
567  new FXButton(cw.getLocatorPopup(),
568  "\tLocate Additional\tLocate an additional structure within the network.",
570  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
571  // for pois
572  new FXButton(cw.getLocatorPopup(),
573  "\tLocate PoI\tLocate a PoI within the network.",
575  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
576  // for polygons
577  new FXButton(cw.getLocatorPopup(),
578  "\tLocate Polygon\tLocate a Polygon within the network.",
580  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
581 }
582 
583 
584 std::set<std::pair<std::string, GNEAttributeCarrier*> >
585 GNEViewNet::getAttributeCarriersInBoundary(const Boundary &boundary, bool forceSelectEdges) {
586  // use a SET of pairs to obtain IDs and Pointers to attribute carriers. We need this because certain ACs can be returned many times (example: Edges)
587  // Note: a map cannot be used because there is different ACs with the same ID (example: Additionals)
588  std::set<std::pair<std::string, GNEAttributeCarrier*> > result;
589  // firstm make OpenGL context current prior to performing OpenGL commands
590  if (makeCurrent()) {
591  // obtain GUIGLIds of all objects in the given boundary
592  std::vector<GUIGlID> ids = getObjectsInBoundary(boundary);
593  // finish make OpenGL context current
594  makeNonCurrent();
595  // iterate over GUIGlIDs
596  for (auto i : ids) {
597  // avoid to select Net (i = 0)
598  if (i != 0) {
600  // in the case of a Lane, we need to change the retrieved lane to their the parent if myViewOptions.mySelectEdges is enabled
601  if ((retrievedAC->getTagProperty().getTag() == SUMO_TAG_LANE) && (myViewOptions.selectEdges() || forceSelectEdges)) {
602  retrievedAC = &dynamic_cast<GNELane*>(retrievedAC)->getParentEdge();
603  }
604  // make sure that AttributeCarrier can be selected
605  GUIGlObject* glObject = dynamic_cast<GUIGlObject*>(retrievedAC);
606  if (glObject && !myViewParent->getSelectorFrame()->getLockGLObjectTypes()->IsObjectTypeLocked(glObject->getType())) {
607  result.insert(std::make_pair(retrievedAC->getID(), retrievedAC));
608  }
609  }
610  }
611  }
612  return result;
613 }
614 
615 
616 void
618  if (AC->isAttributeCarrierSelected()) {
619  new FXMenuCommand(ret, "Remove From Selected", GUIIconSubSys::getIcon(ICON_FLAG_MINUS), this, MID_REMOVESELECT);
620  } else {
621  new FXMenuCommand(ret, "Add To Selected", GUIIconSubSys::getIcon(ICON_FLAG_PLUS), this, MID_ADDSELECT);
622  }
623  new FXMenuSeparator(ret);
624 }
625 
626 
627 bool
628 GNEViewNet::setColorScheme(const std::string& name) {
629  if (!gSchemeStorage.contains(name)) {
630  return false;
631  }
632  if (myVisualizationChanger != nullptr) {
633  if (myVisualizationChanger->getCurrentScheme() != name) {
635  }
636  }
637  myVisualizationSettings = &gSchemeStorage.get(name.c_str());
638  update();
639  return true;
640 }
641 
642 
643 void
645  // reimplemented from GUISUMOAbstractView due OverlappedInspection
646  ungrab();
647  if (!isEnabled() || !myAmInitialised) {
648  return;
649  }
650  if (makeCurrent()) {
651  // initialise the select mode
652  int id = getObjectUnderCursor();
653  GUIGlObject* o = nullptr;
654  // we need to check if we're inspecting a overlapping element
658  o = dynamic_cast<GUIGlObject*>(myViewParent->getInspectorFrame()->getInspectedACs().front());
659  } else if (id != 0) {
661  } else {
663  }
664  // check if open popup menu can be opened
665  if (o != nullptr) {
666  myPopup = o->getPopUpMenu(*myApp, *this);
667  int x, y;
668  FXuint b;
669  myApp->getCursorPosition(x, y, b);
670  myPopup->setX(x + myApp->getX());
671  myPopup->setY(y + myApp->getY());
672  myPopup->create();
673  myPopup->show();
675  myChanger->onRightBtnRelease(nullptr);
677  setFocus();
678  }
679  makeNonCurrent();
680  }
681 }
682 
683 
684 void
686  assert(!scheme.isFixed());
687  UNUSED_PARAMETER(s);
688  double minValue = std::numeric_limits<double>::infinity();
689  double maxValue = -std::numeric_limits<double>::infinity();
690  // retrieve range
691  if (objectType == GLO_LANE) {
692  // XXX (see #3409) multi-colors are not currently handled. this is a quick hack
693  if (active == 9) {
694  active = 8; // segment height, fall back to start height
695  } else if (active == 11) {
696  active = 10; // segment incline, fall back to total incline
697  }
698  for (GNELane* lane : myNet->retrieveLanes()) {
699  const double val = lane->getColorValue(s, active);
700  minValue = MIN2(minValue, val);
701  maxValue = MAX2(maxValue, val);
702  }
703  } else if (objectType == GLO_JUNCTION) {
704  if (active == 3) {
705  for (GNEJunction* junction : myNet->retrieveJunctions()) {
706  minValue = MIN2(minValue, junction->getPositionInView().z());
707  maxValue = MAX2(maxValue, junction->getPositionInView().z());
708  }
709  }
710  }
711  if (minValue != std::numeric_limits<double>::infinity()) {
712  scheme.clear();
713  // add new thresholds
714  double range = maxValue - minValue;
715  scheme.addColor(RGBColor::RED, (minValue));
716  scheme.addColor(RGBColor::ORANGE, (minValue + range * 1 / 6.0));
717  scheme.addColor(RGBColor::YELLOW, (minValue + range * 2 / 6.0));
718  scheme.addColor(RGBColor::GREEN, (minValue + range * 3 / 6.0));
719  scheme.addColor(RGBColor::CYAN, (minValue + range * 4 / 6.0));
720  scheme.addColor(RGBColor::BLUE, (minValue + range * 5 / 6.0));
721  scheme.addColor(RGBColor::MAGENTA, (maxValue));
722  }
723 }
724 
725 
726 void
727 GNEViewNet::setStatusBarText(const std::string& text) {
728  myApp->setStatusBarText(text);
729 }
730 
731 
732 bool
734  return myViewOptions.selectEdges();
735 }
736 
737 
738 bool
741  return (myCreateEdgeOptions.menuCheckMoveElevation->getCheck() == TRUE);
742  } else {
743  return false;
744  }
745 }
746 
747 
748 bool
750  if (myEditMode == GNE_MODE_CONNECT) {
751  return myViewOptions.menuCheckHideConnections->getCheck() == 0;
752  } else if (myEditMode == GNE_MODE_PROHIBITION) {
753  return true;
754  } else if (myViewOptions.menuCheckShowConnections->shown() == false) {
755  return false;
756  } else {
758  }
759 }
760 
761 
762 bool
764  return (myViewOptions.menuCheckExtendSelection->getCheck() != 0);
765 }
766 
767 
768 void
769 GNEViewNet::setSelectionScaling(double selectionScale) {
770  myVisualizationSettings->selectionScale = selectionScale;
771 }
772 
773 
774 bool
776  return (myViewOptions.menuCheckChangeAllPhases->getCheck() != 0);
777 }
778 
779 
780 bool
783 }
784 
785 
786 void
788  if ((myEditShapePoly == nullptr) && (element != nullptr) && (shape.size() > 1)) {
789  // save current edit mode before starting
792  // add special GNEPoly fo edit shapes
793  // color is taken from junction color settings
795  myEditShapePoly = myNet->addPolygonForEditShapes(element, shape, fill, col);
796  // update view net to show the new myEditShapePoly
797  update();
798  }
799 }
800 
801 
802 void
804  // stop edit shape junction deleting myEditShapePoly
805  if (myEditShapePoly != nullptr) {
807  myEditShapePoly = nullptr;
808  // restore previous edit mode
811  }
812  }
813 }
814 
815 
817  myCreateEdgeOptions(this),
820  mySelectingArea(this),
821  myTestingMode(this),
822  myViewOptions(this) {
823 }
824 
825 
826 int
827 GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
828  // init view settings
829  // (uncomment the next line to check select mode)
830  // myVisualizationSettings->drawForSelecting = true;
831  glRenderMode(mode);
832  glMatrixMode(GL_MODELVIEW);
833  glPushMatrix();
834  glDisable(GL_TEXTURE_2D);
835  glDisable(GL_ALPHA_TEST);
836  glEnable(GL_BLEND);
837  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
838  glEnable(GL_DEPTH_TEST);
839 
840  // visualize rectangular selection
842 
843  // compute lane width
844  double lw = m2p(SUMO_const_laneWidth);
845  // draw decals (if not in grabbing mode)
847  drawDecals();
848  // depending of the visualizationSettings, enable or disable check box show grid
850  myViewOptions.menuCheckShowGrid->setCheck(true);
851  paintGLGrid();
852  } else {
853  myViewOptions.menuCheckShowGrid->setCheck(false);
854  }
856 
857  }
858  // draw temporal elements
862  // draw testing elements
864  }
865  // draw elements
866  glLineWidth(1);
867  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
868  const float minB[2] = { (float)bound.xmin(), (float)bound.ymin() };
869  const float maxB[2] = { (float)bound.xmax(), (float)bound.ymax() };
871  glEnable(GL_POLYGON_OFFSET_FILL);
872  glEnable(GL_POLYGON_OFFSET_LINE);
874  int hits2 = myGrid->Search(minB, maxB, *myVisualizationSettings);
875 
876  glTranslated(0, 0, GLO_ADDITIONAL);
877  for (auto i : myAdditionallyDrawn) {
878  i.first->drawGLAdditional(this, *myVisualizationSettings);
879  }
880 
881  glPopMatrix();
882  return hits2;
883 }
884 
885 
886 long
887 GNEViewNet::onLeftBtnPress(FXObject*, FXSelector, void* eventData) {
888  // set focus in view net
889  setFocus();
890  // update keyPressed
891  myKeyPressed.update(eventData);
892  // interpret object under cursor
893  if (makeCurrent()) {
894  // fill objects under cursor
896  // decide what to do based on mode
897  switch (myEditMode) {
898  case GNE_MODE_CREATE_EDGE: {
899 
901  // make sure that Control key isn't pressed
903  if (!myUndoList->hasCommandGroup()) {
904  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
905  }
908  }
909  if (myCreateEdgeOptions.createEdgeSource == nullptr) {
912  update();
913  } else {
915  // may fail to prevent double edges
916  GNEEdge* newEdge = myNet->createEdge(
918  if (newEdge) {
919  // create another edge, if create opposite edge is enabled
922  }
924 
925  if (myUndoList->hasCommandGroup()) {
926  myUndoList->p_end();
927  } else {
928  std::cout << "edge created without an open CommandGroup )-:\n";
929  }
930  if (myCreateEdgeOptions.chainCreateEdge->getCheck()) {
933  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
934  } else {
936  }
937  } else {
938  setStatusBarText("An " + toString(SUMO_TAG_EDGE) + " with the same geometry already exists!");
939  }
940  } else {
941  setStatusBarText("Start- and endpoint for an " + toString(SUMO_TAG_EDGE) + " must be distinct!");
942  }
943  update();
944  }
945  }
946 
947  // process click
948  processClick(eventData);
949  break;
950  }
951  case GNE_MODE_MOVE: {
952  // first obtain moving reference (common for all)
954  // check what type of AC will be moved
956  // calculate poly movement values (can be entire shape, single geometry points, altitude, etc.)
958  } else if (myObjectsUnderCursor.getPOIFront()) {
959  // set POI moved object
961  // Save original Position of POI in view
964  // set additionals moved object
966  // save current position of additional
968  // start additional geometry moving
970  } else if(myObjectsUnderCursor.getTAZFront()) {
971  // calculate TAZ movement values (can be entire shape or single geometry points)
973  } else if (myObjectsUnderCursor.getJunctionFront()) {
974  // check if we're moving a single junction or a set of selected junctions
976  // move selection of junctions
978  } else {
979  // set junction moved object
981  // Save original Position of Element in view
983  // start junction geometry moving
985  }
987  // calculate Edge movement values (can be entire shape, single geometry points, altitude, etc.)
989  } else {
990  // process click (to move camera using drag an drop)
991  processClick(eventData);
992  }
993  update();
994  break;
995  }
996  case GNE_MODE_DELETE: {
998  // change the selected attribute carrier if myViewOptions.mySelectEdges is enabled and clicked element is a getLaneFront()
1001  }
1002  // check if we are deleting a selection or an single attribute carrier
1004  // before delete al selected attribute carriers, check if we clicked over a geometry point
1009  } else {
1011  }
1012  } else {
1014  }
1015  } else {
1016  // process click
1017  processClick(eventData);
1018  }
1019  break;
1020  }
1021  case GNE_MODE_INSPECT: {
1022  // process left click in Inspector Frame
1024  // process click
1025  processClick(eventData);
1026  // update view
1027  update();
1028  break;
1029  }
1030  case GNE_MODE_SELECT:
1031  // check if a rect for selecting is being created
1032  if (myKeyPressed.shiftKeyPressed()) {
1033  // begin rectangle selection
1035  } else {
1036  // first check that under cursor there is an attribute carrier and is selectable
1038  // change the selected attribute carrier if myViewOptions.mySelectEdges is enabled and clicked element is a getLaneFront()
1041  }
1042  // Check if this GLobject type is locked
1044  // toogle netElement selection
1047  } else {
1049  }
1050  }
1051  }
1052  // process click
1053  processClick(eventData);
1054  }
1055  update();
1056  break;
1057  case GNE_MODE_CONNECT: {
1059  // Handle laneclick (shift key may pass connections, Control key allow conflicts)
1061  update();
1062  }
1063  // process click
1064  processClick(eventData);
1065  break;
1066  }
1067  case GNE_MODE_TLS: {
1070  update();
1071  }
1072  // process click
1073  processClick(eventData);
1074  break;
1075  }
1076  case GNE_MODE_ADDITIONAL: {
1077  // avoid create additionals if control key is pressed
1080  // check if we need to start select lanes
1082  // select getLaneFront() to create an additional with consecutive lanes
1084  } else if (myObjectsUnderCursor.getLaneFront()) {
1086  }
1087  } else {
1088  // call function addAdditional from additional frame
1090  }
1091  update();
1092  }
1093  // process click
1094  processClick(eventData);
1095  break;
1096  }
1097  case GNE_MODE_CROSSING: {
1098  // swap lanes to edges in crossingsMode
1101  }
1102  // call function addCrossing from crossing frame
1104  // process click
1105  processClick(eventData);
1106  break;
1107  }
1108  case GNE_MODE_TAZ: {
1109  // avoid create TAZs if control key is pressed
1111  // swap laness to edges in TAZ Mode
1114  }
1115  // check if we want to create a rect for selecting edges
1117  // begin rectangle selection
1119  } else {
1120  // check if process click was scuesfully
1122  // view net must be always update
1123  update();
1124  }
1125  // process click
1126  processClick(eventData);
1127  }
1128  } else {
1129  // process click
1130  processClick(eventData);
1131  }
1132  break;
1133  }
1134  case GNE_MODE_POLYGON: {
1135  // avoid create shapes if control key is pressed
1139  // view net must be always update
1140  update();
1141  // process click depending of the result of "process click"
1143  // process click
1144  processClick(eventData);
1145  }
1146  }
1147  } else {
1148  // process click
1149  processClick(eventData);
1150  }
1151  break;
1152  }
1153  case GNE_MODE_PROHIBITION: {
1155  // shift key may pass connections, Control key allow conflicts.
1157  update();
1158  }
1159  // process click
1160  processClick(eventData);
1161  break;
1162  }
1163  default: {
1164  // process click
1165  processClick(eventData);
1166  }
1167  }
1168  makeNonCurrent();
1169  }
1170  // update cursor
1171  updateCursor();
1172  return 1;
1173 }
1174 
1175 
1176 long
1177 GNEViewNet::onLeftBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
1178  // process parent function
1179  GUISUMOAbstractView::onLeftBtnRelease(obj, sel, eventData);
1180  // first update keyPressed
1181  myKeyPressed.update(eventData);
1182  // update cursor
1183  updateCursor();
1184  // check moved items
1187  } else if (myMovedItems.polyToMove) {
1189  myMovedItems.polyToMove = nullptr;
1190  } else if (myMovedItems.poiToMove) {
1192  myMovedItems.poiToMove = nullptr;
1193  } else if (myMovedItems.junctionToMove) {
1194  // check if in the moved position there is another Junction and it will be merged
1197  // position is already up to date but we must register with myUndoList
1199  }
1200  myMovedItems.junctionToMove = nullptr;
1201  } else if (myMovedItems.edgeToMove) {
1202  // end geometry moving
1204  // commit change depending of what was moved
1211  } else {
1213  }
1214  myMovedItems.edgeToMove = nullptr;
1215  } else if (myMovedItems.additionalToMove) {
1218  myMovedItems.additionalToMove = nullptr;
1219  } else if (myMovedItems.tazToMove) {
1221  myMovedItems.tazToMove = nullptr;
1223  // check if we're creating a rectangle selection or we want only to select a lane
1225  // check if we're selecting all type of elements o we only want a set of edges for TAZ
1226  if(myEditMode == GNE_MODE_SELECT) {
1228  } else if(myEditMode == GNE_MODE_TAZ) {
1229  // process edge selection
1231  }
1232  } else if(myKeyPressed.shiftKeyPressed()) {
1233  // obtain objects under cursor
1234  if (makeCurrent()) {
1235  // update objects under cursor again
1237  makeNonCurrent();
1238  }
1239  // check if there is a lane in objects under cursor
1241  // if we clicked over an lane with shift key pressed, select or unselect it
1244  } else {
1246  }
1247  }
1248  }
1249  // finish selection
1251  }
1252  update();
1253  return 1;
1254 }
1255 
1256 
1257 long
1258 GNEViewNet::onRightBtnPress(FXObject* obj, FXSelector sel, void* eventData) {
1259  // update keyPressed
1260  myKeyPressed.update(eventData);
1261  // update cursor
1262  updateCursor();
1264  // disable right button press during drawing polygon
1265  return 1;
1266  } else {
1267  return GUISUMOAbstractView::onRightBtnPress(obj, sel, eventData);
1268  }
1269 }
1270 
1271 
1272 long
1273 GNEViewNet::onRightBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
1274  // update keyPressed
1275  myKeyPressed.update(eventData);
1276  // update cursor
1277  updateCursor();
1278  // disable right button release during drawing polygon
1280  return 1;
1281  } else {
1282  return GUISUMOAbstractView::onRightBtnRelease(obj, sel, eventData);
1283  }
1284 }
1285 
1286 
1287 long
1288 GNEViewNet::onMouseMove(FXObject* obj, FXSelector sel, void* eventData) {
1289  // process mouse move in GUISUMOAbstractView
1290  GUISUMOAbstractView::onMouseMove(obj, sel, eventData);
1291  // update keyPressed
1292  myKeyPressed.update(eventData);
1293  // update cursor
1294  updateCursor();
1295  // change "delete last created point" depending if during movement shift key is pressed
1298  }
1299  // calculate offset between current position and original position
1301  // check what type of additional is moved
1303  // move entire selection
1305  } else if (myMovedItems.polyToMove) {
1306  // move shape's geometry without commiting changes depending if polygon is blocked
1308  // move entire shape
1310  } else {
1311  // move only a certain Geometry Point
1314  offsetMovement);
1315  }
1316  } else if (myMovedItems.poiToMove) {
1317  // Move POI's geometry without commiting changes
1319  } else if (myMovedItems.junctionToMove) {
1320  // Move Junction's geometry without commiting changes
1322  } else if (myMovedItems.edgeToMove) {
1323  // check if we're moving the start or end position, or a geometry point
1328  } else {
1329  // move edge's geometry without commiting changes
1331  }
1333  // Move Additional geometry without commiting changes
1334  myMovedItems.additionalToMove->moveGeometry(offsetMovement);
1335  } else if (myMovedItems.tazToMove) {
1338  // move entire shape
1340  } else {
1341  // move only a certain Geometry Point
1343  }
1345  // update selection corner of selecting area
1347  }
1348  // update view
1349  update();
1350  return 1;
1351 }
1352 
1353 
1354 long
1355 GNEViewNet::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
1356  // update keyPressed
1357  myKeyPressed.update(eventData);
1358  // update cursor
1359  updateCursor();
1360  // change "delete last created point" depending of shift key
1365  }
1366  update();
1367  return GUISUMOAbstractView::onKeyPress(o, sel, eventData);
1368 }
1369 
1370 
1371 long
1372 GNEViewNet::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
1373  // update keyPressed
1374  myKeyPressed.update(eventData);
1375  // update cursor
1376  updateCursor();
1377  // change "delete last created point" depending of shift key
1380  }
1381  // check if selecting using rectangle has to be disabled
1384  }
1385  update();
1386  return GUISUMOAbstractView::onKeyRelease(o, sel, eventData);
1387 }
1388 
1389 
1390 void
1391 GNEViewNet::abortOperation(bool clearSelection) {
1392  // steal focus from any text fields
1393  setFocus();
1394  if (myCreateEdgeOptions.createEdgeSource != nullptr) {
1395  // remove current created edge source
1398  } else if (myEditMode == GNE_MODE_SELECT) {
1400  // check if current selection has to be cleaned
1401  if (clearSelection) {
1403  }
1404  } else if (myEditMode == GNE_MODE_CONNECT) {
1405  // abort changes in Connector Frame
1407  } else if (myEditMode == GNE_MODE_TLS) {
1408  myViewParent->getTLSEditorFrame()->onCmdCancel(nullptr, 0, nullptr);
1409  } else if (myEditMode == GNE_MODE_MOVE) {
1411  } else if (myEditMode == GNE_MODE_POLYGON) {
1412  // abort current drawing
1414  } else if (myEditMode == GNE_MODE_TAZ) {
1416  // abort current drawing
1418  } else if (myViewParent->getTAZFrame()->getTAZCurrentModul()->getTAZ() != nullptr) {
1419  // finish current editing TAZ
1421  }
1422  } else if (myEditMode == GNE_MODE_PROHIBITION) {
1423  myViewParent->getProhibitionFrame()->onCmdCancel(nullptr, 0, nullptr);
1424  } else if (myEditMode == GNE_MODE_ADDITIONAL) {
1425  // abort select lanes
1427  }
1428  myUndoList->p_abort();
1429 }
1430 
1431 
1432 void
1435  setStatusBarText("Cannot delete in this mode");
1436  } else {
1437  myUndoList->p_begin("delete selection");
1445  myUndoList->p_end();
1446  }
1447 }
1448 
1449 
1450 void
1452  if (myEditMode == GNE_MODE_CONNECT) {
1453  // Accept changes in Connector Frame
1455  } else if (myEditMode == GNE_MODE_TLS) {
1456  myViewParent->getTLSEditorFrame()->onCmdOK(nullptr, 0, nullptr);
1457  } else if ((myEditMode == GNE_MODE_MOVE) && (myEditShapePoly != nullptr)) {
1458  // save edited junction's shape
1459  if (myEditShapePoly != nullptr) {
1460  myUndoList->p_begin("custom " + myEditShapePoly->getShapeEditedElement()->getTagStr() + " shape");
1463  attr = SUMO_ATTR_CUSTOMSHAPE;
1464  }
1466  myUndoList->p_end();
1468  update();
1469  }
1470  } else if (myEditMode == GNE_MODE_POLYGON) {
1472  // stop current drawing
1474  } else {
1475  // start drawing
1477  }
1478  } else if (myEditMode == GNE_MODE_CROSSING) {
1480  } else if (myEditMode == GNE_MODE_TAZ) {
1482  // stop current drawing
1484  } else if (myViewParent->getTAZFrame()->getTAZCurrentModul()->getTAZ() == nullptr) {
1485  // start drawing
1488  // save pending changes
1490  }
1491  } else if (myEditMode == GNE_MODE_ADDITIONAL) {
1493  // stop select lanes to create additional
1495  }
1496  }
1497 }
1498 
1499 
1500 void
1502  // if there is a visible frame, set focus over it. In other case, set focus over ViewNet
1503  if (myCurrentFrame != nullptr) {
1505  } else {
1506  setFocus();
1507  }
1508 }
1509 
1510 
1511 void
1513  switch (selid) {
1516  break;
1517  case MID_GNE_SETMODE_MOVE:
1519  break;
1522  break;
1525  break;
1528  break;
1531  break;
1532  case MID_GNE_SETMODE_TLS:
1534  break;
1537  break;
1540  break;
1541  case MID_GNE_SETMODE_TAZ:
1543  break;
1546  break;
1549  break;
1550  default:
1551  throw ProcessError("invalid edit mode called by hotkey");
1552  break;
1553  }
1554 }
1555 
1556 
1559  return myViewParent;
1560 }
1561 
1562 
1563 GNENet*
1565  return myNet;
1566 }
1567 
1568 
1569 GNEUndoList*
1571  return myUndoList;
1572 }
1573 
1574 
1575 EditMode
1577  return myEditMode;
1578 }
1579 
1580 
1581 const GNEViewNet::KeyPressed &
1583  return myKeyPressed;
1584 }
1585 
1586 
1587 FXMenuCheck*
1590 }
1591 
1592 
1593 const GNEAttributeCarrier*
1595  return myDottedAC;
1596 }
1597 
1598 
1599 void
1601  myDottedAC = AC;
1602 }
1603 
1604 
1605 bool
1608 }
1609 
1610 
1611 GNEJunction*
1613  GNEJunction* junction = nullptr;
1614  if (makeCurrent()) {
1618  if (pointed) {
1619  switch (pointed->getType()) {
1620  case GLO_JUNCTION:
1621  junction = (GNEJunction*)pointed;
1622  break;
1623  default:
1624  break;
1625  }
1626  }
1627  }
1628  return junction;
1629 }
1630 
1631 
1634  GNEConnection* connection = nullptr;
1635  if (makeCurrent()) {
1639  if (pointed) {
1640  switch (pointed->getType()) {
1641  case GLO_CONNECTION:
1642  connection = (GNEConnection*)pointed;
1643  break;
1644  default:
1645  break;
1646  }
1647  }
1648  }
1649  return connection;
1650 }
1651 
1652 
1653 GNECrossing*
1655  GNECrossing* crossing = nullptr;
1656  if (makeCurrent()) {
1660  if (pointed) {
1661  switch (pointed->getType()) {
1662  case GLO_CROSSING:
1663  crossing = (GNECrossing*)pointed;
1664  break;
1665  default:
1666  break;
1667  }
1668  }
1669  }
1670  return crossing;
1671 }
1672 
1673 GNEEdge*
1675  GNEEdge* edge = nullptr;
1676  if (makeCurrent()) {
1680  if (pointed) {
1681  switch (pointed->getType()) {
1682  case GLO_EDGE:
1683  edge = (GNEEdge*)pointed;
1684  break;
1685  case GLO_LANE:
1686  edge = &(((GNELane*)pointed)->getParentEdge());
1687  break;
1688  default:
1689  break;
1690  }
1691  }
1692  }
1693  return edge;
1694 }
1695 
1696 
1697 GNELane*
1699  GNELane* lane = nullptr;
1700  if (makeCurrent()) {
1704  if (pointed) {
1705  if (pointed->getType() == GLO_LANE) {
1706  lane = (GNELane*)pointed;
1707  }
1708  }
1709  }
1710  return lane;
1711 }
1712 
1713 
1716  if (makeCurrent()) {
1720  if (pointed) {
1721  return dynamic_cast<GNEAdditional*>(pointed);
1722  }
1723  }
1724  return nullptr;
1725 }
1726 
1727 
1728 GNEPoly*
1730  if (makeCurrent()) {
1734  if (pointed) {
1735  return dynamic_cast<GNEPoly*>(pointed);
1736  }
1737  }
1738  return nullptr;
1739 }
1740 
1741 
1742 GNEPOI*
1744  if (makeCurrent()) {
1748  if (pointed) {
1749  return dynamic_cast<GNEPOI*>(pointed);
1750  }
1751  }
1752  return nullptr;
1753 }
1754 
1755 
1756 long
1757 GNEViewNet::onCmdSetModeCreateEdge(FXObject*, FXSelector, void*) {
1759  return 1;
1760 }
1761 
1762 
1763 long
1764 GNEViewNet::onCmdSetModeMove(FXObject*, FXSelector, void*) {
1766  return 1;
1767 }
1768 
1769 
1770 long
1771 GNEViewNet::onCmdSetModeDelete(FXObject*, FXSelector, void*) {
1773  return 1;
1774 }
1775 
1776 
1777 long
1778 GNEViewNet::onCmdSetModeInspect(FXObject*, FXSelector, void*) {
1780  return 1;
1781 }
1782 
1783 
1784 long
1785 GNEViewNet::onCmdSetModeSelect(FXObject*, FXSelector, void*) {
1787  return 1;
1788 }
1789 
1790 
1791 long
1792 GNEViewNet::onCmdSetModeConnect(FXObject*, FXSelector, void*) {
1794  return 1;
1795 }
1796 
1797 
1798 long
1799 GNEViewNet::onCmdSetModeTLS(FXObject*, FXSelector, void*) {
1801  return 1;
1802 }
1803 
1804 
1805 long
1806 GNEViewNet::onCmdSetModeAdditional(FXObject*, FXSelector, void*) {
1808  return 1;
1809 }
1810 
1811 
1812 long
1813 GNEViewNet::onCmdSetModeCrossing(FXObject*, FXSelector, void*) {
1815  return 1;
1816 }
1817 
1818 
1819 long
1820 GNEViewNet::onCmdSetModeTAZ(FXObject*, FXSelector, void*) {
1822  return 1;
1823 }
1824 
1825 
1826 long
1827 GNEViewNet::onCmdSetModePolygon(FXObject*, FXSelector, void*) {
1829  return 1;
1830 }
1831 
1832 long
1833 GNEViewNet::onCmdSetModeProhibition(FXObject*, FXSelector, void*) {
1835  return 1;
1836 }
1837 
1838 long
1839 GNEViewNet::onCmdSplitEdge(FXObject*, FXSelector, void*) {
1840  GNEEdge* edge = getEdgeAtPopupPosition();
1841  if (edge != nullptr) {
1843  }
1844  return 1;
1845 }
1846 
1847 
1848 long
1849 GNEViewNet::onCmdSplitEdgeBidi(FXObject*, FXSelector, void*) {
1850  GNEEdge* edge = getEdgeAtPopupPosition();
1851  if (edge != nullptr) {
1852  // obtain reverse edge
1853  GNEEdge* reverseEdge = edge->getOppositeEdge();
1854  // check that reverse edge works
1855  if (reverseEdge != nullptr) {
1856  myNet->splitEdgesBidi(edge, reverseEdge, edge->getSplitPos(getPopupPosition()), myUndoList);
1857  }
1858  }
1859  return 1;
1860 }
1861 
1862 
1863 long
1864 GNEViewNet::onCmdReverseEdge(FXObject*, FXSelector, void*) {
1865  GNEEdge* edge = getEdgeAtPopupPosition();
1866  if (edge != nullptr) {
1867  if (edge->isAttributeCarrierSelected()) {
1868  myUndoList->p_begin("Reverse selected " + toString(SUMO_TAG_EDGE) + "s");
1869  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1870  for (auto it : edges) {
1872  }
1873  myUndoList->p_end();
1874  } else {
1875  myUndoList->p_begin("Reverse " + toString(SUMO_TAG_EDGE));
1876  myNet->reverseEdge(edge, myUndoList);
1877  myUndoList->p_end();
1878  }
1879  }
1880  return 1;
1881 }
1882 
1883 
1884 long
1885 GNEViewNet::onCmdAddReversedEdge(FXObject*, FXSelector, void*) {
1886  GNEEdge* edge = getEdgeAtPopupPosition();
1887  if (edge != nullptr) {
1888  if (edge->isAttributeCarrierSelected()) {
1889  myUndoList->p_begin("Add Reverse edge for selected " + toString(SUMO_TAG_EDGE) + "s");
1890  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1891  for (auto it : edges) {
1893  }
1894  myUndoList->p_end();
1895  } else {
1896  myUndoList->p_begin("Add reverse " + toString(SUMO_TAG_EDGE));
1898  myUndoList->p_end();
1899  }
1900  }
1901  return 1;
1902 }
1903 
1904 
1905 long
1906 GNEViewNet::onCmdEditEdgeEndpoint(FXObject*, FXSelector, void*) {
1907  GNEEdge* edge = getEdgeAtPopupPosition();
1908  if (edge != nullptr) {
1909  // snap to active grid the Popup position
1911  }
1912  return 1;
1913 }
1914 
1915 
1916 long
1917 GNEViewNet::onCmdResetEdgeEndpoint(FXObject*, FXSelector, void*) {
1918  GNEEdge* edge = getEdgeAtPopupPosition();
1919  if (edge != nullptr) {
1921  }
1922  return 1;
1923 }
1924 
1925 
1926 long
1927 GNEViewNet::onCmdStraightenEdges(FXObject*, FXSelector, void*) {
1928  GNEEdge* edge = getEdgeAtPopupPosition();
1929  if (edge != nullptr) {
1930  if (edge->isAttributeCarrierSelected()) {
1931  myUndoList->p_begin("straighten selected " + toString(SUMO_TAG_EDGE) + "s");
1932  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1933  for (auto it : edges) {
1934  it->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
1935  }
1936  myUndoList->p_end();
1937  } else {
1938 
1939  myUndoList->p_begin("straighten " + toString(SUMO_TAG_EDGE));
1941  myUndoList->p_end();
1942  }
1943  }
1944  return 1;
1945 }
1946 
1947 
1948 long
1949 GNEViewNet::onCmdSmoothEdges(FXObject*, FXSelector, void*) {
1950  GNEEdge* edge = getEdgeAtPopupPosition();
1951  if (edge != nullptr) {
1952  if (edge->isAttributeCarrierSelected()) {
1953  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1954  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1955  for (auto it : edges) {
1956  it->smooth(myUndoList);
1957  }
1958  myUndoList->p_end();
1959  } else {
1960  myUndoList->p_begin("straighten edge elevation");
1961  edge->smooth(myUndoList);
1962  myUndoList->p_end();
1963  }
1964  }
1965  return 1;
1966 }
1967 
1968 
1969 long
1970 GNEViewNet::onCmdStraightenEdgesElevation(FXObject*, FXSelector, void*) {
1971  GNEEdge* edge = getEdgeAtPopupPosition();
1972  if (edge != nullptr) {
1973  if (edge->isAttributeCarrierSelected()) {
1974  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1975  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1976  for (auto it : edges) {
1977  it->straightenElevation(myUndoList);
1978  }
1979  myUndoList->p_end();
1980  } else {
1981  myUndoList->p_begin("straighten edge elevation");
1983  myUndoList->p_end();
1984  }
1985  }
1986  return 1;
1987 }
1988 
1989 
1990 long
1991 GNEViewNet::onCmdSmoothEdgesElevation(FXObject*, FXSelector, void*) {
1992  GNEEdge* edge = getEdgeAtPopupPosition();
1993  if (edge != nullptr) {
1994  if (edge->isAttributeCarrierSelected()) {
1995  myUndoList->p_begin("smooth elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1996  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1997  for (auto it : edges) {
1998  it->smoothElevation(myUndoList);
1999  }
2000  myUndoList->p_end();
2001  } else {
2002  myUndoList->p_begin("smooth edge elevation");
2003  edge->smoothElevation(myUndoList);
2004  myUndoList->p_end();
2005  }
2006  }
2007  return 1;
2008 }
2009 
2010 
2011 long
2012 GNEViewNet::onCmdSimplifyShape(FXObject*, FXSelector, void*) {
2013  if (myEditShapePoly != nullptr) {
2015  update();
2016  } else {
2017  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
2018  if (polygonUnderMouse) {
2019  polygonUnderMouse->simplifyShape();
2020  }
2021  }
2022  return 1;
2023 }
2024 
2025 
2026 long
2027 GNEViewNet::onCmdDeleteGeometryPoint(FXObject*, FXSelector, void*) {
2028  if (myEditShapePoly != nullptr) {
2030  update();
2031  } else {
2032  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
2033  if (polygonUnderMouse) {
2034  polygonUnderMouse->deleteGeometryPoint(getPopupPosition());
2035  }
2036  }
2037  return 1;
2038 }
2039 
2040 
2041 long
2042 GNEViewNet::onCmdClosePolygon(FXObject*, FXSelector, void*) {
2043  if (myEditShapePoly != nullptr) {
2044  myEditShapePoly->closePolygon(false);
2045  update();
2046  } else {
2047  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
2048  if (polygonUnderMouse) {
2049  polygonUnderMouse->closePolygon();
2050  }
2051  }
2052  return 1;
2053 }
2054 
2055 
2056 long
2057 GNEViewNet::onCmdOpenPolygon(FXObject*, FXSelector, void*) {
2058  if (myEditShapePoly != nullptr) {
2059  myEditShapePoly->openPolygon(false);
2060  update();
2061  } else {
2062  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
2063  if (polygonUnderMouse) {
2064  polygonUnderMouse->openPolygon();
2065  }
2066  }
2067  return 1;
2068 }
2069 
2070 
2071 long
2072 GNEViewNet::onCmdSetFirstGeometryPoint(FXObject*, FXSelector, void*) {
2073  if (myEditShapePoly != nullptr) {
2075  update();
2076  } else {
2077  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
2078  if (polygonUnderMouse) {
2079  polygonUnderMouse->changeFirstGeometryPoint(polygonUnderMouse->getVertexIndex(getPopupPosition(), false, false));
2080  }
2081  }
2082  return 1;
2083 }
2084 
2085 
2086 long
2087 GNEViewNet::onCmdTransformPOI(FXObject*, FXSelector, void*) {
2088  // obtain POI at popup position
2090  if (POI) {
2091  // check what type of POI will be transformed
2092  if (POI->getTagProperty().getTag() == SUMO_TAG_POI) {
2093  // obtain lanes around POI boundary
2094  std::vector<GUIGlID> GLIDs = getObjectsInBoundary(POI->getCenteringBoundary());
2095  std::vector<GNELane*> lanes;
2096  for (auto i : GLIDs) {
2098  if (lane) {
2099  lanes.push_back(lane);
2100  }
2101  }
2102  if (lanes.empty()) {
2103  WRITE_WARNING("No lanes around " + toString(SUMO_TAG_POI) + " to attach it");
2104  } else {
2105  // obtain nearest lane to POI
2106  GNELane* nearestLane = lanes.front();
2107  double minorPosOverLane = nearestLane->getShape().nearest_offset_to_point2D(POI->getPositionInView());
2108  double minorLateralOffset = nearestLane->getShape().positionAtOffset(minorPosOverLane).distanceTo(POI->getPositionInView());
2109  for (auto i : lanes) {
2110  double posOverLane = i->getShape().nearest_offset_to_point2D(POI->getPositionInView());
2111  double lateralOffset = i->getShape().positionAtOffset(posOverLane).distanceTo(POI->getPositionInView());
2112  if (lateralOffset < minorLateralOffset) {
2113  minorPosOverLane = posOverLane;
2114  minorLateralOffset = lateralOffset;
2115  nearestLane = i;
2116  }
2117  }
2118  // obtain values of POI
2119  std::string id = POI->getID();
2120  std::string type = POI->getShapeType();
2121  RGBColor color = POI->getShapeColor();
2122  Position pos = (*POI);
2123  double layer = POI->getShapeLayer();
2124  double angle = POI->getShapeNaviDegree();
2125  std::string imgFile = POI->getShapeImgFile();
2126  bool relativePath = POI->getShapeRelativePath();
2127  double POIWidth = POI->getWidth(); // double width -> C4458
2128  double POIHeight = POI->getHeight(); // double height -> C4458
2129  // remove POI
2130  myUndoList->p_begin("attach POI into " + toString(SUMO_TAG_LANE));
2131  myNet->deleteShape(POI, myUndoList);
2132  // add POILane
2133  myNet->addPOI(id, type, color, pos, false, nearestLane->getID(), minorPosOverLane, 0, layer, angle, imgFile, relativePath, POIWidth, POIHeight);
2134  myUndoList->p_end();
2135  }
2136  } else {
2137  // obtain values of POILane
2138  std::string id = POI->getID();
2139  std::string type = POI->getShapeType();
2140  RGBColor color = POI->getShapeColor();
2141  Position pos = (*POI);
2142  double layer = POI->getShapeLayer();
2143  double angle = POI->getShapeNaviDegree();
2144  std::string imgFile = POI->getShapeImgFile();
2145  bool relativePath = POI->getShapeRelativePath();
2146  double POIWidth = POI->getWidth(); // double width -> C4458
2147  double POIWeight = POI->getHeight(); // double height -> C4458
2148  // remove POI
2149  myUndoList->p_begin("release POI from " + toString(SUMO_TAG_LANE));
2150  myNet->deleteShape(POI, myUndoList);
2151  // add POI
2152  myNet->addPOI(id, type, color, pos, false, "", 0, 0, layer, angle, imgFile, relativePath, POIWidth, POIWeight);
2153  myUndoList->p_end();
2154  }
2155  // update view after transform
2156  update();
2157  }
2158  return 1;
2159 }
2160 
2161 
2162 long
2163 GNEViewNet::onCmdDuplicateLane(FXObject*, FXSelector, void*) {
2164  GNELane* lane = getLaneAtPopupPosition();
2165  if (lane != nullptr) {
2166  // when duplicating an unselected lane, keep all connections as they
2167  // are, otherwise recompute them
2168  if (lane->isAttributeCarrierSelected()) {
2169  myUndoList->p_begin("duplicate selected " + toString(SUMO_TAG_LANE) + "s");
2170  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2171  for (auto it : lanes) {
2172  myNet->duplicateLane(it, myUndoList, true);
2173  }
2174  myUndoList->p_end();
2175  } else {
2176  myUndoList->p_begin("duplicate " + toString(SUMO_TAG_LANE));
2177  myNet->duplicateLane(lane, myUndoList, false);
2178  myUndoList->p_end();
2179  }
2180  }
2181  return 1;
2182 }
2183 
2184 
2185 long
2186 GNEViewNet::onCmdResetLaneCustomShape(FXObject*, FXSelector, void*) {
2187  GNELane* lane = getLaneAtPopupPosition();
2188  if (lane != nullptr) {
2189  // when duplicating an unselected lane, keep all connections as they
2190  // are, otherwise recompute them
2191  if (lane->isAttributeCarrierSelected()) {
2192  myUndoList->p_begin("reset custom lane shapes");
2193  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2194  for (auto it : lanes) {
2195  it->setAttribute(SUMO_ATTR_CUSTOMSHAPE, "", myUndoList);
2196  }
2197  myUndoList->p_end();
2198  } else {
2199  myUndoList->p_begin("reset custom lane shape");
2201  myUndoList->p_end();
2202  }
2203  }
2204  return 1;
2205 }
2206 
2207 
2208 long
2209 GNEViewNet::onCmdRestrictLaneSidewalk(FXObject*, FXSelector, void*) {
2210  return restrictLane(SVC_PEDESTRIAN);
2211 }
2212 
2213 
2214 long
2215 GNEViewNet::onCmdRestrictLaneBikelane(FXObject*, FXSelector, void*) {
2216  return restrictLane(SVC_BICYCLE);
2217 }
2218 
2219 
2220 long
2221 GNEViewNet::onCmdRestrictLaneBuslane(FXObject*, FXSelector, void*) {
2222  return restrictLane(SVC_BUS);
2223 }
2224 
2225 
2226 long
2227 GNEViewNet::onCmdRestrictLaneGreenVerge(FXObject*, FXSelector, void*) {
2228  return restrictLane(SVC_IGNORING);
2229 }
2230 
2231 
2232 long
2233 GNEViewNet::onCmdAddRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
2235 }
2236 
2237 
2238 long
2239 GNEViewNet::onCmdAddRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
2241 }
2242 
2243 
2244 long
2245 GNEViewNet::onCmdAddRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
2246  return addRestrictedLane(SVC_BUS);
2247 }
2248 
2249 
2250 long
2251 GNEViewNet::onCmdAddRestrictedLaneGreenVerge(FXObject*, FXSelector, void*) {
2253 }
2254 
2255 
2256 long
2257 GNEViewNet::onCmdRemoveRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
2259 }
2260 
2261 
2262 long
2263 GNEViewNet::onCmdRemoveRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
2265 }
2266 
2267 
2268 long
2269 GNEViewNet::onCmdRemoveRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
2270  return removeRestrictedLane(SVC_BUS);
2271 }
2272 
2273 
2274 long
2277 }
2278 
2279 
2280 long
2281 GNEViewNet::onCmdOpenAdditionalDialog(FXObject*, FXSelector, void*) {
2282  // retrieve additional under cursor
2284  // check if additional can open dialog
2285  if (addtional && addtional->getTagProperty().hasDialog()) {
2286  addtional->openAdditionalDialog();
2287  }
2288  return 1;
2289 }
2290 
2291 
2292 bool
2294  GNELane* lane = getLaneAtPopupPosition();
2295  if (lane != nullptr) {
2296  // Get selected lanes
2297  std::vector<GNELane*> lanes = myNet->retrieveLanes(true); ;
2298  // Declare map of edges and lanes
2299  std::map<GNEEdge*, GNELane*> mapOfEdgesAndLanes;
2300  // Iterate over selected lanes
2301  for (auto i : lanes) {
2302  mapOfEdgesAndLanes[myNet->retrieveEdge(i->getParentEdge().getID())] = i;
2303  }
2304  // Throw warning dialog if there hare multiple lanes selected in the same edge
2305  if (mapOfEdgesAndLanes.size() != lanes.size()) {
2306  FXMessageBox::information(getApp(), MBOX_OK,
2307  "Multiple lane in the same edge selected", "%s",
2308  ("There are selected lanes that belong to the same edge.\n Only one lane per edge will be restricted for " + toString(vclass) + ".").c_str());
2309  }
2310  // If we handeln a set of lanes
2311  if (mapOfEdgesAndLanes.size() > 0) {
2312  // declare counter for number of Sidewalks
2313  int counter = 0;
2314  // iterate over selected lanes
2315  for (auto i : mapOfEdgesAndLanes) {
2316  if (i.first->hasRestrictedLane(vclass)) {
2317  counter++;
2318  }
2319  }
2320  // if all edges parent own a Sidewalk, stop function
2321  if (counter == (int)mapOfEdgesAndLanes.size()) {
2322  FXMessageBox::information(getApp(), MBOX_OK,
2323  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2324  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
2325  return 0;
2326  } else {
2327  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
2328  // Ask confirmation to user
2329  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2330  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2331  (toString(mapOfEdgesAndLanes.size() - counter) + " lanes will be restricted for " + toString(vclass) + ". continue?").c_str());
2332  if (answer != 1) { //1:yes, 2:no, 4:esc
2333  // write warning if netedit is running in testing mode
2334  if (answer == 2) {
2335  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
2336  } else if (answer == 4) {
2337  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2338  }
2339  return 0;
2340  } else {
2341  // write warning if netedit is running in testing mode
2342  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2343  }
2344  }
2345  // begin undo operation
2346  myUndoList->p_begin("restrict lanes to " + toString(vclass));
2347  // iterate over selected lanes
2348  for (std::map<GNEEdge*, GNELane*>::iterator i = mapOfEdgesAndLanes.begin(); i != mapOfEdgesAndLanes.end(); i++) {
2349  // Transform lane to Sidewalk
2350  myNet->restrictLane(vclass, i->second, myUndoList);
2351  }
2352  // end undo operation
2353  myUndoList->p_end();
2354  } else {
2355  // If only have a single lane, start undo/redo operation
2356  myUndoList->p_begin("restrict lane to " + toString(vclass));
2357  // Transform lane to Sidewalk
2358  myNet->restrictLane(vclass, lane, myUndoList);
2359  // end undo operation
2360  myUndoList->p_end();
2361  }
2362  }
2363  return 1;
2364 }
2365 
2366 
2367 bool
2369  GNELane* lane = getLaneAtPopupPosition();
2370  if (lane != nullptr) {
2371  // Get selected edges
2372  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2373  // get selected lanes
2374  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2375  // Declare set of edges
2376  std::set<GNEEdge*> setOfEdges;
2377  // Fill set of edges with vector of edges
2378  for (auto i : edges) {
2379  setOfEdges.insert(i);
2380  }
2381  // iterate over selected lanes
2382  for (auto it : lanes) {
2383  // Insert pointer to edge into set of edges (To avoid duplicates)
2384  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
2385  }
2386  // If we handeln a set of edges
2387  if (setOfEdges.size() > 0) {
2388  // declare counter for number of restrictions
2389  int counter = 0;
2390  // iterate over set of edges
2391  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2392  // update counter if edge has already a restricted lane of type "vclass"
2393  if ((*it)->hasRestrictedLane(vclass)) {
2394  counter++;
2395  }
2396  }
2397  // if all lanes own a Sidewalk, stop function
2398  if (counter == (int)setOfEdges.size()) {
2399  FXMessageBox::information(getApp(), MBOX_OK,
2400  ("Add vclass for" + toString(vclass) + " to selected lanes").c_str(), "%s",
2401  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
2402  return 0;
2403  } else {
2404  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
2405  // Ask confirmation to user
2406  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2407  ("Add vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2408  (toString(setOfEdges.size() - counter) + " restrictions for " + toString(vclass) + " will be added. continue?").c_str());
2409  if (answer != 1) { //1:yes, 2:no, 4:esc
2410  // write warning if netedit is running in testing mode
2411  if (answer == 2) {
2412  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
2413  } else if (answer == 4) {
2414  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2415  }
2416  return 0;
2417  } else {
2418  // write warning if netedit is running in testing mode
2419  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2420  }
2421  }
2422  // begin undo operation
2423  myUndoList->p_begin("Add restrictions for " + toString(vclass));
2424  // iterate over set of edges
2425  for (auto it : setOfEdges) {
2426  // add restricted lane
2427  myNet->addRestrictedLane(vclass, *it, 0, myUndoList);
2428  }
2429  // end undo operation
2430  myUndoList->p_end();
2431  } else {
2432  // If only have a single lane, start undo/redo operation
2433  myUndoList->p_begin("Add vclass for " + toString(vclass));
2434  // Add restricted lane
2435  if (lane->getIndex() > 0) {
2436  myNet->addRestrictedLane(vclass, lane->getParentEdge(), lane->getIndex(), myUndoList);
2437  } else {
2438  myNet->addRestrictedLane(vclass, lane->getParentEdge(), 0, myUndoList);
2439  }
2440  // end undo/redo operation
2441  myUndoList->p_end();
2442  }
2443  }
2444  return 1;
2445 }
2446 
2447 
2448 bool
2450  GNELane* lane = getLaneAtPopupPosition();
2451  if (lane != nullptr) {
2452  // Get selected edges
2453  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2454  // get selected lanes
2455  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2456  // Declare set of edges
2457  std::set<GNEEdge*> setOfEdges;
2458  // Fill set of edges with vector of edges
2459  for (auto i : edges) {
2460  setOfEdges.insert(i);
2461  }
2462  // iterate over selected lanes
2463  for (auto it : lanes) {
2464  // Insert pointer to edge into set of edges (To avoid duplicates)
2465  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
2466  }
2467  // If we handeln a set of edges
2468  if (setOfEdges.size() > 0) {
2469  // declare counter for number of restrictions
2470  int counter = 0;
2471  // iterate over set of edges
2472  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2473  // update counter if edge has already a restricted lane of type "vclass"
2474  if ((*it)->hasRestrictedLane(vclass)) {
2475  counter++;
2476  }
2477  }
2478  // if all lanes don't own a Sidewalk, stop function
2479  if (counter == 0) {
2480  FXMessageBox::information(getApp(), MBOX_OK,
2481  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2482  ("Selected lanes and edges haven't a restriction for " + toString(vclass)).c_str());
2483  return 0;
2484  } else {
2485  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
2486  // Ask confirmation to user
2487  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2488  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2489  (toString(counter) + " restrictions for " + toString(vclass) + " will be removed. continue?").c_str());
2490  if (answer != 1) { //1:yes, 2:no, 4:esc
2491  // write warning if netedit is running in testing mode
2492  if (answer == 2) {
2493  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
2494  } else if (answer == 4) {
2495  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2496  }
2497  return 0;
2498  } else {
2499  // write warning if netedit is running in testing mode
2500  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2501  }
2502  }
2503  // begin undo operation
2504  myUndoList->p_begin("Remove restrictions for " + toString(vclass));
2505  // iterate over set of edges
2506  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2507  // add Sidewalk
2508  myNet->removeRestrictedLane(vclass, *(*it), myUndoList);
2509  }
2510  // end undo operation
2511  myUndoList->p_end();
2512  } else {
2513  // If only have a single lane, start undo/redo operation
2514  myUndoList->p_begin("Remove vclass for " + toString(vclass));
2515  // Remove Sidewalk
2517  // end undo/redo operation
2518  myUndoList->p_end();
2519  }
2520  }
2521  return 1;
2522 }
2523 
2524 
2525 void
2526 GNEViewNet::processClick(void* eventData) {
2527  FXEvent* evt = (FXEvent*)eventData;
2528  // process click
2529  destroyPopup();
2530  setFocus();
2531  myChanger->onLeftBtnPress(eventData);
2532  grab();
2533  // Check there are double click
2534  if (evt->click_count == 2) {
2535  handle(this, FXSEL(SEL_DOUBLECLICKED, 0), eventData);
2536  }
2537 }
2538 
2539 
2540 void
2542  // update cursor if control key is pressed
2544  setDefaultCursor(GUICursorSubSys::getCursor(SUMOCURSOR_MOVE));
2546  } else {
2549  }
2550 }
2551 
2552 
2553 long
2554 GNEViewNet::onCmdEditJunctionShape(FXObject*, FXSelector, void*) {
2555  // Obtain junction under mouse
2557  if (junction) {
2558  if (!OptionsCont::getOptions().getBool("lefthand")) {
2559  // for lefthand networks, the shape is already computed in GNELoadThread::run()
2560  // computing it here does not work because the network needs to be
2561  // mirrored before and after
2562  junction->getNBNode()->computeNodeShape(-1);
2563  } else if (junction->getNBNode()->getShape().size() == 0) {
2564  // recompute the whole network
2566  }
2567  PositionVector nodeShape = junction->getNBNode()->getShape();
2568  nodeShape.closePolygon();
2569  startEditCustomShape(junction, nodeShape, true);
2570  }
2571  // destroy pop-up and set focus in view net
2572  destroyPopup();
2573  setFocus();
2574  return 1;
2575 }
2576 
2577 
2578 long
2579 GNEViewNet::onCmdResetJunctionShape(FXObject*, FXSelector, void*) {
2580  // Obtain junction under mouse
2582  if (junction) {
2583  // are, otherwise recompute them
2584  if (junction->isAttributeCarrierSelected()) {
2585  myUndoList->p_begin("reset custom junction shapes");
2586  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions(true);
2587  for (auto it : junctions) {
2588  it->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
2589  }
2590  myUndoList->p_end();
2591  } else {
2592  myUndoList->p_begin("reset custom junction shape");
2593  junction->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
2594  myUndoList->p_end();
2595  }
2596  }
2597  // destroy pop-up and set focus in view net
2598  destroyPopup();
2599  setFocus();
2600  return 1;
2601 }
2602 
2603 
2604 long
2605 GNEViewNet::onCmdReplaceJunction(FXObject*, FXSelector, void*) {
2607  if (junction != nullptr) {
2609  update();
2610  }
2611  // destroy pop-up and set focus in view net
2612  destroyPopup();
2613  setFocus();
2614  return 1;
2615 }
2616 
2617 
2618 long
2619 GNEViewNet::onCmdSplitJunction(FXObject*, FXSelector, void*) {
2621  if (junction != nullptr) {
2622  myNet->splitJunction(junction, myUndoList);
2623  update();
2624  }
2625  // destroy pop-up and set focus in view net
2626  destroyPopup();
2627  setFocus();
2628  return 1;
2629 }
2630 
2631 
2632 long
2633 GNEViewNet::onCmdClearConnections(FXObject*, FXSelector, void*) {
2635  if (junction != nullptr) {
2636  // check if we're handling a selection
2637  if (junction->isAttributeCarrierSelected()) {
2638  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2639  myUndoList->p_begin("clear connections of selected junctions");
2640  for (auto i : selectedJunction) {
2642  }
2643  myUndoList->p_end();
2644  } else {
2646  }
2647  update();
2648  }
2649  // destroy pop-up and set focus in view net
2650  destroyPopup();
2651  setFocus();
2652  return 1;
2653 }
2654 
2655 
2656 long
2657 GNEViewNet::onCmdResetConnections(FXObject*, FXSelector, void*) {
2659  if (junction != nullptr) {
2660  // check if we're handling a selection
2661  if (junction->isAttributeCarrierSelected()) {
2662  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2663  myUndoList->p_begin("reset connections of selected junctions");
2664  for (auto i : selectedJunction) {
2666  }
2667  myUndoList->p_end();
2668  } else {
2670  }
2671  update();
2672  }
2673  // destroy pop-up and set focus in view net
2674  destroyPopup();
2675  setFocus();
2676  return 1;
2677 }
2678 
2679 
2680 long
2681 GNEViewNet::onCmdEditConnectionShape(FXObject*, FXSelector, void*) {
2682  // Obtain connection under mouse
2684  if (connection) {
2685  startEditCustomShape(connection, connection->getShape(), false);
2686  }
2687  // destroy pop-up and update view Net
2688  destroyPopup();
2689  setFocus();
2690  return 1;
2691 }
2692 
2693 
2694 long
2695 GNEViewNet::onCmdEditCrossingShape(FXObject*, FXSelector, void*) {
2696  // Obtain crossing under mouse
2698  if (crossing) {
2699  // due crossings haven two shapes, check what has to be edited
2700  PositionVector shape = crossing->getNBCrossing()->customShape.size() > 0 ? crossing->getNBCrossing()->customShape : crossing->getNBCrossing()->shape;
2701  startEditCustomShape(crossing, shape, false);
2702  }
2703  // destroy pop-up and update view Net
2704  destroyPopup();
2705  setFocus();
2706  return 1;
2707 }
2708 
2709 
2710 long
2711 GNEViewNet::onCmdToogleShowConnection(FXObject*, FXSelector, void*) {
2712  // if show was enabled, init GNEConnections
2715  }
2716  // change flag "showLane2Lane" in myVisualizationSettings
2718  // Hide/show connections requiere recompute
2719  getNet()->requireRecompute();
2720  // Update viewnNet to show/hide conections
2721  update();
2722  return 1;
2723 }
2724 
2725 
2726 long
2727 GNEViewNet::onCmdToogleSelectEdges(FXObject*, FXSelector, void*) {
2728  // nothing to do
2729  return 1;
2730 }
2731 
2732 
2733 long
2734 GNEViewNet::onCmdToogleShowBubbles(FXObject*, FXSelector, void*) {
2735  // Only update view
2736  update();
2737  return 1;
2738 }
2739 
2740 
2741 long
2742 GNEViewNet::onCmdToogleMoveElevation(FXObject*, FXSelector, void*) {
2743  // Only update view
2744  update();
2745  return 1;
2746 }
2747 
2748 
2749 long
2750 GNEViewNet::onCmdAddSelected(FXObject*, FXSelector, void*) {
2751  if (makeCurrent()) {
2755  if (ACToselect && !ACToselect->isAttributeCarrierSelected()) {
2756  ACToselect->selectAttributeCarrier();
2757  }
2758  }
2759  return 1;
2760 }
2761 
2762 
2763 long
2764 GNEViewNet::onCmdRemoveSelected(FXObject*, FXSelector, void*) {
2765  if (makeCurrent()) {
2769  if (ACToselect && ACToselect->isAttributeCarrierSelected()) {
2770  ACToselect->unselectAttributeCarrier();
2771  }
2772  }
2773  return 1;
2774 }
2775 
2776 
2777 long
2778 GNEViewNet::onCmdShowGrid(FXObject*, FXSelector, void*) {
2779  // show or hidde grid depending of myViewOptions.menuCheckShowGrid
2780  if (myViewOptions.menuCheckShowGrid->getCheck()) {
2782  } else {
2784  }
2785  update();
2786  return 1;
2787 }
2788 
2789 
2790 // ===========================================================================
2791 // private
2792 // ===========================================================================
2793 
2794 void
2796  if (mode == myEditMode) {
2797  setStatusBarText("Mode already selected");
2798  if (myCurrentFrame != nullptr) {
2800  }
2802  setStatusBarText("save modifications in TLS before change mode");
2804  } else {
2805  setStatusBarText("");
2806  abortOperation(false);
2807  // stop editing of custom shapes
2809  // set edit mode
2810  myEditMode = mode;
2811  switch (mode) {
2812  case GNE_MODE_CONNECT:
2813  case GNE_MODE_PROHIBITION:
2814  case GNE_MODE_TLS:
2815  // modes which depend on computed data
2817  break;
2818  default:
2819  break;
2820  }
2822  }
2823 }
2824 
2825 
2826 void
2828  // initialize buttons for modes
2829  myEditModeCreateEdge = new MFXCheckableButton(false, myToolbar, "\tset create edge mode\tMode for creating junction and edges.",
2831  myEditModeMove = new MFXCheckableButton(false, myToolbar, "\tset move mode\tMode for move elements.",
2833  myEditModeDelete = new MFXCheckableButton(false, myToolbar, "\tset delete mode\tMode for delete elements.",
2835  myEditModeInspect = new MFXCheckableButton(false, myToolbar, "\tset inspect mode\tMode for inspect elements and change their attributes.",
2837  myEditModeSelect = new MFXCheckableButton(false, myToolbar, "\tset select mode\tMode for select elements.",
2839  myEditModeConnection = new MFXCheckableButton(false, myToolbar, "\tset connection mode\tMode for edit connections between lanes.",
2841  myEditModeProhibition = new MFXCheckableButton(false, myToolbar, "\tset prohibition mode\tMode for editing connection prohibitions.",
2843  myEditModeTrafficLight = new MFXCheckableButton(false, myToolbar, "\tset traffic light mode\tMode for edit traffic lights over junctions.",
2845  myEditModeAdditional = new MFXCheckableButton(false, myToolbar, "\tset additional mode\tMode for adding additional elements.",
2847  myEditModeCrossing = new MFXCheckableButton(false, myToolbar, "\tset crossing mode\tMode for creating crossings between edges.",
2849  myEditModeTAZ = new MFXCheckableButton(false, myToolbar, "\tset TAZ mode\tMode for creating Traffic Assignment Zones.",
2851  myEditModePolygon = new MFXCheckableButton(false, myToolbar, "\tset polygon mode\tMode for creating polygons and POIs.",
2853 
2854  // @ToDo add here new FXToolBarGrip(myNavigationToolBar, nullptr, 0, GUIDesignToolbarGrip);
2855 
2856 
2857  // initialize mode specific controls
2858 
2859  // build menu checks of create edges options
2861 
2862  // build menu checks of view options
2864 }
2865 
2866 
2867 void
2869  // hide grid
2871  // hide all checkbox of create edge
2873  // hide all checkbox of view options
2875  // unckeck all edit modes
2877  myEditModeMove->setChecked(false);
2878  myEditModeDelete->setChecked(false);
2879  myEditModeInspect->setChecked(false);
2880  myEditModeSelect->setChecked(false);
2885  myEditModeTAZ->setChecked(false);
2886  myEditModePolygon->setChecked(false);
2889  // enable selected controls
2890  switch (myEditMode) {
2891  case GNE_MODE_CREATE_EDGE:
2896  break;
2897  case GNE_MODE_MOVE:
2901  myEditModeMove->setChecked(true);
2903  break;
2904  case GNE_MODE_DELETE:
2911  break;
2912  case GNE_MODE_INSPECT:
2919  break;
2920  case GNE_MODE_SELECT:
2928  break;
2929  case GNE_MODE_CONNECT:
2935  break;
2936  case GNE_MODE_TLS:
2942  break;
2943  case GNE_MODE_ADDITIONAL:
2949  break;
2950  case GNE_MODE_CROSSING:
2955  myViewOptions.menuCheckShowGrid->setCheck(false);
2956  break;
2957  case GNE_MODE_TAZ:
2961  myEditModeTAZ->setChecked(true);
2962  myViewOptions.menuCheckShowGrid->setCheck(false);
2963  break;
2964  case GNE_MODE_POLYGON:
2970  break;
2971  case GNE_MODE_PROHIBITION:
2976  break;
2977  default:
2978  break;
2979  }
2980  // Update buttons
2981  myEditModeCreateEdge->update();
2982  myEditModeMove->update();
2983  myEditModeDelete->update();
2984  myEditModeInspect->update();
2985  myEditModeSelect->update();
2986  myEditModeConnection->update();
2987  myEditModeTrafficLight->update();
2988  myEditModeAdditional->update();
2989  myEditModeCrossing->update();
2990  myEditModeTAZ->update();
2991  myEditModePolygon->update();
2992  myEditModeProhibition->update();
2993  // force repaint because different modes draw different things
2994  myToolbar->recalc();
2995  onPaint(nullptr, 0, nullptr);
2996  update();
2997 }
2998 
2999 
3000 void
3002  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions(true);
3003  if (junctions.size() > 0) {
3004  std::string plural = junctions.size() == 1 ? ("") : ("s");
3005  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_JUNCTION) + plural);
3006  for (auto i : junctions) {
3008  }
3009  myUndoList->p_end();
3010  }
3011 }
3012 
3013 
3014 void
3016  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
3017  if (lanes.size() > 0) {
3018  std::string plural = lanes.size() == 1 ? ("") : ("s");
3019  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_LANE) + plural);
3020  for (auto i : lanes) {
3021  // when deleting multiple lanes, recompute connections
3022  myNet->deleteLane(i, myUndoList, true);
3023  }
3024  myUndoList->p_end();
3025  }
3026 }
3027 
3028 
3029 void
3031  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
3032  if (edges.size() > 0) {
3033  std::string plural = edges.size() == 1 ? ("") : ("s");
3034  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_EDGE) + plural);
3035  for (auto i : edges) {
3036  // when deleting multiple edges, recompute connections
3037  myNet->deleteEdge(i, myUndoList, true);
3038  }
3039  myUndoList->p_end();
3040  }
3041 }
3042 
3043 
3044 void
3046  std::vector<GNEAdditional*> additionals = myNet->retrieveAdditionals(true);
3047  if (additionals.size() > 0) {
3048  std::string plural = additionals.size() == 1 ? ("") : ("s");
3049  myUndoList->p_begin("delete selected additional" + plural);
3050  for (auto i : additionals) {
3051  // due there are additionals that are removed when their parent is removed, we need to check if yet exists before removing
3052  if (myNet->retrieveAdditional(i->getTagProperty().getTag(), i->getID(), false) != nullptr) {
3054  }
3055  }
3056  myUndoList->p_end();
3057  }
3058 }
3059 
3060 
3061 
3062 void
3064  // obtain selected crossings
3065  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions();
3066  std::vector<GNECrossing*> crossings;
3067  for (auto i : junctions) {
3068  for (auto j : i->getGNECrossings()) {
3069  if (j->isAttributeCarrierSelected()) {
3070  crossings.push_back(j);
3071  }
3072  }
3073  }
3074  // remove selected crossings
3075  if (crossings.size() > 0) {
3076  std::string plural = crossings.size() == 1 ? ("") : ("s");
3077  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CROSSING) + "s");
3078  for (auto i : crossings) {
3079  if (myNet->retrieveCrossing(i->getID(), false)) {
3081  }
3082  }
3083  myUndoList->p_end();
3084  }
3085 }
3086 
3087 
3088 void
3090  // obtain selected connections
3091  std::vector<GNEEdge*> edges = myNet->retrieveEdges();
3092  std::vector<GNEConnection*> connections;
3093  for (auto i : edges) {
3094  for (auto j : i->getGNEConnections()) {
3095  if (j->isAttributeCarrierSelected()) {
3096  connections.push_back(j);
3097  }
3098  }
3099  }
3100  // remove selected connections
3101  if (connections.size() > 0) {
3102  std::string plural = connections.size() == 1 ? ("") : ("s");
3103  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CONNECTION) + plural);
3104  for (auto i : connections) {
3106  }
3107  myUndoList->p_end();
3108  }
3109 }
3110 
3111 
3112 void
3114  // obtain selected shapes
3115  std::vector<GNEShape*> selectedShapes = myNet->retrieveShapes(true);
3116  // remove it
3117  if (selectedShapes.size() > 0) {
3118  std::string plural = selectedShapes.size() == 1 ? ("") : ("s");
3119  myUndoList->p_begin("delete selected shape" + plural);
3120  for (auto i : selectedShapes) {
3122  }
3123  myUndoList->p_end();
3124  }
3125 }
3126 
3127 
3128 bool
3130  const Position& newPos = moved->getNBNode()->getPosition();
3131  GNEJunction* mergeTarget = nullptr;
3132  // try to find another junction to merge with
3133  if (makeCurrent()) {
3134  Boundary selection;
3135  selection.add(newPos);
3136  selection.grow(0.1);
3137  const std::vector<GUIGlID> ids = getObjectsInBoundary(selection);
3138  GUIGlObject* object = nullptr;
3139  for (auto it_ids : ids) {
3140  if (it_ids == 0) {
3141  continue;
3142  }
3144  if (!object) {
3145  throw ProcessError("Unkown object in selection (id=" + toString(it_ids) + ").");
3146  }
3147  if ((object->getType() == GLO_JUNCTION) && (it_ids != moved->getGlID())) {
3148  mergeTarget = dynamic_cast<GNEJunction*>(object);
3149  }
3151  }
3152  }
3153  if (mergeTarget) {
3154  // optionally ask for confirmation
3155  if (myCreateEdgeOptions.menuCheckWarnAboutMerge->getCheck()) {
3156  WRITE_DEBUG("Opening FXMessageBox 'merge junctions'");
3157  // open question box
3158  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO,
3159  "Confirm Junction Merger", "%s",
3160  ("Do you wish to merge junctions '" + moved->getMicrosimID() +
3161  "' and '" + mergeTarget->getMicrosimID() + "'?\n" +
3162  "('" + moved->getMicrosimID() +
3163  "' will be eliminated and its roads added to '" +
3164  mergeTarget->getMicrosimID() + "')").c_str());
3165  if (answer != 1) { //1:yes, 2:no, 4:esc
3166  // write warning if netedit is running in testing mode
3167  if (answer == 2) {
3168  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'No'");
3169  } else if (answer == 4) {
3170  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'ESC'");
3171  }
3172  return false;
3173  } else {
3174  // write warning if netedit is running in testing mode
3175  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'Yes'");
3176  }
3177  }
3178  // restore previous position of junction moved
3179  moved->moveGeometry(oldPos, Position(0, 0));
3180  // finish geometry moving
3181  moved->endGeometryMoving();
3182  // merge moved and targed junctions
3183  myNet->mergeJunctions(moved, mergeTarget, myUndoList);
3184  return true;
3185  } else {
3186  return false;
3187  }
3188 }
3189 
3190 
3191 void
3193  switch (myEditMode) {
3194  case GNE_MODE_INSPECT:
3195  myViewParent->getInspectorFrame()->update();
3196  break;
3197  default:
3198  break;
3199  }
3200 }
3201 
3202 // ---------------------------------------------------------------------------
3203 // GNEViewNet::MovedItems - methods
3204 // ---------------------------------------------------------------------------
3205 
3207  junctionToMove(nullptr),
3208  edgeToMove(nullptr),
3209  polyToMove(nullptr),
3210  poiToMove(nullptr),
3211  additionalToMove(nullptr),
3212  tazToMove(nullptr) {
3213 }
3214 
3215 // ---------------------------------------------------------------------------
3216 // GNEViewNet::MoveSingleElementValues - methods
3217 // ---------------------------------------------------------------------------
3218 
3220  movingIndexShape(-1),
3221  movingStartPos(false),
3222  movingEndPos(false),
3223  myViewNet(viewNet) {
3224 }
3225 
3226 
3227 Position
3229  // calculate offsetMovement depending of current mouse position and relative clicked position
3230  // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
3232  // calculate Z depending of menuCheckMoveElevation
3234  // reset offset X and Y and use Y for Z
3235  offsetMovement = Position(0, 0, offsetMovement.y());
3236  } else {
3237  // leave z empty (because in this case offset only actuates over X-Y)
3238  offsetMovement.setz(0);
3239  }
3240  return offsetMovement;
3241 }
3242 
3243 
3244 void
3246  // set Poly to move
3248  // now we have two cases: if we're editing the X-Y coordenade or the altitude (z)
3250  // check if in the clicked position a geometry point exist
3251  int existentIndex = myViewNet->myMovedItems.polyToMove->getVertexIndex(myViewNet->getPositionInformation(), false, false);
3252  if (existentIndex != -1) {
3253  // save original shape (needed for commit change)
3255  // obtain existent index
3258  } else {
3259  // stop poly moving
3260  myViewNet->myMovedItems.polyToMove = nullptr;
3261  }
3262  } else {
3263  // save original shape (needed for commit change)
3265  // save clicked position as moving original position
3267  // obtain index of vertex to move if shape isn't blocked
3269  // check if we want to remove a Geometry Point
3271  // check if we're clicked over a Geometry Point
3275  // after removing Geomtery Point, reset PolyToMove
3276  myViewNet->myMovedItems.polyToMove = nullptr;
3277  }
3278  } else {
3279  // obtain index of vertex to move and moving reference
3282  // create new geometry point
3284  }
3285  }
3286  } else {
3288  }
3289  }
3290 }
3291 
3292 
3293 void
3295  // allways swap getLaneFront()s to getEdgesFront()s in movement mode
3298  }
3300  // begin move selection of multiple elements
3302  } else if (myViewNet->myKeyPressed.shiftKeyPressed()) {
3303  // edit end point
3305  } else {
3306  // assign clicked edge to edgeToMove
3308  // check if we clicked over a start or end position
3310  // save start pos
3313  // start geometry moving
3316  // save end pos
3319  // start geometry moving
3321  } else {
3322  // now we have two cases: if we're editing the X-Y coordenade or the altitude (z)
3324  // check if in the clicked position a geometry point exist
3325  int existentIndex = myViewNet->myMovedItems.edgeToMove->getVertexIndex(myViewNet->getPositionInformation(), false, false);
3326  if (existentIndex != -1) {
3329  // start geometry moving
3331  } else {
3332  // stop edge moving
3333  myViewNet->myMovedItems.edgeToMove = nullptr;
3334  }
3335  } else {
3336  // save original shape (needed for commit change)
3338  // obtain index of vertex to move and moving reference
3340  // if index doesn't exist, create it snapping new edge to grid
3343  }
3344  // make sure that myViewNet->myMoveSingleElementValues.movingIndexShape isn't -1
3347  // start geometry moving
3349  }
3350  }
3351  }
3352  }
3353 }
3354 
3355 
3356 void
3358  // set TAZ to move
3360  // save original shape (needed for commit change)
3362  // save clicked position as moving original position
3364  // obtain index of vertex to move if shape isn't blocked
3366  // check if we want to remove a Geometry Point
3368  // check if we're clicked over a Geometry Point
3372  // after removing Geomtery Point, reset PolyToMove
3373  myViewNet->myMovedItems.tazToMove = nullptr;
3374  }
3375  } else {
3376  // obtain index of vertex to move and moving reference
3379  // create new geometry point
3381  }
3382  }
3383  } else {
3384  // abort moving index shape
3386  }
3387 }
3388 
3389 // ---------------------------------------------------------------------------
3390 // GNEViewNet::MoveMultipleElementValues - methods
3391 // ---------------------------------------------------------------------------
3392 
3394  myViewNet(viewNet),
3395  myMovingSelection(false) {
3396 }
3397 
3398 
3399 void
3401  // enable moving selection
3402  myMovingSelection = true;
3403  // save clicked position (to calculate offset)
3405  // obtain Junctions and edges selected
3406  std::vector<GNEJunction*> selectedJunctions = myViewNet->getNet()->retrieveJunctions(true);
3407  std::vector<GNEEdge*> selectedEdges = myViewNet->getNet()->retrieveEdges(true);
3408  // Junctions are always moved, then save position of current selected junctions (Needed when mouse is released)
3409  for (auto i : selectedJunctions) {
3410  // save junction position
3411  myMovedJunctionOriginPositions[i] = i->getPositionInView();
3412  // start geometry moving
3413  i->startGeometryMoving();
3414  }
3415  // make special movement depending of clicked AC
3416  if (originAC->getTagProperty().getTag() == SUMO_TAG_JUNCTION) {
3417  // if clicked element is a junction, move shapes of all selected edges
3418  for (auto i : selectedEdges) {
3419  // save entire edge geometry
3420  myMovedEdgesOriginShape[i] = i->getNBEdge()->getInnerGeometry();
3421  // start geometry moving
3422  i->startGeometryMoving();
3423  }
3424  } else if (originAC->getTagProperty().getTag() == SUMO_TAG_EDGE) {
3425  // obtain clicked edge
3426  GNEEdge* clickedEdge = dynamic_cast<GNEEdge*>(originAC);
3427  // if clicked edge has origin and destiny junction selected, move shapes of all selected edges
3428  if (myMovedJunctionOriginPositions.count(clickedEdge->getGNEJunctionSource()) > 0 &&
3429  myMovedJunctionOriginPositions.count(clickedEdge->getGNEJunctionDestiny()) > 0) {
3430  for (auto i : selectedEdges) {
3431  // save entire edge geometry
3432  myMovedEdgesOriginShape[i] = i->getNBEdge()->getInnerGeometry();
3433  // start geometry moving
3434  i->startGeometryMoving();
3435  }
3436  } else {
3437  // declare three groups for dividing edges
3438  std::vector<GNEEdge*> noJunctionsSelected;
3439  std::vector<GNEEdge*> originJunctionSelected;
3440  std::vector<GNEEdge*> destinyJunctionSelected;
3441  // divide selected edges into four groups, depending of the selection of their junctions
3442  for (auto i : selectedEdges) {
3443  bool originSelected = myMovedJunctionOriginPositions.count(i->getGNEJunctionSource()) > 0;
3444  bool destinySelected = myMovedJunctionOriginPositions.count(i->getGNEJunctionDestiny()) > 0;
3445  // bot junctions selected
3446  if (!originSelected && !destinySelected) {
3447  noJunctionsSelected.push_back(i);
3448  } else if (originSelected && !destinySelected) {
3449  originJunctionSelected.push_back(i);
3450  } else if (!originSelected && destinySelected) {
3451  destinyJunctionSelected.push_back(i);
3452  } else if (!originSelected && !destinySelected) {
3453  // save edge geometry
3454  myMovedEdgesOriginShape[i] = i->getNBEdge()->getInnerGeometry();
3455  // start geometry moving
3456  i->startGeometryMoving();
3457  }
3458  }
3459  // save original shape of all noJunctionsSelected edges (needed for commit change)
3460  for (auto i : noJunctionsSelected) {
3462  // save edge geometry
3463  myMovedEgdesGeometryPoints[i]->originalShapeBeforeMoving = i->getNBEdge()->getInnerGeometry();
3464  // start geometry moving
3465  i->startGeometryMoving();
3466  }
3467  // obtain index shape of clicked edge
3468  int index = clickedEdge->getVertexIndex(myViewNet->getPositionInformation(), true, true);
3469  // check that index is valid
3470  if (index < 0) {
3471  throw ProcessError("invalid shape index");
3472  }
3473  // save index and original position
3475  myMovedEgdesGeometryPoints[clickedEdge]->movingIndexShape = index;
3476  myMovedEgdesGeometryPoints[clickedEdge]->originalPositionInView = myViewNet->getPositionInformation();
3477  // start moving of clicked edge AFTER getting vertex Index
3478  clickedEdge->startGeometryMoving();
3479  // do the same for the rest of noJunctionsSelected edges
3480  for (auto i : noJunctionsSelected) {
3481  if (i != clickedEdge) {
3483  // save index and original position
3484  myMovedEgdesGeometryPoints[i]->movingIndexShape = i->getVertexIndex(myViewNet->getPositionInformation(), true, true);
3485  // set originalPosition depending if edge is opposite to clicked edge
3486  if (i->getOppositeEdge() == clickedEdge) {
3487  myMovedEgdesGeometryPoints[i]->originalPositionInView = myViewNet->getPositionInformation();
3488  } else {
3489  myMovedEgdesGeometryPoints[i]->originalPositionInView = i->getNBEdge()->getInnerGeometry()[myMovedEgdesGeometryPoints[i]->movingIndexShape];
3490  }
3491  // start moving of clicked edge AFTER getting vertex Index
3492  i->startGeometryMoving();
3493  }
3494  }
3495  }
3496  }
3497 }
3498 
3499 
3500 void
3502  // calculate offset between current position and original position
3504  // calculate Z depending of Grid
3506  // reset offset X and Y and use Y for Z
3507  offsetMovement = Position(0, 0, offsetMovement.y());
3508  } else {
3509  // leave z empty (because in this case offset only actuates over X-Y)
3510  offsetMovement.setz(0);
3511  }
3512  // move selected junctions
3513  for (auto i : myMovedJunctionOriginPositions) {
3514  i.first->moveGeometry(i.second, offsetMovement);
3515  }
3516  // move entire edge shapes
3517  for (auto i : myMovedEdgesOriginShape) {
3518  i.first->moveEntireShape(i.second, offsetMovement);
3519  }
3520  // move partial shapes
3521  for (auto i : myMovedEgdesGeometryPoints) {
3522  i.first->moveVertexShape(i.second->movingIndexShape, i.second->originalPositionInView, offsetMovement);
3523  }
3524 }
3525 
3526 
3527 void
3529  // begin undo list
3530  myViewNet->getUndoList()->p_begin("position of selected elements");
3531  // commit positions of moved junctions
3532  for (auto i : myMovedJunctionOriginPositions) {
3533  i.first->endGeometryMoving();
3534  i.first->commitGeometryMoving(i.second, myViewNet->getUndoList());
3535  }
3536  // commit shapes of entired moved edges
3537  for (auto i : myMovedEdgesOriginShape) {
3538  i.first->endGeometryMoving();
3539  i.first->commitShapeChange(i.second, myViewNet->getUndoList());
3540  }
3541  //commit shapes of partial moved shapes
3542  for (auto i : myMovedEgdesGeometryPoints) {
3543  i.first->endGeometryMoving();
3544  i.first->commitShapeChange(i.second->originalShapeBeforeMoving, myViewNet->getUndoList());
3545  }
3546  // end undo list
3547  myViewNet->getUndoList()->p_end();
3548  // stop moving selection
3549  myMovingSelection = false;
3550  // clear containers
3551  myMovedJunctionOriginPositions.clear();
3552  myMovedEdgesOriginShape.clear();
3553  // delete all movedEgdesGeometryPoints before clear container
3554  for (const auto &i : myMovedEgdesGeometryPoints) {
3555  delete i.second;
3556  }
3557  myMovedEgdesGeometryPoints.clear();
3558 }
3559 
3560 
3561 bool
3563  return myMovingSelection;
3564 }
3565 
3566 // ---------------------------------------------------------------------------
3567 // GNEViewNet::SelectingArea - methods
3568 // ---------------------------------------------------------------------------
3569 
3571  selectingUsingRectangle(false),
3572  startDrawing(false),
3573  myViewNet(viewNet) {
3574 }
3575 
3576 
3577 void
3579  selectingUsingRectangle = true;
3582 }
3583 
3584 
3585 void
3587  // start drawing
3588  startDrawing = true;
3589  // only update selection corner 2
3591  // update status bar
3592  myViewNet->setStatusBarText("Selection width:" + toString(fabs(selectionCorner1.x() - selectionCorner2.x()))
3593  + " height:" + toString(fabs(selectionCorner1.y() - selectionCorner2.y()))
3595 }
3596 
3597 
3598 void
3600  // finish rectangle selection
3601  selectingUsingRectangle = false;
3602  startDrawing = false;
3603 }
3604 
3605 
3606 void
3608  // shift held down on mouse-down and mouse-up and check that rectangle exist
3609  if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
3610  (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
3612  // create boundary between two corners
3613  Boundary rectangleBoundary;
3614  rectangleBoundary.add(selectionCorner1);
3615  rectangleBoundary.add(selectionCorner2);
3616  // process selection within boundary
3617  processBoundarySelection(rectangleBoundary);
3618  }
3619 }
3620 
3621 
3622 std::vector<GNEEdge*>
3624  // declare vector for selection
3625  std::vector<GNEEdge*> result;
3626  // shift held down on mouse-down and mouse-up and check that rectangle exist
3627  if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
3628  (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
3630  // create boundary between two corners
3631  Boundary rectangleBoundary;
3632  rectangleBoundary.add(selectionCorner1);
3633  rectangleBoundary.add(selectionCorner2);
3634  if (myViewNet->makeCurrent()) {
3635  // obtain all ACs in Rectangle BOundary
3636  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundary = myViewNet->getAttributeCarriersInBoundary(rectangleBoundary);
3637  // Filter ACs in Boundary and get only edges
3638  for (auto i : ACsInBoundary) {
3639  if(i.second->getTagProperty().getTag() == SUMO_TAG_EDGE) {
3640  result.push_back(dynamic_cast<GNEEdge*>(i.second));
3641  }
3642  }
3643  myViewNet->makeNonCurrent();
3644  }
3645  }
3646  return result;
3647 }
3648 
3649 
3650 void
3653 }
3654 
3655 
3656 void
3659  glPushMatrix();
3660  glTranslated(0, 0, GLO_MAX - 1);
3661  GLHelper::setColor(color);
3662  glLineWidth(2);
3663  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
3664  glBegin(GL_QUADS);
3665  glVertex2d(selectionCorner1.x(), selectionCorner1.y());
3666  glVertex2d(selectionCorner1.x(), selectionCorner2.y());
3667  glVertex2d(selectionCorner2.x(), selectionCorner2.y());
3668  glVertex2d(selectionCorner2.x(), selectionCorner1.y());
3669  glEnd();
3670  glPopMatrix();
3671  }
3672 }
3673 
3674 
3675 void
3677  if (myViewNet->makeCurrent()) {
3678  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundary = myViewNet->getAttributeCarriersInBoundary(boundary);
3679  // declare two sets of attribute carriers, one for select and another for unselect
3680  std::vector<GNEAttributeCarrier*> ACToSelect;
3681  std::vector<GNEAttributeCarrier*> ACToUnselect;
3682  // reserve memory (we assume that in the worst case we're going to insert all elements of ACsInBoundary
3683  ACToSelect.reserve(ACsInBoundary.size());
3684  ACToUnselect.reserve(ACsInBoundary.size());
3685  // in restrict AND replace mode all current selected attribute carriers will be unselected
3688  for (auto i : myViewNet->myNet->getSelectedAttributeCarriers()) {
3689  ACToUnselect.push_back(i);
3690  }
3691  }
3692  // iterate over AtributeCarriers obtained of boundary an place it in ACToSelect or ACToUnselect
3693  for (auto i : ACsInBoundary) {
3696  ACToUnselect.push_back(i.second);
3697  break;
3699  if (std::find(ACToUnselect.begin(), ACToUnselect.end(), i.second) != ACToUnselect.end()) {
3700  ACToSelect.push_back(i.second);
3701  }
3702  break;
3703  default:
3704  ACToSelect.push_back(i.second);
3705  break;
3706  }
3707  }
3708  // select junctions and their connections and crossings if Auto select junctions is enabled (note: only for "add mode")
3710  std::vector<GNEEdge*> edgesToSelect;
3711  // iterate over ACToSelect and extract edges
3712  for (auto i : ACToSelect) {
3713  if (i->getTagProperty().getTag() == SUMO_TAG_EDGE) {
3714  edgesToSelect.push_back(dynamic_cast<GNEEdge*>(i));
3715  }
3716  }
3717  // iterate over extracted edges
3718  for (auto i : edgesToSelect) {
3719  // select junction source and all their connections and crossings
3720  ACToSelect.push_back(i->getGNEJunctionSource());
3721  for (auto j : i->getGNEJunctionSource()->getGNEConnections()) {
3722  ACToSelect.push_back(j);
3723  }
3724  for (auto j : i->getGNEJunctionSource()->getGNECrossings()) {
3725  ACToSelect.push_back(j);
3726  }
3727  // select junction destiny and all their connections crossings
3728  ACToSelect.push_back(i->getGNEJunctionDestiny());
3729  for (auto j : i->getGNEJunctionDestiny()->getGNEConnections()) {
3730  ACToSelect.push_back(j);
3731  }
3732  for (auto j : i->getGNEJunctionDestiny()->getGNECrossings()) {
3733  ACToSelect.push_back(j);
3734  }
3735  }
3736  }
3737  // only continue if there is ACs to select or unselect
3738  if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
3739  // first unselect AC of ACToUnselect and then selects AC of ACToSelect
3740  myViewNet->myUndoList->p_begin("selection using rectangle");
3741  for (auto i : ACToUnselect) {
3742  i->setAttribute(GNE_ATTR_SELECTED, "0", myViewNet->myUndoList);
3743  }
3744  for (auto i : ACToSelect) {
3745  if (i->getTagProperty().isSelectable()) {
3746  i->setAttribute(GNE_ATTR_SELECTED, "1", myViewNet->myUndoList);
3747  }
3748  }
3750  }
3751  myViewNet->makeNonCurrent();
3752  }
3753 }
3754 
3755 // ---------------------------------------------------------------------------
3756 // GNEViewNet::TestingMode - methods
3757 // ---------------------------------------------------------------------------
3758 
3760  myViewNet(viewNet),
3761  myTestingEnabled(OptionsCont::getOptions().getBool("gui-testing")),
3762  myTestingWidth(0),
3763  myTestingHeight(0) {
3764 }
3765 
3766 
3767 void
3769  // first check if testing mode is enabled and window size is correct
3770  if (myTestingEnabled && OptionsCont::getOptions().isSet("window-size")) {
3771  std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
3772  // make sure that given windows size has exactly two valid int values
3773  if ((windowSize.size() == 2) && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
3774  myTestingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
3775  myTestingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
3776  } else {
3777  WRITE_ERROR("Invalid windows size-format: " + toString(windowSize) + "for option 'window-size'");
3778  }
3779  }
3780 }
3781 
3782 
3783 void
3785  // first check if testing mode is neabled
3786  if (myTestingEnabled) {
3787  // check if main windows has to be resized
3788  if (myTestingWidth > 0 && ((myViewNet->getWidth() != myTestingWidth) || (myViewNet->getHeight() != myTestingHeight))) {
3789  // only resize once to avoid flickering
3790  //std::cout << " before resize: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
3791  mainWindow->resize(myTestingWidth + myTestingWidth - myViewNet->getWidth(), myTestingHeight + myTestingHeight - myViewNet->getHeight());
3792  //std::cout << " directly after resize: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
3793  myTestingWidth = 0;
3794  }
3795  //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
3796  // draw pink square in the upper left corner on top of everything
3797  glPushMatrix();
3798  const double size = myViewNet->p2m(32);
3799  Position center = myViewNet->screenPos2NetPos(8, 8);
3801  glTranslated(center.x(), center.y(), GLO_MAX - 1);
3802  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
3803  glBegin(GL_QUADS);
3804  glVertex2d(0, 0);
3805  glVertex2d(0, -size);
3806  glVertex2d(size, -size);
3807  glVertex2d(size, 0);
3808  glEnd();
3809  glPopMatrix();
3810  glPushMatrix();
3811  // show box with the current position relative to pink square
3812  Position posRelative = myViewNet->screenPos2NetPos(myViewNet->getWidth() - 40, myViewNet->getHeight() - 20);
3813  // adjust cursor position (24,25) to show exactly the same position as in function netedit.leftClick(match, X, Y)
3815  glPopMatrix();
3816  }
3817 }
3818 
3819 // ---------------------------------------------------------------------------
3820 // GNEViewNet::CreateEdgeOptions - methods
3821 // ---------------------------------------------------------------------------
3822 
3824  createEdgeSource(nullptr),
3825  myViewNet(viewNet) {
3826 }
3827 
3828 
3829 void
3831  chainCreateEdge = new FXMenuCheck(myViewNet->myToolbar, ("Chain\t\tCreate consecutive " + toString(SUMO_TAG_EDGE) + "s with a single click (hit ESC to cancel chain).").c_str(), myViewNet, 0);
3832  chainCreateEdge->setCheck(false);
3833 
3834  autoCreateOppositeEdge = new FXMenuCheck(myViewNet->myToolbar, ("Two-way\t\tAutomatically create an " + toString(SUMO_TAG_EDGE) + " in the opposite direction").c_str(), myViewNet, 0);
3835  autoCreateOppositeEdge->setCheck(false);
3836 
3837  menuCheckWarnAboutMerge = new FXMenuCheck(myViewNet->myToolbar, ("Ask for merge\t\tAsk for confirmation before merging " + toString(SUMO_TAG_JUNCTION) + ".").c_str(), myViewNet, 0);
3838  menuCheckWarnAboutMerge->setCheck(true);
3839 
3840  menuCheckShowBubbleOverJunction = new FXMenuCheck(myViewNet->myToolbar, ("Bubbles\t\tShow bubbles over " + toString(SUMO_TAG_JUNCTION) + "'s shapes.").c_str(), myViewNet, MID_GNE_VIEWNET_SHOW_BUBBLES);
3841  menuCheckShowBubbleOverJunction->setCheck(false);
3842 
3843  menuCheckMoveElevation = new FXMenuCheck(myViewNet->myToolbar, "Elevation\t\tApply mouse movement to elevation instead of x,y position", myViewNet, MID_GNE_VIEWNET_MOVE_ELEVATION);
3844  menuCheckMoveElevation->setCheck(false);
3845 }
3846 
3847 
3848 void
3850  chainCreateEdge->hide();
3851  autoCreateOppositeEdge->hide();
3852  menuCheckWarnAboutMerge->hide();
3854  menuCheckMoveElevation->hide();
3855 }
3856 
3857 // ---------------------------------------------------------------------------
3858 // GNEViewNet::ViewOptions - methods
3859 // ---------------------------------------------------------------------------
3860 
3862  myViewNet(viewNet) {
3863 }
3864 
3865 
3866 void
3868  menuCheckSelectEdges = new FXMenuCheck(myViewNet->myToolbar, ("Select edges\t\tToggle whether clicking should select " + toString(SUMO_TAG_EDGE) + "s or " + toString(SUMO_TAG_LANE) + "s").c_str(), myViewNet, MID_GNE_VIEWNET_SELECT_EDGES);
3869  menuCheckSelectEdges->setCheck(true);
3870 
3871  menuCheckShowConnections = new FXMenuCheck(myViewNet->myToolbar, ("Show " + toString(SUMO_TAG_CONNECTION) + "s\t\tToggle show " + toString(SUMO_TAG_CONNECTION) + "s over " + toString(SUMO_TAG_JUNCTION) + "s").c_str(), myViewNet, MID_GNE_VIEWNET_SHOW_CONNECTIONS);
3873 
3874  menuCheckHideConnections = new FXMenuCheck(myViewNet->myToolbar, "Hide connections\t\tHide connections", myViewNet, 0);
3875  menuCheckHideConnections->setCheck(false);
3876 
3877  menuCheckExtendSelection = new FXMenuCheck(myViewNet->myToolbar, ("Auto-select " + toString(SUMO_TAG_JUNCTION) + "s\t\tToggle whether selecting multiple " + toString(SUMO_TAG_EDGE) + "s should automatically select their " + toString(SUMO_TAG_JUNCTION) + "s").c_str(), myViewNet, 0);
3878  menuCheckExtendSelection->setCheck(false);
3879 
3880  menuCheckChangeAllPhases = new FXMenuCheck(myViewNet->myToolbar, ("Apply change to all phases\t\tToggle whether clicking should apply state changes to all phases of the current " + toString(SUMO_TAG_TRAFFIC_LIGHT) + " plan").c_str(), myViewNet, 0);
3881  menuCheckChangeAllPhases->setCheck(false);
3882 
3883  menuCheckShowGrid = new FXMenuCheck(myViewNet->myToolbar, "Grid\t\tshow grid and restrict movement to the grid (size defined in visualization options)", myViewNet, MID_GNE_VIEWNET_SHOW_GRID);
3884  menuCheckShowGrid->setCheck(false);
3885 }
3886 
3887 void
3889  menuCheckSelectEdges->hide();
3890  menuCheckShowConnections->hide();
3891  menuCheckHideConnections->hide();
3892  menuCheckExtendSelection->hide();
3893  menuCheckChangeAllPhases->hide();
3894  menuCheckShowGrid->hide();
3895 }
3896 
3897 bool
3899  if(menuCheckSelectEdges->shown()) {
3900  return (menuCheckSelectEdges->getCheck() == TRUE);
3901  } else {
3902  // by default, if menuCheckSelectEdges isn't shown, always select edges
3903  return true;
3904  }
3905 }
3906 
3907 
3908 bool
3910  return (menuCheckShowConnections->getCheck() == TRUE);
3911 }
3912 
3913 // ---------------------------------------------------------------------------
3914 // Private methods
3915 // ---------------------------------------------------------------------------
3916 
3917 void
3920  // draw first point
3922  // Push draw matrix
3923  glPushMatrix();
3924  // obtain first clicked point
3925  const Position &firstLanePoint = myViewParent->getAdditionalFrame()->getConsecutiveLaneSelector()->getSelectedLanes().front().first->getShape().positionAtOffset(
3927  // must draw on top of other connections
3928  glTranslated(firstLanePoint.x(), firstLanePoint.y(), GLO_JUNCTION + 0.3);
3930  // draw first point
3931  GLHelper::drawFilledCircle((double) 1.3, 8);
3932  GLHelper::drawText("S", Position(), .1, 1.3, RGBColor::CYAN);
3933  // pop draw matrix
3934  glPopMatrix();
3935  }
3936  // draw connections between lanes
3938  // iterate over all current selected lanes
3939  for (int i = 0; i < (int)myViewParent->getAdditionalFrame()->getConsecutiveLaneSelector()->getSelectedLanes().size() - 1; i++) {
3940  // declare position vector for shape
3941  PositionVector shape;
3942  // declare vectors for shape rotation and lenghts
3943  std::vector<double> shapeRotations, shapeLengths;
3944  // obtain GNELanes
3947  // Push draw matrix
3948  glPushMatrix();
3949  // must draw on top of other connections
3950  glTranslated(0, 0, GLO_JUNCTION + 0.2);
3951  // obtain connection shape
3952  shape = from->getParentEdge().getNBEdge()->getConnection(from->getIndex(), to->getParentEdge().getNBEdge(), to->getIndex()).shape;
3953  // set special color
3955  // Obtain lengths and shape rotations
3956  int segments = (int) shape.size() - 1;
3957  if (segments >= 0) {
3958  shapeRotations.reserve(segments);
3959  shapeLengths.reserve(segments);
3960  for (int j = 0; j < segments; j++) {
3961  const Position& f = shape[j];
3962  const Position& s = shape[j + 1];
3963  shapeLengths.push_back(f.distanceTo2D(s));
3964  shapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double)M_PI);
3965  }
3966  }
3967  // draw a list of lines
3968  GLHelper::drawBoxLines(shape, shapeRotations, shapeLengths, 0.2);
3969  // pop draw matrix
3970  glPopMatrix();
3971  }
3972  // draw last point
3973  glPushMatrix();
3974  // obtain last clicked point
3975  const Position &lastLanePoint = myViewParent->getAdditionalFrame()->getConsecutiveLaneSelector()->getSelectedLanes().back().first->getShape().positionAtOffset(
3977  // must draw on top of other connections
3978  glTranslated(lastLanePoint.x(), lastLanePoint.y(), GLO_JUNCTION + 0.3);
3980  // draw last point
3981  GLHelper::drawFilledCircle((double) 1.3, 8);
3982  GLHelper::drawText("E", Position(), .1, 1.3, RGBColor::CYAN);
3983  // pop draw matrix
3984  glPopMatrix();
3985  }
3986 
3987  }
3988 }
3989 
3990 
3991 void
3993  PositionVector temporalShape;
3994  bool deleteLastCreatedPoint = false;
3995  // obtain temporal shape and delete last created point flag
4001  deleteLastCreatedPoint = myViewParent->getTAZFrame()->getDrawingShapeModul()->getDeleteLastCreatedPoint();
4002  }
4003  // check if we're in drawing mode
4004  if(temporalShape.size() > 0) {
4005  // draw blue line with the current drawed shape
4006  glPushMatrix();
4007  glLineWidth(2);
4009  GLHelper::drawLine(temporalShape);
4010  glPopMatrix();
4011  // draw red line from the last point of shape to the current mouse position
4012  glPushMatrix();
4013  glLineWidth(2);
4014  // draw last line depending if shift key (delete last created point) is pressed
4015  if (deleteLastCreatedPoint) {
4017  } else {
4019  }
4021  glPopMatrix();
4022  }
4023 }
4024 
4025 /****************************************************************************/
Locate junction - button.
Definition: GUIAppEnum.h:172
void setViewNet(GNEViewNet *viewNet)
Set the viewNet to be notified of network changes.
Definition: GNENet.cpp:881
DeleteOptions * getDeleteOptions() const
get delete options
void startEditCustomShape(GNENetElement *element, const PositionVector &shape, bool fill)
start edit custom shape
Definition: GNEViewNet.cpp:787
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
Definition: GNENet.cpp:656
remove inner geometry
Definition: GUIAppEnum.h:704
long onCmdResetEdgeEndpoint(FXObject *, FXSelector, void *)
change geometry endpoint
GNEViewParent * myViewParent
view parent
Definition: GNEViewNet.h:817
virtual void openAdditionalDialog()
open Additional Dialog
FXMenuCheck * getMenuCheckShowGrid() const
get grid button
void paintGLGrid()
paints a grid
bool addRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, int index, GNEUndoList *undoList)
add restricted lane to edge
Definition: GNENet.cpp:623
long onCmdRemoveRestrictedLaneGreenVerge(FXObject *, FXSelector, void *)
remove restricted lane for all vehicles
GNEPoly * polyToMove
the poly of which geometry is being moved
Definition: GNEViewNet.h:577
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1092
GNETAZFrame * getTAZFrame() const
get frame for GNE_MODE_TAZ
long onCmdResetJunctionShape(FXObject *, FXSelector, void *)
reset junction shape
a tl-logic
KeyPressed()
constructor
Definition: GNEViewNet.cpp:453
GNEEdge * edgeToMove
the edge of which geometry is being moved
Definition: GNEViewNet.h:574
static const RGBColor BLUE
Definition: RGBColor.h:186
GNENetElement * getNetElementFront() const
get front net element (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:317
FXDEFMAP(GNEViewNet) GNEViewNetMap[]
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:131
void show()
show prohibition frame
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:1044
Position getPositionInView() const
Return current position.
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_MODE_INSPECT
void openPolygon(bool allowUndo=true)
open polygon
Definition: GNEPoly.cpp:451
std::set< std::pair< std::string, GNEAttributeCarrier * > > getAttributeCarriersInBoundary(const Boundary &boundary, bool forceSelectEdges=false)
get AttributeCarriers in Boundary
Definition: GNEViewNet.cpp:585
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:125
GUICompleteSchemeStorage gSchemeStorage
MovedItems()
constructor
GNETAZ * getTAZ() const
get current TAZ
const std::vector< T > & getSchemes() const
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:900
long onCmdAddRestrictedLaneSidewalk(FXObject *, FXSelector, void *)
Add restricted lane for pedestrians.
long onCmdAddRestrictedLaneBikelane(FXObject *, FXSelector, void *)
Add restricted lane for bikes.
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
double scale
information about a lane&#39;s width (temporary, used for a single view)
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPOI.cpp:174
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
bool selectEdges() const
whether inspection, selection and inversion should apply to edges or to lanes
Definition: GNEViewNet.cpp:733
GNEPOI * getPOIFront() const
get front POI (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:407
void abortOperation(bool clearSelection=true)
abort current edition operation
void deleteSelectedJunctions()
delete all currently selected junctions
class used to group all variables related with key pressed after certain events
Definition: GNEViewNet.h:216
void abortDrawing()
abort drawing
Definition: GNEFrame.cpp:1269
default cursor
Definition: GUICursors.h:36
whether a given shape is user-defined
bool setColorScheme(const std::string &name)
set color scheme
Definition: GNEViewNet.cpp:628
is a pedestrian
a polygon
long onCmdSetModeAdditional(FXObject *, FXSelector, void *)
called when user press the button for additional mode
const RGBColor & getSelectedLaneColor() const
get selected lane color
FXMenuCheck * menuCheckShowBubbleOverJunction
show connection as buuble in "Move" mode.
Definition: GNEViewNet.h:765
mode for moving things
Definition: GNEViewNet.h:48
static FXCursor * getCursor(GUICursor which)
returns a cursor previously defined in the enum GUICursor
bool restrictLane(SUMOVehicleClass vclass)
restrict lane
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPOI.cpp:107
void smoothElevation(GNEUndoList *undoList)
smooth elevation with regard to adjoining edges
Definition: GNEEdge.cpp:1701
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:178
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:104
const KeyPressed & getKeyPressed() const
get Key Pressed modul
GUIGlObjectType
long onCmdDuplicateLane(FXObject *, FXSelector, void *)
duplicate selected lane
begin/end of the description of a junction
long onRightBtnPress(FXObject *, FXSelector, void *)
called when user press mouse&#39;s right button
begin/end of the description of a single lane
bool myAmInitialised
Internal information whether doInit() was called.
mode for editing tls
Definition: GUIAppEnum.h:491
smooth geometry
Definition: GUIAppEnum.h:706
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static void drawTextBox(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &txtColor=RGBColor::BLACK, const RGBColor &bgColor=RGBColor::WHITE, const RGBColor &borderColor=RGBColor::BLACK, const double angle=0, const double relBorder=0.05, const double relMargin=0.5)
draw Text box with given parameters
Definition: GLHelper.cpp:651
long onMouseMove(FXObject *, FXSelector, void *)
called when user moves mouse
GNEViewNet * myViewNet
pointer to viewNet
Definition: GNEViewNet.h:772
Mode for editing connection prohibits.
Definition: GNEViewNet.h:68
SelectingArea(GNEViewNet *viewNet)
default constructor
void markAsCreateEdgeSource()
marks as first junction in createEdge-mode
GNEViewNet()
FOX needs this.
Definition: GNEViewNet.cpp:816
std::vector< GUIGlID > getObjectsInBoundary(Boundary bound)
returns the ids of all objects in the given boundary
void processBoundarySelection(const Boundary &boundary)
Process boundary Selection.
MovedItems myMovedItems
variable use to save pointers to moved elements
Definition: GNEViewNet.h:841
The main window of the Netedit.
SetOperation getModificationMode() const
get current modification mode
bool selectEdges() const
check if select edges checkbox is enabled
long onCmdAddSelected(FXObject *, FXSelector, void *)
select AC under cursor
move cursor
Definition: GUICursors.h:39
long onCmdToogleMoveElevation(FXObject *, FXSelector, void *)
toogle move elevation
SUMORTree * myGrid
The visualization speed-up.
long onCmdSetModeSelect(FXObject *, FXSelector, void *)
called when user press the button for select mode
mode for deleting things
Definition: GUIAppEnum.h:483
GNETAZ * tazToMove
the TAZ element which their Shape is being moved (it&#39;s the only additional with a shape instead a pos...
Definition: GNEViewNet.h:586
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
void hotkeyFocusFrame()
handle focus frame keypress
static const RGBColor WHITE
Definition: RGBColor.h:191
AddShapeResult
enum with all possible values after try to create an shape using frame
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNEEdge.cpp:243
void stopEditCustomShape()
edit edit shape
Definition: GNEViewNet.cpp:803
edit junction shape
Definition: GUIAppEnum.h:752
mode for editing TAZ
Definition: GUIAppEnum.h:497
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
void straightenElevation(GNEUndoList *undoList)
interpolate z values linear between junctions
Definition: GNEEdge.cpp:1606
virtual long onMouseMove(FXObject *, FXSelector, void *)
void buildColorRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, int active, GUIGlObjectType objectType)
recalibrate color scheme according to the current value range
Definition: GNEViewNet.cpp:685
Locate addtional structure - button.
Definition: GUIAppEnum.h:182
mode for deleting things
Definition: GNEViewNet.h:50
Definition: GNEPOI.h:45
void show()
show delete frame
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true)
get a single attribute carrier based on a GLID
Definition: GNENet.cpp:1166
connectio between two lanes
Stores the information about how to visualize structures.
mode for connecting lanes
Definition: GUIAppEnum.h:489
long onCmdSplitEdge(FXObject *, FXSelector, void *)
split edge at cursor position
edit junction shape
Definition: GUIAppEnum.h:734
a connection
void setChecked(bool val)
check or uncheck this MFXCheckableButton
long onCmdToogleSelectEdges(FXObject *, FXSelector, void *)
toogle selet edges
const std::vector< GNEAttributeCarrier * > & getClickedAttributeCarriers() const
get vector with clicked ACs
Definition: GNEViewNet.cpp:427
MFXCheckableButton * myEditModeTAZ
chekable button for edit mode TAZ
Definition: GNEViewNet.h:892
vehicle is a bicycle
void show()
show Frame
long onCmdAddRestrictedLaneBuslane(FXObject *, FXSelector, void *)
Add restricted lane for buses.
const double SUMO_const_laneWidth
Definition: StdDefs.h:51
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNETAZ.cpp:147
reverse an edge
Definition: GUIAppEnum.h:716
split an edge
Definition: GUIAppEnum.h:712
mode for inspecting object attributes
Definition: GUIAppEnum.h:485
GNEViewParent * getViewParent() const
get the net object
double y() const
Returns the y-position.
Definition: Position.h:62
GNETAZ * getTAZFront() const
get front TAZ (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:397
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
interpolate z values linear between junctions
Definition: GUIAppEnum.h:708
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNEPoly.cpp:146
GUIMainWindow * myApp
The application.
MoveSingleElementValues myMoveSingleElementValues
variable used to save variables related with movement of single elements
Definition: GNEViewNet.h:844
split an edge
Definition: GUIAppEnum.h:714
Position snapToActiveGrid(const Position &pos) const
Returns a position that is mapped to the closest grid point if the grid is active.
std::vector< GNEShape * > myShapes
vector with the clicked shape elements (Poly and POIs)
Definition: GNEViewNet.h:179
Position selectionCorner1
firstcorner of the rectangle-selection
Definition: GNEViewNet.h:705
CreateEdgeOptions myCreateEdgeOptions
variable used to save all elements related to creation of Edges
Definition: GNEViewNet.h:838
GNEViewNet * myViewNet
pointer to viewNet
Definition: GNEViewNet.h:728
void setEditMode(EditMode mode)
set edit mode
static void resetTextures()
Reset textures.
void setDeleteLastCreatedPoint(bool value)
enable or disable delete last created point
Definition: GNEFrame.cpp:1309
MoveMultipleElementValues(GNEViewNet *viewNet)
constructor
void moveShapeStart(const Position &oldPos, const Position &offset)
move position of shape start without commiting change
Definition: GNEEdge.cpp:166
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:710
MFXCheckableButton * myEditModeSelect
chekable button for edit mode select
Definition: GNEViewNet.h:877
long onCmdOpenPolygon(FXObject *, FXSelector, void *)
open closed polygon
PositionVector getShape() const
Returns additional element&#39;s shape.
double x() const
Returns the x-position.
Definition: Position.h:57
mode for editing tls
Definition: GNEViewNet.h:58
bool processClick(const Position &clickedPosition, GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
bool isShown() const
return true if modul is shown
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
Definition: GNENet.cpp:742
mode for editing additional
Definition: GUIAppEnum.h:493
bool movingStartPos
bool to indicate that startPos are being moved
Definition: GNEViewNet.h:620
GNEAdditional * getAdditionalAtPopupPosition()
try to retrieve a additional at popup position
void smooth(GNEUndoList *undoList)
make geometry smooth
Definition: GNEEdge.cpp:1689
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
Definition: GLHelper.cpp:611
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
Definition: GNENet.cpp:572
ObjectsUnderCursor myObjectsUnderCursor
variable use to save all pointers to objects under cursor after a click
Definition: GNEViewNet.h:835
static const RGBColor ORANGE
Definition: RGBColor.h:190
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:367
void updateObjectUnderCursor(const std::vector< GUIGlObject *> &GUIGlObjects, GNEPoly *editedPolyShape)
update objects under cursor (Called only in onLeftBtnPress(...) function)
Definition: GNEViewNet.cpp:152
long onCmdAddRestrictedLaneGreenVerge(FXObject *, FXSelector, void *)
Add restricted lane for all vehicles.
MFXCheckableButton * myEditModeMove
chekable button for edit mode move
Definition: GNEViewNet.h:868
T MAX2(T a, T b)
Definition: StdDefs.h:76
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition: GNENet.cpp:540
bool isTLSSaved()
check if modifications in TLS was saved
transform lane to bikelane
Definition: GUIAppEnum.h:789
void beginRectangleSelection()
begin rectangle selection
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction&#39;s connections
Definition: GNENet.cpp:1696
MFXCheckableButton * myEditModeDelete
chekable button for edit mode delete
Definition: GNEViewNet.h:871
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
bool myTestingEnabled
flag to enable or disable testing mode
Definition: GNEViewNet.h:731
GNEEdge * createEdge(GNEJunction *src, GNEJunction *dest, GNEEdge *tpl, GNEUndoList *undoList, const std::string &suggestedName="", bool wasSplit=false, bool allowDuplicateGeom=false, bool recomputeConnections=true)
creates a new edge (unless an edge with the same geometry already exists)
Definition: GNENet.cpp:303
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: SUMOPolygon.h:81
PositionVector shape
The crossing&#39;s shape.
Definition: NBNode.h:133
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
GUIGlID getGlIDFront() const
get front GUI GL ID (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:287
int editMode
the current NETEDIT mode (temporary)
bool stopConsecutiveLaneSelector()
stop selection of consecutive lanes
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:73
long onCmdStraightenEdgesElevation(FXObject *, FXSelector, void *)
interpolate z values linear between junctions
void setEditModeFromHotkey(FXushort selid)
sets edit mode (from hotkey)
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
long onKeyPress(FXObject *o, FXSelector sel, void *data)
called when user press a key
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a Point of interest
void moveShapeEnd(const Position &oldPos, const Position &offset)
move position of shape end without commiting change
Definition: GNEEdge.cpp:182
long onCmdRemoveRestrictedLaneBikelane(FXObject *, FXSelector, void *)
remove restricted lane for bikes
long onCmdRestrictLaneGreenVerge(FXObject *, FXSelector, void *)
restrict lane to all vehicles
void processEdgeSelection(const std::vector< GNEEdge *> &edges)
process selection of edges in view net
CreateEdgeOptions(GNEViewNet *viewNet)
default constructor
int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape&#39;s edge ...
Definition: GNEEdge.cpp:271
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNETAZ.cpp:195
long onCmdEditConnectionShape(FXObject *, FXSelector, void *)
edit connection shape
GNEProhibitionFrame * getProhibitionFrame() const
get frame for GNE_MODE_PROHIBITION
static const RGBColor BLACK
Definition: RGBColor.h:192
const std::string & getID() const
Returns the id.
Definition: Named.h:78
double getHeight() const
Returns the image height of the POI.
void update(void *eventData)
update status of KeyPressed
Definition: GNEViewNet.cpp:459
GNEPoly * getPolyFront() const
get front Poly (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:417
Remove from selected items - Menu Etry.
Definition: GUIAppEnum.h:256
MFXCheckableButton * myEditModeProhibition
checkable button for edit mode polygon
Definition: GNEViewNet.h:898
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
void commitShapeStartChange(const Position &oldPos, GNEUndoList *undoList)
commit position changing in shape start
Definition: GNEEdge.cpp:198
long onCmdRemoveSelected(FXObject *, FXSelector, void *)
unselect AC under cursor
void startGeometryMoving(bool extendToNeighbors=true)
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
long onCmdResetConnections(FXObject *, FXSelector, void *)
reset junction connections
const std::vector< std::pair< GNELane *, double > > & getSelectedLanes() const
get current selected lanes
void updateControls()
update control contents after undo/redo or recompute
EditMode myPreviousEditMode
the previous edit mode before edit junction&#39;s shapes
Definition: GNEViewNet.h:916
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers()
get all selected attribute carriers
Definition: GNENet.cpp:1736
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:344
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:776
void processRectangleSelection()
process rectangle Selection
std::vector< GNETAZ * > myTAZs
vector with the clicked TAZ elements (needed because uses a shape instead a position) ...
Definition: GNEViewNet.h:197
Position originalPositionInView
original position of geometry position (needed for commmit position changes)
Definition: GNEViewNet.h:614
turn junction into geometry node
Definition: GUIAppEnum.h:730
void deleteSelectedShapes()
delete all currently selected shapes
close opened polygon
Definition: GUIAppEnum.h:762
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:33
show junctions as bubbles
Definition: GUIAppEnum.h:521
GNEAdditional * additionalToMove
the additional element which position is being moved
Definition: GNEViewNet.h:583
FXEvent * myEventInfo
information of event
Definition: GNEViewNet.h:232
GNEPolygonFrame * getPolygonFrame() const
get frame for GNE_MODE_POLYGON
void editEndpoint(Position pos, GNEUndoList *undoList)
makes pos the new geometry endpoint at the appropriate end, or remove current existent endpoint ...
Definition: GNEEdge.cpp:633
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
void handleLaneClick(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
virtual void selectAttributeCarrier(bool changeFlag=true)=0
bool isChangesPending() const
return true if there is changes to save
void closePolygon(bool allowUndo=true)
close polygon
Definition: GNEPoly.cpp:473
GUIGlObjectType getGlTypeFront() const
get front GUI GL object type (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:297
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNETAZ.cpp:96
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:241
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:63
bool mergeJunctions(GNEJunction *moved, const Position &oldPos)
try to merge moved junction with another junction in that spot return true if merging did take place ...
GNEViewNet * myViewNet
pointer to viewNet
Definition: GNEViewNet.h:625
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for GNE_MODE_TLS
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:76
OverlappedInspection * getOverlappedInspection() const
get OverlappedInspection modul
double p2m(double pixel) const
pixels-to-meters conversion method
GNEJunction * createEdgeSource
source junction for new edge 0 if no edge source is selected an existing (or newly created) junction ...
Definition: GNEViewNet.h:753
std::map< const GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
bool changeAllPhases() const
change all phases
Definition: GNEViewNet.cpp:775
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
Definition: GNENet.cpp:593
long onCmdSetModeCrossing(FXObject *, FXSelector, void *)
called when user press the button for crossing mode
GNEAdditionalFrame * getAdditionalFrame() const
get frame for GNE_MODE_ADDITIONAL
const std::vector< GNEAttributeCarrier * > & getInspectedACs() const
get current list of inspected ACs
void hideViewOptionsMenuChecks()
hide all options menu checks
SelectingArea mySelectingArea
variable used to save variables related with selecting areas
Definition: GNEViewNet.h:850
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNETAZ.cpp:131
AddShapeResult processClick(const Position &clickedPosition, const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
std::map< GNEJunction *, Position > myMovedJunctionOriginPositions
container used for move junctions
Definition: GNEViewNet.h:657
long onCmdSetModeTAZ(FXObject *, FXSelector, void *)
called when user press the button for TAZ mode
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:1785
GNEEdge * getEdgeFront() const
get front edge (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:357
void hideCreateEdgeOptionMenuChecks()
hide all MenuChecks
void setCreatedJunction(GNEJunction *junction)
set created junction
Definition: GNEViewNet.cpp:277
void buildEditModeControls()
adds controls for setting the edit mode
GUIGlID getObjectAtPosition(Position pos)
returns the id of the object at position using GL_SELECT
remove bikelane
Definition: GUIAppEnum.h:805
GNEUndoList * getUndoList() const
get the undoList object
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:757
long onLeftBtnPress(FXObject *, FXSelector, void *)
Definition: GNEViewNet.cpp:887
long onRightBtnRelease(FXObject *, FXSelector, void *)
called when user releases mouse&#39;s right button
long onCmdSimplifyShape(FXObject *, FXSelector, void *)
simply shape of current polygon
bool isPolygonBlocked() const
return true if polygon is blocked
Definition: GNEPoly.cpp:423
static const RGBColor GREEN
Definition: RGBColor.h:185
mode for editing connection prohibitions
Definition: GUIAppEnum.h:501
void computeNodeShape(double mismatchThreshold)
Compute the junction shape for this node.
Definition: NBNode.cpp:947
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:111
Locate polygons - button.
Definition: GUIAppEnum.h:186
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNEPOI.cpp:127
std::vector< GNEAttributeCarrier * > myAttributeCarriers
vector with the clicked attribute carriers
Definition: GNEViewNet.h:170
bool showLockIcon() const
check if lock icon should be visible
FXMenuCheck * menuCheckExtendSelection
menu check to extend to edge nodes
Definition: GNEViewNet.h:803
virtual long onPaint(FXObject *, FXSelector, void *)
GNEAdditionalFrame::SelectorLaneParents * getConsecutiveLaneSelector() const
getConsecutive Lane Selector
int addColor(const T &color, const double threshold, const std::string &name="")
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items
add bikelane
Definition: GUIAppEnum.h:797
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool addAdditional(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
add additional element
std::string name
The name of this setting.
bool hasCommandGroup() const
Check if undoList has command group.
void stopDrawing()
stop drawing and check if shape can be created
Definition: GNEFrame.cpp:1251
void splitJunction(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by a list of junctions for each unique edge endpoint ...
Definition: GNENet.cpp:1652
void startDrawing()
start drawing
Definition: GNEFrame.cpp:1239
void deleteSelectedConnections()
delete all currently selected connections
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
remove restricted lane
Definition: GNENet.cpp:642
mode for inspecting object attributes
Definition: GNEViewNet.h:52
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
virtual void setStatusBarText(const std::string &)
Definition: GUIMainWindow.h:78
void deleteSelectedCrossings()
delete all currently selected crossings
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:573
GNEPoly * addPolygonForEditShapes(GNENetElement *netElement, const PositionVector &shape, bool fill, RGBColor col)
Builds a special polygon used for edit Junctions&#39;s shapes.
Definition: GNENet.cpp:1980
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button.
DrawingShape * getDrawingShapeModul() const
get drawing mode modul
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:45
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1260
void processClick(void *eventData)
Auxiliar function used by onLeftBtnPress(...)
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
~GNEViewNet()
destructor
Definition: GNEViewNet.cpp:532
GNEEdge * getEdgeAtPopupPosition()
try to retrieve an edge at popup position
void sortGUIGlObjectsByAltitude(const std::vector< GUIGlObject *> &GUIGlObjects)
invert GUIGlObjects
Definition: GNEViewNet.cpp:433
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition: GNENet.cpp:504
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:870
long onCmdRemoveRestrictedLaneSidewalk(FXObject *, FXSelector, void *)
remove restricted lane for pedestrians
bool clickedOverShapeStart(const Position &pos)
Definition: GNEEdge.cpp:146
void commitShapeEndChange(const Position &oldPos, GNEUndoList *undoList)
commit position changing in shape end
Definition: GNEEdge.cpp:211
ViewOptions myViewOptions
variable used to save variables related with view options
Definition: GNEViewNet.h:856
transform lane to busLane
Definition: GUIAppEnum.h:791
long onCmdSetModeMove(FXObject *, FXSelector, void *)
called when user press the button for move mode
FXMenuCheck * menuCheckShowConnections
menu check to show connections
Definition: GNEViewNet.h:797
bool showConnections() const
check if select show connections checkbox is enabled
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
GNEPOI * getPOIAtPopupPosition()
try to retrieve a POILane at popup position
A list of positions.
long onCmdReplaceJunction(FXObject *, FXSelector, void *)
replace node by geometry
long onCmdClearConnections(FXObject *, FXSelector, void *)
clear junction connections
long onCmdRestrictLaneBuslane(FXObject *, FXSelector, void *)
restrict lane to buslanes
FXToolBar * myToolbar
a reference to the toolbar in myParent
Definition: GNEViewNet.h:860
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
FXComboBox & getColoringSchemesCombo()
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:529
long onCmdToogleShowConnection(FXObject *, FXSelector, void *)
toogle show connections
KeyPressed myKeyPressed
variable used to save key status after certain events
Definition: GNEViewNet.h:832
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
void drawTemporalDrawShape() const
draw temporal polygon shape in Polygon Mode
int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape&#39;s edge ...
Definition: GNETAZ.cpp:174
MFXCheckableButton * myEditModeCreateEdge
Definition: GNEViewNet.h:865
GNEEdge * getOppositeEdge() const
get opposite edge
Definition: GNEEdge.cpp:470
FXMenuCheck * menuCheckShowGrid
show grid button
Definition: GNEViewNet.h:809
DrawingShape * getDrawingShapeModul() const
get drawing mode editor
bool isMovementBlocked() const
return true if movement is blocked
Definition: GNEShape.cpp:55
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:83
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPOI.cpp:223
reset junction shape
Definition: GUIAppEnum.h:736
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
GNEViewNet * myViewNet
pointer to viewNet
Definition: GNEViewNet.h:711
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
Definition: GNENet.cpp:219
GUIVisualizationSettings & get(const std::string &name)
Returns the named scheme.
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
registers completed movement with the undoList
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:464
long onCmdSaveChanges(FXObject *, FXSelector, void *)
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
RGBColor selectionColor
NETEDIT special colors.
bool showJunctionAsBubbles() const
return true if junction must be showed as bubbles
Definition: GNEViewNet.cpp:781
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
bool removeRestrictedLane(SUMOVehicleClass vclass)
remove restricted lane
void setDottedAC(const GNEAttributeCarrier *AC)
set attributeCarrier under cursor
long onCmdSplitEdgeBidi(FXObject *, FXSelector, void *)
split edge at cursor position
bool autoSelectNodes()
whether to autoselect nodes or to lanes
Definition: GNEViewNet.cpp:763
long onCmdSetModeProhibition(FXObject *, FXSelector, void *)
called when user press the button for polygon mode
static const RGBColor MAGENTA
Definition: RGBColor.h:189
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
bool startDrawing
whether we have started rectangle-selection
Definition: GNEViewNet.h:698
T MIN2(T a, T b)
Definition: StdDefs.h:70
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:119
Definition: GNETAZ.h:35
MFXCheckableButton * myEditModeTrafficLight
chekable button for edit mode traffic light
Definition: GNEViewNet.h:883
bool controlKeyPressed() const
check if CONTROL key was pressed during click
Definition: GNEViewNet.cpp:475
void initGNEConnections()
initialize GNEConnections
Definition: GNENet.cpp:2418
virtual bool onRightBtnRelease(void *data)
called when user releases right button
turn junction into multiple junctions
Definition: GUIAppEnum.h:732
FXMenuCheck * chainCreateEdge
whether the endpoint for a created edge should be set as the new source
Definition: GNEViewNet.h:756
mode for selecting objects
Definition: GNEViewNet.h:54
MFXCheckableButton * myEditModeAdditional
chekable button for edit mode additional
Definition: GNEViewNet.h:886
void updateCursor()
update cursor after every click/key press/release
void startGeometryMoving()
Definition: GNEEdge.cpp:224
edge: the shape in xml-definition
const PositionVector & getTemporalShape() const
get Temporal shape
Definition: GNEFrame.cpp:1297
std::vector< GNEEdge * > myEdges
vector with the clicked edges
Definition: GNEViewNet.h:185
void openObjectDialog()
Definition: GNEViewNet.cpp:644
void createCrossingHotkey()
create crossing (used when user press ENTER key in Crossing mode)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
Locate edge - button.
Definition: GUIAppEnum.h:174
bool processClick(const Position &clickedPosition, const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
GUIColorer junctionColorer
The junction colorer.
bool myMovingSelection
flag to check if a selection is being moved
Definition: GNEViewNet.h:654
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
Definition: GNENet.cpp:555
TestingMode(GNEViewNet *viewNet)
default constructor
mode for creating polygons
Definition: GUIAppEnum.h:499
const std::string getID() const
function to support debugging
remove busLane
Definition: GUIAppEnum.h:807
void unMarkAsCreateEdgeSource()
removes mark as first junction in createEdge-mode
move elevation instead of x,y
Definition: GUIAppEnum.h:523
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNEPoly.cpp:386
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:270
Position screenPos2NetPos(int x, int y) const
Translate screen position to network position.
void moveRectangleSelection()
move rectangle selection
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:248
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:1689
bool clickedOverShapeEnd(const Position &pos)
return true if user clicked over ShapeEnd
Definition: GNEEdge.cpp:156
long onCmdEditEdgeEndpoint(FXObject *, FXSelector, void *)
change geometry endpoint
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
Definition: GNENet.cpp:292
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag, bool onlySelected=false)
return shape by type shapes
Definition: GNENet.cpp:1105
FXMenuCheck * menuCheckWarnAboutMerge
whether we should warn about merging junctions
Definition: GNEViewNet.h:762
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:458
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any prohibition modifications.
void p_abort()
reverts and discards ALL active command groups
Definition: GNEUndoList.cpp:94
std::vector< GNELane * > myLanes
vector with the clicked lanes
Definition: GNEViewNet.h:188
GUIPerspectiveChanger * myChanger
The perspective changer.
GNECrossing * getCrossingFront() const
get front crossing (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:377
long onCmdResetLaneCustomShape(FXObject *, FXSelector, void *)
reset custom shapes of selected lanes
void buildCreateEdgeOptionMenuChecks()
build menu checks
bool myUseToolTips
use tool tips
GNEConnection * getConnectionAtPopupPosition()
try to retrieve a connection at popup position
virtual void onLeftBtnPress(void *data)
mouse functions
mode for editing crossing
Definition: GUIAppEnum.h:495
Position relativeClickedPosition
relative position of Clicked Position regarding to originalGeometryPointPosition (Used when user does...
Definition: GNEViewNet.h:617
EditMode
Definition: GNEViewNet.h:42
GUIGLObjectPopupMenu * myPopup
The current popup-menu.
Mode for editing TAZ.
Definition: GNEViewNet.h:64
std::vector< GNEJunction * > myJunctions
vector with the clicked junctions
Definition: GNEViewNet.h:182
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
void finishMoveSelection()
finish moving selection
MoveSingleElementValues(GNEViewNet *viewNet)
constructor
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:90
std::vector< GNEEdge * > processEdgeRectangleSelection()
process rectangle Selection (only limited to Edges)
void destroyPopup()
destoys the popup
double getWidth() const
Returns the image width of the POI.
void doInit()
called after some features are already initialized
Definition: GNEViewNet.cpp:536
add busLane
Definition: GUIAppEnum.h:799
begin/end of the description of an edge
FXint myWindowCursorPositionX
Position of the cursor relative to the window.
GNEAdditional * getAdditionalFront() const
get front additional element (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:327
struct used to group all variables related with movement of single elements
Definition: GNEViewNet.h:590
long onCmdSplitJunction(FXObject *, FXSelector, void *)
split junction into multiple junctions
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool overlappedInspectionShown() const
check if overlappedInspection modul is shown
void setSelectionScaling(double selectionScale)
set selection scaling
Definition: GNEViewNet.cpp:769
EditMode getCurrentEditMode() const
get the current edit mode
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1979
MFXCheckableButton * myEditModeInspect
chekable button for edit mode inspect
Definition: GNEViewNet.h:874
long onCmdClosePolygon(FXObject *, FXSelector, void *)
close opened polygon
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:622
bool isDrawing() const
return true if currently a shape is drawed
Definition: GNEFrame.cpp:1303
void finishRectangleSelection()
finish rectangle selection
transform lane to sidewalk
Definition: GUIAppEnum.h:787
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
Definition: GNENet.cpp:1607
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
unsigned int GUIGlID
Definition: GUIGlObject.h:43
void duplicateLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
duplicates lane
Definition: GNENet.cpp:581
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:247
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
called when user release a key
FXbool makeCurrent()
A reimplementation due to some internal reasons.
std::vector< GNEPOI * > myPOIs
vector with the clicked POIs
Definition: GNEViewNet.h:200
long onCmdRemoveRestrictedLaneBuslane(FXObject *, FXSelector, void *)
remove restricted lane for bus
void setTAZ(GNETAZ *editedTAZ)
set current TAZ
reserved GLO type to pack all additionals
Connection getConnection(int fromLane, const NBEdge *to, int toLane) const
Returns the specified connection This method goes through "myConnections" and returns the specified o...
Definition: NBEdge.cpp:1129
virtual long onLeftBtnRelease(FXObject *, FXSelector, void *)
vehicle is a bus
GNEJunction * getJunctionAtPopupPosition()
try to retrieve a junction at popup position
ModificationMode * getModificationModeModul() const
get modification mode modul
change default geometry endpoints
Definition: GUIAppEnum.h:700
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNEEdge.cpp:315
long onCmdSmoothEdgesElevation(FXObject *, FXSelector, void *)
smooth elevation with regard to adjoining edges
GNECrossing * retrieveCrossing(const std::string &id, bool failHard=true) const
get Crossing by id
Definition: GNENet.cpp:995
static const RGBColor YELLOW
Definition: RGBColor.h:187
PositionVector originalShapeBeforeMoving
original shape of element before start moving (used by polygons, edges, etc., needed for commmit posi...
Definition: GNEViewNet.h:608
bool checkSavedPosition(const Position &clickedPosition) const
check if given position is near to saved position
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNEPoly.cpp:95
Mode for editing Polygons.
Definition: GNEViewNet.h:66
static const RGBColor RED
named colors
Definition: RGBColor.h:184
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:669
reset junction&#39;s connections
Definition: GUIAppEnum.h:728
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
double selectionScale
the current selection scaling in NETEDIT (temporary)
double m2p(double meter) const
meter-to-pixels conversion method
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:617
#define GUIDesignButtonToolbarCheckable
little checkable button with icon placed in navigation toolbar
Definition: GUIDesigns.h:89
virtual void show()
show Frame
Definition: GNEFrame.cpp:1695
Locate TLS - button.
Definition: GUIAppEnum.h:180
static const RGBColor CYAN
Definition: RGBColor.h:188
Set a vertex of polygon as first verte.
Definition: GUIAppEnum.h:766
GUIGlObject * getNetObject() const
Returns the network object.
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
Definition: GNENet.cpp:407
bool addSelectedLane(GNELane *lane, const Position &clickedPosition)
return true if lane can be selected as consecutive lane
void handleProhibitionClick(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
handle prohibitions and set the relative colouring
GUIVisualizationSettings * myVisualizationSettings
visualization settings
Position calculateOffsetMovement() const
calculate offset movement
void simplifyShape(bool allowUndo=true)
replace the current shape with a rectangle
Definition: GNEPoly.cpp:537
MoveMultipleElementValues myMoveMultipleElementValues
variable used to save variables related with movement of multiple elements
Definition: GNEViewNet.h:847
long onCmdDeleteGeometryPoint(FXObject *, FXSelector, void *)
delete the closes geometry point
void show()
show Frame
mode for adding edges
Definition: GUIAppEnum.h:479
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1031
void calculateEdgeValues()
calculate Edge movement values (Position, Index, etc.)
PositionVector customShape
optional customShape for this crossing
Definition: NBNode.h:147
#define M_PI
Definition: odrSpiral.cpp:40
Position myPopupPosition
The current popup-menu position.
bool selectingUsingRectangle
whether we have started rectangle-selection
Definition: GNEViewNet.h:695
GNEViewNet * myViewNet
pointer to viewNet
Definition: GNEViewNet.h:813
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false) const
return all additionals
Definition: GNENet.cpp:1797
GNEConnectorFrame * getConnectorFrame() const
get frame for GNE_MODE_CONNECT
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
bool contains(const std::string &name) const
Returns the information whether a setting with the given name is stored.
bool editingElevation() const
return true if elevation is being edited
Definition: GNEViewNet.cpp:739
void show()
show Frame
add reverse edge
Definition: GUIAppEnum.h:718
MFXCheckableButton * myEditModeConnection
chekable button for edit mode connection
Definition: GNEViewNet.h:880
bool showConnections()
show connections over junctions
Definition: GNEViewNet.cpp:749
GNEViewNet * myViewNet
pointer to viewNet
Definition: GNEViewNet.h:648
bool deleteOnlyGeometryPoints() const
check if only delete geometry points checkbox is enabled
virtual void commitGeometryMoving(GNEUndoList *undoList)=0
commit geometry changes in the attributes of an element after use of moveGeometry(...)
const std::string & getTagStr() const
get tag assigned to this object in string format
long onCmdOK(FXObject *, FXSelector, void *)
long onCmdReverseEdge(FXObject *, FXSelector, void *)
reverse edge
simplify polygon geometry
Definition: GUIAppEnum.h:760
GNEPOI * poiToMove
the poi which position is being moved
Definition: GNEViewNet.h:580
mode for moving things
Definition: GUIAppEnum.h:481
long onCmdSetModeTLS(FXObject *, FXSelector, void *)
called when user press the button for traffic lights mode
void drawTestingElements(GUIMainWindow *mainWindow)
draw testing element
FXMenuCheck * menuCheckChangeAllPhases
menu check to set change all phases
Definition: GNEViewNet.h:806
void drawRectangleSelection(const RGBColor &color) const
draw rectangle selection
int doPaintGL(int mode, const Boundary &bound)
do paintGL
Definition: GNEViewNet.cpp:827
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
element is selected
A storage for options typed value containers)
Definition: OptionsCont.h:92
TemplateEditor * getTemplateEditor() const
get template editor
long onCmdOpenAdditionalDialog(FXObject *, FXSelector, void *)
open additional dialog
The popup menu of a globject.
GNENetElement * getShapeEditedElement() const
retrieve the junction of which the shape is being edited
Definition: GNEPoly.cpp:445
an edge
GNEJunction * junctionToMove
the Junction to be moved.
Definition: GNEViewNet.h:571
TAZSaveChanges * getTAZSaveChangesModul() const
get TAZ Save Changes modul
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:240
std::vector< GNEPoly * > myPolys
vector with the clicked Polys
Definition: GNEViewNet.h:203
duplicate a lane
Definition: GUIAppEnum.h:783
reset default geometry endpoints
Definition: GUIAppEnum.h:702
GNECrossingFrame * getCrossingFrame() const
get frame for GNE_MODE_CROSSING
void computeEverything(GNEApplicationWindow *window, bool force=false, bool volatileOptions=false, std::string additionalPath="", std::string shapePath="")
trigger full netbuild computation param[in] window The window to inform about delay param[in] force W...
Definition: GNENet.cpp:1279
void deleteSelectedAdditionals()
delete all currently selected additionals
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction&#39;s connections
Definition: GNENet.cpp:1684
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
Definition: GNENet.cpp:2431
crossing between edges for pedestrians
bool IsObjectTypeLocked(const GUIGlObjectType type) const
check if an object is locked
std::map< GNEEdge *, PositionVector > myMovedEdgesOriginShape
container used for move entire edges
Definition: GNEViewNet.h:660
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
Definition: GNENet.cpp:362
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
void initTestingMode()
init testing mode
GNECrossing * getCrossingAtPopupPosition()
try to retrieve a crossing at popup position
bool showGrid
Information whether a grid shall be shown.
long onCmdSmoothEdges(FXObject *, FXSelector, void *)
smooth geometry
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:307
void drawDecals()
Draws the stored decals.
The network - empty.
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_MODE_DELETE
void show()
show inspector frame
GNENet * getNet() const
get the net object
std::vector< GNENetElement * > myNetElements
vector with the clicked net elements
Definition: GNEViewNet.h:173
Position selectionCorner2
second corner of the rectangle-selection
Definition: GNEViewNet.h:708
std::vector< GNEAdditional * > myAdditionals
vector with the clicked additional elements
Definition: GNEViewNet.h:176
std::vector< GUIGlObject * > myGUIGlObjects
vector with the clicked GUIGlObjects
Definition: GNEViewNet.h:167
const Position & getPosition() const
Definition: NBNode.h:242
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNEEdge.cpp:353
void updateModeSpecificControls()
updates mode specific controls
GUIGlID getGlID() const
Returns the numerical id of the object.
FXMenuCheck * menuCheckMoveElevation
apply movement to elevation
Definition: GNEViewNet.h:768
MFXCheckableButton * myEditModeCrossing
chekable button for edit mode crossing
Definition: GNEViewNet.h:889
long onCmdEditCrossingShape(FXObject *, FXSelector, void *)
edit crossing shape
void removeAttributeCarrier(GNEAttributeCarrier *ac, bool ignoreOptions=false)
remove attribute carrier (element)
FXMenuCheck * menuCheckHideConnections
menu check to hide connections in connect mode
Definition: GNEViewNet.h:800
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
Definition: GNENet.cpp:755
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:727
bool isSelectingLanes() const
return true if modul is selecting lane
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
void beginMoveSelection(GNEAttributeCarrier *originAC)
begin move selection
void calculateTAZValues()
calculate TAZ movement values (Position, Index, etc.)
void swapLane2Edge()
swap lane to edge
Definition: GNEViewNet.cpp:260
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:234
void buildViewOptionsMenuChecks()
build menu checks
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
void hideAllFrames()
hide all frames
long onCmdSetModeConnect(FXObject *, FXSelector, void *)
called when user press the button for connect mode
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Mode for editing additionals.
Definition: GNEViewNet.h:60
void startConsecutiveLaneSelector(GNELane *lane, const Position &clickedPosition)
start selection of consecutive lanes
void processShapeSelection(const PositionVector &shape)
process shape selection
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
int myTestingWidth
Width of viewNet in testing mode.
Definition: GNEViewNet.h:734
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
Definition: GNEViewNet.cpp:540
edit junction shape
Definition: GUIAppEnum.h:744
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
virtual void moveGeometry(const Position &offset)=0
change the position of the element geometry without saving in undoList
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
Definition: GNECrossing.cpp:91
const GNEAttributeCarrier * myDottedAC
current AttributeCarrier that is drawn using with a dotted contour note: it&#39;s constant because is edi...
Definition: GNEViewNet.h:908
FXMenuCheck * autoCreateOppositeEdge
create auto create opposite edge
Definition: GNEViewNet.h:759
long onCmdSetModePolygon(FXObject *, FXSelector, void *)
called when user press the button for polygon mode
open closed polygon
Definition: GUIAppEnum.h:764
empty max
Mode for editing crossing.
Definition: GNEViewNet.h:62
void unblockObject(GUIGlID id)
Marks an object as unblocked.
GNEShape * getShapeFront() const
get front shape element (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:337
GNEConnection * getConnectionFront() const
get front connection (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:387
long onCmdStraightenEdges(FXObject *, FXSelector, void *)
makes selected edges straight
long onCmdSetModeInspect(FXObject *, FXSelector, void *)
called when user press the button for inspect mode
mode for connecting lanes
Definition: GNEViewNet.h:56
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
mode for creating new edges
Definition: GNEViewNet.h:46
bool getDeleteLastCreatedPoint()
get flag delete last created point
Definition: GNEFrame.cpp:1315
void removePolygonForEditShapes(GNEPoly *polygon)
remove Polygon for edit shapes
Definition: GNENet.cpp:1995
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:228
Position myClickedPosition
original clicked position when moveSelection is called (used for calculate offset during moveSelectio...
Definition: GNEViewNet.h:651
virtual long onRightBtnPress(FXObject *, FXSelector, void *)
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:613
GNEJunction * getJunctionFront() const
get front junction (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:347
long onCmdSetFirstGeometryPoint(FXObject *, FXSelector, void *)
set as first geometry point the closes geometry point
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:79
std::vector< GUIGlObject * > getGUIGlObjectsUnderCursor()
returns the GUIGlObject under the cursor using GL_SELECT (including overlapped objects) ...
std::vector< GNECrossing * > myCrossings
vector with the clicked crossings
Definition: GNEViewNet.h:191
Add to selected items - menu entry.
Definition: GUIAppEnum.h:254
mode for selecting objects
Definition: GUIAppEnum.h:487
const PositionVector & getShape() const
get Position vector calculated in updateGeometry(bool updateGrid)
GUIGlID getObjectUnderCursor()
returns the id of the front object under the cursor using GL_SELECT
GNELane * getLaneAtPopupPosition()
try to retrieve a lane at popup position
long onCmdToogleShowBubbles(FXObject *, FXSelector, void *)
toogle show bubbles
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
Definition: GNENet.cpp:790
void endGeometryMoving()
begin movement (used when user click over additional to start a movement, to avoid problems with prob...
int myTestingHeight
Height of viewNet in testing mode.
Definition: GNEViewNet.h:737
void drawLaneCandidates() const
draw functions
Locate poi - button.
Definition: GUIAppEnum.h:184
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
Definition: GNEViewNet.cpp:465
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:137
long onCmdTransformPOI(FXObject *, FXSelector, void *)
Transform POI to POILane, and viceversa.
void hotkeyDel()
handle del keypress
long onCmdAddReversedEdge(FXObject *, FXSelector, void *)
add reversed edge
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GNEPoly * myEditShapePoly
Definition: GNEViewNet.h:913
bool isMovingSelection() const
check if currently there is element being moved
std::vector< GNEConnection * > myConnections
vector with the clicked connections
Definition: GNEViewNet.h:194
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void closePolygon()
ensures that the last position equals the first
NBNode * getNBNode() const
Return net build node.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEEdge.cpp:971
C++ TraCI client API implementation.
TestingMode myTestingMode
variable used to save variables related with testing mode
Definition: GNEViewNet.h:853
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
Definition: SUMORTree.h:116
std::map< GNEEdge *, MoveSingleElementValues * > myMovedEgdesGeometryPoints
container used for move GeometryPoints of edges
Definition: GNEViewNet.h:663
GNENet * myNet
Pointer to current net. (We are not responsible for deletion)
Definition: GNEViewNet.h:820
void hotkeyEnter()
handle enter keypress
void startGeometryMoving()
long onCmdRestrictLaneBikelane(FXObject *, FXSelector, void *)
restrict lane to bikes
void resetEndpoint(const Position &pos, GNEUndoList *undoList)
restores the endpoint to the junction position at the appropriate end
Definition: GNEEdge.cpp:677
void deleteSelectedLanes()
delete all currently selected lanes
long onCmdEditJunctionShape(FXObject *, FXSelector, void *)
edit junction shape
void calculatePolyValues()
calculate Poly movement values (Position, Index, etc.)
void changeFirstGeometryPoint(int oldIndex, bool allowUndo=true)
change first geometry point
Definition: GNEPoly.cpp:495
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
long onLeftBtnRelease(FXObject *, FXSelector, void *)
called when user releases mouse&#39;s left button
Position getSplitPos(const Position &clickPos)
Definition: GNEEdge.cpp:619
void abortConsecutiveLaneSelector()
abort selection of consecutive lanes
vehicles ignoring classes
void splitEdgesBidi(GNEEdge *edge, GNEEdge *oppositeEdge, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
Definition: GNENet.cpp:730
void requireRecompute()
inform the net about the need for recomputation
Definition: GNENet.cpp:1369
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
long onCmdShowGrid(FXObject *, FXSelector, void *)
toogle show grid
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:97
long onCmdSetModeCreateEdge(FXObject *, FXSelector, void *)
transform lane to greenVerge
Definition: GUIAppEnum.h:793
long onCmdSetModeDelete(FXObject *, FXSelector, void *)
called when user press the button for delete mode
void deleteSelectedEdges()
delete all currently selected edges
int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape&#39;s edge ...
Definition: GNEPoly.cpp:365
clear junction&#39;s connections
Definition: GUIAppEnum.h:726
GNEUndoList * myUndoList
a reference to the undolist maintained in the application
Definition: GNEViewNet.h:903
EditMode myEditMode
the current edit mode
Definition: GNEViewNet.h:823
virtual long onRightBtnRelease(FXObject *, FXSelector, void *)
bool addRestrictedLane(SUMOVehicleClass vclass)
add restricted lane
MFXCheckableButton * myEditModePolygon
chekable button for edit mode polygon
Definition: GNEViewNet.h:895
FXMenuCheck * menuCheckSelectEdges
menu check to select only edges
Definition: GNEViewNet.h:794
reserved GLO type to pack all netElements
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNEPoly.cpp:130
FXPopup * getLocatorPopup()
void endGeometryMoving(bool extendToNeighbors=true)
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
const Position & getPopupPosition() const
get position of current popup
ViewOptions(GNEViewNet *viewNet)
default constructor
GNEFrame * myCurrentFrame
the current frame
Definition: GNEViewNet.h:826
void addCrossing(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
add Crossing element
void setz(double z)
set position z
Definition: Position.h:82
a junction
void removeSelectedAttributeCarriers()
remove selected attribute carriers (element)
long onCmdRestrictLaneSidewalk(FXObject *, FXSelector, void *)
restrict lane to pedestrians
GNEPoly * getPolygonAtPopupPosition()
try to retrieve a polygon at popup position
virtual Position getPositionInView() const =0
Returns position of additional in view.