Fixing drawing order when plotting/printing
This is a partial re-work of a previous commit to the v5 branch
(8f7278e34f
) that fixes #368
This commit is contained in:
parent
a35db35029
commit
c2904ce7e9
|
@ -519,7 +519,10 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
|
||||||
|
|
||||||
void SCH_SCREEN::Print( wxDC* aDC )
|
void SCH_SCREEN::Print( wxDC* aDC )
|
||||||
{
|
{
|
||||||
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
std::vector< SCH_ITEM* > junctions;
|
std::vector< SCH_ITEM* > junctions;
|
||||||
|
std::vector<SCH_ITEM*> bitmaps;
|
||||||
|
std::vector<SCH_ITEM*> other;
|
||||||
|
|
||||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
UpdateSymbolLinks();
|
UpdateSymbolLinks();
|
||||||
|
@ -531,10 +534,26 @@ void SCH_SCREEN::Print( wxDC* aDC )
|
||||||
|
|
||||||
if( item->Type() == SCH_JUNCTION_T )
|
if( item->Type() == SCH_JUNCTION_T )
|
||||||
junctions.push_back( item );
|
junctions.push_back( item );
|
||||||
|
else if( item->Type() == SCH_BITMAP_T )
|
||||||
|
bitmaps.push_back( item );
|
||||||
else
|
else
|
||||||
item->Print( aDC, wxPoint( 0, 0 ) );
|
other.push_back( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sort to ensure plot-order consistency with screen drawing
|
||||||
|
std::sort( other.begin(), other.end(), []( const SCH_ITEM* a, const SCH_ITEM* b ) {
|
||||||
|
if( a->Type() == b->Type() )
|
||||||
|
return a->GetLayer() > b->GetLayer();
|
||||||
|
|
||||||
|
return a->Type() > b->Type();
|
||||||
|
} );
|
||||||
|
|
||||||
|
for( auto item : bitmaps )
|
||||||
|
item->Print( aDC, wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
|
for( auto item : other )
|
||||||
|
item->Print( aDC, wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
for( auto item : junctions )
|
for( auto item : junctions )
|
||||||
item->Print( aDC, wxPoint( 0, 0 ) );
|
item->Print( aDC, wxPoint( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
@ -560,11 +579,17 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||||
else if( item->Type() == SCH_BITMAP_T )
|
else if( item->Type() == SCH_BITMAP_T )
|
||||||
bitmaps.push_back( item );
|
bitmaps.push_back( item );
|
||||||
else
|
else
|
||||||
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
|
|
||||||
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
|
|
||||||
other.push_back( item );
|
other.push_back( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sort to ensure plot-order consistency with screen drawing
|
||||||
|
std::sort( other.begin(), other.end(), []( const SCH_ITEM* a, const SCH_ITEM* b ) {
|
||||||
|
if( a->Type() == b->Type() )
|
||||||
|
return a->GetLayer() > b->GetLayer();
|
||||||
|
|
||||||
|
return a->Type() > b->Type();
|
||||||
|
} );
|
||||||
|
|
||||||
// Bitmaps are drawn first to ensure they are in the background
|
// Bitmaps are drawn first to ensure they are in the background
|
||||||
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
||||||
// the bitmap PS command clears the screen
|
// the bitmap PS command clears the screen
|
||||||
|
|
Loading…
Reference in New Issue