diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index 8bda3bc2cf..7d5dfe7425 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -42,8 +42,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -570,12 +570,12 @@ class BOARD_ADAPTER PCB_LAYER_ID aLayerId, int aClearanceValue ); - void AddShapeWithClearanceToContainer( const DIMENSION *aDimension, + void AddShapeWithClearanceToContainer( const DIMENSION_BASE *aDimension, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue ); - void AddSolidAreasShapesToContainer( const ZONE_CONTAINER *aZoneContainer, + void AddSolidAreasShapesToContainer( const ZONE *aZoneContainer, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId ); diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 75f400541a..564bbd6b76 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -130,10 +130,9 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_TEXT* aText, } -void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION* aDimension, +void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION_BASE* aDimension, CGENERICCONTAINER2D *aDstContainer, - PCB_LAYER_ID aLayerId, - int aClearanceValue ) + PCB_LAYER_ID aLayerId, int aClearanceValue ) { AddShapeWithClearanceToContainer(&aDimension->Text(), aDstContainer, aLayerId, aClearanceValue); @@ -762,7 +761,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_SHAPE* aDrawSegm // Based on // TransformSolidAreasShapesToPolygonSet // board_items_to_polygon_shape_transform.cpp -void BOARD_ADAPTER::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneContainer, +void BOARD_ADAPTER::AddSolidAreasShapesToContainer( const ZONE* aZoneContainer, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId ) { diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 175a2c9af2..904097ac7f 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -653,8 +653,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - AddShapeWithClearanceToContainer( (DIMENSION*) item, layerContainer, curr_layer_id, - 0 ); + AddShapeWithClearanceToContainer( (DIMENSION_BASE*) item, layerContainer, + curr_layer_id, 0 ); break; default: @@ -711,9 +711,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) if( aStatusReporter ) aStatusReporter->Report( _( "Create zones" ) ); - std::vector> zones; + std::vector> zones; - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() ) zones.emplace_back( std::make_pair( zone, layer ) ); @@ -733,7 +733,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) areaId < zones.size(); areaId = nextZone.fetch_add( 1 ) ) { - const ZONE_CONTAINER* zone = zones[areaId].first; + const ZONE* zone = zones[areaId].first; if( zone == nullptr ) break; @@ -761,7 +761,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) && ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) ) { // Add copper zones - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( zone == nullptr ) break; @@ -953,7 +953,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - AddShapeWithClearanceToContainer( (DIMENSION*) item, + AddShapeWithClearanceToContainer( (DIMENSION_BASE*) item, layerContainer, curr_layer_id, 0 ); @@ -1053,13 +1053,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // Draw non copper zones if( GetFlag( FL_ZONE ) ) { - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( zone->IsOnLayer( curr_layer_id ) ) AddSolidAreasShapesToContainer( zone, layerContainer, curr_layer_id ); } - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( zone->IsOnLayer( curr_layer_id ) ) zone->TransformSolidAreasShapesToPolygon( curr_layer_id, *layerPoly ); diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 6c40712fd5..ed83f215dc 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -788,9 +788,9 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event ) } break; - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: { - ZONE_CONTAINER* item = dynamic_cast( intersectedBoardItem ); + ZONE* item = dynamic_cast( intersectedBoardItem ); if( item ) { diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a74829250c..612e6c674d 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -503,7 +503,7 @@ set( PCB_COMMON_SRCS ${CMAKE_SOURCE_DIR}/pcbnew/board_items_to_polygon_shape_transform.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_board.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_board_item.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/class_dimension.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/dimension.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_shape.cpp ${CMAKE_SOURCE_DIR}/pcbnew/fp_shape.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_pcb_group.cpp @@ -512,12 +512,12 @@ set( PCB_COMMON_SRCS ${CMAKE_SOURCE_DIR}/pcbnew/netinfo_item.cpp ${CMAKE_SOURCE_DIR}/pcbnew/netinfo_list.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_pad.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/class_pcb_target.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/pcb_target.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_text.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/class_board_stackup.cpp ${CMAKE_SOURCE_DIR}/pcbnew/fp_text.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_track.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/class_zone.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/zone.cpp ${CMAKE_SOURCE_DIR}/pcbnew/collectors.cpp ${CMAKE_SOURCE_DIR}/pcbnew/connectivity/connectivity_algo.cpp ${CMAKE_SOURCE_DIR}/pcbnew/connectivity/connectivity_items.cpp diff --git a/common/eda_item.cpp b/common/eda_item.cpp index cf5656a691..c4a3fa4f59 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -264,6 +264,7 @@ static struct EDA_ITEM_DESC .Map( PCB_TEXT_T, _HKI( "Board Text" ) ) .Map( PCB_FP_TEXT_T, _HKI( "Footprint Text" ) ) .Map( PCB_FP_SHAPE_T, _HKI( "Graphic Shape" ) ) + .Map( PCB_FP_ZONE_T, _HKI( "Zone" ) ) .Map( PCB_TRACE_T, _HKI( "Track" ) ) .Map( PCB_VIA_T, _HKI( "Via" ) ) .Map( PCB_MARKER_T, _HKI( "Board Marker" ) ) @@ -272,7 +273,7 @@ static struct EDA_ITEM_DESC .Map( PCB_DIM_CENTER_T, _HKI( "Center Dimension" ) ) .Map( PCB_DIM_LEADER_T, _HKI( "Leader" ) ) .Map( PCB_TARGET_T, _HKI( "Target" ) ) - .Map( PCB_ZONE_AREA_T, _HKI( "Zone" ) ) + .Map( PCB_ZONE_T, _HKI( "Zone" ) ) .Map( PCB_ITEM_LIST_T, _HKI( "Item List" ) ) .Map( PCB_NETINFO_T, _HKI( "Net Info" ) ) .Map( PCB_GROUP_T, _HKI( "Group" ) ) diff --git a/include/board_design_settings.h b/include/board_design_settings.h index f14fbbdc0c..263fcb8f52 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -207,7 +207,7 @@ struct TEXT_ITEM_INFO // forward declaration from class_track.h enum class VIATYPE : int; -// forward declarations from class_dimension.h +// forward declarations from dimension.h enum class DIM_UNITS_FORMAT : int; enum class DIM_TEXT_POSITION : int; enum class DIM_UNITS_MODE : int; diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index 1589edfb5a..cb86cfeb74 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -92,18 +92,18 @@ enum KICAD_T PCB_TEXT_T, ///< class PCB_TEXT, text on a layer PCB_FP_TEXT_T, ///< class FP_TEXT, text in a footprint PCB_FP_SHAPE_T, ///< class FP_SHAPE, a footprint edge - PCB_FP_ZONE_AREA_T, ///< class ZONE_CONTAINER, managed by a footprint + PCB_FP_ZONE_T, ///< class ZONE, managed by a footprint 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_ARC_T, ///< class ARC, an arc track segment on a copper layer PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something - PCB_DIMENSION_T, ///< class DIMENSION: abstract dimension meta-type + PCB_DIMENSION_T, ///< class DIMENSION_BASE: abstract dimension meta-type PCB_DIM_ALIGNED_T, ///< class ALIGNED_DIMENSION, a linear dimension (graphic item) PCB_DIM_LEADER_T, ///< class LEADER, a leader dimension (graphic item) PCB_DIM_CENTER_T, ///< class CENTER_DIMENSION, a center point marking (graphic item) PCB_DIM_ORTHOGONAL_T, ///< class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item) - PCB_ZONE_AREA_T, ///< class ZONE_CONTAINER, a zone area + PCB_ZONE_T, ///< class ZONE, a copper pour area PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items PCB_NETINFO_T, ///< class NETINFO_ITEM, a description of a net PCB_GROUP_T, ///< class PCB_GROUP, a set of BOARD_ITEMs diff --git a/pcbnew/array_creator.cpp b/pcbnew/array_creator.cpp index 6bfc40fd2c..58fcfa04d9 100644 --- a/pcbnew/array_creator.cpp +++ b/pcbnew/array_creator.cpp @@ -111,7 +111,7 @@ void ARRAY_CREATOR::Invoke() case PCB_SHAPE_T: case PCB_TRACE_T: case PCB_VIA_T: - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: case PCB_TARGET_T: case PCB_DIM_ALIGNED_T: case PCB_DIM_CENTER_T: diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 59f753027d..1d6eddc692 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -150,7 +150,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a } else if( boardItem->Type() == PCB_FP_TEXT_T || boardItem->Type() == PCB_FP_SHAPE_T || - boardItem->Type() == PCB_FP_ZONE_AREA_T ) + boardItem->Type() == PCB_FP_ZONE_T ) { wxASSERT( boardItem->GetParent() && boardItem->GetParent()->Type() == PCB_MODULE_T ); @@ -187,7 +187,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a case PCB_PAD_T: case PCB_FP_SHAPE_T: case PCB_FP_TEXT_T: - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: // This level can only handle module items when editing footprints wxASSERT( m_isFootprintEditor ); @@ -223,7 +223,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a case PCB_DIM_LEADER_T: // a leader dimension case PCB_TARGET_T: // a target (graphic item) case PCB_MARKER_T: // a marker used to show something - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: view->Remove( boardItem ); if( !( changeFlags & CHT_DONE ) ) @@ -369,10 +369,10 @@ EDA_ITEM* BOARD_COMMIT::parentObject( EDA_ITEM* aItem ) const case PCB_PAD_T: case PCB_FP_SHAPE_T: case PCB_FP_TEXT_T: - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: return aItem->GetParent(); - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: wxASSERT( !dynamic_cast( aItem->GetParent() ) ); return aItem; diff --git a/pcbnew/board_connected_item.h b/pcbnew/board_connected_item.h index 7a343e50a5..d1809429b1 100644 --- a/pcbnew/board_connected_item.h +++ b/pcbnew/board_connected_item.h @@ -60,7 +60,7 @@ public: case PCB_TRACE_T: case PCB_ARC_T: case PCB_VIA_T: - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: return true; default: diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 2f9e02d71b..1aa4422057 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include #include diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 2539eb7d38..ac56ba05d6 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -88,7 +88,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_ } // convert copper zones - for( ZONE_CONTAINER* zone : Zones() ) + for( ZONE* zone : Zones() ) { if( zone->GetLayerSet().test( aLayer ) ) zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines ); @@ -283,9 +283,8 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( SHAPE_POLY_SET& aC } -void ZONE_CONTAINER::TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, - SHAPE_POLY_SET& aCornerBuffer, - int aError ) const +void ZONE::TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer, + int aError ) const { if( !m_FilledPolysList.count( aLayer ) || m_FilledPolysList.at( aLayer ).IsEmpty() ) return; @@ -711,10 +710,9 @@ bool D_PAD::TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, } -void ZONE_CONTAINER::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, - PCB_LAYER_ID aLayer, int aClearance, - int aError, ERROR_LOC aErrorLoc, - bool ignoreLineWidth ) const +void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + PCB_LAYER_ID aLayer, int aClearance, int aError, + ERROR_LOC aErrorLoc, bool ignoreLineWidth ) const { wxASSERT_MSG( !ignoreLineWidth, "IgnoreLineWidth has no meaning for zones." ); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 01ba0a96a3..a8f1e84d80 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -34,9 +34,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include @@ -102,7 +102,7 @@ BOARD::~BOARD() // Clean up the owned elements DeleteMARKERs(); - for( ZONE_CONTAINER* zone : m_zones ) + for( ZONE* zone : m_zones ) delete zone; m_zones.clear(); @@ -251,8 +251,10 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload PCB_ARC_T, // PCB_PAD_T, Can't be at board level // PCB_FP_TEXT_T, Can't be at board level + // PCB_FP_SHAPE_T, Can't be at board level + // PCB_FP_ZONE_T, Can't be at board level PCB_MODULE_T, - PCB_ZONE_AREA_T, + PCB_ZONE_T, EOT }; @@ -518,7 +520,7 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled ) pad->SetLocalRatsnestVisible( isEnabled ); } - for( ZONE_CONTAINER* zone : Zones() ) + for( ZONE* zone : Zones() ) zone->SetLocalRatsnestVisible( isEnabled ); break; @@ -572,8 +574,8 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) break; // this one uses a vector - case PCB_ZONE_AREA_T: - m_zones.push_back( (ZONE_CONTAINER*) aBoardItem ); + case PCB_ZONE_T: + m_zones.push_back( (ZONE*) aBoardItem ); break; case PCB_TRACE_T: @@ -666,7 +668,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem ) } ) ); break; - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: m_zones.erase( std::remove_if( m_zones.begin(), m_zones.end(), [aBoardItem]( BOARD_ITEM* aItem ) { @@ -802,7 +804,7 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID ) const } } - for( ZONE_CONTAINER* zone : Zones() ) + for( ZONE* zone : Zones() ) { if( zone->m_Uuid == aID ) return zone; @@ -856,7 +858,7 @@ void BOARD::FillItemMap( std::map& aMap ) aMap[ drawing->m_Uuid ] = drawing; } - for( ZONE_CONTAINER* zone : Zones() ) + for( ZONE* zone : Zones() ) aMap[ zone->m_Uuid ] = zone; for( BOARD_ITEM* drawing : Drawings() ) @@ -1039,7 +1041,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const } // Check zones - for( ZONE_CONTAINER* aZone : m_zones ) + for( ZONE* aZone : m_zones ) { if( ( aZone->GetLayerSet() & visible ).any() ) area.Merge( aZone->GetBoundingBox() ); @@ -1118,7 +1120,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s case PCB_PAD_T: case PCB_FP_TEXT_T: case PCB_FP_SHAPE_T: - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: // this calls MODULE::Visit() on each module. result = IterateForward( m_modules, inspector, testData, p ); @@ -1132,7 +1134,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s case PCB_PAD_T: case PCB_FP_TEXT_T: case PCB_FP_SHAPE_T: - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: continue; default: @@ -1199,8 +1201,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s ++p; break; - case PCB_ZONE_AREA_T: - for( ZONE_CONTAINER* zone : m_zones) + case PCB_ZONE_T: + for( ZONE* zone : m_zones) { result = zone->Visit( inspector, testData, p ); @@ -1411,7 +1413,7 @@ int BOARD::SetAreasNetCodesFromNetNames() { int error_count = 0; - for( ZONE_CONTAINER* zone : Zones() ) + for( ZONE* zone : Zones() ) { if( !zone->IsOnCopperLayer() ) { @@ -1729,18 +1731,18 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer } -std::list BOARD::GetZoneList( bool aIncludeZonesInFootprints ) +std::list BOARD::GetZoneList( bool aIncludeZonesInFootprints ) { - std::list zones; + std::list zones; - for( ZONE_CONTAINER* zone : Zones() ) + for( ZONE* zone : Zones() ) zones.push_back( zone ); if( aIncludeZonesInFootprints ) { for( MODULE* footprint : m_modules ) { - for( MODULE_ZONE_CONTAINER* zone : footprint->Zones() ) + for( FP_ZONE* zone : footprint->Zones() ) zones.push_back( zone ); } } @@ -1749,10 +1751,10 @@ std::list BOARD::GetZoneList( bool aIncludeZonesInFootprints ) } -ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, - wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch ) +ZONE* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, + wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch ) { - ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this ); + ZONE* new_area = new ZONE( this ); new_area->SetNetCode( aNetcode ); new_area->SetLayer( aLayer ); @@ -1774,28 +1776,28 @@ ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, } -void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to_remove ) +void BOARD::RemoveZone( PICKED_ITEMS_LIST* aDeletedList, ZONE* aZone ) { - if( area_to_remove == NULL ) + if( aZone == NULL ) return; if( aDeletedList ) { - ITEM_PICKER picker( nullptr, area_to_remove, UNDO_REDO::DELETED ); + ITEM_PICKER picker( nullptr, aZone, UNDO_REDO::DELETED ); aDeletedList->PushItem( picker ); - Remove( area_to_remove ); // remove from zone list, but does not delete it + Remove( aZone ); // remove from zone list, but does not delete it } else { - Delete( area_to_remove ); + Delete( aZone ); } } -bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAINER* aCurrArea ) +bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE* aCurrArea ) { // mark all areas as unmodified except this one, if modified - for( ZONE_CONTAINER* zone : m_zones ) + for( ZONE* zone : m_zones ) zone->SetLocalFlags( 0 ); aCurrArea->SetLocalFlags( 1 ); @@ -1810,7 +1812,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI // If clipping has created some polygons, we must add these new copper areas. if( n_poly > 1 ) { - ZONE_CONTAINER* NewArea; + ZONE* NewArea; // Move the newly created polygons to new areas, removing them from the current area for( int ip = 1; ip < n_poly; ip++ ) @@ -1892,7 +1894,7 @@ const std::vector BOARD::AllConnectedItems() items.push_back( pad ); } - for( ZONE_CONTAINER* zone : Zones() ) + for( ZONE* zone : Zones() ) items.push_back( zone ); return items; diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index d939d48af2..4e327636de 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -41,7 +41,7 @@ class PCB_BASE_FRAME; class PCB_EDIT_FRAME; class PICKED_ITEMS_LIST; class BOARD; -class ZONE_CONTAINER; +class ZONE; class TRACK; class D_PAD; class MARKER_PCB; @@ -165,7 +165,7 @@ public: DECL_VEC_FOR_SWIG( MARKERS, MARKER_PCB* ) -DECL_VEC_FOR_SWIG( ZONE_CONTAINERS, ZONE_CONTAINER* ) +DECL_VEC_FOR_SWIG( ZONES, ZONE* ) DECL_DEQ_FOR_SWIG( TRACKS, TRACK* ) // Dequeue rather than Vector just so we can use moveUnflaggedItems in pcbnew_control.cpp DECL_DEQ_FOR_SWIG( GROUPS, PCB_GROUP* ) @@ -189,31 +189,31 @@ class BOARD : public BOARD_ITEM_CONTAINER private: /// What is this board being used for - BOARD_USE m_boardUse; + BOARD_USE m_boardUse; - wxString m_fileName; - MARKERS m_markers; - DRAWINGS m_drawings; - MODULES m_modules; - TRACKS m_tracks; - GROUPS m_groups; - ZONE_CONTAINERS m_zones; + wxString m_fileName; + MARKERS m_markers; + DRAWINGS m_drawings; + MODULES m_modules; + TRACKS m_tracks; + GROUPS m_groups; + ZONES m_zones; - LAYER m_Layer[PCB_LAYER_ID_COUNT]; + LAYER m_Layer[PCB_LAYER_ID_COUNT]; // if true m_highLight_NetCode is used - HIGH_LIGHT_INFO m_highLight; // current high light data - HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data + HIGH_LIGHT_INFO m_highLight; // current high light data + HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data - int m_fileFormatVersionAtLoad; // the version loaded from the file + int m_fileFormatVersionAtLoad; // the version loaded from the file std::map m_properties; std::shared_ptr m_connectivity; - PAGE_INFO m_paper; - TITLE_BLOCK m_titles; // text in lower right of screen and plots - PCB_PLOT_PARAMS m_plotOptions; - PROJECT* m_project; // project this board is a part of + PAGE_INFO m_paper; + TITLE_BLOCK m_titles; // text in lower right of screen and plots + PCB_PLOT_PARAMS m_plotOptions; + PROJECT* m_project; // project this board is a part of /** * All of the board design settings are stored as a JSON object inside the project file. The @@ -227,7 +227,7 @@ private: */ std::unique_ptr m_designSettings; - NETINFO_LIST m_NetInfo; // net info list (name, design constraints .. + NETINFO_LIST m_NetInfo; // net info list (name, design constraints .. std::vector m_listeners; @@ -287,8 +287,8 @@ public: DRAWINGS& Drawings() { return m_drawings; } const DRAWINGS& Drawings() const { return m_drawings; } - ZONE_CONTAINERS& Zones() { return m_zones; } - const ZONE_CONTAINERS& Zones() const { return m_zones; } + ZONES& Zones() { return m_zones; } + const ZONES& Zones() const { return m_zones; } MARKERS& Markers() { return m_markers; } @@ -877,10 +877,10 @@ public: /** * Return the Area (Zone Container) at a given index. * - * @param index The array type index into a collection of ZONE_CONTAINER *. - * @return ZONE_CONTAINER* - a pointer to the Area or NULL if index out of range. + * @param index The array type index into a collection of ZONE *. + * @return ZONE* - a pointer to the Area or NULL if index out of range. */ - ZONE_CONTAINER* GetArea( int index ) const + ZONE* GetArea( int index ) const { if( (unsigned) index < m_zones.size() ) return m_zones[index]; @@ -891,10 +891,10 @@ public: /** * @return a std::list of pointers to all board zones (possibly including zones in footprints) */ - std::list GetZoneList( bool aIncludeZonesInFootprints = false ); + std::list GetZoneList( bool aIncludeZonesInFootprints = false ); /** - * @return The number of Areas or ZONE_CONTAINER. + * @return The number of copper pour areas or ZONEs. */ int GetAreaCount() const { @@ -914,8 +914,8 @@ public: * @param aHatch = hatch option * @return a reference to the new area */ - ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, - wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch ); + ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, + wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch ); /** * Process an area that has been modified, by normalizing its polygon against itself. @@ -925,7 +925,7 @@ public: * @param aCurrArea = the zone to process * @return true if changes are made */ - bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE_CONTAINER* aCurrArea ); + bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE* aCurrArea ); /** * Process an area that has been modified, by normalizing its polygon @@ -936,8 +936,7 @@ public: * @param modified_area = area to test * @return true if some areas modified */ - bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, - ZONE_CONTAINER* modified_area ); + bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, ZONE* modified_area ); /** * Check all copper areas in net for intersections, combining them if found. @@ -949,7 +948,7 @@ public: * Sets local flag = 1 for any areas modified * @return true if some areas modified */ - bool CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, + bool CombineAllZonesInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, bool aUseLocalFlags ); @@ -958,37 +957,33 @@ public: * * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful * in undo commands can be NULL - * @param area_to_remove = area to delete or put in deleted list + * @param aZone = area to delete or put in deleted list */ - void RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to_remove ); + void RemoveZone( PICKED_ITEMS_LIST* aDeletedList, ZONE* aZone ); /** * Check for intersection of a given copper area with other areas in same net - * @param area_to_test = area to compare to all other areas in the same net + * @param aZone = area to compare to all other areas in the same net */ - bool TestAreaIntersections( ZONE_CONTAINER* area_to_test ); + bool TestZoneIntersections( ZONE* aZone ); /** * Test for intersection of 2 copper areas - * @param area_ref = area reference - * @param area_to_test = area to compare for intersection calculations + * @param aZone1 = area reference + * @param aZone2 = area to compare for intersection calculations * @return : false if no intersection, true if intersection */ - bool TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test ); + bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 ); /** * If possible, combine 2 copper areas - * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas - * (useful for undo). - * @param area_ref = the main area (zone) - * @param area_to_combine = the zone that can be merged with area_ref - * area_ref must be BEFORE area_to_combine - * area_to_combine will be deleted, if areas are combined - * @return : true if area_to_combine is combined with area_ref (and therefore be deleted) + * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (for undo). + * @param aRefZone = the main area (zone) + * @param aZoneToCombine = the zone that can be merged with aRefZone; will be deleted if the + * combine is successful + * @return : true if aZoneToCombine is combined with aRefZone (and therefore be deleted) */ - bool CombineAreas( PICKED_ITEMS_LIST* aDeletedList, - ZONE_CONTAINER* area_ref, - ZONE_CONTAINER* area_to_combine ); + bool CombineZones( PICKED_ITEMS_LIST* aDeletedList, ZONE* aRefZone, ZONE* aZoneToCombine ); /** * Find a pad \a aPosition on \a aLayer. diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index f71e41154e..21b54f58bf 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -107,9 +107,9 @@ MODULE::MODULE( const MODULE& aFootprint ) : } // Copy zones - for( MODULE_ZONE_CONTAINER* zone : aFootprint.Zones() ) + for( FP_ZONE* zone : aFootprint.Zones() ) { - MODULE_ZONE_CONTAINER* newZone = static_cast( zone->Clone() ); + FP_ZONE* newZone = static_cast( zone->Clone() ); ptrMap[ zone ] = newZone; Add( newZone ); @@ -183,7 +183,7 @@ MODULE::~MODULE() m_pads.clear(); - for( MODULE_ZONE_CONTAINER* zone : m_fp_zones ) + for( FP_ZONE* zone : m_fp_zones ) delete zone; m_fp_zones.clear(); @@ -242,7 +242,7 @@ MODULE& MODULE::operator=( MODULE&& aOther ) // Move the zones m_fp_zones.clear(); - for( MODULE_ZONE_CONTAINER* item : aOther.Zones() ) + for( FP_ZONE* item : aOther.Zones() ) { Add( item ); @@ -340,9 +340,9 @@ MODULE& MODULE::operator=( const MODULE& aOther ) // Copy zones m_fp_zones.clear(); - for( MODULE_ZONE_CONTAINER* zone : aOther.Zones() ) + for( FP_ZONE* zone : aOther.Zones() ) { - MODULE_ZONE_CONTAINER* newZone = static_cast( zone->Clone() ); + FP_ZONE* newZone = static_cast( zone->Clone() ); ptrMap[ zone ] = newZone; Add( newZone ); @@ -461,11 +461,11 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) m_pads.push_front( static_cast( aBoardItem ) ); break; - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: if( aMode == ADD_MODE::APPEND ) - m_fp_zones.push_back( static_cast( aBoardItem ) ); + m_fp_zones.push_back( static_cast( aBoardItem ) ); else - m_fp_zones.insert( m_fp_zones.begin(), static_cast( aBoardItem ) ); + m_fp_zones.insert( m_fp_zones.begin(), static_cast( aBoardItem ) ); break; case PCB_GROUP_T: @@ -526,10 +526,10 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem ) break; - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: for( auto it = m_fp_zones.begin(); it != m_fp_zones.end(); ++it ) { - if( *it == static_cast( aBoardItem ) ) + if( *it == static_cast( aBoardItem ) ) { m_fp_zones.erase( it ); break; @@ -592,7 +592,7 @@ EDA_RECT MODULE::GetFootprintRect() const for( D_PAD* pad : m_pads ) area.Merge( pad->GetBoundingBox() ); - for( MODULE_ZONE_CONTAINER* zone : m_fp_zones ) + for( FP_ZONE* zone : m_fp_zones ) area.Merge( zone->GetBoundingBox() ); // Groups do not contribute to the rect, only their members @@ -823,7 +823,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co return true; } - for( MODULE_ZONE_CONTAINER* zone : m_fp_zones ) + for( FP_ZONE* zone : m_fp_zones ) { if( zone->HitTest( arect, false, 0 ) ) return true; @@ -982,8 +982,8 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T ++p; break; - case PCB_FP_ZONE_AREA_T: - result = IterateForward( m_fp_zones, inspector, testData, p ); + case PCB_FP_ZONE_T: + result = IterateForward( m_fp_zones, inspector, testData, p ); ++p; break; @@ -1070,8 +1070,8 @@ void MODULE::RunOnChildren( const std::function& aFunction ) for( D_PAD* pad : m_pads ) aFunction( static_cast( pad ) ); - for( MODULE_ZONE_CONTAINER* zone : m_fp_zones ) - aFunction( static_cast( zone ) ); + for( FP_ZONE* zone : m_fp_zones ) + aFunction( static_cast( zone ) ); for( PCB_GROUP* group : m_fp_groups ) aFunction( static_cast( group ) ); @@ -1287,7 +1287,7 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) pad->Flip( m_Pos, false ); // Mirror zones to other side of board. - for( ZONE_CONTAINER* zone : m_fp_zones ) + for( ZONE* zone : m_fp_zones ) zone->Flip( m_Pos, aFlipLeftRight ); // Mirror reference and value. @@ -1333,7 +1333,7 @@ void MODULE::SetPosition( const wxPoint& aPos ) for( D_PAD* pad : m_pads ) pad->SetPosition( pad->GetPosition() + delta ); - for( ZONE_CONTAINER* zone : m_fp_zones ) + for( ZONE* zone : m_fp_zones ) zone->Move( delta ); for( BOARD_ITEM* item : m_drawings ) @@ -1435,7 +1435,7 @@ void MODULE::SetOrientation( double aNewAngle ) pad->SetDrawCoord(); } - for( ZONE_CONTAINER* zone : m_fp_zones ) + for( ZONE* zone : m_fp_zones ) { zone->Rotate( GetPosition(), angleChange ); } @@ -1476,7 +1476,7 @@ BOARD_ITEM* MODULE::Duplicate() const BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule ) { BOARD_ITEM* new_item = NULL; - MODULE_ZONE_CONTAINER* new_zone = NULL; + FP_ZONE* new_zone = NULL; switch( aItem->Type() ) { @@ -1492,9 +1492,9 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule ) break; } - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: { - new_zone = new MODULE_ZONE_CONTAINER( *static_cast( aItem ) ); + new_zone = new FP_ZONE( *static_cast( aItem ) ); const_cast( new_zone->m_Uuid ) = KIID(); if( aAddToModule ) diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 475843048c..d5b5bbeca3 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -37,7 +37,7 @@ #include "zones.h" #include -#include +#include #include class LINE_READER; @@ -100,7 +100,7 @@ public: DECL_DEQ_FOR_SWIG( PADS, D_PAD* ) DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* ) -DECL_VEC_FOR_SWIG( MODULE_ZONE_CONTAINERS, MODULE_ZONE_CONTAINER* ) +DECL_VEC_FOR_SWIG( FP_ZONES, FP_ZONE* ) DECL_VEC_FOR_SWIG( MODULE_GROUPS, PCB_GROUP* ) DECL_DEQ_FOR_SWIG( MODULES, MODULE* ) @@ -176,19 +176,18 @@ public: // Virtual function const EDA_RECT GetBoundingBox() const override; - const EDA_RECT GetBoundingBox( bool aIncludeInvisibleText ) const; - PADS& Pads() { return m_pads; } + PADS& Pads() { return m_pads; } const PADS& Pads() const { return m_pads; } - DRAWINGS& GraphicalItems() { return m_drawings; } + DRAWINGS& GraphicalItems() { return m_drawings; } const DRAWINGS& GraphicalItems() const { return m_drawings; } - MODULE_ZONE_CONTAINERS& Zones() { return m_fp_zones; } - const MODULE_ZONE_CONTAINERS& Zones() const { return m_fp_zones; } + FP_ZONES& Zones() { return m_fp_zones; } + const FP_ZONES& Zones() const { return m_fp_zones; } - MODULE_GROUPS& Groups() { return m_fp_groups; } + MODULE_GROUPS& Groups() { return m_fp_groups; } const MODULE_GROUPS& Groups() const { return m_fp_groups; } bool HasThroughHolePads() const; @@ -197,11 +196,9 @@ public: const std::list& Models() const { return m_3D_Drawings; } void SetPosition( const wxPoint& aPos ) override; - wxPoint GetPosition() const override { return m_Pos; } void SetOrientation( double aNewAngle ); - void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); } double GetOrientation() const { return m_Orient; } double GetOrientationDegrees() const { return m_Orient / 10.0; } @@ -696,7 +693,7 @@ public: private: DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer. PADS m_pads; // D_PAD items, owned by pointer - MODULE_ZONE_CONTAINERS m_fp_zones; // MODULE_ZONE_CONTAINER items, owned by pointer + FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer MODULE_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer double m_Orient; // Orientation in tenths of a degree, 900=90.0 degrees. diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index fdecda4c7b..fc76e3da3e 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -30,8 +30,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -46,22 +46,22 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = { // there are some restrictions on the order of items in the general case. // all items in m_Drawings for instance should be contiguous. // *** all items in a same list (shown here) must be contiguous **** - PCB_MARKER_T, // in m_markers - PCB_TEXT_T, // in m_drawings - PCB_SHAPE_T, // in m_drawings - PCB_DIM_ALIGNED_T, // in m_drawings - PCB_DIM_CENTER_T, // in m_drawings - PCB_DIM_ORTHOGONAL_T, // in m_drawings - PCB_DIM_LEADER_T, // in m_drawings - PCB_TARGET_T, // in m_drawings - PCB_VIA_T, // in m_tracks - PCB_TRACE_T, // in m_tracks - PCB_ARC_T, // in m_tracks - PCB_PAD_T, // in footprints - PCB_FP_TEXT_T, // in footprints - PCB_MODULE_T, // in m_footprints - PCB_GROUP_T, // in m_groups - PCB_ZONE_AREA_T, // in m_zones + PCB_MARKER_T, // in m_markers + PCB_TEXT_T, // in m_drawings + PCB_SHAPE_T, // in m_drawings + PCB_DIM_ALIGNED_T, // in m_drawings + PCB_DIM_CENTER_T, // in m_drawings + PCB_DIM_ORTHOGONAL_T, // in m_drawings + PCB_DIM_LEADER_T, // in m_drawings + PCB_TARGET_T, // in m_drawings + PCB_VIA_T, // in m_tracks + PCB_TRACE_T, // in m_tracks + PCB_ARC_T, // in m_tracks + PCB_PAD_T, // in footprints + PCB_FP_TEXT_T, // in footprints + PCB_MODULE_T, // in m_footprints + PCB_GROUP_T, // in m_groups + PCB_ZONE_T, // in m_zones EOT }; @@ -80,7 +80,7 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = { PCB_TRACE_T, PCB_MODULE_T, PCB_GROUP_T, - PCB_ZONE_AREA_T, + PCB_ZONE_T, EOT }; @@ -101,7 +101,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = { PCB_FP_TEXT_T, PCB_MODULE_T, PCB_GROUP_T, - PCB_ZONE_AREA_T, // if it is visible on screen, it should be selectable + PCB_ZONE_T, // if it is visible on screen, it should be selectable EOT }; @@ -133,7 +133,7 @@ const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = { PCB_FP_TEXT_T, PCB_FP_SHAPE_T, PCB_PAD_T, - PCB_FP_ZONE_AREA_T, + PCB_FP_ZONE_T, PCB_GROUP_T, EOT }; @@ -143,7 +143,7 @@ const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = { PCB_FP_TEXT_T, PCB_FP_SHAPE_T, PCB_PAD_T, - PCB_FP_ZONE_AREA_T, + PCB_FP_ZONE_T, PCB_GROUP_T, EOT }; @@ -168,8 +168,8 @@ const KICAD_T GENERAL_COLLECTOR::LockableItems[] = { const KICAD_T GENERAL_COLLECTOR::Zones[] = { - PCB_ZONE_AREA_T, - PCB_FP_ZONE_AREA_T, + PCB_ZONE_T, + PCB_FP_ZONE_T, EOT }; @@ -194,9 +194,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) bool pad_through = false; VIA* via = nullptr; MARKER_PCB* marker = nullptr; - ZONE_CONTAINER* zone = nullptr; + ZONE* zone = nullptr; PCB_SHAPE* shape = nullptr; - DIMENSION* dimension = nullptr; + DIMENSION_BASE* dimension = nullptr; #if 0 // debugging static int breakhere = 0; @@ -304,14 +304,14 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) goto exit; break; - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: module = static_cast( item->GetParent() ); // Fallthrough to get the zone as well KI_FALLTHROUGH; - case PCB_ZONE_AREA_T: - zone = static_cast( item ); + case PCB_ZONE_T: + zone = static_cast( item ); break; case PCB_TEXT_T: @@ -325,7 +325,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - dimension = static_cast( item ); + dimension = static_cast( item ); break; case PCB_TARGET_T: diff --git a/pcbnew/connectivity/connectivity_algo.cpp b/pcbnew/connectivity/connectivity_algo.cpp index fba349a134..3b3cb16270 100644 --- a/pcbnew/connectivity/connectivity_algo.cpp +++ b/pcbnew/connectivity/connectivity_algo.cpp @@ -74,13 +74,11 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem ) m_itemList.SetDirty( true ); break; - case PCB_ZONE_AREA_T: - { + case PCB_ZONE_T: m_itemMap[aItem].MarkItemsAsInvalid(); m_itemMap.erase ( aItem ); m_itemList.SetDirty( true ); break; - } default: return false; @@ -174,9 +172,9 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem ) break; - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: { - auto zone = static_cast( aItem ); + ZONE* zone = static_cast( aItem ); if( m_itemMap.find( aItem ) != m_itemMap.end() ) return false; @@ -184,8 +182,10 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem ) m_itemMap[zone] = ITEM_MAP_ENTRY(); for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() ) - for( auto zitem : m_itemList.Add( zone, layer ) ) + { + for( CN_ITEM* zitem : m_itemList.Add( zone, layer ) ) m_itemMap[zone].Link( zitem ); + } break; } @@ -298,7 +298,7 @@ void CN_CONNECTIVITY_ALGO::searchConnections() const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUSTER_SEARCH_MODE aMode ) { - constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T, PCB_VIA_T, PCB_ZONE_AREA_T, + constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T, PCB_VIA_T, PCB_ZONE_T, PCB_MODULE_T, EOT }; constexpr KICAD_T no_zones[] = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T, PCB_VIA_T, PCB_MODULE_T, EOT }; @@ -438,7 +438,7 @@ void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter ) size *= 2; // Our caller us gets the other half of the progress bar - for( ZONE_CONTAINER* zone : aBoard->Zones() ) + for( ZONE* zone : aBoard->Zones() ) { Add( zone ); reportProgress( aReporter, ii++, size, delta ); @@ -550,8 +550,7 @@ void CN_CONNECTIVITY_ALGO::PropagateNets( BOARD_COMMIT* aCommit ) } -void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, - PCB_LAYER_ID aLayer, +void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE* aZone, PCB_LAYER_ID aLayer, std::vector& aIslands ) { if( aZone->GetFilledPolysList( aLayer ).IsEmpty() ) @@ -676,8 +675,8 @@ void CN_VISITOR::checkZoneItemConnection( CN_ZONE_LAYER* aZoneLayer, CN_ITEM* aI void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LAYER* aZoneLayerB ) { - const auto zoneA = static_cast( aZoneLayerA->Parent() ); - const auto zoneB = static_cast( aZoneLayerB->Parent() ); + const ZONE* zoneA = static_cast( aZoneLayerA->Parent() ); + const ZONE* zoneB = static_cast( aZoneLayerB->Parent() ); if( aZoneLayerA->Layer() != aZoneLayerB->Layer() ) return; @@ -754,20 +753,20 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate ) return true; // We should handle zone-zone connection separately - if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T ) + if ( parentA->Type() == PCB_ZONE_T && parentB->Type() == PCB_ZONE_T ) { checkZoneZoneConnection( static_cast( m_item ), static_cast( aCandidate ) ); return true; } - if( parentA->Type() == PCB_ZONE_AREA_T ) + if( parentA->Type() == PCB_ZONE_T ) { checkZoneItemConnection( static_cast( aCandidate ), m_item ); return true; } - if( parentB->Type() == PCB_ZONE_AREA_T ) + if( parentB->Type() == PCB_ZONE_T ) { checkZoneItemConnection( static_cast( m_item ), aCandidate ); return true; diff --git a/pcbnew/connectivity/connectivity_algo.h b/pcbnew/connectivity/connectivity_algo.h index 5818afde6f..52cb683afa 100644 --- a/pcbnew/connectivity/connectivity_algo.h +++ b/pcbnew/connectivity/connectivity_algo.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ class CN_RATSNEST_NODES; class BOARD; class BOARD_CONNECTED_ITEM; class BOARD_ITEM; -class ZONE_CONTAINER; +class ZONE; class PROGRESS_REPORTER; class CN_EDGE @@ -224,25 +224,25 @@ public: return m_dirtyNets.size(); } - void Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr ); - void Build( const std::vector& aItems ); + void Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr ); + void Build( const std::vector& aItems ); void Clear(); - bool Remove( BOARD_ITEM* aItem ); - bool Add( BOARD_ITEM* aItem ); + bool Remove( BOARD_ITEM* aItem ); + bool Add( BOARD_ITEM* aItem ); - const CLUSTERS SearchClusters( CLUSTER_SEARCH_MODE aMode, const KICAD_T aTypes[], int aSingleNet ); - const CLUSTERS SearchClusters( CLUSTER_SEARCH_MODE aMode ); + const CLUSTERS SearchClusters( CLUSTER_SEARCH_MODE aMode, const KICAD_T aTypes[], + int aSingleNet ); + const CLUSTERS SearchClusters( CLUSTER_SEARCH_MODE aMode ); /** * Propagates nets from pads to other items in clusters * @param aCommit is used to store undo information for items modified by the call */ - void PropagateNets( BOARD_COMMIT* aCommit = nullptr ); + void PropagateNets( BOARD_COMMIT* aCommit = nullptr ); - void FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, - std::vector& aIslands ); + void FindIsolatedCopperIslands( ZONE* aZone, PCB_LAYER_ID aLayer, std::vector& aIslands ); /** * Finds the copper islands that are not connected to a net. These are added to @@ -250,7 +250,7 @@ public: * N.B. This must be called after aZones has been refreshed. * @param: aZones The set of zones to search for islands */ - void FindIsolatedCopperIslands( std::vector& aZones ); + void FindIsolatedCopperIslands( std::vector& aZones ); const CLUSTERS& GetClusters(); diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index 16cf1e0bde..1ea4d0718c 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -257,8 +257,7 @@ int CONNECTIVITY_DATA::GetNetCount() const } -void CONNECTIVITY_DATA::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, - std::vector& aIslands ) +void CONNECTIVITY_DATA::FindIsolatedCopperIslands( ZONE* aZone, std::vector& aIslands ) { // TODO(JE) ZONES #if 0 diff --git a/pcbnew/connectivity/connectivity_data.h b/pcbnew/connectivity/connectivity_data.h index 2878906b2f..991cf4de07 100644 --- a/pcbnew/connectivity/connectivity_data.h +++ b/pcbnew/connectivity/connectivity_data.h @@ -36,7 +36,7 @@ #include #include -#include +#include class FROM_TO_CACHE; class CN_CLUSTER; @@ -46,7 +46,7 @@ class BOARD; class BOARD_COMMIT; class BOARD_CONNECTED_ITEM; class BOARD_ITEM; -class ZONE_CONTAINER; +class ZONE; class RN_DATA; class RN_NET; class TRACK; @@ -66,11 +66,11 @@ struct CN_DISJOINT_NET_ENTRY */ struct CN_ZONE_ISOLATED_ISLAND_LIST { - CN_ZONE_ISOLATED_ISLAND_LIST( ZONE_CONTAINER* aZone ) : + CN_ZONE_ISOLATED_ISLAND_LIST( ZONE* aZone ) : m_zone( aZone ) {} - ZONE_CONTAINER* m_zone; + ZONE* m_zone; std::map> m_islands; }; @@ -167,7 +167,7 @@ public: * @param aZone zone to test * @param aIslands list of islands that have no connections (outline indices in the polygon set) */ - void FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector& aIslands ); + void FindIsolatedCopperIslands( ZONE* aZone, std::vector& aIslands ); void FindIsolatedCopperIslands( std::vector& aZones ); /** diff --git a/pcbnew/connectivity/connectivity_items.cpp b/pcbnew/connectivity/connectivity_items.cpp index 2732688966..dc6b59cef3 100644 --- a/pcbnew/connectivity/connectivity_items.cpp +++ b/pcbnew/connectivity/connectivity_items.cpp @@ -166,8 +166,8 @@ int CN_ZONE_LAYER::AnchorCount() const if( !Valid() ) return 0; - const auto zone = static_cast( Parent() ); - const auto& outline = zone->GetFilledPolysList( m_layer ).COutline( m_subpolyIndex ); + const ZONE* zone = static_cast( Parent() ); + const SHAPE_LINE_CHAIN& outline = zone->GetFilledPolysList( m_layer ).COutline( m_subpolyIndex ); return outline.PointCount() ? 1 : 0; } @@ -178,8 +178,8 @@ const VECTOR2I CN_ZONE_LAYER::GetAnchor( int n ) const if( !Valid() ) return VECTOR2I(); - const auto zone = static_cast( Parent() ); - const auto& outline = zone->GetFilledPolysList( m_layer ).COutline( m_subpolyIndex ); + const ZONE* zone = static_cast( Parent() ); + const SHAPE_LINE_CHAIN& outline = zone->GetFilledPolysList( m_layer ).COutline( m_subpolyIndex ); return outline.CPoint( 0 ); } @@ -271,7 +271,7 @@ CN_ITEM* CN_LIST::Add( ARC* aArc ) return item; } - const std::vector CN_LIST::Add( ZONE_CONTAINER* zone, PCB_LAYER_ID aLayer ) + const std::vector CN_LIST::Add( ZONE* zone, PCB_LAYER_ID aLayer ) { const auto& polys = zone->GetFilledPolysList( aLayer ); @@ -367,9 +367,9 @@ bool CN_ANCHOR::IsDangling() const connected_count = 0; for( auto item : m_item->ConnectedItems() ) { - if( item->Parent()->Type() == PCB_ZONE_AREA_T ) + if( item->Parent()->Type() == PCB_ZONE_T ) { - ZONE_CONTAINER* zone = static_cast( item->Parent() ); + ZONE* zone = static_cast( item->Parent() ); if( zone->HitTestFilledArea( static_cast( item->Layer() ), wxPoint( Pos() ), accuracy ) ) @@ -390,17 +390,17 @@ int CN_ANCHOR::ConnectedItemsCount() const int connected_count = 0; - for( auto item : m_item->ConnectedItems() ) + for( CN_ITEM* item : m_item->ConnectedItems() ) { - if( item->Parent()->Type() == PCB_ZONE_AREA_T ) + if( item->Parent()->Type() == PCB_ZONE_T ) { - ZONE_CONTAINER* zone = static_cast( item->Parent() ); + ZONE* zone = static_cast( item->Parent() ); if( zone->HitTestFilledArea( static_cast( item->Layer() ), - wxPoint( Pos().x, Pos().y ) ) ) + (wxPoint) Pos() ) ) connected_count++; } - else if( item->Parent()->HitTest( wxPoint( Pos().x, Pos().y ) ) ) + else if( item->Parent()->HitTest( (wxPoint) Pos() ) ) connected_count++; } diff --git a/pcbnew/connectivity/connectivity_items.h b/pcbnew/connectivity/connectivity_items.h index a92ca51d98..02c354927c 100644 --- a/pcbnew/connectivity/connectivity_items.h +++ b/pcbnew/connectivity/connectivity_items.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -357,8 +357,7 @@ typedef std::shared_ptr CN_ITEM_PTR; class CN_ZONE_LAYER : public CN_ITEM { public: - CN_ZONE_LAYER( ZONE_CONTAINER* aParent, PCB_LAYER_ID aLayer, bool aCanChangeNet, - int aSubpolyIndex ) : + CN_ZONE_LAYER( ZONE* aParent, PCB_LAYER_ID aLayer, bool aCanChangeNet, int aSubpolyIndex ) : CN_ITEM( aParent, aCanChangeNet ), m_subpolyIndex( aSubpolyIndex ), m_layer( aLayer ) @@ -383,7 +382,7 @@ public: bool ContainsPoint( const VECTOR2I p, int aAccuracy = 0 ) const { - auto zone = static_cast ( Parent() ); + auto zone = static_cast( Parent() ); int clearance = aAccuracy; if( zone->GetFilledPolysUseThickness() ) @@ -512,7 +511,7 @@ public: CN_ITEM* Add( VIA* via ); - const std::vector Add( ZONE_CONTAINER* zone, PCB_LAYER_ID aLayer ); + const std::vector Add( ZONE* zone, PCB_LAYER_ID aLayer ); }; class CN_CLUSTER diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index c114e8aa6c..d0a5bed6f1 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -503,7 +503,7 @@ void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event ) // Export settings ( but layer and netcode ) to others copper zones BOARD* pcb = m_Parent->GetBoard(); - for( ZONE_CONTAINER* zone : pcb->Zones() ) + for( ZONE* zone : pcb->Zones() ) { // Cannot export settings from a copper zone // to a zone keepout: diff --git a/pcbnew/dialogs/dialog_dimension_properties.cpp b/pcbnew/dialogs/dialog_dimension_properties.cpp index c9e37141fa..eb5eafee78 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.cpp +++ b/pcbnew/dialogs/dialog_dimension_properties.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include #include @@ -48,8 +48,8 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a m_lblExtensionOffsetUnits ) { wxASSERT( BaseType( aItem->Type() ) == PCB_DIMENSION_T ); - m_dimension = static_cast( aItem ); - m_previewDimension = static_cast( m_dimension->Clone() ); + m_dimension = static_cast( aItem ); + m_previewDimension = static_cast( m_dimension->Clone() ); m_previewDimension->SetParent( m_frame->GetBoard() ); switch( m_dimension->Type() ) @@ -284,7 +284,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow() } -void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION* aTarget ) +void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION_BASE* aTarget ) { BOARD* board = m_frame->GetBoard(); diff --git a/pcbnew/dialogs/dialog_dimension_properties.h b/pcbnew/dialogs/dialog_dimension_properties.h index fda4a97b55..8aae0a3162 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.h +++ b/pcbnew/dialogs/dialog_dimension_properties.h @@ -28,7 +28,7 @@ class BOARD_ITEM; -class DIMENSION; +class DIMENSION_BASE; class PCB_BASE_EDIT_FRAME; @@ -46,13 +46,13 @@ protected: private: - PCB_BASE_EDIT_FRAME* m_frame; + PCB_BASE_EDIT_FRAME* m_frame; - DIMENSION* m_dimension; - DIMENSION* m_previewDimension; + DIMENSION_BASE* m_dimension; + DIMENSION_BASE* m_previewDimension; - PCB_LAYER_BOX_SELECTOR* m_cbLayerActual; // The active layer box control - wxTextCtrl* m_txtValueActual; // The active value control + PCB_LAYER_BOX_SELECTOR* m_cbLayerActual; // The active layer box control + wxTextCtrl* m_txtValueActual; // The active value control UNIT_BINDER m_textWidth; UNIT_BINDER m_textHeight; @@ -67,7 +67,7 @@ private: UNIT_BINDER m_arrowLength; UNIT_BINDER m_extensionOffset; - void updateDimensionFromDialog( DIMENSION* aTarget ); + void updateDimensionFromDialog( DIMENSION_BASE* aTarget ); void updatePreviewText(); }; diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 81982990c3..de4d49b0bb 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -32,7 +32,6 @@ using namespace std::placeholders; #include #include #include -#include #include #include #include diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index c87b9668bf..e3bf4d772c 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -270,10 +270,10 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B { aCommit.Modify( aItem ); - EDA_TEXT* textItem = dynamic_cast( aItem ); - FP_TEXT* fpTextItem = dynamic_cast( aItem ); - PCB_SHAPE* drawItem = dynamic_cast( aItem ); - DIMENSION* dimension = dynamic_cast( aItem ); + EDA_TEXT* textItem = dynamic_cast( aItem ); + FP_TEXT* fpTextItem = dynamic_cast( aItem ); + PCB_SHAPE* drawItem = dynamic_cast( aItem ); + DIMENSION_BASE* dimension = dynamic_cast( aItem ); if( dimension ) textItem = &dimension->Text(); diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index a4dfb4e25e..80b3f32600 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/pcbnew/dialogs/dialog_rule_area_properties.cpp b/pcbnew/dialogs/dialog_rule_area_properties.cpp index b8264c12cf..663d0523ed 100644 --- a/pcbnew/dialogs/dialog_rule_area_properties.cpp +++ b/pcbnew/dialogs/dialog_rule_area_properties.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/pcbnew/dialogs/dialog_swap_layers.cpp b/pcbnew/dialogs/dialog_swap_layers.cpp index b4d5ef6130..90cf6b4a4d 100644 --- a/pcbnew/dialogs/dialog_swap_layers.cpp +++ b/pcbnew/dialogs/dialog_swap_layers.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "dialog_swap_layers.h" diff --git a/pcbnew/dialogs/dialog_target_properties.cpp b/pcbnew/dialogs/dialog_target_properties.cpp index ff386f88fb..4dbb6af22a 100644 --- a/pcbnew/dialogs/dialog_target_properties.cpp +++ b/pcbnew/dialogs/dialog_target_properties.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/pcbnew/class_dimension.cpp b/pcbnew/dimension.cpp similarity index 93% rename from pcbnew/class_dimension.cpp rename to pcbnew/dimension.cpp index 61bf022122..8b7d1d67f5 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/dimension.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ #include -DIMENSION::DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) : +DIMENSION_BASE::DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) : BOARD_ITEM( aParent, aType ), m_overrideTextEnabled( false ), m_units( EDA_UNITS::INCHES ), @@ -58,14 +58,14 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) : } -void DIMENSION::SetParent( EDA_ITEM* aParent ) +void DIMENSION_BASE::SetParent( EDA_ITEM* aParent ) { BOARD_ITEM::SetParent( aParent ); m_text.SetParent( aParent ); } -void DIMENSION::updateText() +void DIMENSION_BASE::updateText() { wxString text = m_overrideTextEnabled ? m_valueString : GetValueText(); @@ -94,13 +94,13 @@ void DIMENSION::updateText() template -void DIMENSION::addShape( const ShapeType& aShape ) +void DIMENSION_BASE::addShape( const ShapeType& aShape ) { m_shapes.push_back( std::make_shared( aShape ) ); } -wxString DIMENSION::GetValueText() const +wxString DIMENSION_BASE::GetValueText() const { struct lconv* lc = localeconv(); wxChar sep = lc->decimal_point[0]; @@ -129,25 +129,25 @@ wxString DIMENSION::GetValueText() const } -void DIMENSION::SetPrefix( const wxString& aPrefix ) +void DIMENSION_BASE::SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; } -void DIMENSION::SetSuffix( const wxString& aSuffix ) +void DIMENSION_BASE::SetSuffix( const wxString& aSuffix ) { m_suffix = aSuffix; } -void DIMENSION::SetUnits( EDA_UNITS aUnits ) +void DIMENSION_BASE::SetUnits( EDA_UNITS aUnits ) { m_units = aUnits; } -DIM_UNITS_MODE DIMENSION::GetUnitsMode() const +DIM_UNITS_MODE DIMENSION_BASE::GetUnitsMode() const { if( m_autoUnits ) { @@ -171,7 +171,7 @@ DIM_UNITS_MODE DIMENSION::GetUnitsMode() const } -void DIMENSION::SetUnitsMode( DIM_UNITS_MODE aMode ) +void DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode ) { m_autoUnits = false; @@ -196,27 +196,27 @@ void DIMENSION::SetUnitsMode( DIM_UNITS_MODE aMode ) } -void DIMENSION::SetText( const wxString& aNewText ) +void DIMENSION_BASE::SetText( const wxString& aNewText ) { m_valueString = aNewText; updateText(); } -const wxString DIMENSION::GetText() const +const wxString DIMENSION_BASE::GetText() const { return m_text.GetText(); } -void DIMENSION::SetLayer( PCB_LAYER_ID aLayer ) +void DIMENSION_BASE::SetLayer( PCB_LAYER_ID aLayer ) { m_Layer = aLayer; m_text.SetLayer( aLayer ); } -void DIMENSION::Move( const wxPoint& offset ) +void DIMENSION_BASE::Move( const wxPoint& offset ) { m_text.Offset( offset ); @@ -227,7 +227,7 @@ void DIMENSION::Move( const wxPoint& offset ) } -void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle ) +void DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle ) { if( m_keepTextAligned ) m_keepTextAligned = false; @@ -243,7 +243,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle ) } -void DIMENSION::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) { Mirror( aCentre ); @@ -253,7 +253,7 @@ void DIMENSION::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void DIMENSION::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight ) +void DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight ) { int axis = aMirrorLeftRight ? axis_pos.x : axis_pos.y; wxPoint newPos = m_text.GetTextPos(); @@ -286,21 +286,21 @@ void DIMENSION::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight ) } -void DIMENSION::SetStart( const wxPoint& aOrigin ) +void DIMENSION_BASE::SetStart( const wxPoint& aOrigin ) { m_start = aOrigin; Update(); } -void DIMENSION::SetEnd( const wxPoint& aEnd ) +void DIMENSION_BASE::SetEnd( const wxPoint& aEnd ) { m_end = aEnd; Update(); } -void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { // for now, display only the text within the DIMENSION using class PCB_TEXT. wxString msg; @@ -360,7 +360,7 @@ void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector DIMENSION::GetEffectiveShape( PCB_LAYER_ID aLayer ) const +std::shared_ptr DIMENSION_BASE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const { std::shared_ptr effectiveShape = std::make_shared(); @@ -373,7 +373,7 @@ std::shared_ptr DIMENSION::GetEffectiveShape( PCB_LAYER_ID aLayer ) const } -bool DIMENSION::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool DIMENSION_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const { if( m_text.TextHitTest( aPosition ) ) return true; @@ -392,7 +392,7 @@ bool DIMENSION::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -bool DIMENSION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const +bool DIMENSION_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const { EDA_RECT arect = aRect; arect.Inflate( aAccuracy ); @@ -409,7 +409,7 @@ bool DIMENSION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) } -const EDA_RECT DIMENSION::GetBoundingBox() const +const EDA_RECT DIMENSION_BASE::GetBoundingBox() const { EDA_RECT bBox; int xmin, xmax, ymin, ymax; @@ -442,7 +442,7 @@ const EDA_RECT DIMENSION::GetBoundingBox() const } -wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const +wxString DIMENSION_BASE::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Dimension '%s' on %s" ), GetText(), @@ -451,7 +451,7 @@ wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const -const BOX2I DIMENSION::ViewBBox() const +const BOX2I DIMENSION_BASE::ViewBBox() const { BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ), VECTOR2I( GetBoundingBox().GetSize() ) ); @@ -461,7 +461,7 @@ const BOX2I DIMENSION::ViewBBox() const } -OPT_VECTOR2I DIMENSION::segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart ) +OPT_VECTOR2I DIMENSION_BASE::segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart ) { VECTOR2I start( aStart ? aSeg.A : aSeg.B ); VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A ); @@ -486,7 +486,7 @@ OPT_VECTOR2I DIMENSION::segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, b ALIGNED_DIMENSION::ALIGNED_DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) : - DIMENSION( aParent, aType ), + DIMENSION_BASE( aParent, aType ), m_height( 0 ) { // To preserve look of old dimensions, initialize extension height based on default arrow length @@ -659,7 +659,7 @@ void ALIGNED_DIMENSION::updateText() m_text.SetTextAngle( textAngle ); } - DIMENSION::updateText(); + DIMENSION_BASE::updateText(); } @@ -830,12 +830,12 @@ void ORTHOGONAL_DIMENSION::updateText() m_text.SetTextAngle( textAngle ); } - DIMENSION::updateText(); + DIMENSION_BASE::updateText(); } LEADER::LEADER( BOARD_ITEM* aParent ) : - DIMENSION( aParent, PCB_DIM_LEADER_T ), + DIMENSION_BASE( aParent, PCB_DIM_LEADER_T ), m_textFrame( DIM_TEXT_FRAME::NONE ) { m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX; @@ -964,7 +964,7 @@ void LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector( _HKI( "Height" ), //&DIMENSION::SetHeight, &DIMENSION::GetHeight, PROPERTY_DISPLAY::DISTANCE ) ); diff --git a/pcbnew/class_dimension.h b/pcbnew/dimension.h similarity index 97% rename from pcbnew/class_dimension.h rename to pcbnew/dimension.h index 99de756ce5..d786bf1d4b 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/dimension.h @@ -22,13 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file class_dimension.h - * @brief DIMENSION class definition. - */ - -#ifndef DIMENSION_H_ -#define DIMENSION_H_ +#ifndef DIMENSION_H +#define DIMENSION_H #include @@ -97,10 +92,10 @@ enum class DIM_TEXT_FRAME * - "crossbar" refers to the perpendicular line (usually with arrows at each end) between feature * lines on linear dimensions */ -class DIMENSION : public BOARD_ITEM +class DIMENSION_BASE : public BOARD_ITEM { public: - DIMENSION( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T ); + DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T ); bool IsType( const KICAD_T aScanTypes[] ) const override { @@ -160,11 +155,7 @@ public: wxString GetSuffix() const { return m_suffix; } void SetSuffix( const wxString& aSuffix ); - void GetUnits( EDA_UNITS& aUnits ) const - { - aUnits = m_units; - } - + void GetUnits( EDA_UNITS& aUnits ) const { aUnits = m_units; } void SetUnits( EDA_UNITS aUnits ); DIM_UNITS_MODE GetUnitsMode() const; @@ -335,7 +326,7 @@ protected: * The height (distance from features to crossbar) can be set directly, or set by manipulating the * crossbar start or end point (with the point editor). */ -class ALIGNED_DIMENSION : public DIMENSION +class ALIGNED_DIMENSION : public DIMENSION_BASE { protected: // Geometry @@ -476,7 +467,7 @@ protected: * Point (a) is m_start, point (b) is m_end, point (c) is the end of the "text line" * The b-c line is drawn from b to the text center, and clipped on the text bounding box. */ -class LEADER : public DIMENSION +class LEADER : public DIMENSION_BASE { DIM_TEXT_FRAME m_textFrame; @@ -515,7 +506,7 @@ protected: * The size and orientation of the cross is adjustable. * m_start always marks the center being measured; m_end marks the end of one leg of the cross. */ -class CENTER_DIMENSION : public DIMENSION +class CENTER_DIMENSION : public DIMENSION_BASE { public: @@ -546,4 +537,4 @@ protected: void updateGeometry() override; }; -#endif // DIMENSION_H_ +#endif // DIMENSION_H diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 80c182d09b..f2920b5bdf 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -85,9 +85,9 @@ DRC_ENGINE::~DRC_ENGINE() static bool isKeepoutZone( const BOARD_ITEM* aItem ) { - if( aItem && ( aItem->Type() == PCB_ZONE_AREA_T || aItem->Type() == PCB_FP_ZONE_AREA_T ) ) + if( aItem && ( aItem->Type() == PCB_ZONE_T || aItem->Type() == PCB_FP_ZONE_T ) ) { - const ZONE_CONTAINER* zone = static_cast( aItem ); + const ZONE* zone = static_cast( aItem ); return zone->GetIsRuleArea() && ( zone->GetDoNotAllowTracks() || zone->GetDoNotAllowVias() @@ -357,9 +357,9 @@ void DRC_ENGINE::loadImplicitRules() rule->AddConstraint( disallowConstraint ); }; - std::vector keepoutZones; + std::vector keepoutZones; - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( isKeepoutZone( zone ) ) keepoutZones.push_back( zone ); @@ -367,14 +367,14 @@ void DRC_ENGINE::loadImplicitRules() for( MODULE* footprint : m_board->Modules() ) { - for( ZONE_CONTAINER* zone : footprint->Zones() ) + for( ZONE* zone : footprint->Zones() ) { if( isKeepoutZone( zone ) ) keepoutZones.push_back( zone ); } } - for( ZONE_CONTAINER* zone : keepoutZones ) + for( ZONE* zone : keepoutZones ) { wxString name = zone->GetZoneName(); @@ -656,12 +656,12 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT m_errorLimits[ ii ] = INT_MAX; } - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) zone->CacheBoundingBox(); for( MODULE* module : m_board->Modules() ) { - for( ZONE_CONTAINER* zone : module->Zones() ) + for( ZONE* zone : module->Zones() ) zone->CacheBoundingBox(); module->BuildPolyCourtyards(); @@ -829,8 +829,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI case PCB_FP_SHAPE_T: mask = DRC_DISALLOW_GRAPHICS; break; case PCB_TEXT_T: mask = DRC_DISALLOW_TEXTS; break; case PCB_FP_TEXT_T: mask = DRC_DISALLOW_TEXTS; break; - case PCB_ZONE_AREA_T: mask = DRC_DISALLOW_ZONES; break; - case PCB_FP_ZONE_AREA_T: mask = DRC_DISALLOW_ZONES; break; + case PCB_ZONE_T: mask = DRC_DISALLOW_ZONES; break; + case PCB_FP_ZONE_T: mask = DRC_DISALLOW_ZONES; break; case PCB_LOCATE_HOLE_T: mask = DRC_DISALLOW_HOLES; break; default: mask = 0; break; } diff --git a/pcbnew/drc/drc_engine.h b/pcbnew/drc/drc_engine.h index b9aeca1913..14207779a1 100644 --- a/pcbnew/drc/drc_engine.h +++ b/pcbnew/drc/drc_engine.h @@ -36,7 +36,6 @@ class DRC_TEST_PROVIDER; class PCB_EDIT_FRAME; class BOARD_ITEM; class BOARD; -class ZONE_CONTAINER; class MARKER_PCB; class NETCLASS; class NETLIST; diff --git a/pcbnew/drc/drc_rtree.h b/pcbnew/drc/drc_rtree.h index f53b0a0231..98e5719f6e 100644 --- a/pcbnew/drc/drc_rtree.h +++ b/pcbnew/drc/drc_rtree.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index 5ee7ef009f..df67d8b402 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include @@ -140,7 +140,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, { s_allBasicItems.push_back( (KICAD_T) i ); - if( i != PCB_ZONE_AREA_T && i != PCB_FP_ZONE_AREA_T ) + if( i != PCB_ZONE_T && i != PCB_FP_ZONE_T ) s_allBasicItemsButZones.push_back( (KICAD_T) i ); } } @@ -214,9 +214,9 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, } } - if( typeMask[ PCB_ZONE_AREA_T ] ) + if( typeMask[ PCB_ZONE_T ] ) { - for( ZONE_CONTAINER* item : brd->Zones() ) + for( ZONE* item : brd->Zones() ) { if( (item->GetLayerSet() & aLayers).any() ) { @@ -284,9 +284,9 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, } } - if( typeMask[ PCB_FP_ZONE_AREA_T ] ) + if( typeMask[ PCB_FP_ZONE_T ] ) { - for( ZONE_CONTAINER* zone : mod->Zones() ) + for( ZONE* zone : mod->Zones() ) { if( (zone->GetLayerSet() & aLayers).any() ) { diff --git a/pcbnew/drc/drc_test_provider_connectivity.cpp b/pcbnew/drc/drc_test_provider_connectivity.cpp index 3119ebf0f6..f67235c144 100644 --- a/pcbnew/drc/drc_test_provider_connectivity.cpp +++ b/pcbnew/drc/drc_test_provider_connectivity.cpp @@ -117,7 +117,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run() } /* test starved zones */ - for( ZONE_CONTAINER* zone : board->Zones() ) + for( ZONE* zone : board->Zones() ) { if( m_drcEngine->IsErrorLimitExceeded( DRCE_ZONE_HAS_EMPTY_NET ) ) break; diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 9ac9589611..1f5bff74f4 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include /* Copper clearance test. Checks all copper items (pads, vias, tracks, drawings, zones) for their electrical clearance. @@ -96,8 +96,8 @@ private: DRC_RTREE m_copperTree; int m_drcEpsilon; - std::vector m_zones; - std::map> m_zoneTrees; + std::vector m_zones; + std::map> m_zoneTrees; }; @@ -121,7 +121,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run() m_zones.clear(); - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( !zone->GetIsRuleArea() ) m_zones.push_back( zone ); @@ -129,7 +129,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run() for( MODULE* footprint : m_board->Modules() ) { - for( ZONE_CONTAINER* zone : footprint->Zones() ) + for( ZONE* zone : footprint->Zones() ) { if( !zone->GetIsRuleArea() ) m_zones.push_back( zone ); @@ -186,7 +186,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run() ii = 0; m_zoneTrees.clear(); - for( ZONE_CONTAINER* zone : m_zones ) + for( ZONE* zone : m_zones ) { if( !reportProgress( ii++, m_zones.size(), delta ) ) break; @@ -308,7 +308,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( TRACK* track, SHA void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer ) { - for( ZONE_CONTAINER* zone : m_zones ) + for( ZONE* zone : m_zones ) { if( m_drcEngine->IsErrorLimitExceeded( DRCE_CLEARANCE ) ) break; @@ -588,7 +588,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones() if( !reportProgress( layer_id * m_zones.size() + ia, B_Cu * m_zones.size(), delta ) ) break; - ZONE_CONTAINER* zoneRef = m_zones[ia]; + ZONE* zoneRef = m_zones[ia]; if( !zoneRef->IsOnLayer( layer ) ) continue; @@ -597,7 +597,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones() // Otherwise, we have already tested the zone combination for( size_t ia2 = ia + 1; ia2 < m_zones.size(); ia2++ ) { - ZONE_CONTAINER* zoneToTest = m_zones[ia2]; + ZONE* zoneToTest = m_zones[ia2]; if( zoneRef == zoneToTest ) continue; diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index d7db7707f2..6687eea81a 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -321,7 +321,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() return true; }; - forEachGeometryItem( { PCB_TRACE_T, PCB_VIA_T, PCB_PAD_T, PCB_ZONE_AREA_T, PCB_ARC_T }, + forEachGeometryItem( { PCB_TRACE_T, PCB_VIA_T, PCB_PAD_T, PCB_ZONE_T, PCB_ARC_T }, LSET::AllCuMask(), addToTree ); diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index 2fcc48f0ea..150ac5e546 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -145,7 +145,7 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers() }; // fixme: what about graphical items? - forEachGeometryItem( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_ZONE_AREA_T, PCB_PAD_T }, + forEachGeometryItem( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_ZONE_T, PCB_PAD_T }, LSET::AllLayersMask(), checkDisabledLayers ); } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index a612395e62..1f7e4ff132 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -33,9 +33,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -142,7 +142,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - ShowDimensionPropertiesDialog( static_cast( aItem ) ); + ShowDimensionPropertiesDialog( static_cast( aItem ) ); break; case PCB_FP_TEXT_T: @@ -153,8 +153,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) ShowGraphicItemPropertiesDialog( aItem ); break; - case PCB_ZONE_AREA_T: - Edit_Zone_Params( static_cast( aItem ) ); + case PCB_ZONE_T: + Edit_Zone_Params( static_cast( aItem ) ); break; case PCB_GROUP_T: @@ -167,7 +167,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) } -void PCB_EDIT_FRAME::ShowDimensionPropertiesDialog( DIMENSION* aDimension ) +void PCB_EDIT_FRAME::ShowDimensionPropertiesDialog( DIMENSION_BASE* aDimension ) { if( aDimension == NULL ) return; diff --git a/pcbnew/exporters/export_hyperlynx.cpp b/pcbnew/exporters/export_hyperlynx.cpp index 853ea12ab6..09dfc14212 100644 --- a/pcbnew/exporters/export_hyperlynx.cpp +++ b/pcbnew/exporters/export_hyperlynx.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -473,7 +473,7 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector& aObjec iu2hyp( track->GetEnd().x ), iu2hyp( track->GetEnd().y ), iu2hyp( track->GetWidth() ), (const char*) layerName.c_str() ); } - else if( ZONE_CONTAINER* zone = dyn_cast( item ) ) + else if( ZONE* zone = dyn_cast( item ) ) { for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() ) { @@ -561,7 +561,7 @@ const std::vector HYPERLYNX_EXPORTER::collectNetObjects( int netcod rv.push_back( item ); } - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( check( zone ) ) rv.push_back( zone ); diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index 9428c1f4ec..787a701589 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -37,7 +37,7 @@ #include "class_module.h" #include "pcb_text.h" #include "class_track.h" -#include "class_zone.h" +#include "zone.h" #include "convert_to_biu.h" #include #include "plugins/3dapi/ifsg_all.h" @@ -1002,7 +1002,7 @@ static void export_vrml_tracks( MODEL_VRML& aModel, BOARD* pcb ) static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb, COMMIT* aCommit ) { - for( ZONE_CONTAINER* zone : aPcb->Zones() ) + for( ZONE* zone : aPcb->Zones() ) { for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() ) { @@ -1017,7 +1017,7 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb, COMMIT* aCommit zone->SetFillMode( ZONE_FILL_MODE::POLYGONS ); // use filled polygons // If the zone fill failed, don't try adding it to the export - std::vector toFill = { zone }; + std::vector toFill = { zone }; if( !filler.Fill( toFill ) ) continue; diff --git a/pcbnew/exporters/gerber_jobfile_writer.cpp b/pcbnew/exporters/gerber_jobfile_writer.cpp index 8677eb9cbe..67d100135a 100644 --- a/pcbnew/exporters/gerber_jobfile_writer.cpp +++ b/pcbnew/exporters/gerber_jobfile_writer.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include @@ -514,7 +514,7 @@ void GERBER_JOBFILE_WRITER::addJSONDesignRules() minclearanceOuter = INT_MAX; minclearanceInner = INT_MAX; - for( ZONE_CONTAINER* zone : m_pcb->Zones() ) + for( ZONE* zone : m_pcb->Zones() ) { if( zone->GetIsRuleArea() || !zone->IsOnCopperLayer() ) continue; diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 7c9b6f41e8..395814a353 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -177,13 +177,13 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) case PCB_FP_SHAPE_T :ShowGraphicItemPropertiesDialog( aItem ); break; - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: { - ZONE_CONTAINER* zone = static_cast( aItem ); - bool success = false; - ZONE_SETTINGS zoneSettings; + ZONE* zone = static_cast( aItem ); + bool success = false; + ZONE_SETTINGS zoneSettings; - zoneSettings << *static_cast( aItem ); + zoneSettings << *static_cast( aItem ); if( zone->GetIsRuleArea() ) { @@ -203,7 +203,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) BOARD_COMMIT commit( this ); commit.Modify( zone ); commit.Push( _( "Edit Zone" ) ); - zoneSettings.ExportSetting( *static_cast( aItem ) ); + zoneSettings.ExportSetting( *static_cast( aItem ) ); } } break; diff --git a/pcbnew/fp_text.h b/pcbnew/fp_text.h index d1e26e8b01..cb24e64f31 100644 --- a/pcbnew/fp_text.h +++ b/pcbnew/fp_text.h @@ -25,11 +25,9 @@ #ifndef FP_TEXT_H #define FP_TEXT_H - #include #include - class LINE_READER; class EDA_RECT; class MODULE; @@ -37,8 +35,6 @@ class MSG_PANEL_ITEM; class PCB_BASE_FRAME; class SHAPE; -#define UMBILICAL_COLOR LIGHTBLUE - class FP_TEXT : public BOARD_ITEM, public EDA_TEXT { diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 522749833a..52abce879d 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -199,11 +199,11 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE footprint->Add( pad ); copy = footprint; } - else if( item->Type() == PCB_FP_ZONE_AREA_T ) + else if( item->Type() == PCB_FP_ZONE_T ) { - // Convert to PCB_ZONE_AREA_T - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); - zone->InitDataFromSrcInCopyCtor( *static_cast( item ) ); + // Convert to PCB_ZONE_T + ZONE* zone = new ZONE( m_board ); + zone->InitDataFromSrcInCopyCtor( *static_cast( item ) ); copy = zone; } else if( item->Type() == PCB_GROUP_T ) diff --git a/pcbnew/netinfo_list.cpp b/pcbnew/netinfo_list.cpp index 243e97be4f..f3aa96afaf 100644 --- a/pcbnew/netinfo_list.cpp +++ b/pcbnew/netinfo_list.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include @@ -210,7 +210,7 @@ void NETINFO_MAPPING::Update() nets.insert( 0 ); // Zones - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) nets.insert( zone->GetNetCode() ); // Tracks diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index 81aaf056d2..ed084be428 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include "pcb_netlist.h" @@ -483,7 +483,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent void BOARD_NETLIST_UPDATER::cacheCopperZoneConnections() { - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() ) continue; @@ -556,7 +556,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist ) } // Test copper zones to detect "dead" nets (nets without any pad): - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() ) continue; @@ -686,7 +686,7 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets() // First, see if we have a copper zone attached to this pad. // If so, this is not really a single pad net - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { if( !zone->IsOnCopperLayer() ) continue; diff --git a/pcbnew/netlist_reader/board_netlist_updater.h b/pcbnew/netlist_reader/board_netlist_updater.h index d276dec7c8..c06da81cc8 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.h +++ b/pcbnew/netlist_reader/board_netlist_updater.h @@ -156,12 +156,12 @@ private: BOARD* m_board; REPORTER* m_reporter; - std::map< ZONE_CONTAINER*, std::vector > m_zoneConnectionsCache; - std::map< wxString, wxString> m_oldToNewNets; - std::map< D_PAD*, wxString > m_padNets; - std::map< D_PAD*, wxString > m_padPinFunctions; - std::vector m_addedComponents; - std::map m_addedNets; + std::map> m_zoneConnectionsCache; + std::map m_oldToNewNets; + std::map m_padNets; + std::map m_padPinFunctions; + std::vector m_addedComponents; + std::map m_addedNets; bool m_deleteSinglePadNets; bool m_deleteUnusedComponents; diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index aff000715a..ad886ac378 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include @@ -175,7 +175,7 @@ void PCB_BASE_EDIT_FRAME::unitsChangeRefresh() INSPECTOR_FUNC inspector = [units, view]( EDA_ITEM* aItem, void* aTestData ) { - DIMENSION* dimension = static_cast( aItem ); + DIMENSION_BASE* dimension = static_cast( aItem ); if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC ) { diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index c36f906f1d..72448d6bca 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -42,10 +42,10 @@ class VIA; class D_PAD; class PCB_TARGET; class PCB_GROUP; -class DIMENSION; +class DIMENSION_BASE; class DRC; class DIALOG_PLOT; -class ZONE_CONTAINER; +class ZONE; class GENERAL_COLLECTOR; class GENERAL_COLLECTORS_GUIDE; class SELECTION; @@ -785,12 +785,11 @@ public: * Function Edit_Zone_Params * Edit params (layer, clearance, ...) for a zone outline */ - void Edit_Zone_Params( ZONE_CONTAINER* zone_container ); + void Edit_Zone_Params( ZONE* zone_container ); // Properties dialogs void ShowTargetOptionsDialog( PCB_TARGET* aTarget ); - void ShowDimensionPropertiesDialog( DIMENSION* aDimension ); - void ShowGroupPropertiesDialog( PCB_GROUP* aGroup ); + void ShowDimensionPropertiesDialog( DIMENSION_BASE* aDimension ); void InstallNetlistFrame(); /** diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 9489eba2a2..4184d5204f 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -218,7 +218,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) return; auto insideZone = - [&]( ZONE_CONTAINER* zone ) -> bool + [&]( ZONE* zone ) -> bool { if( !zone ) return false; @@ -297,19 +297,19 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) if( arg->AsString() == "A" ) { - if( insideZone( dynamic_cast( context->GetItem( 0 ) ) ) ) + if( insideZone( dynamic_cast( context->GetItem( 0 ) ) ) ) result->Set( 1.0 ); } else if( arg->AsString() == "B" ) { - if( insideZone( dynamic_cast( context->GetItem( 1 ) ) ) ) + if( insideZone( dynamic_cast( context->GetItem( 1 ) ) ) ) result->Set( 1.0 ); } else if( KIID::SniffTest( arg->AsString() ) ) { KIID target( arg->AsString() ); - for( ZONE_CONTAINER* candidate : item->GetBoard()->Zones() ) + for( ZONE* candidate : item->GetBoard()->Zones() ) { // Only a single zone can match the UUID; exit once we find a match whether // "inside" or not @@ -324,7 +324,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) for( MODULE* module : item->GetBoard()->Modules() ) { - for( ZONE_CONTAINER* candidate : module->Zones() ) + for( ZONE* candidate : module->Zones() ) { // Only a single zone can match the UUID; exit once we find a match whether // "inside" or not @@ -340,7 +340,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) } else // Match on zone name { - for( ZONE_CONTAINER* candidate : item->GetBoard()->Zones() ) + for( ZONE* candidate : item->GetBoard()->Zones() ) { if( candidate->GetZoneName().Matches( arg->AsString() ) ) { @@ -355,7 +355,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) for( MODULE* module : item->GetBoard()->Modules() ) { - for( ZONE_CONTAINER* candidate : module->Zones() ) + for( ZONE* candidate : module->Zones() ) { // Many zones can match the name; exit only when we find an "inside" if( candidate->GetZoneName().Matches( arg->AsString() ) ) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index a87036063d..2380bf23e6 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -30,11 +30,11 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include @@ -229,7 +229,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons const BOARD_CONNECTED_ITEM* conItem = dynamic_cast ( aItem ); // Zones should pull from the copper layer - if( item && item->Type() == PCB_ZONE_AREA_T && IsZoneLayer( aLayer ) ) + if( item && item->Type() == PCB_ZONE_T && IsZoneLayer( aLayer ) ) aLayer = aLayer - LAYER_ZONE_START; // Marker shadows @@ -356,7 +356,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons color.a *= m_viaOpacity; else if( item->Type() == PCB_PAD_T ) color.a *= m_padOpacity; - else if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T ) + else if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) color.a *= m_zoneOpacity; // No special modificators enabled @@ -447,19 +447,19 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) draw( static_cast( item ), aLayer ); break; - case PCB_ZONE_AREA_T: - draw( static_cast( item ), aLayer ); + case PCB_ZONE_T: + draw( static_cast( item ), aLayer ); break; - case PCB_FP_ZONE_AREA_T: - draw( static_cast( item ), aLayer ); + case PCB_FP_ZONE_T: + draw( static_cast( item ), aLayer ); break; case PCB_DIM_ALIGNED_T: case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - draw( static_cast( item ), aLayer ); + draw( static_cast( item ), aLayer ); break; case PCB_TARGET_T: @@ -1381,7 +1381,7 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer ) } -void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone, int aLayer ) +void PCB_PAINTER::draw( const ZONE* aZone, int aLayer ) { /** * aLayer will be the virtual zone layer (LAYER_ZONE_START, ... in GAL_LAYER_ID) @@ -1465,7 +1465,7 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone, int aLayer ) } -void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer ) +void PCB_PAINTER::draw( const DIMENSION_BASE* aDimension, int aLayer ) { const COLOR4D& strokeColor = m_pcbSettings.GetColor( aDimension, aLayer ); diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index e0d48b3da1..b8dcebab7b 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -44,10 +44,10 @@ class D_PAD; class PCB_SHAPE; class PCB_GROUP; class MODULE; -class ZONE_CONTAINER; +class ZONE; class PCB_TEXT; class FP_TEXT; -class DIMENSION; +class DIMENSION_BASE; class PCB_TARGET; class MARKER_PCB; class NET_SETTINGS; @@ -290,8 +290,8 @@ protected: void draw( const FP_TEXT* aText, int aLayer ); void draw( const MODULE* aModule, int aLayer ); void draw( const PCB_GROUP* aGroup, int aLayer ); - void draw( const ZONE_CONTAINER* aZone, int aLayer ); - void draw( const DIMENSION* aDimension, int aLayer ); + void draw( const ZONE* aZone, int aLayer ); + void draw( const DIMENSION_BASE* aDimension, int aLayer ); void draw( const PCB_TARGET* aTarget ); void draw( const MARKER_PCB* aMarker, int aLayer ); diff --git a/pcbnew/class_pcb_target.cpp b/pcbnew/pcb_target.cpp similarity index 94% rename from pcbnew/class_pcb_target.cpp rename to pcbnew/pcb_target.cpp index c0ac2a6a9d..3d4290aaa9 100644 --- a/pcbnew/class_pcb_target.cpp +++ b/pcbnew/pcb_target.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,14 +24,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file class_pcb_target.cpp - * PCB_TARGET class definition - targets for photo plots, formerly called MIRE (from French 'mire optique') - */ - #include #include -#include +#include #include #include #include diff --git a/pcbnew/class_pcb_target.h b/pcbnew/pcb_target.h similarity index 95% rename from pcbnew/class_pcb_target.h rename to pcbnew/pcb_target.h index 868b0a5ee7..6a1207bdee 100644 --- a/pcbnew/class_pcb_target.h +++ b/pcbnew/pcb_target.h @@ -22,13 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file class_pcb_target.h - * @brief PCB_TARGET class definition. (targets for photo plots). - */ - -#ifndef PCB_TARGET_H_ -#define PCB_TARGET_H_ +#ifndef PCB_TARGET_H +#define PCB_TARGET_H #include diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 7e2d7634aa..f97a246414 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -41,12 +41,12 @@ class PLOTTER; class PCB_TEXT; class D_PAD; class PCB_SHAPE; -class DIMENSION; +class DIMENSION_BASE; class MODULE; class FP_SHAPE; class PCB_TARGET; class FP_TEXT; -class ZONE_CONTAINER; +class ZONE; class BOARD; class REPORTER; class wxFileName; @@ -100,9 +100,9 @@ public: */ void PlotFootprintTextItems( MODULE* aModule ); - void PlotDimension( DIMENSION* Dimension ); + void PlotDimension( DIMENSION_BASE* Dimension ); void PlotPcbTarget( PCB_TARGET* PtMire ); - void PlotFilledAreas( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aPolysList ); + void PlotFilledAreas( ZONE* aZone, SHAPE_POLY_SET& aPolysList ); void PlotPcbText( PCB_TEXT* aText ); void PlotPcbShape( PCB_SHAPE* aShape ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 22eccee177..6189f4195b 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -40,10 +40,10 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include @@ -487,7 +487,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, NETINFO_ITEM nonet( aBoard ); - for( ZONE_CONTAINER* zone : aBoard->Zones() ) + for( ZONE* zone : aBoard->Zones() ) { for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() ) { @@ -510,7 +510,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, if( !islands.IsEmpty() ) { - ZONE_CONTAINER dummy( *zone ); + ZONE dummy( *zone ); dummy.SetNet( &nonet ); itemplotter.PlotFilledAreas( &dummy, islands ); } @@ -809,7 +809,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, int zone_margin = 0; #endif - for( ZONE_CONTAINER* zone : aBoard->Zones() ) + for( ZONE* zone : aBoard->Zones() ) { if( zone->GetLayer() != layer ) continue; @@ -829,12 +829,12 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, } #if !NEW_ALGO - // To avoid a lot of code, use a ZONE_CONTAINER to handle and plot polygons, because our - // polygons look exactly like filled areas in zones. + // To avoid a lot of code, use a ZONE to handle and plot polygons, because our polygons look + // exactly like filled areas in zones. // Note, also this code is not optimized: it creates a lot of copy/duplicate data. // However it is not complex, and fast enough for plot purposes (copy/convert data is only a // very small calculation time for these calculations). - ZONE_CONTAINER zone( aBoard ); + ZONE zone( aBoard ); zone.SetMinThickness( 0 ); // trace polygons only zone.SetLayer( layer ); // Combine the current areas to initial areas. This is mandatory because inflate/deflate diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 9758fd7967..5d6f27d396 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -53,16 +53,16 @@ #include #include // for BOARD_ITEM, S_CIRCLE -#include +#include #include #include #include #include // for FP_TEXT #include #include // for D_PAD -#include +#include #include -#include +#include #include // for wxASSERT_MSG #include // for wxPoint, wxSize, wxArra... @@ -357,7 +357,7 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems() case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: if( item->GetLayer() != Edge_Cuts ) - PlotDimension( (DIMENSION*) item ); + PlotDimension( (DIMENSION_BASE*) item ); break; @@ -406,7 +406,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( FP_TEXT* aTextMod, COLOR4D aColor } -void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) +void BRDITEMS_PLOTTER::PlotDimension( DIMENSION_BASE* aDim ) { if( !m_layerMask[aDim->GetLayer()] ) return; @@ -746,7 +746,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( PCB_TEXT* aText ) } -void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& polysList ) +void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE* aZone, SHAPE_POLY_SET& polysList ) { if( polysList.IsEmpty() ) return; diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index a973160b50..eee5514f60 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -1226,7 +1226,7 @@ void ALTIUM_PCB::ParsePolygons6Data( continue; } - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); m_polygons.emplace_back( zone ); @@ -1313,7 +1313,7 @@ void ALTIUM_PCB::ParsePolygons6Data( } zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); } if( reader.GetRemainingBytes() != 0 ) @@ -1391,7 +1391,7 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( continue; } - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); zone->SetIsRuleArea( true ); @@ -1423,7 +1423,7 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( } zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); } else if( elem.kind == ALTIUM_REGION_KIND::COPPER ) { @@ -1477,12 +1477,10 @@ void ALTIUM_PCB::ParseRegions6Data( { ALTIUM_PARSER reader( aReader, aEntry ); - for( ZONE_CONTAINER* zone : m_polygons ) + for( ZONE* zone : m_polygons ) { - if( zone != nullptr ) - { + if( zone ) zone->UnFill(); // just to be sure - } } while( reader.GetRemainingBytes() >= 4 /* TODO: use Header section of file */ ) @@ -1499,7 +1497,7 @@ void ALTIUM_PCB::ParseRegions6Data( elem.subpolyindex, m_polygons.size() ) ); } - ZONE_CONTAINER *zone = m_polygons.at(elem.subpolyindex); + ZONE *zone = m_polygons.at( elem.subpolyindex ); if( zone == nullptr ) { @@ -1571,7 +1569,7 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, shape.SetArcStart( elem.center + arcStartOffset ); } - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); zone->SetIsRuleArea( true ); @@ -1604,7 +1602,7 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, zone->Outline()->Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); // the outline is not a single polygon! zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); continue; } @@ -2143,7 +2141,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader, shape.SetEnd( elem.end ); shape.SetWidth( elem.width ); - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); zone->SetIsRuleArea( true ); @@ -2175,7 +2173,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader, ERROR_INSIDE ); zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); continue; } @@ -2425,7 +2423,7 @@ void ALTIUM_PCB::ParseFills6Data( if( elem.is_keepout || elem.net != ALTIUM_NET_UNCONNECTED ) { - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); zone->SetNetCode( GetNetCode( elem.net ) ); @@ -2457,7 +2455,7 @@ void ALTIUM_PCB::ParseFills6Data( zone->Rotate( center, elem.rotation * 10 ); zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); } else { diff --git a/pcbnew/plugins/altium/altium_pcb.h b/pcbnew/plugins/altium/altium_pcb.h index e6350c31c8..bae3ecdaee 100644 --- a/pcbnew/plugins/altium/altium_pcb.h +++ b/pcbnew/plugins/altium/altium_pcb.h @@ -84,7 +84,7 @@ enum class ALTIUM_PCB_DIR class BOARD; class PCB_SHAPE; class MODULE; -class ZONE_CONTAINER; +class ZONE; /** @@ -184,13 +184,13 @@ private: BOARD* m_board; std::vector m_components; - std::vector m_polygons; + std::vector m_polygons; std::map m_models; size_t m_num_nets; std::map m_layermap; // used to correctly map copper layers std::map> m_rules; - std::map m_outer_plane; + std::map m_outer_plane; /// Altium stores pour order across all layers int m_highest_pour_index; diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index f34b95a11e..8558493156 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -27,13 +27,13 @@ #include // KEY_COPPER, KEY_CORE, KEY_PREPREG #include -#include +#include #include #include #include #include #include -#include +#include #include #include @@ -662,8 +662,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas( const SYMDEF_PCB& aComponent, if( area.NoVias || area.NoTracks ) { - ZONE_CONTAINER* zone = getZoneFromCadstarShape( - area.Shape, getLineThickness( area.LineCodeID ), aModule ); + ZONE* zone = getZoneFromCadstarShape( area.Shape, getLineThickness( area.LineCodeID ), + aModule ); aModule->Add( zone, ADD_MODE::APPEND ); @@ -1137,8 +1137,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadAreas() if( area.NoVias || area.NoTracks || area.Keepout || area.Routing ) { - ZONE_CONTAINER* zone = getZoneFromCadstarShape( - area.Shape, getLineThickness( area.LineCodeID ), mBoard ); + ZONE* zone = getZoneFromCadstarShape( area.Shape, getLineThickness( area.LineCodeID ), + mBoard ); mBoard->Add( zone, ADD_MODE::APPEND ); @@ -1327,8 +1327,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates() { TEMPLATE& csTemplate = tempPair.second; - ZONE_CONTAINER* zone = getZoneFromCadstarShape( - csTemplate.Shape, getLineThickness( csTemplate.LineCodeID ), mBoard ); + ZONE* zone = getZoneFromCadstarShape( csTemplate.Shape, + getLineThickness( csTemplate.LineCodeID ), mBoard ); mBoard->Add( zone, ADD_MODE::APPEND ); @@ -1450,11 +1450,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates() for( std::pair boardPair : Layout.Boards ) { //create a zone in each board shape + BOARD_DESIGN_SETTINGS& bds = mBoard->GetDesignSettings(); BOARD& board = boardPair.second; - int defaultLineThicknesss = - mBoard->GetDesignSettings().GetLineThickness( PCB_LAYER_ID::Edge_Cuts ); - ZONE_CONTAINER* zone = - getZoneFromCadstarShape( board.Shape, defaultLineThicknesss, mBoard ); + int defaultLineThicknesss = bds.GetLineThickness( PCB_LAYER_ID::Edge_Cuts ); + ZONE* zone = getZoneFromCadstarShape( board.Shape, defaultLineThicknesss, mBoard ); mBoard->Add( zone, ADD_MODE::APPEND ); @@ -1523,8 +1522,9 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers() } else { - ZONE_CONTAINER* zone = getZoneFromCadstarShape( csCopper.Shape, - getKiCadLength( getCopperCode( csCopper.CopperCodeID ).CopperWidth ), mBoard ); + ZONE* zone = getZoneFromCadstarShape( csCopper.Shape, + getKiCadLength( getCopperCode( csCopper.CopperCodeID ).CopperWidth ), + mBoard ); mBoard->Add( zone, ADD_MODE::APPEND ); @@ -2077,10 +2077,11 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC } -ZONE_CONTAINER* CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape( const SHAPE& aCadstarShape, - const int& aLineThickness, BOARD_ITEM_CONTAINER* aParentContainer ) +ZONE* CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape( const SHAPE& aCadstarShape, + const int& aLineThickness, + BOARD_ITEM_CONTAINER* aParentContainer ) { - ZONE_CONTAINER* zone = new ZONE_CONTAINER( aParentContainer, isModule( aParentContainer ) ); + ZONE* zone = new ZONE( aParentContainer, isModule( aParentContainer ) ); if( aCadstarShape.Type == SHAPE_TYPE::HATCHED ) { diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h index 49a496eac1..8b3de80a33 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h @@ -266,10 +266,10 @@ private: * @param aCadstarShape * @param aLineThickness Thickness of line to draw with * @param aParentContainer Parent object (e.g. mBoard or a MODULE pointer) - * @return Pointer to ZONE_CONTAINER. Caller owns the object. + * @return Pointer to ZONE. Caller owns the object. */ - ZONE_CONTAINER* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness, - BOARD_ITEM_CONTAINER* aParentContainer ); + ZONE* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness, + BOARD_ITEM_CONTAINER* aParentContainer ); /** * @brief Returns a SHAPE_POLY_SET object from a Cadstar SHAPE diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 91b4f70fcd..d173142087 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -68,9 +68,9 @@ Load() TODO's #include #include #include -#include +#include #include -#include +#include #include @@ -174,7 +174,7 @@ static wxString interpret_text( const wxString& aText ) } -static void setKeepoutSettingsToZone( ZONE_CONTAINER* aZone, LAYER_NUM aLayer ) +static void setKeepoutSettingsToZone( ZONE* aZone, LAYER_NUM aLayer ) { if( aLayer == EAGLE_LAYER::TRESTRICT || aLayer == EAGLE_LAYER::BRESTRICT ) { @@ -734,7 +734,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) if( c.layer == EAGLE_LAYER::TRESTRICT || c.layer == EAGLE_LAYER::BRESTRICT || c.layer == EAGLE_LAYER::VRESTRICT ) { - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); setKeepoutSettingsToZone( zone, c.layer ); @@ -762,7 +762,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) } zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); } else { @@ -801,7 +801,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) if( IsCopperLayer( layer ) ) { // use a "netcode = 0" type ZONE: - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); zone->SetLayer( layer ); @@ -819,7 +819,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) zone->Rotate( zone->GetPosition(), r.rot->degrees * 10 ); // this is not my fault: - zone->SetBorderDisplayStyle( outline_hatch, ZONE_CONTAINER::GetDefaultHatchPitch(), + zone->SetBorderDisplayStyle( outline_hatch, ZONE::GetDefaultHatchPitch(), true ); } @@ -1236,20 +1236,20 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) } -ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) +ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) { - EPOLYGON p( aPolyNode ); + EPOLYGON p( aPolyNode ); PCB_LAYER_ID layer = kicad_layer( p.layer ); - ZONE_CONTAINER* zone = nullptr; - bool keepout = ( p.layer == EAGLE_LAYER::TRESTRICT - || p.layer == EAGLE_LAYER::BRESTRICT - || p.layer == EAGLE_LAYER::VRESTRICT ); + ZONE* zone = nullptr; + bool keepout = ( p.layer == EAGLE_LAYER::TRESTRICT + || p.layer == EAGLE_LAYER::BRESTRICT + || p.layer == EAGLE_LAYER::VRESTRICT ); if( !IsCopperLayer( layer ) && !keepout ) return nullptr; // use a "netcode = 0" type ZONE: - zone = new ZONE_CONTAINER( m_board ); + zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); if( !keepout ) @@ -1854,7 +1854,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const if( r.layer == EAGLE_LAYER::TRESTRICT || r.layer == EAGLE_LAYER::BRESTRICT || r.layer == EAGLE_LAYER::VRESTRICT ) { - MODULE_ZONE_CONTAINER* zone = new MODULE_ZONE_CONTAINER( aModule ); + FP_ZONE* zone = new FP_ZONE( aModule ); aModule->Add( zone, ADD_MODE::APPEND ); setKeepoutSettingsToZone( zone, r.layer ); @@ -1873,7 +1873,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const } zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); } else { @@ -1968,7 +1968,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const || p.layer == EAGLE_LAYER::BRESTRICT || p.layer == EAGLE_LAYER::VRESTRICT ) { - MODULE_ZONE_CONTAINER* zone = new MODULE_ZONE_CONTAINER( aModule ); + FP_ZONE* zone = new FP_ZONE( aModule ); aModule->Add( zone, ADD_MODE::APPEND ); setKeepoutSettingsToZone( zone, p.layer ); @@ -1978,7 +1978,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const zone->Outline()->AddOutline( outline ); zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); } else { @@ -2010,7 +2010,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const || e.layer == EAGLE_LAYER::BRESTRICT || e.layer == EAGLE_LAYER::VRESTRICT ) { - MODULE_ZONE_CONTAINER* zone = new MODULE_ZONE_CONTAINER( aModule ); + FP_ZONE* zone = new FP_ZONE( aModule ); aModule->Add( zone, ADD_MODE::APPEND ); setKeepoutSettingsToZone( zone, e.layer ); @@ -2038,7 +2038,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const } zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, - ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + ZONE::GetDefaultHatchPitch(), true ); } else { @@ -2436,7 +2436,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals ) { // KiCad does not support an unconnected zone with its own non-zero netcode, // but only when assigned netcode = 0 w/o a name... - for( ZONE_CONTAINER* zone : zones ) + for( ZONE* zone : zones ) zone->SetNetCode( NETINFO_LIST::UNCONNECTED ); // therefore omit this signal/net. diff --git a/pcbnew/plugins/eagle/eagle_plugin.h b/pcbnew/plugins/eagle/eagle_plugin.h index bf1847364a..ac9a9cf834 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.h +++ b/pcbnew/plugins/eagle/eagle_plugin.h @@ -34,10 +34,10 @@ class D_PAD; class FP_TEXT; -class ZONE_CONTAINER; +class ZONE; typedef std::map MODULE_MAP; -typedef std::vector ZONES; +typedef std::vector ZONES; typedef std::map NET_MAP; typedef NET_MAP::const_iterator NET_MAP_CITER; @@ -247,7 +247,7 @@ private: * * @return The loaded zone or nullptr if was not processed. */ - ZONE_CONTAINER* loadPolygon( wxXmlNode* aPolyNode ); + ZONE* loadPolygon( wxXmlNode* aPolyNode ); void orientModuleAndText( MODULE* m, const EELEMENT& e, const EATTR* nameAttr, const EATTR* valueAttr ); void orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt, const EATTR* a ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index 0659ae6661..326facdf09 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -30,11 +30,11 @@ #include #include #include -#include +#include #include -#include +#include #include -#include +#include #include #include #include @@ -396,7 +396,7 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - format( static_cast( aItem ), aNestLevel ); + format( static_cast( aItem ), aNestLevel ); break; case PCB_SHAPE_T: @@ -437,9 +437,9 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const format( static_cast( aItem ), aNestLevel ); break; - case PCB_FP_ZONE_AREA_T: - case PCB_ZONE_AREA_T: - format( static_cast( aItem ), aNestLevel ); + case PCB_FP_ZONE_T: + case PCB_ZONE_T: + format( static_cast( aItem ), aNestLevel ); break; default: @@ -665,7 +665,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const } -void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const +void PCB_IO::format( DIMENSION_BASE* aDimension, int aNestLevel ) const { ALIGNED_DIMENSION* aligned = dynamic_cast( aDimension ); ORTHOGONAL_DIMENSION* ortho = dynamic_cast( aDimension ); @@ -1730,10 +1730,10 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const } -void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const +void PCB_IO::format( ZONE* aZone, int aNestLevel ) const { // Save the NET info; For keepout zones, net code and net name are irrelevant - // so be sure a dummy value is stored, just for ZONE_CONTAINER compatibility + // so be sure a dummy value is stored, just for ZONE compatibility // (perhaps netcode and netname should be not stored) m_out->Print( aNestLevel, "(zone (net %d) (net_name %s)", aZone->GetIsRuleArea() ? 0 : m_mapping->Translate( aZone->GetNetCode() ), diff --git a/pcbnew/plugins/kicad/kicad_plugin.h b/pcbnew/plugins/kicad/kicad_plugin.h index 48fadf746f..49ec6dd217 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.h +++ b/pcbnew/plugins/kicad/kicad_plugin.h @@ -35,7 +35,7 @@ class FP_CACHE; class PCB_PARSER; class NETINFO_MAPPING; class BOARD_DESIGN_SETTINGS; -class DIMENSION; +class DIMENSION_BASE; class FP_SHAPE; class PCB_SHAPE; class PCB_TARGET; @@ -43,7 +43,7 @@ class D_PAD; class FP_TEXT; class PCB_GROUP; class TRACK; -class ZONE_CONTAINER; +class ZONE; class PCB_TEXT; @@ -258,7 +258,7 @@ protected: private: void format( BOARD* aBoard, int aNestLevel = 0 ) const; - void format( DIMENSION* aDimension, int aNestLevel = 0 ) const; + void format( DIMENSION_BASE* aDimension, int aNestLevel = 0 ) const; void format( FP_SHAPE* aModuleDrawing, int aNestLevel = 0 ) const; @@ -278,7 +278,7 @@ private: void format( TRACK* aTrack, int aNestLevel = 0 ) const; - void format( ZONE_CONTAINER* aZone, int aNestLevel = 0 ) const; + void format( ZONE* aZone, int aNestLevel = 0 ) const; void formatLayer( const BOARD_ITEM* aItem ) const; diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 6a9a6eecc3..e83dcd7afb 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -36,16 +36,16 @@ #include #include -#include +#include #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include @@ -635,7 +635,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked() break; case T_zone: - m_board->Add( parseZONE_CONTAINER( m_board ), ADD_MODE::APPEND ); + m_board->Add( parseZONE( m_board ), ADD_MODE::APPEND ); break; case T_target: @@ -2360,14 +2360,14 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT() } -DIMENSION* PCB_PARSER::parseDIMENSION() +DIMENSION_BASE* PCB_PARSER::parseDIMENSION() { wxCHECK_MSG( CurTok() == T_dimension, NULL, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as DIMENSION." ) ); T token; - std::unique_ptr dimension; + std::unique_ptr dimension; // skip value that used to be saved if( NextTok() != T_LEFT ) @@ -3056,7 +3056,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) case T_zone: { - ZONE_CONTAINER* zone = parseZONE_CONTAINER( module.get() ); + ZONE* zone = parseZONE( module.get() ); module->Add( zone, ADD_MODE::APPEND ); } break; @@ -4260,35 +4260,35 @@ VIA* PCB_PARSER::parseVIA() } -ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ) +ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) { wxCHECK_MSG( CurTok() == T_zone, NULL, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + - wxT( " as ZONE_CONTAINER." ) ); + wxT( " as ZONE." ) ); ZONE_BORDER_DISPLAY_STYLE hatchStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; - int hatchPitch = ZONE_CONTAINER::GetDefaultHatchPitch(); - wxPoint pt; - T token; - int tmp; - wxString netnameFromfile; // the zone net name find in file + int hatchPitch = ZONE::GetDefaultHatchPitch(); + wxPoint pt; + T token; + int tmp; + wxString netnameFromfile; // the zone net name find in file // bigger scope since each filled_polygon is concatenated in here std::map pts; - bool inModule = false; + bool inModule = false; PCB_LAYER_ID filledLayer; - bool addedFilledPolygons = false; + bool addedFilledPolygons = false; if( dynamic_cast( aParent ) ) // The zone belongs a footprint inModule = true; - std::unique_ptr zone; + std::unique_ptr zone; if( inModule ) - zone = std::make_unique( aParent ); + zone = std::make_unique( aParent ); else - zone = std::make_unique( aParent ); + zone = std::make_unique( aParent ); zone->SetPriority( 0 ); diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index bc80d098fc..eac41e2a90 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -45,7 +45,7 @@ class BOARD_ITEM; class BOARD_ITEM_CONTAINER; class D_PAD; class BOARD_DESIGN_SETTINGS; -class DIMENSION; +class DIMENSION_BASE; class PCB_SHAPE; class EDA_TEXT; class FP_SHAPE; @@ -56,7 +56,7 @@ class MODULE; class PCB_GROUP; class PCB_TARGET; class VIA; -class ZONE_CONTAINER; +class ZONE; class MARKER_PCB; class MODULE_3D_SETTINGS; struct LAYER; @@ -164,7 +164,7 @@ class PCB_PARSER : public PCB_LEXER */ PCB_SHAPE* parsePCB_SHAPE( bool aAllowZeroWidth = false ); PCB_TEXT* parsePCB_TEXT(); - DIMENSION* parseDIMENSION(); + DIMENSION_BASE* parseDIMENSION(); /** * Function parseMODULE_unchecked @@ -179,7 +179,7 @@ class PCB_PARSER : public PCB_LEXER ARC* parseARC(); TRACK* parseTRACK(); VIA* parseVIA(); - ZONE_CONTAINER* parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ); + ZONE* parseZONE( BOARD_ITEM_CONTAINER* aParent ); PCB_TARGET* parsePCB_TARGET(); MARKER_PCB* parseMARKER( BOARD_ITEM_CONTAINER* aParent ); BOARD* parseBOARD(); diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index f108bc7dc4..030cf09ea6 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -76,10 +76,10 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include <3d_cache/3d_info.h> #include @@ -2434,7 +2434,7 @@ void LEGACY_PLUGIN::loadNETCLASS() void LEGACY_PLUGIN::loadZONE_CONTAINER() { - std::unique_ptr zc = std::make_unique( m_board ); + std::unique_ptr zc = std::make_unique( m_board ); ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; bool endContour = false; @@ -2712,8 +2712,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() // HatchBorder here, after outlines corners are read // Set hatch here, after outlines corners are read - zc->SetBorderDisplayStyle( outline_hatch, ZONE_CONTAINER::GetDefaultHatchPitch(), - true ); + zc->SetBorderDisplayStyle( outline_hatch, ZONE::GetDefaultHatchPitch(), true ); m_board->Add( zc.release() ); } diff --git a/pcbnew/plugins/legacy/legacy_plugin.h b/pcbnew/plugins/legacy/legacy_plugin.h index 63e7464f97..73d8224081 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.h +++ b/pcbnew/plugins/legacy/legacy_plugin.h @@ -43,8 +43,8 @@ class MODULE; class TRACK; class NETCLASS; class NETCLASSES; -class ZONE_CONTAINER; -class DIMENSION; +class ZONE; +class DIMENSION_BASE; class NETINFO_ITEM; class NETINFO_MAPPING; class FP_TEXT; diff --git a/pcbnew/plugins/pcad/pcb_component.h b/pcbnew/plugins/pcad/pcb_component.h index 890dfc7691..02c3d65dc9 100644 --- a/pcbnew/plugins/pcad/pcb_component.h +++ b/pcbnew/plugins/pcad/pcb_component.h @@ -38,7 +38,6 @@ #include #include #include -#include namespace PCAD2KICAD { diff --git a/pcbnew/plugins/pcad/pcb_polygon.cpp b/pcbnew/plugins/pcad/pcb_polygon.cpp index 2ec9aaa717..ab530371ac 100644 --- a/pcbnew/plugins/pcad/pcb_polygon.cpp +++ b/pcbnew/plugins/pcad/pcb_polygon.cpp @@ -190,7 +190,7 @@ void PCB_POLYGON::AddToBoard() if( m_outline.GetCount() > 0 ) { - ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + ZONE* zone = new ZONE( m_board ); m_board->Add( zone, ADD_MODE::APPEND ); zone->SetLayer( m_KiCadLayer ); diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index cd0ecd73da..289d7a2d92 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -923,8 +923,7 @@ std::unique_ptr PNS_KICAD_IFACE_BASE::syncVia( VIA* aVia ) } -bool PNS_KICAD_IFACE_BASE::syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone, - SHAPE_POLY_SET* aBoardOutline ) +bool PNS_KICAD_IFACE_BASE::syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_SET* aBoardOutline ) { SHAPE_POLY_SET poly; @@ -1182,7 +1181,7 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld ) if( m_board->GetBoardPolygonOutlines( buffer ) ) boardOutline = &buffer; - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { syncZone( aWorld, zone, boardOutline ); } @@ -1200,7 +1199,7 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld ) syncTextItem( aWorld, &module->Reference(), module->Reference().GetLayer() ); syncTextItem( aWorld, &module->Value(), module->Value().GetLayer() ); - for( MODULE_ZONE_CONTAINER* zone : module->Zones() ) + for( FP_ZONE* zone : module->Zones() ) syncZone( aWorld, zone, boardOutline ); if( module->IsNetTie() ) diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index f553c98589..3299001ee9 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -94,7 +94,7 @@ protected: std::unique_ptr syncVia( VIA* aVia ); bool syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB_LAYER_ID aLayer ); bool syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aItem ); - bool syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone, SHAPE_POLY_SET* aBoardOutline ); + bool syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_SET* aBoardOutline ); bool inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth ); protected: diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 42a97daefe..f219b0acbd 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -1565,7 +1565,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) view()->AddToPreview( previewItem ); view()->Hide( &module->Value() ); - for( ZONE_CONTAINER* zone : module->Zones() ) + for( ZONE* zone : module->Zones() ) { previewItem = static_cast( zone->Clone() ); previewItem->Move( offset ); @@ -1601,7 +1601,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) view()->Hide( &module->Reference(), false ); view()->Hide( &module->Value(), false ); - for( ZONE_CONTAINER* zone : module->Zones() ) + for( ZONE* zone : module->Zones() ) view()->Hide( zone, false ); view()->ClearPreview(); diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index d4839bb811..f824721306 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include @@ -1073,12 +1073,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) { int netlessZones = 0; - static const KICAD_T scanZONEs[] = { PCB_ZONE_AREA_T, EOT }; + static const KICAD_T scanZONEs[] = { PCB_ZONE_T, EOT }; items.Collect( aBoard, scanZONEs ); for( int i = 0; iGetIsRuleArea() ) continue; @@ -1191,12 +1191,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) //------------------------------------- { - static const KICAD_T scanZONEs[] = { PCB_ZONE_AREA_T, EOT }; + static const KICAD_T scanZONEs[] = { PCB_ZONE_T, EOT }; items.Collect( aBoard, scanZONEs ); for( int i=0; iGetIsRuleArea() ) continue; diff --git a/pcbnew/specctra_import_export/specctra_import.cpp b/pcbnew/specctra_import_export/specctra_import.cpp index 74f9dfa3ea..a9417df910 100644 --- a/pcbnew/specctra_import_export/specctra_import.cpp +++ b/pcbnew/specctra_import_export/specctra_import.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include "specctra.h" diff --git a/pcbnew/swig/board_connected_item.i b/pcbnew/swig/board_connected_item.i index 9a8327823f..8eaa0b52b7 100644 --- a/pcbnew/swig/board_connected_item.i +++ b/pcbnew/swig/board_connected_item.i @@ -54,9 +54,9 @@ 0 | 0 ); break; - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: obj = SWIG_NewPointerObj( SWIG_as_voidptr(aItem), - SWIGTYPE_p_ZONE_CONTAINER, + SWIGTYPE_p_ZONE, 0 | 0 ); break; diff --git a/pcbnew/swig/board_item.i b/pcbnew/swig/board_item.i index 90d0fb27c3..cfa76d5372 100644 --- a/pcbnew/swig/board_item.i +++ b/pcbnew/swig/board_item.i @@ -62,7 +62,8 @@ class EDGE_MODULE; class D_PAD; class TRACK; class VIA; -class ZONE_CONTAINER; +class ZONE; +class FP_ZONE; class PCB_TARGET; // Anthing targeted to the %wrapper section is extern "C" whereas code targeted @@ -86,7 +87,8 @@ static FP_SHAPE* Cast_to_FP_SHAPE( BOARD_ITEM* ); static D_PAD* Cast_to_D_PAD( BOARD_ITEM* ); static TRACK* Cast_to_TRACK( BOARD_ITEM* ); static VIA* Cast_to_VIA( BOARD_ITEM* ); -static ZONE_CONTAINER* Cast_to_ZONE_CONTAINER( BOARD_ITEM* ); +static ZONE* Cast_to_ZONE( BOARD_ITEM* ); +static FP_ZONE* Cast_to_FP_ZONE( BOARD_ITEM* ); static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); #ifdef __cplusplus @@ -110,7 +112,8 @@ static FP_SHAPE* Cast_to_FP_SHAPE( BOARD_ITEM* ); static D_PAD* Cast_to_D_PAD( BOARD_ITEM* ); static TRACK* Cast_to_TRACK( BOARD_ITEM* ); static VIA* Cast_to_VIA( BOARD_ITEM* ); -static ZONE_CONTAINER* Cast_to_ZONE_CONTAINER( BOARD_ITEM* ); +static ZONE* Cast_to_ZONE( BOARD_ITEM* ); +static FP_ZONE* Cast_to_FP_ZONE( BOARD_ITEM* ); static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); @@ -152,8 +155,8 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); return Cast_to_TRACK(self) elif ct=="PCB_TARGET": return Cast_to_PCB_TARGET(self) - elif ct=="ZONE_CONTAINER": - return Cast_to_ZONE_CONTAINER(self) + elif ct=="ZONE": + return Cast_to_ZONE(self) else: raise TypeError("Unsupported drawing class: %s" % ct) @@ -197,6 +200,7 @@ static FP_SHAPE* Cast_to_FP_SHAPE( BOARD_ITEM* self ) { static D_PAD* Cast_to_D_PAD( BOARD_ITEM* self ) { return dynamic_cast(self); } static TRACK* Cast_to_TRACK( BOARD_ITEM* self ) { return dynamic_cast(self); } static VIA* Cast_to_VIA( BOARD_ITEM* self ) { return dynamic_cast(self); } -static ZONE_CONTAINER* Cast_to_ZONE_CONTAINER( BOARD_ITEM* self ) { return dynamic_cast(self); } +static ZONE* Cast_to_ZONE( BOARD_ITEM* self ) { return dynamic_cast( self); } +static FP_ZONE* Cast_to_FP_ZONE( BOARD_ITEM* self ) { return dynamic_cast( self); } static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* self ) { return dynamic_cast(self); } %} diff --git a/pcbnew/swig/dimension.i b/pcbnew/swig/dimension.i index db69726065..b9a5f96f83 100644 --- a/pcbnew/swig/dimension.i +++ b/pcbnew/swig/dimension.i @@ -1,6 +1,6 @@ -%include class_dimension.h +%include dimension.h %{ -#include +#include %} diff --git a/pcbnew/swig/pcbnew_action_plugins.cpp b/pcbnew/swig/pcbnew_action_plugins.cpp index 2cf72e39d4..43f328737a 100644 --- a/pcbnew/swig/pcbnew_action_plugins.cpp +++ b/pcbnew/swig/pcbnew_action_plugins.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -231,7 +231,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) } // Append zones outlines - for( ZONE_CONTAINER* zone : currentPcb->Zones() ) + for( ZONE* zone : currentPcb->Zones() ) { ITEM_PICKER picker( nullptr, zone, UNDO_REDO::CHANGED ); itemsList.PushItem( picker ); @@ -282,7 +282,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) currItemList.insert( item ); // Append zones outlines - for( ZONE_CONTAINER* zone : currentPcb->Zones() ) + for( ZONE* zone : currentPcb->Zones() ) currItemList.insert( zone ); // Found deleted footprints @@ -331,7 +331,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) } } - for( ZONE_CONTAINER* zone : currentPcb->Zones() ) + for( ZONE* zone : currentPcb->Zones() ) { if( !oldBuffer->ContainsItem( zone ) ) { diff --git a/pcbnew/swig/pcbnew_scripting_helpers.cpp b/pcbnew/swig/pcbnew_scripting_helpers.cpp index 3b1e6dd829..d6c9f83914 100644 --- a/pcbnew/swig/pcbnew_scripting_helpers.cpp +++ b/pcbnew/swig/pcbnew_scripting_helpers.cpp @@ -351,7 +351,7 @@ bool IsActionRunning() bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits, - bool aTestTracksAgainstZones, bool aReportAllTrackErrors ) + bool aReportAllTrackErrors ) { wxCHECK( aBoard, false ); diff --git a/pcbnew/swig/pcbnew_scripting_helpers.h b/pcbnew/swig/pcbnew_scripting_helpers.h index fdb15171b5..270cd32568 100644 --- a/pcbnew/swig/pcbnew_scripting_helpers.h +++ b/pcbnew/swig/pcbnew_scripting_helpers.h @@ -151,12 +151,11 @@ bool IsActionRunning(); * @param aBoard is a valid loaded board * @param aFileName is the full path and name of the report file to write * @param aUnits is the units to use in the report - * @param aTestTracksAgainstZones controls whether full track/zone checking is done (slow) * @param aReportAllTrackErrors controls whether all errors or just the first error is reported * for each track * @return true if successful, false if not */ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits, - bool aTestTracksAgainstZones, bool aReportAllTrackErrors ); + bool aReportAllTrackErrors ); #endif // __PCBNEW_SCRIPTING_HELPERS_H diff --git a/pcbnew/swig/zone.i b/pcbnew/swig/zone.i index 38b4f315b8..f90356a50a 100644 --- a/pcbnew/swig/zone.i +++ b/pcbnew/swig/zone.i @@ -1,11 +1,11 @@ // Do not permit default ZONE_FILLER ctor since commits are not supported from Python %ignore ZONE_FILLER::ZONE_FILLER(BOARD*, COMMIT*); -%include class_zone.h +%include zone.h %include zones.h %{ -#include +#include #include #include %} diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index 109753c75c..e886bbd6b4 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -72,7 +72,7 @@ bool CONVERT_TOOL::Init() m_menu->SetTitle( _( "Convert..." ) ); static KICAD_T convertableTracks[] = { PCB_TRACE_T, PCB_ARC_T, EOT }; - static KICAD_T convertableZones[] = { PCB_ZONE_AREA_T, PCB_FP_ZONE_AREA_T, EOT }; + static KICAD_T convertableZones[] = { PCB_ZONE_T, PCB_FP_ZONE_T, EOT }; auto graphicLines = P_S_C::OnlyGraphicShapeTypes( { S_SEGMENT, S_RECT } ) && P_S_C::SameLayer(); @@ -218,8 +218,7 @@ int CONVERT_TOOL::LinesToPoly( const TOOL_EVENT& aEvent ) for( const SHAPE_POLY_SET& poly : polys ) { - ZONE_CONTAINER* zone = isFootprint ? new MODULE_ZONE_CONTAINER( parent ) - : new ZONE_CONTAINER( parent ); + ZONE* zone = isFootprint ? new FP_ZONE( parent ) : new ZONE( parent ); *zone->Outline() = poly; zone->HatchBorder(); @@ -391,8 +390,8 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent ) break; - case PCB_ZONE_AREA_T: - case PCB_FP_ZONE_AREA_T: + case PCB_ZONE_T: + case PCB_FP_ZONE_T: break; default: @@ -411,9 +410,9 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent ) switch( aItem->Type() ) { - case PCB_ZONE_AREA_T: - case PCB_FP_ZONE_AREA_T: - set = *static_cast( aItem )->Outline(); + case PCB_ZONE_T: + case PCB_FP_ZONE_T: + set = *static_cast( aItem )->Outline(); break; case PCB_SHAPE_T: diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index e6a8d11272..ceb841d1be 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -43,8 +43,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -620,7 +620,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) } -void DRAWING_TOOL::constrainDimension( DIMENSION* aDim ) +void DRAWING_TOOL::constrainDimension( DIMENSION_BASE* aDim ) { const VECTOR2I lineVector{ aDim->GetEnd() - aDim->GetStart() }; @@ -633,10 +633,10 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor && !m_frame->GetModel() ) return 0; - TOOL_EVENT originalEvent = aEvent; - DIMENSION* dimension = nullptr; - BOARD_COMMIT commit( m_frame ); - GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); + TOOL_EVENT originalEvent = aEvent; + DIMENSION_BASE* dimension = nullptr; + BOARD_COMMIT commit( m_frame ); + GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); const BOARD_DESIGN_SETTINGS& boardSettings = m_board->GetDesignSettings(); @@ -770,7 +770,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) // Init the new item attributes auto setMeasurementAttributes = - [&]( DIMENSION* aDim ) + [&]( DIMENSION_BASE* aDim ) { aDim->SetUnitsMode( boardSettings.m_DimensionUnitsMode ); aDim->SetUnitsFormat( boardSettings.m_DimensionUnitsFormat ); @@ -1764,7 +1764,7 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool } -bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER** aZone ) +bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE** aZone ) { bool clearSelection = false; *aZone = nullptr; @@ -1784,7 +1784,7 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER** aZo // we want a single zone if( selection.Size() == 1 ) - *aZone = dyn_cast( selection[0] ); + *aZone = dyn_cast( selection[0] ); // expected a zone, but didn't get one if( !*aZone ) @@ -1817,7 +1817,7 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent ) // get a source zone, if we need one. We need it for: // ZONE_MODE::CUTOUT (adding a hole to the source zone) // ZONE_MODE::SIMILAR (creating a new zone using settings of source zone - ZONE_CONTAINER* sourceZone = nullptr; + ZONE* sourceZone = nullptr; if( !getSourceZoneForAction( zoneMode, &sourceZone ) ) return 0; @@ -2182,9 +2182,9 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) } } - std::vector foundZones; + std::vector foundZones; - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { for( PCB_LAYER_ID layer : LSET( zone->GetLayerSet() & lset ).Seq() ) { @@ -2194,20 +2194,20 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) } std::sort( foundZones.begin(), foundZones.end(), - [] ( const ZONE_CONTAINER* a, const ZONE_CONTAINER* b ) - { - return a->GetLayer() < b->GetLayer(); - } ); + [] ( const ZONE* a, const ZONE* b ) + { + return a->GetLayer() < b->GetLayer(); + } ); // first take the net of the active layer - for( ZONE_CONTAINER* z : foundZones ) + for( ZONE* z : foundZones ) { if( m_frame->GetActiveLayer() == z->GetLayer() ) return z->GetNetCode(); } // none? take the topmost visible layer - for( ZONE_CONTAINER* z : foundZones ) + for( ZONE* z : foundZones ) { if( m_board->IsLayerVisible( z->GetLayer() ) ) return z->GetNetCode(); diff --git a/pcbnew/tools/drawing_tool.h b/pcbnew/tools/drawing_tool.h index 18f2dc7285..18f962024a 100644 --- a/pcbnew/tools/drawing_tool.h +++ b/pcbnew/tools/drawing_tool.h @@ -211,14 +211,14 @@ private: * @return true if a suitable zone was found, or the action doesn't * need a zone. False if the action needs a zone but none was found. */ - bool getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER** aZone ); + bool getSourceZoneForAction( ZONE_MODE aMode, ZONE** aZone ); /** * Function constrainDimension() * Forces the dimension lime to be drawn on multiple of 45 degrees * @param aDimension is the dimension element currently being drawn */ - void constrainDimension( DIMENSION* aDim ); + void constrainDimension( DIMENSION_BASE* aDim ); ///> Returns the appropriate width for a segment depending on the settings. int getSegmentWidth( PCB_LAYER_ID aLayer ) const; diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index cd57b700d4..d2b18eea0d 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -73,7 +73,7 @@ void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags, { aCollector.Remove( item ); } - else if( item->Type() == PCB_FP_ZONE_AREA_T ) + else if( item->Type() == PCB_FP_ZONE_T ) { MODULE* mod = static_cast( item->GetParent() ); @@ -1071,7 +1071,7 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) { case PCB_FP_SHAPE_T: case PCB_FP_TEXT_T: - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: case PCB_PAD_T: // Only create undo entry for items on the board if( !item->IsNew() && !IsFootprintEditor() ) @@ -1092,9 +1092,9 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) break; } - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: { - MODULE_ZONE_CONTAINER* zone = static_cast( item ); + FP_ZONE* zone = static_cast( item ); zone->Mirror( mirrorPoint, false ); break; } @@ -1301,10 +1301,10 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) } break; - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: { - MODULE_ZONE_CONTAINER* zone = static_cast( item ); - MODULE* parent = static_cast( item->GetParent() ); + FP_ZONE* zone = static_cast( item ); + MODULE* parent = static_cast( item->GetParent() ); m_commit->Modify( parent ); getView()->Remove( zone ); @@ -1312,15 +1312,15 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) } break; - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: // We process the zones special so that cutouts can be deleted when the delete tool // is called from inside a cutout when the zone is selected. { // Only interact with cutouts when deleting and a single item is selected if( !isCut && selectionCopy.GetSize() == 1 ) { - VECTOR2I curPos = getViewControls()->GetCursorPosition(); - ZONE_CONTAINER* zone = static_cast( item ); + VECTOR2I curPos = getViewControls()->GetCursorPosition(); + ZONE* zone = static_cast( item ); int outlineIdx, holeIdx; @@ -1330,7 +1330,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) m_commit->Modify( zone ); zone->RemoveCutout( outlineIdx, holeIdx ); - std::vector toFill; + std::vector toFill; toFill.emplace_back( zone ); // Fill the modified zone @@ -1595,7 +1595,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) case PCB_SHAPE_T: case PCB_TRACE_T: case PCB_VIA_T: - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: case PCB_TARGET_T: case PCB_DIM_ALIGNED_T: case PCB_DIM_CENTER_T: diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index 9848e2359c..0b7b38ad71 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -27,11 +27,11 @@ using namespace std::placeholders; #include -#include +#include #include #include #include -#include +#include #include #include #include @@ -658,9 +658,9 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo break; } - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: { - const SHAPE_POLY_SET* outline = static_cast( aItem )->Outline(); + const SHAPE_POLY_SET* outline = static_cast( aItem )->Outline(); SHAPE_LINE_CHAIN lc; lc.SetClosed( true ); diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 9d3305c6ce..31a09aa7f3 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -34,9 +34,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include @@ -197,7 +197,7 @@ bool PCB_EDITOR_CONTROL::Init() menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::LockableItems ), 100 ); - menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ), 200 ); + menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyType( PCB_ZONE_T ), 200 ); } DRAWING_TOOL* drawingTool = m_toolMgr->GetTool(); @@ -436,7 +436,7 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent ) for( BOARD_ITEM* item : footprint->GraphicalItems() ) processItem( item ); - for( ZONE_CONTAINER* zone : footprint->Zones() ) + for( ZONE* zone : footprint->Zones() ) processItem( zone ); for( PCB_GROUP* group : footprint->Groups() ) @@ -446,7 +446,7 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent ) for( BOARD_ITEM* drawing : board()->Drawings() ) processItem( drawing ); - for( ZONE_CONTAINER* zone : board()->Zones() ) + for( ZONE* zone : board()->Zones() ) processItem( zone ); for( MARKER_PCB* marker : board()->Markers() ) @@ -1101,8 +1101,8 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent ) } -static bool mergeZones( BOARD_COMMIT& aCommit, std::vector& aOriginZones, - std::vector& aMergedZones ) +static bool mergeZones( BOARD_COMMIT& aCommit, std::vector& aOriginZones, + std::vector& aMergedZones ) { for( unsigned int i = 1; i < aOriginZones.size(); i++ ) { @@ -1118,7 +1118,7 @@ static bool mergeZones( BOARD_COMMIT& aCommit, std::vector& aO // but we should never have more than 2 polys if( aOriginZones[0]->Outline()->OutlineCount() > 1 ) { - wxLogMessage( "BOARD::CombineAreas error: more than 2 polys after merging" ); + wxLogMessage( "BOARD::mergeZones error: more than 2 polys after merging" ); return false; } @@ -1149,12 +1149,12 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent ) int netcode = -1; - ZONE_CONTAINER* firstZone = nullptr; - std::vector toMerge, merged; + ZONE* firstZone = nullptr; + std::vector toMerge, merged; for( auto item : selection ) { - auto curr_area = dynamic_cast( item ); + ZONE* curr_area = dynamic_cast( item ); if( !curr_area ) continue; @@ -1176,7 +1176,7 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent ) if( curr_area->GetLayer() != firstZone->GetLayer() ) continue; - if( !board->TestAreaIntersection( curr_area, firstZone ) ) + if( !board->TestZoneIntersection( curr_area, firstZone ) ) continue; toMerge.push_back( curr_area ); @@ -1206,7 +1206,7 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent ) if( selection.Size() != 1 ) return 0; - auto oldZone = dyn_cast( selection[0] ); + ZONE* oldZone = dyn_cast( selection[0] ); if( !oldZone ) return 0; @@ -1228,7 +1228,7 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent ) // duplicate the zone BOARD_COMMIT commit( m_frame ); - auto newZone = std::make_unique( *oldZone ); + std::unique_ptr newZone = std::make_unique( *oldZone ); newZone->ClearSelected(); newZone->UnFill(); zoneSettings.ExportSetting( *newZone ); diff --git a/pcbnew/tools/pcb_inspection_tool.cpp b/pcbnew/tools/pcb_inspection_tool.cpp index 4109f610ba..2daa36ac9b 100644 --- a/pcbnew/tools/pcb_inspection_tool.cpp +++ b/pcbnew/tools/pcb_inspection_tool.cpp @@ -82,7 +82,7 @@ bool PCB_INSPECTION_TOOL::Init() netSubMenu->SetTool( this ); static KICAD_T connectedTypes[] = { PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T, PCB_PAD_T, - PCB_ZONE_AREA_T, EOT }; + PCB_ZONE_T, EOT }; CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu(); @@ -109,7 +109,7 @@ int PCB_INSPECTION_TOOL::ShowStatisticsDialog( const TOOL_EVENT& aEvent ) } -void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE_CONTAINER* aZone, D_PAD* aPad, REPORTER* r ) +void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE* aZone, D_PAD* aPad, REPORTER* r ) { ENUM_MAP connectionEnum = ENUM_MAP::Instance(); wxString source; @@ -283,7 +283,7 @@ int PCB_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent ) layer = B_Cu; } - if( a->Type() != PCB_ZONE_AREA_T && b->Type() == PCB_ZONE_AREA_T ) + if( a->Type() != PCB_ZONE_T && b->Type() == PCB_ZONE_T ) std::swap( a, b ); else if( !a->IsConnected() && b->IsConnected() ) std::swap( a, b ); @@ -340,10 +340,9 @@ int PCB_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent ) { // Same nets.... - if( ac->Type() == PCB_ZONE_AREA_T && bc->Type() == PCB_PAD_T ) + if( ac->Type() == PCB_ZONE_T && bc->Type() == PCB_PAD_T ) { - reportZoneConnection( static_cast( ac ), - static_cast( bc ), r ); + reportZoneConnection( static_cast( ac ), static_cast( bc ), r ); } else { @@ -401,12 +400,12 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent ) compileError = true; } - for( ZONE_CONTAINER* zone : m_frame->GetBoard()->Zones() ) + for( ZONE* zone : m_frame->GetBoard()->Zones() ) zone->CacheBoundingBox(); for( MODULE* module : m_frame->GetBoard()->Modules() ) { - for( ZONE_CONTAINER* zone : module->Zones() ) + for( ZONE* zone : module->Zones() ) zone->CacheBoundingBox(); module->BuildPolyCourtyards(); @@ -1002,7 +1001,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta ) return( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_PAD_T || aItem->Type() == PCB_ARC_T - || aItem->Type() == PCB_ZONE_AREA_T + || aItem->Type() == PCB_ZONE_T || aItem->Type() == PCB_MODULE_T || aItem->Type() == PCB_VIA_T ); } ) ) diff --git a/pcbnew/tools/pcb_inspection_tool.h b/pcbnew/tools/pcb_inspection_tool.h index 9e2e6724d5..1988506850 100644 --- a/pcbnew/tools/pcb_inspection_tool.h +++ b/pcbnew/tools/pcb_inspection_tool.h @@ -130,7 +130,7 @@ private: void onInspectClearanceDialogClosed( wxCommandEvent& aEvent ); void onInspectConstraintsDialogClosed( wxCommandEvent& aEvent ); - void reportZoneConnection( ZONE_CONTAINER* aZone, D_PAD* aPad, REPORTER* r ); + void reportZoneConnection( ZONE* aZone, D_PAD* aPad, REPORTER* r ); void reportClearance( DRC_CONSTRAINT_TYPE_T aClearanceType, PCB_LAYER_ID aLayer, BOARD_ITEM* aA, BOARD_ITEM* aB, REPORTER* r ); diff --git a/pcbnew/tools/pcb_selection_conditions.cpp b/pcbnew/tools/pcb_selection_conditions.cpp index 52d3239bcb..7fece6e3d7 100644 --- a/pcbnew/tools/pcb_selection_conditions.cpp +++ b/pcbnew/tools/pcb_selection_conditions.cpp @@ -42,7 +42,7 @@ bool PCB_SELECTION_CONDITIONS::OnlyConnectedItems( const SELECTION& aSelection ) { auto type = item->Type(); - if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_AREA_T ) + if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_T ) return false; } diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index f83651795c..0a6a92357e 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -33,10 +33,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include #include @@ -201,7 +201,7 @@ int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent ) m_frame->SetDisplayOptions( opts ); - for( ZONE_CONTAINER* zone : board()->Zones() ) + for( ZONE* zone : board()->Zones() ) view()->Update( zone, KIGFX::GEOMETRY ); canvas()->Refresh(); @@ -787,8 +787,7 @@ static void moveUnflaggedItems( std::deque& aList, std::vector& } -static void moveUnflaggedItems( ZONE_CONTAINERS& aList, std::vector& aTarget, - bool aIsNew ) +static void moveUnflaggedItems( ZONES& aList, std::vector& aTarget, bool aIsNew ) { if( aList.size() == 0 ) return; @@ -878,7 +877,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector& aItems, bool aIsN case PCB_DIM_LEADER_T: { // Dimensions need to have their units updated if they are automatic - DIMENSION* dim = static_cast( item ); + DIMENSION_BASE* dim = static_cast( item ); if( dim->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC ) dim->SetUnits( frame()->GetUserUnits() ); diff --git a/pcbnew/tools/pcbnew_selection.cpp b/pcbnew/tools/pcbnew_selection.cpp index 7311c967db..c4a9c82638 100644 --- a/pcbnew/tools/pcbnew_selection.cpp +++ b/pcbnew/tools/pcbnew_selection.cpp @@ -33,7 +33,6 @@ using namespace std::placeholders; #include #include #include -#include #include #include #include diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 138227dbf6..eceb913190 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -40,8 +40,8 @@ using namespace std::placeholders; #include #include #include -#include -#include +#include +#include #include #include @@ -239,10 +239,10 @@ public: } break; - case PCB_FP_ZONE_AREA_T: - case PCB_ZONE_AREA_T: + case PCB_FP_ZONE_T: + case PCB_ZONE_T: { - auto zone = static_cast( aItem ); + const ZONE* zone = static_cast( aItem ); buildForPolyOutline( points, zone->Outline(), aGal ); } break; @@ -1296,10 +1296,10 @@ void POINT_EDITOR::updateItem() const } break; - case PCB_FP_ZONE_AREA_T: - case PCB_ZONE_AREA_T: + case PCB_FP_ZONE_T: + case PCB_ZONE_T: { - ZONE_CONTAINER* zone = static_cast( item ); + ZONE* zone = static_cast( item ); zone->ClearFilledPolysList(); SHAPE_POLY_SET& outline = *zone->Outline(); @@ -1482,9 +1482,9 @@ void POINT_EDITOR::finishItem() if( !item ) return; - if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T ) + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) { - auto zone = static_cast( item ); + ZONE* zone = static_cast( item ); if( zone->IsFilled() && m_refill && zone->NeedRefill() ) m_toolMgr->RunAction( PCB_ACTIONS::zoneFill, true, zone ); @@ -1662,10 +1662,10 @@ void POINT_EDITOR::updatePoints() } break; - case PCB_FP_ZONE_AREA_T: - case PCB_ZONE_AREA_T: + case PCB_FP_ZONE_T: + case PCB_ZONE_T: { - ZONE_CONTAINER* zone = static_cast( item ); + ZONE* zone = static_cast( item ); const SHAPE_POLY_SET* outline = zone->Outline(); if( m_editPoints->PointsSize() != (unsigned) outline->TotalVertices() ) @@ -1753,8 +1753,8 @@ void POINT_EDITOR::setAltConstraint( bool aEnabled ) EDIT_LINE* line = dynamic_cast( m_editedPoint ); bool isPoly = false; - if( m_editPoints->GetParent()->Type() == PCB_ZONE_AREA_T - || m_editPoints->GetParent()->Type() == PCB_FP_ZONE_AREA_T ) + if( m_editPoints->GetParent()->Type() == PCB_ZONE_T + || m_editPoints->GetParent()->Type() == PCB_FP_ZONE_T ) { isPoly = true; } @@ -1844,7 +1844,7 @@ bool POINT_EDITOR::canAddCorner( const EDA_ITEM& aItem ) const auto type = aItem.Type(); // Works only for zones and line segments - if( type == PCB_ZONE_AREA_T || type == PCB_FP_ZONE_AREA_T ) + if( type == PCB_ZONE_T || type == PCB_FP_ZONE_T ) return true; if( type == PCB_SHAPE_T || type == PCB_FP_SHAPE_T ) @@ -1894,15 +1894,15 @@ bool POINT_EDITOR::removeCornerCondition( const SELECTION& ) if( !item ) return false; - if( !( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T - || ( ( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_SHAPE_T ) && + if( !( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T + || ( ( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_SHAPE_T ) && static_cast( item )->GetShape() == S_POLYGON ) ) ) return false; SHAPE_POLY_SET *polyset; - if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T ) - polyset = static_cast( item )->Outline(); + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) + polyset = static_cast( item )->Outline(); else polyset = &static_cast( item )->GetPolyShape(); @@ -1944,8 +1944,8 @@ int POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) PCB_SHAPE* graphicItem = dynamic_cast( item ); BOARD_COMMIT commit( frame ); - if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T || - ( graphicItem && graphicItem->GetShape() == S_POLYGON ) ) + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T + || ( graphicItem && graphicItem->GetShape() == S_POLYGON ) ) { unsigned int nearestIdx = 0; unsigned int nextNearestIdx = 0; @@ -1953,9 +1953,9 @@ int POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) unsigned int firstPointInContour = 0; SHAPE_POLY_SET* zoneOutline; - if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T ) + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) { - ZONE_CONTAINER* zone = static_cast( item ); + ZONE* zone = static_cast( item ); zoneOutline = zone->Outline(); zone->SetNeedRefill( true ); } @@ -2009,8 +2009,8 @@ int POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) zoneOutline->InsertVertex( nextNearestIdx, nearestPoint ); // We re-hatch the filled zones but not polygons - if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T ) - static_cast( item )->HatchBorder(); + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) + static_cast( item )->HatchBorder(); commit.Push( _( "Add a zone corner" ) ); @@ -2071,9 +2071,9 @@ int POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent ) SHAPE_POLY_SET* polygon = nullptr; - if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T ) + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) { - auto zone = static_cast( item ); + ZONE* zone = static_cast( item ); polygon = zone->Outline(); zone->SetNeedRefill( true ); } @@ -2125,8 +2125,8 @@ int POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent ) commit.Push( _( "Remove a zone/polygon corner" ) ); // Refresh zone hatching - if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_FP_ZONE_AREA_T ) - static_cast( item )->HatchBorder(); + if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) + static_cast( item )->HatchBorder(); updatePoints(); } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 35be558493..ee53647d2c 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -33,7 +33,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include #include @@ -786,7 +786,7 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock() case PCB_FP_SHAPE_T: case PCB_FP_TEXT_T: - case PCB_FP_ZONE_AREA_T: + case PCB_FP_ZONE_T: if( static_cast( item->GetParent() )->IsLocked() ) containsLocked = true; break; @@ -1423,7 +1423,7 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard include = aFilterOptions.includeVias; break; } - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: { include = aFilterOptions.includeZones; break; @@ -1544,9 +1544,9 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem ) break; - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: { - ZONE_CONTAINER* zone = static_cast( aItem ); + ZONE* zone = static_cast( aItem ); if( ( !m_filter.zones && !zone->GetIsRuleArea() ) || ( !m_filter.keepouts && zone->GetIsRuleArea() ) ) @@ -1848,13 +1848,13 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn switch( aItem->Type() ) { - case PCB_ZONE_AREA_T: - case PCB_FP_ZONE_AREA_T: + case PCB_ZONE_T: + case PCB_FP_ZONE_T: { if( !board()->IsElementVisible( LAYER_ZONES ) ) return false; - const ZONE_CONTAINER* zone = static_cast( aItem ); + const ZONE* zone = static_cast( aItem ); // Check to see if this keepout is part of a footprint // If it is, and we are not editing the footprint, it should not be selectable @@ -1907,7 +1907,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn return true; } - for( ZONE_CONTAINER* zone : module->Zones() ) + for( ZONE* zone : module->Zones() ) { if( Selectable( zone, true ) ) return true; @@ -2313,13 +2313,13 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, } // Zone edges are very specific; zone fills much less so. - if( aCollector.CountType( PCB_ZONE_AREA_T ) > 0 ) + if( aCollector.CountType( PCB_ZONE_T ) > 0 ) { for( int i = aCollector.GetCount() - 1; i >= 0; i-- ) { - if( aCollector[i]->Type() == PCB_ZONE_AREA_T ) + if( aCollector[i]->Type() == PCB_ZONE_T ) { - auto zone = static_cast( aCollector[i] ); + ZONE* zone = static_cast( aCollector[i] ); if( zone->HitTestForEdge( where, 5 * aCollector.GetGuide()->OnePixelInIU() ) ) preferred.insert( zone ); @@ -2460,7 +2460,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, // MODULE::CoverageRatio() doesn't take zone handles & borders into account so just // use a more aggressive cutoff point if zones are involved. - if( aCollector.CountType( PCB_ZONE_AREA_T ) ) + if( aCollector.CountType( PCB_ZONE_T ) ) maxCoverRatio /= 2; for( int i = 0; i < aCollector.GetCount(); ++i ) diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index 814c8bffe1..6e2a5517c8 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ ZONE_CREATE_HELPER::~ZONE_CREATE_HELPER() } -std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout ) +std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout ) { PCB_BASE_EDIT_FRAME* frame = m_tool.getEditFrame(); BOARD* board = frame->GetBoard(); @@ -100,13 +100,13 @@ std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout controls->WarpCursor( controls->GetCursorPosition(), true ); } - // The new zone is a ZONE_CONTAINER if created in the board editor - // and a MODULE_ZONE_CONTAINER if created in the footprint editor + // The new zone is a ZONE if created in the board editor and a FP_ZONE if created in the + // footprint editor wxASSERT( !m_tool.m_isFootprintEditor || ( parent->Type() == PCB_MODULE_T ) ); - std::unique_ptr newZone = m_tool.m_isFootprintEditor ? - std::make_unique( parent ) : - std::make_unique( parent ); + std::unique_ptr newZone = m_tool.m_isFootprintEditor ? + std::make_unique( parent ) : + std::make_unique( parent ); // Apply the selected settings zoneInfo.ExportSetting( *newZone ); @@ -115,12 +115,11 @@ std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout } -std::unique_ptr ZONE_CREATE_HELPER::createZoneFromExisting( - const ZONE_CONTAINER& aSrcZone ) +std::unique_ptr ZONE_CREATE_HELPER::createZoneFromExisting( const ZONE& aSrcZone ) { - auto& board = *m_tool.getModel(); + BOARD* board = m_tool.getModel(); - auto newZone = std::make_unique( &board ); + std::unique_ptr newZone = std::make_unique( board ); ZONE_SETTINGS zoneSettings; zoneSettings << aSrcZone; @@ -131,11 +130,11 @@ std::unique_ptr ZONE_CREATE_HELPER::createZoneFromExisting( } -void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINER& aCutout ) +void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, ZONE& aCutout ) { BOARD_COMMIT commit( &m_tool ); BOARD* board = m_tool.getModel(); - std::vector newZones; + std::vector newZones; // Clear the selection before removing the old zone auto toolMgr = m_tool.GetManager(); @@ -157,7 +156,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE for (int hole = 0; hole < originalOutline.HoleCount( outline ) ; hole++ ) newZoneOutline->AddHole( originalOutline.CHole( outline, hole ) ); - auto newZone = new ZONE_CONTAINER( aZone ); + auto newZone = new ZONE( aZone ); newZone->SetOutline( newZoneOutline ); newZone->SetLocalFlags( 1 ); newZone->HatchBorder(); @@ -191,7 +190,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE } -void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) +void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) { switch ( m_params.m_mode ) { @@ -211,7 +210,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) if( !m_params.m_keepout ) { ZONE_FILLER filler( m_tool.getModel(), &bCommit ); - std::vector toFill = { aZone.get() }; + std::vector toFill = { aZone.get() }; if( !filler.Fill( toFill ) ) { diff --git a/pcbnew/tools/zone_create_helper.h b/pcbnew/tools/zone_create_helper.h index 440f2958b0..5c66c06006 100644 --- a/pcbnew/tools/zone_create_helper.h +++ b/pcbnew/tools/zone_create_helper.h @@ -35,10 +35,9 @@ class VIEW; } /** - * This class is an adjuct helper to the DRAWING_TOOL interactive - * tool, which handles incoming geometry changes from a - * POLYGON_GEOM_MANAGER and translates that into a ZONE_CONTAINER - * based on given parameters + * This class is an adjuct helper to the DRAWING_TOOL interactive tool, which handles incoming + * geometry changes from a POLYGON_GEOM_MANAGER and translates that into a ZONE based on given + * parameters */ class ZONE_CREATE_HELPER : public POLYGON_GEOM_MANAGER::CLIENT { @@ -59,7 +58,7 @@ public: ZONE_MODE m_mode; ///> Zone settings source (for similar and cutout zones) - ZONE_CONTAINER* m_sourceZone; + ZONE* m_sourceZone; ///> Zone leader mode POLYGON_GEOM_MANAGER::LEADER_MODE m_leaderMode; @@ -73,7 +72,7 @@ public: virtual ~ZONE_CREATE_HELPER(); - ZONE_CONTAINER* GetZone() const { return m_zone.get(); } + ZONE* GetZone() const { return m_zone.get(); } /* * Interface for receiving POLYGON_GEOM_MANAGER update @@ -94,7 +93,7 @@ public: * @param aKeepout should the zone be a keepout * @return the new zone, can be null if the user aborted */ - std::unique_ptr createNewZone( bool aKeepout ); + std::unique_ptr createNewZone( bool aKeepout ); /** * Function createZoneFromExisting @@ -104,7 +103,7 @@ public: * @param aSrcZone the zone to copy settings from * @return the new zone */ - std::unique_ptr createZoneFromExisting( const ZONE_CONTAINER& aSrcZone ); + std::unique_ptr createZoneFromExisting( const ZONE& aSrcZone ); /** * Function performZoneCutout() @@ -115,7 +114,7 @@ public: * @param aZone the zone to removed area from * @param aCutout the area to remove */ - void performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINER& aCutout ); + void performZoneCutout( ZONE& aZone, ZONE& aCutout ); /** * Commit the current zone-in-progress to the BOARD. This might @@ -124,7 +123,7 @@ public: * * @param aZone - the drawn zone outline to commit */ - void commitZone( std::unique_ptr aZone ); + void commitZone( std::unique_ptr aZone ); private: @@ -140,7 +139,7 @@ private: KIGFX::VIEW& m_parentView; ///> The zone-in-progress - std::unique_ptr m_zone; + std::unique_ptr m_zone; }; #endif /* __DRAWING_TOOL_H */ diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp index 99f2751794..4a9a019c9a 100644 --- a/pcbnew/tools/zone_filler_tool.cpp +++ b/pcbnew/tools/zone_filler_tool.cpp @@ -24,7 +24,7 @@ */ #include #include -#include +#include #include #include #include @@ -58,7 +58,7 @@ void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRep if( !getEditFrame()->m_ZoneFillsDirty ) return; - std::vector toFill; + std::vector toFill; for( auto zone : board()->Zones() ) toFill.push_back(zone); @@ -95,11 +95,11 @@ void ZONE_FILLER_TOOL::singleShotRefocus( wxIdleEvent& ) void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter ) { - std::vector toFill; + std::vector toFill; BOARD_COMMIT commit( this ); - for( ZONE_CONTAINER* zone : board()->Zones() ) + for( ZONE* zone : board()->Zones() ) toFill.push_back( zone ); ZONE_FILLER filler( board(), &commit ); @@ -151,20 +151,19 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo int ZONE_FILLER_TOOL::ZoneFill( const TOOL_EVENT& aEvent ) { - std::vector toFill; + std::vector toFill; BOARD_COMMIT commit( this ); - if( auto passedZone = aEvent.Parameter() ) + if( ZONE* passedZone = aEvent.Parameter() ) { - if( passedZone->Type() == PCB_ZONE_AREA_T ) - toFill.push_back( passedZone ); + toFill.push_back( passedZone ); } else { - for( auto item : selection() ) + for( EDA_ITEM* item : selection() ) { - if( auto zone = dyn_cast( item ) ) + if( ZONE* zone = dynamic_cast( item ) ) toFill.push_back( zone ); } } @@ -195,9 +194,9 @@ int ZONE_FILLER_TOOL::ZoneUnfill( const TOOL_EVENT& aEvent ) for( EDA_ITEM* item : selection() ) { - assert( item->Type() == PCB_ZONE_AREA_T ); + assert( item->Type() == PCB_ZONE_T ); - ZONE_CONTAINER* zone = static_cast( item ); + ZONE* zone = static_cast( item ); commit.Modify( zone ); @@ -216,7 +215,7 @@ int ZONE_FILLER_TOOL::ZoneUnfillAll( const TOOL_EVENT& aEvent ) { BOARD_COMMIT commit( this ); - for( ZONE_CONTAINER* zone : board()->Zones() ) + for( ZONE* zone : board()->Zones() ) { commit.Modify( zone ); diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index 0459e63712..70a8924e17 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -31,9 +31,9 @@ using namespace std::placeholders; #include #include #include -#include +#include #include -#include +#include #include #include #include @@ -130,7 +130,7 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem ) return true; } - for( ZONE_CONTAINER* item : aPcb->Zones() ) + for( ZONE* item : aPcb->Zones() ) { if( aItem == static_cast( item ) ) return true; @@ -440,7 +440,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool deep_reBuild_ratsnest = true; // Pointers on pads can be invalid KI_FALLTHROUGH; - case PCB_ZONE_AREA_T: + case PCB_ZONE_T: case PCB_TRACE_T: case PCB_ARC_T: case PCB_VIA_T: diff --git a/pcbnew/class_zone.cpp b/pcbnew/zone.cpp similarity index 82% rename from pcbnew/class_zone.cpp rename to pcbnew/zone.cpp index bbb7e57213..ee67727eb4 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/zone.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,9 +38,9 @@ #include #include -ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInFP ) - : BOARD_CONNECTED_ITEM( aParent, aInFP ? PCB_FP_ZONE_AREA_T : PCB_ZONE_AREA_T ), - m_area( 0.0 ) +ZONE::ZONE( BOARD_ITEM_CONTAINER* aParent, bool aInFP ) : + BOARD_CONNECTED_ITEM( aParent, aInFP ? PCB_FP_ZONE_T : PCB_ZONE_T ), + m_area( 0.0 ) { m_CornerSelection = nullptr; // no corner is selected m_isFilled = false; // fill status : true when the zone is filled @@ -75,7 +75,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInFP ) } -ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) +ZONE::ZONE( const ZONE& aZone ) : BOARD_CONNECTED_ITEM( aZone ), m_Poly( nullptr ), m_CornerSelection( nullptr ) @@ -84,7 +84,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) } -ZONE_CONTAINER& ZONE_CONTAINER::operator=( const ZONE_CONTAINER& aOther ) +ZONE& ZONE::operator=( const ZONE& aOther ) { BOARD_CONNECTED_ITEM::operator=( aOther ); @@ -94,14 +94,14 @@ ZONE_CONTAINER& ZONE_CONTAINER::operator=( const ZONE_CONTAINER& aOther ) } -ZONE_CONTAINER::~ZONE_CONTAINER() +ZONE::~ZONE() { delete m_Poly; delete m_CornerSelection; } -void ZONE_CONTAINER::InitDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone ) +void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone ) { // members are expected non initialize in this. // InitDataFromSrcInCopyCtor() is expected to be called @@ -176,13 +176,13 @@ void ZONE_CONTAINER::InitDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone ) } -EDA_ITEM* ZONE_CONTAINER::Clone() const +EDA_ITEM* ZONE::Clone() const { - return new ZONE_CONTAINER( *this ); + return new ZONE( *this ); } -bool ZONE_CONTAINER::UnFill() +bool ZONE::UnFill() { bool change = false; @@ -205,25 +205,25 @@ bool ZONE_CONTAINER::UnFill() } -wxPoint ZONE_CONTAINER::GetPosition() const +wxPoint ZONE::GetPosition() const { return (wxPoint) GetCornerPosition( 0 ); } -PCB_LAYER_ID ZONE_CONTAINER::GetLayer() const +PCB_LAYER_ID ZONE::GetLayer() const { return BOARD_ITEM::GetLayer(); } -bool ZONE_CONTAINER::IsOnCopperLayer() const +bool ZONE::IsOnCopperLayer() const { return ( m_layerSet & LSET::AllCuMask() ).count() > 0; } -bool ZONE_CONTAINER::CommonLayerExists( const LSET aLayerSet ) const +bool ZONE::CommonLayerExists( const LSET aLayerSet ) const { LSET common = GetLayerSet() & aLayerSet; @@ -231,7 +231,7 @@ bool ZONE_CONTAINER::CommonLayerExists( const LSET aLayerSet ) const } -void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer ) +void ZONE::SetLayer( PCB_LAYER_ID aLayer ) { SetLayerSet( LSET( aLayer ) ); @@ -239,7 +239,7 @@ void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer ) } -void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet ) +void ZONE::SetLayerSet( LSET aLayerSet ) { if( GetIsRuleArea() ) { @@ -284,13 +284,13 @@ void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet ) } -LSET ZONE_CONTAINER::GetLayerSet() const +LSET ZONE::GetLayerSet() const { return m_layerSet; } -void ZONE_CONTAINER::ViewGetLayers( int aLayers[], int& aCount ) const +void ZONE::ViewGetLayers( int aLayers[], int& aCount ) const { LSEQ layers = m_layerSet.Seq(); @@ -301,7 +301,7 @@ void ZONE_CONTAINER::ViewGetLayers( int aLayers[], int& aCount ) const } -double ZONE_CONTAINER::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const +double ZONE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { constexpr double HIDE = std::numeric_limits::max(); @@ -309,13 +309,13 @@ double ZONE_CONTAINER::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const } -bool ZONE_CONTAINER::IsOnLayer( PCB_LAYER_ID aLayer ) const +bool ZONE::IsOnLayer( PCB_LAYER_ID aLayer ) const { return m_layerSet.test( aLayer ); } -const EDA_RECT ZONE_CONTAINER::GetBoundingBox() const +const EDA_RECT ZONE::GetBoundingBox() const { auto bb = m_Poly->BBox(); @@ -325,7 +325,7 @@ const EDA_RECT ZONE_CONTAINER::GetBoundingBox() const } -int ZONE_CONTAINER::GetThermalReliefGap( D_PAD* aPad, wxString* aSource ) const +int ZONE::GetThermalReliefGap( D_PAD* aPad, wxString* aSource ) const { if( aPad->GetEffectiveThermalGap() == 0 ) { @@ -340,7 +340,7 @@ int ZONE_CONTAINER::GetThermalReliefGap( D_PAD* aPad, wxString* aSource ) const } -int ZONE_CONTAINER::GetThermalReliefSpokeWidth( D_PAD* aPad, wxString* aSource ) const +int ZONE::GetThermalReliefSpokeWidth( D_PAD* aPad, wxString* aSource ) const { if( aPad->GetEffectiveThermalSpokeWidth() == 0 ) { @@ -354,7 +354,7 @@ int ZONE_CONTAINER::GetThermalReliefSpokeWidth( D_PAD* aPad, wxString* aSource ) } -void ZONE_CONTAINER::SetCornerRadius( unsigned int aRadius ) +void ZONE::SetCornerRadius( unsigned int aRadius ) { if( m_cornerRadius != aRadius ) SetNeedRefill( true ); @@ -363,7 +363,7 @@ void ZONE_CONTAINER::SetCornerRadius( unsigned int aRadius ) } -bool ZONE_CONTAINER::GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const +bool ZONE::GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const { if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) ) return false; @@ -372,7 +372,7 @@ bool ZONE_CONTAINER::GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const } -bool ZONE_CONTAINER::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool ZONE::HitTest( const wxPoint& aPosition, int aAccuracy ) const { // Normally accuracy is zoom-relative, but for the generic HitTest we just use // a fixed (small) value. @@ -382,7 +382,7 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -void ZONE_CONTAINER::SetSelectedCorner( const wxPoint& aPosition, int aAccuracy ) +void ZONE::SetSelectedCorner( const wxPoint& aPosition, int aAccuracy ) { SHAPE_POLY_SET::VERTEX_INDEX corner; @@ -397,35 +397,35 @@ void ZONE_CONTAINER::SetSelectedCorner( const wxPoint& aPosition, int aAccuracy } } -bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos, int aAccuracy, - SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const +bool ZONE::HitTestForCorner( const wxPoint& refPos, int aAccuracy, + SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const { return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy ); } -bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const +bool ZONE::HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const { SHAPE_POLY_SET::VERTEX_INDEX dummy; return HitTestForCorner( refPos, aAccuracy, dummy ); } -bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos, int aAccuracy, - SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const +bool ZONE::HitTestForEdge( const wxPoint& refPos, int aAccuracy, + SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const { return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy ); } -bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const +bool ZONE::HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const { SHAPE_POLY_SET::VERTEX_INDEX dummy; return HitTestForEdge( refPos, aAccuracy, dummy ); } -bool ZONE_CONTAINER::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const +bool ZONE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const { // Calculate bounding box for zone EDA_RECT bbox = GetBoundingBox(); @@ -466,7 +466,7 @@ bool ZONE_CONTAINER::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur } -int ZONE_CONTAINER::GetLocalClearance( wxString* aSource ) const +int ZONE::GetLocalClearance( wxString* aSource ) const { if( m_isRuleArea ) return 0; @@ -478,8 +478,7 @@ int ZONE_CONTAINER::GetLocalClearance( wxString* aSource ) const } -bool ZONE_CONTAINER::HitTestFilledArea( PCB_LAYER_ID aLayer, const wxPoint &aRefPos, - int aAccuracy ) const +bool ZONE::HitTestFilledArea( PCB_LAYER_ID aLayer, const wxPoint &aRefPos, int aAccuracy ) const { // Rule areas have no filled area, but it's generally nice to treat their interior as if it were // filled so that people don't have to select them by their outline (which is min-width) @@ -494,7 +493,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( PCB_LAYER_ID aLayer, const wxPoint &aRef } -bool ZONE_CONTAINER::HitTestCutout( const VECTOR2I& aRefPos, int* aOutlineIdx, int* aHoleIdx ) const +bool ZONE::HitTestCutout( const VECTOR2I& aRefPos, int* aOutlineIdx, int* aHoleIdx ) const { // Iterate over each outline polygon in the zone and then iterate over // each hole it has to see if the point is in it. @@ -519,7 +518,7 @@ bool ZONE_CONTAINER::HitTestCutout( const VECTOR2I& aRefPos, int* aOutlineIdx, i } -void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { EDA_UNITS units = aFrame->GetUserUnits(); wxString msg, msg2; @@ -663,7 +662,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorMove( offset ); @@ -684,7 +683,7 @@ void ZONE_CONTAINER::Move( const wxPoint& offset ) } -void ZONE_CONTAINER::MoveEdge( const wxPoint& offset, int aEdge ) +void ZONE::MoveEdge( const wxPoint& offset, int aEdge ) { int next_corner; @@ -699,7 +698,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset, int aEdge ) } -void ZONE_CONTAINER::Rotate( const wxPoint& aCentre, double aAngle ) +void ZONE::Rotate( const wxPoint& aCentre, double aAngle ) { aAngle = -DECIDEG2RAD( aAngle ); @@ -725,7 +724,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& aCentre, double aAngle ) } -void ZONE_CONTAINER::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void ZONE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) { Mirror( aCentre, aFlipLeftRight ); int copperLayerCount = GetBoard()->GetCopperLayerCount(); @@ -737,9 +736,9 @@ void ZONE_CONTAINER::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void ZONE_CONTAINER::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight ) +void ZONE::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight ) { - // ZONE_CONTAINERs mirror about the x-axis (why?!?) + // ZONEs mirror about the x-axis (why?!?) m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) ); HatchBorder(); @@ -766,7 +765,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight ) } -ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection( D_PAD* aPad, wxString* aSource ) const +ZONE_CONNECTION ZONE::GetPadConnection( D_PAD* aPad, wxString* aSource ) const { if( aPad == NULL || aPad->GetEffectiveZoneConnection() == ZONE_CONNECTION::INHERITED ) { @@ -782,7 +781,7 @@ ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection( D_PAD* aPad, wxString* aSource } -void ZONE_CONTAINER::RemoveCutout( int aOutlineIdx, int aHoleIdx ) +void ZONE::RemoveCutout( int aOutlineIdx, int aHoleIdx ) { // Ensure the requested cutout is valid if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx ) @@ -797,7 +796,7 @@ void ZONE_CONTAINER::RemoveCutout( int aOutlineIdx, int aHoleIdx ) } -void ZONE_CONTAINER::AddPolygon( const SHAPE_LINE_CHAIN& aPolygon ) +void ZONE::AddPolygon( const SHAPE_LINE_CHAIN& aPolygon ) { wxASSERT( aPolygon.IsClosed() ); @@ -811,7 +810,7 @@ void ZONE_CONTAINER::AddPolygon( const SHAPE_LINE_CHAIN& aPolygon ) } -void ZONE_CONTAINER::AddPolygon( std::vector< wxPoint >& aPolygon ) +void ZONE::AddPolygon( std::vector< wxPoint >& aPolygon ) { if( aPolygon.empty() ) return; @@ -828,7 +827,7 @@ void ZONE_CONTAINER::AddPolygon( std::vector< wxPoint >& aPolygon ) } -bool ZONE_CONTAINER::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication ) +bool ZONE::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication ) { // Ensure the main outline exists: if( m_Poly->OutlineCount() == 0 ) @@ -848,7 +847,7 @@ bool ZONE_CONTAINER::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowD } -wxString ZONE_CONTAINER::GetSelectMenuText( EDA_UNITS aUnits ) const +wxString ZONE::GetSelectMenuText( EDA_UNITS aUnits ) const { wxString text; @@ -879,14 +878,14 @@ wxString ZONE_CONTAINER::GetSelectMenuText( EDA_UNITS aUnits ) const } -int ZONE_CONTAINER::GetBorderHatchPitch() const +int ZONE::GetBorderHatchPitch() const { return m_borderHatchPitch; } -void ZONE_CONTAINER::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch, - bool aRebuildHatch ) +void ZONE::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch, + bool aRebuildHatch ) { SetHatchPitch( aHatchPitch ); m_borderStyle = aHatchStyle; @@ -896,13 +895,13 @@ void ZONE_CONTAINER::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyl } -void ZONE_CONTAINER::SetHatchPitch( int aPitch ) +void ZONE::SetHatchPitch( int aPitch ) { m_borderHatchPitch = aPitch; } -void ZONE_CONTAINER::UnHatchBorder() +void ZONE::UnHatchBorder() { m_borderHatchLines.clear(); } @@ -916,7 +915,7 @@ bool sortEndsByDescendingX( const VECTOR2I& ref, const VECTOR2I& tst ) } -void ZONE_CONTAINER::HatchBorder() +void ZONE::HatchBorder() { UnHatchBorder(); @@ -1083,27 +1082,27 @@ void ZONE_CONTAINER::HatchBorder() } -int ZONE_CONTAINER::GetDefaultHatchPitch() +int ZONE::GetDefaultHatchPitch() { return Mils2iu( 20 ); } -BITMAP_DEF ZONE_CONTAINER::GetMenuImage() const +BITMAP_DEF ZONE::GetMenuImage() const { return add_zone_xpm; } -void ZONE_CONTAINER::SwapData( BOARD_ITEM* aImage ) +void ZONE::SwapData( BOARD_ITEM* aImage ) { - assert( aImage->Type() == PCB_ZONE_AREA_T ); + assert( aImage->Type() == PCB_ZONE_T ); - std::swap( *((ZONE_CONTAINER*) this), *((ZONE_CONTAINER*) aImage) ); + std::swap( *((ZONE*) this), *((ZONE*) aImage) ); } -void ZONE_CONTAINER::CacheTriangulation( PCB_LAYER_ID aLayer ) +void ZONE::CacheTriangulation( PCB_LAYER_ID aLayer ) { if( aLayer == UNDEFINED_LAYER ) { @@ -1118,7 +1117,7 @@ void ZONE_CONTAINER::CacheTriangulation( PCB_LAYER_ID aLayer ) } -bool ZONE_CONTAINER::IsIsland( PCB_LAYER_ID aLayer, int aPolyIdx ) +bool ZONE::IsIsland( PCB_LAYER_ID aLayer, int aPolyIdx ) { if( GetNetCode() < 1 ) return true; @@ -1130,12 +1129,11 @@ bool ZONE_CONTAINER::IsIsland( PCB_LAYER_ID aLayer, int aPolyIdx ) } -void ZONE_CONTAINER::GetInteractingZones( PCB_LAYER_ID aLayer, - std::vector* aZones ) const +void ZONE::GetInteractingZones( PCB_LAYER_ID aLayer, std::vector* aZones ) const { int epsilon = Millimeter2iu( 0.001 ); - for( ZONE_CONTAINER* candidate : GetBoard()->Zones() ) + for( ZONE* candidate : GetBoard()->Zones() ) { if( candidate == this ) continue; @@ -1161,9 +1159,9 @@ void ZONE_CONTAINER::GetInteractingZones( PCB_LAYER_ID aLayer, } -bool ZONE_CONTAINER::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer, - SHAPE_POLY_SET* aBoardOutline, - SHAPE_POLY_SET* aSmoothedPolyWithApron ) const +bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer, + SHAPE_POLY_SET* aBoardOutline, + SHAPE_POLY_SET* aSmoothedPolyWithApron ) const { if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ... return false; @@ -1204,7 +1202,7 @@ bool ZONE_CONTAINER::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER } }; - std::vector interactingZones; + std::vector interactingZones; GetInteractingZones( aLayer, &interactingZones ); SHAPE_POLY_SET* maxExtents = m_Poly; @@ -1223,7 +1221,7 @@ bool ZONE_CONTAINER::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER maxExtents = &withFillets; } - for( ZONE_CONTAINER* zone : interactingZones ) + for( ZONE* zone : interactingZones ) aSmoothedPoly.BooleanAdd( *zone->Outline(), SHAPE_POLY_SET::PM_FAST ); if( !GetIsRuleArea() && aBoardOutline ) @@ -1245,7 +1243,7 @@ bool ZONE_CONTAINER::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER } -double ZONE_CONTAINER::CalculateFilledArea() +double ZONE::CalculateFilledArea() { m_area = 0.0; @@ -1273,9 +1271,8 @@ double ZONE_CONTAINER::CalculateFilledArea() * Convert the smoothed outline to polygons (optionally inflated by \a aClearance) and copy them * into \a aCornerBuffer. */ -void ZONE_CONTAINER::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, - int aClearance, - SHAPE_POLY_SET* aBoardOutline ) const +void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearance, + SHAPE_POLY_SET* aBoardOutline ) const { // Creates the zone outline polygon (with holes if any) SHAPE_POLY_SET polybuffer; @@ -1301,10 +1298,10 @@ void ZONE_CONTAINER::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerB // -/********* MODULE_ZONE_CONTAINER **************/ +/********* FP_ZONE **************/ // -MODULE_ZONE_CONTAINER::MODULE_ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ) : - ZONE_CONTAINER( aParent, true ) +FP_ZONE::FP_ZONE( BOARD_ITEM_CONTAINER* aParent ) : + ZONE( aParent, true ) { // in a footprint, net classes are not managed. // so set the net to NETINFO_LIST::ORPHANED_ITEM @@ -1312,27 +1309,27 @@ MODULE_ZONE_CONTAINER::MODULE_ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ) : } -MODULE_ZONE_CONTAINER::MODULE_ZONE_CONTAINER( const MODULE_ZONE_CONTAINER& aZone ) - : ZONE_CONTAINER( aZone.GetParent(), true ) +FP_ZONE::FP_ZONE( const FP_ZONE& aZone ) : + ZONE( aZone.GetParent(), true ) { InitDataFromSrcInCopyCtor( aZone ); } -MODULE_ZONE_CONTAINER& MODULE_ZONE_CONTAINER::operator=( const MODULE_ZONE_CONTAINER& aOther ) +FP_ZONE& FP_ZONE::operator=( const FP_ZONE& aOther ) { - ZONE_CONTAINER::operator=( aOther ); + ZONE::operator=( aOther ); return *this; } -EDA_ITEM* MODULE_ZONE_CONTAINER::Clone() const +EDA_ITEM* FP_ZONE::Clone() const { - return new MODULE_ZONE_CONTAINER( *this ); + return new FP_ZONE( *this ); } -double MODULE_ZONE_CONTAINER::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const +double FP_ZONE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { constexpr double HIDE = (double)std::numeric_limits::max(); @@ -1356,7 +1353,7 @@ double MODULE_ZONE_CONTAINER::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const } -std::shared_ptr ZONE_CONTAINER::GetEffectiveShape( PCB_LAYER_ID aLayer ) const +std::shared_ptr ZONE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const { std::shared_ptr shape; @@ -1373,9 +1370,9 @@ std::shared_ptr ZONE_CONTAINER::GetEffectiveShape( PCB_LAYER_ID aLayer ) } -static struct ZONE_CONTAINER_DESC +static struct ZONE_DESC { - ZONE_CONTAINER_DESC() + ZONE_DESC() { ENUM_MAP::Instance() .Map( ZONE_CONNECTION::INHERITED, _HKI( "Inherited" ) ) @@ -1385,29 +1382,29 @@ static struct ZONE_CONTAINER_DESC .Map( ZONE_CONNECTION::THT_THERMAL, _HKI( "Reliefs for PTH" ) ); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); - REGISTER_TYPE( ZONE_CONTAINER ); - propMgr.InheritsAfter( TYPE_HASH( ZONE_CONTAINER ), TYPE_HASH( BOARD_CONNECTED_ITEM ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Priority" ), - &ZONE_CONTAINER::SetPriority, &ZONE_CONTAINER::GetPriority ) ); - //propMgr.AddProperty( new PROPERTY( "Filled", - //&ZONE_CONTAINER::SetIsFilled, &ZONE_CONTAINER::IsFilled ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Name" ), - &ZONE_CONTAINER::SetZoneName, &ZONE_CONTAINER::GetZoneName ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Clearance" ), - &ZONE_CONTAINER::SetLocalClearance, &ZONE_CONTAINER::GetLocalClearance, + REGISTER_TYPE( ZONE ); + propMgr.InheritsAfter( TYPE_HASH( ZONE ), TYPE_HASH( BOARD_CONNECTED_ITEM ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Priority" ), + &ZONE::SetPriority, &ZONE::GetPriority ) ); + //propMgr.AddProperty( new PROPERTY( "Filled", + //&ZONE::SetIsFilled, &ZONE::IsFilled ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Name" ), + &ZONE::SetZoneName, &ZONE::GetZoneName ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Clearance" ), + &ZONE::SetLocalClearance, &ZONE::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Min Width" ), - &ZONE_CONTAINER::SetMinThickness, &ZONE_CONTAINER::GetMinThickness, + propMgr.AddProperty( new PROPERTY( _HKI( "Min Width" ), + &ZONE::SetMinThickness, &ZONE::GetMinThickness, PROPERTY_DISPLAY::DISTANCE ) ); - propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Pad Connections" ), - &ZONE_CONTAINER::SetPadConnection, &ZONE_CONTAINER::GetPadConnection ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Clearance" ), - &ZONE_CONTAINER::SetThermalReliefGap, &ZONE_CONTAINER::GetThermalReliefGap, + propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Pad Connections" ), + &ZONE::SetPadConnection, &ZONE::GetPadConnection ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Clearance" ), + &ZONE::SetThermalReliefGap, &ZONE::GetThermalReliefGap, PROPERTY_DISPLAY::DISTANCE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Spoke Width" ), - &ZONE_CONTAINER::SetThermalReliefSpokeWidth, &ZONE_CONTAINER::GetThermalReliefSpokeWidth, + propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Spoke Width" ), + &ZONE::SetThermalReliefSpokeWidth, &ZONE::GetThermalReliefSpokeWidth, PROPERTY_DISPLAY::DISTANCE ) ); } -} _ZONE_CONTAINER_DESC; +} _ZONE_DESC; ENUM_TO_WXANY( ZONE_CONNECTION ); diff --git a/pcbnew/class_zone.h b/pcbnew/zone.h similarity index 94% rename from pcbnew/class_zone.h rename to pcbnew/zone.h index 736dc63d0a..7c0ba8ce36 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/zone.h @@ -22,12 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file class_zone.h - */ - -#ifndef CLASS_ZONE_H_ -#define CLASS_ZONE_H_ +#ifndef ZONE_H +#define ZONE_H #include @@ -44,48 +40,47 @@ class EDA_RECT; class LINE_READER; class PCB_EDIT_FRAME; class BOARD; -class ZONE_CONTAINER; +class ZONE; class MSG_PANEL_ITEM; typedef std::vector ZONE_SEGMENT_FILL; /** - * ZONE_CONTAINER + * ZONE * handles a list of polygons defining a copper zone. * A zone is described by a main polygon, a time stamp, a layer or a lyer set, and a net name. * Other polygons inside the main polygon are holes in the zone. * - * a item ZONE_CONTAINER is living in a board - * a variant MODULE_ZONE_CONTAINER is living in a footprint + * a item ZONE is living in a board + * a variant FP_ZONE is living in a footprint */ -class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM +class ZONE : public BOARD_CONNECTED_ITEM { public: /** - * The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER - * requirement. - * if aInFP is true, a MODULE_ZONE_CONTAINER is actually built + * The ctor to build ZONE, but comaptible with FP_ZONE requirement. + * if aInFP is true, a FP_ZONE is actually built * (same item, but with a specific type id: - * The type is PCB_ZONE_AREA_T for a ZONE_CONTAINER - * The type is PCB_FP_ZONE_AREA_T for a MODULE_ZONE_CONTAINER + * The type is PCB_ZONE_T for a ZONE + * The type is PCB_FP_ZONE_T for a FP_ZONE */ - ZONE_CONTAINER( BOARD_ITEM_CONTAINER* parent, bool aInFP = false ); + ZONE( BOARD_ITEM_CONTAINER* parent, bool aInFP = false ); - ZONE_CONTAINER( const ZONE_CONTAINER& aZone ); - ZONE_CONTAINER& operator=( const ZONE_CONTAINER &aOther ); + ZONE( const ZONE& aZone ); + ZONE& operator=( const ZONE &aOther ); - ~ZONE_CONTAINER(); + ~ZONE(); static inline bool ClassOf( const EDA_ITEM* aItem ) { - return aItem && aItem->Type() == PCB_ZONE_AREA_T; + return aItem && aItem->Type() == PCB_ZONE_T; } /** * Copy aZone data to me */ - void InitDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone ); + void InitDataFromSrcInCopyCtor( const ZONE& aZone ); /** * @return a wxPoint, position of the first point of the outline @@ -345,7 +340,7 @@ public: * merged due to other parameters such as fillet radius. The copper pour will end up * effectively merged though, so we need to do some calculations with them in mind. */ - void GetInteractingZones( PCB_LAYER_ID aLayer, std::vector* aZones ) const; + void GetInteractingZones( PCB_LAYER_ID aLayer, std::vector* aZones ) const; /** * Function TransformSolidAreasShapesToPolygon @@ -498,7 +493,7 @@ public: */ wxString GetClass() const override { - return wxT( "ZONE_CONTAINER" ); + return wxT( "ZONE" ); } /** Access to m_Poly parameters @@ -601,7 +596,7 @@ public: * info, filling is not taken into account * @param aZoneToCompare = zone to compare with "this" */ - bool IsSame( const ZONE_CONTAINER &aZoneToCompare ); + bool IsSame( const ZONE &aZoneToCompare ); /** * Function ClearFilledPolysList @@ -822,8 +817,6 @@ public: m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash(); } - - #if defined(DEBUG) virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } #endif @@ -938,9 +931,9 @@ protected: /// For each layer, a set of insulated islands that were not removed std::map> m_insulatedIslands; - bool m_hv45; // constrain edges to horizontal, vertical or 45º + bool m_hv45; // constrain edges to horiz, vert or 45º - double m_area; // The filled zone area + double m_area; // The filled zone area /// Lock used for multi-threaded filling on multi-layer zones std::mutex m_lock; @@ -948,23 +941,18 @@ protected: /** - * MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id - * ZONE_CONTAINER is living in a board - * MODULE_ZONE_CONTAINER is living in a footprint - * althougt the are similar, these items need a specific type to be easily managed - * in many functions using the type id in switches - * A few virtual methods are different + * FP_ZONE is a specialization of ZONE for use in footprints. */ -class MODULE_ZONE_CONTAINER : public ZONE_CONTAINER +class FP_ZONE : public ZONE { public: - MODULE_ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ); - MODULE_ZONE_CONTAINER( const MODULE_ZONE_CONTAINER& aZone ); - MODULE_ZONE_CONTAINER& operator=( const MODULE_ZONE_CONTAINER &aOther ); + FP_ZONE( BOARD_ITEM_CONTAINER* aParent ); + FP_ZONE( const FP_ZONE& aZone ); + FP_ZONE& operator=( const FP_ZONE &aOther ); EDA_ITEM* Clone() const override; double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; }; -#endif // CLASS_ZONE_H_ +#endif // ZONE_H diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index a2b6db9434..c23807507f 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -29,12 +29,12 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include @@ -84,9 +84,9 @@ void ZONE_FILLER::SetProgressReporter( PROGRESS_REPORTER* aReporter ) } -bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWindow* aParent ) +bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWindow* aParent ) { - std::vector> toFill; + std::vector> toFill; std::vector islandsList; std::shared_ptr connectivity = m_board->GetConnectivity(); @@ -113,7 +113,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin // Update and cache zone bounding boxes and pad effective shapes so that we don't have to // make them thread-safe. - for( ZONE_CONTAINER* zone : m_board->Zones() ) + for( ZONE* zone : m_board->Zones() ) { zone->CacheBoundingBox(); m_worstClearance = std::max( m_worstClearance, zone->GetLocalClearance() ); @@ -127,7 +127,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin pad->BuildEffectiveShapes( UNDEFINED_LAYER ); } - for( ZONE_CONTAINER* zone : module->Zones() ) + for( ZONE* zone : module->Zones() ) { zone->CacheBoundingBox(); m_worstClearance = std::max( m_worstClearance, zone->GetLocalClearance() ); @@ -136,12 +136,12 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin // Sort by priority to reduce deferrals waiting on higher priority zones. std::sort( aZones.begin(), aZones.end(), - []( const ZONE_CONTAINER* lhs, const ZONE_CONTAINER* rhs ) + []( const ZONE* lhs, const ZONE* rhs ) { return lhs->GetPriority() > rhs->GetPriority(); } ); - for( ZONE_CONTAINER* zone : aZones ) + for( ZONE* zone : aZones ) { // Rule areas are not filled if( zone->GetIsRuleArea() ) @@ -173,7 +173,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin std::atomic nextItem; auto check_fill_dependency = - [&]( ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, ZONE_CONTAINER* aOtherZone ) -> bool + [&]( ZONE* aZone, PCB_LAYER_ID aLayer, ZONE* aOtherZone ) -> bool { // Check to see if we have to knock-out the filled areas of a higher-priority // zone. If so we have to wait until said zone is filled before we can fill. @@ -213,13 +213,13 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin for( size_t i = nextItem++; i < toFill.size(); i = nextItem++ ) { - PCB_LAYER_ID layer = toFill[i].second; - ZONE_CONTAINER* zone = toFill[i].first; - bool canFill = true; + PCB_LAYER_ID layer = toFill[i].second; + ZONE* zone = toFill[i].first; + bool canFill = true; // Check for any fill dependencies. If our zone needs to be clipped by // another zone then we can't fill until that zone is filled. - for( ZONE_CONTAINER* otherZone : aZones ) + for( ZONE* otherZone : aZones ) { if( otherZone == zone ) continue; @@ -285,7 +285,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin } toFill.erase( std::remove_if( toFill.begin(), toFill.end(), - [&] ( const std::pair pair ) -> bool + [&] ( const std::pair pair ) -> bool { return pair.first->GetFillFlag( pair.second ); } ), @@ -313,7 +313,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin if( m_progressReporter && m_progressReporter->IsCancelled() ) return false; - for( ZONE_CONTAINER* zone : aZones ) + for( ZONE* zone : aZones ) { // Keepout zones are not filled if( zone->GetIsRuleArea() ) @@ -364,7 +364,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin } // Now remove islands outside the board edge - for( ZONE_CONTAINER* zone : aZones ) + for( ZONE* zone : aZones ) { LSET zoneCopperLayers = zone->GetLayerSet() & LSET::AllCuMask( MAX_CU_LAYERS ); @@ -395,7 +395,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin { bool outOfDate = false; - for( ZONE_CONTAINER* zone : aZones ) + for( ZONE* zone : aZones ) { // Keepout zones are not filled if( zone->GetIsRuleArea() ) @@ -502,7 +502,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin /** * Return true if the given pad has a thermal connection with the given zone. */ -bool hasThermalConnection( D_PAD* pad, const ZONE_CONTAINER* aZone ) +bool hasThermalConnection( D_PAD* pad, const ZONE* aZone ) { // Rejects non-standard pads with tht-only thermal reliefs if( aZone->GetPadConnection( pad ) == ZONE_CONNECTION::THT_THERMAL @@ -610,7 +610,7 @@ void ZONE_FILLER::addKnockout( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer, int aGap, * Removes thermal reliefs from the shape for any pads connected to the zone. Does NOT add * in spokes, which must be done later. */ -void ZONE_FILLER::knockoutThermalReliefs( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, +void ZONE_FILLER::knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aFill ) { SHAPE_POLY_SET holes; @@ -653,7 +653,7 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE_CONTAINER* aZone, PCB_LAYER * Removes clearance from the shape for copper items which share the zone's layer but are * not connected to it. */ -void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, +void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aHoles ) { long ticker = 0; @@ -843,7 +843,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA // Add non-connected zone clearances // auto knockoutZoneClearance = - [&]( ZONE_CONTAINER* aKnockout ) + [&]( ZONE* aKnockout ) { // If the zones share no common layers if( !aKnockout->GetLayerSet().test( aLayer ) ) @@ -879,7 +879,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA } }; - for( ZONE_CONTAINER* otherZone : m_board->Zones() ) + for( ZONE* otherZone : m_board->Zones() ) { if( checkForCancel( m_progressReporter ) ) return; @@ -897,7 +897,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA for( MODULE* module : m_board->Modules() ) { - for( ZONE_CONTAINER* otherZone : module->Zones() ) + for( ZONE* otherZone : module->Zones() ) { if( checkForCancel( m_progressReporter ) ) return; @@ -922,11 +922,11 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA * Removes the outlines of higher-proirity zones with the same net. These zones should be * in charge of the fill parameters within their own outlines. */ -void ZONE_FILLER::subtractHigherPriorityZones( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, +void ZONE_FILLER::subtractHigherPriorityZones( const ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawFill ) { auto knockoutZoneOutline = - [&]( ZONE_CONTAINER* aKnockout ) + [&]( ZONE* aKnockout ) { // If the zones share no common layers if( !aKnockout->GetLayerSet().test( aLayer ) ) @@ -938,7 +938,7 @@ void ZONE_FILLER::subtractHigherPriorityZones( const ZONE_CONTAINER* aZone, PCB_ } }; - for( ZONE_CONTAINER* otherZone : m_board->Zones() ) + for( ZONE* otherZone : m_board->Zones() ) { if( otherZone->GetNetCode() == aZone->GetNetCode() && otherZone->GetPriority() > aZone->GetPriority() ) @@ -949,7 +949,7 @@ void ZONE_FILLER::subtractHigherPriorityZones( const ZONE_CONTAINER* aZone, PCB_ for( MODULE* module : m_board->Modules() ) { - for( ZONE_CONTAINER* otherZone : module->Zones() ) + for( ZONE* otherZone : module->Zones() ) { if( otherZone->GetNetCode() == aZone->GetNetCode() && otherZone->GetPriority() > aZone->GetPriority() ) @@ -985,7 +985,7 @@ void ZONE_FILLER::subtractHigherPriorityZones( const ZONE_CONTAINER* aZone, PCB_ * 5 - Removes unconnected copper islands, deleting any affected spokes * 6 - Adds in the remaining spokes */ -bool ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, +bool ZONE_FILLER::computeRawFilledArea( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, const SHAPE_POLY_SET& aSmoothedOutline, const SHAPE_POLY_SET& aMaxExtents, @@ -1163,8 +1163,8 @@ bool ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, * The solid areas can be more than one on copper layers, and do not have holes * ( holes are linked by overlapping segments to the main outline) */ -bool ZONE_FILLER::fillSingleZone( ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, - SHAPE_POLY_SET& aRawPolys, SHAPE_POLY_SET& aFinalPolys ) +bool ZONE_FILLER::fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawPolys, + SHAPE_POLY_SET& aFinalPolys ) { SHAPE_POLY_SET* boardOutline = m_brdOutlinesValid ? &m_boardOutline : nullptr; SHAPE_POLY_SET maxExtents; @@ -1235,7 +1235,7 @@ bool ZONE_FILLER::fillSingleZone( ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, /** * Function buildThermalSpokes */ -void ZONE_FILLER::buildThermalSpokes( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, +void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, std::deque& aSpokesList ) { auto zoneBB = aZone->GetCachedBoundingBox(); @@ -1351,7 +1351,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE_CONTAINER* aZone, PCB_LAYER_ID } -bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, +bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, SHAPE_POLY_SET& aRawPolys ) { // Build grid: diff --git a/pcbnew/zone_filler.h b/pcbnew/zone_filler.h index bdb328dddc..4a0f892974 100644 --- a/pcbnew/zone_filler.h +++ b/pcbnew/zone_filler.h @@ -27,7 +27,7 @@ #define __ZONE_FILLER_H #include -#include +#include class WX_PROGRESS_REPORTER; class BOARD; @@ -44,8 +44,7 @@ public: void SetProgressReporter( PROGRESS_REPORTER* aReporter ); void InstallNewProgressReporter( wxWindow* aParent, const wxString& aTitle, int aNumPhases ); - bool Fill( std::vector& aZones, bool aCheck = false, - wxWindow* aParent = nullptr ); + bool Fill( std::vector& aZones, bool aCheck = false, wxWindow* aParent = nullptr ); bool IsDebug() const { return m_debugZoneFiller; } @@ -56,13 +55,12 @@ private: void addKnockout( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer, int aGap, bool aIgnoreLineWidth, SHAPE_POLY_SET& aHoles ); - void knockoutThermalReliefs( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, - SHAPE_POLY_SET& aFill ); + void knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aFill ); - void buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, + void buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aHoles ); - void subtractHigherPriorityZones( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, + void subtractHigherPriorityZones( const ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawFill ); /** @@ -76,17 +74,15 @@ private: * filled copper area polygon (without clearance areas * @param aPcb: the current board */ - bool computeRawFilledArea( const ZONE_CONTAINER* aZone, - PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, + bool computeRawFilledArea( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, const SHAPE_POLY_SET& aSmoothedOutline, - const SHAPE_POLY_SET& aMaxExtents, - SHAPE_POLY_SET& aRawPolys ); + const SHAPE_POLY_SET& aMaxExtents, SHAPE_POLY_SET& aRawPolys ); /** * Function buildThermalSpokes * Constructs a list of all thermal spokes for the given zone. */ - void buildThermalSpokes( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, + void buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, std::deque& aSpokes ); /** @@ -103,7 +99,7 @@ private: * by aZone->GetMinThickness() / 2 to be drawn with a outline thickness = aZone->GetMinThickness() * aFinalPolys are polygons that will be drawn on screen and plotted */ - bool fillSingleZone( ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawPolys, + bool fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawPolys, SHAPE_POLY_SET& aFinalPolys ); /** @@ -113,8 +109,8 @@ private: * @param aRawPolys: A reference to a SHAPE_POLY_SET buffer containing the initial * filled areas, and after adding the grid pattern, the modified filled areas with holes */ - bool addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer, - PCB_LAYER_ID aDebugLayer, SHAPE_POLY_SET& aRawPolys ); + bool addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, + SHAPE_POLY_SET& aRawPolys ); BOARD* m_board; SHAPE_POLY_SET m_boardOutline; // the board outlines, if exists diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index eedf6f4653..50f4201b76 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include @@ -87,7 +87,7 @@ ZONE_SETTINGS::ZONE_SETTINGS() } -ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource ) +ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE& aSource ) { m_ZonePriority = aSource.GetPriority(); m_FillMode = aSource.GetFillMode(); @@ -124,7 +124,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource ) } -void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) const +void ZONE_SETTINGS::ExportSetting( ZONE& aTarget, bool aFullExport ) const { aTarget.SetFillMode( m_FillMode ); aTarget.SetLocalClearance( m_ZoneClearance ); diff --git a/pcbnew/zone_settings.h b/pcbnew/zone_settings.h index d25a590a03..0a2066ec9a 100644 --- a/pcbnew/zone_settings.h +++ b/pcbnew/zone_settings.h @@ -128,12 +128,12 @@ public: ZONE_SETTINGS(); /** - * operator << ( const ZONE_CONTAINER& ) + * operator << ( const ZONE& ) * was Function ImportSetting * copies settings from a given zone into this object. * @param aSource: the given zone */ - ZONE_SETTINGS& operator << ( const ZONE_CONTAINER& aSource ); + ZONE_SETTINGS& operator << ( const ZONE& aSource ); /** * A helper routine for the various zone dialogs (copper, non-copper, keepout). @@ -154,7 +154,7 @@ public: * Currently: * m_NetcodeSelection */ - void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true ) const; + void ExportSetting( ZONE& aTarget, bool aFullExport = true ) const; void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; } diff --git a/pcbnew/zones.h b/pcbnew/zones.h index a75586f828..7984664ade 100644 --- a/pcbnew/zones.h +++ b/pcbnew/zones.h @@ -25,7 +25,7 @@ #ifndef ZONES_H_ #define ZONES_H_ -// Default values in mils for parameters in ZONE_CONTAINER +// Default values in mils for parameters in ZONE #define ZONE_THERMAL_RELIEF_GAP_MIL 20 // default value for ZONE_SETTINGS::m_ThermalReliefGap #define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL 20 // default value for ZONE_SETTINGS::m_ThermalReliefCopperBridge #define ZONE_THICKNESS_MIL 10 // default value for ZONE_SETTINGS::m_ZoneMinThickness @@ -47,7 +47,7 @@ enum class ZONE_CONNECTION THT_THERMAL ///< Thermal relief only for THT pads }; -class ZONE_CONTAINER; +class ZONE; class ZONE_SETTINGS; class PCB_BASE_FRAME; diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 73a644fda7..5fa72f79c0 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ static PICKED_ITEMS_LIST s_PickedList; // a picked list to save zones for undo/redo command static PICKED_ITEMS_LIST s_AuxiliaryList; // a picked list to store zones that are deleted or added when combined -void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE_CONTAINER* aZone ) +void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone ) { int dialogResult; ZONE_SETTINGS zoneInfo = GetZoneSettings(); @@ -96,7 +96,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE_CONTAINER* aZone ) wxBusyCursor dummy; // Undraw old zone outlines - for( ZONE_CONTAINER* zone : GetBoard()->Zones() ) + for( ZONE* zone : GetBoard()->Zones() ) GetCanvas()->GetView()->Update( zone ); zoneInfo.ExportSetting( *aZone ); @@ -112,11 +112,11 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE_CONTAINER* aZone ) UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() ); // refill zones with the new properties applied - std::vector zones_to_refill; + std::vector zones_to_refill; for( unsigned i = 0; i < s_PickedList.GetCount(); ++i ) { - ZONE_CONTAINER* zone = dyn_cast( s_PickedList.GetPickedItem( i ) ); + ZONE* zone = dyn_cast( s_PickedList.GetPickedItem( i ) ); if( zone == nullptr ) { diff --git a/pcbnew/zones_functions_for_undo_redo.cpp b/pcbnew/zones_functions_for_undo_redo.cpp index f262882268..4cc4396025 100644 --- a/pcbnew/zones_functions_for_undo_redo.cpp +++ b/pcbnew/zones_functions_for_undo_redo.cpp @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include @@ -58,7 +58,7 @@ * info relative to filling is not take in account * @param aZoneToCompare = zone to compare with "this" */ -bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare ) +bool ZONE::IsSame( const ZONE& aZoneToCompare ) { // compare basic parameters: if( GetLayerSet() != aZoneToCompare.GetLayerSet() ) @@ -149,7 +149,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA for( unsigned ii = 0; ; ii++ ) { - ZONE_CONTAINER* zone = aPcb->GetArea( ii ); + ZONE* zone = aPcb->GetArea( ii ); if( zone == NULL ) // End of list break; @@ -160,7 +160,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA if( aLayer >= 0 && !zone->GetLayerSet().test( aLayer ) ) continue; - ZONE_CONTAINER* zoneDup = new ZONE_CONTAINER( *zone ); + ZONE* zoneDup = new ZONE( *zone ); zoneDup->SetParent( aPcb ); ITEM_PICKER picker( nullptr, zone, UNDO_REDO::CHANGED ); picker.SetLink( zoneDup ); @@ -215,11 +215,11 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, { UNDO_REDO status = aPickList.GetPickedItemStatus( kk ); - ZONE_CONTAINER* ref = (ZONE_CONTAINER*) aPickList.GetPickedItem( kk ); + ZONE* ref = (ZONE*) aPickList.GetPickedItem( kk ); for( unsigned ii = 0; ; ii++ ) // analyse the main picked list { - ZONE_CONTAINER* zone = aPcb->GetArea( ii ); + ZONE* zone = aPcb->GetArea( ii ); if( zone == NULL ) { @@ -238,7 +238,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, } else { - ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk ); + ZONE* zcopy = (ZONE*) aPickList.GetPickedItemLink( kk ); aPickList.SetPickedItemStatus( UNDO_REDO::DELETED, kk ); wxASSERT_MSG( zcopy != NULL, @@ -280,7 +280,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, { if( aPickList.GetPickedItemStatus( kk ) != UNDO_REDO::NEWITEM ) { - ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk ); + ZONE* zcopy = (ZONE*) aPickList.GetPickedItemLink( kk ); if( zone->IsSame( *zcopy ) ) // Remove picked, because no changes { diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index 346f18016c..b5e080fe99 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -1,9 +1,3 @@ -/** - * @file zones_test_and_combine_areas.cpp - * @brief Functions to test, merge and cut polygons used as copper areas outlines - * some pieces of code come from FreePCB. - */ - /* * This program source code file is part of KiCad, a free EDA CAD application. * @@ -31,35 +25,34 @@ */ #include -#include +#include -bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, - ZONE_CONTAINER* modified_area ) +bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, ZONE* modified_area ) { // clip polygon against itself bool modified = NormalizeAreaPolygon( aModifiedZonesList, modified_area ); // now see if we need to clip against other areas - if( TestAreaIntersections( modified_area ) ) + if( TestZoneIntersections( modified_area ) ) { modified = true; - CombineAllAreasInNet( aModifiedZonesList, modified_area->GetNetCode(), true ); + CombineAllZonesInNet( aModifiedZonesList, modified_area->GetNetCode(), true ); } // Test for bad areas: all zones must have more than 2 corners: // Note: should not happen, but just in case. - for( ZONE_CONTAINER* zone : m_zones ) + for( ZONE* zone : m_zones ) { if( zone->GetNumCorners() < 3 ) - RemoveArea( aModifiedZonesList, zone ); + RemoveZone( aModifiedZonesList, zone ); } return modified; } -bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, +bool BOARD::CombineAllZonesInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, bool aUseLocalFlags ) { if( m_zones.size() <= 1 ) @@ -70,43 +63,42 @@ bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, // Loop through all combinations for( unsigned ia1 = 0; ia1 < m_zones.size() - 1; ia1++ ) { - ZONE_CONTAINER* curr_area = m_zones[ia1]; + ZONE* refZone = m_zones[ia1]; - if( curr_area->GetNetCode() != aNetCode ) + if( refZone->GetNetCode() != aNetCode ) continue; // legal polygon - BOX2I b1 = curr_area->Outline()->BBox(); + BOX2I b1 = refZone->Outline()->BBox(); bool mod_ia1 = false; for( unsigned ia2 = m_zones.size() - 1; ia2 > ia1; ia2-- ) { - ZONE_CONTAINER* area2 = m_zones[ia2]; + ZONE* otherZone = m_zones[ia2]; - if( area2->GetNetCode() != aNetCode ) + if( otherZone->GetNetCode() != aNetCode ) continue; - if( curr_area->GetPriority() != area2->GetPriority() ) + if( refZone->GetPriority() != otherZone->GetPriority() ) continue; - if( curr_area->GetIsRuleArea() != area2->GetIsRuleArea() ) + if( refZone->GetIsRuleArea() != otherZone->GetIsRuleArea() ) continue; - if( curr_area->GetLayerSet() != area2->GetLayerSet() ) + if( refZone->GetLayerSet() != otherZone->GetLayerSet() ) continue; - BOX2I b2 = area2->Outline()->BBox(); + BOX2I b2 = otherZone->Outline()->BBox(); if( b1.Intersects( b2 ) ) { - // check area2 against curr_area - if( curr_area->GetLocalFlags() || area2->GetLocalFlags() - || aUseLocalFlags == false ) + // check otherZone against refZone + if( refZone->GetLocalFlags() || otherZone->GetLocalFlags() || !aUseLocalFlags ) { - bool ret = TestAreaIntersection( curr_area, area2 ); + bool ret = TestZoneIntersection( refZone, otherZone ); if( ret ) - ret = CombineAreas( aDeletedList, curr_area, area2 ); + ret = CombineZones( aDeletedList, refZone, otherZone ); if( ret ) { @@ -125,75 +117,75 @@ bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, } -bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) +bool BOARD::TestZoneIntersections( ZONE* aZone ) { - for( ZONE_CONTAINER* area2 : m_zones) + for( ZONE* otherZone : m_zones ) { - if( area_to_test->GetNetCode() != area2->GetNetCode() ) + if( aZone->GetNetCode() != otherZone->GetNetCode() ) continue; - if( area_to_test == area2 ) + if( aZone == otherZone ) continue; // see if areas are on same layers - if( area_to_test->GetLayerSet() != area2->GetLayerSet() ) + if( aZone->GetLayerSet() != otherZone->GetLayerSet() ) continue; // test for different priorities - if( area_to_test->GetPriority() != area2->GetPriority() ) + if( aZone->GetPriority() != otherZone->GetPriority() ) continue; // test for different types - if( area_to_test->GetIsRuleArea() != area2->GetIsRuleArea() ) + if( aZone->GetIsRuleArea() != otherZone->GetIsRuleArea() ) continue; // Keepout area-specific tests - if( area_to_test->GetIsRuleArea() ) + if( aZone->GetIsRuleArea() ) { - if( area_to_test->GetDoNotAllowCopperPour() != area2->GetDoNotAllowCopperPour() ) + if( aZone->GetDoNotAllowCopperPour() != otherZone->GetDoNotAllowCopperPour() ) continue; - if( area_to_test->GetDoNotAllowTracks() != area2->GetDoNotAllowTracks() ) + if( aZone->GetDoNotAllowTracks() != otherZone->GetDoNotAllowTracks() ) continue; - if( area_to_test->GetDoNotAllowVias() != area2->GetDoNotAllowVias() ) + if( aZone->GetDoNotAllowVias() != otherZone->GetDoNotAllowVias() ) continue; - if( area_to_test->GetDoNotAllowPads() != area2->GetDoNotAllowPads() ) + if( aZone->GetDoNotAllowPads() != otherZone->GetDoNotAllowPads() ) continue; - if( area_to_test->GetDoNotAllowFootprints() != area2->GetDoNotAllowFootprints() ) + if( aZone->GetDoNotAllowFootprints() != otherZone->GetDoNotAllowFootprints() ) continue; } // Filled zone specific tests else { - if( area_to_test->GetLocalClearance() != area2->GetLocalClearance() ) + if( aZone->GetLocalClearance() != otherZone->GetLocalClearance() ) continue; - if( area_to_test->GetThermalReliefGap() != area2->GetThermalReliefGap() ) + if( aZone->GetThermalReliefGap() != otherZone->GetThermalReliefGap() ) continue; - if( area_to_test->GetThermalReliefSpokeWidth() != area2->GetThermalReliefSpokeWidth() ) + if( aZone->GetThermalReliefSpokeWidth() != otherZone->GetThermalReliefSpokeWidth() ) continue; - if( area_to_test->GetLocalClearance() != area2->GetLocalClearance() ) + if( aZone->GetLocalClearance() != otherZone->GetLocalClearance() ) continue; - if( area_to_test->GetPadConnection() != area2->GetPadConnection() ) + if( aZone->GetPadConnection() != otherZone->GetPadConnection() ) continue; - if( area_to_test->GetMinThickness() != area2->GetMinThickness() ) + if( aZone->GetMinThickness() != otherZone->GetMinThickness() ) continue; - if( area_to_test->GetCornerSmoothingType() != area2->GetCornerSmoothingType() ) + if( aZone->GetCornerSmoothingType() != otherZone->GetCornerSmoothingType() ) continue; - if( area_to_test->GetCornerRadius() != area2->GetCornerRadius() ) + if( aZone->GetCornerRadius() != otherZone->GetCornerRadius() ) continue; } - if( TestAreaIntersection( area_to_test, area2 ) ) + if( TestZoneIntersection( aZone, otherZone ) ) return true; } @@ -201,14 +193,14 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) } -bool BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test ) +bool BOARD::TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 ) { // see if areas are on same layer - if( area_ref->GetLayer() != area_to_test->GetLayer() ) + if( aZone1->GetLayer() != aZone2->GetLayer() ) return false; - SHAPE_POLY_SET* poly1 = area_ref->Outline(); - SHAPE_POLY_SET* poly2 = area_to_test->Outline(); + SHAPE_POLY_SET* poly1 = aZone1->Outline(); + SHAPE_POLY_SET* poly2 = aZone2->Outline(); // test bounding rects BOX2I b1 = poly1->BBox(); @@ -252,17 +244,16 @@ bool BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area } -bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ref, - ZONE_CONTAINER* area_to_combine ) +bool BOARD::CombineZones( PICKED_ITEMS_LIST* aDeletedList, ZONE* aRefZone, ZONE* aZoneToCombine ) { - if( area_ref == area_to_combine ) + if( aRefZone == aZoneToCombine ) { wxASSERT( 0 ); return false; } - SHAPE_POLY_SET mergedOutlines = *area_ref->Outline(); - SHAPE_POLY_SET areaToMergePoly = *area_to_combine->Outline(); + SHAPE_POLY_SET mergedOutlines = *aRefZone->Outline(); + SHAPE_POLY_SET areaToMergePoly = *aZoneToCombine->Outline(); mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST ); mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST ); @@ -273,7 +264,7 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ // but we should never have more than 2 polys if( mergedOutlines.OutlineCount() > 2 ) { - wxLogMessage( "BOARD::CombineAreas error: more than 2 polys after merging" ); + wxLogMessage( "BOARD::CombineZones error: more than 2 polys after merging" ); return false; } @@ -281,13 +272,13 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ return false; // Update the area with the new merged outline - delete area_ref->Outline(); - area_ref->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) ); + delete aRefZone->Outline(); + aRefZone->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) ); - RemoveArea( aDeletedList, area_to_combine ); + RemoveZone( aDeletedList, aZoneToCombine ); - area_ref->SetLocalFlags( 1 ); - area_ref->HatchBorder(); + aRefZone->SetLocalFlags( 1 ); + aRefZone->HatchBorder(); return true; } diff --git a/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp b/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp index a700466a3e..bd99d0fbc1 100644 --- a/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp +++ b/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp @@ -35,7 +35,6 @@ #include #include #include -#include void process( const BOARD_CONNECTED_ITEM* item, int net ) diff --git a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp index 55fac96e81..305baefe63 100644 --- a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp +++ b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index 4de2669cfb..54f4349aeb 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -33,10 +33,7 @@ #include #include #include -#include #include -#include -#include #include #include #include diff --git a/qa/qa_utils/pcb_test_frame.cpp b/qa/qa_utils/pcb_test_frame.cpp index ba20aa10ba..e4d14f50a2 100644 --- a/qa/qa_utils/pcb_test_frame.cpp +++ b/qa/qa_utils/pcb_test_frame.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include #include