diff --git a/common/plotters/SVG_plotter.cpp b/common/plotters/SVG_plotter.cpp index a106b67c19..e6ecb6aa90 100644 --- a/common/plotters/SVG_plotter.cpp +++ b/common/plotters/SVG_plotter.cpp @@ -206,12 +206,13 @@ void SVG_PLOTTER::setFillMode( FILL_T fill ) } -void SVG_PLOTTER::setSVGPlotStyle() +void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle ) { - fputs( "\n\n\n", outputFile ); + if( aExtraStyle.length() ) + { + fputs( aExtraStyle.c_str(), outputFile ); + } - m_graphics_changed = false; + fputs( "\"", outputFile ); + + if( aIsGroup ) + { + fputs( ">", outputFile ); + m_graphics_changed = false; + } + + fputs( "\n", outputFile ); } /* Set the current line width (in IUs) for the next plot @@ -470,21 +482,22 @@ void SVG_PLOTTER::PlotPoly( const std::vector& aCornerList, setFillMode( aFill ); SetCurrentLineWidth( aWidth ); + fprintf( outputFile, "& aCornerList, fprintf( outputFile, "%d,%d\n", (int) pos.x, (int) pos.y ); } - // ensure the shape is closed, for filled shapes (that are closed polygons): - // (svg does not close automatically a polygon - if( aCornerList.front() != aCornerList.back() && aFill != NO_FILL ) - { - pos = userToDeviceCoordinates( aCornerList.front() ); - fprintf( outputFile, "%d,%d\n", (int) pos.x, (int) pos.y ); - } - - // Close/(fill) the path - fprintf( outputFile, "\" /> \n" ); + fprintf( outputFile, "Z\" /> \n" ); } diff --git a/include/plotter.h b/include/plotter.h index 89008a923a..40e2248554 100644 --- a/include/plotter.h +++ b/include/plotter.h @@ -975,9 +975,12 @@ protected: /** * function setSVGPlotStyle() - * output the string which define pen and brush color, shape, transparence + * output the string which define pen and brush color, shape, transparency + * + * @param aIsGroup If false, do not form a new group for the style. + * @param aExtraStyle If given, the string will be added into the style string before closing */ - void setSVGPlotStyle(); + void setSVGPlotStyle( bool aIsGroup = true, const std::string& aExtraStyle = {} ); /** * function setFillMode() diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 45ed748f6e..d26218647e 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -681,7 +681,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) { // Plot the filled area polygon. // The area can be filled by segments or uses solid polygons - if( aZone->GetFillMode() == 0 ) // We are using solid polygons + if( aZone->GetFillMode() == ZONE_FILL_MODE::ZFM_POLYGONS ) // We are using solid polygons { m_plotter->PlotPoly( cornerList, FILLED_SHAPE, aZone->GetMinThickness(), &gbr_metadata ); }