Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
Boundary Class Reference

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

#include <Boundary.h>

Inheritance diagram for Boundary:
[legend]
Collaboration diagram for Boundary:
[legend]

Public Member Functions

void add (const Boundary &p)
 Makes the boundary include the given boundary.
void add (const Position &p)
 Makes the boundary include the given coordinate.
void add (double x, double y, double z=0)
 Makes the boundary include the given coordinate.
 Boundary ()
 Constructor - the boundary is unset.
 Boundary (double x1, double y1, double x2, double y2)
 Constructor - the boundary will be build using the given values.
 Boundary (double x1, double y1, double z1, double x2, double y2, double z2)
 Constructor - the boundary will be build using the given values including Z.
bool contains2D (const Boundary &b) const
 return true if this boundary contains the given boundary (only X-Y)
double distanceTo2D (const Boundary &b) const
 returns the euclidean distance in the x-y-plane
double distanceTo2D (const Position &p) const
 returns the euclidean distance in the x-y-plane
void flipY ()
 flips ymin and ymax
Position getCenter () const
 Returns the center of the boundary.
double getHeight () const
 Returns the height of the boundary (y-axis).
PositionVector getShape (const bool closeShape) const
 get position vector (shape) based on this boundary
double getWidth () const
 Returns the width of the boudary (x-axis).
double getZRange () const
 Returns the elevation range of the boundary (z-axis).
Boundarygrow (double by)
 extends the boundary by the given amount
void growHeight (double by)
 Increases the height of the boundary (y-axis).
void growWidth (double by)
 Increases the width of the boundary (x-axis).
bool isInitialised () const
 check if Boundary is Initialised
void moveby (double x, double y, double z=0)
 Moves the boundary by the given amount.
bool operator!= (const Boundary &b) const
 Comparison operator not equal.
bool operator== (const Boundary &b) const
 Comparison operator equal.
bool overlaps2D (const Boundary &b) const
 return true if at least one point of the given boundary is in boundary(only X-Y)
void reset ()
 Resets the boundary.
Boundaryscale (double by)
 scale the boundary by the given amount
void set (double xmin, double ymin, double xmax, double ymax)
 Sets the boundary to the given values.
void setOffsets (double xmin, double ymin, double xmax, double ymax)
 Sets the boundary to the given values, ignoring min < max constraints.
double xmax () const
 Returns maximum x-coordinate.
double xmin () const
 Returns minimum x-coordinate.
double ymax () const
 Returns maximum y-coordinate.
double ymin () const
 Returns minimum y-coordinate.
double zmax () const
 Returns maximum z-coordinate.
double zmin () const
 Returns minimum z-coordinate.
inherited from AbstractPoly
bool around (const Position &p, double offset=0) const
 Returns whether the boundary contains the given coordinate.
bool around2D (const Position &p, double offset=0) const
 Returns whether the boundary contains the given 2D coordinate (position).
bool around2D (const double x, const double y) const
 Returns whether the boundary contains the given 2D coordinate (x-y version).
bool overlapsWith (const AbstractPoly &poly, double offset=0) const
 Returns whether the boundary overlaps with the given polygon.
bool partialWithin (const AbstractPoly &poly, double offset=0) const
 Returns whether the boundary is partially within the given polygon.
bool crosses (const Position &p1, const Position &p2) const
 Returns whether the boundary crosses the given line.

Private Attributes

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

Friends

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

Detailed Description

A class that stores a 2D geometrical boundary.

Definition at line 39 of file Boundary.h.

Constructor & Destructor Documentation

◆ Boundary() [1/3]

Boundary::Boundary ( )

Constructor - the boundary is unset.

Definition at line 35 of file Boundary.cpp.

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

Referenced by add(), SUMORTree::addAdditionalGLObject(), contains2D(), distanceTo2D(), operator!=(), operator<<, operator==(), overlaps2D(), and SUMORTree::removeAdditionalGLObject().

Here is the caller graph for this function:

◆ Boundary() [2/3]

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

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

Definition at line 42 of file Boundary.cpp.

References add(), myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.

◆ Boundary() [3/3]

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

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

Definition at line 52 of file Boundary.cpp.

References add(), myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.

Member Function Documentation

