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

 GUIViewObjectsHandler ()
 constructor
 
void isolateEdgeGeometryPoints ()
 isolate edge geometry points (used for moving)
 
void reset ()
 reset view objects handler
 
void updateFrontObject (const GUIGlObject *GLObject)
 move the given object to the front (currently used only in netedit)
 
position and boundary functions. used for defining the posion that will be check (usually the mouse position)

get selection position

const PositiongetSelectionPosition () const
 
const BoundarygetSelectionBoundary () const
 get selection boundary
 
void setSelectionPosition (const Position &pos)
 set selection position
 
void setSelectionBoundary (const Boundary &boundary)
 set selection boundary
 
check functions. If the result is positive, the given GLObject will be added to elementUnderCursor

check boundary parent element

bool checkBoundaryParentObject (const GUIGlObject *GLObject, const GUIGlObject *parent, const double layer)
 
bool checkCircleObject (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 checkShapeObject (const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer)
 check (closed) shape element
 
functions used for mark (select) elements

add element into list of elements under cursor

bool selectObject (const GUIGlObject *GLObject, const double layer, const bool checkDuplicated, const bool fullBoundary)
 
bool selectGeometryPoint (const GUIGlObject *GLObject, const int newIndex, const double layer)
 add geometryPoint into list of elements under cursor
 
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)
 
bool isObjectSelected (const GUIGlObject *GLObject) const
 check if element was already selected
 
const GLObjectsSortedContainergetSelectedObjects () const
 get all elements under cursor sorted by layer
 
const std::vector< int > & getSelectedGeometryPoints (const GUIGlObject *GLObject) const
 get geometry points for the given glObject
 
const PositiongetSelectedPositionOverShape (const GUIGlObject *GLObject) const
 get position over shape
 
functions related with redrawing objects

get redrawing objects

const std::set< const GUIGlObject * > & getRedrawObjects () const
 
void addToRedrawObjects (const GUIGlObject *GLObject)
 get redrawing objects
 
functions related with merging junctions

get merging junctions

const std::vector< const GNEJunction * > & getMergingJunctions () const
 
bool addMergingJunctions (const GNEJunction *junction)
 add to merging junctions (used for marking junctions to merge)
 

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::set< const GUIGlObject * > myRedrawObjects
 set with element marked for redrawing
 
std::map< const GUIGlObject *, bool > mySelectedObjects
 map with selected elements and if was selected with full boundary (used only to avoid double selections)
 
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

◆ addMergingJunctions()

bool GUIViewObjectsHandler::addMergingJunctions ( const GNEJunction junction)

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

Definition at line 396 of file GUIViewObjectsHandler.cpp.

References myMergingJunctions.

Referenced by GNEJunction::checkDrawToContour().

Here is the caller graph for this function:

◆ addToRedrawObjects()

void GUIViewObjectsHandler::addToRedrawObjects ( const GUIGlObject GLObject)

get redrawing objects

Definition at line 384 of file GUIViewObjectsHandler.cpp.

References myRedrawObjects.

Referenced by GNEPathManager::addPathElementToRedrawBuffer(), and GNEViewNet::redrawContourElements().

Here is the caller graph for this function:

◆ checkBoundaryParentObject()

bool GUIViewObjectsHandler::checkBoundaryParentObject ( const GUIGlObject GLObject,
const GUIGlObject parent,
const double  layer 
)

Definition at line 87 of file GUIViewObjectsHandler.cpp.

References Boundary::isInitialised(), isObjectSelected(), mySelectedObjects, mySelectionBoundary, and selectObject().

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

Here is the caller graph for this function:

◆ checkCircleObject()

