Code formatting.

This commit is contained in:
Maciej Suminski 2014-11-14 20:19:00 +01:00
parent 7721d02afe
commit 9245b90392
27 changed files with 419 additions and 417 deletions

View File

@ -29,9 +29,9 @@ using boost::optional;
bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const
{
// fixme: ugly!
SEG s(aP, aP);
return this->Collide(s, aClearance);
// fixme: ugly!
SEG s( aP, aP );
return this->Collide( s, aClearance );
}
@ -161,9 +161,9 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP )
if( dist < min_dist && seg.A != aP && seg.B != aP )
{
min_dist = dist;
if(found_index < 0)
if( found_index < 0 )
ii = s;
else if(s < found_index)
else if( s < found_index )
ii = s;
}
}
@ -521,25 +521,27 @@ const std::string SHAPE_LINE_CHAIN::Format() const
bool SHAPE_LINE_CHAIN::CompareGeometry ( const SHAPE_LINE_CHAIN & aOther ) const
{
SHAPE_LINE_CHAIN a(*this), b(aOther);
SHAPE_LINE_CHAIN a(*this), b( aOther );
a.Simplify();
b.Simplify();
if(a.m_points.size() != b.m_points.size())
if( a.m_points.size() != b.m_points.size() )
return false;
for(int i = 0; i < a.PointCount(); i++)
if(a.CPoint(i) != b.CPoint(i))
for( int i = 0; i < a.PointCount(); i++)
if( a.CPoint( i ) != b.CPoint( i ) )
return false;
return true;
}
bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const
{
INTERSECTIONS dummy;
return Intersect(aChain, dummy) != 0;
return Intersect( aChain, dummy ) != 0;
}
SHAPE* SHAPE_LINE_CHAIN::Clone() const
{
return new SHAPE_LINE_CHAIN( *this );

View File

@ -84,7 +84,7 @@ public:
* @param aB reference to the end point in the parent shape
* @param aIndex index of the segment within the parent shape
*/
SEG ( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB )
SEG( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB )
{
m_index = aIndex;
}
@ -92,7 +92,7 @@ public:
/**
* Copy constructor
*/
SEG ( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index ( aSeg.m_index )
SEG( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index( aSeg.m_index )
{
}
@ -225,23 +225,24 @@ public:
return ( d1 <= 1 && d2 <= 1 );
}
bool Overlaps ( const SEG& aSeg ) const
bool Overlaps( const SEG& aSeg ) const
{
if( aSeg.A == aSeg.B ) // single point corner case
{
if(A == aSeg.A || B == aSeg.A)
if( A == aSeg.A || B == aSeg.A )
return false;
return Contains(aSeg.A);
return Contains( aSeg.A );
}
if( !Collinear (aSeg ))
if( !Collinear( aSeg ) )
return false;
if ( Contains (aSeg.A) || Contains(aSeg.B) )
if( Contains( aSeg.A ) || Contains( aSeg.B ) )
return true;
if ( aSeg.Contains (A) || aSeg.Contains(B) )
if( aSeg.Contains( A ) || aSeg.Contains( B ) )
return true;
return false;
}

View File

@ -41,7 +41,7 @@ enum SHAPE_TYPE
SH_SEGMENT, ///> line segment
SH_LINE_CHAIN, ///> line chain (polyline)
SH_CIRCLE, ///> circle
SH_CONVEX, ///> convex polygon
SH_CONVEX, ///> convex polygon
SH_POLYGON, ///> any polygon (with holes, etc.)
SH_COMPOUND ///> compound shape, consisting of multiple simple shapes
};
@ -63,7 +63,7 @@ public:
* Creates an empty shape of type aType
*/
SHAPE ( SHAPE_TYPE aType ) : m_type( aType )
SHAPE( SHAPE_TYPE aType ) : m_type( aType )
{}
// Destructor

View File

@ -38,7 +38,7 @@ public:
SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter )
{}
SHAPE_CIRCLE ( const SHAPE_CIRCLE& aOther ) :
SHAPE_CIRCLE( const SHAPE_CIRCLE& aOther ) :
SHAPE( SH_CIRCLE ),
m_radius( aOther.m_radius ),
m_center( aOther.m_center )
@ -86,7 +86,7 @@ public:
return m_center;
}
void Move ( const VECTOR2I& aVector )
void Move( const VECTOR2I& aVector )
{
m_center += aVector;
}

