Cleanup wire merge code
This commit is contained in:
parent
92011d91d2
commit
080275b4ee
|
@ -405,19 +405,17 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
// If there are three or more endpoints
|
||||
if( pin_count && pin_count + end_count[0] > 2 )
|
||||
if( pin_count && pin_count + end_count[WIRES] > 2 )
|
||||
return true;
|
||||
|
||||
// If there is at least one segment that ends on a non-parallel line or
|
||||
// junction of two other lines
|
||||
if( has_nonparallel[0] && end_count[0] > 2 )
|
||||
if( has_nonparallel[WIRES] && end_count[WIRES] > 2 )
|
||||
return true;
|
||||
|
||||
// Check for bus - bus junction requirements
|
||||
if( has_nonparallel[1] && end_count[1] > 2 )
|
||||
if( has_nonparallel[BUSSES] && end_count[BUSSES] > 2 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -146,6 +146,9 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
EE_SELECTION& selection = m_selectionTool->RequestSelection( movableItems );
|
||||
bool unselect = selection.IsHover();
|
||||
|
||||
// Keep an original copy of the starting points for cleanup after the move
|
||||
std::vector<DANGLING_END_ITEM> internalPoints;
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
|
@ -181,6 +184,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
// Setup a drag or a move
|
||||
//
|
||||
m_dragAdditions.clear();
|
||||
internalPoints.clear();
|
||||
|
||||
for( SCH_ITEM* it = m_frame->GetScreen()->GetDrawItems(); it; it = it->Next() )
|
||||
{
|
||||
|
@ -218,9 +222,6 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
{
|
||||
// Mark the edges of the block with dangling flags for a move.
|
||||
//
|
||||
std::vector<DANGLING_END_ITEM> internalPoints;
|
||||
|
||||
for( EDA_ITEM* item : selection )
|
||||
static_cast<SCH_ITEM*>( item )->GetEndPoints( internalPoints );
|
||||
|
||||
|
@ -436,7 +437,16 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
// If we move items away from a junction, we _may_ want to add a junction there
|
||||
// to denote the state.
|
||||
for( auto it : internalPoints )
|
||||
{
|
||||
if( m_frame->GetScreen()->IsJunctionNeeded( it.GetPosition(), true ) )
|
||||
m_frame->AddJunction( it.GetPosition(), true, false );
|
||||
}
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selection );
|
||||
|
||||
m_frame->SchematicCleanUp();
|
||||
m_frame->TestDanglingEnds();
|
||||
|
||||
|
|
Loading…
Reference in New Issue