bool GUIViewObjectsHandler::checkCircleObject ( 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 106 of file GUIViewObjectsHandler.cpp.

References Boundary::around2D(), Boundary::contains2D(), Position::distanceSquaredTo2D(), GUIGlObject::getCenteringBoundary(), Position::INVALID, Boundary::isInitialised(), isObjectSelected(), mySelectionBoundary, mySelectionBoundaryShape, mySelectionPosition, Boundary::overlapsWith(), GUIVisualizationSettings::PreciseSelection, and selectObject().

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 212 of file GUIViewObjectsHandler.cpp.

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

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

Here is the caller graph for this function:

◆ checkShapeObject()

bool GUIViewObjectsHandler::checkShapeObject ( const GUIGlObject GLObject,
const PositionVector shape,
const Boundary shapeBoundary,
const double  layer 
)

check (closed) shape element

Definition at line 232 of file GUIViewObjectsHandler.cpp.

References PositionVector::around(), Boundary::contains2D(), Boundary::crosses(), Position::INVALID, Boundary::isInitialised(), isObjectSelected(), mySelectionBoundary, mySelectionPosition, and selectObject().

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

Here is the caller graph for this function:

◆ getMergingJunctions()

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

Definition at line 390 of file GUIViewObjectsHandler.cpp.

References myMergingJunctions.

Referenced by GNEViewNet::checkMergeJunctions().

Here is the caller graph for this function:

◆ getRedrawObjects()

const std::set< const GUIGlObject * > & GUIViewObjectsHandler::getRedrawObjects ( ) const

Definition at line 378 of file GUIViewObjectsHandler.cpp.

References myRedrawObjects.

Referenced by GNEViewNet::redrawContourElements().

Here is the caller graph for this function:

◆ getSelectedGeometryPoints()

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

get geometry points for the given glObject

Definition at line 350 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:

◆ getSelectedObjects()

◆ getSelectedPositionOverShape()

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

get position over shape

Definition at line 364 of file GUIViewObjectsHandler.cpp.

References Position::INVALID, and mySortedSelectedObjects.

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

Here is the caller graph for this function:

◆ getSelectionBoundary()

const Boundary & GUIViewObjectsHandler::getSelectionBoundary ( ) const

get selection boundary

Definition at line 61 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

Definition at line 55 of file GUIViewObjectsHandler.cpp.

References mySelectionPosition.

Referenced by GNEContour::calculateContourEdgeGeometryPoints().

Here is the caller graph for this function:

◆ isObjectSelected()

bool GUIViewObjectsHandler::isObjectSelected ( const GUIGlObject GLObject) const

check if element was already selected

Definition at line 338 of file GUIViewObjectsHandler.cpp.

References mySelectedObjects.

Referenced by checkBoundaryParentObject(), checkCircleObject(), GNENetworkElement::checkDrawingBoundarySelection(), checkShapeObject(), GNEAccess::drawGL(), GNEDemandElementPlan::drawPlanGL(), GNEDemandElementPlan::drawPlanJunctionPartial(), GNEDemandElementPlan::drawPlanLanePartial(), and selectObject().

Here is the caller graph for this function:

◆ isolateEdgeGeometryPoints()

void GUIViewObjectsHandler::isolateEdgeGeometryPoints ( )

isolate edge geometry points (used for moving)

Definition at line 434 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

◆ reset()

void GUIViewObjectsHandler::reset ( )

reset view objects handler

Definition at line 36 of file GUIViewObjectsHandler.cpp.

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

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

Here is the caller graph for this function:

◆ selectGeometryPoint()

bool GUIViewObjectsHandler::selectGeometryPoint ( const GUIGlObject GLObject,
const int  newIndex,
const double  layer 
)

add geometryPoint into list of elements under cursor

Definition at line 283 of file GUIViewObjectsHandler.cpp.

References mySelectedObjects, and mySortedSelectedObjects.

Referenced by checkGeometryPoint().

Here is the caller graph for this function:

◆ selectObject()

bool GUIViewObjectsHandler::selectObject ( const GUIGlObject GLObject,
const double  layer,
const bool  checkDuplicated,
const bool  fullBoundary 
)

Definition at line 268 of file GUIViewObjectsHandler.cpp.

References isObjectSelected(), mySelectedObjects, and mySortedSelectedObjects.

Referenced by GNEEdge::calculateEdgeContour(), GNEJunction::calculateJunctioncontour(), checkBoundaryParentObject(), checkCircleObject(), and checkShapeObject().

Here is the caller graph for this function:

◆ selectPositionOverShape()

bool GUIViewObjectsHandler::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)

