Drop unsupported fills. No reason to keep them around.

Also removes the long-dead segment fill data structures.
This commit is contained in:
Jeff Young 2022-02-11 16:04:05 +00:00
parent 33e57930bc
commit 300ee022fa
5 changed files with 31 additions and 132 deletions

View File

@ -1228,8 +1228,7 @@ void PCB_PARSER::parsePAGE_INFO()
void PCB_PARSER::parseTITLE_BLOCK()
{
wxCHECK_RET( CurTok() == T_title_block,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as TITLE_BLOCK." ) );
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as TITLE_BLOCK." ) );
T token;
TITLE_BLOCK titleBlock;
@ -1831,8 +1830,7 @@ PCB_LAYER_ID PCB_PARSER::parseBoardItemLayer()
LSET PCB_PARSER::parseBoardItemLayersAsMask()
{
wxCHECK_MSG( CurTok() == T_layers, LSET(),
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as item layer mask." ) );
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as item layers." ) );
LSET layerMask;
@ -3494,10 +3492,9 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
if( !name.IsEmpty() && fpid.Parse( name, true ) >= 0 )
{
wxString error;
error.Printf( _( "Invalid footprint ID in\nfile: '%s'\nline: %d\noffset: %d." ),
CurSource(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_IO_ERROR( wxString::Format( _( "Invalid footprint ID in\nfile: %s\nline: %d\n"
"offset: %d." ),
CurSource(), CurLineNumber(), CurOffset() ) );
}
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
@ -4617,8 +4614,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
case T_net:
if( ! pad->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
{
wxLogError( _( "Invalid net ID in\nfile: %s\nline: %d offset: %d" ), CurSource(),
CurLineNumber(), CurOffset() );
wxLogError( _( "Invalid net ID in\nfile: %s\nline: %d offset: %d" ),
CurSource(), CurLineNumber(), CurOffset() );
}
NeedSYMBOLorNUMBER();
@ -5073,9 +5070,10 @@ PCB_ARC* PCB_PARSER::parseARC()
case T_net:
if( !arc->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
THROW_IO_ERROR( wxString::Format(
_( "Invalid net ID in\nfile: '%s'\nline: %d\noffset: %d." ), CurSource(),
CurLineNumber(), CurOffset() ) );
{
wxLogError( _( "Invalid net ID in\nfile: %s\nline: %d\noffset: %d." ),
CurSource(), CurLineNumber(), CurOffset() );
}
break;
case T_tstamp:
@ -5151,9 +5149,10 @@ PCB_TRACK* PCB_PARSER::parsePCB_TRACK()
case T_net:
if( !track->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
THROW_IO_ERROR( wxString::Format(
_( "Invalid net ID in\nfile: '%s'\nline: %d\noffset: %d." ), CurSource(),
CurLineNumber(), CurOffset() ) );
{
wxLogError( _( "Invalid net ID in\nfile: '%s'\nline: %d\noffset: %d." ),
CurSource(), CurLineNumber(), CurOffset() );
}
break;
case T_tstamp:
@ -5246,13 +5245,8 @@ PCB_VIA* PCB_PARSER::parsePCB_VIA()
case T_net:
if( !via->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
{
THROW_IO_ERROR( wxString::Format( _( "Invalid net ID in\n"
"file: '%s'\n"
"line: %d\n"
"offset: %d" ),
CurSource(),
CurLineNumber(),
CurOffset() ) );
wxLogError( _( "Invalid net ID in\nfile: %s\nline: %d\noffset: %d" ),
CurSource(), CurLineNumber(), CurOffset() );
}
NeedRIGHT();
@ -5318,6 +5312,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
bool inFootprint = false;
PCB_LAYER_ID filledLayer;
bool addedFilledPolygons = false;
bool dropFilledPolygons = false;
if( dynamic_cast<FOOTPRINT*>( aParent ) ) // The zone belongs a footprint
inFootprint = true;
@ -5354,11 +5349,10 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
tmp = 0;
if( !zone->SetNetCode( tmp, /* aNoAssert */ true ) )
THROW_IO_ERROR( wxString::Format(
_( "Invalid net ID in\n file: '%s;\nline: %d\noffset: %d." ),
CurSource(),
CurLineNumber(),
CurOffset() ) );
{
wxLogError( _( "Invalid net ID in\nfile: %s;\nline: %d\noffset: %d." ),
CurSource(), CurLineNumber(), CurOffset() );
}
NeedRIGHT();
break;
@ -5463,6 +5457,8 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
m_showLegacy5ZoneWarning = false;
}
dropFilledPolygons = true;
}
NeedRIGHT();
@ -5784,8 +5780,6 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
case T_fill_segments:
{
std::vector<SEG> segs;
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
if( token != T_LEFT )
@ -5812,12 +5806,11 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
if( token != T_pts )
Expecting( T_pts );
SEG segment( parseXY(), parseXY() );
ignore_unused( parseXY() );
ignore_unused( parseXY() );
NeedRIGHT();
segs.push_back( segment );
}
zone->SetFillSegments( filledLayer, segs );
break;
}
@ -5853,7 +5846,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
zone->SetBorderDisplayStyle( hatchStyle, hatchPitch, true );
}
if( addedFilledPolygons )
if( addedFilledPolygons && !dropFilledPolygons )
{
for( auto& pair : pts )
zone->SetFilledPolysList( pair.first, pair.second );

View File

@ -2232,25 +2232,6 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const
formatPolyPts( chain, aNestLevel + 1, ADVANCED_CFG::GetCfg().m_CompactSave );
m_out->Print( aNestLevel + 1, ")\n" );
}
// Save the filling segments list
const std::vector<SEG>& segs = aZone->FillSegments( layer );
if( segs.size() )
{
m_out->Print( aNestLevel + 1, "(fill_segments\n" );
m_out->Print( aNestLevel + 2, "(layer %s)\n",
TO_UTF8( BOARD::GetStandardLayerName( layer ) ) );
for( const SEG& seg : segs )
{
m_out->Print( aNestLevel + 2, "(pts (xy %s) (xy %s))\n",
FormatInternalUnits( seg.A ).c_str(),
FormatInternalUnits( seg.B ).c_str() );
}
m_out->Print( aNestLevel + 1, ")\n" );
}
}
m_out->Print( aNestLevel, ")\n" );

View File

@ -2559,13 +2559,10 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
break;
// e.g. ""%d %d %d %d\n"
BIU sx = biuParse( line, &data );
BIU sy = biuParse( data, &data );
BIU ex = biuParse( data, &data );
BIU ey = biuParse( data );
zc->FillSegments( zc->GetLayer() )
.push_back( SEG( VECTOR2I( sx, sy ), VECTOR2I( ex, ey ) ) );
ignore_unused( biuParse( line, &data ) );
ignore_unused( biuParse( data, &data ) );
ignore_unused( biuParse( data, &data ) );
ignore_unused( biuParse( data ) );
}
}
else if( TESTLINE( "$endCZONE_OUTLINE" ) )

View File

@ -152,7 +152,6 @@ void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone )
m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
}
@ -186,12 +185,6 @@ bool ZONE::UnFill()
pair.second.RemoveAllContours();
}
for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
{
change |= !pair.second.empty();
pair.second.clear();
}
m_isFilled = false;
m_fillFlags.clear();
@ -250,7 +243,6 @@ void ZONE::SetLayerSet( LSET aLayerSet )
UnFill();
m_FillSegmList.clear();
m_FilledPolysList.clear();
m_RawPolysList.clear();
m_filledPolysHash.clear();
@ -258,7 +250,6 @@ void ZONE::SetLayerSet( LSET aLayerSet )
for( PCB_LAYER_ID layer : aLayerSet.Seq() )
{
m_FillSegmList[layer] = {};
m_FilledPolysList[layer] = {};
m_RawPolysList[layer] = {};
m_filledPolysHash[layer] = {};
@ -647,15 +638,6 @@ void ZONE::Move( const VECTOR2I& offset )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Move( offset );
for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
{
for( SEG& seg : pair.second )
{
seg.A += offset;
seg.B += offset;
}
}
}
@ -682,20 +664,6 @@ void ZONE::Rotate( const VECTOR2I& aCentre, const EDA_ANGLE& aAngle )
/* rotate filled areas: */
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Rotate( aAngle, aCentre );
for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
{
for( SEG& seg : pair.second )
{
VECTOR2I a( seg.A );
RotatePoint( a, aCentre, -aAngle );
seg.A = a;
VECTOR2I b( seg.B );
RotatePoint( b, aCentre, -aAngle );
seg.B = a;
}
}
}
@ -720,23 +688,6 @@ void ZONE::Mirror( const VECTOR2I& aMirrorRef, bool aMirrorLeftRight )
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
{
for( SEG& seg : pair.second )
{
if( aMirrorLeftRight )
{
MIRROR( seg.A.x, aMirrorRef.x );
MIRROR( seg.B.x, aMirrorRef.x );
}
else
{
MIRROR( seg.A.y, aMirrorRef.y );
MIRROR( seg.B.y, aMirrorRef.y );
}
}
}
}

View File

@ -331,18 +331,6 @@ public:
int GetLocalFlags() const { return m_localFlgs; }
void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
std::vector<SEG>& FillSegments( PCB_LAYER_ID aLayer )
{
wxASSERT( m_FillSegmList.count( aLayer ) );
return m_FillSegmList.at( aLayer );
}
const std::vector<SEG>& FillSegments( PCB_LAYER_ID aLayer ) const
{
wxASSERT( m_FillSegmList.count( aLayer ) );
return m_FillSegmList.at( aLayer );
}
SHAPE_POLY_SET* Outline() { return m_Poly; }
const SHAPE_POLY_SET* Outline() const { return m_Poly; }
@ -729,11 +717,6 @@ public:
void AddPolygon( const SHAPE_LINE_CHAIN& aPolygon );
void SetFillSegments( PCB_LAYER_ID aLayer, const std::vector<SEG>& aSegments )
{
m_FillSegmList[aLayer] = aSegments;
}
SHAPE_POLY_SET& RawPolysList( PCB_LAYER_ID aLayer )
{
wxASSERT( m_RawPolysList.count( aLayer ) );
@ -940,12 +923,6 @@ protected:
int m_localFlgs; // Variable used in polygon calculations.
/**
* Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
* In this case the segments have #m_ZoneMinThickness width.
*/
std::map<PCB_LAYER_ID, std::vector<SEG> > m_FillSegmList;
/* set of filled polygons used to draw a zone as a filled area.
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
* (they are all in one piece) In very simple cases m_FilledPolysList is same