Add missing junctions during schematic cleanup
This commit is contained in:
parent
b687a178ef
commit
4bc7e6fdfa
|
@ -657,6 +657,16 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen )
|
|||
itemList.PushItem( ITEM_PICKER( aItem, UR_DELETED ) );
|
||||
};
|
||||
|
||||
auto add_junction = [ & ]( const wxPoint& aPosition ) -> void
|
||||
{
|
||||
auto junction = new SCH_JUNCTION( aPosition );
|
||||
AddToScreen( junction, aScreen );
|
||||
BreakSegments( aPosition, aUndo );
|
||||
|
||||
if( aUndo )
|
||||
SaveCopyInUndoList( junction, UR_NEW, true );
|
||||
};
|
||||
|
||||
BreakSegmentsOnJunctions( true, aScreen );
|
||||
|
||||
for( item = aScreen->GetDrawItems(); item; item = item->Next() )
|
||||
|
@ -739,6 +749,16 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen )
|
|||
|
||||
if( item->GetFlags() & STRUCT_DELETED )
|
||||
RemoveFromScreen( item, aScreen );
|
||||
else if( item->Type() == SCH_LINE_T )
|
||||
{
|
||||
auto line = static_cast<SCH_LINE*>( item );
|
||||
|
||||
if( aScreen->IsJunctionNeeded( line->GetStartPoint(), true ) )
|
||||
add_junction( line->GetStartPoint() );
|
||||
|
||||
if( aScreen->IsJunctionNeeded( line->GetEndPoint(), true ) )
|
||||
add_junction( line->GetEndPoint() );
|
||||
}
|
||||
}
|
||||
|
||||
if( itemList.GetCount() && aUndo )
|
||||
|
|
Loading…
Reference in New Issue