PNS: correctly snap to offset pads

This commit is contained in:
Tomasz Wlostowski 2015-08-04 12:15:47 +02:00 committed by Maciej Suminski
parent 86b07d89a7
commit b6f61ff676
4 changed files with 25 additions and 2 deletions

View File

@ -385,7 +385,7 @@ void RN_NET::Update()
void RN_NET::AddItem( const D_PAD* aPad )
{
RN_NODE_PTR node = m_links.AddNode( aPad->ShapePos().x, aPad->ShapePos().y );
RN_NODE_PTR node = m_links.AddNode( aPad->GetPosition().x, aPad->GetPosition().y );
node->AddParent( aPad );
m_pads[aPad] = node;

View File

@ -27,6 +27,7 @@
#include "pns_line.h"
#include "pns_diff_pair.h"
#include "pns_node.h"
#include "pns_solid.h"
#include "pns_optimizer.h"
#include "pns_utils.h"
#include "pns_router.h"
@ -831,6 +832,13 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd,
typedef std::pair<int, SHAPE_LINE_CHAIN> RtVariant;
std::vector<RtVariant> variants;
PNS_SOLID* solid = dyn_cast<PNS_SOLID*>( aPad );
// don't do auto-neckdown for offset pads
if( solid && solid->Offset() != VECTOR2I( 0, 0 ) )
return -1;
BREAKOUT_LIST breakouts = computeBreakouts( aLine->Width(), aPad, true );
SHAPE_LINE_CHAIN line = ( aEnd ? aLine->CLine().Reverse() : aLine->CLine() );

View File

@ -199,11 +199,15 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
wxPoint wx_c = aPad->ShapePos();
wxSize wx_sz = aPad->GetSize();
wxPoint offset = aPad->GetOffset();
VECTOR2I c( wx_c.x, wx_c.y );
VECTOR2I sz( wx_sz.x, wx_sz.y );
solid->SetPos( c );
RotatePoint( &offset, aPad->GetOrientation() );
solid->SetPos( VECTOR2I( c.x - offset.x, c.y - offset.y ) );
solid->SetOffset ( VECTOR2I ( offset.x, offset.y ) );
double orient = aPad->GetOrientation() / 10.0;

View File

@ -88,9 +88,20 @@ public:
return 1;
}
VECTOR2I Offset() const
{
return m_offset;
}
void SetOffset( const VECTOR2I& aOffset )
{
m_offset = aOffset;
}
private:
VECTOR2I m_pos;
SHAPE* m_shape;
VECTOR2I m_offset;
};
#endif