Eclipse SUMO - Simulation of Urban MObility
GUIViewObjectsHandler Class Reference

#include <GUIViewObjectsHandler.h>

Collaboration diagram for GUIViewObjectsHandler:
[legend]

Data Structures

struct  ObjectContainer
 object container More...
 

Public Types

typedef std::map< double, std::vector< ObjectContainer > > GLObjectsSortedContainer
 typedef More...
 

Public Member Functions

bool addElementUnderCursor (const GUIGlObject *GLObject, const bool checkDuplicated, const bool fullBoundary)
 add element into list of elements under cursor More...
 
bool addGeometryPointUnderCursor (const GUIGlObject *GLObject, const int newIndex)
 add geometryPoint into list of elements under cursor More...
 
bool addPositionOverShape (const GUIGlObject *GLObject, const Position &pos, const double offset)
 add position over shape More...
 
bool checkBoundaryParentElement (const GUIGlObject *GLObject, const GUIGlObject *parent)
 check boundary parent element More...
 
bool checkCircleElement (const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position &center, const double radius, const Boundary &circleBoundary)
 check if mouse is within elements geometry (for circles) More...
 
bool checkGeometryPoint (const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const int index, const double radius)
 check if mouse is within geometry point More...
 
bool checkPositionOverShape (const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const double distance)
 check if mouse is within geometry point More...
 
bool checkShapeElement (const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary)
 check (closed) shape element More...
 
void clearSelectedElements ()
 clear selected elements More...
 
const std::vector< int > & getGeometryPoints (const GUIGlObject *GLObject) const
 get geometry points for the given glObject More...
 
const PositiongetPositionOverShape (const GUIGlObject *GLObject) const
 get position over shape More...
 
const GLObjectsSortedContainergetSelectedObjects () const
 get all elements under cursor sorted by layer More...
 
const BoundarygetSelectionBoundary () const
 get selection boundary (usually the mouse position) More...
 
const PositiongetSelectionPosition () const
 get selection position (usually the mouse position) More...
 
 GUIViewObjectsHandler ()
 constructor More...
 
bool isElementSelected (const GUIGlObject *GLObject) const
 check if element was already selected More...
 
void isolateEdgeGeometryPoints ()
 isolate edge geometry points (used for moving) More...
 
void setSelectionBoundary (const Boundary &boundary)
 set selection boundary (usually the mouse position) More...
 
void setSelectionPosition (const Position &pos)
 set selection position (usually the mouse position) More...
 
void updateFrontElement (const GUIGlObject *GLObject)
 move front element in elements under cursor (currently used only in netedit) More...
 

Data Fields

const GNEEdgemarkedEdge = nullptr
 marked edge (used in create edge mode, for splitting) More...
 
const GUIGlObjectmarkedFirstGeometryPoint = nullptr
 marked first geometry point (used for moving/delete geometry points) More...
 
const GNELanemarkedLane = nullptr
 marked lane (used in create edge mode, for splitting) More...
 
const GNERoutemarkedRoute = nullptr
 marked route (used in create vehicle mode) More...
 
const GUIGlObjectmarkedSecondGeometryPoint = nullptr
 marked first geometry point (used for moving/delete geometry points) More...
 
const GUIGlObjectmarkedTAZ = nullptr
 marked TAZ (used in create TAZRel mode) More...
 
GUIGlObjectType recomputeBoundaries = GLO_NETWORK
 recompute boundaries More...
 

Protected Attributes

std::vector< int > myEmptyGeometryPoints
 empty geometry points More...
 
std::map< const GUIGlObject *, bool > mySelectedObjects
 map with selected elements and if was selected with full boundary (used only to avoid double seletions) More...
 
Boundary mySelectionBoundary
 selection boundary More...
 
PositionVector mySelectionBoundaryShape
 selection boundary (shape) More...
 
Position mySelectionPosition
 position More...
 
GLObjectsSortedContainer mySortedSelectedObjects
 selected element sorted by layer More...
 

Private Member Functions

 GUIViewObjectsHandler (const GUIViewObjectsHandler &)=default
 set copy constructor private More...
 
GUIViewObjectsHandleroperator= (const GUIViewObjectsHandler &)=default
 set assignment operator private More...
 

Detailed Description

Definition at line 39 of file GUIViewObjectsHandler.h.

Member Typedef Documentation

◆ GLObjectsSortedContainer

typedef std::map<double, std::vector<ObjectContainer> > GUIViewObjectsHandler::GLObjectsSortedContainer

typedef

Definition at line 63 of file GUIViewObjectsHandler.h.

