Push generalised sketch-mode support down into DXF_PLOTTER.

This commit is contained in:
Jeff Young 2025-05-10 14:17:15 +01:00
parent 3458534fd7
commit 34139ae305
27 changed files with 484 additions and 568 deletions

View File

@ -178,7 +178,7 @@ void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VEC
if( color == COLOR4D::UNSPECIFIED ) if( color == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
Print( aSettings, aOffset, color, FILLED ); Print( aSettings, aOffset, color );
} }

View File

@ -876,8 +876,7 @@ bool EDA_TEXT::TextHitTest( const BOX2I& aRect, bool aContains, int aAccuracy )
} }
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor )
const COLOR4D& aColor, OUTLINE_MODE aFillMode )
{ {
if( IsMultilineAllowed() ) if( IsMultilineAllowed() )
{ {
@ -890,12 +889,11 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
GetLinePositions( positions, (int) strings.Count() ); GetLinePositions( positions, (int) strings.Count() );
for( unsigned ii = 0; ii < strings.Count(); ii++ ) for( unsigned ii = 0; ii < strings.Count(); ii++ )
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] ); printOneLineOfText( aSettings, aOffset, aColor, strings[ii], positions[ii] );
} }
else else
{ {
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText( true ), printOneLineOfText( aSettings, aOffset, aColor, GetShownText( true ), GetDrawPos() );
GetDrawPos() );
} }
} }
@ -945,15 +943,11 @@ void EDA_TEXT::GetLinePositions( std::vector<VECTOR2I>& aPositions, int aLineCou
void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
const COLOR4D& aColor, OUTLINE_MODE aFillMode, const COLOR4D& aColor, const wxString& aText, const VECTOR2I& aPos )
const wxString& aText, const VECTOR2I& aPos )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() ); int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
if( aFillMode == SKETCH )
penWidth = -penWidth;
VECTOR2I size = GetTextSize(); VECTOR2I size = GetTextSize();
if( IsMirrored() ) if( IsMirrored() )

View File

@ -38,6 +38,9 @@
*/ */
static const double DXF_OBLIQUE_ANGLE = 15; static const double DXF_OBLIQUE_ANGLE = 15;
// No support for linewidths in DXF
#define DXF_LINE_WIDTH DO_NOT_SET_LINE_WIDTH
/** /**
* The layer/colors palette. * The layer/colors palette.
* *
@ -524,7 +527,7 @@ void DXF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
unsigned last = aCornerList.size() - 1; unsigned last = aCornerList.size() - 1;
// Plot outlines with lines (thickness = 0) to define the polygon // Plot outlines with lines (thickness = 0) to define the polygon
if( aWidth <= 0 ) if( aWidth <= 0 || aFill == FILL_T::NO_FILL )
{ {
MoveTo( aCornerList[0] ); MoveTo( aCornerList[0] );
@ -539,18 +542,6 @@ void DXF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
} }
PenFinish(); PenFinish();
return;
}
// if the polygon outline has thickness, and is not filled
// (i.e. is a polyline) plot outlines with thick segments
else if( aFill == FILL_T::NO_FILL )
{
MoveTo( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
ThickSegment( aCornerList[ii-1], aCornerList[ii], aWidth, FILLED, nullptr );
return; return;
} }
@ -654,36 +645,6 @@ void DXF_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
} }
void DXF_PLOTTER::ThickSegment( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth,
OUTLINE_MODE aPlotMode, void* aData )
{
if( aPlotMode == SKETCH )
{
std::vector<VECTOR2I> cornerList;
SHAPE_POLY_SET outlineBuffer;
TransformOvalToPolygon( outlineBuffer, aStart, aEnd, aWidth, GetPlotterArcHighDef(),
ERROR_INSIDE );
const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline( 0 );
cornerList.reserve( path.PointCount() );
for( int jj = 0; jj < path.PointCount(); jj++ )
cornerList.emplace_back( path.CPoint( jj ).x, path.CPoint( jj ).y );
// Ensure the polygon is closed
if( cornerList[0] != cornerList[cornerList.size() - 1] )
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, FILL_T::NO_FILL );
}
else
{
MoveTo( aStart );
FinishTo( aEnd );
}
}
void DXF_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle, void DXF_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth ) const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth )
{ {
@ -716,8 +677,127 @@ void DXF_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
} }
void DXF_PLOTTER::ThickSegment( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth, void* aData )
{
const PLOT_PARAMS* cfg = static_cast<const PLOT_PARAMS*>( aData );
if( cfg && cfg->GetDXFPlotMode() == SKETCH )
{
std::vector<VECTOR2I> cornerList;
SHAPE_POLY_SET outlineBuffer;
TransformOvalToPolygon( outlineBuffer, aStart, aEnd, aWidth, GetPlotterArcHighDef(),
ERROR_INSIDE );
const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline( 0 );
cornerList.reserve( path.PointCount() );
for( int jj = 0; jj < path.PointCount(); jj++ )
cornerList.emplace_back( path.CPoint( jj ).x, path.CPoint( jj ).y );
// Ensure the polygon is closed
if( cornerList[0] != cornerList[cornerList.size() - 1] )
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, FILL_T::NO_FILL, DXF_LINE_WIDTH );
}
else
{
MoveTo( aStart );
FinishTo( aEnd );
}
}
void DXF_PLOTTER::ThickArc( const VECTOR2D& centre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData )
{
const PLOT_PARAMS* cfg = static_cast<const PLOT_PARAMS*>( aData );
if( cfg && cfg->GetDXFPlotMode() == SKETCH )
{
Arc( centre, aStartAngle, aAngle, aRadius - aWidth/2, FILL_T::NO_FILL, DXF_LINE_WIDTH );
Arc( centre, aStartAngle, aAngle, aRadius + aWidth/2, FILL_T::NO_FILL, DXF_LINE_WIDTH );
}
else
{
Arc( centre, aStartAngle, aAngle, aRadius, FILL_T::NO_FILL, DXF_LINE_WIDTH );
}
}
void DXF_PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void* aData )
{
const PLOT_PARAMS* cfg = static_cast<const PLOT_PARAMS*>( aData );
if( cfg && cfg->GetDXFPlotMode() == SKETCH )
{
VECTOR2I offsetp1( p1.x - width/2, p1.y - width/2 );
VECTOR2I offsetp2( p2.x + width/2, p2.y + width/2 );
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, DXF_LINE_WIDTH );
offsetp1.x += width;
offsetp1.y += width;
offsetp2.x -= width;
offsetp2.y -= width;
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, DXF_LINE_WIDTH );
}
else
{
Rect( p1, p2, FILL_T::NO_FILL, DXF_LINE_WIDTH );
}
}
void DXF_PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData )
{
const PLOT_PARAMS* cfg = static_cast<const PLOT_PARAMS*>( aData );
if( cfg && cfg->GetDXFPlotMode() == SKETCH )
{
Circle( pos, diametre - width, FILL_T::NO_FILL, DXF_LINE_WIDTH );
Circle( pos, diametre + width, FILL_T::NO_FILL, DXF_LINE_WIDTH );
}
else
{
Circle( pos, diametre, FILL_T::NO_FILL, DXF_LINE_WIDTH );
}
}
void DXF_PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre, void* aData )
{
const PLOT_PARAMS* cfg = static_cast<const PLOT_PARAMS*>( aData );
if( cfg && cfg->GetDXFPlotMode() == SKETCH )
Circle( pos, diametre, FILL_T::NO_FILL, DXF_LINE_WIDTH );
else
Circle( pos, diametre, FILL_T::FILLED_SHAPE, 0 );
}
void DXF_PLOTTER::ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, void* aData )
{
const PLOT_PARAMS* cfg = static_cast<const PLOT_PARAMS*>( aData );
if( cfg && cfg->GetDXFPlotMode() == SKETCH )
{
SHAPE_POLY_SET outline = aPoly.CloneDropTriangulation();
outline.Inflate( aWidth / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, GetPlotterArcHighDef() );
PLOTTER::PlotPoly( outline.COutline( 0 ), FILL_T::NO_FILL, DXF_LINE_WIDTH, aData );
outline = aPoly.CloneDropTriangulation();
outline.Deflate( aWidth / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS, GetPlotterArcHighDef() );
PLOTTER::PlotPoly( outline.COutline( 0 ), FILL_T::NO_FILL, DXF_LINE_WIDTH, aData );
}
else
{
PLOTTER::PlotPoly( aPoly.COutline( 0 ), FILL_T::NO_FILL, aWidth, aData );
}
}
void DXF_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize, void DXF_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData ) const EDA_ANGLE& aOrient, void* aData )
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
@ -732,20 +812,19 @@ void DXF_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
orient += ANGLE_90; orient += ANGLE_90;
} }
ThickOval( aPos, size, orient, USE_DEFAULT_LINE_WIDTH, aData ); ThickOval( aPos, size, orient, DXF_LINE_WIDTH, aData );
} }
void DXF_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, void DXF_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, void* aData )
OUTLINE_MODE trace_mode, void* aData )
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
Circle( pos, diametre, FILL_T::NO_FILL ); Circle( pos, diametre, FILL_T::NO_FILL, DXF_LINE_WIDTH );
} }
void DXF_PLOTTER::FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aPadSize, void DXF_PLOTTER::FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aPadSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData ) const EDA_ANGLE& aOrient, void* aData )
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
@ -804,8 +883,7 @@ void DXF_PLOTTER::FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aPadSize,
void DXF_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void DXF_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient, int aCornerRadius, const EDA_ANGLE& aOrient, void* aData )
OUTLINE_MODE aTraceMode, void* aData )
{ {
SHAPE_POLY_SET outline; SHAPE_POLY_SET outline;
TransformRoundChamferedRectToPolygon( outline, aPadPos, aSize, aOrient, aCornerRadius, 0.0, 0, TransformRoundChamferedRectToPolygon( outline, aPadPos, aSize, aOrient, aCornerRadius, 0.0, 0,
@ -825,7 +903,7 @@ void DXF_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aS
void DXF_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void DXF_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons, const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) void* aData )
{ {
for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt ) for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
{ {
@ -842,8 +920,7 @@ void DXF_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize
void DXF_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, void DXF_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData )
void* aData )
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
VECTOR2I coord[4]; /* coord actual corners of a trapezoidal trace */ VECTOR2I coord[4]; /* coord actual corners of a trapezoidal trace */
@ -865,8 +942,7 @@ void DXF_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorn
void DXF_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount, void DXF_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData )
void* aData )
{ {
// Do nothing // Do nothing
wxASSERT( 0 ); wxASSERT( 0 );
@ -984,9 +1060,7 @@ void DXF_PLOTTER::plotOneLineOfText( const VECTOR2I& aPos, const COLOR4D& aColor
case GR_TEXT_H_ALIGN_LEFT: h_code = 0; break; case GR_TEXT_H_ALIGN_LEFT: h_code = 0; break;
case GR_TEXT_H_ALIGN_CENTER: h_code = 1; break; case GR_TEXT_H_ALIGN_CENTER: h_code = 1; break;
case GR_TEXT_H_ALIGN_RIGHT: h_code = 2; break; case GR_TEXT_H_ALIGN_RIGHT: h_code = 2; break;
case GR_TEXT_H_ALIGN_INDETERMINATE: case GR_TEXT_H_ALIGN_INDETERMINATE: wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) ); break;
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
} }
switch( aAttributes.m_Valign ) switch( aAttributes.m_Valign )
@ -994,9 +1068,7 @@ void DXF_PLOTTER::plotOneLineOfText( const VECTOR2I& aPos, const COLOR4D& aColor
case GR_TEXT_V_ALIGN_TOP: v_code = 3; break; case GR_TEXT_V_ALIGN_TOP: v_code = 3; break;
case GR_TEXT_V_ALIGN_CENTER: v_code = 2; break; case GR_TEXT_V_ALIGN_CENTER: v_code = 2; break;
case GR_TEXT_V_ALIGN_BOTTOM: v_code = 1; break; case GR_TEXT_V_ALIGN_BOTTOM: v_code = 1; break;
case GR_TEXT_V_ALIGN_INDETERMINATE: case GR_TEXT_V_ALIGN_INDETERMINATE: wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) ); break;
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
} }
std::string textStyle = "KICAD"; std::string textStyle = "KICAD";

