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