Pcbnew: fix bug 1179877, due a bad default copy constructor, after my changes about CPOLYGONS_LIST class.
More about CPOLYGONS_LIST work.
This commit is contained in:
parent
6fa4f1e6ac
commit
ac1386a5a2
|
@ -182,9 +182,9 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
if( !g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
|
if( !g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bufferPolys.clear();
|
bufferPolys.RemoveAllContours();
|
||||||
bufferZonesPolys.clear();
|
bufferZonesPolys.RemoveAllContours();
|
||||||
currLayerHoles.clear();
|
currLayerHoles.RemoveAllContours();
|
||||||
|
|
||||||
// Draw tracks:
|
// Draw tracks:
|
||||||
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||||
|
@ -308,7 +308,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||||
|
|
||||||
bufferPolys.clear();
|
bufferPolys.RemoveAllContours();
|
||||||
bufferPolys.ImportFrom( currLayerPolyset );
|
bufferPolys.ImportFrom( currLayerPolyset );
|
||||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||||
thickness,
|
thickness,
|
||||||
|
@ -346,7 +346,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
if( !g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
|
if( !g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bufferPolys.clear();
|
bufferPolys.RemoveAllContours();
|
||||||
|
|
||||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
|
@ -429,7 +429,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||||
|
|
||||||
bufferPolys.clear();
|
bufferPolys.RemoveAllContours();
|
||||||
bufferPolys.ImportFrom( currLayerPolyset );
|
bufferPolys.ImportFrom( currLayerPolyset );
|
||||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||||
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||||
|
@ -480,7 +480,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
||||||
0.0F );
|
0.0F );
|
||||||
|
|
||||||
// Draw Board:
|
// Draw Board:
|
||||||
// For testing purpose only display calculation time to generate 3D data
|
// For testing purpose only, display calculation time to generate 3D data
|
||||||
// #define PRINT_CALCULATION_TIME
|
// #define PRINT_CALCULATION_TIME
|
||||||
|
|
||||||
#ifdef PRINT_CALCULATION_TIME
|
#ifdef PRINT_CALCULATION_TIME
|
||||||
|
|
|
@ -496,9 +496,8 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
|
||||||
bool SCH_SCREEN::Save( FILE* aFile ) const
|
bool SCH_SCREEN::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
// Creates header
|
// Creates header
|
||||||
if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP,
|
if( fprintf( aFile, "%s %s %d\n", EESCHEMA_FILE_STAMP,
|
||||||
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0
|
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0 )
|
||||||
|| fprintf( aFile, " date %s\n", TO_UTF8( DateAndTime() ) ) < 0 )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
|
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
|
||||||
|
|
|
@ -139,7 +139,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
|
||||||
corner.y += GetPosition().y;
|
corner.y += GetPosition().y;
|
||||||
aCornerBuffer.Append( corner );
|
aCornerBuffer.Append( corner );
|
||||||
}
|
}
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.CloseLastContour();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -242,7 +242,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
|
||||||
aCornerBuffer.Append( corners[ii] );
|
aCornerBuffer.Append( corners[ii] );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.CloseLastContour();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -875,7 +875,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||||
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
|
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.CloseLastContour();
|
||||||
angle = AddAngles( angle, 1800 ); // this is calculate hole 3
|
angle = AddAngles( angle, 1800 ); // this is calculate hole 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,7 +900,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||||
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
|
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.CloseLastContour();
|
||||||
angle = AddAngles( angle, 1800 );
|
angle = AddAngles( angle, 1800 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,8 +90,8 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
|
||||||
m_PadConnection = aZone.m_PadConnection;
|
m_PadConnection = aZone.m_PadConnection;
|
||||||
m_ThermalReliefGap = aZone.m_ThermalReliefGap;
|
m_ThermalReliefGap = aZone.m_ThermalReliefGap;
|
||||||
m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
|
m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
|
||||||
m_FilledPolysList = aZone.m_FilledPolysList;
|
m_FilledPolysList.Append( aZone.m_FilledPolysList );
|
||||||
m_FillSegmList = aZone.m_FillSegmList;
|
m_FillSegmList = aZone.m_FillSegmList; // vector <> copy
|
||||||
|
|
||||||
m_isKeepout = aZone.m_isKeepout;
|
m_isKeepout = aZone.m_isKeepout;
|
||||||
m_doNotAllowCopperPour = aZone.m_doNotAllowCopperPour;
|
m_doNotAllowCopperPour = aZone.m_doNotAllowCopperPour;
|
||||||
|
@ -123,7 +123,7 @@ bool ZONE_CONTAINER::UnFill()
|
||||||
bool change = ( m_FilledPolysList.GetCornersCount() > 0 ) ||
|
bool change = ( m_FilledPolysList.GetCornersCount() > 0 ) ||
|
||||||
( m_FillSegmList.size() > 0 );
|
( m_FillSegmList.size() > 0 );
|
||||||
|
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
m_FillSegmList.clear();
|
m_FillSegmList.clear();
|
||||||
m_IsFilled = false;
|
m_IsFilled = false;
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
|
||||||
for( unsigned ic = 0; ic < m_FilledPolysList.GetCornersCount(); ic++ )
|
for( unsigned ic = 0; ic < m_FilledPolysList.GetCornersCount(); ic++ )
|
||||||
{
|
{
|
||||||
m_FilledPolysList.SetX( ic, m_FilledPolysList.GetX( ic ) + offset.x );
|
m_FilledPolysList.SetX( ic, m_FilledPolysList.GetX( ic ) + offset.x );
|
||||||
m_FilledPolysList.SetY( ic, m_FilledPolysList.GetX( ic ) + offset.y );
|
m_FilledPolysList.SetY( ic, m_FilledPolysList.GetY( ic ) + offset.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
||||||
|
@ -863,8 +863,8 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
|
||||||
m_Poly->SetHatchStyle( src->m_Poly->GetHatchStyle() );
|
m_Poly->SetHatchStyle( src->m_Poly->GetHatchStyle() );
|
||||||
m_Poly->SetHatchPitch( src->m_Poly->GetHatchPitch() );
|
m_Poly->SetHatchPitch( src->m_Poly->GetHatchPitch() );
|
||||||
m_Poly->m_HatchLines = src->m_Poly->m_HatchLines; // Copy vector <CSegment>
|
m_Poly->m_HatchLines = src->m_Poly->m_HatchLines; // Copy vector <CSegment>
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
m_FilledPolysList = src->m_FilledPolysList;
|
m_FilledPolysList.Append( src->m_FilledPolysList );
|
||||||
m_FillSegmList.clear();
|
m_FillSegmList.clear();
|
||||||
m_FillSegmList = src->m_FillSegmList;
|
m_FillSegmList = src->m_FillSegmList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,7 +498,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void ClearFilledPolysList()
|
void ClearFilledPolysList()
|
||||||
{
|
{
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,7 +58,7 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb,
|
||||||
CPOLYGONS_LIST* aCornerBuffer )
|
CPOLYGONS_LIST* aCornerBuffer )
|
||||||
{
|
{
|
||||||
if( aCornerBuffer == NULL )
|
if( aCornerBuffer == NULL )
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
|
|
||||||
/* convert outlines + holes to outlines without holes (adding extra segments if necessary)
|
/* convert outlines + holes to outlines without holes (adding extra segments if necessary)
|
||||||
* m_Poly data is expected normalized, i.e. NormalizeAreaOutlines was used after building
|
* m_Poly data is expected normalized, i.e. NormalizeAreaOutlines was used after building
|
||||||
|
@ -121,7 +121,7 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb,
|
||||||
CopyPolygonsFromFilledPolysListToKiPolygonList( polyset_zone_solid_areas );
|
CopyPolygonsFromFilledPolysListToKiPolygonList( polyset_zone_solid_areas );
|
||||||
polyset_zone_solid_areas -= margin;
|
polyset_zone_solid_areas -= margin;
|
||||||
// put solid area in m_FilledPolysList:
|
// put solid area in m_FilledPolysList:
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas );
|
CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas );
|
||||||
}
|
}
|
||||||
if ( m_FillMode ) // if fill mode uses segments, create them:
|
if ( m_FillMode ) // if fill mode uses segments, create them:
|
||||||
|
|
|
@ -188,7 +188,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
|
|
||||||
// static to avoid unnecessary memory allocation when filling many zones.
|
// static to avoid unnecessary memory allocation when filling many zones.
|
||||||
static CPOLYGONS_LIST cornerBufferPolysToSubstract;
|
static CPOLYGONS_LIST cornerBufferPolysToSubstract;
|
||||||
cornerBufferPolysToSubstract.clear();
|
cornerBufferPolysToSubstract.RemoveAllContours();
|
||||||
|
|
||||||
/* Use a dummy pad to calculate hole clerance when a pad is not on all copper layers
|
/* Use a dummy pad to calculate hole clerance when a pad is not on all copper layers
|
||||||
* and this pad has a hole
|
* and this pad has a hole
|
||||||
|
@ -423,7 +423,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
}
|
}
|
||||||
|
|
||||||
// put solid areas in m_FilledPolysList:
|
// put solid areas in m_FilledPolysList:
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas );
|
CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas );
|
||||||
|
|
||||||
// Remove insulated islands:
|
// Remove insulated islands:
|
||||||
|
@ -431,7 +431,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
TestForCopperIslandAndRemoveInsulatedIslands( aPcb );
|
TestForCopperIslandAndRemoveInsulatedIslands( aPcb );
|
||||||
|
|
||||||
// Now we remove all unused thermal stubs.
|
// Now we remove all unused thermal stubs.
|
||||||
cornerBufferPolysToSubstract.clear();
|
cornerBufferPolysToSubstract.RemoveAllContours();
|
||||||
|
|
||||||
// Test thermal stubs connections and add polygons to remove unconnected stubs.
|
// Test thermal stubs connections and add polygons to remove unconnected stubs.
|
||||||
// (this is a refinement for thermal relief shapes)
|
// (this is a refinement for thermal relief shapes)
|
||||||
|
@ -449,20 +449,20 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
polyset_zone_solid_areas -= polyset_holes;
|
polyset_zone_solid_areas -= polyset_holes;
|
||||||
|
|
||||||
// put these areas in m_FilledPolysList
|
// put these areas in m_FilledPolysList
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas );
|
CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas );
|
||||||
|
|
||||||
if( GetNet() > 0 )
|
if( GetNet() > 0 )
|
||||||
TestForCopperIslandAndRemoveInsulatedIslands( aPcb );
|
TestForCopperIslandAndRemoveInsulatedIslands( aPcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
cornerBufferPolysToSubstract.clear();
|
cornerBufferPolysToSubstract.RemoveAllContours();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ZONE_CONTAINER::CopyPolygonsFromKiPolygonListToFilledPolysList( KI_POLYGON_SET& aKiPolyList )
|
void ZONE_CONTAINER::CopyPolygonsFromKiPolygonListToFilledPolysList( KI_POLYGON_SET& aKiPolyList )
|
||||||
{
|
{
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
m_FilledPolysList.ImportFrom( aKiPolyList );
|
m_FilledPolysList.ImportFrom( aKiPolyList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,12 @@ CPolyLine::CPolyLine()
|
||||||
m_utility = 0;
|
m_utility = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPolyLine::CPolyLine( const CPolyLine& aCPolyLine)
|
||||||
|
{
|
||||||
|
Copy( &aCPolyLine );
|
||||||
|
m_HatchLines = aCPolyLine.m_HatchLines; // vector <> copy
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// destructor, removes display elements
|
// destructor, removes display elements
|
||||||
//
|
//
|
||||||
|
@ -517,11 +523,11 @@ void CPolyLine::RemoveAllContours( void )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function RemoveAllContours
|
* function RemoveAllContours
|
||||||
* removes all corners from the lists.
|
* removes all corners from the list.
|
||||||
* Others params are not chnaged
|
* Others params are not changed
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
m_CornersList.clear();
|
m_CornersList.RemoveAllContours();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -937,27 +943,25 @@ bool CPolyLine::TestPointInside( int px, int py )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// copy data from another poly, but don't draw it
|
// copy data from another CPolyLine, but don't draw it
|
||||||
//
|
void CPolyLine::Copy( const CPolyLine* src )
|
||||||
void CPolyLine::Copy( CPolyLine* src )
|
|
||||||
{
|
{
|
||||||
UnHatch();
|
UnHatch();
|
||||||
|
m_layer = src->m_layer;
|
||||||
m_hatchStyle = src->m_hatchStyle;
|
m_hatchStyle = src->m_hatchStyle;
|
||||||
m_hatchPitch = src->m_hatchPitch;
|
m_hatchPitch = src->m_hatchPitch;
|
||||||
// copy corners, using vector copy
|
m_CornersList.RemoveAllContours();
|
||||||
m_CornersList = src->m_CornersList;
|
m_CornersList.Append( src->m_CornersList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
|
||||||
bool CPolyLine::IsCutoutContour( int icont )
|
|
||||||
/*******************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return true if the corner icont is inside the outline (i.e it is a hole)
|
* return true if the corner aCornerIdx is on a hole inside the main outline
|
||||||
|
* and false if it is on the main outline
|
||||||
*/
|
*/
|
||||||
|
bool CPolyLine::IsCutoutContour( int aCornerIdx )
|
||||||
{
|
{
|
||||||
int ncont = GetContour( icont );
|
int ncont = GetContour( aCornerIdx );
|
||||||
|
|
||||||
if( ncont == 0 ) // the first contour is the main outline, not an hole
|
if( ncont == 0 ) // the first contour is the main outline, not an hole
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -117,8 +117,10 @@ public:
|
||||||
|
|
||||||
// vector <> methods
|
// vector <> methods
|
||||||
void reserve( int aSize ) { m_cornersList.reserve( aSize ); }
|
void reserve( int aSize ) { m_cornersList.reserve( aSize ); }
|
||||||
void clear() { m_cornersList.clear(); }
|
|
||||||
CPolyPt& back() { return m_cornersList.back(); }
|
|
||||||
|
void RemoveAllContours( void ) { m_cornersList.clear(); }
|
||||||
|
CPolyPt& GetLastCorner() { return m_cornersList.back(); }
|
||||||
|
|
||||||
unsigned GetCornersCount() const { return m_cornersList.size(); }
|
unsigned GetCornersCount() const { return m_cornersList.size(); }
|
||||||
|
|
||||||
|
@ -206,6 +208,7 @@ public:
|
||||||
|
|
||||||
// constructors/destructor
|
// constructors/destructor
|
||||||
CPolyLine();
|
CPolyLine();
|
||||||
|
CPolyLine( const CPolyLine& aCPolyLine);
|
||||||
~CPolyLine();
|
~CPolyLine();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -296,9 +299,14 @@ public:
|
||||||
CRect GetBounds();
|
CRect GetBounds();
|
||||||
CRect GetCornerBounds();
|
CRect GetCornerBounds();
|
||||||
CRect GetCornerBounds( int icont );
|
CRect GetCornerBounds( int icont );
|
||||||
void Copy( CPolyLine* src );
|
void Copy( const CPolyLine* src );
|
||||||
bool TestPointInside( int x, int y );
|
bool TestPointInside( int x, int y );
|
||||||
bool IsCutoutContour( int icont );
|
|
||||||
|
/**
|
||||||
|
* @return true if the corner aCornerIdx is on a hole inside the main outline
|
||||||
|
* and false if it is on the main outline
|
||||||
|
*/
|
||||||
|
bool IsCutoutContour( int aCornerIdx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function AppendArc.
|
* Function AppendArc.
|
||||||
|
|
Loading…
Reference in New Issue