View File

@ -863,7 +863,7 @@ void GERBER_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
cornerList.push_back( corner ); cornerList.push_back( corner );
cornerList.push_back( p1 ); cornerList.push_back( p1 );
PlotPoly( cornerList, fill, width ); PlotPoly( cornerList, fill, width, nullptr );
} }
@ -1182,79 +1182,72 @@ void GERBER_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T
} }
void GERBER_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void GERBER_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void* aData )
OUTLINE_MODE tracemode, void* aData )
{ {
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ); if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
SetCurrentLineWidth( width, gbr_metadata );
if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
MoveTo( start ); SetCurrentLineWidth( width, aData );
FinishTo( end ); PLOTTER::ThickSegment( start, end, DO_NOT_SET_LINE_WIDTH, aData );
} }
void GERBER_PLOTTER::ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle, void GERBER_PLOTTER::ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth, const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData )
OUTLINE_MODE aTraceMode, void* aData )
{ {
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ); if( GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
SetCurrentLineWidth( aWidth, gbr_metadata );
if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
Arc( aCentre, aStartAngle, aAngle, aRadius, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH ); SetCurrentLineWidth( aWidth, aData );
PLOTTER::ThickArc( aCentre, aStartAngle, aAngle, aRadius, DO_NOT_SET_LINE_WIDTH, aData );
} }
void GERBER_PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void GERBER_PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void* aData )
OUTLINE_MODE tracemode, void* aData )
{ {
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ); if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
SetCurrentLineWidth( width, gbr_metadata );
if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
Rect( p1, p2, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH ); SetCurrentLineWidth( width, aData );
PLOTTER::ThickRect( p1, p2, DO_NOT_SET_LINE_WIDTH, aData );
} }
void GERBER_PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, void GERBER_PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData )
OUTLINE_MODE tracemode, void* aData )
{ {
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ); if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
SetCurrentLineWidth( width, gbr_metadata );
if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
Circle( pos, diametre, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH ); SetCurrentLineWidth( width, aData );
PLOTTER::ThickCircle( pos, diametre, DO_NOT_SET_LINE_WIDTH, aData );
} }
void GERBER_PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre, void GERBER_PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre, void* aData )
OUTLINE_MODE tracemode, void* aData )
{ {
// A filled circle is a graphic item, not a pad. // A filled circle is a graphic item, not a pad.
// So it is drawn, not flashed. // So it is drawn, not flashed.
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ); if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
// Draw a circle of diameter = diameter/2 with a line thickness = radius, // Draw a circle of diameter = diameter/2 with a line thickness = radius,
// To create a filled circle // To create a filled circle
SetCurrentLineWidth( diametre/2, gbr_metadata ); SetCurrentLineWidth( diametre/2, aData );
Circle( pos, diametre/2, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH ); Circle( pos, diametre/2, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
} }
void GERBER_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE trace_mode, void GERBER_PLOTTER::ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, void* aData )
void* aData ) {
if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
SetCurrentLineWidth( aWidth, aData );
PLOTTER::ThickPoly( aPoly, DO_NOT_SET_LINE_WIDTH, aData );
}
void GERBER_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, void* aData )
{ {
VECTOR2I size( diametre, diametre ); VECTOR2I size( diametre, diametre );
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ); GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1264,7 +1257,7 @@ void GERBER_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, OUTLINE_
void GERBER_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize, void GERBER_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData ) const EDA_ANGLE& aOrient, void* aData )
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
@ -1309,15 +1302,13 @@ void GERBER_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
// Draw the oval as round rect pad with a radius = 50% min size) // Draw the oval as round rect pad with a radius = 50% min size)
// In gerber file, it will be drawn as a region with arcs, and can be // In gerber file, it will be drawn as a region with arcs, and can be
// detected as pads (similar to a flashed pad) // detected as pads (similar to a flashed pad)
FlashPadRoundRect( aPos, aSize, std::min( aSize.x, aSize.y ) / 2, orient, aTraceMode, FlashPadRoundRect( aPos, aSize, std::min( aSize.x, aSize.y ) / 2, orient, aData );
aData );
} }
} }
void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize, void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData ) const EDA_ANGLE& aOrient, void* aData )
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
@ -1363,15 +1354,14 @@ void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize,
coord[3].x = size.x/2; // lower right coord[3].x = size.x/2; // lower right
coord[3].y = size.y/2; coord[3].y = size.y/2;
FlashPadTrapez( pos, coord, aOrient, aTraceMode, aData ); FlashPadTrapez( pos, coord, aOrient, aData );
} }
} }
} }
void GERBER_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void GERBER_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient, int aCornerRadius, const EDA_ANGLE& aOrient, void* aData )
OUTLINE_MODE aTraceMode, void* aData )
{ {
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ); GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1548,8 +1538,7 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const VECTOR2I& aRectCenter, const V
void GERBER_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void GERBER_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons, const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) void* aData )
{ {
// A Pad custom is plotted as polygon (a region in Gerber language). // A Pad custom is plotted as polygon (a region in Gerber language).
GBR_METADATA gbr_metadata; GBR_METADATA gbr_metadata;
@ -1606,8 +1595,7 @@ void GERBER_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aS
void GERBER_PLOTTER::FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const VECTOR2I& aPadSize, void GERBER_PLOTTER::FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const VECTOR2I& aPadSize,
int aCornerRadius, double aChamferRatio, int aCornerRadius, double aChamferRatio,
int aChamferPositions, const EDA_ANGLE& aPadOrient, int aChamferPositions, const EDA_ANGLE& aPadOrient,
OUTLINE_MODE aPlotMode, void* aData ) void* aData )
{ {
GBR_METADATA gbr_metadata; GBR_METADATA gbr_metadata;
@ -1724,9 +1712,7 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const
void GERBER_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, void GERBER_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData )
void* aData )
{ {
// polygon corners list // polygon corners list
std::vector<VECTOR2I> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] }; std::vector<VECTOR2I> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
@ -1759,11 +1745,13 @@ void GERBER_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
std::vector<VECTOR2I> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] }; std::vector<VECTOR2I> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
int aperture_attribute = 0; int aperture_attribute = 0;
std::string custom_attribute = ""; std::string custom_attribute = "";
if( gbr_metadata ) if( gbr_metadata )
{ {
aperture_attribute = gbr_metadata->GetApertureAttrib(); aperture_attribute = gbr_metadata->GetApertureAttrib();
custom_attribute = gbr_metadata->GetCustomAttribute(); custom_attribute = gbr_metadata->GetCustomAttribute();
} }
selectAperture( corners, aPadOrient, APERTURE::APER_MACRO_OUTLINE4P, aperture_attribute, selectAperture( corners, aPadOrient, APERTURE::APER_MACRO_OUTLINE4P, aperture_attribute,
custom_attribute ); custom_attribute );
@ -1780,7 +1768,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
void GERBER_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, void GERBER_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter,
int aCornerCount, const EDA_ANGLE& aOrient, int aCornerCount, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) void* aData )
{ {
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ); GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1789,29 +1777,6 @@ void GERBER_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiamet
if( gbr_metadata ) if( gbr_metadata )
metadata = *gbr_metadata; metadata = *gbr_metadata;
if( aTraceMode == SKETCH )
{
// Build the polygon:
std::vector<VECTOR2I> cornerList;
EDA_ANGLE angle_delta = ANGLE_360 / aCornerCount;
for( int ii = 0; ii < aCornerCount; ii++ )
{
EDA_ANGLE rot = aOrient + ( angle_delta * ii );
VECTOR2I vertice( aDiameter / 2, 0 );
RotatePoint( vertice, rot );
vertice += aShapePos;
cornerList.push_back( vertice );
}
cornerList.push_back( cornerList[0] ); // Close the shape
PlotPoly( cornerList, FILL_T::NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
}
else
{
APERTURE::APERTURE_TYPE apert_type = APERTURE::APERTURE_TYPE apert_type =
( APERTURE::APERTURE_TYPE )( APERTURE::AT_REGULAR_POLY3 + aCornerCount - 3 ); ( APERTURE::APERTURE_TYPE )( APERTURE::AT_REGULAR_POLY3 + aCornerCount - 3 );
@ -1821,7 +1786,6 @@ void GERBER_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiamet
selectApertureWithAttributes( aShapePos, gbr_metadata, VECTOR2I( 0, 0 ), aDiameter / 2, selectApertureWithAttributes( aShapePos, gbr_metadata, VECTOR2I( 0, 0 ), aDiameter / 2,
aOrient, apert_type ); aOrient, apert_type );
} }
}
void GERBER_PLOTTER::Text( const VECTOR2I& aPos, void GERBER_PLOTTER::Text( const VECTOR2I& aPos,

View File

@ -90,8 +90,7 @@ void PSLIKE_PLOTTER::SetColor( const COLOR4D& color )
void PSLIKE_PLOTTER::FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void PSLIKE_PLOTTER::FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData )
void* aData )
{ {
wxASSERT( m_outputFile ); wxASSERT( m_outputFile );
@ -112,22 +111,18 @@ void PSLIKE_PLOTTER::FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSiz
RotatePoint( a, orient ); RotatePoint( a, orient );
RotatePoint( b, orient ); RotatePoint( b, orient );
ThickSegment( a + aPadPos, b + aPadPos, size.x, aTraceMode, aData ); ThickSegment( a + aPadPos, b + aPadPos, size.x, aData );
} }
void PSLIKE_PLOTTER::FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, void PSLIKE_PLOTTER::FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, void* aData )
OUTLINE_MODE aTraceMode, void* aData )
{ {
Circle( aPadPos, aDiameter, FILL_T::FILLED_SHAPE, 0 ); Circle( aPadPos, aDiameter, FILL_T::FILLED_SHAPE, 0 );
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
} }
void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData )
void* aData )
{ {
std::vector<VECTOR2I> cornerList; std::vector<VECTOR2I> cornerList;
VECTOR2I size( aSize ); VECTOR2I size( aSize );
@ -160,8 +155,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSiz
void PSLIKE_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void PSLIKE_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient, int aCornerRadius, const EDA_ANGLE& aOrient, void* aData )
OUTLINE_MODE aTraceMode, void* aData )
{ {
SHAPE_POLY_SET outline; SHAPE_POLY_SET outline;
TransformRoundChamferedRectToPolygon( outline, aPadPos, aSize, aOrient, aCornerRadius, 0.0, 0, TransformRoundChamferedRectToPolygon( outline, aPadPos, aSize, aOrient, aCornerRadius, 0.0, 0,
@ -185,7 +179,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I&
void PSLIKE_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, void PSLIKE_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons, const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) void* aData )
{ {
std::vector<VECTOR2I> cornerList; std::vector<VECTOR2I> cornerList;
@ -206,8 +200,7 @@ void PSLIKE_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aS
void PSLIKE_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, void PSLIKE_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData )
void* aData )
{ {
static std::vector<VECTOR2I> cornerList; static std::vector<VECTOR2I> cornerList;
cornerList.clear(); cornerList.clear();
@ -227,8 +220,7 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
void PSLIKE_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount, void PSLIKE_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aRadius, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData )
void* aData )
{ {
// Do nothing // Do nothing
wxASSERT( 0 ); wxASSERT( 0 );

View File

@ -535,10 +535,7 @@ void PLOTTER::ThickOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA_
} }
void PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void* aData )
OUTLINE_MODE tracemode, void* aData )
{
if( tracemode == FILLED )
{ {
if( start == end ) if( start == end )
{ {
@ -551,48 +548,16 @@ void PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int widt
FinishTo( end ); FinishTo( end );
} }
} }
else
{
std::vector<VECTOR2I> cornerList;
SHAPE_POLY_SET outlineBuffer;
TransformOvalToPolygon( outlineBuffer, start, end, width, GetPlotterArcHighDef(), ERROR_INSIDE );
const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline( 0 );
cornerList.reserve( path.PointCount() );
for( int jj = 0; jj < path.PointCount(); jj++ )
cornerList.emplace_back( path.CPoint( jj ).x, path.CPoint( jj ).y );
// Ensure the polygon is closed
if( cornerList[0] != cornerList[cornerList.size() - 1] )
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH, aData );
}
}
void PLOTTER::ThickArc( const VECTOR2D& centre, const EDA_ANGLE& aStartAngle, void PLOTTER::ThickArc( const VECTOR2D& centre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth, const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData )
OUTLINE_MODE aTraceMode, void* aData )
{
if( aTraceMode == FILLED )
{ {
Arc( centre, aStartAngle, aAngle, aRadius, FILL_T::NO_FILL, aWidth ); Arc( centre, aStartAngle, aAngle, aRadius, FILL_T::NO_FILL, aWidth );
} }
else
{
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
Arc( centre, aStartAngle, aAngle, aRadius - KiROUND( ( aWidth - m_currentPenWidth ) / 2 ),
FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
Arc( centre, aStartAngle, aAngle, aRadius + KiROUND( ( aWidth - m_currentPenWidth ) / 2 ),
FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
}
}
void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, void* aData, void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, void* aData, int aWidth )
int aWidth )
{ {
VECTOR2D center = aArcShape.getCenter(); VECTOR2D center = aArcShape.getCenter();
VECTOR2D mid = aArcShape.GetArcMid(); VECTOR2D mid = aArcShape.GetArcMid();
@ -613,83 +578,32 @@ void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, voi
double radius = ( start - center ).EuclideanNorm(); double radius = ( start - center ).EuclideanNorm();
ThickArc( center, startAngle, angle, radius, aWidth, aTraceMode, aData ); ThickArc( center, startAngle, angle, radius, aWidth, aData );
} }
void PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void* aData )
OUTLINE_MODE tracemode, void* aData )
{
if( tracemode == FILLED )
{ {
Rect( p1, p2, FILL_T::NO_FILL, width ); Rect( p1, p2, FILL_T::NO_FILL, width );
} }
else
{
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
VECTOR2I offsetp1( p1.x - ( width - GetCurrentLineWidth() ) / 2,
p1.y - ( width - GetCurrentLineWidth() ) / 2 );
VECTOR2I offsetp2( p2.x + ( width - GetCurrentLineWidth() ) / 2,
p2.y + ( width - GetCurrentLineWidth() ) / 2 );
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
offsetp1.x += ( width - GetCurrentLineWidth() );
offsetp1.y += ( width - GetCurrentLineWidth() );
offsetp2.x -= ( width - GetCurrentLineWidth() );
offsetp2.y -= ( width - GetCurrentLineWidth() );
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
}
}
void PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, OUTLINE_MODE tracemode, void PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData )
void* aData )
{
if( tracemode == FILLED )
{ {
Circle( pos, diametre, FILL_T::NO_FILL, width ); Circle( pos, diametre, FILL_T::NO_FILL, width );
} }
else
{
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
Circle( pos, diametre - width + GetCurrentLineWidth(), FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
Circle( pos, diametre + width - GetCurrentLineWidth(), FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
}
}
void PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE tracemode, void* aData ) void PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre, void* aData )
{
if( tracemode == FILLED )
{ {
Circle( pos, diametre, FILL_T::FILLED_SHAPE, 0 ); Circle( pos, diametre, FILL_T::FILLED_SHAPE, 0 );
} }
else
{
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
Circle( pos, diametre, FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
}
}
void PLOTTER::ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, OUTLINE_MODE tracemode, void* aData ) void PLOTTER::ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, void* aData )
{
if( tracemode == SKETCH )
{
SHAPE_POLY_SET outline = aPoly.CloneDropTriangulation();
outline.Inflate( GetCurrentLineWidth() / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS,
GetPlotterArcHighDef() );
PlotPoly( outline.COutline( 0 ), FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH, nullptr );
outline = aPoly.CloneDropTriangulation();
outline.Deflate( GetCurrentLineWidth() / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS,
GetPlotterArcHighDef() );
PlotPoly( outline.COutline( 0 ), FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH, nullptr );
}
else
{ {
PlotPoly( aPoly.COutline( 0 ), FILL_T::NO_FILL, aWidth, aData ); PlotPoly( aPoly.COutline( 0 ), FILL_T::NO_FILL, aWidth, aData );
} }
}
void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int aWidth, void* aData ) void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int aWidth, void* aData )

