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 @@
// Default marquer shape:
const int M_SHAPE_SCALE = 6; // default scaling factor for MarkerShapeCorners coordinates
const int CORNERS_COUNT = 8;
const int M_SHAPE_SCALE = 6; // default scaling factor for MarkerShapeCorners coordinates
const unsigned CORNERS_COUNT = 8;
/* corners of the default shape
* actual coordinates are these values * .m_ScalingFactor
*/
......
......@@ -54,7 +54,7 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST& aOutlines )
{
// 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) );
// convert tracks and vias:
......
......@@ -131,13 +131,13 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
int i;
for( i = FIRST_COPPER_LAYER; i <= LAST_COPPER_LAYER; i++ )
{
{
if( lmsk & ( 1 << i ) )
{
layers = PNS_LAYERSET( i );
break;
}
}
}
break;
}
......@@ -189,7 +189,7 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
if( sz.x > sz.y )
delta = VECTOR2I( ( sz.x - sz.y ) / 2, 0 );
else
else
delta = VECTOR2I( 0, ( sz.y - sz.x ) / 2 );
SHAPE_SEGMENT* shape = new SHAPE_SEGMENT( c - delta, c + delta,
......@@ -284,11 +284,11 @@ void PNS_ROUTER::SyncWorld()
ClearWorld();
int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue();
m_clearanceFunc = new PCBNEW_CLEARANCE_FUNC( m_board );
m_world = new PNS_NODE();
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() )
{
......@@ -462,7 +462,7 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{
if( !aStartItem || aStartItem->OfKind( PNS_ITEM::SOLID ) )
return false;
m_dragger = new PNS_DRAGGER ( this );
m_dragger->SetWorld( m_world );
......@@ -474,7 +474,7 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_state = IDLE;
return false;
}
return true;
}
......@@ -489,7 +489,7 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_placer->Start( aP, aStartItem );
m_currentEnd = aP;
m_currentEndItem = NULL;
return true;
}
......@@ -603,7 +603,7 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
PNS_NODE::OBSTACLES obstacles;
aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY );
if( item->OfKind( PNS_ITEM::LINE ) )
{
PNS_LINE *l = static_cast<PNS_LINE*>( item );
......@@ -617,7 +617,7 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
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() );
tmp->Mark( MK_VIOLATION );
DisplayItem( tmp.get(), -1, clearance );
......@@ -631,13 +631,13 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
{
PNS_NODE::ITEM_VECTOR removed, added;
PNS_NODE::OBSTACLES obstacles;
if( !aNode )
return;
if( Settings().Mode() == RM_MarkObstacles )
markViolations(aNode, aCurrent, removed);
aNode->GetUpdatedItems( removed, added );
BOOST_FOREACH( PNS_ITEM* item, added )
......@@ -679,7 +679,7 @@ void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem )
m_placer->Move( aP, aEndItem );
PNS_LINE current = m_placer->Trace();
DisplayItem( &current );
if( current.EndsWithVia() )
......@@ -790,18 +790,18 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
rv = m_placer->FixRoute( aP, aEndItem );
m_placingVia = false;
break;
case DRAG_SEGMENT:
rv = m_dragger->FixRoute();
break;
default:
break;
}
break;
}
if( rv )
StopRouting();
return rv;
}
......@@ -909,10 +909,10 @@ void PNS_ROUTER::DumpLog()
case DRAG_SEGMENT:
logger = m_dragger->Logger();
break;
default:
break;
}
}
if( logger )
logger->Save ( "/tmp/shove.log" );
......
......@@ -108,13 +108,13 @@ public:
PNS_VIA* Clone() const;
const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const;
virtual VECTOR2I Anchor( int n ) const
{
return m_pos;
}
virtual int AnchorCount() const
virtual int AnchorCount() const
{
return 1;
}
......
......@@ -199,9 +199,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
*/
MODULE dummymodule( aPcb ); // Creates a dummy parent
D_PAD dummypad( &dummymodule );
D_PAD* nextpad;
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
D_PAD* nextpad;
for( D_PAD* pad = module->Pads(); pad != NULL; pad = nextpad )
{
nextpad = pad->Next(); // pad pointer can be modified by next code, so
......@@ -228,7 +230,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
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_boundingbox = pad->GetBoundingBox();
......@@ -246,14 +249,15 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
continue;
}
int gap = zone_clearance;
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
// 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();
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