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
This commit is contained in:
jean-pierre charras 2012-09-24 08:39:59 +02:00
parent 160560c916
commit cc47e88b9e
16 changed files with 5024 additions and 5012 deletions

View File

@ -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 );

View File

@ -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
);
}

View File

@ -17,9 +17,6 @@ enum PAD_SHAPE_T
PAD_RECT,
PAD_OVAL,
PAD_TRAPEZOID,
PAD_RRECT,
PAD_OCTAGON,
PAD_SQUARE,
};

View File

@ -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;
};

View File

@ -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();

View File

@ -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() );

View File

@ -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;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -116,13 +116,16 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizerPlotItems->Add( m_plotNoViaOnMaskOpt, 0, wxALL, 2 );
m_plotMirrorOpt = new wxCheckBox( this, ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotMirrorOpt, 0, wxALL, 2 );
m_excludeEdgeLayerOpt = new wxCheckBox( this, wxID_ANY, _("Exclude PCB edge layer from other layers"), wxDefaultPosition, wxDefaultSize, 0 );
m_excludeEdgeLayerOpt->SetToolTip( _("Exclude contents of the pcb edge layer from all other layers") );
bSizerPlotItems->Add( m_excludeEdgeLayerOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
bSizerPlotItems->Add( m_excludeEdgeLayerOpt, 0, wxALL, 2 );
m_plotMirrorOpt = new wxCheckBox( this, ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotMirrorOpt, 0, wxALL, 2 );
m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotPSNegativeOpt, 0, wxALL, 2 );
bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 );
@ -301,9 +304,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_PSOptionsSizer->Add( bSizer17, 1, wxEXPAND, 5 );
m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_plotPSNegativeOpt, 0, wxALL, 2 );
m_forcePSA4OutputOpt = new wxCheckBox( this, wxID_ANY, _("Force A4 output"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_forcePSA4OutputOpt, 0, wxALL, 2 );

View File

@ -1344,6 +1344,94 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Exclude PCB edge layer from other layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_excludeEdgeLayerOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Exclude contents of the pcb edge layer from all other layers</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxALL</property>
@ -1434,7 +1522,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@ -1465,7 +1553,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Exclude PCB edge layer from other layers</property>
<property name="label">Negative plot</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1473,7 +1561,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_excludeEdgeLayerOpt</property>
<property name="name">m_plotPSNegativeOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1486,7 +1574,7 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Exclude contents of the pcb edge layer from all other layers</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@ -3103,7 +3191,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -3288,7 +3376,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -3473,7 +3561,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -3649,94 +3737,6 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Negative plot</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_plotPSNegativeOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
<property name="flag">wxALL</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -61,8 +61,9 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
@ -89,7 +90,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxTextCtrl* m_fineAdjustYscaleOpt;
wxStaticText* m_textPSFineAdjustWidth;
wxTextCtrl* m_PSFineAdjustWidthOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_forcePSA4OutputOpt;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;

View File

@ -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;

View File

@ -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;
}

View File

@ -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 );
};

View File

@ -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;
}/*}}}*/

View File

@ -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,
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
*
* 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 );

View File

