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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A view on the network being edited (adapted from GUIViewTraffic)
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <iostream>
32 #include <utility>
33 #include <cmath>
34 #include <limits>
38 #include <utils/common/RGBColor.h>
50 #include <utils/gui/div/GLHelper.h>
53 #include <utils/xml/XMLSubSys.h>
54 #include <netbuild/NBEdge.h>
55 #include <netbuild/NBNode.h>
56 
57 #include "GNEViewNet.h"
58 #include "GNEEdge.h"
59 #include "GNELane.h"
60 #include "GNEJunction.h"
61 #include "GNEPOI.h"
62 #include "GNEPOILane.h"
63 #include "GNEApplicationWindow.h"
64 #include "GNEViewParent.h"
65 #include "GNENet.h"
66 #include "GNEUndoList.h"
67 #include "GNEInspectorFrame.h"
68 #include "GNESelectorFrame.h"
69 #include "GNEConnectorFrame.h"
70 #include "GNETLSEditorFrame.h"
71 #include "GNEAdditionalFrame.h"
72 #include "GNECrossingFrame.h"
73 #include "GNEPolygonFrame.h"
74 #include "GNEDeleteFrame.h"
75 #include "GNEAdditionalHandler.h"
76 #include "GNEPoly.h"
77 #include "GNECrossing.h"
78 #include "GNEAdditional.h"
79 #include "GNEAdditionalDialog.h"
80 #include "GNERerouter.h"
81 #include "GNEConnection.h"
82 
83 // ===========================================================================
84 // FOX callback mapping
85 // ===========================================================================
86 FXDEFMAP(GNEViewNet) GNEViewNetMap[] = {
87  // Modes
89  FXMAPFUNC(SEL_COMMAND, MID_GNE_SETMODE_MOVE, GNEViewNet::onCmdSetModeMove),
94  FXMAPFUNC(SEL_COMMAND, MID_GNE_SETMODE_TLS, GNEViewNet::onCmdSetModeTLS),
98  // Viewnet
102  FXMAPFUNC(SEL_COMMAND, MID_GNE_VIEWNET_SHOW_GRID, GNEViewNet::onCmdShowGrid),
103  // Junctions
108  // Connections
110  // Crossings
112  // Edges
113  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SPLIT, GNEViewNet::onCmdSplitEdge),
115  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_REVERSE, GNEViewNet::onCmdReverseEdge),
120  FXMAPFUNC(SEL_COMMAND, MID_GNE_EDGE_SMOOTH, GNEViewNet::onCmdSmoothEdges),
123  // Lanes
134  // addtionals
136  // Polygons
138  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_CLOSE, GNEViewNet::onCmdClosePolygon),
139  FXMAPFUNC(SEL_COMMAND, MID_GNE_POLYGON_OPEN, GNEViewNet::onCmdOpenPolygon),
142  // POIs
143  FXMAPFUNC(SEL_COMMAND, MID_GNE_POI_TRANSFORM, GNEViewNet::onCmdTransformPOI),
144 };
145 
146 
147 // Object implementation
148 FXIMPLEMENT(GNEViewNet, GUISUMOAbstractView, GNEViewNetMap, ARRAYNUMBER(GNEViewNetMap))
149 
150 
151 // ===========================================================================
152 // member method definitions
153 // ===========================================================================
154 
155 GNEViewNet::GNEViewNet(FXComposite* tmpParent, FXComposite* actualParent, GUIMainWindow& app,
156  GNEViewParent* viewParent, GNENet* net, GNEUndoList* undoList,
157  FXGLVisual* glVis, FXGLCanvas* share, FXToolBar* toolBar) :
158  GUISUMOAbstractView(tmpParent, app, viewParent, net->getVisualisationSpeedUp(), glVis, share),
159  myViewParent(viewParent),
160  myNet(net),
161  myEditMode(GNE_MODE_MOVE),
162  myCurrentFrame(0),
163  myShowConnections(false),
164  mySelectEdges(true),
165  myCreateEdgeSource(0),
166  myJunctionToMove(0),
167  myEdgeToMove(0),
168  myOppositeEdgeToMove(0),
169  myPolyToMove(0),
170  myPoiToMove(0),
171  myPoiLaneToMove(0),
172  myAdditionalToMove(0),
173  myMovingIndexShape(-1),
174  myMovingSelection(false),
175  myAmInRectSelect(false),
176  myToolbar(toolBar),
177  myEditModeCreateEdge(0),
178  myEditModeMove(0),
179  myEditModeDelete(0),
180  myEditModeInspect(0),
181  myEditModeSelect(0),
182  myEditModeConnection(0),
183  myEditModeTrafficLight(0),
184  myEditModeAdditional(0),
185  myEditModeCrossing(0),
186  myEditModePolygon(0),
187  myEditModeNames(),
188  myUndoList(undoList),
189  myEditShapePoly(0),
190  myTestingMode(OptionsCont::getOptions().getBool("gui-testing")) {
191  // view must be the final member of actualParent
192  reparent(actualParent);
193 
194  buildEditModeControls();
195  myUndoList->mark();
196  myNet->setViewNet(this);
197 
198  ((GUIDanielPerspectiveChanger*)myChanger)->setDragDelay(100000000); // 100 milliseconds
199 
200  if (myTestingMode && OptionsCont::getOptions().isSet("window-size")) {
201  std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
202  if (windowSize.size() == 2 && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
203  myTestingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
204  myTestingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
205  } else {
206  WRITE_ERROR("Invalid windows size-format: " + toString(windowSize) + "for option'window-size'");
207  }
208  }
209 }
210 
211 
213 
214 
215 void
217 
218 
219 void
221  // build coloring tools
222  {
223  for (auto it_names : gSchemeStorage.getNames()) {
224  cw.getColoringSchemesCombo().appendItem(it_names.c_str());
225  if (it_names == myVisualizationSettings->name) {
226  cw.getColoringSchemesCombo().setCurrentItem(cw.getColoringSchemesCombo().getNumItems() - 1);
227  }
228  }
229  cw.getColoringSchemesCombo().setNumVisible(MAX2(5, (int)gSchemeStorage.getNames().size() + 1));
230  }
231  // for junctions
232  new FXButton(cw.getLocatorPopup(),
233  "\tLocate Junction\tLocate a junction within the network.",
235  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
236  // for edges
237  new FXButton(cw.getLocatorPopup(),
238  "\tLocate Street\tLocate a street within the network.",
240  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
241  // for tls
242  new FXButton(cw.getLocatorPopup(),
243  "\tLocate TLS\tLocate a tls within the network.",
245  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
246  // for additional stuff
247  new FXButton(cw.getLocatorPopup(),
248  "\tLocate Additional\tLocate an additional structure within the network.",
250  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
251  // for pois
252  new FXButton(cw.getLocatorPopup(),
253  "\tLocate PoI\tLocate a PoI within the network.",
255  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
256  // for polygons
257  new FXButton(cw.getLocatorPopup(),
258  "\tLocate Polygon\tLocate a Polygon within the network.",
260  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
261 }
262 
263 
264 bool
265 GNEViewNet::setColorScheme(const std::string& name) {
266  if (!gSchemeStorage.contains(name)) {
267  return false;
268  }
269  if (myVisualizationChanger != 0) {
270  if (myVisualizationChanger->getCurrentScheme() != name) {
272  }
273  }
274  myVisualizationSettings = &gSchemeStorage.get(name.c_str());
275  update();
276  return true;
277 }
278 
279 
280 void
282  assert(!scheme.isFixed());
283  double minValue = std::numeric_limits<double>::infinity();
284  double maxValue = -std::numeric_limits<double>::infinity();
285  // retrieve range
286  if (objectType == GLO_LANE) {
287  // XXX (see #3409) multi-colors are not currently handled. this is a quick hack
288  if (active == 9) {
289  active = 8; // segment height, fall back to start height
290  } else if (active == 11) {
291  active = 10; // segment incline, fall back to total incline
292  }
293  for (GNELane* lane : myNet->retrieveLanes()) {
294  const double val = lane->getColorValue(active);
295  minValue = MIN2(minValue, val);
296  maxValue = MAX2(maxValue, val);
297  }
298  } else if (objectType == GLO_JUNCTION) {
299  if (active == 3) {
300  for (GNEJunction* junction : myNet->retrieveJunctions()) {
301  minValue = MIN2(minValue, junction->getPositionInView().z());
302  maxValue = MAX2(maxValue, junction->getPositionInView().z());
303  }
304  }
305  }
306  if (minValue != std::numeric_limits<double>::infinity()) {
307  scheme.clear();
308  // add new thresholds
309  double range = maxValue - minValue;
310  scheme.addColor(RGBColor::RED, (minValue));
311  scheme.addColor(RGBColor::ORANGE, (minValue + range * 1 / 6.0));
312  scheme.addColor(RGBColor::YELLOW, (minValue + range * 2 / 6.0));
313  scheme.addColor(RGBColor::GREEN, (minValue + range * 3 / 6.0));
314  scheme.addColor(RGBColor::CYAN, (minValue + range * 4 / 6.0));
315  scheme.addColor(RGBColor::BLUE, (minValue + range * 5 / 6.0));
316  scheme.addColor(RGBColor::MAGENTA, (maxValue));
317  }
318 }
319 
320 
321 void
322 GNEViewNet::setStatusBarText(const std::string& text) {
323  myApp->setStatusBarText(text);
324 }
325 
326 
327 bool
329  return mySelectEdges;
330 }
331 
332 
333 bool
335  if (myEditMode == GNE_MODE_CONNECT) {
336  return true;
337  } else if (myMenuCheckShowConnections->shown() == false) {
338  return false;
339  } else {
341  }
342 }
343 
344 
345 bool
347  return (myMenuCheckExtendToEdgeNodes->getCheck() != 0);
348 }
349 
350 
351 void
352 GNEViewNet::setSelectionScaling(double selectionScale) {
353  myVisualizationSettings->selectionScale = selectionScale;
354 }
355 
356 
357 bool
359  return (myMenuCheckChangeAllPhases->getCheck() != 0);
360 }
361 
362 
363 bool
365  return (myEditMode == GNE_MODE_MOVE) && (myMenuCheckShowBubbleOverJunction->getCheck());
366 }
367 
368 
369 void
371  if ((myEditShapePoly == NULL) && (element != NULL) && (shape.size() > 1)) {
372  // save current edit mode before starting
375  // add special GNEPoly fo edit shapes
376  myEditShapePoly = myNet->addPolygonForEditShapes(element, shape, fill);
377  // update view net to show the new myEditShapePoly
378  update();
379  }
380 }
381 
382 
383 void
385  // stop edit shape junction deleting myEditShapePoly
386  if (myEditShapePoly != 0) {
388  myEditShapePoly = 0;
389  // restore previous edit mode
392  }
393  }
394 }
395 
396 
397 void
399  // enable moving selection
400  myMovingSelection = true;
401  // obtain Junctions and edges selected
402  std::vector<GNEJunction*> selectedJunctions = myNet->retrieveJunctions(true);
403  std::vector<GNEEdge*> selectedEdges = myNet->retrieveEdges(true);
404  // Junctions are always moved, then save position of current selected junctions (Needed when mouse is released)
405  for (auto i : selectedJunctions) {
406  myOriginPositionOfMovedJunctions[i] = i->getPositionInView();
407  }
408  // make special movement depending of clicked AC
409  if (originAC->getTag() == SUMO_TAG_JUNCTION) {
410  // if clicked element is a junction, move shapes of all selected edges
411  for (auto i : selectedEdges) {
412  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
413  }
414  } else if (originAC->getTag() == SUMO_TAG_EDGE) {
415  // obtain clicked edge
416  GNEEdge* clickedEdge = dynamic_cast<GNEEdge*>(originAC);
417  // if clicked edge has origin and destiny junction selected, move shapes of all selected edges
418  if ((myOriginPositionOfMovedJunctions.count(clickedEdge->getGNEJunctionSource()) > 0 &&
419  myOriginPositionOfMovedJunctions.count(clickedEdge->getGNEJunctionDestiny()) > 0)) {
420  for (auto i : selectedEdges) {
421  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
422  }
423  } else {
424  // declare three groups for dividing edges
425  std::vector<GNEEdge*> noJunctionsSelected;
426  std::vector<GNEEdge*> originJunctionSelected;
427  std::vector<GNEEdge*> destinyJunctionSelected;
428  // divide selected edges into four groups, depending of the selection of their junctions
429  for (auto i : selectedEdges) {
430  bool originSelected = myOriginPositionOfMovedJunctions.count(i->getGNEJunctionSource()) > 0;
431  bool destinySelected = myOriginPositionOfMovedJunctions.count(i->getGNEJunctionDestiny()) > 0;
432  // bot junctions selected
433  if (!originSelected && !destinySelected) {
434  noJunctionsSelected.push_back(i);
435  } else if (originSelected && !destinySelected) {
436  originJunctionSelected.push_back(i);
437  } else if (!originSelected && destinySelected) {
438  destinyJunctionSelected.push_back(i);
439  } else if (!originSelected && !destinySelected) {
440  myOriginShapesMovedEntireShapes[i] = i->getNBEdge()->getInnerGeometry();
441  }
442  }
443  // saved old position of Edges which both junction isn't noJunctionsSelected
444  for (auto i : noJunctionsSelected) {
445  myOriginShapesMovedPartialShapes[i].originalShape = i->getNBEdge()->getInnerGeometry();
446  // XXX this doesn't make sense. See #3708
447  // a better solution would be to not move edge geometry when a suitable origin point could not be found
448  //myOriginShapesMovedPartialShapes[i].inverted = (i->isInverted() != clickedEdge->isInverted());
449  myOriginShapesMovedPartialShapes[i].inverted = true;
450  }
451  // obtain index shape of clicked edge and move it
452  myOriginShapesMovedPartialShapes[clickedEdge].originalPosition = originPosition;
453  myOriginShapesMovedPartialShapes[clickedEdge].index = clickedEdge->getVertexIndex(originPosition);
454  myOriginShapesMovedPartialShapes[clickedEdge].inverted = false;
455  // declare auxilar positionVector from Source To Destiny Junctions
456  PositionVector segmentClickedEdge;
457  // segmentA has two points, the first and last positions of edge
458  segmentClickedEdge.push_back(clickedEdge->getGNEJunctionSource()->getPositionInView());
459  segmentClickedEdge.push_back(clickedEdge->getGNEJunctionDestiny()->getPositionInView());
460  // Obtain the offset (legA) over of segment regarding clicked position
461  double offsetSegmentClickedEdge = segmentClickedEdge.nearest_offset_to_point2D(originPosition, false);
462  double distanceToOffsetSegmentClickedEdge = segmentClickedEdge.positionAtOffset(offsetSegmentClickedEdge).distanceTo(originPosition);
463  // check if direction of distanceToOffsetSegmentClickedEdge has to be changed
464  if (!segmentClickedEdge.positionAtOffset(offsetSegmentClickedEdge, distanceToOffsetSegmentClickedEdge).almostSame(originPosition)) {
465  distanceToOffsetSegmentClickedEdge *= -1;
466  }
467  // move index of rest of edges using offsetSegmentFSTDJ and distanceToOffsetSegmentFSTDJ as references
468  for (auto i : noJunctionsSelected) {
469  // don't move index of clicked edge, because was already moved
470  if (i != clickedEdge) {
471  // calculate segment between first and las position of selected edge
472  PositionVector segmentSelectedEdge;
473  segmentSelectedEdge.push_back(i->getGNEJunctionSource()->getPositionInView());
474  segmentSelectedEdge.push_back(i->getGNEJunctionDestiny()->getPositionInView());
475  // get reference depending of this edge is the opposite edge of another alreaday inserted
476  if (myOriginShapesMovedPartialShapes[i].inverted) {
477  myOriginShapesMovedPartialShapes[i].originalPosition = segmentSelectedEdge.positionAtOffset(segmentSelectedEdge.length() - offsetSegmentClickedEdge, -1 * distanceToOffsetSegmentClickedEdge);
478  } else {
479  myOriginShapesMovedPartialShapes[i].originalPosition = segmentSelectedEdge.positionAtOffset(offsetSegmentClickedEdge, distanceToOffsetSegmentClickedEdge);
480  }
481  // obtain index to change
482  myOriginShapesMovedPartialShapes[i].index = i->getVertexIndex(myOriginShapesMovedPartialShapes[i].originalPosition);
483  }
484  }
485  }
486  }
487 }
488 
489 
490 void
492  // move selected junctions
493  for (auto i : myOriginPositionOfMovedJunctions) {
494  i.first->moveGeometry(i.second, offset);
495  }
496 
497  // move entire edge shapes
498  for (auto i : myOriginShapesMovedEntireShapes) {
499  i.first->moveEntireShape(i.second, offset);
500  }
501 
502  // move partial shapes
503  for (auto i : myOriginShapesMovedPartialShapes) {
504  i.first->moveVertexShape(i.second.index, i.second.originalPosition, offset);
505  }
506 }
507 
508 
509 void
511  myUndoList->p_begin("position of selected elements");
512  // commit positions of moved junctions
513  for (auto i : myOriginPositionOfMovedJunctions) {
514  i.first->commitGeometryMoving(i.second, myUndoList);
515  }
516  myOriginPositionOfMovedJunctions.clear();
517 
518  // commit shapes of entired moved edges
519  for (auto i : myOriginShapesMovedEntireShapes) {
520  i.first->commitShapeChange(i.second, myUndoList);
521  }
522  myOriginShapesMovedEntireShapes.clear();
523 
524  //commit shapes of partial moved shapes
525  for (auto i : myOriginShapesMovedPartialShapes) {
526  i.first->commitShapeChange(i.second.originalShape, myUndoList);
527  }
528  myOriginShapesMovedPartialShapes.clear();
529 
530  myUndoList->p_end();
531  myMovingSelection = false;
532 }
533 
534 
535 int
536 GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
537  // init view settings
538  glRenderMode(mode);
539  glMatrixMode(GL_MODELVIEW);
540  glPushMatrix();
541  glDisable(GL_TEXTURE_2D);
542  glDisable(GL_ALPHA_TEST);
543  glEnable(GL_BLEND);
544  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
545  glEnable(GL_DEPTH_TEST);
546 
547  // visualize rectangular selection
548  if (myAmInRectSelect) {
549  glPushMatrix();
550  glTranslated(0, 0, GLO_MAX - 1);
552  glLineWidth(2);
553  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
554  glBegin(GL_QUADS);
555  glVertex2d(mySelCorner1.x(), mySelCorner1.y());
556  glVertex2d(mySelCorner1.x(), mySelCorner2.y());
557  glVertex2d(mySelCorner2.x(), mySelCorner2.y());
558  glVertex2d(mySelCorner2.x(), mySelCorner1.y());
559  glEnd();
560  glPopMatrix();
561  }
562 
563  // compute lane width
564  double lw = m2p(SUMO_const_laneWidth);
565  // draw decals (if not in grabbing mode)
566  if (!myUseToolTips) {
567  drawDecals();
568  // depending of the visualizationSettings, enable or disable check box show grid
570  myMenuCheckShowGrid->setCheck(true);
571  paintGLGrid();
572  } else {
573  myMenuCheckShowGrid->setCheck(false);
574  }
576  if (myTestingMode) {
577  if (myTestingWidth > 0 && (getWidth() != myTestingWidth || getHeight() != myTestingHeight)) {
578  // only resize once to avoid flickering
579  //std::cout << " before resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
580  myApp->resize(myTestingWidth + myTestingWidth - getWidth(), myTestingHeight + myTestingHeight - getHeight());
581  //std::cout << " directly after resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
582  myTestingWidth = 0;
583  }
584  //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n";
585  // draw pink square in the upper left corner on top of everything
586  glPushMatrix();
587  const double size = p2m(32);
588  Position center = screenPos2NetPos(8, 8);
590  glTranslated(center.x(), center.y(), GLO_MAX - 1);
591  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
592  glBegin(GL_QUADS);
593  glVertex2d(0, 0);
594  glVertex2d(0, -size);
595  glVertex2d(size, -size);
596  glVertex2d(size, 0);
597  glEnd();
598  glPopMatrix();
599 
600  // Reset textures due bug #2780. This solution is only provisional, and must be updated in the future
602  }
603  }
604 
605  // draw temporal shape of polygon during drawing
607  const PositionVector& temporalDrawingShape = myViewParent->getPolygonFrame()->getDrawingMode()->getTemporalShape();
608  // draw blue line with the current drawed shape
609  glPushMatrix();
610  glLineWidth(2);
612  GLHelper::drawLine(temporalDrawingShape);
613  glPopMatrix();
614  // draw red line from the last point of shape to the current mouse position
615  if (temporalDrawingShape.size() > 0) {
616  glPushMatrix();
617  glLineWidth(2);
619  GLHelper::drawLine(temporalDrawingShape.back(), snapToActiveGrid(getPositionInformation()));
620  glPopMatrix();
621  }
622  }
623 
624  glLineWidth(1);
625  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
626  const float minB[2] = { (float)bound.xmin(), (float)bound.ymin() };
627  const float maxB[2] = { (float)bound.xmax(), (float)bound.ymax() };
629  glEnable(GL_POLYGON_OFFSET_FILL);
630  glEnable(GL_POLYGON_OFFSET_LINE);
632  int hits2 = myGrid->Search(minB, maxB, *myVisualizationSettings);
633 
634  glTranslated(0, 0, GLO_ADDITIONAL);
635  for (std::map<const GUIGlObject*, int>::iterator i = myAdditionallyDrawn.begin(); i != myAdditionallyDrawn.end(); ++i) {
636  (i->first)->drawGLAdditional(this, *myVisualizationSettings);
637  }
638 
639  glPopMatrix();
640  return hits2;
641 }
642 
643 
644 long
645 GNEViewNet::onLeftBtnPress(FXObject*, FXSelector, void* eventData) {
646  FXEvent* e = (FXEvent*) eventData;
647  setFocus();
648  // interpret object under curser
649  if (makeCurrent()) {
650  int id = getObjectUnderCursor();
653  GNEJunction* pointed_junction = 0;
654  GNELane* pointed_lane = 0;
655  GNEEdge* pointed_edge = 0;
656  GNEPOI* pointed_poi = 0;
657  GNEPOILane* pointed_poiLane = 0;
658  GNEPoly* pointed_poly = 0;
659  GNECrossing* pointed_crossing = 0;
660  GNEAdditional* pointed_additional = 0;
661  GNEConnection* pointed_connection = 0;
662  if (pointed) {
663  // If we're editing a shape, ignore rest of elements (including other polygons)
664  if (myEditShapePoly) {
665  if (pointed == myEditShapePoly) {
666  pointed_poly = (GNEPoly*)pointed;
667  }
668  } else {
669  switch (pointed->getType()) {
670  case GLO_JUNCTION:
671  pointed_junction = (GNEJunction*)pointed;
672  break;
673  case GLO_EDGE:
674  pointed_edge = (GNEEdge*)pointed;
675  break;
676  case GLO_LANE:
677  pointed_lane = (GNELane*)pointed;
678  pointed_edge = &(pointed_lane->getParentEdge());
679  break;
680  case GLO_POI:
681  if (dynamic_cast<GNEPOI*>(pointed)) {
682  pointed_poi = (GNEPOI*)pointed;
683  } else {
684  pointed_poiLane = (GNEPOILane*)pointed;
685  }
686  break;
687  case GLO_POLYGON:
688  pointed_poly = (GNEPoly*)pointed;
689  break;
690  case GLO_CROSSING:
691  pointed_crossing = (GNECrossing*)pointed;
692  break;
693  case GLO_ADDITIONAL:
694  pointed_additional = (GNEAdditional*)pointed;
695  break;
696  case GLO_CONNECTION:
697  pointed_connection = (GNEConnection*)pointed;
698  break;
699  default:
700  pointed = 0;
701  break;
702  }
703  }
704  }
705 
706  // decide what to do based on mode
707  switch (myEditMode) {
708  case GNE_MODE_CREATE_EDGE: {
709  if ((e->state & CONTROLMASK) == 0) {
710  // allow moving when control is held down
711  if (!myUndoList->hasCommandGroup()) {
712  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
713  }
714  if (!pointed_junction) {
716  }
717  if (myCreateEdgeSource == 0) {
718  myCreateEdgeSource = pointed_junction;
720  update();
721  } else {
722  if (myCreateEdgeSource != pointed_junction) {
723  // may fail to prevent double edges
724  GNEEdge* newEdge = myNet->createEdge(
726  if (newEdge) {
727  // create another edge, if create opposite edge is enabled
728  if (myAutoCreateOppositeEdge->getCheck()) {
730  }
732 
733  if (myUndoList->hasCommandGroup()) {
734  myUndoList->p_end();
735  } else {
736  std::cout << "edge created without an open CommandGroup )-:\n";
737  }
738  if (myChainCreateEdge->getCheck()) {
739  myCreateEdgeSource = pointed_junction;
741  myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE));
742  } else {
743  myCreateEdgeSource = 0;
744  }
745  } else {
746  setStatusBarText("An " + toString(SUMO_TAG_EDGE) + " with the same geometry already exists!");
747  }
748  } else {
749  setStatusBarText("Start- and endpoint for an " + toString(SUMO_TAG_EDGE) + " must be distinct!");
750  }
751  update();
752  }
753  }
754  // process click
755  processClick(e, eventData);
756  break;
757  }
758  case GNE_MODE_MOVE: {
759  // first obtain moving reference (common for all)
761  // check what type of AC will be moved
762  if (pointed_poly) {
763  // set Poly to move
764  myPolyToMove = pointed_poly;
765  // save original shape (needed for commit change)
767  // save clicked position as moving original position
769  // obtain index of vertex to move if shape isn't blocked
770  if ((myPolyToMove->isShapeBlocked() == false) && (myPolyToMove->isMovementBlocked() == false)) {
771  // obtain index of vertex to move and moving reference
773  } else {
774  myMovingIndexShape = -1;
775  }
776  } else if (pointed_poi) {
777  myPoiToMove = pointed_poi;
778  // Save original Position of Element
780  } else if (pointed_poiLane) {
781  myPoiLaneToMove = pointed_poiLane;
782  // Save original Position of Element
784  } else if (pointed_junction) {
785  if (gSelected.isSelected(GLO_JUNCTION, pointed_junction->getGlID())) {
786  begingMoveSelection(pointed_junction, getPositionInformation());
787  } else {
788  myJunctionToMove = pointed_junction;
789  }
790  // Save original Position of Element
791  myMovingOriginalPosition = pointed_junction->getPositionInView();
792  } else if (pointed_edge) {
793  if (gSelected.isSelected(GLO_EDGE, pointed_edge->getGlID())) {
795  } else {
796  myEdgeToMove = pointed_edge;
797  // save original shape (needed for commit change)
799  // obtain index of vertex to move and moving reference
801  }
803  } else if (pointed_additional) {
804  if (gSelected.isSelected(GLO_ADDITIONAL, pointed_additional->getGlID())) {
805  myMovingSelection = true;
806  } else {
807  myAdditionalToMove = pointed_additional;
808  // Save original Position of Element
810  }
811  } else {
812  // process click
813  processClick(e, eventData);
814  }
815  update();
816  break;
817  }
818  case GNE_MODE_DELETE: {
819  // Check if Control key is pressed
820  bool markElementMode = (((FXEvent*)eventData)->state & CONTROLMASK) != 0;
821  // obtain attribute carrier related to pointed object (if exists)
822  GNEAttributeCarrier* ac = pointed ? myNet->retrieveAttributeCarrier(pointed->getGlID()) : NULL;
823  if ((pointed_lane != NULL) && mySelectEdges) {
824  ac = pointed_edge;
825  }
826  if (ac) {
827  // if pointed element is an attribute carrier, remove it or mark it
828  if (markElementMode) {
831  }
832  } else if (myViewParent->getDeleteFrame()->getMarkedAttributeCarrier() != NULL) {
834  } else {
836  }
837  } else {
838  // process click
839  processClick(e, eventData);
840  }
841  break;
842  }
843  case GNE_MODE_INSPECT: {
844  GNEAttributeCarrier* pointedAC = 0;
845  GUIGlObject* pointedO = 0;
846  if (pointed_junction) {
847  pointedAC = pointed_junction;
848  pointedO = pointed_junction;
849  } else if (pointed_lane) { // implies pointed_edge
850  if (mySelectEdges) {
851  pointedAC = pointed_edge;
852  pointedO = pointed_edge;
853  } else {
854  pointedAC = pointed_lane;
855  pointedO = pointed_lane;
856  }
857  } else if (pointed_edge) {
858  pointedAC = pointed_edge;
859  pointedO = pointed_edge;
860  } else if (pointed_crossing) {
861  pointedAC = pointed_crossing;
862  pointedO = pointed_crossing;
863  } else if (pointed_additional) {
864  pointedAC = pointed_additional;
865  pointedO = pointed_additional;
866  } else if (pointed_connection) {
867  pointedAC = pointed_connection;
868  pointedO = pointed_connection;
869  } else if (pointed_poly) {
870  pointedAC = pointed_poly;
871  pointedO = pointed_poly;
872  } else if (pointed_poi) {
873  pointedAC = pointed_poi;
874  pointedO = pointed_poi;
875  } else if (pointed_poiLane) {
876  pointedAC = pointed_poiLane;
877  pointedO = pointed_poiLane;
878  }
879  // obtain selected ACs
880  std::vector<GNEAttributeCarrier*> selectedElements;
881  std::vector<GNEAttributeCarrier*> selectedFilteredElements;
882  if (pointedO && gSelected.isSelected(pointedO->getType(), pointedO->getGlID())) {
883  // retrieve selected Attribute Carriers
884  selectedElements = myNet->retrieveAttributeCarriers(gSelected.getSelected(pointedO->getType()), pointedO->getType());
885  // filter selected elements (example: if we have two E2 and one busStop selected, and user click over one E2,
886  // attribues of busstop musn't be shown
887  for (auto i : selectedElements) {
888  if (i->getTag() == pointedAC->getTag()) {
889  selectedFilteredElements.push_back(i);
890  }
891  }
892  }
893  // Inspect seleted ACs, or single clicked AC
894  if (selectedFilteredElements.size() > 0) {
895  myViewParent->getInspectorFrame()->inspectMultisection(selectedFilteredElements);
896  } else if (pointedAC != NULL) {
898  }
899  // process click
900  processClick(e, eventData);
901  // focus upper element of inspector frame
902  if ((selectedFilteredElements.size() > 0) || (pointedAC != NULL)) {
904  }
905  update();
906  break;
907  }
908  case GNE_MODE_SELECT:
909  if ((pointed_lane != NULL) && mySelectEdges) {
911  gSelected.toggleSelection(pointed_edge->getGlID());
912  }
913  } else if (pointed && !myViewParent->getSelectorFrame()->locked(pointed->getType())) {
914  gSelected.toggleSelection(pointed->getGlID());
915  }
916 
917  myAmInRectSelect = (((FXEvent*)eventData)->state & SHIFTMASK) != 0;
918  if (myAmInRectSelect) {
921  } else {
922  // process click
923  processClick(e, eventData);
924  }
925  update();
926  break;
927 
928  case GNE_MODE_CONNECT: {
929  if (pointed_lane) {
930  const bool mayPass = (((FXEvent*)eventData)->state & SHIFTMASK) != 0;
931  const bool allowConflict = (((FXEvent*)eventData)->state & CONTROLMASK) != 0;
932  myViewParent->getConnectorFrame()->handleLaneClick(pointed_lane, mayPass, allowConflict, true);
933  update();
934  }
935  // process click
936  processClick(e, eventData);
937  break;
938  }
939  case GNE_MODE_TLS: {
940  if (pointed_junction) {
941  myViewParent->getTLSEditorFrame()->editJunction(pointed_junction);
942  update();
943  }
944  // process click
945  processClick(e, eventData);
946  break;
947  }
948  case GNE_MODE_ADDITIONAL: {
949  if (pointed_additional == NULL) {
950  GNENetElement* netElement = dynamic_cast<GNENetElement*>(pointed);
952  // process click or update view depending of the result of "add additional"
954  update();
955  // process click
956  processClick(e, eventData);
957  }
958  }
959 
960  break;
961  }
962  case GNE_MODE_CROSSING: {
963  if (pointed_crossing == NULL) {
964  GNENetElement* netElement = dynamic_cast<GNENetElement*>(pointed);
965  if (myViewParent->getCrossingFrame()->addCrossing(netElement)) {
966  update();
967  }
968  }
969  // process click
970  processClick(e, eventData);
971  break;
972  }
973  case GNE_MODE_POLYGON: {
974  if (pointed_poi == NULL) {
976  // view net must be always update
977  update();
978  // process clickw depending of the result of "add additional"
979  if ((result != GNEPolygonFrame::ADDSHAPE_NEWPOINT)) {
980  // process click
981  processClick(e, eventData);
982  }
983  }
984  break;
985  }
986  default: {
987  // process click
988  processClick(e, eventData);
989  }
990  }
991  makeNonCurrent();
992  }
993  return 1;
994 }
995 
996 
997 long
998 GNEViewNet::onLeftBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
999  GUISUMOAbstractView::onLeftBtnRelease(obj, sel, eventData);
1000  if (myMovingSelection) {
1002  } else if (myPolyToMove) {
1004  myPolyToMove = 0;
1005  } else if (myPoiToMove) {
1007  myPoiToMove = 0;
1008  } else if (myPoiLaneToMove) {
1010  myPoiLaneToMove = 0;
1011  } else if (myJunctionToMove) {
1012  // position is already up to date but we must register with myUndoList
1015  }
1016  myJunctionToMove = 0;
1017  } else if (myEdgeToMove) {
1019  myEdgeToMove = 0;
1020  } else if (myAdditionalToMove) {
1022  myAdditionalToMove = 0;
1023  } else if (myAmInRectSelect) {
1024  myAmInRectSelect = false;
1025  // shift held down on mouse-down and mouse-up
1026  if (((FXEvent*)eventData)->state & SHIFTMASK) {
1027  if (makeCurrent()) {
1028  Boundary b;
1029  b.add(mySelCorner1);
1030  b.add(mySelCorner2);
1032  makeNonCurrent();
1033  }
1034  }
1035  update();
1036  }
1037  return 1;
1038 }
1039 
1040 
1041 long GNEViewNet::onRightBtnPress(FXObject* obj, FXSelector sel, void* eventData) {
1043  // during drawing of a polygon, right click removes the last created point
1045  // update view
1046  update();
1047  return 1;
1048  } else {
1049  return GUISUMOAbstractView::onRightBtnPress(obj, sel, eventData);
1050  }
1051 }
1052 
1053 
1054 long GNEViewNet::onRightBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
1056  // during drawing of a polygon, right click removes the last created point
1057  return 1;
1058  } else {
1059  return GUISUMOAbstractView::onRightBtnRelease(obj, sel, eventData);
1060  }
1061 }
1062 
1063 
1064 long
1065 GNEViewNet::onMouseMove(FXObject* obj, FXSelector sel, void* eventData) {
1066  GUISUMOAbstractView::onMouseMove(obj, sel, eventData);
1067  // in delete mode object under cursor must be checked in every mouse movement
1068  if (myEditMode == GNE_MODE_DELETE) {
1069  setFocus();
1070  // show object information in delete frame
1071  if (makeCurrent()) {
1072  // Update current label of delete frame
1074  }
1075  } else {
1076  // calculate offset of movement depending of showGrid
1077  Position offsetMovement;
1080  if (myMenuCheckMoveElevation->getCheck()) {
1081  const double dist = int((offsetMovement.y() + offsetMovement.x()) / myVisualizationSettings->gridXSize) * myVisualizationSettings->gridXSize;
1082  offsetMovement = Position(0, 0, dist / 10);
1083  }
1084  } else {
1085  offsetMovement = getPositionInformation() - myMovingReference;
1086  if (myMenuCheckMoveElevation->getCheck()) {
1087  offsetMovement = Position(0, 0, (offsetMovement.y() + offsetMovement.x()) / 10);
1088  }
1089  }
1090  // @note #3521: Add checkBox to allow moving elements... has to behere implemented
1091  // check what type of additional is moved
1092  if (myMovingSelection) {
1093  moveSelection(offsetMovement);
1094  } else if (myPolyToMove) {
1095  // move shape's geometry without commiting changes
1096  if (myPolyToMove->isShapeBlocked()) {
1098  } else {
1100  }
1101  } else if (myPoiToMove) {
1102  // Move POI's geometry without commiting changes
1104  } else if (myPoiLaneToMove) {
1105  // Move POILane's geometry without commiting changes
1107  } else if (myJunctionToMove) {
1108  // Move Junction's geometry without commiting changes
1110  } else if (myEdgeToMove) {
1111  // move edge's geometry without commiting changes
1113  } else if (myAdditionalToMove && (myAdditionalToMove->isAdditionalBlocked() == false)) {
1114  // Move Additional geometry without commiting changes
1116  } else if (myAmInRectSelect) {
1118  }
1119  }
1120  // update view
1121  update();
1122  return 1;
1123 }
1124 
1125 
1126 long
1127 GNEViewNet::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
1128  return GUISUMOAbstractView::onKeyPress(o, sel, eventData);
1129 }
1130 
1131 
1132 long
1133 GNEViewNet::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
1134  if (myAmInRectSelect && ((((FXEvent*)eventData)->state & SHIFTMASK) == false)) {
1135  myAmInRectSelect = false;
1136  update();
1137  }
1138  return GUISUMOAbstractView::onKeyRelease(o, sel, eventData);
1139 }
1140 
1141 
1142 void
1143 GNEViewNet::abortOperation(bool clearSelection) {
1144  // steal focus from any text fields
1145  setFocus();
1146  if (myCreateEdgeSource != NULL) {
1147  // remove current created edge source
1149  myCreateEdgeSource = 0;
1150  } else if (myEditMode == GNE_MODE_SELECT) {
1151  myAmInRectSelect = false;
1152  if (clearSelection) {
1153  gSelected.clear();
1154  }
1155  } else if (myEditMode == GNE_MODE_CONNECT) {
1157  } else if (myEditMode == GNE_MODE_TLS) {
1159  } else if (myEditMode == GNE_MODE_MOVE) {
1161  } else if (myEditMode == GNE_MODE_POLYGON) {
1162  // abort current drawing
1164  }
1165  myUndoList->p_abort();
1166 }
1167 
1168 
1169 void
1172  setStatusBarText("Cannot delete in this mode");
1173  } else {
1174  myUndoList->p_begin("delete selection");
1182  myUndoList->p_end();
1183  }
1184 }
1185 
1186 
1187 void
1189  if (myEditMode == GNE_MODE_CONNECT) {
1190  myViewParent->getConnectorFrame()->onCmdOK(0, 0, 0);
1191  } else if (myEditMode == GNE_MODE_TLS) {
1192  myViewParent->getTLSEditorFrame()->onCmdOK(0, 0, 0);
1193  } else if ((myEditMode == GNE_MODE_MOVE) && (myEditShapePoly != 0)) {
1194  // save edited junction's shape
1195  if (myEditShapePoly != 0) {
1196  myUndoList->p_begin("custom " + toString(myEditShapePoly->getShapeEditedElement()->getTag()) + " shape");
1199  attr = SUMO_ATTR_CUSTOMSHAPE;
1200  }
1202  myUndoList->p_end();
1204  update();
1205  }
1206  } else if (myEditMode == GNE_MODE_POLYGON) {
1208  // stop current drawing
1210  } else {
1211  // start drawing
1213  }
1214  } else if (myEditMode == GNE_MODE_CROSSING) {
1216  }
1217 }
1218 
1219 
1220 void
1222  // if there is a visible frame, set focus over it. In other case, set focus over ViewNet
1223  if (myCurrentFrame != NULL) {
1225  } else {
1226  setFocus();
1227  }
1228 }
1229 
1230 
1231 void
1233  switch (selid) {
1236  break;
1237  case MID_GNE_SETMODE_MOVE:
1239  break;
1242  break;
1245  break;
1248  break;
1251  break;
1252  case MID_GNE_SETMODE_TLS:
1254  break;
1257  break;
1260  break;
1263  break;
1264  default:
1265  throw ProcessError("invalid edit mode called by hotkey");
1266  break;
1267  }
1268 }
1269 
1270 
1273  return myViewParent;
1274 }
1275 
1276 
1277 GNENet*
1279  return myNet;
1280 }
1281 
1282 
1283 GNEUndoList*
1285  return myUndoList;
1286 }
1287 
1288 
1289 EditMode
1291  return myEditMode;
1292 }
1293 
1294 
1295 bool
1298 }
1299 
1300 
1301 GNEJunction*
1303  GNEJunction* junction = 0;
1304  if (makeCurrent()) {
1308  if (pointed) {
1309  switch (pointed->getType()) {
1310  case GLO_JUNCTION:
1311  junction = (GNEJunction*)pointed;
1312  break;
1313  default:
1314  break;
1315  }
1316  }
1317  }
1318  return junction;
1319 }
1320 
1321 
1324  GNEConnection* connection = 0;
1325  if (makeCurrent()) {
1329  if (pointed) {
1330  switch (pointed->getType()) {
1331  case GLO_CONNECTION:
1332  connection = (GNEConnection*)pointed;
1333  break;
1334  default:
1335  break;
1336  }
1337  }
1338  }
1339  return connection;
1340 }
1341 
1342 
1343 GNECrossing*
1345  GNECrossing* crossing = 0;
1346  if (makeCurrent()) {
1350  if (pointed) {
1351  switch (pointed->getType()) {
1352  case GLO_CROSSING:
1353  crossing = (GNECrossing*)pointed;
1354  break;
1355  default:
1356  break;
1357  }
1358  }
1359  }
1360  return crossing;
1361 }
1362 
1363 GNEEdge*
1365  GNEEdge* edge = 0;
1366  if (makeCurrent()) {
1370  if (pointed) {
1371  switch (pointed->getType()) {
1372  case GLO_EDGE:
1373  edge = (GNEEdge*)pointed;
1374  break;
1375  case GLO_LANE:
1376  edge = &(((GNELane*)pointed)->getParentEdge());
1377  break;
1378  default:
1379  break;
1380  }
1381  }
1382  }
1383  return edge;
1384 }
1385 
1386 
1387 GNELane*
1389  GNELane* lane = 0;
1390  if (makeCurrent()) {
1394  if (pointed) {
1395  if (pointed->getType() == GLO_LANE) {
1396  lane = (GNELane*)pointed;
1397  }
1398  }
1399  }
1400  return lane;
1401 }
1402 
1403 
1404 std::set<GNEEdge*>
1406  std::set<GNEEdge*> result;
1407  if (makeCurrent()) {
1408  const std::vector<GUIGlID> ids = getObjectsAtPosition(getPopupPosition(), 1.0);
1409  for (auto it : ids) {
1412  if (pointed) {
1413  switch (pointed->getType()) {
1414  case GLO_EDGE:
1415  result.insert((GNEEdge*)pointed);
1416  break;
1417  case GLO_LANE:
1418  result.insert(&(((GNELane*)pointed)->getParentEdge()));
1419  break;
1420  default:
1421  break;
1422  }
1423  }
1424  }
1425  }
1426  return result;
1427 }
1428 
1429 
1432  if (makeCurrent()) {
1436  if (pointed) {
1437  return dynamic_cast<GNEAdditional*>(pointed);
1438  }
1439  }
1440  return 0;
1441 }
1442 
1443 
1444 GNEPoly*
1446  if (makeCurrent()) {
1450  if (pointed) {
1451  return dynamic_cast<GNEPoly*>(pointed);
1452  }
1453  }
1454  return 0;
1455 }
1456 
1457 
1458 GNEPOI*
1460  if (makeCurrent()) {
1464  if (pointed) {
1465  return dynamic_cast<GNEPOI*>(pointed);
1466  }
1467  }
1468  return 0;
1469 }
1470 
1471 
1472 GNEPOILane*
1474  if (makeCurrent()) {
1478  if (pointed) {
1479  return dynamic_cast<GNEPOILane*>(pointed);
1480  }
1481  }
1482  return 0;
1483 }
1484 
1485 
1486 long
1487 GNEViewNet::onCmdSetModeCreateEdge(FXObject*, FXSelector, void*) {
1489  return 1;
1490 }
1491 
1492 
1493 long
1494 GNEViewNet::onCmdSetModeMove(FXObject*, FXSelector, void*) {
1496  return 1;
1497 }
1498 
1499 
1500 long
1501 GNEViewNet::onCmdSetModeDelete(FXObject*, FXSelector, void*) {
1503  return 1;
1504 }
1505 
1506 
1507 long
1508 GNEViewNet::onCmdSetModeInspect(FXObject*, FXSelector, void*) {
1510  return 1;
1511 }
1512 
1513 
1514 long
1515 GNEViewNet::onCmdSetModeSelect(FXObject*, FXSelector, void*) {
1517  return 1;
1518 }
1519 
1520 
1521 long
1522 GNEViewNet::onCmdSetModeConnect(FXObject*, FXSelector, void*) {
1524  return 1;
1525 }
1526 
1527 
1528 long
1529 GNEViewNet::onCmdSetModeTLS(FXObject*, FXSelector, void*) {
1531  return 1;
1532 }
1533 
1534 
1535 long
1536 GNEViewNet::onCmdSetModeAdditional(FXObject*, FXSelector, void*) {
1538  return 1;
1539 }
1540 
1541 
1542 long
1543 GNEViewNet::onCmdSetModeCrossing(FXObject*, FXSelector, void*) {
1545  return 1;
1546 }
1547 
1548 
1549 long
1550 GNEViewNet::onCmdSetModePolygon(FXObject*, FXSelector, void*) {
1552  return 1;
1553 }
1554 
1555 
1556 long
1557 GNEViewNet::onCmdSplitEdge(FXObject*, FXSelector, void*) {
1558  GNEEdge* edge = getEdgeAtPopupPosition();
1559  if (edge != 0) {
1561  }
1562  return 1;
1563 }
1564 
1565 
1566 long
1567 GNEViewNet::onCmdSplitEdgeBidi(FXObject*, FXSelector, void*) {
1568  std::set<GNEEdge*> edges = getEdgesAtPopupPosition();
1569  if (edges.size() != 0) {
1570  myNet->splitEdgesBidi(edges, (*edges.begin())->getSplitPos(getPopupPosition()), myUndoList);
1571  }
1572  return 1;
1573 }
1574 
1575 
1576 long
1577 GNEViewNet::onCmdReverseEdge(FXObject*, FXSelector, void*) {
1578  GNEEdge* edge = getEdgeAtPopupPosition();
1579  if (edge != 0) {
1580  myNet->reverseEdge(edge, myUndoList);
1581  }
1582  return 1;
1583 }
1584 
1585 
1586 long
1587 GNEViewNet::onCmdAddReversedEdge(FXObject*, FXSelector, void*) {
1588  GNEEdge* edge = getEdgeAtPopupPosition();
1589  if (edge != 0) {
1591  }
1592  return 1;
1593 }
1594 
1595 
1596 long
1597 GNEViewNet::onCmdSetEdgeEndpoint(FXObject*, FXSelector, void*) {
1598  GNEEdge* edge = getEdgeAtPopupPosition();
1599  if (edge != 0) {
1601  }
1602  return 1;
1603 }
1604 
1605 
1606 long
1607 GNEViewNet::onCmdResetEdgeEndpoint(FXObject*, FXSelector, void*) {
1608  GNEEdge* edge = getEdgeAtPopupPosition();
1609  if (edge != 0) {
1611  }
1612  return 1;
1613 }
1614 
1615 
1616 long
1617 GNEViewNet::onCmdStraightenEdges(FXObject*, FXSelector, void*) {
1618  GNEEdge* edge = getEdgeAtPopupPosition();
1619  if (edge != 0) {
1620  if (gSelected.isSelected(GLO_EDGE, edge->getGlID())) {
1621  myUndoList->p_begin("straighten selected " + toString(SUMO_TAG_EDGE) + "s");
1622  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1623  for (auto it : edges) {
1624  it->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList);
1625  }
1626  myUndoList->p_end();
1627  } else {
1628  myUndoList->p_begin("straighten " + toString(SUMO_TAG_EDGE));
1630  myUndoList->p_end();
1631  }
1632  }
1633  return 1;
1634 }
1635 
1636 
1637 long
1638 GNEViewNet::onCmdSmoothEdges(FXObject*, FXSelector, void*) {
1639  GNEEdge* edge = getEdgeAtPopupPosition();
1640  if (edge != 0) {
1641  if (gSelected.isSelected(GLO_EDGE, edge->getGlID())) {
1642  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1643  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1644  for (auto it : edges) {
1645  it->smooth(myUndoList);
1646  }
1647  myUndoList->p_end();
1648  } else {
1649  myUndoList->p_begin("straighten edge elevation");
1650  edge->smooth(myUndoList);
1651  myUndoList->p_end();
1652  }
1653  }
1654  return 1;
1655 }
1656 
1657 
1658 long
1659 GNEViewNet::onCmdStraightenEdgesElevation(FXObject*, FXSelector, void*) {
1660  GNEEdge* edge = getEdgeAtPopupPosition();
1661  if (edge != 0) {
1662  if (gSelected.isSelected(GLO_EDGE, edge->getGlID())) {
1663  myUndoList->p_begin("straighten elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1664  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1665  for (auto it : edges) {
1666  it->straightenElevation(myUndoList);
1667  }
1668  myUndoList->p_end();
1669  } else {
1670  myUndoList->p_begin("straighten edge elevation");
1672  myUndoList->p_end();
1673  }
1674  }
1675  return 1;
1676 }
1677 
1678 
1679 long
1680 GNEViewNet::onCmdSmoothEdgesElevation(FXObject*, FXSelector, void*) {
1681  GNEEdge* edge = getEdgeAtPopupPosition();
1682  if (edge != 0) {
1683  if (gSelected.isSelected(GLO_EDGE, edge->getGlID())) {
1684  myUndoList->p_begin("smooth elevation of selected " + toString(SUMO_TAG_EDGE) + "s");
1685  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
1686  for (auto it : edges) {
1687  it->smoothElevation(myUndoList);
1688  }
1689  myUndoList->p_end();
1690  } else {
1691  myUndoList->p_begin("smooth edge elevation");
1692  edge->smoothElevation(myUndoList);
1693  myUndoList->p_end();
1694  }
1695  }
1696  return 1;
1697 }
1698 
1699 
1700 long
1701 GNEViewNet::onCmdSimplifyShape(FXObject*, FXSelector, void*) {
1702  if (myEditShapePoly != 0) {
1704  update();
1705  } else {
1706  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1707  if (polygonUnderMouse) {
1708  polygonUnderMouse->simplifyShape();
1709  }
1710  }
1711  return 1;
1712 }
1713 
1714 
1715 long
1716 GNEViewNet::onCmdDeleteGeometryPoint(FXObject*, FXSelector, void*) {
1717  if (myEditShapePoly != 0) {
1719  update();
1720  } else {
1721  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1722  if (polygonUnderMouse) {
1723  polygonUnderMouse->deleteGeometryPoint(getPopupPosition());
1724  }
1725  }
1726  return 1;
1727 }
1728 
1729 
1730 long
1731 GNEViewNet::onCmdClosePolygon(FXObject*, FXSelector, void*) {
1732  if (myEditShapePoly != 0) {
1733  myEditShapePoly->closePolygon(false);
1734  update();
1735  } else {
1736  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1737  if (polygonUnderMouse) {
1738  polygonUnderMouse->closePolygon();
1739  }
1740  }
1741  return 1;
1742 }
1743 
1744 
1745 long
1746 GNEViewNet::onCmdOpenPolygon(FXObject*, FXSelector, void*) {
1747  if (myEditShapePoly != 0) {
1748  myEditShapePoly->openPolygon(false);
1749  update();
1750  } else {
1751  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1752  if (polygonUnderMouse) {
1753  polygonUnderMouse->openPolygon();
1754  }
1755  }
1756  return 1;
1757 }
1758 
1759 
1760 long
1761 GNEViewNet::onCmdSetFirstGeometryPoint(FXObject*, FXSelector, void*) {
1762  if (myEditShapePoly != 0) {
1764  update();
1765  } else {
1766  GNEPoly* polygonUnderMouse = getPolygonAtPopupPosition();
1767  if (polygonUnderMouse) {
1768  polygonUnderMouse->changeFirstGeometryPoint(polygonUnderMouse->getVertexIndex(getPopupPosition(), false));
1769  }
1770  }
1771  return 1;
1772 }
1773 
1774 
1775 long
1776 GNEViewNet::onCmdTransformPOI(FXObject*, FXSelector, void*) {
1777  // check what type of POI will be transformed
1780  if (POI) {
1781  // obtain lanes around POI boundary
1782  std::vector<GUIGlID> GLIDs = getObjectsInBoundary(POI->getCenteringBoundary());
1783  std::vector<GNELane*> lanes;
1784  for (auto i : GLIDs) {
1786  if (lane) {
1787  lanes.push_back(lane);
1788  }
1789  }
1790  if (lanes.empty()) {
1791  WRITE_WARNING("No lanes around " + toString(SUMO_TAG_POILANE) + " to attach it");
1792  } else {
1793  // obtain nearest lane to POI
1794  GNELane* nearestLane = lanes.front();
1795  double minorPosOverLane = nearestLane->getShape().nearest_offset_to_point2D(POI->getPositionInView());
1796  double minorLateralOffset = nearestLane->getShape().positionAtOffset(minorPosOverLane).distanceTo(POI->getPositionInView());
1797  for (auto i : lanes) {
1798  double posOverLane = i->getShape().nearest_offset_to_point2D(POI->getPositionInView());
1799  double lateralOffset = i->getShape().positionAtOffset(posOverLane).distanceTo(POI->getPositionInView());
1800  if (lateralOffset < minorLateralOffset) {
1801  minorPosOverLane = posOverLane;
1802  minorLateralOffset = lateralOffset;
1803  nearestLane = i;
1804  }
1805  }
1806  // obtain values of POI
1807  std::string id = POI->getID();
1808  std::string type = POI->getType();
1809  RGBColor color = POI->getColor();
1810  Position pos = (*POI);
1811  double layer = POI->getLayer();
1812  double angle = POI->getNaviDegree();
1813  std::string imgFile = POI->getImgFile();
1814  double POIWidth = POI->getWidth(); // double width -> C4458
1815  double POIHeight = POI->getHeight(); // double height -> C4458
1816  // remove POI
1817  myUndoList->p_begin("attach POI into " + toString(SUMO_TAG_LANE));
1818  myNet->deleteShape(POI, myUndoList);
1819  // add POILane
1820  myNet->addPOI(id, type, color, pos, false, nearestLane->getID(), minorPosOverLane, 0, layer, angle, imgFile, POIWidth, POIHeight);
1821  myUndoList->p_end();
1822  }
1823  } else if (POILane) {
1824  // obtain values of POILane
1825  std::string id = POILane->getID();
1826  std::string type = POILane->getType();
1827  RGBColor color = POILane->getColor();
1828  Position pos = (*POILane);
1829  double layer = POILane->getLayer();
1830  double angle = POILane->getNaviDegree();
1831  std::string imgFile = POILane->getImgFile();
1832  double POIWidth = POILane->getWidth(); // double width -> C4458
1833  double POIWeight = POILane->getHeight(); // double height -> C4458
1834  // remove POILane
1835  myUndoList->p_begin("release POI from " + toString(SUMO_TAG_LANE));
1836  myNet->deleteShape(POILane, myUndoList);
1837  // add POI
1838  myNet->addPOI(id, type, color, pos, false, "", 0, 0, layer, angle, imgFile, POIWidth, POIWeight);
1839  myUndoList->p_end();
1840  }
1841  // update view after transform
1842  update();
1843  return 1;
1844 }
1845 
1846 
1847 long
1848 GNEViewNet::onCmdDuplicateLane(FXObject*, FXSelector, void*) {
1849  GNELane* lane = getLaneAtPopupPosition();
1850  if (lane != 0) {
1851  if (gSelected.isSelected(GLO_LANE, lane->getGlID())) {
1852  myUndoList->p_begin("duplicate selected " + toString(SUMO_TAG_LANE) + "s");
1853  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
1854  for (auto it : lanes) {
1856  }
1857  myUndoList->p_end();
1858  } else {
1859  myUndoList->p_begin("duplicate " + toString(SUMO_TAG_LANE));
1860  myNet->duplicateLane(lane, myUndoList);
1861  myUndoList->p_end();
1862  }
1863  }
1864  return 1;
1865 }
1866 
1867 
1868 long
1869 GNEViewNet::onCmdRestrictLaneSidewalk(FXObject*, FXSelector, void*) {
1870  return restrictLane(SVC_PEDESTRIAN);
1871 }
1872 
1873 
1874 long
1875 GNEViewNet::onCmdRestrictLaneBikelane(FXObject*, FXSelector, void*) {
1876  return restrictLane(SVC_BICYCLE);
1877 }
1878 
1879 
1880 long
1881 GNEViewNet::onCmdRestrictLaneBuslane(FXObject*, FXSelector, void*) {
1882  return restrictLane(SVC_BUS);
1883 }
1884 
1885 
1886 long
1887 GNEViewNet::onCmdAddRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
1889 }
1890 
1891 
1892 long
1893 GNEViewNet::onCmdAddRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
1895 }
1896 
1897 
1898 long
1899 GNEViewNet::onCmdAddRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
1900  return addRestrictedLane(SVC_BUS);
1901 }
1902 
1903 
1904 long
1905 GNEViewNet::onCmdRemoveRestrictedLaneSidewalk(FXObject*, FXSelector, void*) {
1907 }
1908 
1909 
1910 long
1911 GNEViewNet::onCmdRemoveRestrictedLaneBikelane(FXObject*, FXSelector, void*) {
1913 }
1914 
1915 
1916 long
1917 GNEViewNet::onCmdRemoveRestrictedLaneBuslane(FXObject*, FXSelector, void*) {
1918  return removeRestrictedLane(SVC_BUS);
1919 }
1920 
1921 
1922 long
1923 GNEViewNet::onCmdOpenAdditionalDialog(FXObject*, FXSelector, void*) {
1924  // retrieve additional under cursor
1926  // check if additional can open dialog
1927  if (addtional && GNEAttributeCarrier::canOpenDialog(addtional->getTag())) {
1928  addtional->openAdditionalDialog();
1929  }
1930  return 1;
1931 }
1932 
1933 
1934 bool
1936  GNELane* lane = getLaneAtPopupPosition();
1937  if (lane != 0) {
1938  // Get selected lanes
1939  std::vector<GNELane*> lanes = myNet->retrieveLanes(true); ;
1940  // Declare map of edges and lanes
1941  std::map<GNEEdge*, GNELane*> mapOfEdgesAndLanes;
1942  // Iterate over selected lanes
1943  for (auto i : lanes) {
1944  mapOfEdgesAndLanes[myNet->retrieveEdge(i->getParentEdge().getID())] = i;
1945  }
1946  // Throw warning dialog if there hare multiple lanes selected in the same edge
1947  if (mapOfEdgesAndLanes.size() != lanes.size()) {
1948  FXMessageBox::information(getApp(), MBOX_OK,
1949  "Multiple lane in the same edge selected", "%s",
1950  ("There are selected lanes that belong to the same edge.\n Only one lane per edge will be restricted for " + toString(vclass) + ".").c_str());
1951  }
1952  // If we handeln a set of lanes
1953  if (mapOfEdgesAndLanes.size() > 0) {
1954  // declare counter for number of Sidewalks
1955  int counter = 0;
1956  // iterate over selected lanes
1957  for (auto i : mapOfEdgesAndLanes) {
1958  if (i.first->hasRestrictedLane(vclass)) {
1959  counter++;
1960  }
1961  }
1962  // if all edges parent own a Sidewalk, stop function
1963  if (counter == (int)mapOfEdgesAndLanes.size()) {
1964  FXMessageBox::information(getApp(), MBOX_OK,
1965  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
1966  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
1967  return 0;
1968  } else {
1969  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
1970  WRITE_WARNING("Opening FXMessageBox 'restrict lanes'");
1971  }
1972  // Ask confirmation to user
1973  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
1974  ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
1975  (toString(mapOfEdgesAndLanes.size() - counter) + " lanes will be restricted for " + toString(vclass) + ". continue?").c_str());
1976  if (answer != 1) { //1:yes, 2:no, 4:esc
1977  // write warning if netedit is running in testing mode
1978  if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
1979  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'No'");
1980  } else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
1981  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'ESC'");
1982  }
1983  return 0;
1984  } else {
1985  // write warning if netedit is running in testing mode
1986  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
1987  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'Yes'");
1988  }
1989  }
1990  }
1991  // begin undo operation
1992  myUndoList->p_begin("restrict lanes to " + toString(vclass));
1993  // iterate over selected lanes
1994  for (std::map<GNEEdge*, GNELane*>::iterator i = mapOfEdgesAndLanes.begin(); i != mapOfEdgesAndLanes.end(); i++) {
1995  // Transform lane to Sidewalk
1996  myNet->restrictLane(vclass, i->second, myUndoList);
1997  }
1998  // end undo operation
1999  myUndoList->p_end();
2000  } else {
2001  // If only have a single lane, start undo/redo operation
2002  myUndoList->p_begin("restrict lane to " + toString(vclass));
2003  // Transform lane to Sidewalk
2004  myNet->restrictLane(vclass, lane, myUndoList);
2005  // end undo operation
2006  myUndoList->p_end();
2007  }
2008  }
2009  return 1;
2010 }
2011 
2012 
2013 bool
2015  GNELane* lane = getLaneAtPopupPosition();
2016  if (lane != 0) {
2017  // Get selected edges
2018  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2019  // get selected lanes
2020  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2021  // Declare set of edges
2022  std::set<GNEEdge*> setOfEdges;
2023  // Fill set of edges with vector of edges
2024  for (auto i : edges) {
2025  setOfEdges.insert(i);
2026  }
2027  // iterate over selected lanes
2028  for (auto it : lanes) {
2029  // Insert pointer to edge into set of edges (To avoid duplicates)
2030  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
2031  }
2032  // If we handeln a set of edges
2033  if (setOfEdges.size() > 0) {
2034  // declare counter for number of restrictions
2035  int counter = 0;
2036  // iterate over set of edges
2037  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2038  // update counter if edge has already a restricted lane of type "vclass"
2039  if ((*it)->hasRestrictedLane(vclass)) {
2040  counter++;
2041  }
2042  }
2043  // if all lanes own a Sidewalk, stop function
2044  if (counter == (int)setOfEdges.size()) {
2045  FXMessageBox::information(getApp(), MBOX_OK,
2046  ("Add vclass for" + toString(vclass) + " to selected lanes").c_str(), "%s",
2047  ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str());
2048  return 0;
2049  } else {
2050  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
2051  WRITE_WARNING("Opening FXMessageBox 'restrict lanes'");
2052  }
2053  // Ask confirmation to user
2054  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2055  ("Add vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2056  (toString(setOfEdges.size() - counter) + " restrictions for " + toString(vclass) + " will be added. continue?").c_str());
2057  if (answer != 1) { //1:yes, 2:no, 4:esc
2058  // write warning if netedit is running in testing mode
2059  if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
2060  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'No'");
2061  } else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
2062  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2063  }
2064  return 0;
2065  } else {
2066  // write warning if netedit is running in testing mode
2067  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
2068  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2069  }
2070  }
2071  }
2072  // begin undo operation
2073  myUndoList->p_begin("Add restrictions for " + toString(vclass));
2074  // iterate over set of edges
2075  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2076  // add Sidewalk
2077  myNet->addSRestrictedLane(vclass, *(*it), myUndoList);
2078  }
2079  // end undo operation
2080  myUndoList->p_end();
2081  } else {
2082  // If only have a single lane, start undo/redo operation
2083  myUndoList->p_begin("Add vclass for " + toString(vclass));
2084  // Add Sidewalk
2085  myNet->addSRestrictedLane(vclass, lane->getParentEdge(), myUndoList);
2086  // end undo/redo operation
2087  myUndoList->p_end();
2088  }
2089  }
2090  return 1;
2091 }
2092 
2093 
2094 bool
2096  GNELane* lane = getLaneAtPopupPosition();
2097  if (lane != 0) {
2098  // Get selected edges
2099  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2100  // get selected lanes
2101  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2102  // Declare set of edges
2103  std::set<GNEEdge*> setOfEdges;
2104  // Fill set of edges with vector of edges
2105  for (auto i : edges) {
2106  setOfEdges.insert(i);
2107  }
2108  // iterate over selected lanes
2109  for (auto it : lanes) {
2110  // Insert pointer to edge into set of edges (To avoid duplicates)
2111  setOfEdges.insert(myNet->retrieveEdge(it->getParentEdge().getID()));
2112  }
2113  // If we handeln a set of edges
2114  if (setOfEdges.size() > 0) {
2115  // declare counter for number of restrictions
2116  int counter = 0;
2117  // iterate over set of edges
2118  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2119  // update counter if edge has already a restricted lane of type "vclass"
2120  if ((*it)->hasRestrictedLane(vclass)) {
2121  counter++;
2122  }
2123  }
2124  // if all lanes don't own a Sidewalk, stop function
2125  if (counter == 0) {
2126  FXMessageBox::information(getApp(), MBOX_OK,
2127  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2128  ("Selected lanes and edges haven't a restriction for " + toString(vclass)).c_str());
2129  return 0;
2130  } else {
2131  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
2132  WRITE_WARNING("Opening FXMessageBox 'restrict lanes'");
2133  }
2134  // Ask confirmation to user
2135  FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
2136  ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s",
2137  (toString(counter) + " restrictions for " + toString(vclass) + " will be removed. continue?").c_str());
2138  if (answer != 1) { //1:yes, 2:no, 4:esc
2139  // write warning if netedit is running in testing mode
2140  if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
2141  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'No'");
2142  } else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
2143  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'ESC'");
2144  }
2145  return 0;
2146  } else {
2147  // write warning if netedit is running in testing mode
2148  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
2149  WRITE_WARNING("Closed FXMessageBox 'restrict lanes' with 'Yes'");
2150  }
2151  }
2152  }
2153  // begin undo operation
2154  myUndoList->p_begin("Remove restrictions for " + toString(vclass));
2155  // iterate over set of edges
2156  for (std::set<GNEEdge*>::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) {
2157  // add Sidewalk
2158  myNet->removeRestrictedLane(vclass, *(*it), myUndoList);
2159  }
2160  // end undo operation
2161  myUndoList->p_end();
2162  } else {
2163  // If only have a single lane, start undo/redo operation
2164  myUndoList->p_begin("Remove vclass for " + toString(vclass));
2165  // Remove Sidewalk
2167  // end undo/redo operation
2168  myUndoList->p_end();
2169  }
2170  }
2171  return 1;
2172 }
2173 
2174 
2175 void
2176 GNEViewNet::processClick(FXEvent* e, void* eventData) {
2177  // process click
2178  destroyPopup();
2179  setFocus();
2180  myChanger->onLeftBtnPress(eventData);
2181  grab();
2182  // Check there are double click
2183  if (e->click_count == 2) {
2184  handle(this, FXSEL(SEL_DOUBLECLICKED, 0), eventData);
2185  }
2186 }
2187 
2188 
2189 long
2190 GNEViewNet::onCmdEditJunctionShape(FXObject*, FXSelector, void*) {
2191  // Obtain junction under mouse
2193  if (junction) {
2194  junction->getNBNode()->computeNodeShape(-1);
2195  PositionVector nodeShape = junction->getNBNode()->getShape();
2196  nodeShape.closePolygon();
2197  startEditCustomShape(junction, nodeShape, true);
2198  }
2199  // destroy pop-up and set focus in view net
2200  destroyPopup();
2201  setFocus();
2202  return 1;
2203 }
2204 
2205 
2206 long
2207 GNEViewNet::onCmdReplaceJunction(FXObject*, FXSelector, void*) {
2209  if (junction != 0) {
2211  update();
2212  }
2213  // destroy pop-up and set focus in view net
2214  destroyPopup();
2215  setFocus();
2216  return 1;
2217 }
2218 
2219 
2220 long
2221 GNEViewNet::onCmdClearConnections(FXObject*, FXSelector, void*) {
2223  if (junction != 0) {
2224  // check if we're handling a selection
2225  if (gSelected.isSelected(GLO_JUNCTION, junction->getGlID())) {
2226  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2227  myUndoList->p_begin("clear connections of selected junctions");
2228  for (auto i : selectedJunction) {
2230  }
2231  myUndoList->p_end();
2232  } else {
2234  }
2235  update();
2236  }
2237  // destroy pop-up and set focus in view net
2238  destroyPopup();
2239  setFocus();
2240  return 1;
2241 }
2242 
2243 
2244 long
2245 GNEViewNet::onCmdResetConnections(FXObject*, FXSelector, void*) {
2247  if (junction != 0) {
2248  // check if we're handling a selection
2249  if (gSelected.isSelected(GLO_JUNCTION, junction->getGlID())) {
2250  std::vector<GNEJunction*> selectedJunction = myNet->retrieveJunctions(true);
2251  myUndoList->p_begin("reset connections of selected junctions");
2252  for (auto i : selectedJunction) {
2254  }
2255  myUndoList->p_end();
2256  } else {
2258  }
2259  update();
2260  }
2261  // destroy pop-up and set focus in view net
2262  destroyPopup();
2263  setFocus();
2264  return 1;
2265 }
2266 
2267 
2268 long
2269 GNEViewNet::onCmdEditConnectionShape(FXObject*, FXSelector, void*) {
2270  // Obtain connection under mouse
2272  if (connection) {
2273  startEditCustomShape(connection, connection->getShape(), false);
2274  }
2275  // destroy pop-up and update view Net
2276  destroyPopup();
2277  setFocus();
2278  return 1;
2279 }
2280 
2281 
2282 long
2283 GNEViewNet::onCmdEditCrossingShape(FXObject*, FXSelector, void*) {
2284  // Obtain crossing under mouse
2286  if (crossing) {
2287  // due crossings haven two shapes, check what has to be edited
2288  PositionVector shape = crossing->getNBCrossing()->customShape.size() > 0 ? crossing->getNBCrossing()->customShape : crossing->getNBCrossing()->shape;
2289  startEditCustomShape(crossing, shape, false);
2290  }
2291  // destroy pop-up and update view Net
2292  destroyPopup();
2293  setFocus();
2294  return 1;
2295 }
2296 
2297 
2298 long
2299 GNEViewNet::onCmdToogleShowConnection(FXObject*, FXSelector, void*) {
2300  if (!myShowConnections) {
2302  myShowConnections = true;
2303  }
2305  // Update viewnNet to show/hide conections
2306  update();
2307  // Hide/show connections requiere recompute
2308  getNet()->requireRecompute();
2309  return 1;
2310 }
2311 
2312 
2313 long
2314 GNEViewNet::onCmdToogleSelectEdges(FXObject*, FXSelector, void*) {
2315  if (myMenuCheckSelectEdges->getCheck()) {
2316  mySelectEdges = true;
2317  } else {
2318  mySelectEdges = false;
2319  }
2320  return 1;
2321 }
2322 
2323 
2324 long
2325 GNEViewNet::onCmdToogleShowBubbles(FXObject*, FXSelector, void*) {
2326  // Update view net Shapes
2327  update();
2328  return 1;
2329 }
2330 
2331 
2332 long
2333 GNEViewNet::onCmdShowGrid(FXObject*, FXSelector, void*) {
2334  // show or hidde grid depending of myMenuCheckShowGrid
2335  if (myMenuCheckShowGrid->getCheck()) {
2337  } else {
2339  }
2340  update();
2341  return 1;
2342 }
2343 
2344 
2345 // ===========================================================================
2346 // private
2347 // ===========================================================================
2348 
2349 void
2351  setStatusBarText("");
2352  abortOperation(false);
2353  // stop editing of custom shapes
2355 
2356  if (mode == myEditMode) {
2357  setStatusBarText("Mode already selected");
2358  if (myCurrentFrame != NULL) {
2360  }
2361  } else {
2362  myEditMode = mode;
2363  switch (mode) {
2364  case GNE_MODE_CONNECT:
2365  case GNE_MODE_TLS:
2366  // modes which depend on computed data
2368  break;
2369  default:
2370  break;
2371  }
2373  }
2374 }
2375 
2376 
2377 void
2379  // initialize mappings
2380  myEditModeNames.insert("(e) Create Edge", GNE_MODE_CREATE_EDGE);
2381  myEditModeNames.insert("(m) Move", GNE_MODE_MOVE);
2382  myEditModeNames.insert("(d) Delete", GNE_MODE_DELETE);
2383  myEditModeNames.insert("(i) Inspect", GNE_MODE_INSPECT);
2384  myEditModeNames.insert("(s) Select", GNE_MODE_SELECT);
2385  myEditModeNames.insert("(c) Connect", GNE_MODE_CONNECT);
2386  myEditModeNames.insert("(t) Traffic Lights", GNE_MODE_TLS);
2387  myEditModeNames.insert("(a) Additionals", GNE_MODE_ADDITIONAL);
2388  myEditModeNames.insert("(r) Crossings", GNE_MODE_CROSSING);
2389  myEditModeNames.insert("(p) Polygons", GNE_MODE_POLYGON);
2390 
2391  // initialize buttons for modes
2392  myEditModeCreateEdge = new MFXCheckableButton(false, myToolbar, "\tset create edge mode\tMode for creating junction and edges.",
2394  myEditModeMove = new MFXCheckableButton(false, myToolbar, "\tset move mode\tMode for move elements.",
2396  myEditModeDelete = new MFXCheckableButton(false, myToolbar, "\tset delete mode\tMode for delete elements.",
2398  myEditModeInspect = new MFXCheckableButton(false, myToolbar, "\tset inspect mode\tMode for inspect elements and change their attributes.",
2400  myEditModeSelect = new MFXCheckableButton(false, myToolbar, "\tset select mode\tMode for select elements.",
2402  myEditModeConnection = new MFXCheckableButton(false, myToolbar, "\tset connection mode\tMode for edit connections between lanes.",
2404  myEditModeTrafficLight = new MFXCheckableButton(false, myToolbar, "\tset traffic light mode\tMode for edit traffic lights over junctions.",
2406  myEditModeAdditional = new MFXCheckableButton(false, myToolbar, "\tset additional mode\tMode for adding additional elements.",
2408  myEditModeCrossing = new MFXCheckableButton(false, myToolbar, "\tset crossing mode\tMode for creating crossings between edges.",
2410  myEditModePolygon = new MFXCheckableButton(false, myToolbar, "\tset polygon mode\tMode for creating polygons and POIs.",
2412 
2413  // @ToDo add here new FXToolBarGrip(myNavigationToolBar, NULL, 0, GUIDesignToolbarGrip);
2414 
2415  // initialize mode specific controls
2416  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);
2417  myChainCreateEdge->setCheck(false);
2418 
2419  myAutoCreateOppositeEdge = new FXMenuCheck(myToolbar, ("Two-way\t\tAutomatically create an " + toString(SUMO_TAG_EDGE) + " in the opposite direction").c_str(), this, 0);
2420  myAutoCreateOppositeEdge->setCheck(false);
2421 
2422  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);
2423  myMenuCheckSelectEdges->setCheck(true);
2424 
2425  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);
2427 
2428  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);
2429 
2430  myMenuCheckWarnAboutMerge = new FXMenuCheck(myToolbar, ("Ask for merge\t\tAsk for confirmation before merging " + toString(SUMO_TAG_JUNCTION) + ".").c_str(), this, 0);
2431  myMenuCheckWarnAboutMerge->setCheck(true);
2432 
2433  myMenuCheckShowBubbleOverJunction = new FXMenuCheck(myToolbar, ("Bubbles\t\tShow bubbles over " + toString(SUMO_TAG_JUNCTION) + "'s shapes.").c_str(), this, MID_GNE_VIEWNET_SHOW_BUBBLES);
2434  myMenuCheckShowBubbleOverJunction->setCheck(false);
2435 
2436  myMenuCheckMoveElevation = new FXMenuCheck(myToolbar, "Elevation\t\tApply mouse movement to elevation instead of x,y position", this, MID_GNE_VIEWNET_MOVE_ELEVATION);
2437  myMenuCheckMoveElevation->setCheck(false);
2438 
2439  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);
2440  myMenuCheckChangeAllPhases->setCheck(false);
2441 
2442  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);
2443  myMenuCheckShowGrid->setCheck(false);
2444 }
2445 
2446 
2447 void
2449  // hide grid
2451  // hide all controls (checkboxs)
2452  myChainCreateEdge->hide();
2453  myAutoCreateOppositeEdge->hide();
2454  myMenuCheckSelectEdges->hide();
2458  myMenuCheckWarnAboutMerge->hide();
2460  myMenuCheckMoveElevation->hide();
2461  myMenuCheckShowGrid->hide();
2462  // unckeck all edit modes
2464  myEditModeMove->setChecked(false);
2465  myEditModeDelete->setChecked(false);
2466  myEditModeInspect->setChecked(false);
2467  myEditModeSelect->setChecked(false);
2472  myEditModePolygon->setChecked(false);
2474  // enable selected controls
2475  switch (myEditMode) {
2476  case GNE_MODE_CREATE_EDGE:
2477  myChainCreateEdge->show();
2478  myAutoCreateOppositeEdge->show();
2480  myMenuCheckShowGrid->show();
2481  break;
2482  case GNE_MODE_MOVE:
2483  myMenuCheckWarnAboutMerge->show();
2485  myMenuCheckMoveElevation->show();
2486  myEditModeMove->setChecked(true);
2487  myMenuCheckShowGrid->show();
2488  break;
2489  case GNE_MODE_DELETE:
2494  myMenuCheckSelectEdges->show();
2496  break;
2497  case GNE_MODE_INSPECT:
2501  myMenuCheckSelectEdges->show();
2504  break;
2505  case GNE_MODE_SELECT:
2509  myMenuCheckSelectEdges->show();
2513  break;
2514  case GNE_MODE_CONNECT:
2519  break;
2520  case GNE_MODE_TLS:
2526  break;
2527  case GNE_MODE_ADDITIONAL:
2532  myMenuCheckShowGrid->show();
2533  break;
2534  case GNE_MODE_CROSSING:
2539  myMenuCheckShowGrid->setCheck(false);
2540  break;
2541  case GNE_MODE_POLYGON:
2546  myMenuCheckShowGrid->show();
2547  break;
2548  default:
2549  break;
2550  }
2551  // Update buttons
2552  myEditModeCreateEdge->update();
2553  myEditModeMove->update();
2554  myEditModeDelete->update();
2555  myEditModeInspect->update();
2556  myEditModeSelect->update();
2557  myEditModeConnection->update();
2558  myEditModeTrafficLight->update();
2559  myEditModeAdditional->update();
2560  myEditModeCrossing->update();
2561  myEditModePolygon->update();
2562  // force repaint because different modes draw different things
2563  myToolbar->recalc();
2564  onPaint(0, 0, 0);
2565  update();
2566 }
2567 
2568 
2569 void
2571  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions(true);
2572  if (junctions.size() > 0) {
2573  std::string plural = junctions.size() == 1 ? ("") : ("s");
2574  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_JUNCTION) + plural);
2575  for (auto i : junctions) {
2577  }
2578  myUndoList->p_end();
2579  }
2580 }
2581 
2582 
2583 void
2585  std::vector<GNELane*> lanes = myNet->retrieveLanes(true);
2586  if (lanes.size() > 0) {
2587  std::string plural = lanes.size() == 1 ? ("") : ("s");
2588  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_LANE) + plural);
2589  for (auto i : lanes) {
2591  }
2592  myUndoList->p_end();
2593  }
2594 }
2595 
2596 
2597 void
2599  std::vector<GNEEdge*> edges = myNet->retrieveEdges(true);
2600  if (edges.size() > 0) {
2601  std::string plural = edges.size() == 1 ? ("") : ("s");
2602  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_EDGE) + plural);
2603  for (auto i : edges) {
2605  }
2606  myUndoList->p_end();
2607  }
2608 }
2609 
2610 
2611 void
2613  std::vector<GNEAdditional*> additionals = myNet->retrieveAdditionals(true);
2614  if (additionals.size() > 0) {
2615  std::string plural = additionals.size() == 1 ? ("") : ("s");
2616  myUndoList->p_begin("delete selected additional" + plural);
2617  for (auto i : additionals) {
2619  }
2620  myUndoList->p_end();
2621  }
2622 }
2623 
2624 
2625 
2626 void
2628  // obtain selected crossings
2629  std::vector<GNEJunction*> junctions = myNet->retrieveJunctions();
2630  std::vector<GNECrossing*> crossings;
2631  for (auto i : junctions) {
2632  for (auto j : i->getGNECrossings()) {
2633  if (gSelected.isSelected(GLO_CROSSING, j->getGlID())) {
2634  crossings.push_back(j);
2635  }
2636  }
2637  }
2638  // remove selected crossings
2639  if (crossings.size() > 0) {
2640  std::string plural = crossings.size() == 1 ? ("") : ("s");
2641  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CROSSING) + "s");
2642  for (auto i : crossings) {
2644  }
2645  myUndoList->p_end();
2646  }
2647 }
2648 
2649 
2650 void
2652  // obtain selected connections
2653  std::vector<GNEEdge*> edges = myNet->retrieveEdges();
2654  std::vector<GNEConnection*> connections;
2655  for (auto i : edges) {
2656  for (auto j : i->getGNEConnections()) {
2657  if (gSelected.isSelected(GLO_CONNECTION, j->getGlID())) {
2658  connections.push_back(j);
2659  }
2660  }
2661  }
2662  // remove selected connections
2663  if (connections.size() > 0) {
2664  std::string plural = connections.size() == 1 ? ("") : ("s");
2665  myUndoList->p_begin("delete selected " + toString(SUMO_TAG_CONNECTION) + plural);
2666  for (auto i : connections) {
2668  }
2669  myUndoList->p_end();
2670  }
2671 }
2672 
2673 
2674 void
2676  // obtain selected shapes
2677  std::vector<GNEShape*> selectedShapes = myNet->retrieveShapes(shapeTag, true);
2678  // remove it
2679  if (selectedShapes.size() > 0) {
2680  std::string plural = selectedShapes.size() == 1 ? ("") : ("s");
2681  myUndoList->p_begin("delete selected " + toString(shapeTag) + plural);
2682  for (auto i : selectedShapes) {
2684  }
2685  myUndoList->p_end();
2686  }
2687 }
2688 
2689 
2690 bool
2692  const Position& newPos = moved->getNBNode()->getPosition();
2693  GNEJunction* mergeTarget = 0;
2694  // try to find another junction to merge with
2695  if (makeCurrent()) {
2696  Boundary selection;
2697  selection.add(newPos);
2698  selection.grow(0.1);
2699  const std::vector<GUIGlID> ids = getObjectsInBoundary(selection);
2700  GUIGlObject* object = 0;
2701  for (auto it_ids : ids) {
2702  if (it_ids == 0) {
2703  continue;
2704  }
2706  if (!object) {
2707  throw ProcessError("Unkown object in selection (id=" + toString(it_ids) + ").");
2708  }
2709  if ((object->getType() == GLO_JUNCTION) && (it_ids != moved->getGlID())) {
2710  mergeTarget = dynamic_cast<GNEJunction*>(object);
2711  }
2713  }
2714  }
2715  if (mergeTarget) {
2716  // optionally ask for confirmation
2717  if (myMenuCheckWarnAboutMerge->getCheck()) {
2718  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
2719  WRITE_WARNING("Opening FXMessageBox 'merge junctions'");
2720  }
2721  // open question box
2722  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO,
2723  "Confirm Junction Merger", "%s",
2724  ("Do you wish to merge junctions '" + moved->getMicrosimID() +
2725  "' and '" + mergeTarget->getMicrosimID() + "'?\n" +
2726  "('" + moved->getMicrosimID() +
2727  "' will be eliminated and its roads added to '" +
2728  mergeTarget->getMicrosimID() + "')").c_str());
2729  if (answer != 1) { //1:yes, 2:no, 4:esc
2730  // write warning if netedit is running in testing mode
2731  if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
2732  WRITE_WARNING("Closed FXMessageBox 'merge junctions' with 'No'");
2733  } else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing-debug"))) {
2734  WRITE_WARNING("Closed FXMessageBox 'merge junctions' with 'ESC'");
2735  }
2736  return false;
2737  } else {
2738  // write warning if netedit is running in testing mode
2739  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
2740  WRITE_WARNING("Closed FXMessageBox 'merge junctions' with 'Yes'");
2741  }
2742  }
2743  }
2744  // restore previous position of junction moved
2745  moved->moveGeometry(oldPos, Position(0, 0));
2746  // merge moved and targed junctions
2747  myNet->mergeJunctions(moved, mergeTarget, myUndoList);
2748  return true;
2749  } else {
2750  return false;
2751  }
2752 }
2753 
2754 
2755 void
2757  switch (myEditMode) {
2758  case GNE_MODE_INSPECT:
2759  myViewParent->getInspectorFrame()->update();
2760  break;
2761  default:
2762  break;
2763  }
2764 }
2765 /****************************************************************************/
void startEditCustomShape(GNENetElement *element, const PositionVector &shape, bool fill)
start edit custom shape
Definition: GNEViewNet.cpp:370
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:691
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:281
long onCmdResetEdgeEndpoint(FXObject *, FXSelector, void *)
restore geometry endpoint to node position
GNEViewParent * myViewParent
view parent
Definition: GNEViewNet.h:380
virtual void openAdditionalDialog()
open Additional Dialog
void paintGLGrid()
paints a grid
mode for selecting objects
Definition: GUIAppEnum.h:477
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1033
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:761
long onCmdRestrictLaneBikelane(FXObject *, FXSelector typeOfTransformation, void *)
restrict lane to bikes
a tl-logic
close opened polygon
Definition: GUIAppEnum.h:747
GNEPOILane * getPOILaneAtPopupPosition()
try to retrieve a POILane at popup position
PositionVector getShape() const
get Position vector calculated in updateGeometry()
static const RGBColor BLUE
Definition: RGBColor.h:180
FXDEFMAP(GNEViewNet) GNEViewNetMap[]
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:137
std::vector< GUIGlID > getObjectsAtPosition(Position pos, double radius)
returns the ids of the object at position within the given (rectangular) radius using GL_SELECT ...
Locate poi - button.
Definition: GUIAppEnum.h:184
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:986
bool almostSame(const Position &p2, double maxDiv=POSITION_EPS) const
checki if two position is almost the sme as other
Definition: Position.h:234
Position getPositionInView() const
Return current position.
SumoXMLTag
Numbers representing SUMO-XML - element names.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
bool selectEdges()
whether inspection, selection and inversion should apply to edges or to lanes
Definition: GNEViewNet.cpp:328
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_MODE_INSPECT
void openPolygon(bool allowUndo=true)
open polygon
Definition: GNEPoly.cpp:407
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:131
GUICompleteSchemeStorage gSchemeStorage
set non-default geometry endpoint
Definition: GUIAppEnum.h:689
AddAdditionalResult addAdditional(GNENetElement *netElement, GUISUMOAbstractView *abstractViewParent)
add additional element
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:902
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:112
void abortOperation(bool clearSelection=true)
abort current edition operation
void deleteSelectedJunctions()
delete all currently selected junctions
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
whether a given shape is user-defined
reset junction&#39;s connections
Definition: GUIAppEnum.h:717
bool setColorScheme(const std::string &name)
set color scheme
Definition: GNEViewNet.cpp:265
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:52
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:84
void smoothElevation(GNEUndoList *undoList)
smooth elevation with regard to adjoining edges
Definition: GNEEdge.cpp:1353
mode for creating polygons
Definition: GUIAppEnum.h:487
void inspectElement(GNEAttributeCarrier *AC)
Inspect a single element.
Position myMovingReference
variable for calculating moving offset (Used when user doesn&#39;t click exactly over the center of shape...
Definition: GNEViewNet.h:458
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
bool myShowConnections
whether show connections has been activated once
Definition: GNEViewNet.h:407
begin/end of the description of a single lane
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:549
long onMouseMove(FXObject *, FXSelector, void *)
called when user moves mouse
void markAsCreateEdgeSource()
marks as first junction in createEdge-mode
The main window of the Netedit.
bool mySelectEdges
flag to check if select edges is enabled
Definition: GNEViewNet.h:410
SUMORTree * myGrid
The visualization speed-up.
long onCmdSetModeSelect(FXObject *, FXSelector, void *)
called when user press the button for select mode
int myTestingHeight
Height of viewNet in testing mode.
Definition: GNEViewNet.h:576
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
void hotkeyFocusFrame()
handle focus frame keypress
AddShapeResult
FOX-declaration.
FXMenuCheck * myMenuCheckShowGrid
show grid button
Definition: GNEViewNet.h:404
void stopEditCustomShape()
edit edit shape
Definition: GNEViewNet.cpp:384
GNEPOILane * myPoiLaneToMove
the poiLane which is being moved
Definition: GNEViewNet.h:452
void removeAttributeCarrier(GNEAttributeCarrier *ac)
remove attribute carrier (element)
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNEPOILane.cpp:97
void straightenElevation(GNEUndoList *undoList)
interpolate z values linear between junctions
Definition: GNEEdge.cpp:1258
void toggleSelection(GUIGlID id)
Toggles selection of an object.
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:418
void stopDrawing()
stop drawing and create polygon or
Definition: GNEFrame.cpp:398
turn junction into geometry node
Definition: GUIAppEnum.h:719
mode for moving things
Definition: GUIAppEnum.h:471
add bikelane
Definition: GUIAppEnum.h:778
mode for deleting things
Definition: GNEViewNet.h:54
Definition: GNEPOI.h:46
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true)
get a single attribute carrier based on a GLID
Definition: GNENet.cpp:1100
connectio between two lanes
std::set< GNEEdge * > getEdgesAtPopupPosition()
try to retrieve multiple edges at popup position
long onCmdSplitEdge(FXObject *, FXSelector, void *)
split edge at cursor position
void updateCurrentLabel(GNEAttributeCarrier *ac)
update current label
a connection
void setChecked(bool val)
check or uncheck this MFXCheckableButton
long onCmdToogleSelectEdges(FXObject *, FXSelector, void *)
toogle selet edges
Locate junction - button.
Definition: GUIAppEnum.h:172
vehicle is a bicycle
void show()
show Frame
const double SUMO_const_laneWidth
Definition: StdDefs.h:49
GNEViewParent * getViewParent() const
get the net object
double y() const
Returns the y-position.
Definition: Position.h:67
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNEPoly.cpp:139
GUIMainWindow * myApp
The application.
Position snapToActiveGrid(const Position &pos) const
Returns a position that is mapped to the closest grid point if the grid is active.
std::map< GNEEdge *, movingEdges > myOriginShapesMovedPartialShapes
Definition: GNEViewNet.h:493
void setEditMode(EditMode mode)
set edit mode
static void resetTextures()
Reset textures.
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, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
Definition: GNENet.cpp:251
MFXCheckableButton * myEditModeSelect
chekable button for edit mode select
Definition: GNEViewNet.h:528
long onCmdOpenPolygon(FXObject *, FXSelector, void *)
open closed polygon
Position mySelCorner2
second corner of the rectangle-selection
Definition: GNEViewNet.h:507
double x() const
Returns the x-position.
Definition: Position.h:62
mode for editing tls
Definition: GNEViewNet.h:62
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:333
void reverseEdge(GNEEdge *edge, GNEUndoList *undoList)
reverse edge
Definition: GNENet.cpp:754
GNEAdditional * getAdditionalAtPopupPosition()
try to retrieve a additional at popup position
void smooth(GNEUndoList *undoList)
make geometry smooth
Definition: GNEEdge.cpp:1341
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
Definition: GNENet.cpp:608
mode for deleting things
Definition: GUIAppEnum.h:473
static const RGBColor ORANGE
Definition: RGBColor.h:184
MFXCheckableButton * myEditModeMove
chekable button for edit mode move
Definition: GNEViewNet.h:519
T MAX2(T a, T b)
Definition: StdDefs.h:73
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition: GNENet.cpp:570
void resetJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
reset junction&#39;s connections
Definition: GNENet.cpp:1573
MFXCheckableButton * myEditModeDelete
chekable button for edit mode delete
Definition: GNEViewNet.h:522
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:91
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:53
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: SUMOPolygon.h:84
PositionVector shape
The crossing&#39;s shape.
Definition: NBNode.h:139
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
GNEEdge * createEdge(GNEJunction *src, GNEJunction *dest, GNEEdge *tpl, GNEUndoList *undoList, const std::string &suggestedName="", bool wasSplit=false, bool allowDuplicateGeom=false)
creates a new edge (unless an edge with the same geometry already exists)
Definition: GNENet.cpp:323
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:84
long onCmdStraightenEdgesElevation(FXObject *, FXSelector, void *)
interpolate z values linear between junctions
GNEPOI * myPoiToMove
the poi which is being moved
Definition: GNEViewNet.h:449
void setEditModeFromHotkey(FXushort selid)
sets edit mode (from hotkey)
void abortDrawing()
abort drawing
Definition: GNEFrame.cpp:424
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.
long onCmdSetEdgeEndpoint(FXObject *, FXSelector, void *)
set non-default geometry endpoint
edit junction shape
Definition: GUIAppEnum.h:729
void handleIDs(std::vector< GUIGlID > ids, bool selectEdgesEnabled, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
interpolate z values linear between junctions
Definition: GUIAppEnum.h:697
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
long onCmdEditConnectionShape(FXObject *, FXSelector, void *)
edit connection shape
PositionVector myMovingOriginalShape
Shape of elements before moving (needed for commmit shape changes)
Definition: GNEViewNet.h:464
const std::string & getID() const
Returns the id.
Definition: Named.h:74
double getHeight() const
Returns the image height of the POI.
duplicate a lane
Definition: GUIAppEnum.h:768
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList)
removes edge
Definition: GNENet.cpp:430
void moveSelection(const Position &offset)
move selection
Definition: GNEViewNet.cpp:491
int myMovingIndexShape
current index of shape that are being moved
Definition: GNEViewNet.h:468
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:564
edit junction shape
Definition: GUIAppEnum.h:721
std::map< GNEJunction *, Position > myOriginPositionOfMovedJunctions
Selected Junctions that are being moved.
Definition: GNEViewNet.h:481
FXMenuCheck * myMenuCheckChangeAllPhases
menu check to set change all phases
Definition: GNEViewNet.h:401
void removeLastPoint()
remove last added point
Definition: GNEFrame.cpp:446
GNEPolygonFrame * getPolygonFrame() const
get frame for GNE_MODE_POLYGON
GNEEdge * myEdgeToMove
the edge of which geometry is being moved
Definition: GNEViewNet.h:440
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
void closePolygon(bool allowUndo=true)
close polygon
Definition: GNEPoly.cpp:429
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:199
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:72
const std::string & getImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:100
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:64
double p2m(double pixel) const
pixels-to-meters conversion method
add reverse edge
Definition: GUIAppEnum.h:707
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:358
const PositionVector & getTemporalShape() const
get Temporal shape
Definition: GNEFrame.cpp:458
bool restrictLane(SUMOVehicleClass vclass, GNELane *lane, GNEUndoList *undoList)
transform lane to restricted lane
Definition: GNENet.cpp:635
long onCmdSetModeCrossing(FXObject *, FXSelector, void *)
called when user press the button for crossing mode
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:143
double getLayer() const
Returns the layer of the Shape.
Definition: Shape.h:86
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...
std::vector< GNEShape * > retrieveShapes(SumoXMLTag shapeTag=SUMO_TAG_NOTHING, bool onlySelected=false)
return all shapes
Definition: GNENet.cpp:1045
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:431
GUIGlID getObjectAtPosition(Position pos)
returns the id of the object at position using GL_SELECT
GNEUndoList * getUndoList() const
get the undoList object
long onLeftBtnPress(FXObject *, FXSelector, void *)
Definition: GNEViewNet.cpp:645
long onRightBtnRelease(FXObject *, FXSelector, void *)
called when user releases mouse&#39;s right button
long onCmdSimplifyShape(FXObject *, FXSelector, void *)
simply shape of current polygon
static const RGBColor GREEN
Definition: RGBColor.h:179
void begingMoveSelection(GNEAttributeCarrier *originAC, const Position &originPosition)
begin move selection
Definition: GNEViewNet.cpp:398
void computeNodeShape(double mismatchThreshold)
Compute the junction shape for this node.
Definition: NBNode.cpp:771
remove inner geometry
Definition: GUIAppEnum.h:693
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNEPOI.cpp:95
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="")
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 deleteSelectedConnections()
delete all currently selected connections
bool removeRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
remove restricted lane
Definition: GNENet.cpp:677
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPOILane.cpp:86
mode for inspecting object attributes
Definition: GNEViewNet.h:56
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
FXMenuCheck * myMenuCheckShowConnections
menu check to show connections
Definition: GNEViewNet.h:395
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr)
check if an element with certain tag has a certain attribute
virtual void setStatusBarText(const std::string &)
Definition: GUIMainWindow.h:80
simplify polygon geometry
Definition: GUIAppEnum.h:745
void deleteSelectedCrossings()
delete all currently selected crossings
edit junction shape
Definition: GUIAppEnum.h:737
show junctions as bubbles
Definition: GUIAppEnum.h:507
GNEAdditional * myAdditionalToMove
the stoppingPlace element which shape is being moved
Definition: GNEViewNet.h:455
double getNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:93
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:449
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:51
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1121
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
virtual ~GNEViewNet()
destructor
Definition: GNEViewNet.cpp:212
GNEEdge * getEdgeAtPopupPosition()
try to retrieve an edge at popup position
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:91
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
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:392
transform lane to busLane
Definition: GUIAppEnum.h:774
mode for editing tls
Definition: GUIAppEnum.h:481
FXToolBar * myToolbar
a reference to the toolbar in myParent
Definition: GNEViewNet.h:511
FXComboBox & getColoringSchemesCombo()
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:502
void deleteLane(GNELane *lane, GNEUndoList *undoList)
removes lane
Definition: GNENet.cpp:528
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:516
bool isMovementBlocked() const
return true if movement is blocked
Definition: GNEShape.cpp:62
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPOI.cpp:147
virtual void moveGeometry(const Position &oldPos, const Position &offset)=0
change the position of the element geometry without saving in undoList
add busLane
Definition: GUIAppEnum.h:780
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:323
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:364
transform lane to bikelane
Definition: GUIAppEnum.h:772
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:346
static const RGBColor MAGENTA
Definition: RGBColor.h:183
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:67
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:125
MFXCheckableButton * myEditModeTrafficLight
chekable button for edit mode traffic light
Definition: GNEViewNet.h:534
void initGNEConnections()
initialize GNEConnections
Definition: GNENet.cpp:2291
long onCmdRemoveRestrictedLaneBikelane(FXObject *, FXSelector typeOfTransformation, void *)
remove restricted lane for bikes
mode for selecting objects
Definition: GNEViewNet.h:58
GNEJunction * myJunctionToMove
the Junction to be moved.
Definition: GNEViewNet.h:437
bool addCrossing(GNENetElement *netElement)
add Crossing element
MFXCheckableButton * myEditModeAdditional
chekable button for edit mode additional
Definition: GNEViewNet.h:537
void markAttributeCarrier(GNEAttributeCarrier *ac)
mark attribute carrier (element)
edge: the shape in xml-definition
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(const std::set< GUIGlID > &ids, GUIGlObjectType type)
get the attribute carriers based on GlIDs
Definition: GNENet.cpp:1123
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
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:590
Locate polygons - button.
Definition: GUIAppEnum.h:186
const std::string getID() const
function to support debugging
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:238
void unMarkAsCreateEdgeSource()
removes mark as first junction in createEdge-mode
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNEPoly.cpp:350
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:276
Position screenPos2NetPos(int x, int y) const
Translate screen position to network position.
std::map< GNEEdge *, PositionVector > myOriginShapesMovedEntireShapes
Selected Edges that are being moved < Edge, PositionVector >
Definition: GNEViewNet.h:484
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:540
int myTestingWidth
Width of viewNet in testing mode.
Definition: GNEViewNet.h:573
GNEFrame::DrawingMode * getDrawingMode() const
get drawing mode editor
Definition: GNEFrame.cpp:609
GNEJunction * createJunction(const Position &pos, GNEUndoList *undoList)
creates a new junction
Definition: GNENet.cpp:312
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:743
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:317
Position mySelCorner1
firstcorner of the rectangle-selection
Definition: GNEViewNet.h:504
void p_abort()
reverts and discards ALL active command groups
GUIPerspectiveChanger * myChanger
The perspective changer.
mode for editing crossing
Definition: GUIAppEnum.h:485
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
EditMode
Definition: GNEViewNet.h:46
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:216
begin/end of the description of an edge
restore geometry endpoint to node position
Definition: GUIAppEnum.h:691
FXMenuCheck * myAutoCreateOppositeEdge
Definition: GNEViewNet.h:419
void setSelectionScaling(double selectionScale)
set selection scaling
Definition: GNEViewNet.cpp:352
EditMode getCurrentEditMode() const
get the current edit mode
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1726
MFXCheckableButton * myEditModeInspect
chekable button for edit mode inspect
Definition: GNEViewNet.h:525
FXMenuCheck * myMenuCheckExtendToEdgeNodes
menu check to extend to edge nodes
Definition: GNEViewNet.h:398
long onCmdClosePolygon(FXObject *, FXSelector, void *)
close opened polygon
void replaceJunctionByGeometry(GNEJunction *junction, GNEUndoList *undoList)
replace the selected junction by geometry node(s) and merge the edges
Definition: GNENet.cpp:1517
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:56
const std::string & getType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:70
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:205
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
called when user release a key
FXbool makeCurrent()
A reimplementation due to some internal reasons.
reverse an edge
Definition: GUIAppEnum.h:705
long onCmdOK(FXObject *, FXSelector, void *)
compound additional
virtual long onLeftBtnRelease(FXObject *, FXSelector, void *)
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:699
vehicle is a bus
GNEJunction * getJunctionAtPopupPosition()
try to retrieve a junction at popup position
long onCmdCreateCrossing(FXObject *, FXSelector, void *)
AddAdditionalResult
FOX-declaration.
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNEEdge.cpp:180
long onCmdSmoothEdgesElevation(FXObject *, FXSelector, void *)
smooth elevation with regard to adjoining edges
static const RGBColor YELLOW
Definition: RGBColor.h:181
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNEPoly.cpp:93
Mode for editing Polygons.
Definition: GNEViewNet.h:68
static const RGBColor RED
named colors
Definition: RGBColor.h:178
transform lane to sidewalk
Definition: GUIAppEnum.h:770
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:599
FXMenuCheck * myMenuCheckWarnAboutMerge
whether we should warn about merging junctions
Definition: GNEViewNet.h:425
double selectionScale
the current selection scaling in NETEDIT (temporary)
double m2p(double meter) const
meter-to-pixels conversion method
double length() const
Returns the length.
#define GUIDesignButtonToolbarCheckable
little checkable button with icon placed in navigation toolbar
Definition: GUIDesigns.h:90
virtual void show()
show Frame
Definition: GNEFrame.cpp:546
static const RGBColor CYAN
Definition: RGBColor.h:182
GUIVisualizationSettings * myVisualizationSettings
visualization settings
void simplifyShape(bool allowUndo=true)
replace the current shape with a rectangle
Definition: GNEPoly.cpp:493
long onCmdDeleteGeometryPoint(FXObject *, FXSelector, void *)
delete the closes geometry point
void show()
show additional frame and update use selected edges/lanes
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:974
PositionVector customShape
optional customShape for this crossing
Definition: NBNode.h:153
long onCmdAddRestrictedLaneBikelane(FXObject *, FXSelector typeOfTransformation, void *)
Add restricted lane for bikes.
const RGBColor & getColor() const
Returns the color of the Shape.
Definition: Shape.h:78
FXMenuCheck * myMenuCheckShowBubbleOverJunction
show connection as buuble in "Move" mode.
Definition: GNEViewNet.h:428
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:59
GNEConnectorFrame * getConnectorFrame() const
get frame for GNE_MODE_CONNECT
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
MFXCheckableButton * myEditModeConnection
chekable button for edit mode connection
Definition: GNEViewNet.h:531
bool showConnections()
show connections over junctions
Definition: GNEViewNet.cpp:334
long onCmdOK(FXObject *, FXSelector, void *)
long onCmdReverseEdge(FXObject *, FXSelector, void *)
reverse edge
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:536
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Locate addtional structure - button.
Definition: GUIAppEnum.h:182
GNEJunction * myCreateEdgeSource
source junction for new edge 0 if no edge source is selected an existing (or newly created) junction ...
Definition: GNEViewNet.h:415
A storage for options typed value containers)
Definition: OptionsCont.h:98
void deleteSelectedShapes(SumoXMLTag shapeTag=SUMO_TAG_NOTHING)
delete all currently selected shapes
long onCmdOpenAdditionalDialog(FXObject *, FXSelector, void *)
open additional dialog
GNENetElement * getShapeEditedElement() const
retrieve the junction of which the shape is being edited
Definition: GNEPoly.cpp:401
an edge
remove busLane
Definition: GUIAppEnum.h:786
static bool canOpenDialog(SumoXMLTag tag)
return true if element tag can open a values editor
long onCmdAddRestrictedLaneBuslane(FXObject *, FXSelector typeOfTransformation, void *)
Add restricted lane for buses.
long onCmdRemoveRestrictedLaneSidewalk(FXObject *, FXSelector typeOfTransformation, void *)
remove restricted lane for pedestrians
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:1235
void deleteSelectedAdditionals()
delete all currently selected additionals
void clearJunctionConnections(GNEJunction *junction, GNEUndoList *undoList)
clear junction&#39;s connections
Definition: GNENet.cpp:1561
crossing between edges for pedestrians
void clear()
Clears the list of selected objects.
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
Definition: GNENet.cpp:378
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
clear junction&#39;s connections
Definition: GUIAppEnum.h:715
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.
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_MODE_DELETE
void show()
show inspector frame
move elevation instead of x,y
Definition: GUIAppEnum.h:509
GNENet * getNet() const
get the net object
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:218
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:540
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false)
return all additionals
Definition: GNENet.cpp:1655
long onCmdEditCrossingShape(FXObject *, FXSelector, void *)
edit crossing shape
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPOILane.cpp:126
GNEEdge * addReversedEdge(GNEEdge *edge, GNEUndoList *undoList)
add reversed edge
Definition: GNENet.cpp:765
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:322
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
void startDrawing()
start drawing
Definition: GNEFrame.cpp:386
smooth geometry
Definition: GUIAppEnum.h:695
Set a vertex of polygon as first verte.
Definition: GUIAppEnum.h:751
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:239
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:64
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
Locate edge - button.
Definition: GUIAppEnum.h:174
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
Definition: GNEViewNet.cpp:220
void setEndpoint(Position pos, GNEUndoList *undoList)
makes pos the new geometry endpoint at the appropriate end
Definition: GNEEdge.cpp:432
split an edge
Definition: GUIAppEnum.h:701
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:107
empty max
Mode for editing crossing.
Definition: GNEViewNet.h:66
Locate TLS - button.
Definition: GUIAppEnum.h:180
GNEAttributeCarrier * getMarkedAttributeCarrier() const
returns marked atrribute carrier
void unblockObject(GUIGlID id)
Marks an object as unblocked.
mode for connecting lanes
Definition: GUIAppEnum.h:479
long onCmdStraightenEdges(FXObject *, FXSelector, void *)
makes selected edges straight
long onCmdSetModeInspect(FXObject *, FXSelector, void *)
called when user press the button for inspect mode
void finishMoveSelection()
finish moving selection
Definition: GNEViewNet.cpp:510
mode for connecting lanes
Definition: GNEViewNet.h:60
bool myMovingSelection
whether a selection is being moved
Definition: GNEViewNet.h:477
mode for creating new edges
Definition: GNEViewNet.h:50
void removePolygonForEditShapes(GNEPoly *polygon)
remove Polygon for edit shapes
Definition: GNENet.cpp:1928
virtual long onRightBtnPress(FXObject *, FXSelector, void *)
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:412
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:85
split an edge
Definition: GUIAppEnum.h:703
GNEPoly * addPolygonForEditShapes(GNENetElement *netElement, const PositionVector &shape, bool fill)
Builds a special polygon used for edit Junctions&#39;s shapes.
Definition: GNENet.cpp:1911
GUIGlID getObjectUnderCursor()
returns the id of the object under the cursor using GL_SELECT
open closed polygon
Definition: GUIAppEnum.h:749
GNELane * getLaneAtPopupPosition()
try to retrieve a lane at popup position
long onCmdToogleShowBubbles(FXObject *, FXSelector, void *)
toogle show bubbles
bool locked(GUIGlObjectType type)
void mergeJunctions(GNEJunction *moved, GNEJunction *target, GNEUndoList *undoList)
merge the given junctions edges between the given junctions will be deleted
Definition: GNENet.cpp:799
void inspectMultisection(const std::vector< GNEAttributeCarrier *> &ACs)
Inspect the given multi-selection.
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:143
begin/end of the description of a Point of interest over Lane (used by Netedit)
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:68
long onCmdAddReversedEdge(FXObject *, FXSelector, void *)
add reversed edge
mode for editing additional
Definition: GUIAppEnum.h:483
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GNEPoly * myEditShapePoly
Definition: GNEViewNet.h:561
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
bool isDrawing() const
return true if currently a shape is drawed
Definition: GNEFrame.cpp:464
void closePolygon()
ensures that the last position equals the first
NBNode * getNBNode() const
Return net build node.
bool myAmInRectSelect
whether we have started rectangle-selection
Definition: GNEViewNet.h:501
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEEdge.cpp:747
C++ TraCI client API implementation.
Definition: POI.h:42
bool addSRestrictedLane(SUMOVehicleClass vclass, GNEEdge &edge, GNEUndoList *undoList)
add restricted lane to edge
Definition: GNENet.cpp:662
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:119
remove bikelane
Definition: GUIAppEnum.h:784
GUISelectedStorage gSelected
A global holder of selected objects.
GNENet * myNet
Pointer to current net. (We are not responsible for deletion)
Definition: GNEViewNet.h:383
void hotkeyEnter()
handle enter keypress
void resetEndpoint(const Position &pos, GNEUndoList *undoList)
restores the endpoint to the junction position at the appropriate end
Definition: GNEEdge.cpp:457
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:451
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:998
Position getSplitPos(const Position &clickPos)
Definition: GNEEdge.cpp:418
mode for adding edges
Definition: GUIAppEnum.h:469
void requireRecompute()
inform the net about the need for recomputation
Definition: GNENet.cpp:1308
long onCmdShowGrid(FXObject *, FXSelector, void *)
toogle show grid
void processClick(FXEvent *e, void *data)
Auxiliar function used by onLeftBtnPress(...)
void duplicateLane(GNELane *lane, GNEUndoList *undoList)
duplicates lane
Definition: GNENet.cpp:623
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
GNEUndoList * myUndoList
a reference to the undolist maintained in the application
Definition: GNEViewNet.h:556
EditMode myEditMode
the current edit mode
Definition: GNEViewNet.h:386
virtual long onRightBtnRelease(FXObject *, FXSelector, void *)
bool addRestrictedLane(SUMOVehicleClass vclass)
add restricted lane
std::vector< GUIGlID > getObjectsInBoundary(const Boundary &bound)
returns the ids of all objects in the given boundary
MFXCheckableButton * myEditModePolygon
chekable button for edit mode polygon
Definition: GNEViewNet.h:543
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNEPoly.cpp:123
FXPopup * getLocatorPopup()
const Position & getPopupPosition() const
get position of current popup
bool myTestingMode
Definition: GNEViewNet.h:570
GNEFrame * myCurrentFrame
the current frame
Definition: GNEViewNet.h:389
mode for inspecting object attributes
Definition: GUIAppEnum.h:475
Position myMovingOriginalPosition
original Position of element before moving (needed for commmit position changes)
Definition: GNEViewNet.h:461
a junction
GNEPoly * myPolyToMove
the poly of which geometry is being moved
Definition: GNEViewNet.h:446
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.