Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/dsf/base/Edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ namespace dsf {
assert(!(std::abs(m_angle) > 2 * std::numbers::pi));
}

void Edge::resetId(Id newId) { m_id = newId; }

void Edge::setGeometry(geometry::PolyLine geometry) {
m_geometry = std::move(geometry);
if (m_geometry.size() > 1) {
Expand All @@ -46,16 +44,10 @@ namespace dsf {
m_weight = weight;
}

Id Edge::id() const { return m_id; }
Id Edge::source() const { return m_nodePair.first; }
Id Edge::target() const { return m_nodePair.second; }
std::pair<Id, Id> const& Edge::nodePair() const { return m_nodePair; }
double Edge::angle() const { return m_angle; }
double Edge::weight() const {
return m_weight.has_value() ? *m_weight
: throw std::runtime_error("Edge weight is not set.");
}
geometry::PolyLine const& Edge::geometry() const { return m_geometry; }

double Edge::deltaAngle(double const previousEdgeAngle) const {
double deltaAngle{m_angle - previousEdgeAngle};
Expand Down
18 changes: 11 additions & 7 deletions src/dsf/base/Edge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,34 @@ namespace dsf {
Edge(const Edge&) = delete;
virtual ~Edge() = default;

void resetId(Id newId);
/// @brief Set the edge's geometry
/// @param geometry dsf::geometry::PolyLine The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation format is inconsistent. The parameter type 'dsf::geometry::PolyLine' should not be included in the @param description - it should only contain the parameter name followed by the description. The type is already declared in the function signature.

Suggested change
/// @param geometry dsf::geometry::PolyLine The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry
/// @param geometry The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry

Copilot uses AI. Check for mistakes.
void setGeometry(geometry::PolyLine geometry);
/// @brief Set the edge's weight
/// @param weight The edge's weight
/// @throws std::invalid_argument if the weight is less or equal to 0
void setWeight(double const weight);

/// @brief Get the edge's id
/// @return Id The edge's id
Id id() const;
inline auto id() const { return m_id; }
/// @brief Get the edge's source node id
/// @return Id The edge's source node id
Id source() const;
inline auto source() const { return m_nodePair.first; }
/// @brief Get the edge's target node id
/// @return Id The edge's target node id
Id target() const;
inline auto target() const { return m_nodePair.second; }
/// @brief Get the edge's node pair
/// @return 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.
std::pair<Id, Id> const& nodePair() const;
inline auto const& nodePair() const { return m_nodePair; }
/// @brief Get the edge's geometry
/// @return dsf::geometry::PolyLine The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry
geometry::PolyLine const& geometry() const;
inline auto const& geometry() const { return m_geometry; }

/// @brief Get the edge's angle, in radians, between the source and target nodes
/// @return double The edge's angle, in radians
double angle() const;
inline auto angle() const { return m_angle; }
/// @brief Get the edge's weight
/// @return double The edge's weight
double weight() const;
Expand Down
8 changes: 6 additions & 2 deletions src/dsf/base/Node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ namespace dsf {
/// @brief Set the node's name
/// @param name The node's name
inline void setName(const std::string& name) noexcept { m_name = name; }

/// @brief Add an ingoing edge to the node
/// @param edgeId The edge's id
/// @throws std::invalid_argument if the edge already exists in the ingoing edges
inline void addIngoingEdge(Id edgeId) {
if (std::find(m_ingoingEdges.cbegin(), m_ingoingEdges.cend(), edgeId) !=
m_ingoingEdges.cend()) {
Expand All @@ -83,7 +85,9 @@ namespace dsf {
}
m_ingoingEdges.push_back(edgeId);
}

/// @brief Add an outgoing edge to the node
/// @param edgeId The edge's id
/// @throws std::invalid_argument if the edge already exists in the outgoing edges
inline void addOutgoingEdge(Id edgeId) {
if (std::find(m_outgoingEdges.cbegin(), m_outgoingEdges.cend(), edgeId) !=
m_outgoingEdges.cend()) {
Expand Down
1 change: 0 additions & 1 deletion src/dsf/utility/queue.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

#include <queue>
Expand Down
Loading