Pcbnew: push and shove router fixes.

* Fix segfault caused by invalidation of the end item by
  PNS_LINE_PLACER::UpdateSizes().
* GAL zone drawing tool updates the ratsnest after zone drawing is complete.
* Fixed performance issue in zones processing using strict simplification
  only for the final filled area.
This commit is contained in:
Tomasz Wlostowski 2015-11-18 09:35:17 -05:00 committed by Wayne Stambaugh
parent 20b6346180
commit 72b0593fdb
7 changed files with 11 additions and 20 deletions

View File

@ -87,9 +87,6 @@ bool PNS_LINE_PLACER::ToggleVia( bool aEnabled )
if( !aEnabled ) if( !aEnabled )
m_head.RemoveVia(); m_head.RemoveVia();
if( !m_idle )
Move( m_currentEnd, NULL );
return true; return true;
} }
@ -1021,7 +1018,6 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
if( !m_idle ) if( !m_idle )
{ {
initPlacement( m_splitSeg ); initPlacement( m_splitSeg );
Move ( m_currentEnd, NULL );
} }
} }

View File

@ -458,7 +458,6 @@ PNS_ROUTER::PNS_ROUTER()
m_showInterSteps = false; m_showInterSteps = false;
m_snapshotIter = 0; m_snapshotIter = 0;
m_view = NULL; m_view = NULL;
m_currentEndItem = NULL;
m_snappingEnabled = false; m_snappingEnabled = false;
m_violation = false; m_violation = false;
m_gridHelper = NULL; m_gridHelper = NULL;
@ -646,7 +645,6 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLa
return false; return false;
m_currentEnd = aP; m_currentEnd = aP;
m_currentEndItem = NULL;
m_state = ROUTE_TRACK; m_state = ROUTE_TRACK;
return rv; return rv;
} }
@ -724,7 +722,6 @@ void PNS_ROUTER::DisplayDebugPoint( const VECTOR2I aPos, int aType )
void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem ) void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem )
{ {
m_currentEnd = aP; m_currentEnd = aP;
m_currentEndItem = endItem;
switch( m_state ) switch( m_state )
{ {
@ -827,7 +824,6 @@ void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes )
if( m_state == ROUTE_TRACK) if( m_state == ROUTE_TRACK)
{ {
m_placer->UpdateSizes( m_sizes ); m_placer->UpdateSizes( m_sizes );
movePlacing( m_currentEnd, m_currentEndItem );
} }
} }
@ -997,7 +993,6 @@ void PNS_ROUTER::FlipPosture()
if( m_state == ROUTE_TRACK ) if( m_state == ROUTE_TRACK )
{ {
m_placer->FlipPosture(); m_placer->FlipPosture();
movePlacing ( m_currentEnd, m_currentEndItem );
} }
} }

View File

@ -263,13 +263,9 @@ private:
KIGFX::VIEW* m_view; KIGFX::VIEW* m_view;
KIGFX::VIEW_GROUP* m_previewItems; KIGFX::VIEW_GROUP* m_previewItems;
PNS_ITEM* m_currentEndItem;
bool m_snappingEnabled; bool m_snappingEnabled;
bool m_violation; bool m_violation;
// optHoverItem m_startItem, m_endItem;
PNS_ROUTING_SETTINGS m_settings; PNS_ROUTING_SETTINGS m_settings;
PNS_PCBNEW_CLEARANCE_FUNC* m_clearanceFunc; PNS_PCBNEW_CLEARANCE_FUNC* m_clearanceFunc;

View File

@ -382,7 +382,7 @@ void ROUTER_TOOL::switchLayerOnViaPlacement()
} }
bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType ) bool ROUTER_TOOL::onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType )
{ {
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
@ -475,6 +475,8 @@ bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType )
m_router->UpdateSizes( sizes ); m_router->UpdateSizes( sizes );
m_router->ToggleViaPlacement(); m_router->ToggleViaPlacement();
updateEndItem( aEvent );
m_router->Move( m_endSnapPoint, m_endItem ); // refresh m_router->Move( m_endSnapPoint, m_endItem ); // refresh
return false; return false;
@ -576,15 +578,15 @@ void ROUTER_TOOL::performRouting()
} }
else if( evt->IsAction( &ACT_PlaceThroughVia ) ) else if( evt->IsAction( &ACT_PlaceThroughVia ) )
{ {
onViaCommand( VIA_THROUGH ); onViaCommand( *evt, VIA_THROUGH );
} }
else if( evt->IsAction( &ACT_PlaceBlindVia ) ) else if( evt->IsAction( &ACT_PlaceBlindVia ) )
{ {
onViaCommand( VIA_BLIND_BURIED ); onViaCommand( *evt, VIA_BLIND_BURIED );
} }
else if( evt->IsAction( &ACT_PlaceMicroVia ) ) else if( evt->IsAction( &ACT_PlaceMicroVia ) )
{ {
onViaCommand( VIA_MICROVIA ); onViaCommand( *evt, VIA_MICROVIA );
} }
else if( evt->IsAction( &ACT_SwitchPosture ) ) else if( evt->IsAction( &ACT_SwitchPosture ) )
{ {

View File

@ -54,7 +54,7 @@ private:
int getStartLayer( const PNS_ITEM* aItem ); int getStartLayer( const PNS_ITEM* aItem );
void switchLayerOnViaPlacement(); void switchLayerOnViaPlacement();
bool onViaCommand( VIATYPE_T aType ); bool onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType );
bool prepareInteractive(); bool prepareInteractive();
bool finishInteractive(); bool finishInteractive();

View File

@ -39,6 +39,7 @@
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <router/direction.h> #include <router/direction.h>
#include <ratsnest_data.h>
#include <class_board.h> #include <class_board.h>
#include <class_edge_mod.h> #include <class_edge_mod.h>
@ -1125,6 +1126,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
static_cast<PCB_EDIT_FRAME*>( m_frame )->Fill_Zone( zone ); static_cast<PCB_EDIT_FRAME*>( m_frame )->Fill_Zone( zone );
zone->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); zone->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_board->GetRatsnest()->Update( zone );
m_frame->OnModify(); m_frame->OnModify();
m_frame->SaveCopyInUndoList( zone, UR_NEW ); m_frame->SaveCopyInUndoList( zone, UR_NEW );

View File

@ -442,12 +442,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
if(g_DumpZonesWhenFilling) if(g_DumpZonesWhenFilling)
dumper->Write( &holes, "feature-holes" ); dumper->Write( &holes, "feature-holes" );
holes.Simplify(); holes.Simplify( true );
if (g_DumpZonesWhenFilling) if (g_DumpZonesWhenFilling)
dumper->Write( &holes, "feature-holes-postsimplify" ); dumper->Write( &holes, "feature-holes-postsimplify" );
solidAreas.BooleanSubtract( holes ); solidAreas.BooleanSubtract( holes, true );
if (g_DumpZonesWhenFilling) if (g_DumpZonesWhenFilling)
dumper->Write( &solidAreas, "solid-areas-minus-holes" ); dumper->Write( &solidAreas, "solid-areas-minus-holes" );