View File

@ -87,7 +87,6 @@ principle should be easily implemented by adapting the current STL containers.
// headers/imports that must be included in the _wrapper.cpp at top // headers/imports that must be included in the _wrapper.cpp at top
%{ %{
#include <outline_mode.h>
#include <macros_swig.h> #include <macros_swig.h>
#include <kiid.h> #include <kiid.h>
#include <cstddef> #include <cstddef>
@ -121,7 +120,6 @@ principle should be easily implemented by adapting the current STL containers.
// header files that must be wrapped // header files that must be wrapped
%include <outline_mode.h>
%include macros_swig.h %include macros_swig.h
%include kiid.h %include kiid.h
%include core/typeinfo.h %include core/typeinfo.h

View File

@ -1328,7 +1328,7 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
aPlotter->PenFinish(); aPlotter->PenFinish();
int diameter = ( s_poly[2] - s_poly[1] ).EuclideanNorm() * 2; int diameter = ( s_poly[2] - s_poly[1] ).EuclideanNorm() * 2;
aPlotter->FilledCircle( s_poly[2], diameter , FILLED, nullptr ); aPlotter->FilledCircle( s_poly[2], diameter, nullptr );
} }
else if( GetShape() == LABEL_FLAG_SHAPE::F_ROUND ) else if( GetShape() == LABEL_FLAG_SHAPE::F_ROUND )
{ {
@ -1337,7 +1337,7 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
aPlotter->PenFinish(); aPlotter->PenFinish();
int diameter = ( s_poly[2] - s_poly[1] ).EuclideanNorm() * 2; int diameter = ( s_poly[2] - s_poly[1] ).EuclideanNorm() * 2;
aPlotter->ThickCircle( s_poly[2], diameter, penWidth, FILLED, nullptr ); aPlotter->ThickCircle( s_poly[2], diameter, penWidth, nullptr );
} }
else else
{ {

View File

@ -1280,11 +1280,11 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) ); aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) );
aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr ); aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, nullptr );
aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ), aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ), bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
strokeWidth, FILLED, nullptr ); strokeWidth, nullptr );
} }
} }

View File

@ -2634,11 +2634,11 @@ void SCH_SYMBOL::PlotDNP( PLOTTER* aPlotter ) const
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter ); SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
aPlotter->SetColor( renderSettings->GetLayerColor( LAYER_DNP_MARKER ) ); aPlotter->SetColor( renderSettings->GetLayerColor( LAYER_DNP_MARKER ) );
aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr ); aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, nullptr );
aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ), aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ), bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
strokeWidth, FILLED, nullptr ); strokeWidth, nullptr );
} }

View File

@ -28,7 +28,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <outline_mode.h>
#include <eda_search_data.h> #include <eda_search_data.h>
#include <font/glyph.h> #include <font/glyph.h>
#include <font/text_attributes.h> #include <font/text_attributes.h>
@ -286,10 +285,8 @@ public:
* @param aDC the current Device Context. * @param aDC the current Device Context.
* @param aOffset draw offset (usually (0,0)). * @param aOffset draw offset (usually (0,0)).
* @param aColor text color. * @param aColor text color.
* @param aDisplay_mode #FILLED or #SKETCH.
*/ */
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor, void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor );
OUTLINE_MODE aDisplay_mode = FILLED );
/** /**
* build a list of segments (SHAPE_SEGMENT) to describe a text shape. * build a list of segments (SHAPE_SEGMENT) to describe a text shape.
@ -437,13 +434,11 @@ protected:
* *
* @param aOffset draw offset (usually (0,0)). * @param aOffset draw offset (usually (0,0)).
* @param aColor text color. * @param aColor text color.
* @param aFillMode FILLED or SKETCH
* @param aText the single line of text to draw. * @param aText the single line of text to draw.
* @param aPos the position of this line ). * @param aPos the position of this line ).
*/ */
void printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
const COLOR4D& aColor, OUTLINE_MODE aFillMode, const wxString& aText, const COLOR4D& aColor, const wxString& aText, const VECTOR2I& aPos );
const VECTOR2I& aPos );
protected: protected:
/** /**

View File

@ -1,30 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUTLINE_MODE_H
#define OUTLINE_MODE_H
/* Options to draw items with thickness ( segments, arcs, circles, texts...) */
enum OUTLINE_MODE
{
SKETCH = 0, // sketch mode: draw segments outlines only
FILLED = 1 // normal mode: solid segments
};
#endif

View File

@ -29,7 +29,6 @@
#include <eda_units.h> #include <eda_units.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <outline_mode.h>
#include <lib_id.h> #include <lib_id.h>
#include <pcb_display_options.h> #include <pcb_display_options.h>
#include <pcb_draw_panel_gal.h> #include <pcb_draw_panel_gal.h>

