SUMO - Simulation of Urban MObility
LayeredRTree Class Reference

A RT-tree for efficient storing of SUMO's GL-objects in layers. More...

#include <LayeredRTree.h>

Inheritance diagram for LayeredRTree:
Inheritance graph
Collaboration diagram for LayeredRTree:
Collaboration graph

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...
 
Boundarygrow (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

LayeredRTree::LayeredRTree ( )
inline

Constructor.

Definition at line 59 of file LayeredRTree.h.

References myLayers, and SUMORTree::SUMORTree().

LayeredRTree::~LayeredRTree ( )
inline

Destructor.

Definition at line 66 of file LayeredRTree.h.

References myLayers.

Member Function Documentation

void Boundary::add ( SUMOReal  x,
SUMOReal  y 
)
inherited

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(), 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(), and GeoConvHelper::x2cartesian().

void Boundary::add ( const Position p)
inherited

Makes the boundary include the given coordinate.

Definition at line 93 of file Boundary.cpp.

References Boundary::add(), Position::x(), and Position::y().

void Boundary::add ( const Boundary p)
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().

bool Boundary::around ( const Position p,
SUMOReal  offset = 0 
) const
virtualinherited
bool Boundary::crosses ( const Position p1,
const Position p2 
) const
virtualinherited

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.

void Boundary::flipY ( )
inherited

flips ymin and ymax

Definition at line 223 of file Boundary.cpp.

References Boundary::myYmax, Boundary::myYmin, and SUMOReal.

Referenced by GeoConvHelper::computeFinal().

Boundary & Boundary::grow ( SUMOReal  by)
inherited

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(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GNECrossing::getCenteringBoundary(), GNEInternalLane::getCenteringBoundary(), GUIContainer::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIInstantInductLoop::MyWrapper::getCenteringBoundary(), GUILaneSpeedTrigger::getCenteringBoundary(), GUICalibrator::getCenteringBoundary(), GNEJunction::getCenteringBoundary(), GUIJunctionWrapper::getCenteringBoundary(), GNEEdge::getCenteringBoundary(), GUIE3Collector::MyWrapper::getCenteringBoundary(), GNELane::getCenteringBoundary(), GUITriggeredRerouter::getCenteringBoundary(), GUI_E2_ZS_Collector::MyWrapper::getCenteringBoundary(), GUIContainerStop::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GUIChargingStation::getCenteringBoundary(), GUIEdge::getCenteringBoundary(), GUIBaseVehicle::getCenteringBoundary(), GUIInductLoop::MyWrapper::getCenteringBoundary(), GUITriggeredRerouter::GUITriggeredRerouterEdge::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), NBEdgeCont::ignoreFilterMatch(), GUINet::initGUIStructures(), and GNEViewNet::mergeJunctions().

void LayeredRTree::Insert ( const float  a_min[2],
const float  a_max[2],
GUIGlObject *const &  a_dataId 
)
inlinevirtual

Insert entry (delegate to appropriate layer)

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataIdPositive 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().

bool Boundary::overlapsWith ( const AbstractPoly poly,
SUMOReal  offset = 0 
) const
virtualinherited
bool Boundary::partialWithin ( const AbstractPoly poly,
SUMOReal  offset = 0 
) const
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::insert(), and Boundary::overlapsWith().

void LayeredRTree::Remove ( const float  a_min[2],
const float  a_max[2],
GUIGlObject *const &  a_dataId 
)
inlinevirtual

Remove entry (delegate to appropriate layer)

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataIdPositive 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().

void Boundary::reset ( )
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().

int LayeredRTree::Search ( const float  a_min[2],
const float  a_max[2],
const GUIVisualizationSettings c 
) const
inlinevirtual

Find all within search rectangle (searches all layers in order)

Parameters
a_minMin of search bounding rect
a_maxMax of search bounding rect
a_searchResultSearch result array. Caller should set grow size. Function will reset, not append to array.
a_resultCallbackCallback function to return result. Callback should return 'true' to continue searching
a_contextUser context to pass as parameter to a_resultCallback
Returns
Returns the number of entries found

Reimplemented from SUMORTree.

Definition at line 101 of file LayeredRTree.h.

References myLayers.

size_t LayeredRTree::selectLayer ( GUIGlObject o)
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.

Referenced by Insert(), and Remove().

void Boundary::set ( SUMOReal  xmin,
SUMOReal  ymin,
SUMOReal  xmax,
SUMOReal  ymax 
)
inherited
SUMOReal Boundary::xmax ( ) const
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().

SUMOReal Boundary::xmin ( ) const
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().

Field Documentation

std::vector<SUMORTree*> LayeredRTree::myLayers
protected

the layers for drawing

Definition at line 112 of file LayeredRTree.h.

Referenced by Insert(), LayeredRTree(), Remove(), Search(), and ~LayeredRTree().

MFXMutex SUMORTree::myLock
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().


The documentation for this class was generated from the following file: