SUMO - Simulation of Urban MObility
Boundary Class Reference

A class that stores a 2D geometrical boundary. More...

#include <Boundary.h>

Inheritance diagram for Boundary:
Inheritance graph
Collaboration diagram for Boundary:
Collaboration graph

Public Member Functions

void add (double x, double y, double z=0)
 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...
 
bool around (const Position &p, double offset=0) const
 Returns whether the boundary contains the given coordinate. More...
 
 Boundary ()
 Constructor - the boundary is unset. More...
 
 Boundary (double x1, double y1, double x2, double y2)
 Constructor - the boundary will be build using the given values. More...
 
 Boundary (double x1, double y1, double z1, double x2, double y2, double z2)
 
bool crosses (const Position &p1, const Position &p2) const
 Returns whether the boundary crosses the given line. More...
 
double distanceTo2D (const Position &p) const
 returns the euclidean distance in the x-y-plane More...
 
double distanceTo2D (const Boundary &b) const
 returns the euclidean distance in the x-y-plane More...
 
void flipY ()
 flips ymin and ymax More...
 
Position getCenter () const
 Returns the center of the boundary. More...
 
double getHeight () const
 Returns the height of the boundary (y-axis) More...
 
double getWidth () const
 Returns the width of the boudary (x-axis) More...
 
double getZRange () const
 Returns the elevation range of the boundary (z-axis) More...
 
Boundary & grow (double by)
 extends the boundary by the given amount More...
 
void growHeight (double by)
 Increases the height of the boundary (y-axis) More...
 
void growWidth (double by)
 Increases the width of the boundary (x-axis) More...
 
void moveby (double x, double y, double z=0)
 Moves the boundary by the given amount. More...
 
bool overlapsWith (const AbstractPoly &poly, double offset=0) const
 Returns whether the boundary overlaps with the given polygon. More...
 
bool partialWithin (const AbstractPoly &poly, double offset=0) const
 Returns whether the boundary is partially within the given polygon. More...
 
void reset ()
 Resets the boundary. More...
 
void set (double xmin, double ymin, double xmax, double ymax)
 Sets the boundary to the given values. More...
 
double xmax () const
 Returns maximum x-coordinate. More...
 
double xmin () const
 Returns minimum x-coordinate. More...
 
double ymax () const
 Returns maximum y-coordinate. More...
 
double ymin () const
 Returns minimum y-coordinate. More...
 
double zmax () const
 Returns maximum z-coordinate. More...
 
double zmin () const
 Returns minimum z-coordinate. More...
 
 ~Boundary ()
 Destructor. More...
 

Private Attributes

bool myWasInitialised
 Information whether the boundary was initialised. More...
 
double myXmax
 
double myXmin
 The boundaries. More...
 
double myYmax
 
double myYmin
 
double myZmax
 
double myZmin
 

Friends

std::ostream & operator<< (std::ostream &os, const Boundary &b)
 Output operator. More...
 

Detailed Description

A class that stores a 2D geometrical boundary.

Definition at line 48 of file Boundary.h.

Constructor & Destructor Documentation

Boundary::Boundary ( )

Constructor - the boundary is unset.

Definition at line 43 of file Boundary.cpp.

Boundary::Boundary ( double  x1,
double  y1,
double  x2,
double  y2 
)

Constructor - the boundary will be build using the given values.

Definition at line 50 of file Boundary.cpp.

References add().

Boundary::Boundary ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2 
)

Definition at line 60 of file Boundary.cpp.

References add().

Boundary::~Boundary ( )

Destructor.

Definition at line 70 of file Boundary.cpp.

Member Function Documentation

void Boundary::add ( double  x,
double  y,
double  z = 0 
)

Makes the boundary include the given coordinate.

Definition at line 86 of file Boundary.cpp.

References myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.