View File

@ -30,7 +30,6 @@
#include <math/box2.h> #include <math/box2.h>
#include <gr_text.h> #include <gr_text.h>
#include <page_info.h> #include <page_info.h>
#include <outline_mode.h>
#include <gal/color4d.h> #include <gal/color4d.h>
#include <stroke_params.h> #include <stroke_params.h>
#include <render_settings.h> #include <render_settings.h>
@ -74,6 +73,15 @@ enum class PLOT_FORMAT
LAST_FORMAT = SVG LAST_FORMAT = SVG
}; };
/**
* Options to draw items with thickness ( segments, arcs, circles, texts...)
*/
enum DXF_OUTLINE_MODE
{
SKETCH = 0, // sketch mode: draw segments outlines only
FILLED = 1 // normal mode: solid segments
};
/** /**
* Which kind of text to output with the PSLIKE plotters. * Which kind of text to output with the PSLIKE plotters.
* *
@ -95,6 +103,14 @@ enum class PLOT_TEXT_MODE
DEFAULT DEFAULT
}; };
class PLOT_PARAMS
{
public:
virtual DXF_OUTLINE_MODE GetDXFPlotMode() const { wxFAIL; return DXF_OUTLINE_MODE::FILLED; }
virtual PLOT_TEXT_MODE GetTextMode() const { return PLOT_TEXT_MODE::DEFAULT; }
};
/** /**
* Base plotter engine class. General rule: all the interface with the caller * Base plotter engine class. General rule: all the interface with the caller
* is done in IU, the IU size is specified with SetViewport. Internal and * is done in IU, the IU size is specified with SetViewport. Internal and
@ -300,86 +316,72 @@ public:
virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor ); virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor );
// Higher level primitives -- can be drawn as line, sketch or 'filled' // Higher level primitives -- can be drawn as line, sketch or 'filled'
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void* aData );
OUTLINE_MODE tracemode, void* aData );
virtual void ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, void* aData, virtual void ThickArc( const EDA_SHAPE& aArcShape, void* aData, int aWidth );
int aWidth );
virtual void ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStAngle, virtual void ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth, const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData );
OUTLINE_MODE aTraceMode, void* aData );
virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void* aData );
OUTLINE_MODE tracemode, void* aData );
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, OUTLINE_MODE tracemode, virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData );
void* aData );
virtual void FilledCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE tracemode, virtual void FilledCircle( const VECTOR2I& pos, int diametre, void* aData );
void* aData );
virtual void ThickOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA_ANGLE& aOrient, virtual void ThickOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA_ANGLE& aOrient,
int aWidth, void* aData ); int aWidth, void* aData );
virtual void ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, OUTLINE_MODE tracemode, void* aData ); virtual void ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, void* aData );
// Flash primitives // Flash primitives
/** /**
* @param aPadPos Position of the shape (center of the rectangle. * @param aPadPos Position of the shape (center of the rectangle.
* @param aDiameter is the diameter of round pad. * @param aDiameter is the diameter of round pad.
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData is an auxiliary info (mainly for gerber format attributes). * @param aData is an auxiliary info (mainly for gerber format attributes).
*/ */
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, void* aData ) = 0;
void* aData ) = 0;
/** /**
* @param aPadPos Position of the shape (center of the rectangle. * @param aPadPos Position of the shape (center of the rectangle.
* @param aSize is the size of oblong shape. * @param aSize is the size of oblong shape.
* @param aPadOrient The rotation of the shape. * @param aPadOrient The rotation of the shape.
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes). * @param aData an auxiliary info (mainly for gerber format attributes).
*/ */
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) = 0;
void* aData ) = 0;
/** /**
* @param aPadPos Position of the shape (center of the rectangle). * @param aPadPos Position of the shape (center of the rectangle).
* @param aSize is the size of rounded rect. * @param aSize is the size of rounded rect.
* @param aPadOrient The rotation of the shape. * @param aPadOrient The rotation of the shape.
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes). * @param aData an auxiliary info (mainly for gerber format attributes).
*/ */
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) = 0;
void* aData ) = 0;
/** /**
* @param aPadPos Position of the shape (center of the rectangle. * @param aPadPos Position of the shape (center of the rectangle.
* @param aSize is the size of rounded rect. * @param aSize is the size of rounded rect.
* @param aCornerRadius Radius of the rounded corners. * @param aCornerRadius Radius of the rounded corners.
* @param aOrient The rotation of the shape. * @param aOrient The rotation of the shape.
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes). * @param aData an auxiliary info (mainly for gerber format attributes).
*/ */
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient, int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) = 0; void* aData ) = 0;
/** /**
* @param aPadPos Position of the shape. * @param aPadPos Position of the shape.
* @param aSize is the size of round reference pad. * @param aSize is the size of round reference pad.
* @param aPadOrient is the pad rotation, used only with aperture macros (Gerber plotter). * @param aPadOrient is the pad rotation, used only with aperture macros (Gerber plotter).
* @param aPolygons the shape as polygon set. * @param aPolygons the shape as polygon set.
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes). * @param aData an auxiliary info (mainly for gerber format attributes).
*/ */
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, SHAPE_POLY_SET* aPolygons, const EDA_ANGLE& aPadOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) = 0; void* aData ) = 0;
/** /**
* Flash a trapezoidal pad. * Flash a trapezoidal pad.
@ -388,12 +390,10 @@ public:
* @param aCorners is the list of 4 corners positions, relative to the shape position, * @param aCorners is the list of 4 corners positions, relative to the shape position,
* pad orientation 0. * pad orientation 0.
* @param aPadOrient is the rotation of the shape. * @param aPadOrient is the rotation of the shape.
* @param aTraceMode is the drawing mode, FILLED or SKETCH.
* @param aData an auxiliary info (mainly for gerber format attributes). * @param aData an auxiliary info (mainly for gerber format attributes).
*/ */
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) = 0;
void* aData ) = 0;
/** /**
* Flash a regular polygon. Useful only in Gerber files to flash a regular polygon. * Flash a regular polygon. Useful only in Gerber files to flash a regular polygon.
@ -406,8 +406,7 @@ public:
* specific to the plotter. * specific to the plotter.
*/ */
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount, virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) = 0;
void* aData ) = 0;
/** /**
* Draw text with the plotter. * Draw text with the plotter.
@ -571,8 +570,7 @@ protected:
* Winding direction: counter-clockwise in right-down coordinate system. * Winding direction: counter-clockwise in right-down coordinate system.
*/ */
virtual void polyArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle, virtual void polyArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth );
int aWidth = USE_DEFAULT_LINE_WIDTH );
// These are marker subcomponents // These are marker subcomponents
/** /**

View File

@ -84,8 +84,7 @@ public:
/** /**
* DXF rectangle: fill not supported. * DXF rectangle: fill not supported.
*/ */
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
int width = USE_DEFAULT_LINE_WIDTH ) override;
/** /**
* DXF circle: full functionality; it even does 'fills' drawing a * DXF circle: full functionality; it even does 'fills' drawing a
@ -93,8 +92,7 @@ public:
* *
* I could use this trick to do other filled primitives. * I could use this trick to do other filled primitives.
*/ */
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle, virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth ) override; const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth ) override;
@ -107,9 +105,23 @@ public:
* are converted to inflated polygon by aWidth/2. * are converted to inflated polygon by aWidth/2.
*/ */
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override; int aWidth, void* aData = nullptr ) override;
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData ) override; void* aData ) override;
virtual void ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth,
void* aData ) override;
virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width,
void* aData ) override;
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData ) override;
virtual void FilledCircle( const VECTOR2I& pos, int diametre, void* aData ) override;
virtual void ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, void* aData ) override;
virtual void PenTo( const VECTOR2I& pos, char plume ) override; virtual void PenTo( const VECTOR2I& pos, char plume ) override;
@ -117,38 +129,33 @@ public:
* DXF round pad: always done in sketch mode; it could be filled but it isn't * DXF round pad: always done in sketch mode; it could be filled but it isn't
* pretty if other kinds of pad aren't... * pretty if other kinds of pad aren't...
*/ */
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre, virtual void FlashPadCircle( const VECTOR2I& pos, int diametre, void* aData ) override;
OUTLINE_MODE trace_mode, void* aData ) override;
/** /**
* DXF oval pad: always done in sketch mode. * DXF oval pad: always done in sketch mode.
*/ */
virtual void FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize, virtual void FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) override;
void* aData ) override;
/** /**
* DXF rectangular pad: always done in sketch mode. * DXF rectangular pad: always done in sketch mode.
*/ */
virtual void FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aSize, virtual void FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) override;
void* aData ) override;
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient, int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override; void* aData ) override;
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons, const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override; void* aData ) override;
/** /**
* DXF trapezoidal pad: only sketch mode is supported. * DXF trapezoidal pad: only sketch mode is supported.
*/ */
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) override;
void* aData ) override;
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount, virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) override;
void* aData ) override;
virtual void Text( const VECTOR2I& aPos, virtual void Text( const VECTOR2I& aPos,
const COLOR4D& aColor, const COLOR4D& aColor,

View File

@ -60,36 +60,33 @@ public:
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
// Basic plot primitives // Basic plot primitives
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
int width = USE_DEFAULT_LINE_WIDTH ) override; virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle, virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth ) override;
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
// These functions plot an item and manage X2 gerber attributes // These functions plot an item and manage X2 gerber attributes
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData ) override; void* aData ) override;
virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width,
OUTLINE_MODE tracemode, void* aData ) override; void* aData ) override;
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData ) override;
OUTLINE_MODE tracemode, void* aData ) override;
virtual void FilledCircle( const VECTOR2I& pos, int diametre, virtual void FilledCircle( const VECTOR2I& pos, int diametre, void* aData ) override;
OUTLINE_MODE tracemode, void* aData ) override;
virtual void ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, void* aData ) override;
/** /**
* Gerber polygon: they can (and *should*) be filled with the * Gerber polygon: they can (and *should*) be filled with the
* appropriate G36/G37 sequence * appropriate G36/G37 sequence
*/ */
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override; void* aData ) override;
virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int aWidth,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override; void* aData ) override;
/** /**
* Similar to PlotPoly(), plot a filled polygon using Gerber region, * Similar to PlotPoly(), plot a filled polygon using Gerber region,
@ -127,31 +124,26 @@ public:
/** /**
* Filled circular flashes are stored as apertures * Filled circular flashes are stored as apertures
*/ */
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre, virtual void FlashPadCircle( const VECTOR2I& pos, int diametre, void* aData ) override;
OUTLINE_MODE trace_mode, void* aData ) override;
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) override;
void* aData ) override;
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) override;
void* aData ) override;
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient, int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override; void* aData ) override;
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, SHAPE_POLY_SET* aPolygons, const EDA_ANGLE& aPadOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override; void* aData ) override;
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) override;
void* aData ) override;
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount, virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) override;
void* aData ) override;
/** /**
* Flash a chamfered round rect pad. * Flash a chamfered round rect pad.
@ -167,13 +159,11 @@ public:
* 4 = BOTTOM_LEFT * 4 = BOTTOM_LEFT
* 8 = BOTTOM_RIGHT * 8 = BOTTOM_RIGHT
* @param aPadOrient is the rotation of the shape. * @param aPadOrient is the rotation of the shape.
* @param aPlotMode is the drawing mode, FILLED or SKETCH.
* @param aData is the a reference to Gerber attributes descr. * @param aData is the a reference to Gerber attributes descr.
*/ */
void FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const VECTOR2I& aPadSize, void FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const VECTOR2I& aPadSize,
int aCornerRadius, double aChamferRatio, int aCornerRadius, double aChamferRatio, int aChamferPositions,
int aChamferPositions, const EDA_ANGLE& aPadOrient, const EDA_ANGLE& aPadOrient, void* aData );
OUTLINE_MODE aPlotMode, void* aData );
/** /**
* Plot a Gerber region: similar to PlotPoly but plot only filled polygon, * Plot a Gerber region: similar to PlotPoly but plot only filled polygon,
@ -269,8 +259,7 @@ public:
protected: protected:
virtual void ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle, virtual void ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth, const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData ) override;
OUTLINE_MODE aTraceMode, void* aData ) override;
/** /**
* Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs * Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs

View File

@ -62,26 +62,21 @@ public:
} }
// Pad routines are handled with lower level primitives // Pad routines are handled with lower level primitives
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, void* aData ) override;
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) override;
void* aData ) override;
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) override;
void* aData ) override;
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient, int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override; void* aData ) override;
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize, virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons, const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override; void* aData ) override;
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners, virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aPadOrient, void* aData ) override;
void* aData ) override;
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount, virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, const EDA_ANGLE& aOrient, void* aData ) override;
void* aData ) override;
/** /**
* The SetColor implementation is split with the subclasses: the PSLIKE computes the rgb * The SetColor implementation is split with the subclasses: the PSLIKE computes the rgb
@ -190,16 +185,13 @@ public:
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil, virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
int width = USE_DEFAULT_LINE_WIDTH ) override; virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle, virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth ) override;
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override; int aWidth, void* aData = nullptr ) override;
/** /**
* PostScript-likes at the moment are the only plot engines supporting bitmaps. * PostScript-likes at the moment are the only plot engines supporting bitmaps.
@ -323,21 +315,19 @@ public:
/** /**
* Rectangles in PDF. Supported by the native operator. * Rectangles in PDF. Supported by the native operator.
*/ */
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
int width = USE_DEFAULT_LINE_WIDTH ) override;
/** /**
* Circle drawing for PDF. They're approximated by curves, but fill is supported * Circle drawing for PDF. They're approximated by curves, but fill is supported
*/ */
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
int width = USE_DEFAULT_LINE_WIDTH ) override;
/** /**
* The PDF engine can't directly plot arcs so we use polygonization. * The PDF engine can't directly plot arcs so we use polygonization.
*/ */
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle, virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH ) override; int aWidth ) override;
/** /**
* Polygon plotting for PDF. Everything is supported * Polygon plotting for PDF. Everything is supported
@ -559,23 +549,20 @@ public:
*/ */
virtual void SetDash( int aLineWidth, LINE_STYLE aLineStyle ) override; virtual void SetDash( int aLineWidth, LINE_STYLE aLineStyle ) override;
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil, virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil, double aScale,
double aScale, bool aMirror ) override; bool aMirror ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
int width = USE_DEFAULT_LINE_WIDTH ) override; virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle, virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH ) override; int aWidth ) override;
virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1, virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
const VECTOR2I& aControl2, const VECTOR2I& aEnd, const VECTOR2I& aControl2, const VECTOR2I& aEnd,
int aTolerance, int aTolerance, int aLineThickness ) override;
int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = nullptr ) override; int aWidth, void * aData ) override;
/** /**
* PostScript-likes at the moment are the only plot engines supporting bitmaps. * PostScript-likes at the moment are the only plot engines supporting bitmaps.

View File

@ -476,10 +476,9 @@ void DIALOG_PLOT::transferPlotParamsToJob()
if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF ) if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF )
{ {
JOB_EXPORT_PCB_DXF* dxfJob = static_cast<JOB_EXPORT_PCB_DXF*>( m_job ); JOB_EXPORT_PCB_DXF* dxfJob = static_cast<JOB_EXPORT_PCB_DXF*>( m_job );
dxfJob->m_dxfUnits = m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH dxfJob->m_dxfUnits = m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH ? JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH
? JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH
: JOB_EXPORT_PCB_DXF::DXF_UNITS::MM; : JOB_EXPORT_PCB_DXF::DXF_UNITS::MM;
dxfJob->m_plotGraphicItemsUsingContours = m_plotOpts.GetPlotMode() == OUTLINE_MODE::SKETCH; dxfJob->m_plotGraphicItemsUsingContours = m_plotOpts.GetDXFPlotMode() == DXF_OUTLINE_MODE::SKETCH;
dxfJob->m_polygonMode = m_plotOpts.GetDXFPlotPolygonMode(); dxfJob->m_polygonMode = m_plotOpts.GetDXFPlotPolygonMode();
dxfJob->m_genMode = JOB_EXPORT_PCB_DXF::GEN_MODE::MULTI; dxfJob->m_genMode = JOB_EXPORT_PCB_DXF::GEN_MODE::MULTI;
} }

View File

@ -519,9 +519,11 @@ bool GENDRILL_WRITER_BASE::plotDrillMarks( PLOTTER* aPlotter )
aPlotter->Marker( hole.m_Hole_Pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 ); aPlotter->Marker( hole.m_Hole_Pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 );
if( hole.m_Hole_Shape != 0 ) if( hole.m_Hole_Shape != 0 )
{
aPlotter->ThickOval( hole.m_Hole_Pos, hole.m_Hole_Size, hole.m_Hole_Orient, aPlotter->ThickOval( hole.m_Hole_Pos, hole.m_Hole_Size, hole.m_Hole_Orient,
getSketchOvalBestPenSize(), nullptr ); getSketchOvalBestPenSize(), nullptr );
} }
}
aPlotter->SetCurrentLineWidth( PLOTTER::USE_DEFAULT_LINE_WIDTH ); aPlotter->SetCurrentLineWidth( PLOTTER::USE_DEFAULT_LINE_WIDTH );

View File

@ -304,7 +304,7 @@ int GERBER_WRITER::createProtectionFile( const wxString& aFullFilename, IPC4761_
gbr_metadata.SetApertureAttrib( attrib ); gbr_metadata.SetApertureAttrib( attrib );
plotter.FlashPadCircle( hole_descr.m_Hole_Pos, diameter, FILLED, &gbr_metadata ); plotter.FlashPadCircle( hole_descr.m_Hole_Pos, diameter, &gbr_metadata );
holes_count++; holes_count++;
} }
@ -418,7 +418,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
#if FLASH_OVAL_HOLE // set to 1 to use flashed oblong holes, #if FLASH_OVAL_HOLE // set to 1 to use flashed oblong holes,
// 0 to draw them as a line. // 0 to draw them as a line.
plotter.FlashPadOval( hole_pos, hole_descr.m_Hole_Size, hole_descr.m_Hole_Orient, plotter.FlashPadOval( hole_pos, hole_descr.m_Hole_Size, hole_descr.m_Hole_Orient,
FILLED, &gbr_metadata ); &gbr_metadata );
#else #else
// Use routing for oblong hole (Slots) // Use routing for oblong hole (Slots)
VECTOR2I start, end; VECTOR2I start, end;
@ -428,13 +428,13 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
if ( width == 0 ) if ( width == 0 )
continue; continue;
plotter.ThickSegment( start+hole_pos, end+hole_pos, width, FILLED, &gbr_metadata ); plotter.ThickSegment( start+hole_pos, end+hole_pos, width, &gbr_metadata );
#endif #endif
} }
else else
{ {
int diam = std::min( hole_descr.m_Hole_Size.x, hole_descr.m_Hole_Size.y ); int diam = std::min( hole_descr.m_Hole_Size.x, hole_descr.m_Hole_Size.y );
plotter.FlashPadCircle( hole_pos, diam, FILLED, &gbr_metadata ); plotter.FlashPadCircle( hole_pos, diam, &gbr_metadata );
} }
holes_count++; holes_count++;

View File

@ -174,7 +174,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( const wxString& aFullFilename, PCB
VECTOR2I flash_pos = footprint->GetPosition(); VECTOR2I flash_pos = footprint->GetPosition();
plotter.FlashPadCircle( flash_pos, flash_position_shape_diam, FILLED, &metadata ); plotter.FlashPadCircle( flash_pos, flash_position_shape_diam, &metadata );
metadata.m_NetlistMetadata.ClearExtraData(); metadata.m_NetlistMetadata.ClearExtraData();
// Now some extra metadata is output, avoid blindly clearing the full metadata list // Now some extra metadata is output, avoid blindly clearing the full metadata list
@ -245,7 +245,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( const wxString& aFullFilename, PCB
// Flashes a diamond at pad position: // Flashes a diamond at pad position:
plotter.FlashRegularPolygon( pad1->GetPosition(), pad1_mark_size, 4, ANGLE_0, plotter.FlashRegularPolygon( pad1->GetPosition(), pad1_mark_size, 4, ANGLE_0,
FILLED, &metadata ); &metadata );
} }
} }
@ -279,7 +279,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( const wxString& aFullFilename, PCB
metadata.SetPadPinFunction( pad->GetPinFunction(), allowUtf8, quoteOption ); metadata.SetPadPinFunction( pad->GetPinFunction(), allowUtf8, quoteOption );
// Flashes a round, 0 sized round shape at pad position // Flashes a round, 0 sized round shape at pad position
plotter.FlashPadCircle( pad->GetPosition(), other_pads_mark_size, FILLED, &metadata ); plotter.FlashPadCircle( pad->GetPosition(), other_pads_mark_size, &metadata );
} }
} }

View File

@ -70,7 +70,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_svgPrecision = SVG_PRECISION_DEFAULT; m_svgPrecision = SVG_PRECISION_DEFAULT;
m_svgFitPageToBoard = false; m_svgFitPageToBoard = false;
m_plotDrawingSheet = false; m_plotDrawingSheet = false;
m_plotMode = FILLED; m_DXFPlotMode = FILLED;
m_DXFPolygonMode = true; m_DXFPolygonMode = true;
m_DXFUnits = DXF_UNITS::INCH; m_DXFUnits = DXF_UNITS::INCH;
m_useAuxOrigin = false; m_useAuxOrigin = false;
@ -168,7 +168,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter ) const
aFormatter->Print( "(svgprecision %d)", m_svgPrecision ); aFormatter->Print( "(svgprecision %d)", m_svgPrecision );
KICAD_FORMAT::FormatBool( aFormatter, "plotframeref", m_plotDrawingSheet ); KICAD_FORMAT::FormatBool( aFormatter, "plotframeref", m_plotDrawingSheet );
aFormatter->Print( "(mode %d)", GetPlotMode() == SKETCH ? 2 : 1 ); aFormatter->Print( "(mode %d)", GetDXFPlotMode() == SKETCH ? 2 : 1 );
KICAD_FORMAT::FormatBool( aFormatter, "useauxorigin", m_useAuxOrigin ); KICAD_FORMAT::FormatBool( aFormatter, "useauxorigin", m_useAuxOrigin );
// PDF options // PDF options
@ -247,7 +247,7 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet ) if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet )
return false; return false;
if( m_plotMode != aPcbPlotParams.m_plotMode ) if( m_DXFPlotMode != aPcbPlotParams.m_DXFPlotMode )
return false; return false;
if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode ) if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode )

View File

@ -34,7 +34,7 @@ class PCB_PLOT_PARAMS_PARSER;
/** /**
* Parameters and options when plotting/printing a board. * Parameters and options when plotting/printing a board.
*/ */
class PCB_PLOT_PARAMS class PCB_PLOT_PARAMS : public PLOT_PARAMS
{ {
public: public:
PCB_PLOT_PARAMS(); PCB_PLOT_PARAMS();
@ -64,13 +64,13 @@ public:
m_textMode = aVal; m_textMode = aVal;
} }
PLOT_TEXT_MODE GetTextMode() const PLOT_TEXT_MODE GetTextMode() const override
{ {
return m_textMode; return m_textMode;
} }
void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; } void SetDXFPlotMode( DXF_OUTLINE_MODE aPlotMode ) { m_DXFPlotMode = aPlotMode; }
OUTLINE_MODE GetPlotMode() const { return m_plotMode; } DXF_OUTLINE_MODE GetDXFPlotMode() const override { return m_DXFPlotMode; }
void SetPlotPadNumbers( bool aFlag ) { m_plotPadNumbers = aFlag; } void SetPlotPadNumbers( bool aFlag ) { m_plotPadNumbers = aFlag; }
bool GetPlotPadNumbers() const { return m_plotPadNumbers; } bool GetPlotPadNumbers() const { return m_plotPadNumbers; }
@ -198,12 +198,11 @@ private:
LSEQ m_plotOnAllLayersSequence; LSEQ m_plotOnAllLayersSequence;
bool m_skipNPTH_Pads; /// Used to disable NPTH pads plotting on copper layers bool m_skipNPTH_Pads; /// Used to disable NPTH pads plotting on copper layers
OUTLINE_MODE m_plotMode; /// FILLED or SKETCH for filled objects.
bool m_plotPadNumbers; /// Plot pad numbers when sketching pads on fab layers bool m_plotPadNumbers; /// Plot pad numbers when sketching pads on fab layers
DRILL_MARKS m_drillMarks; /// Holes can be not plotted, have a small mark, or be DRILL_MARKS m_drillMarks; /// Holes can be not plotted, have a small mark, or be
/// plotted in actual size /// plotted in actual size
PLOT_TEXT_MODE m_textMode; PLOT_TEXT_MODE m_textMode;
DXF_OUTLINE_MODE m_DXFPlotMode; /// FILLED or SKETCH for filled objects.
DXF_UNITS m_DXFUnits; DXF_UNITS m_DXFUnits;
bool m_DXFPolygonMode; /// In polygon mode, each item to plot is converted to a bool m_DXFPolygonMode; /// In polygon mode, each item to plot is converted to a
/// polygon and all polygons are merged. /// polygon and all polygons are merged.

