98 return selectObject(GLObject, layer,
false,
true,
nullptr);
107 const Position& center,
const double radius,
const Boundary& circleBoundary,
const double layer) {
113 const double squaredRadius = (radius * radius);
124 return selectObject(GLObject, layer,
false,
true,
nullptr);
128 return selectObject(GLObject, layer,
false,
false,
nullptr);
132 if (vertex.distanceSquaredTo2D(center) <= squaredRadius) {
133 return selectObject(GLObject, layer,
false,
false,
nullptr);
141 return selectObject(GLObject, layer,
false,
false,
nullptr);
149 return selectObject(GLObject, layer,
false,
false,
nullptr);
162 const PositionVector& shape,
const int index,
const double layer,
const double radius) {
164 const auto geometryPointPos = shape[index];
166 const double squaredRadius = (radius * radius);
173 geometryPointBoundary.
add(geometryPointPos);
174 geometryPointBoundary.
grow(radius);
183 if (vertex.distanceSquaredTo2D(geometryPointPos) <= squaredRadius) {
213 const PositionVector& shape,
const double layer,
const double distance) {
233 const double layer,
const GNESegment* segment) {
244 return selectObject(GLObject, layer,
false,
true, segment);
247 for (
int i = 1; i < (int)shape.size(); i++) {
249 return selectObject(GLObject, layer,
false,
false, segment);
257 return selectObject(GLObject, layer,
false,
false, segment);
269 const bool fullBoundary,
const GNESegment* segment) {
275 layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
284 const double layer) {
287 for (
auto& element : elementLayer.second) {
288 if (element.object == GLObject) {
290 for (
auto& index : element.geometryPoints) {
291 if (index == newIndex) {
296 element.geometryPoints.push_back(newIndex);
303 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
304 it->geometryPoints.push_back(newIndex);
312 const double offset) {
315 for (
auto& element : elementLayer.second) {
316 if (element.object == GLObject) {
321 element.posOverShape = pos;
322 element.offset = offset;
330 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
331 it->posOverShape = pos;
353 return finder->second.second;
360const std::vector<int>&
364 for (
auto& element : elementLayer.second) {
365 if (element.object == GLObject) {
366 return element.geometryPoints;
378 for (
auto& element : elementLayer.second) {
379 if (element.object == GLObject) {
380 return element.posOverShape;
389const std::set<const GNEPathElement*>&
411const std::vector<const GNEJunction*>&
421 if (mergingJunctions == junction) {
435 auto it = elementLayer.second.begin();
436 while (it != elementLayer.second.end()) {
437 if (it->object == GLObject) {
439 frontElement.
object = it->object;
442 it = elementLayer.second.erase(it);
449 if (frontElement.
object) {
461 for (
auto element : elementLayer.second) {
462 if ((element.object->getType() ==
GLO_EDGE) && (element.geometryPoints.size() > 0)) {
463 edgeWithGeometryPoints = element;
468 if (edgeWithGeometryPoints.
object !=
nullptr) {
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_NETWORK
The network - empty.
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
bool isInitialised() const
check if Boundary is Initialised
void reset()
Resets the boundary.
Boundary & grow(double by)
extends the boundary by the given amount
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
bool contains2D(const Boundary &b) const
return true if this boundary contains the given boundary (only X-Y)
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
bool around2D(const Position &p, double offset=0) const
Returns whether the boundary contains the given 2D coordinate (position)
bool crosses(const Position &p1, const Position &p2) const
Returns whether the boundary crosses the given line.
virtual Boundary getCenteringBoundary() const =0
Boundary mySelectionBoundary
selection boundary
bool checkShapeObject(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer, const GNESegment *segment)
check (closed) shape element
PositionVector mySelectionBoundaryShape
selection boundary (shape)
bool checkCircleObject(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position ¢er, const double radius, const Boundary &circleBoundary, const double layer)
check if mouse is within elements geometry (for circles)
const Boundary & getSelectionBoundary() const
get selection boundary
void setSelectionPosition(const Position &pos)
set selection position
void addToRedrawPathElements(const GNEPathElement *pathElement)
add path element to redrawing set
std::map< const GUIGlObject *, std::pair< bool, const GNESegment * > > mySelectedObjects
map with selected elements and if was selected with full boundary (used only to avoid double selectio...
const GNERoute * markedRoute
marked route (used in create vehicle mode)
bool selectGeometryPoint(const GUIGlObject *GLObject, const int newIndex, const double layer)
add geometryPoint into list of elements under cursor
std::vector< const GNEJunction * > myMergingJunctions
merging junctions
const Position & getSelectionPosition() const
void isolateEdgeGeometryPoints()
isolate edge geometry points (used for moving)
void reset()
reset view objects handler
const GUIGlObject * markedTAZ
marked TAZ (used in create TAZRel mode)
const Position & getSelectedPositionOverShape(const GUIGlObject *GLObject) const
get position over shape
std::map< double, std::vector< ObjectContainer > > GLObjectsSortedContainer
typedef for pack elements sorted by layer
bool selectObject(const GUIGlObject *GLObject, const double layer, const bool checkDuplicated, const bool fullBoundary, const GNESegment *segment)
GUIViewObjectsHandler()
constructor
bool addMergingJunctions(const GNEJunction *junction)
add to merging junctions (used for marking junctions to merge)
void setSelectionBoundary(const Boundary &boundary)
set selection boundary
GUIGlObjectType recomputeBoundaries
recompute boundaries
const GLObjectsSortedContainer & getSelectedObjects() const
get all elements under cursor sorted by layer
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
bool isPathElementMarkForRedraw(const GNEPathElement *pathElement) const
check if the given path element has to be redraw again
const GUIGlObject * markedSecondGeometryPoint
marked first geometry point (used for moving/delete geometry points)
bool isObjectSelected(const GUIGlObject *GLObject) const
check if element was already selected
const std::vector< int > & getSelectedGeometryPoints(const GUIGlObject *GLObject) const
get geometry points for the given glObject
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const GUIGlObject *parent, const double layer)
void updateFrontObject(const GUIGlObject *GLObject)
move the given object to the front (currently used only in netedit)
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
std::set< const GNEPathElement * > myRedrawPathElements
set with path elements marked for redrawing
const GNESegment * getSelectedSegment(const GUIGlObject *GLObject) const
get segment associated with the given GLObject (if exist)
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)
const std::set< const GNEPathElement * > & getRedrawPathElements() const
bool selectPositionOverShape(const GUIGlObject *GLObject, const Position &pos, const double layer, const double offset)
select position over shape (for example, the position over a lane shape)
const std::vector< const GNEJunction * > & getMergingJunctions() const
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
static const Position INVALID
used to indicate that a position is valid
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
std::vector< int > geometryPoints
vector with geometry points
const GUIGlObject * object
object