SUMO - Simulation of Urban MObility
PositionVector Class Reference

A list of positions. More...

#include <PositionVector.h>

Inheritance diagram for PositionVector:
AbstractPoly

Data Structures

class  as_poly_cw_sorter
class  increasing_x_y_sorter

Public Types

typedef std::vector< PositionContType
 Definition of the list of points.

Public Member Functions

void add (SUMOReal xoff, SUMOReal yoff, SUMOReal zoff)
int appendWithCrossingPoint (const PositionVector &v)
SUMOReal area () const
 Returns the area (0 for non-closed)
bool around (const Position &p, SUMOReal offset=0) const
 Returns the information whether the position vector describes a polygon lying around the given point The optional offset is added to the polygon's bounderies.
ContType::const_iterator begin () const
SUMOReal beginEndAngle () const
void clear ()
 Removes all information from this list.
void closePolygon ()
PositionVector convexHull () const
bool crosses (const Position &p1, const Position &p2) const
SUMOReal distance (const Position &p) const
std::vector< SUMORealdistances (const PositionVector &s) const
ContType::const_iterator end () const
void eraseAt (int i)
void extrapolate (SUMOReal val)
const PositiongetBegin () const
 Returns the first position.
Line getBegLine () const
Boundary getBoxBoundary () const
 Returns a boundary enclosing this list of lines.
Position getCentroid () const
 Returns the centroid (closes the polygon if unclosed)
const PositiongetEnd () const
 Returns the last position.
Line getEndLine () const
Position getLineCenter () const
Position getPolygonCenter () const
 Returns the arithmetic of all corner points.
PositionVector getSubpart (SUMOReal begin, SUMOReal end) const
PositionVector getSubpart2D (SUMOReal begin, SUMOReal end) const
int indexOfClosest (const Position &p) const
void insertAt (int index, const Position &p)
void insertAtClosest (const Position &p)
PositionVector intersectionPoints2D (const Line &line) const
bool intersects (const Position &p1, const Position &p2) const
bool intersects (const PositionVector &v1) const
std::vector< SUMORealintersectsAtLengths2D (const PositionVector &other) const
 For all intersections between this vector and other, return the 2D-length of the subvector from this vectors start to the intersection.
std::vector< SUMORealintersectsAtLengths2D (const Line &line) const
 For all intersections between this vector and line, return the 2D-length of the subvector from this vectors start to the intersection.
Position intersectsAtPoint (const Position &p1, const Position &p2) const
Position intersectsAtPoint (const PositionVector &v1) const
bool isClosed () const
SUMOReal isLeft (const Position &P0, const Position &P1, const Position &P2) const
SUMOReal length () const
 Returns the length.
Line lineAt (size_t pos) const
void move2side (SUMOReal amount)
SUMOReal nearest_position_on_line_to_point2D (const Position &p, bool perpendicular=true) const
bool operator== (const PositionVector &v2) const
 comparing operation
const Positionoperator[] (int index) const
 returns the position at the given index !!! exceptions?
Positionoperator[] (int index)
bool overlapsWith (const AbstractPoly &poly, SUMOReal offset=0) const
 Returns the information whether the given polygon overlaps with this Again a boundary may be specified.
bool partialWithin (const AbstractPoly &poly, SUMOReal offset=0) const
 Returns the information whether this polygon lies partially within the given polygon.
Position pop_back ()
Position pop_front ()
Position positionAtLengthPosition (SUMOReal pos) const
 Returns the position at the given length.
Position positionAtLengthPosition2D (SUMOReal pos) const
 Returns the position at the given length.
 PositionVector ()
 Constructor.
 PositionVector (const std::vector< Position > &v)
 Constructor.
void pruneFromBeginAt (const Position &p)
void pruneFromEndAt (const Position &p)
void push_back_noDoublePos (const Position &p)
void push_front (const Position &p)
 Puts the given position at the begin of the list.
void push_front_noDoublePos (const Position &p)
void removeColinearPoints ()
void removeDoublePoints ()
void replaceAt (size_t index, const Position &by)
void reshiftRotate (SUMOReal xoff, SUMOReal yoff, SUMOReal rot)
PositionVector reverse () const
SUMOReal rotationDegreeAtLengthPosition (SUMOReal pos) const
 Returns the position at the given length.
