Loading common/class_plotter.cpp +42 −36 Original line number Original line Diff line number Diff line Loading @@ -100,47 +100,53 @@ double PLOTTER::user_to_device_size( double size ) void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill ) void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill ) { { int radius = wxRound( diametre / 2.8284 ); int radius = wxRound( diametre / 2.8284 ); int coord[10] = static std::vector< wxPoint > corner_list; { corner_list.clear(); position.x + radius, position.y + radius, wxPoint corner; position.x + radius, position.y - radius, corner.x = position.x + radius; position.x - radius, position.y - radius, corner.y = position.y + radius; position.x - radius, position.y + radius, corner_list.push_back( corner ); position.x + radius, position.y + radius corner.x = position.x + radius; }; corner.y = position.y - radius; corner_list.push_back( corner ); if( fill ) corner.x = position.x - radius; { corner.y = position.y - radius; poly( 4, coord, fill ); corner_list.push_back( corner ); } corner.x = position.x - radius; else corner.y = position.y + radius; { corner_list.push_back( corner ); poly( 5, coord, fill ); corner.x = position.x + radius; } corner.y = position.y + radius; corner_list.push_back( corner ); PlotPoly( corner_list, fill ); } } void PLOTTER::center_lozenge( const wxPoint& position, int diametre, void PLOTTER::center_lozenge( const wxPoint& position, int diametre, FILL_T fill ) FILL_T fill ) { { int radius = diametre / 2; int radius = diametre / 2; int coord[10] = static std::vector< wxPoint > corner_list; { corner_list.clear(); position.x, position.y + radius, wxPoint corner; position.x + radius, position.y, corner.x = position.x; position.x, position.y - radius, corner.y = position.y + radius; position.x - radius, position.y, corner_list.push_back( corner ); position.x, position.y + radius, corner.x = position.x + radius; }; corner.y = position.y, corner_list.push_back( corner ); if( fill ) corner.x = position.x; { corner.y = position.y - radius; poly( 4, coord, fill ); corner_list.push_back( corner ); } corner.x = position.x - radius; else corner.y = position.y; { corner_list.push_back( corner ); poly( 5, coord, fill ); corner.x = position.x; } corner.y = position.y + radius; corner_list.push_back( corner ); PlotPoly( corner_list, fill ); } } Loading common/common_plotDXF_functions.cpp +11 −13 Original line number Original line Diff line number Diff line Loading @@ -115,27 +115,25 @@ void DXF_PLOTTER::circle( wxPoint centre, int diameter, FILL_T fill, int width ) } } /* Draw a polygon (closed if completed) in DXF format /* Draw a polygon (closed if filled) in DXF format * coord = coord table tops * nb = number of coord (coord 1 = 2 elements: X and Y table) * nb = number of coord (coord 1 = 2 elements: X and Y table) * fill: if != 0 filled polygon * aFill: if != 0 filled polygon */ */ void DXF_PLOTTER::poly( int nb, int* coord, FILL_T fill, int width ) void DXF_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) if( nb <= 1 ) return; return; move_to( wxPoint( coord[0], coord[1] ) ); move_to( aCornerList[0] ); for( int ii = 1; ii < nb; ii++ ) for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) line_to( wxPoint( coord[ii * 2], coord[(ii * 2) + 1] ) ); line_to( aCornerList[ii] ); /* Close polygon. */ /* Close polygon. */ if( fill ) if( aFill ) { { int ii = (nb - 1) * 2; unsigned ii = aCornerList.size() - 1; if( ( coord[ii] != coord[0] ) || ( coord[ii + 1] != coord[1] ) ) if( aCornerList[ii] != aCornerList[0] ) line_to( wxPoint( coord[0], coord[1] ) ); line_to( aCornerList[0] ); } } pen_finish(); pen_finish(); } } Loading common/common_plotGERBER_functions.cpp +36 −32 Original line number Original line Diff line number Diff line Loading @@ -248,16 +248,20 @@ void GERBER_PLOTTER::pen_to( wxPoint aPos, char plume ) void GERBER_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) void GERBER_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) { { wxASSERT( output_file ); static std::vector< wxPoint > cornerList; int coord[10] = cornerList.clear(); { p1.x, p1.y, // Build corners list p1.x, p2.y, cornerList.push_back( p1 ); p2.x, p2.y, wxPoint corner(p1.x, p2.y); p2.x, p1.y, cornerList.push_back( corner ); p1.x, p1.y cornerList.push_back( p2 ); }; corner.x = p2.x; poly( 5, coord, fill, width ); corner.y = p1.y; cornerList.push_back( corner ); cornerList.push_back( p1 ); PlotPoly( cornerList, fill, width ); } } Loading Loading @@ -296,34 +300,31 @@ void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T aFill, /** /** * Function PlotFilledPolygon_GERBER * Function PlotPoly * writes a filled polyline to output file * writes a filled or not filled polyline to output file * @param aCornersCount = number of corners * @param aCoord = buffer of corners coordinates * @param aCoord = buffer of corners coordinates * @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR) * @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR) * @param aWidth = Width of the line to plot. * @param aWidth = Width of the line to plot. */ */ void GERBER_PLOTTER::poly( int aCornersCount, int* aCoord, FILL_T aFill, int aWidth ) void GERBER_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth ) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) wxPoint pos, startpos; return; set_current_line_width( aWidth ); set_current_line_width( aWidth ); if( aFill ) if( aFill ) fputs( "G36*\n", output_file ); fputs( "G36*\n", output_file ); startpos.x = *aCoord++; startpos.y = *aCoord++; move_to( aCornerList[0] ); move_to( startpos ); for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) for( int ii = 1; ii < aCornersCount; ii++ ) { { pos.x = *aCoord++; line_to( aCornerList[ii] ); pos.y = *aCoord++; line_to( pos ); } } if( aFill ) if( aFill ) { { finish_to( startpos ); finish_to( aCornerList[0] ); fputs( "G37*\n", output_file ); fputs( "G37*\n", output_file ); } } else else Loading Loading @@ -488,22 +489,25 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, int aPadOrient, GRTraceMode aTrace_Mode ) int aPadOrient, GRTraceMode aTrace_Mode ) { { wxPoint polygon[5]; // polygon corners list // polygon corners list static std::vector< wxPoint > cornerList; cornerList.clear(); for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) polygon[ii] = aCorners[ii]; cornerList.push_back( aCorners[ii] ); /* Draw the polygon and fill the interior as required. */ /* Draw the polygon and fill the interior as required. */ for( int ii = 0; ii < 4; ii++ ) for( unsigned ii = 0; ii < 4; ii++ ) { { RotatePoint( &polygon[ii], aPadOrient ); RotatePoint( &cornerList[ii], aPadOrient ); polygon[ii] += aPadPos; cornerList[ii] += aPadPos; } } // Close the polygon // Close the polygon polygon[4] = polygon[0]; cornerList.push_back( cornerList[0] ); set_current_line_width( -1 ); set_current_line_width( -1 ); poly( 5, &polygon[0].x, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); } } void GERBER_PLOTTER::SetLayerPolarity( bool aPositive ) void GERBER_PLOTTER::SetLayerPolarity( bool aPositive ) Loading common/common_plotHPGL_functions.cpp +11 −13 Original line number Original line Diff line number Diff line Loading @@ -75,26 +75,24 @@ void HPGL_PLOTTER::circle( wxPoint centre, /* Plot a polygon (closed if completed) in HPGL /* Plot a polygon (closed if completed) in HPGL * Coord = coord table tops * aCornerList = a wxPoint list of corner * Nb = number of coord (coord 1 = 2 elements: X and Y table) * aFill: if != 0 filled polygon * Fill: if! = 0 filled polygon */ */ void HPGL_PLOTTER::poly( int nb, int* coord, FILL_T fill, int width ) void HPGL_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) if( nb <= 1 ) return; return; move_to( wxPoint( coord[0], coord[1] ) ); move_to( aCornerList[0] ); for( int ii = 1; ii < nb; ii++ ) for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) line_to( wxPoint( coord[ii * 2], coord[(ii * 2) + 1] ) ); line_to( aCornerList[ii] ); /* Close polygon if filled. */ /* Close polygon if filled. */ if( fill ) if( aFill ) { { int ii = (nb - 1) * 2; int ii = aCornerList.size() - 1; if( (coord[ii] != coord[0] ) || (coord[ii + 1] != coord[1]) ) if( aCornerList[ii] != aCornerList[0] ) line_to( wxPoint( coord[0], coord[1] ) ); line_to( aCornerList[0] ); } } pen_finish(); pen_finish(); } } Loading common/common_plotPS_functions.cpp +49 −50 Original line number Original line Diff line number Diff line Loading @@ -168,40 +168,33 @@ void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius, } } /** /* * Function poly * Function PlotPoly * @brief Draw a polygon ( a filled polygon if fill == 1 ) in POSTSCRIPT format * Draw a polygon (filled or not) in POSTSCRIPT format * @param nb_segm = corner count * param aCornerList = corners list * @param coord = corner list (a corner uses 2 int = X coordinate followed by Y * param aFill :if true : filled polygon * coordinate * param aWidth = line width * @param fill :if true : filled polygon * @param width = line width */ */ void PS_PLOTTER::poly( int nb_segm, int* coord, FILL_T fill, int width ) void PS_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth ) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) wxPoint pos; if( nb_segm <= 1 ) return; return; set_current_line_width( width ); set_current_line_width( aWidth ); pos.x = coord[0]; wxPoint pos = aCornerList[0]; pos.y = coord[1]; user_to_device_coordinates( pos ); user_to_device_coordinates( pos ); fprintf( output_file, "newpath\n%d %d moveto\n", pos.x, pos.y ); fprintf( output_file, "newpath\n%d %d moveto\n", pos.x, pos.y ); for( int ii = 1; ii < nb_segm; ii++ ) for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) { { pos.x = coord[2 * ii]; pos = aCornerList[ii]; pos.y = coord[2 * ii + 1]; user_to_device_coordinates( pos ); user_to_device_coordinates( pos ); fprintf( output_file, "%d %d lineto\n", pos.x, pos.y ); fprintf( output_file, "%d %d lineto\n", pos.x, pos.y ); } } // Close path // Close path fprintf( output_file, "poly%d\n", fill ); fprintf( output_file, "poly%d\n", aFill ); } } Loading Loading @@ -445,7 +438,8 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, int orient, GRTraceMode trace_mode ) int orient, GRTraceMode trace_mode ) { { wxASSERT( output_file ); static std::vector< wxPoint > cornerList; cornerList.clear(); set_current_line_width( -1 ); set_current_line_width( -1 ); int w = current_pen_width; int w = current_pen_width; Loading @@ -459,23 +453,28 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, int dx = size.x / 2; int dx = size.x / 2; int dy = size.y / 2; int dy = size.y / 2; int coord[10] = wxPoint corner; { corner.x = pos.x - dx; pos.x - dx, pos.y + dy, corner.y = pos.y + dy; pos.x - dx, pos.y - dy, cornerList.push_back( corner ); pos.x + dx, pos.y - dy, corner.x = pos.x - dx; pos.x + dx, pos.y + dy, corner.y = pos.y - dy; 0, 0 cornerList.push_back( corner ); }; corner.x = pos.x + dx; corner.y = pos.y - dy; for( int ii = 0; ii < 4; ii++ ) cornerList.push_back( corner ); { corner.x = pos.x + dx; RotatePoint( &coord[ii * 2], &coord[ii * 2 + 1], pos.x, pos.y, orient ); corner.y = pos.y + dy, cornerList.push_back( corner ); for( unsigned ii = 0; ii < cornerList.size(); ii++ ) { RotatePoint( &cornerList[ii], pos, orient ); } } coord[8] = coord[0]; cornerList.push_back( cornerList[0] ); coord[9] = coord[1]; poly( 5, coord, ( trace_mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, ( trace_mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); } } Loading @@ -487,11 +486,11 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) int aPadOrient, GRTraceMode aTrace_Mode ) { { wxASSERT( output_file ); static std::vector< wxPoint > cornerList; wxPoint coord[5]; cornerList.clear(); for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) coord[ii] = aCorners[ii]; cornerList.push_back( aCorners[ii] ); if( aTrace_Mode == FILLED ) if( aTrace_Mode == FILLED ) { { Loading @@ -508,22 +507,22 @@ void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], // coord[3] is assumed the lower right // coord[3] is assumed the lower right /* Trace the outline. */ /* Trace the outline. */ coord[0].x += w; cornerList[0].x += w; coord[0].y -= w; cornerList[0].y -= w; coord[1].x += w; cornerList[1].x += w; coord[1].y += w; cornerList[1].y += w; coord[2].x -= w; cornerList[2].x -= w; coord[2].y += w; cornerList[2].y += w; coord[3].x -= w; cornerList[3].x -= w; coord[3].y -= w; cornerList[3].y -= w; } } for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) { { RotatePoint( &coord[ii], aPadOrient ); RotatePoint( &cornerList[ii], aPadOrient ); coord[ii] += aPadPos; cornerList[ii] += aPadPos; } } coord[4] = coord[0]; cornerList.push_back( cornerList[0] ); poly( 5, &coord[0].x, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); } } Loading
common/class_plotter.cpp +42 −36 Original line number Original line Diff line number Diff line Loading @@ -100,47 +100,53 @@ double PLOTTER::user_to_device_size( double size ) void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill ) void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill ) { { int radius = wxRound( diametre / 2.8284 ); int radius = wxRound( diametre / 2.8284 ); int coord[10] = static std::vector< wxPoint > corner_list; { corner_list.clear(); position.x + radius, position.y + radius, wxPoint corner; position.x + radius, position.y - radius, corner.x = position.x + radius; position.x - radius, position.y - radius, corner.y = position.y + radius; position.x - radius, position.y + radius, corner_list.push_back( corner ); position.x + radius, position.y + radius corner.x = position.x + radius; }; corner.y = position.y - radius; corner_list.push_back( corner ); if( fill ) corner.x = position.x - radius; { corner.y = position.y - radius; poly( 4, coord, fill ); corner_list.push_back( corner ); } corner.x = position.x - radius; else corner.y = position.y + radius; { corner_list.push_back( corner ); poly( 5, coord, fill ); corner.x = position.x + radius; } corner.y = position.y + radius; corner_list.push_back( corner ); PlotPoly( corner_list, fill ); } } void PLOTTER::center_lozenge( const wxPoint& position, int diametre, void PLOTTER::center_lozenge( const wxPoint& position, int diametre, FILL_T fill ) FILL_T fill ) { { int radius = diametre / 2; int radius = diametre / 2; int coord[10] = static std::vector< wxPoint > corner_list; { corner_list.clear(); position.x, position.y + radius, wxPoint corner; position.x + radius, position.y, corner.x = position.x; position.x, position.y - radius, corner.y = position.y + radius; position.x - radius, position.y, corner_list.push_back( corner ); position.x, position.y + radius, corner.x = position.x + radius; }; corner.y = position.y, corner_list.push_back( corner ); if( fill ) corner.x = position.x; { corner.y = position.y - radius; poly( 4, coord, fill ); corner_list.push_back( corner ); } corner.x = position.x - radius; else corner.y = position.y; { corner_list.push_back( corner ); poly( 5, coord, fill ); corner.x = position.x; } corner.y = position.y + radius; corner_list.push_back( corner ); PlotPoly( corner_list, fill ); } } Loading
common/common_plotDXF_functions.cpp +11 −13 Original line number Original line Diff line number Diff line Loading @@ -115,27 +115,25 @@ void DXF_PLOTTER::circle( wxPoint centre, int diameter, FILL_T fill, int width ) } } /* Draw a polygon (closed if completed) in DXF format /* Draw a polygon (closed if filled) in DXF format * coord = coord table tops * nb = number of coord (coord 1 = 2 elements: X and Y table) * nb = number of coord (coord 1 = 2 elements: X and Y table) * fill: if != 0 filled polygon * aFill: if != 0 filled polygon */ */ void DXF_PLOTTER::poly( int nb, int* coord, FILL_T fill, int width ) void DXF_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) if( nb <= 1 ) return; return; move_to( wxPoint( coord[0], coord[1] ) ); move_to( aCornerList[0] ); for( int ii = 1; ii < nb; ii++ ) for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) line_to( wxPoint( coord[ii * 2], coord[(ii * 2) + 1] ) ); line_to( aCornerList[ii] ); /* Close polygon. */ /* Close polygon. */ if( fill ) if( aFill ) { { int ii = (nb - 1) * 2; unsigned ii = aCornerList.size() - 1; if( ( coord[ii] != coord[0] ) || ( coord[ii + 1] != coord[1] ) ) if( aCornerList[ii] != aCornerList[0] ) line_to( wxPoint( coord[0], coord[1] ) ); line_to( aCornerList[0] ); } } pen_finish(); pen_finish(); } } Loading
common/common_plotGERBER_functions.cpp +36 −32 Original line number Original line Diff line number Diff line Loading @@ -248,16 +248,20 @@ void GERBER_PLOTTER::pen_to( wxPoint aPos, char plume ) void GERBER_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) void GERBER_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) { { wxASSERT( output_file ); static std::vector< wxPoint > cornerList; int coord[10] = cornerList.clear(); { p1.x, p1.y, // Build corners list p1.x, p2.y, cornerList.push_back( p1 ); p2.x, p2.y, wxPoint corner(p1.x, p2.y); p2.x, p1.y, cornerList.push_back( corner ); p1.x, p1.y cornerList.push_back( p2 ); }; corner.x = p2.x; poly( 5, coord, fill, width ); corner.y = p1.y; cornerList.push_back( corner ); cornerList.push_back( p1 ); PlotPoly( cornerList, fill, width ); } } Loading Loading @@ -296,34 +300,31 @@ void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T aFill, /** /** * Function PlotFilledPolygon_GERBER * Function PlotPoly * writes a filled polyline to output file * writes a filled or not filled polyline to output file * @param aCornersCount = number of corners * @param aCoord = buffer of corners coordinates * @param aCoord = buffer of corners coordinates * @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR) * @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR) * @param aWidth = Width of the line to plot. * @param aWidth = Width of the line to plot. */ */ void GERBER_PLOTTER::poly( int aCornersCount, int* aCoord, FILL_T aFill, int aWidth ) void GERBER_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth ) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) wxPoint pos, startpos; return; set_current_line_width( aWidth ); set_current_line_width( aWidth ); if( aFill ) if( aFill ) fputs( "G36*\n", output_file ); fputs( "G36*\n", output_file ); startpos.x = *aCoord++; startpos.y = *aCoord++; move_to( aCornerList[0] ); move_to( startpos ); for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) for( int ii = 1; ii < aCornersCount; ii++ ) { { pos.x = *aCoord++; line_to( aCornerList[ii] ); pos.y = *aCoord++; line_to( pos ); } } if( aFill ) if( aFill ) { { finish_to( startpos ); finish_to( aCornerList[0] ); fputs( "G37*\n", output_file ); fputs( "G37*\n", output_file ); } } else else Loading Loading @@ -488,22 +489,25 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, int aPadOrient, GRTraceMode aTrace_Mode ) int aPadOrient, GRTraceMode aTrace_Mode ) { { wxPoint polygon[5]; // polygon corners list // polygon corners list static std::vector< wxPoint > cornerList; cornerList.clear(); for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) polygon[ii] = aCorners[ii]; cornerList.push_back( aCorners[ii] ); /* Draw the polygon and fill the interior as required. */ /* Draw the polygon and fill the interior as required. */ for( int ii = 0; ii < 4; ii++ ) for( unsigned ii = 0; ii < 4; ii++ ) { { RotatePoint( &polygon[ii], aPadOrient ); RotatePoint( &cornerList[ii], aPadOrient ); polygon[ii] += aPadPos; cornerList[ii] += aPadPos; } } // Close the polygon // Close the polygon polygon[4] = polygon[0]; cornerList.push_back( cornerList[0] ); set_current_line_width( -1 ); set_current_line_width( -1 ); poly( 5, &polygon[0].x, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); } } void GERBER_PLOTTER::SetLayerPolarity( bool aPositive ) void GERBER_PLOTTER::SetLayerPolarity( bool aPositive ) Loading
common/common_plotHPGL_functions.cpp +11 −13 Original line number Original line Diff line number Diff line Loading @@ -75,26 +75,24 @@ void HPGL_PLOTTER::circle( wxPoint centre, /* Plot a polygon (closed if completed) in HPGL /* Plot a polygon (closed if completed) in HPGL * Coord = coord table tops * aCornerList = a wxPoint list of corner * Nb = number of coord (coord 1 = 2 elements: X and Y table) * aFill: if != 0 filled polygon * Fill: if! = 0 filled polygon */ */ void HPGL_PLOTTER::poly( int nb, int* coord, FILL_T fill, int width ) void HPGL_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) if( nb <= 1 ) return; return; move_to( wxPoint( coord[0], coord[1] ) ); move_to( aCornerList[0] ); for( int ii = 1; ii < nb; ii++ ) for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) line_to( wxPoint( coord[ii * 2], coord[(ii * 2) + 1] ) ); line_to( aCornerList[ii] ); /* Close polygon if filled. */ /* Close polygon if filled. */ if( fill ) if( aFill ) { { int ii = (nb - 1) * 2; int ii = aCornerList.size() - 1; if( (coord[ii] != coord[0] ) || (coord[ii + 1] != coord[1]) ) if( aCornerList[ii] != aCornerList[0] ) line_to( wxPoint( coord[0], coord[1] ) ); line_to( aCornerList[0] ); } } pen_finish(); pen_finish(); } } Loading
common/common_plotPS_functions.cpp +49 −50 Original line number Original line Diff line number Diff line Loading @@ -168,40 +168,33 @@ void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius, } } /** /* * Function poly * Function PlotPoly * @brief Draw a polygon ( a filled polygon if fill == 1 ) in POSTSCRIPT format * Draw a polygon (filled or not) in POSTSCRIPT format * @param nb_segm = corner count * param aCornerList = corners list * @param coord = corner list (a corner uses 2 int = X coordinate followed by Y * param aFill :if true : filled polygon * coordinate * param aWidth = line width * @param fill :if true : filled polygon * @param width = line width */ */ void PS_PLOTTER::poly( int nb_segm, int* coord, FILL_T fill, int width ) void PS_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth ) { { wxASSERT( output_file ); if( aCornerList.size() <= 1 ) wxPoint pos; if( nb_segm <= 1 ) return; return; set_current_line_width( width ); set_current_line_width( aWidth ); pos.x = coord[0]; wxPoint pos = aCornerList[0]; pos.y = coord[1]; user_to_device_coordinates( pos ); user_to_device_coordinates( pos ); fprintf( output_file, "newpath\n%d %d moveto\n", pos.x, pos.y ); fprintf( output_file, "newpath\n%d %d moveto\n", pos.x, pos.y ); for( int ii = 1; ii < nb_segm; ii++ ) for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) { { pos.x = coord[2 * ii]; pos = aCornerList[ii]; pos.y = coord[2 * ii + 1]; user_to_device_coordinates( pos ); user_to_device_coordinates( pos ); fprintf( output_file, "%d %d lineto\n", pos.x, pos.y ); fprintf( output_file, "%d %d lineto\n", pos.x, pos.y ); } } // Close path // Close path fprintf( output_file, "poly%d\n", fill ); fprintf( output_file, "poly%d\n", aFill ); } } Loading Loading @@ -445,7 +438,8 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, int orient, GRTraceMode trace_mode ) int orient, GRTraceMode trace_mode ) { { wxASSERT( output_file ); static std::vector< wxPoint > cornerList; cornerList.clear(); set_current_line_width( -1 ); set_current_line_width( -1 ); int w = current_pen_width; int w = current_pen_width; Loading @@ -459,23 +453,28 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, int dx = size.x / 2; int dx = size.x / 2; int dy = size.y / 2; int dy = size.y / 2; int coord[10] = wxPoint corner; { corner.x = pos.x - dx; pos.x - dx, pos.y + dy, corner.y = pos.y + dy; pos.x - dx, pos.y - dy, cornerList.push_back( corner ); pos.x + dx, pos.y - dy, corner.x = pos.x - dx; pos.x + dx, pos.y + dy, corner.y = pos.y - dy; 0, 0 cornerList.push_back( corner ); }; corner.x = pos.x + dx; corner.y = pos.y - dy; for( int ii = 0; ii < 4; ii++ ) cornerList.push_back( corner ); { corner.x = pos.x + dx; RotatePoint( &coord[ii * 2], &coord[ii * 2 + 1], pos.x, pos.y, orient ); corner.y = pos.y + dy, cornerList.push_back( corner ); for( unsigned ii = 0; ii < cornerList.size(); ii++ ) { RotatePoint( &cornerList[ii], pos, orient ); } } coord[8] = coord[0]; cornerList.push_back( cornerList[0] ); coord[9] = coord[1]; poly( 5, coord, ( trace_mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, ( trace_mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); } } Loading @@ -487,11 +486,11 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) int aPadOrient, GRTraceMode aTrace_Mode ) { { wxASSERT( output_file ); static std::vector< wxPoint > cornerList; wxPoint coord[5]; cornerList.clear(); for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) coord[ii] = aCorners[ii]; cornerList.push_back( aCorners[ii] ); if( aTrace_Mode == FILLED ) if( aTrace_Mode == FILLED ) { { Loading @@ -508,22 +507,22 @@ void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], // coord[3] is assumed the lower right // coord[3] is assumed the lower right /* Trace the outline. */ /* Trace the outline. */ coord[0].x += w; cornerList[0].x += w; coord[0].y -= w; cornerList[0].y -= w; coord[1].x += w; cornerList[1].x += w; coord[1].y += w; cornerList[1].y += w; coord[2].x -= w; cornerList[2].x -= w; coord[2].y += w; cornerList[2].y += w; coord[3].x -= w; cornerList[3].x -= w; coord[3].y -= w; cornerList[3].y -= w; } } for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) { { RotatePoint( &coord[ii], aPadOrient ); RotatePoint( &cornerList[ii], aPadOrient ); coord[ii] += aPadPos; cornerList[ii] += aPadPos; } } coord[4] = coord[0]; cornerList.push_back( cornerList[0] ); poly( 5, &coord[0].x, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); } }