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...
struct  ObjectContainerLayer
 object container layer More...

Public Types

typedef std::map< double, ObjectContainerLayerGLObjectsSortedContainer
 typedef for pack elements sorted by layer

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 TrianglegetSelectionTriangle () const
 get selection triangle
void setSelectionPosition (const Position &pos)
 set selection position
void setSelectionTriangle (const Triangle &triangle)
 set selection triangle
bool selectingUsingRectangle () const
 return true if we're selecting using a triangle
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 double layer, const GUIGlObject *parent)
bool checkCircleObject (const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position &center, const double radius, 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, const GNESegment *segment)
 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 GNESegment *segment)
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
bool checkRectangleSelection (const GUIVisualizationSettings &s, const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
 check rectangle selection
const GLObjectsSortedContainergetSelectedObjects () const
 get all elements under cursor sorted by layer
const GNESegmentgetSelectedSegment (const GUIGlObject *GLObject) const
 get segment associated with the given GLObject (if exist)
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
int getNumberOfSelectedObjects () const
 get number of selected objects
void reverseSelectedObjects ()
 reverse selected objects
functions related with redrawing path elements

get redrawing objects

const std::set< const GNEPathElement * > & getRedrawPathElements () const
bool isPathElementMarkForRedraw (const GNEPathElement *pathElement) const
 check if the given path element has to be redraw again
void addToRedrawPathElements (const GNEPathElement *pathElement)
 add path element to redrawing set
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
int myNumberOfSelectedObjects = 0
 number of selected objects
std::set< const GNEPathElement * > myRedrawPathElements
 set with path elements marked for redrawing
std::unordered_map< const GUIGlObject *, const GNESegment * > mySelectedObjects
 map with selected elements and if was selected with full boundary (used only to avoid double selections)
Position mySelectionPosition
 position
Triangle mySelectionTriangle
 selection triangle
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 44 of file GUIViewObjectsHandler.h.

Member Typedef Documentation

◆ GLObjectsSortedContainer

typedef for pack elements sorted by layer

Definition at line 78 of file GUIViewObjectsHandler.h.

Constructor & Destructor Documentation

◆ GUIViewObjectsHandler() [1/2]

GUIViewObjectsHandler::GUIViewObjectsHandler ( )

constructor

Definition at line 32 of file GUIViewObjectsHandler.cpp.

Referenced by GUIViewObjectsHandler(), and operator=().

Here is the caller graph for this function:

◆ GUIViewObjectsHandler() [2/2]

GUIViewObjectsHandler::GUIViewObjectsHandler ( const GUIViewObjectsHandler & )
privatedefault

set copy constructor private

References GUIViewObjectsHandler().

Member Function Documentation

◆ addMergingJunctions()

bool GUIViewObjectsHandler::addMergingJunctions ( const GNEJunction * junction)

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

Definition at line 420 of file GUIViewObjectsHandler.cpp.

References myMergingJunctions.

◆ addToRedrawPathElements()

void GUIViewObjectsHandler::addToRedrawPathElements ( const GNEPathElement * pathElement)

add path element to redrawing set

Definition at line 408 of file GUIViewObjectsHandler.cpp.

References myRedrawPathElements.

◆ checkBoundaryParentObject()

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

Definition at line 92 of file GUIViewObjectsHandler.cpp.

References Triangle::INVALID, isObjectSelected(), mySelectedObjects, mySelectionTriangle, and selectObject().

Referenced by checkRectangleSelection().

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 double layer )

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

◆ checkRectangleSelection()

bool GUIViewObjectsHandler::checkRectangleSelection ( const GUIVisualizationSettings & s,
const GUIGlObject * GLObject,
const double layer,
const GUIGlObject * parent )

check rectangle selection

Definition at line 322 of file GUIViewObjectsHandler.cpp.

References checkBoundaryParentObject(), and GUIVisualizationSettings::drawForRectangleSelection.

◆ checkShapeObject()

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

◆ getMergingJunctions()

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

