#pragma once #include "core/Types.h" #include namespace diag { class DiagramScene; class NetworkModel; // An edge (pipe/cable) routed orthogonally between two ports. Supports line // styles, head/tail decorations (arrow, circle, diamond, bar) and an animated // flow overlay whose direction and density follow the solver result. class EdgeItem : public QGraphicsObject { Q_OBJECT public: EdgeItem(DiagramScene* scene, QUuid edgeId); QUuid edgeId() const { return m_id; } NetworkModel* model() const; const QList& polyline() const { return m_poly; } void setRoute(const QList& poly, const QList& hops); QRectF boundingRect() const override; QPainterPath shape() const override; void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override; private: QPen basePen() const; void drawDecoration(QPainter* painter, const QString& kind, QPointF tip, QPointF back, const QColor& color, double width) const; void drawFlowOverlay(QPainter* painter, const QPainterPath& path, double width) const; DiagramScene* m_scene; QUuid m_id; QList m_poly; QList m_hops; QPainterPath m_path; }; } // namespace diag