SUMO - Simulation of Urban MObility
|
A class that stores a 2D geometrical boundary. More...
#include <Boundary.h>
Public Member Functions | |
void | add (SUMOReal x, SUMOReal y) |
Makes the boundary include the given coordinate. | |
void | add (const Position &p) |
Makes the boundary include the given coordinate. | |
void | add (const Boundary &p) |
Makes the boundary include the given boundary. | |
bool | around (const Position &p, SUMOReal offset=0) const |
Returns whether the boundary contains the given coordinate. | |
Boundary () | |
Constructor - the boundary is unset. | |
Boundary (SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2) | |
Constructor - the boundary will be build using the given values. | |
bool | crosses (const Position &p1, const Position &p2) const |
Returns whether the boundary crosses the given line. | |
void | flipY () |
flips ymin and ymax | |
Position | getCenter () const |
Returns the center of the boundary. | |
SUMOReal | getHeight () const |
Returns the height of the boundary. | |
SUMOReal | getWidth () const |
Returns the width of the boudary. | |
Boundary & | grow (SUMOReal by) |
extends the boundary by the given amount | |
void | growHeight (SUMOReal by) |
void | growWidth (SUMOReal by) |
void | moveby (SUMOReal x, SUMOReal y) |
Moves the boundary by the given amount. | |
bool | overlapsWith (const AbstractPoly &poly, SUMOReal offset=0) const |
Returns whether the boundary overlaps with the given polygon. | |
bool | partialWithin (const AbstractPoly &poly, SUMOReal offset=0) const |
Returns whether the boundary is partially within the given polygon. | |
void | reset () |
Resets the boundary. | |
void | set (SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) |
Sets the boundary to the given values. | |
SUMOReal | xmax () const |
Returns maximum x-coordinate. | |
SUMOReal | xmin () const |
Returns minimum x-coordinate. | |
SUMOReal | ymax () const |
Returns maximum y-coordinate. | |
SUMOReal | ymin () const |
Returns minimum y-coordinate. | |
~Boundary () | |
Destructor. | |
Private Attributes | |
bool | myWasInitialised |
Information whether the boundary was initialised. | |
SUMOReal | myXmax |
SUMOReal | myXmin |
The boundaries. | |
SUMOReal | myYmax |
SUMOReal | myYmin |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Boundary &b) |
Output operator. |
A class that stores a 2D geometrical boundary.
Definition at line 48 of file Boundary.h.
Constructor - the boundary is unset.
Definition at line 47 of file Boundary.cpp.
Boundary::Boundary | ( | SUMOReal | x1, |
SUMOReal | y1, | ||
SUMOReal | x2, | ||
SUMOReal | y2 | ||
) |
Constructor - the boundary will be build using the given values.
Definition at line 53 of file Boundary.cpp.
References add().
Destructor.
Definition at line 62 of file Boundary.cpp.
void Boundary::add | ( | SUMOReal | x, |
SUMOReal | y | ||
) |
Makes the boundary include the given coordinate.
Definition at line 76 of file Boundary.cpp.
References myWasInitialised, myXmax, myXmin, myYmax, and myYmin.
Referenced by add(), NIVissimConnectionCluster::NodeSubCluster::add(), NIVissimConnectionCluster::add(), Boundary(), GUIDanielPerspectiveChanger::centerTo(), NIVissimDisturbance::computeBounding(), NIVissimConnection::computeBounding(), GUIEdge::getBoundary(), PositionVector::getBoxBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUILaneWrapper::getCenteringBoundary(), GUIVehicle::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUITriggeredRerouter::GUITriggeredRerouter(), 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().
void Boundary::add | ( | const Position & | p | ) |
Makes the boundary include the given coordinate.
Definition at line 93 of file Boundary.cpp.
References add(), Position::x(), and Position::y().
void Boundary::add | ( | const Boundary & | p | ) |
bool Boundary::around | ( | const Position & | p, |
SUMOReal | offset = 0 |
||
) | const [virtual] |
Returns whether the boundary contains the given coordinate.
Implements AbstractPoly.
Definition at line 148 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, Position::x(), and Position::y().
Referenced by NIVissimConnectionCluster::around(), PCPolyContainer::insert(), and NIVissimConnectionCluster::recheckEdges().
bool Boundary::crosses | ( | const Position & | p1, |
const Position & | p2 | ||
) | const [virtual] |
Returns whether the boundary crosses the given line.
Implements AbstractPoly.
Definition at line 177 of file Boundary.cpp.
References GeomHelper::intersects(), myXmax, myXmin, myYmax, and myYmin.
void Boundary::flipY | ( | ) |
flips ymin and ymax
Definition at line 222 of file Boundary.cpp.
Position Boundary::getCenter | ( | ) | const |
Returns the center of the boundary.
Definition at line 106 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, and SUMOReal.
Referenced by GUISUMOAbstractView::centerTo(), GUIDanielPerspectiveChanger::getXPos(), GUIDanielPerspectiveChanger::getYPos(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), GUIVehicle::setFunctionalColor(), and GUIDanielPerspectiveChanger::zoom().
SUMOReal Boundary::getHeight | ( | ) | const |
Returns the height of the boundary.
Definition at line 142 of file Boundary.cpp.
References myYmax, and myYmin.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUISUMOAbstractView::getGridHeight(), GUISUMOAbstractView::getPositionInformation(), GUIJunctionWrapper::GUIJunctionWrapper(), GUINet::initGUIStructures(), and GUIPerspectiveChanger::patchedViewPort().
SUMOReal Boundary::getWidth | ( | ) | const |
Returns the width of the boudary.
Definition at line 136 of file Boundary.cpp.
References myXmax, and myXmin.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUISUMOAbstractView::getGridWidth(), GUISUMOAbstractView::getPositionInformation(), GUIDanielPerspectiveChanger::getZoom(), GUIJunctionWrapper::GUIJunctionWrapper(), GUINet::initGUIStructures(), GUISUMOAbstractView::m2p(), GUISUMOAbstractView::p2m(), and GUIPerspectiveChanger::patchedViewPort().
Boundary & Boundary::grow | ( | SUMOReal | by | ) |
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 myXmax, myXmin, myYmax, and myYmin.
Referenced by GUIDanielPerspectiveChanger::centerTo(), GUIEdge::getBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUITriggeredRerouter::getCenteringBoundary(), GUILaneSpeedTrigger::getCenteringBoundary(), GUIJunctionWrapper::getCenteringBoundary(), GUILaneWrapper::getCenteringBoundary(), GUIInstantInductLoop::MyWrapper::getCenteringBoundary(), GUIVehicle::getCenteringBoundary(), GUIE3Collector::MyWrapper::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GUI_E2_ZS_Collector::MyWrapper::getCenteringBoundary(), GUIEdge::getCenteringBoundary(), GUIInductLoop::MyWrapper::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), NBEdgeCont::ignoreFilterMatch(), and GUINet::initGUIStructures().
void Boundary::growHeight | ( | SUMOReal | by | ) |
Definition at line 216 of file Boundary.cpp.
References myYmax, and myYmin.
Referenced by GUIPerspectiveChanger::patchedViewPort(), and GUIDanielPerspectiveChanger::setViewport().
void Boundary::growWidth | ( | SUMOReal | by | ) |
Definition at line 209 of file Boundary.cpp.
References myXmax, and myXmin.
Referenced by GUIPerspectiveChanger::patchedViewPort(), and GUIDanielPerspectiveChanger::setViewport().
void Boundary::moveby | ( | SUMOReal | x, |
SUMOReal | y | ||
) |
Moves the boundary by the given amount.
Definition at line 249 of file Boundary.cpp.
References myXmax, myXmin, myYmax, and myYmin.
Referenced by GUIDanielPerspectiveChanger::centerTo(), GUIDanielPerspectiveChanger::move(), and GeoConvHelper::moveConvertedBy().
bool Boundary::overlapsWith | ( | const AbstractPoly & | poly, |
SUMOReal | offset = 0 |
||
) | const [virtual] |
Returns whether the boundary overlaps with the given polygon.
Implements AbstractPoly.
Definition at line 156 of file Boundary.cpp.
References AbstractPoly::crosses(), myXmax, myXmin, myYmax, myYmin, AbstractPoly::partialWithin(), and partialWithin().
Referenced by NIVissimBoundedClusterObject::crosses(), NBEdgeCont::ignoreFilterMatch(), NIVissimConnectionCluster::overlapsWith(), and NIVissimConnectionCluster::NodeSubCluster::overlapsWith().
bool Boundary::partialWithin | ( | const AbstractPoly & | poly, |
SUMOReal | offset = 0 |
||
) | const [virtual] |
Returns whether the boundary is partially within the given polygon.
Implements AbstractPoly.
Definition at line 190 of file Boundary.cpp.
References AbstractPoly::around(), myXmax, myXmin, myYmax, and myYmin.
Referenced by PCPolyContainer::insert(), and overlapsWith().
void Boundary::reset | ( | ) |
Resets the boundary.
Definition at line 66 of file Boundary.cpp.
References myWasInitialised, myXmax, myXmin, myYmax, and myYmin.
void Boundary::set | ( | SUMOReal | xmin, |
SUMOReal | ymin, | ||
SUMOReal | xmax, | ||
SUMOReal | ymax | ||
) |
SUMOReal Boundary::xmax | ( | ) | const |
Returns maximum x-coordinate.
Definition at line 118 of file Boundary.cpp.
References myXmax.
Referenced by add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), 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(), set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), and GUIDanielPerspectiveChanger::zoom().
SUMOReal Boundary::xmin | ( | ) | const |
Returns minimum x-coordinate.
Definition at line 112 of file Boundary.cpp.
References myXmin.
Referenced by add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), GUISUMOAbstractView::applyGLTransform(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvassLeft(), 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(), set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), and GUIDanielPerspectiveChanger::zoom().
SUMOReal Boundary::ymax | ( | ) | const |
Returns maximum y-coordinate.
Definition at line 130 of file Boundary.cpp.
References myYmax.
Referenced by add(), SUMORTree::addAdditionalGLObject(), GUIDanielPerspectiveChanger::changeCanvassLeft(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), SUMORTree::removeAdditionalGLObject(), set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), and GUIDanielPerspectiveChanger::zoom().
SUMOReal Boundary::ymin | ( | ) | const |
Returns minimum y-coordinate.
Definition at line 124 of file Boundary.cpp.
References myYmin.
Referenced by add(), SUMORTree::addAdditionalGLObject(), GUISUMOAbstractView::applyGLTransform(), GUIDanielPerspectiveChanger::changeCanvassLeft(), NBNetBuilder::compute(), GeomHelper::crossPoint(), GUIViewTraffic::doPaintGL(), GUISUMOAbstractView::getPositionInformation(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::makeSnapshot(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processGet(), SUMORTree::removeAdditionalGLObject(), set(), GUIVehicle::setFunctionalColor(), BinaryFormatter::writeAttr(), and GUIDanielPerspectiveChanger::zoom().
std::ostream& operator<< | ( | std::ostream & | os, |
const Boundary & | b | ||
) | [friend] |
Output operator.
Definition at line 233 of file Boundary.cpp.
bool Boundary::myWasInitialised [private] |
Information whether the boundary was initialised.
Definition at line 132 of file Boundary.h.
SUMOReal Boundary::myXmax [private] |
Definition at line 129 of file Boundary.h.
Referenced by add(), around(), crosses(), getCenter(), getWidth(), grow(), growWidth(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and xmax().
SUMOReal Boundary::myXmin [private] |
The boundaries.
Definition at line 129 of file Boundary.h.
Referenced by add(), around(), crosses(), getCenter(), getWidth(), grow(), growWidth(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and xmin().
SUMOReal Boundary::myYmax [private] |
Definition at line 129 of file Boundary.h.
Referenced by add(), around(), crosses(), flipY(), getCenter(), getHeight(), grow(), growHeight(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and ymax().
SUMOReal Boundary::myYmin [private] |
Definition at line 129 of file Boundary.h.
Referenced by add(), around(), crosses(), flipY(), getCenter(), getHeight(), grow(), growHeight(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and ymin().