Definition at line 311 of file GUIViewObjectsHandler.cpp.

References Position::INVALID, mySelectedObjects, and mySortedSelectedObjects.

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

Here is the caller graph for this function:

◆ setSelectionBoundary()

void GUIViewObjectsHandler::setSelectionBoundary ( const Boundary boundary)

set selection boundary

Definition at line 77 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

Definition at line 67 of file GUIViewObjectsHandler.cpp.

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

Referenced by GNEViewNet::updateObjectsInPosition().

Here is the caller graph for this function:

◆ updateFrontObject()

void GUIViewObjectsHandler::updateFrontObject ( const GUIGlObject GLObject)

move the given object to the front (currently used only in netedit)

Definition at line 409 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 167 of file GUIViewObjectsHandler.h.

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

◆ markedFirstGeometryPoint

const GUIGlObject* GUIViewObjectsHandler::markedFirstGeometryPoint = nullptr

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

Definition at line 179 of file GUIViewObjectsHandler.h.

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

◆ markedLane

const GNELane* GUIViewObjectsHandler::markedLane = nullptr

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

Definition at line 170 of file GUIViewObjectsHandler.h.

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

◆ markedRoute

const GNERoute* GUIViewObjectsHandler::markedRoute = nullptr

marked route (used in create vehicle mode)

Definition at line 176 of file GUIViewObjectsHandler.h.

Referenced by reset().

◆ markedSecondGeometryPoint

const GUIGlObject* GUIViewObjectsHandler::markedSecondGeometryPoint = nullptr

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

Definition at line 182 of file GUIViewObjectsHandler.h.

Referenced by reset().

◆ markedTAZ

const GUIGlObject* GUIViewObjectsHandler::markedTAZ = nullptr

marked TAZ (used in create TAZRel mode)

Definition at line 173 of file GUIViewObjectsHandler.h.

Referenced by reset().

◆ myEmptyGeometryPoints

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

empty geometry points

Definition at line 204 of file GUIViewObjectsHandler.h.

Referenced by getSelectedGeometryPoints().

◆ myMergingJunctions

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

merging junctions

Definition at line 207 of file GUIViewObjectsHandler.h.

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

◆ myRedrawObjects

std::set<const GUIGlObject*> GUIViewObjectsHandler::myRedrawObjects
protected

set with element marked for redrawing

Definition at line 192 of file GUIViewObjectsHandler.h.

Referenced by addToRedrawObjects(), getRedrawObjects(), and reset().

◆ 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 selections)

Definition at line 189 of file GUIViewObjectsHandler.h.

Referenced by checkBoundaryParentObject(), isObjectSelected(), reset(), selectGeometryPoint(), selectObject(), and selectPositionOverShape().

◆ mySelectionBoundary

Boundary GUIViewObjectsHandler::mySelectionBoundary
protected

◆ mySelectionBoundaryShape

PositionVector GUIViewObjectsHandler::mySelectionBoundaryShape
protected

selection boundary (shape)

Definition at line 198 of file GUIViewObjectsHandler.h.

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

◆ mySelectionPosition

Position GUIViewObjectsHandler::mySelectionPosition
protected

◆ mySortedSelectedObjects

◆ recomputeBoundaries

GUIGlObjectType GUIViewObjectsHandler::recomputeBoundaries = GLO_NETWORK

recompute boundaries

Definition at line 164 of file GUIViewObjectsHandler.h.

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


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