void scaleSize (SUMOReal factor)
 enlarges/shrinks the polygon based at the centroid
void set (size_t pos, const Position &p)
size_t size () const
 returns the number of points making up the line vector
void sortAsPolyCWByAngle ()
void sortByIncreasingXY ()
std::pair< PositionVector,
PositionVector
splitAt (SUMOReal where) const
 Returns the two lists made when this list vector is splitted at the given point.
 ~PositionVector ()
 Destructor.
Adding items to the container
void push_back (const Position &p)
 Appends the given position to the list.
void push_back (const PositionVector &p)
 Appends all positions from the given vector.

Static Public Member Functions

static Position positionAtLengthPosition (const Position &p1, const Position &p2, SUMOReal pos)
 Returns the position between the two given point at the specified position */.
static Position positionAtLengthPosition2D (const Position &p1, const Position &p2, SUMOReal pos)
 Returns the position between the two given point at the specified position */.

Private Attributes

ContType myCont
 The list of points.

Friends

std::ostream & operator<< (std::ostream &os, const PositionVector &geom)
 Output operator.

Detailed Description

A list of positions.

Definition at line 53 of file PositionVector.h.


Member Typedef Documentation

typedef std::vector<Position> PositionVector::ContType

Definition of the list of points.

Definition at line 57 of file PositionVector.h.


Constructor & Destructor Documentation

Constructor.

Creates an empty position vector

Definition at line 60 of file PositionVector.cpp.

PositionVector::PositionVector ( const std::vector< Position > &  v)

Constructor.

Parameters:
[in]vThe vector to copy

Definition at line 63 of file PositionVector.cpp.

References myCont.

Destructor.

Definition at line 68 of file PositionVector.cpp.


Member Function Documentation

void PositionVector::add ( SUMOReal  xoff,
SUMOReal  yoff,
SUMOReal  zoff 
)

Definition at line 484 of file PositionVector.cpp.

References myCont, and size().

Referenced by NBEdge::init(), and NBNode::reshiftPosition().

Returns the area (0 for non-closed)

Definition at line 374 of file PositionVector.cpp.

References isClosed(), push_back(), size(), and SUMOReal.

Referenced by getCentroid().

bool PositionVector::around ( const Position p,
SUMOReal  offset = 0 
) const [virtual]

Returns the information whether the position vector describes a polygon lying around the given point The optional offset is added to the polygon's bounderies.

Implements AbstractPoly.

Definition at line 91 of file PositionVector.cpp.

References GeomHelper::Angle2D(), myCont, PI, SUMOReal, Position::x(), and Position::y().

Referenced by NIImporter_SUMO::addJunction(), and NIVissimTL::NIVissimTLSignal::isWithin().

Removes all information from this list.

Definition at line 186 of file PositionVector.cpp.

References myCont.

Referenced by NBEdge::init(), PCLoaderVisum::load(), PCLoaderDlrNavteq::loadPolyFile(), and NBEdge::splitGeometry().

Definition at line 1004 of file PositionVector.cpp.

References myCont, and push_back().

bool PositionVector::crosses ( const Position p1,
const Position p2 
) const [virtual]

Implements AbstractPoly.

Definition at line 405 of file PositionVector.cpp.

References intersects().

std::vector< SUMOReal > PositionVector::distances ( const PositionVector s) const

Definition at line 1013 of file PositionVector.cpp.

References distance(), and myCont.

Referenced by NBEdge::isNearEnough2BeJoined2().

Definition at line 768 of file PositionVector.cpp.

References myCont.

Referenced by NBEdge::startShapeAt().

Returns the centroid (closes the polygon if unclosed)

Definition at line 311 of file PositionVector.cpp.

References area(), isClosed(), length(), push_back(), size(), and SUMOReal.

Referenced by scaleSize().

Returns the arithmetic of all corner points.

Note:
: this is different from the centroid!

Definition at line 299 of file PositionVector.cpp.

References myCont, and SUMOReal.

