Commit b0b49df4 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: bug fix: m_ZoneMinThickness parameter not copied in zone copy...

Pcbnew: bug fix: m_ZoneMinThickness parameter not copied in zone copy function. In copy block, copied zones have an erroneous m_ZoneMinThickness parmeter value.
parent e560573c
...@@ -25,7 +25,6 @@ ...@@ -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;
...@@ -34,7 +33,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) : ...@@ -34,7 +33,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
utility = 0; // flags used in polygon calculations utility = 0; // flags used in polygon calculations
utility2 = 0; // flags used in polygon calculations utility2 = 0; // flags used in polygon calculations
m_Poly = new CPolyLine(); // Outlines m_Poly = new CPolyLine(); // Outlines
g_Zone_Default_Setting.ExportSetting(*this); g_Zone_Default_Setting.ExportSetting( *this );
} }
...@@ -45,7 +44,6 @@ ZONE_CONTAINER::~ZONE_CONTAINER() ...@@ -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() ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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,8 +406,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader ) ...@@ -393,8 +406,7 @@ 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;
while( aReader->ReadLine() ) while( aReader->ReadLine() )
...@@ -402,7 +414,12 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader ) ...@@ -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 );
...@@ -435,11 +452,11 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con ...@@ -435,11 +452,11 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con
wxPoint seg_start, seg_end; wxPoint seg_start, seg_end;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
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 );
...@@ -468,7 +485,7 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con ...@@ -468,7 +485,7 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con
// draw the lines // draw the lines
int i_start_contour = 0; int i_start_contour = 0;
std::vector<wxPoint> lines; std::vector<wxPoint> lines;
lines.reserve( (GetNumCorners()*2)+2 ); lines.reserve( (GetNumCorners() * 2) + 2 );
for( int ic = 0; ic < GetNumCorners(); ic++ ) for( int ic = 0; ic < GetNumCorners(); ic++ )
{ {
...@@ -486,11 +503,12 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con ...@@ -486,11 +503,12 @@ 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
lines.clear(); lines.clear();
lines.reserve( (m_Poly->m_HatchLines.size() *2) +2 ); lines.reserve( (m_Poly->m_HatchLines.size() * 2) + 2 );
for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ ) for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ )
{ {
...@@ -509,8 +527,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, con ...@@ -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, ...@@ -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;
...@@ -536,9 +553,9 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -536,9 +553,9 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
if( m_FilledPolysList.size() == 0 ) // Nothing to draw if( m_FilledPolysList.size() == 0 ) // Nothing to draw
return; return;
BOARD * brd = GetBoard( ); BOARD* brd = GetBoard();
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = brd->GetLayerColor(m_Layer); int color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
return; return;
...@@ -577,9 +594,9 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -577,9 +594,9 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
wxPoint coord( corner->x + offset.x, corner->y + offset.y ); wxPoint coord( corner->x + offset.x, corner->y + offset.y );
CornersBuffer.push_back(coord); CornersBuffer.push_back( coord );
CornersTypeBuffer.push_back((char) corner->utility); CornersTypeBuffer.push_back( (char) corner->utility );
if( (corner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it if( (corner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it
{ {
...@@ -594,7 +611,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -594,7 +611,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
// Draw outlines: // Draw outlines:
if( (m_ZoneMinThickness > 1) || outline_mode ) if( (m_ZoneMinThickness > 1) || outline_mode )
{ {
int ilim = CornersBuffer.size()-1; int ilim = CornersBuffer.size() - 1;
for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ ) for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
{ {
int x0 = CornersBuffer[is].x; int x0 = CornersBuffer[is].x;
...@@ -606,11 +623,11 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -606,11 +623,11 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
{ {
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
GRCSegm( &panel->m_ClipBox, DC, GRCSegm( &panel->m_ClipBox, DC,
x0, y0, x1 , y1, x0, y0, x1, y1,
m_ZoneMinThickness, color ); m_ZoneMinThickness, color );
else else
GRFillCSegm( &panel->m_ClipBox, DC, GRFillCSegm( &panel->m_ClipBox, DC,
x0, y0, x1 , y1, x0, y0, x1, y1,
m_ZoneMinThickness, color ); m_ZoneMinThickness, color );
} }
} }
...@@ -673,8 +690,8 @@ EDA_Rect ZONE_CONTAINER::GetBoundingBox() const ...@@ -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, ...@@ -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;
...@@ -693,8 +709,8 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -693,8 +709,8 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
if( DC == NULL ) if( DC == NULL )
return; return;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD * brd = GetBoard( ); BOARD* brd = GetBoard();
int color = brd->GetLayerColor(m_Layer) & MASKCOLOR; int color = brd->GetLayerColor( m_Layer ) & MASKCOLOR;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
{ {
...@@ -877,6 +893,7 @@ bool ZONE_CONTAINER::HitTest( EDA_Rect& refArea ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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,18 +1094,20 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle ) ...@@ -1071,18 +1094,20 @@ 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
* (like Mirror() but changes layer) * (like Mirror() but changes layer)
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
void ZONE_CONTAINER::Flip(const wxPoint& aCentre ) void ZONE_CONTAINER::Flip( const wxPoint& aCentre )
{ {
Mirror( aCentre ); Mirror( 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
...@@ -1093,7 +1118,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref ) ...@@ -1093,7 +1118,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ ) for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ )
{ {
m_Poly->corner[ii].y -= mirror_ref.y; m_Poly->corner[ii].y -= mirror_ref.y;
NEGATE(m_Poly->corner[ii].y); NEGATE( m_Poly->corner[ii].y );
m_Poly->corner[ii].y += mirror_ref.y; m_Poly->corner[ii].y += mirror_ref.y;
} }
...@@ -1104,16 +1129,17 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref ) ...@@ -1104,16 +1129,17 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
{ {
CPolyPt* corner = &m_FilledPolysList[ic]; CPolyPt* corner = &m_FilledPolysList[ic];
corner->y -= mirror_ref.y; corner->y -= mirror_ref.y;
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;
NEGATE(m_FillSegmList[ic].m_Start.y); NEGATE( m_FillSegmList[ic].m_Start.y );
m_FillSegmList[ic].m_Start.y += mirror_ref.y; m_FillSegmList[ic].m_Start.y += mirror_ref.y;
m_FillSegmList[ic].m_End.y -= mirror_ref.y; m_FillSegmList[ic].m_End.y -= mirror_ref.y;
NEGATE(m_FillSegmList[ic].m_End.y); NEGATE( m_FillSegmList[ic].m_End.y );
m_FillSegmList[ic].m_End.y += mirror_ref.y; m_FillSegmList[ic].m_End.y += mirror_ref.y;
} }
} }
...@@ -1134,6 +1160,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src ) ...@@ -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 ) ...@@ -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,7 +1183,8 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src ) ...@@ -1155,7 +1183,8 @@ 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();
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment