Component dragger: make relaxed segment pickup work for PTH pads

This commit is contained in:
Jon Evans 2020-12-22 22:43:44 -05:00
parent 70c6314c67
commit 912657dd23
4 changed files with 16 additions and 17 deletions

View File

@ -91,18 +91,17 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives )
std::vector<JOINT*> extraJoints; std::vector<JOINT*> extraJoints;
if( m_world->QueryJoints( solid->Hull().BBox(), extraJoints, solid->Layer(), m_world->QueryJoints( solid->Hull().BBox(), extraJoints, solid->Layers(),
ITEM::SEGMENT_T | ITEM::ARC_T ) ) ITEM::SEGMENT_T | ITEM::ARC_T );
{
for( JOINT* extraJoint : extraJoints )
{
if( extraJoint->Net() == jt->Net() && extraJoint->LinkCount() == 1 )
{
LINKED_ITEM* li = static_cast<LINKED_ITEM*>( extraJoint->LinkList()[0].item );
if( li->Collide( solid, 0, false, nullptr, nullptr, false ) ) for( JOINT* extraJoint : extraJoints )
addLinked( solid, li, extraJoint->Pos() - solid->Pos() ); {
} if( extraJoint->Net() == jt->Net() && extraJoint->LinkCount() == 1 )
{
LINKED_ITEM* li = static_cast<LINKED_ITEM*>( extraJoint->LinkList()[0].item );
if( li->Collide( solid, 0, false, nullptr, nullptr, false ) )
addLinked( solid, li, extraJoint->Pos() - solid->Pos() );
} }
} }
} }

View File

@ -1417,7 +1417,7 @@ ARC* NODE::findRedundantArc( ARC* aArc )
} }
int NODE::QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints, int aLayerMask, int NODE::QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints, LAYER_RANGE aLayerMask,
int aKindMask ) int aKindMask )
{ {
int n = 0; int n = 0;
@ -1426,7 +1426,7 @@ int NODE::QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints, int aLay
for( JOINT_MAP::value_type& j : m_joints ) for( JOINT_MAP::value_type& j : m_joints )
{ {
if( j.second.Layer() != aLayerMask ) if( !j.second.Layers().Overlaps( aLayerMask ) )
continue; continue;
if( aBox.Contains( j.second.Pos() ) && j.second.LinkCount( aKindMask ) ) if( aBox.Contains( j.second.Pos() ) && j.second.LinkCount( aKindMask ) )
@ -1441,7 +1441,7 @@ int NODE::QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints, int aLay
for( JOINT_MAP::value_type& j : m_root->m_joints ) for( JOINT_MAP::value_type& j : m_root->m_joints )
{ {
if( !Overrides( &j.second ) && j.second.Layer() == aLayerMask ) if( !Overrides( &j.second ) && j.second.Layers().Overlaps( aLayerMask ) )
{ {
if( aBox.Contains( j.second.Pos() ) && j.second.LinkCount( aKindMask ) ) if( aBox.Contains( j.second.Pos() ) && j.second.LinkCount( aKindMask ) )
{ {

View File

@ -233,8 +233,8 @@ public:
int QueryJoints( const BOX2I& aBox, int QueryJoints( const BOX2I& aBox,
std::vector<JOINT*>& aJoints, std::vector<JOINT*>& aJoints,
int aLayerMask = -1, LAYER_RANGE aLayerMask = LAYER_RANGE::All(),
int aKindMask = ITEM::ANY_T); int aKindMask = ITEM::ANY_T );
int QueryColliding( const ITEM* aItem, OBSTACLE_VISITOR& aVisitor ); int QueryColliding( const ITEM* aItem, OBSTACLE_VISITOR& aVisitor );

View File

@ -404,7 +404,7 @@ bool KEEP_TOPOLOGY_CONSTRAINT::Check( int aVertex1, int aVertex2, const LINE* aO
auto bb = encPoly.BBox(); auto bb = encPoly.BBox();
std::vector<JOINT*> joints; std::vector<JOINT*> joints;
int cnt = m_world->QueryJoints( bb, joints, aOriginLine->Layers().Start(), ITEM::SOLID_T ); int cnt = m_world->QueryJoints( bb, joints, aOriginLine->Layers(), ITEM::SOLID_T );
if( !cnt ) if( !cnt )
return true; return true;