Commit 537ad872 authored by jean-pierre charras's avatar jean-pierre charras

Use D_PAD::BuildPadPolygon() in plot functions

parents 59d33db4 e162ffee
...@@ -319,51 +319,21 @@ void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize, ...@@ -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:
......
...@@ -450,94 +450,53 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, ...@@ -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; /* Draw the polygon and fill the interior as required. */
for( int ii = 0; ii < 4; ii++ )
/* 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. */
for( ii = 0, jj = 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 );
} }
...@@ -440,106 +440,57 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize, ...@@ -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. */
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++ ) 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. */
...@@ -548,14 +499,14 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, ...@@ -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
...@@ -581,9 +532,9 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, ...@@ -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] );
......
...@@ -479,75 +479,50 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size, ...@@ -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 );
} }
...@@ -832,12 +832,20 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) ...@@ -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 ) );
} }
} }
...@@ -858,7 +866,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) ...@@ -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
...@@ -878,6 +886,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) ...@@ -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 );
......
...@@ -115,8 +115,15 @@ public: ...@@ -115,8 +115,15 @@ public:
GRTraceMode trace_mode ) = 0; GRTraceMode trace_mode ) = 0;
virtual void flash_pad_rect( wxPoint pos, wxSize size, virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode ) = 0; int orient, GRTraceMode trace_mode ) = 0;
virtual void flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, /** virtual function flash_pad_trapez
int orient, GRTraceMode trace_mode ) = 0; * flash a trapezoidal pad
* @param aPadPos = the position of the shape
* @param aCorners = the list of 4 corners positions, relative to the shape position, pad orientation 0
* @param aPadOrient = the rotation of the shape
* @param aTrace_Mode = FILLED or SKETCH
*/
virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode ) = 0;
/* Convenience functions */ /* Convenience functions */
void move_to( wxPoint pos ) void move_to( wxPoint pos )
...@@ -257,8 +264,8 @@ public: ...@@ -257,8 +264,8 @@ public:
GRTraceMode trace_mode ); GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size, virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode ); int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int orient, GRTraceMode trace_mode ); int aPadOrient, GRTraceMode aTrace_Mode );
protected: protected:
void pen_control( int plume ); void pen_control( int plume );
...@@ -306,8 +313,8 @@ public: ...@@ -306,8 +313,8 @@ public:
GRTraceMode trace_mode ); GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size, virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode ); int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int orient, GRTraceMode trace_mode ); int aPadOrient, GRTraceMode aTrace_Mode );
protected: protected:
double plot_scale_adjX, plot_scale_adjY; double plot_scale_adjX, plot_scale_adjY;
...@@ -364,8 +371,8 @@ public: ...@@ -364,8 +371,8 @@ public:
GRTraceMode trace_mode ); GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size, virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode ); int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int orient, GRTraceMode trace_mode ); int aPadOrient, GRTraceMode aTrace_Mode );
protected: protected:
void select_aperture( const wxSize& size, void select_aperture( const wxSize& size,
...@@ -424,8 +431,8 @@ public: ...@@ -424,8 +431,8 @@ public:
GRTraceMode trace_mode ); GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size, virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode ); int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int orient, GRTraceMode trace_mode ); int aPadOrient, GRTraceMode aTrace_Mode );
protected: protected:
int current_color; int current_color;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -26,55 +26,37 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -26,55 +26,37 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
int masque_layer, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
{ {
wxPoint pos, shape_pos;
wxSize size;
bool trace_val, trace_ref; bool trace_val, trace_ref;
D_PAD* pt_pad;
TEXTE_MODULE* pt_texte; TEXTE_MODULE* pt_texte;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
/* Plot edge layer and graphic items */ /* Plot edge layer and graphic items */
for( PtStruct = m_Pcb->m_Drawings; for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
PtStruct != NULL;
PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
PlotDrawSegment( plotter, PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, masque_layer, trace_mode );
(DRAWSEGMENT*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_TEXTE: case TYPE_TEXTE:
PlotTextePcb( plotter, PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, masque_layer, trace_mode );
(TEXTE_PCB*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_DIMENSION: case TYPE_DIMENSION:
PlotDimension( plotter, PlotDimension( plotter, (DIMENSION*) PtStruct, masque_layer, trace_mode );
(DIMENSION*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_MIRE: case TYPE_MIRE:
PlotMirePcb( plotter, PlotMirePcb( plotter, (MIREPCB*) PtStruct, masque_layer, trace_mode );
(MIREPCB*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_MARKER_PCB: case TYPE_MARKER_PCB:
break; break;
default: default:
DisplayError( this, DisplayError( this, wxT( "Plot_Serigraphie() error: unexpected Type()" ) );
wxT( "Plot_Serigraphie() error: unexpected Type()" ) );
break; break;
} }
} }
...@@ -85,49 +67,37 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -85,49 +67,37 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
/* Plot pads (creates pads outlines, for pads on silkscreen layers) */ /* Plot pads (creates pads outlines, for pads on silkscreen layers) */
if( g_pcb_plot_options.PlotPadsOnSilkLayer ) if( g_pcb_plot_options.PlotPadsOnSilkLayer )
{ {
for( MODULE* Module = m_Pcb->m_Modules; for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
Module;
Module = Module->Next() )
{ {
for( pt_pad = (D_PAD*) Module->m_Pads; for( D_PAD * pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
pt_pad != NULL;
pt_pad = pt_pad->Next() )
{ {
/* See if the pad is on this layer */ /* See if the pad is on this layer */
if( (pt_pad->m_Masque_Layer & masque_layer) == 0 ) if( (pad->m_Masque_Layer & masque_layer) == 0 )
continue; continue;
shape_pos = pt_pad->ReturnShapePos(); wxPoint shape_pos = pad->ReturnShapePos();
pos = shape_pos;
size = pt_pad->m_Size;
switch( pt_pad->m_PadShape & 0x7F ) switch( pad->m_PadShape & 0x7F )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
plotter->flash_pad_circle( pos, size.x, FILAIRE ); plotter->flash_pad_circle( shape_pos, pad->m_Size.x, FILAIRE );
break; break;
case PAD_OVAL: case PAD_OVAL:
plotter->flash_pad_oval( pos, size, plotter->flash_pad_oval( shape_pos, pad->m_Size, pad->m_Orient, FILAIRE );
pt_pad->m_Orient, FILAIRE );
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ {
wxSize delta; wxPoint coord[4];
delta = pt_pad->m_DeltaSize; pad->BuildPadPolygon( coord, wxSize(0,0), 0 );
plotter->flash_pad_trapez( pos, size, plotter->flash_pad_trapez( shape_pos, coord, pad->m_Orient, FILAIRE );
delta, pt_pad->m_Orient,
FILAIRE );
break; break;
} }
case PAD_RECT: case PAD_RECT:
default: default:
plotter->flash_pad_rect( pos, plotter->flash_pad_rect( shape_pos, pad->m_Size, pad->m_Orient, FILAIRE );
size,
pt_pad->m_Orient,
FILAIRE );
break; break;
} }
} }
...@@ -892,12 +862,9 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, ...@@ -892,12 +862,9 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter,
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ {
wxSize delta = pad->m_DeltaSize; wxPoint coord[4];
aPlotter->flash_pad_trapez( pos, pad->BuildPadPolygon( coord, margin, 0 );
size, aPlotter->flash_pad_trapez( pos, coord, pad->m_Orient, aPlotMode );
delta,
pad->m_Orient,
aPlotMode );
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment