Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIViewObjectsHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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// class used for handle objects over view
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <vector>
26
27// ===========================================================================
28// class declaration
29// ===========================================================================
30
31class GNEJunction;
32class GNEEdge;
33class GNELane;
34class GNERoute;
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
39
41
42public:
45
47 ObjectContainer(const GUIGlObject* object_) :
48 object(object_) {}
49
51 const GUIGlObject* object = nullptr;
52
54 std::vector<int> geometryPoints;
55
58
60 double offset = 0;
61 };
62
64 typedef std::map<double, std::vector<ObjectContainer> > GLObjectsSortedContainer;
65
68
71
73 const Position& getSelectionPosition() const;
74
76 const Boundary& getSelectionBoundary() const;
77
79 void setSelectionPosition(const Position& pos);
80
82 void setSelectionBoundary(const Boundary& boundary);
83
85 bool isElementSelected(const GUIGlObject* GLObject) const;
86
88 bool checkBoundaryParentElement(const GUIGlObject* GLObject, const GUIGlObject* parent, const double layer);
89
92 const Position& center, const double radius, const Boundary& circleBoundary,
93 const double layer);
94
97 const PositionVector& shape, const int index, const double layer, const double radius);
98
101 const PositionVector& shape, const double layer, const double distance);
102
104 bool checkShapeElement(const GUIGlObject* GLObject, const PositionVector& shape,
105 const Boundary& shapeBoundary, const double layer);
106
108 bool addElementUnderCursor(const GUIGlObject* GLObject, const double layer, const bool checkDuplicated,
109 const bool fullBoundary);
110
112 bool addGeometryPointUnderCursor(const GUIGlObject* GLObject, const int newIndex, const double layer);
113
115 bool addPositionOverShape(const GUIGlObject* GLObject, const Position& pos, const double layer, const double offset);
116
119
121 const std::vector<int>& getGeometryPoints(const GUIGlObject* GLObject) const;
122
124 const Position& getPositionOverShape(const GUIGlObject* GLObject) const;
125
127 void updateFrontElement(const GUIGlObject* GLObject);
128
131
133 const std::vector<const GNEJunction*>& getMergingJunctions() const;
134
136 bool addMergingJunctions(const GNEJunction* junction);
137
140
142 const GNEEdge* markedEdge = nullptr;
143
145 const GNELane* markedLane = nullptr;
146
148 const GUIGlObject* markedTAZ = nullptr;
149
151 const GNERoute* markedRoute = nullptr;
152
155
158
159protected:
162
164 std::map<const GUIGlObject*, bool> mySelectedObjects;
165
168
171
174
176 std::vector<int> myEmptyGeometryPoints;
177
179 std::vector<const GNEJunction*> myMergingJunctions;
180
181private:
184
187};
GUIGlObjectType
@ GLO_NETWORK
The network - empty.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
Boundary mySelectionBoundary
selection boundary
void updateFrontElement(const GUIGlObject *GLObject)
move front element in elements under cursor (currently used only in netedit)
PositionVector mySelectionBoundaryShape
selection boundary (shape)
bool isElementSelected(const GUIGlObject *GLObject) const
check if element was already selected
const Boundary & getSelectionBoundary() const
get selection boundary (usually the mouse position)
bool checkShapeElement(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer)
check (closed) shape element
void setSelectionPosition(const Position &pos)
set selection position (usually the mouse position)
bool addGeometryPointUnderCursor(const GUIGlObject *GLObject, const int newIndex, const double layer)
add geometryPoint into list of elements under cursor
bool checkBoundaryParentElement(const GUIGlObject *GLObject, const GUIGlObject *parent, const double layer)
check boundary parent element
const GNERoute * markedRoute
marked route (used in create vehicle mode)
std::vector< const GNEJunction * > myMergingJunctions
merging junctions
bool addElementUnderCursor(const GUIGlObject *GLObject, const double layer, const bool checkDuplicated, const bool fullBoundary)
add element into list of elements under cursor
GUIViewObjectsHandler(const GUIViewObjectsHandler &)=default
set copy constructor private
const Position & getSelectionPosition() const
get selection position (usually the mouse position)
void isolateEdgeGeometryPoints()
isolate edge geometry points (used for moving)
const GUIGlObject * markedTAZ
marked TAZ (used in create TAZRel mode)
std::map< double, std::vector< ObjectContainer > > GLObjectsSortedContainer
typedef
bool addMergingJunctions(const GNEJunction *junction)
add to merging junctions (used for marking junctions to merge)
void setSelectionBoundary(const Boundary &boundary)
set selection boundary (usually the mouse position)
std::map< const GUIGlObject *, bool > mySelectedObjects
map with selected elements and if was selected with full boundary (used only to avoid double seletion...
GUIGlObjectType recomputeBoundaries
recompute boundaries
const GLObjectsSortedContainer & getSelectedObjects() const
get all elements under cursor sorted by layer
void clearSelectedElements()
clear selected elements
const std::vector< int > & getGeometryPoints(const GUIGlObject *GLObject) const
get geometry points for the given glObject
const GNEEdge * markedEdge
marked edge (used in create edge mode, for splitting)
const GNELane * markedLane
marked lane (used in create edge mode, for splitting)
Position mySelectionPosition
position
const GUIGlObject * markedSecondGeometryPoint
marked first geometry point (used for moving/delete geometry points)
bool checkCircleElement(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position &center, const double radius, const Boundary &circleBoundary, const double layer)
check if mouse is within elements geometry (for circles)
const Position & getPositionOverShape(const GUIGlObject *GLObject) const
get position over shape
bool checkGeometryPoint(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const int index, const double layer, const double radius)
check if mouse is within geometry point
bool checkPositionOverShape(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const double layer, const double distance)
check if mouse is within geometry point
GLObjectsSortedContainer mySortedSelectedObjects
selected element sorted by layer
std::vector< int > myEmptyGeometryPoints
empty geometry points
const GUIGlObject * markedFirstGeometryPoint
marked first geometry point (used for moving/delete geometry points)
GUIViewObjectsHandler & operator=(const GUIViewObjectsHandler &)=default
set assignment operator private
bool addPositionOverShape(const GUIGlObject *GLObject, const Position &pos, const double layer, const double offset)
add position over shape
const std::vector< const GNEJunction * > & getMergingJunctions() const
get merging junctions
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:322
A list of positions.
ObjectContainer(const GUIGlObject *object_)
parameter constructor
std::vector< int > geometryPoints
vector with geometry points
double offset
offset of position over shape