diff --git a/pcbnew/router/pns_component_dragger.h b/pcbnew/router/pns_component_dragger.h index 5253e86ce9..f20f25a1a8 100644 --- a/pcbnew/router/pns_component_dragger.h +++ b/pcbnew/router/pns_component_dragger.h @@ -79,6 +79,11 @@ public: */ NODE* CurrentNode() const override; + const std::vector CurrentNets() const override + { + return std::vector(); + } + /** * Function Traces() * diff --git a/pcbnew/router/pns_drag_algo.h b/pcbnew/router/pns_drag_algo.h index 3650b00f8c..466a87d07b 100644 --- a/pcbnew/router/pns_drag_algo.h +++ b/pcbnew/router/pns_drag_algo.h @@ -43,13 +43,14 @@ class DRAG_ALGO : public ALGO_BASE { public: DRAG_ALGO( ROUTER* aRouter ) : - ALGO_BASE( aRouter ), m_world( nullptr ) + ALGO_BASE( aRouter ), + m_world( nullptr ) { } - ~DRAG_ALGO() - { - } + ~DRAG_ALGO() + { + } /** * Function SetWorld() @@ -61,51 +62,52 @@ public: m_world = aWorld; } + /** + * Function Start() + * + * Starts routing a single track at point aP, taking item aStartItem as anchor + * (unless NULL). Returns true if a dragging operation has started. + */ + virtual bool Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) = 0; - /** - * Function Start() - * - * Starts routing a single track at point aP, taking item aStartItem as anchor - * (unless NULL). Returns true if a dragging operation has started. - */ - virtual bool Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) = 0; + /** + * Function Drag() + * + * Drags the current segment/corner/via to the point aP. + * @return true, if dragging finished with success. + */ + virtual bool Drag( const VECTOR2I& aP ) = 0; - /** - * Function Drag() - * - * Drags the current segment/corner/via to the point aP. - * @return true, if dragging finished with success. - */ - virtual bool Drag( const VECTOR2I& aP ) = 0; + /** + * Function FixRoute() + * + * Checks if the result of current dragging operation is correct + * and eventually commits it to the world. + * @return true, if dragging finished with success. + */ + virtual bool FixRoute() = 0; - /** - * Function FixRoute() - * - * Checks if the result of current dragging operation is correct - * and eventually commits it to the world. - * @return true, if dragging finished with success. - */ - virtual bool FixRoute() = 0; + /** + * Function CurrentNode() + * + * Returns the most recent world state, including all + * items changed due to dragging operation. + */ + virtual NODE* CurrentNode() const = 0; - /** - * Function CurrentNode() - * - * Returns the most recent world state, including all - * items changed due to dragging operation. - */ - virtual NODE* CurrentNode() const = 0; + virtual const std::vector CurrentNets() const = 0; - /** - * Function Traces() - * - * Returns the set of dragged items. - */ - virtual const ITEM_SET Traces() = 0; + /** + * Function Traces() + * + * Returns the set of dragged items. + */ + virtual const ITEM_SET Traces() = 0; - virtual void SetMode( int aDragMode ) {}; + virtual void SetMode( int aDragMode ) {}; protected: - NODE* m_world; + NODE* m_world; }; diff --git a/pcbnew/router/pns_dragger.h b/pcbnew/router/pns_dragger.h index 31fb8748e8..b865a2ff41 100644 --- a/pcbnew/router/pns_dragger.h +++ b/pcbnew/router/pns_dragger.h @@ -83,6 +83,11 @@ public: */ NODE* CurrentNode() const override; + const std::vector CurrentNets() const override + { + return std::vector( 1, m_draggedLine.Net() ); + } + /** * Function Traces() * @@ -107,25 +112,22 @@ private: void optimizeAndUpdateDraggedLine( LINE& dragged, SEG& aDraggedSeg, const VECTOR2I& aP ); - VIA_HANDLE m_initialVia; - VIA_HANDLE m_draggedVia; + VIA_HANDLE m_initialVia; + VIA_HANDLE m_draggedVia; - NODE* m_lastNode; - int m_mode; - LINE m_draggedLine; - //VIA* m_draggedVia; - //LINE m_lastValidDraggedLine; + NODE* m_lastNode; + int m_mode; + LINE m_draggedLine; std::unique_ptr m_shove; - int m_draggedSegmentIndex; - bool m_dragStatus; - PNS_MODE m_currentMode; - ITEM_SET m_origViaConnections; + int m_draggedSegmentIndex; + bool m_dragStatus; + PNS_MODE m_currentMode; ///< Contains the list of items that are currently modified by the dragger - ITEM_SET m_draggedItems; + ITEM_SET m_draggedItems; ///< If true, moves the connection lines without maintaining 45° corners - bool m_freeAngleMode; + bool m_freeAngleMode; }; } diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index e0e210a20c..b5b4afebe9 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -507,6 +507,8 @@ const std::vector ROUTER::GetCurrentNets() const { if( m_placer ) return m_placer->CurrentNets(); + else if( m_dragger ) + return m_dragger->CurrentNets(); return std::vector(); }