Referenced by NIVissimNodeCluster::buildNBNode(), and NIVissimDistrictConnection::dict_BuildDistrictNodes().

Definition at line 800 of file PositionVector.cpp.

References Position::distanceTo(), max, myCont, size(), and SUMOReal.

void PositionVector::insertAt ( int  index,
const Position p 
)

Returns any intersection Points with the given line (ignoring z-coordinates)

Definition at line 551 of file PositionVector.cpp.

References GeomHelper::intersection_position2D(), GeomHelper::intersects(), myCont, Line::p1(), Line::p2(), and push_back_noDoublePos().

Referenced by Line::intersectsAtLengths2D().

bool PositionVector::intersects ( const Position p1,
const Position p2 
) const

Returns the information whether this list of points interesects one the given lines

Definition at line 143 of file PositionVector.cpp.

References intersects(), myCont, and size().

std::vector< SUMOReal > PositionVector::intersectsAtLengths2D ( const PositionVector other) const

For all intersections between this vector and other, return the 2D-length of the subvector from this vectors start to the intersection.

Definition at line 846 of file PositionVector.cpp.

References myCont.

Referenced by NBEdge::buildInnerEdges(), computeSameEnd(), and NBEdge::startShapeAt().

std::vector< SUMOReal > PositionVector::intersectsAtLengths2D ( const Line line) const

For all intersections between this vector and line, return the 2D-length of the subvector from this vectors start to the intersection.

Definition at line 857 of file PositionVector.cpp.

References Position::distanceTo2D(), GeomHelper::intersection_position2D(), GeomHelper::intersects(), Line::length2D(), myCont, Line::p1(), Line::p2(), and SUMOReal.

Position PositionVector::intersectsAtPoint ( const Position p1,
const Position p2 
) const

Returns the position of the intersection

Definition at line 158 of file PositionVector.cpp.

References GeomHelper::intersection_position2D(), GeomHelper::intersects(), and myCont.

Referenced by NIVissimAbstractEdge::crossesEdgeAtPoint(), GeomHelper::crossPoint(), and intersectsAtPoint().

Returns the position of the intersection

Definition at line 170 of file PositionVector.cpp.

References intersects(), intersectsAtPoint(), and myCont.

Definition at line 1076 of file PositionVector.cpp.

References myCont.

Referenced by area(), and getCentroid().

SUMOReal PositionVector::isLeft ( const Position P0,
const Position P1,
const Position P2 
) const

Definition at line 530 of file PositionVector.cpp.

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

bool PositionVector::operator== ( const PositionVector v2) const

comparing operation

Definition at line 1114 of file PositionVector.cpp.

References size().

const Position & PositionVector::operator[] ( int  index) const

returns the position at the given index !!! exceptions?

Definition at line 192 of file PositionVector.cpp.

References myCont.

Position & PositionVector::operator[] ( int  index)

Definition at line 202 of file PositionVector.cpp.

References myCont.

bool PositionVector::overlapsWith ( const AbstractPoly poly,
SUMOReal  offset = 0 
) const [virtual]

Returns the information whether the given polygon overlaps with this Again a boundary may be specified.

Implements AbstractPoly.

Definition at line 117 of file PositionVector.cpp.

References AbstractPoly::around(), and myCont.

Referenced by NIVissimAbstractEdge::overlapsWith().

bool PositionVector::partialWithin ( const AbstractPoly poly,
SUMOReal  offset = 0 
) const [virtual]

Returns the information whether this polygon lies partially within the given polygon.

Implements AbstractPoly.

Definition at line 393 of file PositionVector.cpp.

References AbstractPoly::around(), and myCont.

Position PositionVector::positionAtLengthPosition ( const Position p1,
const Position p2,
SUMOReal  pos 
) [static]

Returns the position between the two given point at the specified position */.

Definition at line 265 of file PositionVector.cpp.

References Position::distanceTo(), and SUMOReal.

Position PositionVector::positionAtLengthPosition2D ( const Position p1,
const Position p2,
SUMOReal  pos 
) [static]

Returns the position between the two given point at the specified position */.

