Separate plotting into background and foreground.
Fixes https://gitlab.com/kicad/code/kicad/issues/10390
This commit is contained in:
parent
a5e8575091
commit
f11b8011cd
|
@ -295,10 +295,10 @@ void LIB_FIELD::Rotate( const VECTOR2I& center, bool aRotateCCW )
|
|||
}
|
||||
|
||||
|
||||
void LIB_FIELD::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
if( GetText().IsEmpty() )
|
||||
if( GetText().IsEmpty() || aBackground )
|
||||
return;
|
||||
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror.
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
|
|
@ -251,11 +251,13 @@ public:
|
|||
* Plot the draw item using the plot object.
|
||||
*
|
||||
* @param aPlotter The plot object to plot to.
|
||||
* @param aBackground a poor-man's Z-order. The routine will get called twice, first with
|
||||
* aBackground true and then with aBackground false.
|
||||
* @param aOffset Plot offset position.
|
||||
* @param aFill Flag to indicate whether or not the object is filled.
|
||||
* @param aTransform The plot transform.
|
||||
*/
|
||||
virtual void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
virtual void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const = 0;
|
||||
|
||||
void SetUnit( int aUnit ) { m_unit = aUnit; }
|
||||
|
|
|
@ -1031,10 +1031,10 @@ void LIB_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
|||
}
|
||||
|
||||
|
||||
void LIB_PIN::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
void LIB_PIN::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
if( !IsVisible() )
|
||||
if( !IsVisible() || aBackground )
|
||||
return;
|
||||
|
||||
int orient = PinDrawOrient( aTransform );
|
||||
|
|
|
@ -220,7 +220,7 @@ public:
|
|||
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const VECTOR2I& aPffset, bool aFill,
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
|
|
@ -109,7 +109,7 @@ void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
|||
}
|
||||
|
||||
|
||||
void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
if( IsPrivate() )
|
||||
|
@ -118,9 +118,6 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
|||
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
VECTOR2I center = aTransform.TransformCoordinate( getCenter() ) + aOffset;
|
||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL;
|
||||
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
|
||||
static std::vector<VECTOR2I> cornerList;
|
||||
|
||||
|
@ -149,47 +146,43 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
|||
std::swap( start, end );
|
||||
}
|
||||
|
||||
if( fill != FILL_T::NO_FILL )
|
||||
{
|
||||
COLOR4D fillColor = color;
|
||||
int penWidth;
|
||||
COLOR4D color;
|
||||
FILL_T fill;
|
||||
|
||||
if( aBackground )
|
||||
{
|
||||
if( aPlotter->GetColorMode() )
|
||||
return;
|
||||
|
||||
switch( m_fill )
|
||||
{
|
||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
else if( fill == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
}
|
||||
case FILL_T::FILLED_SHAPE:
|
||||
return;
|
||||
|
||||
aPlotter->SetColor( fillColor );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( center, start, end, fill, 0, ARC_HIGH_DEF );
|
||||
case FILL_T::FILLED_WITH_COLOR:
|
||||
color = GetFillColor();
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
aPlotter->Circle( center, GetRadius() * 2, fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
aPlotter->Rect( start, end, fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
case SHAPE_T::BEZIER:
|
||||
aPlotter->PlotPoly( cornerList, fill, 0 );
|
||||
case FILL_T::FILLED_WITH_BG_BODYCOLOR:
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
return;
|
||||
}
|
||||
|
||||
if( penWidth <= 0 )
|
||||
return;
|
||||
penWidth = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_fill == FILL_T::FILLED_SHAPE )
|
||||
fill = m_fill;
|
||||
else
|
||||
fill = FILL_T::NO_FILL;
|
||||
|
||||
penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
}
|
||||
|
||||
aPlotter->SetColor( color );
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
|
|
@ -593,35 +593,13 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
|
|||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const
|
||||
void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||
const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
|
||||
// draw background for filled items using background option
|
||||
// Solid lines will be drawn after the background
|
||||
for( const LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( item.Type() != LIB_SHAPE_T )
|
||||
continue;
|
||||
|
||||
const LIB_SHAPE& shape = static_cast<const LIB_SHAPE&>( item );
|
||||
|
||||
// Do not draw items not attached to the current part
|
||||
if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
|
||||
continue;
|
||||
|
||||
if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR && aPlotter->GetColorMode() )
|
||||
shape.Plot( aPlotter, aOffset, true, aTransform );
|
||||
}
|
||||
|
||||
// Not filled items and filled shapes are now plotted
|
||||
// Items that have BG fills only get re-stroked to ensure the edges are in the foreground
|
||||
for( const LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
// Lib Fields are not plotted here, because this plot function
|
||||
|
@ -635,21 +613,13 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2
|
|||
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
bool forceNoFill = false;
|
||||
|
||||
if( item.Type() == LIB_SHAPE_T )
|
||||
{
|
||||
const LIB_SHAPE& shape = static_cast<const LIB_SHAPE&>( item );
|
||||
forceNoFill = shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR;
|
||||
}
|
||||
|
||||
item.Plot( aPlotter, aOffset, !forceNoFill, aTransform );
|
||||
item.Plot( aPlotter, aBackground, aOffset, aTransform );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform )
|
||||
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||
const VECTOR2I& aOffset, const TRANSFORM& aTransform )
|
||||
{
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
|
@ -679,7 +649,7 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, cons
|
|||
field.SetText( text );
|
||||
}
|
||||
|
||||
item.Plot( aPlotter, aOffset, fill, aTransform );
|
||||
item.Plot( aPlotter, aBackground, aOffset, aTransform );
|
||||
field.SetText( tmp );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,11 +326,12 @@ public:
|
|||
* @param aPlotter - Plotter object to plot to.
|
||||
* @param aUnit - Symbol symbol to plot.
|
||||
* @param aConvert - Symbol alternate body style to plot.
|
||||
* @param aBackground - A poor-man's Z-order.
|
||||
* @param aOffset - Distance to shift the plot coordinates.
|
||||
* @param aTransform - Symbol plot transform matrix.
|
||||
*/
|
||||
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const;
|
||||
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||
const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const;
|
||||
|
||||
/**
|
||||
* Plot Lib Fields only of the symbol to plotter.
|
||||
|
@ -339,11 +340,12 @@ public:
|
|||
* @param aPlotter - Plotter object to plot to.
|
||||
* @param aUnit - Symbol to plot.
|
||||
* @param aConvert - Symbol alternate body style to plot.
|
||||
* @param aBackground - A poor-man's Z-order.
|
||||
* @param aOffset - Distance to shift the plot coordinates.
|
||||
* @param aTransform - Symbol plot transform matrix.
|
||||
*/
|
||||
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform );
|
||||
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||
const VECTOR2I& aOffset, const TRANSFORM& aTransform );
|
||||
|
||||
/**
|
||||
* Add a new draw \a aItem to the draw object list and sort according to \a aSort.
|
||||
|
|
|
@ -257,11 +257,14 @@ void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
|
|||
}
|
||||
|
||||
|
||||
void LIB_TEXT::Plot( PLOTTER* plotter, const VECTOR2I& offset, bool fill,
|
||||
void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( plotter != nullptr );
|
||||
|
||||
if( aBackground )
|
||||
return;
|
||||
|
||||
EDA_RECT bBox = GetBoundingBox();
|
||||
// convert coordinates from draw Y axis to symbol_editor Y axis
|
||||
bBox.RevertYAxis();
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
void NormalizeJustification( bool inverse );
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
|
|
@ -306,7 +306,7 @@ BITMAPS LIB_TEXTBOX::GetMenuImage() const
|
|||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
@ -314,26 +314,16 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
|||
if( IsPrivate() )
|
||||
return;
|
||||
|
||||
if( aBackground )
|
||||
{
|
||||
LIB_SHAPE::Plot( aPlotter, aBackground, aOffset, aTransform );
|
||||
return;
|
||||
}
|
||||
|
||||
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL;
|
||||
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
if( fill != FILL_T::NO_FILL )
|
||||
{
|
||||
COLOR4D fillColor = color;
|
||||
|
||||
if( aPlotter->GetColorMode() )
|
||||
{
|
||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
else if( fill == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
}
|
||||
|
||||
aPlotter->SetColor( fillColor );
|
||||
aPlotter->Rect( start, end, fill, 0 );
|
||||
}
|
||||
|
||||
if( penWidth > 0 )
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const VECTOR2I& offset, bool fill,
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& offset,
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override
|
||||
|
|
|
@ -183,10 +183,14 @@ bool SCH_BITMAP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
|
|||
}
|
||||
|
||||
|
||||
void SCH_BITMAP::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_BITMAP::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
m_image->PlotImage( aPlotter, m_pos, aPlotter->RenderSettings()->GetLayerColor( GetLayer() ),
|
||||
if( aBackground )
|
||||
{
|
||||
m_image->PlotImage( aPlotter, m_pos,
|
||||
aPlotter->RenderSettings()->GetLayerColor( GetLayer() ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -468,12 +468,17 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aA
|
|||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground )
|
||||
return;
|
||||
|
||||
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||
|
||||
COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED ) ?
|
||||
settings->GetLayerColor( m_layer ) : GetBusEntryColor();
|
||||
COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED )
|
||||
? settings->GetLayerColor( m_layer )
|
||||
: GetBusEntryColor();
|
||||
|
||||
int penWidth = ( GetPenWidth() == 0 ) ? settings->GetDefaultPenWidth() : GetPenWidth();
|
||||
|
||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
|
@ -483,6 +488,8 @@ void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) const
|
|||
aPlotter->SetDash( GetLineStyle() );
|
||||
aPlotter->MoveTo( m_pos );
|
||||
aPlotter->FinishTo( GetEnd() );
|
||||
|
||||
aPlotter->SetDash( PLOT_DASH_TYPE::SOLID );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
|
|
|
@ -911,8 +911,11 @@ bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
}
|
||||
|
||||
|
||||
void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( IsVoid() || aBackground )
|
||||
return;
|
||||
|
||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||
COLOR4D color = settings->GetLayerColor( GetLayer() );
|
||||
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||
|
@ -922,9 +925,6 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
|
|||
if( !IsVisible() )
|
||||
return;
|
||||
|
||||
if( IsVoid() )
|
||||
return;
|
||||
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror
|
||||
EDA_ANGLE orient = GetTextAngle();
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ const wxString& SCH_ITEM::GetDefaultFont() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_ITEM::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_ITEM::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
wxFAIL_MSG( wxT( "Plot() method not implemented for class " ) + GetClass() );
|
||||
}
|
||||
|
|
|
@ -448,8 +448,10 @@ public:
|
|||
* Plot the schematic item to \a aPlotter.
|
||||
*
|
||||
* @param aPlotter is the #PLOTTER object to plot to.
|
||||
* @param aBackground a poor-man's Z-order. The routine will get called twice, first with
|
||||
* aBackground true and then with aBackground false.
|
||||
*/
|
||||
virtual void Plot( PLOTTER* aPlotter ) const;
|
||||
virtual void Plot( PLOTTER* aPlotter, bool aBackground ) const;
|
||||
|
||||
virtual bool operator <( const SCH_ITEM& aItem ) const;
|
||||
|
||||
|
|
|
@ -235,8 +235,11 @@ bool SCH_JUNCTION::doIsConnected( const VECTOR2I& aPosition ) const
|
|||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_JUNCTION::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground )
|
||||
return;
|
||||
|
||||
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||
COLOR4D color = GetJunctionColor();
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@ void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
|||
}
|
||||
|
||||
|
||||
void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
static std::vector<VECTOR2I> s_poly;
|
||||
|
||||
|
@ -817,17 +817,23 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const
|
|||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
||||
VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
|
||||
|
||||
if( aBackground )
|
||||
{
|
||||
// No filled shapes (yet)
|
||||
}
|
||||
else
|
||||
{
|
||||
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
||||
|
||||
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
|
||||
|
||||
if( s_poly.size() )
|
||||
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
|
||||
}
|
||||
|
||||
for( const SCH_FIELD& field : m_fields )
|
||||
field.Plot( aPlotter );
|
||||
field.Plot( aPlotter, aBackground );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
|
||||
|
||||
|
|
|
@ -861,8 +861,11 @@ bool SCH_LINE::doIsConnected( const VECTOR2I& aPosition ) const
|
|||
}
|
||||
|
||||
|
||||
void SCH_LINE::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_LINE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground )
|
||||
return;
|
||||
|
||||
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||
int penWidth = std::max( GetPenWidth(), settings->GetMinPenWidth() );
|
||||
COLOR4D color = GetLineColor();
|
||||
|
|
|
@ -272,7 +272,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -62,11 +62,10 @@ public:
|
|||
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
void Plot( PLOTTER* /* aPlotter */ ) const override
|
||||
void Plot( PLOTTER* /* aPlotter */, bool /* aBackground */ ) const override
|
||||
{
|
||||
// SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an
|
||||
// assertion if we do not confirm this by locally implementing a no-op
|
||||
// Plot().
|
||||
// SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an assertion if we
|
||||
// do not confirm this by locally implementing a no-op Plot().
|
||||
}
|
||||
|
||||
EDA_RECT const GetBoundingBox() const override;
|
||||
|
|
|
@ -171,8 +171,11 @@ bool SCH_NO_CONNECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
|
|||
}
|
||||
|
||||
|
||||
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground )
|
||||
return;
|
||||
|
||||
int delta = GetSize() / 2;
|
||||
int pX = m_pos.x;
|
||||
int pY = m_pos.y;
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -866,6 +866,7 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
|
|||
} );
|
||||
|
||||
int defaultPenWidth = aPlotter->RenderSettings()->GetDefaultPenWidth();
|
||||
constexpr bool background = true;
|
||||
|
||||
// Bitmaps are drawn first to ensure they are in the background
|
||||
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
||||
|
@ -873,19 +874,25 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
|
|||
for( const SCH_ITEM* item : bitmaps )
|
||||
{
|
||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||
item->Plot( aPlotter );
|
||||
item->Plot( aPlotter, background );
|
||||
}
|
||||
|
||||
for( const SCH_ITEM* item : other )
|
||||
{
|
||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||
item->Plot( aPlotter );
|
||||
item->Plot( aPlotter, background );
|
||||
}
|
||||
|
||||
for( const SCH_ITEM* item : other )
|
||||
{
|
||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||
item->Plot( aPlotter, !background );
|
||||
}
|
||||
|
||||
for( const SCH_ITEM* item : junctions )
|
||||
{
|
||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||
item->Plot( aPlotter );
|
||||
item->Plot( aPlotter, !background );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
|
@ -106,13 +106,49 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
|||
else
|
||||
aPlotter->SetColor( GetStroke().GetColor() );
|
||||
|
||||
if( aBackground )
|
||||
{
|
||||
if( m_fill == FILL_T::FILLED_WITH_COLOR && GetFillColor() != COLOR4D::UNSPECIFIED )
|
||||
{
|
||||
aPlotter->SetColor( GetFillColor() );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), m_fill, 0, ARC_HIGH_DEF );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
aPlotter->Circle( getCenter(), GetRadius() * 2, m_fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
aPlotter->Rect( GetStart(), GetEnd(), m_fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
aPlotter->PlotPoly( cornerList, m_fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
aPlotter->PlotPoly( m_bezierPoints, m_fill, 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* if( aForeground ) */
|
||||
{
|
||||
aPlotter->SetCurrentLineWidth( pen_size );
|
||||
aPlotter->SetDash( GetEffectiveLineStyle() );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size, ARC_HIGH_DEF );
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size,
|
||||
ARC_HIGH_DEF );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
|
@ -151,36 +187,6 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
|||
}
|
||||
|
||||
aPlotter->SetDash( PLOT_DASH_TYPE::SOLID );
|
||||
|
||||
if( m_fill == FILL_T::FILLED_WITH_COLOR && GetFillColor() != COLOR4D::UNSPECIFIED )
|
||||
{
|
||||
aPlotter->SetColor( GetFillColor() );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), m_fill, 0, ARC_HIGH_DEF );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
aPlotter->Circle( getCenter(), GetRadius() * 2, m_fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
aPlotter->Rect( GetStart(), GetEnd(), m_fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
aPlotter->PlotPoly( cornerList, m_fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
aPlotter->PlotPoly( m_bezierPoints, m_fill, 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
void AddPoint( const VECTOR2I& aPosition );
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
|
|
|
@ -1020,8 +1020,11 @@ bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground && !aPlotter->GetColorMode() )
|
||||
return;
|
||||
|
||||
wxString msg;
|
||||
VECTOR2I pos;
|
||||
auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||
|
@ -1035,27 +1038,26 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
|
|||
if( override || backgroundColor == COLOR4D::UNSPECIFIED )
|
||||
backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
|
||||
|
||||
// Do not fill shape in B&W mode, otherwise texts are unreadable
|
||||
bool fill = aPlotter->GetColorMode();
|
||||
|
||||
if( fill )
|
||||
if( aBackground )
|
||||
{
|
||||
aPlotter->SetColor( backgroundColor );
|
||||
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::FILLED_SHAPE, 1 );
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
aPlotter->SetColor( borderColor );
|
||||
|
||||
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::NO_FILL, penWidth );
|
||||
}
|
||||
|
||||
// Plot sheet pins
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Plot( aPlotter );
|
||||
sheetPin->Plot( aPlotter, aBackground );
|
||||
|
||||
// Plot the fields
|
||||
for( const SCH_FIELD& field : m_fields )
|
||||
field.Plot( aPlotter );
|
||||
field.Plot( aPlotter, aBackground );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -1848,17 +1848,29 @@ bool SCH_SYMBOL::IsInNetlist() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground )
|
||||
return;
|
||||
|
||||
if( m_part )
|
||||
{
|
||||
TRANSFORM temp = GetTransform();
|
||||
aPlotter->StartBlock( nullptr );
|
||||
|
||||
m_part->Plot( aPlotter, GetUnit(), GetConvert(), m_pos, temp );
|
||||
bool local_background = true;
|
||||
|
||||
m_part->Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp );
|
||||
|
||||
for( SCH_FIELD field : m_fields )
|
||||
field.Plot( aPlotter );
|
||||
field.Plot( aPlotter, local_background );
|
||||
|
||||
local_background = false;
|
||||
|
||||
m_part->Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp );
|
||||
|
||||
for( SCH_FIELD field : m_fields )
|
||||
field.Plot( aPlotter, local_background );
|
||||
|
||||
aPlotter->EndBlock( nullptr );
|
||||
}
|
||||
|
|
|
@ -648,7 +648,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -404,8 +404,11 @@ void SCH_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
void SCH_TEXT::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground )
|
||||
return;
|
||||
|
||||
static std::vector<VECTOR2I> s_poly;
|
||||
|
||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||
|
|
|
@ -204,7 +204,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override
|
||||
{
|
||||
|
|
|
@ -323,30 +323,20 @@ BITMAPS SCH_TEXTBOX::GetMenuImage() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::Plot( PLOTTER* aPlotter ) const
|
||||
void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( aBackground )
|
||||
{
|
||||
SCH_SHAPE::Plot( aPlotter, aBackground );
|
||||
return;
|
||||
}
|
||||
|
||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
int penWidth = GetPenWidth();
|
||||
FILL_T fill = m_fill;
|
||||
COLOR4D color = settings->GetLayerColor( LAYER_NOTES );
|
||||
|
||||
if( fill != FILL_T::NO_FILL )
|
||||
{
|
||||
COLOR4D fillColor = color;
|
||||
|
||||
if( aPlotter->GetColorMode() )
|
||||
{
|
||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
else if( fill == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
}
|
||||
|
||||
aPlotter->SetColor( fillColor );
|
||||
aPlotter->Rect( m_start, m_end, fill, 0 );
|
||||
}
|
||||
|
||||
if( penWidth > 0 )
|
||||
{
|
||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override
|
||||
{
|
||||
|
|
|
@ -61,16 +61,22 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
|
|||
|
||||
if( m_symbol )
|
||||
{
|
||||
constexpr bool background = true;
|
||||
TRANSFORM temp; // Uses default transform
|
||||
wxPoint plotPos;
|
||||
|
||||
plotPos.x = pageInfo.GetWidthIU() / 2;
|
||||
plotPos.y = pageInfo.GetHeightIU() / 2;
|
||||
|
||||
m_symbol->Plot( plotter, GetUnit(), GetConvert(), plotPos, temp );
|
||||
m_symbol->Plot( plotter, GetUnit(), GetConvert(), background, plotPos, temp );
|
||||
|
||||
// Plot lib fields, not plotted by m_symbol->Plot():
|
||||
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), plotPos, temp );
|
||||
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), background, plotPos, temp );
|
||||
|
||||
m_symbol->Plot( plotter, GetUnit(), GetConvert(), !background, plotPos, temp );
|
||||
|
||||
// Plot lib fields, not plotted by m_symbol->Plot():
|
||||
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), !background, plotPos, temp );
|
||||
}
|
||||
|
||||
plotter->EndPlot();
|
||||
|
|
Loading…
Reference in New Issue