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 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 ¢er, 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 Position & | getPositionOverShape (const GUIGlObject *GLObject) const |
get position over shape More... | |
const GLObjectsSortedContainer & | getSelectedObjects () const |
get all elements under cursor sorted by layer More... | |
const Boundary & | getSelectionBoundary () const |
get selection boundary (usually the mouse position) More... | |
const Position & | getSelectionPosition () 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 GNEEdge * | markedEdge = nullptr |
marked edge (used in create edge mode, for splitting) More... | |
const GUIGlObject * | markedFirstGeometryPoint = nullptr |
marked first geometry point (used for moving/delete geometry points) More... | |
const GNELane * | markedLane = nullptr |
marked lane (used in create edge mode, for splitting) More... | |
const GNERoute * | markedRoute = nullptr |
marked route (used in create vehicle mode) More... | |
const GUIGlObject * | markedSecondGeometryPoint = nullptr |
marked first geometry point (used for moving/delete geometry points) More... | |
const GUIGlObject * | markedTAZ = 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... | |
GUIViewObjectsHandler & | operator= (const GUIViewObjectsHandler &)=default |
set assignment operator private More... | |
Definition at line 39 of file GUIViewObjectsHandler.h.
typedef std::map<double, std::vector<ObjectContainer> > GUIViewObjectsHandler::GLObjectsSortedContainer |
typedef
Definition at line 63 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 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().
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().
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().
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().
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().
bool GUIViewObjectsHandler::checkGeometryPoint | ( | const GUIVisualizationSettings::Detail | d, |
const GUIGlObject * | GLObject, | ||
const PositionVector & | shape, | ||
const int | index, | ||
const double | radius | ||
) |
check if mouse is within geometry point
Definition at line 164 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 | 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().
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().
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().
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().
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().
const GUIViewObjectsHandler::GLObjectsSortedContainer & GUIViewObjectsHandler::getSelectedObjects | ( | ) | const |
get all elements under cursor sorted by layer
Definition at line 359 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::getTAZAtPopupPosition(), GNEViewNet::getWalkingAreaAtPopupPosition(), and GNEViewNetHelper::ViewObjectsSelector::updateObjects().
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().
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().
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().
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().
|
privatedefault |
set assignment operator private
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().
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().
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().
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().
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().
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().
const GNERoute* GUIViewObjectsHandler::markedRoute = nullptr |
marked route (used in create vehicle mode)
Definition at line 142 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 148 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements().
const GUIGlObject* GUIViewObjectsHandler::markedTAZ = nullptr |
marked TAZ (used in create TAZRel mode)
Definition at line 139 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements().
|
protected |
empty geometry points
Definition at line 167 of file GUIViewObjectsHandler.h.
Referenced by getGeometryPoints().
|
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().
|
protected |
selection boundary
Definition at line 158 of file GUIViewObjectsHandler.h.
Referenced by checkBoundaryParentElement(), checkCircleElement(), checkGeometryPoint(), checkShapeElement(), getSelectionBoundary(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
selection boundary (shape)
Definition at line 161 of file GUIViewObjectsHandler.h.
Referenced by checkCircleElement(), checkGeometryPoint(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
position
Definition at line 164 of file GUIViewObjectsHandler.h.
Referenced by checkCircleElement(), checkGeometryPoint(), checkPositionOverShape(), checkShapeElement(), getSelectionPosition(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
selected element sorted by layer
Definition at line 152 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 130 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements(), and GUIDialog_ViewSettings::SizePanel::onCmdSizeChange().