Constructor & Destructor Documentation

◆ GUIViewObjectsHandler() [1/2]

GUIViewObjectsHandler::GUIViewObjectsHandler ( )

constructor

Definition at line 32 of file GUIViewObjectsHandler.cpp.

◆ GUIViewObjectsHandler() [2/2]

GUIViewObjectsHandler::GUIViewObjectsHandler ( const GUIViewObjectsHandler )
privatedefault

set copy constructor private

Member Function Documentation

◆ addElementUnderCursor()

bool GUIViewObjectsHandler::addElementUnderCursor ( const GUIGlObject GLObject,
const bool  checkDuplicated,
const bool  fullBoundary 
)

add element into list of elements under cursor

Definition at line 271 of file GUIViewObjectsHandler.cpp.

References GUIGlObject::getType(), isElementSelected(), mySelectedObjects, and mySortedSelectedObjects.

Referenced by GNEEdge::calculateEdgeContour(), GNEJunction::calculateJunctioncontour(), checkBoundaryParentElement(), checkCircleElement(), and checkShapeElement().

Here is the caller graph for this function:

◆ addGeometryPointUnderCursor()

bool GUIViewObjectsHandler::addGeometryPointUnderCursor ( const GUIGlObject GLObject,
const int  newIndex 
)

add geometryPoint into list of elements under cursor

Definition at line 292 of file GUIViewObjectsHandler.cpp.

References GUIGlObject::getType(), mySelectedObjects, and mySortedSelectedObjects.

Referenced by checkGeometryPoint().

Here is the caller graph for this function:

◆ addPositionOverShape()

bool GUIViewObjectsHandler::addPositionOverShape ( const GUIGlObject GLObject,
const Position pos,
const double  offset 
)

add position over shape

Definition at line 326 of file GUIViewObjectsHandler.cpp.

References GUIGlObject::getType(), Position::INVALID, mySelectedObjects, and mySortedSelectedObjects.

Referenced by GNEContour::calculateContourEdgeGeometryPoints(), and checkPositionOverShape().

Here is the caller graph for this function:

◆ checkBoundaryParentElement()

bool GUIViewObjectsHandler::checkBoundaryParentElement ( const GUIGlObject GLObject,
const GUIGlObject parent 
)

check boundary parent element

Definition at line 91 of file GUIViewObjectsHandler.cpp.

References addElementUnderCursor(), isElementSelected(), Boundary::isInitialised(), mySelectedObjects, and mySelectionBoundary.

Referenced by GNEConnection::calculateConnectionContour(), GNECrossing::calculateCrossingContour(), GNELane::calculateLaneContour(), and GNEWalkingArea::drawGL().

Here is the caller graph for this function:

◆ checkCircleElement()

bool GUIViewObjectsHandler::checkCircleElement ( const GUIVisualizationSettings::Detail  d,
const GUIGlObject GLObject,
const Position center,
const double  radius,
const Boundary circleBoundary 
)

check if mouse is within elements geometry (for circles)

Definition at line 109 of file GUIViewObjectsHandler.cpp.

References addElementUnderCursor(), Boundary::around2D(), Boundary::contains(), Position::distanceSquaredTo2D(), GUIGlObject::getCenteringBoundary(), Position::INVALID, isElementSelected(), Boundary::isInitialised(), mySelectionBoundary, mySelectionBoundaryShape, mySelectionPosition, Boundary::overlapsWith(), and GUIVisualizationSettings::PreciseSelection.

Referenced by GNEContour::calculateContourCircleShape().

Here is the caller graph for this function:

◆ checkGeometryPoint()

bool GUIViewObjectsHandler::checkGeometryPoint ( const GUIVisualizationSettings::Detail  d,
const GUIGlObject GLObject,
const PositionVector shape,
const int  index,
const double  radius 
)

◆ checkPositionOverShape()

bool GUIViewObjectsHandler::checkPositionOverShape ( const GUIVisualizationSettings::Detail  d,
const GUIGlObject GLObject,
const PositionVector shape,
const double  distance 
)

check if mouse is within geometry point

Definition at line 215 of file GUIViewObjectsHandler.cpp.

References addPositionOverShape(), Position::distanceSquaredTo2D(), Position::INVALID, mySelectionPosition, PositionVector::nearest_offset_to_point2D(), PositionVector::positionAtOffset2D(), and GUIVisualizationSettings::PreciseSelection.

Referenced by GNEContour::calculateContourAllGeometryPoints(), and GNEContour::calculateContourMiddleGeometryPoints().

Here is the caller graph for this function:

