DRAGGER needs to report it's nets.

Otherwise things like snapping don't work.

Fixes https://gitlab.com/kicad/code/kicad/issues/4147
This commit is contained in:
Jeff Young 2020-11-01 19:56:54 +00:00
parent a95e2184da
commit f6c92ab1ea
4 changed files with 65 additions and 54 deletions

View File

@ -79,6 +79,11 @@ public:
*/
NODE* CurrentNode() const override;
const std::vector<int> CurrentNets() const override
{
return std::vector<int>();
}
/**
* Function Traces()
*

View File

@ -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<int> 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;
};

View File

@ -83,6 +83,11 @@ public:
*/
NODE* CurrentNode() const override;
const std::vector<int> CurrentNets() const override
{
return std::vector<int>( 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<SHOVE> 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;
};
}

View File

@ -507,6 +507,8 @@ const std::vector<int> ROUTER::GetCurrentNets() const
{
if( m_placer )
return m_placer->CurrentNets();
else if( m_dragger )
return m_dragger->CurrentNets();
return std::vector<int>();
}