Commit cc47e88b authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew, plot functions: fix bug in SVG plotter, fix a minor other bug when...

Pcbnew, plot functions: fix bug in SVG plotter, fix a minor other bug when using PS plotter (trcak width fine adjust not working)
and plot code cleaning continued
parent 160560c9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -430,7 +430,6 @@ void PS_PLOTTER::SetCurrentLineWidth( int width )
    currentPenWidth = pen_width;
}


void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
{
    wxASSERT( outputFile );
+9 −3
Original line number Diff line number Diff line
@@ -228,15 +228,21 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
{
    EDA_RECT rect( p1, wxSize( p2.x -p1.x,  p2.y -p1.y ) );
    rect.Normalize();
    DPOINT  pos_dev  = userToDeviceCoordinates( rect.GetOrigin() );
    DPOINT  size_dev = userToDeviceSize( rect.GetSize() );
    DPOINT  org_dev  = userToDeviceCoordinates( rect.GetOrigin() );
    DPOINT  end_dev = userToDeviceCoordinates( rect.GetEnd() );
    DSIZE  size_dev = end_dev - org_dev;
    // Ensure size of rect in device coordinates is > 0
    // Inkscape has problems with negative values for width and/or height
    DBOX rect_dev( org_dev, size_dev);
    rect_dev.Normalize();

    setFillMode( fill );
    SetCurrentLineWidth( width );

    fprintf( outputFile,
             "<rect x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" rx=\"%g\" />\n",
             pos_dev.x, pos_dev.y, size_dev.x, size_dev.y,
             rect_dev.GetPosition().x,  rect_dev.GetPosition().y,
             rect_dev.GetSize().x, rect_dev.GetSize().y,
             0.0   // radius of rounded corners
             );
}
+0 −3
Original line number Diff line number Diff line
@@ -17,9 +17,6 @@ enum PAD_SHAPE_T
    PAD_RECT,
    PAD_OVAL,
    PAD_TRAPEZOID,
    PAD_RRECT,
    PAD_OCTAGON,
    PAD_SQUARE,
};


+2 −36
Original line number Diff line number Diff line
@@ -119,21 +119,6 @@ public:

    virtual void SetDash( bool dashed ) = 0;

    /** PLEASE NOTE: the plot width adjustment is actually done by the
     * pcbnew routines, the plotter class only carry it along!
     * XXX In fact it's only used during postscript plot, I'd move this
     * variable as a static in pcbnew/plot_rtn.cpp. Also: why it's double?
     * it's added to pad/track size and it's specified in IU, so it should
     * be an int */
    virtual void SetPlotWidthAdj( double width )
    {
    }

    virtual double GetPlotWidthAdj()
    {
        return 0.;
    }

    virtual void SetCreator( const wxString& _creator )
    {
        creator = _creator;
@@ -452,7 +437,7 @@ protected:
class PSLIKE_PLOTTER : public PLOTTER
{
public:
    PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ), plotWidthAdj( 0 ),
    PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ),
                       m_textMode( PLOTTEXTMODE_PHANTOM )
    {
    }
@@ -476,20 +461,6 @@ public:
        plotScaleAdjY = scaleY;
    }

    /**
     * Set the 'width adjustment' for the postscript engine
     * (useful for controlling toner bleeding during direct transfer)
     */
    virtual void SetPlotWidthAdj( double width )
    {
        plotWidthAdj = width;
    }

    virtual double GetPlotWidthAdj() const
    {
        return plotWidthAdj;
    }

    // Pad routines are handled with lower level primitives
    virtual void FlashPadCircle( const wxPoint& pos, int diametre,
                                 EDA_DRAW_MODE_T trace_mode );
@@ -538,14 +509,9 @@ protected:
    int returnPostscriptTextWidth( const wxString& aText, int aXSize,
                                   bool aItalic, bool aBold );

    /// Fine user scale
    /// Fine user scale adjust ( = 1.0 if no correction)
    double plotScaleAdjX, plotScaleAdjY;

    /** Plot width adjust XXX should be moved in the PCB plotting
     * routines!
     */
    double plotWidthAdj;

    /// How to draw text
    PlotTextMode m_textMode;
};
+5 −4
Original line number Diff line number Diff line
@@ -248,7 +248,11 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
    PCB_PLOT_PARAMS m_plotOpts;

    m_plotOpts.SetPlotFrameRef( PrintPageRef() );
    // Adding drill marks
    m_plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::FULL_DRILL_SHAPE );

    m_plotOpts.SetSkipPlotNPTH_Pads( false );

    m_plotOpts.SetMirror( m_printMirror );
    m_plotOpts.SetFormat( PLOT_FORMAT_SVG );
    EDA_COLOR_T color = UNSPECIFIED_COLOR;      // Used layer color to plot ref and value
@@ -278,10 +282,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
    if( plotter )
    {
        plotter->SetColorMode( m_ModeColorOption->GetSelection() == 0 );
        PlotStandardLayer( brd, plotter, m_PrintMaskLayer, m_plotOpts, true, false );
        // Adding drill marks, if required and if the plotter is able to plot them:
        if( m_plotOpts.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
            PlotDrillMarks( brd, plotter, m_plotOpts );
        PlotStandardLayer( brd, plotter, m_PrintMaskLayer, m_plotOpts );
    }

    plotter->EndPlot();
Loading