Referenced by add(), NIVissimConnectionCluster::NodeSubCluster::add(), NIVissimConnectionCluster::add(), ROEdge::addSuccessor(), MSEdge::addSuccessor(), Boundary(), GUIDanielPerspectiveChanger::centerTo(), NBNetBuilder::compute(), GNENet::computeAndUpdate(), NIVissimDisturbance::computeBounding(), NIVissimConnection::computeBounding(), GUIEdge::getBoundary(), GNEEdge::getBoundary(), PositionVector::getBoxBoundary(), MSDevice_BTsender::VehicleInformation::getBoxBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GUIContainer::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIParkingArea::getCenteringBoundary(), GUIBaseVehicle::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GUICalibrator::GUICalibrator(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUITriggeredRerouter::GUITriggeredRerouter(), GUITriggeredRerouter::GUITriggeredRerouterEdge::GUITriggeredRerouterEdge(), MSPModel_Remote::handleShape(), GUINet::initGUIStructures(), GNENet::initJunctionsAndEdges(), NBHeightMapper::loadShapeFile(), NBHeightMapper::loadTiff(), GNEViewNet::mergeJunctions(), GUITriggeredRerouter::myEndElement(), GUIMEInductLoop::MyWrapper::MyWrapper(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUIE3Collector::MyWrapper::MyWrapper(), GUIInductLoop::MyWrapper::MyWrapper(), GNEViewNet::onLeftBtnRelease(), NIVissimConnectionCluster::recomputeBoundary(), GNENet::registerEdge(), GNENet::registerJunction(), GUIDanielPerspectiveChanger::setViewport(), GNEJunction::updateGeometry(), and GeoConvHelper::x2cartesian().

void Boundary::add ( const Position &  p)

Makes the boundary include the given coordinate.

Definition at line 107 of file Boundary.cpp.

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

void Boundary::add ( const Boundary &  p)

Makes the boundary include the given boundary.

Definition at line 113 of file Boundary.cpp.

References add(), xmax(), xmin(), ymax(), ymin(), zmax(), and zmin().

bool Boundary::around ( const Position &  p,
double  offset = 0 
) const
virtual

Returns whether the boundary contains the given coordinate.

Implements AbstractPoly.

Definition at line 180 of file Boundary.cpp.

References myXmax, myXmin, myYmax, myYmin, myZmax, myZmin, Position::x(), Position::y(), and Position::z().

Referenced by PCPolyContainer::add(), NIVissimConnectionCluster::around(), NBHeightMapper::getZ(), 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 210 of file Boundary.cpp.

References PositionVector::intersects(), myXmax, myXmin, myYmax, and myYmin.

double Boundary::distanceTo2D ( const Position &  p) const

returns the euclidean distance in the x-y-plane

Definition at line 224 of file Boundary.cpp.

References myXmax, myXmin, myYmax, myYmin, Position::x(), and Position::y().

Referenced by ROEdge::getDistanceTo(), and MSEdge::getDistanceTo().

double Boundary::distanceTo2D ( const Boundary &  b) const

returns the euclidean distance in the x-y-plane

Definition at line 258 of file Boundary.cpp.

References myXmax, myXmin, myYmax, and myYmin.

void Boundary::flipY ( )

flips ymin and ymax

Definition at line 324 of file Boundary.cpp.

References myYmax, and myYmin.

Referenced by GeoConvHelper::computeFinal().

double Boundary::getZRange ( ) const

Returns the elevation range of the boundary (z-axis)

Definition at line 174 of file Boundary.cpp.

References myZmax, and myZmin.

Referenced by NBNetBuilder::compute().

Boundary & Boundary::grow ( double  by)

extends the boundary by the given amount

The method returns a reference to the instance for further use

Definition at line 302 of file Boundary.cpp.

References myXmax, myXmin, myYmax, and myYmin.

Referenced by GUIDanielPerspectiveChanger::centerTo(), NBEdgeCont::checkOverlap(), TraCIServer::collectObjectsInRange(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), MSLane::fill(), GUIEdge::getBoundary(), GNEEdge::getBoundary(), GNEInternalLane::getCenteringBoundary(), GUITrafficLightLogicWrapper::getCenteringBoundary(), GNECrossing::getCenteringBoundary(), GUIContainer::getCenteringBoundary(), GNEJunction::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GUIInstantInductLoop::MyWrapper::getCenteringBoundary(), GUILaneSpeedTrigger::getCenteringBoundary(), GUICalibrator::getCenteringBoundary(), GUIPointOfInterest::getCenteringBoundary(), GUIPerson::getCenteringBoundary(), GUIJunctionWrapper::getCenteringBoundary(), GUIMEInductLoop::MyWrapper::getCenteringBoundary(), GNELane::getCenteringBoundary(), GUIE3Collector::MyWrapper::getCenteringBoundary(), GUITriggeredRerouter::getCenteringBoundary(), GNEEdge::getCenteringBoundary(), GUIChargingStation::getCenteringBoundary(), GUIContainerStop::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GNEConnection::getCenteringBoundary(), GUIParkingArea::getCenteringBoundary(), GUIEdge::getCenteringBoundary(), GUIE2Collector::MyWrapper::getCenteringBoundary(), GNEAdditional::getCenteringBoundary(), GUIBaseVehicle::getCenteringBoundary(), GUIInductLoop::MyWrapper::getCenteringBoundary(), GUITriggeredRerouter::GUITriggeredRerouterEdge::getCenteringBoundary(), GUILane::getCenteringBoundary(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), NBEdgeCont::ignoreFilterMatch(), GUINet::initGUIStructures(), and GNEViewNet::mergeJunctions().

void Boundary::growHeight ( double  by)

Increases the height of the boundary (y-axis)

Definition at line 318 of file Boundary.cpp.

References myYmax, and myYmin.

Referenced by GUIPointOfInterest::getCenteringBoundary(), GUIPerspectiveChanger::patchedViewPort(), and GUIDanielPerspectiveChanger::setViewport().

void Boundary::growWidth ( double  by)

Increases the width of the boundary (x-axis)

Definition at line 311 of file Boundary.cpp.

References myXmax, and myXmin.

Referenced by GUIPointOfInterest::getCenteringBoundary(), GUIPerspectiveChanger::patchedViewPort(), and GUIDanielPerspectiveChanger::setViewport().

void Boundary::moveby ( double  x,
double  y,
double  z = 0 
)
bool Boundary::overlapsWith ( const AbstractPoly &  poly,
double  offset = 0 
) const
virtual
bool Boundary::partialWithin ( const AbstractPoly &  poly,
double  offset = 0 
) const
virtual

Returns whether the boundary is partially within the given polygon.

Implements AbstractPoly.

Definition at line 292 of file Boundary.cpp.

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

Referenced by PCPolyContainer::add(), and overlapsWith().

void Boundary::reset ( )

Resets the boundary.

Definition at line 74 of file Boundary.cpp.

References myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.

Referenced by NBHeightMapper::clearData(), and GNENet::computeAndUpdate().

void Boundary::set ( double  xmin,
double  ymin,
double  xmax,
double  ymax 
)

Sets the boundary to the given values.

Definition at line 342 of file Boundary.cpp.

References myXmax, myXmin, myYmax, myYmin, xmax(), xmin(), ymax(), and ymin().

Referenced by TraCIServer::readTypeCheckingBoundary().

double Boundary::xmax ( ) const

Returns maximum x-coordinate.

Definition at line 132 of file Boundary.cpp.

References myXmax.

Referenced by add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), NBHeightMapper::addTriangle(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvasSizeLeft(), 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(), MSPModel_Remote::initialize(), main(), GUISUMOAbstractView::makeSnapshot(), NIVissimConnectionCluster::NIVissimConnectionCluster(), NIVissimConnectionCluster::overlapsWith(), NIVissimConnectionCluster::NodeSubCluster::overlapsWith(), GUISUMOAbstractView::paintGLGrid(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Simulation::processGet(), NIVissimConnectionCluster::recheckEdges(), NIVissimConnectionCluster::recomputeBoundary(), SUMORTree::removeAdditionalGLObject(), set(), GUIBaseVehicle::setFunctionalColor(), GNEPoly::simplifyShape(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), NWWriter_DlrNavteq::writeNodesUnsplitted(), and GUIDanielPerspectiveChanger::zoom().

double Boundary::xmin ( ) const

Returns minimum x-coordinate.

Definition at line 126 of file Boundary.cpp.

References myXmin.

Referenced by add(), NIVissimConnectionCluster::add(), SUMORTree::addAdditionalGLObject(), NBHeightMapper::addTriangle(), GUISUMOAbstractView::applyGLTransform(), NIVissimConnectionCluster::around(), NIVissimConnection::buildNodeClusters(), GUIDanielPerspectiveChanger::changeCanvasSizeLeft(), 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(), MSPModel_Remote::initialize(), 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(), GUISUMOAbstractView::screenPos2NetPos(), set(), GUIBaseVehicle::setFunctionalColor(), GNEPoly::simplifyShape(), BinaryFormatter::writeAttr(), NWWriter_OpenDrive::writeNetwork(), NWWriter_DlrNavteq::writeNodesUnsplitted(), and GUIDanielPerspectiveChanger::zoom().

double Boundary::zmax ( ) const

Returns maximum z-coordinate.

Definition at line 156 of file Boundary.cpp.

References myZmax.

Referenced by add().

double Boundary::zmin ( ) const

Returns minimum z-coordinate.

Definition at line 150 of file Boundary.cpp.

References myZmin.

Referenced by add().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Boundary &  b 
)
friend

Output operator.

Definition at line 335 of file Boundary.cpp.

Field Documentation

bool Boundary::myWasInitialised
private

Information whether the boundary was initialised.

Definition at line 151 of file Boundary.h.

Referenced by add(), and reset().

double Boundary::myXmax
private
double Boundary::myXmin
private
double Boundary::myYmax
private
double Boundary::myYmin
private
double Boundary::myZmax
private

Definition at line 148 of file Boundary.h.

Referenced by add(), around(), getCenter(), getZRange(), moveby(), reset(), and zmax().

double Boundary::myZmin
private

Definition at line 148 of file Boundary.h.

Referenced by add(), around(), getCenter(), getZRange(), moveby(), reset(), and zmin().


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