◆ checkShapeElement()

bool GUIViewObjectsHandler::checkShapeElement ( const GUIGlObject GLObject,
const PositionVector shape,
const Boundary shapeBoundary 
)

check (closed) shape element

Definition at line 235 of file GUIViewObjectsHandler.cpp.

References addElementUnderCursor(), PositionVector::around(), Boundary::contains(), Boundary::crosses(), Position::INVALID, isElementSelected(), Boundary::isInitialised(), mySelectionBoundary, and mySelectionPosition.

Referenced by GNEContour::calculateContourClosedShape(), GNEContour::calculateContourEdge(), GNEContour::calculateContourExtrudedShape(), and GNEContour::calculateContourRectangleShape().

Here is the caller graph for this function:

◆ clearSelectedElements()

void GUIViewObjectsHandler::clearSelectedElements ( )

clear selected elements

Definition at line 36 of file GUIViewObjectsHandler.cpp.

References GLO_NETWORK, markedEdge, markedFirstGeometryPoint, markedLane, markedRoute, markedSecondGeometryPoint, markedTAZ, mySelectedObjects, mySortedSelectedObjects, and recomputeBoundaries.

Referenced by GNEViewNet::updateObjectsInBoundary(), and GNEViewNet::updateObjectsInPosition().

Here is the caller graph for this function:

◆ getGeometryPoints()

const std::vector< int > & GUIViewObjectsHandler::getGeometryPoints ( const GUIGlObject GLObject) const

get geometry points for the given glObject

Definition at line 365 of file GUIViewObjectsHandler.cpp.

References myEmptyGeometryPoints, and mySortedSelectedObjects.

Referenced by GNEContour::calculateContourEdgeGeometryPoints(), GNEMoveElement::calculateMoveShapeOperation(), GNEContour::drawDottedContourGeometryPoints(), GNEEdge::drawEndGeometryPoint(), GNEEdge::drawStartGeometryPoint(), and GNEStoppingPlace::getMoveOperation().

Here is the caller graph for this function:

◆ getPositionOverShape()

const Position & GUIViewObjectsHandler::getPositionOverShape ( const GUIGlObject GLObject) const

get position over shape

Definition at line 379 of file GUIViewObjectsHandler.cpp.

References Position::INVALID, and mySortedSelectedObjects.

Referenced by GNEMoveElement::calculateMoveShapeOperation(), and GNEContour::drawDottedContourGeometryPoints().

Here is the caller graph for this function:

◆ getSelectedObjects()

◆ getSelectionBoundary()

const Boundary & GUIViewObjectsHandler::getSelectionBoundary ( ) const

get selection boundary (usually the mouse position)

Definition at line 59 of file GUIViewObjectsHandler.cpp.

References mySelectionBoundary.

Referenced by GNEEdge::calculateEdgeContour(), GNEJunction::calculateJunctioncontour(), and GNENetworkElement::checkDrawingBoundarySelection().

Here is the caller graph for this function:

◆ getSelectionPosition()

const Position & GUIViewObjectsHandler::getSelectionPosition ( ) const

get selection position (usually the mouse position)

Definition at line 53 of file GUIViewObjectsHandler.cpp.

References mySelectionPosition.

Referenced by GNEContour::calculateContourEdgeGeometryPoints().

Here is the caller graph for this function:

◆ isElementSelected()

bool GUIViewObjectsHandler::isElementSelected ( const GUIGlObject GLObject) const

check if element was already selected

Definition at line 85 of file GUIViewObjectsHandler.cpp.

References mySelectedObjects.

Referenced by addElementUnderCursor(), checkBoundaryParentElement(), checkCircleElement(), GNEAdditional::checkDrawFromContour(), GNENetworkElement::checkDrawingBoundarySelection(), GNEJunction::checkDrawOverContour(), GNELane::checkDrawOverContour(), GNEAdditional::checkDrawToContour(), GNEJunction::checkDrawToContour(), checkShapeElement(), and GNEAccess::drawGL().

Here is the caller graph for this function:

◆ isolateEdgeGeometryPoints()

void GUIViewObjectsHandler::isolateEdgeGeometryPoints ( )

isolate edge geometry points (used for moving)

Definition at line 418 of file GUIViewObjectsHandler.cpp.

References GLO_EDGE, GLO_FRONTELEMENT, mySortedSelectedObjects, and GUIViewObjectsHandler::ObjectContainer::object.

Referenced by GNEViewNet::updateObjectsInPosition().

Here is the caller graph for this function:

◆ operator=()