View File

@ -114,7 +114,7 @@ public:
}
SHAPE_LINE_CHAIN(const VECTOR2I* aV, int aCount ) :
SHAPE_LINE_CHAIN( const VECTOR2I* aV, int aCount ) :
SHAPE( SH_LINE_CHAIN ),
m_closed( false )
{
@ -564,9 +564,9 @@ public:
bool CompareGeometry( const SHAPE_LINE_CHAIN & aOther ) const;
void Move ( const VECTOR2I& aVector )
void Move( const VECTOR2I& aVector )
{
for(std::vector<VECTOR2I>::iterator i = m_points.begin(); i != m_points.end(); ++i)
for( std::vector<VECTOR2I>::iterator i = m_points.begin(); i != m_points.end(); ++i )
(*i) += aVector;
}

View File

@ -57,7 +57,7 @@ public:
SHAPE( SH_RECT ), m_p0( aP0 ), m_w( aW ), m_h( aH )
{}
SHAPE_RECT ( const SHAPE_RECT& aOther ) :
SHAPE_RECT( const SHAPE_RECT& aOther ) :
SHAPE( SH_RECT ),
m_p0( aOther.m_p0 ),
m_w( aOther.m_w ),
@ -159,7 +159,7 @@ public:
return m_h;
}
void Move ( const VECTOR2I& aVector )
void Move( const VECTOR2I& aVector )
{
m_p0 += aVector;
}

View File

@ -31,71 +31,71 @@
class SHAPE_SEGMENT : public SHAPE {
public:
SHAPE_SEGMENT():
SHAPE( SH_SEGMENT ), m_width( 0 ) {};
SHAPE_SEGMENT():
SHAPE( SH_SEGMENT ), m_width( 0 ) {};
SHAPE_SEGMENT( const VECTOR2I& aA, const VECTOR2I& aB, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aA, aB ), m_width( aWidth ) {};
SHAPE_SEGMENT( const VECTOR2I& aA, const VECTOR2I& aB, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aA, aB ), m_width( aWidth ) {};
SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {};
SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {};
~SHAPE_SEGMENT() {};
~SHAPE_SEGMENT() {};
SHAPE* Clone() const
{
return new SHAPE_SEGMENT( m_seg, m_width );
}
const BOX2I BBox( int aClearance = 0 ) const
{
return BOX2I( m_seg.A, m_seg.B - m_seg.A ).Inflate( aClearance + m_width / 2 );
}
const BOX2I BBox( int aClearance = 0 ) const
{
return BOX2I( m_seg.A, m_seg.B - m_seg.A ).Inflate( aClearance + m_width / 2 );
}
bool Collide( const SEG& aSeg, int aClearance = 0 ) const
{
return m_seg.Distance( aSeg ) <= m_width / 2 + aClearance;
}
bool Collide( const SEG& aSeg, int aClearance = 0 ) const
{
return m_seg.Distance( aSeg ) <= m_width / 2 + aClearance;
}
bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const
{
return m_seg.Distance( aP ) <= m_width / 2 + aClearance;
}
bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const
{
return m_seg.Distance( aP ) <= m_width / 2 + aClearance;
}
void SetSeg ( const SEG& aSeg )
{
m_seg = aSeg;
}
void SetSeg( const SEG& aSeg )
{
m_seg = aSeg;
}
const SEG& GetSeg () const
{
return m_seg;
}
const SEG& GetSeg() const
{
return m_seg;
}
void SetWidth ( int aWidth )
{
m_width = aWidth;
}
void SetWidth( int aWidth )
{
m_width = aWidth;
}
int GetWidth() const
{
return m_width;
}
int GetWidth() const
{
return m_width;
}
bool IsSolid() const
{
return true;
}
bool IsSolid() const
{
return true;
}
void Move ( const VECTOR2I& aVector )
{
m_seg.A += aVector;
m_seg.B += aVector;
}
void Move( const VECTOR2I& aVector )
{
m_seg.A += aVector;
m_seg.B += aVector;
}
private:
SEG m_seg;
int m_width;
SEG m_seg;
int m_width;
};
#endif

View File

@ -25,7 +25,7 @@
#include "pns_router.h"
PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
PNS_ALGO_BASE ( aRouter )
PNS_ALGO_BASE( aRouter )
{
m_world = NULL;
m_shove = NULL;
@ -39,7 +39,7 @@ PNS_DRAGGER::~PNS_DRAGGER()
}
void PNS_DRAGGER::SetWorld ( PNS_NODE* aWorld )
void PNS_DRAGGER::SetWorld( PNS_NODE* aWorld )
{
m_world = aWorld;
}
@ -49,7 +49,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
{
int w2 = aSeg->Width() / 2;
m_draggedLine = m_world->AssembleLine ( aSeg, &m_draggedSegmentIndex );
m_draggedLine = m_world->AssembleLine( aSeg, &m_draggedSegmentIndex );
m_shove->SetInitialLine( m_draggedLine );
m_lastValidDraggedLine = *m_draggedLine;
m_lastValidDraggedLine.ClearSegmentLinks();
@ -58,7 +58,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
m_mode = CORNER;
else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 )
{
m_draggedSegmentIndex ++;
m_draggedSegmentIndex++;
m_mode = CORNER;
} else
m_mode = SEGMENT;
@ -74,14 +74,14 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
m_mode = VIA;
VECTOR2I p0( aVia->Pos() );
PNS_JOINT *jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
PNS_JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
BOOST_FOREACH(PNS_ITEM *item, jt->LinkList() )
BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
{
if( item->OfKind( PNS_ITEM::SEGMENT ) )
{
int segIndex;
PNS_SEGMENT* seg = (PNS_SEGMENT*) item;
PNS_SEGMENT* seg = ( PNS_SEGMENT*) item;
std::auto_ptr<PNS_LINE> l( m_world->AssembleLine( seg, &segIndex ) );
if( segIndex != 0 )
@ -97,24 +97,24 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{
m_shove = new PNS_SHOVE( m_world, Router() );
m_shove = new PNS_SHOVE( m_world, Router() );
m_lastNode = NULL;
m_draggedItems.Clear();
m_currentMode = Settings().Mode();
TRACE( 2, "StartDragging: item %p [kind %d]", aStartItem % aStartItem->Kind() );
switch( aStartItem->Kind() )
{
case PNS_ITEM::SEGMENT:
return startDragSegment ( aP, static_cast<PNS_SEGMENT *>( aStartItem ) );
switch( aStartItem->Kind() )
{
case PNS_ITEM::SEGMENT:
return startDragSegment( aP, static_cast<PNS_SEGMENT*>( aStartItem ) );
case PNS_ITEM::VIA:
return startDragVia ( aP, static_cast<PNS_VIA *> (aStartItem) );
case PNS_ITEM::VIA:
return startDragVia( aP, static_cast<PNS_VIA*>( aStartItem ) );
default:
return false;
}
default:
return false;
}
}
@ -135,9 +135,9 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
PNS_LINE tmp( *m_draggedLine );
if( m_mode == SEGMENT )
tmp.DragSegment ( aP, m_draggedSegmentIndex, thresh );
tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
tmp.DragCorner ( aP, m_draggedSegmentIndex, thresh );
tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
m_lastNode = m_shove->CurrentNode()->Branch();
@ -145,8 +145,8 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark();
m_lastNode->Add ( &m_lastValidDraggedLine );
m_draggedItems = PNS_ITEMSET ( &m_lastValidDraggedLine );
m_lastNode->Add( &m_lastValidDraggedLine );
m_draggedItems = PNS_ITEMSET( &m_lastValidDraggedLine );
break;
}
@ -154,7 +154,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
case VIA: // fixme...
{
m_lastNode = m_shove->CurrentNode()->Branch();
dumbDragVia ( m_initialVia, m_lastNode, aP );
dumbDragVia( m_initialVia, m_lastNode, aP );
break;
}
@ -182,7 +182,7 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a
BOOST_FOREACH( PNS_LINE &l, m_origViaConnections )
{
PNS_LINE origLine (l);
PNS_LINE origLine( l );
PNS_LINE* draggedLine = l.Clone();
draggedLine->DragCorner( aP, 0 );
@ -208,21 +208,21 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
switch( m_mode )
{
case SEGMENT:
case CORNER:
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0;
PNS_LINE tmp( *m_draggedLine );
case SEGMENT:
case CORNER:
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0;
PNS_LINE tmp( *m_draggedLine );
if( m_mode == SEGMENT )
tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
if( m_mode == SEGMENT )
tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( tmp );
if( st == PNS_SHOVE::SH_OK )
ok = true;
ok = true;
else if( st == PNS_SHOVE::SH_HEAD_MODIFIED )
{
tmp = m_shove->NewHead();
@ -240,11 +240,11 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
m_draggedItems = PNS_ITEMSET( &m_lastValidDraggedLine );
break;
}
}
case VIA:
{
PNS_VIA *newVia;
PNS_VIA* newVia;
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia );
if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED )
@ -282,23 +282,23 @@ bool PNS_DRAGGER::FixRoute()
bool PNS_DRAGGER::Drag( const VECTOR2I& aP )
{
switch( m_currentMode )
{
case RM_MarkObstacles:
return dragMarkObstacles( aP );
switch( m_currentMode )
{
case RM_MarkObstacles:
return dragMarkObstacles( aP );
case RM_Shove:
case RM_Walkaround:
case RM_Smart:
return dragShove( aP );
case RM_Shove:
case RM_Walkaround:
case RM_Smart:
return dragShove( aP );
default:
return false;
}
default:
return false;
}
}
PNS_NODE *PNS_DRAGGER::CurrentNode() const
PNS_NODE* PNS_DRAGGER::CurrentNode() const
{
return m_lastNode;
}

View File

@ -24,8 +24,8 @@
PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem )
{
if(aInitialItem)
m_items.push_back(aInitialItem);
if( aInitialItem )
m_items.push_back( aInitialItem );
}
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert )
@ -55,7 +55,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert )
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( item->OfKind ( aKindMask ) ^ aInvert )
if( item->OfKind( aKindMask ) ^ aInvert )
newItems.push_back( item );
}
@ -71,7 +71,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( (item->Net() == aNet) ^ aInvert )
if( ( item->Net() == aNet ) ^ aInvert )
newItems.push_back( item );
}
@ -80,7 +80,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
return *this;
}
PNS_ITEMSET& PNS_ITEMSET::ExcludeItem ( const PNS_ITEM *aItem )
PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem )
{
ITEMS newItems;

View File

@ -51,10 +51,10 @@ public:
return *this;
}
int Count(int aKindMask = -1) const
int Count( int aKindMask = -1 ) const
{
int n = 0;
BOOST_FOREACH ( PNS_ITEM *item, m_items )
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( item->Kind() & aKindMask )
n++;
@ -76,15 +76,15 @@ public:
PNS_ITEMSET& ExcludeKinds( int aKindMask )
{
return FilterKinds ( aKindMask, true );
return FilterKinds( aKindMask, true );
}
PNS_ITEMSET& ExcludeNet( int aNet )
{
return FilterNet ( aNet, true );
return FilterNet( aNet, true );
}
PNS_ITEMSET& ExcludeItem ( const PNS_ITEM *aItem );
PNS_ITEMSET& ExcludeItem( const PNS_ITEM* aItem );
int Size() const
{
@ -93,7 +93,7 @@ public:
void Add( PNS_ITEM* aItem )
{
m_items.push_back ( aItem );
m_items.push_back( aItem );
}
PNS_ITEM* Get( int index ) const
@ -101,7 +101,7 @@ public:
return m_items[index];
}
PNS_ITEM* operator[] (int index ) const
PNS_ITEM* operator[] ( int index ) const
{
return m_items[index];
}
@ -111,17 +111,17 @@ public:
m_items.clear();
}
bool Contains ( const PNS_ITEM *aItem ) const
bool Contains( const PNS_ITEM* aItem ) const
{
return std::find ( m_items.begin(), m_items.end(), aItem ) != m_items.end();
return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
}
void Erase ( const PNS_ITEM *aItem )
void Erase( const PNS_ITEM* aItem )
{
ITEMS::iterator f = std::find (m_items.begin(), m_items.end(), aItem );
ITEMS::iterator f = std::find( m_items.begin(), m_items.end(), aItem );
if( f != m_items.end() )
m_items.erase ( f );
m_items.erase( f );
}
private:

View File

@ -72,7 +72,7 @@ public:
m_layers = aB.m_layers;
}
PNS_ITEM* Clone ( ) const
PNS_ITEM* Clone( ) const
{
assert( false );
return NULL;
@ -98,17 +98,17 @@ public:
///> Links the joint to a given board item (when it's added to the PNS_NODE)
void Link( PNS_ITEM* aItem )
{
if (m_linkedItems.Contains( aItem ))
if( m_linkedItems.Contains( aItem ) )
return;
m_linkedItems.Add ( aItem );
m_linkedItems.Add( aItem );
}
///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE)
///> Returns true if the joint became dangling after unlinking.
bool Unlink( PNS_ITEM* aItem )
{
m_linkedItems.Erase ( aItem );
m_linkedItems.Erase( aItem );
return m_linkedItems.Size() == 0;
}
@ -159,7 +159,6 @@ public:
return m_linkedItems.Count( aMask );
}
void Dump() const;
bool operator==( const PNS_JOINT& rhs ) const
@ -174,9 +173,9 @@ public:
m_layers.Merge( aJoint.m_layers );
BOOST_FOREACH ( PNS_ITEM *item, aJoint.LinkList() )
BOOST_FOREACH( PNS_ITEM* item, aJoint.LinkList() )
{
m_linkedItems.Add (item);
m_linkedItems.Add( item );
}
}

View File

@ -123,7 +123,7 @@ int PNS_LINE::Marker()const
}
void PNS_LINE::copyLinks( const PNS_LINE *aParent )
void PNS_LINE::copyLinks( const PNS_LINE* aParent )
{
if( aParent->m_segmentRefs == NULL )
{
@ -413,7 +413,7 @@ void PNS_LINE::DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThresho
if( aIndex == 0 )
path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse();
else if ( aIndex == m_line.SegmentCount() )
else if( aIndex == m_line.SegmentCount() )
path = dragCornerInternal( m_line, snapped );
else
{

View File

@ -703,7 +703,7 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
{
if( aSeg && aSeg->OfKind( PNS_ITEM::SEGMENT ) )
{
PNS_JOINT *jt = aNode->FindJoint( aP, aSeg );
PNS_JOINT* jt = aNode->FindJoint( aP, aSeg );
if( jt && jt->LinkCount() >= 1 )
return;
@ -727,13 +727,13 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
bool PNS_LINE_PLACER::SetLayer( int aLayer )
{
if(m_idle)
if( m_idle )
{
m_currentLayer = aLayer;
return true;
} else if (m_chainedPlacement) {
} else if( m_chainedPlacement ) {
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;
m_splitSeg = false;
initPlacement ( m_splitSeg );
@ -790,7 +790,7 @@ void PNS_LINE_PLACER::initPlacement( bool aSplitSeg )
m_p_start = m_currentStart;
m_direction = m_initial_direction;
PNS_NODE *world = Router()->GetWorld();
PNS_NODE* world = Router()->GetWorld();
world->KillChildren();
PNS_NODE* rootNode = world->Branch();
@ -939,7 +939,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
for( int s = 0; s < aLatest->SegmentCount(); s++ )
{
PNS_SEGMENT *seg = ( *aLatest->LinkedSegments() )[s];
PNS_SEGMENT* seg = ( *aLatest->LinkedSegments() )[s];
PNS_LINE* ourLine = aNode->AssembleLine( seg );
PNS_JOINT a, b;
std::vector<PNS_LINE*> lines;
@ -991,8 +991,8 @@ void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest )
if( simplified.PointCount() != l->PointCount() )
{
std::auto_ptr<PNS_LINE> lnew ( l->Clone() );
aNode -> Remove(l);
lnew->SetShape(simplified);
aNode -> Remove( l );
lnew->SetShape( simplified );
aNode -> Add( lnew.get() );
}
}
@ -1019,14 +1019,14 @@ void PNS_LINE_PLACER::updateLeadingRatLine()
std::auto_ptr<PNS_NODE> tmpNode ( m_lastNode->Branch() );
tmpNode->Add( &current );
PNS_JOINT *jt = tmpNode->FindJoint( current.CPoint( -1 ),
PNS_JOINT* jt = tmpNode->FindJoint( current.CPoint( -1 ),
current.Layers().Start(), current.Net() );
if( !jt )
return;
int anchor;
PNS_ITEM *it = tmpNode->NearestUnconnectedItem( jt, &anchor );
PNS_ITEM* it = tmpNode->NearestUnconnectedItem( jt, &anchor );
if( it )
{

View File

@ -248,7 +248,7 @@ private:
* and redundant vertexes. If a simplification bhas been found, replaces the
* old line with the simplified one in aNode.
*/
void simplifyNewLine( PNS_NODE *aNode, PNS_SEGMENT *aLatest );
void simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest );
/**
* Function handleViaPlacement()
@ -398,7 +398,7 @@ private:
PNS_LINE m_currentTrace;
PNS_MODE m_currentMode;
PNS_ITEM *m_startItem;
PNS_ITEM* m_startItem;
bool m_idle;
bool m_chainedPlacement;

View File

@ -504,7 +504,7 @@ void PNS_ROUTER::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance
void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems )
{
BOOST_FOREACH( const PNS_ITEM *item, aItems.CItems() )
BOOST_FOREACH( const PNS_ITEM* item, aItems.CItems() )
DisplayItem( item );
}
@ -604,7 +604,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
return;
if( Settings().Mode() == RM_MarkObstacles )
markViolations(aNode, aCurrent, removed);
markViolations( aNode, aCurrent, removed );
aNode->GetUpdatedItems( removed, added );
@ -760,7 +760,7 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
void PNS_ROUTER::StopRouting()
{
// Update the ratsnest with new changes
if(m_placer)
if( m_placer )
{
int n = m_placer->CurrentNet();
@ -827,7 +827,7 @@ void PNS_ROUTER::ToggleViaPlacement()
int PNS_ROUTER::GetCurrentNet() const
{
if(m_placer)
if( m_placer )
return m_placer->CurrentNet();
return -1;
}
@ -841,7 +841,6 @@ int PNS_ROUTER::GetCurrentLayer() const
}
void PNS_ROUTER::DumpLog()
{
PNS_LOGGER* logger = NULL;

View File

@ -217,7 +217,7 @@ private:
void highlightCurrent( bool enabled );
void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
VECTOR2I m_currentEnd;
RouterState m_state;

View File

@ -109,7 +109,7 @@ public:
///> Enables/disables jumping over unmovable obstacles.
void SetJumpOverObstacles( bool aJumpOverObstacles ) { m_jumpOverObstacles = aJumpOverObstacles; }
void SetStartDiagonal(bool aStartDiagonal) { m_startDiagonal = aStartDiagonal; }
void SetStartDiagonal( bool aStartDiagonal ) { m_startDiagonal = aStartDiagonal; }
bool CanViolateDRC() const { return m_canViolateDRC; }
void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; }

View File

@ -41,7 +41,7 @@
#include <profile.h>
static void sanityCheck( PNS_LINE *aOld, PNS_LINE *aNew )
static void sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew )
{
assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) );
assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) );
@ -58,26 +58,26 @@ PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
PNS_SHOVE::~PNS_SHOVE()
{
// free all the stuff we've created during routing/dragging operation.
BOOST_FOREACH( PNS_ITEM *item, m_gcItems )
BOOST_FOREACH( PNS_ITEM* item, m_gcItems )
delete item;
}
// garbage-collected line assembling
PNS_LINE* PNS_SHOVE::assembleLine( const PNS_SEGMENT *aSeg, int *aIndex )
PNS_LINE* PNS_SHOVE::assembleLine( const PNS_SEGMENT* aSeg, int* aIndex )
{
PNS_LINE* l = m_currentNode->AssembleLine( const_cast<PNS_SEGMENT*>( aSeg ), aIndex );
m_gcItems.push_back(l);
m_gcItems.push_back( l );
return l;
}
// garbage-collected line cloning
PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine )
PNS_LINE* PNS_SHOVE::cloneLine ( const PNS_LINE* aLine )
{
PNS_LINE *l = aLine->Clone();
PNS_LINE* l = aLine->Clone();
m_gcItems.push_back( l );
return l;
@ -88,7 +88,7 @@ PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine )
// visually "outwards" of the line/via applying pressure on it. Unfortunately there's no
// mathematical concept of orientation of an open curve, so we use some primitive heuristics:
// if the shoved line wraps around the start of the "pusher", it's likely shoved in wrong direction.
bool PNS_SHOVE::checkBumpDirection( PNS_LINE *aCurrent, PNS_LINE *aShoved ) const
bool PNS_SHOVE::checkBumpDirection( PNS_LINE* aCurrent, PNS_LINE* aShoved ) const
{
const SEG ss = aCurrent->CSegment( 0 );
@ -299,7 +299,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S
if( rv == SH_OK )
{
if ( shovedLine->Marker() & MK_HEAD )
if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine;
sanityCheck( obstacleLine, shovedLine );
@ -324,7 +324,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S
}
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE *aObstacle )
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE* aCurrent, PNS_LINE* aObstacle )
{
PNS_LINE* shovedLine = cloneLine( aObstacle );
@ -332,7 +332,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE
if( rv == SH_OK )
{
if ( shovedLine->Marker() & MK_HEAD )
if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine;
sanityCheck( aObstacle, shovedLine );
@ -535,7 +535,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
m_newHead = *lp.second;
}
unwindStack(lp.first);
unwindStack( lp.first );
if( lp.second->SegmentCount() )
{
@ -556,12 +556,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
}
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia )
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia )
{
int clearance = m_currentNode->GetClearance( aCurrent, aObstacleVia ) ;
LINE_PAIR_VEC draggedLines;
bool colLine = false, colVia = false;
PNS_LINE *currentLine = NULL;
PNS_LINE* currentLine = NULL;
VECTOR2I mtvLine, mtvVia, mtv, mtvSolid;
int rank = -1;
@ -593,7 +593,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA*
rank = currentLine->Rank();
}
else if (aCurrent->OfKind(PNS_ITEM::SOLID))
else if( aCurrent->OfKind( PNS_ITEM::SOLID ) )
{
CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(),
clearance + PNS_HULL_MARGIN, true, mtvSolid );
@ -617,7 +617,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
shoved->ClearSegmentLinks();
cur->RemoveVia();
unwindStack(aCurrent);
unwindStack( aCurrent );
BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
{
@ -715,7 +715,7 @@ void PNS_SHOVE::unwindStack( PNS_ITEM* aItem )
{
PNS_LINE* l = static_cast<PNS_LINE*>( aItem );
if ( !l->LinkedSegments() )
if( !l->LinkedSegments() )
return;
BOOST_FOREACH( PNS_SEGMENT* seg, *l->LinkedSegments() )
@ -1062,7 +1062,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead )
}
const RANGE<int> PNS_SHOVE::findShovedVertexRange( PNS_LINE *aL )
const RANGE<int> PNS_SHOVE::findShovedVertexRange( PNS_LINE* aL )
{
RANGE<int> r;
@ -1116,6 +1116,7 @@ const PNS_LINE PNS_SHOVE::NewHead() const
return *m_newHead;
}
void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial )
{
m_root = m_root->Branch();

View File

@ -104,14 +104,14 @@ private:
SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank );
void unwindStack( PNS_SEGMENT* aSeg );
void unwindStack( PNS_ITEM *aItem );
void unwindStack( PNS_ITEM* aItem );
void runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead );
void pushLine( PNS_LINE *aL );
void pushLine( PNS_LINE* aL );
void popLine();
const RANGE<int> findShovedVertexRange( PNS_LINE *aL );
const RANGE<int> findShovedVertexRange( PNS_LINE* aL );
PNS_LINE* assembleLine( const PNS_SEGMENT* aSeg, int* aIndex = NULL );
PNS_LINE* cloneLine( const PNS_LINE* aLine );

View File

@ -79,7 +79,7 @@ public:
private:
int inheritTrackWidth( PNS_ITEM *aItem );
int inheritTrackWidth( PNS_ITEM* aItem );
int m_trackWidth;
int m_diffPairWidth;

View File

@ -304,7 +304,7 @@ PNS_ITEM* ROUTER_TOOL::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLa
PNS_ITEM* prioritized[4];
for(int i = 0; i < 4; i++)
for( int i = 0; i < 4; i++ )
prioritized[i] = 0;
PNS_ITEMSET candidates = m_router->QueryHoverItems( aWhere );
@ -379,7 +379,7 @@ void ROUTER_TOOL::highlightNet( bool aEnabled, int aNetcode )
void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME> ();
BOARD *board = getModel<BOARD> ();
BOARD* board = getModel<BOARD> ();
#ifdef DEBUG
if( aEvent.IsKeyPressed() )
@ -409,7 +409,7 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
DIALOG_TRACK_VIA_SIZE sizeDlg( frame, bds );
if ( sizeDlg.ShowModal() )
if( sizeDlg.ShowModal() )
{
bds.UseCustomTrackViaSize( true );
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
@ -437,7 +437,7 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent )
{
VECTOR2I p = aEvent.Position();
startItem = pickSingleItem( p );
bool snapEnabled = !aEvent.Modifier(MD_SHIFT);
bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
m_router->EnableSnapping ( snapEnabled );
if( !snapEnabled && startItem && !startItem->Layers().Overlaps( tl ) )
@ -520,15 +520,15 @@ void ROUTER_TOOL::updateEndItem( TOOL_EVENT& aEvent )
TRACE( 0, "%s, layer : %d", m_endItem->KindStr().c_str() % m_endItem->Layers().Start() );
}
int ROUTER_TOOL::getStartLayer( const PNS_ITEM *aItem )
int ROUTER_TOOL::getStartLayer( const PNS_ITEM* aItem )
{
int tl = getView()->GetTopLayer();
if (m_startItem)
if( m_startItem )
{
const PNS_LAYERSET& ls = m_startItem->Layers();
if(ls.Overlaps( tl ))
if( ls.Overlaps( tl ) )
return tl;
else
return ls.Start();
@ -559,7 +559,7 @@ void ROUTER_TOOL::switchLayerOnViaPlacement()
bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType )
{
BOARD *board = getModel<BOARD> ();
BOARD* board = getModel<BOARD> ();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
@ -572,7 +572,7 @@ bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType )
sizes.AddLayerPair( frame->GetScreen()->m_Route_Layer_TOP,
frame->GetScreen()->m_Route_Layer_BOTTOM );
if (!m_router->IsPlacingVia())
if( !m_router->IsPlacingVia() )
{
// Cannot place microvias or blind vias if not allowed (obvious)
if( ( aType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
@ -659,7 +659,7 @@ void ROUTER_TOOL::performRouting()
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
break;
if(needLayerSwitch)
if( needLayerSwitch )
{
switchLayerOnViaPlacement();
}
@ -764,7 +764,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
else
performRouting();
}
else if ( evt->IsAction( &ACT_Drag ) )
else if( evt->IsAction( &ACT_Drag ) )
performDragging();
handleCommonEvents( *evt );

View File

@ -59,7 +59,7 @@ private:
void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill );
void handleCommonEvents( TOOL_EVENT& evt );
int getStartLayer( const PNS_ITEM *aItem );
int getStartLayer( const PNS_ITEM* aItem );
void switchLayerOnViaPlacement();
bool onViaCommand( VIATYPE_T aType );