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 bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const
{ {
// fixme: ugly! // fixme: ugly!
SEG s(aP, aP); SEG s( aP, aP );
return this->Collide(s, aClearance); 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 ) if( dist < min_dist && seg.A != aP && seg.B != aP )
{ {
min_dist = dist; min_dist = dist;
if(found_index < 0) if( found_index < 0 )
ii = s; ii = s;
else if(s < found_index) else if( s < found_index )
ii = s; 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 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(); a.Simplify();
b.Simplify(); b.Simplify();
if(a.m_points.size() != b.m_points.size()) if( a.m_points.size() != b.m_points.size() )
return false; return false;
for(int i = 0; i < a.PointCount(); i++) for( int i = 0; i < a.PointCount(); i++)
if(a.CPoint(i) != b.CPoint(i)) if( a.CPoint( i ) != b.CPoint( i ) )
return false; return false;
return true; return true;
} }
bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const
{ {
INTERSECTIONS dummy; INTERSECTIONS dummy;
return Intersect(aChain, dummy) != 0; return Intersect( aChain, dummy ) != 0;
} }
SHAPE* SHAPE_LINE_CHAIN::Clone() const SHAPE* SHAPE_LINE_CHAIN::Clone() const
{ {
return new SHAPE_LINE_CHAIN( *this ); 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 aB reference to the end point in the parent shape
* @param aIndex index of the segment within 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; m_index = aIndex;
} }
@ -92,7 +92,7 @@ public:
/** /**
* Copy constructor * 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 ); 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( 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 false;
return Contains(aSeg.A); return Contains( aSeg.A );
} }
if( !Collinear (aSeg )) if( !Collinear( aSeg ) )
return false; return false;
if ( Contains (aSeg.A) || Contains(aSeg.B) ) if( Contains( aSeg.A ) || Contains( aSeg.B ) )
return true; return true;
if ( aSeg.Contains (A) || aSeg.Contains(B) ) if( aSeg.Contains( A ) || aSeg.Contains( B ) )
return true; return true;
return false; return false;
} }

View File

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

View File

@ -38,7 +38,7 @@ public:
SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter ) SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter )
{} {}
SHAPE_CIRCLE ( const SHAPE_CIRCLE& aOther ) : SHAPE_CIRCLE( const SHAPE_CIRCLE& aOther ) :
SHAPE( SH_CIRCLE ), SHAPE( SH_CIRCLE ),
m_radius( aOther.m_radius ), m_radius( aOther.m_radius ),
m_center( aOther.m_center ) m_center( aOther.m_center )
@ -86,7 +86,7 @@ public:
return m_center; return m_center;
} }
void Move ( const VECTOR2I& aVector ) void Move( const VECTOR2I& aVector )
{ {
m_center += 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 ), SHAPE( SH_LINE_CHAIN ),
m_closed( false ) m_closed( false )
{ {
@ -564,9 +564,9 @@ public:
bool CompareGeometry( const SHAPE_LINE_CHAIN & aOther ) const; 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; (*i) += aVector;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -72,7 +72,7 @@ public:
m_layers = aB.m_layers; m_layers = aB.m_layers;
} }
PNS_ITEM* Clone ( ) const PNS_ITEM* Clone( ) const
{ {
assert( false ); assert( false );
return NULL; return NULL;
@ -98,17 +98,17 @@ public:
///> Links the joint to a given board item (when it's added to the PNS_NODE) ///> Links the joint to a given board item (when it's added to the PNS_NODE)
void Link( PNS_ITEM* aItem ) void Link( PNS_ITEM* aItem )
{ {
if (m_linkedItems.Contains( aItem )) if( m_linkedItems.Contains( aItem ) )
return; return;
m_linkedItems.Add ( aItem ); m_linkedItems.Add( aItem );
} }
///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE) ///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE)
///> Returns true if the joint became dangling after unlinking. ///> Returns true if the joint became dangling after unlinking.
bool Unlink( PNS_ITEM* aItem ) bool Unlink( PNS_ITEM* aItem )
{ {
m_linkedItems.Erase ( aItem ); m_linkedItems.Erase( aItem );
return m_linkedItems.Size() == 0; return m_linkedItems.Size() == 0;
} }
@ -159,7 +159,6 @@ public:
return m_linkedItems.Count( aMask ); return m_linkedItems.Count( aMask );
} }
void Dump() const; void Dump() const;
bool operator==( const PNS_JOINT& rhs ) const bool operator==( const PNS_JOINT& rhs ) const
@ -174,9 +173,9 @@ public:
m_layers.Merge( aJoint.m_layers ); 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 ) if( aParent->m_segmentRefs == NULL )
{ {
@ -413,7 +413,7 @@ void PNS_LINE::DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThresho
if( aIndex == 0 ) if( aIndex == 0 )
path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse(); path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse();
else if ( aIndex == m_line.SegmentCount() ) else if( aIndex == m_line.SegmentCount() )
path = dragCornerInternal( m_line, snapped ); path = dragCornerInternal( m_line, snapped );
else 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 ) ) 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 ) if( jt && jt->LinkCount() >= 1 )
return; return;
@ -727,13 +727,13 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
bool PNS_LINE_PLACER::SetLayer( int aLayer ) bool PNS_LINE_PLACER::SetLayer( int aLayer )
{ {
if(m_idle) if( m_idle )
{ {
m_currentLayer = aLayer; m_currentLayer = aLayer;
return true; return true;
} else if (m_chainedPlacement) { } else if( m_chainedPlacement ) {
return false; 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_currentLayer = aLayer;
m_splitSeg = false; m_splitSeg = false;
initPlacement ( m_splitSeg ); initPlacement ( m_splitSeg );
@ -790,7 +790,7 @@ void PNS_LINE_PLACER::initPlacement( bool aSplitSeg )
m_p_start = m_currentStart; m_p_start = m_currentStart;
m_direction = m_initial_direction; m_direction = m_initial_direction;
PNS_NODE *world = Router()->GetWorld(); PNS_NODE* world = Router()->GetWorld();
world->KillChildren(); world->KillChildren();
PNS_NODE* rootNode = world->Branch(); 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++ ) 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_LINE* ourLine = aNode->AssembleLine( seg );
PNS_JOINT a, b; PNS_JOINT a, b;
std::vector<PNS_LINE*> lines; 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() ) if( simplified.PointCount() != l->PointCount() )
{ {
std::auto_ptr<PNS_LINE> lnew ( l->Clone() ); std::auto_ptr<PNS_LINE> lnew ( l->Clone() );
aNode -> Remove(l); aNode -> Remove( l );
lnew->SetShape(simplified); lnew->SetShape( simplified );
aNode -> Add( lnew.get() ); aNode -> Add( lnew.get() );
} }
} }
@ -1019,14 +1019,14 @@ void PNS_LINE_PLACER::updateLeadingRatLine()
std::auto_ptr<PNS_NODE> tmpNode ( m_lastNode->Branch() ); std::auto_ptr<PNS_NODE> tmpNode ( m_lastNode->Branch() );
tmpNode->Add( &current ); tmpNode->Add( &current );
PNS_JOINT *jt = tmpNode->FindJoint( current.CPoint( -1 ), PNS_JOINT* jt = tmpNode->FindJoint( current.CPoint( -1 ),
current.Layers().Start(), current.Net() ); current.Layers().Start(), current.Net() );
if( !jt ) if( !jt )
return; return;
int anchor; int anchor;
PNS_ITEM *it = tmpNode->NearestUnconnectedItem( jt, &anchor ); PNS_ITEM* it = tmpNode->NearestUnconnectedItem( jt, &anchor );
if( it ) if( it )
{ {

View File

@ -248,7 +248,7 @@ private:
* and redundant vertexes. If a simplification bhas been found, replaces the * and redundant vertexes. If a simplification bhas been found, replaces the
* old line with the simplified one in aNode. * 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() * Function handleViaPlacement()
@ -398,7 +398,7 @@ private:
PNS_LINE m_currentTrace; PNS_LINE m_currentTrace;
PNS_MODE m_currentMode; PNS_MODE m_currentMode;
PNS_ITEM *m_startItem; PNS_ITEM* m_startItem;
bool m_idle; bool m_idle;
bool m_chainedPlacement; 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 ) 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 ); DisplayItem( item );
} }
@ -604,7 +604,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
return; return;
if( Settings().Mode() == RM_MarkObstacles ) if( Settings().Mode() == RM_MarkObstacles )
markViolations(aNode, aCurrent, removed); markViolations( aNode, aCurrent, removed );
aNode->GetUpdatedItems( removed, added ); aNode->GetUpdatedItems( removed, added );
@ -760,7 +760,7 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
void PNS_ROUTER::StopRouting() void PNS_ROUTER::StopRouting()
{ {
// Update the ratsnest with new changes // Update the ratsnest with new changes
if(m_placer) if( m_placer )
{ {
int n = m_placer->CurrentNet(); int n = m_placer->CurrentNet();
@ -827,7 +827,7 @@ void PNS_ROUTER::ToggleViaPlacement()
int PNS_ROUTER::GetCurrentNet() const int PNS_ROUTER::GetCurrentNet() const
{ {
if(m_placer) if( m_placer )
return m_placer->CurrentNet(); return m_placer->CurrentNet();
return -1; return -1;
} }
@ -841,7 +841,6 @@ int PNS_ROUTER::GetCurrentLayer() const
} }
void PNS_ROUTER::DumpLog() void PNS_ROUTER::DumpLog()
{ {
PNS_LOGGER* logger = NULL; PNS_LOGGER* logger = NULL;

View File

@ -217,7 +217,7 @@ private:
void highlightCurrent( bool enabled ); 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; VECTOR2I m_currentEnd;
RouterState m_state; RouterState m_state;

View File

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

View File

@ -41,7 +41,7 @@
#include <profile.h> #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( 0 ) == aNew->CPoint( 0 ) );
assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) ); 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() PNS_SHOVE::~PNS_SHOVE()
{ {
// free all the stuff we've created during routing/dragging operation. // 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; delete item;
} }
// garbage-collected line assembling // 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 ); PNS_LINE* l = m_currentNode->AssembleLine( const_cast<PNS_SEGMENT*>( aSeg ), aIndex );
m_gcItems.push_back(l); m_gcItems.push_back( l );
return l; return l;
} }
// garbage-collected line cloning // 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 ); m_gcItems.push_back( l );
return 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 // 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: // 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. // 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 ); 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( rv == SH_OK )
{ {
if ( shovedLine->Marker() & MK_HEAD ) if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine; m_newHead = *shovedLine;
sanityCheck( obstacleLine, 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 ); 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( rv == SH_OK )
{ {
if ( shovedLine->Marker() & MK_HEAD ) if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine; m_newHead = *shovedLine;
sanityCheck( aObstacle, 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; m_newHead = *lp.second;
} }
unwindStack(lp.first); unwindStack( lp.first );
if( lp.second->SegmentCount() ) 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 ) ; int clearance = m_currentNode->GetClearance( aCurrent, aObstacleVia ) ;
LINE_PAIR_VEC draggedLines; LINE_PAIR_VEC draggedLines;
bool colLine = false, colVia = false; bool colLine = false, colVia = false;
PNS_LINE *currentLine = NULL; PNS_LINE* currentLine = NULL;
VECTOR2I mtvLine, mtvVia, mtv, mtvSolid; VECTOR2I mtvLine, mtvVia, mtv, mtvSolid;
int rank = -1; int rank = -1;
@ -593,7 +593,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA*
rank = currentLine->Rank(); rank = currentLine->Rank();
} }
else if (aCurrent->OfKind(PNS_ITEM::SOLID)) else if( aCurrent->OfKind( PNS_ITEM::SOLID ) )
{ {
CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(), CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(),
clearance + PNS_HULL_MARGIN, true, mtvSolid ); clearance + PNS_HULL_MARGIN, true, mtvSolid );
@ -617,7 +617,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
shoved->ClearSegmentLinks(); shoved->ClearSegmentLinks();
cur->RemoveVia(); cur->RemoveVia();
unwindStack(aCurrent); unwindStack( aCurrent );
BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() ) 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 ); PNS_LINE* l = static_cast<PNS_LINE*>( aItem );
if ( !l->LinkedSegments() ) if( !l->LinkedSegments() )
return; return;
BOOST_FOREACH( PNS_SEGMENT* seg, *l->LinkedSegments() ) 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; RANGE<int> r;
@ -1116,6 +1116,7 @@ const PNS_LINE PNS_SHOVE::NewHead() const
return *m_newHead; return *m_newHead;
} }
void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial ) void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial )
{ {
m_root = m_root->Branch(); m_root = m_root->Branch();

View File

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

View File

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

View File

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