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 )
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,
const COLOR4D& aColor, OUTLINE_MODE aFillMode )
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor )
{
if( IsMultilineAllowed() )
{
@ -890,12 +889,11 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
GetLinePositions( positions, (int) strings.Count() );
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
{
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText( true ),
GetDrawPos() );
printOneLineOfText( aSettings, aOffset, aColor, GetShownText( true ), 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,
const COLOR4D& aColor, OUTLINE_MODE aFillMode,
const wxString& aText, const VECTOR2I& aPos )
const COLOR4D& aColor, const wxString& aText, const VECTOR2I& aPos )
{
wxDC* DC = aSettings->GetPrintDC();
int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
if( aFillMode == SKETCH )
penWidth = -penWidth;
VECTOR2I size = GetTextSize();
if( IsMirrored() )

View File

@ -38,6 +38,9 @@
*/
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.
*
@ -524,7 +527,7 @@ void DXF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
unsigned last = aCornerList.size() - 1;
// Plot outlines with lines (thickness = 0) to define the polygon
if( aWidth <= 0 )
if( aWidth <= 0 || aFill == FILL_T::NO_FILL )
{
MoveTo( aCornerList[0] );
@ -539,18 +542,6 @@ void DXF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
}
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;
}
@ -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,
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,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData )
const EDA_ANGLE& aOrient, void* aData )
{
wxASSERT( m_outputFile );
@ -732,20 +812,19 @@ void DXF_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
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,
OUTLINE_MODE trace_mode, void* aData )
void DXF_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, void* aData )
{
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,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData )
const EDA_ANGLE& aOrient, void* aData )
{
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,
int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData )
int aCornerRadius, const EDA_ANGLE& aOrient, void* aData )
{
SHAPE_POLY_SET outline;
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,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData )
void* aData )
{
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,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData )
const EDA_ANGLE& aPadOrient, void* aData )
{
wxASSERT( m_outputFile );
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,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData )
const EDA_ANGLE& aOrient, void* aData )
{
// Do nothing
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_CENTER: h_code = 1; break;
case GR_TEXT_H_ALIGN_RIGHT: h_code = 2; break;
case GR_TEXT_H_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
case GR_TEXT_H_ALIGN_INDETERMINATE: wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) ); break;
}
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_CENTER: v_code = 2; break;
case GR_TEXT_V_ALIGN_BOTTOM: v_code = 1; break;
case GR_TEXT_V_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
case GR_TEXT_V_ALIGN_INDETERMINATE: wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) ); break;
}
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( 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,
OUTLINE_MODE tracemode, void* aData )
void GERBER_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void* aData )
{
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
SetCurrentLineWidth( width, gbr_metadata );
if( gbr_metadata )
if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
MoveTo( start );
FinishTo( end );
SetCurrentLineWidth( width, aData );
PLOTTER::ThickSegment( start, end, DO_NOT_SET_LINE_WIDTH, aData );
}
void GERBER_PLOTTER::ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth,
OUTLINE_MODE aTraceMode, void* aData )
const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData )
{
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
SetCurrentLineWidth( aWidth, gbr_metadata );
if( gbr_metadata )
if( GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
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,
OUTLINE_MODE tracemode, void* aData )
void GERBER_PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void* aData )
{
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
SetCurrentLineWidth( width, gbr_metadata );
if( gbr_metadata )
if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
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,
OUTLINE_MODE tracemode, void* aData )
void GERBER_PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData )
{
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
SetCurrentLineWidth( width, gbr_metadata );
if( gbr_metadata )
if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
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,
OUTLINE_MODE tracemode, void* aData )
void GERBER_PLOTTER::FilledCircle( const VECTOR2I& pos, int diametre, void* aData )
{
// A filled circle is a graphic item, not a pad.
// So it is drawn, not flashed.
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
if( gbr_metadata )
if( GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData ) )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
// Draw a circle of diameter = diameter/2 with a line thickness = radius,
// 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 );
}
void GERBER_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE trace_mode,
void* aData )
void GERBER_PLOTTER::ThickPoly( const SHAPE_POLY_SET& aPoly, int aWidth, 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 );
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,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode, void* aData )
const EDA_ANGLE& aOrient, void* aData )
{
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)
// In gerber file, it will be drawn as a region with arcs, and can be
// detected as pads (similar to a flashed pad)
FlashPadRoundRect( aPos, aSize, std::min( aSize.x, aSize.y ) / 2, orient, aTraceMode,
aData );
FlashPadRoundRect( aPos, aSize, std::min( aSize.x, aSize.y ) / 2, orient, aData );
}
}
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 );
@ -1363,15 +1354,14 @@ void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize,
coord[3].x = size.x/2; // lower right
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,
int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData )
int aCornerRadius, const EDA_ANGLE& aOrient, void* 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,
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).
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,
int aCornerRadius, double aChamferRatio,
int aChamferPositions, const EDA_ANGLE& aPadOrient,
OUTLINE_MODE aPlotMode, void* aData )
void* aData )
{
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,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData )
const EDA_ANGLE& aPadOrient, void* aData )
{
// polygon corners list
std::vector<VECTOR2I> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
@ -1748,9 +1734,9 @@ void GERBER_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
metadata = *gbr_metadata;
// Plot a filled polygon:
#ifdef GBR_USE_MACROS_FOR_TRAPEZOID
#ifdef GBR_USE_MACROS_FOR_TRAPEZOID
if( !m_gerberDisableApertMacros )
#endif
#endif
{
m_hasApertureOutline4P = true;
VECTOR2D pos_dev = userToDeviceCoordinates( aPadPos );
@ -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] };
int aperture_attribute = 0;
std::string custom_attribute = "";
if( gbr_metadata )
{
aperture_attribute = gbr_metadata->GetApertureAttrib();
custom_attribute = gbr_metadata->GetCustomAttribute();
}
selectAperture( corners, aPadOrient, APERTURE::APER_MACRO_OUTLINE4P, aperture_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,
int aCornerCount, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData )
void* aData )
{
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
@ -1789,38 +1777,14 @@ void GERBER_PLOTTER::FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiamet
if( gbr_metadata )
metadata = *gbr_metadata;
if( aTraceMode == SKETCH )
{
// Build the polygon:
std::vector<VECTOR2I> cornerList;
APERTURE::APERTURE_TYPE apert_type =
( APERTURE::APERTURE_TYPE )( APERTURE::AT_REGULAR_POLY3 + aCornerCount - 3 );
EDA_ANGLE angle_delta = ANGLE_360 / aCornerCount;
wxASSERT( apert_type >= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY3
&& apert_type <= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY12 );
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 )( APERTURE::AT_REGULAR_POLY3 + aCornerCount - 3 );
wxASSERT( apert_type >= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY3
&& apert_type <= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY12 );
selectApertureWithAttributes( aShapePos, gbr_metadata, VECTOR2I( 0, 0 ), aDiameter / 2,
aOrient, apert_type );
}
selectApertureWithAttributes( aShapePos, gbr_metadata, VECTOR2I( 0, 0 ), aDiameter / 2,
aOrient, apert_type );
}