GUIViewObjectsHandler& GUIViewObjectsHandler::operator= ( const GUIViewObjectsHandler )
privatedefault

set assignment operator private

◆ setSelectionBoundary()

void GUIViewObjectsHandler::setSelectionBoundary ( const Boundary boundary)

set selection boundary (usually the mouse position)

Definition at line 75 of file GUIViewObjectsHandler.cpp.

References Boundary::getShape(), Position::INVALID, mySelectionBoundary, mySelectionBoundaryShape, and mySelectionPosition.

Referenced by GNEViewNet::updateObjectsInBoundary().

Here is the caller graph for this function:

◆ setSelectionPosition()

void GUIViewObjectsHandler::setSelectionPosition ( const Position pos)

set selection position (usually the mouse position)

Definition at line 65 of file GUIViewObjectsHandler.cpp.

References mySelectionBoundary, mySelectionBoundaryShape, mySelectionPosition, and Boundary::reset().

Referenced by GNEViewNet::updateObjectsInPosition().

Here is the caller graph for this function:

◆ updateFrontElement()

void GUIViewObjectsHandler::updateFrontElement ( const GUIGlObject GLObject)

move front element in elements under cursor (currently used only in netedit)

Definition at line 393 of file GUIViewObjectsHandler.cpp.

References GUIViewObjectsHandler::ObjectContainer::geometryPoints, GLO_FRONTELEMENT, mySortedSelectedObjects, and GUIViewObjectsHandler::ObjectContainer::object.

Referenced by GNEViewNet::updateObjectsInBoundary(), and GNEViewNet::updateObjectsInPosition().

Here is the caller graph for this function:

Field Documentation

◆ markedEdge

const GNEEdge* GUIViewObjectsHandler::markedEdge = nullptr

marked edge (used in create edge mode, for splitting)

Definition at line 133 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements(), and GNEViewNet::drawTemporalSplitJunction().

◆ markedFirstGeometryPoint

const GUIGlObject* GUIViewObjectsHandler::markedFirstGeometryPoint = nullptr

marked first geometry point (used for moving/delete geometry points)

Definition at line 145 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements(), and GNEEdge::drawEdgeShape().

◆ markedLane

const GNELane* GUIViewObjectsHandler::markedLane = nullptr

marked lane (used in create edge mode, for splitting)

Definition at line 136 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements(), and GNEViewNet::drawNeteditAttributesReferences().

◆ markedRoute

const GNERoute* GUIViewObjectsHandler::markedRoute = nullptr

marked route (used in create vehicle mode)

Definition at line 142 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements().

◆ markedSecondGeometryPoint

const GUIGlObject* GUIViewObjectsHandler::markedSecondGeometryPoint = nullptr

marked first geometry point (used for moving/delete geometry points)

Definition at line 148 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements().

◆ markedTAZ

const GUIGlObject* GUIViewObjectsHandler::markedTAZ = nullptr

marked TAZ (used in create TAZRel mode)

Definition at line 139 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements().

◆ myEmptyGeometryPoints

std::vector<int> GUIViewObjectsHandler::myEmptyGeometryPoints
protected

empty geometry points

Definition at line 167 of file GUIViewObjectsHandler.h.

Referenced by getGeometryPoints().

◆ mySelectedObjects

std::map<const GUIGlObject*, bool> GUIViewObjectsHandler::mySelectedObjects
protected

map with selected elements and if was selected with full boundary (used only to avoid double seletions)

Definition at line 155 of file GUIViewObjectsHandler.h.

Referenced by addElementUnderCursor(), addGeometryPointUnderCursor(), addPositionOverShape(), checkBoundaryParentElement(), clearSelectedElements(), and isElementSelected().

◆ mySelectionBoundary

Boundary GUIViewObjectsHandler::mySelectionBoundary
protected

◆ mySelectionBoundaryShape

PositionVector GUIViewObjectsHandler::mySelectionBoundaryShape
protected

selection boundary (shape)

Definition at line 161 of file GUIViewObjectsHandler.h.

Referenced by checkCircleElement(), checkGeometryPoint(), setSelectionBoundary(), and setSelectionPosition().

◆ mySelectionPosition

Position GUIViewObjectsHandler::mySelectionPosition
protected

◆ mySortedSelectedObjects

◆ recomputeBoundaries

GUIGlObjectType GUIViewObjectsHandler::recomputeBoundaries = GLO_NETWORK

recompute boundaries

Definition at line 130 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements(), and GUIDialog_ViewSettings::SizePanel::onCmdSizeChange().


The documentation for this class was generated from the following files: