Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
29void
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 containers
44 // reset marked elements
45 myTopElement = nullptr;
46 markedNode = nullptr;
47 markedEdge = nullptr;
48 markedLane = nullptr;
49 markedTAZ = nullptr;
50 markedRoute = nullptr;
53}
54
55
56void
58 if (GLObject) {
59 myGLObjectsToUpdate.push_back(GLObject);
60 }
61}
62
63
64void
66 myElementsUnderCursor.push_back(GLObject);
67 if (myTopElement == nullptr) {
68 myTopElement = GLObject;
69 } else if (GLObject->getType() > myTopElement->getType()) {
70 myTopElement = GLObject;
71 }
72}
73
74
75bool
77 return (std::find(myElementsUnderCursor.begin(), myElementsUnderCursor.end(), GLObject) != myElementsUnderCursor.end());
78}
79
80
81bool
83 if (myTopElement) {
84 return (GLObject->getType() >= myTopElement->getType());
85 } else {
86 return false;
87 }
88}
89
90
91const std::vector<const GUIGlObject*>&
95
96/****************************************************************************/
@ GLO_NETWORK
The network - empty.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void markGLObjectToUpdate(GUIGlObject *GLObject)
mark GLObject to update (usually the geometry)
const GUIGlObject * markedLane
marked lane (used in create edge mode, for splitting)
std::vector< const GUIGlObject * > myElementsUnderCursor
elements under cursor
void executePostDrawingTasks()
execute post drawing tasks
GUIPostDrawing()
constructor
std::vector< const GUIGlObject * > elementsMarkedToRemove
elements marked for drawing remove contour (used in netedit)
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 * myTopElement
top element (used during selecting and deleting)
void addElementUnderCursor(const GUIGlObject *GLObject)
add element into list of elements under cursor
const GUIGlObject * markedRoute
marked Route (used in create vehicle mode)
bool isTopElementUnderCursor(const GUIGlObject *GLObject) const
check if the given element is the top element under cursor
const GUIGlObject * markedTAZ
marked TAZ (used in create TAZRel mode)
GUIGlObjectType recomputeBoundaries
recompute boundaries
const GUIGlObject * markedNode
marked Node (used in create edge mode)
const GUIGlObject * markedEdge
marked edge (used in create edge mode, for splitting)
Position mousePos
mouse position before rendering elements
std::vector< const GUIGlObject * > elementsMarkedToSelect
elements marked for drawing selet contour(used in netedit)
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:300