View File

@ -90,8 +90,7 @@ void PSLIKE_PLOTTER::SetColor( const COLOR4D& color )
void PSLIKE_PLOTTER::FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData )
const EDA_ANGLE& aPadOrient, void* aData )
{
wxASSERT( m_outputFile );
@ -112,22 +111,18 @@ void PSLIKE_PLOTTER::FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSiz
RotatePoint( a, 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,
OUTLINE_MODE aTraceMode, void* aData )
void PSLIKE_PLOTTER::FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, void* aData )
{
Circle( aPadPos, aDiameter, FILL_T::FILLED_SHAPE, 0 );
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
}
void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData )
const EDA_ANGLE& aPadOrient, void* aData )
{
std::vector<VECTOR2I> cornerList;
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,
int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData )
int aCornerRadius, const EDA_ANGLE& aOrient, void* aData )
{
SHAPE_POLY_SET outline;
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,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData )
void* aData )
{
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,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData )
const EDA_ANGLE& aPadOrient, void* aData )
{
static std::vector<VECTOR2I> cornerList;
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,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData )
const EDA_ANGLE& aOrient, void* aData )
{
// Do nothing
wxASSERT( 0 );

View File

@ -535,64 +535,29 @@ void PLOTTER::ThickOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA_
}
void PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData )
void PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void* aData )
{
if( tracemode == FILLED )
if( start == end )
{
if( start == end )
{
Circle( start, width, FILL_T::FILLED_SHAPE, 0 );
}
else
{
SetCurrentLineWidth( width );
MoveTo( start );
FinishTo( end );
}
Circle( start, width, FILL_T::FILLED_SHAPE, 0 );
}
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 );
SetCurrentLineWidth( width );
MoveTo( start );
FinishTo( end );
}
}
void PLOTTER::ThickArc( const VECTOR2D& centre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth,
OUTLINE_MODE aTraceMode, void* aData )
const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData )
{
if( aTraceMode == FILLED )
{
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 );
}
Arc( centre, aStartAngle, aAngle, aRadius, FILL_T::NO_FILL, aWidth );
}
void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, void* aData,
int aWidth )
void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, void* aData, int aWidth )
{
VECTOR2D center = aArcShape.getCenter();
VECTOR2D mid = aArcShape.GetArcMid();
@ -613,82 +578,31 @@ void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, voi
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,
OUTLINE_MODE tracemode, void* aData )
void PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void* aData )
{
if( tracemode == FILLED )
{
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 );
}
Rect( p1, p2, FILL_T::NO_FILL, width );
}
void PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, OUTLINE_MODE tracemode,
void* aData )
void PLOTTER::ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData )
{
if( tracemode == FILLED )
{
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 );
}
Circle( pos, diametre, FILL_T::NO_FILL, 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 );
}
else
{
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
Circle( pos, diametre, FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
}
Circle( pos, diametre, FILL_T::FILLED_SHAPE, 0 );
}
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 );
}

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
%{
#include <outline_mode.h>
#include <macros_swig.h>
#include <kiid.h>
#include <cstddef>
@ -121,7 +120,6 @@ principle should be easily implemented by adapting the current STL containers.
// header files that must be wrapped
%include <outline_mode.h>
%include macros_swig.h
%include kiid.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();
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 )
{
@ -1337,7 +1337,7 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
aPlotter->PenFinish();
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
{

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->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr );
aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, nullptr );
aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
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 );
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 ),
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
strokeWidth, FILLED, nullptr );
strokeWidth, nullptr );
}

