Commit fb0045a8 authored by Maciej Suminski's avatar Maciej Suminski

Bugfix: Bottom layer not correctly handled in (PNS) Interactive router.

parent a3b421b0
...@@ -255,6 +255,9 @@ public: ...@@ -255,6 +255,9 @@ public:
*/ */
inline virtual void SetLayerDepth( double aLayerDepth ) inline virtual void SetLayerDepth( double aLayerDepth )
{ {
assert( aLayerDepth <= depthRange.y );
assert( aLayerDepth >= depthRange.x );
layerDepth = aLayerDepth; layerDepth = aLayerDepth;
} }
......
...@@ -138,7 +138,7 @@ enum LAYER_ID ...@@ -138,7 +138,7 @@ enum LAYER_ID
#define LAST_COPPER_LAYER brain dead #define LAST_COPPER_LAYER brain dead
#define FIRST_LAYER brain dead #define FIRST_LAYER brain dead
#define NB_LAYERS use LAYER_ID_COUNT instead #define NB_LAYERS use LAYER_ID_COUNT instead
#define NB_COPPER_LAYERS was always a max, not a number, use MAX_CU_COUNT now. #define NB_COPPER_LAYERS was always a max, not a number, use MAX_CU_LAYERS now.
*/ */
......
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
///> Shortcut for comparisons/overlap tests ///> Shortcut for comparisons/overlap tests
static PNS_LAYERSET All() static PNS_LAYERSET All()
{ {
return PNS_LAYERSET( 0, 256 ); return PNS_LAYERSET( 0, 64 );
} }
private: private:
......
...@@ -379,7 +379,7 @@ bool PNS_LINE_PLACER::handleViaPlacement( PNS_LINE& aHead ) ...@@ -379,7 +379,7 @@ bool PNS_LINE_PLACER::handleViaPlacement( PNS_LINE& aHead )
if( !m_placingVia ) if( !m_placingVia )
return true; return true;
PNS_LAYERSET allLayers( 0, 15 ); PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
PNS_VIA v( aHead.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill, aHead.Net() ); PNS_VIA v( aHead.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill, aHead.Net() );
VECTOR2I force; VECTOR2I force;
...@@ -439,7 +439,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -439,7 +439,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
} }
else if( m_placingVia && viaOk ) else if( m_placingVia && viaOk )
{ {
PNS_LAYERSET allLayers( 0, 15 ); PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
PNS_VIA v1( walkFull.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill ); PNS_VIA v1( walkFull.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
walkFull.AppendVia( v1 ); walkFull.AppendVia( v1 );
} }
...@@ -464,7 +464,7 @@ bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -464,7 +464,7 @@ bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead )
if( m_placingVia ) if( m_placingVia )
{ {
PNS_LAYERSET allLayers( 0, 15 ); PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
PNS_VIA v1( m_head.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill ); PNS_VIA v1( m_head.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
m_head.AppendVia( v1 ); m_head.AppendVia( v1 );
} }
...@@ -507,7 +507,7 @@ bool PNS_LINE_PLACER::rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead ) ...@@ -507,7 +507,7 @@ bool PNS_LINE_PLACER::rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead )
if( m_placingVia ) if( m_placingVia )
{ {
PNS_LAYERSET allLayers( 0, 15 ); PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
PNS_VIA v1( l.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill ); PNS_VIA v1( l.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
PNS_VIA v2( l2.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill ); PNS_VIA v2( l2.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
......
...@@ -116,12 +116,12 @@ private: ...@@ -116,12 +116,12 @@ private:
PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
{ {
PNS_LAYERSET layers( 0, 15 ); PNS_LAYERSET layers( 0, MAX_CU_LAYERS - 1 );
switch( aPad->GetAttribute() ) switch( aPad->GetAttribute() )
{ {
case PAD_STANDARD: case PAD_STANDARD:
layers = PNS_LAYERSET( 0, 15 ); layers = PNS_LAYERSET( 0, MAX_CU_LAYERS - 1 ); // TODO necessary? it is already initialized
break; break;
case PAD_SMD: case PAD_SMD:
...@@ -191,7 +191,7 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) ...@@ -191,7 +191,7 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
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,
std::min( sz.x, sz.y ) ); std::min( sz.x, sz.y ) );
solid->SetShape( shape ); solid->SetShape( shape );
} }
...@@ -229,7 +229,7 @@ PNS_ITEM* PNS_ROUTER::syncVia( VIA* aVia ) ...@@ -229,7 +229,7 @@ PNS_ITEM* PNS_ROUTER::syncVia( VIA* aVia )
{ {
PNS_VIA* v = new PNS_VIA( PNS_VIA* v = new PNS_VIA(
aVia->GetPosition(), aVia->GetPosition(),
PNS_LAYERSET( 0, 15 ), PNS_LAYERSET( 0, MAX_CU_LAYERS - 1 ),
aVia->GetWidth(), aVia->GetWidth(),
aVia->GetDrillValue(), aVia->GetDrillValue(),
aVia->GetNetCode() ); aVia->GetNetCode() );
...@@ -260,7 +260,7 @@ int PNS_ROUTER::NextCopperLayer( bool aUp ) ...@@ -260,7 +260,7 @@ int PNS_ROUTER::NextCopperLayer( bool aUp )
l = 0; l = 0;
if( l < 0 ) if( l < 0 )
l = MAX_CU_LAYERS-1; l = MAX_CU_LAYERS - 1;
if( mask[l] ) if( mask[l] )
return l; return l;
......
...@@ -41,7 +41,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem, VIEW_GROUP* aPa ...@@ -41,7 +41,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem, VIEW_GROUP* aPa
m_shape = NULL; m_shape = NULL;
m_clearance = -1; m_clearance = -1;
m_originLayer = m_layer = ITEM_GAL_LAYER ( GP_OVERLAY ); m_originLayer = m_layer = ITEM_GAL_LAYER( GP_OVERLAY );
if( aItem ) if( aItem )
Update( aItem ); Update( aItem );
...@@ -59,7 +59,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) ...@@ -59,7 +59,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
assert( m_originLayer >= 0 ); assert( m_originLayer >= 0 );
m_layer = m_originLayer; m_layer = m_originLayer;
m_color = getLayerColor( m_originLayer ); m_color = getLayerColor( m_originLayer );
m_color.a = 0.8; m_color.a = 0.8;
m_depth = BaseOverlayDepth - aItem->Layers().Start(); m_depth = BaseOverlayDepth - aItem->Layers().Start();
...@@ -70,7 +70,6 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) ...@@ -70,7 +70,6 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
case PNS_ITEM::LINE: case PNS_ITEM::LINE:
m_type = PR_SHAPE; m_type = PR_SHAPE;
m_width = ( (PNS_LINE*) aItem )->Width(); m_width = ( (PNS_LINE*) aItem )->Width();
break; break;
case PNS_ITEM::SEGMENT: case PNS_ITEM::SEGMENT:
...@@ -174,7 +173,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const ...@@ -174,7 +173,7 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
if( m_clearance > 0 ) if( m_clearance > 0 )
{ {
aGal->SetLayerDepth( ClearanceOverlayDepth ); aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY )); aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetLineWidth( m_width + 2 * m_clearance ); aGal->SetLineWidth( m_width + 2 * m_clearance );
aGal->DrawLine( s->GetSeg().A, s->GetSeg().B ); aGal->DrawLine( s->GetSeg().A, s->GetSeg().B );
} }
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
aCount = 1; aCount = 1;
} }
void drawLineChain( const SHAPE_LINE_CHAIN& aL, KIGFX::GAL *aGal ) const; void drawLineChain( const SHAPE_LINE_CHAIN& aL, KIGFX::GAL* aGal ) const;
private: private:
const KIGFX::COLOR4D assignColor( int aStyle ) const; const KIGFX::COLOR4D assignColor( int aStyle ) const;
...@@ -105,7 +105,7 @@ private: ...@@ -105,7 +105,7 @@ private:
// fixme: shouldn't this go to VIEW? // fixme: shouldn't this go to VIEW?
static const int ClearanceOverlayDepth = -2000; static const int ClearanceOverlayDepth = -2000;
static const int BaseOverlayDepth = -2020; static const int BaseOverlayDepth = -2010;
static const int ViaOverlayDepth = -2046; static const int ViaOverlayDepth = -2046;
double m_depth; double m_depth;
......
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