Fix ratsnest calculation for pads connected with zones (GAL)

This patch fixes a problem with GAL where zones are ignored in ratsnest
calculation.
The problem is that calling RN_DATA::Update on a zone with no polygons
(an unfilled zone) will remove the zone successfully, but then
RN_DATA::Add is a no-op.
From this point on, because ::Update refuses to work on items that have
not been ::Add'ed, the zone is removed entirely from ratsnest
calculation and will only be reconsidered once it is explicitly ::Add'ed
again.
The fix is to explicitly create an empty RN_ZONE_DATA object for every
zone that is ::Add'ed.

A second problem is that the point editor forgot to call
RN_DATA::Recalculate after calling Fill_Zone.

Fixes: lp:1537120
* https://bugs.launchpad.net/kicad/+bug/1537120
This commit is contained in:
Julius Schmidt 2017-02-14 00:38:14 +01:00 committed by Maciej Suminski
parent 461c72c034
commit 877a65dcc7
2 changed files with 7 additions and 0 deletions

View File

@ -499,6 +499,9 @@ bool RN_NET::AddItem( const ZONE_CONTAINER* aZone )
// Prepare a list of polygons (every zone can contain one or more polygons)
const SHAPE_POLY_SET& polySet = aZone->GetFilledPolysList();
// This ensures that we record aZone as added even if it contains no polygons.
(void) m_zones[aZone];
for( int i = 0; i < polySet.OutlineCount(); ++i )
{
const SHAPE_LINE_CHAIN& path = polySet.COutline( i );

View File

@ -42,6 +42,7 @@ using namespace std::placeholders;
#include <class_zone.h>
#include <class_board.h>
#include <class_module.h>
#include <ratsnest_data.h>
// Few constants to avoid using bare numbers for point indices
enum SEG_POINTS
@ -523,7 +524,10 @@ void POINT_EDITOR::finishItem() const
ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
if( zone->IsFilled() )
{
getEditFrame<PCB_EDIT_FRAME>()->Fill_Zone( zone );
zone->GetBoard()->GetRatsnest()->Recalculate( zone->GetNetCode() );
}
}
}