SUMO - Simulation of Urban MObility
|
A RT-tree for efficient storing of SUMO's GL-objects. More...
#include <TraCIRTree.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 | addObject (Named *o, Boundary &b) |
Adds an additional object (detector/shape/trigger) for visualisation. More... | |
void | addObject (Named *o, Position &p) |
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], Named *a_dataId) |
Insert entry. 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], Named *a_dataId) |
Remove entry. More... | |
void | removeAdditionalGLObject (Named *o, Boundary &b) |
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 Named::StoringVisitor &c) |
Find all within search rectangle. More... | |
void | set (SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) |
Sets the boundary to the given values. More... | |
TraCIRTree () | |
Constructor. 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... | |
~TraCIRTree () | |
Destructor. More... | |
Private Types | |
enum | |
typedef void(Named::* | Operation )(const Named::StoringVisitor &) const |
Private Member Functions | |
bool | AddBranch (Branch *a_branch, Node *a_node, Node **a_newNode) |
ListNode * | AllocListNode () |
Node * | AllocNode () |
float | CalcRectVolume (Rect *a_rect) |
void | ChoosePartition (PartitionVars *a_parVars, int a_minFill) |
void | Classify (int a_index, int a_group, PartitionVars *a_parVars) |
Rect | CombineRect (Rect *a_rectA, Rect *a_rectB) |
int | Count () |
Count the data elements in this container. This is slow as no internal counter is maintained. More... | |
void | CountRec (Node *a_node, int &a_count) |
void | DisconnectBranch (Node *a_node, int a_index) |
void | FreeListNode (ListNode *a_listNode) |
void | FreeNode (Node *a_node) |
Named *& | GetAt (Iterator &a_it) |
Get object at iterator position. More... | |
void | GetBranches (Node *a_node, Branch *a_branch, PartitionVars *a_parVars) |
void | GetFirst (Iterator &a_it) |
Get 'first' for iteration. More... | |
void | GetNext (Iterator &a_it) |
Get Next for iteration. More... | |
void | InitNode (Node *a_node) |
void | InitParVars (PartitionVars *a_parVars, int a_maxRects, int a_minFill) |
void | InitRect (Rect *a_rect) |
virtual void | Insert (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const Named *&a_dataId) |
bool | InsertRect (Rect *a_rect, const Named *&a_id, Node **a_root, int a_level) |
bool | InsertRectRec (Rect *a_rect, const Named *&a_id, Node *a_node, Node **a_newNode, int a_level) |
bool | IsNull (Iterator &a_it) |
Is iterator NULL, or at end? More... | |
void | LoadNodes (Node *a_nodeA, Node *a_nodeB, PartitionVars *a_parVars) |
Rect | NodeCover (Node *a_node) |
bool | Overlap (Rect *a_rectA, Rect *a_rectB) |
int | PickBranch (Rect *a_rect, Node *a_node) |
void | PickSeeds (PartitionVars *a_parVars) |
float | RectSphericalVolume (Rect *a_rect) |
float | RectVolume (Rect *a_rect) |
void | ReInsert (Node *a_node, ListNode **a_listNode) |
virtual void | Remove (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const Named *&a_dataId) |
void | RemoveAll () |
DK 15.10.2008 - end. More... | |
void | RemoveAllRec (Node *a_node) |
bool | RemoveRect (Rect *a_rect, const Named *&a_id, Node **a_root) |
bool | RemoveRectRec (Rect *a_rect, const Named *&a_id, Node *a_node, ListNode **a_listNode) |
void | Reset () |
virtual int | Search (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const Named::StoringVisitor &c) |
DK 15.10.2008 - begin. More... | |
bool | Search (Node *a_node, Rect *a_rect, int &a_foundCount, const Named::StoringVisitor &c) |
void | SplitNode (Node *a_node, Branch *a_branch, Node **a_newNode) |
Private Attributes | |
Node * | m_root |
Root of tree. More... | |
float | m_unitSphereVolume |
Unit sphere constant for required number of dimensions. More... | |
Operation | myOperation |
A RT-tree for efficient storing of SUMO's GL-objects.
This class specialises the used RT-tree implementation from "rttree.h" and extends it by a mutex for avoiding parallel change and traversal of the tree.
Definition at line 59 of file TraCIRTree.h.
|
inherited |
|
inline |
Constructor.
Definition at line 62 of file TraCIRTree.h.
|
inline |
Destructor.
Definition at line 68 of file TraCIRTree.h.
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(), addObject(), Boundary::Boundary(), GUIDanielPerspectiveChanger::centerTo(), NIVissimDisturbance::computeBounding(), NIVissimConnection::computeBounding(), GUIEdge::getBoundary(), PositionVector::getBoxBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUILaneWrapper::getCenteringBoundary(), GUIVehicle::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), TraCIServerAPI_Edge::getTree(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUITriggeredRerouter::GUITriggeredRerouter(), GUITriggeredRerouter::GUITriggeredRerouterEdge::GUITriggeredRerouterEdge(), GUINet::initGUIStructures(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUIE3Collector::MyWrapper::MyWrapper(), GUI_E2_ZS_CollectorOverLanes::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().
|
protectedinherited |
Adds an additional object (detector/shape/trigger) for visualisation.
[in] | o | The object to add |
[in] | b | The object's boundary |
Definition at line 115 of file TraCIRTree.h.
References Insert(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by addObject(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_InductionLoop::getTree(), TraCIServerAPI_Edge::getTree(), TraCIServerAPI_POI::getTree(), TraCIServerAPI_Polygon::getTree(), and TraCIServerAPI_Lane::getTree().
Adds an additional object (detector/shape/trigger) for visualisation.
[in] | o | The object to add |
[in] | p | The object's position |
Definition at line 126 of file TraCIRTree.h.
References Boundary::add(), and addObject().
|
protectedinherited |
|
protectedinherited |
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().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
Count the data elements in this container. This is slow as no internal counter is maintained.
|
protectedinherited |
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.
|
protectedinherited |
|
inherited |
flips ymin and ymax
Definition at line 222 of file Boundary.cpp.
References Boundary::myYmax, Boundary::myYmin, and SUMOReal.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
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().
|
inlineinherited |
Get 'first' for iteration.
Definition at line 246 of file RTree.h.
References RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Node::m_count, and RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::m_root.
|
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(), 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(), 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(), traci::TraCIServer::collectObjectsInRange(), GUIEdge::getBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUILaneSpeedTrigger::getCenteringBoundary(), GUITriggeredRerouter::getCenteringBoundary(), GUIJunctionWrapper::getCenteringBoundary(), GUILaneWrapper::getCenteringBoundary(), GUIInstantInductLoop::MyWrapper::getCenteringBoundary(), GUIVehicle::getCenteringBoundary(), GUIE3Collector::MyWrapper::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GUI_E2_ZS_Collector::MyWrapper::getCenteringBoundary(), GUIEdge::getCenteringBoundary(), GUITriggeredRerouter::GUITriggeredRerouterEdge::getCenteringBoundary(), GUIInductLoop::MyWrapper::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().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
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. |
Definition at line 78 of file TraCIRTree.h.
References RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Insert().
Referenced by addObject().
|
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. |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
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().
|
protectedinherited |
|
protectedinherited |
|
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().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
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. |
Definition at line 90 of file TraCIRTree.h.
References RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Remove().
Referenced by removeAdditionalGLObject().
|
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. |
Removes an additional object (detector/shape/trigger) from being visualised.
[in] | o | The object to remove |
Definition at line 136 of file TraCIRTree.h.
References Remove(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
|
inherited |
DK 15.10.2008 - end.
Remove all entries from tree
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
Resets the boundary.
Definition at line 66 of file Boundary.cpp.
References Boundary::myWasInitialised, Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.
|
protectedinherited |
|
inline |
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 |
Definition at line 105 of file TraCIRTree.h.
References RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Search().
|
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 |
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().
|
protectedinherited |
|
inherited |
Returns maximum x-coordinate.
Definition at line 118 of file Boundary.cpp.
References Boundary::myXmax.
Referenced by Boundary::add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), addObject(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), traci::TraCIServer::collectObjectsInRange(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), 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(), 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(), addObject(), GUISUMOAbstractView::applyGLTransform(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), traci::TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), GUISUMOAbstractView::getPositionInformation(), 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(), 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(), addObject(), GUIDanielPerspectiveChanger::changeCanvassLeft(), traci::TraCIServer::collectObjectsInRange(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), SUMORTree::removeAdditionalGLObject(), 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(), addObject(), GUISUMOAbstractView::applyGLTransform(), GUIDanielPerspectiveChanger::changeCanvassLeft(), traci::TraCIServer::collectObjectsInRange(), NBNetBuilder::compute(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GUISUMOAbstractView::getPositionInformation(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), SUMORTree::removeAdditionalGLObject(), removeAdditionalGLObject(), Boundary::set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().