View File

@ -28,7 +28,6 @@
#include <memory>
#include <vector>
#include <outline_mode.h>
#include <eda_search_data.h>
#include <font/glyph.h>
#include <font/text_attributes.h>
@ -286,10 +285,8 @@ public:
* @param aDC the current Device Context.
* @param aOffset draw offset (usually (0,0)).
* @param aColor text color.
* @param aDisplay_mode #FILLED or #SKETCH.
*/
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor,
OUTLINE_MODE aDisplay_mode = FILLED );
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor );
/**
* 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 aColor text color.
* @param aFillMode FILLED or SKETCH
* @param aText the single line of text to draw.
* @param aPos the position of this line ).
*/
void printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
const COLOR4D& aColor, OUTLINE_MODE aFillMode, const wxString& aText,
const VECTOR2I& aPos );
const COLOR4D& aColor, const wxString& aText, const VECTOR2I& aPos );
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_draw_frame.h>
#include <outline_mode.h>
#include <lib_id.h>
#include <pcb_display_options.h>
#include <pcb_draw_panel_gal.h>

View File

@ -30,7 +30,6 @@
#include <math/box2.h>
#include <gr_text.h>
#include <page_info.h>
#include <outline_mode.h>
#include <gal/color4d.h>
#include <stroke_params.h>
#include <render_settings.h>
@ -74,6 +73,15 @@ enum class PLOT_FORMAT
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.
*
@ -95,6 +103,14 @@ enum class PLOT_TEXT_MODE
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
* 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 );
// Higher level primitives -- can be drawn as line, sketch or 'filled'
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode, void* aData );
virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width, void* aData );
virtual void ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, void* aData,
int aWidth );
virtual void ThickArc( const EDA_SHAPE& aArcShape, void* aData, int aWidth );
virtual void ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth,
OUTLINE_MODE aTraceMode, void* aData );
const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData );
virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width,
OUTLINE_MODE tracemode, void* aData );
virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, void* aData );
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, OUTLINE_MODE tracemode,
void* aData );
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData );
virtual void FilledCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE tracemode,
void* aData );
virtual void FilledCircle( const VECTOR2I& pos, int diametre, void* aData );
virtual void ThickOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA_ANGLE& aOrient,
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
/**
* @param aPadPos Position of the shape (center of the rectangle.
* @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).
*/
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, OUTLINE_MODE aTraceMode,
void* aData ) = 0;
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, void* aData ) = 0;
/**
* @param aPadPos Position of the shape (center of the rectangle.
* @param aSize is the size of oblong 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).
*/
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) = 0;
const EDA_ANGLE& aPadOrient, void* aData ) = 0;
/**
* @param aPadPos Position of the shape (center of the rectangle).
* @param aSize is the size of rounded rect.
* @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).
*/
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) = 0;
const EDA_ANGLE& aPadOrient, void* aData ) = 0;
/**
* @param aPadPos Position of the shape (center of the rectangle.
* @param aSize is the size of rounded rect.
* @param aCornerRadius Radius of the rounded corners.
* @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).
*/
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) = 0;
void* aData ) = 0;
/**
* @param aPadPos Position of the shape.
* @param aSize is the size of round reference pad.
* @param aPadOrient is the pad rotation, used only with aperture macros (Gerber plotter).
* @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).
*/
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) = 0;
void* aData ) = 0;
/**
* Flash a trapezoidal pad.
@ -388,12 +390,10 @@ public:
* @param aCorners is the list of 4 corners positions, relative to the shape position,
* pad orientation 0.
* @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).
*/
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) = 0;
const EDA_ANGLE& aPadOrient, void* aData ) = 0;
/**
* Flash a regular polygon. Useful only in Gerber files to flash a regular polygon.
@ -406,8 +406,7 @@ public:
* specific to the plotter.
*/
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) = 0;
const EDA_ANGLE& aOrient, void* aData ) = 0;
/**
* Draw text with the plotter.
@ -571,8 +570,7 @@ protected:
* Winding direction: counter-clockwise in right-down coordinate system.
*/
virtual void polyArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH );
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth );
// These are marker subcomponents
/**

View File

@ -84,8 +84,7 @@ public:
/**
* DXF rectangle: fill not supported.
*/
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
/**
* 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.
*/
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
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.
*/
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,
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;
@ -117,38 +129,33 @@ public:
* DXF round pad: always done in sketch mode; it could be filled but it isn't
* pretty if other kinds of pad aren't...
*/
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE trace_mode, void* aData ) override;
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre, void* aData ) override;
/**
* DXF oval pad: always done in sketch mode.
*/
virtual void FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aOrient, void* aData ) override;
/**
* DXF rectangular pad: always done in sketch mode.
*/
virtual void FlashPadRect( const VECTOR2I& aPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aOrient, void* aData ) override;
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
void* aData ) override;
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
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.
*/
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aPadOrient, void* aData ) override;
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aOrient, void* aData ) override;
virtual void Text( const VECTOR2I& aPos,
const COLOR4D& aColor,

View File

@ -60,36 +60,33 @@ public:
double aScale, bool aMirror ) override;
// Basic plot primitives
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth ) override;
// These functions plot an item and manage X2 gerber attributes
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,
OUTLINE_MODE tracemode, void* aData ) override;
void* aData ) override;
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width,
OUTLINE_MODE tracemode, void* aData ) override;
virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, void* aData ) override;
virtual void FilledCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE tracemode, 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;
/**
* Gerber polygon: they can (and *should*) be filled with the
* appropriate G36/G37 sequence
*/
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
void* aData ) override;
virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int aWidth,
void* aData ) override;
/**
* Similar to PlotPoly(), plot a filled polygon using Gerber region,
@ -127,31 +124,26 @@ public:
/**
* Filled circular flashes are stored as apertures
*/
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre,
OUTLINE_MODE trace_mode, void* aData ) override;
virtual void FlashPadCircle( const VECTOR2I& pos, int diametre, void* aData ) override;
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aOrient, void* aData ) override;
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aOrient, void* aData ) override;
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
void* aData ) override;
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, void* aData ) override;
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aOrient, void* aData ) override;
/**
* Flash a chamfered round rect pad.
@ -167,13 +159,11 @@ public:
* 4 = BOTTOM_LEFT
* 8 = BOTTOM_RIGHT
* @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.
*/
void FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const VECTOR2I& aPadSize,
int aCornerRadius, double aChamferRatio,
int aChamferPositions, const EDA_ANGLE& aPadOrient,
OUTLINE_MODE aPlotMode, void* aData );
int aCornerRadius, double aChamferRatio, int aChamferPositions,
const EDA_ANGLE& aPadOrient, void* aData );
/**
* Plot a Gerber region: similar to PlotPoly but plot only filled polygon,
@ -269,8 +259,7 @@ public:
protected:
virtual void ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, int aWidth,
OUTLINE_MODE aTraceMode, void* aData ) override;
const EDA_ANGLE& aAngle, double aRadius, int aWidth, void* aData ) override;
/**
* 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
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, void* aData ) override;
virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aPadOrient, void* aData ) override;
virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aPadOrient, void* aData ) override;
virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
int aCornerRadius, const EDA_ANGLE& aOrient,
OUTLINE_MODE aTraceMode, void* aData ) override;
void* aData ) override;
virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
OUTLINE_MODE aTraceMode, void* aData ) override;
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
const EDA_ANGLE& aPadOrient, void* aData ) override;
virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
void* aData ) override;
const EDA_ANGLE& aOrient, void* aData ) override;
/**
* 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,
double aScale, bool aMirror ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill, int aWidth ) override;
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.
@ -323,21 +315,19 @@ public:
/**
* Rectangles in PDF. Supported by the native operator.
*/
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
/**
* Circle drawing for PDF. They're approximated by curves, but fill is supported
*/
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
/**
* The PDF engine can't directly plot arcs so we use polygonization.
*/
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
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
@ -559,23 +549,20 @@ public:
*/
virtual void SetDash( int aLineWidth, LINE_STYLE aLineStyle ) override;
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil, double aScale,
bool aMirror ) override;
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) override;
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) override;
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
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,
const VECTOR2I& aControl2, const VECTOR2I& aEnd,
int aTolerance,
int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
int aTolerance, int aLineThickness ) override;
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.