◆ add() [1/3]

void Boundary::add ( const Boundary & p)

Makes the boundary include the given boundary.

Definition at line 102 of file Boundary.cpp.

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

◆ add() [2/3]

void Boundary::add ( const Position & p)

Makes the boundary include the given coordinate.

Definition at line 96 of file Boundary.cpp.

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

◆ add() [3/3]

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

◆ around()

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

Returns whether the boundary contains the given coordinate.

Implements AbstractPoly.

Definition at line 169 of file Boundary.cpp.

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

◆ around2D() [1/2]

bool Boundary::around2D ( const double x,
const double y ) const

Returns whether the boundary contains the given 2D coordinate (x-y version).

Definition at line 186 of file Boundary.cpp.

References myXmax, myXmin, myYmax, and myYmin.

◆ around2D() [2/2]

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

Returns whether the boundary contains the given 2D coordinate (position).

Definition at line 178 of file Boundary.cpp.

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

Referenced by NBHeightMapper::getZ(), and overlaps2D().

Here is the caller graph for this function:

◆ contains2D()

bool Boundary::contains2D ( const Boundary & b) const

return true if this boundary contains the given boundary (only X-Y)

Definition at line 229 of file Boundary.cpp.

References Boundary(), myXmax, myXmin, myYmax, and myYmin.

◆ crosses()

bool Boundary::crosses ( const Position & p1,
const Position & p2 ) const
virtual

Returns whether the boundary crosses the given line.

Implements AbstractPoly.

Definition at line 215 of file Boundary.cpp.

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

◆ distanceTo2D() [1/2]

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

returns the euclidean distance in the x-y-plane

Definition at line 296 of file Boundary.cpp.

References Boundary(), myXmax, myXmin, myYmax, and myYmin.

◆ distanceTo2D() [2/2]

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

returns the euclidean distance in the x-y-plane

Definition at line 262 of file Boundary.cpp.

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

Referenced by libsumo::Helper::convertCartesianToRoadMap(), MSEdge::getDistanceTo(), and ROEdge::getDistanceTo().

Here is the caller graph for this function:

◆ flipY()

void Boundary::flipY ( )

flips ymin and ymax

Definition at line 372 of file Boundary.cpp.

References myYmax, and myYmin.

◆ getCenter()

Position Boundary::getCenter ( ) const

Returns the center of the boundary.

Definition at line 109 of file Boundary.cpp.

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

Referenced by GUISUMOAbstractView::applyGLTransform(), GUIGlObject::getCenter(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), MSPModel_Striping::moveInDirection(), GUISUMOAbstractView::screenPos2NetPos(), and GUIOSGPerspectiveChanger::setViewport().

Here is the caller graph for this function:

◆ getHeight()

double Boundary::getHeight ( ) const

Returns the height of the boundary (y-axis).

Definition at line 157 of file Boundary.cpp.

References myYmax, and myYmin.

Referenced by GUISUMOAbstractView::applyGLTransform(), GUIPolygon::checkDraw(), libsumo::Helper::convertCartesianToRoadMap(), and GUISUMOAbstractView::screenPos2NetPos().

Here is the caller graph for this function:

◆ getShape()

PositionVector Boundary::getShape ( const bool closeShape) const

get position vector (shape) based on this boundary

Definition at line 444 of file Boundary.cpp.

References myXmax, myXmin, myYmax, and myYmin.

Referenced by GNEAdditionalHandler::buildTAZ(), GNEViewNetHelper::SelectingArea::processBoundarySelection(), GNEViewNetHelper::SelectingArea::processEdgeRectangleSelection(), and LIBSUMO_NAMESPACE::Simulation::storeShape().

Here is the caller graph for this function:

◆ getWidth()

double Boundary::getWidth ( ) const

Returns the width of the boudary (x-axis).

Definition at line 151 of file Boundary.cpp.

References myXmax, and myXmin.

Referenced by GUISUMOAbstractView::applyGLTransform(), GUIPolygon::checkDraw(), libsumo::Helper::convertCartesianToRoadMap(), MSPModel_Striping::moveInDirection(), and GUISUMOAbstractView::screenPos2NetPos().

Here is the caller graph for this function:

◆ getZRange()

double Boundary::getZRange ( ) const

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

Definition at line 163 of file Boundary.cpp.

References myZmax, and myZmin.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ grow()

◆ growHeight()

void Boundary::growHeight ( double by)

Increases the height of the boundary (y-axis).

Definition at line 366 of file Boundary.cpp.

References myYmax, and myYmin.

Referenced by scale().

Here is the caller graph for this function:

◆ growWidth()

void Boundary::growWidth ( double by)

Increases the width of the boundary (x-axis).

Definition at line 359 of file Boundary.cpp.

References myXmax, and myXmin.

Referenced by MSPModel_Striping::moveInDirection(), and scale().

Here is the caller graph for this function:

◆ isInitialised()

bool Boundary::isInitialised ( ) const

check if Boundary is Initialised

Definition at line 256 of file Boundary.cpp.

References myWasInitialised.

Referenced by GUIViewObjectsHandler::checkShapeObject(), GNEAdditional::getCenteringBoundary(), GNERoute::getCenteringBoundary(), and NIImporter_OpenDrive::loadNetwork().

Here is the caller graph for this function:

◆ moveby()

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

Moves the boundary by the given amount.

Definition at line 433 of file Boundary.cpp.

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

◆ operator!=()

bool Boundary::operator!= ( const Boundary & b) const

Comparison operator not equal.

Definition at line 403 of file Boundary.cpp.

References Boundary().

◆ operator==()

bool Boundary::operator== ( const Boundary & b) const

Comparison operator equal.

Definition at line 390 of file Boundary.cpp.

References Boundary(), myWasInitialised, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.

◆ overlaps2D()

bool Boundary::overlaps2D ( const Boundary & b) const

return true if at least one point of the given boundary is in boundary(only X-Y)

Definition at line 240 of file Boundary.cpp.

References around2D(), and Boundary().

◆ overlapsWith()

bool Boundary::overlapsWith ( const AbstractPoly & poly,
double offset = 0 ) const
virtual

Returns whether the boundary overlaps with the given polygon.

Implements AbstractPoly.

Definition at line 194 of file Boundary.cpp.

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

Referenced by NBEdgeCont::checkOverlap(), NBEdgeCont::ignoreFilterMatch(), and NIVissimConnectionCluster::overlapsWith().

Here is the caller graph for this function:

◆ partialWithin()

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 330 of file Boundary.cpp.

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

Referenced by overlapsWith().

Here is the caller graph for this function:

◆ reset()

void Boundary::reset ( )

Resets the boundary.

Definition at line 63 of file Boundary.cpp.

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

◆ scale()

Boundary & Boundary::scale ( double by)

scale the boundary by the given amount

Returns
a reference to the instance for further use

Definition at line 351 of file Boundary.cpp.

References growHeight(), growWidth(), myXmax, myXmin, myYmax, and myYmin.

◆ set()

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

Sets the boundary to the given values.

Definition at line 409 of file Boundary.cpp.

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

◆ setOffsets()

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

Sets the boundary to the given values, ignoring min < max constraints.

Definition at line 424 of file Boundary.cpp.

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

Referenced by main().

Here is the caller graph for this function:

◆ xmax()

◆ xmin()

◆ ymax()

◆ ymin()

◆ zmax()

double Boundary::zmax ( ) const

Returns maximum z-coordinate.

Definition at line 145 of file Boundary.cpp.

References myZmax.

Referenced by add().

Here is the caller graph for this function:

◆ zmin()

double Boundary::zmin ( ) const

Returns minimum z-coordinate.

Definition at line 139 of file Boundary.cpp.

References myZmin.

Referenced by add().

Here is the caller graph for this function:

◆ operator<<

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

Output operator.

Definition at line 382 of file Boundary.cpp.

References Boundary().

Field Documentation

◆ myWasInitialised

bool Boundary::myWasInitialised
private

Information whether the boundary was initialised.

Definition at line 175 of file Boundary.h.

Referenced by add(), Boundary(), Boundary(), Boundary(), isInitialised(), operator==(), and reset().

◆ myXmax

◆ myXmin

◆ myYmax

◆ myYmin

◆ myZmax

double Boundary::myZmax
private

◆ myZmin

double Boundary::myZmin
private

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