SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SUMORTree Class Reference

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

#include <SUMORTree.h>

Inheritance diagram for SUMORTree:
GUI_RTREE_QUAL Boundary AbstractPoly LayeredRTree

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)
 
virtual void Insert (const float a_min[2], const float a_max[2], GUIGlObject *const &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...
 
virtual void Remove (const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
 Remove entry. More...
 
void removeAdditionalGLObject (GUIGlObject *o)
 Removes an additional object (detector/shape/trigger) from being visualised. More...
 
void reset ()
 Resets the boundary. More...
 
virtual int Search (const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
 Find all within search rectangle. More...
 
void set (SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax)
 Sets the boundary to the given values. More...
 
 SUMORTree ()
 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...
 
virtual ~SUMORTree ()
 Destructor. More...
 

Protected Attributes

MFXMutex myLock
 A mutex avoiding parallel change and traversal of the tree. More...
 

Detailed Description

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 74 of file SUMORTree.h.

Constructor & Destructor Documentation

SUMORTree::SUMORTree ( )
inline

Constructor.

Definition at line 78 of file SUMORTree.h.

Referenced by LayeredRTree::LayeredRTree().

virtual SUMORTree::~SUMORTree ( )
inlinevirtual

Destructor.

Definition at line 83 of file SUMORTree.h.

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(), GUIEdge::getBoundary(), PositionVector::getBoxBoundary(), MSDevice_BTsender::VehicleInformation::getBoxBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIContainer::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUIVehicle::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GUICalibrator::GUICalibrator(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUITriggeredRerouter::GUITriggeredRerouter(), GUITriggeredRerouter::GUITriggeredRerouterEdge::GUITriggeredRerouterEdge(), GUINet::initGUIStructures(), NBHeightMapper::loadShapeFile(), NBHeightMapper::loadTiff(), GUITriggeredRerouter::myEndElement(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUI_E2_ZS_CollectorOverLanes::MyWrapper::MyWrapper(), GUIE3Collector::MyWrapper::MyWrapper(), GUIInductLoop::MyWrapper::MyWrapper(), NIVissimConnectionCluster::recomputeBoundary(), 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().

void SUMORTree::addAdditionalGLObject ( GUIGlObject o)
inline
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 GeomHelper::intersects(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.

void Boundary::flipY ( )
inherited

flips ymin and ymax

Definition at line 222 of file Boundary.cpp.

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

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

Insert entry.

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataIdPositive Id of data. Maybe zero, but negative numbers not allowed.
See also
RTree::Insert

Reimplemented in LayeredRTree.

Definition at line 93 of file SUMORTree.h.

References myLock.

Referenced by addAdditionalGLObject().

void Boundary::moveby ( SUMOReal  x,
SUMOReal  y 
)
inherited
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 190 of file Boundary.cpp.

References AbstractPoly::around(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.

Referenced by PCPolyContainer::insert(), and Boundary::overlapsWith().

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

Remove entry.

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataIdPositive Id of data. Maybe zero, but negative numbers not allowed.
See also
RTree::Remove

Reimplemented in LayeredRTree.

Definition at line 105 of file SUMORTree.h.

References myLock.

Referenced by removeAdditionalGLObject().

void SUMORTree::removeAdditionalGLObject ( GUIGlObject o)
inline

Removes an additional object (detector/shape/trigger) from being visualised.

Parameters
[in]oThe object to remove

Definition at line 141 of file SUMORTree.h.

References GUIGlObject::getCenteringBoundary(), myLock, Remove(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().

Referenced by GUIShapeContainer::movePOI(), GUIShapeContainer::removePOI(), GUIShapeContainer::removePolygon(), and GUIShapeContainer::reshapePolygon().

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

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

Find all within search rectangle.

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
See also
RTree::Search

Reimplemented in LayeredRTree.

Definition at line 120 of file SUMORTree.h.

References myLock.

Referenced by GUIViewTraffic::doPaintGL(), and GUISUMOAbstractView::makeSnapshot().

void Boundary::set ( SUMOReal  xmin,
SUMOReal  ymin,
SUMOReal  xmax,
SUMOReal  ymax 
)
inherited
SUMOReal Boundary::xmin ( ) const
inherited

Returns minimum x-coordinate.

Definition at line 112 of file Boundary.cpp.

References Boundary::myXmin.

Referenced by Boundary::add(), NIVissimConnectionCluster::add(), addAdditionalGLObject(), NBHeightMapper::addTriangle(), 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(), NBHeightMapper::getZ(), 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(), removeAdditionalGLObject(), Boundary::set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), and GUIDanielPerspectiveChanger::zoom().

Field Documentation

MFXMutex SUMORTree::myLock
mutableprotected

A mutex avoiding parallel change and traversal of the tree.

Definition at line 152 of file SUMORTree.h.

Referenced by addAdditionalGLObject(), Insert(), Remove(), removeAdditionalGLObject(), and Search().


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