52 const std::vector<BLOCK_DRAG_ENDPOINT>& aMovedEndpoints,
bool aOverrideLocks,
53 std::vector<BLOCK_DRAG_ENDPOINT>& aDependents )
57 const int baseTol =
pcbIUScale.mmToIU( 0.001 );
58 int64_t tolSq = (int64_t) baseTol * baseTol;
66 std::vector<BLOCK_DRAG_ENDPOINT> seeds( aMovedEndpoints.begin(), aMovedEndpoints.end() );
69 std::set<const PCB_SHAPE*> carried;
71 auto isMoved = [&](
const PCB_SHAPE* aShape,
bool aIsStart )
75 if(
moved.shape == aShape &&
moved.isStart == aIsStart )
82 auto alreadyAccepted = [&](
const PCB_SHAPE* aShape,
bool aIsStart )
86 if( dep.shape == aShape && dep.isStart == aIsStart )
94 for(
size_t si = 0; si < seeds.size(); ++si )
97 std::vector<BLOCK_DRAG_ENDPOINT> cluster;
102 tol = std::max( tol, board->GetOutlinesChainingEpsilon() );
104 tolSq = (int64_t) tol * tol;
106 for(
PCB_SHAPE* candidate : aCandidates )
111 std::optional<BLOCK_DRAG_FOLLOW> follow = followKind( *candidate );
113 if( !follow || carried.count( candidate ) )
116 if( candidate->GetLayer() !=
moved.shape->GetLayer() )
119 for(
bool isStart : {
true,
false } )
121 VECTOR2I pos = isStart ? candidate->GetStart() : candidate->GetEnd();
125 if( !withinTol( pos,
moved.position ) )
128 if( !isMoved( candidate, isStart ) )
129 cluster.push_back( { candidate, isStart, pos, *follow } );
135 bool ambiguous =
false;
137 for(
size_t ii = 0; ii < cluster.size() && !ambiguous; ++ii )
139 for(
size_t jj = ii + 1; jj < cluster.size(); ++jj )
141 if( !withinTol( cluster[ii].position, cluster[jj].position ) )
154 if( alreadyAccepted( member.shape, member.isStart ) )
157 aDependents.push_back( member );
163 carried.insert( member.shape );
165 bool farIsStart = !member.isStart;
166 VECTOR2I farPos = farIsStart ? member.shape->GetStart() : member.shape->GetEnd();
172 if( !aOverrideLocks )
BLOCK_DRAG_DEPENDENT_RESULT BlockDragFindDependents(const std::vector< PCB_SHAPE * > &aCandidates, const std::vector< BLOCK_DRAG_ENDPOINT > &aMovedEndpoints, bool aOverrideLocks, std::vector< BLOCK_DRAG_ENDPOINT > &aDependents)
Find the joined endpoints that have to follow the ones the drag moves.