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();
}
void TOOL_BASE::attachManager( TOOL_MANAGER* aManager )
{
m_toolMgr = aManager;
m_toolSettings = TOOL_SETTINGS( this );
}
TOOL_SETTINGS::TOOL_SETTINGS( TOOL_BASE* aTool )
{
m_tool = aTool;
@ -72,20 +74,22 @@ TOOL_SETTINGS::TOOL_SETTINGS ( TOOL_BASE *aTool )
m_config = frame->GetSettings();
}
TOOL_SETTINGS::~TOOL_SETTINGS()
{
}
TOOL_SETTINGS& TOOL_BASE::GetSettings()
{
return m_toolSettings;
}
wxString TOOL_SETTINGS::getKeyName(const wxString& entryName) const
wxString TOOL_SETTINGS::getKeyName( const wxString& aEntryName ) const
{
wxString key( m_tool->GetName() );
key += wxT( "." );
key += entryName;
key += aEntryName;
return key;
}

View File

@ -63,12 +63,11 @@ class TOOL_SETTINGS
}
private:
wxString getKeyName(const wxString& entryName) const;
wxString getKeyName( const wxString& aEntryName ) const;
wxConfigBase* m_config;
TOOL_BASE* m_tool;
};
#endif

View File

@ -1028,11 +1028,15 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
if( m_p_start == aP )
{
l.Clear();
} else {
}
else
{
if( Settings().GetFreeAngleMode() && Settings().Mode() == RM_MarkObstacles )
{
l = SHAPE_LINE_CHAIN( m_p_start, aP );
} else {
}
else
{
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 ) )
{
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace(
m_p_start,
aP + force );
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace( m_p_start, aP + force );
aHead = PNS_LINE( aHead, line );
v.SetPos( v.Pos() + force );

View File

@ -1237,11 +1237,13 @@ PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg )
return NULL;
}
void PNS_NODE::SetCollisionFilter( PNS_COLLISION_FILTER* aFilter )
{
m_collisionFilter = aFilter;
}
PNS_ITEM *PNS_NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
{
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 )
{
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 == 90.0 || orient == 270.0 )
@ -262,7 +263,9 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
delete solid;
return NULL;
}
} else {
}
else
{
switch( aPad->GetShape() )
{
// PAD_CIRCLE already handled above

View File

@ -43,6 +43,7 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
m_inlineDragEnabled = false;
}
void PNS_ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
{
aSettings.Set( "Mode", (int) m_routingMode );
@ -62,6 +63,7 @@ void PNS_ROUTING_SETTINGS::Save ( TOOL_SETTINGS& aSettings ) const
aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
}
void PNS_ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
{
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 );
}
const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
{
if( m_startDiagonal )

View File

@ -130,7 +130,6 @@ public:
int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
TIME_LIMIT WalkaroundTimeLimit() const;
void SetInlineDragEnabled ( bool aEnable ) { m_inlineDragEnabled = aEnable; }
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
popLine();
if( !pushLine( walkaroundLine ) )
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 );
lp.second->SetRank( aCurrentRank - 1 );
if( !pushLine( lp.second ) )
return SH_INCOMPLETE;
}

View File

@ -129,6 +129,7 @@ bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRa
return true;
}
PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor, int aKindMask )
{
std::set<PNS_ITEM*> disconnected;
@ -320,8 +321,10 @@ int PNS_TOPOLOGY::DpNetPolarity( int aNet )
return MatchDpSuffix( refName, dummy1, dummy2 );
}
bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip );
bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
{
int refNet = aStart->Net();
@ -374,13 +377,12 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
}
int gap = -1 ;
if( refSeg->Seg().ApproxParallel( coupledSeg->Seg() ) ) {
if( refSeg->Seg().ApproxParallel( coupledSeg->Seg() ) )
{
// Segments are parallel -> compute pair gap
const VECTOR2I refDir = refSeg->Anchor( 1 ) - refSeg->Anchor( 0 );
const VECTOR2I displacement = refSeg->Anchor( 1 ) - coupledSeg->Anchor( 1 );
gap = (int) abs( refDir.Cross( displacement ) / refDir.EuclideanNorm() ) - lp->Width();
}
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;
vertices.NearestPoint( diagonal, dist );
aVertices.NearestPoint( aDiagonal, dist );
dist -= HULL_MARGIN;
VECTOR2I moveBy = (diagonal.A - diagonal.B).Perpendicular().Resize( dist - clearance );
diagonal.A += moveBy;
diagonal.B += moveBy;
VECTOR2I moveBy = ( aDiagonal.A - aDiagonal.B ).Perpendicular().Resize( dist - aClearance );
aDiagonal.A += 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
BOX2I box = convex.BBox( clearance + HULL_MARGIN );
BOX2I box = convex.BBox( aClearance + HULL_MARGIN );
box.Normalize();
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();
SEG toprightline = SEG( corner,
corner + VECTOR2I( box.GetHeight(), -box.GetHeight() ) );
MoveDiagonal( toprightline, vertices, clearance );
MoveDiagonal( toprightline, vertices, aClearance );
// bottom right diagonal
corner = box.GetOrigin() + VECTOR2I( box.GetWidth(), 0 );
SEG bottomrightline = SEG( corner + VECTOR2I( box.GetHeight(), box.GetHeight() ),
corner );
MoveDiagonal( bottomrightline, vertices, clearance );
MoveDiagonal( bottomrightline, vertices, aClearance );
// bottom left diagonal
corner = box.GetOrigin();
SEG bottomleftline = SEG( corner,
corner + VECTOR2I( -box.GetHeight(), box.GetHeight() ) );
MoveDiagonal( bottomleftline, vertices, clearance );
MoveDiagonal( bottomleftline, vertices, aClearance );
// top left diagonal
corner = box.GetOrigin() + VECTOR2I( 0, box.GetHeight() );
SEG topleftline = SEG( corner + VECTOR2I( -box.GetHeight(), -box.GetHeight() ),
corner );
MoveDiagonal( topleftline, vertices, clearance );
MoveDiagonal( topleftline, vertices, aClearance );
SHAPE_LINE_CHAIN octagon;
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.
* @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 );
@ -59,5 +59,4 @@ void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor );
OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB );
#endif // __PNS_UTILS_H