Eclipse SUMO - Simulation of Urban MObility
|
#include <GUIViewObjectsHandler.h>
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 ¢er, 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 Position & | getPositionOverShape (const GUIGlObject *GLObject) const |
get position over shape | |
const GLObjectsSortedContainer & | getSelectedObjects () const |
get all elements under cursor sorted by layer | |
const Boundary & | getSelectionBoundary () const |
get selection boundary (usually the mouse position) | |
const Position & | getSelectionPosition () 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 GNEEdge * | markedEdge = nullptr |
marked edge (used in create edge mode, for splitting) | |
const GUIGlObject * | markedFirstGeometryPoint = nullptr |
marked first geometry point (used for moving/delete geometry points) | |
const GNELane * | markedLane = nullptr |
marked lane (used in create edge mode, for splitting) | |
const GNERoute * | markedRoute = nullptr |
marked route (used in create vehicle mode) | |
const GUIGlObject * | markedSecondGeometryPoint = nullptr |
marked first geometry point (used for moving/delete geometry points) | |
const GUIGlObject * | markedTAZ = 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 | |
GUIViewObjectsHandler & | operator= (const GUIViewObjectsHandler &)=default |
set assignment operator private | |
Definition at line 40 of file GUIViewObjectsHandler.h.
typedef std::map<double, std::vector<ObjectContainer> > GUIViewObjectsHandler::GLObjectsSortedContainer |
typedef
Definition at line 64 of file GUIViewObjectsHandler.h.
GUIViewObjectsHandler::GUIViewObjectsHandler | ( | ) |
constructor
Definition at line 32 of file GUIViewObjectsHandler.cpp.
|
privatedefault |
set copy constructor private
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().
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().
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().
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().
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().
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().
bool GUIViewObjectsHandler::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
Definition at line 166 of file GUIViewObjectsHandler.cpp.
References Boundary::add(), addGeometryPointUnderCursor(), Boundary::around2D(), Boundary::contains(), Position::distanceSquaredTo2D(), Boundary::grow(), Position::INVALID, Boundary::isInitialised(), mySelectionBoundary, mySelectionBoundaryShape, mySelectionPosition, Boundary::overlapsWith(), and GUIVisualizationSettings::PreciseSelection.
Referenced by GNEContour::calculateContourAllGeometryPoints(), GNEContour::calculateContourEdgeGeometryPoints(), GNEContour::calculateContourFirstGeometryPoint(), GNEContour::calculateContourLastGeometryPoint(), and GNEContour::calculateContourMiddleGeometryPoints().
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().
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().
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().
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().
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().
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().
const GUIViewObjectsHandler::GLObjectsSortedContainer & GUIViewObjectsHandler::getSelectedObjects | ( | ) | const |
get all elements under cursor sorted by layer
Definition at line 343 of file GUIViewObjectsHandler.cpp.
References mySortedSelectedObjects.
Referenced by GNEViewNet::getAdditionalAtPopupPosition(), GNEViewNet::getConnectionAtPopupPosition(), GNEViewNet::getCrossingAtPopupPosition(), GNEViewNet::getDemandElementAtPopupPosition(), GNEViewNet::getEdgeAtPopupPosition(), GNEViewNet::getJunctionAtPopupPosition(), GNEViewNet::getLaneAtPopupPosition(), GNEViewNet::getPOIAtPopupPosition(), GNEViewNet::getPolygonAtPopupPosition(), GNEViewNet::getShapeEditedAtPopupPosition(), GNEViewNet::getTAZAtPopupPosition(), GNEViewNet::getWalkingAreaAtPopupPosition(), and GNEViewNetHelper::ViewObjectsSelector::updateObjects().
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().
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().
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().
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().
|
privatedefault |
set assignment operator private
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().
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().
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().
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().
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().
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().
const GNERoute* GUIViewObjectsHandler::markedRoute = nullptr |
marked route (used in create vehicle mode)
Definition at line 151 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements().
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().
const GUIGlObject* GUIViewObjectsHandler::markedTAZ = nullptr |
marked TAZ (used in create TAZRel mode)
Definition at line 148 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements().
|
protected |
empty geometry points
Definition at line 176 of file GUIViewObjectsHandler.h.
Referenced by getGeometryPoints().
|
protected |
merging junctions
Definition at line 179 of file GUIViewObjectsHandler.h.
Referenced by addMergingJunctions(), clearSelectedElements(), and getMergingJunctions().
|
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().
|
protected |
selection boundary
Definition at line 167 of file GUIViewObjectsHandler.h.
Referenced by checkBoundaryParentElement(), checkCircleElement(), checkGeometryPoint(), checkShapeElement(), getSelectionBoundary(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
selection boundary (shape)
Definition at line 170 of file GUIViewObjectsHandler.h.
Referenced by checkCircleElement(), checkGeometryPoint(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
position
Definition at line 173 of file GUIViewObjectsHandler.h.
Referenced by checkCircleElement(), checkGeometryPoint(), checkPositionOverShape(), checkShapeElement(), getSelectionPosition(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
selected element sorted by layer
Definition at line 161 of file GUIViewObjectsHandler.h.
Referenced by addElementUnderCursor(), addGeometryPointUnderCursor(), addPositionOverShape(), clearSelectedElements(), getGeometryPoints(), getPositionOverShape(), getSelectedObjects(), isolateEdgeGeometryPoints(), and updateFrontElement().
GUIGlObjectType GUIViewObjectsHandler::recomputeBoundaries = GLO_NETWORK |
recompute boundaries
Definition at line 139 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements(), and GUIDialog_ViewSettings::SizePanel::onCmdSizeChange().