Definition at line 414 of file GUIViewObjectsHandler.cpp.

References myMergingJunctions.

◆ getNumberOfSelectedObjects()

int GUIViewObjectsHandler::getNumberOfSelectedObjects ( ) const

get number of selected objects

Definition at line 378 of file GUIViewObjectsHandler.cpp.

References myNumberOfSelectedObjects.

◆ getRedrawPathElements()

const std::set< const GNEPathElement * > & GUIViewObjectsHandler::getRedrawPathElements ( ) const

Definition at line 392 of file GUIViewObjectsHandler.cpp.

References myRedrawPathElements.

◆ 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.

◆ getSelectedObjects()

const GUIViewObjectsHandler::GLObjectsSortedContainer & GUIViewObjectsHandler::getSelectedObjects ( ) const

get all elements under cursor sorted by layer

Definition at line 333 of file GUIViewObjectsHandler.cpp.

References mySortedSelectedObjects.

◆ 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.

◆ getSelectedSegment()

const GNESegment * GUIViewObjectsHandler::getSelectedSegment ( const GUIGlObject * GLObject) const

get segment associated with the given GLObject (if exist)

Definition at line 339 of file GUIViewObjectsHandler.cpp.

References mySelectedObjects.

◆ getSelectionPosition()

const Position & GUIViewObjectsHandler::getSelectionPosition ( ) const

Definition at line 56 of file GUIViewObjectsHandler.cpp.

References mySelectionPosition.

◆ getSelectionTriangle()

const Triangle & GUIViewObjectsHandler::getSelectionTriangle ( ) const

get selection triangle

Definition at line 62 of file GUIViewObjectsHandler.cpp.

References mySelectionTriangle.

◆ isObjectSelected()

bool GUIViewObjectsHandler::isObjectSelected ( const GUIGlObject * GLObject) const

check if element was already selected

Definition at line 316 of file GUIViewObjectsHandler.cpp.

References mySelectedObjects.

Referenced by checkBoundaryParentObject(), checkCircleObject(), checkShapeObject(), and selectObject().

Here is the caller graph for this function:

◆ isolateEdgeGeometryPoints()

void GUIViewObjectsHandler::isolateEdgeGeometryPoints ( )

isolate edge geometry points (used for moving)

Definition at line 458 of file GUIViewObjectsHandler.cpp.

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

◆ isPathElementMarkForRedraw()

bool GUIViewObjectsHandler::isPathElementMarkForRedraw ( const GNEPathElement * pathElement) const

check if the given path element has to be redraw again

Definition at line 398 of file GUIViewObjectsHandler.cpp.

References myRedrawPathElements.

◆ operator=()

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

set assignment operator private

References GUIViewObjectsHandler().

◆ reset()

◆ reverseSelectedObjects()

void GUIViewObjectsHandler::reverseSelectedObjects ( )

reverse selected objects

Definition at line 384 of file GUIViewObjectsHandler.cpp.

References mySortedSelectedObjects.

◆ selectGeometryPoint()

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

add geometryPoint into list of elements under cursor

Definition at line 259 of file GUIViewObjectsHandler.cpp.

References myNumberOfSelectedObjects, mySelectedObjects, and mySortedSelectedObjects.

Referenced by checkGeometryPoint().

Here is the caller graph for this function:

◆ selectingUsingRectangle()

bool GUIViewObjectsHandler::selectingUsingRectangle ( ) const

return true if we're selecting using a triangle

Definition at line 86 of file GUIViewObjectsHandler.cpp.

References Triangle::INVALID, and mySelectionTriangle.

Referenced by checkCircleObject(), checkGeometryPoint(), and checkShapeObject().

Here is the caller graph for this function:

◆ selectObject()

bool GUIViewObjectsHandler::selectObject ( const GUIGlObject * GLObject,
const double layer,
const bool checkDuplicated,
const GNESegment * segment )

Definition at line 243 of file GUIViewObjectsHandler.cpp.

