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  // Junctions
105  // Connections
107  // Crossings
109  // Edges
110  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SPLIT, GNEViewNet::onCmdSplitEdge),
112  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_REVERSE, GNEViewNet::onCmdReverseEdge),
117  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SMOOTH, GNEViewNet::onCmdSmoothEdges),
120  // Lanes
131  // addtionals
133  // Polygons
135  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_CLOSE, GNEViewNet::onCmdClosePolygon),
136  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_OPEN, GNEViewNet::onCmdOpenPolygon),
139  // POIs
140  FXMAPFUNC(SEL_COMMAND, MID_GNE_POI_TRANSFORM, GNEViewNet::onCmdTransformPOI),
141 };
142 
143 // Object implementation
144 FXIMPLEMENT(GNEViewNet, GUISUMOAbstractView, GNEViewNetMap, ARRAYNUMBER(GNEViewNetMap))
145 
146 // ===========================================================================
147 // member method definitions
148 // ===========================================================================
149 
150 GNEViewNet::GNEViewNet(FXComposite* tmpParent, FXComposite* actualParent, GUIMainWindow& app,
151  GNEViewParent* viewParent, GNENet* net, GNEUndoList* undoList,
152  FXGLVisual* glVis, FXGLCanvas* share, FXToolBar* toolBar) :
153  GUISUMOAbstractView(tmpParent, app, viewParent, net->getVisualisationSpeedUp(), glVis, share),
154  myViewParent(viewParent),
155  myNet(net),
156  myEditMode(GNE_MODE_MOVE),
157  myCurrentFrame(0),
158  myShowConnections(false),
159  mySelectEdges(true),
160  myCreateEdgeSource(0),
161  myMovingSelection(false),
162  myToolbar(toolBar),
163  myEditModeCreateEdge(0),
164  myEditModeMove(0),
165  myEditModeDelete(0),
166  myEditModeInspect(0),
167  myEditModeSelect(0),
168  myEditModeConnection(0),
169  myEditModeTrafficLight(0),
170  myEditModeAdditional(0),
171  myEditModeCrossing(0),
172  myEditModePolygon(0),
173  myEditModeProhibition(0),
174  myEditModeNames(),
175  myUndoList(undoList),
176  myEditShapePoly(0) {
177  // view must be the final member of actualParent
178  reparent(actualParent);
179 
180  buildEditModeControls();
181  myUndoList->mark();
182  myNet->setViewNet(this);
183 
184  ((GUIDanielPerspectiveChanger*)myChanger)->setDragDelay(100000000); // 100 milliseconds
185 
186  // Reset textures
188 
189  if (myTestingMode.testingEnabled && OptionsCont::getOptions().isSet("window-size")) {
190  std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
191  if (windowSize.size() == 2 && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
192  myTestingMode.testingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
193  myTestingMode.testingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
194  } else {
195  WRITE_ERROR("Invalid windows size-format: " + toString(windowSize) + "for option 'window-size'");
196  }
197  }
198 }
199 
200 
202 
203 
204 void
206 
207 
208 void
210  // build coloring tools
211  {
212  for (auto it_names : gSchemeStorage.getNames()) {
213  cw.getColoringSchemesCombo().appendItem(it_names.c_str());
214  if (it_names == myVisualizationSettings->name) {
215  cw.getColoringSchemesCombo().setCurrentItem(cw.getColoringSchemesCombo().getNumItems() - 1);
216  }
217  }
218  cw.getColoringSchemesCombo().setNumVisible(MAX2(5, (int)gSchemeStorage.getNames().size() + 1));
219  }
220  // for junctions
221  new FXButton(cw.getLocatorPopup(),
222  "\tLocate Junction\tLocate a junction within the network.",
224  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
225  // for edges
226  new FXButton(cw.getLocatorPopup(),
227  "\tLocate Street\tLocate a street within the network.",
229  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
230  // for tls
231  new FXButton(cw.getLocatorPopup(),
232  "\tLocate TLS\tLocate a tls within the network.",
234  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
235  // for additional stuff
236  new FXButton(cw.getLocatorPopup(),
237  "\tLocate Additional\tLocate an additional structure within the network.",
239  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
240  // for pois
241  new FXButton(cw.getLocatorPopup(),
242  "\tLocate PoI\tLocate a PoI within the network.",
244  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
245  // for polygons
246  new FXButton(cw.getLocatorPopup(),
247  "\tLocate Polygon\tLocate a Polygon within the network.",
249  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
250 }
251 
252 
253 bool
254 GNEViewNet::setColorScheme(const std::string& name) {
255  if (!gSchemeStorage.contains(name)) {
256  return false;
257  }
258  if (myVisualizationChanger != 0) {
259  if (myVisualizationChanger->getCurrentScheme() != name) {
261  }
262  }
263  myVisualizationSettings = &gSchemeStorage.get(name.c_str());
264  update();
265  return true;
266 }
267 
268 
269 void
271  assert(!scheme.isFixed());
272  double minValue = std::numeric_limits<double>::infinity();
273  double maxValue = -std::numeric_limits<double>::infinity();
274  // retrieve range
275  if (objectType == GLO_LANE) {
276  // XXX (see #3409) multi-colors are not currently handled. this is a quick hack
277  if (active == 9) {
278  active = 8; // segment height, fall back to start height
279  } else if (active == 11) {
280  active = 10; // segment incline, fall back to total incline
281  }
282  for (GNELane* lane : myNet->retrieveLanes()) {
283  const double val = lane->getColorValue(active);
284  minValue = MIN2(minValue, val);
285  maxValue = MAX2(maxValue, val);
286  }
287  } else if (objectType == GLO_JUNCTION) {
288  if (active == 3) {
289  for (GNEJunction* junction : myNet->retrieveJunctions()) {
290  minValue = MIN2(minValue, junction->getPositionInView().z());
291  maxValue = MAX2(maxValue, junction->getPositionInView().z());
292  }
293  }
294  }
295  if (minValue != std::numeric_limits<double>::infinity()) {
296  scheme.clear();
297  // add new thresholds
298  double range = maxValue - minValue;
299  scheme.addColor(RGBColor::RED, (minValue));
300  scheme.addColor(RGBColor::ORANGE, (minValue + range * 1 / 6.0));
301  scheme.addColor(RGBColor::YELLOW, (minValue + range * 2 / 6.0));
302  scheme.addColor(RGBColor::GREEN, (minValue + range * 3 / 6.0));
303  scheme.addColor(RGBColor::CYAN, (minValue + range * 4 / 6.0));
304  scheme.addColor(RGBColor::BLUE, (minValue + range * 5 / 6.0));
305  scheme.addColor(RGBColor::MAGENTA, (maxValue));
306  }
307 }
308 
309 
310 void
311 GNEViewNet::setStatusBarText(const std::string& text) {
312  myApp->setStatusBarText(text);
313 }
314 
315 
316 bool
318  return mySelectEdges;
319 }
320 
321 
322 bool
324  if (myEditMode == GNE_MODE_CONNECT) {
325  return myMenuCheckHideConnections->getCheck() == 0;
326  } else if (myEditMode == GNE_MODE_PROHIBITION) {
327  return true;
328  } else if (myMenuCheckShowConnections->shown() == false) {
329  return false;
330  } else {
332  }
333 }
334 
335 
336 bool
338  return (myMenuCheckExtendToEdgeNodes->getCheck() != 0);
339 }
340 
341 
342 void
343 GNEViewNet::setSelectionScaling(double selectionScale) {
344  myVisualizationSettings->selectionScale = selectionScale;
345 }
346 
347 
348 bool
350  return (myMenuCheckChangeAllPhases->getCheck() != 0);
351 }
352 
353 
354 bool
356  return (myEditMode == GNE_MODE_MOVE) && (myMenuCheckShowBubbleOverJunction->getCheck());
357 }
358 
359 
360 void
362  if ((myEditShapePoly == nullptr) && (element != nullptr) && (shape.size() > 1)) {
363  // save current edit mode before starting
366  // add special GNEPoly fo edit shapes
367  // color is taken from junction color settings
369  myEditShapePoly = myNet->addPolygonForEditShapes(element, shape, fill, col);
370  // update view net to show the new myEditShapePoly
371  update();
372  }
373 }
374 
375 
376 void
378  // stop edit shape junction deleting myEditShapePoly
379  if (myEditShapePoly != 0) {
381  myEditShapePoly = 0;
382  // restore previous edit mode
385  }
386  }
387 }
388 
389 
390 void
392  // enable moving selection
393  myMovingSelection = true;
394  // obtain Junctions and edges selected
395  std::vector<GNEJunction*> selectedJunctions = myNet->retrieveJunctions(true);
396  std::vector<GNEEdge*> selectedEdges = myNet->retrieveEdges(true);
397  // Junctions are always moved, then save position of current selected junctions (Needed when mouse is released)
398  for (auto i : selectedJunctions) {
399  myOriginPositionOfMovedJunctions[i] = i->getPositionInView();
400  }
401  // make special movement depending of clicked AC
402  if (originAC->getTag() == SUMO_TAG_JUNCTION) {
403  // if clicked element is a junction, move shapes of all selected edges
404  for (auto i : selectedEdges) {
405  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
406  }
407  } else if (originAC->getTag() == SUMO_TAG_EDGE) {
408  // obtain clicked edge
409  GNEEdge* clickedEdge = dynamic_cast<GNEEdge*>(originAC);
410  // if clicked edge has origin and destiny junction selected, move shapes of all selected edges
411  if ((myOriginPositionOfMovedJunctions.count(clickedEdge->getGNEJunctionSource()) > 0 &&
412  myOriginPositionOfMovedJunctions.count(clickedEdge->getGNEJunctionDestiny()) > 0)) {
413  for (auto i : selectedEdges) {
414  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
415  }
416  } else {
417  // declare three groups for dividing edges
418  std::vector<GNEEdge*> noJunctionsSelected;
419  std::vector<GNEEdge*> originJunctionSelected;
420  std::vector<GNEEdge*> destinyJunctionSelected;
421  // divide selected edges into four groups, depending of the selection of their junctions
422  for (auto i : selectedEdges) {
423  bool originSelected = myOriginPositionOfMovedJunctions.count(i->getGNEJunctionSource()) > 0;
424  bool destinySelected = myOriginPositionOfMovedJunctions.count(i->getGNEJunctionDestiny()) > 0;
425  // bot junctions selected
426  if (!originSelected && !destinySelected) {
427  noJunctionsSelected.push_back(i);
428  } else if (originSelected && !destinySelected) {
429  originJunctionSelected.push_back(i);
430  } else if (!originSelected && destinySelected) {
431  destinyJunctionSelected.push_back(i);
432  } else if (!originSelected && !destinySelected) {
433  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
434  }
435  }
436  // saved old position of Edges which both junction isn't noJunctionsSelected
437  for (auto i : noJunctionsSelected) {
438  myOriginShapesMovedPartialShapes[i].originalShape = i->getNBEdge()->getInnerGeometry();
439  }
440  // obtain index shape of clicked edge and move it
441  int index = clickedEdge->getVertexIndex(originPosition);
442  assert(index >= 0);
443  myOriginShapesMovedPartialShapes[clickedEdge].index = index;
444  Position originPositionOnClicked = clickedEdge->getNBEdge()->getInnerGeometry()[index];
445  myOriginShapesMovedPartialShapes[clickedEdge].originalPosition = originPositionOnClicked;
446  // find/create point to move for other edges
447  for (auto i : noJunctionsSelected) {
448  if (i != clickedEdge) {
449  int index = i->getVertexIndex(originPositionOnClicked);
450  myOriginShapesMovedPartialShapes[i].index = index;
451  if (index >= 0) {
452  myOriginShapesMovedPartialShapes[i].originalPosition = i->getNBEdge()->getInnerGeometry()[index];
453  }
454  }
455  }
456  }
457  }
458 }
459 
460 
461 void
463  // move selected junctions
464  for (auto i : myOriginPositionOfMovedJunctions) {
465  i.first->moveGeometry(i.second, offset);
466  }
467 
468  // move entire edge shapes
469  for (auto i : myOriginShapesMovedEntireShapes) {
470  i.first->moveEntireShape(i.second, offset);
471  }
472 
473  // move partial shapes
474  for (auto i : myOriginShapesMovedPartialShapes) {
475  i.first->moveVertexShape(i.second.index, i.second.originalPosition, offset);
476  }
477 }
478 
479 
480 void
482  myUndoList->p_begin("position of selected elements");
483  // commit positions of moved junctions
484  for (auto i : myOriginPositionOfMovedJunctions) {
485  i.first->commitGeometryMoving(i.second, myUndoList);
486  }
487  myOriginPositionOfMovedJunctions.clear();
488 
489  // commit shapes of entired moved edges
490  for (auto i : myOriginShapesMovedEntireShapes) {
491  i.first->commitShapeChange(i.second, myUndoList);
492  }
493  myOriginShapesMovedEntireShapes.clear();
494 
495  //commit shapes of partial moved shapes
496  for (auto i : myOriginShapesMovedPartialShapes) {
497  i.first->commitShapeChange(i.second.originalShape, myUndoList);
498  }
499  myOriginShapesMovedPartialShapes.clear();
500 
501  myUndoList->p_end();
502  myMovingSelection = false;
503 }
504 
505 
506 int
507 GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
508  // init view settings
509  // (uncomment the next line to check select mode)
510  // myVisualizationSettings->drawForSelecting = true;
511  glRenderMode(mode);
512  glMatrixMode(GL_MODELVIEW);
513  glPushMatrix();
514  glDisable(GL_TEXTURE_2D);
515  glDisable(GL_ALPHA_TEST);
516  glEnable(GL_BLEND);
517  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
518  glEnable(GL_DEPTH_TEST);
519 
520  // visualize rectangular selection
522  glPushMatrix();
523  glTranslated(0, 0, GLO_MAX - 1);
525  glLineWidth(2);
526  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
527  glBegin(GL_QUADS);
532  glEnd();
533  glPopMatrix();
534  }
535 
536  // compute lane width
537  double lw = m2p(SUMO_const_laneWidth);
538  // draw decals (if not in grabbing mode)
540  drawDecals();
541  // depending of the visualizationSettings, enable or disable check box show grid
543  myMenuCheckShowGrid->setCheck(true);
544  paintGLGrid();
545  } else {
546  myMenuCheckShowGrid->setCheck(false);
547  }
550  if (myTestingMode.testingWidth > 0 && (getWidth() != myTestingMode.testingWidth || getHeight() != myTestingMode.testingHeight)) {
551  // only resize once to avoid flickering
552  //std::cout << " before resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
554  //std::cout << " directly after resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
556  }
557  //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
558  // draw pink square in the upper left corner on top of everything
559  glPushMatrix();
560  const double size = p2m(32);
561  Position center = screenPos2NetPos(8, 8);
563  glTranslated(center.x(), center.y(), GLO_MAX - 1);
564  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
565  glBegin(GL_QUADS);
566  glVertex2d(0, 0);
567  glVertex2d(0, -size);
568  glVertex2d(size, -size);
569  glVertex2d(size, 0);
570  glEnd();
571  glPopMatrix();
572  // show box with the current position relative to pink square
573  Position posRelative = screenPos2NetPos(getWidth() - 40, getHeight() - 20);
574  // adjust cursor position (24,25) to show exactly the same position as in function netedit.leftClick(match, X, Y)
576  }
577  }
578 
579  // draw temporal shape of polygon during drawing
581  const PositionVector& temporalDrawingShape = myViewParent->getPolygonFrame()->getDrawingMode()->getTemporalShape();
582  // draw blue line with the current drawed shape
583  glPushMatrix();
584  glLineWidth(2);
586  GLHelper::drawLine(temporalDrawingShape);
587  glPopMatrix();
588  // draw red line from the last point of shape to the current mouse position
589  if (temporalDrawingShape.size() > 0) {
590  glPushMatrix();
591  glLineWidth(2);
593  GLHelper::drawLine(temporalDrawingShape.back(), snapToActiveGrid(getPositionInformation()));
594  glPopMatrix();
595  }
596  }
597 
598  glLineWidth(1);
599  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
600  const float minB[2] = { (float)bound.xmin(), (float)bound.ymin() };
601  const float maxB[2] = { (float)bound.xmax(), (float)bound.ymax() };
603  glEnable(GL_POLYGON_OFFSET_FILL);
604  glEnable(GL_POLYGON_OFFSET_LINE);
606  int hits2 = myGrid->Search(minB, maxB, *myVisualizationSettings);
607 
608  glTranslated(0, 0, GLO_ADDITIONAL);
609  for (auto i : myAdditionallyDrawn) {
610  i.first->drawGLAdditional(this, *myVisualizationSettings);
611  }
612 
613  glPopMatrix();
614  return hits2;
615 }
616 
617 
618 long
619 GNEViewNet::onLeftBtnPress(FXObject*, FXSelector, void* eventData) {
620  FXEvent* evt = (FXEvent*) eventData;
621  setFocus();
622  // interpret object under cursor
623  if (makeCurrent()) {
624  // first update objects under cursor
626  // decide what to do based on mode
627  switch (myEditMode) {
628  case GNE_MODE_CREATE_EDGE: {
629  // make sure that Control key isn't pressed
631  // allow moving when control is held down
632  if (!myUndoList->hasCommandGroup()) {
633  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
634  }
637  }
638  if (myCreateEdgeSource == 0) {
641  update();
642  } else {
644  // may fail to prevent double edges
645  GNEEdge* newEdge = myNet->createEdge(
647  if (newEdge) {
648  // create another edge, if create opposite edge is enabled
649  if (myAutoCreateOppositeEdge->getCheck()) {
651  }
653 
654  if (myUndoList->hasCommandGroup()) {
655  myUndoList->p_end();
656  } else {
657  std::cout << "edge created without an open CommandGroup )-:\n";
658  }
659  if (myChainCreateEdge->getCheck()) {
662  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
663  } else {
664  myCreateEdgeSource = 0;
665  }
666  } else {
667  setStatusBarText("An " + toString(SUMO_TAG_EDGE) + " with the same geometry already exists!");
668  }
669  } else {
670  setStatusBarText("Start- and endpoint for an " + toString(SUMO_TAG_EDGE) + " must be distinct!");
671  }
672  update();
673  }
674  }
675  // process click
676  processClick(evt, eventData);
677  break;
678  }
679  case GNE_MODE_MOVE: {
680  // first obtain moving reference (common for all)
682  // check what type of AC will be moved
684  // set Poly to move
686  // save original shape (needed for commit change)
688  // save clicked position as moving original position
690  // obtain index of vertex to move if shape isn't blocked
691  if ((myMovedItems.polyToMove->isShapeBlocked() == false) && (myMovedItems.polyToMove->isMovementBlocked() == false)) {
692  // obtain index of vertex to move and moving reference
694  } else {
696  }
697  } else if (myObjectsUnderCursor.poi) {
699  // Save original Position of Element
701  } else if (myObjectsUnderCursor.junction) {
704  } else {
707  }
708  // Save original Position of Element
711  // allways swap lanes to edges in movement mode
714  }
717  } else if (myObjectsUnderCursor.shiftKeyPressed()) {
719  } else {
727  } else {
728  // save original shape (needed for commit change)
730  // obtain index of vertex to move and moving reference
733  // start moving AFTER getvertex Index
735  }
736  }
737  } else if (myObjectsUnderCursor.additional) {
739  myMovingSelection = true;
740  } else {
742  // start geometry moving
744  // Save original Position of Element
746  }
747  } else {
748  // process click
749  processClick(evt, eventData);
750  }
751  update();
752  break;
753  }
754  case GNE_MODE_DELETE: {
756  // change the selected attribute carrier if mySelectEdges is enabled and clicked element is a lane
759  }
760  // check if we are deleting a selection or an single attribute carrier
762  // before delete al selected attribute carriers, check if we clicked over a geometry point
767  } else {
769  }
770  } else {
772  }
773  } else {
774  // process click
775  processClick(evt, eventData);
776  }
777  break;
778  }
779  case GNE_MODE_INSPECT: {
781  // change the selected attribute carrier if mySelectEdges is enabled and clicked element is a lane
784  }
785  // if Control key is Pressed, select instead inspect element
787  // Check if this GLobject type is locked
789  // toogle netElement selection
792  } else {
794  }
795  }
796  } else {
797  // inspect attribute carrier, or multiseletion if AC is selected
799  // focus upper element of inspector frame
801  }
802  }
803  // process click
804  processClick(evt, eventData);
805  update();
806  break;
807  }
808  case GNE_MODE_SELECT:
809  // first check that under cursor there is an attribute carrier and is selectable
811  // change the selected attribute carrier if mySelectEdges is enabled and clicked element is a lane
814  }
815  // Check if this GLobject type is locked
817  // toogle netElement selection
820  } else {
822  }
823  // update selector frame
824  if (myViewParent->getSelectorFrame()->shown()) {
826  }
827  }
828  }
829  // check if a rect for selecting is being created
834  } else {
835  // process click
836  processClick(evt, eventData);
837  }
838  update();
839  break;
840  case GNE_MODE_CONNECT: {
842  // shift key may pass connections, Control key allow conflicts.
844  update();
845  }
846  // process click
847  processClick(evt, eventData);
848  break;
849  }
850  case GNE_MODE_TLS: {
853  update();
854  }
855  // process click
856  processClick(evt, eventData);
857  break;
858  }
859  case GNE_MODE_ADDITIONAL: {
861  // process click or update view depending of the result of "add additional"
863  update();
864  // process click
865  processClick(evt, eventData);
866  }
867  break;
868  }
869  case GNE_MODE_CROSSING: {
870  if (myObjectsUnderCursor.crossing == nullptr) {
872  update();
873  }
874  }
875  // process click
876  processClick(evt, eventData);
877  break;
878  }
879  case GNE_MODE_POLYGON: {
880  if (myObjectsUnderCursor.poi == nullptr) {
882  // view net must be always update
883  update();
884  // process clickw depending of the result of "add additional"
885  if ((result != GNEPolygonFrame::ADDSHAPE_NEWPOINT)) {
886  // process click
887  processClick(evt, eventData);
888  }
889  }
890  break;
891  }
892  case GNE_MODE_PROHIBITION: {
894  // shift key may pass connections, Control key allow conflicts.
896  update();
897  }
898  // process click
899  processClick(evt, eventData);
900  break;
901  }
902  default: {
903  // process click
904  processClick(evt, eventData);
905  }
906  }
907  makeNonCurrent();
908  }
909  return 1;
910 }
911 
912 
913 long
914 GNEViewNet::onLeftBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
915  GUISUMOAbstractView::onLeftBtnRelease(obj, sel, eventData);
916  if (myMovingSelection) {
918  } else if (myMovedItems.polyToMove) {
921  } else if (myMovedItems.poiToMove) {
924  } else if (myMovedItems.junctionToMove) {
925  // finish Junction movement
927  // position is already up to date but we must register with myUndoList
930  }
932  } else if (myMovedItems.edgeToMove) {
939  } else {
941  }
943  } else if (myMovedItems.additionalToMove) {
948  bool shiftKeyPressed = ((FXEvent*)eventData)->state & SHIFTMASK;
949  mySelectingArea.processSelection(this, shiftKeyPressed);
950  // update selector frame
951  if (myViewParent->getSelectorFrame()->shown()) {
953  }
954  }
955  update();
956  return 1;
957 }
958 
959 
960 long GNEViewNet::onRightBtnPress(FXObject* obj, FXSelector sel, void* eventData) {
962  // during drawing of a polygon, right click removes the last created point
964  // update view
965  update();
966  return 1;
967  } else {
968  return GUISUMOAbstractView::onRightBtnPress(obj, sel, eventData);
969  }
970 }
971 
972 
973 long GNEViewNet::onRightBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
975  // during drawing of a polygon, right click removes the last created point
976  return 1;
977  } else {
978  return GUISUMOAbstractView::onRightBtnRelease(obj, sel, eventData);
979  }
980 }
981 
982 
983 long
984 GNEViewNet::onMouseMove(FXObject* obj, FXSelector sel, void* eventData) {
985  GUISUMOAbstractView::onMouseMove(obj, sel, eventData);
986  // calculate offset of movement depending of showGrid
987  Position offsetMovement;
990  if (myMenuCheckMoveElevation->getCheck()) {
991  const double dist = int((offsetMovement.y() + offsetMovement.x()) / myVisualizationSettings->gridXSize) * myVisualizationSettings->gridXSize;
992  offsetMovement = Position(0, 0, dist / 10);
993  }
994  } else {
996  if (myMenuCheckMoveElevation->getCheck()) {
997  offsetMovement = Position(0, 0, (offsetMovement.y() + offsetMovement.x()) / 10);
998  }
999  }
1000  // @note #3521: Add checkBox to allow moving elements... has to behere implemented
1001  // check what type of additional is moved
1002  if (myMovingSelection) {
1003  moveSelection(offsetMovement);
1004  } else if (myMovedItems.polyToMove) {
1005  // move shape's geometry without commiting changes
1008  } else {
1010  }
1011  } else if (myMovedItems.poiToMove) {
1012  // Move POI's geometry without commiting changes
1014  } else if (myMovedItems.junctionToMove) {
1015  // Move Junction's geometry without commiting changes
1017  } else if (myMovedItems.edgeToMove) {
1022  } else {
1023  // move edge's geometry without commiting changes
1025  }
1027  // Move Additional geometry without commiting changes
1032  }
1033  // update view
1034  update();
1035  return 1;
1036 }
1037 
1038 
1039 long
1040 GNEViewNet::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
1041  return GUISUMOAbstractView::onKeyPress(o, sel, eventData);
1042 }
1043 
1044 
1045 long
1046 GNEViewNet::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
1047  if (mySelectingArea.selectingUsingRectangle && ((((FXEvent*)eventData)->state & SHIFTMASK) == false)) {
1049  update();
1050  }
1051  return GUISUMOAbstractView::onKeyRelease(o, sel, eventData);
1052 }
1053 
1054 
1055 void
1056 GNEViewNet::abortOperation(bool clearSelection) {
1057  // steal focus from any text fields
1058  setFocus();
1059  if (myCreateEdgeSource != nullptr) {
1060  // remove current created edge source
1062  myCreateEdgeSource = 0;
1063  } else if (myEditMode == GNE_MODE_SELECT) {
1065  // check if current selection has to be cleaned
1066  if (clearSelection) {
1068  }
1069  } else if (myEditMode == GNE_MODE_CONNECT) {
1071  } else if (myEditMode == GNE_MODE_TLS) {
1073  } else if (myEditMode == GNE_MODE_MOVE) {
1075  } else if (myEditMode == GNE_MODE_POLYGON) {
1076  // abort current drawing
1078  } else if (myEditMode == GNE_MODE_PROHIBITION) {
1080  }
1081  myUndoList->p_abort();
1082 }
1083 
1084 
1085 void
1088  setStatusBarText("Cannot delete in this mode");
1089  } else {
1090  myUndoList->p_begin("delete selection");
1098  myUndoList->p_end();
1099  }
1100 }
1101 
1102 
1103 void
1105  if (myEditMode == GNE_MODE_CONNECT) {
1106  myViewParent->getConnectorFrame()->onCmdOK(0, 0, 0);
1107  } else if (myEditMode == GNE_MODE_TLS) {
1108  myViewParent->getTLSEditorFrame()->onCmdOK(0, 0, 0);
1109  } else if ((myEditMode == GNE_MODE_MOVE) && (myEditShapePoly != 0)) {
1110  // save edited junction's shape
1111  if (myEditShapePoly != 0) {
1112  myUndoList->p_begin("custom " + toString(myEditShapePoly->getShapeEditedElement()->getTag()) + " shape");
1115  attr = SUMO_ATTR_CUSTOMSHAPE;
1116  }
1118  myUndoList->p_end();
1120  update();
1121  }
1122  } else if (myEditMode == GNE_MODE_POLYGON) {
1124  // stop current drawing
1126  } else {
1127  // start drawing
1129  }
1130  } else if (myEditMode == GNE_MODE_CROSSING) {
1132  }
1133 }
1134 
1135 
1136 void
1138  // if there is a visible frame, set focus over it. In other case, set focus over ViewNet
1139  if (myCurrentFrame != nullptr) {
1141  } else {
1142  setFocus();
1143  }
1144 }
1145 
1146 
1147 void
1149  switch (selid) {
1152  break;
1153  case MID_GNE_SETMODE_MOVE:
1155  break;
1158  break;
1161  break;
1164  break;
1167  break;
1168  case MID_GNE_SETMODE_TLS:
1170  break;
1173  break;
1176  break;
1179  break;
1182  break;
1183  default:
1184  throw ProcessError("invalid edit mode called by hotkey");
1185  break;
1186  }
1187 }
1188 
1189 
1192  return myViewParent;
1193 }
1194 
1195 
1196 GNENet*
1198  return myNet;
1199 }
1200 
1201 
1202 GNEUndoList*
1204  return myUndoList;
1205 }
1206 
1207 
1208 EditMode
1210  return myEditMode;
1211 }
1212 
1213 
1214 FXMenuCheck*
1216  return myMenuCheckShowGrid;
1217 }
1218 
1219 
1220 const GNEAttributeCarrier*
1222  return myACUnderCursor;
1223 }
1224 
1225 
1226 void
1228  myACUnderCursor = AC;
1229 }
1230 
1231 
1232 bool
1235 }
1236 
1237 
1238 GNEJunction*
1240  GNEJunction* junction = 0;
1241  if (makeCurrent()) {
1245  if (pointed) {
1246  switch (pointed->getType()) {
1247  case GLO_JUNCTION:
1248  junction = (GNEJunction*)pointed;
1249  break;
1250  default:
1251  break;
1252  }
1253  }
1254  }
1255  return junction;
1256 }
1257 
1258 
1261  GNEConnection* connection = 0;
1262  if (makeCurrent()) {
1266  if (pointed) {
1267  switch (pointed->getType()) {
1268  case GLO_CONNECTION:
1269  connection = (GNEConnection*)pointed;
1270  break;
1271  default:
1272  break;
1273  }
1274  }
1275  }
1276  return connection;
1277 }
1278 
1279 
1280 GNECrossing*
1282  GNECrossing* crossing = 0;
1283  if (makeCurrent()) {
1287  if (pointed) {
1288  switch (pointed->getType()) {
1289  case GLO_CROSSING:
1290  crossing = (GNECrossing*)pointed;
1291  break;
1292  default:
1293  break;
1294  }
1295  }
1296  }
1297  return crossing;
1298 }
1299 
1300 GNEEdge*
1302  GNEEdge* edge = 0;
1303  if (makeCurrent()) {
1307  if (pointed) {
1308  switch (pointed->getType()) {
1309  case GLO_EDGE:
1310  edge = (GNEEdge*)pointed;
1311  break;
1312  case GLO_LANE:
1313  edge = &(((GNELane*)pointed)->getParentEdge());
1314  break;
1315  default:
1316  break;
1317  }
1318  }
1319  }
1320  return edge;
1321 }
1322 
1323 
1324 GNELane*
1326  GNELane* lane = 0;
1327  if (makeCurrent()) {
1331  if (pointed) {
1332  if (pointed->getType() == GLO_LANE) {
1333  lane = (GNELane*)pointed;
1334  }
1335  }
1336  }
1337  return lane;
1338 }
1339 
1340 
1341 std::set<GNEEdge*>
1343  std::set<GNEEdge*> result;
1344  if (makeCurrent()) {
1345  const std::vector<GUIGlID> ids = getObjectsAtPosition(getPopupPosition(), 1.0);
1346  for (auto it : ids) {
1349  if (pointed) {
1350  switch (pointed->getType()) {
1351  case GLO_EDGE:
1352  result.insert((GNEEdge*)pointed);
1353  break;
1354  case GLO_LANE:
1355  result.insert(&(((GNELane*)pointed)->getParentEdge()));
1356  break;
1357  default:
1358  break;
1359  }
1360  }
1361  }
1362  }
1363  return result;
1364 }
1365 
1366 
1369  if (makeCurrent()) {
1373  if (pointed) {
1374  return dynamic_cast<GNEAdditional*>(pointed);
1375  }
1376  }
1377  return 0;
1378 }
1379 
1380 
1381 GNEPoly*
1383  if (makeCurrent()) {
1387  if (pointed) {
1388  return dynamic_cast<GNEPoly*>(pointed);
1389  }
1390  }
1391  return 0;
1392 }
1393 
1394 
1395 GNEPOI*
1397  if (makeCurrent()) {
1401  if (pointed) {
1402  return dynamic_cast<GNEPOI*>(pointed);
1403  }
1404  }
1405  return 0;
1406 }
1407 
1408 
1409 long
1410 GNEViewNet::onCmdSetModeCreateEdge(FXObject*, FXSelector, void*) {
1412  return 1;
1413 }
1414 
1415 
1416 long
1417 GNEViewNet::onCmdSetModeMove(FXObject*, FXSelector, void*) {
1419  return 1;
1420 }
1421 
1422 
1423 long
1424 GNEViewNet::onCmdSetModeDelete(FXObject*, FXSelector, void*) {
1426  return 1;
1427 }
1428 
1429 
1430 long
1431 GNEViewNet::onCmdSetModeInspect(FXObject*, FXSelector, void*) {
1433  return 1;
1434 }
1435 
1436 
1437 long
1438 GNEViewNet::onCmdSetModeSelect(FXObject*, FXSelector, void*) {
1440  return 1;
1441 }
1442 
1443 
1444 long
1445 GNEViewNet::onCmdSetModeConnect(FXObject*, FXSelector, void*) {
1447  return 1;
1448 }
1449 
1450 
1451 long
1452 GNEViewNet::onCmdSetModeTLS(FXObject*, FXSelector, void*) {
1454  return 1;
1455 }
1456 
1457 
1458 long
1459 GNEViewNet::onCmdSetModeAdditional(FXObject*, FXSelector, void*) {
1461  return 1;
1462 }
1463 
1464 
1465 long
1466 GNEViewNet::onCmdSetModeCrossing(FXObject*, FXSelector, void*) {
1468  return 1;
1469 }
1470 
1471 
1472 long
1473 GNEViewNet::onCmdSetModePolygon(FXObject*, FXSelector, void*) {
1475  return 1;
1476 }
1477 
1478 long
1479 GNEViewNet::onCmdSetModeProhibition(FXObject*, FXSelector, void*) {
1481  return 1;
1482 }
1483 
1484 long
1485 GNEViewNet::onCmdSplitEdge(FXObject*, FXSelector, void*) {
1486  GNEEdge* edge = getEdgeAtPopupPosition();
1487  if (edge != 0) {
1489  }
1490  return 1;
1491 }
1492 
1493 
1494 long
1495 GNEViewNet::onCmdSplitEdgeBidi(FXObject*, FXSelector, void*) {
1496  std::set<GNEEdge*> edges = getEdgesAtPopupPosition();
1497  if (edges.size() != 0) {
1498  myNet->splitEdgesBidi(edges, (*edges.begin())->getSplitPos(getPopupPosition()), myUndoList);
1499  }
1500  return 1;
1501 }
1502 
1503 
1504 long
1505 GNEViewNet::onCmdReverseEdge(FXObject*, FXSelector, void*) {
1506  GNEEdge* edge = getEdgeAtPopupPosition();
1507  if (edge != 0) {
1508  myNet->reverseEdge(edge, myUndoList);
1509  }
1510  return 1;
1511 }
1512 
1513 
1514 long
1515 GNEViewNet::onCmdAddReversedEdge(FXObject*, FXSelector, void*) {
1516  GNEEdge* edge = getEdgeAtPopupPosition();
1517  if (edge != 0) {
1519  }
1520  return 1;
1521 }
1522 
1523 
1524 long
1525 GNEViewNet::onCmdEditEdgeEndpoint(FXObject*, FXSelector, void*) {
1526  GNEEdge* edge = getEdgeAtPopupPosition();
1527  if (edge != 0) {
1529  }
1530  return 1;
1531 }
1532 
1533 
1534 long
1535 GNEViewNet::onCmdResetEdgeEndpoint(FXObject*, FXSelector, void*) {
1536  GNEEdge* edge = getEdgeAtPopupPosition();
1537  if (edge != 0) {
1539  }
1540  return 1;
1541 }
1542 
1543 
1544 long
1545 GNEViewNet::onCmdStraightenEdges(FXObject*, FXSelector, void*) {
1546  GNEEdge* edge = getEdgeAtPopupPosition();
1547  if (edge != 0) {
1548  if (edge->isAttributeCarrierSelected()) {
1549  myUndoList->p_begin("straighten selected " + toString(SUMO_TAG_EDGE) + "s");
1550  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1551  for (auto it : edges) {
1552  it->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
1553  }
1554  myUndoList->p_end();
1555  } else {
1556  myUndoList->p_begin("straighten " + toString(SUMO_TAG_EDGE));
1558  myUndoList->p_end();
1559  }
1560  }
1561  return 1;
1562 }
1563 
1564 
1565 long
1566 GNEViewNet::onCmdSmoothEdges(FXObject*, FXSelector, void*) {
1567  GNEEdge* edge = getEdgeAtPopupPosition();
1568  if (edge != 0) {
1569  if (edge->isAttributeCarrierSelected()) {
1570  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1571  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1572  for (auto it : edges) {
1573  it->smooth(myUndoList);
1574  }
1575  myUndoList->p_end();
1576  } else {
1577  myUndoList->p_begin("straighten edge elevation");
1578  edge->smooth(myUndoList);
1579  myUndoList->p_end();
1580  }
1581  }
1582  return 1;
1583 }
1584 
1585 
1586 long
1587 GNEViewNet::onCmdStraightenEdgesElevation(FXObject*, FXSelector, void*) {
1588  GNEEdge* edge = getEdgeAtPopupPosition();
1589  if (edge != 0) {
1590  if (edge->isAttributeCarrierSelected()) {
1591  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1592  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1593  for (auto it : edges) {
1594  it->straightenElevation(myUndoList);
1595  }
1596  myUndoList->p_end();
1597  } else {
1598  myUndoList->p_begin("straighten edge elevation");
1600  myUndoList->p_end();
1601  }
1602  }
1603  return 1;
1604 }
1605 
1606 
1607 long
1608 GNEViewNet::onCmdSmoothEdgesElevation(FXObject*, FXSelector, void*) {
1609  GNEEdge* edge = getEdgeAtPopupPosition();
1610  if (edge != 0) {
1611  if (edge->isAttributeCarrierSelected()) {
1612  myUndoList->p_begin("smooth elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1613  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1614  for (auto it : edges) {
1615  it->smoothElevation(myUndoList);
1616  }
1617  myUndoList->p_end();
1618  } else {
1619  myUndoList->p_begin("smooth edge elevation");
1620  edge->smoothElevation(myUndoList);
1621  myUndoList->p_end();
1622  }
1623  }
1624  return 1;
1625 }
1626 
1627 
1628 long
1629 GNEViewNet::onCmdSimplifyShape(FXObject*, FXSelector, void*) {
1630  if (myEditShapePoly != 0) {
1632  update();
1633  } else {
1634  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1635  if (polygonUnderMouse) {
1636  polygonUnderMouse->simplifyShape();
1637  }
1638  }
1639  return 1;
1640 }
1641 
1642 
1643 long
1644 GNEViewNet::onCmdDeleteGeometryPoint(FXObject*, FXSelector, void*) {
1645  if (myEditShapePoly != 0) {
1647  update();
1648  } else {
1649  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1650  if (polygonUnderMouse) {
1651  polygonUnderMouse->deleteGeometryPoint(getPopupPosition());
1652  }
1653  }
1654  return 1;
1655 }
1656 
1657 
1658 long
1659 GNEViewNet::onCmdClosePolygon(FXObject*, FXSelector, void*) {
1660  if (myEditShapePoly != 0) {
1661  myEditShapePoly->closePolygon(false);
1662  update();
1663  } else {
1664  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1665  if (polygonUnderMouse) {
1666  polygonUnderMouse->closePolygon();
1667  }
1668  }
1669  return 1;
1670 }
1671 
1672 
1673 long
1674 GNEViewNet::onCmdOpenPolygon(FXObject*, FXSelector, void*) {
1675  if (myEditShapePoly != 0) {
1676  myEditShapePoly->openPolygon(false);
1677  update();
1678  } else {
1679  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1680  if (polygonUnderMouse) {
1681  polygonUnderMouse->openPolygon();
1682  }
1683  }
1684  return 1;
1685 }
1686 
1687 
1688 long
1689 GNEViewNet::onCmdSetFirstGeometryPoint(FXObject*, FXSelector, void*) {
1690  if (myEditShapePoly != 0) {
1692  update();
1693  } else {
1694  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1695  if (polygonUnderMouse) {
1696  polygonUnderMouse->changeFirstGeometryPoint(polygonUnderMouse->getVertexIndex(getPopupPosition(), false));
1697  }
1698  }
1699  return 1;
1700 }
1701 
1702 
1703 long
1704 GNEViewNet::onCmdTransformPOI(FXObject*, FXSelector, void*) {
1705  // obtain POI at popup position
1707  if (POI) {
1708  // check what type of POI will be transformed
1709  if (POI->getTag() == SUMO_TAG_POI) {
1710  // obtain lanes around POI boundary
1711  std::vector<GUIGlID> GLIDs = getObjectsInBoundary(POI->getCenteringBoundary());
1712  std::vector<GNELane*> lanes;
1713  for (auto i : GLIDs) {
1715  if (lane) {
1716  lanes.push_back(lane);
1717  }
1718  }
1719  if (lanes.empty()) {
1720  WRITE_WARNING("No lanes around " + toString(SUMO_TAG_POI) + " to attach it");
1721  } else {
1722  // obtain nearest lane to POI
1723  GNELane* nearestLane = lanes.front();
1724  double minorPosOverLane = nearestLane->getShape().nearest_offset_to_point2D(POI->getPositionInView());
1725  double minorLateralOffset = nearestLane->getShape().positionAtOffset(minorPosOverLane).distanceTo(POI->getPositionInView());
1726  for (auto i : lanes) {
1727  double posOverLane = i->getShape().nearest_offset_to_point2D(POI->getPositionInView());
1728  double lateralOffset = i->getShape().positionAtOffset(posOverLane).distanceTo(POI->getPositionInView());
1729  if (lateralOffset < minorLateralOffset) {
1730  minorPosOverLane = posOverLane;
1731  minorLateralOffset = lateralOffset;
1732  nearestLane = i;
1733  }
1734  }
1735  // obtain values of POI
1736  std::string id = POI->getID();
1737  std::string type = POI->getShapeType();
1738  RGBColor color = POI->getShapeColor();
1739  Position pos = (*POI);
1740  double layer = POI->getShapeLayer();
1741  double angle = POI->getShapeNaviDegree();
1742  std::string imgFile = POI->getShapeImgFile();
1743  bool relativePath = POI->getShapeRelativePath();
1744  double POIWidth = POI->getWidth(); // double width -> C4458
1745  double POIHeight = POI->getHeight(); // double height -> C4458
1746  // remove POI
1747  myUndoList->p_begin("attach POI into " + toString(SUMO_TAG_LANE));
1748  myNet->deleteShape(POI, myUndoList);
1749  // add POILane
1750  myNet->addPOI(id, type, color, pos, false, nearestLane->getID(), minorPosOverLane, 0, layer, angle, imgFile, relativePath, POIWidth, POIHeight);
1751  myUndoList->p_end();
1752  }
1753  } else {
1754  // obtain values of POILane
1755  std::string id = POI->getID();
1756  std::string type = POI->getShapeType();
1757  RGBColor color = POI->getShapeColor();
1758  Position pos = (*POI);
1759  double layer = POI->getShapeLayer();
1760  double angle = POI->getShapeNaviDegree();
1761  std::string imgFile = POI->getShapeImgFile();
1762  bool relativePath = POI->getShapeRelativePath();
1763  double POIWidth = POI->getWidth(); // double width -> C4458
1764  double POIWeight = POI->getHeight(); // double height -> C4458
1765  // remove POI
1766  myUndoList->p_begin("release POI from " + toString(SUMO_TAG_LANE));
1767  myNet->deleteShape(POI, myUndoList);
1768  // add POI
1769  myNet->addPOI(id, type, color, pos, false, "", 0, 0, layer, angle, imgFile, relativePath, POIWidth, POIWeight);
1770  myUndoList->p_end();
1771  }
1772  // update view after transform
1773  update();
1774  }
1775  return 1;
1776 }
1777 
1778 
1779 long
1780 GNEViewNet::onCmdDuplicateLane(FXObject*, FXSelector, void*) {
1781  GNELane* lane = getLaneAtPopupPosition();
1782  if (lane != 0) {
1783  // when duplicating an unselected lane, keep all connections as they
1784  // are, otherwise recompute them
1785  if (lane->isAttributeCarrierSelected()) {
1786  myUndoList->p_begin("duplicate selected " + toString(SUMO_TAG_LANE) + "s");
1787  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
1788  for (auto it : lanes) {
1789  myNet->duplicateLane(it, myUndoList, true);
1790  }
1791  myUndoList->p_end();
1792  } else {
1793  myUndoList->p_begin("duplicate " + toString(SUMO_TAG_LANE));
1794  myNet->duplicateLane(lane, myUndoList, false);
1795  myUndoList->p_end();
1796  }
1797  }
1798  return 1;
1799 }
1800 
1801 
1802 long
1803 GNEViewNet::onCmdRestrictLaneSidewalk(FXObject*, FXSelector, void*) {
1804  return restrictLane(SVC_PEDESTRIAN);
1805 }
1806 
1807 
1808 long
1809 GNEViewNet::onCmdRestrictLaneBikelane(FXObject*, FXSelector, void*) {
1810  return restrictLane(SVC_BICYCLE);
1811 }
1812 
1813 
1814 long
1815 GNEViewNet::onCmdRestrictLaneBuslane(FXObject*, FXSelector, void*) {
1816  return restrictLane(SVC_BUS);
1817 }
1818 
1819 
1820 long
1821 GNEViewNet::onCmdAddRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
1823 }
1824 
1825 
1826 long
1827 GNEViewNet::onCmdAddRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
1829 }
1830 
1831 
1832 long
1833 GNEViewNet::onCmdAddRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
1834  return addRestrictedLane(SVC_BUS);
1835 }
1836 
1837 
1838 long
1839 GNEViewNet::onCmdRemoveRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
1841 }
1842 
1843 
1844 long
1845 GNEViewNet::onCmdRemoveRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
1847 }
1848 
1849 
1850 long
1851 GNEViewNet::onCmdRemoveRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
1852  return removeRestrictedLane(SVC_BUS);
1853 }
1854 
1855 
1856 long
1857 GNEViewNet::onCmdOpenAdditionalDialog(FXObject*, FXSelector, void*) {
1858  // retrieve additional under cursor
1860  // check if additional can open dialog
1861  if (addtional && GNEAttributeCarrier::getTagProperties(addtional->getTag()).hasDialog()) {
1862  addtional->openAdditionalDialog();
1863  }
1864  return 1;
1865 }
1866 
1867 
1868 bool
1870  GNELane* lane = getLaneAtPopupPosition();
1871  if (lane != 0) {
1872  // Get selected lanes
1873  std::vector<GNELane*> lanes = myNet->retrieveLanes(true); ;
1874  // Declare map of edges and lanes
1875  std::map<GNEEdge*, GNELane*> mapOfEdgesAndLanes;
1876  // Iterate over selected lanes
1877  for (auto i : lanes) {
1878  mapOfEdgesAndLanes[myNet->retrieveEdge(i->getParentEdge().getID())] = i;
1879  }
1880  // Throw warning dialog if there hare multiple lanes selected in the same edge
1881  if (mapOfEdgesAndLanes.size() != lanes.size()) {
1882  FXMessageBox::information(getApp(), MBOX_OK,
1883  "Multiple lane in the same edge selected", "%s",
1884  ("There are selected lanes that belong to the same edge.\n Only one lane per edge will be restricted for " + toString(vclass) + ".").c_str());
1885  }
1886  // If we handeln a set of lanes
1887  if (mapOfEdgesAndLanes.size() > 0) {
1888  // declare counter for number of Sidewalks
1889  int counter = 0;
1890  // iterate over selected lanes
1891  for (auto i : mapOfEdgesAndLanes) {
1892  if (i.first->hasRestrictedLane(vclass)) {
1893  counter++;
1894  }
1895  }
1896  // if all edges parent own a Sidewalk, stop function
1897  if (counter == (int)mapOfEdgesAndLanes.size()) {
1898  FXMessageBox::information(getApp(), MBOX_OK,
1899  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
1900  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
1901  return 0;
1902  } else {
1903  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
1904  // Ask confirmation to user
1905  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
1906  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
1907  (toString(mapOfEdgesAndLanes.size() - counter) + " lanes will be restricted for " + toString(vclass) + ". continue?").c_str());
1908  if (answer != 1) { //1:yes, 2:no, 4:esc
1909  // write warning if netedit is running in testing mode
1910  if (answer == 2) {
1911  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
1912  } else if (answer == 4) {
1913  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
1914  }
1915  return 0;
1916  } else {
1917  // write warning if netedit is running in testing mode
1918  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
1919  }
1920  }
1921  // begin undo operation
1922  myUndoList->p_begin("restrict lanes to " + toString(vclass));
1923  // iterate over selected lanes
1924  for (std::map<GNEEdge*, GNELane*>::iterator i = mapOfEdgesAndLanes.begin(); i != mapOfEdgesAndLanes.end(); i++) {
1925  // Transform lane to Sidewalk
1926  myNet->restrictLane(vclass, i->second, myUndoList);
1927  }
1928  // end undo operation
1929  myUndoList->p_end();
1930  } else {
1931  // If only have a single lane, start undo/redo operation
1932  myUndoList->p_begin("restrict lane to " + toString(vclass));
1933  // Transform lane to Sidewalk
1934  myNet->restrictLane(vclass, lane, myUndoList);
1935  // end undo operation
1936  myUndoList->p_end();
1937  }
1938  }
1939  return 1;
1940 }
1941 
1942 
1943 bool
1945  GNELane* lane = getLaneAtPopupPosition();
1946  if (lane != 0) {
1947  // Get selected edges
1948  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1949  // get selected lanes
1950  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
1951  // Declare set of edges
1952  std::set<GNEEdge*> setOfEdges;
1953  // Fill set of edges with vector of edges
1954  for (auto i : edges) {
1955  setOfEdges.insert(i);
1956  }
1957  // iterate over selected lanes
1958  for (auto it : lanes) {
1959  // Insert pointer to edge into set of edges (To avoid duplicates)
1960  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
1961  }
1962  // If we handeln a set of edges
1963  if (setOfEdges.size() > 0) {
1964  // declare counter for number of restrictions
1965  int counter = 0;
1966  // iterate over set of edges
1967  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
1968  // update counter if edge has already a restricted lane of type "vclass"
1969  if ((*it)->hasRestrictedLane(vclass)) {
1970  counter++;
1971  }
1972  }
1973  // if all lanes own a Sidewalk, stop function
1974  if (counter == (int)setOfEdges.size()) {
1975  FXMessageBox::information(getApp(), MBOX_OK,
1976  ("Add vclass for" + toString(vclass) + " to selected lanes").c_str(), "%s",
1977  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
1978  return 0;
1979  } else {
1980  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
1981  // Ask confirmation to user
1982  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
1983  ("Add vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
1984  (toString(setOfEdges.size() - counter) + " restrictions for " + toString(vclass) + " will be added. continue?").c_str());
1985  if (answer != 1) { //1:yes, 2:no, 4:esc
1986  // write warning if netedit is running in testing mode
1987  if (answer == 2) {
1988  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
1989  } else if (answer == 4) {
1990  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
1991  }
1992  return 0;
1993  } else {
1994  // write warning if netedit is running in testing mode
1995  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
1996  }
1997  }
1998  // begin undo operation
1999  myUndoList->p_begin("Add restrictions for " + toString(vclass));
2000  // iterate over set of edges
2001  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2002  // add Sidewalk
2003  myNet->addSRestrictedLane(vclass, *(*it), myUndoList);
2004  }
2005  // end undo operation
2006  myUndoList->p_end();
2007  } else {
2008  // If only have a single lane, start undo/redo operation
2009  myUndoList->p_begin("Add vclass for " + toString(vclass));
2010  // Add Sidewalk
2011  myNet->addSRestrictedLane(vclass, lane->getParentEdge(), myUndoList);
2012  // end undo/redo operation
2013  myUndoList->p_end();
2014  }
2015  }
2016  return 1;
2017 }
2018 
2019 
2020 bool
2022  GNELane* lane = getLaneAtPopupPosition();
2023  if (lane != 0) {
2024  // Get selected edges
2025  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2026  // get selected lanes
2027  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2028  // Declare set of edges
2029  std::set<GNEEdge*> setOfEdges;
2030  // Fill set of edges with vector of edges
2031  for (auto i : edges) {
2032  setOfEdges.insert(i);
2033  }
2034  // iterate over selected lanes
2035  for (auto it : lanes) {
2036  // Insert pointer to edge into set of edges (To avoid duplicates)
2037  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
2038  }
2039  // If we handeln a set of edges
2040  if (setOfEdges.size() > 0) {
2041  // declare counter for number of restrictions
2042  int counter = 0;
2043  // iterate over set of edges
2044  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2045  // update counter if edge has already a restricted lane of type "vclass"
2046  if ((*it)->hasRestrictedLane(vclass)) {
2047  counter++;
2048  }
2049  }
2050  // if all lanes don't own a Sidewalk, stop function
2051  if (counter == 0) {
2052  FXMessageBox::information(getApp(), MBOX_OK,
2053  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2054  ("Selected lanes and edges haven't a restriction for " + toString(vclass)).c_str());
2055  return 0;
2056  } else {
2057  WRITE_DEBUG("Opening FXMessageBox 'restrict lanes'");
2058  // Ask confirmation to user
2059  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2060  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2061  (toString(counter) + " restrictions for " + toString(vclass) + " will be removed. continue?").c_str());
2062  if (answer != 1) { //1:yes, 2:no, 4:esc
2063  // write warning if netedit is running in testing mode
2064  if (answer == 2) {
2065  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'No'");
2066  } else if (answer == 4) {
2067  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2068  }
2069  return 0;
2070  } else {
2071  // write warning if netedit is running in testing mode
2072  WRITE_DEBUG("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2073  }
2074  }
2075  // begin undo operation
2076  myUndoList->p_begin("Remove restrictions for " + toString(vclass));
2077  // iterate over set of edges
2078  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2079  // add Sidewalk
2080  myNet->removeRestrictedLane(vclass, *(*it), myUndoList);
2081  }
2082  // end undo operation
2083  myUndoList->p_end();
2084  } else {
2085  // If only have a single lane, start undo/redo operation
2086  myUndoList->p_begin("Remove vclass for " + toString(vclass));
2087  // Remove Sidewalk
2089  // end undo/redo operation
2090  myUndoList->p_end();
2091  }
2092  }
2093  return 1;
2094 }
2095 
2096 
2097 void
2098 GNEViewNet::processClick(FXEvent* e, void* eventData) {
2099  // process click
2100  destroyPopup();
2101  setFocus();
2102  myChanger->onLeftBtnPress(eventData);
2103  grab();
2104  // Check there are double click
2105  if (e->click_count == 2) {
2106  handle(this, FXSEL(SEL_DOUBLECLICKED, 0), eventData);
2107  }
2108 }
2109 
2110 
2111 long
2112 GNEViewNet::onCmdEditJunctionShape(FXObject*, FXSelector, void*) {
2113  // Obtain junction under mouse
2115  if (junction) {
2116  if (!OptionsCont::getOptions().getBool("lefthand")) {
2117  // for lefthand networks, the shape is already computed in GNELoadThread::run()
2118  // computing it here does not work because the network needs to be
2119  // mirrored before and after
2120  junction->getNBNode()->computeNodeShape(-1);
2121  } else if (junction->getNBNode()->getShape().size() == 0) {
2122  // recompute the whole network
2124  }
2125  PositionVector nodeShape = junction->getNBNode()->getShape();
2126  nodeShape.closePolygon();
2127  startEditCustomShape(junction, nodeShape, true);
2128  }
2129  // destroy pop-up and set focus in view net
2130  destroyPopup();
2131  setFocus();
2132  return 1;
2133 }
2134 
2135 
2136 long
2137 GNEViewNet::onCmdReplaceJunction(FXObject*, FXSelector, void*) {
2139  if (junction != 0) {
2141  update();
2142  }
2143  // destroy pop-up and set focus in view net
2144  destroyPopup();
2145  setFocus();
2146  return 1;
2147 }
2148 
2149 
2150 long
2151 GNEViewNet::onCmdSplitJunction(FXObject*, FXSelector, void*) {
2153  if (junction != 0) {
2154  myNet->splitJunction(junction, myUndoList);
2155  update();
2156  }
2157  // destroy pop-up and set focus in view net
2158  destroyPopup();
2159  setFocus();
2160  return 1;
2161 }
2162 
2163 
2164 long
2165 GNEViewNet::onCmdClearConnections(FXObject*, FXSelector, void*) {
2167  if (junction != 0) {
2168  // check if we're handling a selection
2169  if (junction->isAttributeCarrierSelected()) {
2170  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2171  myUndoList->p_begin("clear connections of selected junctions");
2172  for (auto i : selectedJunction) {
2174  }
2175  myUndoList->p_end();
2176  } else {
2178  }
2179  update();
2180  }
2181  // destroy pop-up and set focus in view net
2182  destroyPopup();
2183  setFocus();
2184  return 1;
2185 }
2186 
2187 
2188 long
2189 GNEViewNet::onCmdResetConnections(FXObject*, FXSelector, void*) {
2191  if (junction != 0) {
2192  // check if we're handling a selection
2193  if (junction->isAttributeCarrierSelected()) {
2194  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2195  myUndoList->p_begin("reset connections of selected junctions");
2196  for (auto i : selectedJunction) {
2198  }
2199  myUndoList->p_end();
2200  } else {
2202  }
2203  update();
2204  }
2205  // destroy pop-up and set focus in view net
2206  destroyPopup();
2207  setFocus();
2208  return 1;
2209 }
2210 
2211 
2212 long
2213 GNEViewNet::onCmdEditConnectionShape(FXObject*, FXSelector, void*) {
2214  // Obtain connection under mouse
2216  if (connection) {
2217  startEditCustomShape(connection, connection->getShape(), false);
2218  }
2219  // destroy pop-up and update view Net
2220  destroyPopup();
2221  setFocus();
2222  return 1;
2223 }
2224 
2225 
2226 long
2227 GNEViewNet::onCmdEditCrossingShape(FXObject*, FXSelector, void*) {
2228  // Obtain crossing under mouse
2230  if (crossing) {
2231  // due crossings haven two shapes, check what has to be edited
2232  PositionVector shape = crossing->getNBCrossing()->customShape.size() > 0 ? crossing->getNBCrossing()->customShape : crossing->getNBCrossing()->shape;
2233  startEditCustomShape(crossing, shape, false);
2234  }
2235  // destroy pop-up and update view Net
2236  destroyPopup();
2237  setFocus();
2238  return 1;
2239 }
2240 
2241 
2242 long
2243 GNEViewNet::onCmdToogleShowConnection(FXObject*, FXSelector, void*) {
2244  if (!myShowConnections) {
2246  myShowConnections = true;
2247  }
2249  // Update viewnNet to show/hide conections
2250  update();
2251  // Hide/show connections requiere recompute
2252  getNet()->requireRecompute();
2253  return 1;
2254 }
2255 
2256 
2257 long
2258 GNEViewNet::onCmdToogleSelectEdges(FXObject*, FXSelector, void*) {
2259  if (myMenuCheckSelectEdges->getCheck()) {
2260  mySelectEdges = true;
2261  } else {
2262  mySelectEdges = false;
2263  }
2264  return 1;
2265 }
2266 
2267 
2268 long
2269 GNEViewNet::onCmdToogleShowBubbles(FXObject*, FXSelector, void*) {
2270  // Update view net Shapes
2271  update();
2272  return 1;
2273 }
2274 
2275 
2276 long
2277 GNEViewNet::onCmdShowGrid(FXObject*, FXSelector, void*) {
2278  // show or hidde grid depending of myMenuCheckShowGrid
2279  if (myMenuCheckShowGrid->getCheck()) {
2281  } else {
2283  }
2284  update();
2285  return 1;
2286 }
2287 
2288 
2289 // ===========================================================================
2290 // private
2291 // ===========================================================================
2292 
2293 void
2295  if (mode == myEditMode) {
2296  setStatusBarText("Mode already selected");
2297  if (myCurrentFrame != nullptr) {
2299  }
2301  setStatusBarText("save modifications in TLS before change mode");
2303  } else {
2304  setStatusBarText("");
2305  abortOperation(false);
2306  // stop editing of custom shapes
2308  // set edit mode
2309  myEditMode = mode;
2310  switch (mode) {
2311  case GNE_MODE_CONNECT:
2312  case GNE_MODE_PROHIBITION:
2313  case GNE_MODE_TLS:
2314  // modes which depend on computed data
2316  break;
2317  default:
2318  break;
2319  }
2321  }
2322 }
2323 
2324 
2325 void
2327  // initialize mappings
2328  myEditModeNames.insert("(e) Create Edge", GNE_MODE_CREATE_EDGE);
2329  myEditModeNames.insert("(m) Move", GNE_MODE_MOVE);
2330  myEditModeNames.insert("(d) Delete", GNE_MODE_DELETE);
2331  myEditModeNames.insert("(i) Inspect", GNE_MODE_INSPECT);
2332  myEditModeNames.insert("(s) Select", GNE_MODE_SELECT);
2333  myEditModeNames.insert("(c) Connect", GNE_MODE_CONNECT);
2334  myEditModeNames.insert("(t) Traffic Lights", GNE_MODE_TLS);
2335  myEditModeNames.insert("(a) Additionals", GNE_MODE_ADDITIONAL);
2336  myEditModeNames.insert("(r) Crossings", GNE_MODE_CROSSING);
2337  myEditModeNames.insert("(p) Polygons", GNE_MODE_POLYGON);
2338  myEditModeNames.insert("(w) Prohibitions", GNE_MODE_PROHIBITION);
2339 
2340  // initialize buttons for modes
2341  myEditModeCreateEdge = new MFXCheckableButton(false, myToolbar, "\tset create edge mode\tMode for creating junction and edges.",
2343  myEditModeMove = new MFXCheckableButton(false, myToolbar, "\tset move mode\tMode for move elements.",
2345  myEditModeDelete = new MFXCheckableButton(false, myToolbar, "\tset delete mode\tMode for delete elements.",
2347  myEditModeInspect = new MFXCheckableButton(false, myToolbar, "\tset inspect mode\tMode for inspect elements and change their attributes.",
2349  myEditModeSelect = new MFXCheckableButton(false, myToolbar, "\tset select mode\tMode for select elements.",
2351  myEditModeConnection = new MFXCheckableButton(false, myToolbar, "\tset connection mode\tMode for edit connections between lanes.",
2353  myEditModeProhibition = new MFXCheckableButton(false, myToolbar, "\tset prohibition mode\tMode for editing connection prohibitions.",
2355  myEditModeTrafficLight = new MFXCheckableButton(false, myToolbar, "\tset traffic light mode\tMode for edit traffic lights over junctions.",
2357  myEditModeAdditional = new MFXCheckableButton(false, myToolbar, "\tset additional mode\tMode for adding additional elements.",
2359  myEditModeCrossing = new MFXCheckableButton(false, myToolbar, "\tset crossing mode\tMode for creating crossings between edges.",
2361  myEditModePolygon = new MFXCheckableButton(false, myToolbar, "\tset polygon mode\tMode for creating polygons and POIs.",
2363 
2364  // @ToDo add here new FXToolBarGrip(myNavigationToolBar, nullptr, 0, GUIDesignToolbarGrip);
2365 
2366  // initialize mode specific controls
2367  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);
2368  myChainCreateEdge->setCheck(false);
2369 
2370  myAutoCreateOppositeEdge = new FXMenuCheck(myToolbar, ("Two-way\t\tAutomatically create an " + toString(SUMO_TAG_EDGE) + " in the opposite direction").c_str(), this, 0);
2371  myAutoCreateOppositeEdge->setCheck(false);
2372 
2373  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);
2374  myMenuCheckSelectEdges->setCheck(true);
2375 
2376  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);
2378 
2379  myMenuCheckHideConnections = new FXMenuCheck(myToolbar,
2380  "Hide connections\t\tHide connections", this, 0);
2381  myMenuCheckHideConnections->setCheck(false);
2382 
2383  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);
2384 
2385  myMenuCheckWarnAboutMerge = new FXMenuCheck(myToolbar, ("Ask for merge\t\tAsk for confirmation before merging " + toString(SUMO_TAG_JUNCTION) + ".").c_str(), this, 0);
2386  myMenuCheckWarnAboutMerge->setCheck(true);
2387 
2388  myMenuCheckShowBubbleOverJunction = new FXMenuCheck(myToolbar, ("Bubbles\t\tShow bubbles over " + toString(SUMO_TAG_JUNCTION) + "'s shapes.").c_str(), this, MID_GNE_VIEWNET_SHOW_BUBBLES);
2389  myMenuCheckShowBubbleOverJunction->setCheck(false);
2390 
2391  myMenuCheckMoveElevation = new FXMenuCheck(myToolbar, "Elevation\t\tApply mouse movement to elevation instead of x,y position", this, MID_GNE_VIEWNET_MOVE_ELEVATION);
2392  myMenuCheckMoveElevation->setCheck(false);
2393 
2394  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);
2395  myMenuCheckChangeAllPhases->setCheck(false);
2396 
2397  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);
2398  myMenuCheckShowGrid->setCheck(false);
2399 }
2400 
2401 
2402 void
2404  // hide grid
2406  // hide all controls (checkboxs)
2407  myChainCreateEdge->hide();
2408  myAutoCreateOppositeEdge->hide();
2409  myMenuCheckSelectEdges->hide();
2414  myMenuCheckWarnAboutMerge->hide();
2416  myMenuCheckMoveElevation->hide();
2417  myMenuCheckShowGrid->hide();
2418  // unckeck all edit modes
2420  myEditModeMove->setChecked(false);
2421  myEditModeDelete->setChecked(false);
2422  myEditModeInspect->setChecked(false);
2423  myEditModeSelect->setChecked(false);
2428  myEditModePolygon->setChecked(false);
2431  // enable selected controls
2432  switch (myEditMode) {
2433  case GNE_MODE_CREATE_EDGE:
2434  myChainCreateEdge->show();
2435  myAutoCreateOppositeEdge->show();
2437  myMenuCheckShowGrid->show();
2438  break;
2439  case GNE_MODE_MOVE:
2440  myMenuCheckWarnAboutMerge->show();
2442  myMenuCheckMoveElevation->show();
2443  myEditModeMove->setChecked(true);
2444  myMenuCheckShowGrid->show();
2445  break;
2446  case GNE_MODE_DELETE:
2451  myMenuCheckSelectEdges->show();
2453  break;
2454  case GNE_MODE_INSPECT:
2458  myMenuCheckSelectEdges->show();
2461  break;
2462  case GNE_MODE_SELECT:
2466  myMenuCheckSelectEdges->show();
2470  break;
2471  case GNE_MODE_CONNECT:
2477  break;
2478  case GNE_MODE_TLS:
2484  break;
2485  case GNE_MODE_ADDITIONAL:
2490  myMenuCheckShowGrid->show();
2491  break;
2492  case GNE_MODE_CROSSING:
2497  myMenuCheckShowGrid->setCheck(false);
2498  break;
2499  case GNE_MODE_POLYGON:
2504  myMenuCheckShowGrid->show();
2505  break;
2506  case GNE_MODE_PROHIBITION:
2511  break;
2512  default:
2513  break;
2514  }
2515  // Update buttons
2516  myEditModeCreateEdge->update();
2517  myEditModeMove->update();
2518  myEditModeDelete->update();
2519  myEditModeInspect->update();
2520  myEditModeSelect->update();
2521  myEditModeConnection->update();
2522  myEditModeTrafficLight->update();
2523  myEditModeAdditional->update();
2524  myEditModeCrossing->update();
2525  myEditModePolygon->update();
2526  myEditModeProhibition->update();
2527  // force repaint because different modes draw different things
2528  myToolbar->recalc();
2529  onPaint(0, 0, 0);
2530  update();
2531 }
2532 
2533 
2534 void
2536  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions(true);
2537  if (junctions.size() > 0) {
2538  std::string plural = junctions.size() == 1 ? ("") : ("s");
2539  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_JUNCTION) + plural);
2540  for (auto i : junctions) {
2542  }
2543  myUndoList->p_end();
2544  }
2545 }
2546 
2547 
2548 void
2550  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2551  if (lanes.size() > 0) {
2552  std::string plural = lanes.size() == 1 ? ("") : ("s");
2553  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_LANE) + plural);
2554  for (auto i : lanes) {
2555  // when deleting multiple lanes, recompute connections
2556  myNet->deleteLane(i, myUndoList, true);
2557  }
2558  myUndoList->p_end();
2559  }
2560 }
2561 
2562 
2563 void
2565  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2566  if (edges.size() > 0) {
2567  std::string plural = edges.size() == 1 ? ("") : ("s");
2568  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_EDGE) + plural);
2569  for (auto i : edges) {
2570  // when deleting multiple edges, recompute connections
2571  myNet->deleteEdge(i, myUndoList, true);
2572  }
2573  myUndoList->p_end();
2574  }
2575 }
2576 
2577 
2578 void
2580  std::vector<GNEAdditional*> additionals = myNet->retrieveAdditionals(true);
2581  if (additionals.size() > 0) {
2582  std::string plural = additionals.size() == 1 ? ("") : ("s");
2583  myUndoList->p_begin("delete selected additional" + plural);
2584  for (auto i : additionals) {
2585  // due there are additionals that are removed when their parent is removed, we need to check if yet exists before removing
2586  if (myNet->retrieveAdditional(i->getTag(), i->getID(), false) != nullptr) {
2588  }
2589  }
2590  myUndoList->p_end();
2591  }
2592 }
2593 
2594 
2595 
2596 void
2598  // obtain selected crossings
2599  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions();
2600  std::vector<GNECrossing*> crossings;
2601  for (auto i : junctions) {
2602  for (auto j : i->getGNECrossings()) {
2603  if (j->isAttributeCarrierSelected()) {
2604  crossings.push_back(j);
2605  }
2606  }
2607  }
2608  // remove selected crossings
2609  if (crossings.size() > 0) {
2610  std::string plural = crossings.size() == 1 ? ("") : ("s");
2611  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CROSSING) + "s");
2612  for (auto i : crossings) {
2613  if (myNet->retrieveCrossing(i->getID(), false)) {
2615  }
2616  }
2617  myUndoList->p_end();
2618  }
2619 }
2620 
2621 
2622 void
2624  // obtain selected connections
2625  std::vector<GNEEdge*> edges = myNet->retrieveEdges();
2626  std::vector<GNEConnection*> connections;
2627  for (auto i : edges) {
2628  for (auto j : i->getGNEConnections()) {
2629  if (j->isAttributeCarrierSelected()) {
2630  connections.push_back(j);
2631  }
2632  }
2633  }
2634  // remove selected connections
2635  if (connections.size() > 0) {
2636  std::string plural = connections.size() == 1 ? ("") : ("s");
2637  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CONNECTION) + plural);
2638  for (auto i : connections) {
2640  }
2641  myUndoList->p_end();
2642  }
2643 }
2644 
2645 
2646 void
2648  // obtain selected shapes
2649  std::vector<GNEShape*> selectedShapes = myNet->retrieveShapes(true);
2650  // remove it
2651  if (selectedShapes.size() > 0) {
2652  std::string plural = selectedShapes.size() == 1 ? ("") : ("s");
2653  myUndoList->p_begin("delete selected shape" + plural);
2654  for (auto i : selectedShapes) {
2656  }
2657  myUndoList->p_end();
2658  }
2659 }
2660 
2661 
2662 bool
2664  const Position& newPos = moved->getNBNode()->getPosition();
2665  GNEJunction* mergeTarget = 0;
2666  // try to find another junction to merge with
2667  if (makeCurrent()) {
2668  Boundary selection;
2669  selection.add(newPos);
2670  selection.grow(0.1);
2671  const std::vector<GUIGlID> ids = getObjectsInBoundary(selection);
2672  GUIGlObject* object = 0;
2673  for (auto it_ids : ids) {
2674  if (it_ids == 0) {
2675  continue;
2676  }
2678  if (!object) {
2679  throw ProcessError("Unkown object in selection (id=" + toString(it_ids) + ").");
2680  }
2681  if ((object->getType() == GLO_JUNCTION) && (it_ids != moved->getGlID())) {
2682  mergeTarget = dynamic_cast<GNEJunction*>(object);
2683  }
2685  }
2686  }
2687  if (mergeTarget) {
2688  // optionally ask for confirmation
2689  if (myMenuCheckWarnAboutMerge->getCheck()) {
2690  WRITE_DEBUG("Opening FXMessageBox 'merge junctions'");
2691  // open question box
2692  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO,
2693  "Confirm Junction Merger", "%s",
2694  ("Do you wish to merge junctions '" + moved->getMicrosimID() +
2695  "' and '" + mergeTarget->getMicrosimID() + "'?\n" +
2696  "('" + moved->getMicrosimID() +
2697  "' will be eliminated and its roads added to '" +
2698  mergeTarget->getMicrosimID() + "')").c_str());
2699  if (answer != 1) { //1:yes, 2:no, 4:esc
2700  // write warning if netedit is running in testing mode
2701  if (answer == 2) {
2702  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'No'");
2703  } else if (answer == 4) {
2704  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'ESC'");
2705  }
2706  return false;
2707  } else {
2708  // write warning if netedit is running in testing mode
2709  WRITE_DEBUG("Closed FXMessageBox 'merge junctions' with 'Yes'");
2710  }
2711  }
2712  // restore previous position of junction moved
2713  moved->moveGeometry(oldPos, Position(0, 0));
2714  // merge moved and targed junctions
2715  myNet->mergeJunctions(moved, mergeTarget, myUndoList);
2716  return true;
2717  } else {
2718  return false;
2719  }
2720 }
2721 
2722 
2723 void
2725  switch (myEditMode) {
2726  case GNE_MODE_INSPECT:
2727  myViewParent->getInspectorFrame()->update();
2728  break;
2729  default:
2730  break;
2731  }
2732 }
2733 
2734 void
2736  // first reset all variables
2737  eventInfo = nullptr;
2738  glType = GLO_NETWORK;
2739  attributeCarrier = nullptr;
2740  netElement = nullptr;
2741  additional = nullptr;
2742  shape = nullptr;
2743  junction = nullptr;
2744  edge = nullptr;
2745  lane = nullptr;
2746  crossing = nullptr;
2747  connection = nullptr;
2748  poi = nullptr;
2749  poly = nullptr;
2750  // set event
2751  eventInfo = ev;
2752  // set GLID of object under cursor
2753  glID = glIDObject;
2754  // only continue if isn't 0
2755  if (glID == 0) {
2756  return;
2757  }
2758  // obtain glObject associated to these glID
2761  // only continue if glObject isn't nullptr;
2762  if (glObject == nullptr) {
2763  return;
2764  }
2765  // set glType
2766  glType = glObject->getType();
2767  // cast attribute carrier from glObject
2768  attributeCarrier = dynamic_cast<GNEAttributeCarrier*>(glObject);
2769  // only continue if attributeCarrier isn't nullptr;
2770  if (attributeCarrier == nullptr) {
2771  return;
2772  }
2773  // If we're editing a shape, ignore rest of elements (including other polygons)
2774  if (editedPolyShape != nullptr) {
2775  if (attributeCarrier == editedPolyShape) {
2776  // cast Poly from attribute carrier
2777  poly = dynamic_cast<GNEPoly*>(attributeCarrier);
2778  }
2779  } else {
2780  // obtain tag property (only for improve code legibility)
2781  const auto& tagValue = GNEAttributeCarrier::getTagProperties(attributeCarrier->getTag());
2782  // check if attributeCarrier can be casted into netElement, additional or shape
2783  if (tagValue.isNetElement()) {
2784  // cast netElement from attribute carrier
2785  netElement = dynamic_cast<GNENetElement*>(attributeCarrier);
2786  } else if (tagValue.isAdditional()) {
2787  // cast additional element from attribute carrier
2788  additional = dynamic_cast<GNEAdditional*>(attributeCarrier);
2789  } else if (tagValue.isShape()) {
2790  // cast shape element from attribute carrier
2791  shape = dynamic_cast<GNEShape*>(attributeCarrier);
2792  } else {
2793  // element isn't specified, then stop
2794  return;
2795  }
2796  // now set specify AC type
2797  switch (glObject->getType()) {
2798  case GLO_JUNCTION:
2799  junction = dynamic_cast<GNEJunction*>(attributeCarrier);
2800  break;
2801  case GLO_EDGE:
2802  edge = dynamic_cast<GNEEdge*>(attributeCarrier);
2803  break;
2804  case GLO_LANE:
2805  lane = dynamic_cast<GNELane*>(attributeCarrier);
2806  break;
2807  case GLO_POI:
2808  poi = dynamic_cast<GNEPOI*>(attributeCarrier);
2809  break;
2810  case GLO_POLYGON:
2811  poly = dynamic_cast<GNEPoly*>(attributeCarrier);
2812  break;
2813  case GLO_CROSSING:
2814  crossing = dynamic_cast<GNECrossing*>(attributeCarrier);
2815  break;
2816  case GLO_CONNECTION:
2817  connection = dynamic_cast<GNEConnection*>(attributeCarrier);
2818  break;
2819  default:
2820  break;
2821  }
2822  }
2823 }
2824 
2825 
2826 void
2828  if (lane) {
2829  edge = &lane->getParentEdge();
2830  netElement = edge;
2831  attributeCarrier = edge;
2832  glType = GLO_EDGE;
2833  }
2834 }
2835 
2836 
2837 bool
2839  if (eventInfo) {
2840  return (eventInfo->state & SHIFTMASK) != 0;
2841  } else {
2842  return false;
2843  }
2844 }
2845 
2846 
2847 bool
2849  if (eventInfo) {
2850  return (eventInfo->state & CONTROLMASK) != 0;
2851  } else {
2852  return false;
2853  }
2854 }
2855 
2856 
2857 void
2859  selectingUsingRectangle = false;
2860  // shift held down on mouse-down and mouse-up
2861  if (shiftKeyPressed) {
2862  if (viewNet->makeCurrent()) {
2863  Boundary b;
2864  b.add(selectionCorner1);
2865  b.add(selectionCorner2);
2866  std::vector<GUIGlID> ids = viewNet->getObjectsInBoundary(b);
2867  // 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
2868  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACInRectangles;
2869  for (auto i : ids) {
2870  // avoid to select Net (i = 0)
2871  if (i != 0) {
2872  GNEAttributeCarrier* retrievedAC = viewNet->myNet->retrieveAttributeCarrier(i);
2873  // in the case of a Lane, we need to change the retrieved lane to their the parent if mySelectEdges is enabled
2874  if ((retrievedAC->getTag() == SUMO_TAG_LANE) && viewNet->mySelectEdges) {
2875  retrievedAC = &dynamic_cast<GNELane*>(retrievedAC)->getParentEdge();
2876  }
2877  // make sure that AttributeCarrier can be selected
2878  GUIGlObject* glObject = dynamic_cast<GUIGlObject*>(retrievedAC);
2879  if (glObject && !viewNet->getViewParent()->getSelectorFrame()->getLockGLObjectTypes()->IsObjectTypeLocked(glObject->getType())) {
2880  ACInRectangles.insert(std::make_pair(retrievedAC->getID(), retrievedAC));
2881  }
2882  }
2883  }
2884  // declare two sets of attribute carriers, one for select and another for unselect
2885  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToSelect;
2886  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACToUnselect;
2887  // in restrict AND replace mode all current selected attribute carriers will be unselected
2890  for (auto i : viewNet->myNet->getSelectedAttributeCarriers()) {
2891  ACToUnselect.insert(std::make_pair(i->getID(), i));
2892  }
2893  }
2894  // iterate over AtributeCarriers obtained of rectangle an place it in ACToSelect or ACToUnselect
2895  for (auto i : ACInRectangles) {
2898  ACToUnselect.insert(i);
2899  break;
2901  if (ACToUnselect.find(i) != ACToUnselect.end()) {
2902  ACToSelect.insert(i);
2903  }
2904  break;
2905  default:
2906  ACToSelect.insert(i);
2907  break;
2908  }
2909  }
2910  // select junctions and their connections and crossings if Auto select junctions is enabled (note: only for "add mode")
2912  std::vector<GNEEdge*> edgesToSelect;
2913  // iterate over ACToSelect and extract edges
2914  for (auto i : ACToSelect) {
2915  if (i.second->getTag() == SUMO_TAG_EDGE) {
2916  edgesToSelect.push_back(dynamic_cast<GNEEdge*>(i.second));
2917  }
2918  }
2919  // iterate over extracted edges
2920  for (auto i : edgesToSelect) {
2921  // select junction source and all their connections and crossings
2922  ACToSelect.insert(std::make_pair(i->getGNEJunctionSource()->getID(), i->getGNEJunctionSource()));
2923  for (auto j : i->getGNEJunctionSource()->getGNEConnections()) {
2924  ACToSelect.insert(std::make_pair(j->getID(), j));
2925  }
2926  for (auto j : i->getGNEJunctionSource()->getGNECrossings()) {
2927  ACToSelect.insert(std::make_pair(j->getID(), j));
2928  }
2929  // select junction destiny and all their connections crossings
2930  ACToSelect.insert(std::make_pair(i->getGNEJunctionDestiny()->getID(), i->getGNEJunctionDestiny()));
2931  for (auto j : i->getGNEJunctionDestiny()->getGNEConnections()) {
2932  ACToSelect.insert(std::make_pair(j->getID(), j));
2933  }
2934  for (auto j : i->getGNEJunctionDestiny()->getGNECrossings()) {
2935  ACToSelect.insert(std::make_pair(j->getID(), j));
2936  }
2937  }
2938  }
2939  // only continue if there is ACs to select or unselect
2940  if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
2941  // first unselect AC of ACToUnselect and then selects AC of ACToSelect
2942  viewNet->myUndoList->p_begin("selection using rectangle");
2943  for (auto i : ACToUnselect) {
2944  i.second->setAttribute(GNE_ATTR_SELECTED, "false", viewNet->myUndoList);
2945  }
2946  for (auto i : ACToSelect) {
2947  if (GNEAttributeCarrier::getTagProperties(i.second->getTag()).isSelectable()) {
2948  i.second->setAttribute(GNE_ATTR_SELECTED, "true", viewNet->myUndoList);
2949  }
2950  }
2951  viewNet->myUndoList->p_end();
2952  }
2953  viewNet->makeNonCurrent();
2954  }
2955  }
2956 }
2957 
2958 std::string
2960  return ("Selection width:" + toString(fabs(selectionCorner1.x() - selectionCorner2.x()))
2961  + " height:" + toString(fabs(selectionCorner1.y() - selectionCorner2.y()))
2962  + " diagonal:" + toString(selectionCorner1.distanceTo2D(selectionCorner2)));
2963 }
2964 
2965 /****************************************************************************/
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:361
long onCmdAddRestrictedLaneSidewalk(FXObject *, FXSelector typeOfTransformation, void *)
Add restricted lane for pedestrians.
GNEJunction * splitEdge(GNEEdge *edge, const Position &pos, GNEUndoList *undoList, GNEJunction *newJunction=0)
split edge at position by inserting a new junction
Definition: GNENet.cpp:676
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:270
remove inner geometry
Definition: GUIAppEnum.h:694
long onCmdResetEdgeEndpoint(FXObject *, FXSelector, void *)
change geometry endpoint
GNEViewParent * myViewParent
view parent
Definition: GNEViewNet.h:564
virtual void openAdditionalDialog()
open Additional Dialog
FXMenuCheck * getMenuCheckShowGrid() const
get grid button
void paintGLGrid()
paints a grid
testingMode myTestingMode
variable used to save variables related with testing mode
Definition: GNEViewNet.h:634
GNEPoly * polyToMove
the poly of which geometry is being moved
Definition: GNEViewNet.h:412
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1099
void processSelection(GNEViewNet *viewNet, bool shiftKeyPressed)
Process Selection.
long onCmdRestrictLaneBikelane(FXObject *, FXSelector typeOfTransformation, void *)
restrict lane to bikes
a tl-logic
GNEEdge * edgeToMove
the edge of which geometry is being moved
Definition: GNEViewNet.h:409
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:1051
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:317
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_MODE_INSPECT
void openPolygon(bool allowUndo=true)
open polygon
Definition: GNEPoly.cpp:446
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:907
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:495
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:254
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:1681
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:960
bool myShowConnections
whether show connections has been activated once
Definition: GNEViewNet.h:594
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:698
long onMouseMove(FXObject *, FXSelector, void *)
called when user moves mouse
Definition: GNEViewNet.cpp:984
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:625
The main window of the Netedit.
void beginMoveSelection(GNEAttributeCarrier *originAC, const Position &originPosition)
begin move selection
Definition: GNEViewNet.cpp:391
SetOperation getModificationMode() const
get current modification mode
bool mySelectEdges
flag to check if select edges is enabled
Definition: GNEViewNet.h:597
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:486
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
std::map< GNEEdge *, MovingEdges > myOriginShapesMovedPartialShapes
Definition: GNEViewNet.h:652
void hotkeyFocusFrame()
handle focus frame keypress
const GNEAttributeCarrier * myACUnderCursor
current AttributeCarrier under Mouse position
Definition: GNEViewNet.h:708
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:591
void stopEditCustomShape()
edit edit shape
Definition: GNEViewNet.cpp:377
edit junction shape
Definition: GUIAppEnum.h:740
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:430
void straightenElevation(GNEUndoList *undoList)
interpolate z values linear between junctions
Definition: GNEEdge.cpp:1586
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:605
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:1173
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
const double SUMO_const_laneWidth
Definition: StdDefs.h:43
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:628
split an edge
Definition: GUIAppEnum.h:704
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:536
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:673
long onCmdOpenPolygon(FXObject *, FXSelector, void *)
open closed polygon
GNEConnection * connection
connection
Definition: GNEViewNet.h:513
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:753
mode for editing additional
Definition: GUIAppEnum.h:493
bool movingStartPos
bool to indicate that startPos are being moved
Definition: GNEViewNet.h:440
GNEAdditional * getAdditionalAtPopupPosition()
try to retrieve a additional at popup position
void smooth(GNEUndoList *undoList)
make geometry smooth
Definition: GNEEdge.cpp:1669
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:622
static const RGBColor ORANGE
Definition: RGBColor.h:178
MFXCheckableButton * myEditModeMove
chekable button for edit mode move
Definition: GNEViewNet.h:664
T MAX2(T a, T b)
Definition: StdDefs.h:68
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:775
int movingIndexShape
current index of shape that are being moved
Definition: GNEViewNet.h:444
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction&#39;s connections
Definition: GNENet.cpp:1703
MFXCheckableButton * myEditModeDelete
chekable button for edit mode delete
Definition: GNEViewNet.h:667
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:436
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 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.
MFXCheckableButton * myEditModeProhibition
checkable button for edit mode polygon
Definition: GNEViewNet.h:691
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
void moveSelection(const Position &offset)
move selection
Definition: GNEViewNet.cpp:462
void commitShapeStartChange(const Position &oldPos, GNEUndoList *undoList)
commit position changing in shape start
Definition: GNEEdge.cpp:188
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:716
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers()
get all selected attribute carriers
Definition: GNENet.cpp:1743
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:764
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
std::map< GNEJunction *, Position > myOriginPositionOfMovedJunctions
Selected Junctions that are being moved.
Definition: GNEViewNet.h:641
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:588
turn junction into geometry node
Definition: GUIAppEnum.h:720
void deleteSelectedShapes()
delete all currently selected shapes
close opened polygon
Definition: GUIAppEnum.h:750
show junctions as bubbles
Definition: GUIAppEnum.h:519
GNEAdditional * additionalToMove
the stoppingPlace element which shape is being moved
Definition: GNEViewNet.h:418
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:557
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:554
FXMenuCheck * myMenuCheckHideConnections
menu check to hide connections in connect mode
Definition: GNEViewNet.h:582
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:349
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:631
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:1787
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:618
GUIGlID getObjectAtPosition(Position pos)
returns the id of the object at position using GL_SELECT
remove bikelane
Definition: GUIAppEnum.h:787
GNEUndoList * getUndoList() const
get the undoList object
void removeLastPoint()
remove last added point
long onLeftBtnPress(FXObject *, FXSelector, void *)
Definition: GNEViewNet.cpp:619
long onRightBtnRelease(FXObject *, FXSelector, void *)
called when user releases mouse&#39;s right button
Definition: GNEViewNet.cpp:973
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:781
long onCmdRemoveRestrictedLaneBuslane(FXObject *, FXSelector typeOfTransformation, void *)
remove restricted lane for bus
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:1659
void deleteSelectedConnections()
delete all currently selected connections
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
remove restricted lane
Definition: GNENet.cpp:662
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:579
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:1983
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:1230
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
virtual ~GNEViewNet()
destructor
Definition: GNEViewNet.cpp:201
GNEEdge * getEdgeAtPopupPosition()
try to retrieve an edge at popup position
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition: GNENet.cpp:528
int testingHeight
Height of viewNet in testing mode.
Definition: GNEViewNet.h:560
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:777
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:576
FXToolBar * myToolbar
a reference to the toolbar in myParent
Definition: GNEViewNet.h:656
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:661
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:229
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:355
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:337
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:62
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:119
MFXCheckableButton * myEditModeTrafficLight
chekable button for edit mode traffic light
Definition: GNEViewNet.h:679
void initGNEConnections()
initialize GNEConnections
Definition: GNENet.cpp:2396
turn junction into multiple junctions
Definition: GUIAppEnum.h:722
long onCmdRemoveRestrictedLaneBikelane(FXObject *, FXSelector typeOfTransformation, void *)
remove restricted lane for bikes
GNECrossing * crossing
crossing
Definition: GNEViewNet.h:510
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:682
GNEAttributeCarrier * attributeCarrier
attribute carrier
Definition: GNEViewNet.h:489
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:789
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:644
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:1112
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:742
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 onCmdRestrictLaneBuslane(FXObject *, FXSelector typeOfTransformation, void *)
restrict lane to buslanes
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:205
add busLane
Definition: GUIAppEnum.h:783
begin/end of the description of an edge
FXint myWindowCursorPositionX
Position of the cursor relative to the window.
FXMenuCheck * myAutoCreateOppositeEdge
Definition: GNEViewNet.h:606
long onCmdSplitJunction(FXObject *, FXSelector, void *)
split junction into multiple junctions
void setSelectionScaling(double selectionScale)
set selection scaling
Definition: GNEViewNet.cpp:343
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:670
FXMenuCheck * myMenuCheckExtendToEdgeNodes
menu check to extend to edge nodes
Definition: GNEViewNet.h:585
long onCmdClosePolygon(FXObject *, FXSelector, void *)
close opened polygon
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:617
transform lane to sidewalk
Definition: GUIAppEnum.h:773
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
Definition: GNENet.cpp:1614
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 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:1002
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:613
GNENetElement * netElement
net element
Definition: GNEViewNet.h:492
reset junction&#39;s connections
Definition: GUIAppEnum.h:718
FXMenuCheck * myMenuCheckWarnAboutMerge
whether we should warn about merging junctions
Definition: GNEViewNet.h:612
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
#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:754
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:1038
PositionVector customShape
optional customShape for this crossing
Definition: NBNode.h:147
long onCmdAddRestrictedLaneBikelane(FXObject *, FXSelector typeOfTransformation, void *)
Add restricted lane for bikes.
FXMenuCheck * myMenuCheckShowBubbleOverJunction
show connection as buuble in "Move" mode.
Definition: GNEViewNet.h:615
bool selectingUsingRectangle
whether we have started rectangle-selection
Definition: GNEViewNet.h:533
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:1799
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:676
bool showConnections()
show connections over junctions
Definition: GNEViewNet.cpp:323
GNEJunction * junction
junction
Definition: GNEViewNet.h:501
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:748
GNEPOI * poiToMove
the poi which is being moved
Definition: GNEViewNet.h:415
mode for moving things
Definition: GUIAppEnum.h:481
Position movingOriginalPosition
original Position of element before moving (needed for commmit position changes)
Definition: GNEViewNet.h:433
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:507
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:602
void abortDrawing()
abort drawing
element is selected
TemplateEditor * getTemplateEditor() const
get template editor
long onCmdOpenAdditionalDialog(FXObject *, FXSelector, void *)
open additional dialog
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:406
long onCmdAddRestrictedLaneBuslane(FXObject *, FXSelector typeOfTransformation, void *)
Add restricted lane for buses.
long onCmdRemoveRestrictedLaneSidewalk(FXObject *, FXSelector typeOfTransformation, void *)
remove restricted lane for pedestrians
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:240
duplicate a lane
Definition: GUIAppEnum.h:771
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:1286
void deleteSelectedAdditionals()
delete all currently selected additionals
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction&#39;s connections
Definition: GNENet.cpp:1691
void computeAndUpdate(OptionsCont &oc, bool volatileOptions)
recompute the network and update lane geometries
Definition: GNENet.cpp:2407
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:539
long onCmdRestrictLaneSidewalk(FXObject *, FXSelector typeOfTransformation, void *)
restrict lane to pedestrians
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:685
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:764
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:311
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:209
edit junction shape
Definition: GUIAppEnum.h:732
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:752
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:481
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:637
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:2000
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
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:797
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:713
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 setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEEdge.cpp:932
C++ TraCI client API implementation.
bool addSRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
add restricted lane to edge
Definition: GNENet.cpp:647
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:567
void hotkeyEnter()
handle enter keypress
void startGeometryMoving()
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:914
Position getSplitPos(const Position &clickPos)
Definition: GNEEdge.cpp:592
void requireRecompute()
inform the net about the need for recomputation
Definition: GNENet.cpp:1376
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 *)
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:705
EditMode myEditMode
the current edit mode
Definition: GNEViewNet.h:570
virtual long onRightBtnRelease(FXObject *, FXSelector, void *)
bool addRestrictedLane(SUMOVehicleClass vclass)
add restricted lane
MFXCheckableButton * myEditModePolygon
chekable button for edit mode polygon
Definition: GNEViewNet.h:688
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:573
a junction
void removeSelectedAttributeCarriers()
remove selected attribute carriers (element)
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.