diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 07da514a8e..5ecc8f8232 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -163,6 +163,7 @@ set( COMMON_SRCS config_params.cpp confirm.cpp copy_to_clipboard.cpp + convert_basic_shapes_to_polygon.cpp dialog_shim.cpp displlst.cpp draw_frame.cpp @@ -247,7 +248,6 @@ set( PCB_COMMON_SRCS base_screen.cpp eda_text.cpp class_page_info.cpp - convert_basic_shapes_to_polygon.cpp pcbcommon.cpp footprint_info.cpp ../pcbnew/basepcbframe.cpp diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index 89aabe2f73..fbca11328f 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -11,6 +11,7 @@ #include #include #include +#include /** * Oblique angle for DXF native text @@ -319,35 +320,43 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int /** * DXF polygon: doesn't fill it but at least it close the filled ones + * DXF does not know thick outline. + * It does not know thhick segments, therefore filled polygons with thick outline + * are converted to inflated polygon by aWidth/2 */ +#include "clipper.hpp" void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth) { if( aCornerList.size() <= 1 ) return; + unsigned last = aCornerList.size() - 1; + // Plot outlines with lines (thickness = 0) to define the polygon - if( aWidth == 0 || aFill ) + if( aWidth <= 0 ) { MoveTo( aCornerList[0] ); for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) LineTo( aCornerList[ii] ); + + // Close polygon if 'fill' requested + if( aFill ) + { + if( aCornerList[last] != aCornerList[0] ) + LineTo( aCornerList[0] ); + } + + PenFinish(); + + return; } - // Close polygon if 'fill' requested - unsigned last = aCornerList.size() - 1; - if( aFill ) - { - if( aCornerList[last] != aCornerList[0] ) - LineTo( aCornerList[0] ); - } - - PenFinish(); - - // if the polygon outline has thickness, plot outlines with thick segments - if( aWidth > 0 ) + // if the polygon outline has thickness, and is not filled + // (i.e. is a polyline) plot outlines with thick segments + if( aWidth > 0 && !aFill ) { MoveTo( aCornerList[0] ); @@ -355,10 +364,72 @@ void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, ThickSegment( aCornerList[ii-1], aCornerList[ii], aWidth, FILLED ); - if( aCornerList[last] != aCornerList[0] ) - ThickSegment( aCornerList[last], aCornerList[0], - aWidth, FILLED ); + return; } + + // The polygon outline has thickness, and is filled + // Build and plot the polygon which contains the initial + // polygon and its thick outline + CPOLYGONS_LIST bufferOutline; + CPOLYGONS_LIST bufferPolybase; + const int circleToSegmentsCount = 16; + + // enter outline as polygon: + for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) + { + TransformRoundedEndsSegmentToPolygon( bufferOutline, + aCornerList[ii-1], aCornerList[ii], circleToSegmentsCount, aWidth ); + } + + // enter the initial polygon: + for( unsigned ii = 0; ii < aCornerList.size(); ii++ ) + { + CPolyPt polypoint( aCornerList[ii].x, aCornerList[ii].y ); + bufferPolybase.Append( polypoint ); + } + + bufferPolybase.CloseLastContour(); + + // Merge polygons to build the polygon which contains the initial + // polygon and its thick outline + KI_POLYGON_SET polysBase; // Store the main outline and the final outline + KI_POLYGON_SET polysOutline; // Store the thick segments to draw the outline + bufferPolybase.ExportTo( polysBase ); + bufferOutline.ExportTo( polysOutline ); + + polysBase += polysOutline; // create the outline which contains thick outline + + // We should have only one polygon in list, now. + wxASSERT( polysBase.size() == 1 ); + + if( polysBase.size() < 1 ) // should not happen + return; + + KI_POLYGON poly = polysBase[0]; // Expected only one polygon here + + if( poly.size() < 2 ) // should not happen + return; + + // Now, output the final polygon to DXF file: + last = poly.size() - 1; + KI_POLY_POINT point = *(poly.begin()); + wxPoint startPoint( point.x(), point.y() ); + MoveTo( startPoint ); + + for( unsigned ii = 1; ii < poly.size(); ii++ ) + { + point = *( poly.begin() + ii ); + LineTo( wxPoint( point.x(), point.y() ) ); + } + + // Close polygon, if needed + point = *(poly.begin() + last); + wxPoint endPoint( point.x(), point.y() ); + + if( endPoint != startPoint ) + LineTo( startPoint ); + + PenFinish(); } diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp index e8b5273ded..c0b1d418c3 100644 --- a/common/common_plotGERBER_functions.cpp +++ b/common/common_plotGERBER_functions.cpp @@ -325,25 +325,32 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, if( aCornerList.size() <= 1 ) return; + // Gerber format does not know filled polygons with thick outline + // Thereore, to plot a filled polygon with outline having a thickness, + // one should plot outline as thick segments + SetCurrentLineWidth( aWidth ); if( aFill ) + { fputs( "G36*\n", outputFile ); - MoveTo( aCornerList[0] ); + MoveTo( aCornerList[0] ); - for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) - { - LineTo( aCornerList[ii] ); - } + for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) + LineTo( aCornerList[ii] ); - if( aFill ) - { FinishTo( aCornerList[0] ); fputs( "G37*\n", outputFile ); } - else + + if( aWidth > 0 ) { + MoveTo( aCornerList[0] ); + + for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) + LineTo( aCornerList[ii] ); + PenFinish(); } } diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index d3ff46b6f4..8498b0491b 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -264,6 +264,8 @@ void HPGL_PLOTTER::PlotPoly( const std::vector& aCornerList, if( aCornerList.size() <= 1 ) return; + SetCurrentLineWidth( aWidth ); + MoveTo( aCornerList[0] ); for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) diff --git a/eeschema/dialogs/dialog_libedit_dimensions_base.fbp b/eeschema/dialogs/dialog_libedit_dimensions_base.fbp index 0b76d9a183..0c3540751b 100644 --- a/eeschema/dialogs/dialog_libedit_dimensions_base.fbp +++ b/eeschema/dialogs/dialog_libedit_dimensions_base.fbp @@ -1,8 +1,8 @@ - + - + C++ 1 UTF-8 @@ -12,66 +12,66 @@ none 1 dialog_libedit_dimensions_base - + . - + 1 1 0 - + wxBOTH - + 1 - - - + + + 0 wxID_ANY - - + + DIALOG_LIBEDIT_DIMENSIONS_BASE - + 412,349 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + Library Editor Options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + mainSizer wxVERTICAL none @@ -83,9 +83,9 @@ 3 wxHORIZONTAL 0,1,2 - + 0 - + fgSizer1 wxFLEX_GROWMODE_SPECIFIED none @@ -96,50 +96,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 1 - - + + 1 - - + + 0 wxID_ANY &Grid size: - - + + m_staticText3 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -147,50 +147,50 @@ wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - + "50" "25" "10" "5" "2" "1" - + 1 - - + + 0 wxID_ANY - - + + m_choiceGridSize protected - + 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -198,50 +198,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticGridUnits protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -249,50 +249,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 1 - - + + 1 - - + + 0 wxID_ANY Current graphic &line width: - - + + m_staticText5 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -300,54 +300,54 @@ wxALL|wxEXPAND 0 - - + + 1 - - + + 0 wxID_ANY - + 0 - + m_CurrentGraphicLineThicknessCtrl protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -355,50 +355,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticLineWidthUnits protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -406,50 +406,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 1 - - + + 1 - - + + 0 wxID_ANY Current graphic text &size: - - + + m_staticText7 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -457,54 +457,54 @@ wxALL|wxEXPAND 0 - - + + 1 - - + + 0 wxID_ANY - + 0 - + m_CurrentGraphicTextSizeCtrl protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -512,50 +512,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticTextSizeUnits protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -563,50 +563,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 1 - - + + 1 - - + + 0 wxID_ANY Repeat draw item &horizontal displacement: - - + + m_staticText9 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -614,50 +614,50 @@ wxALL|wxEXPAND 0 - + "50" "25" - + 1 - - + + 0 wxID_ANY - - + + m_choiceRepeatHorizontal protected - + 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -665,50 +665,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticRepeatXUnits protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -716,50 +716,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 1 - - + + 1 - - + + 0 wxID_ANY Repeat draw item &vertical displacement: - - + + m_staticText12 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -767,50 +767,50 @@ wxALL|wxEXPAND 0 - + "50" "25" - + 1 - - + + 0 wxID_ANY - - + + m_choiceRepeatVertical protected - + 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -818,50 +818,50 @@ wxALIGN_CENTER_VERTICAL|wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticRepeatYUnits protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -869,50 +869,50 @@ wxALL|wxALIGN_CENTER_VERTICAL 0 - - + + 1 - - + + 0 wxID_ANY Current &pin lenght: - - + + m_staticText15 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -920,54 +920,54 @@ wxEXPAND|wxALL 0 - - + + 1 - - + + 0 wxID_ANY - + 0 - + m_CurrentPinLenghtCtrl protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -975,50 +975,50 @@ wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticText161 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1026,50 +1026,50 @@ wxALL|wxALIGN_CENTER_VERTICAL 0 - - + + 1 - - + + 0 wxID_ANY Current pin name size: - - + + m_CurrentPinNameSizeText protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1077,54 +1077,54 @@ wxALL|wxEXPAND 0 - - + + 1 - - + + 0 wxID_ANY - + 0 - + m_CurrentPinNameSizeCtrl protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1132,50 +1132,50 @@ wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticText18 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1183,50 +1183,50 @@ wxALL|wxALIGN_CENTER_VERTICAL 0 - - + + 1 - - + + 0 wxID_ANY Current pin number size: - - + + m_CurrentPinNumberSizeText protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1234,54 +1234,54 @@ wxALL|wxEXPAND 0 - - + + 1 - - + + 0 wxID_ANY - + 0 - + m_CurrentPinNumberSizeCtrl protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1289,50 +1289,50 @@ wxALL 0 - - + + 1 - - + + 0 wxID_ANY mils - - + + m_staticText20 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1340,50 +1340,50 @@ wxALL|wxALIGN_CENTER_VERTICAL 0 - - + + 1 - - + + 0 wxID_ANY &Repeat pin number increment: - - + + m_staticText16 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1391,54 +1391,54 @@ wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - - + + 1 - - + + 0 wxID_ANY 1 10 - + 0 - + m_spinRepeatLabel protected - - + + wxSP_ARROW_KEYS|wxSP_WRAP - - + + 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1458,48 +1458,48 @@ wxEXPAND | wxALL 0 - - + + 1 - - + + 0 wxID_ANY - - + + m_staticline1 protected - - + + wxLI_HORIZONTAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1507,7 +1507,7 @@ wxALIGN_RIGHT 0 - + bSizerBttons wxHORIZONTAL none @@ -1516,51 +1516,51 @@ wxALL 0 - - + + 0 1 - - + + 0 wxID_ANY Save as Default - - + + m_buttonSave protected - - - - - - - - + + + + + + + + OnSaveSetupClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1576,17 +1576,17 @@ 1 0 0 - + m_sdbSizer1 protected - + OnCancelClick - - - + + + OnOkClick - - + + diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 3b2550e931..bf9e0d28ac 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -775,6 +775,8 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) // Save the current plot options in the board m_parent->SetPlotSettings( m_plotOpts ); + wxBusyCursor dummy; + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) ) diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 00dbeede81..3926012958 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -539,13 +539,14 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) // Plot the current filled area and its outline if( GetMode() == FILLED ) { - // Plot the current filled area polygon - if( aZone->GetFillMode() == 0 ) // We are using solid polygons - { // (if != 0: using segments ) - m_plotter->PlotPoly( cornerList, FILLED_SHAPE ); + // 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 + { + m_plotter->PlotPoly( cornerList, FILLED_SHAPE, aZone->GetMinThickness() ); } - else // We are using areas filled by - { // segments: plot them ) + else // We are using areas filled by segments: plot segments and outline + { for( unsigned iseg = 0; iseg < aZone->FillSegments().size(); iseg++ ) { wxPoint start = aZone->FillSegments()[iseg].m_Start; @@ -554,11 +555,11 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) aZone->GetMinThickness(), GetMode() ); } - } - // Plot the current filled area outline + // Plot the area outline only if( aZone->GetMinThickness() > 0 ) m_plotter->PlotPoly( cornerList, NO_FILL, aZone->GetMinThickness() ); + } } else {