Loading common/common_plotDXF_functions.cpp +8 −38 Original line number Diff line number Diff line Loading @@ -319,51 +319,21 @@ void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize, /* * Plot trapezoidal pad. * pos its center, pos.y * Dimensions dim X and dimy * DeltaX and variations deltaY * Orientation and 0.1 degrees east * Plot mode (FILLED, SKETCH, WIRED) * The evidence is that a trapezoid, ie that deltaX or deltaY * = 0. * * The rating of the vertexes are (vis a vis the plotter) * 0 ------------- 3 * . . * . . * . . * 1 --- 2 * aPadPos is pad position, aCorners the corners position of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode = FILLED, SKETCH (unused) */ void DXF_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, int orient, GRTraceMode trace_mode ) void DXF_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); wxPoint polygone[4]; /* coord of vertex or center of the pad */ wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */ int moveX, moveY; /* change pen position by X and Y axis to * fill the trapezoid */ moveX = moveY = 0; size.x /= 2; size.y /= 2; delta.x /= 2; delta.y /= 2; polygone[0].x = -size.x - delta.y; polygone[0].y = +size.y + delta.x; polygone[1].x = -size.x + delta.y; polygone[1].y = -size.y - delta.x; polygone[2].x = +size.x - delta.y; polygone[2].y = -size.y + delta.x; polygone[3].x = +size.x + delta.y; polygone[3].y = +size.y - delta.x; for( int ii = 0; ii < 4; ii++ ) { coord[ii].x = polygone[ii].x + pos.x; coord[ii].y = polygone[ii].y + pos.y; RotatePoint( &coord[ii], pos, orient ); coord[ii] = aCorners[ii]; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } // Plot edge: Loading common/common_plotGERBER_functions.cpp +36 −77 Original line number Diff line number Diff line Loading @@ -450,94 +450,53 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, break; default: /* plot pad shape as polygon */ flash_pad_trapez( pos, size, wxSize( 0, 0 ), orient, trace_mode ); { wxPoint coord[4]; // coord[0] is assumed the lower left // coord[1] is assumed the upper left // coord[2] is assumed the upper right // coord[3] is assumed the lower right /* Trace the outline. */ coord[0].x = -size.x; // lower left coord[0].y = size.y; coord[1].x = -size.x; // upper left coord[1].y = -size.y; coord[2].x = size.x; // upper right coord[2].y = -size.y; coord[3].x = size.x; //lower right coord[3].y = size.y; flash_pad_trapez( pos, coord, orient, trace_mode ); } break; } } /* Plot trapezoidal pad. * Pos is pad center * Dimensions size.x and size.y * Changes delta.x and delta.y (1 of at least two must be zero) * Orientation east to 0.1 degrees * Plot mode (FILLED, SKETCH, WIRED) * * The evidence is that a trapezoid, ie that delta.x or delta.y = 0. * * The rating of the vertexes are (vis a vis the plotter) * * " 0 ------------- 3 " * " . . " * " . O . " * " . . " * " 1 ---- 2 " * * * Example delta.y > 0, delta.x = 0 * " 1 ---- 2 " * " . . " * " . O . " * " . . " * " 0 ------------- 3 " * * * Example delta.y = 0, delta.x > 0 * " 0 " * " . . " * " . . " * " . 3 " * " . . " * " . O . " * " . . " * " . 2 " * " . . " * " . . " * " 1 " * aPadPos is pad position, aCorners the corners positions of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode = FILLED or SKETCH */ void GERBER_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, int orient, GRTraceMode trace_mode ) void GERBER_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); int ii, jj; int dx, dy; wxPoint polygon[4]; /* polygon corners */ int coord[10]; int ddx, ddy; /* Calculate the optimum size of the spot chosen by 1 / 4 of the *smallest dimension */ dx = size.x - abs( delta.y ); dy = size.y - abs( delta.x ); dx = size.x / 2; dy = size.y / 2; ddx = delta.x / 2; ddy = delta.y / 2; polygon[0].x = -dx - ddy; polygon[0].y = +dy + ddx; polygon[1].x = -dx + ddy; polygon[1].y = -dy - ddx; polygon[2].x = +dx - ddy; polygon[2].y = -dy + ddx; polygon[3].x = +dx + ddy; polygon[3].y = +dy - ddx; wxPoint polygon[5]; // polygon corners list for( int ii = 0; ii < 4; ii++ ) polygon[ii] = aCorners[ii]; /* Draw the polygon and fill the interior as required. */ for( ii = 0, jj = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) { RotatePoint( &polygon[ii].x, &polygon[ii].y, orient ); coord[jj] = polygon[ii].x += pos.x; jj++; coord[jj] = polygon[ii].y += pos.y; jj++; RotatePoint( &polygon[ii], aPadOrient ); polygon[ii] += aPadPos; } coord[8] = coord[0]; coord[9] = coord[1]; // Close the polygon polygon[4] = polygon[0]; set_current_line_width( -1 ); poly( 5, coord, trace_mode==FILLED ? FILLED_SHAPE : NO_FILL ); poly( 5, &polygon[0].x, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); } common/common_plotHPGL_functions.cpp +41 −90 Original line number Diff line number Diff line Loading @@ -440,106 +440,57 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize, /* Plot trapezoidal pad. * Pos is pad center * Dimensions size.x and size.y * Changes delta.x and delta.y (1 of at least two must be zero) * Orientation east to 0.1 degrees * Plot mode (FILLED, SKETCH, WIRED) * * The evidence is that a trapezoid, ie that delta.x or delta.y = 0. * * The rating of the vertexes are (vis a vis the plotter) * * " 0 ------------- 3 " * " . . " * " . O . " * " . . " * " 1 ---- 2 " * * * Example delta.y > 0, delta.x = 0 * " 1 ---- 2 " * " . . " * " . O . " * " . . " * " 0 ------------- 3 " * * * Example delta.y = 0, delta.x > 0 * " 0 " * " . . " * " . . " * " . 3 " * " . . " * " . O . " * " . . " * " . 2 " * " . . " * " . . " * " 1 " * aPadPos is pad position, aCorners the corners position of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode FILLED or SKETCH */ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, int orient, GRTraceMode trace_mode ) void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); wxPoint polygone[4]; wxPoint coord[4]; int moveX, moveY; moveX = moveY = wxRound( pen_diameter ); size.x /= 2; size.y /= 2; delta.x /= 2; delta.y /= 2; polygone[0].x = -size.x - delta.y; polygone[0].y = +size.y + delta.x; polygone[1].x = -size.x + delta.y; polygone[1].y = -size.y - delta.x; polygone[2].x = +size.x - delta.y; polygone[2].y = -size.y + delta.x; polygone[3].x = +size.x + delta.y; polygone[3].y = +size.y - delta.x; wxPoint polygone[4]; // coordinates of corners relatives to the pad wxPoint coord[4]; // absolute coordinates of corners (coordinates in plotter space) int move; /* Trace the outline. */ polygone[0].x += moveX; polygone[0].y -= moveY; polygone[1].x += moveX; polygone[1].y += moveY; polygone[2].x -= moveX; polygone[2].y += moveY; polygone[3].x -= moveX; polygone[3].y -= moveY; move = wxRound( pen_diameter ); for( int ii = 0; ii < 4; ii++ ) polygone[ii] = aCorners[ii]; // polygone[0] is assumed the lower left // polygone[1] is assumed the upper left // polygone[2] is assumed the upper right // polygone[3] is assumed the lower right // Plot the outline: for( int ii = 0; ii < 4; ii++ ) { coord[ii].x = polygone[ii].x + pos.x; coord[ii].y = polygone[ii].y + pos.y; RotatePoint( &coord[ii], pos, orient ); coord[ii] = polygone[ii]; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } // Plot edge: move_to( coord[0] ); line_to( coord[1] ); line_to( coord[2] ); line_to( coord[3] ); finish_to( coord[0] ); if( trace_mode == FILLED ) // Fill shape: if( aTrace_Mode == FILLED ) { // TODO: replace this par the HPGL plot polygon. int jj; /* Fill the shape */ moveX = moveY = wxRound( pen_diameter - pen_overlap ); move = wxRound( pen_diameter - pen_overlap ); /* Calculate fill height. */ if( delta.y ) /* Horizontal */ if( polygone[0].y == polygone[3].y ) /* Horizontal */ { jj = size.y - (int) ( pen_diameter + ( 2 * pen_overlap ) ); jj = polygone[3].y - (int) ( pen_diameter + ( 2 * pen_overlap ) ); } else else // vertical { jj = size.x - (int) ( pen_diameter + ( 2 * pen_overlap ) ); jj = polygone[3].x - (int) ( pen_diameter + ( 2 * pen_overlap ) ); } /* Calculation of dd = number of segments was traced to fill. */ Loading @@ -548,14 +499,14 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, /* Trace the outline. */ for( ; jj > 0; jj-- ) { polygone[0].x += moveX; polygone[0].y -= moveY; polygone[1].x += moveX; polygone[1].y += moveY; polygone[2].x -= moveX; polygone[2].y += moveY; polygone[3].x -= moveX; polygone[3].y -= moveY; polygone[0].x += move; polygone[0].y -= move; polygone[1].x += move; polygone[1].y += move; polygone[2].x -= move; polygone[2].y += move; polygone[3].x -= move; polygone[3].y -= move; /* Test for crossed vertexes. */ if( polygone[0].x > polygone[3].x ) /* X axis intersection on Loading @@ -581,9 +532,9 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, for( int ii = 0; ii < 4; ii++ ) { coord[ii].x = polygone[ii].x + pos.x; coord[ii].y = polygone[ii].y + pos.y; RotatePoint( &coord[ii], pos, orient ); coord[ii] = polygone[ii]; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } move_to( coord[0] ); Loading common/common_plotPS_functions.cpp +35 −60 Original line number Diff line number Diff line Loading @@ -479,75 +479,50 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, /* Plot trapezoidal pad. * Pos is pad center * Dimensions size.x and size.y * Changes delta.x and delta.y (1 of at least two must be zero) * Orientation east to 0.1 degrees * Plot mode (FILLED, SKETCH, WIRED) * * The evidence is that a trapezoid, ie that delta.x or delta.y = 0. * * The rating of the vertexes are (vis a vis the plotter) * * " 0 ------------- 3 " * " . . " * " . O . " * " . . " * " 1 ---- 2 " * * * Example delta.y > 0, delta.x = 0 * " 1 ---- 2 " * " . . " * " . O . " * " . . " * " 0 ------------- 3 " * * * Example delta.y = 0, delta.x > 0 * " 0 " * " . . " * " . . " * " . 3 " * " . . " * " . O . " * " . . " * " . 2 " * " . . " * " . . " * " 1 " * aPadPos is pad position, aCorners the corners position of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode FILLED or SKETCH */ void PS_PLOTTER::flash_pad_trapez( wxPoint centre, wxSize size, wxSize delta, int orient, GRTraceMode modetrace ) void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); set_current_line_width( -1 ); int w = current_pen_width; int dx, dy; int ddx, ddy; wxPoint coord[5]; dx = ( size.x - w ) / 2; dy = ( size.y - w ) / 2; ddx = delta.x / 2; ddy = delta.y / 2; for( int ii = 0; ii < 4; ii++ ) coord[ii] = aCorners[ii]; int coord[10] = if( aTrace_Mode == FILLED ) { -dx - ddy, +dy + ddx, -dx + ddy, -dy - ddx, +dx - ddy, -dy + ddx, +dx + ddy, +dy - ddx, 0, 0 }; set_current_line_width( 0 ); } else { set_current_line_width( -1 ); int w = current_pen_width; // offset polygon by w // coord[0] is assumed the lower left // coord[1] is assumed the upper left // coord[2] is assumed the upper right // coord[3] is assumed the lower right /* Trace the outline. */ coord[0].x += w; coord[0].y -= w; coord[1].x += w; coord[1].y += w; coord[2].x -= w; coord[2].y += w; coord[3].x -= w; coord[3].y -= w; } for( int ii = 0; ii < 4; ii++ ) { RotatePoint( &coord[ii * 2], &coord[ii * 2 + 1], orient ); coord[ii * 2] += centre.x; coord[ii * 2 + 1] += centre.y; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } coord[8] = coord[0]; coord[9] = coord[1]; poly( 5, coord, ( modetrace == FILLED ) ? FILLED_SHAPE : NO_FILL ); coord[4] = coord[0]; poly( 5, &coord[0].x, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); } common/drawpanel.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -832,12 +832,20 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) break; xpos = org.x + xg; xpos = GRMapX( xpos ); if( xpos < m_ClipBox.GetOrigin().x) // column not in active screen area. continue; if( xpos > m_ClipBox.GetEnd().x) // end of active area reached. break; for( jj = 0; ; jj++ ) { yg = wxRound( jj * screen_grid_size.y ); if( yg > size.y ) break; ypos = org.y + yg; if( ypos < m_ClipBox.GetOrigin().y) // column not in active screen area. continue; if( ypos > m_ClipBox.GetEnd().y) // end of active area reached. break; DC->DrawPoint( xpos, GRMapY( ypos ) ); } } Loading @@ -858,7 +866,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) wxMemoryDC tmpDC; wxBitmap tmpBM( 1, screenSize.y ); tmpDC.SelectObject( tmpBM ); GRSetColorPen( &tmpDC, g_DrawBgColor ); GRSetColorPen( &tmpDC, WHITE/*g_DrawBgColor*/ ); tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background GRSetColorPen( &tmpDC, m_Parent->GetGridColor() ); for( jj = 0; ; jj++ ) // draw grid points Loading @@ -878,6 +886,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) break; xpos = GRMapX( org.x + xg ); if( xpos < m_ClipBox.GetOrigin().x) // column not in active screen area. continue; if( xpos > m_ClipBox.GetEnd().x) // end of active area reached. break; DC->Blit( xpos, ypos, 1, screenSize.y, &tmpDC, 0, 0 ); Loading Loading
common/common_plotDXF_functions.cpp +8 −38 Original line number Diff line number Diff line Loading @@ -319,51 +319,21 @@ void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize, /* * Plot trapezoidal pad. * pos its center, pos.y * Dimensions dim X and dimy * DeltaX and variations deltaY * Orientation and 0.1 degrees east * Plot mode (FILLED, SKETCH, WIRED) * The evidence is that a trapezoid, ie that deltaX or deltaY * = 0. * * The rating of the vertexes are (vis a vis the plotter) * 0 ------------- 3 * . . * . . * . . * 1 --- 2 * aPadPos is pad position, aCorners the corners position of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode = FILLED, SKETCH (unused) */ void DXF_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, int orient, GRTraceMode trace_mode ) void DXF_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); wxPoint polygone[4]; /* coord of vertex or center of the pad */ wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */ int moveX, moveY; /* change pen position by X and Y axis to * fill the trapezoid */ moveX = moveY = 0; size.x /= 2; size.y /= 2; delta.x /= 2; delta.y /= 2; polygone[0].x = -size.x - delta.y; polygone[0].y = +size.y + delta.x; polygone[1].x = -size.x + delta.y; polygone[1].y = -size.y - delta.x; polygone[2].x = +size.x - delta.y; polygone[2].y = -size.y + delta.x; polygone[3].x = +size.x + delta.y; polygone[3].y = +size.y - delta.x; for( int ii = 0; ii < 4; ii++ ) { coord[ii].x = polygone[ii].x + pos.x; coord[ii].y = polygone[ii].y + pos.y; RotatePoint( &coord[ii], pos, orient ); coord[ii] = aCorners[ii]; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } // Plot edge: Loading
common/common_plotGERBER_functions.cpp +36 −77 Original line number Diff line number Diff line Loading @@ -450,94 +450,53 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, break; default: /* plot pad shape as polygon */ flash_pad_trapez( pos, size, wxSize( 0, 0 ), orient, trace_mode ); { wxPoint coord[4]; // coord[0] is assumed the lower left // coord[1] is assumed the upper left // coord[2] is assumed the upper right // coord[3] is assumed the lower right /* Trace the outline. */ coord[0].x = -size.x; // lower left coord[0].y = size.y; coord[1].x = -size.x; // upper left coord[1].y = -size.y; coord[2].x = size.x; // upper right coord[2].y = -size.y; coord[3].x = size.x; //lower right coord[3].y = size.y; flash_pad_trapez( pos, coord, orient, trace_mode ); } break; } } /* Plot trapezoidal pad. * Pos is pad center * Dimensions size.x and size.y * Changes delta.x and delta.y (1 of at least two must be zero) * Orientation east to 0.1 degrees * Plot mode (FILLED, SKETCH, WIRED) * * The evidence is that a trapezoid, ie that delta.x or delta.y = 0. * * The rating of the vertexes are (vis a vis the plotter) * * " 0 ------------- 3 " * " . . " * " . O . " * " . . " * " 1 ---- 2 " * * * Example delta.y > 0, delta.x = 0 * " 1 ---- 2 " * " . . " * " . O . " * " . . " * " 0 ------------- 3 " * * * Example delta.y = 0, delta.x > 0 * " 0 " * " . . " * " . . " * " . 3 " * " . . " * " . O . " * " . . " * " . 2 " * " . . " * " . . " * " 1 " * aPadPos is pad position, aCorners the corners positions of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode = FILLED or SKETCH */ void GERBER_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, int orient, GRTraceMode trace_mode ) void GERBER_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); int ii, jj; int dx, dy; wxPoint polygon[4]; /* polygon corners */ int coord[10]; int ddx, ddy; /* Calculate the optimum size of the spot chosen by 1 / 4 of the *smallest dimension */ dx = size.x - abs( delta.y ); dy = size.y - abs( delta.x ); dx = size.x / 2; dy = size.y / 2; ddx = delta.x / 2; ddy = delta.y / 2; polygon[0].x = -dx - ddy; polygon[0].y = +dy + ddx; polygon[1].x = -dx + ddy; polygon[1].y = -dy - ddx; polygon[2].x = +dx - ddy; polygon[2].y = -dy + ddx; polygon[3].x = +dx + ddy; polygon[3].y = +dy - ddx; wxPoint polygon[5]; // polygon corners list for( int ii = 0; ii < 4; ii++ ) polygon[ii] = aCorners[ii]; /* Draw the polygon and fill the interior as required. */ for( ii = 0, jj = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ ) { RotatePoint( &polygon[ii].x, &polygon[ii].y, orient ); coord[jj] = polygon[ii].x += pos.x; jj++; coord[jj] = polygon[ii].y += pos.y; jj++; RotatePoint( &polygon[ii], aPadOrient ); polygon[ii] += aPadPos; } coord[8] = coord[0]; coord[9] = coord[1]; // Close the polygon polygon[4] = polygon[0]; set_current_line_width( -1 ); poly( 5, coord, trace_mode==FILLED ? FILLED_SHAPE : NO_FILL ); poly( 5, &polygon[0].x, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); }
common/common_plotHPGL_functions.cpp +41 −90 Original line number Diff line number Diff line Loading @@ -440,106 +440,57 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize, /* Plot trapezoidal pad. * Pos is pad center * Dimensions size.x and size.y * Changes delta.x and delta.y (1 of at least two must be zero) * Orientation east to 0.1 degrees * Plot mode (FILLED, SKETCH, WIRED) * * The evidence is that a trapezoid, ie that delta.x or delta.y = 0. * * The rating of the vertexes are (vis a vis the plotter) * * " 0 ------------- 3 " * " . . " * " . O . " * " . . " * " 1 ---- 2 " * * * Example delta.y > 0, delta.x = 0 * " 1 ---- 2 " * " . . " * " . O . " * " . . " * " 0 ------------- 3 " * * * Example delta.y = 0, delta.x > 0 * " 0 " * " . . " * " . . " * " . 3 " * " . . " * " . O . " * " . . " * " . 2 " * " . . " * " . . " * " 1 " * aPadPos is pad position, aCorners the corners position of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode FILLED or SKETCH */ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, int orient, GRTraceMode trace_mode ) void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); wxPoint polygone[4]; wxPoint coord[4]; int moveX, moveY; moveX = moveY = wxRound( pen_diameter ); size.x /= 2; size.y /= 2; delta.x /= 2; delta.y /= 2; polygone[0].x = -size.x - delta.y; polygone[0].y = +size.y + delta.x; polygone[1].x = -size.x + delta.y; polygone[1].y = -size.y - delta.x; polygone[2].x = +size.x - delta.y; polygone[2].y = -size.y + delta.x; polygone[3].x = +size.x + delta.y; polygone[3].y = +size.y - delta.x; wxPoint polygone[4]; // coordinates of corners relatives to the pad wxPoint coord[4]; // absolute coordinates of corners (coordinates in plotter space) int move; /* Trace the outline. */ polygone[0].x += moveX; polygone[0].y -= moveY; polygone[1].x += moveX; polygone[1].y += moveY; polygone[2].x -= moveX; polygone[2].y += moveY; polygone[3].x -= moveX; polygone[3].y -= moveY; move = wxRound( pen_diameter ); for( int ii = 0; ii < 4; ii++ ) polygone[ii] = aCorners[ii]; // polygone[0] is assumed the lower left // polygone[1] is assumed the upper left // polygone[2] is assumed the upper right // polygone[3] is assumed the lower right // Plot the outline: for( int ii = 0; ii < 4; ii++ ) { coord[ii].x = polygone[ii].x + pos.x; coord[ii].y = polygone[ii].y + pos.y; RotatePoint( &coord[ii], pos, orient ); coord[ii] = polygone[ii]; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } // Plot edge: move_to( coord[0] ); line_to( coord[1] ); line_to( coord[2] ); line_to( coord[3] ); finish_to( coord[0] ); if( trace_mode == FILLED ) // Fill shape: if( aTrace_Mode == FILLED ) { // TODO: replace this par the HPGL plot polygon. int jj; /* Fill the shape */ moveX = moveY = wxRound( pen_diameter - pen_overlap ); move = wxRound( pen_diameter - pen_overlap ); /* Calculate fill height. */ if( delta.y ) /* Horizontal */ if( polygone[0].y == polygone[3].y ) /* Horizontal */ { jj = size.y - (int) ( pen_diameter + ( 2 * pen_overlap ) ); jj = polygone[3].y - (int) ( pen_diameter + ( 2 * pen_overlap ) ); } else else // vertical { jj = size.x - (int) ( pen_diameter + ( 2 * pen_overlap ) ); jj = polygone[3].x - (int) ( pen_diameter + ( 2 * pen_overlap ) ); } /* Calculation of dd = number of segments was traced to fill. */ Loading @@ -548,14 +499,14 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, /* Trace the outline. */ for( ; jj > 0; jj-- ) { polygone[0].x += moveX; polygone[0].y -= moveY; polygone[1].x += moveX; polygone[1].y += moveY; polygone[2].x -= moveX; polygone[2].y += moveY; polygone[3].x -= moveX; polygone[3].y -= moveY; polygone[0].x += move; polygone[0].y -= move; polygone[1].x += move; polygone[1].y += move; polygone[2].x -= move; polygone[2].y += move; polygone[3].x -= move; polygone[3].y -= move; /* Test for crossed vertexes. */ if( polygone[0].x > polygone[3].x ) /* X axis intersection on Loading @@ -581,9 +532,9 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, for( int ii = 0; ii < 4; ii++ ) { coord[ii].x = polygone[ii].x + pos.x; coord[ii].y = polygone[ii].y + pos.y; RotatePoint( &coord[ii], pos, orient ); coord[ii] = polygone[ii]; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } move_to( coord[0] ); Loading
common/common_plotPS_functions.cpp +35 −60 Original line number Diff line number Diff line Loading @@ -479,75 +479,50 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, /* Plot trapezoidal pad. * Pos is pad center * Dimensions size.x and size.y * Changes delta.x and delta.y (1 of at least two must be zero) * Orientation east to 0.1 degrees * Plot mode (FILLED, SKETCH, WIRED) * * The evidence is that a trapezoid, ie that delta.x or delta.y = 0. * * The rating of the vertexes are (vis a vis the plotter) * * " 0 ------------- 3 " * " . . " * " . O . " * " . . " * " 1 ---- 2 " * * * Example delta.y > 0, delta.x = 0 * " 1 ---- 2 " * " . . " * " . O . " * " . . " * " 0 ------------- 3 " * * * Example delta.y = 0, delta.x > 0 * " 0 " * " . . " * " . . " * " . 3 " * " . . " * " . O . " * " . . " * " . 2 " * " . . " * " . . " * " 1 " * aPadPos is pad position, aCorners the corners position of the basic shape * Orientation aPadOrient in 0.1 degrees * Plot mode FILLED or SKETCH */ void PS_PLOTTER::flash_pad_trapez( wxPoint centre, wxSize size, wxSize delta, int orient, GRTraceMode modetrace ) void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], int aPadOrient, GRTraceMode aTrace_Mode ) { wxASSERT( output_file ); set_current_line_width( -1 ); int w = current_pen_width; int dx, dy; int ddx, ddy; wxPoint coord[5]; dx = ( size.x - w ) / 2; dy = ( size.y - w ) / 2; ddx = delta.x / 2; ddy = delta.y / 2; for( int ii = 0; ii < 4; ii++ ) coord[ii] = aCorners[ii]; int coord[10] = if( aTrace_Mode == FILLED ) { -dx - ddy, +dy + ddx, -dx + ddy, -dy - ddx, +dx - ddy, -dy + ddx, +dx + ddy, +dy - ddx, 0, 0 }; set_current_line_width( 0 ); } else { set_current_line_width( -1 ); int w = current_pen_width; // offset polygon by w // coord[0] is assumed the lower left // coord[1] is assumed the upper left // coord[2] is assumed the upper right // coord[3] is assumed the lower right /* Trace the outline. */ coord[0].x += w; coord[0].y -= w; coord[1].x += w; coord[1].y += w; coord[2].x -= w; coord[2].y += w; coord[3].x -= w; coord[3].y -= w; } for( int ii = 0; ii < 4; ii++ ) { RotatePoint( &coord[ii * 2], &coord[ii * 2 + 1], orient ); coord[ii * 2] += centre.x; coord[ii * 2 + 1] += centre.y; RotatePoint( &coord[ii], aPadOrient ); coord[ii] += aPadPos; } coord[8] = coord[0]; coord[9] = coord[1]; poly( 5, coord, ( modetrace == FILLED ) ? FILLED_SHAPE : NO_FILL ); coord[4] = coord[0]; poly( 5, &coord[0].x, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL ); }
common/drawpanel.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -832,12 +832,20 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) break; xpos = org.x + xg; xpos = GRMapX( xpos ); if( xpos < m_ClipBox.GetOrigin().x) // column not in active screen area. continue; if( xpos > m_ClipBox.GetEnd().x) // end of active area reached. break; for( jj = 0; ; jj++ ) { yg = wxRound( jj * screen_grid_size.y ); if( yg > size.y ) break; ypos = org.y + yg; if( ypos < m_ClipBox.GetOrigin().y) // column not in active screen area. continue; if( ypos > m_ClipBox.GetEnd().y) // end of active area reached. break; DC->DrawPoint( xpos, GRMapY( ypos ) ); } } Loading @@ -858,7 +866,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) wxMemoryDC tmpDC; wxBitmap tmpBM( 1, screenSize.y ); tmpDC.SelectObject( tmpBM ); GRSetColorPen( &tmpDC, g_DrawBgColor ); GRSetColorPen( &tmpDC, WHITE/*g_DrawBgColor*/ ); tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background GRSetColorPen( &tmpDC, m_Parent->GetGridColor() ); for( jj = 0; ; jj++ ) // draw grid points Loading @@ -878,6 +886,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) break; xpos = GRMapX( org.x + xg ); if( xpos < m_ClipBox.GetOrigin().x) // column not in active screen area. continue; if( xpos > m_ClipBox.GetEnd().x) // end of active area reached. break; DC->Blit( xpos, ypos, 1, screenSize.y, &tmpDC, 0, 0 ); Loading