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 // ===========================================================================
23 #include <config.h>
24 
25 #include <iostream>
26 #include <utility>
27 #include <cmath>
28 #include <limits>
32 #include <utils/common/RGBColor.h>
44 #include <utils/gui/div/GLHelper.h>
46 #include <utils/xml/XMLSubSys.h>
47 #include <netbuild/NBEdge.h>
48 #include <netbuild/NBNode.h>
69 
70 #include "GNEViewNet.h"
71 #include "GNEApplicationWindow.h"
72 #include "GNEViewParent.h"
73 #include "GNENet.h"
74 #include "GNEUndoList.h"
75 
76 
77 // ===========================================================================
78 // FOX callback mapping
79 // ===========================================================================
80 
81 FXDEFMAP(GNEViewNet) GNEViewNetMap[] = {
82  // Modes
84  FXMAPFUNC(SEL_COMMAND, MID_GNE_SETMODE_MOVE, GNEViewNet::onCmdSetModeMove),
89  FXMAPFUNC(SEL_COMMAND, MID_GNE_SETMODE_TLS, GNEViewNet::onCmdSetModeTLS),
94  // Viewnet
99  // select elements
100  FXMAPFUNC(SEL_COMMAND, MID_ADDSELECT, GNEViewNet::onCmdAddSelected),
101  FXMAPFUNC(SEL_COMMAND, MID_REMOVESELECT, GNEViewNet::onCmdRemoveSelected),
102  // Junctions
109  // Connections
111  // Crossings
113  // Edges
114  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SPLIT, GNEViewNet::onCmdSplitEdge),
116  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_REVERSE, GNEViewNet::onCmdReverseEdge),
121  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SMOOTH, GNEViewNet::onCmdSmoothEdges),
124  // Lanes
139  // Additionals
141  // Polygons
143  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_CLOSE, GNEViewNet::onCmdClosePolygon),
144  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_OPEN, GNEViewNet::onCmdOpenPolygon),
147  // POIs
148  FXMAPFUNC(SEL_COMMAND, MID_GNE_POI_TRANSFORM, GNEViewNet::onCmdTransformPOI),
149 };
150 
151 // Object implementation
152 FXIMPLEMENT(GNEViewNet, GUISUMOAbstractView, GNEViewNetMap, ARRAYNUMBER(GNEViewNetMap))
153 
154 // ===========================================================================
155 // member method definitions
156 // ===========================================================================
157 
158 GNEViewNet::GNEViewNet(FXComposite* tmpParent, FXComposite* actualParent, GUIMainWindow& app,
159  GNEViewParent* viewParent, GNENet* net, GNEUndoList* undoList,
160  FXGLVisual* glVis, FXGLCanvas* share, FXToolBar* toolBar) :
161  GUISUMOAbstractView(tmpParent, app, viewParent, net->getVisualisationSpeedUp(), glVis, share),
162  myViewParent(viewParent),
163  myNet(net),
164  myEditMode(GNE_MODE_MOVE),
165  myCurrentFrame(0),
166  myShowConnections(false),
167  mySelectEdges(true),
168  myShiftKeyPressed(false),
169  myCreateEdgeSource(0),
170  myMovingSelection(false),
171  myToolbar(toolBar),
172  myEditModeCreateEdge(0),
173  myEditModeMove(0),
174  myEditModeDelete(0),
175  myEditModeInspect(0),
176  myEditModeSelect(0),
177  myEditModeConnection(0),
178  myEditModeTrafficLight(0),
179  myEditModeAdditional(0),
180  myEditModeCrossing(0),
181  myEditModePolygon(0),
182  myEditModeProhibition(0),
183  myEditModeNames(),
184  myUndoList(undoList),
185  myEditShapePoly(0) {
186  // view must be the final member of actualParent
187  reparent(actualParent);
188 
189  buildEditModeControls();
190  myUndoList->mark();
191  myNet->setViewNet(this);
192 
193  ((GUIDanielPerspectiveChanger*)myChanger)->setDragDelay(100000000); // 100 milliseconds
194 
195  // Reset textures
197 
198  if (myTestingMode.testingEnabled && OptionsCont::getOptions().isSet("window-size")) {
199  std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
200  if (windowSize.size() == 2 && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
201  myTestingMode.testingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
202  myTestingMode.testingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
203  } else {
204  WRITE_ERROR("Invalid windows size-format: " + toString(windowSize) + "for option 'window-size'");
205  }
206  }
207 }
208 
209 
211 
212 
213 void
215 
216 
217 void
219  // build coloring tools
220  {
221  for (auto it_names : gSchemeStorage.getNames()) {
222  cw.getColoringSchemesCombo().appendItem(it_names.c_str());
223  if (it_names == myVisualizationSettings->name) {
224  cw.getColoringSchemesCombo().setCurrentItem(cw.getColoringSchemesCombo().getNumItems() - 1);
225  }
226  }
227  cw.getColoringSchemesCombo().setNumVisible(MAX2(5, (int)gSchemeStorage.getNames().size() + 1));
228  }
229  // for junctions
230  new FXButton(cw.getLocatorPopup(),
231  "\tLocate Junction\tLocate a junction within the network.",
233  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
234  // for edges
235  new FXButton(cw.getLocatorPopup(),
236  "\tLocate Street\tLocate a street within the network.",
238  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
239  // for tls
240  new FXButton(cw.getLocatorPopup(),
241  "\tLocate TLS\tLocate a tls within the network.",
243  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
244  // for additional stuff
245  new FXButton(cw.getLocatorPopup(),
246  "\tLocate Additional\tLocate an additional structure within the network.",
248  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
249  // for pois
250  new FXButton(cw.getLocatorPopup(),
251  "\tLocate PoI\tLocate a PoI within the network.",
253  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
254  // for polygons
255  new FXButton(cw.getLocatorPopup(),
256  "\tLocate Polygon\tLocate a Polygon within the network.",
258  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
259 }
260 
261 
262 void
264  if (AC->isAttributeCarrierSelected()) {
265  new FXMenuCommand(ret, "Remove From Selected", GUIIconSubSys::getIcon(ICON_FLAG_MINUS), this, MID_REMOVESELECT);
266  } else {
267  new FXMenuCommand(ret, "Add To Selected", GUIIconSubSys::getIcon(ICON_FLAG_PLUS), this, MID_ADDSELECT);
268  }
269  new FXMenuSeparator(ret);
270 }
271 
272 
273 bool
274 GNEViewNet::setColorScheme(const std::string& name) {
275  if (!gSchemeStorage.contains(name)) {
276  return false;
277  }
278  if (myVisualizationChanger != 0) {
279  if (myVisualizationChanger->getCurrentScheme() != name) {
281  }
282  }
283  myVisualizationSettings = &gSchemeStorage.get(name.c_str());
284  update();
285  return true;
286 }
287 
288 
289 void
291  assert(!scheme.isFixed());
292  double minValue = std::numeric_limits<double>::infinity();
293  double maxValue = -std::numeric_limits<double>::infinity();
294  // retrieve range
295  if (objectType == GLO_LANE) {
296  // XXX (see #3409) multi-colors are not currently handled. this is a quick hack
297  if (active == 9) {
298  active = 8; // segment height, fall back to start height
299  } else if (active == 11) {
300  active = 10; // segment incline, fall back to total incline
301  }
302  for (GNELane* lane : myNet->retrieveLanes()) {
303  const double val = lane->getColorValue(active);
304  minValue = MIN2(minValue, val);
305  maxValue = MAX2(maxValue, val);
306  }
307  } else if (objectType == GLO_JUNCTION) {
308  if (active == 3) {
309  for (GNEJunction* junction : myNet->retrieveJunctions()) {
310  minValue = MIN2(minValue, junction->getPositionInView().z());
311  maxValue = MAX2(maxValue, junction->getPositionInView().z());
312  }
313  }
314  }
315  if (minValue != std::numeric_limits<double>::infinity()) {
316  scheme.clear();
317  // add new thresholds
318  double range = maxValue - minValue;
319  scheme.addColor(RGBColor::RED, (minValue));
320  scheme.addColor(RGBColor::ORANGE, (minValue + range * 1 / 6.0));
321  scheme.addColor(RGBColor::YELLOW, (minValue + range * 2 / 6.0));
322  scheme.addColor(RGBColor::GREEN, (minValue + range * 3 / 6.0));
323  scheme.addColor(RGBColor::CYAN, (minValue + range * 4 / 6.0));
324  scheme.addColor(RGBColor::BLUE, (minValue + range * 5 / 6.0));
325  scheme.addColor(RGBColor::MAGENTA, (maxValue));
326  }
327 }
328 
329 
330 void
331 GNEViewNet::setStatusBarText(const std::string& text) {
332  myApp->setStatusBarText(text);
333 }
334 
335 
336 bool
338  return mySelectEdges;
339 }
340 
341 
342 bool
344  if (myEditMode == GNE_MODE_CONNECT) {
345  return myMenuCheckHideConnections->getCheck() == 0;
346  } else if (myEditMode == GNE_MODE_PROHIBITION) {
347  return true;
348  } else if (myMenuCheckShowConnections->shown() == false) {
349  return false;
350  } else {
352  }
353 }
354 
355 
356 bool
358  return (myMenuCheckExtendToEdgeNodes->getCheck() != 0);
359 }
360 
361 
362 void
363 GNEViewNet::setSelectionScaling(double selectionScale) {
364  myVisualizationSettings->selectionScale = selectionScale;
365 }
366 
367 
368 bool
370  return (myMenuCheckChangeAllPhases->getCheck() != 0);
371 }
372 
373 
374 bool
376  return (myEditMode == GNE_MODE_MOVE) && (myMenuCheckShowBubbleOverJunction->getCheck());
377 }
378 
379 
380 void
382  if ((myEditShapePoly == nullptr) && (element != nullptr) && (shape.size() > 1)) {
383  // save current edit mode before starting
386  // add special GNEPoly fo edit shapes
387  // color is taken from junction color settings
389  myEditShapePoly = myNet->addPolygonForEditShapes(element, shape, fill, col);
390  // update view net to show the new myEditShapePoly
391  update();
392  }
393 }
394 
395 
396 void
398  // stop edit shape junction deleting myEditShapePoly
399  if (myEditShapePoly != 0) {
401  myEditShapePoly = 0;
402  // restore previous edit mode
405  }
406  }
407 }
408 
409 
410 void
412  // enable moving selection
413  myMovingSelection = true;
414  // obtain Junctions and edges selected
415  std::vector<GNEJunction*> selectedJunctions = myNet->retrieveJunctions(true);
416  std::vector<GNEEdge*> selectedEdges = myNet->retrieveEdges(true);
417  // Junctions are always moved, then save position of current selected junctions (Needed when mouse is released)
418  for (auto i : selectedJunctions) {
419  myOriginPositionOfMovedJunctions[i] = i->getPositionInView();
420  }
421  // make special movement depending of clicked AC
422  if (originAC->getTag() == SUMO_TAG_JUNCTION) {
423  // if clicked element is a junction, move shapes of all selected edges
424  for (auto i : selectedEdges) {
425  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
426  }
427  } else if (originAC->getTag() == SUMO_TAG_EDGE) {
428  // obtain clicked edge
429  GNEEdge* clickedEdge = dynamic_cast<GNEEdge*>(originAC);
430  // if clicked edge has origin and destiny junction selected, move shapes of all selected edges
431  if ((myOriginPositionOfMovedJunctions.count(clickedEdge->getGNEJunctionSource()) > 0 &&
432  myOriginPositionOfMovedJunctions.count(clickedEdge->getGNEJunctionDestiny()) > 0)) {
433  for (auto i : selectedEdges) {
434  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
435  }
436  } else {
437  // declare three groups for dividing edges
438  std::vector<GNEEdge*> noJunctionsSelected;
439  std::vector<GNEEdge*> originJunctionSelected;
440  std::vector<GNEEdge*> destinyJunctionSelected;
441  // divide selected edges into four groups, depending of the selection of their junctions
442  for (auto i : selectedEdges) {
443  bool originSelected = myOriginPositionOfMovedJunctions.count(i->getGNEJunctionSource()) > 0;
444  bool destinySelected = myOriginPositionOfMovedJunctions.count(i->getGNEJunctionDestiny()) > 0;
445  // bot junctions selected
446  if (!originSelected && !destinySelected) {
447  noJunctionsSelected.push_back(i);
448  } else if (originSelected && !destinySelected) {
449  originJunctionSelected.push_back(i);
450  } else if (!originSelected && destinySelected) {
451  destinyJunctionSelected.push_back(i);
452  } else if (!originSelected && !destinySelected) {
453  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
454  }
455  }
456  // saved old position of Edges which both junction isn't noJunctionsSelected
457  for (auto i : noJunctionsSelected) {
458  myOriginShapesMovedPartialShapes[i].originalShape = i->getNBEdge()->getInnerGeometry();
459  }
460  // obtain index shape of clicked edge and move it
461  int index = clickedEdge->getVertexIndex(originPosition);
462  assert(index >= 0);
463  myOriginShapesMovedPartialShapes[clickedEdge].index = index;
464  Position originPositionOnClicked = clickedEdge->getNBEdge()->getInnerGeometry()[index];
465  myOriginShapesMovedPartialShapes[clickedEdge].originalPosition = originPositionOnClicked;
466  // find/create point to move for other edges
467  for (auto i : noJunctionsSelected) {
468  if (i != clickedEdge) {
469  int index = i->getVertexIndex(originPositionOnClicked);
470  myOriginShapesMovedPartialShapes[i].index = index;
471  if (index >= 0) {
472  myOriginShapesMovedPartialShapes[i].originalPosition = i->getNBEdge()->getInnerGeometry()[index];
473  }
474  }
475  }
476  }
477  }
478 }
479 
480 
481 void
483  // move selected junctions
484  for (auto i : myOriginPositionOfMovedJunctions) {
485  i.first->moveGeometry(i.second, offset);
486  }
487 
488  // move entire edge shapes
489  for (auto i : myOriginShapesMovedEntireShapes) {
490  i.first->moveEntireShape(i.second, offset);
491  }
492 
493  // move partial shapes
494  for (auto i : myOriginShapesMovedPartialShapes) {
495  i.first->moveVertexShape(i.second.index, i.second.originalPosition, offset);
496  }
497 }
498 
499 
500 void
502  myUndoList->p_begin("position of selected elements");
503  // commit positions of moved junctions
504  for (auto i : myOriginPositionOfMovedJunctions) {
505  i.first->commitGeometryMoving(i.second, myUndoList);
506  }
507  myOriginPositionOfMovedJunctions.clear();
508 
509  // commit shapes of entired moved edges
510  for (auto i : myOriginShapesMovedEntireShapes) {
511  i.first->commitShapeChange(i.second, myUndoList);
512  }
513  myOriginShapesMovedEntireShapes.clear();
514 
515  //commit shapes of partial moved shapes
516  for (auto i : myOriginShapesMovedPartialShapes) {
517  i.first->commitShapeChange(i.second.originalShape, myUndoList);
518  }
519  myOriginShapesMovedPartialShapes.clear();
520 
521  myUndoList->p_end();
522  myMovingSelection = false;
523 }
524 
525 
526 int
527 GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
528  // init view settings
529  // (uncomment the next line to check select mode)
530  // myVisualizationSettings->drawForSelecting = true;
531  glRenderMode(mode);
532  glMatrixMode(GL_MODELVIEW);
533  glPushMatrix();
534  glDisable(GL_TEXTURE_2D);
535  glDisable(GL_ALPHA_TEST);
536  glEnable(GL_BLEND);
537  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
538  glEnable(GL_DEPTH_TEST);
539 
540  // visualize rectangular selection
542  glPushMatrix();
543  glTranslated(0, 0, GLO_MAX - 1);
545  glLineWidth(2);
546  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
547  glBegin(GL_QUADS);
552  glEnd();
553  glPopMatrix();
554  }
555 
556  // compute lane width
557  double lw = m2p(SUMO_const_laneWidth);
558  // draw decals (if not in grabbing mode)
560  drawDecals();
561  // depending of the visualizationSettings, enable or disable check box show grid
563  myMenuCheckShowGrid->setCheck(true);
564  paintGLGrid();
565  } else {
566  myMenuCheckShowGrid->setCheck(false);
567  }
570  if (myTestingMode.testingWidth > 0 && (getWidth() != myTestingMode.testingWidth || getHeight() != myTestingMode.testingHeight)) {
571  // only resize once to avoid flickering
572  //std::cout << " before resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
574  //std::cout << " directly after resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
576  }
577  //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
578  // draw pink square in the upper left corner on top of everything
579  glPushMatrix();
580  const double size = p2m(32);
581  Position center = screenPos2NetPos(8, 8);
583  glTranslated(center.x(), center.y(), GLO_MAX - 1);
584  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
585  glBegin(GL_QUADS);
586  glVertex2d(0, 0);
587  glVertex2d(0, -size);
588  glVertex2d(size, -size);
589  glVertex2d(size, 0);
590  glEnd();
591  glPopMatrix();
592  // show box with the current position relative to pink square
593  Position posRelative = screenPos2NetPos(getWidth() - 40, getHeight() - 20);
594  // adjust cursor position (24,25) to show exactly the same position as in function netedit.leftClick(match, X, Y)
596  }
597  }
598 
599  // draw temporal shape of polygon during drawing
601  const PositionVector& temporalDrawingShape = myViewParent->getPolygonFrame()->getDrawingMode()->getTemporalShape();
602  // draw blue line with the current drawed shape
603  glPushMatrix();
604  glLineWidth(2);
606  GLHelper::drawLine(temporalDrawingShape);
607  glPopMatrix();
608  // draw red line from the last point of shape to the current mouse position
609  if (temporalDrawingShape.size() > 0) {
610  glPushMatrix();
611  glLineWidth(2);
612  // draw last line depending if shift key (delete last created point) is pressed
615  } else {
617  }
618  GLHelper::drawLine(temporalDrawingShape.back(), snapToActiveGrid(getPositionInformation()));
619  glPopMatrix();
620  }
621  }
622  // draw elements
623  glLineWidth(1);
624  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
625  const float minB[2] = { (float)bound.xmin(), (float)bound.ymin() };
626  const float maxB[2] = { (float)bound.xmax(), (float)bound.ymax() };
628  glEnable(GL_POLYGON_OFFSET_FILL);
629  glEnable(GL_POLYGON_OFFSET_LINE);
631  int hits2 = myGrid->Search(minB, maxB, *myVisualizationSettings);
632 
633  glTranslated(0, 0, GLO_ADDITIONAL);
634  for (auto i : myAdditionallyDrawn) {
635  i.first->drawGLAdditional(this, *myVisualizationSettings);
636  }
637 
638  glPopMatrix();
639  return hits2;
640 }
641 
642 
643 long
644 GNEViewNet::onLeftBtnPress(FXObject*, FXSelector, void* eventData) {
645  FXEvent* evt = (FXEvent*) eventData;
646  setFocus();
647  // interpret object under cursor
648  if (makeCurrent()) {
649  // first update objects under cursor
651  // decide what to do based on mode
652  switch (myEditMode) {
653  case GNE_MODE_CREATE_EDGE: {
654  // make sure that Control key isn't pressed
656  // allow moving when control is held down
657  if (!myUndoList->hasCommandGroup()) {
658  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
659  }
662  }
663  if (myCreateEdgeSource == 0) {
666  update();
667  } else {
669  // may fail to prevent double edges
670  GNEEdge* newEdge = myNet->createEdge(
672  if (newEdge) {
673  // create another edge, if create opposite edge is enabled
674  if (myAutoCreateOppositeEdge->getCheck()) {
676  }
678 
679  if (myUndoList->hasCommandGroup()) {
680  myUndoList->p_end();
681  } else {
682  std::cout << "edge created without an open CommandGroup )-:\n";
683  }
684  if (myChainCreateEdge->getCheck()) {
687  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
688  } else {
689  myCreateEdgeSource = 0;
690  }
691  } else {
692  setStatusBarText("An " + toString(SUMO_TAG_EDGE) + " with the same geometry already exists!");
693  }
694  } else {
695  setStatusBarText("Start- and endpoint for an " + toString(SUMO_TAG_EDGE) + " must be distinct!");
696  }
697  update();
698  }
699  }
700  // process click
701  processClick(evt, eventData);
702  break;
703  }
704  case GNE_MODE_MOVE: {
705  // first obtain moving reference (common for all)
707  // check what type of AC will be moved
709  // set Poly to move
711  // save original shape (needed for commit change)
713  // save clicked position as moving original position
715  // obtain index of vertex to move if shape isn't blocked
716  if ((myMovedItems.polyToMove->isShapeBlocked() == false) && (myMovedItems.polyToMove->isMovementBlocked() == false)) {
717  // check if we want to remove a Geometry Point
718  if (myShiftKeyPressed) {
719  // check if we're clicked over a Geometry Point
723  // after removing Geomtery Point, reset PolyToMove
724  myMovedItems.polyToMove = nullptr;
725  }
726  } else {
727  // obtain index of vertex to move and moving reference
729  }
730  } else {
732  }
733  } else if (myObjectsUnderCursor.poi) {
735  // Save original Position of Element
737  } else if (myObjectsUnderCursor.junction) {
740  } else {
743  }
744  // Save original Position of Element
747  // allways swap lanes to edges in movement mode
750  }
753  } else if (myObjectsUnderCursor.shiftKeyPressed()) {
755  } else {
763  } else {
764  // save original shape (needed for commit change)
766  // obtain index of vertex to move and moving reference
769  // start moving AFTER getvertex Index
771  }
772  }
773  } else if (myObjectsUnderCursor.additional) {
775  myMovingSelection = true;
776  } else {
778  // start geometry moving
780  // Save original Position of Element
782  }
783  } else {
784  // process click
785  processClick(evt, eventData);
786  }
787  update();
788  break;
789  }
790  case GNE_MODE_DELETE: {
792  // change the selected attribute carrier if mySelectEdges is enabled and clicked element is a lane
795  }
796  // check if we are deleting a selection or an single attribute carrier
798  // before delete al selected attribute carriers, check if we clicked over a geometry point
803  } else {
805  }
806  } else {
808  }
809  } else {
810  // process click
811  processClick(evt, eventData);
812  }
813  break;
814  }
815  case GNE_MODE_INSPECT: {
817  // change the selected attribute carrier if mySelectEdges is enabled and clicked element is a lane
820  }
821  // if Control key is Pressed, select instead inspect element
823  // Check if this GLobject type is locked
825  // toogle netElement selection
828  } else {
830  }
831  }
832  } else {
833  // inspect attribute carrier, or multiseletion if AC is selected
835  // focus upper element of inspector frame
837  }
838  }
839  // process click
840  processClick(evt, eventData);
841  update();
842  break;
843  }
844  case GNE_MODE_SELECT:
845  // first check that under cursor there is an attribute carrier and is selectable
847  // change the selected attribute carrier if mySelectEdges is enabled and clicked element is a lane
850  }
851  // Check if this GLobject type is locked
853  // toogle netElement selection
856  } else {
858  }
859  // update selector frame
860  if (myViewParent->getSelectorFrame()->shown()) {
862  }
863  }
864  }
865  // check if a rect for selecting is being created
870  } else {
871  // process click
872  processClick(evt, eventData);
873  }
874  update();
875  break;
876  case GNE_MODE_CONNECT: {
878  // shift key may pass connections, Control key allow conflicts.
880  update();
881  }
882  // process click
883  processClick(evt, eventData);
884  break;
885  }
886  case GNE_MODE_TLS: {
889  update();
890  }
891  // process click
892  processClick(evt, eventData);
893  break;
894  }
895  case GNE_MODE_ADDITIONAL: {
897  // process click or update view depending of the result of "add additional"
899  update();
900  // process click
901  processClick(evt, eventData);
902  }
903  break;
904  }
905  case GNE_MODE_CROSSING: {
906  if (myObjectsUnderCursor.crossing == nullptr) {
908  update();
909  }
910  }
911  // process click
912  processClick(evt, eventData);
913  break;
914  }
915  case GNE_MODE_POLYGON: {
916  if (myObjectsUnderCursor.poi == nullptr) {
918  // view net must be always update
919  update();
920  // process click depending of the result of "process click"
922  // process click
923  processClick(evt, eventData);
924  }
925  }
926  break;
927  }
928  case GNE_MODE_PROHIBITION: {
930  // shift key may pass connections, Control key allow conflicts.
932  update();
933  }
934  // process click
935  processClick(evt, eventData);
936  break;
937  }
938  default: {
939  // process click
940  processClick(evt, eventData);
941  }
942  }
943  makeNonCurrent();
944  }
945  return 1;
946 }
947 
948 
949 long
950 GNEViewNet::onLeftBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
951  GUISUMOAbstractView::onLeftBtnRelease(obj, sel, eventData);
952  if (myMovingSelection) {
954  } else if (myMovedItems.polyToMove) {
957  } else if (myMovedItems.poiToMove) {
960  } else if (myMovedItems.junctionToMove) {
961  // finish Junction movement
963  // position is already up to date but we must register with myUndoList
966  }
968  } else if (myMovedItems.edgeToMove) {
975  } else {
977  }
979  } else if (myMovedItems.additionalToMove) {
984  bool shiftKeyPressed = ((FXEvent*)eventData)->state & SHIFTMASK;
985  mySelectingArea.processSelection(this, shiftKeyPressed);
986  // update selector frame
987  if (myViewParent->getSelectorFrame()->shown()) {
989  }
990  }
991  update();
992  return 1;
993 }
994 
995 
996 long GNEViewNet::onRightBtnPress(FXObject* obj, FXSelector sel, void* eventData) {
997  // disable right button press during drawing polygon
999  return 1;
1000  } else {
1001  return GUISUMOAbstractView::onRightBtnPress(obj, sel, eventData);
1002  }
1003 }
1004 
1005 
1006 long GNEViewNet::onRightBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
1007  // disable right button release during drawing polygon
1009  return 1;
1010  } else {
1011  return GUISUMOAbstractView::onRightBtnRelease(obj, sel, eventData);
1012  }
1013 }
1014 
1015 
1016 long
1017 GNEViewNet::onMouseMove(FXObject* obj, FXSelector sel, void* eventData) {
1018  GUISUMOAbstractView::onMouseMove(obj, sel, eventData);
1019  // update shift key pressed
1020  myShiftKeyPressed = ((FXEvent*)eventData)->state & SHIFTMASK;
1021  // change "delete last created point" depending if during movement shift key is pressed
1024  }
1025  // calculate offset of movement depending of showGrid
1026  Position offsetMovement;
1029  if (myMenuCheckMoveElevation->getCheck()) {
1030  const double dist = int((offsetMovement.y() + offsetMovement.x()) / myVisualizationSettings->gridXSize) * myVisualizationSettings->gridXSize;
1031  offsetMovement = Position(0, 0, dist / 10);
1032  }
1033  } else {
1035  if (myMenuCheckMoveElevation->getCheck()) {
1036  offsetMovement = Position(0, 0, (offsetMovement.y() + offsetMovement.x()) / 10);
1037  }
1038  }
1039  // @note #3521: Add checkBox to allow moving elements... has to behere implemented
1040  // check what type of additional is moved
1041  if (myMovingSelection) {
1042  moveSelection(offsetMovement);
1043  } else if (myMovedItems.polyToMove) {
1044  // move shape's geometry without commiting changes
1047  } else {
1049  }
1050  } else if (myMovedItems.poiToMove) {
1051  // Move POI's geometry without commiting changes
1053  } else if (myMovedItems.junctionToMove) {
1054  // Move Junction's geometry without commiting changes
1056  } else if (myMovedItems.edgeToMove) {
1061  } else {
1062  // move edge's geometry without commiting changes
1064  }
1066  // Move Additional geometry without commiting changes
1071  }
1072  // update view
1073  update();
1074  return 1;
1075 }
1076 
1077 
1078 long
1079 GNEViewNet::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
1080  // update shift key pressed
1081  myShiftKeyPressed = ((FXEvent*)eventData)->state & SHIFTMASK;
1082  // change "delete last created point" depending of shift key
1084  myViewParent->getPolygonFrame()->getDrawingMode()->setDeleteLastCreatedPoint(((FXEvent*)eventData)->state & SHIFTMASK);
1085  }
1086  update();
1087  return GUISUMOAbstractView::onKeyPress(o, sel, eventData);
1088 }
1089 
1090 
1091 long
1092 GNEViewNet::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
1093  // update shift key pressed
1094  myShiftKeyPressed = ((FXEvent*)eventData)->state & SHIFTMASK;
1095  // change "delete last created point" depending of shift key
1098  }
1099  // check if selecting using rectangle has to be disabled
1102  }
1103  update();
1104  return GUISUMOAbstractView::onKeyRelease(o, sel, eventData);
1105 }
1106 
1107 
1108 void
1109 GNEViewNet::abortOperation(bool clearSelection) {
1110  // steal focus from any text fields
1111  setFocus();
1112  if (myCreateEdgeSource != nullptr) {
1113  // remove current created edge source
1115  myCreateEdgeSource = 0;
1116  } else if (myEditMode == GNE_MODE_SELECT) {
1118  // check if current selection has to be cleaned
1119  if (clearSelection) {
1121  }
1122  } else if (myEditMode == GNE_MODE_CONNECT) {
1124  } else if (myEditMode == GNE_MODE_TLS) {
1126  } else if (myEditMode == GNE_MODE_MOVE) {
1128  } else if (myEditMode == GNE_MODE_POLYGON) {
1129  // abort current drawing
1131  } else if (myEditMode == GNE_MODE_PROHIBITION) {
1133  }
1134  myUndoList->p_abort();
1135 }
1136 
1137 
1138 void
1141  setStatusBarText("Cannot delete in this mode");
1142  } else {
1143  myUndoList->p_begin("delete selection");
1151  myUndoList->p_end();
1152  }
1153 }
1154 
1155 
1156 void
1158  if (myEditMode == GNE_MODE_CONNECT) {
1159  myViewParent->getConnectorFrame()->onCmdOK(0, 0, 0);
1160  } else if (myEditMode == GNE_MODE_TLS) {
1161  myViewParent->getTLSEditorFrame()->onCmdOK(0, 0, 0);
1162  } else if ((myEditMode == GNE_MODE_MOVE) && (myEditShapePoly != 0)) {
1163  // save edited junction's shape
1164  if (myEditShapePoly != 0) {
1165  myUndoList->p_begin("custom " + toString(myEditShapePoly->getShapeEditedElement()->getTag()) + " shape");
1168  attr = SUMO_ATTR_CUSTOMSHAPE;
1169  }
1171  myUndoList->p_end();
1173  update();
1174  }
1175  } else if (myEditMode == GNE_MODE_POLYGON) {
1177  // stop current drawing
1179  } else {
1180  // start drawing
1182  }
1183  } else if (myEditMode == GNE_MODE_CROSSING) {
1185  }
1186 }
1187 
1188 
1189 void
1191  // if there is a visible frame, set focus over it. In other case, set focus over ViewNet
1192  if (myCurrentFrame != nullptr) {
1194  } else {
1195  setFocus();
1196  }
1197 }
1198 
1199 
1200 void
1202  switch (selid) {
1205  break;
1206  case MID_GNE_SETMODE_MOVE:
1208  break;
1211  break;
1214  break;
1217  break;
1220  break;
1221  case MID_GNE_SETMODE_TLS:
1223  break;
1226  break;
1229  break;
1232  break;
1235  break;
1236  default:
1237  throw ProcessError("invalid edit mode called by hotkey");
1238  break;
1239  }
1240 }
1241 
1242 
1245  return myViewParent;
1246 }
1247 
1248 
1249 GNENet*
1251  return myNet;
1252 }
1253 
1254 
1255 GNEUndoList*
1257  return myUndoList;
1258 }
1259 
1260 
1261 EditMode
1263  return myEditMode;
1264 }
1265 
1266 
1267 FXMenuCheck*
1269  return myMenuCheckShowGrid;
1270 }
1271 
1272 
1273 const GNEAttributeCarrier*
1275  return myACUnderCursor;
1276 }
1277 
1278 
1279 void
1281  myACUnderCursor = AC;
1282 }
1283 
1284 
1285 bool
1288 }
1289 
1290 
1291 GNEJunction*
1293  GNEJunction* junction = 0;
1294  if (makeCurrent()) {
1298  if (pointed) {
1299  switch (pointed->getType()) {
1300  case GLO_JUNCTION:
1301  junction = (GNEJunction*)pointed;
1302  break;
1303  default:
1304  break;
1305  }
1306  }
1307  }
1308  return junction;
1309 }
1310 
1311 
1314  GNEConnection* connection = 0;
1315  if (makeCurrent()) {
1319  if (pointed) {
1320  switch (pointed->getType()) {
1321  case GLO_CONNECTION:
1322  connection = (GNEConnection*)pointed;
1323  break;
1324  default:
1325  break;
1326  }
1327  }
1328  }
1329  return connection;
1330 }
1331 
1332 
1333 GNECrossing*
1335  GNECrossing* crossing = 0;
1336  if (makeCurrent()) {
1340  if (pointed) {
1341  switch (pointed->getType()) {
1342  case GLO_CROSSING:
1343  crossing = (GNECrossing*)pointed;
1344  break;
1345  default:
1346  break;
1347  }
1348  }
1349  }
1350  return crossing;
1351 }
1352 
1353 GNEEdge*
1355  GNEEdge* edge = 0;
1356  if (makeCurrent()) {
1360  if (pointed) {
1361  switch (pointed->getType()) {
1362  case GLO_EDGE:
1363  edge = (GNEEdge*)pointed;
1364  break;
1365  case GLO_LANE:
1366  edge = &(((GNELane*)pointed)->getParentEdge());
1367  break;
1368  default:
1369  break;
1370  }
1371  }
1372  }
1373  return edge;
1374 }
1375 
1376 
1377 GNELane*
1379  GNELane* lane = 0;
1380  if (makeCurrent()) {
1384  if (pointed) {
1385  if (pointed->getType() == GLO_LANE) {
1386  lane = (GNELane*)pointed;
1387  }
1388  }
1389  }
1390  return lane;
1391 }
1392 
1393 
1394 std::set<GNEEdge*>
1396  std::set<GNEEdge*> result;
1397  if (makeCurrent()) {
1398  const std::vector<GUIGlID> ids = getObjectsAtPosition(getPopupPosition(), 1.0);
1399  for (auto it : ids) {
1402  if (pointed) {
1403  switch (pointed->getType()) {
1404  case GLO_EDGE:
1405  result.insert((GNEEdge*)pointed);
1406  break;
1407  case GLO_LANE:
1408  result.insert(&(((GNELane*)pointed)->getParentEdge()));
1409  break;
1410  default:
1411  break;
1412  }
1413  }
1414  }
1415  }
1416  return result;
1417 }
1418 
1419 
1422  if (makeCurrent()) {
1426  if (pointed) {
1427  return dynamic_cast<GNEAdditional*>(pointed);
1428  }
1429  }
1430  return 0;
1431 }
1432 
1433 
1434 GNEPoly*
1436  if (makeCurrent()) {
1440  if (pointed) {
1441  return dynamic_cast<GNEPoly*>(pointed);
1442  }
1443  }
1444  return 0;
1445 }
1446 
1447 
1448 GNEPOI*
1450  if (makeCurrent()) {
1454  if (pointed) {
1455  return dynamic_cast<GNEPOI*>(pointed);
1456  }
1457  }
1458  return 0;
1459 }
1460 
1461 
1462 long
1463 GNEViewNet::onCmdSetModeCreateEdge(FXObject*, FXSelector, void*) {
1465  return 1;
1466 }
1467 
1468 
1469 long
1470 GNEViewNet::onCmdSetModeMove(FXObject*, FXSelector, void*) {
1472  return 1;
1473 }
1474 
1475 
1476 long
1477 GNEViewNet::onCmdSetModeDelete(FXObject*, FXSelector, void*) {
1479  return 1;
1480 }
1481 
1482 
1483 long
1484 GNEViewNet::onCmdSetModeInspect(FXObject*, FXSelector, void*) {
1486  return 1;
1487 }
1488 
1489 
1490 long
1491 GNEViewNet::onCmdSetModeSelect(FXObject*, FXSelector, void*) {
1493  return 1;
1494 }
1495 
1496 
1497 long
1498 GNEViewNet::onCmdSetModeConnect(FXObject*, FXSelector, void*) {
1500  return 1;
1501 }
1502 
1503 
1504 long
1505 GNEViewNet::onCmdSetModeTLS(FXObject*, FXSelector, void*) {
1507  return 1;
1508 }
1509 
1510 
1511 long
1512 GNEViewNet::onCmdSetModeAdditional(FXObject*, FXSelector, void*) {
1514  return 1;
1515 }
1516 
1517 
1518 long
1519 GNEViewNet::onCmdSetModeCrossing(FXObject*, FXSelector, void*) {
1521  return 1;
1522 }
1523 
1524 
1525 long
1526 GNEViewNet::onCmdSetModePolygon(FXObject*, FXSelector, void*) {
1528  return 1;
1529 }
1530 
1531 long
1532 GNEViewNet::onCmdSetModeProhibition(FXObject*, FXSelector, void*) {
1534  return 1;
1535 }
1536 
1537 long
1538 GNEViewNet::onCmdSplitEdge(FXObject*, FXSelector, void*) {
1539  GNEEdge* edge = getEdgeAtPopupPosition();
1540  if (edge != 0) {
1542  }
1543  return 1;
1544 }
1545 
1546 
1547 long
1548 GNEViewNet::onCmdSplitEdgeBidi(FXObject*, FXSelector, void*) {
1549  std::set<GNEEdge*> edges = getEdgesAtPopupPosition();
1550  if (edges.size() != 0) {
1551  myNet->splitEdgesBidi(edges, (*edges.begin())->getSplitPos(getPopupPosition()), myUndoList);
1552  }
1553  return 1;
1554 }
1555 
1556 
1557 long
1558 GNEViewNet::onCmdReverseEdge(FXObject*, FXSelector, void*) {
1559  GNEEdge* edge = getEdgeAtPopupPosition();
1560  if (edge != 0) {
1561  myNet->reverseEdge(edge, myUndoList);
1562  }
1563  return 1;
1564 }
1565 
1566 
1567 long
1568 GNEViewNet::onCmdAddReversedEdge(FXObject*, FXSelector, void*) {
1569  GNEEdge* edge = getEdgeAtPopupPosition();
1570  if (edge != 0) {
1572  }
1573  return 1;
1574 }
1575 
1576 
1577 long
1578 GNEViewNet::onCmdEditEdgeEndpoint(FXObject*, FXSelector, void*) {
1579  GNEEdge* edge = getEdgeAtPopupPosition();
1580  if (edge != 0) {
1582  }
1583  return 1;
1584 }
1585 
1586 
1587 long
1588 GNEViewNet::onCmdResetEdgeEndpoint(FXObject*, FXSelector, void*) {
1589  GNEEdge* edge = getEdgeAtPopupPosition();
1590  if (edge != 0) {
1592  }
1593  return 1;
1594 }
1595 
1596 
1597 long
1598 GNEViewNet::onCmdStraightenEdges(FXObject*, FXSelector, void*) {
1599  GNEEdge* edge = getEdgeAtPopupPosition();
1600  if (edge != 0) {
1601  if (edge->isAttributeCarrierSelected()) {
1602  myUndoList->p_begin("straighten selected " + toString(SUMO_TAG_EDGE) + "s");
1603  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1604  for (auto it : edges) {
1605  it->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
1606  }
1607  myUndoList->p_end();
1608  } else {
1609  myUndoList->p_begin("straighten " + toString(SUMO_TAG_EDGE));
1611  myUndoList->p_end();
1612  }
1613  }
1614  return 1;
1615 }
1616 
1617 
1618 long
1619 GNEViewNet::onCmdSmoothEdges(FXObject*, FXSelector, void*) {
1620  GNEEdge* edge = getEdgeAtPopupPosition();
1621  if (edge != 0) {
1622  if (edge->isAttributeCarrierSelected()) {
1623  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1624  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1625  for (auto it : edges) {
1626  it->smooth(myUndoList);
1627  }
1628  myUndoList->p_end();
1629  } else {
1630  myUndoList->p_begin("straighten edge elevation");
1631  edge->smooth(myUndoList);
1632  myUndoList->p_end();
1633  }
1634  }
1635  return 1;
1636 }
1637 
1638 
1639 long
1640 GNEViewNet::onCmdStraightenEdgesElevation(FXObject*, FXSelector, void*) {
1641  GNEEdge* edge = getEdgeAtPopupPosition();
1642  if (edge != 0) {
1643  if (edge->isAttributeCarrierSelected()) {
1644  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1645  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1646  for (auto it : edges) {
1647  it->straightenElevation(myUndoList);
1648  }
1649  myUndoList->p_end();
1650  } else {
1651  myUndoList->p_begin("straighten edge elevation");
1653  myUndoList->p_end();
1654  }
1655  }
1656  return 1;
1657 }
1658 
1659 
1660 long
1661 GNEViewNet::onCmdSmoothEdgesElevation(FXObject*, FXSelector, void*) {
1662  GNEEdge* edge = getEdgeAtPopupPosition();
1663  if (edge != 0) {
1664  if (edge->isAttributeCarrierSelected()) {
1665  myUndoList->p_begin("smooth elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1666  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1667  for (auto it : edges) {
1668  it->smoothElevation(myUndoList);
1669  }
1670  myUndoList->p_end();
1671  } else {
1672  myUndoList->p_begin("smooth edge elevation");
1673  edge->smoothElevation(myUndoList);
1674  myUndoList->p_end();
1675  }
1676  }
1677  return 1;
1678 }
1679 
1680 
1681 long
1682 GNEViewNet::onCmdSimplifyShape(FXObject*, FXSelector, void*) {
1683  if (myEditShapePoly != 0) {
1685  update();
1686  } else {
1687  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1688  if (polygonUnderMouse) {
1689  polygonUnderMouse->simplifyShape();
1690  }
1691  }
1692  return 1;
1693 }
1694 
1695 
1696 long
1697 GNEViewNet::onCmdDeleteGeometryPoint(FXObject*, FXSelector, void*) {
1698  if (myEditShapePoly != 0) {
1700  update();
1701  } else {
1702  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1703  if (polygonUnderMouse) {
1704  polygonUnderMouse->deleteGeometryPoint(getPopupPosition());
1705  }
1706  }
1707  return 1;
1708 }
1709 
1710 
1711 long
1712 GNEViewNet::onCmdClosePolygon(FXObject*, FXSelector, void*) {
1713  if (myEditShapePoly != 0) {
1714  myEditShapePoly->closePolygon(false);
1715  update();
1716  } else {
1717  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1718  if (polygonUnderMouse) {
1719  polygonUnderMouse->closePolygon();
1720  }
1721  }
1722  return 1;
1723 }
1724 
1725 
1726 long
1727 GNEViewNet::onCmdOpenPolygon(FXObject*, FXSelector, void*) {
1728  if (myEditShapePoly != 0) {
1729  myEditShapePoly->openPolygon(false);
1730  update();
1731  } else {
1732  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1733  if (polygonUnderMouse) {
1734  polygonUnderMouse->openPolygon();
1735  }
1736  }
1737  return 1;
1738 }
1739 
1740 
1741 long
1742 GNEViewNet::onCmdSetFirstGeometryPoint(FXObject*, FXSelector, void*) {
1743  if (myEditShapePoly != 0) {
1745  update();
1746  } else {
1747  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1748  if (polygonUnderMouse) {
1749  polygonUnderMouse->changeFirstGeometryPoint(polygonUnderMouse->getVertexIndex(getPopupPosition(), false));
1750  }
1751  }
1752  return 1;
1753 }
1754 
1755 
1756 long
1757 GNEViewNet::onCmdTransformPOI(FXObject*, FXSelector, void*) {
1758  // obtain POI at popup position
1760  if (POI) {
1761  // check what type of POI will be transformed
1762  if (POI->getTag() == SUMO_TAG_POI) {
1763  // obtain lanes around POI boundary
1764  std::vector<GUIGlID> GLIDs = getObjectsInBoundary(POI->getCenteringBoundary());
1765  std::vector<GNELane*> lanes;
1766  for (auto i : GLIDs) {
1768  if (lane) {
1769  lanes.push_back(lane);
1770  }
1771  }
1772  if (lanes.empty()) {
1773  WRITE_WARNING("No lanes around " + toString(SUMO_TAG_POI) + " to attach it");
1774  } else {
1775  // obtain nearest lane to POI
1776  GNELane* nearestLane = lanes.front();
1777  double minorPosOverLane = nearestLane->getShape().nearest_offset_to_point2D(POI->getPositionInView());
1778  double minorLateralOffset = nearestLane->getShape().positionAtOffset(minorPosOverLane).distanceTo(POI->getPositionInView());
1779  for (auto i : lanes) {
1780  double posOverLane = i->getShape().nearest_offset_to_point2D(POI->getPositionInView());
1781  double lateralOffset = i->getShape().positionAtOffset(posOverLane).distanceTo(POI->getPositionInView());
1782  if (lateralOffset < minorLateralOffset) {
1783  minorPosOverLane = posOverLane;
1784  minorLateralOffset = lateralOffset;
1785  nearestLane = i;
1786  }
1787  }
1788  // obtain values of POI
1789  std::string id = POI->getID();
1790  std::string type = POI->getShapeType();
1791  RGBColor color = POI->getShapeColor();
1792  Position pos = (*POI);
1793  double layer = POI->getShapeLayer();
1794  double angle = POI->getShapeNaviDegree();
1795  std::string imgFile = POI->getShapeImgFile();
1796  bool relativePath = POI->getShapeRelativePath();
1797  double POIWidth = POI->getWidth(); // double width -> C4458
1798  double POIHeight = POI->getHeight(); // double height -> C4458
1799  // remove POI
1800  myUndoList->p_begin("attach POI into " + toString(SUMO_TAG_LANE));
1801  myNet->deleteShape(POI, myUndoList);
1802  // add POILane
1803  myNet->addPOI(id, type, color, pos, false, nearestLane->getID(), minorPosOverLane, 0, layer, angle, imgFile, relativePath, POIWidth, POIHeight);
1804  myUndoList->p_end();
1805  }
1806  } else {
1807  // obtain values of POILane
1808  std::string id = POI->getID();
1809  std::string type = POI->getShapeType();
1810  RGBColor color = POI->getShapeColor();
1811  Position pos = (*POI);
1812  double layer = POI->getShapeLayer();
1813  double angle = POI->getShapeNaviDegree();
1814  std::string imgFile = POI->getShapeImgFile();
1815  bool relativePath = POI->getShapeRelativePath();
1816  double POIWidth = POI->getWidth(); // double width -> C4458
1817  double POIWeight = POI->getHeight(); // double height -> C4458
1818  // remove POI
1819  myUndoList->p_begin("release POI from " + toString(SUMO_TAG_LANE));
1820  myNet->deleteShape(POI, myUndoList);
1821  // add POI
1822  myNet->addPOI(id, type, color, pos, false, "", 0, 0, layer, angle, imgFile, relativePath, POIWidth, POIWeight);
1823  myUndoList->p_end();
1824  }
1825  // update view after transform
1826  update();
1827  }
1828  return 1;
1829 }
1830 
1831 
1832 long
1833 GNEViewNet::onCmdDuplicateLane(FXObject*, FXSelector, void*) {
1834  GNELane* lane = getLaneAtPopupPosition();
1835  if (lane != 0) {
1836  // when duplicating an unselected lane, keep all connections as they
1837  // are, otherwise recompute them
1838  if (lane->isAttributeCarrierSelected()) {
1839  myUndoList->p_begin("duplicate selected " + toString(SUMO_TAG_LANE) + "s");
1840  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
1841  for (auto it : lanes) {
1842  myNet->duplicateLane(it, myUndoList, true);
1843  }
1844  myUndoList->p_end();
1845  } else {
1846  myUndoList->p_begin("duplicate " + toString(SUMO_TAG_LANE));
1847  myNet->duplicateLane(lane, myUndoList, false);
1848  myUndoList->p_end();
1849  }
1850  }
1851  return 1;
1852 }
1853 
1854 
1855 long
1856 GNEViewNet::onCmdResetLaneCustomShape(FXObject*, FXSelector, void*) {
1857  GNELane* lane = getLaneAtPopupPosition();
1858  if (lane != 0) {
1859  // when duplicating an unselected lane, keep all connections as they
1860  // are, otherwise recompute them
1861  if (lane->isAttributeCarrierSelected()) {
1862  myUndoList->p_begin("reset custom lane shapes");
1863  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
1864  for (auto it : lanes) {
1865  it->setAttribute(SUMO_ATTR_CUSTOMSHAPE, "", myUndoList);
1866  }
1867  myUndoList->p_end();
1868  } else {
1869  myUndoList->p_begin("reset custom lane shape");
1871  myUndoList->p_end();
1872  }
1873  }
1874  return 1;
1875 }
1876 
1877 
1878 long
1879 GNEViewNet::onCmdRestrictLaneSidewalk(FXObject*, FXSelector, void*) {
1880  return restrictLane(SVC_PEDESTRIAN);
1881 }
1882 
1883 
1884 long
1885 GNEViewNet::onCmdRestrictLaneBikelane(FXObject*, FXSelector, void*) {
1886  return restrictLane(SVC_BICYCLE);
1887 }
1888 
1889 
1890 long
1891 GNEViewNet::onCmdRestrictLaneBuslane(FXObject*, FXSelector, void*) {
1892  return restrictLane(SVC_BUS);
1893 }
1894 
1895 
1896 long
1897 GNEViewNet::onCmdRestrictLaneGreenVerge(FXObject*, FXSelector, void*) {
1898  return restrictLane(SVC_IGNORING);
1899 }
1900 
1901 
1902 long
1903 GNEViewNet::onCmdAddRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
1905 }
1906 
1907 
1908 long
1909 GNEViewNet::onCmdAddRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
1911 }
1912 
1913 
1914 long
1915 GNEViewNet::onCmdAddRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
1916  return addRestrictedLane(SVC_BUS);
1917 }
1918 
1919 
1920 long
1921 GNEViewNet::onCmdAddRestrictedLaneGreenVerge(FXObject*, FXSelector, void*) {
1923 }
1924 
1925 
1926 long
1927 GNEViewNet::onCmdRemoveRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
1929 }
1930 
1931 
1932 long
1933 GNEViewNet::onCmdRemoveRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
1935 }
1936 
1937 
1938 long
1939 GNEViewNet::onCmdRemoveRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
1940  return removeRestrictedLane(SVC_BUS);
1941 }
1942 
1943 
1944 long
1947 }
1948 
1949 
1950 long
1951 GNEViewNet::onCmdOpenAdditionalDialog(FXObject*, FXSelector, void*) {
1952  // retrieve additional under cursor
1954  // check if additional can open dialog
1955  if (addtional && GNEAttributeCarrier::getTagProperties(addtional->getTag()).hasDialog()) {
1956  addtional->openAdditionalDialog();
1957  }
1958  return 1;
1959 }
1960 
1961 
1962 bool
1964  GNELane* lane = getLaneAtPopupPosition();
1965  if (lane != 0) {
1966  // Get selected lanes
1967  std::vector<GNELane*> lanes = myNet->retrieveLanes(true); ;
1968  // Declare map of edges and lanes
1969  std::map<GNEEdge*, GNELane*> mapOfEdgesAndLanes;
1970  // Iterate over selected lanes
1971  for (auto i : lanes) {
1972  mapOfEdgesAndLanes[myNet->retrieveEdge(i->getParentEdge().getID())] = i;
1973  }
1974  // Throw warning dialog if there hare multiple lanes selected in the same edge
1975  if (mapOfEdgesAndLanes.size() != lanes.size()) {
1976  FXMessageBox::information(getApp(), MBOX_OK,
1977  "Multiple lane in the same edge selected", "%s",
1978  ("There are selected lanes that belong to the same edge.\n Only one lane per edge will be restricted for " + toString(vclass) + ".").c_str());
1979  }
1980  // If we handeln a set of lanes
1981  if (mapOfEdgesAndLanes.size() > 0) {
1982  // declare counter for number of Sidewalks
1983  int counter = 0;
1984  // iterate over selected lanes
1985  for (auto i : mapOfEdgesAndLanes) {
1986  if (i.first->hasRestrictedLane(vclass)) {
1987  counter++;
1988  }
1989  }
1990  // if all edges parent own a Sidewalk, stop function
1991  if (counter == (int)mapOfEdgesAndLanes.size()) {
1992  FXMessageBox::information(getApp(), MBOX_OK,
1993  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
1994  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
1995  return 0;
1996  } else {
1997  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
1998  // Ask confirmation to user
1999  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2000  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2001  (toString(mapOfEdgesAndLanes.size() - counter) + " lanes will be restricted for " + toString(vclass) + ". continue?").c_str());
2002  if (answer != 1) { //1:yes, 2:no, 4:esc
2003  // write warning if netedit is running in testing mode
2004  if (answer == 2) {
2005  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
2006  } else if (answer == 4) {
2007  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2008  }
2009  return 0;
2010  } else {
2011  // write warning if netedit is running in testing mode
2012  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2013  }
2014  }
2015  // begin undo operation
2016  myUndoList->p_begin("restrict lanes to " + toString(vclass));
2017  // iterate over selected lanes
2018  for (std::map<GNEEdge*, GNELane*>::iterator i = mapOfEdgesAndLanes.begin(); i != mapOfEdgesAndLanes.end(); i++) {
2019  // Transform lane to Sidewalk
2020  myNet->restrictLane(vclass, i->second, myUndoList);
2021  }
2022  // end undo operation
2023  myUndoList->p_end();
2024  } else {
2025  // If only have a single lane, start undo/redo operation
2026  myUndoList->p_begin("restrict lane to " + toString(vclass));
2027  // Transform lane to Sidewalk
2028  myNet->restrictLane(vclass, lane, myUndoList);
2029  // end undo operation
2030  myUndoList->p_end();
2031  }
2032  }
2033  return 1;
2034 }
2035 
2036 
2037 bool
2039  GNELane* lane = getLaneAtPopupPosition();
2040  if (lane != 0) {
2041  // Get selected edges
2042  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2043  // get selected lanes
2044  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2045  // Declare set of edges
2046  std::set<GNEEdge*> setOfEdges;
2047  // Fill set of edges with vector of edges
2048  for (auto i : edges) {
2049  setOfEdges.insert(i);
2050  }
2051  // iterate over selected lanes
2052  for (auto it : lanes) {
2053  // Insert pointer to edge into set of edges (To avoid duplicates)
2054  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
2055  }
2056  // If we handeln a set of edges
2057  if (setOfEdges.size() > 0) {
2058  // declare counter for number of restrictions
2059  int counter = 0;
2060  // iterate over set of edges
2061  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2062  // update counter if edge has already a restricted lane of type "vclass"
2063  if ((*it)->hasRestrictedLane(vclass)) {
2064  counter++;
2065  }
2066  }
2067  // if all lanes own a Sidewalk, stop function
2068  if (counter == (int)setOfEdges.size()) {
2069  FXMessageBox::information(getApp(), MBOX_OK,
2070  ("Add vclass for" + toString(vclass) + " to selected lanes").c_str(), "%s",
2071  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
2072  return 0;
2073  } else {
2074  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
2075  // Ask confirmation to user
2076  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2077  ("Add vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2078  (toString(setOfEdges.size() - counter) + " restrictions for " + toString(vclass) + " will be added. continue?").c_str());
2079  if (answer != 1) { //1:yes, 2:no, 4:esc
2080  // write warning if netedit is running in testing mode
2081  if (answer == 2) {
2082  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
2083  } else if (answer == 4) {
2084  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2085  }
2086  return 0;
2087  } else {
2088  // write warning if netedit is running in testing mode
2089  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2090  }
2091  }
2092  // begin undo operation
2093  myUndoList->p_begin("Add restrictions for " + toString(vclass));
2094  // iterate over set of edges
2095  for (auto it : setOfEdges) {
2096  // add restricted lane
2097  myNet->addRestrictedLane(vclass, *it, 0, myUndoList);
2098  }
2099  // end undo operation
2100  myUndoList->p_end();
2101  } else {
2102  // If only have a single lane, start undo/redo operation
2103  myUndoList->p_begin("Add vclass for " + toString(vclass));
2104  // Add restricted lane
2105  if (lane->getIndex() > 0) {
2106  myNet->addRestrictedLane(vclass, lane->getParentEdge(), lane->getIndex(), myUndoList);
2107  } else {
2108  myNet->addRestrictedLane(vclass, lane->getParentEdge(), 0, myUndoList);
2109  }
2110  // end undo/redo operation
2111  myUndoList->p_end();
2112  }
2113  }
2114  return 1;
2115 }
2116 
2117 
2118 bool
2120  GNELane* lane = getLaneAtPopupPosition();
2121  if (lane != 0) {
2122  // Get selected edges
2123  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2124  // get selected lanes
2125  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2126  // Declare set of edges
2127  std::set<GNEEdge*> setOfEdges;
2128  // Fill set of edges with vector of edges
2129  for (auto i : edges) {
2130  setOfEdges.insert(i);
2131  }
2132  // iterate over selected lanes
2133  for (auto it : lanes) {
2134  // Insert pointer to edge into set of edges (To avoid duplicates)
2135  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
2136  }
2137  // If we handeln a set of edges
2138  if (setOfEdges.size() > 0) {
2139  // declare counter for number of restrictions
2140  int counter = 0;
2141  // iterate over set of edges
2142  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2143  // update counter if edge has already a restricted lane of type "vclass"
2144  if ((*it)->hasRestrictedLane(vclass)) {
2145  counter++;
2146  }
2147  }
2148  // if all lanes don't own a Sidewalk, stop function
2149  if (counter == 0) {
2150  FXMessageBox::information(getApp(), MBOX_OK,
2151  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2152  ("Selected lanes and edges haven't a restriction for " + toString(vclass)).c_str());
2153  return 0;
2154  } else {
2155  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
2156  // Ask confirmation to user
2157  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2158  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2159  (toString(counter) + " restrictions for " + toString(vclass) + " will be removed. continue?").c_str());
2160  if (answer != 1) { //1:yes, 2:no, 4:esc
2161  // write warning if netedit is running in testing mode
2162  if (answer == 2) {
2163  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
2164  } else if (answer == 4) {
2165  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2166  }
2167  return 0;
2168  } else {
2169  // write warning if netedit is running in testing mode
2170  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2171  }
2172  }
2173  // begin undo operation
2174  myUndoList->p_begin("Remove restrictions for " + toString(vclass));
2175  // iterate over set of edges
2176  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2177  // add Sidewalk
2178  myNet->removeRestrictedLane(vclass, *(*it), myUndoList);
2179  }
2180  // end undo operation
2181  myUndoList->p_end();
2182  } else {
2183  // If only have a single lane, start undo/redo operation
2184  myUndoList->p_begin("Remove vclass for " + toString(vclass));
2185  // Remove Sidewalk
2187  // end undo/redo operation
2188  myUndoList->p_end();
2189  }
2190  }
2191  return 1;
2192 }
2193 
2194 
2195 void
2196 GNEViewNet::processClick(FXEvent* e, void* eventData) {
2197  // process click
2198  destroyPopup();
2199  setFocus();
2200  myChanger->onLeftBtnPress(eventData);
2201  grab();
2202  // Check there are double click
2203  if (e->click_count == 2) {
2204  handle(this, FXSEL(SEL_DOUBLECLICKED, 0), eventData);
2205  }
2206 }
2207 
2208 
2209 long
2210 GNEViewNet::onCmdEditJunctionShape(FXObject*, FXSelector, void*) {
2211  // Obtain junction under mouse
2213  if (junction) {
2214  if (!OptionsCont::getOptions().getBool("lefthand")) {
2215  // for lefthand networks, the shape is already computed in GNELoadThread::run()
2216  // computing it here does not work because the network needs to be
2217  // mirrored before and after
2218  junction->getNBNode()->computeNodeShape(-1);
2219  } else if (junction->getNBNode()->getShape().size() == 0) {
2220  // recompute the whole network
2222  }
2223  PositionVector nodeShape = junction->getNBNode()->getShape();
2224  nodeShape.closePolygon();
2225  startEditCustomShape(junction, nodeShape, true);
2226  }
2227  // destroy pop-up and set focus in view net
2228  destroyPopup();
2229  setFocus();
2230  return 1;
2231 }
2232 
2233 
2234 long
2235 GNEViewNet::onCmdResetJunctionShape(FXObject*, FXSelector, void*) {
2236  // Obtain junction under mouse
2238  if (junction) {
2239  // are, otherwise recompute them
2240  if (junction->isAttributeCarrierSelected()) {
2241  myUndoList->p_begin("reset custom junction shapes");
2242  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions(true);
2243  for (auto it : junctions) {
2244  it->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
2245  }
2246  myUndoList->p_end();
2247  } else {
2248  myUndoList->p_begin("reset custom junction shape");
2249  junction->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
2250  myUndoList->p_end();
2251  }
2252  }
2253  // destroy pop-up and set focus in view net
2254  destroyPopup();
2255  setFocus();
2256  return 1;
2257 }
2258 
2259 
2260 long
2261 GNEViewNet::onCmdReplaceJunction(FXObject*, FXSelector, void*) {
2263  if (junction != 0) {
2265  update();
2266  }
2267  // destroy pop-up and set focus in view net
2268  destroyPopup();
2269  setFocus();
2270  return 1;
2271 }
2272 
2273 
2274 long
2275 GNEViewNet::onCmdSplitJunction(FXObject*, FXSelector, void*) {
2277  if (junction != 0) {
2278  myNet->splitJunction(junction, myUndoList);
2279  update();
2280  }
2281  // destroy pop-up and set focus in view net
2282  destroyPopup();
2283  setFocus();
2284  return 1;
2285 }
2286 
2287 
2288 long
2289 GNEViewNet::onCmdClearConnections(FXObject*, FXSelector, void*) {
2291  if (junction != 0) {
2292  // check if we're handling a selection
2293  if (junction->isAttributeCarrierSelected()) {
2294  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2295  myUndoList->p_begin("clear connections of selected junctions");
2296  for (auto i : selectedJunction) {
2298  }
2299  myUndoList->p_end();
2300  } else {
2302  }
2303  update();
2304  }
2305  // destroy pop-up and set focus in view net
2306  destroyPopup();
2307  setFocus();
2308  return 1;
2309 }
2310 
2311 
2312 long
2313 GNEViewNet::onCmdResetConnections(FXObject*, FXSelector, void*) {
2315  if (junction != 0) {
2316  // check if we're handling a selection
2317  if (junction->isAttributeCarrierSelected()) {
2318  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2319  myUndoList->p_begin("reset connections of selected junctions");
2320  for (auto i : selectedJunction) {
2322  }
2323  myUndoList->p_end();
2324  } else {
2326  }
2327  update();
2328  }
2329  // destroy pop-up and set focus in view net
2330  destroyPopup();
2331  setFocus();
2332  return 1;
2333 }
2334 
2335 
2336 long
2337 GNEViewNet::onCmdEditConnectionShape(FXObject*, FXSelector, void*) {
2338  // Obtain connection under mouse
2340  if (connection) {
2341  startEditCustomShape(connection, connection->getShape(), false);
2342  }
2343  // destroy pop-up and update view Net
2344  destroyPopup();
2345  setFocus();
2346  return 1;
2347 }
2348 
2349 
2350 long
2351 GNEViewNet::onCmdEditCrossingShape(FXObject*, FXSelector, void*) {
2352  // Obtain crossing under mouse
2354  if (crossing) {
2355  // due crossings haven two shapes, check what has to be edited
2356  PositionVector shape = crossing->getNBCrossing()->customShape.size() > 0 ? crossing->getNBCrossing()->customShape : crossing->getNBCrossing()->shape;
2357  startEditCustomShape(crossing, shape, false);
2358  }
2359  // destroy pop-up and update view Net
2360  destroyPopup();
2361  setFocus();
2362  return 1;
2363 }
2364 
2365 
2366 long
2367 GNEViewNet::onCmdToogleShowConnection(FXObject*, FXSelector, void*) {
2368  if (!myShowConnections) {
2370  myShowConnections = true;
2371  }
2373  // Update viewnNet to show/hide conections
2374  update();
2375  // Hide/show connections requiere recompute
2376  getNet()->requireRecompute();
2377  return 1;
2378 }
2379 
2380 
2381 long
2382 GNEViewNet::onCmdToogleSelectEdges(FXObject*, FXSelector, void*) {
2383  if (myMenuCheckSelectEdges->getCheck()) {
2384  mySelectEdges = true;
2385  } else {
2386  mySelectEdges = false;
2387  }
2388  return 1;
2389 }
2390 
2391 
2392 long
2393 GNEViewNet::onCmdToogleShowBubbles(FXObject*, FXSelector, void*) {
2394  // Update view net Shapes
2395  update();
2396  return 1;
2397 }
2398 
2399 
2400 long
2401 GNEViewNet::onCmdAddSelected(FXObject*, FXSelector, void*) {
2402  if (makeCurrent()) {
2406  if (ACToselect && !ACToselect->isAttributeCarrierSelected()) {
2407  ACToselect->selectAttributeCarrier();
2408  }
2409  }
2410  return 1;
2411 }
2412 
2413 
2414 long
2415 GNEViewNet::onCmdRemoveSelected(FXObject*, FXSelector, void*) {
2416  if (makeCurrent()) {
2420  if (ACToselect && ACToselect->isAttributeCarrierSelected()) {
2421  ACToselect->unselectAttributeCarrier();
2422  }
2423  }
2424  return 1;
2425 }
2426 
2427 
2428 long
2429 GNEViewNet::onCmdShowGrid(FXObject*, FXSelector, void*) {
2430  // show or hidde grid depending of myMenuCheckShowGrid
2431  if (myMenuCheckShowGrid->getCheck()) {
2433  } else {
2435  }
2436  update();
2437  return 1;
2438 }
2439 
2440 
2441 // ===========================================================================
2442 // private
2443 // ===========================================================================
2444 
2445 void
2447  if (mode == myEditMode) {
2448  setStatusBarText("Mode already selected");
2449  if (myCurrentFrame != nullptr) {
2451  }
2453  setStatusBarText("save modifications in TLS before change mode");
2455  } else {
2456  setStatusBarText("");
2457  abortOperation(false);
2458  // stop editing of custom shapes
2460  // set edit mode
2461  myEditMode = mode;
2462  switch (mode) {
2463  case GNE_MODE_CONNECT:
2464  case GNE_MODE_PROHIBITION:
2465  case GNE_MODE_TLS:
2466  // modes which depend on computed data
2468  break;
2469  default:
2470  break;
2471  }
2473  }
2474 }
2475 
2476 
2477 void
2479  // initialize mappings
2480  myEditModeNames.insert("(e) Create Edge", GNE_MODE_CREATE_EDGE);
2481  myEditModeNames.insert("(m) Move", GNE_MODE_MOVE);
2482  myEditModeNames.insert("(d) Delete", GNE_MODE_DELETE);
2483  myEditModeNames.insert("(i) Inspect", GNE_MODE_INSPECT);
2484  myEditModeNames.insert("(s) Select", GNE_MODE_SELECT);
2485  myEditModeNames.insert("(c) Connect", GNE_MODE_CONNECT);
2486  myEditModeNames.insert("(t) Traffic Lights", GNE_MODE_TLS);
2487  myEditModeNames.insert("(a) Additionals", GNE_MODE_ADDITIONAL);
2488  myEditModeNames.insert("(r) Crossings", GNE_MODE_CROSSING);
2489  myEditModeNames.insert("(p) Polygons", GNE_MODE_POLYGON);
2490  myEditModeNames.insert("(w) Prohibitions", GNE_MODE_PROHIBITION);
2491 
2492  // initialize buttons for modes
2493  myEditModeCreateEdge = new MFXCheckableButton(false, myToolbar, "\tset create edge mode\tMode for creating junction and edges.",
2495  myEditModeMove = new MFXCheckableButton(false, myToolbar, "\tset move mode\tMode for move elements.",
2497  myEditModeDelete = new MFXCheckableButton(false, myToolbar, "\tset delete mode\tMode for delete elements.",
2499  myEditModeInspect = new MFXCheckableButton(false, myToolbar, "\tset inspect mode\tMode for inspect elements and change their attributes.",
2501  myEditModeSelect = new MFXCheckableButton(false, myToolbar, "\tset select mode\tMode for select elements.",
2503  myEditModeConnection = new MFXCheckableButton(false, myToolbar, "\tset connection mode\tMode for edit connections between lanes.",
2505  myEditModeProhibition = new MFXCheckableButton(false, myToolbar, "\tset prohibition mode\tMode for editing connection prohibitions.",
2507  myEditModeTrafficLight = new MFXCheckableButton(false, myToolbar, "\tset traffic light mode\tMode for edit traffic lights over junctions.",
2509  myEditModeAdditional = new MFXCheckableButton(false, myToolbar, "\tset additional mode\tMode for adding additional elements.",
2511  myEditModeCrossing = new MFXCheckableButton(false, myToolbar, "\tset crossing mode\tMode for creating crossings between edges.",
2513  myEditModePolygon = new MFXCheckableButton(false, myToolbar, "\tset polygon mode\tMode for creating polygons and POIs.",
2515 
2516  // @ToDo add here new FXToolBarGrip(myNavigationToolBar, nullptr, 0, GUIDesignToolbarGrip);
2517 
2518  // initialize mode specific controls
2519  myChainCreateEdge = new FXMenuCheck(myToolbar, ("Chain\t\tCreate consecutive " + toString(SUMO_TAG_EDGE) + "s with a single click (hit ESC to cancel chain).").c_str(), this, 0);
2520  myChainCreateEdge->setCheck(false);
2521 
2522  myAutoCreateOppositeEdge = new FXMenuCheck(myToolbar, ("Two-way\t\tAutomatically create an " + toString(SUMO_TAG_EDGE) + " in the opposite direction").c_str(), this, 0);
2523  myAutoCreateOppositeEdge->setCheck(false);
2524 
2525  myMenuCheckSelectEdges = new FXMenuCheck(myToolbar, ("Select edges\t\tToggle whether clicking should select " + toString(SUMO_TAG_EDGE) + "s or " + toString(SUMO_TAG_LANE) + "s").c_str(), this, MID_GNE_VIEWNET_SELECT_EDGES);
2526  myMenuCheckSelectEdges->setCheck(true);
2527 
2528  myMenuCheckShowConnections = new FXMenuCheck(myToolbar, ("Show " + toString(SUMO_TAG_CONNECTION) + "s\t\tToggle show " + toString(SUMO_TAG_CONNECTION) + "s over " + toString(SUMO_TAG_JUNCTION) + "s").c_str(), this, MID_GNE_VIEWNET_SHOW_CONNECTIONS);
2530 
2531  myMenuCheckHideConnections = new FXMenuCheck(myToolbar,
2532  "Hide connections\t\tHide connections", this, 0);
2533  myMenuCheckHideConnections->setCheck(false);
2534 
2535  myMenuCheckExtendToEdgeNodes = new FXMenuCheck(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(), this, 0);
2536 
2537  myMenuCheckWarnAboutMerge = new FXMenuCheck(myToolbar, ("Ask for merge\t\tAsk for confirmation before merging " + toString(SUMO_TAG_JUNCTION) + ".").c_str(), this, 0);
2538  myMenuCheckWarnAboutMerge->setCheck(true);
2539 
2540  myMenuCheckShowBubbleOverJunction = new FXMenuCheck(myToolbar, ("Bubbles\t\tShow bubbles over " + toString(SUMO_TAG_JUNCTION) + "'s shapes.").c_str(), this, MID_GNE_VIEWNET_SHOW_BUBBLES);
2541  myMenuCheckShowBubbleOverJunction->setCheck(false);
2542 
2543  myMenuCheckMoveElevation = new FXMenuCheck(myToolbar, "Elevation\t\tApply mouse movement to elevation instead of x,y position", this, MID_GNE_VIEWNET_MOVE_ELEVATION);
2544  myMenuCheckMoveElevation->setCheck(false);
2545 
2546  myMenuCheckChangeAllPhases = new FXMenuCheck(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(), this, 0);
2547  myMenuCheckChangeAllPhases->setCheck(false);
2548 
2549  myMenuCheckShowGrid = new FXMenuCheck(myToolbar, "Grid\t\tshow grid and restrict movement to the grid (size defined in visualization options)", this, MID_GNE_VIEWNET_SHOW_GRID);
2550  myMenuCheckShowGrid->setCheck(false);
2551 }
2552 
2553 
2554 void
2556  // hide grid
2558  // hide all controls (checkboxs)
2559  myChainCreateEdge->hide();
2560  myAutoCreateOppositeEdge->hide();
2561  myMenuCheckSelectEdges->hide();
2566  myMenuCheckWarnAboutMerge->hide();
2568  myMenuCheckMoveElevation->hide();
2569  myMenuCheckShowGrid->hide();
2570  // unckeck all edit modes
2572  myEditModeMove->setChecked(false);
2573  myEditModeDelete->setChecked(false);
2574  myEditModeInspect->setChecked(false);
2575  myEditModeSelect->setChecked(false);
2580  myEditModePolygon->setChecked(false);
2583  // enable selected controls
2584  switch (myEditMode) {
2585  case GNE_MODE_CREATE_EDGE:
2586  myChainCreateEdge->show();
2587  myAutoCreateOppositeEdge->show();
2589  myMenuCheckShowGrid->show();
2590  break;
2591  case GNE_MODE_MOVE:
2592  myMenuCheckWarnAboutMerge->show();
2594  myMenuCheckMoveElevation->show();
2595  myEditModeMove->setChecked(true);
2596  myMenuCheckShowGrid->show();
2597  break;
2598  case GNE_MODE_DELETE:
2603  myMenuCheckSelectEdges->show();
2605  break;
2606  case GNE_MODE_INSPECT:
2610  myMenuCheckSelectEdges->show();
2613  break;
2614  case GNE_MODE_SELECT:
2618  myMenuCheckSelectEdges->show();
2622  break;
2623  case GNE_MODE_CONNECT:
2629  break;
2630  case GNE_MODE_TLS:
2636  break;
2637  case GNE_MODE_ADDITIONAL:
2642  myMenuCheckShowGrid->show();
2643  break;
2644  case GNE_MODE_CROSSING:
2649  myMenuCheckShowGrid->setCheck(false);
2650  break;
2651  case GNE_MODE_POLYGON:
2656  myMenuCheckShowGrid->show();
2657  break;
2658  case GNE_MODE_PROHIBITION:
2663  break;
2664  default:
2665  break;
2666  }
2667  // Update buttons
2668  myEditModeCreateEdge->update();
2669  myEditModeMove->update();
2670  myEditModeDelete->update();
2671  myEditModeInspect->update();
2672  myEditModeSelect->update();
2673  myEditModeConnection->update();
2674  myEditModeTrafficLight->update();
2675  myEditModeAdditional->update();
2676  myEditModeCrossing->update();
2677  myEditModePolygon->update();
2678  myEditModeProhibition->update();
2679  // force repaint because different modes draw different things
2680  myToolbar->recalc();
2681  onPaint(0, 0, 0);
2682  update();
2683 }
2684 
2685 
2686 void
2688  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions(true);
2689  if (junctions.size() > 0) {
2690  std::string plural = junctions.size() == 1 ? ("") : ("s");
2691  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_JUNCTION) + plural);
2692  for (auto i : junctions) {
2694  }
2695  myUndoList->p_end();
2696  }
2697 }
2698 
2699 
2700 void
2702  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2703  if (lanes.size() > 0) {
2704  std::string plural = lanes.size() == 1 ? ("") : ("s");
2705  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_LANE) + plural);
2706  for (auto i : lanes) {
2707  // when deleting multiple lanes, recompute connections
2708  myNet->deleteLane(i, myUndoList, true);
2709  }
2710  myUndoList->p_end();
2711  }
2712 }
2713 
2714 
2715 void
2717  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2718  if (edges.size() > 0) {
2719  std::string plural = edges.size() == 1 ? ("") : ("s");
2720  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_EDGE) + plural);
2721  for (auto i : edges) {
2722  // when deleting multiple edges, recompute connections
2723  myNet->deleteEdge(i, myUndoList, true);
2724  }
2725  myUndoList->p_end();
2726  }
2727 }
2728 
2729 
2730 void
2732  std::vector<GNEAdditional*> additionals = myNet->retrieveAdditionals(true);
2733  if (additionals.size() > 0) {
2734  std::string plural = additionals.size() == 1 ? ("") : ("s");
2735  myUndoList->p_begin("delete selected additional" + plural);
2736  for (auto i : additionals) {
2737  // due there are additionals that are removed when their parent is removed, we need to check if yet exists before removing
2738  if (myNet->retrieveAdditional(i->getTag(), i->getID(), false) != nullptr) {
2740  }
2741  }
2742  myUndoList->p_end();
2743  }
2744 }
2745 
2746 
2747 
2748 void
2750  // obtain selected crossings
2751  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions();
2752  std::vector<GNECrossing*> crossings;
2753  for (auto i : junctions) {
2754  for (auto j : i->getGNECrossings()) {
2755  if (j->isAttributeCarrierSelected()) {
2756  crossings.push_back(j);
2757  }
2758  }
2759  }
2760  // remove selected crossings
2761  if (crossings.size() > 0) {
2762  std::string plural = crossings.size() == 1 ? ("") : ("s");
2763  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CROSSING) + "s");
2764  for (auto i : crossings) {
2765  if (myNet->retrieveCrossing(i->getID(), false)) {
2767  }
2768  }
2769  myUndoList->p_end();
2770  }
2771 }
2772 
2773 
2774 void
2776  // obtain selected connections
2777  std::vector<GNEEdge*> edges = myNet->retrieveEdges();
2778  std::vector<GNEConnection*> connections;
2779  for (auto i : edges) {
2780  for (auto j : i->getGNEConnections()) {
2781  if (j->isAttributeCarrierSelected()) {
2782  connections.push_back(j);
2783  }
2784  }
2785  }
2786  // remove selected connections
2787  if (connections.size() > 0) {
2788  std::string plural = connections.size() == 1 ? ("") : ("s");
2789  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CONNECTION) + plural);
2790  for (auto i : connections) {
2792  }
2793  myUndoList->p_end();
2794  }
2795 }
2796 
2797 
2798 void
2800  // obtain selected shapes
2801  std::vector<GNEShape*> selectedShapes = myNet->retrieveShapes(true);
2802  // remove it
2803  if (selectedShapes.size() > 0) {
2804  std::string plural = selectedShapes.size() == 1 ? ("") : ("s");
2805  myUndoList->p_begin("delete selected shape" + plural);
2806  for (auto i : selectedShapes) {
2808  }
2809  myUndoList->p_end();
2810  }
2811 }
2812 
2813 
2814 bool
2816  const Position& newPos = moved->getNBNode()->getPosition();
2817  GNEJunction* mergeTarget = 0;
2818  // try to find another junction to merge with
2819  if (makeCurrent()) {
2820  Boundary selection;
2821  selection.add(newPos);
2822  selection.grow(0.1);
2823  const std::vector<GUIGlID> ids = getObjectsInBoundary(selection);
2824  GUIGlObject* object = 0;
2825  for (auto it_ids : ids) {
2826  if (it_ids == 0) {
2827  continue;
2828  }
2830  if (!object) {
2831  throw ProcessError("Unkown object in selection (id=" + toString(it_ids) + ").");
2832  }
2833  if ((object->getType() == GLO_JUNCTION) && (it_ids != moved->getGlID())) {
2834  mergeTarget = dynamic_cast<GNEJunction*>(object);
2835  }
2837  }
2838  }
2839  if (mergeTarget) {
2840  // optionally ask for confirmation
2841  if (myMenuCheckWarnAboutMerge->getCheck()) {
2842  WRITE_DEBUG("Opening FXMessageBox 'merge junctions'");
2843  // open question box
2844  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO,
2845  "Confirm Junction Merger", "%s",
2846  ("Do you wish to merge junctions '" + moved->getMicrosimID() +
2847  "' and '" + mergeTarget->getMicrosimID() + "'?\n" +
2848  "('" + moved->getMicrosimID() +
2849  "' will be eliminated and its roads added to '" +
2850  mergeTarget->getMicrosimID() + "')").c_str());
2851  if (answer != 1) { //1:yes, 2:no, 4:esc
2852  // write warning if netedit is running in testing mode
2853  if (answer == 2) {
2854  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'No'");
2855  } else if (answer == 4) {
2856  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'ESC'");
2857  }
2858  return false;
2859  } else {
2860  // write warning if netedit is running in testing mode
2861  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'Yes'");
2862  }
2863  }
2864  // restore previous position of junction moved
2865  moved->moveGeometry(oldPos, Position(0, 0));
2866  // merge moved and targed junctions
2867  myNet->mergeJunctions(moved, mergeTarget, myUndoList);
2868  return true;
2869  } else {
2870  return false;
2871  }
2872 }
2873 
2874 
2875 void
2877  switch (myEditMode) {
2878  case GNE_MODE_INSPECT:
2879  myViewParent->getInspectorFrame()->update();
2880  break;
2881  default:
2882  break;
2883  }
2884 }
2885 
2886 void
2888  // first reset all variables
2889  eventInfo = nullptr;
2890  glType = GLO_NETWORK;
2891  attributeCarrier = nullptr;
2892  netElement = nullptr;
2893  additional = nullptr;
2894  shape = nullptr;
2895  junction = nullptr;
2896  edge = nullptr;
2897  lane = nullptr;
2898  crossing = nullptr;
2899  connection = nullptr;
2900  poi = nullptr;
2901  poly = nullptr;
2902  // set event
2903  eventInfo = ev;
2904  // set GLID of object under cursor
2905  glID = glIDObject;
2906  // only continue if isn't 0
2907  if (glID == 0) {
2908  return;
2909  }
2910  // obtain glObject associated to these glID
2913  // only continue if glObject isn't nullptr;
2914  if (glObject == nullptr) {
2915  return;
2916  }
2917  // set glType
2918  glType = glObject->getType();
2919  // cast attribute carrier from glObject
2920  attributeCarrier = dynamic_cast<GNEAttributeCarrier*>(glObject);
2921  // only continue if attributeCarrier isn't nullptr;
2922  if (attributeCarrier == nullptr) {
2923  return;
2924  }
2925  // If we're editing a shape, ignore rest of elements (including other polygons)
2926  if (editedPolyShape != nullptr) {
2927  if (attributeCarrier == editedPolyShape) {
2928  // cast Poly from attribute carrier
2929  poly = dynamic_cast<GNEPoly*>(attributeCarrier);
2930  }
2931  } else {
2932  // obtain tag property (only for improve code legibility)
2933  const auto& tagValue = GNEAttributeCarrier::getTagProperties(attributeCarrier->getTag());
2934  // check if attributeCarrier can be casted into netElement, additional or shape
2935  if (tagValue.isNetElement()) {
2936  // cast netElement from attribute carrier
2937  netElement = dynamic_cast<GNENetElement*>(attributeCarrier);
2938  } else if (tagValue.isAdditional()) {
2939  // cast additional element from attribute carrier
2940  additional = dynamic_cast<GNEAdditional*>(attributeCarrier);
2941  } else if (tagValue.isShape()) {
2942  // cast shape element from attribute carrier
2943  shape = dynamic_cast<GNEShape*>(attributeCarrier);
2944  } else {
2945  // element isn't specified, then stop
2946  return;
2947  }
2948  // now set specify AC type
2949  switch (glObject->getType()) {
2950  case GLO_JUNCTION:
2951  junction = dynamic_cast<GNEJunction*>(attributeCarrier);
2952  break;
2953  case GLO_EDGE:
2954  edge = dynamic_cast<GNEEdge*>(attributeCarrier);
2955  break;
2956  case GLO_LANE:
2957  lane = dynamic_cast<GNELane*>(attributeCarrier);
2958  break;
2959  case GLO_POI:
2960  poi = dynamic_cast<GNEPOI*>(attributeCarrier);
2961  break;
2962  case GLO_POLYGON:
2963  poly = dynamic_cast<GNEPoly*>(attributeCarrier);
2964  break;
2965  case GLO_CROSSING:
2966  crossing = dynamic_cast<GNECrossing*>(attributeCarrier);
2967  break;
2968  case GLO_CONNECTION:
2969  connection = dynamic_cast<GNEConnection*>(attributeCarrier);
2970  break;
2971  default:
2972  break;
2973  }
2974  }
2975 }
2976 
2977 
2978 void
2980  if (lane) {
2981  edge = &lane->getParentEdge();
2982  netElement = edge;
2983  attributeCarrier = edge;
2984  glType = GLO_EDGE;
2985  }
2986 }
2987 
2988 
2989 bool
2991  if (eventInfo) {
2992  return (eventInfo->state & SHIFTMASK) != 0;
2993  } else {
2994  return false;
2995  }
2996 }
2997 
2998 
2999 bool
3001  if (eventInfo) {
3002  return (eventInfo->state & CONTROLMASK) != 0;
3003  } else {
3004  return false;
3005  }
3006 }
3007 
3008 
3009 void
3011  selectingUsingRectangle = false;
3012  // shift held down on mouse-down and mouse-up
3013  if (shiftKeyPressed) {
3014  if (viewNet->makeCurrent()) {
3015  Boundary b;
3016  b.add(selectionCorner1);
3017  b.add(selectionCorner2);
3018  std::vector<GUIGlID> ids = viewNet->getObjectsInBoundary(b);
3019  // use a set of pairs to obtain attribute carriers in rectangle sorted by ID (note: a map cannot be used because there is different ACs with the same ID
3020  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACInRectangles;
3021  for (auto i : ids) {
3022  // avoid to select Net (i = 0)
3023  if (i != 0) {
3024  GNEAttributeCarrier* retrievedAC = viewNet->myNet->retrieveAttributeCarrier(i);
3025  // in the case of a Lane, we need to change the retrieved lane to their the parent if mySelectEdges is enabled
3026  if ((retrievedAC->getTag() == SUMO_TAG_LANE) && viewNet->mySelectEdges) {
3027  retrievedAC = &dynamic_cast<GNELane*>(retrievedAC)->getParentEdge();
3028  }
3029  // make sure that AttributeCarrier can be selected
3030  GUIGlObject* glObject = dynamic_cast<GUIGlObject*>(retrievedAC);
3031  if (glObject && !viewNet->getViewParent()->getSelectorFrame()->getLockGLObjectTypes()->IsObjectTypeLocked(glObject->getType())) {
3032  ACInRectangles.insert(std::make_pair(retrievedAC->getID(), retrievedAC));
3033  }
3034  }
3035  }
3036  // declare two sets of attribute carriers, one for select and another for unselect
3037  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToSelect;
3038  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToUnselect;
3039  // in restrict AND replace mode all current selected attribute carriers will be unselected
3042  for (auto i : viewNet->myNet->getSelectedAttributeCarriers()) {
3043  ACToUnselect.insert(std::make_pair(i->getID(), i));
3044  }
3045  }
3046  // iterate over AtributeCarriers obtained of rectangle an place it in ACToSelect or ACToUnselect
3047  for (auto i : ACInRectangles) {
3050  ACToUnselect.insert(i);
3051  break;
3053  if (ACToUnselect.find(i) != ACToUnselect.end()) {
3054  ACToSelect.insert(i);
3055  }
3056  break;
3057  default:
3058  ACToSelect.insert(i);
3059  break;
3060  }
3061  }
3062  // select junctions and their connections and crossings if Auto select junctions is enabled (note: only for "add mode")
3064  std::vector<GNEEdge*> edgesToSelect;
3065  // iterate over ACToSelect and extract edges
3066  for (auto i : ACToSelect) {
3067  if (i.second->getTag() == SUMO_TAG_EDGE) {
3068  edgesToSelect.push_back(dynamic_cast<GNEEdge*>(i.second));
3069  }
3070  }
3071  // iterate over extracted edges
3072  for (auto i : edgesToSelect) {
3073  // select junction source and all their connections and crossings
3074  ACToSelect.insert(std::make_pair(i->getGNEJunctionSource()->getID(), i->getGNEJunctionSource()));
3075  for (auto j : i->getGNEJunctionSource()->getGNEConnections()) {
3076  ACToSelect.insert(std::make_pair(j->getID(), j));
3077  }
3078  for (auto j : i->getGNEJunctionSource()->getGNECrossings()) {
3079  ACToSelect.insert(std::make_pair(j->getID(), j));
3080  }
3081  // select junction destiny and all their connections crossings
3082  ACToSelect.insert(std::make_pair(i->getGNEJunctionDestiny()->getID(), i->getGNEJunctionDestiny()));
3083  for (auto j : i->getGNEJunctionDestiny()->getGNEConnections()) {
3084  ACToSelect.insert(std::make_pair(j->getID(), j));
3085  }
3086  for (auto j : i->getGNEJunctionDestiny()->getGNECrossings()) {
3087  ACToSelect.insert(std::make_pair(j->getID(), j));
3088  }
3089  }
3090  }
3091  // only continue if there is ACs to select or unselect
3092  if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
3093  // first unselect AC of ACToUnselect and then selects AC of ACToSelect
3094  viewNet->myUndoList->p_begin("selection using rectangle");
3095  for (auto i : ACToUnselect) {
3096  i.second->setAttribute(GNE_ATTR_SELECTED, "false", viewNet->myUndoList);
3097  }
3098  for (auto i : ACToSelect) {
3099  if (GNEAttributeCarrier::getTagProperties(i.second->getTag()).isSelectable()) {
3100  i.second->setAttribute(GNE_ATTR_SELECTED, "true", viewNet->myUndoList);
3101  }
3102  }
3103  viewNet->myUndoList->p_end();
3104  }
3105  viewNet->makeNonCurrent();
3106  }
3107  }
3108 }
3109 
3110 std::string
3112  return ("Selection width:" + toString(fabs(selectionCorner1.x() - selectionCorner2.x()))
3113  + " height:" + toString(fabs(selectionCorner1.y() - selectionCorner2.y()))
3114  + " diagonal:" + toString(selectionCorner1.distanceTo2D(selectionCorner2)));
3115 }
3116 
3117 /****************************************************************************/
Locate junction - button.
Definition: GUIAppEnum.h:172
DeleteOptions * getDeleteOptions() const
get delete options
void startEditCustomShape(GNENetElement *element, const PositionVector &shape, bool fill)
start edit custom shape
Definition: GNEViewNet.cpp:381
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
Definition: GNENet.cpp:680
AddShapeResult processClick(const Position &clickedPosition, GNELane *lane)
process click over Viewnet
void buildColorRainbow(GUIColorScheme &scheme, int active, GUIGlObjectType objectType)
recalibrate color scheme according to the current value range
Definition: GNEViewNet.cpp:290
remove inner geometry
Definition: GUIAppEnum.h:694
long onCmdResetEdgeEndpoint(FXObject *, FXSelector, void *)
change geometry endpoint
GNEViewParent * myViewParent
view parent
Definition: GNEViewNet.h:591
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:647
testingMode myTestingMode
variable used to save variables related with testing mode
Definition: GNEViewNet.h:664
long onCmdRemoveRestrictedLaneGreenVerge(FXObject *, FXSelector, void *)
remove restricted lane for all vehicles
GNEPoly * polyToMove
the poly of which geometry is being moved
Definition: GNEViewNet.h:439
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1107
void processSelection(GNEViewNet *viewNet, bool shiftKeyPressed)
Process Selection.
long onCmdResetJunctionShape(FXObject *, FXSelector, void *)
reset junction shape
a tl-logic
GNEEdge * edgeToMove
the edge of which geometry is being moved
Definition: GNEViewNet.h:436
static const RGBColor BLUE
Definition: RGBColor.h:174
FXDEFMAP(GNEViewNet) GNEViewNetMap[]
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:131
std::vector< GUIGlID > getObjectsAtPosition(Position pos, double radius)
returns the ids of the object at position within the given (rectangular) radius using GL_SELECT ...
void show()
show prohibition frame
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:1059
const GNEAttributeCarrier * getACUnderCursor() const
get AttributeCarrier under cursor
Position getPositionInView() const
Return current position.
bool selectEdges()
whether inspection, selection and inversion should apply to edges or to lanes
Definition: GNEViewNet.cpp:337
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_MODE_INSPECT
void openPolygon(bool allowUndo=true)
open polygon
Definition: GNEPoly.cpp:446
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:125
GUICompleteSchemeStorage gSchemeStorage
const std::vector< T > & getSchemes() const
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:915
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:186
GNEAdditional * additional
additional element
Definition: GNEViewNet.h:522
void abortOperation(bool clearSelection=true)
abort current edition operation
void deleteSelectedJunctions()
delete all currently selected junctions
whether a given shape is user-defined
bool setColorScheme(const std::string &name)
set color scheme
Definition: GNEViewNet.cpp:274
is a pedestrian
a polygon
long onCmdSetModeAdditional(FXObject *, FXSelector, void *)
called when user press the button for additional mode
mode for moving things
Definition: GNEViewNet.h:48
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:120
void smoothElevation(GNEUndoList *undoList)
smooth elevation with regard to adjoining edges
Definition: GNEEdge.cpp:1671
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:103
void inspectElement(GNEAttributeCarrier *AC)
Inspect a single element.
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
Definition: GNEViewNet.cpp:996
bool myShowConnections
whether show connections has been activated once
Definition: GNEViewNet.h:621
void stopDrawing()
stop drawing and create polygon or
begin/end of the description of a single lane
mode for editing tls
Definition: GUIAppEnum.h:491
smooth geometry
Definition: GUIAppEnum.h:696
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
StringBijection< EditMode > myEditModeNames
since we cannot switch on strings we map the mode names to an enum
Definition: GNEViewNet.h:728
long onMouseMove(FXObject *, FXSelector, void *)
called when user moves mouse
Mode for editing connection prohibits.
Definition: GNEViewNet.h:66
void markAsCreateEdgeSource()
marks as first junction in createEdge-mode
std::vector< GUIGlID > getObjectsInBoundary(Boundary bound)
returns the ids of all objects in the given boundary
MovedItems myMovedItems
variable use to save pointers to moved elements
Definition: GNEViewNet.h:655
The main window of the Netedit.
void beginMoveSelection(GNEAttributeCarrier *originAC, const Position &originPosition)
begin move selection
Definition: GNEViewNet.cpp:411
SetOperation getModificationMode() const
get current modification mode
long onCmdAddSelected(FXObject *, FXSelector, void *)
select AC under cursor
bool mySelectEdges
flag to check if select edges is enabled
Definition: GNEViewNet.h:624
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
GUIGlObjectType glType
GUI GL object type.
Definition: GNEViewNet.h:513
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
std::map< GNEEdge *, MovingEdges > myOriginShapesMovedPartialShapes
Definition: GNEViewNet.h:682
void hotkeyFocusFrame()
handle focus frame keypress
const GNEAttributeCarrier * myACUnderCursor
current AttributeCarrier under Mouse position
Definition: GNEViewNet.h:738
static const RGBColor WHITE
Definition: RGBColor.h:179
AddShapeResult
enum with all possible values after try to create an shape using frame
FXMenuCheck * myMenuCheckShowGrid
show grid button
Definition: GNEViewNet.h:618
void stopEditCustomShape()
edit edit shape
Definition: GNEViewNet.cpp:397
edit junction shape
Definition: GUIAppEnum.h:742
AddAdditionalResult addAdditional(GNENetElement *netElement, GNEAdditional *additional)
add additional element
Position movingReference
variable for calculating moving offset (Used when user doesn&#39;t click exactly over the center of shape...
Definition: GNEViewNet.h:457
void straightenElevation(GNEUndoList *undoList)
interpolate z values linear between junctions
Definition: GNEEdge.cpp:1576
virtual long onMouseMove(FXObject *, FXSelector, void *)
FXMenuCheck * myChainCreateEdge
whether the endpoint for a created edge should be set as the new source
Definition: GNEViewNet.h:635
Locate addtional structure - button.
Definition: GUIAppEnum.h:182
mode for deleting things
Definition: GNEViewNet.h:50
Definition: GNEPOI.h:44
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true)
get a single attribute carrier based on a GLID
Definition: GNENet.cpp:1181
void show()
show delete frame
connectio between two lanes
std::set< GNEEdge * > getEdgesAtPopupPosition()
try to retrieve multiple edges at popup position
mode for connecting lanes
Definition: GUIAppEnum.h:489
long onCmdSplitEdge(FXObject *, FXSelector, void *)
split edge at cursor position
edit junction shape
Definition: GUIAppEnum.h:724
a connection
bool controlKeyPressed() const
check if CONTROL key was pressed during click
void setChecked(bool val)
check or uncheck this MFXCheckableButton
long onCmdToogleSelectEdges(FXObject *, FXSelector, void *)
toogle selet edges
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
reverse an edge
Definition: GUIAppEnum.h:706
split an edge
Definition: GUIAppEnum.h:702
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:61
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
interpolate z values linear between junctions
Definition: GUIAppEnum.h:698
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNEPoly.cpp:165
GUIMainWindow * myApp
The application.
MoveSingleElementValues myMoveSingleElementValues
variable used to save variables related with movement of single elements
Definition: GNEViewNet.h:658
split an edge
Definition: GUIAppEnum.h:704
bool myShiftKeyPressed
flag to check if shift key is pressed (can be changed after Key Press/Released and mouse Move) ...
Definition: GNEViewNet.h:627
Position snapToActiveGrid(const Position &pos) const
Returns a position that is mapped to the closest grid point if the grid is active.
Position selectionCorner1
firstcorner of the rectangle-selection
Definition: GNEViewNet.h:563
void setEditMode(EditMode mode)
set edit mode
static void resetTextures()
Reset textures.
void moveShapeStart(const Position &oldPos, const Position &offset)
move position of shape start without commiting change
Definition: GNEEdge.cpp:168
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:700
MFXCheckableButton * myEditModeSelect
chekable button for edit mode select
Definition: GNEViewNet.h:703
long onCmdOpenPolygon(FXObject *, FXSelector, void *)
open closed polygon
GNEConnection * connection
connection
Definition: GNEViewNet.h:540
double x() const
Returns the x-position.
Definition: Position.h:56
mode for editing tls
Definition: GNEViewNet.h:58
int getVertexIndex(const Position &pos, bool createIfNoExist=true)
return index of a vertex of shape, or of a new vertex if position is over an shape&#39;s edge ...
Definition: GNEPoly.cpp:370
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
Definition: GNENet.cpp:757
mode for editing additional
Definition: GUIAppEnum.h:493
bool movingStartPos
bool to indicate that startPos are being moved
Definition: GNEViewNet.h:467
GNEAdditional * getAdditionalAtPopupPosition()
try to retrieve a additional at popup position
void smooth(GNEUndoList *undoList)
make geometry smooth
Definition: GNEEdge.cpp:1659
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
Definition: GNENet.cpp:596
ObjectsUnderCursor myObjectsUnderCursor
variable use to save all pointers to objects under cursor after a click
Definition: GNEViewNet.h:652
static const RGBColor ORANGE
Definition: RGBColor.h:178
long onCmdAddRestrictedLaneGreenVerge(FXObject *, FXSelector, void *)
Add restricted lane for all vehicles.
MFXCheckableButton * myEditModeMove
chekable button for edit mode move
Definition: GNEViewNet.h:694
T MAX2(T a, T b)
Definition: StdDefs.h:76
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition: GNENet.cpp:564
bool isTLSSaved()
check if modifications in TLS was saved
transform lane to bikelane
Definition: GUIAppEnum.h:779
int movingIndexShape
current index of shape that are being moved
Definition: GNEViewNet.h:471
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction&#39;s connections
Definition: GNENet.cpp:1711
MFXCheckableButton * myEditModeDelete
chekable button for edit mode delete
Definition: GNEViewNet.h:697
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:80
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:327
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:80
PositionVector movingOriginalShape
Shape of elements before moving (needed for commmit shape changes)
Definition: GNEViewNet.h:463
PositionVector shape
The crossing&#39;s shape.
Definition: NBNode.h:133
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
int editMode
the current NETEDIT mode (temporary)
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:78
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:178
long onCmdRemoveRestrictedLaneBikelane(FXObject *, FXSelector, void *)
remove restricted lane for bikes
long onCmdRestrictLaneGreenVerge(FXObject *, FXSelector, void *)
restrict lane to all vehicles
long onCmdEditConnectionShape(FXObject *, FXSelector, void *)
edit connection shape
GNEProhibitionFrame * getProhibitionFrame() const
get frame for GNE_MODE_PROHIBITION
static const RGBColor BLACK
Definition: RGBColor.h:180
const std::string & getID() const
Returns the id.
Definition: Named.h:69
double getHeight() const
Returns the image height of the POI.
Remove from selected items - Menu Etry.
Definition: GUIAppEnum.h:256
MFXCheckableButton * myEditModeProhibition
checkable button for edit mode polygon
Definition: GNEViewNet.h:721
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
void moveSelection(const Position &offset)
move selection
Definition: GNEViewNet.cpp:482
void commitShapeStartChange(const Position &oldPos, GNEUndoList *undoList)
commit position changing in shape start
Definition: GNEEdge.cpp:188
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
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:746
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers()
get all selected attribute carriers
Definition: GNENet.cpp:1751
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:766
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
std::map< GNEJunction *, Position > myOriginPositionOfMovedJunctions
Selected Junctions that are being moved.
Definition: GNEViewNet.h:671
void updateObjectUnderCursor(GUIGlID glIDObject, GNEPoly *editedPolyShape, FXEvent *ev)
update objects under cursor (Called only in onLeftBtnPress(...) function)
FXMenuCheck * myMenuCheckChangeAllPhases
menu check to set change all phases
Definition: GNEViewNet.h:615
turn junction into geometry node
Definition: GUIAppEnum.h:720
void deleteSelectedShapes()
delete all currently selected shapes
close opened polygon
Definition: GUIAppEnum.h:752
show junctions as bubbles
Definition: GUIAppEnum.h:519
GNEAdditional * additionalToMove
the stoppingPlace element which shape is being moved
Definition: GNEViewNet.h:445
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:606
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
virtual void selectAttributeCarrier(bool changeFlag=true)=0
void closePolygon(bool allowUndo=true)
close polygon
Definition: GNEPoly.cpp:468
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:242
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:70
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 ...
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:75
int testingWidth
Width of viewNet in testing mode.
Definition: GNEViewNet.h:584
double p2m(double pixel) const
pixels-to-meters conversion method
bool isDrawing() const
return true if currently a shape is drawed
bool testingEnabled
flag to enable or disable testing mode
Definition: GNEViewNet.h:581
FXMenuCheck * myMenuCheckHideConnections
menu check to hide connections in connect mode
Definition: GNEViewNet.h:609
virtual void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)=0
commit geometry changes in the attributes of an element after use of moveGeometry(...)
std::map< const GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
bool changeAllPhases() const
change all phases
Definition: GNEViewNet.cpp:369
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
Definition: GNENet.cpp:617
long onCmdSetModeCrossing(FXObject *, FXSelector, void *)
called when user press the button for crossing mode
bool IsObjectTypeLocked(GUIGlObjectType type) const
check if an object is locked
GNEAdditionalFrame * getAdditionalFrame() const
get frame for GNE_MODE_ADDITIONAL
int getVertexIndex(const Position &pos, bool createIfNoExist=true)
return index of a vertex of shape, or of a new vertex if position is over an shape&#39;s edge ...
Definition: GNEEdge.cpp:261
SelectingArea mySelectingArea
variable used to save variables related with selecting areas
Definition: GNEViewNet.h:661
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:1795
void handleLaneClick(GNELane *lane, bool mayDefinitelyPass, bool allowConflict, bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
void insert(const std::string str, const T key, bool checkDuplicates=true)
void buildEditModeControls()
adds controls for setting the edit mode
FXMenuCheck * myMenuCheckMoveElevation
apply movement to elevation
Definition: GNEViewNet.h:648
GUIGlID getObjectAtPosition(Position pos)
returns the id of the object at position using GL_SELECT
remove bikelane
Definition: GUIAppEnum.h:795
GNEUndoList * getUndoList() const
get the undoList object
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:767
long onLeftBtnPress(FXObject *, FXSelector, void *)
Definition: GNEViewNet.cpp:644
long onRightBtnRelease(FXObject *, FXSelector, void *)
called when user releases mouse&#39;s right button
long onCmdSimplifyShape(FXObject *, FXSelector, void *)
simply shape of current polygon
static const RGBColor GREEN
Definition: RGBColor.h:173
mode for editing connection prohibitions
Definition: GUIAppEnum.h:499
void computeNodeShape(double mismatchThreshold)
Compute the junction shape for this node.
Definition: NBNode.cpp:879
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:110
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:139
bool showLockIcon() const
check if lock icon should be visible
virtual long onPaint(FXObject *, FXSelector, void *)
int addColor(const T &color, const double threshold, const std::string &name="")
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items
add bikelane
Definition: GUIAppEnum.h:787
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string name
The name of this setting.
double gridXSize
Information about the grid spacings.
bool hasCommandGroup() const
Check if undoList has command group.
void splitJunction(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by a list of junctions for each unique edge endpoint ...
Definition: GNENet.cpp:1667
void deleteSelectedConnections()
delete all currently selected connections
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
remove restricted lane
Definition: GNENet.cpp:666
mode for inspecting object attributes
Definition: GNEViewNet.h:52
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
FXMenuCheck * myMenuCheckShowConnections
menu check to show connections
Definition: GNEViewNet.h:606
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
virtual void setStatusBarText(const std::string &)
Definition: GUIMainWindow.h:74
void deleteSelectedCrossings()
delete all currently selected crossings
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:1991
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button.
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:1298
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
virtual ~GNEViewNet()
destructor
Definition: GNEViewNet.cpp:210
GNEEdge * getEdgeAtPopupPosition()
try to retrieve an edge at popup position
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition: GNENet.cpp:528
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:880
long onCmdRemoveRestrictedLaneSidewalk(FXObject *, FXSelector, void *)
remove restricted lane for pedestrians
int testingHeight
Height of viewNet in testing mode.
Definition: GNEViewNet.h:587
bool clickedOverShapeStart(const Position &pos)
Definition: GNEEdge.cpp:148
void commitShapeEndChange(const Position &oldPos, GNEUndoList *undoList)
commit position changing in shape end
Definition: GNEEdge.cpp:201
transform lane to busLane
Definition: GUIAppEnum.h:781
void handleConnectionClick(GNEConnection *conn, bool mayDefinitelyPass, bool allowConflict, bool toggle)
handle prohibitions and set teh relative colouring
long onCmdSetModeMove(FXObject *, FXSelector, void *)
called when user press the button for move mode
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:85
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
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
FXMenuCheck * myMenuCheckSelectEdges
menu check to select only edges
Definition: GNEViewNet.h:603
long onCmdRestrictLaneBuslane(FXObject *, FXSelector, void *)
restrict lane to buslanes
FXToolBar * myToolbar
a reference to the toolbar in myParent
Definition: GNEViewNet.h:686
FXComboBox & getColoringSchemesCombo()
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:522
long onCmdToogleShowConnection(FXObject *, FXSelector, void *)
toogle show connections
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
MFXCheckableButton * myEditModeCreateEdge
Definition: GNEViewNet.h:691
bool isMovementBlocked() const
return true if movement is blocked
Definition: GNEShape.cpp:57
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:82
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPOI.cpp:235
reset junction shape
Definition: GUIAppEnum.h:726
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
virtual void moveGeometry(const Position &oldPos, const Position &offset)=0
change the position of the element geometry without saving in undoList
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:243
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:453
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
bool showJunctionAsBubbles() const
return true if junction must be showed as bubbles
Definition: GNEViewNet.cpp:375
bool removeRestrictedLane(SUMOVehicleClass vclass)
remove restricted lane
long onCmdSplitEdgeBidi(FXObject *, FXSelector, void *)
split edge at cursor position
bool autoSelectNodes()
whether to autoselect nodes or to lanes
Definition: GNEViewNet.cpp:357
long onCmdSetModeProhibition(FXObject *, FXSelector, void *)
called when user press the button for polygon mode
static const RGBColor MAGENTA
Definition: RGBColor.h:177
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) ...
T MIN2(T a, T b)
Definition: StdDefs.h:70
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:119
MFXCheckableButton * myEditModeTrafficLight
chekable button for edit mode traffic light
Definition: GNEViewNet.h:709
void initGNEConnections()
initialize GNEConnections
Definition: GNENet.cpp:2404
turn junction into multiple junctions
Definition: GUIAppEnum.h:722
GNECrossing * crossing
crossing
Definition: GNEViewNet.h:537
mode for selecting objects
Definition: GNEViewNet.h:54
bool addCrossing(GNENetElement *netElement)
add Crossing element
MFXCheckableButton * myEditModeAdditional
chekable button for edit mode additional
Definition: GNEViewNet.h:712
GNEAttributeCarrier * attributeCarrier
attribute carrier
Definition: GNEViewNet.h:516
void startGeometryMoving()
Definition: GNEEdge.cpp:214
edge: the shape in xml-definition
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
GUIColorer junctionColorer
The junction colorer.
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:579
mode for creating polygons
Definition: GUIAppEnum.h:497
const std::string getID() const
function to support debugging
remove busLane
Definition: GUIAppEnum.h:797
void updateLockGLObjectTypes()
update selected items
void unMarkAsCreateEdgeSource()
removes mark as first junction in createEdge-mode
move elevation instead of x,y
Definition: GUIAppEnum.h:521
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNEPoly.cpp:387
void startDrawing()
start drawing
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.
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:249
std::map< GNEEdge *, PositionVector > myOriginShapesMovedEntireShapes
Selected Edges that are being moved < Edge, PositionVector >
Definition: GNEViewNet.h:674
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:735
bool clickedOverShapeEnd(const Position &pos)
return true if user clicked over ShapeEnd
Definition: GNEEdge.cpp:158
long onCmdEditEdgeEndpoint(FXObject *, FXSelector, void *)
change geometry endpoint
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
Definition: GNENet.cpp:316
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag, bool onlySelected=false)
return shape by type shapes
Definition: GNENet.cpp:1120
void splitEdgesBidi(const std::set< GNEEdge *> &edges, const Position &pos, GNEUndoList *undoList)
split all edges at position by inserting one new junction
Definition: GNENet.cpp:746
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:447
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:99
GUIPerspectiveChanger * myChanger
The perspective changer.
long onCmdResetLaneCustomShape(FXObject *, FXSelector, void *)
reset custom shapes of selected lanes
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
EditMode
Definition: GNEViewNet.h:42
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:89
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:214
add busLane
Definition: GUIAppEnum.h:789
begin/end of the description of an edge
FXint myWindowCursorPositionX
Position of the cursor relative to the window.
FXMenuCheck * myAutoCreateOppositeEdge
Definition: GNEViewNet.h:636
long onCmdSplitJunction(FXObject *, FXSelector, void *)
split junction into multiple junctions
void setSelectionScaling(double selectionScale)
set selection scaling
Definition: GNEViewNet.cpp:363
EditMode getCurrentEditMode() const
get the current edit mode
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1911
MFXCheckableButton * myEditModeInspect
chekable button for edit mode inspect
Definition: GNEViewNet.h:700
FXMenuCheck * myMenuCheckExtendToEdgeNodes
menu check to extend to edge nodes
Definition: GNEViewNet.h:612
long onCmdClosePolygon(FXObject *, FXSelector, void *)
close opened polygon
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:620
transform lane to sidewalk
Definition: GUIAppEnum.h:777
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
Definition: GNENet.cpp:1622
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:605
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:248
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
called when user release a key
std::string reportDimensions()
inform about selection size
FXbool makeCurrent()
A reimplementation due to some internal reasons.
long onCmdRemoveRestrictedLaneBuslane(FXObject *, FXSelector, void *)
remove restricted lane for bus
long onCmdOK(FXObject *, FXSelector, void *)
reserved GLO type to pack all additionals
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:690
long onCmdCreateCrossing(FXObject *, FXSelector, void *)
AddAdditionalResult
enum with all possible values after try to create an additional using frame
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNEEdge.cpp:298
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:1010
DrawingMode * getDrawingMode() const
get drawing mode editor
static const RGBColor YELLOW
Definition: RGBColor.h:175
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNEPoly.cpp:103
Mode for editing Polygons.
Definition: GNEViewNet.h:64
static const RGBColor RED
named colors
Definition: RGBColor.h:172
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:679
GNENetElement * netElement
net element
Definition: GNEViewNet.h:519
reset junction&#39;s connections
Definition: GUIAppEnum.h:718
FXMenuCheck * myMenuCheckWarnAboutMerge
whether we should warn about merging junctions
Definition: GNEViewNet.h:642
double selectionScale
the current selection scaling in NETEDIT (temporary)
void setACUnderCursor(const GNEAttributeCarrier *AC)
set attributeCarrier under cursor
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:263
#define GUIDesignButtonToolbarCheckable
little checkable button with icon placed in navigation toolbar
Definition: GUIDesigns.h:89
virtual void show()
show Frame
Definition: GNEFrame.cpp:741
Locate TLS - button.
Definition: GUIAppEnum.h:180
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)
draw Text box with given parameters
Definition: GLHelper.cpp:635
static const RGBColor CYAN
Definition: RGBColor.h:176
Set a vertex of polygon as first verte.
Definition: GUIAppEnum.h:756
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
Definition: GNENet.cpp:431
GUIVisualizationSettings * myVisualizationSettings
visualization settings
void simplifyShape(bool allowUndo=true)
replace the current shape with a rectangle
Definition: GNEPoly.cpp:532
long onCmdDeleteGeometryPoint(FXObject *, FXSelector, void *)
delete the closes geometry point
void show()
show additional frame and update use selected edges/lanes
mode for adding edges
Definition: GUIAppEnum.h:479
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1046
PositionVector customShape
optional customShape for this crossing
Definition: NBNode.h:147
bool getDeleteLastCreatedPoint()
get flag delete last created point
FXMenuCheck * myMenuCheckShowBubbleOverJunction
show connection as buuble in "Move" mode.
Definition: GNEViewNet.h:645
bool selectingUsingRectangle
whether we have started rectangle-selection
Definition: GNEViewNet.h:560
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:53
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false) const
return all additionals
Definition: GNENet.cpp:1807
GNEConnectorFrame * getConnectorFrame() const
get frame for GNE_MODE_CONNECT
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
bool contains(const std::string &name) const
Returns the information whether a setting with the given name is stored.
void show()
show shape frame and update use selected edges/lanes
add reverse edge
Definition: GUIAppEnum.h:708
MFXCheckableButton * myEditModeConnection
chekable button for edit mode connection
Definition: GNEViewNet.h:706
bool showConnections()
show connections over junctions
Definition: GNEViewNet.cpp:343
GNEJunction * junction
junction
Definition: GNEViewNet.h:528
bool deleteOnlyGeometryPoints() const
check if only delete geometry points checkbox is enabled
long onCmdOK(FXObject *, FXSelector, void *)
long onCmdReverseEdge(FXObject *, FXSelector, void *)
reverse edge
simplify polygon geometry
Definition: GUIAppEnum.h:750
GNEPOI * poiToMove
the poi which is being moved
Definition: GNEViewNet.h:442
mode for moving things
Definition: GUIAppEnum.h:481
Position movingOriginalPosition
original Position of element before moving (needed for commmit position changes)
Definition: GNEViewNet.h:460
long onCmdSetModeTLS(FXObject *, FXSelector, void *)
called when user press the button for traffic lights mode
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
int doPaintGL(int mode, const Boundary &bound)
do paintGL
Definition: GNEViewNet.cpp:527
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
GNEJunction * myCreateEdgeSource
source junction for new edge 0 if no edge source is selected an existing (or newly created) junction ...
Definition: GNEViewNet.h:632
void abortDrawing()
abort drawing
element is selected
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:440
an edge
GNEJunction * junctionToMove
the Junction to be moved.
Definition: GNEViewNet.h:433
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:240
duplicate a lane
Definition: GUIAppEnum.h:773
reset default geometry endpoints
Definition: GUIAppEnum.h:692
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:1294
void deleteSelectedAdditionals()
delete all currently selected additionals
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction&#39;s connections
Definition: GNENet.cpp:1699
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
Definition: GNENet.cpp:2415
crossing between edges for pedestrians
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
Definition: GNENet.cpp:386
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
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
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
Position selectionCorner2
second corner of the rectangle-selection
Definition: GNEViewNet.h:566
const Position & getPosition() const
Definition: NBNode.h:241
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNEEdge.cpp:342
void updateModeSpecificControls()
updates mode specific controls
GUIGlID getGlID() const
Returns the numerical id of the object.
MFXCheckableButton * myEditModeCrossing
chekable button for edit mode crossing
Definition: GNEViewNet.h:715
long onCmdEditCrossingShape(FXObject *, FXSelector, void *)
edit crossing shape
void removeAttributeCarrier(GNEAttributeCarrier *ac, bool ignoreOptions=false)
remove attribute carrier (element)
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
Definition: GNENet.cpp:770
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:331
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
void swapLane2Edge()
swap lane to edge
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:233
void hideAllFrames()
hide all frames
long onCmdSetModeConnect(FXObject *, FXSelector, void *)
called when user press the button for connect mode
Mode for editing additionals.
Definition: GNEViewNet.h:60
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
Definition: GNEViewNet.cpp:218
edit junction shape
Definition: GUIAppEnum.h:734
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
long onCmdSetModePolygon(FXObject *, FXSelector, void *)
called when user press the button for polygon mode
static const RGBColor selectionColor
Definition: GNENet.h:96
open closed polygon
Definition: GUIAppEnum.h:754
empty max
Mode for editing crossing.
Definition: GNEViewNet.h:62
void unblockObject(GUIGlID id)
Marks an object as unblocked.
long onCmdStraightenEdges(FXObject *, FXSelector, void *)
makes selected edges straight
long onCmdSetModeInspect(FXObject *, FXSelector, void *)
called when user press the button for inspect mode
static const TagValues & getTagProperties(SumoXMLTag tag)
get Tag Properties
void finishMoveSelection()
finish moving selection
Definition: GNEViewNet.cpp:501
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
mode for connecting lanes
Definition: GNEViewNet.h:56
bool myMovingSelection
whether a selection is being moved
Definition: GNEViewNet.h:667
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
mode for creating new edges
Definition: GNEViewNet.h:46
void removePolygonForEditShapes(GNEPoly *polygon)
remove Polygon for edit shapes
Definition: GNENet.cpp:2008
virtual long onRightBtnPress(FXObject *, FXSelector, void *)
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:586
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
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 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:805
void endGeometryMoving()
begin movement (used when user click over additional to start a movement, to avoid problems with prob...
Locate poi - button.
Definition: GUIAppEnum.h:184
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
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
bool isShapeBlocked() const
return true if shape is blocked
Definition: GNEShape.cpp:63
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:743
const PositionVector & getTemporalShape() const
get Temporal shape
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 setDeleteLastCreatedPoint(bool value)
enable or disable delete last created point
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEEdge.cpp:930
C++ TraCI client API implementation.
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
GNENet * myNet
Pointer to current net. (We are not responsible for deletion)
Definition: GNEViewNet.h:594
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:641
void deleteSelectedLanes()
delete all currently selected lanes
long onCmdEditJunctionShape(FXObject *, FXSelector, void *)
edit junction shape
void changeFirstGeometryPoint(int oldIndex, bool allowUndo=true)
change first geometry point
Definition: GNEPoly.cpp:490
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
Definition: GNEViewNet.cpp:950
Position getSplitPos(const Position &clickPos)
Definition: GNEEdge.cpp:592
vehicles ignoring classes
void requireRecompute()
inform the net about the need for recomputation
Definition: GNENet.cpp:1384
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
long onCmdShowGrid(FXObject *, FXSelector, void *)
toogle show grid
void processClick(FXEvent *e, void *data)
Auxiliar function used by onLeftBtnPress(...)
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:96
long onCmdSetModeCreateEdge(FXObject *, FXSelector, void *)
transform lane to greenVerge
Definition: GUIAppEnum.h:783
long onCmdSetModeDelete(FXObject *, FXSelector, void *)
called when user press the button for delete mode
void deleteSelectedEdges()
delete all currently selected edges
clear junction&#39;s connections
Definition: GUIAppEnum.h:716
GNEUndoList * myUndoList
a reference to the undolist maintained in the application
Definition: GNEViewNet.h:735
EditMode myEditMode
the current edit mode
Definition: GNEViewNet.h:597
virtual long onRightBtnRelease(FXObject *, FXSelector, void *)
bool addRestrictedLane(SUMOVehicleClass vclass)
add restricted lane
MFXCheckableButton * myEditModePolygon
chekable button for edit mode polygon
Definition: GNEViewNet.h:718
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNEPoly.cpp:149
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
GNEFrame * myCurrentFrame
the current frame
Definition: GNEViewNet.h:600
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
SumoXMLTag getTag() const
get XML Tag assigned to this object
virtual Position getPositionInView() const =0
Returns position of additional in view.