pcbnew: Rename PCB_ZONE_T and remove from connectivity

SEGZONE types were confusingly named PCB_ZONE_T.  Zones in pcbnew are
now _only_ PCB_ZONE_AREA_T, so we name segzone types PCB_SEGZONE_T to be
clear.

This also removes processing of the SEGZONEs from connectivity
calculations.

(cherry picked from commit b3a5e08c2f)
This commit is contained in:
Seth Hillbrand 2018-09-29 10:58:31 -07:00
parent 115f318976
commit 79d19d9055
20 changed files with 40 additions and 39 deletions

View File

@ -94,7 +94,7 @@ enum KICAD_T
PCB_MODULE_EDGE_T, ///< class EDGE_MODULE, a footprint edge PCB_MODULE_EDGE_T, ///< class EDGE_MODULE, a footprint edge
PCB_TRACE_T, ///< class TRACK, a track segment (segment on a copper layer) PCB_TRACE_T, ///< class TRACK, a track segment (segment on a copper layer)
PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer) PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer)
PCB_ZONE_T, ///< class SEGZONE, a segment used to fill a zone area (segment on a PCB_SEGZONE_T, ///< class SEGZONE, a segment used to fill a zone area (segment on a
///< copper layer) ///< copper layer)
PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something
PCB_DIMENSION_T, ///< class DIMENSION, a dimension (graphic item) PCB_DIMENSION_T, ///< class DIMENSION, a dimension (graphic item)

View File

@ -70,7 +70,7 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
TRACK* Track; TRACK* Track;
int nb_segm; int nb_segm;
if( (track == NULL ) || (track->Type() == PCB_ZONE_T) ) if( (track == NULL ) || (track->Type() == PCB_SEGZONE_T) )
return; return;
m_canvas->CrossHairOff( DC ); // Erase cursor shape m_canvas->CrossHairOff( DC ); // Erase cursor shape

View File

@ -566,7 +566,7 @@ void PCB_EDIT_FRAME::Block_Delete()
// These items are deleted, but not put in undo list // These items are deleted, but not put in undo list
case PCB_MARKER_T: // a marker used to show something case PCB_MARKER_T: // a marker used to show something
case PCB_ZONE_T: // SEG_ZONE items are now deprecated case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
item->UnLink(); item->UnLink();
itemsList->RemovePicker( ii ); itemsList->RemovePicker( ii );
ii--; ii--;
@ -625,7 +625,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
break; break;
// This item is not put in undo list // This item is not put in undo list
case PCB_ZONE_T: // SEG_ZONE items are now deprecated case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
itemsList->RemovePicker( ii ); itemsList->RemovePicker( ii );
ii--; ii--;
break; break;
@ -694,7 +694,7 @@ void PCB_EDIT_FRAME::Block_Flip()
break; break;
// This item is not put in undo list // This item is not put in undo list
case PCB_ZONE_T: // SEG_ZONE items are now deprecated case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
itemsList->RemovePicker( ii ); itemsList->RemovePicker( ii );
ii--; ii--;
break; break;
@ -750,7 +750,7 @@ void PCB_EDIT_FRAME::Block_Move()
break; break;
// This item is not put in undo list // This item is not put in undo list
case PCB_ZONE_T: // SEG_ZONE items are now deprecated case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
itemsList->RemovePicker( ii ); itemsList->RemovePicker( ii );
ii--; ii--;
break; break;

View File

@ -211,7 +211,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
case PCB_DIMENSION_T: // a dimension (graphic item) case PCB_DIMENSION_T: // a dimension (graphic item)
case PCB_TARGET_T: // a target (graphic item) case PCB_TARGET_T: // a target (graphic item)
case PCB_MARKER_T: // a marker used to show something case PCB_MARKER_T: // a marker used to show something
case PCB_ZONE_T: // SEG_ZONE items are now deprecated case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
view->Remove( boardItem ); view->Remove( boardItem );

View File

@ -871,7 +871,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
break; break;
case PCB_ZONE_T: case PCB_SEGZONE_T:
if( aMode == ADD_APPEND ) if( aMode == ADD_APPEND )
m_SegZoneDeprecated.PushBack( (SEGZONE*) aBoardItem ); m_SegZoneDeprecated.PushBack( (SEGZONE*) aBoardItem );
else else
@ -967,7 +967,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
m_Track.Remove( (TRACK*) aBoardItem ); m_Track.Remove( (TRACK*) aBoardItem );
break; break;
case PCB_ZONE_T: case PCB_SEGZONE_T:
m_SegZoneDeprecated.Remove( (SEGZONE*) aBoardItem ); m_SegZoneDeprecated.Remove( (SEGZONE*) aBoardItem );
break; break;
@ -1313,7 +1313,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
++p; ++p;
break; break;
case PCB_ZONE_T: case PCB_SEGZONE_T:
result = IterateForward( m_SegZoneDeprecated, inspector, testData, p ); result = IterateForward( m_SegZoneDeprecated, inspector, testData, p );
++p; ++p;
break; break;

View File

@ -116,7 +116,7 @@ wxString TRACK::ShowWidth() const
SEGZONE::SEGZONE( BOARD_ITEM* aParent ) : SEGZONE::SEGZONE( BOARD_ITEM* aParent ) :
TRACK( aParent, PCB_ZONE_T ) TRACK( aParent, PCB_SEGZONE_T )
{ {
} }
@ -484,7 +484,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
// When reading from a file most of the items will already be in the correct order. // When reading from a file most of the items will already be in the correct order.
// Searching from the back therefore takes us from n^2 to essentially 0. // Searching from the back therefore takes us from n^2 to essentially 0.
if( Type() == PCB_ZONE_T ) // Deprecated items, only found in very old boards if( Type() == PCB_SEGZONE_T ) // Deprecated items, only found in very old boards
track = aPcb->m_SegZoneDeprecated.GetLast(); track = aPcb->m_SegZoneDeprecated.GetLast();
else else
track = aPcb->m_Track.GetLast(); track = aPcb->m_Track.GetLast();
@ -495,7 +495,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
return track->Next(); return track->Next();
} }
if( Type() == PCB_ZONE_T ) // Deprecated if( Type() == PCB_SEGZONE_T ) // Deprecated
return aPcb->m_SegZoneDeprecated.GetFirst(); return aPcb->m_SegZoneDeprecated.GetFirst();
else else
return aPcb->m_Track.GetFirst(); return aPcb->m_Track.GetFirst();

View File

@ -76,7 +76,7 @@ public:
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
return aItem && ( ( PCB_ZONE_AREA_T == aItem->Type() ) || return aItem && ( ( PCB_ZONE_AREA_T == aItem->Type() ) ||
( PCB_ZONE_T == aItem->Type() ) ); ( PCB_SEGZONE_T == aItem->Type() ) );
} }
/** /**

View File

@ -50,7 +50,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
PCB_PAD_T, // in modules PCB_PAD_T, // in modules
PCB_MODULE_TEXT_T, // in modules PCB_MODULE_TEXT_T, // in modules
PCB_MODULE_T, // in m_Modules PCB_MODULE_T, // in m_Modules
PCB_ZONE_T, // in m_Zones PCB_SEGZONE_T, // in m_Zones
PCB_ZONE_AREA_T, // in m_ZoneDescriptorList PCB_ZONE_AREA_T, // in m_ZoneDescriptorList
EOT EOT
}; };
@ -65,7 +65,7 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = {
PCB_VIA_T, PCB_VIA_T,
PCB_TRACE_T, PCB_TRACE_T,
PCB_MODULE_T, PCB_MODULE_T,
PCB_ZONE_T, PCB_SEGZONE_T,
PCB_ZONE_AREA_T, PCB_ZONE_AREA_T,
EOT EOT
}; };
@ -104,7 +104,7 @@ const KICAD_T GENERAL_COLLECTOR::PadsTracksOrZones[] = {
PCB_PAD_T, PCB_PAD_T,
PCB_VIA_T, PCB_VIA_T,
PCB_TRACE_T, PCB_TRACE_T,
PCB_ZONE_T, PCB_SEGZONE_T,
PCB_ZONE_AREA_T, PCB_ZONE_AREA_T,
EOT EOT
}; };
@ -182,7 +182,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
breakhere++; breakhere++;
break; break;
case PCB_ZONE_T: case PCB_SEGZONE_T:
breakhere++; breakhere++;
break; break;
@ -266,7 +266,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
goto exit; goto exit;
break; break;
case PCB_ZONE_T: case PCB_SEGZONE_T:
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:

View File

@ -188,7 +188,6 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
case PCB_ZONE_T:
{ {
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid(); m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
m_itemMap.erase ( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ); m_itemMap.erase ( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
@ -196,6 +195,7 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
break; break;
} }
case PCB_SEGZONE_T:
default: default:
return false; return false;
} }
@ -279,7 +279,6 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
case PCB_ZONE_T:
{ {
auto zone = static_cast<ZONE_CONTAINER*>( aItem ); auto zone = static_cast<ZONE_CONTAINER*>( aItem );
@ -294,6 +293,8 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
break; break;
} }
//N.B. SEGZONE items are deprecated and not to used for connectivity
case PCB_SEGZONE_T:
default: default:
return false; return false;
} }
@ -584,7 +585,6 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
{ {
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:
case PCB_ZONE_T:
case PCB_PAD_T: case PCB_PAD_T:
Add( item ); Add( item );
break; break;
@ -599,6 +599,8 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
break; break;
} }
//N.B. SEGZONE items are deprecated and not to used for connectivity
case PCB_SEGZONE_T:
default: default:
break; break;
} }
@ -830,21 +832,20 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
return true; return true;
// We should handle zone-zone connection separately // We should handle zone-zone connection separately
if ( ( parentA->Type() == PCB_ZONE_AREA_T || parentA->Type() == PCB_ZONE_T ) && if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T )
( parentB->Type() == PCB_ZONE_AREA_T || parentB->Type() == PCB_ZONE_T ) )
{ {
checkZoneZoneConnection( static_cast<CN_ZONE*>( m_item ), checkZoneZoneConnection( static_cast<CN_ZONE*>( m_item ),
static_cast<CN_ZONE*>( aCandidate ) ); static_cast<CN_ZONE*>( aCandidate ) );
return true; return true;
} }
if( parentA->Type() == PCB_ZONE_AREA_T || parentA->Type() == PCB_ZONE_T) if( parentA->Type() == PCB_ZONE_AREA_T )
{ {
checkZoneItemConnection( static_cast<CN_ZONE*>( aCandidate ), m_item ); checkZoneItemConnection( static_cast<CN_ZONE*>( aCandidate ), m_item );
return true; return true;
} }
if( parentB->Type() == PCB_ZONE_AREA_T || parentB->Type() == PCB_ZONE_T) if( parentB->Type() == PCB_ZONE_AREA_T )
{ {
checkZoneItemConnection( static_cast<CN_ZONE*>( m_item ), aCandidate ); checkZoneItemConnection( static_cast<CN_ZONE*>( m_item ), aCandidate );
return true; return true;

View File

@ -170,7 +170,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_ZONE_T: case PCB_SEGZONE_T:
// Found a TYPE ZONE // Found a TYPE ZONE
if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found
{ {

View File

@ -1369,7 +1369,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
Delete_Segment( DC, (TRACK*) Item ); Delete_Segment( DC, (TRACK*) Item );
break; break;
case PCB_ZONE_T: case PCB_SEGZONE_T:
Delete_OldZone_Fill( (SEGZONE*) Item ); Delete_OldZone_Fill( (SEGZONE*) Item );
break; break;

View File

@ -1103,7 +1103,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
fprintf( aFile, "TRACK TRACK%d\n", track->GetWidth() ); fprintf( aFile, "TRACK TRACK%d\n", track->GetWidth() );
} }
if( (track->Type() == PCB_TRACE_T) || (track->Type() == PCB_ZONE_T) ) if( (track->Type() == PCB_TRACE_T) || (track->Type() == PCB_SEGZONE_T) )
{ {
if( old_layer != track->GetLayer() ) if( old_layer != track->GetLayer() )
{ {

View File

@ -444,7 +444,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_VIA_T: case PCB_VIA_T:
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_ZONE_T: case PCB_SEGZONE_T:
case PCB_MARKER_T: case PCB_MARKER_T:
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
case PCB_TARGET_T: case PCB_TARGET_T:

View File

@ -72,7 +72,7 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC )
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:
case PCB_ZONE_T: case PCB_SEGZONE_T:
// since these classes are all derived from TRACK, use a common // since these classes are all derived from TRACK, use a common
// GetNet() function: // GetNet() function:
netcode = ( (TRACK*) item )->GetNetCode(); netcode = ( (TRACK*) item )->GetNetCode();

View File

@ -491,7 +491,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend )
else if( TESTLINE( "$ZONE" ) ) else if( TESTLINE( "$ZONE" ) )
{ {
loadTrackList( PCB_ZONE_T ); loadTrackList( PCB_SEGZONE_T );
} }
else if( TESTLINE( "$GENERAL" ) ) else if( TESTLINE( "$GENERAL" ) )
@ -2260,7 +2260,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
BIU drill = data ? biuParse( data ) : -1; // SetDefault() if < 0 BIU drill = data ? biuParse( data ) : -1; // SetDefault() if < 0
// Read the 2nd line to determine the exact type, one of: // Read the 2nd line to determine the exact type, one of:
// PCB_TRACE_T, PCB_VIA_T, or PCB_ZONE_T. The type field in 2nd line // PCB_TRACE_T, PCB_VIA_T, or PCB_SEGZONE_T. The type field in 2nd line
// differentiates between PCB_TRACE_T and PCB_VIA_T. With virtual // differentiates between PCB_TRACE_T and PCB_VIA_T. With virtual
// functions in use, it is critical to instantiate the PCB_VIA_T // functions in use, it is critical to instantiate the PCB_VIA_T
// exactly. // exactly.
@ -2313,7 +2313,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
newTrack = new VIA( m_board ); newTrack = new VIA( m_board );
break; break;
case PCB_ZONE_T: // this is now deprecated, but exist in old boards case PCB_SEGZONE_T: // this is now deprecated, but exist in old boards
newTrack = new SEGZONE( m_board ); newTrack = new SEGZONE( m_board );
break; break;
} }

View File

@ -210,7 +210,7 @@ protected:
* reads a list of segments (Tracks and Vias, or Segzones) * reads a list of segments (Tracks and Vias, or Segzones)
* *
* @param aStructType is either PCB_TRACE_T to indicate tracks and vias, or * @param aStructType is either PCB_TRACE_T to indicate tracks and vias, or
* PCB_ZONE_T to indicate oldschool zone segments (before polygons came to be). * PCB_SEGZONE_T to indicate oldschool zone segments (before polygons came to be).
*/ */
void loadTrackList( int aStructType ); void loadTrackList( int aStructType );

View File

@ -196,7 +196,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break; break;
case PCB_ZONE_T: // Item used to fill a zone case PCB_SEGZONE_T: // Item used to fill a zone
AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE, AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE,
_( "Delete Zone Filling" ), KiBitmap( delete_xpm ) ); _( "Delete Zone Filling" ), KiBitmap( delete_xpm ) );
break; break;

View File

@ -285,7 +285,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
// the "cast" applied in here clarifies which overloaded draw() is called // the "cast" applied in here clarifies which overloaded draw() is called
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_ZONE_T: case PCB_SEGZONE_T:
case PCB_TRACE_T: case PCB_TRACE_T:
draw( static_cast<const TRACK*>( item ), aLayer ); draw( static_cast<const TRACK*>( item ), aLayer );
break; break;

View File

@ -274,7 +274,7 @@ void PCB_EDIT_FRAME::OnActionPlugin( wxCommandEvent& aEvent )
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
case PCB_TARGET_T: case PCB_TARGET_T:
case PCB_ZONE_T: case PCB_SEGZONE_T:
// If item has a list it's mean that the element is on the board // If item has a list it's mean that the element is on the board
if( item->GetList() == NULL ) if( item->GetList() == NULL )

View File

@ -39,7 +39,7 @@ bool PCB_SELECTION_CONDITIONS::OnlyConnectedItems( const SELECTION& aSelection )
{ {
auto type = item->Type(); auto type = item->Type();
if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_T ) if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_AREA_T )
return false; return false;
} }