Commit 771ac33c authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix a minor bug: in zones with no net, only the zone clerance was used...

Pcbnew: fix a minor bug: in zones with no net, only the zone clerance was used to created clearence,  regardless the pad or footprint local clerance.
Very minor other fixes.
parent 707f5cd6
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
// Default marquer shape: // Default marquer shape:
const int M_SHAPE_SCALE = 6; // default scaling factor for MarkerShapeCorners coordinates const int M_SHAPE_SCALE = 6; // default scaling factor for MarkerShapeCorners coordinates
const int CORNERS_COUNT = 8; const unsigned CORNERS_COUNT = 8;
/* corners of the default shape /* corners of the default shape
* actual coordinates are these values * .m_ScalingFactor * actual coordinates are these values * .m_ScalingFactor
*/ */
......
...@@ -54,7 +54,7 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf ) ...@@ -54,7 +54,7 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST& aOutlines ) void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST& aOutlines )
{ {
// Number of segments to convert a circle to a polygon // Number of segments to convert a circle to a polygon
const int segcountforcircle = 16; const int segcountforcircle = 18;
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) ); double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
// convert tracks and vias: // convert tracks and vias:
......
...@@ -131,13 +131,13 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) ...@@ -131,13 +131,13 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
int i; int i;
for( i = FIRST_COPPER_LAYER; i <= LAST_COPPER_LAYER; i++ ) for( i = FIRST_COPPER_LAYER; i <= LAST_COPPER_LAYER; i++ )
{ {
if( lmsk & ( 1 << i ) ) if( lmsk & ( 1 << i ) )
{ {
layers = PNS_LAYERSET( i ); layers = PNS_LAYERSET( i );
break; break;
} }
} }
break; break;
} }
...@@ -189,7 +189,7 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) ...@@ -189,7 +189,7 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
if( sz.x > sz.y ) if( sz.x > sz.y )
delta = VECTOR2I( ( sz.x - sz.y ) / 2, 0 ); delta = VECTOR2I( ( sz.x - sz.y ) / 2, 0 );
else else
delta = VECTOR2I( 0, ( sz.y - sz.x ) / 2 ); delta = VECTOR2I( 0, ( sz.y - sz.x ) / 2 );
SHAPE_SEGMENT* shape = new SHAPE_SEGMENT( c - delta, c + delta, SHAPE_SEGMENT* shape = new SHAPE_SEGMENT( c - delta, c + delta,
...@@ -284,11 +284,11 @@ void PNS_ROUTER::SyncWorld() ...@@ -284,11 +284,11 @@ void PNS_ROUTER::SyncWorld()
ClearWorld(); ClearWorld();
int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue(); int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue();
m_clearanceFunc = new PCBNEW_CLEARANCE_FUNC( m_board ); m_clearanceFunc = new PCBNEW_CLEARANCE_FUNC( m_board );
m_world = new PNS_NODE(); m_world = new PNS_NODE();
m_world->SetClearanceFunctor( m_clearanceFunc ); m_world->SetClearanceFunctor( m_clearanceFunc );
m_world->SetMaxClearance( 4 * worstClearance ); m_world->SetMaxClearance( 4 * worstClearance );
for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
{ {
...@@ -462,7 +462,7 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -462,7 +462,7 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{ {
if( !aStartItem || aStartItem->OfKind( PNS_ITEM::SOLID ) ) if( !aStartItem || aStartItem->OfKind( PNS_ITEM::SOLID ) )
return false; return false;
m_dragger = new PNS_DRAGGER ( this ); m_dragger = new PNS_DRAGGER ( this );
m_dragger->SetWorld( m_world ); m_dragger->SetWorld( m_world );
...@@ -474,7 +474,7 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -474,7 +474,7 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_state = IDLE; m_state = IDLE;
return false; return false;
} }
return true; return true;
} }
...@@ -489,7 +489,7 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -489,7 +489,7 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_placer->Start( aP, aStartItem ); m_placer->Start( aP, aStartItem );
m_currentEnd = aP; m_currentEnd = aP;
m_currentEndItem = NULL; m_currentEndItem = NULL;
return true; return true;
} }
...@@ -603,7 +603,7 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, ...@@ -603,7 +603,7 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
PNS_NODE::OBSTACLES obstacles; PNS_NODE::OBSTACLES obstacles;
aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY ); aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY );
if( item->OfKind( PNS_ITEM::LINE ) ) if( item->OfKind( PNS_ITEM::LINE ) )
{ {
PNS_LINE *l = static_cast<PNS_LINE*>( item ); PNS_LINE *l = static_cast<PNS_LINE*>( item );
...@@ -617,7 +617,7 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, ...@@ -617,7 +617,7 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
BOOST_FOREACH( PNS_OBSTACLE& obs, obstacles ) BOOST_FOREACH( PNS_OBSTACLE& obs, obstacles )
{ {
int clearance = aNode->GetClearance( item, obs.m_item ); int clearance = aNode->GetClearance( item, obs.m_item );
std::auto_ptr<PNS_ITEM> tmp( obs.m_item->Clone() ); std::auto_ptr<PNS_ITEM> tmp( obs.m_item->Clone() );
tmp->Mark( MK_VIOLATION ); tmp->Mark( MK_VIOLATION );
DisplayItem( tmp.get(), -1, clearance ); DisplayItem( tmp.get(), -1, clearance );
...@@ -631,13 +631,13 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) ...@@ -631,13 +631,13 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
{ {
PNS_NODE::ITEM_VECTOR removed, added; PNS_NODE::ITEM_VECTOR removed, added;
PNS_NODE::OBSTACLES obstacles; PNS_NODE::OBSTACLES obstacles;
if( !aNode ) if( !aNode )
return; return;
if( Settings().Mode() == RM_MarkObstacles ) if( Settings().Mode() == RM_MarkObstacles )
markViolations(aNode, aCurrent, removed); markViolations(aNode, aCurrent, removed);
aNode->GetUpdatedItems( removed, added ); aNode->GetUpdatedItems( removed, added );
BOOST_FOREACH( PNS_ITEM* item, added ) BOOST_FOREACH( PNS_ITEM* item, added )
...@@ -679,7 +679,7 @@ void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -679,7 +679,7 @@ void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem )
m_placer->Move( aP, aEndItem ); m_placer->Move( aP, aEndItem );
PNS_LINE current = m_placer->Trace(); PNS_LINE current = m_placer->Trace();
DisplayItem( &current ); DisplayItem( &current );
if( current.EndsWithVia() ) if( current.EndsWithVia() )
...@@ -790,18 +790,18 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -790,18 +790,18 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
rv = m_placer->FixRoute( aP, aEndItem ); rv = m_placer->FixRoute( aP, aEndItem );
m_placingVia = false; m_placingVia = false;
break; break;
case DRAG_SEGMENT: case DRAG_SEGMENT:
rv = m_dragger->FixRoute(); rv = m_dragger->FixRoute();
break; break;
default: default:
break; break;
} }
if( rv ) if( rv )
StopRouting(); StopRouting();
return rv; return rv;
} }
...@@ -909,10 +909,10 @@ void PNS_ROUTER::DumpLog() ...@@ -909,10 +909,10 @@ void PNS_ROUTER::DumpLog()
case DRAG_SEGMENT: case DRAG_SEGMENT:
logger = m_dragger->Logger(); logger = m_dragger->Logger();
break; break;
default: default:
break; break;
} }
if( logger ) if( logger )
logger->Save ( "/tmp/shove.log" ); logger->Save ( "/tmp/shove.log" );
......
...@@ -108,13 +108,13 @@ public: ...@@ -108,13 +108,13 @@ public:
PNS_VIA* Clone() const; PNS_VIA* Clone() const;
const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const; const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const;
virtual VECTOR2I Anchor( int n ) const virtual VECTOR2I Anchor( int n ) const
{ {
return m_pos; return m_pos;
} }
virtual int AnchorCount() const virtual int AnchorCount() const
{ {
return 1; return 1;
} }
......
...@@ -199,9 +199,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -199,9 +199,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
*/ */
MODULE dummymodule( aPcb ); // Creates a dummy parent MODULE dummymodule( aPcb ); // Creates a dummy parent
D_PAD dummypad( &dummymodule ); D_PAD dummypad( &dummymodule );
D_PAD* nextpad;
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{ {
D_PAD* nextpad;
for( D_PAD* pad = module->Pads(); pad != NULL; pad = nextpad ) for( D_PAD* pad = module->Pads(); pad != NULL; pad = nextpad )
{ {
nextpad = pad->Next(); // pad pointer can be modified by next code, so nextpad = pad->Next(); // pad pointer can be modified by next code, so
...@@ -228,7 +230,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -228,7 +230,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
pad = &dummypad; pad = &dummypad;
} }
if( pad->GetNetCode() != GetNetCode() ) // Note: netcode <=0 means not connected item
if( ( pad->GetNetCode() != GetNetCode() ) || ( pad->GetNetCode() <= 0 ) )
{ {
item_clearance = pad->GetClearance() + margin; item_clearance = pad->GetClearance() + margin;
item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox();
...@@ -246,14 +249,15 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -246,14 +249,15 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
continue; continue;
} }
int gap = zone_clearance;
if( ( GetPadConnection( pad ) == PAD_NOT_IN_ZONE ) if( ( GetPadConnection( pad ) == PAD_NOT_IN_ZONE )
|| ( GetNetCode() == 0 ) || ( pad->GetShape() == PAD_TRAPEZOID ) ) || ( pad->GetShape() == PAD_TRAPEZOID ) )
// PAD_TRAPEZOID shapes are not in zones because they are used in microwave apps // PAD_TRAPEZOID shapes are not in zones because they are used in microwave apps
// and i think it is good that shapes are not changed by thermal pads or others // and i think it is good that shapes are not changed by thermal pads or others
{ {
int gap = zone_clearance;
int thermalGap = GetThermalReliefGap( pad );
gap = std::max( gap, thermalGap );
item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox();
if( item_boundingbox.Intersects( zone_boundingbox ) ) if( item_boundingbox.Intersects( zone_boundingbox ) )
......
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