Browse Source

Cleanup plotting APIs.

pull/18/head
Jeff Young 5 months ago
parent
commit
3458534fd7
  1. 10
      common/plotters/PS_plotter.cpp
  2. 22
      common/plotters/common_plot_functions.cpp
  3. 4
      common/plotters/plotter.cpp
  4. 2
      eeschema/sch_label.cpp
  5. 2
      eeschema/sch_rule_area.cpp
  6. 4
      eeschema/sch_shape.cpp
  7. 16
      include/plotters/plotter.h

10
common/plotters/PS_plotter.cpp

@ -112,7 +112,7 @@ void PSLIKE_PLOTTER::FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSiz
RotatePoint( a, orient );
RotatePoint( b, orient );
ThickSegment( a + aPadPos, b + aPadPos, size.x, aTraceMode, nullptr );
ThickSegment( a + aPadPos, b + aPadPos, size.x, aTraceMode, aData );
}
@ -155,7 +155,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSiz
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0 );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0, aData );
}
@ -179,7 +179,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I&
// Close polygon
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0 );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0, aData );
}
@ -200,7 +200,7 @@ void PSLIKE_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aS
// Close polygon
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0 );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0, aData );
}
}
@ -222,7 +222,7 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
}
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0 );
PlotPoly( cornerList, FILL_T::FILLED_SHAPE, 0, aData );
}

22
common/plotters/common_plot_functions.cpp

@ -69,7 +69,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
wxFileName fn( aFilename );
// Prepare plot parameters
drawList.SetDefaultPenSize( PLOTTER::USE_DEFAULT_LINE_WIDTH );
drawList.SetDefaultPenSize( defaultPenWidth );
drawList.SetPlotterMilsToIUfactor( iusPerMil );
drawList.SetPageNumber( aSheetNumber );
drawList.SetSheetCount( aSheetCount );
@ -97,7 +97,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
continue;
bitmap->m_ImageBitmap->PlotImage( plotter, drawItem->GetPosition(), plotColor,
PLOTTER::USE_DEFAULT_LINE_WIDTH );
defaultPenWidth );
}
}
@ -108,7 +108,6 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
continue;
plotter->SetColor( plotColor );
plotter->SetCurrentLineWidth( PLOTTER::USE_DEFAULT_LINE_WIDTH );
switch( item->Type() )
{
@ -118,8 +117,8 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
plotter->SetCurrentLineWidth( std::max( line->GetPenWidth(), defaultPenWidth ) );
plotter->MoveTo( line->GetStart() );
plotter->FinishTo( line->GetEnd() );
break;
}
break;
case WSG_RECT_T:
{
@ -130,8 +129,8 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
plotter->LineTo( VECTOR2I( rect->GetEnd().x, rect->GetEnd().y ) );
plotter->LineTo( VECTOR2I( rect->GetStart().x, rect->GetEnd().y ) );
plotter->FinishTo( rect->GetStart() );
break;
}
break;
case WSG_TEXT_T:
{
@ -154,13 +153,13 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
text->IsMultilineAllowed(), font, text->GetFontMetrics() );
break;
}
break;
case WSG_POLY_T:
{
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
int penWidth = poly->GetPenWidth();
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
std::vector<VECTOR2I> points;
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
@ -171,12 +170,15 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
for( int ii = 0; ii < outline.PointCount(); ii++ )
points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
plotter->PlotPoly( points, FILL_T::FILLED_SHAPE, penWidth );
plotter->PlotPoly( points, FILL_T::FILLED_SHAPE, penWidth, nullptr );
}
break;
}
break;
default: wxFAIL_MSG( wxT( "PlotDrawingSheet(): Unknown drawing sheet item." ) ); break;
default:
wxFAIL_MSG( wxT( "PlotDrawingSheet(): Unknown drawing sheet item." ) );
break;
}
}
}

4
common/plotters/plotter.cpp

@ -295,7 +295,7 @@ void PLOTTER::markerSquare( const VECTOR2I& position, int radius )
corner.y = position.y + r;
corner_list.push_back( corner );
PlotPoly( corner_list, FILL_T::NO_FILL, GetCurrentLineWidth() );
PlotPoly( corner_list, FILL_T::NO_FILL, GetCurrentLineWidth(), nullptr );
}
@ -328,7 +328,7 @@ void PLOTTER::markerLozenge( const VECTOR2I& position, int radius )
corner.y = position.y + radius;
corner_list.push_back( corner );
PlotPoly( corner_list, FILL_T::NO_FILL, GetCurrentLineWidth() );
PlotPoly( corner_list, FILL_T::NO_FILL, GetCurrentLineWidth(), nullptr );
}

2
eeschema/sch_label.cpp

@ -1342,7 +1342,7 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
else
{
if( !s_poly.empty() )
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth, nullptr );
}
// Make sheet pins and hierarchical labels clickable hyperlinks

2
eeschema/sch_rule_area.cpp

@ -186,7 +186,7 @@ void SCH_RULE_AREA::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OP
aPlotter->SetCurrentLineWidth( pen_size );
aPlotter->SetDash( pen_size, lineStyle );
aPlotter->PlotPoly( ptList, fill, pen_size );
aPlotter->PlotPoly( ptList, fill, pen_size, nullptr );
aPlotter->SetDash( pen_size, LINE_STYLE::SOLID );
}

4
eeschema/sch_shape.cpp

@ -252,7 +252,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
if( aBackground && IsHatchedFill() )
{
for( int ii = 0; ii < GetHatching().OutlineCount(); ++ii )
aPlotter->PlotPoly( GetHatching().COutline( ii ), FILL_T::FILLED_SHAPE, 0 );
aPlotter->PlotPoly( GetHatching().COutline( ii ), FILL_T::FILLED_SHAPE, 0, nullptr );
return;
}
@ -282,7 +282,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
case SHAPE_T::POLY:
case SHAPE_T::BEZIER:
aPlotter->PlotPoly( ptList, fill, pen_size );
aPlotter->PlotPoly( ptList, fill, pen_size, nullptr );
break;
default:

16
include/plotters/plotter.h

@ -272,8 +272,8 @@ public:
* @param aWidth is the line width.
* @param aData is an auxiliary info (mainly for gerber format).
*/
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) = 0;
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
void* aData ) = 0;
/**
* Draw a polygon ( filled or not ).
@ -284,8 +284,8 @@ public:
* @param aWidth is the line width.
* @param aData is an auxiliary info (mainly for gerber format).
*/
virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr );
virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int aWidth,
void* aData );
/**
* Only PostScript plotters can plot bitmaps.
@ -612,14 +612,6 @@ protected:
// Helper function for sketched filler segment
/**
* Convert a thick segment and plot it as an oval
*/
void segmentAsOval( const VECTOR2I& start, const VECTOR2I& end, int width,
OUTLINE_MODE tracemode );
void sketchOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA_ANGLE& aOrient,
int aWidth );
// Coordinate and scaling conversion functions

Loading…
Cancel
Save