polygon work, EDGE_MODULE::m_PolyPoints is now std::vector
This commit is contained in:
parent
fadacffc02
commit
0d790e57a2
|
@ -5,18 +5,29 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2008-Dec-29 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
++all
|
||||
* gr_basic.h DOXYGEN comments. made a couple functions static and removed
|
||||
those from gr_basic.h since they are private to gr_basic.c. changed the
|
||||
polygon code to use wxPoints since that is what the underlying wxWidgets
|
||||
API uses.
|
||||
++gerbview
|
||||
More work on drawing polygons, erasure still work in progress. Will
|
||||
probably switch to ZONEs from SEG_ZONEs for polygons.
|
||||
|
||||
|
||||
2008-Dec-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
++Eeschema:
|
||||
More about italic and bold texts options in fields and graphic texts
|
||||
More about italic and bold texts options in fields and graphic texts
|
||||
|
||||
|
||||
2008-Dec-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
++Pcbnew:
|
||||
Added dialog box to edit graphic items (graphic segments, circles, arcs)
|
||||
properties
|
||||
Added dialog box to edit graphic items (graphic segments, circles, arcs)
|
||||
properties
|
||||
|
||||
|
||||
2008-Dec-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
|
@ -24,7 +35,7 @@ email address.
|
|||
++All
|
||||
Cleaning code to draw/plot texts:
|
||||
Now only one function is used to draw and plot texts in pcbnew in all formats
|
||||
Italics texts are allowed in pcbnew (work in progress)
|
||||
Italics texts are allowed in pcbnew (work in progress)
|
||||
|
||||
2008-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
|
|
|
@ -269,7 +269,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
*(coordptr + 2), *(coordptr + 3), aWidth, aColor );
|
||||
}
|
||||
else
|
||||
GRPoly( &aPanel->m_ClipBox, DC, ii / 2, coord, 0,
|
||||
GRPoly( &aPanel->m_ClipBox, DC, ii / 2, (wxPoint*)coord, 0,
|
||||
aWidth, aColor, aColor );
|
||||
}
|
||||
plume = f_cod; ii = 0;
|
||||
|
|
|
@ -828,21 +828,19 @@ void GRSCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int
|
|||
}
|
||||
|
||||
|
||||
static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points )
|
||||
static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] )
|
||||
{
|
||||
int ii;
|
||||
int Xmin, Xmax, Ymin, Ymax;
|
||||
|
||||
Xmin = Xmax = Points[0];
|
||||
Ymin = Ymax = Points[1];
|
||||
Xmin = Xmax = Points[0].x;
|
||||
Ymin = Ymax = Points[0].y;
|
||||
|
||||
for( ii = 1; ii < n; ii++ ) // calcul du rectangle d'encadrement
|
||||
for( int ii = 1; ii < n; ii++ ) // calcul du rectangle d'encadrement
|
||||
{
|
||||
int jj = ii * 2;
|
||||
Xmin = MIN( Xmin, Points[jj] );
|
||||
Xmax = MAX( Xmax, Points[jj] );
|
||||
Ymin = MIN( Ymin, Points[jj + 1] );
|
||||
Ymax = MAX( Ymax, Points[jj + 1] );
|
||||
Xmin = MIN( Xmin, Points[ii].x );
|
||||
Xmax = MAX( Xmax, Points[ii].x );
|
||||
Ymin = MIN( Ymin, Points[ii].y );
|
||||
Ymax = MAX( Ymax, Points[ii].y );
|
||||
}
|
||||
|
||||
xcliplo = ClipBox->GetX();
|
||||
|
@ -866,7 +864,7 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points )
|
|||
/************************************************************************/
|
||||
/* Routine to draw a new polyline and fill it if Fill, in screen space. */
|
||||
/************************************************************************/
|
||||
void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, bool Fill,
|
||||
static void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[], bool Fill,
|
||||
int width, int Color, int BgColor )
|
||||
{
|
||||
if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
|
||||
|
@ -877,19 +875,19 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, bool Fill,
|
|||
if( Fill && ( n > 2 ) )
|
||||
{
|
||||
GRSetBrush( DC, BgColor, FILLED );
|
||||
DC->DrawPolygon( n, (wxPoint*) Points );
|
||||
DC->DrawPolygon( n, Points );
|
||||
}
|
||||
else
|
||||
{
|
||||
int endx = Points[n * 2 - 2];
|
||||
int endy = Points[n * 2 - 1];
|
||||
wxPoint endPt = Points[n-1];
|
||||
|
||||
GRSetBrush( DC, Color );
|
||||
DC->DrawLines( n, (wxPoint*) Points );
|
||||
DC->DrawLines( n, Points );
|
||||
|
||||
// The last point is not drawn by DrawLine and DrawLines
|
||||
// Add it if the polygon is not closed
|
||||
if ( endx != Points[0] || endy != Points[1] )
|
||||
DC->DrawPoint(endx, endy);
|
||||
if( endPt != Points[0] )
|
||||
DC->DrawPoint(endPt.x, endPt.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,61 +895,56 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, bool Fill,
|
|||
/******************************************************************************/
|
||||
/* Routine to draw a new closed polyline and fill it if Fill, in screen space */
|
||||
/******************************************************************************/
|
||||
void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
|
||||
bool Fill, int Color, int BgColor )
|
||||
{
|
||||
GRSClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
|
||||
}
|
||||
|
||||
|
||||
void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
|
||||
static void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int aPointCount, wxPoint aPoints[],
|
||||
bool Fill, int width, int Color, int BgColor )
|
||||
{
|
||||
int startx, starty;
|
||||
|
||||
if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
|
||||
if( !IsGRSPolyDrawable( ClipBox, aPointCount, aPoints ) )
|
||||
return;
|
||||
|
||||
GRSetColorPen( DC, Color, width );
|
||||
|
||||
if( Fill && ( n > 2 ) )
|
||||
if( Fill && ( aPointCount > 2 ) )
|
||||
{
|
||||
GRSMoveTo( Points[n * 2 - 2], Points[n * 2 - 1] );
|
||||
GRSMoveTo( aPoints[aPointCount-1].x, aPoints[aPointCount-1].y );
|
||||
GRSetBrush( DC, BgColor, FILLED );
|
||||
DC->DrawPolygon( n, (wxPoint*) Points, 0, 0, wxODDEVEN_RULE );
|
||||
DC->DrawPolygon( aPointCount, aPoints, 0, 0, wxODDEVEN_RULE );
|
||||
}
|
||||
else
|
||||
{
|
||||
startx = Points[n * 2 - 2]; starty = Points[n * 2 - 1];
|
||||
GRSetBrush( DC, BgColor );
|
||||
DC->DrawLines( n, (wxPoint*) Points );
|
||||
DC->DrawLines( aPointCount, aPoints );
|
||||
|
||||
/* Fermeture du polygone */
|
||||
if( (startx != Points[0]) || (starty != Points[1]) )
|
||||
if( aPoints[aPointCount-1] != aPoints[0] )
|
||||
{
|
||||
GRSLine( ClipBox, DC, Points[0], Points[1], startx, starty, width, Color );
|
||||
GRSLine( ClipBox, DC, aPoints[0].x, aPoints[0].y,
|
||||
aPoints[aPointCount-1].x, aPoints[aPointCount-1].y, width, Color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* not used
|
||||
static void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[],
|
||||
bool Fill, int Color, int BgColor )
|
||||
{
|
||||
GRSClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Routine to draw a new polyline and fill it if Fill, in drawing space. */
|
||||
/************************************************************************/
|
||||
void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
|
||||
void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[],
|
||||
bool Fill, int width, int Color, int BgColor )
|
||||
{
|
||||
int ii, jj;
|
||||
|
||||
width = ZoomValue( width );
|
||||
for( ii = 0; ii < n; ii++ )
|
||||
for( int i=0; i<n; ++i )
|
||||
{
|
||||
jj = ii << 1;
|
||||
Points[jj] = GRMapX( Points[jj] );
|
||||
jj++;
|
||||
Points[jj] = GRMapY( Points[jj] );
|
||||
Points[i].x = GRMapX( Points[i].x );
|
||||
Points[i].y = GRMapY( Points[i].y );
|
||||
}
|
||||
|
||||
width = ZoomValue( width );
|
||||
GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
|
||||
}
|
||||
|
||||
|
@ -959,27 +952,23 @@ void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
|
|||
/**************************************************************************/
|
||||
/* Routine to draw a closed polyline and fill it if Fill, in object space */
|
||||
/**************************************************************************/
|
||||
void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
|
||||
void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[],
|
||||
bool Fill, int Color, int BgColor )
|
||||
{
|
||||
GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
|
||||
}
|
||||
|
||||
|
||||
void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
|
||||
void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[],
|
||||
bool Fill, int width, int Color, int BgColor )
|
||||
{
|
||||
int ii, jj;
|
||||
|
||||
width = ZoomValue( width );
|
||||
for( ii = 0; ii < n; ii++ )
|
||||
for( int i=0; i<n; ++i )
|
||||
{
|
||||
jj = ii << 1;
|
||||
Points[jj] = GRMapX( Points[jj] );
|
||||
jj++;
|
||||
Points[jj] = GRMapY( Points[jj] );
|
||||
Points[i].x = GRMapX( Points[i].x );
|
||||
Points[i].y = GRMapY( Points[i].y );
|
||||
}
|
||||
|
||||
width = ZoomValue( width );
|
||||
GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
|
||||
}
|
||||
|
||||
|
|
|
@ -35,19 +35,20 @@
|
|||
|
||||
/*******************************************************************/
|
||||
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
|
||||
const wxPoint& pos, const wxString& text ) :
|
||||
const wxPoint& pos,
|
||||
const wxString& text ) :
|
||||
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
|
||||
EDA_TextStruct( text )
|
||||
/*******************************************************************/
|
||||
{
|
||||
wxASSERT( parent );
|
||||
wxASSERT( Pnext == NULL );
|
||||
m_Layer = LAYER_SHEETLABEL;
|
||||
m_Pos = pos;
|
||||
m_Edge = 0;
|
||||
m_Shape = NET_INPUT;
|
||||
m_Layer = LAYER_SHEETLABEL;
|
||||
m_Pos = pos;
|
||||
m_Edge = 0;
|
||||
m_Shape = NET_INPUT;
|
||||
m_IsDangling = TRUE;
|
||||
m_Number = 2;
|
||||
m_Number = 2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,8 +59,8 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
|
|||
Hierarchical_PIN_Sheet_Struct* newitem =
|
||||
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos, m_Text );
|
||||
|
||||
newitem->m_Edge = m_Edge;
|
||||
newitem->m_Shape = m_Shape;
|
||||
newitem->m_Edge = m_Edge;
|
||||
newitem->m_Shape = m_Shape;
|
||||
newitem->m_Number = m_Number;
|
||||
|
||||
return newitem;
|
||||
|
@ -68,24 +69,31 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
|
|||
|
||||
/********************************************************************************************/
|
||||
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
int DrawMode, int Color )
|
||||
/********************************************************************************************/
|
||||
/* Routine de dessin des Labels type hierarchie */
|
||||
{
|
||||
GRTextHorizJustifyType side;
|
||||
EDA_Colors txtcolor;
|
||||
GRTextHorizJustifyType side;
|
||||
EDA_Colors txtcolor;
|
||||
int posx, tposx, posy, size2;
|
||||
wxSize size;
|
||||
int NbSegm, coord[20];
|
||||
int NbSegm;
|
||||
|
||||
// @todo use wxPoints here
|
||||
int coord[20];
|
||||
|
||||
int LineWidth = g_DrawMinimunLineWidth;
|
||||
|
||||
if( Color >= 0 )
|
||||
txtcolor = (EDA_Colors)Color;
|
||||
txtcolor = (EDA_Colors) Color;
|
||||
else
|
||||
txtcolor = ReturnLayerColor( m_Layer );
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size;
|
||||
posx = m_Pos.x + offset.x;
|
||||
posy = m_Pos.y + offset.y;
|
||||
size = m_Size;
|
||||
|
||||
if( !m_Text.IsEmpty() )
|
||||
{
|
||||
if( m_Edge )
|
||||
|
@ -99,8 +107,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
|
|||
side = GR_TEXT_HJUSTIFY_LEFT;
|
||||
}
|
||||
DrawGraphicText( panel, DC, wxPoint( tposx, posy ), txtcolor,
|
||||
m_Text, TEXT_ORIENT_HORIZ, size,
|
||||
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
|
||||
m_Text, TEXT_ORIENT_HORIZ, size,
|
||||
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
|
||||
}
|
||||
/* dessin du symbole de connexion */
|
||||
|
||||
|
@ -110,8 +118,11 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
|
|||
size.y = -size.y;
|
||||
}
|
||||
|
||||
coord[0] = posx; coord[1] = posy; size2 = size.x / 2;
|
||||
NbSegm = 0;
|
||||
coord[0] = posx;
|
||||
coord[1] = posy;
|
||||
|
||||
size2 = size.x / 2;
|
||||
NbSegm = 0;
|
||||
|
||||
switch( m_Shape )
|
||||
{
|
||||
|
@ -154,7 +165,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
|
|||
}
|
||||
|
||||
int FillShape = FALSE;
|
||||
GRPoly( &panel->m_ClipBox, DC, NbSegm, coord, FillShape, LineWidth, txtcolor, txtcolor ); /* Poly Non rempli */
|
||||
GRPoly( &panel->m_ClipBox, DC, NbSegm, (wxPoint*) coord,
|
||||
FillShape, LineWidth, txtcolor, txtcolor ); /* Poly Non rempli */
|
||||
}
|
||||
|
||||
|
||||
|
@ -192,9 +204,9 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
|
|||
}
|
||||
|
||||
if( fprintf( aFile, "F%d \"%s\" %c %c %-3d %-3d %-3d\n", m_Number,
|
||||
CONV_TO_UTF8( m_Text ), type, side,
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Size.x ) == EOF )
|
||||
CONV_TO_UTF8( m_Text ), type, side,
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Size.x ) == EOF )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -202,6 +214,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
|
@ -209,12 +222,12 @@ void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
|
|||
wxString s = GetClass();
|
||||
|
||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
|
||||
<< " pin_name=\"" << CONV_TO_UTF8( m_Text ) << '"'
|
||||
<< "/>\n"
|
||||
<< std::flush;
|
||||
<< " pin_name=\"" << CONV_TO_UTF8( m_Text ) << '"'
|
||||
<< "/>\n"
|
||||
<< std::flush;
|
||||
|
||||
// NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -393,15 +393,16 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
|
|||
}
|
||||
|
||||
CreateGraphicShape( Poly, AnchorPos );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly[0], Poly + 1, 0, width, color, color );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly[0], (wxPoint*)(Poly + 1), 0, width, color, color );
|
||||
|
||||
if( m_IsDangling )
|
||||
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
|
||||
}
|
||||
|
||||
|
||||
/** function CreateGraphicShape
|
||||
* Calculates the graphic shape (a polygon) associated to the text
|
||||
/**
|
||||
* Function CreateGraphicShape
|
||||
* calculates the graphic shape (a polygon) associated to the text
|
||||
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
|
||||
* @param Pos = Postion of the shape
|
||||
* format list is
|
||||
|
@ -414,13 +415,14 @@ void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
|
|||
|
||||
int imax = *Template; Template++;
|
||||
|
||||
*corner_list = imax; corner_list++;
|
||||
*corner_list++ = imax;
|
||||
for( int ii = 0; ii < imax; ii++ )
|
||||
{
|
||||
*corner_list = ( HalfSize * (*Template) ) + Pos.x;
|
||||
corner_list++; Template++;
|
||||
*corner_list = ( HalfSize * (*Template) ) + Pos.y;
|
||||
corner_list++; Template++;
|
||||
*corner_list++ = ( HalfSize * (*Template) ) + Pos.x;
|
||||
Template++;
|
||||
|
||||
*corner_list++ = ( HalfSize * (*Template) ) + Pos.y;
|
||||
Template++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +548,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
|
|||
}
|
||||
|
||||
CreateGraphicShape( Poly, AnchorPos );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly[0], Poly + 1, 0, width, color, color );
|
||||
GRPoly( &panel->m_ClipBox, DC, Poly[0], (wxPoint*) (Poly + 1), 0, width, color, color );
|
||||
|
||||
if( m_IsDangling )
|
||||
DrawDanglingSymbol( panel, DC, AnchorPos, color );
|
||||
|
|
|
@ -281,14 +281,14 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
|||
|
||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||
GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount,
|
||||
Buf_Poly_Drawings, 1, linewidth, color,
|
||||
(wxPoint*) Buf_Poly_Drawings, 1, linewidth, color,
|
||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||
else if( fill == FILLED_SHAPE )
|
||||
GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount,
|
||||
Buf_Poly_Drawings, 1, linewidth, color, color );
|
||||
(wxPoint*) Buf_Poly_Drawings, 1, linewidth, color, color );
|
||||
else
|
||||
GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount,
|
||||
Buf_Poly_Drawings, 0, linewidth, color, color );
|
||||
(wxPoint*) Buf_Poly_Drawings, 0, linewidth, color, color );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,9 +81,49 @@ static wxPoint LastPosition;
|
|||
/* Local Functions (are lower case since they are private to this source file) */
|
||||
|
||||
|
||||
/**
|
||||
* Function fillCircularTRACK
|
||||
* initializes a given TRACK so that it can draw a circle which is not filled and
|
||||
* has a given pen width (\a aPenWidth ).
|
||||
*
|
||||
* @param aTrack The TRACK to fill in.
|
||||
* @param Dcode_index The DCODE value, like D14
|
||||
* @param aLayer The layer index to set into the TRACK
|
||||
* @param aPos The center point of the flash
|
||||
* @param aDiameter The diameter of the round flash
|
||||
* @param aPenWidth The width of the pen used to draw the circle's circumfrance.
|
||||
* @param isDark True if flash is positive and should use a drawing
|
||||
* color other than the background color, else use the background color
|
||||
* when drawing so that an erasure happens.
|
||||
*/
|
||||
static void fillCircularTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
|
||||
const wxPoint& aPos, int aDiameter, int aPenWidth, bool isDark )
|
||||
{
|
||||
aTrack->m_Shape = S_CIRCLE;
|
||||
aTrack->m_Width = aPenWidth;
|
||||
|
||||
aTrack->SetLayer( aLayer );
|
||||
aTrack->SetNet( Dcode_index );
|
||||
|
||||
// When drawing a TRACK with shape S_CIRCLE, the hypotenuse (i.e. distance)
|
||||
// between the Start and End points gives the radius of the circle.
|
||||
aTrack->m_Start = aTrack->m_End = aPos;
|
||||
aTrack->m_End.x += max(0, (aDiameter + 1)/2);
|
||||
|
||||
NEGATE( aTrack->m_Start.y );
|
||||
NEGATE( aTrack->m_End.y );
|
||||
|
||||
if( !isDark )
|
||||
{
|
||||
aTrack->m_Flags |= DRAW_ERASED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function fillRoundFlashTRACK
|
||||
* initializes a given TRACK so that it can draw a flash D code which is round.
|
||||
* initializes a given TRACK so that it can draw a circle which is filled and
|
||||
* has no pen border.
|
||||
*
|
||||
* @param aTrack The TRACK to fill in.
|
||||
* @param Dcode_index The DCODE value, like D14
|
||||
|
@ -114,12 +154,12 @@ static void fillRoundFlashTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
|
|||
|
||||
/**
|
||||
* Function fillOvalOrRectFlashTRACK
|
||||
* initializes a given TRACK so that it can draw an oval or rectangular flash D code.
|
||||
* initializes a given TRACK so that it can draw an oval or rectangular filled rectangle.
|
||||
*
|
||||
* @param aTrack The TRACK to fill in.
|
||||
* @param Dcode_index The DCODE value, like D14
|
||||
* @param aLayer The layer index to set into the TRACK
|
||||
* @param aPos The center point of the flash
|
||||
* @param aPos The center point of the rectangle
|
||||
* @param aSize The size of the flash
|
||||
* @param aShape What type of flash, S_SPOT_OVALE or S_SPOT_RECT
|
||||
* @param isDark True if flash is positive and should use a drawing
|
||||
|
@ -810,6 +850,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
|
||||
APERTURE_T aperture = APT_CIRCLE;
|
||||
TRACK* track;
|
||||
BOARD* pcb = frame->m_Pcb;
|
||||
|
||||
int activeLayer = frame->GetScreen()->m_Active_Layer;
|
||||
|
||||
|
@ -841,24 +882,35 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
switch( D_commande )
|
||||
{
|
||||
case 1: // code D01 Draw line, exposure ON
|
||||
{
|
||||
m_Exposure = true;
|
||||
|
||||
SEGZONE* edge_poly = new SEGZONE( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Zone.Append( edge_poly );
|
||||
SEGZONE* edge_poly;
|
||||
edge_poly = new SEGZONE( pcb );
|
||||
pcb->m_Zone.Append( edge_poly );
|
||||
|
||||
edge_poly->SetLayer( activeLayer );
|
||||
edge_poly->m_Width = 1;
|
||||
|
||||
edge_poly->m_Start = m_PreviousPos;
|
||||
NEGATE( edge_poly->m_Start.y );
|
||||
|
||||
edge_poly->m_End = m_CurrentPos;
|
||||
NEGATE( edge_poly->m_End.y );
|
||||
|
||||
edge_poly->SetNet( m_PolygonFillModeState );
|
||||
|
||||
|
||||
// the first track of each polygon has a netcode of zero, otherwise one.
|
||||
// set the erasure flag in that special track, if a negative polygon.
|
||||
if( !m_PolygonFillModeState )
|
||||
{
|
||||
if( m_LayerNegative ^ m_ImageNegative )
|
||||
edge_poly->m_Flags |= DRAW_ERASED;
|
||||
D(printf("\nm_Flags=0x%08X\n", edge_poly->m_Flags );)
|
||||
}
|
||||
|
||||
m_PreviousPos = m_CurrentPos;
|
||||
m_PolygonFillModeState = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: // code D2: exposure OFF (i.e. "move to")
|
||||
m_Exposure = false;
|
||||
|
@ -888,8 +940,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
switch( m_Iterpolation )
|
||||
{
|
||||
case GERB_INTERPOL_LINEAR_1X:
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillLineTRACK( track, dcode, activeLayer,
|
||||
m_PreviousPos, m_CurrentPos,
|
||||
size.x, !(m_LayerNegative ^ m_ImageNegative) );
|
||||
|
@ -903,8 +955,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
|
||||
case GERB_INTERPOL_ARC_NEG:
|
||||
case GERB_INTERPOL_ARC_POS:
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillArcTRACK( track, dcode, activeLayer,
|
||||
m_PreviousPos, m_CurrentPos, m_IJPos,
|
||||
size.x, m_Iterpolation==GERB_INTERPOL_ARC_NEG ? false : true,
|
||||
|
@ -939,8 +991,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
{
|
||||
case APT_LINE: // APT_LINE is not in the spec, don't know why it's here
|
||||
case APT_CIRCLE:
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillRoundFlashTRACK( track, dcode, activeLayer,
|
||||
m_CurrentPos,
|
||||
size.x, !(m_LayerNegative ^ m_ImageNegative) );
|
||||
|
@ -948,8 +1000,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
|
||||
case APT_OVAL:
|
||||
case APT_RECT:
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
|
||||
m_CurrentPos, size,
|
||||
aperture == APT_RECT ? S_SPOT_RECT : S_SPOT_OVALE,
|
||||
|
@ -975,8 +1027,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
curPos += mapPt( p->params[2].GetValue( tool ), p->params[3].GetValue( tool ), m_GerbMetric );
|
||||
int diameter = scale( p->params[1].GetValue( tool ), m_GerbMetric );
|
||||
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillRoundFlashTRACK( track, dcode, activeLayer,
|
||||
m_CurrentPos,
|
||||
diameter, exposure );
|
||||
|
@ -1004,8 +1056,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
|
||||
wxPoint midPoint( (start.x + end.x)/2, (start.y+end.y)/2 );
|
||||
curPos += midPoint;
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
|
||||
curPos, size, S_SPOT_RECT,
|
||||
exposure );
|
||||
|
@ -1019,8 +1071,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
size.x = msize.x;
|
||||
size.y = msize.y;
|
||||
curPos += mapPt( p->params[3].GetValue( tool ), p->params[4].GetValue( tool ), m_GerbMetric );
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
|
||||
curPos, size, S_SPOT_RECT,
|
||||
exposure );
|
||||
|
@ -1038,8 +1090,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
// need the middle, so adjust from the lower left
|
||||
curPos.y += size.y/2;
|
||||
curPos.x += size.x/2;
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
|
||||
curPos, size, S_SPOT_RECT,
|
||||
exposure );
|
||||
|
@ -1053,13 +1105,13 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
|
||||
curPos += mapPt( p->params[0].GetValue( tool ), p->params[1].GetValue( tool ), m_GerbMetric );
|
||||
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillRoundFlashTRACK( track, dcode, activeLayer, curPos,
|
||||
outerDiam, !(m_LayerNegative ^ m_ImageNegative) );
|
||||
|
||||
track = new TRACK( frame->m_Pcb );
|
||||
frame->m_Pcb->m_Track.Append( track );
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillRoundFlashTRACK( track, dcode, activeLayer, curPos,
|
||||
innerDiam, (m_LayerNegative ^ m_ImageNegative) );
|
||||
|
||||
|
@ -1069,10 +1121,46 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
}
|
||||
break;
|
||||
|
||||
case AMP_MOIRE:
|
||||
{
|
||||
curPos += mapPt( p->params[0].GetValue( tool ), p->params[1].GetValue( tool ), m_GerbMetric );
|
||||
|
||||
// e.g.: "6,0,0,0.125,.01,0.01,3,0.003,0.150,0"
|
||||
int outerDiam = scale( p->params[2].GetValue(tool), m_GerbMetric );
|
||||
int penThickness = scale( p->params[3].GetValue(tool), m_GerbMetric );
|
||||
int gap = scale( p->params[4].GetValue(tool), m_GerbMetric );
|
||||
int numCircles = p->params[5].GetValue(tool);
|
||||
int crossHairThickness = scale( p->params[6].GetValue(tool), m_GerbMetric );
|
||||
int crossHairLength = scale( p->params[7].GetValue(tool), m_GerbMetric );
|
||||
// ignore rotation, not supported
|
||||
|
||||
int diamAdjust = 2 * (gap + penThickness); // adjust outerDiam by this on each nested circle
|
||||
for( int i=0; i<numCircles; ++i, outerDiam -= diamAdjust )
|
||||
{
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillCircularTRACK( track, dcode, activeLayer, curPos, outerDiam,
|
||||
penThickness, !(m_LayerNegative ^ m_ImageNegative) );
|
||||
}
|
||||
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
|
||||
curPos, wxSize(crossHairThickness,crossHairLength),
|
||||
S_SPOT_RECT, !(m_LayerNegative ^ m_ImageNegative) );
|
||||
|
||||
track = new TRACK( pcb );
|
||||
pcb->m_Track.Append( track );
|
||||
// swap x and y in wxSize() for this one
|
||||
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
|
||||
curPos, wxSize(crossHairLength,crossHairThickness),
|
||||
S_SPOT_RECT, !(m_LayerNegative ^ m_ImageNegative) );
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_EOF:
|
||||
case AMP_OUTLINE:
|
||||
case AMP_POLYGON:
|
||||
case AMP_MOIRE:
|
||||
default:
|
||||
// not yet supported, waiting for you.
|
||||
break;
|
||||
|
|
|
@ -28,37 +28,37 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
|
|||
/* Draw gerbview layers, for printing
|
||||
*/
|
||||
{
|
||||
DISPLAY_OPTIONS save_opt;
|
||||
int DisplayPolygonsModeImg;
|
||||
DISPLAY_OPTIONS save_opt;
|
||||
int DisplayPolygonsModeImg;
|
||||
|
||||
save_opt = DisplayOpt;
|
||||
if( printmasklayer & ALL_CU_LAYERS )
|
||||
DisplayOpt.DisplayPadFill = FILLED;
|
||||
else
|
||||
DisplayOpt.DisplayPadFill = SKETCH;
|
||||
DisplayOpt.DisplayPadNum = 0;
|
||||
DisplayOpt.DisplayPadNoConn = 0;
|
||||
DisplayOpt.DisplayPadIsol = 0;
|
||||
DisplayOpt.DisplayModEdge = FILLED;
|
||||
DisplayOpt.DisplayModText = FILLED;
|
||||
DisplayOpt.DisplayPcbTrackFill = FILLED;
|
||||
DisplayOpt.DisplayTrackIsol = 0;
|
||||
DisplayOpt.DisplayDrawItems = FILLED;
|
||||
DisplayOpt.DisplayZonesMode = 0;
|
||||
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
|
||||
g_DisplayPolygonsModeSketch = 0;
|
||||
save_opt = DisplayOpt;
|
||||
if( printmasklayer & ALL_CU_LAYERS )
|
||||
DisplayOpt.DisplayPadFill = FILLED;
|
||||
else
|
||||
DisplayOpt.DisplayPadFill = SKETCH;
|
||||
DisplayOpt.DisplayPadNum = 0;
|
||||
DisplayOpt.DisplayPadNoConn = 0;
|
||||
DisplayOpt.DisplayPadIsol = 0;
|
||||
DisplayOpt.DisplayModEdge = FILLED;
|
||||
DisplayOpt.DisplayModText = FILLED;
|
||||
DisplayOpt.DisplayPcbTrackFill = FILLED;
|
||||
DisplayOpt.DisplayTrackIsol = 0;
|
||||
DisplayOpt.DisplayDrawItems = FILLED;
|
||||
DisplayOpt.DisplayZonesMode = 0;
|
||||
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
|
||||
g_DisplayPolygonsModeSketch = 0;
|
||||
|
||||
m_PrintIsMirrored = aPrintMirrorMode;
|
||||
m_PrintIsMirrored = aPrintMirrorMode;
|
||||
|
||||
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer );
|
||||
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer );
|
||||
|
||||
if( Print_Sheet_Ref )
|
||||
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
|
||||
if( Print_Sheet_Ref )
|
||||
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
|
||||
|
||||
m_PrintIsMirrored = false;
|
||||
m_PrintIsMirrored = false;
|
||||
|
||||
DisplayOpt = save_opt;
|
||||
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
|
||||
DisplayOpt = save_opt;
|
||||
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,31 +69,31 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
/* Trace le PCB, et les elements complementaires ( axes, grille .. )
|
||||
*/
|
||||
{
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
||||
|
||||
if( !m_Pcb )
|
||||
return;
|
||||
ActiveScreen = screen;
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
if( !m_Pcb )
|
||||
return;
|
||||
ActiveScreen = screen;
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
if( EraseBg )
|
||||
DrawPanel->EraseScreen( DC );
|
||||
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
DrawPanel->DrawBackGround( DC );
|
||||
|
||||
Trace_Gerber( DC, GR_COPY, -1 );
|
||||
TraceWorkSheet( DC, screen, 0 );
|
||||
Affiche_Status_Box();
|
||||
Trace_Gerber( DC, GR_COPY, -1 );
|
||||
TraceWorkSheet( DC, screen, 0 );
|
||||
Affiche_Status_Box();
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
DrawPanel->Trace_Curseur( DC );
|
||||
DrawPanel->Trace_Curseur( DC );
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
||||
int aDrawMode, const wxPoint& offset )
|
||||
int aDrawMode, const wxPoint& offset )
|
||||
/********************************************************************/
|
||||
/* Redraw the BOARD items but not cursors, axis or grid */
|
||||
// @todo: replace WinEDA_GerberFrame::Trace_Gerber() by this function
|
||||
|
@ -110,72 +110,72 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
|
|||
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
|
||||
*/
|
||||
{
|
||||
if( !m_Pcb )
|
||||
return;
|
||||
if( !m_Pcb )
|
||||
return;
|
||||
|
||||
// Draw filled polygons
|
||||
#define NBMAX 20000
|
||||
int nbpoints = 0;
|
||||
int nbpointsmax = NBMAX;
|
||||
int* coord = (int*) malloc( nbpointsmax * sizeof(int) * 2 );
|
||||
int* ptcoord = coord;
|
||||
bool erase;
|
||||
|
||||
// Draw filled polygons
|
||||
std::vector<wxPoint> coords;
|
||||
|
||||
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
|
||||
{
|
||||
if( !(track->ReturnMaskLayer() & printmasklayer) )
|
||||
continue;
|
||||
// minimize reallocations of the vector's internal array by starting with a good sized one.
|
||||
coords.reserve(20000);
|
||||
|
||||
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
|
||||
{
|
||||
if( !(track->ReturnMaskLayer() & printmasklayer) )
|
||||
continue;
|
||||
|
||||
if( track->GetNet() == 0 ) // StartPoint
|
||||
{
|
||||
if( nbpoints ) // we have found a new polygon: Draw the old polygon
|
||||
{
|
||||
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
||||
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
|
||||
if( track->GetNet() == 0 ) // StartPoint
|
||||
{
|
||||
if( coords.size() ) // we have found a new polygon: Draw the old polygon
|
||||
{
|
||||
int Color;
|
||||
int filled;
|
||||
|
||||
if( erase )
|
||||
{
|
||||
D(printf("erase\n");)
|
||||
Color = g_DrawBgColor;
|
||||
filled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
D(printf("NO erase\n");)
|
||||
Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
||||
filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
|
||||
filled, Color, Color );
|
||||
}
|
||||
GRClosedPoly( &DrawPanel->m_ClipBox, DC, coords.size(), &coords[0],
|
||||
filled, Color, Color );
|
||||
}
|
||||
|
||||
nbpoints = 2;
|
||||
ptcoord = coord;
|
||||
erase = ( track->m_Flags & DRAW_ERASED ) ? true : false;
|
||||
|
||||
coords.clear();
|
||||
coords.push_back( track->m_Start );
|
||||
coords.push_back( track->m_End );
|
||||
}
|
||||
else
|
||||
{
|
||||
coords.push_back( track->m_End );
|
||||
}
|
||||
|
||||
*ptcoord++ = track->m_Start.x;
|
||||
*ptcoord++ = track->m_Start.y;
|
||||
if( track->Next() == NULL ) // Last point
|
||||
{
|
||||
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
||||
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
|
||||
|
||||
*ptcoord++ = track->m_End.x;
|
||||
*ptcoord++ = track->m_End.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( nbpoints >= nbpointsmax )
|
||||
{
|
||||
nbpointsmax *= 2;
|
||||
coord = (int*) realloc( coord, nbpointsmax * sizeof(int) * 2 );
|
||||
ptcoord = coord + nbpointsmax;
|
||||
}
|
||||
nbpoints++;
|
||||
GRClosedPoly( &DrawPanel->m_ClipBox, DC, coords.size(), &coords[0],
|
||||
filled, Color, Color );
|
||||
}
|
||||
}
|
||||
|
||||
*ptcoord++ = track->m_End.x;
|
||||
*ptcoord++ = track->m_End.y;
|
||||
}
|
||||
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
|
||||
Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer );
|
||||
|
||||
if( track->Next() == NULL ) // Last point
|
||||
{
|
||||
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
||||
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
|
||||
if( DisplayOpt.DisplayPadNum )
|
||||
Affiche_DCodes_Pistes( DrawPanel, DC, m_Pcb, GR_COPY );
|
||||
|
||||
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
|
||||
filled, Color, Color );
|
||||
}
|
||||
}
|
||||
|
||||
free( coord );
|
||||
|
||||
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
|
||||
Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer );
|
||||
|
||||
if( DisplayOpt.DisplayPadNum )
|
||||
Affiche_DCodes_Pistes( DrawPanel, DC, m_Pcb, GR_COPY );
|
||||
|
||||
GetScreen()->ClrRefreshReq();
|
||||
GetScreen()->ClrRefreshReq();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
/***************************************************************************************************/
|
||||
void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode,
|
||||
int printmasklayer )
|
||||
int printmasklayer )
|
||||
/***************************************************************************************************/
|
||||
|
||||
/* Function to draw the tracks (i.e Spots or lines) in gerbview
|
||||
|
@ -29,23 +29,23 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_
|
|||
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
|
||||
*/
|
||||
{
|
||||
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
||||
GERBER* gerber = g_GERBER_List[layer];
|
||||
int dcode_hightlight = 0;
|
||||
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
||||
GERBER* gerber = g_GERBER_List[layer];
|
||||
int dcode_hightlight = 0;
|
||||
|
||||
if( gerber )
|
||||
dcode_hightlight = gerber->m_Selected_Tool;
|
||||
if( gerber )
|
||||
dcode_hightlight = gerber->m_Selected_Tool;
|
||||
|
||||
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( !(track->ReturnMaskLayer() & printmasklayer) )
|
||||
continue;
|
||||
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( !(track->ReturnMaskLayer() & printmasklayer) )
|
||||
continue;
|
||||
|
||||
if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer )
|
||||
Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL );
|
||||
else
|
||||
Trace_Segment( panel, DC, track, draw_mode );
|
||||
}
|
||||
if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer )
|
||||
Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL );
|
||||
else
|
||||
Trace_Segment( panel, DC, track, draw_mode );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,163 +61,174 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
|
|||
* draw_mode = mode ( GR_XOR, GR_OR..)
|
||||
*/
|
||||
{
|
||||
int l_piste;
|
||||
int color;
|
||||
int zoom;
|
||||
int rayon;
|
||||
int fillopt;
|
||||
static bool show_err;
|
||||
int l_piste;
|
||||
int color;
|
||||
int zoom;
|
||||
int fillopt;
|
||||
static bool show_err;
|
||||
|
||||
if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
|
||||
{
|
||||
color = g_DrawBgColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
return;
|
||||
{
|
||||
color = g_DrawBgColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
return;
|
||||
|
||||
if( draw_mode & GR_SURBRILL )
|
||||
{
|
||||
if( draw_mode & GR_AND )
|
||||
color &= ~HIGHT_LIGHT_FLAG;
|
||||
else
|
||||
color |= HIGHT_LIGHT_FLAG;
|
||||
}
|
||||
if( color & HIGHT_LIGHT_FLAG )
|
||||
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
||||
}
|
||||
if( draw_mode & GR_SURBRILL )
|
||||
{
|
||||
if( draw_mode & GR_AND )
|
||||
color &= ~HIGHT_LIGHT_FLAG;
|
||||
else
|
||||
color |= HIGHT_LIGHT_FLAG;
|
||||
}
|
||||
if( color & HIGHT_LIGHT_FLAG )
|
||||
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
||||
}
|
||||
|
||||
GRSetDrawMode( DC, draw_mode );
|
||||
GRSetDrawMode( DC, draw_mode );
|
||||
|
||||
zoom = panel->GetZoom();
|
||||
zoom = panel->GetZoom();
|
||||
|
||||
rayon = l_piste = track->m_Width >> 1;
|
||||
fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
|
||||
|
||||
fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
|
||||
switch( track->m_Shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
{
|
||||
int radius = (int) hypot( (double) (track->m_End.x - track->m_Start.x),
|
||||
(double) (track->m_End.y - track->m_Start.y) );
|
||||
|
||||
switch( track->m_Shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
rayon = (int) hypot( (double) (track->m_End.x - track->m_Start.x),
|
||||
(double) (track->m_End.y - track->m_Start.y) );
|
||||
if( (l_piste / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
rayon, 0, color );
|
||||
}
|
||||
int halfPenWidth = track->m_Width >> 1;
|
||||
if( (halfPenWidth / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
radius, 0, color );
|
||||
}
|
||||
|
||||
if( fillopt == SKETCH )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
rayon - l_piste, 0, color );
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
rayon + l_piste, 0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
rayon, track->m_Width, color );
|
||||
}
|
||||
break;
|
||||
if( fillopt == SKETCH )
|
||||
{
|
||||
// draw the border of the pen's path using two circles, each as narrow as possible
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
radius - halfPenWidth, 0, color );
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
radius + halfPenWidth, 0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
radius, track->m_Width, color );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
if( fillopt == SKETCH )
|
||||
{
|
||||
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Param, track->GetSubNet(), 0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Param, track->GetSubNet(),
|
||||
track->m_Width, color );
|
||||
}
|
||||
break;
|
||||
case S_ARC:
|
||||
if( fillopt == SKETCH )
|
||||
{
|
||||
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Param, track->GetSubNet(), 0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Param, track->GetSubNet(),
|
||||
track->m_Width, color );
|
||||
}
|
||||
break;
|
||||
|
||||
case S_SPOT_CIRCLE:
|
||||
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
||||
if( (rayon / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
rayon, 0, color );
|
||||
}
|
||||
else if( fillopt == SKETCH )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
rayon, 0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
rayon, 0, color, color );
|
||||
}
|
||||
break;
|
||||
case S_SPOT_CIRCLE:
|
||||
{
|
||||
int radius = track->m_Width >> 1;
|
||||
|
||||
case S_SPOT_RECT:
|
||||
case S_RECT:
|
||||
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
||||
if( (l_piste / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y, 0, color );
|
||||
}
|
||||
else if( fillopt == SKETCH )
|
||||
{
|
||||
GRRect( &panel->m_ClipBox, DC,
|
||||
track->m_Start.x - l_piste,
|
||||
track->m_Start.y - l_piste,
|
||||
track->m_End.x + l_piste,
|
||||
track->m_End.y + l_piste,
|
||||
0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFilledRect( &panel->m_ClipBox, DC,
|
||||
track->m_Start.x - l_piste,
|
||||
track->m_Start.y - l_piste,
|
||||
track->m_End.x + l_piste,
|
||||
track->m_End.y + l_piste,
|
||||
0, color, color );
|
||||
}
|
||||
break;
|
||||
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
||||
if( (radius / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
radius, 0, color );
|
||||
}
|
||||
else if( fillopt == SKETCH )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
radius, 0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
radius, 0, color, color );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case S_SPOT_OVALE:
|
||||
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
||||
case S_SPOT_RECT:
|
||||
case S_RECT:
|
||||
|
||||
case S_SEGMENT:
|
||||
if( (l_piste / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y, 0, color );
|
||||
break;
|
||||
}
|
||||
l_piste = track->m_Width >> 1;
|
||||
|
||||
if( fillopt == SKETCH )
|
||||
{
|
||||
GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Width, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Width, color );
|
||||
}
|
||||
break;
|
||||
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
||||
if( (l_piste / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y, 0, color );
|
||||
}
|
||||
else if( fillopt == SKETCH )
|
||||
{
|
||||
GRRect( &panel->m_ClipBox, DC,
|
||||
track->m_Start.x - l_piste,
|
||||
track->m_Start.y - l_piste,
|
||||
track->m_End.x + l_piste,
|
||||
track->m_End.y + l_piste,
|
||||
0, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFilledRect( &panel->m_ClipBox, DC,
|
||||
track->m_Start.x - l_piste,
|
||||
track->m_Start.y - l_piste,
|
||||
track->m_End.x + l_piste,
|
||||
track->m_End.y + l_piste,
|
||||
0, color, color );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if( !show_err )
|
||||
{
|
||||
DisplayError( panel, wxT( "Trace_Segment() type error" ) );
|
||||
show_err = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case S_SPOT_OVALE:
|
||||
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
||||
|
||||
case S_SEGMENT:
|
||||
l_piste = track->m_Width >> 1;
|
||||
|
||||
if( (l_piste / zoom) < L_MIN_DESSIN )
|
||||
{
|
||||
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y, 0, color );
|
||||
break;
|
||||
}
|
||||
|
||||
if( fillopt == SKETCH )
|
||||
{
|
||||
GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Width, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
||||
track->m_End.x, track->m_End.y,
|
||||
track->m_Width, color );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if( !show_err )
|
||||
{
|
||||
DisplayError( panel, wxT( "Trace_Segment() type error" ) );
|
||||
show_err = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -227,49 +238,49 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
|
|||
void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode )
|
||||
/*****************************************************************************************/
|
||||
{
|
||||
TRACK* track;
|
||||
wxPoint pos;
|
||||
int width, orient;
|
||||
wxString Line;
|
||||
TRACK* track;
|
||||
wxPoint pos;
|
||||
int width, orient;
|
||||
wxString Line;
|
||||
|
||||
GRSetDrawMode( DC, drawmode );
|
||||
track = Pcb->m_Track;
|
||||
for( ; track != NULL; track = track->Next() )
|
||||
{
|
||||
if( (track->m_Shape == S_ARC)
|
||||
|| (track->m_Shape == S_CIRCLE)
|
||||
|| (track->m_Shape == S_ARC_RECT) )
|
||||
{
|
||||
pos.x = track->m_Start.x;
|
||||
pos.y = track->m_Start.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.x = (track->m_Start.x + track->m_End.x) / 2;
|
||||
pos.y = (track->m_Start.y + track->m_End.y) / 2;
|
||||
}
|
||||
GRSetDrawMode( DC, drawmode );
|
||||
track = Pcb->m_Track;
|
||||
for( ; track != NULL; track = track->Next() )
|
||||
{
|
||||
if( (track->m_Shape == S_ARC)
|
||||
|| (track->m_Shape == S_CIRCLE)
|
||||
|| (track->m_Shape == S_ARC_RECT) )
|
||||
{
|
||||
pos.x = track->m_Start.x;
|
||||
pos.y = track->m_Start.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.x = (track->m_Start.x + track->m_End.x) / 2;
|
||||
pos.y = (track->m_Start.y + track->m_End.y) / 2;
|
||||
}
|
||||
|
||||
Line.Printf( wxT( "D%d" ), track->GetNet() );
|
||||
Line.Printf( wxT( "D%d" ), track->GetNet() );
|
||||
|
||||
width = track->m_Width;
|
||||
orient = TEXT_ORIENT_HORIZ;
|
||||
if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash
|
||||
{
|
||||
width /= 3;
|
||||
}
|
||||
else // lines
|
||||
{
|
||||
int dx, dy;
|
||||
dx = track->m_Start.x - track->m_End.x;
|
||||
dy = track->m_Start.y - track->m_End.y;
|
||||
if( abs( dx ) < abs( dy ) )
|
||||
orient = TEXT_ORIENT_VERT;
|
||||
width /= 2;
|
||||
}
|
||||
width = track->m_Width;
|
||||
orient = TEXT_ORIENT_HORIZ;
|
||||
if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash
|
||||
{
|
||||
width /= 3;
|
||||
}
|
||||
else // lines
|
||||
{
|
||||
int dx, dy;
|
||||
dx = track->m_Start.x - track->m_End.x;
|
||||
dy = track->m_Start.y - track->m_End.y;
|
||||
if( abs( dx ) < abs( dy ) )
|
||||
orient = TEXT_ORIENT_VERT;
|
||||
width /= 2;
|
||||
}
|
||||
|
||||
DrawGraphicText( panel, DC,
|
||||
pos, (EDA_Colors) g_DCodesColor, Line,
|
||||
orient, wxSize( width, width ),
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||
}
|
||||
DrawGraphicText( panel, DC,
|
||||
pos, (EDA_Colors) g_DCodesColor, Line,
|
||||
orient, wxSize( width, width ),
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,13 +95,57 @@ void GRMoveRel(int x, int y);
|
|||
void GRSMoveRel(int x, int y);
|
||||
void GRLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color);
|
||||
void GRSLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color);
|
||||
void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
|
||||
bool Fill, int width, int Color, int BgColor);
|
||||
void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int Color, int BgColor);
|
||||
void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int width, int Color, int BgColor);
|
||||
void GRSPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int width, int Color, int BgColor);
|
||||
void GRSClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int width, int Color, int BgColor);
|
||||
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color);
|
||||
|
||||
|
||||
void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, wxPoint Points[], bool Fill, int width, int Color, int BgColor);
|
||||
|
||||
|
||||
/**
|
||||
* Function GRClosedPoly
|
||||
* draws a closed polygon onto the drawing context \a aDC and optionally fills and/or
|
||||
* draws a border around it.
|
||||
* @param ClipBox defines a rectangular boundary outside of which no drawing will occur.
|
||||
* @param aDC the device context into which drawing should occur.
|
||||
* @param aPointCount the number of points in the array \a aPointArray.
|
||||
* @param aPointArray an array holding the wxPoints in the polygon.
|
||||
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
|
||||
* @param aPenColor the color index of the border.
|
||||
* @param aFillColor the fill color of the polygon's interior.
|
||||
*/
|
||||
void GRClosedPoly(EDA_Rect* ClipBox, wxDC* aDC, int aPointCount, wxPoint aPoints[], bool doFill, int aPenColor, int aFillColor);
|
||||
|
||||
// @todo could make these 2 closed polygons calls a single function and default the aPenWidth argument
|
||||
|
||||
/**
|
||||
* Function GRClosedPoly
|
||||
* draws a closed polygon onto the drawing context \a aDC and optionally fills and/or
|
||||
* draws a border around it.
|
||||
* @param ClipBox defines a rectangular boundary outside of which no drawing will occur.
|
||||
* @param aDC the device context into which drawing should occur.
|
||||
* @param aPointCount the number of points in the array \a aPointArray.
|
||||
* @param aPointArray an array holding the wxPoints in the polygon.
|
||||
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
|
||||
* @param aPenWidth is the width of the pen to use on the perimeter, can be zero.
|
||||
* @param aPenColor the color index of the border.
|
||||
* @param aFillColor the fill color of the polygon's interior.
|
||||
*/
|
||||
void GRClosedPoly(EDA_Rect * ClipBox, wxDC* aDC, int aPointCount, wxPoint aPoints[], bool doFill, int aPenWidth, int aPenColor, int aFillColor);
|
||||
|
||||
|
||||
/**
|
||||
* Function GRCircle
|
||||
* draws a circle onto the drawing context \a aDC centered at the user coordinates (x,y)
|
||||
*
|
||||
* @param ClipBox defines a rectangular boundary outside of which no drawing will occur.
|
||||
* @param aDC the device context into which drawing should occur.
|
||||
* @param x The x coordinate in user space of the center of the circle.
|
||||
* @param x The y coordinate in user space of the center of the circle.
|
||||
* @param aRadius is the radis of the circle.
|
||||
* @param aColor is an index into our color table of RGB colors.
|
||||
* @see EDA_Colors and colors.h
|
||||
*/
|
||||
void GRCircle(EDA_Rect * ClipBox, wxDC * aDC, int x, int y, int aRadius, int aColor);
|
||||
|
||||
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color);
|
||||
void GRFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r,
|
||||
int width, int Color, int BgColor);
|
||||
|
|
|
@ -35,17 +35,11 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
|
|||
m_Shape = S_SEGMENT;
|
||||
m_Angle = 0;
|
||||
m_Width = 120;
|
||||
m_PolyCount = 0; // For polygons : number of points (> 2)
|
||||
m_PolyList = NULL; // For polygons: coord list (1 point = 2 coord)
|
||||
}
|
||||
|
||||
|
||||
EDGE_MODULE::~EDGE_MODULE()
|
||||
{
|
||||
if( m_PolyList )
|
||||
free( m_PolyList );
|
||||
m_PolyList = NULL;
|
||||
m_PolyCount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,6 +50,7 @@ void EDGE_MODULE:: Copy( EDGE_MODULE* source ) // copy structure
|
|||
if( source == NULL )
|
||||
return;
|
||||
|
||||
// @todo why not just use "*this = source;" ?
|
||||
m_Start = source->m_Start;
|
||||
m_End = source->m_End;
|
||||
m_Shape = source->m_Shape;
|
||||
|
@ -64,18 +59,8 @@ void EDGE_MODULE:: Copy( EDGE_MODULE* source ) // copy structure
|
|||
m_Angle = source->m_Angle; // pour les arcs de cercle: longueur de l'arc en 0,1 degres
|
||||
m_Layer = source->m_Layer;
|
||||
m_Width = source->m_Width;
|
||||
if( m_PolyList )
|
||||
free( m_PolyList );
|
||||
m_PolyCount = 0;
|
||||
m_PolyList = NULL;
|
||||
if( source->m_PolyCount && source->m_PolyList )
|
||||
{
|
||||
int size;
|
||||
m_PolyCount = source->m_PolyCount; // For polygons : number of points
|
||||
size = m_PolyCount * 2 * sizeof(int); // For polygons: 1 point = 2 coord
|
||||
m_PolyList = (int*) MyMalloc( size );
|
||||
memcpy( m_PolyList, source->m_PolyList, size );
|
||||
}
|
||||
|
||||
m_PolyPoints = source->m_PolyPoints;
|
||||
}
|
||||
|
||||
/***********************************/
|
||||
|
@ -210,33 +195,32 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
{
|
||||
// We must compute true coordinates from m_PolyList
|
||||
// which are relative to module position, orientation 0
|
||||
int ii, * source, * ptr, * ptr_base;
|
||||
ptr = ptr_base = (int*) MyMalloc( 2 * m_PolyCount * sizeof(int) );
|
||||
source = m_PolyList;
|
||||
for( ii = 0; ii < m_PolyCount; ii++ )
|
||||
{
|
||||
int x, y;
|
||||
x = *source; source++; y = *source; source++;
|
||||
if( Module )
|
||||
{
|
||||
RotatePoint( &x, &y, Module->m_Orient );
|
||||
x += Module->m_Pos.x;
|
||||
y += Module->m_Pos.y;
|
||||
}
|
||||
x += m_Start0.x - offset.x;
|
||||
y += m_Start0.y - offset.y;
|
||||
*ptr = x; ptr++; *ptr = y; ptr++;
|
||||
}
|
||||
// We must compute true coordinates from m_PolyPoints
|
||||
// which are relative to module position, orientation 0
|
||||
|
||||
GRPoly( &panel->m_ClipBox, DC, m_PolyCount, ptr_base,
|
||||
TRUE, m_Width, color, color );
|
||||
free( ptr_base );
|
||||
std::vector<wxPoint> points = m_PolyPoints;
|
||||
|
||||
for( unsigned ii = 0; ii < points.size(); ii++ )
|
||||
{
|
||||
wxPoint& pt = points[ii];
|
||||
|
||||
if( Module )
|
||||
{
|
||||
RotatePoint( &pt.x, &pt.y, Module->m_Orient );
|
||||
pt.x += Module->m_Pos.x;
|
||||
pt.y += Module->m_Pos.y;
|
||||
}
|
||||
|
||||
pt.x += m_Start0.x - offset.x;
|
||||
pt.y += m_Start0.y - offset.y;
|
||||
}
|
||||
|
||||
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0],
|
||||
TRUE, m_Width, color, color );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,13 +290,11 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
|
|||
ret = fprintf( aFile, "DP %d %d %d %d %d %d %d\n",
|
||||
m_Start0.x, m_Start0.y,
|
||||
m_End0.x, m_End0.y,
|
||||
m_PolyCount,
|
||||
m_PolyPoints.size(),
|
||||
m_Width, m_Layer );
|
||||
|
||||
int* pInt;
|
||||
pInt = m_PolyList;
|
||||
for( int i=0; i<m_PolyCount; ++i, pInt+=2 )
|
||||
fprintf( aFile, "Dl %d %d\n", pInt[0], pInt[1] );
|
||||
for( unsigned i=0; i<m_PolyPoints.size(); ++i )
|
||||
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x, m_PolyPoints[i].y );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -345,11 +327,10 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
|
|||
*
|
||||
*/
|
||||
{
|
||||
int ii, * ptr;
|
||||
int ii;
|
||||
int error = 0;
|
||||
char Buf[1024];
|
||||
|
||||
|
||||
switch( Line[1] )
|
||||
{
|
||||
case 'S':
|
||||
|
@ -394,26 +375,37 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
|
|||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
int pointCount;
|
||||
sscanf( Line + 3, "%d %d %d %d %d %d %d",
|
||||
&m_Start0.x, &m_Start0.y,
|
||||
&m_End0.x, &m_End0.y,
|
||||
&m_PolyCount, &m_Width, &m_Layer );
|
||||
&pointCount, &m_Width, &m_Layer );
|
||||
|
||||
(*LineNum)++;
|
||||
m_PolyList = (int*) MyZMalloc( 2 * m_PolyCount * sizeof(int) );
|
||||
for( ii = 0, ptr = m_PolyList; ii < m_PolyCount; ii++ )
|
||||
m_PolyPoints.clear();
|
||||
m_PolyPoints.reserve( pointCount );
|
||||
for( ii = 0; ii<pointCount; ii++ )
|
||||
{
|
||||
if( GetLine( File, Buf, LineNum, sizeof(Buf) - 1 ) != NULL )
|
||||
{
|
||||
if( strncmp( Buf, "Dl", 2 ) != 0 )
|
||||
{
|
||||
error = 1; break;
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
sscanf( Buf + 3, "%d %d\n", ptr, ptr + 1 );
|
||||
(*LineNum)++; ptr += 2;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
sscanf( Buf + 3, "%d %d\n", &x, &y );
|
||||
|
||||
m_PolyPoints.push_back( wxPoint(x,y) );
|
||||
|
||||
(*LineNum)++;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = 1; break;
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ public:
|
|||
|
||||
int m_Angle; // pour les arcs de cercle: longueur de l'arc en 0,1 degres
|
||||
|
||||
int m_PolyCount; // For polygons: number of points (> 2)
|
||||
int* m_PolyList; // For polygons: coord list (1 point = 2 coord)
|
||||
std::vector<wxPoint> m_PolyPoints; // For polygons: number of points (> 2)
|
||||
// Coord are relative to Origin, orient 0
|
||||
|
||||
public:
|
||||
|
|
|
@ -280,7 +280,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
|
|||
coord[ii].y = coord[ii].y + uy0;
|
||||
}
|
||||
|
||||
GRClosedPoly( &panel->m_ClipBox, DC, 4, (int*) coord, fillpad, color, color );
|
||||
GRClosedPoly( &panel->m_ClipBox, DC, 4, coord, fillpad, color, color );
|
||||
|
||||
if( DisplayIsol )
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
|
|||
coord[ii].y = coord[ii].y + uy0;
|
||||
}
|
||||
|
||||
GRClosedPoly( &panel->m_ClipBox, DC, 4, (int*) coord, 0, color, color );
|
||||
GRClosedPoly( &panel->m_ClipBox, DC, 4, coord, 0, color, color );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -455,19 +455,6 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
|
|||
}
|
||||
}
|
||||
|
||||
/* this is local class to handle 2 integers that are a corner coordinate
|
||||
* One could use wxPoint insteed.
|
||||
* However, this class has only 2 integers
|
||||
* if changes happen in wxPoint ( like virtual functions) they will be not suitable
|
||||
* So i prefer use this simple class to handle a coordinate.
|
||||
*/
|
||||
class corner_coord
|
||||
{
|
||||
public:
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
||||
|
@ -483,8 +470,8 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
|||
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
|
||||
*/
|
||||
{
|
||||
static vector < char > CornersTypeBuffer;
|
||||
static vector < corner_coord > CornersBuffer;
|
||||
static vector <char> CornersTypeBuffer;
|
||||
static vector <wxPoint> CornersBuffer;
|
||||
// outline_mode is false to show filled polys,
|
||||
// and true to show polygons outlines only (test and debug purposes)
|
||||
bool outline_mode = DisplayOpt.DisplayZonesMode == 2 ? true : false;
|
||||
|
@ -535,19 +522,21 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
|||
for( int ic = 0; ic <= imax; ic++ )
|
||||
{
|
||||
CPolyPt* corner = &m_FilledPolysList[ic];
|
||||
corner_coord coord;
|
||||
wxPoint coord;
|
||||
coord.x = corner->x + offset.x;
|
||||
coord.y = corner->y + offset.y;
|
||||
CornersBuffer.push_back(coord);
|
||||
CornersTypeBuffer.push_back((char) corner->utility);
|
||||
|
||||
if( (corner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it
|
||||
{ /* Draw the current filled area: draw segments ouline first
|
||||
* Curiously, draw segments ouline first and after draw filled polygons
|
||||
* with oulines thickness = 0 is a faster than
|
||||
* just draw filled polygons but with oulines thickness = m_ZoneMinThickness
|
||||
* So DO NOT use draw filled polygons with oulines having a thickness > 0
|
||||
* Note: Extra segments ( added by kbool to joint holes with external outline) are not drawn
|
||||
*/
|
||||
{
|
||||
/* Draw the current filled area: draw segments ouline first
|
||||
* Curiously, draw segments ouline first and after draw filled polygons
|
||||
* with oulines thickness = 0 is a faster than
|
||||
* just draw filled polygons but with oulines thickness = m_ZoneMinThickness
|
||||
* So DO NOT use draw filled polygons with oulines having a thickness > 0
|
||||
* Note: Extra segments ( added by kbool to joint holes with external outline) are not drawn
|
||||
*/
|
||||
{
|
||||
// Draw outlines:
|
||||
if ( (m_ZoneMinThickness > 1) || outline_mode )
|
||||
|
@ -559,6 +548,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
|||
int y0 = CornersBuffer[is].y;
|
||||
int x1 = CornersBuffer[ie].x;
|
||||
int y1 = CornersBuffer[ie].y;
|
||||
|
||||
if ( CornersTypeBuffer[ie] == 0 ) // Draw only basic outlines, not extra segments
|
||||
{
|
||||
if( (!DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) )
|
||||
|
@ -573,12 +563,12 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
|||
}
|
||||
}
|
||||
// Draw areas:
|
||||
if( (m_FillMode == 0 ) && ! outline_mode )
|
||||
GRPoly( &panel->m_ClipBox, DC, CornersBuffer.size(), (int*)&CornersBuffer[0].x,
|
||||
true, 0, color, color );
|
||||
if( (m_FillMode == 0 ) && ! outline_mode )
|
||||
GRPoly( &panel->m_ClipBox, DC, CornersBuffer.size(), &CornersBuffer[0],
|
||||
true, 0, color, color );
|
||||
}
|
||||
CornersTypeBuffer.clear();
|
||||
CornersBuffer.clear();
|
||||
CornersTypeBuffer.clear();
|
||||
CornersBuffer.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
|
|||
* the "gap" is isolation created between this 2 pads
|
||||
*/
|
||||
{
|
||||
int gap_size, oX, ii;
|
||||
int oX;
|
||||
float fcoeff;
|
||||
D_PAD* pad;
|
||||
MODULE* Module;
|
||||
|
@ -126,7 +126,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
|
|||
bool abort;
|
||||
|
||||
/* Enter the size of the gap or stub*/
|
||||
gap_size = g_DesignSettings.m_CurrentTrackWidth; // Valeur raisonnable
|
||||
int gap_size = g_DesignSettings.m_CurrentTrackWidth; // Valeur raisonnable
|
||||
|
||||
switch( shape_type )
|
||||
{
|
||||
|
@ -219,40 +219,39 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
|
|||
pad->m_Pos.y += pad->m_Pos0.y;
|
||||
break;
|
||||
|
||||
case 2: //Arc Stub created by a polygonal approach:
|
||||
{
|
||||
EDGE_MODULE* edge; int* ptr, theta;
|
||||
ii = angle / 50; // Note : angles are in 0.1 degrees
|
||||
|
||||
edge = new EDGE_MODULE( Module );
|
||||
Module->m_Drawings.PushFront( edge );
|
||||
|
||||
edge->m_Shape = S_POLYGON;
|
||||
edge->SetLayer( LAYER_CMP_N );
|
||||
edge->m_PolyCount = ii + 3;
|
||||
edge->m_PolyList = (int*) MyMalloc( edge->m_PolyCount * 2 * sizeof(int) );
|
||||
ptr = edge->m_PolyList;
|
||||
edge->m_Start0.y = -pad->m_Size.y / 2;
|
||||
|
||||
*ptr = 0; ptr++;
|
||||
*ptr = 0; ptr++;
|
||||
theta = -angle / 2;
|
||||
for( ii = 1; ii < edge->m_PolyCount - 1; ii++ )
|
||||
case 2: // Arc Stub created by a polygonal approach:
|
||||
{
|
||||
int x, y;
|
||||
x = 0; y = -gap_size;
|
||||
RotatePoint( &x, &y, theta );
|
||||
*ptr = x; ptr++; *ptr = y; ptr++;
|
||||
theta += 50;
|
||||
if( theta > angle / 2 )
|
||||
theta = angle / 2;
|
||||
}
|
||||
EDGE_MODULE* edge = new EDGE_MODULE( Module );
|
||||
Module->m_Drawings.PushFront( edge );
|
||||
|
||||
// Close the polygon:
|
||||
*ptr = edge->m_PolyList[0]; ptr++;
|
||||
*ptr = edge->m_PolyList[1];
|
||||
edge->m_Shape = S_POLYGON;
|
||||
edge->SetLayer( LAYER_CMP_N );
|
||||
|
||||
int numPoints = angle / 50 + 3; // Note : angles are in 0.1 degrees
|
||||
edge->m_PolyPoints.reserve( numPoints );
|
||||
|
||||
edge->m_Start0.y = -pad->m_Size.y / 2;
|
||||
|
||||
edge->m_PolyPoints.push_back( wxPoint(0,0) );
|
||||
|
||||
int theta = -angle / 2;
|
||||
for( int ii=1; ii<numPoints-1; ii++ )
|
||||
{
|
||||
wxPoint pt(0, -gap_size);
|
||||
|
||||
RotatePoint( &pt.x, &pt.y, theta );
|
||||
|
||||
edge->m_PolyPoints.push_back( pt );
|
||||
|
||||
theta += 50;
|
||||
if( theta > angle / 2 )
|
||||
theta = angle / 2;
|
||||
}
|
||||
|
||||
// Close the polygon:
|
||||
edge->m_PolyPoints.push_back( edge->m_PolyPoints[0] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -505,11 +504,13 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
|
|||
MODULE* Module;
|
||||
wxString cmp_name;
|
||||
int pad_count = 2;
|
||||
EDGE_MODULE* edge; int* ptr;
|
||||
EDGE_MODULE* edge;
|
||||
int ii, npoints;
|
||||
|
||||
WinEDA_SetParamShapeFrame* frame = new WinEDA_SetParamShapeFrame( this, wxPoint( -1, -1 ) );
|
||||
int ok = frame->ShowModal(); frame->Destroy();
|
||||
|
||||
int ok = frame->ShowModal();
|
||||
frame->Destroy();
|
||||
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
|
@ -524,6 +525,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
|
|||
|
||||
if( PolyShapeType == 2 ) // mirrored
|
||||
ShapeScaleY = -ShapeScaleY;
|
||||
|
||||
ShapeSize.x = (int) round( ShapeScaleX );
|
||||
ShapeSize.y = (int) round( ShapeScaleY );
|
||||
|
||||
|
@ -558,69 +560,50 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
|
|||
edge->SetLayer( LAYER_CMP_N );
|
||||
npoints = PolyEdgesCount;
|
||||
|
||||
switch( PolyShapeType )
|
||||
{
|
||||
case 0: // Single
|
||||
case 2: // Single, mirrored
|
||||
edge->m_PolyCount = PolyEdgesCount + 2;
|
||||
break;
|
||||
|
||||
case 1: // Symetric
|
||||
edge->m_PolyCount = (2 * PolyEdgesCount) + 2;
|
||||
break;
|
||||
}
|
||||
|
||||
edge->m_PolyList = (int*) MyMalloc( edge->m_PolyCount * 2 * sizeof(int) );
|
||||
|
||||
ptr = edge->m_PolyList;
|
||||
edge->m_PolyPoints.reserve(2 * PolyEdgesCount + 2);
|
||||
|
||||
// Init start point coord:
|
||||
*ptr = pad1->m_Pos0.x; ptr++;
|
||||
*ptr = 0; ptr++;
|
||||
edge->m_PolyPoints.push_back( wxPoint( pad1->m_Pos0.x, 0) );
|
||||
|
||||
double* dptr = PolyEdges;
|
||||
wxPoint first_cordinate, last_cordinate;
|
||||
wxPoint first_coordinate, last_coordinate;
|
||||
for( ii = 0; ii < npoints; ii++ ) // Copy points
|
||||
{
|
||||
last_cordinate.x = *ptr = (int) round( *dptr * ShapeScaleX ) + pad1->m_Pos0.x;
|
||||
dptr++; ptr++;
|
||||
last_cordinate.y = *ptr = -(int) round( *dptr * ShapeScaleY );
|
||||
dptr++; ptr++;
|
||||
last_coordinate.x = (int) round( *dptr++ * ShapeScaleX ) + pad1->m_Pos0.x;
|
||||
last_coordinate.y = -(int) round( *dptr++ * ShapeScaleY );
|
||||
edge->m_PolyPoints.push_back( last_coordinate );
|
||||
}
|
||||
|
||||
first_cordinate.y = edge->m_PolyList[3];
|
||||
first_coordinate.y = edge->m_PolyPoints[1].y;
|
||||
|
||||
switch( PolyShapeType )
|
||||
{
|
||||
int* ptr1;
|
||||
|
||||
case 0: // Single
|
||||
case 2: // Single mirrored
|
||||
// Init end point coord:
|
||||
*ptr = pad2->m_Pos0.x = last_cordinate.x; ptr++;
|
||||
*ptr = 0;
|
||||
pad1->m_Size.x = pad1->m_Size.y = ABS( first_cordinate.y );
|
||||
pad2->m_Size.x = pad2->m_Size.y = ABS( last_cordinate.y );
|
||||
pad1->m_Pos0.y = first_cordinate.y / 2;
|
||||
pad2->m_Pos0.y = last_cordinate.y / 2;
|
||||
pad2->m_Pos0.x = last_coordinate.x;
|
||||
edge->m_PolyPoints.push_back( wxPoint( last_coordinate.x, 0 ) );
|
||||
|
||||
pad1->m_Size.x = pad1->m_Size.y = ABS( first_coordinate.y );
|
||||
pad2->m_Size.x = pad2->m_Size.y = ABS( last_coordinate.y );
|
||||
pad1->m_Pos0.y = first_coordinate.y / 2;
|
||||
pad2->m_Pos0.y = last_coordinate.y / 2;
|
||||
pad1->m_Pos.y = pad1->m_Pos0.y + Module->m_Pos.y;
|
||||
pad2->m_Pos.y = pad2->m_Pos0.y + Module->m_Pos.y;
|
||||
break;
|
||||
|
||||
case 1: // Symetric
|
||||
ptr1 = ptr - 2;
|
||||
for( ii = 0; ii <= npoints; ii++ )
|
||||
for( int ndx = edge->m_PolyPoints.size()-1; ndx>=0; --ndx )
|
||||
{
|
||||
*ptr = *ptr1; // Copy X coord
|
||||
ptr++;
|
||||
*ptr = -*(ptr1 + 1); // Copy Y coord, mirror X axis
|
||||
ptr1 -= 2; ptr++;
|
||||
wxPoint pt = edge->m_PolyPoints[ndx];
|
||||
|
||||
pt.y = -pt.y; // mirror about X axis
|
||||
|
||||
edge->m_PolyPoints.push_back( pt );
|
||||
}
|
||||
|
||||
pad1->m_Size.x = pad1->m_Size.y = 2* ABS( first_cordinate.y );
|
||||
|
||||
pad2->m_Size.x = pad2->m_Size.y = 2* ABS( last_cordinate.y );
|
||||
|
||||
pad1->m_Size.x = pad1->m_Size.y = 2 * ABS( first_coordinate.y );
|
||||
pad2->m_Size.x = pad2->m_Size.y = 2 * ABS( last_coordinate.y );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -325,9 +325,9 @@ static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot )
|
|||
size.x = -size.x; // Text is mirrored
|
||||
|
||||
if ( format_plot == PLOT_FORMAT_GERBER )
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
|
||||
PlotGraphicText( format_plot, pos, BLACK,
|
||||
PlotGraphicText( format_plot, pos, BLACK,
|
||||
pt_texte->m_Text,
|
||||
orient, size,
|
||||
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
||||
|
@ -472,6 +472,7 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
|
|||
|
||||
if( PtEdge->Type() != TYPE_EDGE_MODULE )
|
||||
return;
|
||||
|
||||
type_trace = PtEdge->m_Shape;
|
||||
thickness = PtEdge->m_Width;
|
||||
if( Plot_Mode == FILAIRE )
|
||||
|
@ -517,39 +518,42 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
|
|||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
{
|
||||
// We must compute true coordinates from m_PolyList
|
||||
// which are relative to module position, orientation 0
|
||||
int ii, * source, * ptr, * ptr_base;
|
||||
MODULE* Module = NULL;
|
||||
if( PtEdge->GetParent() && (PtEdge->GetParent()->Type() == TYPE_MODULE) )
|
||||
Module = (MODULE*) PtEdge->GetParent();
|
||||
ptr = ptr_base = (int*) MyMalloc( 2 * PtEdge->m_PolyCount * sizeof(int) );
|
||||
source = PtEdge->m_PolyList;
|
||||
for( ii = 0; ii < PtEdge->m_PolyCount; ii++ )
|
||||
{
|
||||
int x = *source++;
|
||||
int y = *source++;
|
||||
// We must compute true coordinates from m_PolyList
|
||||
// which are relative to module position, orientation 0
|
||||
MODULE* Module = NULL;
|
||||
if( PtEdge->GetParent() && (PtEdge->GetParent()->Type() == TYPE_MODULE) )
|
||||
Module = (MODULE*) PtEdge->GetParent();
|
||||
|
||||
if( Module )
|
||||
int* ptr_base = (int*) MyMalloc( 2 * PtEdge->m_PolyPoints.size() * sizeof(int) );
|
||||
int* ptr = ptr_base;
|
||||
|
||||
int* source = (int*) &PtEdge->m_PolyPoints[0];
|
||||
|
||||
for( unsigned ii = 0; ii < PtEdge->m_PolyPoints.size(); ii++ )
|
||||
{
|
||||
RotatePoint( &x, &y, Module->m_Orient );
|
||||
x += Module->m_Pos.x;
|
||||
y += Module->m_Pos.y;
|
||||
int x = *source++;
|
||||
int y = *source++;
|
||||
|
||||
if( Module )
|
||||
{
|
||||
RotatePoint( &x, &y, Module->m_Orient );
|
||||
x += Module->m_Pos.x;
|
||||
y += Module->m_Pos.y;
|
||||
}
|
||||
|
||||
x += PtEdge->m_Start0.x;
|
||||
y += PtEdge->m_Start0.y;
|
||||
|
||||
*ptr++ = x;
|
||||
*ptr++ = y;
|
||||
}
|
||||
|
||||
x += PtEdge->m_Start0.x;
|
||||
y += PtEdge->m_Start0.y;
|
||||
|
||||
*ptr++ = x;
|
||||
*ptr++ = y;
|
||||
PlotFilledPolygon( format_plot, PtEdge->m_PolyPoints.size(), ptr_base );
|
||||
free( ptr_base );
|
||||
}
|
||||
|
||||
PlotFilledPolygon( format_plot, PtEdge->m_PolyCount, ptr_base );
|
||||
free( ptr_base );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -577,9 +581,9 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
|
|||
size.x = -size.x;
|
||||
|
||||
if ( format_plot == PLOT_FORMAT_GERBER )
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
|
||||
PlotGraphicText( format_plot, pos, BLACK,
|
||||
PlotGraphicText( format_plot, pos, BLACK,
|
||||
pt_texte->m_Text,
|
||||
orient, size,
|
||||
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
||||
|
@ -711,7 +715,7 @@ void PlotCircle( int format_plot, int thickness, wxPoint centre, int radius )
|
|||
switch( format_plot )
|
||||
{
|
||||
case PLOT_FORMAT_GERBER:
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
PlotCircle_GERBER( centre, radius, thickness );
|
||||
break;
|
||||
|
||||
|
@ -755,7 +759,7 @@ void PlotPolygon( int format_plot, int nbpoints, int* coord, int width )
|
|||
switch( format_plot )
|
||||
{
|
||||
case PLOT_FORMAT_GERBER:
|
||||
SelectD_CODE_For_LineDraw(width);
|
||||
SelectD_CODE_For_LineDraw(width);
|
||||
PlotPolygon_GERBER( nbpoints, coord, width );
|
||||
break;
|
||||
|
||||
|
@ -812,7 +816,7 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
|
|||
RotatePoint( &ox, &oy, start_angle );
|
||||
|
||||
if ( format_plot == PLOT_FORMAT_GERBER )
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
SelectD_CODE_For_LineDraw(thickness);
|
||||
|
||||
delta = 120; /* un cercle sera trace en 3600/delta = 30 segments / cercle*/
|
||||
for( ii = start_angle + delta; ii < end_angle; ii += delta )
|
||||
|
|
Loading…
Reference in New Issue