Pcbnew: bug fix: m_ZoneMinThickness parameter not copied in zone copy function. In copy block, copied zones have an erroneous m_ZoneMinThickness parmeter value.
This commit is contained in:
parent
e560573c5e
commit
b0b49df4e2
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
|
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
|
||||||
BOARD_CONNECTED_ITEM( parent, TYPE_ZONE_CONTAINER )
|
BOARD_CONNECTED_ITEM( parent, TYPE_ZONE_CONTAINER )
|
||||||
|
|
||||||
{
|
{
|
||||||
m_NetCode = -1; // Net number for fast comparisons
|
m_NetCode = -1; // Net number for fast comparisons
|
||||||
m_CornerSelection = -1;
|
m_CornerSelection = -1;
|
||||||
|
@ -45,7 +44,6 @@ ZONE_CONTAINER::~ZONE_CONTAINER()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetPosition (virtual)
|
* Function GetPosition (virtual)
|
||||||
* @return a wxPoint, position of the first point of the outline
|
* @return a wxPoint, position of the first point of the outline
|
||||||
|
@ -53,24 +51,26 @@ ZONE_CONTAINER::~ZONE_CONTAINER()
|
||||||
wxPoint& ZONE_CONTAINER::GetPosition()
|
wxPoint& ZONE_CONTAINER::GetPosition()
|
||||||
{
|
{
|
||||||
static wxPoint pos;
|
static wxPoint pos;
|
||||||
|
|
||||||
if( m_Poly )
|
if( m_Poly )
|
||||||
{
|
{
|
||||||
pos = GetCornerPosition( 0 );
|
pos = GetCornerPosition( 0 );
|
||||||
}
|
}
|
||||||
else pos = wxPoint(0,0);
|
else
|
||||||
|
pos = wxPoint( 0, 0 );
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
void ZONE_CONTAINER::SetNet( int anet_code )
|
void ZONE_CONTAINER::SetNet( int anet_code )
|
||||||
|
{
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the netcode and the netname
|
* Set the netcode and the netname
|
||||||
* if netcode >= 0, set the netname
|
* if netcode >= 0, set the netname
|
||||||
* if netcode < 0: keep old netname (used to set an necode error flag)
|
* if netcode < 0: keep old netname (used to set an necode error flag)
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
m_NetCode = anet_code;
|
m_NetCode = anet_code;
|
||||||
|
|
||||||
if( anet_code < 0 )
|
if( anet_code < 0 )
|
||||||
|
@ -163,8 +163,13 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
if( ret < 1 )
|
if( ret < 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ret = fprintf( aFile, "ZOptions %d %d %c %d %d\n", m_FillMode, m_ArcToSegmentsCount,
|
ret = fprintf( aFile,
|
||||||
m_IsFilled ? 'S' : 'F', m_ThermalReliefGapValue, m_ThermalReliefCopperBridgeValue );
|
"ZOptions %d %d %c %d %d\n",
|
||||||
|
m_FillMode,
|
||||||
|
m_ArcToSegmentsCount,
|
||||||
|
m_IsFilled ? 'S' : 'F',
|
||||||
|
m_ThermalReliefGapValue,
|
||||||
|
m_ThermalReliefCopperBridgeValue );
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -186,7 +191,12 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
for( unsigned ii = 0; ii < m_FilledPolysList.size(); ii++ )
|
for( unsigned ii = 0; ii < m_FilledPolysList.size(); ii++ )
|
||||||
{
|
{
|
||||||
const CPolyPt* corner = &m_FilledPolysList[ii];
|
const CPolyPt* corner = &m_FilledPolysList[ii];
|
||||||
ret = fprintf( aFile, "%d %d %d %d\n", corner->x, corner->y, corner->end_contour, corner->utility );
|
ret = fprintf( aFile,
|
||||||
|
"%d %d %d %d\n",
|
||||||
|
corner->x,
|
||||||
|
corner->y,
|
||||||
|
corner->end_contour,
|
||||||
|
corner->utility );
|
||||||
if( ret < 4 )
|
if( ret < 4 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -217,8 +227,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
/**********************************************************/
|
|
||||||
{
|
{
|
||||||
|
/**********************************************************/
|
||||||
char* Line, * text;
|
char* Line, * text;
|
||||||
char netname_buffer[1024];
|
char netname_buffer[1024];
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -363,7 +373,6 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( strnicmp( Line, "ZMinThickness", 13 ) == 0 ) // Min Thickness info found
|
else if( strnicmp( Line, "ZMinThickness", 13 ) == 0 ) // Min Thickness info found
|
||||||
{
|
{
|
||||||
int thickness;
|
int thickness;
|
||||||
|
@ -374,7 +383,6 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
else
|
else
|
||||||
m_ZoneMinThickness = thickness;
|
m_ZoneMinThickness = thickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( strnicmp( Line, "$POLYSCORNERS", 13 ) == 0 ) // Read the PolysList (polygons used for fill areas in the zone)
|
else if( strnicmp( Line, "$POLYSCORNERS", 13 ) == 0 ) // Read the PolysList (polygons used for fill areas in the zone)
|
||||||
{
|
{
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
|
@ -385,7 +393,12 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
CPolyPt corner;
|
CPolyPt corner;
|
||||||
int end_contour, utility;
|
int end_contour, utility;
|
||||||
utility = 0;
|
utility = 0;
|
||||||
ret = sscanf( Line, "%d %d %d %d", &corner.x, &corner.y, &end_contour, &utility );
|
ret = sscanf( Line,
|
||||||
|
"%d %d %d %d",
|
||||||
|
&corner.x,
|
||||||
|
&corner.y,
|
||||||
|
&end_contour,
|
||||||
|
&utility );
|
||||||
if( ret < 4 )
|
if( ret < 4 )
|
||||||
return false;
|
return false;
|
||||||
corner.end_contour = end_contour ? true : false;
|
corner.end_contour = end_contour ? true : false;
|
||||||
|
@ -393,7 +406,6 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
m_FilledPolysList.push_back( corner );
|
m_FilledPolysList.push_back( corner );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( strnicmp( Line, "$FILLSEGMENTS", 13 ) == 0 )
|
else if( strnicmp( Line, "$FILLSEGMENTS", 13 ) == 0 )
|
||||||
{
|
{
|
||||||
SEGMENT segm;
|
SEGMENT segm;
|
||||||
|
@ -402,7 +414,12 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
if( strnicmp( Line, "$endFILLSEGMENTS", 4 ) == 0 )
|
if( strnicmp( Line, "$endFILLSEGMENTS", 4 ) == 0 )
|
||||||
break;
|
break;
|
||||||
ret = sscanf( Line, "%d %d %d %d", &segm.m_Start.x, &segm.m_Start.y, &segm.m_End.x, &segm.m_End.y );
|
ret = sscanf( Line,
|
||||||
|
"%d %d %d %d",
|
||||||
|
&segm.m_Start.x,
|
||||||
|
&segm.m_Start.y,
|
||||||
|
&segm.m_End.x,
|
||||||
|
&segm.m_End.y );
|
||||||
if( ret < 4 )
|
if( ret < 4 )
|
||||||
return false;
|
return false;
|
||||||
m_FillSegmList.push_back( segm );
|
m_FillSegmList.push_back( segm );
|
||||||
|
@ -438,8 +455,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con
|
||||||
BOARD* brd = GetBoard();
|
BOARD* brd = GetBoard();
|
||||||
int color = brd->GetLayerColor( m_Layer );
|
int color = brd->GetLayerColor( m_Layer );
|
||||||
|
|
||||||
if( brd->IsLayerVisible( m_Layer ) == false &&
|
if( brd->IsLayerVisible( m_Layer ) == false
|
||||||
( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
|
&& ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GRSetDrawMode( DC, aDrawMode );
|
GRSetDrawMode( DC, aDrawMode );
|
||||||
|
@ -486,6 +503,7 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con
|
||||||
lines.push_back( seg_start );
|
lines.push_back( seg_start );
|
||||||
lines.push_back( seg_end );
|
lines.push_back( seg_end );
|
||||||
}
|
}
|
||||||
|
|
||||||
GRLineArray( &panel->m_ClipBox, DC, lines, 0, color );
|
GRLineArray( &panel->m_ClipBox, DC, lines, 0, color );
|
||||||
|
|
||||||
// draw hatches
|
// draw hatches
|
||||||
|
@ -509,8 +527,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
||||||
wxDC* DC, int aDrawMode, const wxPoint& offset )
|
wxDC* DC, int aDrawMode, const wxPoint& offset )
|
||||||
|
{
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DrawDrawFilledArea
|
* Function DrawDrawFilledArea
|
||||||
* Draws the filled areas for this zone (polygon list .m_FilledPolysList)
|
* Draws the filled areas for this zone (polygon list .m_FilledPolysList)
|
||||||
|
@ -519,7 +537,6 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
||||||
* @param offset = Draw offset (usually wxPoint(0,0))
|
* @param offset = Draw offset (usually wxPoint(0,0))
|
||||||
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
|
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
static vector <char> CornersTypeBuffer;
|
static vector <char> CornersTypeBuffer;
|
||||||
static vector <wxPoint> CornersBuffer;
|
static vector <wxPoint> CornersBuffer;
|
||||||
|
|
||||||
|
@ -673,8 +690,8 @@ EDA_Rect ZONE_CONTAINER::GetBoundingBox() const
|
||||||
|
|
||||||
/**********************************************************************************************/
|
/**********************************************************************************************/
|
||||||
void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
|
void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
|
||||||
|
{
|
||||||
/***********************************************************************************************/
|
/***********************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DrawWhileCreateOutline
|
* Function DrawWhileCreateOutline
|
||||||
* Draws the zone outline when ir is created.
|
* Draws the zone outline when ir is created.
|
||||||
|
@ -685,7 +702,6 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
* @param DC = current Device Context
|
* @param DC = current Device Context
|
||||||
* @param draw_mode = draw mode: OR, XOR ..
|
* @param draw_mode = draw mode: OR, XOR ..
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
int current_gr_mode = draw_mode;
|
int current_gr_mode = draw_mode;
|
||||||
bool is_close_segment = false;
|
bool is_close_segment = false;
|
||||||
wxPoint seg_start, seg_end;
|
wxPoint seg_start, seg_end;
|
||||||
|
@ -877,6 +893,7 @@ bool ZONE_CONTAINER::HitTest( EDA_Rect& refArea )
|
||||||
return is_out_of_box ? false : true;
|
return is_out_of_box ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function HitTestFilledArea
|
* Function HitTestFilledArea
|
||||||
* tests if the given wxPoint is within the bounds of a filled area of this zone.
|
* tests if the given wxPoint is within the bounds of a filled area of this zone.
|
||||||
|
@ -887,28 +904,31 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos )
|
||||||
{
|
{
|
||||||
unsigned indexstart = 0, indexend;
|
unsigned indexstart = 0, indexend;
|
||||||
bool inside = false;
|
bool inside = false;
|
||||||
|
|
||||||
for( indexend = 0; indexend < m_FilledPolysList.size(); indexend++ )
|
for( indexend = 0; indexend < m_FilledPolysList.size(); indexend++ )
|
||||||
{
|
{
|
||||||
if( m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found
|
if( m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found
|
||||||
{
|
{
|
||||||
if( TestPointInsidePolygon( m_FilledPolysList, indexstart, indexend, aRefPos.x, aRefPos.y ) )
|
if( TestPointInsidePolygon( m_FilledPolysList, indexstart, indexend, aRefPos.x,
|
||||||
|
aRefPos.y ) )
|
||||||
{
|
{
|
||||||
inside = true;
|
inside = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare test of next area which starts after the current indexend (if exists)
|
// Prepare test of next area which starts after the current indexend (if exists)
|
||||||
indexstart = indexend + 1;
|
indexstart = indexend + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return inside;
|
return inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
|
void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
/************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/************************************************************/
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
BOARD* board = (BOARD*) m_Parent;
|
BOARD* board = (BOARD*) m_Parent;
|
||||||
|
@ -1000,6 +1020,7 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
|
||||||
corner->x += offset.x;
|
corner->x += offset.x;
|
||||||
corner->y += offset.y;
|
corner->y += offset.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
||||||
{
|
{
|
||||||
m_FillSegmList[ic].m_Start += offset;
|
m_FillSegmList[ic].m_Start += offset;
|
||||||
|
@ -1043,6 +1064,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
|
||||||
void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle )
|
void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle )
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ )
|
for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ )
|
||||||
{
|
{
|
||||||
pos.x = m_Poly->corner[ii].x;
|
pos.x = m_Poly->corner[ii].x;
|
||||||
|
@ -1064,6 +1086,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle )
|
||||||
corner->x = pos.x;
|
corner->x = pos.x;
|
||||||
corner->y = pos.y;
|
corner->y = pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
||||||
{
|
{
|
||||||
RotatePoint( &m_FillSegmList[ic].m_Start, centre, angle );
|
RotatePoint( &m_FillSegmList[ic].m_Start, centre, angle );
|
||||||
|
@ -1071,6 +1094,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Flip
|
* Function Flip
|
||||||
* Flip this object, i.e. change the board side for this object
|
* Flip this object, i.e. change the board side for this object
|
||||||
|
@ -1083,6 +1107,7 @@ void ZONE_CONTAINER::Flip(const wxPoint& aCentre )
|
||||||
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Mirror
|
* Function Mirror
|
||||||
* flip the outlines , relative to a given horizontal axis
|
* flip the outlines , relative to a given horizontal axis
|
||||||
|
@ -1107,6 +1132,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
|
||||||
NEGATE( corner->y );
|
NEGATE( corner->y );
|
||||||
corner->y += mirror_ref.y;
|
corner->y += mirror_ref.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
||||||
{
|
{
|
||||||
m_FillSegmList[ic].m_Start.y -= mirror_ref.y;
|
m_FillSegmList[ic].m_Start.y -= mirror_ref.y;
|
||||||
|
@ -1134,6 +1160,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
|
||||||
m_Poly->Copy( src->m_Poly ); // copy outlines
|
m_Poly->Copy( src->m_Poly ); // copy outlines
|
||||||
m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection
|
m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection
|
||||||
m_ZoneClearance = src->m_ZoneClearance; // clearance value
|
m_ZoneClearance = src->m_ZoneClearance; // clearance value
|
||||||
|
m_ZoneMinThickness = src->m_ZoneMinThickness;
|
||||||
m_FillMode = src->m_FillMode; // Filling mode (segments/polygons)
|
m_FillMode = src->m_FillMode; // Filling mode (segments/polygons)
|
||||||
m_ArcToSegmentsCount = src->m_ArcToSegmentsCount;
|
m_ArcToSegmentsCount = src->m_ArcToSegmentsCount;
|
||||||
m_PadOption = src->m_PadOption;
|
m_PadOption = src->m_PadOption;
|
||||||
|
@ -1147,6 +1174,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
|
||||||
m_FillSegmList = src->m_FillSegmList;
|
m_FillSegmList = src->m_FillSegmList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetNetNameFromNetCode
|
* Function SetNetNameFromNetCode
|
||||||
* Find the net name corresponding to the net code.
|
* Find the net name corresponding to the net code.
|
||||||
|
@ -1155,6 +1183,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
|
||||||
bool ZONE_CONTAINER::SetNetNameFromNetCode( void )
|
bool ZONE_CONTAINER::SetNetNameFromNetCode( void )
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* net;
|
NETINFO_ITEM* net;
|
||||||
|
|
||||||
if( m_Parent && ( net = ( (BOARD*) m_Parent )->FindNet( GetNet() ) ) )
|
if( m_Parent && ( net = ( (BOARD*) m_Parent )->FindNet( GetNet() ) ) )
|
||||||
{
|
{
|
||||||
m_Netname = net->GetNetname();
|
m_Netname = net->GetNetname();
|
||||||
|
|
Loading…
Reference in New Issue