Commit 00bdc800 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fix a collision name between 2 methods: EDA_ITEM::GetFlags() and...

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().
parent 8cb20938
...@@ -2272,9 +2272,9 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI ...@@ -2272,9 +2272,9 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI
// mark all areas as unmodified except this one, if modified // mark all areas as unmodified except this one, if modified
for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ ) 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() ) if( curr_polygon->IsPolygonSelfIntersecting() )
{ {
...@@ -2299,7 +2299,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI ...@@ -2299,7 +2299,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI
delete NewArea->Outline(); delete NewArea->Outline();
NewArea->SetOutline( new_p ); NewArea->SetOutline( new_p );
NewArea->Outline()->Hatch(); NewArea->Outline()->Hatch();
NewArea->SetFlags( 1 ); NewArea->SetLocalFlags( 1 );
} }
} }
......
...@@ -1107,7 +1107,6 @@ public: ...@@ -1107,7 +1107,6 @@ public:
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers
* @param aCurrArea = the zone to process * @param aCurrArea = the zone to process
* @return true if changes are made * @return true if changes are made
* Also sets areas->utility1 flags if areas are modified
*/ */
bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE_CONTAINER* aCurrArea ); bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE_CONTAINER* aCurrArea );
...@@ -1130,13 +1129,13 @@ public: ...@@ -1130,13 +1129,13 @@ public:
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
* in undo commands can be NULL * in undo commands can be NULL
* @param aNetCode = net to consider * @param aNetCode = net to consider
* @param aUseUtility : if true, don't check areas if both utility flags are 0 * @param aUseLocalFlags : if true, don't check areas if both local flags are 0
* Sets utility flag = 1 for any areas modified * Sets local flag = 1 for any areas modified
* @return true if some areas modified * @return true if some areas modified
*/ */
bool CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, bool CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList,
int aNetCode, int aNetCode,
bool aUseUtility ); bool aUseLocalFlags );
/** /**
* Function RemoveArea * Function RemoveArea
......
...@@ -66,7 +66,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) : ...@@ -66,7 +66,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true
SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true
m_cornerRadius = 0; m_cornerRadius = 0;
utility = 0; // flags used in polygon calculations SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
m_Poly = new CPolyLine(); // Outlines m_Poly = new CPolyLine(); // Outlines
aBoard->GetZoneSettings().ExportSetting( *this ); aBoard->GetZoneSettings().ExportSetting( *this );
} }
...@@ -101,8 +101,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : ...@@ -101,8 +101,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
m_cornerSmoothingType = aZone.m_cornerSmoothingType; m_cornerSmoothingType = aZone.m_cornerSmoothingType;
m_cornerRadius = aZone.m_cornerRadius; m_cornerRadius = aZone.m_cornerRadius;
SetLocalFlags( aZone.GetLocalFlags() );
utility = aZone.utility;
} }
......
...@@ -242,8 +242,8 @@ public: ...@@ -242,8 +242,8 @@ public:
int GetSelectedCorner() const { return m_CornerSelection; } int GetSelectedCorner() const { return m_CornerSelection; }
void SetSelectedCorner( int aCorner ) { m_CornerSelection = aCorner; } void SetSelectedCorner( int aCorner ) { m_CornerSelection = aCorner; }
int GetFlags() const { return utility; } int GetLocalFlags() const { return m_localFlgs; }
void SetFlags( int aFlags ) { utility = aFlags; } void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
std::vector <SEGMENT>& FillSegments() { return m_FillSegmList; } std::vector <SEGMENT>& FillSegments() { return m_FillSegmList; }
const std::vector <SEGMENT>& FillSegments() const { return m_FillSegmList; } const std::vector <SEGMENT>& FillSegments() const { return m_FillSegmList; }
...@@ -617,7 +617,7 @@ private: ...@@ -617,7 +617,7 @@ private:
/// The index of the corner being moved or -1 if no corner is selected. /// The index of the corner being moved or -1 if no corner is selected.
int m_CornerSelection; 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. /** Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
......
...@@ -818,15 +818,13 @@ static void export_vrml_zones( BOARD* pcb ) ...@@ -818,15 +818,13 @@ static void export_vrml_zones( BOARD* pcb )
{ {
CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; 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,
export_vrml_line( layer, begincorner->x, begincorner->y, endcorner->x, endcorner->y, width, 1 );
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->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,
export_vrml_line( layer, endcorner->x, endcorner->y, firstcorner->x, firstcorner->y, width, 1 );
firstcorner->x, firstcorner->y, width, 1 );
ic++; ic++;
// A new contour? // A new contour?
......
...@@ -2348,9 +2348,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2348,9 +2348,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
BIU y = biuParse( data, &data ); BIU y = biuParse( data, &data );
bool end_contour = intParse( data, &data ); // end_countour was a bool when file saved, so '0' or '1' here 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 ); zc->AddFilledPolysList( polysList );
} }
......
...@@ -86,7 +86,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, ...@@ -86,7 +86,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode,
bool aUseUtility ) bool aUseLocalFlags )
{ {
if( m_ZoneDescriptorList.size() <= 1 ) if( m_ZoneDescriptorList.size() <= 1 )
return false; return false;
...@@ -127,7 +127,8 @@ bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, ...@@ -127,7 +127,8 @@ bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode,
|| b1.bottom > b2.top || b1.top < b2.bottom ) ) || b1.bottom > b2.top || b1.top < b2.bottom ) )
{ {
// check area2 against curr_area // 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 ); bool ret = TestAreaIntersection( curr_area, area2 );
...@@ -350,7 +351,7 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ ...@@ -350,7 +351,7 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_
RemoveArea( aDeletedList, area_to_combine ); RemoveArea( aDeletedList, area_to_combine );
area_ref->SetFlags( 1 ); area_ref->SetLocalFlags( 1 );
area_ref->Outline()->Hatch(); area_ref->Outline()->Hatch();
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment