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
|
const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
if( GetText().IsEmpty() )
|
if( GetText().IsEmpty() || aBackground )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calculate the text orientation, according to the symbol orientation/mirror.
|
// Calculate the text orientation, according to the symbol orientation/mirror.
|
||||||
|
|
|
@ -162,7 +162,7 @@ public:
|
||||||
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
||||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) 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;
|
const TRANSFORM& aTransform ) const override;
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||||
|
|
|
@ -251,11 +251,13 @@ public:
|
||||||
* Plot the draw item using the plot object.
|
* Plot the draw item using the plot object.
|
||||||
*
|
*
|
||||||
* @param aPlotter The plot object to plot to.
|
* @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 aOffset Plot offset position.
|
||||||
* @param aFill Flag to indicate whether or not the object is filled.
|
* @param aFill Flag to indicate whether or not the object is filled.
|
||||||
* @param aTransform The plot transform.
|
* @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;
|
const TRANSFORM& aTransform ) const = 0;
|
||||||
|
|
||||||
void SetUnit( int aUnit ) { m_unit = aUnit; }
|
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
|
const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
if( !IsVisible() )
|
if( !IsVisible() || aBackground )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int orient = PinDrawOrient( aTransform );
|
int orient = PinDrawOrient( aTransform );
|
||||||
|
|
|
@ -220,7 +220,7 @@ public:
|
||||||
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
||||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) 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;
|
const TRANSFORM& aTransform ) const override;
|
||||||
|
|
||||||
BITMAPS GetMenuImage() 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
|
const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
if( IsPrivate() )
|
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 start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||||
VECTOR2I center = aTransform.TransformCoordinate( getCenter() ) + 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;
|
static std::vector<VECTOR2I> cornerList;
|
||||||
|
|
||||||
|
@ -149,47 +146,43 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||||
std::swap( start, end );
|
std::swap( start, end );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fill != FILL_T::NO_FILL )
|
int penWidth;
|
||||||
|
COLOR4D color;
|
||||||
|
FILL_T fill;
|
||||||
|
|
||||||
|
if( aBackground )
|
||||||
{
|
{
|
||||||
COLOR4D fillColor = color;
|
|
||||||
|
|
||||||
if( aPlotter->GetColorMode() )
|
if( aPlotter->GetColorMode() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch( m_fill )
|
||||||
{
|
{
|
||||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
case FILL_T::FILLED_SHAPE:
|
||||||
fillColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
return;
|
||||||
else if( fill == FILL_T::FILLED_WITH_COLOR )
|
|
||||||
fillColor = GetFillColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
aPlotter->SetColor( fillColor );
|
case FILL_T::FILLED_WITH_COLOR:
|
||||||
|
color = GetFillColor();
|
||||||
switch( GetShape() )
|
|
||||||
{
|
|
||||||
case SHAPE_T::ARC:
|
|
||||||
aPlotter->Arc( center, start, end, fill, 0, ARC_HIGH_DEF );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::CIRCLE:
|
case FILL_T::FILLED_WITH_BG_BODYCOLOR:
|
||||||
aPlotter->Circle( center, GetRadius() * 2, fill, 0 );
|
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||||
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 );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( penWidth <= 0 )
|
penWidth = 0;
|
||||||
return;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( m_fill == FILL_T::FILLED_SHAPE )
|
||||||
|
fill = m_fill;
|
||||||
else
|
else
|
||||||
fill = FILL_T::NO_FILL;
|
fill = FILL_T::NO_FILL;
|
||||||
|
|
||||||
|
penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||||
|
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||||
}
|
}
|
||||||
|
|
||||||
aPlotter->SetColor( color );
|
aPlotter->SetColor( color );
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
void MirrorVertical( const VECTOR2I& aCenter ) override;
|
||||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) 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;
|
const TRANSFORM& aTransform ) const override;
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) 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,
|
void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||||
const TRANSFORM& aTransform ) const
|
const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
wxASSERT( aPlotter != nullptr );
|
wxASSERT( aPlotter != nullptr );
|
||||||
|
|
||||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
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 )
|
for( const LIB_ITEM& item : m_drawings )
|
||||||
{
|
{
|
||||||
// Lib Fields are not plotted here, because this plot function
|
// 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 ) )
|
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool forceNoFill = false;
|
item.Plot( aPlotter, aBackground, aOffset, aTransform );
|
||||||
|
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
|
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||||
const TRANSFORM& aTransform )
|
const VECTOR2I& aOffset, const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
wxASSERT( aPlotter != nullptr );
|
wxASSERT( aPlotter != nullptr );
|
||||||
|
|
||||||
|
@ -679,7 +649,7 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, cons
|
||||||
field.SetText( text );
|
field.SetText( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
item.Plot( aPlotter, aOffset, fill, aTransform );
|
item.Plot( aPlotter, aBackground, aOffset, aTransform );
|
||||||
field.SetText( tmp );
|
field.SetText( tmp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,11 +326,12 @@ public:
|
||||||
* @param aPlotter - Plotter object to plot to.
|
* @param aPlotter - Plotter object to plot to.
|
||||||
* @param aUnit - Symbol symbol to plot.
|
* @param aUnit - Symbol symbol to plot.
|
||||||
* @param aConvert - Symbol alternate body style 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 aOffset - Distance to shift the plot coordinates.
|
||||||
* @param aTransform - Symbol plot transform matrix.
|
* @param aTransform - Symbol plot transform matrix.
|
||||||
*/
|
*/
|
||||||
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
|
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||||
const TRANSFORM& aTransform ) const;
|
const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot Lib Fields only of the symbol to plotter.
|
* Plot Lib Fields only of the symbol to plotter.
|
||||||
|
@ -339,11 +340,12 @@ public:
|
||||||
* @param aPlotter - Plotter object to plot to.
|
* @param aPlotter - Plotter object to plot to.
|
||||||
* @param aUnit - Symbol to plot.
|
* @param aUnit - Symbol to plot.
|
||||||
* @param aConvert - Symbol alternate body style 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 aOffset - Distance to shift the plot coordinates.
|
||||||
* @param aTransform - Symbol plot transform matrix.
|
* @param aTransform - Symbol plot transform matrix.
|
||||||
*/
|
*/
|
||||||
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
|
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
|
||||||
const TRANSFORM& aTransform );
|
const VECTOR2I& aOffset, const TRANSFORM& aTransform );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new draw \a aItem to the draw object list and sort according to \a aSort.
|
* 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
|
const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
wxASSERT( plotter != nullptr );
|
wxASSERT( plotter != nullptr );
|
||||||
|
|
||||||
|
if( aBackground )
|
||||||
|
return;
|
||||||
|
|
||||||
EDA_RECT bBox = GetBoundingBox();
|
EDA_RECT bBox = GetBoundingBox();
|
||||||
// convert coordinates from draw Y axis to symbol_editor Y axis
|
// convert coordinates from draw Y axis to symbol_editor Y axis
|
||||||
bBox.RevertYAxis();
|
bBox.RevertYAxis();
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
void NormalizeJustification( bool inverse );
|
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;
|
const TRANSFORM& aTransform ) const override;
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) 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
|
const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
wxASSERT( aPlotter != nullptr );
|
wxASSERT( aPlotter != nullptr );
|
||||||
|
@ -314,26 +314,16 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||||
if( IsPrivate() )
|
if( IsPrivate() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if( aBackground )
|
||||||
|
{
|
||||||
|
LIB_SHAPE::Plot( aPlotter, aBackground, aOffset, aTransform );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||||
FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL;
|
|
||||||
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
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 )
|
if( penWidth > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,8 +83,8 @@ public:
|
||||||
|
|
||||||
BITMAPS GetMenuImage() const override;
|
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;
|
const TRANSFORM& aTransform ) const override;
|
||||||
|
|
||||||
EDA_ITEM* Clone() 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 )
|
||||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
{
|
||||||
|
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 VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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;
|
EDA_ITEM* Clone() const override;
|
||||||
|
|
||||||
|
|
|
@ -468,13 +468,18 @@ 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() );
|
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||||
|
|
||||||
COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED ) ?
|
COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED )
|
||||||
settings->GetLayerColor( m_layer ) : GetBusEntryColor();
|
? settings->GetLayerColor( m_layer )
|
||||||
int penWidth = ( GetPenWidth() == 0 ) ? settings->GetDefaultPenWidth() : GetPenWidth();
|
: GetBusEntryColor();
|
||||||
|
|
||||||
|
int penWidth = ( GetPenWidth() == 0 ) ? settings->GetDefaultPenWidth() : GetPenWidth();
|
||||||
|
|
||||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||||
|
|
||||||
|
@ -483,6 +488,8 @@ void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) const
|
||||||
aPlotter->SetDash( GetLineStyle() );
|
aPlotter->SetDash( GetLineStyle() );
|
||||||
aPlotter->MoveTo( m_pos );
|
aPlotter->MoveTo( m_pos );
|
||||||
aPlotter->FinishTo( GetEnd() );
|
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;
|
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;
|
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();
|
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||||
COLOR4D color = settings->GetLayerColor( GetLayer() );
|
COLOR4D color = settings->GetLayerColor( GetLayer() );
|
||||||
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||||
|
@ -922,9 +925,6 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
|
||||||
if( !IsVisible() )
|
if( !IsVisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( IsVoid() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Calculate the text orientation, according to the symbol orientation/mirror
|
// Calculate the text orientation, according to the symbol orientation/mirror
|
||||||
EDA_ANGLE orient = GetTextAngle();
|
EDA_ANGLE orient = GetTextAngle();
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ public:
|
||||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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;
|
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() );
|
wxFAIL_MSG( wxT( "Plot() method not implemented for class " ) + GetClass() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,8 +448,10 @@ public:
|
||||||
* Plot the schematic item to \a aPlotter.
|
* Plot the schematic item to \a aPlotter.
|
||||||
*
|
*
|
||||||
* @param aPlotter is the #PLOTTER object to plot to.
|
* @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;
|
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() );
|
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||||
COLOR4D color = GetJunctionColor();
|
COLOR4D color = GetJunctionColor();
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public:
|
||||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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;
|
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;
|
static std::vector<VECTOR2I> s_poly;
|
||||||
|
|
||||||
|
@ -817,17 +817,23 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const
|
||||||
aPlotter->SetCurrentLineWidth( penWidth );
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
|
|
||||||
VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||||
|
|
||||||
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
|
||||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
|
||||||
|
|
||||||
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
|
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
|
||||||
|
|
||||||
if( s_poly.size() )
|
if( aBackground )
|
||||||
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
|
{
|
||||||
|
// No filled shapes (yet)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
||||||
|
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
||||||
|
|
||||||
|
if( s_poly.size() )
|
||||||
|
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
|
||||||
|
}
|
||||||
|
|
||||||
for( const SCH_FIELD& field : m_fields )
|
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 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;
|
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() );
|
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||||
int penWidth = std::max( GetPenWidth(), settings->GetMinPenWidth() );
|
int penWidth = std::max( GetPenWidth(), settings->GetMinPenWidth() );
|
||||||
COLOR4D color = GetLineColor();
|
COLOR4D color = GetLineColor();
|
||||||
|
|
|
@ -272,7 +272,7 @@ public:
|
||||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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;
|
EDA_ITEM* Clone() const override;
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,10 @@ public:
|
||||||
|
|
||||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
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
|
// SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an assertion if we
|
||||||
// assertion if we do not confirm this by locally implementing a no-op
|
// do not confirm this by locally implementing a no-op Plot().
|
||||||
// Plot().
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT const GetBoundingBox() const override;
|
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 delta = GetSize() / 2;
|
||||||
int pX = m_pos.x;
|
int pX = m_pos.x;
|
||||||
int pY = m_pos.y;
|
int pY = m_pos.y;
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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;
|
EDA_ITEM* Clone() const override;
|
||||||
|
|
||||||
|
|
|
@ -866,6 +866,7 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
|
||||||
} );
|
} );
|
||||||
|
|
||||||
int defaultPenWidth = aPlotter->RenderSettings()->GetDefaultPenWidth();
|
int defaultPenWidth = aPlotter->RenderSettings()->GetDefaultPenWidth();
|
||||||
|
constexpr bool background = true;
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -873,19 +874,25 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
|
||||||
for( const SCH_ITEM* item : bitmaps )
|
for( const SCH_ITEM* item : bitmaps )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter, background );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( const SCH_ITEM* item : other )
|
for( const SCH_ITEM* item : other )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
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 )
|
for( const SCH_ITEM* item : junctions )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
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() );
|
int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||||
|
|
||||||
|
@ -106,81 +106,87 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
||||||
else
|
else
|
||||||
aPlotter->SetColor( GetStroke().GetColor() );
|
aPlotter->SetColor( GetStroke().GetColor() );
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( pen_size );
|
if( aBackground )
|
||||||
aPlotter->SetDash( GetEffectiveLineStyle() );
|
|
||||||
|
|
||||||
switch( GetShape() )
|
|
||||||
{
|
{
|
||||||
case SHAPE_T::ARC:
|
if( m_fill == FILL_T::FILLED_WITH_COLOR && GetFillColor() != COLOR4D::UNSPECIFIED )
|
||||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size, ARC_HIGH_DEF );
|
{
|
||||||
break;
|
aPlotter->SetColor( GetFillColor() );
|
||||||
|
|
||||||
case SHAPE_T::CIRCLE:
|
switch( GetShape() )
|
||||||
aPlotter->Circle( getCenter(), GetRadius() * 2, FILL_T::NO_FILL, pen_size );
|
{
|
||||||
break;
|
case SHAPE_T::ARC:
|
||||||
|
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), m_fill, 0, ARC_HIGH_DEF );
|
||||||
|
break;
|
||||||
|
|
||||||
case SHAPE_T::RECT:
|
case SHAPE_T::CIRCLE:
|
||||||
{
|
aPlotter->Circle( getCenter(), GetRadius() * 2, m_fill, 0 );
|
||||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
break;
|
||||||
|
|
||||||
aPlotter->MoveTo( pts[0] );
|
case SHAPE_T::RECT:
|
||||||
aPlotter->LineTo( pts[1] );
|
aPlotter->Rect( GetStart(), GetEnd(), m_fill, 0 );
|
||||||
aPlotter->LineTo( pts[2] );
|
break;
|
||||||
aPlotter->LineTo( pts[3] );
|
|
||||||
aPlotter->FinishTo( pts[0] );
|
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() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
else /* if( aForeground ) */
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
|
||||||
{
|
{
|
||||||
aPlotter->MoveTo( cornerList[0] );
|
aPlotter->SetCurrentLineWidth( pen_size );
|
||||||
|
aPlotter->SetDash( GetEffectiveLineStyle() );
|
||||||
for( size_t ii = 1; ii < cornerList.size(); ++ii )
|
|
||||||
aPlotter->LineTo( cornerList[ii] );
|
|
||||||
|
|
||||||
aPlotter->FinishTo( cornerList[0] );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHAPE_T::BEZIER:
|
|
||||||
aPlotter->PlotPoly( m_bezierPoints, FILL_T::NO_FILL, pen_size );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
|
||||||
}
|
|
||||||
|
|
||||||
aPlotter->SetDash( PLOT_DASH_TYPE::SOLID );
|
|
||||||
|
|
||||||
if( m_fill == FILL_T::FILLED_WITH_COLOR && GetFillColor() != COLOR4D::UNSPECIFIED )
|
|
||||||
{
|
|
||||||
aPlotter->SetColor( GetFillColor() );
|
|
||||||
|
|
||||||
switch( GetShape() )
|
switch( GetShape() )
|
||||||
{
|
{
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), m_fill, 0, ARC_HIGH_DEF );
|
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size,
|
||||||
|
ARC_HIGH_DEF );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::CIRCLE:
|
case SHAPE_T::CIRCLE:
|
||||||
aPlotter->Circle( getCenter(), GetRadius() * 2, m_fill, 0 );
|
aPlotter->Circle( getCenter(), GetRadius() * 2, FILL_T::NO_FILL, pen_size );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::RECT:
|
case SHAPE_T::RECT:
|
||||||
aPlotter->Rect( GetStart(), GetEnd(), m_fill, 0 );
|
{
|
||||||
|
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||||
|
|
||||||
|
aPlotter->MoveTo( pts[0] );
|
||||||
|
aPlotter->LineTo( pts[1] );
|
||||||
|
aPlotter->LineTo( pts[2] );
|
||||||
|
aPlotter->LineTo( pts[3] );
|
||||||
|
aPlotter->FinishTo( pts[0] );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
aPlotter->PlotPoly( cornerList, m_fill, 0 );
|
{
|
||||||
|
aPlotter->MoveTo( cornerList[0] );
|
||||||
|
|
||||||
|
for( size_t ii = 1; ii < cornerList.size(); ++ii )
|
||||||
|
aPlotter->LineTo( cornerList[ii] );
|
||||||
|
|
||||||
|
aPlotter->FinishTo( cornerList[0] );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::BEZIER:
|
case SHAPE_T::BEZIER:
|
||||||
aPlotter->PlotPoly( m_bezierPoints, m_fill, 0 );
|
aPlotter->PlotPoly( m_bezierPoints, FILL_T::NO_FILL, pen_size );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aPlotter->SetDash( PLOT_DASH_TYPE::SOLID );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
|
|
||||||
void AddPoint( const VECTOR2I& aPosition );
|
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;
|
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;
|
wxString msg;
|
||||||
VECTOR2I pos;
|
VECTOR2I pos;
|
||||||
auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
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 )
|
if( override || backgroundColor == COLOR4D::UNSPECIFIED )
|
||||||
backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
|
backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
|
||||||
|
|
||||||
// Do not fill shape in B&W mode, otherwise texts are unreadable
|
if( aBackground )
|
||||||
bool fill = aPlotter->GetColorMode();
|
|
||||||
|
|
||||||
if( fill )
|
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( backgroundColor );
|
aPlotter->SetColor( backgroundColor );
|
||||||
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::FILLED_SHAPE, 1 );
|
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::FILLED_SHAPE, 1 );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aPlotter->SetColor( borderColor );
|
||||||
|
|
||||||
aPlotter->SetColor( borderColor );
|
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||||
|
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::NO_FILL, penWidth );
|
||||||
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
}
|
||||||
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::NO_FILL, penWidth );
|
|
||||||
|
|
||||||
// Plot sheet pins
|
// Plot sheet pins
|
||||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||||
sheetPin->Plot( aPlotter );
|
sheetPin->Plot( aPlotter, aBackground );
|
||||||
|
|
||||||
// Plot the fields
|
// Plot the fields
|
||||||
for( const SCH_FIELD& field : m_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 VECTOR2I& aPosition, int aAccuracy ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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;
|
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 )
|
if( m_part )
|
||||||
{
|
{
|
||||||
TRANSFORM temp = GetTransform();
|
TRANSFORM temp = GetTransform();
|
||||||
aPlotter->StartBlock( nullptr );
|
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 )
|
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 );
|
aPlotter->EndBlock( nullptr );
|
||||||
}
|
}
|
||||||
|
|
|
@ -648,7 +648,7 @@ public:
|
||||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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;
|
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;
|
static std::vector<VECTOR2I> s_poly;
|
||||||
|
|
||||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||||
|
|
|
@ -204,7 +204,7 @@ public:
|
||||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, 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
|
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();
|
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||||
KIFONT::FONT* font = GetDrawFont();
|
KIFONT::FONT* font = GetDrawFont();
|
||||||
int penWidth = GetPenWidth();
|
int penWidth = GetPenWidth();
|
||||||
FILL_T fill = m_fill;
|
FILL_T fill = m_fill;
|
||||||
COLOR4D color = settings->GetLayerColor( LAYER_NOTES );
|
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 )
|
if( penWidth > 0 )
|
||||||
{
|
{
|
||||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
|
|
||||||
BITMAPS GetMenuImage() const override;
|
BITMAPS GetMenuImage() const override;
|
||||||
|
|
||||||
void Plot( PLOTTER* aPlotter ) const override;
|
void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
|
||||||
|
|
||||||
EDA_ITEM* Clone() const override
|
EDA_ITEM* Clone() const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,16 +61,22 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
|
||||||
|
|
||||||
if( m_symbol )
|
if( m_symbol )
|
||||||
{
|
{
|
||||||
TRANSFORM temp; // Uses default transform
|
constexpr bool background = true;
|
||||||
wxPoint plotPos;
|
TRANSFORM temp; // Uses default transform
|
||||||
|
wxPoint plotPos;
|
||||||
|
|
||||||
plotPos.x = pageInfo.GetWidthIU() / 2;
|
plotPos.x = pageInfo.GetWidthIU() / 2;
|
||||||
plotPos.y = pageInfo.GetHeightIU() / 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():
|
// 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();
|
plotter->EndPlot();
|
||||||
|
|
Loading…
Reference in New Issue