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 *a_dataId) |
Insert entry (delegate to appropriate layer) More... | |
virtual void | Insert (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const GUIGlObject *&a_dataId) |
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 *a_dataId) |
Remove entry (delegate to appropriate layer) More... | |
virtual void | Remove (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const GUIGlObject *&a_dataId) |
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... | |
virtual int | Search (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const GUIVisualizationSettings &c) const |
DK 15.10.2008 - begin. 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 Member Functions | |
bool | Search (Node *a_node, Rect *a_rect, int &a_foundCount, const GUIVisualizationSettings &c) const |
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(), GUIEdge::getBoundary(), PositionVector::getBoxBoundary(), MSDevice_BTsender::VehicleInformation::getBoxBoundary(), MSDevice_BTreceiver::VehicleInformation::getBoxBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUIVehicle::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUICalibrator::GUICalibrator(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUITriggeredRerouter::GUITriggeredRerouter(), GUITriggeredRerouter::GUITriggeredRerouterEdge::GUITriggeredRerouterEdge(), GUINet::initGUIStructures(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUI_E2_ZS_CollectorOverLanes::MyWrapper::MyWrapper(), GUIE3Collector::MyWrapper::MyWrapper(), GUIInductLoop::MyWrapper::MyWrapper(), NIVissimConnectionCluster::recomputeBoundary(), NIVissimNodeDef_Edges::searchAndSetConnections(), GUIDanielPerspectiveChanger::setViewport(), 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 117 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(), GUINet::createTLWrapper(), GUITriggeredRerouter::GUITriggeredRerouter(), GUINet::initGUIStructures(), GUIShapeContainer::movePOI(), 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 NIVissimConnectionCluster::around(), PCPolyContainer::insert(), and NIVissimConnectionCluster::recheckEdges().
Returns whether the boundary crosses the given line.
Implements AbstractPoly.
Definition at line 177 of file Boundary.cpp.
References GeomHelper::intersects(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
|
inherited |
flips ymin and ymax
Definition at line 222 of file Boundary.cpp.
References Boundary::myYmax, Boundary::myYmin, and SUMOReal.
|
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(), GUIVehicle::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(), GUIJunctionWrapper::GUIJunctionWrapper(), GUINet::initGUIStructures(), and GUIPerspectiveChanger::patchedViewPort().
|
inherited |
Returns the width of the boudary.
Definition at line 136 of file Boundary.cpp.
References Boundary::myXmax, and Boundary::myXmin.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUIPolygon::drawGL(), GUISUMOAbstractView::getGridWidth(), GUISUMOAbstractView::getPositionInformation(), GUIDanielPerspectiveChanger::getZoom(), GUIJunctionWrapper::GUIJunctionWrapper(), GUINet::initGUIStructures(), GUISUMOAbstractView::m2p(), GUISUMOAbstractView::p2m(), and GUIPerspectiveChanger::patchedViewPort().
extends the boundary by the given amount
The method returns a reference to the instance for further use
Definition at line 200 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(), GUIEdge::getBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIInstantInductLoop::MyWrapper::getCenteringBoundary(), GUILaneSpeedTrigger::getCenteringBoundary(), GUICalibrator::getCenteringBoundary(), GUITriggeredRerouter::getCenteringBoundary(), GUIJunctionWrapper::getCenteringBoundary(), GUIE3Collector::MyWrapper::getCenteringBoundary(), GUIVehicle::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GUI_E2_ZS_Collector::MyWrapper::getCenteringBoundary(), GUIEdge::getCenteringBoundary(), GUITriggeredRerouter::GUITriggeredRerouterEdge::getCenteringBoundary(), GUIInductLoop::MyWrapper::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), NBEdgeCont::ignoreFilterMatch(), and GUINet::initGUIStructures().
|
inherited |
Definition at line 216 of file Boundary.cpp.
References Boundary::myYmax, and Boundary::myYmin.
Referenced by GUIPointOfInterest::getCenteringBoundary(), GUIPerspectiveChanger::patchedViewPort(), and GUIDanielPerspectiveChanger::setViewport().
|
inherited |
Definition at line 209 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().
|
virtualinherited |
Insert entry
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. |
Moves the boundary by the given amount.
Definition at line 249 of file Boundary.cpp.
References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
Referenced by GUIDanielPerspectiveChanger::centerTo(), GUIDanielPerspectiveChanger::move(), and GeoConvHelper::moveConvertedBy().
|
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 190 of file Boundary.cpp.
References AbstractPoly::around(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
Referenced by PCPolyContainer::insert(), 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().
|
virtualinherited |
Remove entry
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. |
|
inlineinherited |
Removes an additional object (detector/shape/trigger) from being visualised.
[in] | o | The object to remove |
Definition at line 129 of file SUMORTree.h.
References GUIGlObject::getCenteringBoundary(), SUMORTree::myLock, SUMORTree::Remove(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by GUIShapeContainer::movePOI(), 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.
|
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.
|
virtualinherited |
DK 15.10.2008 - begin.
Find all within search rectangle
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 |
|
protectedinherited |
|
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 240 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.
Referenced by Boundary::add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), NIVissimConnectionCluster::NIVissimConnectionCluster(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), NIVissimConnectionCluster::recheckEdges(), NIVissimConnectionCluster::recomputeBoundary(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().
|
inherited |
Returns minimum x-coordinate.
Definition at line 112 of file Boundary.cpp.
References Boundary::myXmin.
Referenced by Boundary::add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), GUISUMOAbstractView::applyGLTransform(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), GUISUMOAbstractView::getPositionInformation(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), NBNetBuilder::moveToOrigin(), NIVissimConnectionCluster::NIVissimConnectionCluster(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), NIVissimConnectionCluster::recheckEdges(), NIVissimConnectionCluster::recomputeBoundary(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().
|
inherited |
Returns maximum y-coordinate.
Definition at line 130 of file Boundary.cpp.
References Boundary::myYmax.
Referenced by Boundary::add(), SUMORTree::addAdditionalGLObject(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().
|
inherited |
Returns minimum y-coordinate.
Definition at line 124 of file Boundary.cpp.
References Boundary::myYmin.
Referenced by Boundary::add(), SUMORTree::addAdditionalGLObject(), GUISUMOAbstractView::applyGLTransform(), GUIDanielPerspectiveChanger::changeCanvassLeft(), TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), GUISUMOAbstractView::getPositionInformation(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_Polygon::getTree(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), NBNetBuilder::moveToOrigin(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), SUMORTree::removeAdditionalGLObject(), Boundary::set(), GUIVehicle::setFunctionalColor(), 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 140 of file SUMORTree.h.
Referenced by SUMORTree::addAdditionalGLObject(), SUMORTree::Insert(), SUMORTree::Remove(), SUMORTree::removeAdditionalGLObject(), and SUMORTree::Search().