Code formatting.

This commit is contained in:
Maciej Suminski 2015-07-02 16:11:15 +02:00
parent 506e8c4d89
commit 766da1e494
19 changed files with 115 additions and 100 deletions

View File

@ -50,12 +50,14 @@ 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;
@ -72,20 +74,22 @@ TOOL_SETTINGS::TOOL_SETTINGS ( TOOL_BASE *aTool )
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;
} }

View File

@ -63,12 +63,11 @@ class TOOL_SETTINGS
} }
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

View File

@ -1028,11 +1028,15 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
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 );
} }
@ -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 );

View File

@ -1237,11 +1237,13 @@ 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() );

View File

@ -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

View File

@ -43,6 +43,7 @@ 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 );
@ -62,6 +63,7 @@ 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 );
@ -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 )

View File

@ -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; }

View File

@ -466,6 +466,7 @@ 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;
@ -620,6 +621,7 @@ 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;
} }

View File

@ -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();
@ -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 );

View File

@ -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 );

View File

@ -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