@ -112,6 +112,38 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
return true;
}
// plot items like text and graphics, but not tracks and module
void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
{
for( BOARD_ITEM* item = m_board->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_LINE_T:
PlotDrawSegment( (DRAWSEGMENT*) item);
break;
case PCB_TEXT_T:
PlotTextePcb( (TEXTE_PCB*) item );
break;
case PCB_DIMENSION_T:
PlotDimension( (DIMENSION*) item );
break;
case PCB_TARGET_T:
PlotPcbTarget( (PCB_TARGET*) item );
break;
case PCB_MARKER_T:
default:
break;
}
}
}
/* Creates the plot for silkscreen layers
*/
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
@ -121,35 +153,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
itemplotter.SetLayerMask( aLayerMask );
// Plot edge layer and graphic items
for( EDA_ITEM* item = aBoard->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_LINE_T:
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) item);
break;
case PCB_TEXT_T:
itemplotter.PlotTextePcb( (TEXTE_PCB*) item );
break;
case PCB_DIMENSION_T:
itemplotter.PlotDimension( (DIMENSION*) item );
break;
case PCB_TARGET_T:
itemplotter.PlotPcbTarget( (PCB_TARGET*) item );
break;
case PCB_MARKER_T:
break;
default:
wxLogMessage( wxT( "PlotSilkScreen() error: unexpected Type(%d)" ),
item->Type() );
break;
}
}
itemplotter.PlotBoardGraphicItems();
// Plot footprint outlines :
itemplotter.Plot_Edges_Modules();
@ -682,9 +686,10 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
}
void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
const PCB_PLOT_PARAMS& aPlotOpt )
{
PCB_PLOT_PARAMS plotOpt = aPlotOpt;
// Set a default color and the text mode for this layer
aPlotter->SetColor( aPlotOpt.GetColor() );
aPlotter->SetTextMode( aPlotOpt.GetTextMode() );
@ -715,48 +720,53 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
case LAYER_N_15:
case LAST_COPPER_LAYER:
// Skip NPTH pads on copper layers ( only if hole size == pad size ):
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt, true, true );
// Adding drill marks, if required and if the plotter is able to plot them:
if( aPlotOpt.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
PlotDrillMarks( aBoard, aPlotter, aPlotOpt );
plotOpt.SetSkipPlotNPTH_Pads( true );
// Drill mark will be plotted,
// if drill mark is SMALL_DRILL_SHAPE or FULL_DRILL_SHAPE
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
break;
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt,
aPlotOpt.GetPlotViaOnMaskLayer(), false );
plotOpt.SetSkipPlotNPTH_Pads( false );
// Disable plot pad holes
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
break;
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt,
false, false );
plotOpt.SetSkipPlotNPTH_Pads( false );
// Disable plot pad holes
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
break;
case SILKSCREEN_N_FRONT:
case SILKSCREEN_N_BACK:
PlotSilkScreen( aBoard, aPlotter, layer_mask, aPlotOpt );
PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt );
// Gerber: Subtract soldermask from silkscreen if enabled
if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER
&& aPlotOpt.GetSubtractMaskFromSilk() )
&& plotOpt.GetSubtractMaskFromSilk() )
{
plotOpt.SetPlotViaOnMaskLayer( true );
if( aLayer == SILKSCREEN_N_FRONT )
layer_mask = GetLayerMask( SOLDERMASK_N_FRONT );
else
layer_mask = GetLayerMask( SOLDERMASK_N_BACK );
// Set layer polarity to negative
// Create the mask to substract by creating a negative layer polarity
aPlotter->SetLayerPolarity( false );
PlotStandardLayer( aBoard, aPlotter, layer_mask, aPlotOpt,
aPlotOpt.GetPlotViaOnMaskLayer(), false );
// Disable plot pad holes
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
// Plot the mask
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );
}
break;
default:
PlotSilkScreen( aBoard, aPlotter, layer_mask, aPlotOpt );
PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt );
break;
}
}
@ -766,48 +776,16 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
* Silk screen layers are not plotted here.
*/
void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt,
bool aPlotVia, bool aSkipNPTH_Pads )
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt )
{
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
itemplotter.SetLayerMask( aLayerMask );
wxPoint pos;
wxSize size;
EDA_DRAW_MODE_T plotMode = aPlotOpt.GetMode();
EDA_DRAW_MODE_T aPlotMode = aPlotOpt.GetMode();
// Plot pcb draw items.
for( BOARD_ITEM* item = aBoard->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_LINE_T:
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) item );
break;
case PCB_TEXT_T:
itemplotter.PlotTextePcb( (TEXTE_PCB*) item );
break;
case PCB_DIMENSION_T:
itemplotter.PlotDimension( (DIMENSION*) item );
break;
case PCB_TARGET_T:
itemplotter.PlotPcbTarget( (PCB_TARGET*) item );
break;
case PCB_MARKER_T:
break;
default:
wxLogMessage( wxT( "Plot_Standard_Layer() error : Unexpected Draw Type %d" ),
item->Type() );
break;
}
}
// Plot edge layer and graphic items
itemplotter.PlotBoardGraphicItems();
// Draw footprint shapes without pads (pads will plotted later)
// We plot here module texts, but they are usually on silkscreen layer,
@ -851,14 +829,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
wxPoint shape_pos = pad->ReturnShapePos();
pos = shape_pos;
wxSize margin;
double width_adj = 0;
if( aLayerMask & ALL_CU_LAYERS )
{
width_adj = aPlotter->GetPlotWidthAdj();
width_adj = itemplotter.getFineWidthAdj();
}
switch( aLayerMask &
@ -879,6 +855,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
break;
}
wxSize size;
size.x = pad->GetSize().x + ( 2 * margin.x ) + width_adj;
size.y = pad->GetSize().y + ( 2 * margin.y ) + width_adj;
@ -886,7 +863,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if( size.x <= 0 || size.y <= 0 )
continue;
EDA_COLOR_T color = ColorFromInt(0);
EDA_COLOR_T color = BLACK;
if( (pad->GetLayerMask() & LAYER_BACK) )
color = aBoard->GetVisibleElementColor( PAD_BK_VISIBLE );
@ -901,42 +878,41 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
switch( pad->GetShape() )
{
case PAD_CIRCLE:
if( aSkipNPTH_Pads &&
if( aPlotOpt.GetSkipPlotNPTH_Pads() &&
(pad->GetSize() == pad->GetDrillSize()) &&
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
break;
aPlotter->FlashPadCircle( pos, size.x, aPlotMode );
aPlotter->FlashPadCircle( shape_pos, size.x, plotMode );
break;
case PAD_OVAL:
if( aSkipNPTH_Pads &&
if( aPlotOpt.GetSkipPlotNPTH_Pads() &&
(pad->GetSize() == pad->GetDrillSize()) &&
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
break;
aPlotter->FlashPadOval( pos, size, pad->GetOrientation(), aPlotMode );
aPlotter->FlashPadOval( shape_pos, size, pad->GetOrientation(), plotMode );
break;
case PAD_TRAPEZOID:
{
wxPoint coord[4];
pad->BuildPadPolygon( coord, margin, 0 );
aPlotter->FlashPadTrapez( pos, coord, pad->GetOrientation(), aPlotMode );
aPlotter->FlashPadTrapez( shape_pos, coord, pad->GetOrientation(), plotMode );
}
break;
case PAD_RECT:
default:
aPlotter->FlashPadRect( pos, size, pad->GetOrientation(), aPlotMode );
aPlotter->FlashPadRect( shape_pos, size, pad->GetOrientation(), plotMode );
break;
}
}
}
// Plot vias :
if( aPlotVia )
{
// Plot vias on copper layers, and if aPlotOpt.GetPlotViaOnMaskLayer() is true,
// plot them on solder mask
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
{
if( track->Type() != PCB_VIA_T )
@ -946,14 +922,17 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
// vias are not plotted if not on selected layer, but if layer
// is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn,
// if they are on an external copper layer
// only if they are on the corresponding external copper layer
int via_mask_layer = Via->ReturnMaskLayer();
if( aPlotOpt.GetPlotViaOnMaskLayer() )
{
if( via_mask_layer & LAYER_BACK )
via_mask_layer |= SOLDERMASK_LAYER_BACK;
if( via_mask_layer & LAYER_FRONT )
via_mask_layer |= SOLDERMASK_LAYER_FRONT;
}
if( ( via_mask_layer & aLayerMask ) == 0 )
continue;
@ -967,60 +946,44 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
via_margin = aBoard->GetDesignSettings().m_SolderMaskMargin;
if( aLayerMask & ALL_CU_LAYERS )
width_adj = aPlotter->GetPlotWidthAdj();
width_adj = itemplotter.getFineWidthAdj();
pos = Via->m_Start;
size.x = size.y = Via->m_Width + 2 * via_margin + width_adj;
int diameter = Via->m_Width + 2 * via_margin + width_adj;
// Don't draw a null size item :
if( size.x <= 0 )
if( diameter <= 0 )
continue;
EDA_COLOR_T color = aBoard->GetVisibleElementColor(VIAS_VISIBLE + Via->m_Shape);
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
aPlotter->FlashPadCircle( pos, size.x, aPlotMode );
}
aPlotter->FlashPadCircle( Via->m_Start, diameter, plotMode );
}
// Plot tracks (not vias) :
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
{
wxPoint end;
if( track->Type() == PCB_VIA_T )
continue;
if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 )
continue;
size.x = size.y = track->m_Width + aPlotter->GetPlotWidthAdj();
pos = track->m_Start;
end = track->m_End;
EDA_COLOR_T color = aBoard->GetLayerColor( track->GetLayer() );
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
aPlotter->ThickSegment( pos, end, size.x, aPlotMode );
int width = track->m_Width + itemplotter.getFineWidthAdj();
aPlotter->SetColor( itemplotter.getColor( track->GetLayer() ) );
aPlotter->ThickSegment( track->m_Start, track->m_End, width, plotMode );
}
// Plot zones (outdated, for old boards compatibility):
for( TRACK* track = aBoard->m_Zone; track; track = track->Next() )
{
wxPoint end;
if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 )
continue;
size.x = size.y = track->m_Width + aPlotter->GetPlotWidthAdj();
pos = track->m_Start;
end = track->m_End;
aPlotter->ThickSegment( pos, end, size.x, aPlotMode );
int width = track->m_Width + itemplotter.getFineWidthAdj();
aPlotter->SetColor( itemplotter.getColor( track->GetLayer() ) );
aPlotter->ThickSegment( track->m_Start, track->m_End, width, plotMode );
}
// Plot filled ares
@ -1033,31 +996,35 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
itemplotter.PlotFilledAreas( zone );
}
// Adding drill marks, if required and if the plotter is able to plot them:
if( aPlotOpt.GetDrillMarksType() != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
itemplotter.PlotDrillMarks();
}
/** Helper function to plot a single drill mark. It compensate and clamp
the drill mark size depending on the current plot options */
static void PlotDrillMark( PLOTTER *aPlotter, PAD_SHAPE_T aDrillShape,
* the drill mark size depending on the current plot options
*/
void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_SHAPE_T aDrillShape,
const wxPoint &aDrillPos, wxSize aDrillSize,
const wxSize &aPadSize,
double aOrientation, int aSmallDrill,
EDA_DRAW_MODE_T aTraceMode )
double aOrientation, int aSmallDrill )
{
// Small drill marks have no significance when applied to slots
if( aSmallDrill && aDrillShape == PAD_ROUND )
aDrillSize.x = std::min( aSmallDrill, aDrillSize.x );
// Round holes only have x diameter, slots have both
aDrillSize.x -= aPlotter->GetPlotWidthAdj();
aDrillSize.x -= getFineWidthAdj();
aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 );
if( aDrillShape == PAD_OVAL )
{
aDrillSize.y -= aPlotter->GetPlotWidthAdj();
aDrillSize.y -= getFineWidthAdj();
aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 );
aPlotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, aTraceMode );
m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetMode() );
}
else
aPlotter->FlashPadCircle( aDrillPos, aDrillSize.x, aTraceMode );
m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetMode() );
}
/* Function PlotDrillMarks
@ -1066,14 +1033,11 @@ static void PlotDrillMark( PLOTTER *aPlotter, PAD_SHAPE_T aDrillShape,
* 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( BOARD *aBoard, PLOTTER* aPlotter,
const PCB_PLOT_PARAMS& aPlotOpts )
void BRDITEMS_PLOTTER::PlotDrillMarks()
{
EDA_DRAW_MODE_T trace_mode = aPlotOpts.GetMode();
/* If small drills marks were requested prepare a clamp value to pass
to the helper function */
int small_drill = (aPlotOpts.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) ?
int small_drill = (GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) ?
SMALL_DRILL : 0;
/* In the filled trace mode drill marks are drawn white-on-black to scrape
@ -1087,40 +1051,35 @@ void PlotDrillMarks( BOARD *aBoard, PLOTTER* aPlotter,
you could start a layer with negative polarity to scrape the film.
- In DXF they go into the 'WHITE' layer. This could be useful.
*/
if( trace_mode == FILLED )
{
aPlotter->SetColor( WHITE );
}
if( GetMode() == FILLED )
m_plotter->SetColor( WHITE );
for( TRACK *pts = aBoard->m_Track; pts != NULL; pts = pts->Next() )
for( TRACK *pts = m_board->m_Track; pts != NULL; pts = pts->Next() )
{
if( pts->Type() != PCB_VIA_T )
continue;
PlotDrillMark( aPlotter, PAD_CIRCLE,
plotOneDrillMark(PAD_CIRCLE,
pts->m_Start, wxSize( pts->GetDrillValue(), 0 ),
wxSize( pts->m_Width, 0 ), 0, small_drill,
trace_mode );
wxSize( pts->m_Width, 0 ), 0, small_drill );
}
for( MODULE *Module = aBoard->m_Modules; Module != NULL; Module = Module->Next() )
for( MODULE *Module = m_board->m_Modules; Module != NULL; Module = Module->Next() )
{
for( D_PAD *pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
{
if( pad->GetDrillSize().x == 0 )
continue;
PlotDrillMark( aPlotter, pad->GetDrillShape(),
plotOneDrillMark( pad->GetDrillShape(),
pad->GetPosition(), pad->GetDrillSize(),
pad->GetSize(), pad->GetOrientation(),
small_drill, trace_mode );
small_drill );
}
}
if( trace_mode == FILLED )
{
aPlotter->SetColor( aPlotOpts.GetColor() );
}
if( GetMode() == FILLED )
m_plotter->SetColor( GetColor() );
}
/** Set up most plot options for plotting a board (especially the viewport)
@ -1202,7 +1161,7 @@ static void PlotSetupPlotter( PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts,
/* Configure the plotter object with all the stuff computed and
most of that taken from the options */
aPlotter->SetPageSettings( *sheet_info );
aPlotter->SetPlotWidthAdj( aPlotOpts->GetWidthAdjust() );
aPlotter->SetViewport( offset, IU_PER_DECIMILS, compound_scale,
aPlotOpts->GetMirror() );
aPlotter->SetDefaultLineWidth( aPlotOpts->GetLineWidth() );
@ -1214,14 +1173,14 @@ static void PlotSetupPlotter( PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts,
/** Prefill in black an area a little bigger than the board to prepare for the
* negative plot */
static void FillNegativeKnockout(PLOTTER *aPlotter, const EDA_RECT &aBbbox )
static void FillNegativeKnockout( PLOTTER *aPlotter, const EDA_RECT &aBbbox )
{
static const int margin = 5 * IU_PER_MM; // Add a 5 mm margin around the board
const int margin = 5 * IU_PER_MM; // Add a 5 mm margin around the board
aPlotter->SetNegative( true );
aPlotter->SetColor( WHITE ); // Which will be plotted as black
aPlotter->Rect( wxPoint( aBbbox.GetX() - margin, aBbbox.GetY() - margin ),
wxPoint( aBbbox.GetRight() + margin, aBbbox.GetBottom() + margin ),
FILLED_SHAPE );
EDA_RECT area = aBbbox;
area.Inflate( margin );
aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILLED_SHAPE );
aPlotter->SetColor( BLACK );
}
@ -1232,7 +1191,7 @@ static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter,
{
/* Compute pen_dim (the value is given in mils) in pcb units,
with plot scale (if Scale is 2, pen diameter value is always m_HPGLPenDiam
so apparent pen diam is real pen diam / Scale */
so apparent pen diam is actually pen diam / Scale */
int pen_diam = KiROUND( aPlotOpts->GetHPGLPenDiameter() * IU_PER_MILS /
aPlotOpts->GetScale() );
@ -1263,8 +1222,6 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
const wxString& aSheetDesc )
{
const PAGE_INFO& pageInfo = aBoard->GetPageSettings();
EDA_RECT bbbox = aBoard->ComputeBoundingBox();
wxPoint auxOrigin( aBoard->GetOriginAxisPosition() );
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL )
@ -1315,6 +1272,8 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
if( the_plotter )
{
EDA_RECT bbbox = aBoard->ComputeBoundingBox();
wxPoint auxOrigin( aBoard->GetOriginAxisPosition() );
// Compute the viewport and set the other options
PlotSetupPlotter( the_plotter, aPlotOpts, pageInfo, bbbox, auxOrigin,
aFullFileName );
@ -1333,8 +1292,7 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
PlotWorkSheet( the_plotter, aBoard->GetTitleBlock(),
aBoard->GetPageSettings(),
1, 1, // Only one page
aSheetDesc,
aBoard->GetFileName() );
aSheetDesc, aBoard->GetFileName() );
return the_plotter;
}