Code formatting.
This commit is contained in:
parent
506e8c4d89
commit
766da1e494
|
@ -50,42 +50,46 @@ EDA_ITEM* TOOL_BASE::getModelInt() const
|
||||||
return m_toolMgr->GetModel();
|
return m_toolMgr->GetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TOOL_BASE::attachManager( TOOL_MANAGER* aManager )
|
void TOOL_BASE::attachManager( TOOL_MANAGER* aManager )
|
||||||
{
|
{
|
||||||
m_toolMgr = aManager;
|
m_toolMgr = aManager;
|
||||||
m_toolSettings = TOOL_SETTINGS ( this );
|
m_toolSettings = TOOL_SETTINGS( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
TOOL_SETTINGS::TOOL_SETTINGS ( TOOL_BASE *aTool )
|
|
||||||
|
TOOL_SETTINGS::TOOL_SETTINGS( TOOL_BASE* aTool )
|
||||||
{
|
{
|
||||||
m_tool = aTool;
|
m_tool = aTool;
|
||||||
|
|
||||||
if(!aTool)
|
if( !aTool )
|
||||||
{
|
{
|
||||||
m_config = NULL;
|
m_config = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fixme: make independent of pcbnew (post-stable)
|
// fixme: make independent of pcbnew (post-stable)
|
||||||
PCB_EDIT_FRAME *frame = aTool->getEditFrame<PCB_EDIT_FRAME> ();
|
PCB_EDIT_FRAME* frame = aTool->getEditFrame<PCB_EDIT_FRAME>();
|
||||||
|
|
||||||
m_config = frame->GetSettings();
|
m_config = frame->GetSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
TOOL_SETTINGS::~TOOL_SETTINGS ()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
TOOL_SETTINGS::~TOOL_SETTINGS()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TOOL_SETTINGS& TOOL_BASE::GetSettings()
|
TOOL_SETTINGS& TOOL_BASE::GetSettings()
|
||||||
{
|
{
|
||||||
return m_toolSettings;
|
return m_toolSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString TOOL_SETTINGS::getKeyName(const wxString& entryName) const
|
|
||||||
|
wxString TOOL_SETTINGS::getKeyName( const wxString& aEntryName ) const
|
||||||
{
|
{
|
||||||
wxString key ( m_tool->GetName() );
|
wxString key( m_tool->GetName() );
|
||||||
key += wxT(".");
|
key += wxT( "." );
|
||||||
key += entryName;
|
key += aEntryName;
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,37 +38,36 @@ class TOOL_BASE;
|
||||||
class TOOL_SETTINGS
|
class TOOL_SETTINGS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TOOL_SETTINGS ( TOOL_BASE *aTool = NULL );
|
TOOL_SETTINGS ( TOOL_BASE* aTool = NULL );
|
||||||
~TOOL_SETTINGS ();
|
~TOOL_SETTINGS ();
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T Get( const wxString& aName, T aDefaultValue ) const
|
T Get( const wxString& aName, T aDefaultValue ) const
|
||||||
{
|
{
|
||||||
if(!m_config)
|
if( !m_config )
|
||||||
return aDefaultValue;
|
return aDefaultValue;
|
||||||
|
|
||||||
T tmp = aDefaultValue;
|
T tmp = aDefaultValue;
|
||||||
|
|
||||||
m_config->Read ( getKeyName( aName ), &tmp );
|
m_config->Read( getKeyName( aName ), &tmp );
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void Set( const wxString& aName, const T &aValue )
|
void Set( const wxString& aName, const T &aValue )
|
||||||
{
|
{
|
||||||
if(!m_config)
|
if( !m_config )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_config->Write ( getKeyName( aName ), aValue );
|
m_config->Write( getKeyName( aName ), aValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxString getKeyName(const wxString& entryName) const;
|
wxString getKeyName( const wxString& aEntryName ) const;
|
||||||
|
|
||||||
wxConfigBase *m_config;
|
wxConfigBase* m_config;
|
||||||
TOOL_BASE *m_tool;
|
TOOL_BASE* m_tool;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -395,7 +395,7 @@ public:
|
||||||
|
|
||||||
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||||
|
|
||||||
wxConfigBase *GetSettings() { return config(); };
|
wxConfigBase* GetSettings() { return config(); };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last net list read with the net list dialog box.
|
* Get the last net list read with the net list dialog box.
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_originPair.Gap() < 0 )
|
if( m_originPair.Gap() < 0 )
|
||||||
m_originPair.SetGap( Router()->Sizes().DiffPairGap() );
|
m_originPair.SetGap( Router()->Sizes().DiffPairGap() );
|
||||||
|
|
||||||
if( !m_originPair.PLine().SegmentCount() ||
|
if( !m_originPair.PLine().SegmentCount() ||
|
||||||
!m_originPair.NLine().SegmentCount() )
|
!m_originPair.NLine().SegmentCount() )
|
||||||
|
@ -224,28 +224,28 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
||||||
{
|
{
|
||||||
SEG base = baselineSegment( sp );
|
SEG base = baselineSegment( sp );
|
||||||
|
|
||||||
DrawDebugSeg ( base, 3 );
|
DrawDebugSeg( base, 3 );
|
||||||
|
|
||||||
while(sp.indexP >= curIndexP)
|
while( sp.indexP >= curIndexP )
|
||||||
{
|
{
|
||||||
m_result.AddCorner( tunedP.CPoint(curIndexP), tunedN.CPoint(curIndexN) );
|
m_result.AddCorner( tunedP.CPoint( curIndexP ), tunedN.CPoint( curIndexN ) );
|
||||||
curIndexP++;
|
curIndexP++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(sp.indexN >= curIndexN)
|
while( sp.indexN >= curIndexN )
|
||||||
{
|
{
|
||||||
m_result.AddCorner( tunedP.CPoint(sp.indexP), tunedN.CPoint(curIndexN) );
|
m_result.AddCorner( tunedP.CPoint( sp.indexP ), tunedN.CPoint( curIndexN ) );
|
||||||
curIndexN++;
|
curIndexN++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_result.MeanderSegment( base );
|
m_result.MeanderSegment( base );
|
||||||
}
|
}
|
||||||
|
|
||||||
while(curIndexP < tunedP.PointCount() )
|
while( curIndexP < tunedP.PointCount() )
|
||||||
m_result.AddCorner( tunedP.CPoint(curIndexP++), tunedN.CPoint(curIndexN) );
|
m_result.AddCorner( tunedP.CPoint( curIndexP++ ), tunedN.CPoint( curIndexN ) );
|
||||||
|
|
||||||
while(curIndexN < tunedN.PointCount() )
|
while( curIndexN < tunedN.PointCount() )
|
||||||
m_result.AddCorner( tunedP.CPoint(-1), tunedN.CPoint(curIndexN++) );
|
m_result.AddCorner( tunedP.CPoint( -1 ), tunedN.CPoint( curIndexN++ ) );
|
||||||
|
|
||||||
int dpLen = origPathLength();
|
int dpLen = origPathLength();
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
|
||||||
int effort = 0;
|
int effort = 0;
|
||||||
bool rv = true, viaOk;
|
bool rv = true, viaOk;
|
||||||
|
|
||||||
viaOk = buildInitialLine ( aP, initTrack );
|
viaOk = buildInitialLine( aP, initTrack );
|
||||||
|
|
||||||
PNS_WALKAROUND walkaround( m_currentNode, Router() );
|
PNS_WALKAROUND walkaround( m_currentNode, Router() );
|
||||||
|
|
||||||
|
@ -402,8 +402,8 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
|
||||||
|
|
||||||
PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode );
|
PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode );
|
||||||
|
|
||||||
if ( m_currentNode->CheckColliding( &walkFull ) )
|
if( m_currentNode->CheckColliding( &walkFull ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_head = walkFull;
|
m_head = walkFull;
|
||||||
aNewHead = walkFull;
|
aNewHead = walkFull;
|
||||||
|
@ -927,7 +927,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
|
||||||
if( !aLatest->SegmentCount() )
|
if( !aLatest->SegmentCount() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (aLatest->CLine().CPoint(0) == aLatest->CLine().CPoint(-1))
|
if ( aLatest->CLine().CPoint( 0 ) == aLatest->CLine().CPoint( -1 ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aNode->Add( aLatest, true );
|
aNode->Add( aLatest, true );
|
||||||
|
@ -1025,14 +1025,18 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
|
||||||
{
|
{
|
||||||
SHAPE_LINE_CHAIN l;
|
SHAPE_LINE_CHAIN l;
|
||||||
|
|
||||||
if(m_p_start == aP)
|
if( m_p_start == aP )
|
||||||
{
|
{
|
||||||
l.Clear();
|
l.Clear();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if( Settings().GetFreeAngleMode() && Settings().Mode() == RM_MarkObstacles )
|
if( Settings().GetFreeAngleMode() && Settings().Mode() == RM_MarkObstacles )
|
||||||
{
|
{
|
||||||
l = SHAPE_LINE_CHAIN ( m_p_start, aP );
|
l = SHAPE_LINE_CHAIN( m_p_start, aP );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
l = m_direction.BuildInitialTrace( m_p_start, aP );
|
l = m_direction.BuildInitialTrace( m_p_start, aP );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1050,12 +1054,12 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
|
||||||
if( !m_placingVia )
|
if( !m_placingVia )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PNS_VIA v ( makeVia ( aP ) );
|
PNS_VIA v( makeVia( aP ) );
|
||||||
v.SetNet ( aHead.Net() );
|
v.SetNet( aHead.Net() );
|
||||||
|
|
||||||
if ( m_currentMode == RM_MarkObstacles )
|
if( m_currentMode == RM_MarkObstacles )
|
||||||
{
|
{
|
||||||
aHead.AppendVia ( v );
|
aHead.AppendVia( v );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1066,9 +1070,7 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
|
||||||
|
|
||||||
if( v.PushoutForce( m_currentNode, lead, force, solidsOnly, 40 ) )
|
if( v.PushoutForce( m_currentNode, lead, force, solidsOnly, 40 ) )
|
||||||
{
|
{
|
||||||
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace(
|
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace( m_p_start, aP + force );
|
||||||
m_p_start,
|
|
||||||
aP + force );
|
|
||||||
aHead = PNS_LINE( aHead, line );
|
aHead = PNS_LINE( aHead, line );
|
||||||
|
|
||||||
v.SetPos( v.Pos() + force );
|
v.SetPos( v.Pos() + force );
|
||||||
|
|
|
@ -79,14 +79,14 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_originPair.Gap() < 0 )
|
if( m_originPair.Gap() < 0 )
|
||||||
m_originPair.SetGap ( Router()->Sizes().DiffPairGap() );
|
m_originPair.SetGap( Router()->Sizes().DiffPairGap() );
|
||||||
|
|
||||||
if( !m_originPair.PLine().SegmentCount() ||
|
if( !m_originPair.PLine().SegmentCount() ||
|
||||||
!m_originPair.NLine().SegmentCount() )
|
!m_originPair.NLine().SegmentCount() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_tunedPathP = topo.AssembleTrivialPath ( m_originPair.PLine().GetLink( 0 ) );
|
m_tunedPathP = topo.AssembleTrivialPath( m_originPair.PLine().GetLink( 0 ) );
|
||||||
m_tunedPathN = topo.AssembleTrivialPath ( m_originPair.NLine().GetLink( 0 ) );
|
m_tunedPathN = topo.AssembleTrivialPath( m_originPair.NLine().GetLink( 0 ) );
|
||||||
|
|
||||||
m_world->Remove( m_originLine );
|
m_world->Remove( m_originLine );
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
||||||
m_currentEnd = VECTOR2I( 0, 0 );
|
m_currentEnd = VECTOR2I( 0, 0 );
|
||||||
|
|
||||||
if ( m_originPair.PLine().Net () == m_originLine->Net() )
|
if ( m_originPair.PLine().Net () == m_originLine->Net() )
|
||||||
m_coupledLength = itemsetLength ( m_tunedPathN );
|
m_coupledLength = itemsetLength( m_tunedPathN );
|
||||||
else
|
else
|
||||||
m_coupledLength = itemsetLength ( m_tunedPathP );
|
m_coupledLength = itemsetLength( m_tunedPathP );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1237,17 +1237,19 @@ PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PNS_NODE::SetCollisionFilter( PNS_COLLISION_FILTER* aFilter )
|
void PNS_NODE::SetCollisionFilter( PNS_COLLISION_FILTER* aFilter )
|
||||||
{
|
{
|
||||||
m_collisionFilter = aFilter;
|
m_collisionFilter = aFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
PNS_ITEM *PNS_NODE::FindItemByParent ( const BOARD_CONNECTED_ITEM *aParent )
|
|
||||||
|
PNS_ITEM *PNS_NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
|
||||||
{
|
{
|
||||||
PNS_INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() );
|
PNS_INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() );
|
||||||
|
|
||||||
BOOST_FOREACH( PNS_ITEM*item, *l_cur )
|
BOOST_FOREACH( PNS_ITEM*item, *l_cur )
|
||||||
if ( item->Parent() == aParent )
|
if( item->Parent() == aParent )
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -373,7 +373,7 @@ public:
|
||||||
int RemoveByMarker( int aMarker );
|
int RemoveByMarker( int aMarker );
|
||||||
void SetCollisionFilter( PNS_COLLISION_FILTER* aFilter );
|
void SetCollisionFilter( PNS_COLLISION_FILTER* aFilter );
|
||||||
|
|
||||||
PNS_ITEM *FindItemByParent ( const BOARD_CONNECTED_ITEM *aParent );
|
PNS_ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM *aParent );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct OBSTACLE_VISITOR;
|
struct OBSTACLE_VISITOR;
|
||||||
|
|
|
@ -210,8 +210,9 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
|
||||||
if( aPad->GetShape() == PAD_CIRCLE )
|
if( aPad->GetShape() == PAD_CIRCLE )
|
||||||
{
|
{
|
||||||
solid->SetShape( new SHAPE_CIRCLE( c, sz.x / 2 ) );
|
solid->SetShape( new SHAPE_CIRCLE( c, sz.x / 2 ) );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if( orient == 0.0 || orient == 90.0 || orient == 180.0 || orient == 270.0 )
|
if( orient == 0.0 || orient == 90.0 || orient == 180.0 || orient == 270.0 )
|
||||||
{
|
{
|
||||||
if( orient == 90.0 || orient == 270.0 )
|
if( orient == 90.0 || orient == 270.0 )
|
||||||
|
@ -262,7 +263,9 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
|
||||||
delete solid;
|
delete solid;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
switch( aPad->GetShape() )
|
switch( aPad->GetShape() )
|
||||||
{
|
{
|
||||||
// PAD_CIRCLE already handled above
|
// PAD_CIRCLE already handled above
|
||||||
|
|
|
@ -43,9 +43,10 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
|
||||||
m_inlineDragEnabled = false;
|
m_inlineDragEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNS_ROUTING_SETTINGS::Save ( TOOL_SETTINGS& aSettings ) const
|
|
||||||
|
void PNS_ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
|
||||||
{
|
{
|
||||||
aSettings.Set( "Mode", (int)m_routingMode );
|
aSettings.Set( "Mode", (int) m_routingMode );
|
||||||
aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort );
|
aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort );
|
||||||
aSettings.Set( "RemoveLoops", m_removeLoops );
|
aSettings.Set( "RemoveLoops", m_removeLoops );
|
||||||
aSettings.Set( "SmartPads", m_smartPads );
|
aSettings.Set( "SmartPads", m_smartPads );
|
||||||
|
@ -62,7 +63,8 @@ void PNS_ROUTING_SETTINGS::Save ( TOOL_SETTINGS& aSettings ) const
|
||||||
aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
|
aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNS_ROUTING_SETTINGS::Load ( const TOOL_SETTINGS& aSettings )
|
|
||||||
|
void PNS_ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
|
||||||
{
|
{
|
||||||
m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround );
|
m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround );
|
||||||
m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM );
|
m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM );
|
||||||
|
@ -81,6 +83,7 @@ void PNS_ROUTING_SETTINGS::Load ( const TOOL_SETTINGS& aSettings )
|
||||||
m_inlineDragEnabled = aSettings.Get( "InlineDragEnabled", false );
|
m_inlineDragEnabled = aSettings.Get( "InlineDragEnabled", false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
|
const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
|
||||||
{
|
{
|
||||||
if( m_startDiagonal )
|
if( m_startDiagonal )
|
||||||
|
|
|
@ -56,8 +56,8 @@ class PNS_ROUTING_SETTINGS
|
||||||
public:
|
public:
|
||||||
PNS_ROUTING_SETTINGS();
|
PNS_ROUTING_SETTINGS();
|
||||||
|
|
||||||
void Load ( const TOOL_SETTINGS& where );
|
void Load( const TOOL_SETTINGS& where );
|
||||||
void Save ( TOOL_SETTINGS& where ) const;
|
void Save( TOOL_SETTINGS& where ) const;
|
||||||
|
|
||||||
///> Returns the routing mode.
|
///> Returns the routing mode.
|
||||||
PNS_MODE Mode() const { return m_routingMode; }
|
PNS_MODE Mode() const { return m_routingMode; }
|
||||||
|
@ -130,7 +130,6 @@ public:
|
||||||
int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
|
int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
|
||||||
TIME_LIMIT WalkaroundTimeLimit() const;
|
TIME_LIMIT WalkaroundTimeLimit() const;
|
||||||
|
|
||||||
|
|
||||||
void SetInlineDragEnabled ( bool aEnable ) { m_inlineDragEnabled = aEnable; }
|
void SetInlineDragEnabled ( bool aEnable ) { m_inlineDragEnabled = aEnable; }
|
||||||
bool InlineDragEnabled( ) const { return m_inlineDragEnabled; }
|
bool InlineDragEnabled( ) const { return m_inlineDragEnabled; }
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S
|
||||||
int rank = aCurrent->Rank();
|
int rank = aCurrent->Rank();
|
||||||
shovedLine->SetRank( rank - 1 );
|
shovedLine->SetRank( rank - 1 );
|
||||||
|
|
||||||
if (!pushLine( shovedLine ) )
|
if( !pushLine( shovedLine ) )
|
||||||
rv = SH_INCOMPLETE;
|
rv = SH_INCOMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
popLine();
|
popLine();
|
||||||
if ( !pushLine( walkaroundLine ) )
|
|
||||||
|
if( !pushLine( walkaroundLine ) )
|
||||||
return SH_INCOMPLETE;
|
return SH_INCOMPLETE;
|
||||||
|
|
||||||
return SH_OK;
|
return SH_OK;
|
||||||
|
@ -620,7 +621,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
|
||||||
{
|
{
|
||||||
replaceItems( lp.first, lp.second );
|
replaceItems( lp.first, lp.second );
|
||||||
lp.second->SetRank( aCurrentRank - 1 );
|
lp.second->SetRank( aCurrentRank - 1 );
|
||||||
if (! pushLine( lp.second ) )
|
|
||||||
|
if( !pushLine( lp.second ) )
|
||||||
return SH_INCOMPLETE;
|
return SH_INCOMPLETE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1120,7 +1122,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
|
||||||
|
|
||||||
st = shoveMainLoop();
|
st = shoveMainLoop();
|
||||||
|
|
||||||
if ( st == SH_OK )
|
if( st == SH_OK )
|
||||||
runOptimizer( m_currentNode, NULL );
|
runOptimizer( m_currentNode, NULL );
|
||||||
|
|
||||||
m_currentNode->RemoveByMarker( MK_HEAD );
|
m_currentNode->RemoveByMarker( MK_HEAD );
|
||||||
|
@ -1169,7 +1171,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
|
||||||
st = pushVia( aVia, ( aWhere - aVia->Pos() ), 0 );
|
st = pushVia( aVia, ( aWhere - aVia->Pos() ), 0 );
|
||||||
st = shoveMainLoop();
|
st = shoveMainLoop();
|
||||||
|
|
||||||
if ( st == SH_OK )
|
if( st == SH_OK )
|
||||||
runOptimizer( m_currentNode, NULL );
|
runOptimizer( m_currentNode, NULL );
|
||||||
|
|
||||||
if( st == SH_OK || st == SH_HEAD_MODIFIED )
|
if( st == SH_OK || st == SH_HEAD_MODIFIED )
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness ) const
|
const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness ) const
|
||||||
{
|
{
|
||||||
int cl = aClearance + (aWalkaroundThickness + 1)/ 2;
|
int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2;
|
||||||
|
|
||||||
switch( m_shape->Type() )
|
switch( m_shape->Type() )
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness
|
||||||
|
|
||||||
case SH_SEGMENT:
|
case SH_SEGMENT:
|
||||||
{
|
{
|
||||||
SHAPE_SEGMENT* seg = static_cast<SHAPE_SEGMENT*> ( m_shape );
|
SHAPE_SEGMENT* seg = static_cast<SHAPE_SEGMENT*>( m_shape );
|
||||||
return SegmentHull( *seg, aClearance, aWalkaroundThickness );
|
return SegmentHull( *seg, aClearance, aWalkaroundThickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,7 @@ bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRa
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor, int aKindMask )
|
PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor, int aKindMask )
|
||||||
{
|
{
|
||||||
std::set<PNS_ITEM*> disconnected;
|
std::set<PNS_ITEM*> disconnected;
|
||||||
|
@ -320,8 +321,10 @@ int PNS_TOPOLOGY::DpNetPolarity( int aNet )
|
||||||
return MatchDpSuffix( refName, dummy1, dummy2 );
|
return MatchDpSuffix( refName, dummy1, dummy2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip );
|
bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip );
|
||||||
|
|
||||||
|
|
||||||
bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
|
bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
|
||||||
{
|
{
|
||||||
int refNet = aStart->Net();
|
int refNet = aStart->Net();
|
||||||
|
@ -334,7 +337,7 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
|
||||||
|
|
||||||
m_world->AllItemsInNet( coupledNet, coupledItems );
|
m_world->AllItemsInNet( coupledNet, coupledItems );
|
||||||
|
|
||||||
PNS_SEGMENT *coupledSeg = NULL, *refSeg;
|
PNS_SEGMENT* coupledSeg = NULL, *refSeg;
|
||||||
int minDist = std::numeric_limits<int>::max();
|
int minDist = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
if( ( refSeg = dyn_cast<PNS_SEGMENT*>( aStart ) ) != NULL )
|
if( ( refSeg = dyn_cast<PNS_SEGMENT*>( aStart ) ) != NULL )
|
||||||
|
@ -365,8 +368,8 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
|
||||||
if( !coupledSeg )
|
if( !coupledSeg )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::auto_ptr<PNS_LINE> lp ( m_world->AssembleLine( refSeg ) );
|
std::auto_ptr<PNS_LINE> lp( m_world->AssembleLine( refSeg ) );
|
||||||
std::auto_ptr<PNS_LINE> ln ( m_world->AssembleLine( coupledSeg ) );
|
std::auto_ptr<PNS_LINE> ln( m_world->AssembleLine( coupledSeg ) );
|
||||||
|
|
||||||
if( DpNetPolarity( refNet ) < 0 )
|
if( DpNetPolarity( refNet ) < 0 )
|
||||||
{
|
{
|
||||||
|
@ -374,13 +377,12 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
|
||||||
}
|
}
|
||||||
|
|
||||||
int gap = -1 ;
|
int gap = -1 ;
|
||||||
if( refSeg->Seg().ApproxParallel( coupledSeg->Seg() ) ) {
|
if( refSeg->Seg().ApproxParallel( coupledSeg->Seg() ) )
|
||||||
|
{
|
||||||
// Segments are parallel -> compute pair gap
|
// Segments are parallel -> compute pair gap
|
||||||
const VECTOR2I refDir = refSeg->Anchor(1) - refSeg->Anchor(0);
|
const VECTOR2I refDir = refSeg->Anchor( 1 ) - refSeg->Anchor( 0 );
|
||||||
const VECTOR2I displacement = refSeg->Anchor(1) - coupledSeg->Anchor(1);
|
const VECTOR2I displacement = refSeg->Anchor( 1 ) - coupledSeg->Anchor( 1 );
|
||||||
gap = (int) abs( refDir.Cross( displacement ) / refDir.EuclideanNorm() ) - lp->Width();
|
gap = (int) abs( refDir.Cross( displacement ) / refDir.EuclideanNorm() ) - lp->Width();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aPair = PNS_DIFF_PAIR( *lp, *ln );
|
aPair = PNS_DIFF_PAIR( *lp, *ln );
|
||||||
|
|
|
@ -81,22 +81,22 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void MoveDiagonal( SEG& diagonal, const SHAPE_LINE_CHAIN& vertices, int clearance )
|
static void MoveDiagonal( SEG& aDiagonal, const SHAPE_LINE_CHAIN& aVertices, int aClearance )
|
||||||
{
|
{
|
||||||
int dist;
|
int dist;
|
||||||
|
|
||||||
vertices.NearestPoint( diagonal, dist );
|
aVertices.NearestPoint( aDiagonal, dist );
|
||||||
dist -= HULL_MARGIN;
|
dist -= HULL_MARGIN;
|
||||||
VECTOR2I moveBy = (diagonal.A - diagonal.B).Perpendicular().Resize( dist - clearance );
|
VECTOR2I moveBy = ( aDiagonal.A - aDiagonal.B ).Perpendicular().Resize( dist - aClearance );
|
||||||
diagonal.A += moveBy;
|
aDiagonal.A += moveBy;
|
||||||
diagonal.B += moveBy;
|
aDiagonal.B += moveBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& convex, int clearance )
|
const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& convex, int aClearance )
|
||||||
{
|
{
|
||||||
// this defines the horizontal and vertical lines in the hull octagon
|
// this defines the horizontal and vertical lines in the hull octagon
|
||||||
BOX2I box = convex.BBox( clearance + HULL_MARGIN );
|
BOX2I box = convex.BBox( aClearance + HULL_MARGIN );
|
||||||
box.Normalize();
|
box.Normalize();
|
||||||
|
|
||||||
SEG topline = SEG( VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ),
|
SEG topline = SEG( VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ),
|
||||||
|
@ -113,25 +113,25 @@ const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& convex, int clearance )
|
||||||
VECTOR2I corner = box.GetOrigin() + box.GetSize();
|
VECTOR2I corner = box.GetOrigin() + box.GetSize();
|
||||||
SEG toprightline = SEG( corner,
|
SEG toprightline = SEG( corner,
|
||||||
corner + VECTOR2I( box.GetHeight(), -box.GetHeight() ) );
|
corner + VECTOR2I( box.GetHeight(), -box.GetHeight() ) );
|
||||||
MoveDiagonal( toprightline, vertices, clearance );
|
MoveDiagonal( toprightline, vertices, aClearance );
|
||||||
|
|
||||||
// bottom right diagonal
|
// bottom right diagonal
|
||||||
corner = box.GetOrigin() + VECTOR2I( box.GetWidth(), 0 );
|
corner = box.GetOrigin() + VECTOR2I( box.GetWidth(), 0 );
|
||||||
SEG bottomrightline = SEG( corner + VECTOR2I( box.GetHeight(), box.GetHeight() ),
|
SEG bottomrightline = SEG( corner + VECTOR2I( box.GetHeight(), box.GetHeight() ),
|
||||||
corner );
|
corner );
|
||||||
MoveDiagonal( bottomrightline, vertices, clearance );
|
MoveDiagonal( bottomrightline, vertices, aClearance );
|
||||||
|
|
||||||
// bottom left diagonal
|
// bottom left diagonal
|
||||||
corner = box.GetOrigin();
|
corner = box.GetOrigin();
|
||||||
SEG bottomleftline = SEG( corner,
|
SEG bottomleftline = SEG( corner,
|
||||||
corner + VECTOR2I( -box.GetHeight(), box.GetHeight() ) );
|
corner + VECTOR2I( -box.GetHeight(), box.GetHeight() ) );
|
||||||
MoveDiagonal( bottomleftline, vertices, clearance );
|
MoveDiagonal( bottomleftline, vertices, aClearance );
|
||||||
|
|
||||||
// top left diagonal
|
// top left diagonal
|
||||||
corner = box.GetOrigin() + VECTOR2I( 0, box.GetHeight() );
|
corner = box.GetOrigin() + VECTOR2I( 0, box.GetHeight() );
|
||||||
SEG topleftline = SEG( corner + VECTOR2I( -box.GetHeight(), -box.GetHeight() ),
|
SEG topleftline = SEG( corner + VECTOR2I( -box.GetHeight(), -box.GetHeight() ),
|
||||||
corner );
|
corner );
|
||||||
MoveDiagonal( topleftline, vertices, clearance );
|
MoveDiagonal( topleftline, vertices, aClearance );
|
||||||
|
|
||||||
SHAPE_LINE_CHAIN octagon;
|
SHAPE_LINE_CHAIN octagon;
|
||||||
octagon.SetClosed( true );
|
octagon.SetClosed( true );
|
||||||
|
|
|
@ -37,8 +37,8 @@ class PNS_ITEM;
|
||||||
const SHAPE_LINE_CHAIN OctagonalHull( const VECTOR2I& aP0, const VECTOR2I& aSize,
|
const SHAPE_LINE_CHAIN OctagonalHull( const VECTOR2I& aP0, const VECTOR2I& aSize,
|
||||||
int aClearance, int aChamfer );
|
int aClearance, int aChamfer );
|
||||||
|
|
||||||
const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
|
const SHAPE_LINE_CHAIN SegmentHull( const SHAPE_SEGMENT& aSeg, int aClearance,
|
||||||
int aWalkaroundThickness );
|
int aWalkaroundThickness );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ConvexHull()
|
* Function ConvexHull()
|
||||||
|
@ -48,7 +48,7 @@ const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
|
||||||
* @param clearance The minimum distance between polygon and hull.
|
* @param clearance The minimum distance between polygon and hull.
|
||||||
* @return A closed line chain describing the octagon.
|
* @return A closed line chain describing the octagon.
|
||||||
*/
|
*/
|
||||||
const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& convex, int clearance );
|
const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& convex, int aClearance );
|
||||||
|
|
||||||
SHAPE_RECT ApproximateSegmentAsRect( const SHAPE_SEGMENT& aSeg );
|
SHAPE_RECT ApproximateSegmentAsRect( const SHAPE_SEGMENT& aSeg );
|
||||||
|
|
||||||
|
@ -59,5 +59,4 @@ void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor );
|
||||||
|
|
||||||
OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB );
|
OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB );
|
||||||
|
|
||||||
|
|
||||||
#endif // __PNS_UTILS_H
|
#endif // __PNS_UTILS_H
|
||||||
|
|
|
@ -816,7 +816,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(saveUndoBuffer)
|
if( saveUndoBuffer )
|
||||||
{
|
{
|
||||||
frame->SaveCopyInUndoList( m_router->GetUndoBuffer(), UR_UNSPECIFIED );
|
frame->SaveCopyInUndoList( m_router->GetUndoBuffer(), UR_UNSPECIFIED );
|
||||||
m_router->ClearUndoBuffer();
|
m_router->ClearUndoBuffer();
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
void Restart();
|
void Restart();
|
||||||
|
|
||||||
void Set( int aMilliseconds );
|
void Set( int aMilliseconds );
|
||||||
int Get () const { return m_limitMs; }
|
int Get() const { return m_limitMs; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_limitMs;
|
int m_limitMs;
|
||||||
|
|
|
@ -110,7 +110,7 @@ bool EDIT_TOOL::invokeInlineRouter()
|
||||||
if( track || via )
|
if( track || via )
|
||||||
{
|
{
|
||||||
ROUTER_TOOL *theRouter = static_cast<ROUTER_TOOL*> ( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
|
ROUTER_TOOL *theRouter = static_cast<ROUTER_TOOL*> ( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
|
||||||
assert ( theRouter );
|
assert( theRouter );
|
||||||
|
|
||||||
if( !theRouter->PNSSettings().InlineDragEnabled() )
|
if( !theRouter->PNSSettings().InlineDragEnabled() )
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue