From 00bdc800874a3c3d8fcd15f11f23431d76c20167 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 26 Mar 2013 10:58:40 +0100 Subject: [PATCH] Pcbnew: Fix a collision name between 2 methods: EDA_ITEM::GetFlags() and ZONE_CONTAINER::GetFlags(), which creates a very strange behavior when creating/edition zones. ZONE_CONTAINER::GetFlags() is now named ZONE_CONTAINER::GetLocalFlags(). --- pcbnew/class_board.cpp | 6 +++--- pcbnew/class_board.h | 7 +++---- pcbnew/class_zone.cpp | 5 ++--- pcbnew/class_zone.h | 6 +++--- pcbnew/export_vrml.cpp | 10 ++++------ pcbnew/legacy_plugin.cpp | 4 ++-- pcbnew/zones_test_and_combine_areas.cpp | 7 ++++--- 7 files changed, 21 insertions(+), 24 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 1a77fe35a2..0e8fe450b5 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2272,9 +2272,9 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI // mark all areas as unmodified except this one, if modified for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ ) - m_ZoneDescriptorList[ia]->SetFlags( 0 ); + m_ZoneDescriptorList[ia]->SetLocalFlags( 0 ); - aCurrArea->SetFlags( 1 ); + aCurrArea->SetLocalFlags( 1 ); if( curr_polygon->IsPolygonSelfIntersecting() ) { @@ -2299,7 +2299,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI delete NewArea->Outline(); NewArea->SetOutline( new_p ); NewArea->Outline()->Hatch(); - NewArea->SetFlags( 1 ); + NewArea->SetLocalFlags( 1 ); } } diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index abad85ec46..218fee5ef5 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -1107,7 +1107,6 @@ public: * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers * @param aCurrArea = the zone to process * @return true if changes are made - * Also sets areas->utility1 flags if areas are modified */ bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE_CONTAINER* aCurrArea ); @@ -1130,13 +1129,13 @@ public: * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful * in undo commands can be NULL * @param aNetCode = net to consider - * @param aUseUtility : if true, don't check areas if both utility flags are 0 - * Sets utility flag = 1 for any areas modified + * @param aUseLocalFlags : if true, don't check areas if both local flags are 0 + * Sets local flag = 1 for any areas modified * @return true if some areas modified */ bool CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, - bool aUseUtility ); + bool aUseLocalFlags ); /** * Function RemoveArea diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 2d598130b0..d3ad2608ea 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -66,7 +66,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) : SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true m_cornerRadius = 0; - utility = 0; // flags used in polygon calculations + SetLocalFlags( 0 ); // flags tempoarry used in zone calculations m_Poly = new CPolyLine(); // Outlines aBoard->GetZoneSettings().ExportSetting( *this ); } @@ -101,8 +101,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : m_cornerSmoothingType = aZone.m_cornerSmoothingType; m_cornerRadius = aZone.m_cornerRadius; - - utility = aZone.utility; + SetLocalFlags( aZone.GetLocalFlags() ); } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 2ef1f34b9a..7b14356c49 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -242,8 +242,8 @@ public: int GetSelectedCorner() const { return m_CornerSelection; } void SetSelectedCorner( int aCorner ) { m_CornerSelection = aCorner; } - int GetFlags() const { return utility; } - void SetFlags( int aFlags ) { utility = aFlags; } + int GetLocalFlags() const { return m_localFlgs; } + void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; } std::vector & FillSegments() { return m_FillSegmList; } const std::vector & FillSegments() const { return m_FillSegmList; } @@ -617,7 +617,7 @@ private: /// The index of the corner being moved or -1 if no corner is selected. int m_CornerSelection; - int utility; ///< Flags used in polygon calculations. + int m_localFlgs; ///< Flags used in polygon calculations. /** Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index e07889c2ce..1aea2044cf 100755 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -818,15 +818,13 @@ static void export_vrml_zones( BOARD* pcb ) { CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; - if( begincorner->utility == 0 ) // Draw only basic outlines, not extra segments - export_vrml_line( layer, begincorner->x, begincorner->y, - endcorner->x, endcorner->y, width, 1 ); + export_vrml_line( layer, begincorner->x, begincorner->y, + endcorner->x, endcorner->y, width, 1 ); if( (endcorner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it { - if( endcorner->utility == 0 ) // Draw only basic outlines, not extra segments - export_vrml_line( layer, endcorner->x, endcorner->y, - firstcorner->x, firstcorner->y, width, 1 ); + export_vrml_line( layer, endcorner->x, endcorner->y, + firstcorner->x, firstcorner->y, width, 1 ); ic++; // A new contour? diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index b3a26ad4bc..515f31e411 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2348,9 +2348,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() BIU y = biuParse( data, &data ); bool end_contour = intParse( data, &data ); // end_countour was a bool when file saved, so '0' or '1' here - int utility = intParse( data ); + int cornerUtilityFlg = intParse( data ); - polysList.push_back( CPolyPt( x, y, end_contour, utility ) ); + polysList.push_back( CPolyPt( x, y, end_contour, cornerUtilityFlg ) ); } zc->AddFilledPolysList( polysList ); } diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index ff9b736a3b..718661e8a2 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -86,7 +86,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, - bool aUseUtility ) + bool aUseLocalFlags ) { if( m_ZoneDescriptorList.size() <= 1 ) return false; @@ -127,7 +127,8 @@ bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, || b1.bottom > b2.top || b1.top < b2.bottom ) ) { // check area2 against curr_area - if( curr_area->GetFlags() || area2->GetFlags() || aUseUtility == false ) + if( curr_area->GetLocalFlags() || area2->GetLocalFlags() + || aUseLocalFlags == false ) { bool ret = TestAreaIntersection( curr_area, area2 ); @@ -350,7 +351,7 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ RemoveArea( aDeletedList, area_to_combine ); - area_ref->SetFlags( 1 ); + area_ref->SetLocalFlags( 1 ); area_ref->Outline()->Hatch(); return true;