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

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
......@@ -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 );
......
......@@ -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
);
}
......
......@@ -17,9 +17,6 @@ enum PAD_SHAPE_T
PAD_RECT,
PAD_OVAL,
PAD_TRAPEZOID,
PAD_RRECT,
PAD_OCTAGON,
PAD_SQUARE,
};
......
......@@ -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;
};
......
......@@ -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();
......
......@@ -61,12 +61,16 @@ void DIALOG_PLOT::Init_Dialog()
m_config->Read( OPTKEY_PLOT_X_FINESCALE_ADJ, &m_XScaleAdjust );
m_config->Read( OPTKEY_PLOT_Y_FINESCALE_ADJ, &m_YScaleAdjust );
m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &m_PSWidthAdjust );
// m_PSWidthAdjust is stored in mm in user config
double dtmp;
m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &dtmp, 0 );
m_PSWidthAdjust = KiROUND( dtmp * IU_PER_MM );
// The reasonable width correction value must be in a range of
// [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
m_WidthAdjustMinValue = -(m_board->GetDesignSettings().m_TrackMinWidth - 1);
m_WidthAdjustMaxValue = m_board->GetSmallestClearanceValue() - 1;
m_widthAdjustMinValue = -(m_board->GetDesignSettings().m_TrackMinWidth - 1);
m_widthAdjustMaxValue = m_board->GetSmallestClearanceValue() - 1;
switch( m_plotOpts.GetFormat() )
{
......@@ -130,7 +134,7 @@ void DIALOG_PLOT::Init_Dialog()
m_fineAdjustYscaleOpt->AppendText( msg );
// Test for a reasonable PS width correction value. Set to 0 if problem.
if( m_PSWidthAdjust < m_WidthAdjustMinValue || m_PSWidthAdjust > m_WidthAdjustMaxValue )
if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
m_PSWidthAdjust = 0.;
msg.Printf( wxT( "%f" ), To_User_Unit( g_UserUnit, m_PSWidthAdjust ) );
......@@ -289,7 +293,8 @@ PlotFormat DIALOG_PLOT::GetPlotFormat()
return plotFmt[ m_plotFormatOpt->GetSelection() ];
}
// Enable or disable widgets according to the plot format selected
// and clear also some optional values
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
{
switch( GetPlotFormat() )
......@@ -311,11 +316,13 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( false );
m_scaleOpt->SetSelection( 1 );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->Enable( false );
m_plotPSNegativeOpt->Enable( true );
m_forcePSA4OutputOpt->Enable( false );
m_forcePSA4OutputOpt->SetValue( false );
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
......@@ -469,6 +476,22 @@ static bool setDouble( double* aResult, double aValue, double aMin, double aMax
*aResult = aValue;
return true;
}
static bool setInt( int* aResult, int aValue, int aMin, int aMax )
{
if( aValue < aMin )
{
*aResult = aMin;
return false;
}
else if( aValue > aMax )
{
*aResult = aMax;
return false;
}
*aResult = aValue;
return true;
}
void DIALOG_PLOT::applyPlotSettings()
......@@ -476,22 +499,15 @@ void DIALOG_PLOT::applyPlotSettings()
PCB_PLOT_PARAMS tempOptions;
tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() );
tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
tempOptions.SetPlotOtherText( m_plotTextOther->GetValue() );
tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>
( m_drillShapeOpt->GetSelection() ) );
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
......@@ -581,22 +597,23 @@ void DIALOG_PLOT::applyPlotSettings()
// PS Width correction
msg = m_PSFineAdjustWidthOpt->GetValue();
tmpDouble = ReturnValueFromString( g_UserUnit, msg );
int itmp = ReturnValueFromString( g_UserUnit, msg );
if( !setDouble( &m_PSWidthAdjust, tmpDouble, m_WidthAdjustMinValue, m_WidthAdjustMaxValue ) )
if( !setInt( &m_PSWidthAdjust, itmp, m_widthAdjustMinValue, m_widthAdjustMaxValue ) )
{
msg = ReturnStringFromValue( g_UserUnit, m_PSWidthAdjust );
m_PSFineAdjustWidthOpt->SetValue( msg );
msg.Printf( _( "Width correction constrained!\n"
"The reasonable width correction value must be in a range of\n"
" [%+f; %+f] (%s) for current design rules!\n" ),
To_User_Unit( g_UserUnit, m_WidthAdjustMinValue ),
To_User_Unit( g_UserUnit, m_WidthAdjustMaxValue ),
To_User_Unit( g_UserUnit, m_widthAdjustMinValue ),
To_User_Unit( g_UserUnit, m_widthAdjustMaxValue ),
( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) );
m_messagesBox->AppendText( msg );
}
m_config->Write( CONFIG_PS_FINEWIDTH_ADJ, m_PSWidthAdjust );
// Store m_PSWidthAdjust in mm in user config
m_config->Write( CONFIG_PS_FINEWIDTH_ADJ, (double)m_PSWidthAdjust / IU_PER_MM );
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
......
......@@ -47,12 +47,12 @@ private:
// plotter X scaling error
double m_YScaleAdjust; // X scale factor adjust to compensate
// plotter Y scaling error
double m_PSWidthAdjust; // Global width correction for exact line width
int m_PSWidthAdjust; // Global width correction for exact line width
// in postscript output.
// this is a correction factor for tracks width
// when plotted
double m_WidthAdjustMinValue; // Global track width limits
double m_WidthAdjustMaxValue; // tracks width will be "clipped" whenever the
int m_widthAdjustMinValue; // Global track width limits
int m_widthAdjustMaxValue; // tracks width will be "clipped" whenever the
// m_PSWidthAdjust to these limits.
PCB_PLOT_PARAMS m_plotOpts;
......
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PLOT_BASE_H__
#define __DIALOG_PLOT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/checklst.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE
};
wxBoxSizer* m_MainSizer;
wxStaticText* m_staticText121;
wxChoice* m_plotFormatOpt;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticBoxSizer* m_LayersSizer;
wxCheckListBox* m_layerCheckListBox;
wxBoxSizer* m_PlotOptionsSizer;
wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_excludeEdgeLayerOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
wxChoice* m_scaleOpt;
wxStaticText* m_staticText13;
wxChoice* m_plotModeOpt;
wxStaticText* m_textDefaultPenSize;
wxTextCtrl* m_linesWidth;
wxStaticBoxSizer* m_GerberOptionsSizer;
wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_useAuxOriginCheckBox;
wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt;
wxStaticText* m_textPenSpeed;
wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticBoxSizer* m_PSOptionsSizer;
wxStaticText* m_staticText7;
wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8;
wxTextCtrl* m_fineAdjustYscaleOpt;
wxStaticText* m_textPSFineAdjustWidth;
wxTextCtrl* m_PSFineAdjustWidthOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_forcePSA4OutputOpt;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
};
#endif //__DIALOG_PLOT_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PLOT_BASE_H__
#define __DIALOG_PLOT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/checklst.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE
};
wxBoxSizer* m_MainSizer;
wxStaticText* m_staticText121;
wxChoice* m_plotFormatOpt;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticBoxSizer* m_LayersSizer;
wxCheckListBox* m_layerCheckListBox;
wxBoxSizer* m_PlotOptionsSizer;
wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
wxChoice* m_scaleOpt;
wxStaticText* m_staticText13;
wxChoice* m_plotModeOpt;
wxStaticText* m_textDefaultPenSize;
wxTextCtrl* m_linesWidth;
wxStaticBoxSizer* m_GerberOptionsSizer;
wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_useAuxOriginCheckBox;
wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt;
wxStaticText* m_textPenSpeed;
wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticBoxSizer* m_PSOptionsSizer;
wxStaticText* m_staticText7;
wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8;
wxTextCtrl* m_fineAdjustYscaleOpt;
wxStaticText* m_textPSFineAdjustWidth;
wxTextCtrl* m_PSFineAdjustWidthOpt;
wxCheckBox* m_forcePSA4OutputOpt;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
};
#endif //__DIALOG_PLOT_BASE_H__
......@@ -472,7 +472,7 @@ void PCB_PARSER::parseGeneralSection() throw( IO_ERROR, PARSE_ERROR )
break;
default: // Skip everything but the board thickness.
wxLogDebug( wxT( "Skipping general section token %s " ),
wxLogDebug( wxT( "Skipping general section token %s " ),
GetChars( GetTokenString( token ) ) );
while( ( token = NextTok() ) != T_RIGHT )
......@@ -756,7 +756,6 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as setup." ) );
T token;
int lastTraceWidth;
NETCLASS* defaultNetclass = m_board->m_NetClasses.GetDefault();
BOARD_DESIGN_SETTINGS designSettings = m_board->GetDesignSettings();
ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings();
......@@ -770,8 +769,8 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
switch( token )
{
case T_last_trace_width:
lastTraceWidth = parseBoardUnits( T_last_trace_width );
case T_last_trace_width: // not used now
/* lastTraceWidth =*/ parseBoardUnits( T_last_trace_width );
NeedRIGHT();
break;
......
......@@ -112,6 +112,10 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_referenceColor = BLACK;
m_valueColor = BLACK;
m_textMode = PLOTTEXTMODE_PHANTOM;
// This parameter controls if the NPTH pads will be plotted or not
// it is are "local" parameters
m_skipNPTH_Pads = false;
}
......
......@@ -47,6 +47,10 @@ public:
};
private:
// If true, do not plot NPTH pads
// (mainly used to disable NPTH pads plotting on copper layers)
bool m_skipNPTH_Pads;
/** LINE, FILLED or SKETCH selects how to plot filled objects.
* FILLED is not available with all drivers */
EDA_DRAW_MODE_T m_mode;
......@@ -132,10 +136,10 @@ private:
double m_fineScaleAdjustX; ///< fine scale adjust X axis
double m_fineScaleAdjustY; ///< fine scale adjust Y axis
/** This width factor is intended to compensate printers and plotters that do
* not strictly obey line width settings. Only used for pads and zone
* filling AFAIK */
double m_widthAdjust;
/** This width factor is intended to compensate PS printers/ plotters that do
* not strictly obey line width settings. Only used to plot pads and tracks
*/
int m_widthAdjust;
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
......@@ -148,7 +152,11 @@ private:
public:
PCB_PLOT_PARAMS();
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const throw( IO_ERROR );
void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 )
const throw( IO_ERROR );
void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( IO_ERROR, PARSE_ERROR );
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
......@@ -156,30 +164,41 @@ public:
void SetColor( EDA_COLOR_T aVal ) { m_color = aVal; }
EDA_COLOR_T GetColor() const { return m_color; }
void SetReferenceColor( EDA_COLOR_T aVal ) { m_referenceColor = aVal; }
EDA_COLOR_T GetReferenceColor() const { return m_referenceColor; }
void SetValueColor( EDA_COLOR_T aVal ) { m_valueColor = aVal; }
EDA_COLOR_T GetValueColor() const { return m_valueColor; }
void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
PlotTextMode GetTextMode() const { return m_textMode; }
void SetMode( EDA_DRAW_MODE_T aVal ) { m_mode = aVal; }
EDA_DRAW_MODE_T GetMode() const { return m_mode; }
void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; }
DrillMarksType GetDrillMarksType() const { return m_drillMarks; }
void SetScale( double aVal ) { m_scale = aVal; }
double GetScale() const { return m_scale; }
void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
void SetWidthAdjust( double aVal ) { m_widthAdjust = aVal; }
double GetWidthAdjust() const { return m_widthAdjust; }
void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
int GetWidthAdjust() const { return m_widthAdjust; }
void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
bool GetAutoScale() const { return m_autoScale; }
void SetMirror( bool aFlag ) { m_mirror = aFlag; }
bool GetMirror() const { return m_mirror; }
void SetPlotPadsOnSilkLayer( bool aFlag ) { m_plotPadsOnSilkLayer = aFlag; }
bool GetPlotPadsOnSilkLayer() const { return m_plotPadsOnSilkLayer; }
void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
void SetPlotOtherText( bool aFlag ) { m_plotOtherText = aFlag; }
......@@ -188,29 +207,41 @@ public:
bool GetPlotValue() const { return m_plotValue; }
void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
bool GetPlotReference() const { return m_plotReference; }
void SetNegative( bool aFlag ) { m_negative = aFlag; }
bool GetNegative() const { return m_negative; }
void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
bool GetPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; }
void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
bool GetPlotFrameRef() const { return m_plotFrameRef; }
void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
void SetFormat( PlotFormat aFormat ) { m_format = aFormat; };
PlotFormat GetFormat() const { return m_format; };
void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; };
wxString GetOutputDirectory() const { return m_outputDirectory; };
void SetUseGerberExtensions( bool aUse ) { m_useGerberExtensions = aUse; };
bool GetUseGerberExtensions() const { return m_useGerberExtensions; };
void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
bool GetSubtractMaskFromSilk() const { return m_subtractMaskFromSilk; };
void SetLayerSelection( long aSelection )
{ m_layerSelection = aSelection; };
long GetLayerSelection() const { return m_layerSelection; };
void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
int GetScaleSelection() const { return m_scaleSelection; };
void SetA4Output( int aForce ) { m_A4Output = aForce; };
bool GetA4Output() const { return m_A4Output; };
......@@ -222,6 +253,7 @@ public:
bool SetHPGLPenOverlay( int aValue );
void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
int GetHPGLPenNum() const { return m_HPGLPenNum; }
int GetLineWidth() const { return m_lineWidth; };
bool SetLineWidth( int aValue );
};
......
......@@ -274,7 +274,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
wxString msg;
if( plotter )
{
PlotBoardLayer( board, plotter, layer, m_plotOpts );
PlotOneBoardLayer( board, plotter, layer, m_plotOpts );
plotter->EndPlot();
delete plotter;
......@@ -372,7 +372,7 @@ bool PLOT_CONTROLLER::PlotLayer( int aLayer )/*{{{*/
return false;
// Fully delegated to the parent
PlotBoardLayer( m_board, m_plotter, aLayer, m_plotOpts );
PlotOneBoardLayer( m_board, m_plotter, aLayer, m_plotOpts );
return true;
}/*}}}*/
......
......@@ -5,6 +5,7 @@
#ifndef PCBPLOT_H_
#define PCBPLOT_H_
#include <pad_shapes.h>
#include <pcb_plot_params.h>
class PLOTTER;
......@@ -52,6 +53,7 @@ class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS
BOARD* m_board;
int m_layerMask;
public:
BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts )
: PCB_PLOT_PARAMS( aPlotOpts )
......@@ -61,6 +63,18 @@ public:
m_layerMask = 0;
}
/**
* @return a 'width adjustment' for the postscript engine
* (useful for controlling toner bleeding during direct transfer)
* addded to track width and via/pads size
*/
int getFineWidthAdj()
{
if( GetFormat() == PLOT_FORMAT_POST )
return GetWidthAdjust();
else
return 0;
}
// Basic functions to plot a board item
void SetLayerMask( int aLayerMask ){ m_layerMask = aLayerMask; }
void Plot_Edges_Modules();
......@@ -73,6 +87,20 @@ public:
void PlotTextePcb( TEXTE_PCB* pt_texte );
void PlotDrawSegment( DRAWSEGMENT* PtSegm );
/**
* lot items like text and graphics,
* but not tracks and modules
*/
void PlotBoardGraphicItems();
/** Function PlotDrillMarks
* Draw a drill mark for pads and vias.
* Must be called after all drawings, because it
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in
* FILLED plot mode (for PS and PDF outputs)
*/
void PlotDrillMarks();
/**
* Function getColor
* @return the layer color
......@@ -82,6 +110,16 @@ public:
* so the returned color is LIGHTGRAY when the layer color is WHITE
*/
EDA_COLOR_T getColor( int aLayer );
private:
/** Helper function to plot a single drill mark. It compensate and clamp
* the drill mark size depending on the current plot options
*/
void plotOneDrillMark( PAD_SHAPE_T aDrillShape,
const wxPoint &aDrillPos, wxSize aDrillSize,
const wxSize &aPadSize,
double aOrientation, int aSmallDrill );
};
PLOTTER *StartPlotBoard( BOARD *aBoard,
......@@ -90,34 +128,41 @@ PLOTTER *StartPlotBoard( BOARD *aBoard,
const wxString& aSheetDesc );
/**
* Function PlotBoardLayer
* main function to plot copper or technical layers.
* It calls the specilize plot function, according to the layer type
* Function PlotOneBoardLayer
* main function to plot one copper or technical layer.
* It prepare options and calls the specilized plot function,
* according to the layer type
* @param aBoard = the board to plot
* @param aPlotter = the plotter to use
* @param aLayer = the layer id to plot
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
*/
void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
const PCB_PLOT_PARAMS& aPlotOpt );
void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
const PCB_PLOT_PARAMS& aPlotOpt );
/**
* Function Plot_Standard_Layer
* Function PlotStandardLayer
* plot copper or technical layers.
* not used for silk screen layers, because these layers have specific
* requirements, mainly for pads
* @param aBoard = the board to plot
* @param aPlotter = the plotter to use
* @param aLayerMask = the mask to define the layers to plot
* @param aPlotVia = true to plot vias, false to skip vias (has meaning
* only for solder mask layers).
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
* @param aSkipNPTH_Pads = true to skip NPTH Pads, when the pad size and the pad hole
* have the same size. Used in GERBER format only.
*
* aPlotOpt has 3 important options to controle this plot,
* which are set, depending on the layer typpe to plot
* SetEnablePlotVia( bool aEnable )
* aEnable = true to plot vias, false to skip vias (has meaning
* only for solder mask layers).
* SetSkipPlotNPTH_Pads( bool aSkip )
* aSkip = true to skip NPTH Pads, when the pad size and the pad hole
* have the same size. Used in GERBER format only.
* SetDrillMarksType( DrillMarksType aVal ) controle the actual hole:
* no hole, small hole, actual hole
*/
void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt,
bool aPlotVia, bool aSkipNPTH_Pads );
const PCB_PLOT_PARAMS& aPlotOpt );
/**
* Function PlotSilkScreen
......@@ -131,18 +176,6 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt );
/**
* Function PlotDrillMarks
* Draw a drill mark for pads and vias.
* Must be called after all drawings, because it
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape
* in FILLED plot mode
* @param aBoard = the board to plot
* @param aPlotter = the PLOTTER
* @param aPlotOpts = plot options
*/
void PlotDrillMarks( BOARD *aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts );
// PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment