![]() |
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 (SUMOReal x, SUMOReal y) |
Makes the boundary include the given coordinate. More... | |
void | add (const Position &p) |
Makes the boundary include the given coordinate. More... | |
void | add (const Boundary &p) |
Makes the boundary include the given boundary. More... | |
void | addAdditionalGLObject (GUIGlObject *o) |
Adds an additional object (detector/shape/trigger) for visualisation. More... | |
bool | around (const Position &p, SUMOReal offset=0) const |
Returns whether the boundary contains the given coordinate. More... | |
bool | crosses (const Position &p1, const Position &p2) const |
Returns whether the boundary crosses the given line. More... | |
void | flipY () |
flips ymin and ymax More... | |
Position | getCenter () const |
Returns the center of the boundary. More... | |
SUMOReal | getHeight () const |
Returns the height of the boundary. More... | |
SUMOReal | getWidth () const |
Returns the width of the boudary. More... | |
Boundary & | grow (SUMOReal by) |
extends the boundary by the given amount More... | |
void | growHeight (SUMOReal by) |
void | growWidth (SUMOReal by) |
void | Insert (const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId) |
Insert entry (delegate to appropriate layer) More... | |
LayeredRTree () | |
Constructor. More... | |
void | moveby (SUMOReal x, SUMOReal y) |
Moves the boundary by the given amount. More... | |
bool | overlapsWith (const AbstractPoly &poly, SUMOReal offset=0) const |
Returns whether the boundary overlaps with the given polygon. More... | |
bool | partialWithin (const AbstractPoly &poly, SUMOReal offset=0) const |
Returns whether the boundary is partially within the given polygon. More... | |
void | Remove (const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId) |
Remove entry (delegate to appropriate layer) More... | |
void | removeAdditionalGLObject (GUIGlObject *o) |
Removes an additional object (detector/shape/trigger) from being visualised. More... | |
void | reset () |
Resets the boundary. More... | |
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) More... | |
void | set (SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) |
Sets the boundary to the given values. More... | |
SUMOReal | xmax () const |
Returns maximum x-coordinate. More... | |
SUMOReal | xmin () const |
Returns minimum x-coordinate. More... | |
SUMOReal | ymax () const |
Returns maximum y-coordinate. More... | |
SUMOReal | ymin () const |
Returns minimum y-coordinate. More... | |
~LayeredRTree () | |
Destructor. More... | |
Protected Attributes | |
std::vector< SUMORTree * > | myLayers |
the layers for drawing More... | |
MFXMutex | myLock |
A mutex avoiding parallel change and traversal of the tree. More... | |
Private Member Functions | |
size_t | selectLayer (GUIGlObject *o) |
select the appropriate layer for each object More... | |
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 56 of file LayeredRTree.h.
|
inline |
Constructor.
Definition at line 59 of file LayeredRTree.h.
References myLayers, and SUMORTree::SUMORTree().
|
inline |
Makes the boundary include the given coordinate.
Definition at line 76 of file Boundary.cpp.
References Boundary::myWasInitialised, Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
Referenced by Boundary::add(), NIVissimConnectionCluster::NodeSubCluster::add(), NIVissimConnectionCluster::add(), Boundary::Boundary(), GUIDanielPerspectiveChanger::centerTo(), NBNetBuilder::compute(), NIVissimDisturbance::computeBounding(), NIVissimConnection::computeBounding(), GNEEdge::getBoundary(), GUIEdge::getBoundary(), PositionVector::getBoxBoundary(), MSDevice_BTsender::VehicleInformation::getBoxBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIContainer::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUIBaseVehicle::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GNENet::GNENet(), GUICalibrator::GUICalibrator(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUITriggeredRerouter::GUITriggeredRerouter(), GUITriggeredRerouter::GUITriggeredRerouterEdge::GUITriggeredRerouterEdge(), GUINet::initGUIStructures(), NBHeightMapper::loadShapeFile(), NBHeightMapper::loadTiff(), GNEViewNet::mergeJunctions(), GUITriggeredRerouter::myEndElement(), GUIMEInductLoop::MyWrapper::MyWrapper(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUI_E2_ZS_CollectorOverLanes::MyWrapper::MyWrapper(), GUIE3Collector::MyWrapper::MyWrapper(), GUIInductLoop::MyWrapper::MyWrapper(), GNEViewNet::onLeftBtnRelease(), NIVissimConnectionCluster::recomputeBoundary(), GNENet::registerEdge(), GNENet::registerJunction(), GUIDanielPerspectiveChanger::setViewport(), GNEJunction::updateGeometry(), and GeoConvHelper::x2cartesian().
|
inherited |
Makes the boundary include the given coordinate.
Definition at line 93 of file Boundary.cpp.
References Boundary::add(), Position::x(), and Position::y().
|
inherited |
Makes the boundary include the given boundary.
Definition at line 99 of file Boundary.cpp.
References Boundary::add(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
|
inlineinherited |
Adds an additional object (detector/shape/trigger) for visualisation.
[in] | o | The object to add |
Definition at line 129 of file SUMORTree.h.
References GUIGlObject::getCenteringBoundary(), SUMORTree::Insert(), SUMORTree::myLock, Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by GUIShapeContainer::addPOI(), GUIShapeContainer::addPolygon(), GNEConnectorFrame::buildIinternalLanes(), GNETLSEditorFrame::buildIinternalLanes(), GUINet::createTLWrapper(), GUITriggeredRerouter::GUITriggeredRerouter(), GUINet::initGUIStructures(), GNENet::insertAdditional(), GUIShapeContainer::movePOI(), GNEViewNet::onCmdNodeShape(), GNENet::refreshElement(), GNENet::registerEdge(), GNENet::registerJunction(), and GUIShapeContainer::reshapePolygon().
Returns whether the boundary contains the given coordinate.
Implements AbstractPoly.
Definition at line 148 of file Boundary.cpp.
References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, Boundary::myYmin, Position::x(), and Position::y().
Referenced by PCPolyContainer::add(), NIVissimConnectionCluster::around(), NBHeightMapper::getZ(), and NIVissimConnectionCluster::recheckEdges().
Returns whether the boundary crosses the given line.
Implements AbstractPoly.
Definition at line 177 of file Boundary.cpp.
References PositionVector::intersects(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
|
inherited |
flips ymin and ymax
Definition at line 223 of file Boundary.cpp.
References Boundary::myYmax, Boundary::myYmin, and SUMOReal.
Referenced by GeoConvHelper::computeFinal().
|
inherited |
Returns the center of the boundary.
Definition at line 106 of file Boundary.cpp.
References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, Boundary::myYmin, and SUMOReal.
Referenced by GUISUMOAbstractView::centerTo(), GUIDanielPerspectiveChanger::getXPos(), GUIDanielPerspectiveChanger::getYPos(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), GUIBaseVehicle::setFunctionalColor(), and GUIDanielPerspectiveChanger::zoom().
|
inherited |
Returns the height of the boundary.
Definition at line 142 of file Boundary.cpp.
References Boundary::myYmax, and Boundary::myYmin.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUIPolygon::drawGL(), GUISUMOAbstractView::getGridHeight(), GUISUMOAbstractView::getPositionInformation(), GNENet::GNENet(), GUIJunctionWrapper::GUIJunctionWrapper(), GUINet::initGUIStructures(), GUIDanielPerspectiveChanger::onKeyPress(), GUIPerspectiveChanger::patchedViewPort(), and GNEJunction::updateGeometry().
|
inherited |
Returns the width of the boudary.
Definition at line 136 of file Boundary.cpp.
References Boundary::myXmax, Boundary::myXmin, and SUMOReal.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUIPolygon::drawGL(), GUISUMOAbstractView::getGridWidth(), GUISUMOAbstractView::getPositionInformation(), GUIDanielPerspectiveChanger::getZoom(), GUIDanielPerspectiveChanger::getZPos(), GNENet::GNENet(), GUIJunctionWrapper::GUIJunctionWrapper(), GUINet::initGUIStructures(), GUISUMOAbstractView::m2p(), GUIDanielPerspectiveChanger::onKeyPress(), GUISUMOAbstractView::p2m(), GUIPerspectiveChanger::patchedViewPort(), and GNEJunction::updateGeometry().
extends the boundary by the given amount
The method returns a reference to the instance for further use
Definition at line 201 of file Boundary.cpp.
References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
Referenced by GUIDanielPerspectiveChanger::centerTo(), TraCIServer::collectObjectsInRange(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), GNEEdge::getBoundary(), GUIEdge::getBoundary(), GNEInternalLane::getCenteringBoundary(), GNECrossing::getCenteringBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GNEJunction::getCenteringBoundary(), GUIContainer::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIInstantInductLoop::MyWrapper::getCenteringBoundary(), GUILaneSpeedTrigger::getCenteringBoundary(), GUICalibrator::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GNELane::getCenteringBoundary(), GNEEdge::getCenteringBoundary(), GUIMEInductLoop::MyWrapper::getCenteringBoundary(), GUIJunctionWrapper::getCenteringBoundary(), GUIE3Collector::MyWrapper::getCenteringBoundary(), GUITriggeredRerouter::getCenteringBoundary(), GUIChargingStation::getCenteringBoundary(), GUI_E2_ZS_Collector::MyWrapper::getCenteringBoundary(), GUIContainerStop::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GUIEdge::getCenteringBoundary(), GUIInductLoop::MyWrapper::getCenteringBoundary(), GUIBaseVehicle::getCenteringBoundary(), GUITriggeredRerouter::GUITriggeredRerouterEdge::getCenteringBoundary(), GNEAdditional::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), NBEdgeCont::ignoreFilterMatch(), GUINet::initGUIStructures(), and GNEViewNet::mergeJunctions().
|
inherited |
Definition at line 217 of file Boundary.cpp.
References Boundary::myYmax, and Boundary::myYmin.
Referenced by GUIPointOfInterest::getCenteringBoundary(), GUIPerspectiveChanger::patchedViewPort(), and GUIDanielPerspectiveChanger::setViewport().
|
inherited |
Definition at line 210 of file Boundary.cpp.
References Boundary::myXmax, and Boundary::myXmin.
Referenced by GUIPointOfInterest::getCenteringBoundary(), GUIPerspectiveChanger::patchedViewPort(), and GUIDanielPerspectiveChanger::setViewport().
|
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 79 of file LayeredRTree.h.
References myLayers, and selectLayer().
Referenced by GUINet::initGUIStructures().
Moves the boundary by the given amount.
Definition at line 250 of file Boundary.cpp.
References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
Referenced by GUIDanielPerspectiveChanger::centerTo(), GUIDanielPerspectiveChanger::move(), GeoConvHelper::moveConvertedBy(), GUIDanielPerspectiveChanger::onKeyPress(), and GNEJunction::setPosition().
|
virtualinherited |
Returns whether the boundary overlaps with the given polygon.
Implements AbstractPoly.
Definition at line 156 of file Boundary.cpp.
References AbstractPoly::crosses(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, Boundary::myYmin, AbstractPoly::partialWithin(), and Boundary::partialWithin().
Referenced by NIVissimBoundedClusterObject::crosses(), NBEdgeCont::ignoreFilterMatch(), NIVissimConnectionCluster::overlapsWith(), and NIVissimConnectionCluster::NodeSubCluster::overlapsWith().
|
virtualinherited |
Returns whether the boundary is partially within the given polygon.
Implements AbstractPoly.
Definition at line 191 of file Boundary.cpp.
References AbstractPoly::around(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
Referenced by PCPolyContainer::add(), and Boundary::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 89 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 141 of file SUMORTree.h.
References GUIGlObject::getCenteringBoundary(), SUMORTree::myLock, SUMORTree::Remove(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by GNEConnectorFrame::buildIinternalLanes(), GNETLSEditorFrame::buildIinternalLanes(), GNENet::deleteAdditional(), GNENet::deleteSingleEdge(), GNENet::deleteSingleJunction(), GUIShapeContainer::movePOI(), GNEViewNet::onCmdNodeShape(), GNENet::refreshElement(), GNEViewNet::removeCurrentPoly(), GUIShapeContainer::removePOI(), GUIShapeContainer::removePolygon(), and GUIShapeContainer::reshapePolygon().
|
inherited |
Resets the boundary.
Definition at line 66 of file Boundary.cpp.
References Boundary::myWasInitialised, Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
Referenced by NBHeightMapper::clearData().
|
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 101 of file LayeredRTree.h.
References myLayers.
|
inlineprivate |
select the appropriate layer for each object
Definition at line 117 of file LayeredRTree.h.
References GUIGlObject::getType(), GLO_EDGE, GLO_LANE, GLO_PERSON, GLO_POI, and GLO_VEHICLE.
Sets the boundary to the given values.
Definition at line 241 of file Boundary.cpp.
References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, Boundary::myYmin, Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by TraCIServer::readTypeCheckingBoundary().
|
inherited |
Returns maximum x-coordinate.
Definition at line 118 of file Boundary.cpp.
References Boundary::myXmax, and SUMOReal.
Referenced by Boundary::add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), NBHeightMapper::addTriangle(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GNEViewNet::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), NBHeightMapper::getZ(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), NIVissimConnectionCluster::NIVissimConnectionCluster(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Simulation::processGet(), NIVissimConnectionCluster::recheckEdges(), NIVissimConnectionCluster::recomputeBoundary(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIBaseVehicle::setFunctionalColor(), GNEPoly::simplifyShape(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().
|
inherited |
Returns minimum x-coordinate.
Definition at line 112 of file Boundary.cpp.
References Boundary::myXmin, and SUMOReal.
Referenced by Boundary::add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), NBHeightMapper::addTriangle(), GUISUMOAbstractView::applyGLTransform(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GNEViewNet::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), GUISUMOAbstractView::getPositionInformation(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), NBHeightMapper::getZ(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), NBNetBuilder::moveToOrigin(), NIVissimConnectionCluster::NIVissimConnectionCluster(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Simulation::processGet(), NIVissimConnectionCluster::recheckEdges(), NIVissimConnectionCluster::recomputeBoundary(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIBaseVehicle::setFunctionalColor(), GNEPoly::simplifyShape(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().
|
inherited |
Returns maximum y-coordinate.
Definition at line 130 of file Boundary.cpp.
References Boundary::myYmax, and SUMOReal.
Referenced by Boundary::add(), SUMORTree::addAdditionalGLObject(), NBHeightMapper::addTriangle(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GNEViewNet::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), NBHeightMapper::getZ(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), NBNetBuilder::moveToOrigin(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Simulation::processGet(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIBaseVehicle::setFunctionalColor(), GNEPoly::simplifyShape(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().
|
inherited |
Returns minimum y-coordinate.
Definition at line 124 of file Boundary.cpp.
References Boundary::myYmin, and SUMOReal.
Referenced by Boundary::add(), SUMORTree::addAdditionalGLObject(), NBHeightMapper::addTriangle(), GUISUMOAbstractView::applyGLTransform(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GNEViewNet::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), GUISUMOAbstractView::getPositionInformation(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), GNENet::GNENet(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), NBNetBuilder::moveToOrigin(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Simulation::processGet(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIBaseVehicle::setFunctionalColor(), GNEPoly::simplifyShape(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().
|
protected |
the layers for drawing
Definition at line 112 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 152 of file SUMORTree.h.
Referenced by SUMORTree::addAdditionalGLObject(), SUMORTree::Insert(), SUMORTree::Remove(), SUMORTree::removeAdditionalGLObject(), and SUMORTree::Search().