![]() |
Eclipse SUMO - Simulation of Urban MObility
|
A RT-tree for efficient storing of SUMO's GL-objects in layers. More...
#include <LayeredRTree.h>
Public Member Functions | |
| void | add (const Boundary &p) |
| Makes the boundary include the given boundary. | |
| void | add (const Position &p) |
| Makes the boundary include the given coordinate. | |
| void | add (double x, double y, double z=0) |
| Makes the boundary include the given coordinate. | |
| void | addAdditionalGLObject (GUIGlObject *o, const double exaggeration=1) |
| Adds an additional object (detector/shape/trigger) for visualisation. | |
| bool | contains2D (const Boundary &b) const |
| return true if this boundary contains the given boundary (only X-Y) | |
| double | distanceTo2D (const Boundary &b) const |
| returns the euclidean distance in the x-y-plane | |
| double | distanceTo2D (const Position &p) const |
| returns the euclidean distance in the x-y-plane | |
| void | flipY () |
| flips ymin and ymax | |
| Position | getCenter () const |
| Returns the center of the boundary. | |
| double | getHeight () const |
| Returns the height of the boundary (y-axis). | |
| PositionVector | getShape (const bool closeShape) const |
| get position vector (shape) based on this boundary | |
| double | getWidth () const |
| Returns the width of the boudary (x-axis). | |
| double | getZRange () const |
| Returns the elevation range of the boundary (z-axis). | |
| Boundary & | grow (double by) |
| extends the boundary by the given amount | |
| void | growHeight (double by) |
| Increases the height of the boundary (y-axis). | |
| void | growWidth (double by) |
| Increases the width of the boundary (x-axis). | |
| void | Insert (const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId) |
| Insert entry (delegate to appropriate layer). | |
| bool | isInitialised () const |
| check if Boundary is Initialised | |
| LayeredRTree () | |
| Constructor. | |
| void | moveby (double x, double y, double z=0) |
| Moves the boundary by the given amount. | |
| bool | operator!= (const Boundary &b) const |
| Comparison operator not equal. | |
| bool | operator== (const Boundary &b) const |
| Comparison operator equal. | |
| bool | overlaps2D (const Boundary &b) const |
| return true if at least one point of the given boundary is in boundary(only X-Y) | |
| void | Remove (const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId) |
| Remove entry (delegate to appropriate layer). | |
| void | removeAdditionalGLObject (GUIGlObject *o, const double exaggeration=1) |
| Removes an additional object (detector/shape/trigger) from being visualised. | |
| void | reset () |
| Resets the boundary. | |
| Boundary & | scale (double by) |
| scale the boundary by the given amount | |
| int | Search (const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const |
| Find all within search rectangle (searches all layers in order). | |
| void | set (double xmin, double ymin, double xmax, double ymax) |
| Sets the boundary to the given values. | |
| void | setOffsets (double xmin, double ymin, double xmax, double ymax) |
| Sets the boundary to the given values, ignoring min < max constraints. | |
| void | updateBoundaries (GUIGlObjectType type) |
| update boundaries | |
| double | xmax () const |
| Returns maximum x-coordinate. | |
| double | xmin () const |
| Returns minimum x-coordinate. | |
| double | ymax () const |
| Returns maximum y-coordinate. | |
| double | ymin () const |
| Returns minimum y-coordinate. | |
| double | zmax () const |
| Returns maximum z-coordinate. | |
| double | zmin () const |
| Returns minimum z-coordinate. | |
| ~LayeredRTree () | |
| Destructor. | |
inherited from AbstractPoly | |
| bool | around (const Position &p, double offset=0) const |
| Returns whether the boundary contains the given coordinate. | |
| bool | around2D (const Position &p, double offset=0) const |
| Returns whether the boundary contains the given 2D coordinate (position). | |
| bool | around2D (const double x, const double y) const |
| Returns whether the boundary contains the given 2D coordinate (x-y version). | |
| bool | overlapsWith (const AbstractPoly &poly, double offset=0) const |
| Returns whether the boundary overlaps with the given polygon. | |
| bool | partialWithin (const AbstractPoly &poly, double offset=0) const |
| Returns whether the boundary is partially within the given polygon. | |
| bool | crosses (const Position &p1, const Position &p2) const |
| Returns whether the boundary crosses the given line. | |
Protected Attributes | |
| std::vector< SUMORTree * > | myLayers |
| the layers for drawing | |
| FXMutex | myLock |
| A mutex avoiding parallel change and traversal of the tree. | |
| int | myTreeSize = 0 |
| number of inserted elements | |
Private Member Functions | |
| bool | removeObjectFromTreeDebug (const GUIGlObject *obj) |
| remove object from TreeDebug | |
| size_t | selectLayer (GUIGlObject *o) |
| select the appropriate layer for each object | |
Private Attributes | |
| std::map< GUIGlObject *, Boundary > | myTreeDebug |
| Map only used for check that SUMORTree works as expected, only is used if option "gui-testing-debug-gl" is enabled. | |
| bool | myWasInitialised |
| Information whether the boundary was initialised. | |
| double | myXmax |
| double | myXmin |
| The boundaries. | |
| double | myYmax |
| double | myYmin |
| double | myZmax |
| double | myZmin |
A RT-tree for efficient storing of SUMO's GL-objects in layers.
This class maintains SUMORTrees for each layer (only 2 at the moment) but provides the same interface as SUMORTree
Definition at line 46 of file LayeredRTree.h.
|
inline |
Constructor.
Definition at line 49 of file LayeredRTree.h.
References myLayers, and SUMORTree::SUMORTree().
|
inline |
|
inherited |
Makes the boundary include the given boundary.
Definition at line 102 of file Boundary.cpp.
References add(), Boundary(), xmax(), xmin(), ymax(), ymin(), zmax(), and zmin().
|
inherited |
Makes the boundary include the given coordinate.
Definition at line 96 of file Boundary.cpp.
References add(), Position::x(), Position::y(), and Position::z().
|
inherited |
Makes the boundary include the given coordinate.
Definition at line 75 of file Boundary.cpp.
References myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.
Referenced by add(), add(), MSEdge::addSuccessor(), ROEdge::addSuccessor(), GUISUMOAbstractView::applyGLTransform(), Boundary(), Boundary(), GNEAdditionalHandler::buildTAZ(), GUIViewObjectsHandler::checkGeometryPoint(), NBNetBuilder::compute(), NIVissimConnection::computeBounding(), NIVissimDisturbance::computeBounding(), GUIEdge::getBoundary(), MSDevice_BTsender::VehicleInformation::getBoxBoundary(), PositionVector::getBoxBoundary(), GNEContainer::getCenteringBoundary(), GNEPerson::getCenteringBoundary(), GNERoute::getCenteringBoundary(), GNEVehicle::getCenteringBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), NBHeightMapper::loadTiff(), MSPModel_Striping::moveInDirection(), NIImporter_OpenDrive::myCharacters(), GNEShapeFrame::GEOPOICreator::onCmdCreateGEOPOI(), GNEViewNetHelper::SelectingArea::processEdgeRectangleSelection(), GNEViewNetHelper::SelectingArea::processRectangleSelection(), NBRailwayGeometryHelper::straigthenCorrdidor(), and GNEViewNet::updateObjectsInPosition().
|
inlineinherited |
Adds an additional object (detector/shape/trigger) for visualisation.
| [in] | o | The object to add |
Definition at line 122 of file SUMORTree.h.
References Boundary::Boundary(), StringUtils::format(), GUIGlObject::getCenteringBoundary(), GUIGlObject::getMicrosimID(), Insert(), myLock, myTreeDebug, myTreeSize, and MsgHandler::writeDebugGLMessages().
Referenced by GUINet::registerRenderedObject(), and updateBoundaries().
|
virtualinherited |
Returns whether the boundary contains the given coordinate.
Implements AbstractPoly.
Definition at line 169 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, myZmax, myZmin, Position::x(), Position::y(), and Position::z().
|
inherited |
|
inherited |
Returns whether the boundary contains the given 2D coordinate (position).
Definition at line 178 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, Position::x(), and Position::y().
Referenced by NBHeightMapper::getZ(), and overlaps2D().
|
inherited |
return true if this boundary contains the given boundary (only X-Y)
Definition at line 229 of file Boundary.cpp.
References Boundary(), myXmax, myXmin, myYmax, and myYmin.
Returns whether the boundary crosses the given line.
Implements AbstractPoly.
Definition at line 215 of file Boundary.cpp.
References PositionVector::intersects(), myXmax, myXmin, myYmax, and myYmin.
|
inherited |
returns the euclidean distance in the x-y-plane
Definition at line 296 of file Boundary.cpp.
References Boundary(), myXmax, myXmin, myYmax, and myYmin.
|
inherited |
returns the euclidean distance in the x-y-plane
Definition at line 262 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, Position::x(), and Position::y().
Referenced by libsumo::Helper::convertCartesianToRoadMap(), MSEdge::getDistanceTo(), and ROEdge::getDistanceTo().
|
inherited |
|
inherited |
Returns the center of the boundary.
Definition at line 109 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUIGlObject::getCenter(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), MSPModel_Striping::moveInDirection(), GUISUMOAbstractView::screenPos2NetPos(), and GUIOSGPerspectiveChanger::setViewport().
|
inherited |
Returns the height of the boundary (y-axis).
Definition at line 157 of file Boundary.cpp.
References myYmax, and myYmin.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUIPolygon::checkDraw(), libsumo::Helper::convertCartesianToRoadMap(), and GUISUMOAbstractView::screenPos2NetPos().
|
inherited |
get position vector (shape) based on this boundary
Definition at line 444 of file Boundary.cpp.
References myXmax, myXmin, myYmax, and myYmin.
Referenced by GNEAdditionalHandler::buildTAZ(), GNEViewNetHelper::SelectingArea::processBoundarySelection(), GNEViewNetHelper::SelectingArea::processEdgeRectangleSelection(), and LIBSUMO_NAMESPACE::Simulation::storeShape().
|
inherited |
Returns the width of the boudary (x-axis).
Definition at line 151 of file Boundary.cpp.
References myXmax, and myXmin.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUIPolygon::checkDraw(), libsumo::Helper::convertCartesianToRoadMap(), MSPModel_Striping::moveInDirection(), and GUISUMOAbstractView::screenPos2NetPos().
|
inherited |
Returns the elevation range of the boundary (z-axis).
Definition at line 163 of file Boundary.cpp.
References myZmax, and myZmin.
Referenced by NBNetBuilder::compute().
|
inherited |
extends the boundary by the given amount
Definition at line 340 of file Boundary.cpp.
References myXmax, myXmin, myYmax, and myYmin.
Referenced by NBEdgeCont::checkOverlap(), libsumo::Helper::collectObjectsInRange(), GUIEdge::getBoundary(), GNEAdditional::getCenteringBoundary(), GNEContainer::getCenteringBoundary(), GNEPerson::getCenteringBoundary(), GNEVehicle::getCenteringBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), NBEdgeCont::ignoreFilterMatch(), NBEdgeCont::joinTramEdges(), NWWriter_OpenDrive::mapmatchRoadObjects(), GNEShapeFrame::GEOPOICreator::onCmdCreateGEOPOI(), and GNEViewNet::updateObjectsInPosition().
|
inherited |
Increases the height of the boundary (y-axis).
Definition at line 366 of file Boundary.cpp.
References myYmax, and myYmin.
Referenced by scale().
|
inherited |
Increases the width of the boundary (x-axis).
Definition at line 359 of file Boundary.cpp.
References myXmax, and myXmin.
Referenced by MSPModel_Striping::moveInDirection(), and scale().
|
inlinevirtual |
Insert entry (delegate to appropriate layer).
| a_min | Min of bounding rect |
| a_max | Max of bounding rect |
| a_dataId | Positive Id of data. Maybe zero, but negative numbers not allowed. |
Reimplemented from SUMORTree.
Definition at line 69 of file LayeredRTree.h.
References myLayers, and selectLayer().
|
inherited |
check if Boundary is Initialised
Definition at line 256 of file Boundary.cpp.
References myWasInitialised.
Referenced by GUIViewObjectsHandler::checkShapeObject(), GNEAdditional::getCenteringBoundary(), GNERoute::getCenteringBoundary(), and NIImporter_OpenDrive::loadNetwork().
|
inherited |
|
inherited |
|
inherited |
Comparison operator equal.
Definition at line 390 of file Boundary.cpp.
References Boundary(), myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.
|
inherited |
return true if at least one point of the given boundary is in boundary(only X-Y)
Definition at line 240 of file Boundary.cpp.
References around2D(), and Boundary().
|
virtualinherited |
Returns whether the boundary overlaps with the given polygon.
Implements AbstractPoly.
Definition at line 194 of file Boundary.cpp.
References AbstractPoly::crosses(), myXmax, myXmin, myYmax, myYmin, AbstractPoly::partialWithin(), and partialWithin().
Referenced by NBEdgeCont::checkOverlap(), NBEdgeCont::ignoreFilterMatch(), and NIVissimConnectionCluster::overlapsWith().
|
virtualinherited |
Returns whether the boundary is partially within the given polygon.
Implements AbstractPoly.
Definition at line 330 of file Boundary.cpp.
References AbstractPoly::around(), myXmax, myXmin, myYmax, and myYmin.
Referenced by overlapsWith().
|
inlinevirtual |
Remove entry (delegate to appropriate layer).
| a_min | Min of bounding rect |
| a_max | Max of bounding rect |
| a_dataId | Positive Id of data. Maybe zero, but negative numbers not allowed. |
Reimplemented from SUMORTree.
Definition at line 79 of file LayeredRTree.h.
References myLayers, and selectLayer().
|
inlineinherited |
Removes an additional object (detector/shape/trigger) from being visualised.
| [in] | o | The object to remove |
Definition at line 158 of file SUMORTree.h.
References Boundary::Boundary(), StringUtils::format(), GUIGlObject::getCenteringBoundary(), GUIGlObject::getMicrosimID(), myLock, myTreeDebug, myTreeSize, Remove(), toString(), and MsgHandler::writeDebugGLMessages().
Referenced by updateBoundaries().
|
inlineprivateinherited |
remove object from TreeDebug
Definition at line 235 of file SUMORTree.h.
References myTreeDebug.
Referenced by updateBoundaries().
|
inherited |
Resets the boundary.
Definition at line 63 of file Boundary.cpp.
References myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.
|
inherited |
scale the boundary by the given amount
Definition at line 351 of file Boundary.cpp.
References growHeight(), growWidth(), myXmax, myXmin, myYmax, and myYmin.
|
inlinevirtual |
Find all within search rectangle (searches all layers in order).
| a_min | Min of search bounding rect |
| a_max | Max of search bounding rect |
| a_searchResult | Search result array. Caller should set grow size. Function will reset, not append to array. |
| a_resultCallback | Callback function to return result. Callback should return 'true' to continue searching |
| a_context | User context to pass as parameter to a_resultCallback |
Reimplemented from SUMORTree.
Definition at line 91 of file LayeredRTree.h.
References myLayers.
|
inlineprivate |
select the appropriate layer for each object
Definition at line 107 of file LayeredRTree.h.
References GUIGlObject::getType(), GLO_EDGE, GLO_LANE, GLO_PERSON, GLO_POI, and GLO_VEHICLE.
Referenced by Insert(), and Remove().
|
inherited |
|
inherited |
|
inlineinherited |
update boundaries
Definition at line 196 of file SUMORTree.h.
References addAdditionalGLObject(), GLO_ADDITIONALELEMENT, GLO_LOCKICON, GLO_SHAPE, GLO_TAZ, myTreeSize, removeAdditionalGLObject(), and removeObjectFromTreeDebug().
|
inherited |
Returns maximum x-coordinate.
Definition at line 121 of file Boundary.cpp.
References myXmax.
Referenced by add(), MSPModel_JuPedSim::add(), NIVissimConnectionCluster::add(), GUISUMOAbstractView::applyGLTransform(), NBPTStopCont::assignEdgeForFloatingStops(), NIVissimConnection::buildNodeClusters(), NBNetBuilder::compute(), GUIViewTraffic::doPaintGL(), GNEViewNet::drawGLElements(), NBPTStopCont::findAccessEdgesForRailStops(), Triangle::intersectWithShape(), Triangle::isBoundaryFullWithin(), NBEdgeCont::joinTramEdges(), NIImporter_OpenDrive::loadNetwork(), main(), GUISUMOAbstractView::makeSnapshot(), NWWriter_OpenDrive::mapmatchRoadObjects(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), NIVissimConnectionCluster::overlapsWith(), set(), setOffsets(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
|
inherited |
Returns minimum x-coordinate.
Definition at line 115 of file Boundary.cpp.
References myXmin.
Referenced by add(), MSPModel_JuPedSim::add(), NIVissimConnectionCluster::add(), GUISUMOAbstractView::applyGLTransform(), NBPTStopCont::assignEdgeForFloatingStops(), NIVissimConnection::buildNodeClusters(), NBNetBuilder::compute(), GUIViewTraffic::doPaintGL(), GNEViewNet::drawGLElements(), NBPTStopCont::findAccessEdgesForRailStops(), NBHeightMapper::getZ(), Triangle::intersectWithShape(), Triangle::isBoundaryFullWithin(), NBEdgeCont::joinTramEdges(), NIImporter_OpenDrive::loadNetwork(), main(), GUISUMOAbstractView::makeSnapshot(), NWWriter_OpenDrive::mapmatchRoadObjects(), NBNetBuilder::moveToOrigin(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), NIVissimConnectionCluster::overlapsWith(), GUISUMOAbstractView::screenPos2NetPos(), set(), setOffsets(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
|
inherited |
Returns maximum y-coordinate.
Definition at line 133 of file Boundary.cpp.
References myYmax.
Referenced by add(), MSPModel_JuPedSim::add(), GUISUMOAbstractView::applyGLTransform(), NBPTStopCont::assignEdgeForFloatingStops(), NBNetBuilder::compute(), GUIViewTraffic::doPaintGL(), GNEViewNet::drawGLElements(), NBPTStopCont::findAccessEdgesForRailStops(), NBHeightMapper::getZ(), Triangle::intersectWithShape(), Triangle::isBoundaryFullWithin(), NBEdgeCont::joinTramEdges(), NIImporter_OpenDrive::loadNetwork(), main(), GUISUMOAbstractView::makeSnapshot(), NWWriter_OpenDrive::mapmatchRoadObjects(), MSPModel_Striping::moveInDirection(), NBNetBuilder::moveToOrigin(), set(), setOffsets(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
|
inherited |
Returns minimum y-coordinate.
Definition at line 127 of file Boundary.cpp.
References myYmin.
Referenced by add(), MSPModel_JuPedSim::add(), GUISUMOAbstractView::applyGLTransform(), NBPTStopCont::assignEdgeForFloatingStops(), NBNetBuilder::compute(), GUIViewTraffic::doPaintGL(), GNEViewNet::drawGLElements(), NBPTStopCont::findAccessEdgesForRailStops(), Triangle::intersectWithShape(), Triangle::isBoundaryFullWithin(), NBEdgeCont::joinTramEdges(), NIImporter_OpenDrive::loadNetwork(), main(), GUISUMOAbstractView::makeSnapshot(), NWWriter_OpenDrive::mapmatchRoadObjects(), MSPModel_Striping::moveInDirection(), NBNetBuilder::moveToOrigin(), GUISUMOAbstractView::screenPos2NetPos(), set(), setOffsets(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
|
inherited |
Returns maximum z-coordinate.
Definition at line 145 of file Boundary.cpp.
References myZmax.
Referenced by add().
|
inherited |
Returns minimum z-coordinate.
Definition at line 139 of file Boundary.cpp.
References myZmin.
Referenced by add().
|
protected |
the layers for drawing
Definition at line 102 of file LayeredRTree.h.
Referenced by Insert(), LayeredRTree(), Remove(), Search(), and ~LayeredRTree().
|
mutableprotectedinherited |
A mutex avoiding parallel change and traversal of the tree.
Definition at line 223 of file SUMORTree.h.
Referenced by addAdditionalGLObject(), Insert(), Remove(), removeAdditionalGLObject(), Search(), SUMORTree(), and ~SUMORTree().
|
privateinherited |
Map only used for check that SUMORTree works as expected, only is used if option "gui-testing-debug-gl" is enabled.
Definition at line 232 of file SUMORTree.h.
Referenced by addAdditionalGLObject(), removeAdditionalGLObject(), and removeObjectFromTreeDebug().
|
protectedinherited |
number of inserted elements
Definition at line 226 of file SUMORTree.h.
Referenced by addAdditionalGLObject(), removeAdditionalGLObject(), and updateBoundaries().
|
privateinherited |
Information whether the boundary was initialised.
Definition at line 175 of file Boundary.h.
Referenced by add(), Boundary(), Boundary(), Boundary(), isInitialised(), operator==(), and reset().
|
privateinherited |
Definition at line 172 of file Boundary.h.
Referenced by add(), around(), around2D(), around2D(), Boundary(), Boundary(), Boundary(), contains2D(), crosses(), distanceTo2D(), distanceTo2D(), getCenter(), getShape(), getWidth(), grow(), growWidth(), moveby(), operator==(), overlapsWith(), partialWithin(), reset(), scale(), set(), setOffsets(), and xmax().
|
privateinherited |
The boundaries.
Definition at line 172 of file Boundary.h.
Referenced by add(), around(), around2D(), around2D(), Boundary(), Boundary(), Boundary(), contains2D(), crosses(), distanceTo2D(), distanceTo2D(), getCenter(), getShape(), getWidth(), grow(), growWidth(), moveby(), operator==(), overlapsWith(), partialWithin(), reset(), scale(), set(), setOffsets(), and xmin().
|
privateinherited |
Definition at line 172 of file Boundary.h.
Referenced by add(), around(), around2D(), around2D(), Boundary(), Boundary(), Boundary(), contains2D(), crosses(), distanceTo2D(), distanceTo2D(), flipY(), getCenter(), getHeight(), getShape(), grow(), growHeight(), moveby(), operator==(), overlapsWith(), partialWithin(), reset(), scale(), set(), setOffsets(), and ymax().
|
privateinherited |
Definition at line 172 of file Boundary.h.
Referenced by add(), around(), around2D(), around2D(), Boundary(), Boundary(), Boundary(), contains2D(), crosses(), distanceTo2D(), distanceTo2D(), flipY(), getCenter(), getHeight(), getShape(), grow(), growHeight(), moveby(), operator==(), overlapsWith(), partialWithin(), reset(), scale(), set(), setOffsets(), and ymin().
|
privateinherited |
Definition at line 172 of file Boundary.h.
Referenced by add(), around(), Boundary(), Boundary(), Boundary(), getCenter(), getZRange(), moveby(), operator==(), reset(), and zmax().
|
privateinherited |
Definition at line 172 of file Boundary.h.
Referenced by add(), around(), Boundary(), Boundary(), Boundary(), getCenter(), getZRange(), moveby(), operator==(), reset(), and zmin().