Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
 

Public Member Functions

bool addElementUnderCursor (const GUIGlObject *GLObject, const double layer, const bool checkDuplicated, const bool fullBoundary)
 add element into list of elements under cursor
 
bool addGeometryPointUnderCursor (const GUIGlObject *GLObject, const int newIndex, const double layer)
 add geometryPoint into list of elements under cursor
 
bool addMergingJunctions (const GNEJunction *junction)
 add to merging junctions (used for marking junctions to merge)
 
bool addPositionOverShape (const GUIGlObject *GLObject, const Position &pos, const double layer, const double offset)
 add position over shape
 
bool checkBoundaryParentElement (const GUIGlObject *GLObject, const GUIGlObject *parent, const double layer)
 check boundary parent element
 
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)
 
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
 
bool checkShapeElement (const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer)
 check (closed) shape element
 
void clearSelectedElements ()
 clear selected elements
 
const std::vector< int > & getGeometryPoints (const GUIGlObject *GLObject) const
 get geometry points for the given glObject
 
const std::vector< const GNEJunction * > & getMergingJunctions () const
 get merging junctions
 
const PositiongetPositionOverShape (const GUIGlObject *GLObject) const
 get position over shape
 
const GLObjectsSortedContainergetSelectedObjects () const
 get all elements under cursor sorted by layer
 
const BoundarygetSelectionBoundary () const
 get selection boundary (usually the mouse position)
 
const PositiongetSelectionPosition () const
 get selection position (usually the mouse position)
 
 GUIViewObjectsHandler ()
 constructor
 
bool isElementSelected (const GUIGlObject *GLObject) const
 check if element was already selected
 
void isolateEdgeGeometryPoints ()
 isolate edge geometry points (used for moving)
 
void setSelectionBoundary (const Boundary &boundary)
 set selection boundary (usually the mouse position)
 
void setSelectionPosition (const Position &pos)
 set selection position (usually the mouse position)
 
void updateFrontElement (const GUIGlObject *GLObject)
 move front element in elements under cursor (currently used only in netedit)
 

Data Fields

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

Protected Attributes

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

Private Member Functions

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

Detailed Description

Definition at line 40 of file GUIViewObjectsHandler.h.

Member Typedef Documentation

◆ GLObjectsSortedContainer

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

typedef

Definition at line 64 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 double  layer,
const bool  checkDuplicated,
const bool  fullBoundary 
)

add element into list of elements under cursor

Definition at line 273 of file GUIViewObjectsHandler.cpp.

References 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,
const double  layer 
)

add geometryPoint into list of elements under cursor

Definition at line 288 of file GUIViewObjectsHandler.cpp.

References mySelectedObjects, and mySortedSelectedObjects.

Referenced by checkGeometryPoint().

Here is the caller graph for this function:

◆ addMergingJunctions()

bool GUIViewObjectsHandler::addMergingJunctions ( const GNEJunction junction)

add to merging junctions (used for marking junctions to merge)

Definition at line 430 of file GUIViewObjectsHandler.cpp.

References myMergingJunctions.

Referenced by GNEJunction::checkDrawToContour().

Here is the caller graph for this function:

◆ addPositionOverShape()

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

add position over shape

Definition at line 316 of file GUIViewObjectsHandler.cpp.

References 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,
const double  layer 
)

check boundary parent element

Definition at line 92 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,
const double  layer 
)

check if mouse is within elements geometry (for circles)

Definition at line 111 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  layer,
const double  radius 
)

◆ checkPositionOverShape()

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

check if mouse is within geometry point

Definition at line 217 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,
const double  layer 
)

check (closed) shape element

Definition at line 237 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, myMergingJunctions, 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 349 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:

◆ getMergingJunctions()

const std::vector< const GNEJunction * > & GUIViewObjectsHandler::getMergingJunctions ( ) const

get merging junctions

Definition at line 424 of file GUIViewObjectsHandler.cpp.

References myMergingJunctions.

Referenced by GNEViewNet::checkMergeJunctions().

Here is the caller graph for this function:

◆ getPositionOverShape()

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

get position over shape

Definition at line 363 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 60 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 54 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 86 of file GUIViewObjectsHandler.cpp.

References mySelectedObjects.

Referenced by addElementUnderCursor(), checkBoundaryParentElement(), checkCircleElement(), GNENetworkElement::checkDrawingBoundarySelection(), checkShapeElement(), GNEAccess::drawGL(), GNEDemandElementPlan::drawPlanGL(), GNEDemandElementPlan::drawPlanJunctionPartial(), and GNEDemandElementPlan::drawPlanLanePartial().

Here is the caller graph for this function:

◆ isolateEdgeGeometryPoints()

void GUIViewObjectsHandler::isolateEdgeGeometryPoints ( )

isolate edge geometry points (used for moving)

Definition at line 402 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 76 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 66 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 377 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 142 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 154 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 145 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 151 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 157 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements().

◆ markedTAZ

const GUIGlObject* GUIViewObjectsHandler::markedTAZ = nullptr

marked TAZ (used in create TAZRel mode)

Definition at line 148 of file GUIViewObjectsHandler.h.

Referenced by clearSelectedElements().

◆ myEmptyGeometryPoints

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

empty geometry points

Definition at line 176 of file GUIViewObjectsHandler.h.

Referenced by getGeometryPoints().

◆ myMergingJunctions

std::vector<const GNEJunction*> GUIViewObjectsHandler::myMergingJunctions
protected

merging junctions

Definition at line 179 of file GUIViewObjectsHandler.h.

Referenced by addMergingJunctions(), clearSelectedElements(), and getMergingJunctions().

◆ 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 164 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 170 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 139 of file GUIViewObjectsHandler.h.

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


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