From 72b0593fdbab0a59498d2c3c1b68588713db16ad Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Wed, 18 Nov 2015 09:35:17 -0500 Subject: [PATCH] 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. --- pcbnew/router/pns_line_placer.cpp | 4 ---- pcbnew/router/pns_router.cpp | 5 ----- pcbnew/router/pns_router.h | 4 ---- pcbnew/router/router_tool.cpp | 10 ++++++---- pcbnew/router/router_tool.h | 2 +- pcbnew/tools/drawing_tool.cpp | 2 ++ .../zones_convert_brd_items_to_polygons_with_Boost.cpp | 4 ++-- 7 files changed, 11 insertions(+), 20 deletions(-) diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 96aa6dec4d..7f4efb4176 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -87,9 +87,6 @@ bool PNS_LINE_PLACER::ToggleVia( bool aEnabled ) if( !aEnabled ) m_head.RemoveVia(); - if( !m_idle ) - Move( m_currentEnd, NULL ); - return true; } @@ -1021,7 +1018,6 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ) if( !m_idle ) { initPlacement( m_splitSeg ); - Move ( m_currentEnd, NULL ); } } diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index af940da7e9..6f64f96bc5 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -458,7 +458,6 @@ PNS_ROUTER::PNS_ROUTER() m_showInterSteps = false; m_snapshotIter = 0; m_view = NULL; - m_currentEndItem = NULL; m_snappingEnabled = false; m_violation = false; m_gridHelper = NULL; @@ -646,7 +645,6 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLa return false; m_currentEnd = aP; - m_currentEndItem = NULL; m_state = ROUTE_TRACK; 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 ) { m_currentEnd = aP; - m_currentEndItem = endItem; switch( m_state ) { @@ -827,7 +824,6 @@ void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes ) if( m_state == ROUTE_TRACK) { m_placer->UpdateSizes( m_sizes ); - movePlacing( m_currentEnd, m_currentEndItem ); } } @@ -997,7 +993,6 @@ void PNS_ROUTER::FlipPosture() if( m_state == ROUTE_TRACK ) { m_placer->FlipPosture(); - movePlacing ( m_currentEnd, m_currentEndItem ); } } diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index 0541dec11e..4bc4bc30dd 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -263,13 +263,9 @@ private: KIGFX::VIEW* m_view; KIGFX::VIEW_GROUP* m_previewItems; - PNS_ITEM* m_currentEndItem; - bool m_snappingEnabled; bool m_violation; - // optHoverItem m_startItem, m_endItem; - PNS_ROUTING_SETTINGS m_settings; PNS_PCBNEW_CLEARANCE_FUNC* m_clearanceFunc; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 4b610a3124..387e03cfbd 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -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(); @@ -475,6 +475,8 @@ bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType ) m_router->UpdateSizes( sizes ); m_router->ToggleViaPlacement(); + updateEndItem( aEvent ); + m_router->Move( m_endSnapPoint, m_endItem ); // refresh return false; @@ -576,15 +578,15 @@ void ROUTER_TOOL::performRouting() } else if( evt->IsAction( &ACT_PlaceThroughVia ) ) { - onViaCommand( VIA_THROUGH ); + onViaCommand( *evt, VIA_THROUGH ); } else if( evt->IsAction( &ACT_PlaceBlindVia ) ) { - onViaCommand( VIA_BLIND_BURIED ); + onViaCommand( *evt, VIA_BLIND_BURIED ); } else if( evt->IsAction( &ACT_PlaceMicroVia ) ) { - onViaCommand( VIA_MICROVIA ); + onViaCommand( *evt, VIA_MICROVIA ); } else if( evt->IsAction( &ACT_SwitchPosture ) ) { diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h index 08f2f84827..c1bd1a290f 100644 --- a/pcbnew/router/router_tool.h +++ b/pcbnew/router/router_tool.h @@ -54,7 +54,7 @@ private: int getStartLayer( const PNS_ITEM* aItem ); void switchLayerOnViaPlacement(); - bool onViaCommand( VIATYPE_T aType ); + bool onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType ); bool prepareInteractive(); bool finishInteractive(); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 83444989f2..10c46fd034 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -1125,6 +1126,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout ) static_cast( m_frame )->Fill_Zone( zone ); zone->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); + m_board->GetRatsnest()->Update( zone ); m_frame->OnModify(); m_frame->SaveCopyInUndoList( zone, UR_NEW ); diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index 7bcb15b930..bc79c76d66 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -442,12 +442,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb ) if(g_DumpZonesWhenFilling) dumper->Write( &holes, "feature-holes" ); - holes.Simplify(); + holes.Simplify( true ); if (g_DumpZonesWhenFilling) dumper->Write( &holes, "feature-holes-postsimplify" ); - solidAreas.BooleanSubtract( holes ); + solidAreas.BooleanSubtract( holes, true ); if (g_DumpZonesWhenFilling) dumper->Write( &solidAreas, "solid-areas-minus-holes" );