View File

@ -30,7 +30,6 @@
#include <wx/filename.h> #include <wx/filename.h>
#include <gerber_jobfile_writer.h> #include <gerber_jobfile_writer.h>
#include <jobs/job_export_pcb_gerbers.h> #include <jobs/job_export_pcb_gerbers.h>
#include <jobs/job_export_pcb_hpgl.h>
#include <jobs/job_export_pcb_dxf.h> #include <jobs/job_export_pcb_dxf.h>
#include <jobs/job_export_pcb_pdf.h> #include <jobs/job_export_pcb_pdf.h>
#include <jobs/job_export_pcb_plot.h> #include <jobs/job_export_pcb_plot.h>
@ -403,10 +402,8 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
JOB_EXPORT_PCB_DXF* dxfJob = static_cast<JOB_EXPORT_PCB_DXF*>( aJob ); JOB_EXPORT_PCB_DXF* dxfJob = static_cast<JOB_EXPORT_PCB_DXF*>( aJob );
aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH ? DXF_UNITS::INCH aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH ? DXF_UNITS::INCH
: DXF_UNITS::MM ); : DXF_UNITS::MM );
aOpts.SetDXFPlotMode( dxfJob->m_plotGraphicItemsUsingContours ? DXF_OUTLINE_MODE::SKETCH
aOpts.SetPlotMode( dxfJob->m_plotGraphicItemsUsingContours ? OUTLINE_MODE::SKETCH : DXF_OUTLINE_MODE::FILLED );
: OUTLINE_MODE::FILLED );
aOpts.SetDXFPlotPolygonMode( dxfJob->m_polygonMode ); aOpts.SetDXFPlotPolygonMode( dxfJob->m_polygonMode );
} }

View File

@ -102,7 +102,7 @@ public:
* although the plot mode is filled color and plot mode are needed by this function. * although the plot mode is filled color and plot mode are needed by this function.
*/ */
void PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLOR4D& aColor, void PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLOR4D& aColor,
OUTLINE_MODE aPlotMode ); bool aSketchMode );
void PlotPadNumber( const PAD* aPad, const COLOR4D& aColor ); void PlotPadNumber( const PAD* aPad, const COLOR4D& aColor );

View File

@ -347,7 +347,6 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
itemplotter.SetLayerSet( aLayerMask ); itemplotter.SetLayerSet( aLayerMask );
OUTLINE_MODE plotMode = aPlotOpt.GetPlotMode();
bool onCopperLayer = ( LSET::AllCuMask() & aLayerMask ).any(); bool onCopperLayer = ( LSET::AllCuMask() & aLayerMask ).any();
bool onSolderMaskLayer = ( LSET( { F_Mask, B_Mask } ) & aLayerMask ).any(); bool onSolderMaskLayer = ( LSET( { F_Mask, B_Mask } ) & aLayerMask ).any();
bool onSolderPasteLayer = ( LSET( { F_Paste, B_Paste } ) & aLayerMask ).any(); bool onSolderPasteLayer = ( LSET( { F_Paste, B_Paste } ) & aLayerMask ).any();
@ -374,15 +373,14 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
OUTLINE_MODE padPlotMode = plotMode; bool doSketchPads = false;
if( !( pad->GetLayerSet() & aLayerMask ).any() ) if( !( pad->GetLayerSet() & aLayerMask ).any() )
{ {
if( sketchPads && if( sketchPads && ( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) )
( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) ) || || ( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
{ {
padPlotMode = SKETCH; doSketchPads = true;
} }
else else
{ {
@ -420,8 +418,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
color = aPlotOpt.ColorSettings()->GetColor( B_Fab ); color = aPlotOpt.ColorSettings()->GetColor( B_Fab );
} }
if( sketchPads if( sketchPads && ( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) )
&& ( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) )
|| ( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) ) || ( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
{ {
if( aPlotOpt.GetPlotPadNumbers() ) if( aPlotOpt.GetPlotPadNumbers() )
@ -482,7 +479,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
break; break;
} }
itemplotter.PlotPad( pad, aLayer, color, padPlotMode ); itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
break; break;
case PAD_SHAPE::RECTANGLE: case PAD_SHAPE::RECTANGLE:
@ -494,7 +491,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
pad->SetRoundRectCornerRadius( aLayer, mask_clearance ); pad->SetRoundRectCornerRadius( aLayer, mask_clearance );
} }
itemplotter.PlotPad( pad, aLayer, color, padPlotMode ); itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
break; break;
case PAD_SHAPE::TRAPEZOID: case PAD_SHAPE::TRAPEZOID:
@ -505,7 +502,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
// we are using only margin.x as inflate/deflate value // we are using only margin.x as inflate/deflate value
if( mask_clearance == 0 ) if( mask_clearance == 0 )
{ {
itemplotter.PlotPad( pad, aLayer, color, padPlotMode ); itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
} }
else else
{ {
@ -536,7 +533,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
// polygonal shape is built, we can clamp the anchor size // polygonal shape is built, we can clamp the anchor size
dummy.SetSize( aLayer, VECTOR2I( 0, 0 ) ); dummy.SetSize( aLayer, VECTOR2I( 0, 0 ) );
itemplotter.PlotPad( &dummy, aLayer, color, padPlotMode ); itemplotter.PlotPad( &dummy, aLayer, color, doSketchPads );
} }
break; break;
@ -550,7 +547,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
pad->SetSize( aLayer, padPlotsSize ); pad->SetSize( aLayer, padPlotsSize );
pad->SetRoundRectRadiusRatio( aLayer, radius_ratio ); pad->SetRoundRectRadiusRatio( aLayer, radius_ratio );
itemplotter.PlotPad( pad, aLayer, color, padPlotMode ); itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
break; break;
} }
@ -559,7 +556,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
{ {
// the size can be slightly inflated by width_adj (PS/PDF only) // the size can be slightly inflated by width_adj (PS/PDF only)
pad->SetSize( aLayer, padPlotsSize ); pad->SetSize( aLayer, padPlotsSize );
itemplotter.PlotPad( pad, aLayer, color, padPlotMode ); itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
} }
else else
{ {
@ -594,7 +591,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
dummy.SetOffset( aLayer, pad->GetOffset( aLayer ) ); dummy.SetOffset( aLayer, pad->GetOffset( aLayer ) );
dummy.SetOrientation( pad->GetOrientation() ); dummy.SetOrientation( pad->GetOrientation() );
itemplotter.PlotPad( &dummy, aLayer, color, padPlotMode ); itemplotter.PlotPad( &dummy, aLayer, color, doSketchPads );
} }
break; break;
@ -625,7 +622,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
std::max( 0, padPlotsSize.y ) ) ); std::max( 0, padPlotsSize.y ) ) );
} }
itemplotter.PlotPad( &dummy, aLayer, color, padPlotMode ); itemplotter.PlotPad( &dummy, aLayer, color, doSketchPads );
break; break;
} }
} }
@ -650,10 +647,10 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
BOX2I rect = footprint->GetBoundingHull().BBox(); BOX2I rect = footprint->GetBoundingHull().BBox();
int width = aBoard->GetDesignSettings().m_LineThickness[ LAYER_CLASS_FAB ]; int width = aBoard->GetDesignSettings().m_LineThickness[ LAYER_CLASS_FAB ];
aPlotter->ThickSegment( rect.GetOrigin(), rect.GetEnd(), width, FILLED, nullptr ); aPlotter->ThickSegment( rect.GetOrigin(), rect.GetEnd(), width, nullptr );
aPlotter->ThickSegment( VECTOR2I( rect.GetLeft(), rect.GetBottom() ), aPlotter->ThickSegment( VECTOR2I( rect.GetLeft(), rect.GetBottom() ),
VECTOR2I( rect.GetRight(), rect.GetTop() ), VECTOR2I( rect.GetRight(), rect.GetTop() ),
width, FILLED, nullptr ); width, nullptr );
} }
aPlotter->EndBlock( nullptr ); aPlotter->EndBlock( nullptr );
@ -669,6 +666,17 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_NET ); gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_NET );
} }
auto getMetadata =
[&]() -> void*
{
if( aPlotter->GetPlotterType() == PLOT_FORMAT::DXF )
return (void*) &aPlotOpt;
else if( aPlotter->GetPlotterType() == PLOT_FORMAT::GERBER )
return &gbr_metadata;
else
return nullptr;
};
aPlotter->StartBlock( nullptr ); aPlotter->StartBlock( nullptr );
for( const PCB_TRACK* track : aBoard->Tracks() ) for( const PCB_TRACK* track : aBoard->Tracks() )
@ -729,7 +737,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
color = LIGHTGRAY; color = LIGHTGRAY;
aPlotter->SetColor( color ); aPlotter->SetColor( color );
aPlotter->FlashPadCircle( via->GetStart(), diameter, plotMode, &gbr_metadata ); aPlotter->FlashPadCircle( via->GetStart(), diameter, getMetadata() );
} }
aPlotter->EndBlock( nullptr ); aPlotter->EndBlock( nullptr );
@ -780,19 +788,17 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
if( !arc->IsDegenerated( 10 /* in IU */ ) ) if( !arc->IsDegenerated( 10 /* in IU */ ) )
{ {
aPlotter->ThickArc( arc->GetCenter(), arc->GetArcAngleStart(), arc->GetAngle(), aPlotter->ThickArc( arc->GetCenter(), arc->GetArcAngleStart(), arc->GetAngle(),
arc->GetRadius(), width, plotMode, &gbr_metadata ); arc->GetRadius(), width, getMetadata() );
} }
else else
{ {
// Approximate this very small arc by a segment. // Approximate this very small arc by a segment.
aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, plotMode, aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, getMetadata() );
&gbr_metadata );
} }
} }
else else
{ {
aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, plotMode, aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, getMetadata() );
&gbr_metadata );
} }
} }
@ -897,7 +903,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
drill = std::min( smallDrill, drill ); drill = std::min( smallDrill, drill );
aPlotter->ThickCircle( pad->ShapePos( layer ), drill, aPlotter->ThickCircle( pad->ShapePos( layer ), drill,
PLOTTER::USE_DEFAULT_LINE_WIDTH, FILLED, nullptr ); PLOTTER::USE_DEFAULT_LINE_WIDTH, nullptr );
} }
else else
{ {

View File

@ -147,7 +147,7 @@ void BRDITEMS_PLOTTER::PlotPadNumber( const PAD* aPad, const COLOR4D& aColor )
void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLOR4D& aColor, void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLOR4D& aColor,
OUTLINE_MODE aPlotMode ) bool aSketchMode )
{ {
VECTOR2I shape_pos = aPad->ShapePos( aLayer ); VECTOR2I shape_pos = aPad->ShapePos( aLayer );
GBR_METADATA metadata; GBR_METADATA metadata;
@ -276,19 +276,19 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
// the white items are not seen on a white paper or screen // the white items are not seen on a white paper or screen
m_plotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY ); m_plotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY );
if( aPlotMode == SKETCH ) if( aSketchMode )
{ {
switch( aPad->GetShape( aLayer ) ) switch( aPad->GetShape( aLayer ) )
{ {
case PAD_SHAPE::CIRCLE: case PAD_SHAPE::CIRCLE:
m_plotter->ThickCircle( shape_pos, aPad->GetSize( aLayer ).x, GetSketchPadLineWidth(), m_plotter->ThickCircle( shape_pos, aPad->GetSize( aLayer ).x, GetSketchPadLineWidth(),
FILLED, &metadata ); nullptr );
break; break;
case PAD_SHAPE::OVAL: case PAD_SHAPE::OVAL:
{ {
m_plotter->ThickOval( shape_pos, aPad->GetSize( aLayer ), aPad->GetOrientation(), m_plotter->ThickOval( shape_pos, aPad->GetSize( aLayer ), aPad->GetOrientation(),
GetSketchPadLineWidth(), &metadata ); GetSketchPadLineWidth(), nullptr );
break; break;
} }
@ -298,7 +298,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
m_plotter->ThickRect( VECTOR2I( shape_pos.x - ( size.x / 2 ), shape_pos.y - (size.y / 2 ) ), m_plotter->ThickRect( VECTOR2I( shape_pos.x - ( size.x / 2 ), shape_pos.y - (size.y / 2 ) ),
VECTOR2I( shape_pos.x + ( size.x / 2 ), shape_pos.y + (size.y / 2 ) ), VECTOR2I( shape_pos.x + ( size.x / 2 ), shape_pos.y + (size.y / 2 ) ),
GetSketchPadLineWidth(), FILLED, &metadata ); GetSketchPadLineWidth(), nullptr );
break; break;
} }
@ -311,7 +311,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
aPad->TransformShapeToPolygon( outline, aLayer, 0, m_plotter->GetPlotterArcHighDef(), aPad->TransformShapeToPolygon( outline, aLayer, 0, m_plotter->GetPlotterArcHighDef(),
ERROR_INSIDE, true ); ERROR_INSIDE, true );
m_plotter->ThickPoly( outline, GetSketchPadLineWidth(), FILLED, &metadata ); m_plotter->ThickPoly( outline, GetSketchPadLineWidth(), nullptr );
break; break;
} }
@ -325,24 +325,23 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
switch( aPad->GetShape( aLayer ) ) switch( aPad->GetShape( aLayer ) )
{ {
case PAD_SHAPE::CIRCLE: case PAD_SHAPE::CIRCLE:
m_plotter->FlashPadCircle( shape_pos, aPad->GetSize( aLayer ).x, m_plotter->FlashPadCircle( shape_pos, aPad->GetSize( aLayer ).x, &metadata );
aPlotMode, &metadata );
break; break;
case PAD_SHAPE::OVAL: case PAD_SHAPE::OVAL:
m_plotter->FlashPadOval( shape_pos, aPad->GetSize( aLayer ), m_plotter->FlashPadOval( shape_pos, aPad->GetSize( aLayer ),
aPad->GetOrientation(), aPlotMode, &metadata ); aPad->GetOrientation(), &metadata );
break; break;
case PAD_SHAPE::RECTANGLE: case PAD_SHAPE::RECTANGLE:
m_plotter->FlashPadRect( shape_pos, aPad->GetSize( aLayer ), m_plotter->FlashPadRect( shape_pos, aPad->GetSize( aLayer ),
aPad->GetOrientation(), aPlotMode, &metadata ); aPad->GetOrientation(), &metadata );
break; break;
case PAD_SHAPE::ROUNDRECT: case PAD_SHAPE::ROUNDRECT:
m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize( aLayer ), m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize( aLayer ),
aPad->GetRoundRectCornerRadius( aLayer ), aPad->GetRoundRectCornerRadius( aLayer ),
aPad->GetOrientation(), aPlotMode, &metadata ); aPad->GetOrientation(), &metadata );
break; break;
case PAD_SHAPE::TRAPEZOID: case PAD_SHAPE::TRAPEZOID:
@ -361,7 +360,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
coord[2] = VECTOR2I( half_size.x - trap_delta.y, -half_size.y + trap_delta.x ); coord[2] = VECTOR2I( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
coord[3] = VECTOR2I( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x ); coord[3] = VECTOR2I( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
m_plotter->FlashPadTrapez( shape_pos, coord, aPad->GetOrientation(), aPlotMode, &metadata ); m_plotter->FlashPadTrapez( shape_pos, coord, aPad->GetOrientation(), &metadata );
} }
break; break;
@ -370,12 +369,11 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
{ {
GERBER_PLOTTER* gerberPlotter = static_cast<GERBER_PLOTTER*>( m_plotter ); GERBER_PLOTTER* gerberPlotter = static_cast<GERBER_PLOTTER*>( m_plotter );
gerberPlotter->FlashPadChamferRoundRect( shape_pos, gerberPlotter->FlashPadChamferRoundRect( shape_pos, aPad->GetSize( aLayer ),
aPad->GetSize( aLayer ),
aPad->GetRoundRectCornerRadius( aLayer ), aPad->GetRoundRectCornerRadius( aLayer ),
aPad->GetChamferRectRatio( aLayer ), aPad->GetChamferRectRatio( aLayer ),
aPad->GetChamferPositions( aLayer ), aPad->GetOrientation(), aPad->GetChamferPositions( aLayer ),
aPlotMode, &metadata ); aPad->GetOrientation(), &metadata );
break; break;
} }
@ -390,7 +388,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
if( polygons->OutlineCount() ) if( polygons->OutlineCount() )
{ {
m_plotter->FlashPadCustom( shape_pos, aPad->GetSize( aLayer ), aPad->GetOrientation(), m_plotter->FlashPadCustom( shape_pos, aPad->GetSize( aLayer ), aPad->GetOrientation(),
polygons.get(), aPlotMode, &metadata ); polygons.get(), &metadata );
} }
} }
break; break;
@ -754,6 +752,17 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
if( IsCopperLayer( aLayer ) ) if( IsCopperLayer( aLayer ) )
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR ); gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
auto getMetadata =
[&]() -> void*
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF )
return this;
else if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
return &gbr_metadata;
else
return nullptr;
};
COLOR4D color = getColor( aLayer ); COLOR4D color = getColor( aLayer );
m_plotter->SetColor( color ); m_plotter->SetColor( color );
@ -783,7 +792,7 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
RotatePoint( start, text->GetDrawPos(), text->GetDrawRotation() ); RotatePoint( start, text->GetDrawPos(), text->GetDrawRotation() );
RotatePoint( end, text->GetDrawPos(), text->GetDrawRotation() ); RotatePoint( end, text->GetDrawPos(), text->GetDrawRotation() );
m_plotter->ThickSegment( start, end, attrs.m_StrokeWidth, FILLED, nullptr ); m_plotter->ThickSegment( start, end, attrs.m_StrokeWidth, getMetadata() );
}; };
if( aIsKnockout ) if( aIsKnockout )
@ -798,7 +807,7 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
finalPoly.Fracture(); finalPoly.Fracture();
for( int ii = 0; ii < finalPoly.OutlineCount(); ++ii ) for( int ii = 0; ii < finalPoly.OutlineCount(); ++ii )
m_plotter->PlotPoly( finalPoly.Outline( ii ), FILL_T::FILLED_SHAPE, 0, &gbr_metadata ); m_plotter->PlotPoly( finalPoly.Outline( ii ), FILL_T::FILLED_SHAPE, 0, getMetadata() );
} }
else else
{ {
@ -810,12 +819,12 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
// Stroke callback // Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 ) [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{ {
m_plotter->ThickSegment( aPt1, aPt2, attrs.m_StrokeWidth, FILLED, nullptr ); m_plotter->ThickSegment( aPt1, aPt2, attrs.m_StrokeWidth, getMetadata() );
}, },
// Polygon callback // Polygon callback
[&]( const SHAPE_LINE_CHAIN& aPoly ) [&]( const SHAPE_LINE_CHAIN& aPoly )
{ {
m_plotter->PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0, &gbr_metadata ); m_plotter->PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0, getMetadata() );
} ); } );
callback_gal.DrawGlyphs( *aText->GetRenderCache( font, shownText ) ); callback_gal.DrawGlyphs( *aText->GetRenderCache( font, shownText ) );
@ -832,8 +841,7 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxString& txt = strings_list.Item( ii ); wxString& txt = strings_list.Item( ii );
m_plotter->PlotText( positions[ii], color, txt, attrs, font, aFontMetrics, m_plotter->PlotText( positions[ii], color, txt, attrs, font, aFontMetrics, getMetadata() );
&gbr_metadata );
} }
if( aStrikeout && strings_list.Count() == 1 ) if( aStrikeout && strings_list.Count() == 1 )
@ -841,7 +849,7 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
} }
else else
{ {
m_plotter->PlotText( pos, color, shownText, attrs, font, aFontMetrics, &gbr_metadata ); m_plotter->PlotText( pos, color, shownText, attrs, font, aFontMetrics, getMetadata() );
if( aStrikeout ) if( aStrikeout )
strikeoutText( static_cast<const PCB_TEXT*>( aText ) ); strikeoutText( static_cast<const PCB_TEXT*>( aText ) );
@ -877,6 +885,17 @@ void BRDITEMS_PLOTTER::PlotZone( const ZONE* aZone, PCB_LAYER_ID aLayer,
} }
} }
auto getMetadata =
[&]() -> void*
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF )
return this;
else if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
return &gbr_metadata;
else
return nullptr;
};
m_plotter->SetColor( getColor( aLayer ) ); m_plotter->SetColor( getColor( aLayer ) );
m_plotter->StartBlock( nullptr ); // Clean current object attributes m_plotter->StartBlock( nullptr ); // Clean current object attributes
@ -890,21 +909,17 @@ void BRDITEMS_PLOTTER::PlotZone( const ZONE* aZone, PCB_LAYER_ID aLayer,
const SHAPE_LINE_CHAIN& outline = aPolysList.Outline( idx ); const SHAPE_LINE_CHAIN& outline = aPolysList.Outline( idx );
// Plot the current filled area (as region for Gerber plotter to manage attributes) // Plot the current filled area (as region for Gerber plotter to manage attributes)
if( GetPlotMode() == FILLED )
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER ) if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
{ {
static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( outline, static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( outline, &gbr_metadata );
&gbr_metadata ); }
else if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF && GetDXFPlotMode() == SKETCH )
{
m_plotter->SetCurrentLineWidth( PLOTTER::USE_DEFAULT_LINE_WIDTH );
} }
else else
{ {
m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, &gbr_metadata ); m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, getMetadata() );
}
}
else
{
m_plotter->SetCurrentLineWidth( -1 );
} }
} }
@ -987,13 +1002,23 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
} }
} }
auto getMetadata =
[&]() -> void*
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF )
return this;
else if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
return &gbr_metadata;
else
return nullptr;
};
if( lineStyle <= LINE_STYLE::FIRST_TYPE ) if( lineStyle <= LINE_STYLE::FIRST_TYPE )
{ {
switch( aShape->GetShape() ) switch( aShape->GetShape() )
{ {
case SHAPE_T::SEGMENT: case SHAPE_T::SEGMENT:
m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(), m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, getMetadata() );
&gbr_metadata );
break; break;
case SHAPE_T::CIRCLE: case SHAPE_T::CIRCLE:
@ -1007,12 +1032,12 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
diameter = std::max( diameter, 0 ); diameter = std::max( diameter, 0 );
} }
m_plotter->FilledCircle( aShape->GetStart(), diameter, GetPlotMode(), &gbr_metadata ); m_plotter->FilledCircle( aShape->GetStart(), diameter, getMetadata() );
} }
else else
{ {
m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness, m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness,
GetPlotMode(), &gbr_metadata ); getMetadata() );
} }
break; break;
@ -1024,11 +1049,11 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
if( std::abs( aShape->GetArcAngle().AsDegrees() ) == 360.0 ) if( std::abs( aShape->GetArcAngle().AsDegrees() ) == 360.0 )
{ {
m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness, m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness,
GetPlotMode(), &gbr_metadata ); getMetadata() );
} }
else else
{ {
m_plotter->ThickArc( *aShape, GetPlotMode(), &gbr_metadata, thickness ); m_plotter->ThickArc( *aShape, getMetadata(), thickness );
} }
break; break;
@ -1042,9 +1067,9 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
case SHAPE_T::POLY: case SHAPE_T::POLY:
if( aShape->IsPolyShapeValid() ) if( aShape->IsPolyShapeValid() )
{ {
if( GetPlotMode() == SKETCH ) if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF && GetDXFPlotMode() == SKETCH )
{ {
m_plotter->ThickPoly( aShape->GetPolyShape(), thickness, GetPlotMode(), &gbr_metadata ); m_plotter->ThickPoly( aShape->GetPolyShape(), thickness, getMetadata() );
} }
else else
{ {
@ -1082,7 +1107,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
} }
else else
{ {
m_plotter->PlotPoly( poly, fill, thickness, &gbr_metadata ); m_plotter->PlotPoly( poly, fill, thickness, getMetadata() );
} }
} }
} }
@ -1094,9 +1119,9 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
{ {
std::vector<VECTOR2I> pts = aShape->GetRectCorners(); std::vector<VECTOR2I> pts = aShape->GetRectCorners();
if( GetPlotMode() == SKETCH ) if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF && GetDXFPlotMode() == SKETCH )
{ {
m_plotter->ThickRect( pts[0], pts[2], thickness, GetPlotMode(), &gbr_metadata ); m_plotter->ThickRect( pts[0], pts[2], thickness, getMetadata() );
} }
else else
{ {
@ -1124,7 +1149,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
} }
else else
{ {
m_plotter->PlotPoly( poly.COutline( 0 ), fill_mode, thickness, &gbr_metadata ); m_plotter->PlotPoly( poly.COutline( 0 ), fill_mode, thickness, getMetadata() );
} }
} }
} }
@ -1146,8 +1171,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
m_plotter->RenderSettings(), m_plotter->RenderSettings(),
[&]( const VECTOR2I& a, const VECTOR2I& b ) [&]( const VECTOR2I& a, const VECTOR2I& b )
{ {
m_plotter->ThickSegment( a, b, thickness, GetPlotMode(), m_plotter->ThickSegment( a, b, thickness, getMetadata() );
&gbr_metadata );
} ); } );
} }
@ -1168,7 +1192,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
else else
{ {
m_plotter->PlotPoly( aShape->GetHatching().Outline( ii ), FILL_T::FILLED_SHAPE, m_plotter->PlotPoly( aShape->GetHatching().Outline( ii ), FILL_T::FILLED_SHAPE,
0, &gbr_metadata ); 0, getMetadata() );
} }
} }
} }
@ -1188,6 +1212,17 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP ); gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
} }
auto getMetadata =
[&]() -> void*
{
if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF )
return this;
else if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
return &gbr_metadata;
else
return nullptr;
};
aTable->DrawBorders( aTable->DrawBorders(
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB, const STROKE_PARAMS& stroke ) [&]( const VECTOR2I& ptA, const VECTOR2I& ptB, const STROKE_PARAMS& stroke )
{ {
@ -1196,7 +1231,7 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
if( lineStyle <= LINE_STYLE::FIRST_TYPE ) if( lineStyle <= LINE_STYLE::FIRST_TYPE )
{ {
m_plotter->ThickSegment( ptA, ptB, lineWidth, GetPlotMode(), &gbr_metadata ); m_plotter->ThickSegment( ptA, ptB, lineWidth, getMetadata() );
} }
else else
{ {
@ -1205,8 +1240,7 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
STROKE_PARAMS::Stroke( &seg, lineStyle, lineWidth, m_plotter->RenderSettings(), STROKE_PARAMS::Stroke( &seg, lineStyle, lineWidth, m_plotter->RenderSettings(),
[&]( const VECTOR2I& a, const VECTOR2I& b ) [&]( const VECTOR2I& a, const VECTOR2I& b )
{ {
m_plotter->ThickSegment( a, b, lineWidth, GetPlotMode(), m_plotter->ThickSegment( a, b, lineWidth, getMetadata() );
&gbr_metadata );
} ); } );
} }
} ); } );
@ -1232,11 +1266,11 @@ void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE aDrillShape, const VECT
drillSize.y -= getFineWidthAdj(); drillSize.y -= getFineWidthAdj();
drillSize.y = std::clamp( drillSize.y, 1, aPadSize.y - 1 ); drillSize.y = std::clamp( drillSize.y, 1, aPadSize.y - 1 );
m_plotter->FlashPadOval( aDrillPos, drillSize, aOrientation, GetPlotMode(), nullptr ); m_plotter->FlashPadOval( aDrillPos, drillSize, aOrientation, nullptr );
} }
else else
{ {
m_plotter->FlashPadCircle( aDrillPos, drillSize.x, GetPlotMode(), nullptr ); m_plotter->FlashPadCircle( aDrillPos, drillSize.x, nullptr );
} }
} }
@ -1249,8 +1283,8 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
if( GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE ) if( GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE )
smallDrill = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ); smallDrill = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize );
/* In the filled trace mode drill marks are drawn white-on-black to knock-out the underlying /* Drill marks are drawn white-on-black to knock-out the underlying pad. This works only
pad. This works only for drivers supporting color change, obviously... it means that: * for drivers supporting color change, obviously... it means that:
- PS, SVG and PDF output is correct (i.e. you have a 'donut' pad) - PS, SVG and PDF output is correct (i.e. you have a 'donut' pad)
- In gerbers you can't see them, too. This is arguably the right thing to do since having - In gerbers you can't see them, too. This is arguably the right thing to do since having
drill marks and high speed drill stations is a sure recipe for broken tools and angry drill marks and high speed drill stations is a sure recipe for broken tools and angry
@ -1258,7 +1292,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
to knock-out the film. to knock-out the film.
- In DXF they go into the 'WHITE' layer. This could be useful. - In DXF they go into the 'WHITE' layer. This could be useful.
*/ */
if( GetPlotMode() == FILLED && onCopperLayer ) if( onCopperLayer && ( m_plotter->GetPlotterType() != PLOT_FORMAT::DXF || GetDXFPlotMode() == FILLED ) )
m_plotter->SetColor( WHITE ); m_plotter->SetColor( WHITE );
for( PCB_TRACK* track : m_board->Tracks() ) for( PCB_TRACK* track : m_board->Tracks() )
@ -1290,6 +1324,6 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
} }
} }
if( GetPlotMode() == FILLED && onCopperLayer ) if( onCopperLayer && ( m_plotter->GetPlotterType() != PLOT_FORMAT::DXF || GetDXFPlotMode() == FILLED ) )
m_plotter->SetColor( BLACK ); m_plotter->SetColor( BLACK );
} }