#include <Boundary.h>

Definition at line 45 of file Boundary.h.
Public Member Functions | |
| void | add (const Boundary &p) |
| Makes the boundary include the given boundary. | |
| void | add (const Position2D &p) |
| Makes the boundary include the given coordinate. | |
| void | add (SUMOReal x, SUMOReal y) |
| Makes the boundary include the given coordinate. | |
| bool | around (const Position2D &p, SUMOReal offset=0) const |
| Returns whether the boundary contains the given coordinate. | |
| Boundary (SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2) | |
| Constructor - the boundary will be build using the given values. | |
| Boundary () | |
| Constructor - the boundary is unset. | |
| bool | crosses (const Position2D &p1, const Position2D &p2) const |
| Returns whether the boundary crosses the given line. | |
| void | flipY () |
| flips ymin and ymax | |
| Position2D | 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 | 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. | |
| Boundary::Boundary | ( | ) |
Constructor - the boundary is unset.
Definition at line 44 of file Boundary.cpp.
00045 : myXmin(10000000000.0), myXmax(-10000000000.0), 00046 myYmin(10000000000.0), myYmax(-10000000000.0), 00047 myWasInitialised(false) {}
| Boundary::Boundary | ( | SUMOReal | x1, | |
| SUMOReal | y1, | |||
| SUMOReal | x2, | |||
| SUMOReal | y2 | |||
| ) |
Constructor - the boundary will be build using the given values.
Definition at line 50 of file Boundary.cpp.
00051 : myXmin(10000000000.0), myXmax(-10000000000.0), 00052 myYmin(10000000000.0), myYmax(-10000000000.0), 00053 myWasInitialised(false) { 00054 add(x1, y1); 00055 add(x2, y2); 00056 }
| Boundary::~Boundary | ( | ) |
| void Boundary::add | ( | const Boundary & | p | ) |
| void Boundary::add | ( | const Position2D & | p | ) |
Makes the boundary include the given coordinate.
Definition at line 90 of file Boundary.cpp.
References Position2D::x(), and Position2D::y().
| void Boundary::add | ( | SUMOReal | x, | |
| SUMOReal | y | |||
| ) |
Makes the boundary include the given coordinate.
Definition at line 73 of file Boundary.cpp.
References myWasInitialised, myXmax, myXmin, myYmax, and myYmin.
Referenced by NIVissimConnectionCluster::add(), NIVissimConnectionCluster::NodeSubCluster::add(), NIVissimDisturbance::computeBounding(), NIVissimConnection::computeBounding(), GUIEdge::getBoundary(), Position2DVector::getBoxBoundary(), GUIVehicle::getCenteringBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPolygon2D::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUILaneWrapper::getCenteringBoundary(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUITriggeredRerouter::GUITriggeredRerouter(), GeoConvHelper::init(), GUINet::initGUIStructures(), NIVissimConnectionCluster::recomputeBoundary(), NIVissimNodeDef_Edges::searchAndSetConnections(), TEST(), and GeoConvHelper::x2cartesian().
00073 { 00074 if (!myWasInitialised) { 00075 myYmin = y; 00076 myYmax = y; 00077 myXmin = x; 00078 myXmax = x; 00079 } else { 00080 myXmin = myXmin < x ? myXmin : x; 00081 myXmax = myXmax > x ? myXmax : x; 00082 myYmin = myYmin < y ? myYmin : y; 00083 myYmax = myYmax > y ? myYmax : y; 00084 } 00085 myWasInitialised = true; 00086 }
| bool Boundary::around | ( | const Position2D & | p, | |
| SUMOReal | offset = 0 | |||
| ) | const [virtual] |
Returns whether the boundary contains the given coordinate.
Implements AbstractPoly.
Definition at line 145 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, Position2D::x(), and Position2D::y().
Referenced by NIVissimConnectionCluster::around(), PCPolyContainer::insert(), NIVissimConnectionCluster::recheckEdges(), and TEST().
00145 { 00146 return 00147 (p.x()<=myXmax+offset && p.x()>=myXmin-offset) && 00148 (p.y()<=myYmax+offset && p.y()>=myYmin-offset); 00149 }
| bool Boundary::crosses | ( | const Position2D & | p1, | |
| const Position2D & | p2 | |||
| ) | const [virtual] |
Returns whether the boundary crosses the given line.
Implements AbstractPoly.
Definition at line 174 of file Boundary.cpp.
References GeomHelper::intersects(), myXmax, myXmin, myYmax, and myYmin.
Referenced by TEST().
00174 { 00175 return 00176 GeomHelper::intersects(p1, p2, Position2D(myXmax, myYmax), Position2D(myXmin, myYmax)) 00177 || 00178 GeomHelper::intersects(p1, p2, Position2D(myXmin, myYmax), Position2D(myXmin, myYmin)) 00179 || 00180 GeomHelper::intersects(p1, p2, Position2D(myXmin, myYmin), Position2D(myXmax, myYmin)) 00181 || 00182 GeomHelper::intersects(p1, p2, Position2D(myXmax, myYmin), Position2D(myXmax, myYmax)); 00183 }
| void Boundary::flipY | ( | ) |
| Position2D Boundary::getCenter | ( | ) | const |
Returns the center of the boundary.
Definition at line 103 of file Boundary.cpp.
References myXmax, myXmin, myYmax, myYmin, and SUMOReal.
Referenced by GUISUMOAbstractView::applyChanges(), GUIDanielPerspectiveChanger::centerTo(), GUISUMOAbstractView::getPositionInformation(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), GUIVehicle::Colorer::setFunctionalColor(), and TEST().
00103 { 00104 return Position2D((myXmin+myXmax)/(SUMOReal) 2.0, (myYmin+myYmax)/(SUMOReal) 2.0); 00105 }
| SUMOReal Boundary::getHeight | ( | ) | const |
Returns the height of the boundary.
Definition at line 139 of file Boundary.cpp.
References myYmax, and myYmin.
Referenced by GUISUMOAbstractView::applyChanges(), GUIDanielPerspectiveChanger::centerTo(), GUISUMOAbstractView::getGridHeight(), and TEST().
| SUMOReal Boundary::getWidth | ( | ) | const |
Returns the width of the boudary.
Definition at line 133 of file Boundary.cpp.
References myXmax, and myXmin.
Referenced by GUISUMOAbstractView::applyChanges(), GUIDanielPerspectiveChanger::centerTo(), GUISUMOAbstractView::getGridWidth(), and TEST().
| 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 197 of file Boundary.cpp.
References myXmax, myXmin, myYmax, and myYmin.
Referenced by GUIEdge::getBoundary(), GUIVehicle::getCenteringBoundary(), GUITriggeredRerouter::getCenteringBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIPolygon2D::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUILaneWrapper::getCenteringBoundary(), GUILaneSpeedTrigger::getCenteringBoundary(), GUIJunctionWrapper::getCenteringBoundary(), GUIInductLoop::MyWrapper::getCenteringBoundary(), GUIEmitter::getCenteringBoundary(), GUIEdge::getCenteringBoundary(), GUIE3Collector::MyWrapper::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GUI_E2_ZS_Collector::MyWrapper::getCenteringBoundary(), and GUINet::initGUIStructures().
00197 { 00198 myXmax += by; 00199 myYmax += by; 00200 myXmin -= by; 00201 myYmin -= by; 00202 return *this; 00203 }
| void Boundary::moveby | ( | SUMOReal | x, | |
| SUMOReal | y | |||
| ) |
| 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 153 of file Boundary.cpp.
References AbstractPoly::crosses(), myXmax, myXmin, myYmax, myYmin, AbstractPoly::partialWithin(), and partialWithin().
Referenced by NIVissimBoundedClusterObject::crosses(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), and TEST().
00153 { 00154 if ( 00155 // check whether one of my points lies within the given poly 00156 partialWithin(p, offset) || 00157 // check whether the polygon lies within me 00158 p.partialWithin(*this, offset)) { 00159 return true; 00160 } 00161 // check whether the bounderies cross 00162 return 00163 p.crosses(Position2D(myXmax+offset, myYmax+offset), Position2D(myXmin-offset, myYmax+offset)) 00164 || 00165 p.crosses(Position2D(myXmin-offset, myYmax+offset), Position2D(myXmin-offset, myYmin-offset)) 00166 || 00167 p.crosses(Position2D(myXmin-offset, myYmin-offset), Position2D(myXmax+offset, myYmin-offset)) 00168 || 00169 p.crosses(Position2D(myXmax+offset, myYmin-offset), Position2D(myXmax+offset, myYmax+offset)); 00170 }
| 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 187 of file Boundary.cpp.
References AbstractPoly::around(), myXmax, myXmin, myYmax, and myYmin.
Referenced by PCPolyContainer::insert(), overlapsWith(), and TEST().
00187 { 00188 return 00189 poly.around(Position2D(myXmax, myYmax), offset) || 00190 poly.around(Position2D(myXmin, myYmax), offset) || 00191 poly.around(Position2D(myXmax, myYmin), offset) || 00192 poly.around(Position2D(myXmin, myYmin), offset); 00193 }
| void Boundary::reset | ( | ) |
Resets the boundary.
Definition at line 63 of file Boundary.cpp.
References myWasInitialised, myXmax, myXmin, myYmax, and myYmin.
Referenced by GeoConvHelper::init().
00063 { 00064 myXmin = 10000000000.0; 00065 myXmax = -10000000000.0; 00066 myYmin = 10000000000.0; 00067 myYmax = -10000000000.0; 00068 myWasInitialised = false; 00069 }
| void Boundary::set | ( | SUMOReal | xmin, | |
| SUMOReal | ymin, | |||
| SUMOReal | xmax, | |||
| SUMOReal | ymax | |||
| ) |
| SUMOReal Boundary::xmax | ( | ) | const |
Returns maximum x-coordinate.
Definition at line 115 of file Boundary.cpp.
References myXmax.
Referenced by NIVissimConnectionCluster::add(), add(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), GUINet::initGUIStructures(), main(), NIVissimConnectionCluster::NIVissimConnectionCluster(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), GUISUMOAbstractView::paintGLGrid(), NIVissimConnectionCluster::recheckEdges(), NIVissimConnectionCluster::recomputeBoundary(), GUIVehicle::Colorer::setFunctionalColor(), TEST(), and TEST_F().
00115 { 00116 return myXmax; 00117 }
| SUMOReal Boundary::xmin | ( | ) | const |
Returns minimum x-coordinate.
Definition at line 109 of file Boundary.cpp.
References myXmin.
Referenced by NIVissimConnectionCluster::add(), add(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), NBNetBuilder::compute(), NIVissimDisturbance::computeBounding(), NIVissimBoundedClusterObject::crosses(), GeomHelper::crossPoint(), NIVissimConnection::getBoundingBox(), NIVissimConnectionCluster::getPositionForEdge(), GUINet::initGUIStructures(), main(), NIVissimConnectionCluster::NIVissimConnectionCluster(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), GUISUMOAbstractView::paintGLGrid(), NIVissimConnectionCluster::recheckEdges(), NIVissimConnectionCluster::recomputeBoundary(), GUIVehicle::Colorer::setFunctionalColor(), TEST(), and TEST_F().
00109 { 00110 return myXmin; 00111 }
| SUMOReal Boundary::ymax | ( | ) | const |
Returns maximum y-coordinate.
Definition at line 127 of file Boundary.cpp.
References myYmax.
Referenced by add(), GeomHelper::crossPoint(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::paintGLGrid(), GUIVehicle::Colorer::setFunctionalColor(), TEST(), and TEST_F().
00127 { 00128 return myYmax; 00129 }
| SUMOReal Boundary::ymin | ( | ) | const |
Returns minimum y-coordinate.
Definition at line 121 of file Boundary.cpp.
References myYmin.
Referenced by add(), NBNetBuilder::compute(), GeomHelper::crossPoint(), GUINet::initGUIStructures(), main(), GUISUMOAbstractView::paintGLGrid(), GUIVehicle::Colorer::setFunctionalColor(), TEST(), and TEST_F().
00121 { 00122 return myYmin; 00123 }
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const Boundary & | b | |||
| ) | [friend] |
bool Boundary::myWasInitialised [private] |
SUMOReal Boundary::myXmax [private] |
Definition at line 122 of file Boundary.h.
Referenced by add(), around(), crosses(), getCenter(), getWidth(), grow(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and xmax().
SUMOReal Boundary::myXmin [private] |
The boundaries.
Definition at line 122 of file Boundary.h.
Referenced by add(), around(), crosses(), getCenter(), getWidth(), grow(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and xmin().
SUMOReal Boundary::myYmax [private] |
Definition at line 122 of file Boundary.h.
Referenced by add(), around(), crosses(), flipY(), getCenter(), getHeight(), grow(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and ymax().
SUMOReal Boundary::myYmin [private] |
Definition at line 122 of file Boundary.h.
Referenced by add(), around(), crosses(), flipY(), getCenter(), getHeight(), grow(), moveby(), operator<<(), overlapsWith(), partialWithin(), reset(), set(), and ymin().
1.5.6