View File

@ -476,10 +476,9 @@ void DIALOG_PLOT::transferPlotParamsToJob()
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 );
dxfJob->m_dxfUnits = m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH
? JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH
: JOB_EXPORT_PCB_DXF::DXF_UNITS::MM;
dxfJob->m_plotGraphicItemsUsingContours = m_plotOpts.GetPlotMode() == OUTLINE_MODE::SKETCH;
dxfJob->m_dxfUnits = m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH ? JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH
: JOB_EXPORT_PCB_DXF::DXF_UNITS::MM;
dxfJob->m_plotGraphicItemsUsingContours = m_plotOpts.GetDXFPlotMode() == DXF_OUTLINE_MODE::SKETCH;
dxfJob->m_polygonMode = m_plotOpts.GetDXFPlotPolygonMode();
dxfJob->m_genMode = JOB_EXPORT_PCB_DXF::GEN_MODE::MULTI;
}

View File

@ -519,8 +519,10 @@ bool GENDRILL_WRITER_BASE::plotDrillMarks( PLOTTER* aPlotter )
aPlotter->Marker( hole.m_Hole_Pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 );
if( hole.m_Hole_Shape != 0 )
{
aPlotter->ThickOval( hole.m_Hole_Pos, hole.m_Hole_Size, hole.m_Hole_Orient,
getSketchOvalBestPenSize(), nullptr );
}
}
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 );
plotter.FlashPadCircle( hole_descr.m_Hole_Pos, diameter, FILLED, &gbr_metadata );
plotter.FlashPadCircle( hole_descr.m_Hole_Pos, diameter, &gbr_metadata );
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,
// 0 to draw them as a line.
plotter.FlashPadOval( hole_pos, hole_descr.m_Hole_Size, hole_descr.m_Hole_Orient,
FILLED, &gbr_metadata );
&gbr_metadata );
#else
// Use routing for oblong hole (Slots)
VECTOR2I start, end;
@ -428,13 +428,13 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
if ( width == 0 )
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
}
else
{
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++;

View File

@ -174,7 +174,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( const wxString& aFullFilename, PCB
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();
// 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:
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 );
// 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_svgFitPageToBoard = false;
m_plotDrawingSheet = false;
m_plotMode = FILLED;
m_DXFPlotMode = FILLED;
m_DXFPolygonMode = true;
m_DXFUnits = DXF_UNITS::INCH;
m_useAuxOrigin = false;
@ -168,7 +168,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter ) const
aFormatter->Print( "(svgprecision %d)", m_svgPrecision );
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 );
// PDF options
@ -247,7 +247,7 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet )
return false;
if( m_plotMode != aPcbPlotParams.m_plotMode )
if( m_DXFPlotMode != aPcbPlotParams.m_DXFPlotMode )
return false;
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.
*/
class PCB_PLOT_PARAMS
class PCB_PLOT_PARAMS : public PLOT_PARAMS
{
public:
PCB_PLOT_PARAMS();
@ -64,13 +64,13 @@ public:
m_textMode = aVal;
}
PLOT_TEXT_MODE GetTextMode() const
PLOT_TEXT_MODE GetTextMode() const override
{
return m_textMode;
}
void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; }
OUTLINE_MODE GetPlotMode() const { return m_plotMode; }
void SetDXFPlotMode( DXF_OUTLINE_MODE aPlotMode ) { m_DXFPlotMode = aPlotMode; }
DXF_OUTLINE_MODE GetDXFPlotMode() const override { return m_DXFPlotMode; }
void SetPlotPadNumbers( bool aFlag ) { m_plotPadNumbers = aFlag; }
bool GetPlotPadNumbers() const { return m_plotPadNumbers; }
@ -193,19 +193,18 @@ public:
private:
friend class PCB_PLOT_PARAMS_PARSER;
PLOT_FORMAT m_format; /// Plot format type (chooses the driver to be used)
LSET m_layerSelection;
LSEQ m_plotOnAllLayersSequence;
PLOT_FORMAT m_format; /// Plot format type (chooses the driver to be used)
LSET m_layerSelection;
LSEQ m_plotOnAllLayersSequence;
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
DRILL_MARKS m_drillMarks; /// Holes can be not plotted, have a small mark, or be
bool m_skipNPTH_Pads; /// Used to disable NPTH pads plotting on copper 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
/// plotted in actual size
PLOT_TEXT_MODE m_textMode;
DXF_UNITS m_DXFUnits;
bool m_DXFPolygonMode; /// In polygon mode, each item to plot is converted to a
PLOT_TEXT_MODE m_textMode;
DXF_OUTLINE_MODE m_DXFPlotMode; /// FILLED or SKETCH for filled objects.
DXF_UNITS m_DXFUnits;
bool m_DXFPolygonMode; /// In polygon mode, each item to plot is converted to a
/// polygon and all polygons are merged.
bool m_A4Output; /// Autoscale the plot to fit an A4 (landscape?) sheet

View File

@ -30,7 +30,6 @@
#include <wx/filename.h>
#include <gerber_jobfile_writer.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_pdf.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 );
aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH ? DXF_UNITS::INCH
: DXF_UNITS::MM );
aOpts.SetPlotMode( dxfJob->m_plotGraphicItemsUsingContours ? OUTLINE_MODE::SKETCH
: OUTLINE_MODE::FILLED );
aOpts.SetDXFPlotMode( dxfJob->m_plotGraphicItemsUsingContours ? DXF_OUTLINE_MODE::SKETCH
: DXF_OUTLINE_MODE::FILLED );
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.
*/
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 );

View File

@ -347,7 +347,6 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
itemplotter.SetLayerSet( aLayerMask );
OUTLINE_MODE plotMode = aPlotOpt.GetPlotMode();
bool onCopperLayer = ( LSET::AllCuMask() & aLayerMask ).any();
bool onSolderMaskLayer = ( LSET( { F_Mask, B_Mask } ) & 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() )
{
OUTLINE_MODE padPlotMode = plotMode;
bool doSketchPads = false;
if( !( pad->GetLayerSet() & aLayerMask ).any() )
{
if( sketchPads &&
( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) ) ||
( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
if( sketchPads && ( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) )
|| ( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
{
padPlotMode = SKETCH;
doSketchPads = true;
}
else
{
@ -420,9 +418,8 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
color = aPlotOpt.ColorSettings()->GetColor( B_Fab );
}
if( sketchPads
&& ( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) )
|| ( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
if( sketchPads && ( ( onFrontFab && pad->GetLayerSet().Contains( F_Cu ) )
|| ( onBackFab && pad->GetLayerSet().Contains( B_Cu ) ) ) )
{
if( aPlotOpt.GetPlotPadNumbers() )
itemplotter.PlotPadNumber( pad, color );
@ -482,7 +479,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
break;
}
itemplotter.PlotPad( pad, aLayer, color, padPlotMode );
itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
break;
case PAD_SHAPE::RECTANGLE:
@ -494,7 +491,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
pad->SetRoundRectCornerRadius( aLayer, mask_clearance );
}
itemplotter.PlotPad( pad, aLayer, color, padPlotMode );
itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
break;
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
if( mask_clearance == 0 )
{
itemplotter.PlotPad( pad, aLayer, color, padPlotMode );
itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
}
else
{
@ -536,7 +533,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
// polygonal shape is built, we can clamp the anchor size
dummy.SetSize( aLayer, VECTOR2I( 0, 0 ) );
itemplotter.PlotPad( &dummy, aLayer, color, padPlotMode );
itemplotter.PlotPad( &dummy, aLayer, color, doSketchPads );
}
break;
@ -550,7 +547,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
pad->SetSize( aLayer, padPlotsSize );
pad->SetRoundRectRadiusRatio( aLayer, radius_ratio );
itemplotter.PlotPad( pad, aLayer, color, padPlotMode );
itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
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)
pad->SetSize( aLayer, padPlotsSize );
itemplotter.PlotPad( pad, aLayer, color, padPlotMode );
itemplotter.PlotPad( pad, aLayer, color, doSketchPads );
}
else
{
@ -594,7 +591,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
dummy.SetOffset( aLayer, pad->GetOffset( aLayer ) );
dummy.SetOrientation( pad->GetOrientation() );
itemplotter.PlotPad( &dummy, aLayer, color, padPlotMode );
itemplotter.PlotPad( &dummy, aLayer, color, doSketchPads );
}
break;
@ -625,7 +622,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
std::max( 0, padPlotsSize.y ) ) );
}
itemplotter.PlotPad( &dummy, aLayer, color, padPlotMode );
itemplotter.PlotPad( &dummy, aLayer, color, doSketchPads );
break;
}
}
@ -650,10 +647,10 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
BOX2I rect = footprint->GetBoundingHull().BBox();
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() ),
VECTOR2I( rect.GetRight(), rect.GetTop() ),
width, FILLED, nullptr );
width, 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 );
}
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 );
for( const PCB_TRACK* track : aBoard->Tracks() )
@ -729,7 +737,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
color = LIGHTGRAY;
aPlotter->SetColor( color );
aPlotter->FlashPadCircle( via->GetStart(), diameter, plotMode, &gbr_metadata );
aPlotter->FlashPadCircle( via->GetStart(), diameter, getMetadata() );
}
aPlotter->EndBlock( nullptr );
@ -780,19 +788,17 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
if( !arc->IsDegenerated( 10 /* in IU */ ) )
{
aPlotter->ThickArc( arc->GetCenter(), arc->GetArcAngleStart(), arc->GetAngle(),
arc->GetRadius(), width, plotMode, &gbr_metadata );
arc->GetRadius(), width, getMetadata() );
}
else
{
// Approximate this very small arc by a segment.
aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, plotMode,
&gbr_metadata );
aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, getMetadata() );
}
}
else
{
aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, plotMode,
&gbr_metadata );
aPlotter->ThickSegment( track->GetStart(), track->GetEnd(), width, getMetadata() );
}
}
@ -897,7 +903,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask
drill = std::min( smallDrill, drill );
aPlotter->ThickCircle( pad->ShapePos( layer ), drill,
PLOTTER::USE_DEFAULT_LINE_WIDTH, FILLED, nullptr );
PLOTTER::USE_DEFAULT_LINE_WIDTH, nullptr );
}
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,
OUTLINE_MODE aPlotMode )
bool aSketchMode )
{
VECTOR2I shape_pos = aPad->ShapePos( aLayer );
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
m_plotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY );
if( aPlotMode == SKETCH )
if( aSketchMode )
{
switch( aPad->GetShape( aLayer ) )
{
case PAD_SHAPE::CIRCLE:
m_plotter->ThickCircle( shape_pos, aPad->GetSize( aLayer ).x, GetSketchPadLineWidth(),
FILLED, &metadata );
nullptr );
break;
case PAD_SHAPE::OVAL:
{
m_plotter->ThickOval( shape_pos, aPad->GetSize( aLayer ), aPad->GetOrientation(),
GetSketchPadLineWidth(), &metadata );
GetSketchPadLineWidth(), nullptr );
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 ) ),
VECTOR2I( shape_pos.x + ( size.x / 2 ), shape_pos.y + (size.y / 2 ) ),
GetSketchPadLineWidth(), FILLED, &metadata );
GetSketchPadLineWidth(), nullptr );
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(),
ERROR_INSIDE, true );
m_plotter->ThickPoly( outline, GetSketchPadLineWidth(), FILLED, &metadata );
m_plotter->ThickPoly( outline, GetSketchPadLineWidth(), nullptr );
break;
}
@ -325,24 +325,23 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
switch( aPad->GetShape( aLayer ) )
{
case PAD_SHAPE::CIRCLE:
m_plotter->FlashPadCircle( shape_pos, aPad->GetSize( aLayer ).x,
aPlotMode, &metadata );
m_plotter->FlashPadCircle( shape_pos, aPad->GetSize( aLayer ).x, &metadata );
break;
case PAD_SHAPE::OVAL:
m_plotter->FlashPadOval( shape_pos, aPad->GetSize( aLayer ),
aPad->GetOrientation(), aPlotMode, &metadata );
aPad->GetOrientation(), &metadata );
break;
case PAD_SHAPE::RECTANGLE:
m_plotter->FlashPadRect( shape_pos, aPad->GetSize( aLayer ),
aPad->GetOrientation(), aPlotMode, &metadata );
aPad->GetOrientation(), &metadata );
break;
case PAD_SHAPE::ROUNDRECT:
m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize( aLayer ),
aPad->GetRoundRectCornerRadius( aLayer ),
aPad->GetOrientation(), aPlotMode, &metadata );
aPad->GetOrientation(), &metadata );
break;
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[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;
@ -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 );
gerberPlotter->FlashPadChamferRoundRect( shape_pos,
aPad->GetSize( aLayer ),
aPad->GetRoundRectCornerRadius( aLayer ),
aPad->GetChamferRectRatio( aLayer ),
aPad->GetChamferPositions( aLayer ), aPad->GetOrientation(),
aPlotMode, &metadata );
gerberPlotter->FlashPadChamferRoundRect( shape_pos, aPad->GetSize( aLayer ),
aPad->GetRoundRectCornerRadius( aLayer ),
aPad->GetChamferRectRatio( aLayer ),
aPad->GetChamferPositions( aLayer ),
aPad->GetOrientation(), &metadata );
break;
}
@ -390,7 +388,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, PCB_LAYER_ID aLayer, const COLO
if( polygons->OutlineCount() )
{
m_plotter->FlashPadCustom( shape_pos, aPad->GetSize( aLayer ), aPad->GetOrientation(),
polygons.get(), aPlotMode, &metadata );
polygons.get(), &metadata );
}
}
break;
@ -754,6 +752,17 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
if( IsCopperLayer( aLayer ) )
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 );
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( 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 )
@ -798,7 +807,7 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
finalPoly.Fracture();
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
{
@ -810,12 +819,12 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
// Stroke callback
[&]( 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
[&]( 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 ) );
@ -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++ )
{
wxString& txt = strings_list.Item( ii );
m_plotter->PlotText( positions[ii], color, txt, attrs, font, aFontMetrics,
&gbr_metadata );
m_plotter->PlotText( positions[ii], color, txt, attrs, font, aFontMetrics, getMetadata() );
}
if( aStrikeout && strings_list.Count() == 1 )
@ -841,7 +849,7 @@ void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, boo
}
else
{
m_plotter->PlotText( pos, color, shownText, attrs, font, aFontMetrics, &gbr_metadata );
m_plotter->PlotText( pos, color, shownText, attrs, font, aFontMetrics, getMetadata() );
if( aStrikeout )
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->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 );
// 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,
&gbr_metadata );
}
else
{
m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
}
static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( outline, &gbr_metadata );
}
else if( m_plotter->GetPlotterType() == PLOT_FORMAT::DXF && GetDXFPlotMode() == SKETCH )
{
m_plotter->SetCurrentLineWidth( PLOTTER::USE_DEFAULT_LINE_WIDTH );
}
else
{
m_plotter->SetCurrentLineWidth( -1 );
m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, getMetadata() );
}
}
@ -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 )
{
switch( aShape->GetShape() )
{
case SHAPE_T::SEGMENT:
m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(),
&gbr_metadata );
m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, getMetadata() );
break;
case SHAPE_T::CIRCLE:
@ -1007,12 +1032,12 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
diameter = std::max( diameter, 0 );
}
m_plotter->FilledCircle( aShape->GetStart(), diameter, GetPlotMode(), &gbr_metadata );
m_plotter->FilledCircle( aShape->GetStart(), diameter, getMetadata() );
}
else
{
m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness,
GetPlotMode(), &gbr_metadata );
getMetadata() );
}
break;
@ -1024,11 +1049,11 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
if( std::abs( aShape->GetArcAngle().AsDegrees() ) == 360.0 )
{
m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness,
GetPlotMode(), &gbr_metadata );
getMetadata() );
}
else
{
m_plotter->ThickArc( *aShape, GetPlotMode(), &gbr_metadata, thickness );
m_plotter->ThickArc( *aShape, getMetadata(), thickness );
}
break;
@ -1042,9 +1067,9 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
case SHAPE_T::POLY:
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
{
@ -1082,7 +1107,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
}
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();
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
{
@ -1124,7 +1149,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
}
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(),
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
&gbr_metadata );
m_plotter->ThickSegment( a, b, thickness, getMetadata() );
} );
}
@ -1168,7 +1192,7 @@ void BRDITEMS_PLOTTER::PlotShape( const PCB_SHAPE* aShape )
else
{
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 );
}
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(
[&]( 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 )
{
m_plotter->ThickSegment( ptA, ptB, lineWidth, GetPlotMode(), &gbr_metadata );
m_plotter->ThickSegment( ptA, ptB, lineWidth, getMetadata() );
}
else
{
@ -1205,8 +1240,7 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
STROKE_PARAMS::Stroke( &seg, lineStyle, lineWidth, m_plotter->RenderSettings(),
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_plotter->ThickSegment( a, b, lineWidth, GetPlotMode(),
&gbr_metadata );
m_plotter->ThickSegment( a, b, lineWidth, getMetadata() );
} );
}
} );
@ -1232,11 +1266,11 @@ void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE aDrillShape, const VECT
drillSize.y -= getFineWidthAdj();
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
{
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 )
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
pad. This works only for drivers supporting color change, obviously... it means that:
/* Drill marks are drawn white-on-black to knock-out the underlying pad. This works only
* for drivers supporting color change, obviously... it means that:
- 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
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.
- 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 );
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 );
}