Code formatting
This commit is contained in:
parent
f0adbd757c
commit
0ef866ee74
|
@ -575,7 +575,7 @@ private:
|
|||
};
|
||||
|
||||
// Convenience typedefs
|
||||
typedef std::unordered_map<int, VIEW_LAYER> LAYER_MAP;
|
||||
typedef std::unordered_map<int, VIEW_LAYER> LAYER_MAP;
|
||||
typedef LAYER_MAP::iterator LAYER_MAP_ITER;
|
||||
typedef std::vector<VIEW_LAYER*> LAYER_ORDER;
|
||||
typedef std::vector<VIEW_LAYER*>::iterator LAYER_ORDER_ITER;
|
||||
|
|
|
@ -93,7 +93,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
trackLayer = boost::none;
|
||||
}
|
||||
|
||||
if ( t->IsLocked() )
|
||||
if( t->IsLocked() )
|
||||
hasLocked = true;
|
||||
else
|
||||
hasUnlocked = true;
|
||||
|
@ -128,7 +128,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
viaDrill = boost::none;
|
||||
}
|
||||
|
||||
if ( v->IsLocked() )
|
||||
if( v->IsLocked() )
|
||||
hasLocked = true;
|
||||
else
|
||||
hasUnlocked = true;
|
||||
|
@ -180,11 +180,11 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
m_MainSizer->Hide( m_sbTrackSizer, true );
|
||||
}
|
||||
|
||||
if ( hasLocked && hasUnlocked )
|
||||
if( hasLocked && hasUnlocked )
|
||||
{
|
||||
m_lockedCbox->Set3StateValue( wxCHK_UNDETERMINED );
|
||||
}
|
||||
else if ( hasLocked )
|
||||
else if( hasLocked )
|
||||
{
|
||||
m_lockedCbox->Set3StateValue( wxCHK_CHECKED );
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const
|
|||
return m_router->Settings();
|
||||
}
|
||||
|
||||
PNS_LOGGER *PNS_ALGO_BASE::Logger()
|
||||
|
||||
PNS_LOGGER* PNS_ALGO_BASE::Logger()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -59,12 +59,12 @@ public:
|
|||
*
|
||||
* Assign a debug decorator allowing this algo to draw extra graphics for visual debugging
|
||||
*/
|
||||
void SetDebugDecorator( PNS_DEBUG_DECORATOR *aDecorator )
|
||||
void SetDebugDecorator( PNS_DEBUG_DECORATOR* aDecorator )
|
||||
{
|
||||
m_debugDecorator = aDecorator;
|
||||
}
|
||||
|
||||
PNS_DEBUG_DECORATOR *Dbg() const
|
||||
PNS_DEBUG_DECORATOR* Dbg() const
|
||||
{
|
||||
return m_debugDecorator;
|
||||
}
|
||||
|
|
|
@ -123,28 +123,31 @@ DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::anchorDirection( PNS_ITEM* aItem, const VECT
|
|||
|
||||
void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTOR2I& aMidpoint, VECTOR2I& aDirection ) const
|
||||
{
|
||||
assert (m_primP && m_primN);
|
||||
assert( m_primP && m_primN );
|
||||
|
||||
VECTOR2I aP, aN, dir, midpoint;
|
||||
|
||||
if ( m_primP->OfKind(PNS_ITEM::SEGMENT) && m_primN->OfKind(PNS_ITEM::SEGMENT) )
|
||||
if ( m_primP->OfKind( PNS_ITEM::SEGMENT ) && m_primN->OfKind( PNS_ITEM::SEGMENT ) )
|
||||
{
|
||||
aP = m_primP->Anchor( 1 );
|
||||
aN = m_primN->Anchor( 1 );
|
||||
midpoint = ( aP + aN ) / 2;
|
||||
SEG s = static_cast <PNS_SEGMENT*> (m_primP)->Seg();
|
||||
SEG s = static_cast <PNS_SEGMENT*>( m_primP )->Seg();
|
||||
|
||||
if ( s.B != s.A )
|
||||
{
|
||||
dir = s.B - s.A;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = VECTOR2I(0, 1);
|
||||
else
|
||||
{
|
||||
dir = VECTOR2I( 0, 1 );
|
||||
}
|
||||
|
||||
dir = dir.Resize( (aP - aN).EuclideanNorm() );
|
||||
dir = dir.Resize( ( aP - aN ).EuclideanNorm() );
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
aP = m_primP->Anchor( 0 );
|
||||
aN = m_primN->Anchor( 0 );
|
||||
midpoint = ( aP + aN ) / 2;
|
||||
|
@ -158,6 +161,7 @@ void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTO
|
|||
aDirection = dir;
|
||||
}
|
||||
|
||||
|
||||
DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::DirP() const
|
||||
{
|
||||
return anchorDirection( m_primP, m_anchorP );
|
||||
|
@ -189,7 +193,7 @@ static bool checkGap( const SHAPE_LINE_CHAIN &p, const SHAPE_LINE_CHAIN &n, int
|
|||
{
|
||||
int dist = p.CSegment( i ).Distance( n.CSegment( j ) );
|
||||
|
||||
if( dist < gap - 100 )
|
||||
if( dist < gap - 100 )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +351,6 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
|
|||
{
|
||||
for( const PNS_DP_GATEWAY& g_target : aTarget.Gateways() )
|
||||
{
|
||||
|
||||
n++;
|
||||
|
||||
for( int attempt = 0; attempt < 2; attempt++ )
|
||||
|
@ -394,12 +397,13 @@ bool PNS_DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I&
|
|||
|
||||
void PNS_DP_GATEWAYS::FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOrientation )
|
||||
{
|
||||
std::remove_if( m_gateways.begin(), m_gateways.end(), [aAngleMask, aRefOrientation] ( const PNS_DP_GATEWAY& dp) {
|
||||
DIRECTION_45 orient ( dp.AnchorP() - dp.AnchorN() );
|
||||
return ! (orient.Angle ( aRefOrientation ) & aAngleMask );
|
||||
} );
|
||||
std::remove_if( m_gateways.begin(), m_gateways.end(), [aAngleMask, aRefOrientation]( const PNS_DP_GATEWAY& dp) {
|
||||
DIRECTION_45 orient( dp.AnchorP() - dp.AnchorN() );
|
||||
return !( orient.Angle( aRefOrientation ) & aAngleMask );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal )
|
||||
{
|
||||
VECTOR2I majorDirection;
|
||||
|
|
|
@ -162,8 +162,8 @@ public:
|
|||
|
||||
void dump()
|
||||
{
|
||||
printf("-- Prim-P %p anchor [%d, %d]\n", m_primP, m_anchorP.x, m_anchorP.y);
|
||||
printf("-- Prim-N %p anchor [%d, %d]\n", m_primN, m_anchorN.x, m_anchorN.y);
|
||||
printf( "-- Prim-P %p anchor [%d, %d]\n", m_primP, m_anchorP.x, m_anchorP.y );
|
||||
printf( "-- Prim-N %p anchor [%d, %d]\n", m_primN, m_anchorN.x, m_anchorN.y );
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -231,7 +231,7 @@ class PNS_DP_GATEWAYS
|
|||
return m_gateways;
|
||||
}
|
||||
|
||||
void FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOrientation );
|
||||
void FilterByOrientation( int aAngleMask, DIRECTION_45 aRefOrientation );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -242,9 +242,9 @@ class PNS_DP_GATEWAYS
|
|||
int score;
|
||||
};
|
||||
|
||||
bool checkDiagonalAlignment ( const VECTOR2I& a, const VECTOR2I& b) const;
|
||||
void buildDpContinuation ( PNS_DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal );
|
||||
void buildEntries ( const VECTOR2I& p0_p, const VECTOR2I& p0_n );
|
||||
bool checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const;
|
||||
void buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal );
|
||||
void buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n );
|
||||
|
||||
int m_gap;
|
||||
int m_viaGap;
|
||||
|
@ -267,12 +267,12 @@ public:
|
|||
struct COUPLED_SEGMENTS {
|
||||
COUPLED_SEGMENTS ( const SEG& aCoupledP, const SEG& aParentP, int aIndexP,
|
||||
const SEG& aCoupledN, const SEG& aParentN, int aIndexN ) :
|
||||
coupledP ( aCoupledP ),
|
||||
coupledN ( aCoupledN ),
|
||||
parentP ( aParentP ),
|
||||
parentN ( aParentN ),
|
||||
indexP ( aIndexP ),
|
||||
indexN ( aIndexN )
|
||||
coupledP( aCoupledP ),
|
||||
coupledN( aCoupledN ),
|
||||
parentP( aParentP ),
|
||||
parentN( aParentN ),
|
||||
indexP( aIndexP ),
|
||||
indexN( aIndexN )
|
||||
{}
|
||||
|
||||
SEG coupledP;
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
|
||||
typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
|
||||
|
||||
PNS_DIFF_PAIR ( ) : PNS_ITEM ( DIFF_PAIR ), m_hasVias (false)
|
||||
PNS_DIFF_PAIR() : PNS_ITEM( DIFF_PAIR ), m_hasVias( false )
|
||||
{
|
||||
// Initialize some members, to avoid uninitialized variables.
|
||||
m_net_p = 0;
|
||||
|
@ -297,9 +297,9 @@ public:
|
|||
m_chamferLimit = 0;
|
||||
}
|
||||
|
||||
PNS_DIFF_PAIR ( int aGap ) :
|
||||
PNS_ITEM ( DIFF_PAIR ),
|
||||
m_hasVias (false)
|
||||
PNS_DIFF_PAIR( int aGap ) :
|
||||
PNS_ITEM( DIFF_PAIR ),
|
||||
m_hasVias( false )
|
||||
{
|
||||
m_gapConstraint = aGap;
|
||||
|
||||
|
@ -313,11 +313,11 @@ public:
|
|||
m_chamferLimit = 0;
|
||||
}
|
||||
|
||||
PNS_DIFF_PAIR ( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
|
||||
PNS_ITEM ( DIFF_PAIR ),
|
||||
m_n (aN),
|
||||
m_p (aP),
|
||||
m_hasVias (false)
|
||||
PNS_DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
|
||||
PNS_ITEM( DIFF_PAIR ),
|
||||
m_n( aN ),
|
||||
m_p( aP ),
|
||||
m_hasVias( false )
|
||||
{
|
||||
m_gapConstraint = aGap;
|
||||
|
||||
|
@ -331,11 +331,11 @@ public:
|
|||
m_chamferLimit = 0;
|
||||
}
|
||||
|
||||
PNS_DIFF_PAIR ( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ):
|
||||
PNS_ITEM ( DIFF_PAIR ),
|
||||
m_line_p ( aLineP ),
|
||||
m_line_n ( aLineN ),
|
||||
m_hasVias (false)
|
||||
PNS_DIFF_PAIR( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ):
|
||||
PNS_ITEM( DIFF_PAIR ),
|
||||
m_line_p( aLineP ),
|
||||
m_line_n( aLineN ),
|
||||
m_hasVias( false )
|
||||
{
|
||||
m_gapConstraint = aGap;
|
||||
m_net_p = aLineP.Net();
|
||||
|
@ -356,59 +356,62 @@ public:
|
|||
return aItem && DIFF_PAIR == aItem->Kind();
|
||||
}
|
||||
|
||||
PNS_DIFF_PAIR * Clone() const { assert(false); return NULL; }
|
||||
PNS_DIFF_PAIR* Clone() const { assert( false ); return NULL; }
|
||||
|
||||
static PNS_DIFF_PAIR* AssembleDp ( PNS_LINE *aLine );
|
||||
static PNS_DIFF_PAIR* AssembleDp( PNS_LINE *aLine );
|
||||
|
||||
void SetShape ( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, bool aSwapLanes = false)
|
||||
void SetShape( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, bool aSwapLanes = false )
|
||||
{
|
||||
if (aSwapLanes)
|
||||
if( aSwapLanes )
|
||||
{
|
||||
m_p = aN;
|
||||
m_n = aP;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
m_p = aP;
|
||||
m_n = aN;
|
||||
}
|
||||
}
|
||||
|
||||
void SetShape ( const PNS_DIFF_PAIR& aPair )
|
||||
void SetShape( const PNS_DIFF_PAIR& aPair )
|
||||
{
|
||||
m_p = aPair.m_p;
|
||||
m_n = aPair.m_n;
|
||||
}
|
||||
|
||||
void SetNets ( int aP, int aN )
|
||||
void SetNets( int aP, int aN )
|
||||
{
|
||||
m_net_p = aP;
|
||||
m_net_n = aN;
|
||||
}
|
||||
|
||||
void SetWidth ( int aWidth )
|
||||
void SetWidth( int aWidth )
|
||||
{
|
||||
m_width = aWidth;
|
||||
}
|
||||
|
||||
int Width() const { return m_width; }
|
||||
int Width() const { return m_width; }
|
||||
|
||||
void SetGap ( int aGap)
|
||||
void SetGap( int aGap )
|
||||
{
|
||||
m_gap = aGap;
|
||||
m_gapConstraint = RANGED_NUM<int> ( m_gap, 10000, 10000 );
|
||||
m_gapConstraint = RANGED_NUM<int>( m_gap, 10000, 10000 );
|
||||
}
|
||||
|
||||
int Gap() const {
|
||||
int Gap() const
|
||||
{
|
||||
return m_gap;
|
||||
}
|
||||
|
||||
void AppendVias ( const PNS_VIA &aViaP, const PNS_VIA& aViaN )
|
||||
void AppendVias( const PNS_VIA &aViaP, const PNS_VIA& aViaN )
|
||||
{
|
||||
m_hasVias = true;
|
||||
m_via_p = aViaP;
|
||||
m_via_n = aViaN;
|
||||
}
|
||||
|
||||
void RemoveVias ()
|
||||
void RemoveVias()
|
||||
{
|
||||
m_hasVias = false;
|
||||
}
|
||||
|
@ -430,15 +433,17 @@ public:
|
|||
|
||||
PNS_LINE& PLine()
|
||||
{
|
||||
if ( !m_line_p.IsLinked ( ) )
|
||||
updateLine(m_line_p, m_p, m_net_p, m_via_p );
|
||||
if( !m_line_p.IsLinked() )
|
||||
updateLine( m_line_p, m_p, m_net_p, m_via_p );
|
||||
|
||||
return m_line_p;
|
||||
}
|
||||
|
||||
PNS_LINE& NLine()
|
||||
{
|
||||
if ( !m_line_n.IsLinked ( ) )
|
||||
updateLine(m_line_n, m_n, m_net_n, m_via_n );
|
||||
if( !m_line_n.IsLinked() )
|
||||
updateLine( m_line_n, m_n, m_net_n, m_via_n );
|
||||
|
||||
return m_line_n;
|
||||
}
|
||||
|
||||
|
@ -446,10 +451,10 @@ public:
|
|||
|
||||
double CoupledLength() const;
|
||||
double TotalLength() const;
|
||||
double CoupledLengthFactor () const;
|
||||
double Skew () const;
|
||||
double CoupledLengthFactor() const;
|
||||
double Skew() const;
|
||||
|
||||
void CoupledSegmentPairs ( COUPLED_SEGMENTS_VEC& aPairs ) const;
|
||||
void CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
|
@ -457,40 +462,41 @@ public:
|
|||
m_p.Clear();
|
||||
}
|
||||
|
||||
void Append (const PNS_DIFF_PAIR& aOther )
|
||||
void Append( const PNS_DIFF_PAIR& aOther )
|
||||
{
|
||||
m_n.Append ( aOther.m_n );
|
||||
m_p.Append ( aOther.m_p );
|
||||
m_n.Append( aOther.m_n );
|
||||
m_p.Append( aOther.m_p );
|
||||
}
|
||||
|
||||
bool Empty() const
|
||||
{
|
||||
return (m_n.SegmentCount() == 0) || (m_p.SegmentCount() == 0);
|
||||
return ( m_n.SegmentCount() == 0 ) || ( m_p.SegmentCount() == 0 );
|
||||
}
|
||||
|
||||
const SHAPE_LINE_CHAIN& CP() const { return m_p; }
|
||||
const SHAPE_LINE_CHAIN& CN() const { return m_n; }
|
||||
|
||||
bool BuildInitial ( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GATEWAY& aTarget, bool aPrefDiagonal );
|
||||
bool CheckConnectionAngle ( const PNS_DIFF_PAIR &aOther, int allowedAngles ) const;
|
||||
int CoupledLength ( const SEG& aP, const SEG& aN ) const;
|
||||
bool BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GATEWAY& aTarget, bool aPrefDiagonal );
|
||||
bool CheckConnectionAngle( const PNS_DIFF_PAIR &aOther, int allowedAngles ) const;
|
||||
int CoupledLength( const SEG& aP, const SEG& aN ) const;
|
||||
|
||||
int64_t CoupledLength ( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const;
|
||||
int64_t CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const;
|
||||
|
||||
const RANGED_NUM<int> GapConstraint() const {
|
||||
const RANGED_NUM<int> GapConstraint() const
|
||||
{
|
||||
return m_gapConstraint;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void updateLine( PNS_LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, PNS_VIA& aVia )
|
||||
{
|
||||
aLine.SetShape( aShape );
|
||||
aLine.SetWidth( m_width );
|
||||
aLine.SetNet(aNet);
|
||||
aLine.SetLayer (Layers().Start());
|
||||
aLine.SetNet( aNet );
|
||||
aLine.SetLayer( Layers().Start() );
|
||||
|
||||
if(m_hasVias)
|
||||
aLine.AppendVia ( aVia );
|
||||
if( m_hasVias )
|
||||
aLine.AppendVia( aVia );
|
||||
}
|
||||
|
||||
SHAPE_LINE_CHAIN m_n, m_p;
|
||||
|
@ -507,5 +513,4 @@ private:
|
|||
RANGED_NUM<int> m_gapConstraint;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -474,25 +474,22 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
|
|||
{
|
||||
int netP, netN;
|
||||
|
||||
|
||||
printf("world %p\n", m_world);
|
||||
printf( "world %p\n", m_world );
|
||||
|
||||
bool result = m_world->GetRuleResolver()->DpNetPair( aItem, netP, netN );
|
||||
|
||||
if(!result)
|
||||
if( !result )
|
||||
return false;
|
||||
|
||||
int refNet = aItem->Net();
|
||||
int coupledNet = (refNet == netP) ? netN : netP;
|
||||
|
||||
printf("result %d\n", !!result);
|
||||
|
||||
int coupledNet = ( refNet == netP ) ? netN : netP;
|
||||
|
||||
printf( "result %d\n", !!result );
|
||||
|
||||
OPT_VECTOR2I refAnchor = getDanglingAnchor( m_currentNode, aItem );
|
||||
PNS_ITEM *primRef = aItem;
|
||||
PNS_ITEM* primRef = aItem;
|
||||
|
||||
printf("refAnchor %p\n", aItem);
|
||||
printf( "refAnchor %p\n", aItem );
|
||||
|
||||
if( !refAnchor )
|
||||
return false;
|
||||
|
@ -613,7 +610,7 @@ bool PNS_DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
|||
}
|
||||
|
||||
|
||||
void PNS_DIFF_PAIR_PLACER::initPlacement( )
|
||||
void PNS_DIFF_PAIR_PLACER::initPlacement()
|
||||
{
|
||||
m_idle = false;
|
||||
m_orthoMode = false;
|
||||
|
@ -642,6 +639,7 @@ void PNS_DIFF_PAIR_PLACER::initPlacement( )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
|
||||
{
|
||||
m_fitOk = false;
|
||||
|
@ -656,31 +654,34 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
|
|||
|
||||
PNS_DP_PRIMITIVE_PAIR target;
|
||||
|
||||
if( findDpPrimitivePair ( aP, m_currentEndItem, target ) )
|
||||
if( findDpPrimitivePair( aP, m_currentEndItem, target ) )
|
||||
{
|
||||
gwsTarget.BuildFromPrimitivePair( target, m_startDiagonal );
|
||||
m_snapOnTarget = true;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
VECTOR2I fp;
|
||||
|
||||
if( !propagateDpHeadForces( aP, fp ) )
|
||||
return false;
|
||||
|
||||
|
||||
VECTOR2I midp, dirV;
|
||||
m_prevPair->CursorOrientation(fp, midp, dirV);
|
||||
m_prevPair->CursorOrientation( fp, midp, dirV );
|
||||
|
||||
VECTOR2I fpProj = SEG( midp, midp+dirV ).LineProject ( fp );
|
||||
int lead_dist = (fpProj - fp).EuclideanNorm();
|
||||
VECTOR2I fpProj = SEG( midp, midp + dirV ).LineProject( fp );
|
||||
int lead_dist = ( fpProj - fp ).EuclideanNorm();
|
||||
|
||||
gwsTarget.SetFitVias( m_placingVia, m_sizes.ViaDiameter(), viaGap() );
|
||||
|
||||
if (lead_dist > m_sizes.DiffPairGap() + m_sizes.DiffPairWidth() )
|
||||
if( lead_dist > m_sizes.DiffPairGap() + m_sizes.DiffPairWidth() )
|
||||
{
|
||||
gwsTarget.BuildForCursor( fp );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
gwsTarget.BuildForCursor( fpProj );
|
||||
gwsTarget.FilterByOrientation ( DIRECTION_45::ANG_STRAIGHT | DIRECTION_45::ANG_HALF_FULL, DIRECTION_45 ( dirV ) );
|
||||
gwsTarget.FilterByOrientation( DIRECTION_45::ANG_STRAIGHT | DIRECTION_45::ANG_HALF_FULL, DIRECTION_45( dirV ) );
|
||||
}
|
||||
|
||||
m_snapOnTarget = false;
|
||||
|
@ -692,7 +693,7 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
|
|||
|
||||
bool result = gwsEntry.FitGateways( gwsEntry, gwsTarget, m_startDiagonal, m_currentTrace );
|
||||
|
||||
if ( result )
|
||||
if( result )
|
||||
{
|
||||
m_currentTrace.SetNets( m_netP, m_netN );
|
||||
m_currentTrace.SetWidth( m_sizes.DiffPairWidth() );
|
||||
|
@ -700,8 +701,8 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
|
|||
|
||||
if( m_placingVia )
|
||||
{
|
||||
m_currentTrace.AppendVias ( makeVia ( m_currentTrace.CP().CPoint(-1), m_netP ),
|
||||
makeVia ( m_currentTrace.CN().CPoint(-1), m_netN ) );
|
||||
m_currentTrace.AppendVias ( makeVia( m_currentTrace.CP().CPoint( -1 ), m_netP ),
|
||||
makeVia( m_currentTrace.CN().CPoint( -1 ), m_netN ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -117,7 +117,6 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
|||
|
||||
void PNS_DP_MEANDER_PLACER::release()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,7 +155,7 @@ static bool pairOrientation( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aPair )
|
|||
{
|
||||
VECTOR2I midp = ( aPair.coupledP.A + aPair.coupledN.A ) / 2;
|
||||
|
||||
//DrawDebugPoint (midp, 6);
|
||||
//DrawDebugPoint(midp, 6);
|
||||
|
||||
return aPair.coupledP.Side( midp ) > 0;
|
||||
}
|
||||
|
@ -179,7 +178,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
|||
cutTunedLine( m_originPair.CP(), m_currentStart, aP, preP, tunedP, postP );
|
||||
cutTunedLine( m_originPair.CN(), m_currentStart, aP, preN, tunedN, postN );
|
||||
|
||||
PNS_DIFF_PAIR tuned ( m_originPair );
|
||||
PNS_DIFF_PAIR tuned( m_originPair );
|
||||
|
||||
tuned.SetShape( tunedP, tunedN );
|
||||
|
||||
|
@ -188,11 +187,11 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
|||
if( coupledSegments.size() == 0 )
|
||||
return false;
|
||||
|
||||
//Router()->DisplayDebugLine ( tuned.CP(), 5, 20000 );
|
||||
//Router()->DisplayDebugLine ( tuned.CN(), 4, 20000 );
|
||||
//Router()->DisplayDebugLine( tuned.CP(), 5, 20000 );
|
||||
//Router()->DisplayDebugLine( tuned.CN(), 4, 20000 );
|
||||
|
||||
//Router()->DisplayDebugLine ( m_originPair.CP(), 5, 20000 );
|
||||
//Router()->DisplayDebugLine ( m_originPair.CN(), 4, 20000 );
|
||||
//Router()->DisplayDebugLine( m_originPair.CP(), 5, 20000 );
|
||||
//Router()->DisplayDebugLine( m_originPair.CN(), 4, 20000 );
|
||||
|
||||
m_result = PNS_MEANDERED_LINE( this, true );
|
||||
m_result.SetWidth( tuned.Width() );
|
||||
|
@ -269,8 +268,8 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
|||
{
|
||||
if( m->Type() != MT_EMPTY )
|
||||
{
|
||||
tunedP.Append ( m->CLine( 0 ) );
|
||||
tunedN.Append ( m->CLine( 1 ) );
|
||||
tunedP.Append( m->CLine( 0 ) );
|
||||
tunedN.Append( m->CLine( 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
* Starts routing a single track at point aP, taking item aStartItem as anchor
|
||||
* (unless NULL).
|
||||
*/
|
||||
bool Start ( const VECTOR2I& aP, PNS_ITEM* aStartItem );
|
||||
bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
|
||||
|
||||
/**
|
||||
* Function Move()
|
||||
|
@ -106,7 +106,7 @@ public:
|
|||
private:
|
||||
friend class PNS_MEANDER_SHAPE;
|
||||
|
||||
void meanderSegment ( const SEG& aBase );
|
||||
void meanderSegment( const SEG& aBase );
|
||||
|
||||
// void addMeander ( PNS_MEANDER *aM );
|
||||
// void addCorner ( const VECTOR2I& aP );
|
||||
|
|
|
@ -300,7 +300,7 @@ public:
|
|||
m_marker = aMarker;
|
||||
}
|
||||
|
||||
virtual void Unmark (int aMarker = -1)
|
||||
virtual void Unmark(int aMarker = -1)
|
||||
{
|
||||
m_marker &= ~aMarker;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
|
||||
virtual VECTOR2I Anchor( int n ) const
|
||||
{
|
||||
return VECTOR2I ();
|
||||
return VECTOR2I();
|
||||
}
|
||||
|
||||
virtual int AnchorCount() const
|
||||
|
|
|
@ -62,19 +62,19 @@
|
|||
class PNS_PCBNEW_RULE_RESOLVER : public PNS_RULE_RESOLVER
|
||||
{
|
||||
public:
|
||||
PNS_PCBNEW_RULE_RESOLVER( BOARD *aBoard, PNS_ROUTER *aRouter );
|
||||
PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS_ROUTER* aRouter );
|
||||
virtual ~PNS_PCBNEW_RULE_RESOLVER();
|
||||
|
||||
virtual int Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB );
|
||||
virtual void OverrideClearance (bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0);
|
||||
virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 );
|
||||
virtual void UseDpGap( bool aUseDpGap ) { m_useDpGap = aUseDpGap; }
|
||||
virtual int DpCoupledNet( int aNet );
|
||||
virtual int DpNetPolarity( int aNet );
|
||||
virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN );
|
||||
|
||||
private:
|
||||
|
||||
struct CLEARANCE_ENT {
|
||||
struct CLEARANCE_ENT
|
||||
{
|
||||
int coupledNet;
|
||||
int clearance;
|
||||
};
|
||||
|
@ -82,8 +82,8 @@ private:
|
|||
int localPadClearance( const PNS_ITEM* aItem ) const;
|
||||
int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName );
|
||||
|
||||
PNS_ROUTER *m_router;
|
||||
BOARD *m_board;
|
||||
PNS_ROUTER* m_router;
|
||||
BOARD* m_board;
|
||||
|
||||
std::vector<CLEARANCE_ENT> m_clearanceCache;
|
||||
int m_defaultClearance;
|
||||
|
@ -91,11 +91,10 @@ private:
|
|||
int m_overrideNetA, m_overrideNetB;
|
||||
int m_overrideClearance;
|
||||
bool m_useDpGap;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD *aBoard, PNS_ROUTER* aRouter ) :
|
||||
PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS_ROUTER* aRouter ) :
|
||||
m_router( aRouter ),
|
||||
m_board( aBoard )
|
||||
{
|
||||
|
@ -107,6 +106,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD *aBoard, PNS_ROUTER* a
|
|||
for( unsigned int i = 0; i < m_board->GetNetCount(); i++ )
|
||||
{
|
||||
NETINFO_ITEM* ni = m_board->FindNet( i );
|
||||
|
||||
if( ni == NULL )
|
||||
continue;
|
||||
|
||||
|
@ -131,10 +131,12 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD *aBoard, PNS_ROUTER* a
|
|||
m_overrideClearance = 0;
|
||||
}
|
||||
|
||||
|
||||
PNS_PCBNEW_RULE_RESOLVER::~PNS_PCBNEW_RULE_RESOLVER()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS_ITEM* aItem ) const
|
||||
{
|
||||
if( !aItem->Parent() || aItem->Parent()->Type() != PCB_PAD_T )
|
||||
|
@ -178,6 +180,7 @@ void PNS_PCBNEW_RULE_RESOLVER::OverrideClearance( bool aEnable, int aNetA, int a
|
|||
m_overrideClearance = aClearance;
|
||||
}
|
||||
|
||||
|
||||
int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
|
||||
{
|
||||
int rv = 0;
|
||||
|
@ -226,7 +229,6 @@ int PNS_PCBNEW_RULE_RESOLVER::DpCoupledNet( int aNet )
|
|||
return -1;
|
||||
|
||||
return net->GetNet();
|
||||
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -241,6 +243,7 @@ int PNS_PCBNEW_RULE_RESOLVER::DpNetPolarity( int aNet )
|
|||
return matchDpSuffix( refName, dummy1, dummy2 );
|
||||
}
|
||||
|
||||
|
||||
bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN )
|
||||
{
|
||||
if( !aItem || !aItem->Parent() || !aItem->Parent()->GetNet() )
|
||||
|
@ -249,7 +252,7 @@ bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNet
|
|||
wxString netNameP = aItem->Parent()->GetNet()->GetNetname();
|
||||
wxString netNameN, netNameCoupled, netNameBase;
|
||||
|
||||
int r = matchDpSuffix ( netNameP, netNameCoupled, netNameBase );
|
||||
int r = matchDpSuffix( netNameP, netNameCoupled, netNameBase );
|
||||
|
||||
if( r == 0 )
|
||||
return false;
|
||||
|
@ -279,13 +282,14 @@ bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNet
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
class PNS_PCBNEW_DEBUG_DECORATOR: public PNS_DEBUG_DECORATOR
|
||||
{
|
||||
public:
|
||||
PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW *aView = NULL ): PNS_DEBUG_DECORATOR(),
|
||||
PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW* aView = NULL ): PNS_DEBUG_DECORATOR(),
|
||||
m_view( NULL ), m_items( NULL )
|
||||
{
|
||||
SetView ( aView );
|
||||
SetView( aView );
|
||||
}
|
||||
|
||||
~PNS_PCBNEW_DEBUG_DECORATOR()
|
||||
|
@ -293,14 +297,16 @@ public:
|
|||
Clear();
|
||||
}
|
||||
|
||||
void SetView( KIGFX::VIEW *aView )
|
||||
void SetView( KIGFX::VIEW* aView )
|
||||
{
|
||||
Clear();
|
||||
delete m_items;
|
||||
m_items = NULL;
|
||||
m_view = aView;
|
||||
if ( m_view == NULL )
|
||||
|
||||
if( m_view == NULL )
|
||||
return;
|
||||
|
||||
m_items = new KIGFX::VIEW_GROUP( m_view );
|
||||
m_items->SetLayer( ITEM_GAL_LAYER( GP_OVERLAY ) );
|
||||
m_view->Add( m_items );
|
||||
|
@ -314,7 +320,7 @@ public:
|
|||
l.Append( aP - VECTOR2I( -50000, -50000 ) );
|
||||
l.Append( aP + VECTOR2I( -50000, -50000 ) );
|
||||
|
||||
AddLine ( l, aColor, 10000 );
|
||||
AddLine( l, aColor, 10000 );
|
||||
|
||||
l.Clear();
|
||||
l.Append( aP - VECTOR2I( 50000, -50000 ) );
|
||||
|
@ -376,7 +382,7 @@ public:
|
|||
|
||||
void Clear() override
|
||||
{
|
||||
if (m_view && m_items)
|
||||
if( m_view && m_items )
|
||||
{
|
||||
m_items->FreeItems();
|
||||
m_items->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
|
@ -388,13 +394,14 @@ private:
|
|||
KIGFX::VIEW_GROUP* m_items;
|
||||
};
|
||||
|
||||
|
||||
PNS_DEBUG_DECORATOR* PNS_KICAD_IFACE::GetDebugDecorator()
|
||||
{
|
||||
return m_debugDecorator;
|
||||
}
|
||||
|
||||
|
||||
PNS_KICAD_IFACE::PNS_KICAD_IFACE ()
|
||||
PNS_KICAD_IFACE::PNS_KICAD_IFACE()
|
||||
{
|
||||
m_ruleResolver = nullptr;
|
||||
m_board = nullptr;
|
||||
|
@ -406,7 +413,8 @@ PNS_KICAD_IFACE::PNS_KICAD_IFACE ()
|
|||
m_debugDecorator = nullptr;
|
||||
}
|
||||
|
||||
PNS_KICAD_IFACE::~PNS_KICAD_IFACE ()
|
||||
|
||||
PNS_KICAD_IFACE::~PNS_KICAD_IFACE()
|
||||
{
|
||||
if( m_ruleResolver )
|
||||
delete m_ruleResolver;
|
||||
|
@ -421,7 +429,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
|
|||
PNS_LAYERSET layers( 0, MAX_CU_LAYERS - 1 );
|
||||
|
||||
// ignore non-copper pads
|
||||
if ( (aPad->GetLayerSet() & LSET::AllCuMask()).none() )
|
||||
if( ( aPad->GetLayerSet() & LSET::AllCuMask()).none() )
|
||||
return NULL;
|
||||
|
||||
switch( aPad->GetAttribute() )
|
||||
|
@ -441,8 +449,10 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
|
|||
if( lmsk[i] )
|
||||
{
|
||||
is_copper = true;
|
||||
|
||||
if( aPad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||
layers = PNS_LAYERSET( i );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -532,8 +542,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
|
|||
SHAPE_POLY_SET outline;
|
||||
const int segmentToCircleCount = 64;
|
||||
|
||||
aPad->BuildPadShapePolygon( outline, wxSize( 0, 0 ),
|
||||
segmentToCircleCount, 1.0 );
|
||||
aPad->BuildPadShapePolygon( outline, wxSize( 0, 0 ), segmentToCircleCount, 1.0 );
|
||||
|
||||
// TransformRoundRectToPolygon creates only one convex polygon
|
||||
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
|
||||
|
@ -642,8 +651,8 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
|
|||
}
|
||||
|
||||
solid->SetShape( shape );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
TRACEn( 0, "unsupported pad shape" );
|
||||
|
@ -724,7 +733,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
|
|||
item = syncVia( static_cast<VIA*>( t ) );
|
||||
|
||||
if( t->IsLocked() )
|
||||
item->Mark ( MK_LOCKED );
|
||||
item->Mark( MK_LOCKED );
|
||||
|
||||
if( item )
|
||||
aWorld->Add( item );
|
||||
|
@ -732,7 +741,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
|
|||
|
||||
int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue();
|
||||
|
||||
if (m_ruleResolver)
|
||||
if( m_ruleResolver )
|
||||
delete m_ruleResolver;
|
||||
|
||||
m_ruleResolver = new PNS_PCBNEW_RULE_RESOLVER( m_board, m_router );
|
||||
|
@ -741,9 +750,10 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
|
|||
aWorld->SetMaxClearance( 4 * worstClearance );
|
||||
}
|
||||
|
||||
|
||||
void PNS_KICAD_IFACE::EraseView()
|
||||
{
|
||||
for ( auto item : m_hiddenItems)
|
||||
for( auto item : m_hiddenItems )
|
||||
item->ViewSetVisible( true );
|
||||
|
||||
m_hiddenItems.clear();
|
||||
|
@ -754,13 +764,14 @@ void PNS_KICAD_IFACE::EraseView()
|
|||
m_previewItems->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
|
||||
if(m_debugDecorator)
|
||||
if( m_debugDecorator )
|
||||
m_debugDecorator->Clear();
|
||||
}
|
||||
|
||||
|
||||
void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance )
|
||||
{
|
||||
printf("DisplayItem %p\n", aItem);
|
||||
printf( "DisplayItem %p\n", aItem );
|
||||
|
||||
ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aItem, m_previewItems );
|
||||
|
||||
|
@ -776,7 +787,8 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClear
|
|||
m_previewItems->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY | KIGFX::VIEW_ITEM::APPEARANCE );
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::HideItem( PNS_ITEM *aItem )
|
||||
|
||||
void PNS_KICAD_IFACE::HideItem( PNS_ITEM* aItem )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* parent = aItem->Parent();
|
||||
|
||||
|
@ -790,7 +802,8 @@ void PNS_KICAD_IFACE::HideItem( PNS_ITEM *aItem )
|
|||
}
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::RemoveItem ( PNS_ITEM *aItem )
|
||||
|
||||
void PNS_KICAD_IFACE::RemoveItem( PNS_ITEM* aItem )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* parent = aItem->Parent();
|
||||
|
||||
|
@ -802,7 +815,8 @@ void PNS_KICAD_IFACE::RemoveItem ( PNS_ITEM *aItem )
|
|||
}
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::AddItem ( PNS_ITEM *aItem )
|
||||
|
||||
void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* newBI = NULL;
|
||||
|
||||
|
@ -852,6 +866,7 @@ void PNS_KICAD_IFACE::AddItem ( PNS_ITEM *aItem )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void PNS_KICAD_IFACE::Commit()
|
||||
{
|
||||
m_board->GetRatsnest()->Recalculate();
|
||||
|
@ -860,9 +875,11 @@ void PNS_KICAD_IFACE::Commit()
|
|||
m_frame->OnModify();
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::SetView ( KIGFX::VIEW *aView )
|
||||
|
||||
void PNS_KICAD_IFACE::SetView( KIGFX::VIEW *aView )
|
||||
{
|
||||
printf("SetView %p\n", aView);
|
||||
printf( "SetView %p\n", aView );
|
||||
|
||||
if( m_previewItems )
|
||||
{
|
||||
m_previewItems->FreeItems();
|
||||
|
@ -879,12 +896,12 @@ void PNS_KICAD_IFACE::SetView ( KIGFX::VIEW *aView )
|
|||
delete m_debugDecorator;
|
||||
|
||||
m_debugDecorator = new PNS_PCBNEW_DEBUG_DECORATOR();
|
||||
m_debugDecorator->SetView ( m_view );
|
||||
m_debugDecorator->SetView( m_view );
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::UpdateNet ( int aNetCode )
|
||||
void PNS_KICAD_IFACE::UpdateNet( int aNetCode )
|
||||
{
|
||||
printf("Update-net %d\n", aNetCode);
|
||||
printf( "Update-net %d\n", aNetCode );
|
||||
}
|
||||
|
||||
PNS_RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver()
|
||||
|
@ -892,12 +909,12 @@ PNS_RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver()
|
|||
return m_ruleResolver;
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::SetRouter( PNS_ROUTER *aRouter )
|
||||
void PNS_KICAD_IFACE::SetRouter( PNS_ROUTER* aRouter )
|
||||
{
|
||||
m_router = aRouter;
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::SetHostFrame ( PCB_EDIT_FRAME *aFrame )
|
||||
void PNS_KICAD_IFACE::SetHostFrame( PCB_EDIT_FRAME *aFrame )
|
||||
{
|
||||
m_frame = aFrame;
|
||||
}
|
||||
|
|
|
@ -28,38 +28,36 @@
|
|||
class PNS_PCBNEW_RULE_RESOLVER;
|
||||
class PNS_PCBNEW_DEBUG_DECORATOR;
|
||||
|
||||
|
||||
class BOARD;
|
||||
namespace KIGFX {
|
||||
namespace KIGFX
|
||||
{
|
||||
class VIEW;
|
||||
|
||||
};
|
||||
|
||||
class PNS_KICAD_IFACE : public PNS_ROUTER_IFACE {
|
||||
public:
|
||||
PNS_KICAD_IFACE ();
|
||||
~PNS_KICAD_IFACE ();
|
||||
PNS_KICAD_IFACE();
|
||||
~PNS_KICAD_IFACE();
|
||||
|
||||
void SetRouter( PNS_ROUTER *aRouter );
|
||||
void SetHostFrame ( PCB_EDIT_FRAME *aFrame );
|
||||
void SetRouter( PNS_ROUTER* aRouter );
|
||||
void SetHostFrame( PCB_EDIT_FRAME* aFrame );
|
||||
|
||||
void SetBoard( BOARD* aBoard );
|
||||
void SetView ( KIGFX::VIEW *aView );
|
||||
void SyncWorld( PNS_NODE *aWorld );
|
||||
void SetView( KIGFX::VIEW* aView );
|
||||
void SyncWorld( PNS_NODE* aWorld );
|
||||
void EraseView();
|
||||
void HideItem ( PNS_ITEM *aItem );
|
||||
void DisplayItem( const PNS_ITEM* aItem, int aColor = 0, int aClearance = 0);
|
||||
void AddItem ( PNS_ITEM *aItem );
|
||||
void RemoveItem ( PNS_ITEM *aItem );
|
||||
void Commit ();
|
||||
void HideItem( PNS_ITEM* aItem );
|
||||
void DisplayItem( const PNS_ITEM* aItem, int aColor = 0, int aClearance = 0 );
|
||||
void AddItem( PNS_ITEM* aItem );
|
||||
void RemoveItem( PNS_ITEM* aItem );
|
||||
void Commit();
|
||||
|
||||
void UpdateNet ( int aNetCode );
|
||||
void UpdateNet( int aNetCode );
|
||||
|
||||
PNS_RULE_RESOLVER* GetRuleResolver();
|
||||
PNS_DEBUG_DECORATOR* GetDebugDecorator();
|
||||
|
||||
private:
|
||||
|
||||
PNS_PCBNEW_RULE_RESOLVER* m_ruleResolver;
|
||||
PNS_PCBNEW_DEBUG_DECORATOR* m_debugDecorator;
|
||||
|
||||
|
@ -67,15 +65,15 @@ private:
|
|||
PNS_ITEM* syncTrack( TRACK* aTrack );
|
||||
PNS_ITEM* syncVia( VIA* aVia );
|
||||
|
||||
KIGFX::VIEW *m_view;
|
||||
KIGFX::VIEW* m_view;
|
||||
KIGFX::VIEW_GROUP* m_previewItems;
|
||||
std::unordered_set<BOARD_CONNECTED_ITEM*> m_hiddenItems;
|
||||
|
||||
PNS_NODE *m_world;
|
||||
PNS_ROUTER *m_router;
|
||||
BOARD *m_board;
|
||||
PNS_NODE* m_world;
|
||||
PNS_ROUTER* m_router;
|
||||
BOARD* m_board;
|
||||
PICKED_ITEMS_LIST m_undoBuffer;
|
||||
PCB_EDIT_FRAME *m_frame;
|
||||
PCB_EDIT_FRAME* m_frame;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -281,7 +281,7 @@ void PNS_LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle,
|
|||
|
||||
const SHAPE_LINE_CHAIN PNS_SEGMENT::Hull( int aClearance, int aWalkaroundThickness ) const
|
||||
{
|
||||
return SegmentHull ( m_seg, aClearance, aWalkaroundThickness );
|
||||
return SegmentHull( m_seg, aClearance, aWalkaroundThickness );
|
||||
}
|
||||
|
||||
|
||||
|
@ -369,7 +369,7 @@ SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECT
|
|||
|
||||
for( i = aOrigin.SegmentCount() - d; i >= 0; i-- )
|
||||
{
|
||||
DIRECTION_45 d_start ( aOrigin.CSegment( i ) );
|
||||
DIRECTION_45 d_start( aOrigin.CSegment( i ) );
|
||||
VECTOR2I p_start = aOrigin.CPoint( i );
|
||||
SHAPE_LINE_CHAIN paths[2];
|
||||
DIRECTION_45 dirs[2];
|
||||
|
@ -420,7 +420,7 @@ SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECT
|
|||
}
|
||||
|
||||
|
||||
void PNS_LINE::DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
|
||||
void PNS_LINE::DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
|
||||
{
|
||||
SHAPE_LINE_CHAIN path;
|
||||
|
||||
|
@ -532,7 +532,7 @@ VECTOR2I PNS_LINE::snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const
|
|||
}
|
||||
|
||||
|
||||
void PNS_LINE::DragSegment ( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
|
||||
void PNS_LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
|
||||
{
|
||||
SHAPE_LINE_CHAIN path( m_line );
|
||||
VECTOR2I target( aP );
|
||||
|
@ -649,15 +649,15 @@ void PNS_LINE::DragSegment ( const VECTOR2I& aP, int aIndex, int aSnappingThresh
|
|||
|
||||
if( (ip = s1.Intersect( s_next )) )
|
||||
{
|
||||
np.Append ( s1.A );
|
||||
np.Append ( *ip );
|
||||
np.Append ( s_next.B );
|
||||
np.Append( s1.A );
|
||||
np.Append( *ip );
|
||||
np.Append( s_next.B );
|
||||
}
|
||||
else if( (ip = s3.Intersect( s_prev )) )
|
||||
{
|
||||
np.Append ( s_prev.A );
|
||||
np.Append ( *ip );
|
||||
np.Append ( s3.B );
|
||||
np.Append( s_prev.A );
|
||||
np.Append( *ip );
|
||||
np.Append( s3.B );
|
||||
}
|
||||
else if( (ip = s1.Intersect( s3 )) )
|
||||
{
|
||||
|
@ -801,8 +801,11 @@ void PNS_LINE::ClearSegmentLinks()
|
|||
static void extendBox( BOX2I& aBox, bool& aDefined, const VECTOR2I& aP )
|
||||
{
|
||||
if( aDefined )
|
||||
aBox.Merge ( aP );
|
||||
else {
|
||||
{
|
||||
aBox.Merge( aP );
|
||||
}
|
||||
else
|
||||
{
|
||||
aBox = BOX2I( aP, VECTOR2I( 0, 0 ) );
|
||||
aDefined = true;
|
||||
}
|
||||
|
@ -887,11 +890,12 @@ OPT_BOX2I PNS_LINE::ChangedArea( const PNS_LINE* aOther ) const
|
|||
return OPT_BOX2I();
|
||||
}
|
||||
|
||||
|
||||
bool PNS_LINE::HasLockedSegments() const
|
||||
{
|
||||
for ( const PNS_SEGMENT *seg : *m_segmentRefs )
|
||||
for( const PNS_SEGMENT* seg : *m_segmentRefs )
|
||||
{
|
||||
if ( seg->Marker() & MK_LOCKED )
|
||||
if( seg->Marker() & MK_LOCKED )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -436,7 +436,7 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
|
|||
PNS_WALKAROUND::WALKAROUND_STATUS stat_solids = walkaround.Route( initTrack, walkSolids );
|
||||
|
||||
optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_SEGMENTS );
|
||||
optimizer.SetCollisionMask ( PNS_ITEM::SOLID );
|
||||
optimizer.SetCollisionMask( PNS_ITEM::SOLID );
|
||||
optimizer.Optimize( &walkSolids );
|
||||
|
||||
if( stat_solids == PNS_WALKAROUND::DONE )
|
||||
|
@ -724,10 +724,11 @@ bool PNS_LINE_PLACER::SetLayer( int aLayer )
|
|||
{
|
||||
return false;
|
||||
}
|
||||
else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA ) && m_startItem->Layers().Overlaps( aLayer ) ) ) {
|
||||
else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA ) && m_startItem->Layers().Overlaps( aLayer ) ) )
|
||||
{
|
||||
m_currentLayer = aLayer;
|
||||
initPlacement ( );
|
||||
Move ( m_currentEnd, NULL );
|
||||
initPlacement();
|
||||
Move( m_currentEnd, NULL );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -756,11 +757,12 @@ bool PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
|||
|
||||
setInitialDirection( Settings().InitialDirection() );
|
||||
|
||||
initPlacement( );
|
||||
initPlacement();
|
||||
return true;
|
||||
}
|
||||
|
||||
void PNS_LINE_PLACER::initPlacement( )
|
||||
|
||||
void PNS_LINE_PLACER::initPlacement()
|
||||
{
|
||||
m_idle = false;
|
||||
|
||||
|
@ -1008,7 +1010,7 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
|
|||
|
||||
if( !m_idle )
|
||||
{
|
||||
initPlacement( );
|
||||
initPlacement();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1029,6 +1031,7 @@ void PNS_LINE_PLACER::SetOrthoMode( bool aOrthoMode )
|
|||
m_orthoMode = aOrthoMode;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
|
||||
{
|
||||
SHAPE_LINE_CHAIN l;
|
||||
|
|
|
@ -222,7 +222,7 @@ private:
|
|||
*
|
||||
* Initializes placement of a new line with given parameters.
|
||||
*/
|
||||
void initPlacement( );
|
||||
void initPlacement();
|
||||
|
||||
/**
|
||||
* Function setInitialDirection()
|
||||
|
@ -342,7 +342,7 @@ private:
|
|||
///> route step, mark obstacles mode
|
||||
bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead );
|
||||
|
||||
const PNS_VIA makeVia ( const VECTOR2I& aP );
|
||||
const PNS_VIA makeVia( const VECTOR2I& aP );
|
||||
|
||||
bool buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead );
|
||||
|
||||
|
|
|
@ -35,11 +35,13 @@ const PNS_MEANDER_SETTINGS& PNS_MEANDER_SHAPE::Settings() const
|
|||
return m_placer->MeanderSettings();
|
||||
}
|
||||
|
||||
|
||||
const PNS_MEANDER_SETTINGS& PNS_MEANDERED_LINE::Settings() const
|
||||
{
|
||||
return m_placer->MeanderSettings();
|
||||
}
|
||||
|
||||
|
||||
void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
|
||||
{
|
||||
double base_len = aBase.Length();
|
||||
|
@ -78,7 +80,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
|
|||
{
|
||||
for( int i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( m.Fit( MT_CHECK_START, aBase, m_last, i ) )
|
||||
if( m.Fit( MT_CHECK_START, aBase, m_last, i ) )
|
||||
{
|
||||
turning = true;
|
||||
AddMeander( new PNS_MEANDER_SHAPE( m ) );
|
||||
|
@ -94,7 +96,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
|
|||
|
||||
for( int i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( m.Fit ( MT_SINGLE, aBase, m_last, i ) )
|
||||
if( m.Fit( MT_SINGLE, aBase, m_last, i ) )
|
||||
{
|
||||
AddMeander( new PNS_MEANDER_SHAPE( m ) );
|
||||
fail = false;
|
||||
|
@ -170,12 +172,12 @@ int PNS_MEANDER_SHAPE::cornerRadius() const
|
|||
|
||||
int PNS_MEANDER_SHAPE::spacing( ) const
|
||||
{
|
||||
if ( !m_dual )
|
||||
if( !m_dual )
|
||||
return std::max( 2 * m_width, Settings().m_spacing );
|
||||
else
|
||||
{
|
||||
int sp = 2 * ( m_width + std::abs( m_baselineOffset ) );
|
||||
return std::max ( sp, Settings().m_spacing );
|
||||
return std::max( sp, Settings().m_spacing );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +199,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir,
|
|||
|
||||
|
||||
// fixme: refactor
|
||||
switch (m_placer->MeanderSettings().m_cornerStyle)
|
||||
switch( m_placer->MeanderSettings().m_cornerStyle )
|
||||
{
|
||||
case MEANDER_STYLE_ROUND:
|
||||
{
|
||||
|
@ -231,7 +233,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir,
|
|||
double radius = (double) aDir.EuclideanNorm();
|
||||
double correction = 0;
|
||||
if( m_dual && radius > m_meanCornerRadius )
|
||||
correction = (double)(-2 * abs(m_baselineOffset)) * tan ( 22.5 * M_PI / 180.0 );
|
||||
correction = (double)(-2 * abs(m_baselineOffset)) * tan( 22.5 * M_PI / 180.0 );
|
||||
|
||||
VECTOR2D dir_cu = dir_u.Resize( correction );
|
||||
VECTOR2D dir_cv = dir_v.Resize( correction );
|
||||
|
@ -307,7 +309,7 @@ void PNS_MEANDER_SHAPE::miter( int aRadius, bool aSide )
|
|||
m_currentPos = lc.CPoint( -1 );
|
||||
m_currentDir = dir.Rotate( aSide ? -M_PI / 2.0 : M_PI / 2.0 );
|
||||
|
||||
m_currentTarget->Append ( lc );
|
||||
m_currentTarget->Append( lc );
|
||||
}
|
||||
|
||||
|
||||
|
@ -371,7 +373,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
|
|||
case MT_FINISH:
|
||||
{
|
||||
start( &lc, aP - dir_u_b, aDir );
|
||||
turn ( 90 );
|
||||
turn( 90 );
|
||||
forward( std::min( cr - offset, cr + offset ) );
|
||||
forward( std::abs( offset ) );
|
||||
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
|
||||
|
@ -384,7 +386,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
|
|||
start( &lc, aP - dir_u_b, aDir );
|
||||
turn( 90 );
|
||||
forward( std::abs( offset ) );
|
||||
uShape ( aAmpl - cr, cr + offset, spc - 2 * cr );
|
||||
uShape( aAmpl - cr, cr + offset, spc - 2 * cr );
|
||||
forward( std::abs( offset ) );
|
||||
break;
|
||||
}
|
||||
|
@ -394,7 +396,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
|
|||
miter( cr - offset, false );
|
||||
uShape( aAmpl - 2 * cr + std::abs( offset ), cr + offset, spc - 2 * cr );
|
||||
miter( cr - offset, false );
|
||||
lc.Append( aP + dir_v_b + aDir.Resize ( 2 * st.m_spacing ) );
|
||||
lc.Append( aP + dir_v_b + aDir.Resize( 2 * st.m_spacing ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -404,7 +406,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
|
|||
|
||||
if( aSide )
|
||||
{
|
||||
SEG axis ( aP, aP + aDir );
|
||||
SEG axis( aP, aP + aDir );
|
||||
|
||||
for( int i = 0; i < lc.PointCount(); i++ )
|
||||
lc.Point( i ) = reflect( lc.CPoint( i ), axis );
|
||||
|
@ -432,7 +434,7 @@ bool PNS_MEANDERED_LINE::CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int
|
|||
int n = m->CLine( 0 ).SegmentCount();
|
||||
|
||||
for( int j = n - 1; j >= 0; j-- )
|
||||
if( aShape->CLine( 0 ).Collide ( m->CLine( 0 ) .CSegment( j ), aClearance ) )
|
||||
if( aShape->CLine( 0 ).Collide( m->CLine( 0 ) .CSegment( j ), aClearance ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -560,7 +562,7 @@ void PNS_MEANDER_SHAPE::MakeEmpty()
|
|||
|
||||
m_type = MT_EMPTY;
|
||||
|
||||
m_shapes[0] = genMeanderShape ( m_p0, dir, m_side, m_type, 0, m_dual ? m_baselineOffset : 0 );
|
||||
m_shapes[0] = genMeanderShape( m_p0, dir, m_side, m_type, 0, m_dual ? m_baselineOffset : 0 );
|
||||
|
||||
if( m_dual )
|
||||
m_shapes[1] = genMeanderShape( m_p0, dir, m_side, m_type, 0, -m_baselineOffset );
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
* @param aIsDual when true, the shape contains two meandered
|
||||
* lines at a given offset (diff pairs)
|
||||
*/
|
||||
PNS_MEANDER_SHAPE( PNS_MEANDER_PLACER_BASE *aPlacer, int aWidth, bool aIsDual = false ) :
|
||||
PNS_MEANDER_SHAPE( PNS_MEANDER_PLACER_BASE* aPlacer, int aWidth, bool aIsDual = false ) :
|
||||
m_placer( aPlacer ),
|
||||
m_dual( aIsDual ),
|
||||
m_width( aWidth ),
|
||||
|
@ -491,7 +491,7 @@ public:
|
|||
* @param aClearance clearance value
|
||||
* @return true, if the meander shape is not colliding
|
||||
*/
|
||||
bool CheckSelfIntersections ( PNS_MEANDER_SHAPE* aShape, int aClearance );
|
||||
bool CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int aClearance );
|
||||
|
||||
/**
|
||||
* Function Settings()
|
||||
|
|
|
@ -148,22 +148,24 @@ void PNS_NODE::unlinkParent()
|
|||
|
||||
|
||||
PNS_OBSTACLE_VISITOR::PNS_OBSTACLE_VISITOR( const PNS_ITEM* aItem ) :
|
||||
m_item ( aItem ),
|
||||
m_node ( NULL ),
|
||||
m_item( aItem ),
|
||||
m_node( NULL ),
|
||||
m_override( NULL ),
|
||||
m_extraClearance ( 0 )
|
||||
m_extraClearance( 0 )
|
||||
{
|
||||
if( aItem && aItem->Kind() == PNS_ITEM::LINE )
|
||||
m_extraClearance += static_cast<const PNS_LINE*>( aItem )->Width() / 2;
|
||||
}
|
||||
|
||||
|
||||
void PNS_OBSTACLE_VISITOR::SetWorld( const PNS_NODE* aNode, const PNS_NODE* aOverride )
|
||||
{
|
||||
m_node = aNode;
|
||||
m_override = aOverride;
|
||||
}
|
||||
|
||||
bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM *aCandidate )
|
||||
|
||||
bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM* aCandidate )
|
||||
{
|
||||
// check if there is a more recent branch with a newer
|
||||
// (possibily modified) version of this item.
|
||||
|
@ -173,6 +175,7 @@ bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM *aCandidate )
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// function object that visits potential obstacles and performs
|
||||
// the actual collision refining
|
||||
struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
|
||||
|
@ -197,7 +200,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
|
|||
int m_forceClearance;
|
||||
|
||||
DEFAULT_OBSTACLE_VISITOR( PNS_NODE::OBSTACLES& aTab, const PNS_ITEM* aItem, int aKindMask, bool aDifferentNetsOnly ) :
|
||||
PNS_OBSTACLE_VISITOR ( aItem ),
|
||||
PNS_OBSTACLE_VISITOR( aItem ),
|
||||
m_tab( aTab ),
|
||||
m_kindMask( aKindMask ),
|
||||
m_limitCount( -1 ),
|
||||
|
@ -217,7 +220,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
|
|||
if( !aCandidate->OfKind( m_kindMask ) )
|
||||
return true;
|
||||
|
||||
if ( visit(aCandidate) )
|
||||
if( visit( aCandidate ) )
|
||||
return true;
|
||||
|
||||
int clearance = m_extraClearance + m_node->GetClearance( aCandidate, m_item );
|
||||
|
@ -249,8 +252,8 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
|
|||
};
|
||||
};
|
||||
|
||||
int PNS_NODE::QueryColliding( const PNS_ITEM *aItem,
|
||||
PNS_OBSTACLE_VISITOR& aVisitor )
|
||||
|
||||
int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, PNS_OBSTACLE_VISITOR& aVisitor )
|
||||
{
|
||||
aVisitor.SetWorld( this, NULL );
|
||||
m_index->Query( aItem, m_maxClearance, aVisitor );
|
||||
|
@ -292,9 +295,8 @@ int PNS_NODE::QueryColliding( const PNS_ITEM* aItem,
|
|||
}
|
||||
|
||||
|
||||
PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem,
|
||||
int aKindMask,
|
||||
const std::set<PNS_ITEM*>* aRestrictedSet )
|
||||
PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKindMask,
|
||||
const std::set<PNS_ITEM*>* aRestrictedSet )
|
||||
{
|
||||
OBSTACLES obs_list;
|
||||
bool found_isects = false;
|
||||
|
@ -477,7 +479,7 @@ struct HIT_VISITOR : public PNS_OBSTACLE_VISITOR
|
|||
const VECTOR2I& m_point;
|
||||
|
||||
HIT_VISITOR( PNS_ITEMSET& aTab, const VECTOR2I& aPoint ) :
|
||||
PNS_OBSTACLE_VISITOR ( NULL ),
|
||||
PNS_OBSTACLE_VISITOR( NULL ),
|
||||
m_items( aTab ), m_point( aPoint )
|
||||
{}
|
||||
|
||||
|
@ -502,14 +504,14 @@ const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const
|
|||
// fixme: we treat a point as an infinitely small circle - this is inefficient.
|
||||
SHAPE_CIRCLE s( aPoint, 0 );
|
||||
HIT_VISITOR visitor( items, aPoint );
|
||||
visitor.SetWorld(this, NULL);
|
||||
visitor.SetWorld( this, NULL );
|
||||
|
||||
m_index->Query( &s, m_maxClearance, visitor );
|
||||
|
||||
if( !isRoot() ) // fixme: could be made cleaner
|
||||
{
|
||||
PNS_ITEMSET items_root;
|
||||
visitor.SetWorld(m_root, NULL);
|
||||
visitor.SetWorld( m_root, NULL );
|
||||
HIT_VISITOR visitor_root( items_root, aPoint );
|
||||
m_root->m_index->Query( &s, m_maxClearance, visitor_root );
|
||||
|
||||
|
@ -584,7 +586,7 @@ void PNS_NODE::addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant )
|
|||
return;
|
||||
}
|
||||
|
||||
if( !aAllowRedundant && findRedundantSegment ( aSeg ) )
|
||||
if( !aAllowRedundant && findRedundantSegment( aSeg ) )
|
||||
return;
|
||||
|
||||
aSeg->SetOwner( this );
|
||||
|
@ -696,7 +698,7 @@ void PNS_NODE::removeVia( PNS_VIA* aVia )
|
|||
|
||||
for( JOINT_MAP::iterator f = range.first; f != range.second; ++f )
|
||||
{
|
||||
if( aVia->LayersOverlap ( &f->second ) )
|
||||
if( aVia->LayersOverlap( &f->second ) )
|
||||
{
|
||||
m_joints.erase( f );
|
||||
split = true;
|
||||
|
@ -709,7 +711,7 @@ void PNS_NODE::removeVia( PNS_VIA* aVia )
|
|||
for(PNS_ITEM* item : links)
|
||||
{
|
||||
if( item != aVia )
|
||||
linkJoint ( p, item->Layers(), net, item );
|
||||
linkJoint( p, item->Layers(), net, item );
|
||||
}
|
||||
|
||||
doRemove( aVia );
|
||||
|
@ -859,7 +861,7 @@ void PNS_NODE::FindLineEnds( const PNS_LINE& aLine, PNS_JOINT& aA, PNS_JOINT& aB
|
|||
|
||||
|
||||
#if 0
|
||||
void PNS_NODE::MapConnectivity ( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFoundJoints )
|
||||
void PNS_NODE::MapConnectivity( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFoundJoints )
|
||||
{
|
||||
std::deque<PNS_JOINT*> searchQueue;
|
||||
std::set<PNS_JOINT*> processed;
|
||||
|
@ -874,7 +876,7 @@ void PNS_NODE::MapConnectivity ( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFo
|
|||
|
||||
for( PNS_ITEM* item : current->LinkList() )
|
||||
{
|
||||
if ( item->OfKind( PNS_ITEM::SEGMENT ) )
|
||||
if( item->OfKind( PNS_ITEM::SEGMENT ) )
|
||||
{
|
||||
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT *>( item );
|
||||
PNS_JOINT* a = FindJoint( seg->Seg().A, seg );
|
||||
|
@ -905,7 +907,7 @@ int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector<
|
|||
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( item );
|
||||
PNS_LINE line = AssembleLine( seg );
|
||||
|
||||
if ( !line.Layers().Overlaps( aB.Layers() ) )
|
||||
if( !line.Layers().Overlaps( aB.Layers() ) )
|
||||
continue;
|
||||
|
||||
PNS_JOINT j_start, j_end;
|
||||
|
@ -1246,7 +1248,7 @@ int PNS_NODE::RemoveByMarker( int aMarker )
|
|||
|
||||
for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
|
||||
{
|
||||
if ( (*i)->Marker() & aMarker )
|
||||
if( (*i)->Marker() & aMarker )
|
||||
{
|
||||
garbage.push_back( *i );
|
||||
}
|
||||
|
@ -1263,7 +1265,7 @@ int PNS_NODE::RemoveByMarker( int aMarker )
|
|||
|
||||
PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg )
|
||||
{
|
||||
PNS_JOINT* jtStart = FindJoint ( aSeg->Seg().A, aSeg );
|
||||
PNS_JOINT* jtStart = FindJoint( aSeg->Seg().A, aSeg );
|
||||
|
||||
if( !jtStart )
|
||||
return NULL;
|
||||
|
|
|
@ -56,13 +56,11 @@ public:
|
|||
virtual ~PNS_RULE_RESOLVER() {}
|
||||
|
||||
virtual int Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) = 0;
|
||||
virtual void OverrideClearance (bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0) = 0;
|
||||
virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 ) = 0;
|
||||
virtual void UseDpGap( bool aUseDpGap ) = 0;
|
||||
virtual int DpCoupledNet( int aNet ) = 0;
|
||||
virtual int DpNetPolarity( int aNet ) = 0;
|
||||
virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN ) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -101,11 +99,11 @@ public:
|
|||
|
||||
void SetWorld( const PNS_NODE* aNode, const PNS_NODE* aOverride = NULL );
|
||||
|
||||
virtual bool operator()( PNS_ITEM *aCandidate ) = 0;
|
||||
virtual bool operator()( PNS_ITEM* aCandidate ) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
bool visit( PNS_ITEM *aCandidate );
|
||||
bool visit( PNS_ITEM* aCandidate );
|
||||
|
||||
///> the item we are looking for collisions with
|
||||
const PNS_ITEM* m_item;
|
||||
|
@ -197,7 +195,7 @@ public:
|
|||
bool aDifferentNetsOnly = true,
|
||||
int aForceClearance = -1 );
|
||||
|
||||
int QueryColliding( const PNS_ITEM *aItem,
|
||||
int QueryColliding( const PNS_ITEM* aItem,
|
||||
PNS_OBSTACLE_VISITOR& aVisitor
|
||||
);
|
||||
|
||||
|
@ -290,7 +288,6 @@ public:
|
|||
*/
|
||||
void Remove( PNS_LINE& aLine );
|
||||
|
||||
|
||||
/**
|
||||
* Function Replace()
|
||||
*
|
||||
|
@ -368,7 +365,7 @@ public:
|
|||
#if 0
|
||||
void MapConnectivity( PNS_JOINT* aStart, std::vector<PNS_JOINT*> & aFoundJoints );
|
||||
|
||||
PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int *aAnchor = NULL,
|
||||
PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL,
|
||||
int aKindMask = PNS_ITEM::ANY);
|
||||
|
||||
#endif
|
||||
|
@ -391,7 +388,7 @@ public:
|
|||
int FindByMarker( int aMarker, PNS_ITEMSET& aItems );
|
||||
int RemoveByMarker( int aMarker );
|
||||
|
||||
PNS_ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM *aParent );
|
||||
PNS_ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM* aParent );
|
||||
|
||||
bool HasChildren() const
|
||||
{
|
||||
|
|
|
@ -73,24 +73,23 @@ enum PNS_ROUTER_MODE {
|
|||
class PNS_ROUTER_IFACE
|
||||
{
|
||||
public:
|
||||
PNS_ROUTER_IFACE() {};
|
||||
virtual ~PNS_ROUTER_IFACE() {};
|
||||
PNS_ROUTER_IFACE() {};
|
||||
virtual ~PNS_ROUTER_IFACE() {};
|
||||
|
||||
virtual void SetRouter ( PNS_ROUTER *aRouter ) = 0;
|
||||
virtual void SyncWorld ( PNS_NODE *aNode ) = 0;
|
||||
virtual void AddItem ( PNS_ITEM *aItem ) = 0;
|
||||
virtual void RemoveItem ( PNS_ITEM *aItem ) = 0;
|
||||
virtual void DisplayItem( const PNS_ITEM* aItem, int aColor = -1, int aClearance = -1 ) = 0;
|
||||
virtual void HideItem ( PNS_ITEM *aItem ) = 0;
|
||||
virtual void Commit () = 0;
|
||||
// virtual void Abort () = 0;
|
||||
virtual void SetRouter( PNS_ROUTER* aRouter ) = 0;
|
||||
virtual void SyncWorld( PNS_NODE* aNode ) = 0;
|
||||
virtual void AddItem( PNS_ITEM* aItem ) = 0;
|
||||
virtual void RemoveItem( PNS_ITEM* aItem ) = 0;
|
||||
virtual void DisplayItem( const PNS_ITEM* aItem, int aColor = -1, int aClearance = -1 ) = 0;
|
||||
virtual void HideItem( PNS_ITEM* aItem ) = 0;
|
||||
virtual void Commit() = 0;
|
||||
// virtual void Abort () = 0;
|
||||
|
||||
virtual void EraseView () = 0;
|
||||
virtual void UpdateNet ( int aNetCode ) = 0;
|
||||
|
||||
virtual PNS_RULE_RESOLVER* GetRuleResolver() = 0;
|
||||
virtual PNS_DEBUG_DECORATOR* GetDebugDecorator() = 0;
|
||||
virtual void EraseView() = 0;
|
||||
virtual void UpdateNet( int aNetCode ) = 0;
|
||||
|
||||
virtual PNS_RULE_RESOLVER* GetRuleResolver() = 0;
|
||||
virtual PNS_DEBUG_DECORATOR* GetDebugDecorator() = 0;
|
||||
};
|
||||
|
||||
class PNS_ROUTER
|
||||
|
@ -107,7 +106,7 @@ public:
|
|||
PNS_ROUTER();
|
||||
~PNS_ROUTER();
|
||||
|
||||
void SetInterface( PNS_ROUTER_IFACE *aIface );
|
||||
void SetInterface( PNS_ROUTER_IFACE* aIface );
|
||||
void SetMode ( PNS_ROUTER_MODE aMode );
|
||||
PNS_ROUTER_MODE Mode() const { return m_mode; }
|
||||
|
||||
|
@ -136,7 +135,7 @@ public:
|
|||
|
||||
void DisplayItem( const PNS_ITEM* aItem, int aColor = -1, int aClearance = -1 );
|
||||
void DisplayItems( const PNS_ITEMSET& aItems );
|
||||
void DeleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack );
|
||||
void DeleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack );
|
||||
void SwitchLayer( int layer );
|
||||
|
||||
void ToggleViaPlacement();
|
||||
|
@ -205,15 +204,15 @@ public:
|
|||
return m_sizes;
|
||||
}
|
||||
|
||||
PNS_ITEM *QueryItemByParent ( const BOARD_ITEM *aItem ) const;
|
||||
PNS_ITEM* QueryItemByParent( const BOARD_ITEM* aItem ) const;
|
||||
|
||||
|
||||
void SetFailureReason ( const wxString& aReason ) { m_failureReason = aReason; }
|
||||
const wxString& FailureReason() const { return m_failureReason; }
|
||||
|
||||
PNS_PLACEMENT_ALGO *Placer() { return m_placer; }
|
||||
PNS_PLACEMENT_ALGO* Placer() { return m_placer; }
|
||||
|
||||
PNS_ROUTER_IFACE *GetInterface() const
|
||||
PNS_ROUTER_IFACE* GetInterface() const
|
||||
{
|
||||
return m_iface;
|
||||
}
|
||||
|
@ -252,7 +251,7 @@ private:
|
|||
PNS_PLACEMENT_ALGO * m_placer;
|
||||
PNS_DRAGGER* m_dragger;
|
||||
PNS_SHOVE* m_shove;
|
||||
PNS_ROUTER_IFACE *m_iface;
|
||||
PNS_ROUTER_IFACE* m_iface;
|
||||
|
||||
int m_iterLimit;
|
||||
bool m_showInterSteps;
|
||||
|
|
|
@ -49,7 +49,7 @@ void PNS_SHOVE::replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew )
|
|||
|
||||
if( changed_area )
|
||||
{
|
||||
m_affectedAreaSum = m_affectedAreaSum ? m_affectedAreaSum->Merge ( *changed_area ) : *changed_area;
|
||||
m_affectedAreaSum = m_affectedAreaSum ? m_affectedAreaSum->Merge( *changed_area ) : *changed_area;
|
||||
}
|
||||
|
||||
m_currentNode->Replace( aOld, aNew );
|
||||
|
@ -73,7 +73,7 @@ void PNS_SHOVE::sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew )
|
|||
|
||||
|
||||
PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
|
||||
PNS_ALGO_BASE ( aRouter )
|
||||
PNS_ALGO_BASE( aRouter )
|
||||
{
|
||||
m_forceClearance = -1;
|
||||
m_root = aWorld;
|
||||
|
@ -170,7 +170,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE&
|
|||
l.SetShape( path );
|
||||
}
|
||||
|
||||
for( int i = 0; i < std::min ( path.PointCount(), obs.PointCount() ); i++ )
|
||||
for( int i = 0; i < std::min( path.PointCount(), obs.PointCount() ); i++ )
|
||||
{
|
||||
if( path.CPoint( i ) != obs.CPoint( i ) )
|
||||
{
|
||||
|
@ -289,9 +289,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI
|
|||
}
|
||||
|
||||
if( viaOnEnd )
|
||||
hulls.push_back ( aCurrent.Via().Hull( clearance, w ) );
|
||||
hulls.push_back( aCurrent.Via().Hull( clearance, w ) );
|
||||
|
||||
rv = processHullSet ( aCurrent, aObstacle, aShoved, hulls );
|
||||
rv = processHullSet( aCurrent, aObstacle, aShoved, hulls );
|
||||
}
|
||||
|
||||
if( obstacleIsHead )
|
||||
|
@ -463,7 +463,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
|
|||
|
||||
PNS_WALKAROUND::WALKAROUND_STATUS status = walkaround.Route( aCurrent, walkaroundLine, false );
|
||||
|
||||
if ( status != PNS_WALKAROUND::DONE )
|
||||
if( status != PNS_WALKAROUND::DONE )
|
||||
continue;
|
||||
|
||||
walkaroundLine.ClearSegmentLinks();
|
||||
|
@ -491,7 +491,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
|
|||
|
||||
if( m_currentNode->CheckColliding( &lastLine, &walkaroundLine ) )
|
||||
{
|
||||
PNS_LINE dummy ( lastLine );
|
||||
PNS_LINE dummy( lastLine );
|
||||
|
||||
if( ProcessSingleLine( walkaroundLine, lastLine, dummy ) == SH_OK )
|
||||
{
|
||||
|
@ -566,7 +566,7 @@ bool PNS_SHOVE::pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET& aHeadItems,
|
|||
if( aAffectedArea )
|
||||
{
|
||||
if( prev_area )
|
||||
st.m_affectedArea = prev_area->Merge ( *aAffectedArea );
|
||||
st.m_affectedArea = prev_area->Merge( *aAffectedArea );
|
||||
else
|
||||
st.m_affectedArea = aAffectedArea;
|
||||
} else
|
||||
|
@ -591,7 +591,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
|
|||
return SH_INCOMPLETE;
|
||||
}
|
||||
|
||||
if ( aVia->IsLocked() )
|
||||
if( aVia->IsLocked() )
|
||||
return SH_TRY_WALK;
|
||||
|
||||
if( jt->IsLocked() )
|
||||
|
@ -831,7 +831,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PN
|
|||
}
|
||||
|
||||
|
||||
void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg )
|
||||
void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg )
|
||||
{
|
||||
for( std::vector<PNS_LINE>::iterator i = m_lineStack.begin(); i != m_lineStack.end() ; )
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
|
|||
}
|
||||
else
|
||||
{
|
||||
st = onReverseCollidingVia ( currentLine, revVia );
|
||||
st = onReverseCollidingVia( currentLine, revVia );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1062,7 +1062,7 @@ OPT_BOX2I PNS_SHOVE::totalAffectedArea() const
|
|||
if( area )
|
||||
{
|
||||
if( m_affectedAreaSum )
|
||||
area->Merge ( *m_affectedAreaSum );
|
||||
area->Merge( *m_affectedAreaSum );
|
||||
} else
|
||||
area = m_affectedAreaSum;
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
|
|||
runOptimizer( m_currentNode );
|
||||
|
||||
if( m_newHead )
|
||||
st = m_currentNode->CheckColliding( &(*m_newHead) ) ? SH_INCOMPLETE : SH_HEAD_MODIFIED;
|
||||
st = m_currentNode->CheckColliding( &( *m_newHead ) ) ? SH_INCOMPLETE : SH_HEAD_MODIFIED;
|
||||
else
|
||||
st = m_currentNode->CheckColliding( &head ) ? SH_INCOMPLETE : SH_OK;
|
||||
}
|
||||
|
|
|
@ -104,9 +104,9 @@ void PNS_TOOL_BASE::Reset( RESET_REASON aReason )
|
|||
|
||||
m_iface = new PNS_KICAD_IFACE;
|
||||
|
||||
m_iface->SetBoard (m_board);
|
||||
m_iface->SetBoard( m_board );
|
||||
m_iface->SetView( getView() );
|
||||
m_iface->SetHostFrame ( m_frame );
|
||||
m_iface->SetHostFrame( m_frame );
|
||||
|
||||
m_router = new PNS_ROUTER;
|
||||
m_router->SetInterface(m_iface);
|
||||
|
@ -216,12 +216,14 @@ void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
|
|||
{
|
||||
snapEnabled = !aEvent.Modifier( MD_SHIFT );
|
||||
p = aEvent.Position();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
p = cp;
|
||||
}
|
||||
|
||||
startItem = pickSingleItem( p );
|
||||
m_router->EnableSnapping ( snapEnabled );
|
||||
m_router->EnableSnapping( snapEnabled );
|
||||
|
||||
if( !snapEnabled && startItem && !startItem->Layers().Overlaps( tl ) )
|
||||
startItem = NULL;
|
||||
|
@ -307,34 +309,37 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
|
|||
TRACE( 0, "%s, layer : %d", m_endItem->KindStr().c_str() % m_endItem->Layers().Start() );
|
||||
}
|
||||
|
||||
void PNS_TOOL_BASE::deleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack )
|
||||
|
||||
void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack )
|
||||
{
|
||||
PNS_NODE *node = m_router->GetWorld()->Branch();
|
||||
|
||||
if( !aStartItem )
|
||||
return;
|
||||
|
||||
if ( !aWholeTrack )
|
||||
if( !aWholeTrack )
|
||||
{
|
||||
node->Remove ( aStartItem );
|
||||
node->Remove( aStartItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
PNS_TOPOLOGY topo (node);
|
||||
PNS_TOPOLOGY topo( node );
|
||||
PNS_ITEMSET path = topo.AssembleTrivialPath( aStartItem );
|
||||
|
||||
for ( auto ent : path.Items() )
|
||||
for( auto ent : path.Items() )
|
||||
node->Remove( ent.item );
|
||||
}
|
||||
|
||||
m_router->CommitRouting( node );
|
||||
}
|
||||
|
||||
|
||||
PNS_ROUTER *PNS_TOOL_BASE::Router() const
|
||||
{
|
||||
return m_router;
|
||||
}
|
||||
|
||||
|
||||
const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment )
|
||||
{
|
||||
VECTOR2I anchor;
|
||||
|
@ -374,8 +379,8 @@ const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aS
|
|||
anchor = s.NearestPoint( aP );
|
||||
aSplitsSegment = true;
|
||||
|
||||
anchor = m_gridHelper->AlignToSegment ( aP, s );
|
||||
aSplitsSegment = (anchor != s.A && anchor != s.B );
|
||||
anchor = m_gridHelper->AlignToSegment( aP, s );
|
||||
aSplitsSegment = ( anchor != s.A && anchor != s.B );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -50,16 +50,16 @@ public:
|
|||
return m_savedSettings;
|
||||
}
|
||||
|
||||
PNS_ROUTER *Router() const;
|
||||
PNS_ROUTER* Router() const;
|
||||
|
||||
protected:
|
||||
|
||||
const VECTOR2I snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
|
||||
const VECTOR2I snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
|
||||
virtual PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );
|
||||
virtual void highlightNet( bool aEnabled, int aNetcode = -1 );
|
||||
virtual void updateStartItem( TOOL_EVENT& aEvent );
|
||||
virtual void updateEndItem( TOOL_EVENT& aEvent );
|
||||
void deleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack );
|
||||
void deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack );
|
||||
|
||||
MSG_PANEL_ITEMS m_panelItems;
|
||||
|
||||
|
@ -76,8 +76,8 @@ protected:
|
|||
KIGFX::VIEW_CONTROLS* m_ctls;
|
||||
BOARD* m_board;
|
||||
GRID_HELPER* m_gridHelper;
|
||||
PNS_KICAD_IFACE *m_iface;
|
||||
PNS_ROUTER *m_router;
|
||||
PNS_KICAD_IFACE* m_iface;
|
||||
PNS_ROUTER* m_router;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -152,7 +152,7 @@ PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor,
|
|||
{
|
||||
if( item->OfKind( aKindMask ) )
|
||||
{
|
||||
for(int i = 0; i < item->AnchorCount(); i++)
|
||||
for( int i = 0; i < item->AnchorCount(); i++ )
|
||||
{
|
||||
VECTOR2I p = item->Anchor( i );
|
||||
int d = ( p - aStart->Pos() ).EuclideanNorm();
|
||||
|
@ -234,20 +234,20 @@ const PNS_ITEMSET PNS_TOPOLOGY::AssembleTrivialPath( PNS_ITEM* aStart )
|
|||
{
|
||||
PNS_ITEMSET path;
|
||||
std::set<PNS_ITEM*> visited;
|
||||
PNS_SEGMENT *seg;
|
||||
PNS_VIA *via;
|
||||
PNS_SEGMENT* seg;
|
||||
PNS_VIA* via;
|
||||
|
||||
seg = dyn_cast<PNS_SEGMENT*> (aStart);
|
||||
|
||||
if(!seg && (via = dyn_cast<PNS_VIA *>( aStart ) ) )
|
||||
if(!seg && (via = dyn_cast<PNS_VIA*>( aStart ) ) )
|
||||
{
|
||||
PNS_JOINT *jt = m_world->FindJoint( via->Pos(), via );
|
||||
|
||||
if( !jt->IsNonFanoutVia () )
|
||||
if( !jt->IsNonFanoutVia() )
|
||||
return PNS_ITEMSET();
|
||||
|
||||
for ( auto entry : jt->Links().Items() )
|
||||
if ( ( seg = dyn_cast<PNS_SEGMENT*>( entry.item ) ) )
|
||||
for( auto entry : jt->Links().Items() )
|
||||
if( ( seg = dyn_cast<PNS_SEGMENT*>( entry.item ) ) )
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,6 @@ const PNS_ITEMSET PNS_TOPOLOGY::ConnectedItems( PNS_ITEM* aStart, int aKindMask
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip );
|
||||
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ bool ROUTER_TOOL::prepareInteractive()
|
|||
{
|
||||
int routingLayer = getStartLayer( m_startItem );
|
||||
m_frame->SetActiveLayer( ToLAYER_ID( routingLayer ) );
|
||||
m_frame->UndoRedoBlock ( true );
|
||||
m_frame->UndoRedoBlock( true );
|
||||
|
||||
// fixme: switch on invisible layer
|
||||
|
||||
|
@ -524,7 +524,7 @@ bool ROUTER_TOOL::prepareInteractive()
|
|||
m_endItem = NULL;
|
||||
m_endSnapPoint = m_startSnapPoint;
|
||||
|
||||
m_frame->UndoRedoBlock ( false );
|
||||
m_frame->UndoRedoBlock( false );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -712,11 +712,12 @@ int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
|
|||
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
|
||||
{
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::layerToggle, true );
|
||||
} else if (evt->IsAction ( &COMMON_ACTIONS::remove ) )
|
||||
}
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::remove ) )
|
||||
{
|
||||
deleteTraces( m_startItem, true );
|
||||
}
|
||||
else if (evt->IsAction ( &COMMON_ACTIONS::removeAlt ) )
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::removeAlt ) )
|
||||
{
|
||||
deleteTraces( m_startItem, false );
|
||||
}
|
||||
|
@ -742,9 +743,9 @@ void ROUTER_TOOL::performDragging()
|
|||
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
|
||||
VIEW_CONTROLS* ctls = getViewControls();
|
||||
|
||||
if ( m_startItem && m_startItem->IsLocked() )
|
||||
if( m_startItem && m_startItem->IsLocked() )
|
||||
{
|
||||
if ( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
|
||||
if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -764,7 +765,7 @@ void ROUTER_TOOL::performDragging()
|
|||
{
|
||||
ctls->ForceCursorPosition( false );
|
||||
|
||||
if( evt->IsCancel() || evt->IsActivate() )
|
||||
if( evt->IsCancel() || evt->IsActivate() )
|
||||
break;
|
||||
else if( evt->IsMotion() )
|
||||
{
|
||||
|
@ -799,7 +800,7 @@ void ROUTER_TOOL::performDragging()
|
|||
|
||||
int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
const BOARD_CONNECTED_ITEM *item = aEvent.Parameter<const BOARD_CONNECTED_ITEM*>();
|
||||
const BOARD_CONNECTED_ITEM* item = aEvent.Parameter<const BOARD_CONNECTED_ITEM*>();
|
||||
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
|
||||
VIEW_CONTROLS* ctls = getViewControls();
|
||||
|
||||
|
@ -811,9 +812,9 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_startItem = m_router->GetWorld()->FindItemByParent( item );
|
||||
|
||||
if ( m_startItem && m_startItem->IsLocked() )
|
||||
if( m_startItem && m_startItem->IsLocked() )
|
||||
{
|
||||
if ( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
|
||||
if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue