Dynamical system model
Loading...
Searching...
No Matches
dsf::Edge Class Referenceabstract
Inheritance diagram for dsf::Edge:
dsf::mobility::Road dsf::mobility::Street

Public Member Functions

 Edge (Id id, std::pair< Id, Id > nodePair, geometry::PolyLine geometry={})
 Construct a new Edge object.
 Edge (Edge &&)=default
 Edge (const Edge &)=delete
void setGeometry (geometry::PolyLine geometry)
 Set the edge's geometry.
void setAttribute (std::string const &name, std::variant< std::monostate, bool, std::int64_t, double, std::string > const &value)
 Set an attribute for the edge.
auto id () const
 Get the edge's id.
auto source () const
 Get the edge's source node id.
auto target () const
 Get the edge's target node id.
auto const & nodePair () const
 Get the edge's node pair.
auto const & geometry () const
 Get the edge's geometry.
auto angle () const
 Get the edge's angle, in radians, between the source and target nodes.
auto const & attributes () const
 Get the edge's attributes.
template<typename T>
std::optional< T > getAttribute (std::string const &name) const
 Get an attribute of the edge by name.
virtual bool isFull () const =0
virtual bool isActive () const
double deltaAngle (double const previousEdgeAngle) const

Protected Member Functions

void m_setAngle (geometry::Point srcNodeCoordinates, geometry::Point dstNodeCoordinates)

Protected Attributes

geometry::PolyLine m_geometry
Id m_id
std::pair< Id, Id > m_nodePair
double m_angle
std::unordered_map< std::string, std::variant< std::monostate, bool, std::int64_t, double, std::string > > m_attributes

Constructor & Destructor Documentation

◆ Edge()

dsf::Edge::Edge ( Id id,
std::pair< Id, Id > nodePair,
geometry::PolyLine geometry = {} )

Construct a new Edge object.

Parameters
idThe edge's id
nodePairThe edge's node pair (u, v) with the edge u -> v
geometryThe edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry. Default is an empty vector.

Member Function Documentation

◆ angle()

auto dsf::Edge::angle ( ) const
inline

Get the edge's angle, in radians, between the source and target nodes.

Returns
double The edge's angle, in radians

◆ attributes()

auto const & dsf::Edge::attributes ( ) const
inline

Get the edge's attributes.

Returns
std::unordered_map<std::string, std::variant<std::monostate, bool, std::int64_t, double, std::string>> The edge's attributes, where the key is the attribute's name and the value is the attribute's value

◆ geometry()

auto const & dsf::Edge::geometry ( ) const
inline

Get the edge's geometry.

Returns
dsf::geometry::PolyLine The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry

◆ getAttribute()

template<typename T>
std::optional< T > dsf::Edge::getAttribute ( std::string const & name) const
inline

Get an attribute of the edge by name.

Template Parameters
TThe expected type of the attribute's value
Parameters
nameThe attribute's name
Returns
std::optional<T> The attribute's value if it exists and can be cast to the expected type, std::nullopt otherwise

◆ id()

auto dsf::Edge::id ( ) const
inline

Get the edge's id.

Returns
Id The edge's id

◆ isActive()

virtual bool dsf::Edge::isActive ( ) const
inlinevirtual

Reimplemented in dsf::mobility::Road.

◆ isFull()

virtual bool dsf::Edge::isFull ( ) const
pure virtual

Implemented in dsf::mobility::Road.

◆ nodePair()

auto const & dsf::Edge::nodePair ( ) const
inline

Get the edge's node pair.

Returns
std::pair<Id, Id> The edge's node pair, where the first element is the source node id and the second element is the target node id. The pair is (u, v) with the edge u -> v.

◆ setAttribute()

void dsf::Edge::setAttribute ( std::string const & name,
std::variant< std::monostate, bool, std::int64_t, double, std::string > const & value )

Set an attribute for the edge.

Parameters
nameThe attribute's name
valueThe attribute's value

◆ setGeometry()

void dsf::Edge::setGeometry ( geometry::PolyLine geometry)

Set the edge's geometry.

Parameters
geometrydsf::geometry::PolyLine The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry

◆ source()

auto dsf::Edge::source ( ) const
inline

Get the edge's source node id.

Returns
Id The edge's source node id

◆ target()

auto dsf::Edge::target ( ) const
inline

Get the edge's target node id.

Returns
Id The edge's target node id

The documentation for this class was generated from the following files:
  • src/dsf/base/Edge.hpp
  • src/dsf/base/Edge.cpp