Eclipse SUMO - Simulation of Urban MObility
GUIPostDrawing.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2023 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Operations that must be applied after drawGL()
19 /****************************************************************************/
20 #include <config.h>
21 #include <algorithm>
22 
23 #include "GUIPostDrawing.h"
24 
25 
27 
28 
29 void
31  // reset recompute boundaries
33  // udate AC geometries
34  for (const auto& GLObject : myGLObjectsToUpdate) {
35  GLObject->updateGLObject();
36  }
37  myGLObjectsToUpdate.clear();
38  // reset mouse Pos
40  // clear objects under cursor
41  myElementsUnderCursor.clear();
42  // reset marked elements
43  markedElementOverContour = nullptr;
46  markedEdge = nullptr;
47  markedLane = nullptr;
48  markedTAZ = nullptr;
49  markedRoute = nullptr;
50  markedFirstGeometryPoint = nullptr;
51  markedSecondGeometryPoint = nullptr;
52 }
53 
54 
55 void
57  if (GLObject) {
58  myGLObjectsToUpdate.push_back(GLObject);
59  }
60 }
61 
62 
63 void
65  // avoid to insert duplicated elements
66  if (isElementUnderCursor(GLObject) == false) {
67  myElementsUnderCursor.push_back(GLObject);
68  }
69 }
70 
71 
72 bool
74  return (std::find(myElementsUnderCursor.begin(), myElementsUnderCursor.end(), GLObject) != myElementsUnderCursor.end());
75 }
76 
77 
78 const std::vector<const GUIGlObject*>&
80  return myElementsUnderCursor;
81 }
82 
83 /****************************************************************************/
@ GLO_NETWORK
The network - empty.
void markGLObjectToUpdate(GUIGlObject *GLObject)
mark GLObject to update (usually the geometry)
const GNERoute * markedRoute
marked route (used in create vehicle mode)
std::vector< const GUIGlObject * > myElementsUnderCursor
elements under cursor
void executePostDrawingTasks()
execute post drawing tasks
GUIPostDrawing()
constructor
const GUIGlObject * markedElementSelectContour
elements marked for drawing select contour (used in netedit)
const GNELane * markedLane
marked lane (used in create edge mode, for splitting)
const GUIGlObject * markedFirstGeometryPoint
marked first geometry point (used for moving/delete geometry points)
const std::vector< const GUIGlObject * > & getElementUnderCursor() const
get all elements under cursor
std::vector< GUIGlObject * > myGLObjectsToUpdate
GLObjects to update.
const GUIGlObject * markedSecondGeometryPoint
marked first geometry point (used for moving/delete geometry points)
bool isElementUnderCursor(const GUIGlObject *GLObject) const
check if element is under cursor
const GUIGlObject * markedElementDeleteContour
elements marked for drawing delete contour (used in netedit)
void addElementUnderCursor(const GUIGlObject *GLObject)
add element into list of elements under cursor
const GUIGlObject * markedTAZ
marked TAZ (used in create TAZRel mode)
const GUIGlObject * markedElementOverContour
elements marked for drawing over contour (used in netedit)
GUIGlObjectType recomputeBoundaries
recompute boundaries
const GNEEdge * markedEdge
marked edge (used in create edge mode, for splitting)
Position mousePos
mouse position before rendering elements
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:317