References isObjectSelected(), myNumberOfSelectedObjects, mySelectedObjects, and mySortedSelectedObjects.

Referenced by checkBoundaryParentObject(), checkCircleObject(), checkGeometryPoint(), 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 288 of file GUIViewObjectsHandler.cpp.

References Position::INVALID, myNumberOfSelectedObjects, mySelectedObjects, and mySortedSelectedObjects.

Referenced by checkPositionOverShape().

Here is the caller graph for this function:

◆ setSelectionPosition()

void GUIViewObjectsHandler::setSelectionPosition ( const Position & pos)

set selection position

Definition at line 68 of file GUIViewObjectsHandler.cpp.

References Triangle::INVALID, mySelectionPosition, and mySelectionTriangle.

◆ setSelectionTriangle()

void GUIViewObjectsHandler::setSelectionTriangle ( const Triangle & triangle)

set selection triangle

Definition at line 77 of file GUIViewObjectsHandler.cpp.

References Position::INVALID, mySelectionPosition, and mySelectionTriangle.

◆ updateFrontObject()

void GUIViewObjectsHandler::updateFrontObject ( const GUIGlObject * GLObject)

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

Definition at line 433 of file GUIViewObjectsHandler.cpp.

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

Field Documentation

◆ markedEdge

const GNEEdge* GUIViewObjectsHandler::markedEdge = nullptr

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

Definition at line 200 of file GUIViewObjectsHandler.h.

Referenced by reset().

◆ markedFirstGeometryPoint

const GUIGlObject* GUIViewObjectsHandler::markedFirstGeometryPoint = nullptr

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

Definition at line 212 of file GUIViewObjectsHandler.h.

Referenced by reset().

◆ markedLane

const GNELane* GUIViewObjectsHandler::markedLane = nullptr

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

Definition at line 203 of file GUIViewObjectsHandler.h.

Referenced by reset().

◆ markedRoute

const GNERoute* GUIViewObjectsHandler::markedRoute = nullptr

marked route (used in create vehicle mode)

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

Referenced by reset().

◆ markedTAZ

const GUIGlObject* GUIViewObjectsHandler::markedTAZ = nullptr

marked TAZ (used in create TAZRel mode)

Definition at line 206 of file GUIViewObjectsHandler.h.

Referenced by reset().

◆ myEmptyGeometryPoints

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

empty geometry points

Definition at line 237 of file GUIViewObjectsHandler.h.

Referenced by getSelectedGeometryPoints().

◆ myMergingJunctions

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

merging junctions

Definition at line 240 of file GUIViewObjectsHandler.h.

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

◆ myNumberOfSelectedObjects

int GUIViewObjectsHandler::myNumberOfSelectedObjects = 0
protected

number of selected objects

Definition at line 225 of file GUIViewObjectsHandler.h.

Referenced by getNumberOfSelectedObjects(), reset(), selectGeometryPoint(), selectObject(), and selectPositionOverShape().

◆ myRedrawPathElements

std::set<const GNEPathElement*> GUIViewObjectsHandler::myRedrawPathElements
protected

set with path elements marked for redrawing

Definition at line 228 of file GUIViewObjectsHandler.h.

Referenced by addToRedrawPathElements(), getRedrawPathElements(), isPathElementMarkForRedraw(), and reset().

◆ mySelectedObjects

std::unordered_map<const GUIGlObject*, const GNESegment*> GUIViewObjectsHandler::mySelectedObjects
protected

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

Definition at line 222 of file GUIViewObjectsHandler.h.

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

◆ mySelectionPosition

Position GUIViewObjectsHandler::mySelectionPosition
protected

◆ mySelectionTriangle

◆ mySortedSelectedObjects

◆ recomputeBoundaries

GUIGlObjectType GUIViewObjectsHandler::recomputeBoundaries = GLO_NETWORK

recompute boundaries

Definition at line 197 of file GUIViewObjectsHandler.h.

Referenced by reset().


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