Definition at line 277 of file PositionVector.cpp.

References Position::distanceTo2D(), and SUMOReal.

Appends all positions from the given vector.

Parameters:
[in]pThe vector from which values shall be appended

Definition at line 79 of file PositionVector.cpp.

References myCont.

void PositionVector::push_front ( const Position p)

Puts the given position at the begin of the list.

Definition at line 85 of file PositionVector.cpp.

References myCont.

Referenced by NBNodeCont::buildOffRamp(), extrapolate(), NBEdge::init(), NIImporter_DlrNavteq::EdgesHandler::report(), and NBEdge::setGeometry().

Definition at line 1082 of file PositionVector.cpp.

References myCont.

Referenced by NBEdge::init().

void PositionVector::replaceAt ( size_t  index,
const Position by 
)
void PositionVector::reshiftRotate ( SUMOReal  xoff,
SUMOReal  yoff,
SUMOReal  rot 
)

Definition at line 492 of file PositionVector.cpp.

References myCont, and size().

Referenced by NBDistrict::reshiftPosition(), and NBEdge::reshiftPosition().

enlarges/shrinks the polygon based at the centroid

Definition at line 346 of file PositionVector.cpp.

References getCentroid(), myCont, and size().

void PositionVector::set ( size_t  pos,
const Position p 
)

Definition at line 545 of file PositionVector.cpp.

References myCont.

size_t PositionVector::size ( ) const

returns the number of points making up the line vector

Definition at line 212 of file PositionVector.cpp.

References myCont.

Referenced by NIImporter_SUMO::_loadNetwork(), add(), NIXMLEdgesHandler::addEdge(), NLHandler::addLane(), area(), NIVissimConnection::buildGeom(), NBEdge::buildInnerEdges(), NIVissimNodeCluster::buildNBNode(), NBNodeShapeComputer::compute(), NBEdge::computeEdgeShape(), NBNode::computeInternalLaneShape(), NIImporter_OpenDrive::computeShapes(), GLHelper::drawBoxLines(), GLHelper::drawFilledPoly(), GUIPolygon::drawGL(), GLHelper::drawLine(), GUILaneWrapper::drawMarkings(), Distribution_Points::getAreaNo(), Distribution_Points::getAreaPerc(), GUIEdge::getBoundary(), getCentroid(), Distribution_Points::getMax(), GUIBusStop::GUIBusStop(), GUIJunctionWrapper::GUIJunctionWrapper(), GUILaneWrapper::GUILaneWrapper(), NBEdge::hasDefaultGeometry(), NBEdgeCont::ignoreFilterMatch(), indexOfClosest(), NBEdge::init(), insertAtClosest(), intersects(), Line::intersectsAtLengths2D(), NIImporter_OpenDrive::loadNetwork(), PCLoaderDlrNavteq::loadPolyFile(), operator==(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Polygon::processGet(), push_back_noDoublePos(), push_front_noDoublePos(), NIVissimConnectionCluster::recomputeBoundary(), NIImporter_SUMO::reconstructEdgeShape(), replaceAt(), NBNodeShapeComputer::replaceLastChecking(), reshiftRotate(), scaleSize(), simpleHull_2D(), splitAt(), NBEdge::splitGeometry(), NILoader::transformCoordinates(), BinaryFormatter::writeAttr(), NWWriter_SUMO::writeDistrict(), NWWriter_XML::writeEdgesAndConnections(), and NWWriter_OpenDrive::writePlanView().

Definition at line 478 of file PositionVector.cpp.

References myCont.

Referenced by convexHull().

Definition at line 508 of file PositionVector.cpp.

References myCont.

Returns the two lists made when this list vector is splitted at the given point.

Definition at line 424 of file PositionVector.cpp.

References Position::distanceTo(), getBegin(), getEnd(), length(), myCont, POSITION_EPS, push_back(), size(), SUMOReal, toString(), and WRITE_WARNING.

Referenced by NBEdge::buildInnerEdges(), and NBEdgeCont::splitAt().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const PositionVector geom 
) [friend]

Output operator.

Definition at line 466 of file PositionVector.cpp.


Field Documentation


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines