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 | addMergingJunctions (const GNEJunction *junction) |
add to merging junctions (used for marking junctions to merge) 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 std::vector< const GNEJunction * > & | getMergingJunctions () const |
get merging junctions 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::vector< const GNEJunction * > | myMergingJunctions |
merging junctions 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 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 bool | checkDuplicated, | ||
const bool | fullBoundary | ||
) |
add element into list of elements under cursor
Definition at line 272 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 293 of file GUIViewObjectsHandler.cpp.
References GUIGlObject::getType(), 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 447 of file GUIViewObjectsHandler.cpp.
References myMergingJunctions.
Referenced by GNEJunction::checkDrawToContour().
bool GUIViewObjectsHandler::addPositionOverShape | ( | const GUIGlObject * | GLObject, |
const Position & | pos, | ||
const double | offset | ||
) |
add position over shape
Definition at line 327 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 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 | ||
) |
check if mouse is within elements geometry (for circles)
Definition at line 110 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 165 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 216 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 236 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 366 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 441 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 380 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 360 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(), GNEAdditional::checkDrawFromContour(), GNEEdge::checkDrawFromContour(), GNENetworkElement::checkDrawingBoundarySelection(), GNEAdditional::checkDrawToContour(), GNEEdge::checkDrawToContour(), checkShapeElement(), GNEAccess::drawGL(), GNEDemandElementPlan::drawPlanGL(), GNEDemandElementPlan::drawPlanJunctionPartial(), and GNEDemandElementPlan::drawPlanLanePartial().
void GUIViewObjectsHandler::isolateEdgeGeometryPoints | ( | ) |
isolate edge geometry points (used for moving)
Definition at line 419 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 394 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 140 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 152 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 143 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 149 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 155 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements().
const GUIGlObject* GUIViewObjectsHandler::markedTAZ = nullptr |
marked TAZ (used in create TAZRel mode)
Definition at line 146 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements().
|
protected |
empty geometry points
Definition at line 174 of file GUIViewObjectsHandler.h.
Referenced by getGeometryPoints().
|
protected |
merging junctions
Definition at line 177 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 162 of file GUIViewObjectsHandler.h.
Referenced by addElementUnderCursor(), addGeometryPointUnderCursor(), addPositionOverShape(), checkBoundaryParentElement(), clearSelectedElements(), and isElementSelected().
|
protected |
selection boundary
Definition at line 165 of file GUIViewObjectsHandler.h.
Referenced by checkBoundaryParentElement(), checkCircleElement(), checkGeometryPoint(), checkShapeElement(), getSelectionBoundary(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
selection boundary (shape)
Definition at line 168 of file GUIViewObjectsHandler.h.
Referenced by checkCircleElement(), checkGeometryPoint(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
position
Definition at line 171 of file GUIViewObjectsHandler.h.
Referenced by checkCircleElement(), checkGeometryPoint(), checkPositionOverShape(), checkShapeElement(), getSelectionPosition(), setSelectionBoundary(), and setSelectionPosition().
|
protected |
selected element sorted by layer
Definition at line 159 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 137 of file GUIViewObjectsHandler.h.
Referenced by clearSelectedElements(), and GUIDialog_ViewSettings::SizePanel::onCmdSizeChange().