Commit ad1b138f authored by Maciej Suminski's avatar Maciej Suminski

Reformatted PNS code to conform the coding policy.

parent ebf35fd4
...@@ -209,12 +209,12 @@ public: ...@@ -209,12 +209,12 @@ public:
// we are more horizontal than vertical? // we are more horizontal than vertical?
if( w > h ) if( w > h )
{ {
mp0 = VECTOR2I( (w - h) * sw, 0 ); // direction: E mp0 = VECTOR2I( ( w - h ) * sw, 0 ); // direction: E
mp1 = VECTOR2I( h * sw, h * sh ); // direction: NE mp1 = VECTOR2I( h * sw, h * sh ); // direction: NE
} }
else else
{ {
mp0 = VECTOR2I( 0, sh * (h - w) ); // direction: N mp0 = VECTOR2I( 0, sh * ( h - w ) ); // direction: N
mp1 = VECTOR2I( sw * w, sh * w ); // direction: NE mp1 = VECTOR2I( sw * w, sh * w ); // direction: NE
} }
...@@ -237,7 +237,7 @@ public: ...@@ -237,7 +237,7 @@ public:
pl.Append( aP1 ); pl.Append( aP1 );
pl.Simplify(); pl.Simplify();
return pl; return pl;
}; }
bool operator==( const DIRECTION_45& aOther ) const bool operator==( const DIRECTION_45& aOther ) const
{ {
...@@ -275,19 +275,17 @@ public: ...@@ -275,19 +275,17 @@ public:
{ {
DIRECTION_45 l; DIRECTION_45 l;
if (m_dir == UNDEFINED) if ( m_dir == UNDEFINED )
return l; return l;
if(m_dir == N) if( m_dir == N )
l.m_dir = NW; l.m_dir = NW;
else else
l.m_dir = static_cast<Directions> (m_dir - 1); l.m_dir = static_cast<Directions>( m_dir - 1 );
return l; return l;
} }
/** /**
* Function ToVector() * Function ToVector()
* *
...@@ -295,19 +293,19 @@ public: ...@@ -295,19 +293,19 @@ public:
*/ */
const VECTOR2I ToVector() const const VECTOR2I ToVector() const
{ {
switch(m_dir) switch( m_dir )
{ {
case N: return VECTOR2I(0, 1); case N: return VECTOR2I( 0, 1 );
case S: return VECTOR2I(0, -1); case S: return VECTOR2I( 0, -1 );
case E: return VECTOR2I(1, 0); case E: return VECTOR2I( 1, 0 );
case W: return VECTOR2I(-1, 0); case W: return VECTOR2I( -1, 0 );
case NE: return VECTOR2I(1, 1); case NE: return VECTOR2I( 1, 1 );
case NW: return VECTOR2I(-1, 1); case NW: return VECTOR2I( -1, 1 );
case SE: return VECTOR2I(1, -1); case SE: return VECTOR2I( 1, -1 );
case SW: return VECTOR2I(-1, -1); case SW: return VECTOR2I( -1, -1 );
default: default:
return VECTOR2I(0, 0); return VECTOR2I( 0, 0 );
} }
} }
......
...@@ -33,17 +33,18 @@ class PNS_LOGGER; ...@@ -33,17 +33,18 @@ class PNS_LOGGER;
* Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router instance, logging) * Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router instance, logging)
**/ **/
class PNS_ALGO_BASE { class PNS_ALGO_BASE
{
public: public:
PNS_ALGO_BASE ( PNS_ROUTER *aRouter ): PNS_ALGO_BASE( PNS_ROUTER *aRouter ) :
m_router ( aRouter ) m_router ( aRouter )
{}; {}
virtual ~PNS_ALGO_BASE() {} virtual ~PNS_ALGO_BASE() {}
///> Returns the instance of our router ///> Returns the instance of our router
PNS_ROUTER *Router() const { PNS_ROUTER* Router() const
{
return m_router; return m_router;
} }
...@@ -51,10 +52,10 @@ public: ...@@ -51,10 +52,10 @@ public:
PNS_ROUTING_SETTINGS& Settings() const; PNS_ROUTING_SETTINGS& Settings() const;
///> Returns the logger object, allowing to dump geometry to a file. ///> Returns the logger object, allowing to dump geometry to a file.
virtual PNS_LOGGER *Logger(); virtual PNS_LOGGER* Logger();
private: private:
PNS_ROUTER *m_router; PNS_ROUTER* m_router;
}; };
#endif #endif
...@@ -29,7 +29,8 @@ PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) : ...@@ -29,7 +29,8 @@ PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
{ {
m_world = NULL; m_world = NULL;
m_shove = NULL; m_shove = NULL;
}; }
PNS_DRAGGER::~PNS_DRAGGER() PNS_DRAGGER::~PNS_DRAGGER()
{ {
...@@ -37,97 +38,103 @@ PNS_DRAGGER::~PNS_DRAGGER() ...@@ -37,97 +38,103 @@ PNS_DRAGGER::~PNS_DRAGGER()
delete m_shove; delete m_shove;
} }
void PNS_DRAGGER::SetWorld ( PNS_NODE *aWorld )
void PNS_DRAGGER::SetWorld ( PNS_NODE* aWorld )
{ {
m_world = aWorld; m_world = aWorld;
} }
bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT *aSeg )
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();
if( (aP - aSeg->Seg().A).EuclideanNorm() <= w2 ) if( ( aP - aSeg->Seg().A ).EuclideanNorm() <= w2 )
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;
return true; return true;
} }
bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA *aVia )
bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
{ {
m_draggedVia = aVia; m_draggedVia = aVia;
m_initialVia = aVia; m_initialVia = 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)
l->Reverse();
m_origViaConnections.push_back (*l); if( segIndex != 0 )
l->Reverse();
m_origViaConnections.push_back( *l );
} }
} }
return true; return true;
} }
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;
} }
} }
bool PNS_DRAGGER::dragMarkObstacles(const VECTOR2I& aP)
bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
{ {
if(m_lastNode) if( m_lastNode )
{ {
delete m_lastNode; delete m_lastNode;
m_lastNode = NULL; m_lastNode = NULL;
} }
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 );
...@@ -143,17 +150,17 @@ bool PNS_DRAGGER::dragMarkObstacles(const VECTOR2I& aP) ...@@ -143,17 +150,17 @@ bool PNS_DRAGGER::dragMarkObstacles(const VECTOR2I& aP)
break; break;
} }
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;
} }
} }
if (Settings().CanViolateDRC()) if( Settings().CanViolateDRC() )
m_dragStatus = true; m_dragStatus = true;
else else
m_dragStatus = !m_world->CheckColliding( m_draggedItems ); m_dragStatus = !m_world->CheckColliding( m_draggedItems );
...@@ -161,60 +168,62 @@ bool PNS_DRAGGER::dragMarkObstacles(const VECTOR2I& aP) ...@@ -161,60 +168,62 @@ bool PNS_DRAGGER::dragMarkObstacles(const VECTOR2I& aP)
return true; return true;
} }
void PNS_DRAGGER::dumbDragVia ( PNS_VIA *aVia, PNS_NODE *aNode, const VECTOR2I& aP )
void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP )
{ {
// fixme: this is awful. // fixme: this is awful.
m_draggedVia = aVia->Clone(); m_draggedVia = aVia->Clone();
m_draggedVia->SetPos( aP ); m_draggedVia->SetPos( aP );
m_draggedItems.Clear(); m_draggedItems.Clear();
m_draggedItems.Add(m_draggedVia); m_draggedItems.Add( m_draggedVia );
m_lastNode->Remove ( aVia ); m_lastNode->Remove( aVia );
m_lastNode->Add ( m_draggedVia ); m_lastNode->Add( m_draggedVia );
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 );
draggedLine->ClearSegmentLinks(); draggedLine->ClearSegmentLinks();
m_draggedItems.AddOwned( draggedLine ); m_draggedItems.AddOwned( draggedLine );
m_lastNode->Remove ( &origLine ); m_lastNode->Remove( &origLine );
m_lastNode->Add ( draggedLine ); m_lastNode->Add( draggedLine );
} }
} }
bool PNS_DRAGGER::dragShove(const VECTOR2I& aP)
bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
{ {
bool ok = false; bool ok = false;
if(m_lastNode) if( m_lastNode )
{ {
delete m_lastNode; delete m_lastNode;
m_lastNode = NULL; m_lastNode = NULL;
} }
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)
tmp.DragSegment ( aP, m_draggedSegmentIndex, thresh ); if( m_mode == SEGMENT )
tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
else else
tmp.DragCorner ( aP, m_draggedSegmentIndex, thresh ); tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
PNS_SHOVE::ShoveStatus 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();
ok = true; ok = true;
...@@ -222,22 +231,23 @@ bool PNS_DRAGGER::dragShove(const VECTOR2I& aP) ...@@ -222,22 +231,23 @@ bool PNS_DRAGGER::dragShove(const VECTOR2I& aP)
m_lastNode = m_shove->CurrentNode()->Branch(); m_lastNode = m_shove->CurrentNode()->Branch();
if(ok) if( ok )
m_lastValidDraggedLine = tmp; m_lastValidDraggedLine = tmp;
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;
} }
case VIA: case VIA:
{ {
PNS_VIA *newVia; PNS_VIA *newVia;
PNS_SHOVE::ShoveStatus 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 )
ok = true; ok = true;
m_lastNode = m_shove->CurrentNode()->Branch(); m_lastNode = m_shove->CurrentNode()->Branch();
...@@ -250,16 +260,17 @@ bool PNS_DRAGGER::dragShove(const VECTOR2I& aP) ...@@ -250,16 +260,17 @@ bool PNS_DRAGGER::dragShove(const VECTOR2I& aP)
break; break;
} }
} }
m_dragStatus = ok; m_dragStatus = ok;
return ok; return ok;
} }
bool PNS_DRAGGER::FixRoute( )
bool PNS_DRAGGER::FixRoute()
{ {
if(m_dragStatus) if( m_dragStatus )
{ {
Router()->CommitRouting( CurrentNode() ); Router()->CommitRouting( CurrentNode() );
return true; return true;
...@@ -267,35 +278,42 @@ bool PNS_DRAGGER::FixRoute( ) ...@@ -267,35 +278,42 @@ bool PNS_DRAGGER::FixRoute( )
return false; return false;
} }
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;
} }
const PNS_ITEMSET PNS_DRAGGER::Traces() const PNS_ITEMSET PNS_DRAGGER::Traces()
{ {
return m_draggedItems; return m_draggedItems;
} }
PNS_LOGGER *PNS_DRAGGER::Logger()
PNS_LOGGER* PNS_DRAGGER::Logger()
{ {
if(m_shove) if( m_shove )
return m_shove->Logger(); return m_shove->Logger();
return NULL; return NULL;
} }
...@@ -39,12 +39,10 @@ class PNS_ROUTER_BASE; ...@@ -39,12 +39,10 @@ class PNS_ROUTER_BASE;
* *
* Via, segment and corner dragging algorithm. * Via, segment and corner dragging algorithm.
*/ */
class PNS_DRAGGER : public PNS_ALGO_BASE class PNS_DRAGGER : public PNS_ALGO_BASE
{ {
public: public:
PNS_DRAGGER( PNS_ROUTER* aRouter );
PNS_DRAGGER( PNS_ROUTER *aRouter );
~PNS_DRAGGER(); ~PNS_DRAGGER();
/** /**
...@@ -52,8 +50,7 @@ public: ...@@ -52,8 +50,7 @@ public:
* *
* Sets the board to work on. * Sets the board to work on.
*/ */
void SetWorld ( PNS_NODE *aWorld ); void SetWorld( PNS_NODE* aWorld );
/** /**
* Function Start() * Function Start()
...@@ -61,7 +58,7 @@ public: ...@@ -61,7 +58,7 @@ public:
* Starts routing a single track at point aP, taking item aStartItem as anchor * Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL). Returns true if a dragging operation has started. * (unless NULL). Returns true if a dragging operation has started.
*/ */
bool Start ( const VECTOR2I& aP, PNS_ITEM* aStartItem ); bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
/** /**
* Function Drag() * Function Drag()
...@@ -69,7 +66,7 @@ public: ...@@ -69,7 +66,7 @@ public:
* Drags the current segment/corner/via to the point aP. * Drags the current segment/corner/via to the point aP.
* @return true, if dragging finished with success. * @return true, if dragging finished with success.
*/ */
bool Drag ( const VECTOR2I& aP ); bool Drag( const VECTOR2I& aP );
/** /**
* Function FixRoute() * Function FixRoute()
...@@ -78,7 +75,7 @@ public: ...@@ -78,7 +75,7 @@ public:
* and eventually commits it to the world. * and eventually commits it to the world.
* @return true, if dragging finished with success. * @return true, if dragging finished with success.
*/ */
bool FixRoute ( ); bool FixRoute();
/** /**
* Function CurrentNode() * Function CurrentNode()
...@@ -86,7 +83,6 @@ public: ...@@ -86,7 +83,6 @@ public:
* Returns the most recent world state, including all * Returns the most recent world state, including all
* items changed due to dragging operation. * items changed due to dragging operation.
*/ */
PNS_NODE* CurrentNode() const; PNS_NODE* CurrentNode() const;
/** /**
...@@ -97,11 +93,10 @@ public: ...@@ -97,11 +93,10 @@ public:
const PNS_ITEMSET Traces(); const PNS_ITEMSET Traces();
/// @copydoc PNS_ALGO_BASE::Logger() /// @copydoc PNS_ALGO_BASE::Logger()
virtual PNS_LOGGER *Logger(); virtual PNS_LOGGER* Logger();
private: private:
typedef std::pair<PNS_LINE *, PNS_LINE *> LinePair;
typedef std::pair <PNS_LINE *, PNS_LINE *> LinePair;
typedef std::vector<LinePair> LinePairVec; typedef std::vector<LinePair> LinePairVec;
enum DragMode { enum DragMode {
...@@ -110,26 +105,26 @@ private: ...@@ -110,26 +105,26 @@ private:
VIA VIA
}; };
bool dragMarkObstacles(const VECTOR2I& aP); bool dragMarkObstacles( const VECTOR2I& aP );
bool dragShove(const VECTOR2I& aP); bool dragShove(const VECTOR2I& aP );
bool startDragSegment( const VECTOR2D& aP, PNS_SEGMENT *aSeg ); bool startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg );
bool startDragVia( const VECTOR2D& aP, PNS_VIA *aVia ); bool startDragVia( const VECTOR2D& aP, PNS_VIA* aVia );
void dumbDragVia ( PNS_VIA *aVia, PNS_NODE *aNode, const VECTOR2I& aP ); void dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP );
PNS_NODE * m_world; PNS_NODE* m_world;
PNS_NODE * m_lastNode; PNS_NODE* m_lastNode;
DragMode m_mode; DragMode m_mode;
PNS_LINE * m_draggedLine; PNS_LINE* m_draggedLine;
PNS_VIA * m_draggedVia; PNS_VIA* m_draggedVia;
PNS_LINE m_lastValidDraggedLine; PNS_LINE m_lastValidDraggedLine;
PNS_SHOVE * m_shove; PNS_SHOVE* m_shove;
int m_draggedSegmentIndex; int m_draggedSegmentIndex;
bool m_dragStatus; bool m_dragStatus;
PNS_MODE m_currentMode; PNS_MODE m_currentMode;
std::vector<PNS_LINE> m_origViaConnections; std::vector<PNS_LINE> m_origViaConnections;
std::vector<PNS_LINE> m_draggedViaConnections; std::vector<PNS_LINE> m_draggedViaConnections;
PNS_VIA * m_initialVia; PNS_VIA* m_initialVia;
PNS_ITEMSET m_draggedItems; PNS_ITEMSET m_draggedItems;
}; };
#endif #endif
...@@ -39,13 +39,12 @@ ...@@ -39,13 +39,12 @@
* are assigned to separate R-Tree subindices depending on their type and spanned layers, reducing * are assigned to separate R-Tree subindices depending on their type and spanned layers, reducing
* overlap and improving search time. * overlap and improving search time.
**/ **/
class PNS_INDEX class PNS_INDEX
{ {
public: public:
typedef std::list<PNS_ITEM*> NetItemsList; typedef std::list<PNS_ITEM*> NET_ITEMS_LIST;
typedef SHAPE_INDEX<PNS_ITEM*> ItemShapeIndex; typedef SHAPE_INDEX<PNS_ITEM*> ITEM_SHAPE_INDEX;
typedef boost::unordered_set<PNS_ITEM*> ItemSet; typedef boost::unordered_set<PNS_ITEM*> ITEM_SET;
PNS_INDEX(); PNS_INDEX();
~PNS_INDEX(); ~PNS_INDEX();
...@@ -115,7 +114,7 @@ public: ...@@ -115,7 +114,7 @@ public:
* *
* Returns list of all items in a given net. * Returns list of all items in a given net.
*/ */
NetItemsList* GetItemsForNet( int aNet ); NET_ITEMS_LIST* GetItemsForNet( int aNet );
/** /**
* Function Contains() * Function Contains()
...@@ -134,36 +133,35 @@ public: ...@@ -134,36 +133,35 @@ public:
*/ */
int Size() const { return m_allItems.size(); } int Size() const { return m_allItems.size(); }
ItemSet::iterator begin() { return m_allItems.begin(); } ITEM_SET::iterator begin() { return m_allItems.begin(); }
ItemSet::iterator end() { return m_allItems.end(); } ITEM_SET::iterator end() { return m_allItems.end(); }
private: private:
static const int MaxSubIndices = 64; static const int MaxSubIndices = 64;
static const int SI_Multilayer = 2; static const int SI_Multilayer = 2;
static const int SI_SegDiagonal = 0; static const int SI_SegDiagonal = 0;
static const int SI_SegStraight = 1; static const int SI_SegStraight = 1;
static const int SI_Traces = 3; static const int SI_Traces = 3;
static const int SI_PadsTop = 0; static const int SI_PadsTop = 0;
static const int SI_PadsBottom = 1; static const int SI_PadsBottom = 1;
template <class Visitor> template <class Visitor>
int querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ); int querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor );
ItemShapeIndex* getSubindex( const PNS_ITEM* aItem ); ITEM_SHAPE_INDEX* getSubindex( const PNS_ITEM* aItem );
ItemShapeIndex* m_subIndices[MaxSubIndices]; ITEM_SHAPE_INDEX* m_subIndices[MaxSubIndices];
std::map<int, NetItemsList> m_netMap; std::map<int, NET_ITEMS_LIST> m_netMap;
ItemSet m_allItems; ITEM_SET m_allItems;
}; };
PNS_INDEX::PNS_INDEX() PNS_INDEX::PNS_INDEX()
{ {
memset( m_subIndices, 0, sizeof( m_subIndices ) ); memset( m_subIndices, 0, sizeof( m_subIndices ) );
} }
PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem ) PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
{ {
int idx_n = -1; int idx_n = -1;
...@@ -199,7 +197,7 @@ PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem ) ...@@ -199,7 +197,7 @@ PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
assert( idx_n >= 0 && idx_n < MaxSubIndices ); assert( idx_n >= 0 && idx_n < MaxSubIndices );
if( !m_subIndices[idx_n] ) if( !m_subIndices[idx_n] )
m_subIndices[idx_n] = new ItemShapeIndex; m_subIndices[idx_n] = new ITEM_SHAPE_INDEX;
return m_subIndices[idx_n]; return m_subIndices[idx_n];
} }
...@@ -207,10 +205,8 @@ PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem ) ...@@ -207,10 +205,8 @@ PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
void PNS_INDEX::Add( PNS_ITEM* aItem ) void PNS_INDEX::Add( PNS_ITEM* aItem )
{ {
ItemShapeIndex* idx = getSubindex( aItem ); ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
idx->Add( aItem ); idx->Add( aItem );
m_allItems.insert( aItem ); m_allItems.insert( aItem );
int net = aItem->Net(); int net = aItem->Net();
...@@ -224,7 +220,7 @@ void PNS_INDEX::Add( PNS_ITEM* aItem ) ...@@ -224,7 +220,7 @@ void PNS_INDEX::Add( PNS_ITEM* aItem )
void PNS_INDEX::Remove( PNS_ITEM* aItem ) void PNS_INDEX::Remove( PNS_ITEM* aItem )
{ {
ItemShapeIndex* idx = getSubindex( aItem ); ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
idx->Remove( aItem ); idx->Remove( aItem );
m_allItems.erase( aItem ); m_allItems.erase( aItem );
...@@ -303,7 +299,7 @@ void PNS_INDEX::Clear() ...@@ -303,7 +299,7 @@ void PNS_INDEX::Clear()
{ {
for( int i = 0; i < MaxSubIndices; ++i ) for( int i = 0; i < MaxSubIndices; ++i )
{ {
ItemShapeIndex* idx = m_subIndices[i]; ITEM_SHAPE_INDEX* idx = m_subIndices[i];
if( idx ) if( idx )
delete idx; delete idx;
...@@ -319,7 +315,7 @@ PNS_INDEX::~PNS_INDEX() ...@@ -319,7 +315,7 @@ PNS_INDEX::~PNS_INDEX()
} }
PNS_INDEX::NetItemsList* PNS_INDEX::GetItemsForNet( int aNet ) PNS_INDEX::NET_ITEMS_LIST* PNS_INDEX::GetItemsForNet( int aNet )
{ {
if( m_netMap.find( aNet ) == m_netMap.end() ) if( m_netMap.find( aNet ) == m_netMap.end() )
return NULL; return NULL;
......
...@@ -50,8 +50,7 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, ...@@ -50,8 +50,7 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
const PNS_LINE* line = static_cast<const PNS_LINE*>( aOther ); const PNS_LINE* line = static_cast<const PNS_LINE*>( aOther );
if( line->EndsWithVia() ) if( line->EndsWithVia() )
return collideSimple( &line->Via(), aClearance - line->Width() / 2, aNeedMTV, return collideSimple( &line->Via(), aClearance - line->Width() / 2, aNeedMTV, aMTV );
aMTV );
} }
return false; return false;
...@@ -85,5 +84,4 @@ const std::string PNS_ITEM::KindStr() const ...@@ -85,5 +84,4 @@ const std::string PNS_ITEM::KindStr() const
PNS_ITEM::~PNS_ITEM() PNS_ITEM::~PNS_ITEM()
{ {
} }
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
* *
* Returns a deep copy of the item * Returns a deep copy of the item
*/ */
virtual PNS_ITEM* Clone( ) const = 0; virtual PNS_ITEM* Clone() const = 0;
/* /*
* Function Hull() * Function Hull()
...@@ -104,7 +104,7 @@ public: ...@@ -104,7 +104,7 @@ public:
virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const
{ {
return SHAPE_LINE_CHAIN(); return SHAPE_LINE_CHAIN();
}; }
/** /**
* Function Kind() * Function Kind()
...@@ -123,7 +123,7 @@ public: ...@@ -123,7 +123,7 @@ public:
*/ */
bool OfKind( int aKindMask ) const bool OfKind( int aKindMask ) const
{ {
return (aKindMask & m_kind) != 0; return ( aKindMask & m_kind ) != 0;
} }
/** /**
...@@ -219,7 +219,7 @@ public: ...@@ -219,7 +219,7 @@ public:
* Returns true if the set of layers spanned by aOther overlaps our * Returns true if the set of layers spanned by aOther overlaps our
* layers. * layers.
*/ */
bool LayersOverlap( const PNS_ITEM *aOther ) const bool LayersOverlap( const PNS_ITEM* aOther ) const
{ {
return Layers().Overlaps( aOther->Layers() ); return Layers().Overlaps( aOther->Layers() );
} }
...@@ -252,7 +252,6 @@ public: ...@@ -252,7 +252,6 @@ public:
*/ */
PNS_NODE* Owner() const { return m_owner; } PNS_NODE* Owner() const { return m_owner; }
/** /**
* Function Collide() * Function Collide()
* *
...@@ -308,7 +307,7 @@ public: ...@@ -308,7 +307,7 @@ public:
return m_marker; return m_marker;
} }
virtual void SetRank ( int aRank ) virtual void SetRank( int aRank )
{ {
m_rank = aRank; m_rank = aRank;
} }
...@@ -318,10 +317,10 @@ public: ...@@ -318,10 +317,10 @@ public:
return m_rank; return m_rank;
} }
virtual VECTOR2I Anchor(int n) const virtual VECTOR2I Anchor( int n ) const
{ {
return VECTOR2I (); return VECTOR2I ();
}; }
virtual int AnchorCount() const virtual int AnchorCount() const
{ {
...@@ -329,15 +328,14 @@ public: ...@@ -329,15 +328,14 @@ public:
} }
private: private:
bool collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, bool collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
VECTOR2I& aMTV ) const; VECTOR2I& aMTV ) const;
protected: protected:
PnsKind m_kind; PnsKind m_kind;
BOARD_CONNECTED_ITEM *m_parent; BOARD_CONNECTED_ITEM* m_parent;
PNS_NODE *m_owner; PNS_NODE* m_owner;
PNS_LAYERSET m_layers; PNS_LAYERSET m_layers;
bool m_movable; bool m_movable;
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#include "pns_itemset.h" #include "pns_itemset.h"
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);
...@@ -38,7 +37,7 @@ PNS_ITEMSET::~PNS_ITEMSET() ...@@ -38,7 +37,7 @@ PNS_ITEMSET::~PNS_ITEMSET()
void PNS_ITEMSET::Clear() void PNS_ITEMSET::Clear()
{ {
BOOST_FOREACH(PNS_ITEM *item, m_ownedItems) BOOST_FOREACH(PNS_ITEM* item, m_ownedItems)
{ {
delete item; delete item;
} }
...@@ -47,9 +46,10 @@ void PNS_ITEMSET::Clear() ...@@ -47,9 +46,10 @@ void PNS_ITEMSET::Clear()
m_ownedItems.clear(); m_ownedItems.clear();
} }
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd ) PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
{ {
ItemVector newItems; ITEM_VECTOR newItems;
PNS_LAYERSET l; PNS_LAYERSET l;
if( aEnd < 0 ) if( aEnd < 0 )
...@@ -57,39 +57,44 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd ) ...@@ -57,39 +57,44 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
else else
l = PNS_LAYERSET( aStart, aEnd ); l = PNS_LAYERSET( aStart, aEnd );
BOOST_FOREACH( PNS_ITEM * item, m_items ) BOOST_FOREACH( PNS_ITEM* item, m_items )
if( item->Layers().Overlaps( l ) ) if( item->Layers().Overlaps( l ) )
newItems.push_back( item ); newItems.push_back( item );
m_items = newItems; m_items = newItems;
return *this; return *this;
} }
PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask ) PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask )
{ {
ItemVector newItems; ITEM_VECTOR newItems;
BOOST_FOREACH( PNS_ITEM * item, m_items )
if( item->OfKind ( aKindMask ) ) BOOST_FOREACH( PNS_ITEM* item, m_items )
newItems.push_back( item ); {
if( item->OfKind ( aKindMask ) )
newItems.push_back( item );
}
m_items = newItems; m_items = newItems;
return *this; return *this;
} }
PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet ) PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet )
{ {
ItemVector newItems; ITEM_VECTOR newItems;
BOOST_FOREACH( PNS_ITEM * item, m_items )
if( item->Net() == aNet ) BOOST_FOREACH( PNS_ITEM* item, m_items )
newItems.push_back( item ); {
if( item->Net() == aNet )
newItems.push_back( item );
}
m_items = newItems; m_items = newItems;
return *this; return *this;
} }
...@@ -35,27 +35,28 @@ ...@@ -35,27 +35,28 @@
class PNS_ITEMSET class PNS_ITEMSET
{ {
public: public:
typedef std::vector<PNS_ITEM*> ItemVector; typedef std::vector<PNS_ITEM*> ITEM_VECTOR;
PNS_ITEMSET( PNS_ITEM *aInitialItem = NULL ); PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL );
PNS_ITEMSET (const PNS_ITEMSET &aOther ) PNS_ITEMSET( const PNS_ITEMSET& aOther )
{ {
m_items = aOther.m_items; m_items = aOther.m_items;
m_ownedItems = ItemVector(); m_ownedItems = ITEM_VECTOR();
} }
const PNS_ITEMSET& operator= (const PNS_ITEMSET &aOther) const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther )
{ {
m_items = aOther.m_items; m_items = aOther.m_items;
m_ownedItems = ItemVector(); m_ownedItems = ITEM_VECTOR();
return *this; return *this;
} }
~PNS_ITEMSET(); ~PNS_ITEMSET();
ItemVector& Items() { return m_items; } ITEM_VECTOR& Items() { return m_items; }
const ItemVector& CItems() const { return m_items; } const ITEM_VECTOR& CItems() const { return m_items; }
PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1 ); PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1 );
PNS_ITEMSET& FilterKinds( int aKindMask ); PNS_ITEMSET& FilterKinds( int aKindMask );
...@@ -63,24 +64,24 @@ public: ...@@ -63,24 +64,24 @@ public:
int Size() { return m_items.size(); } int Size() { return m_items.size(); }
void Add( PNS_ITEM* item ) void Add( PNS_ITEM* aItem )
{ {
m_items.push_back( item ); m_items.push_back( aItem );
} }
PNS_ITEM* Get( int index ) const { return m_items[index]; } PNS_ITEM* Get( int index ) const { return m_items[index]; }
void Clear(); void Clear();
void AddOwned ( PNS_ITEM *aItem ) void AddOwned( PNS_ITEM *aItem )
{ {
m_items.push_back( aItem ); m_items.push_back( aItem );
m_ownedItems.push_back( aItem ); m_ownedItems.push_back( aItem );
} }
private: private:
ItemVector m_items; ITEM_VECTOR m_items;
ItemVector m_ownedItems; ITEM_VECTOR m_ownedItems;
}; };
#endif #endif
...@@ -40,11 +40,11 @@ ...@@ -40,11 +40,11 @@
class PNS_JOINT : public PNS_ITEM class PNS_JOINT : public PNS_ITEM
{ {
public: public:
typedef std::vector<PNS_ITEM*> LinkedItems; typedef std::vector<PNS_ITEM*> LINKED_ITEMS;
///> Joints are hashed by their position, layers and net. ///> Joints are hashed by their position, layers and net.
/// Linked items are, obviously, not hashed /// Linked items are, obviously, not hashed
struct HashTag struct HASH_TAG
{ {
VECTOR2I pos; VECTOR2I pos;
int net; int net;
...@@ -53,8 +53,7 @@ public: ...@@ -53,8 +53,7 @@ public:
PNS_JOINT() : PNS_JOINT() :
PNS_ITEM( JOINT ) {} PNS_ITEM( JOINT ) {}
PNS_JOINT( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, PNS_JOINT( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aNet = -1 ) :
int aNet = -1 ) :
PNS_ITEM( JOINT ) PNS_ITEM( JOINT )
{ {
m_tag.pos = aPos; m_tag.pos = aPos;
...@@ -62,14 +61,14 @@ public: ...@@ -62,14 +61,14 @@ public:
m_layers = aLayers; m_layers = aLayers;
} }
PNS_JOINT( const PNS_JOINT& b ) : PNS_JOINT( const PNS_JOINT& aB ) :
PNS_ITEM( JOINT ) PNS_ITEM( JOINT )
{ {
m_layers = b.m_layers; m_layers = aB.m_layers;
m_tag.pos = b.m_tag.pos; m_tag.pos = aB.m_tag.pos;
m_tag.net = b.m_tag.net; m_tag.net = aB.m_tag.net;
m_linkedItems = b.m_linkedItems; m_linkedItems = aB.m_linkedItems;
m_layers = b.m_layers; m_layers = aB.m_layers;
} }
PNS_ITEM* Clone ( ) const PNS_ITEM* Clone ( ) const
...@@ -85,8 +84,7 @@ public: ...@@ -85,8 +84,7 @@ public:
if( m_linkedItems.size() != 2 ) if( m_linkedItems.size() != 2 )
return false; return false;
if( m_linkedItems[0]->Kind() != SEGMENT || if( m_linkedItems[0]->Kind() != SEGMENT || m_linkedItems[1]->Kind() != SEGMENT )
m_linkedItems[1]->Kind() != SEGMENT )
return false; return false;
PNS_SEGMENT* seg1 = static_cast<PNS_SEGMENT*>( m_linkedItems[0] ); PNS_SEGMENT* seg1 = static_cast<PNS_SEGMENT*>( m_linkedItems[0] );
...@@ -99,8 +97,7 @@ public: ...@@ -99,8 +97,7 @@ 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 )
{ {
LinkedItems::iterator f = std::find( m_linkedItems.begin(), LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem );
m_linkedItems.end(), aItem );
if( f != m_linkedItems.end() ) if( f != m_linkedItems.end() )
return; return;
...@@ -112,8 +109,7 @@ public: ...@@ -112,8 +109,7 @@ public:
///> 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 )
{ {
LinkedItems::iterator f = std::find( m_linkedItems.begin(), LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem );
m_linkedItems.end(), aItem );
if( f != m_linkedItems.end() ) if( f != m_linkedItems.end() )
m_linkedItems.erase( f ); m_linkedItems.erase( f );
...@@ -131,17 +127,19 @@ public: ...@@ -131,17 +127,19 @@ public:
return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] ); return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
} }
PNS_VIA *Via() PNS_VIA* Via()
{ {
for( LinkedItems::iterator i = m_linkedItems.begin(); for( LINKED_ITEMS::iterator i = m_linkedItems.begin(); i != m_linkedItems.end(); ++i )
i != m_linkedItems.end(); ++i ) {
if( (*i)->Kind() == PNS_ITEM::VIA ) if( (*i)->Kind() == PNS_ITEM::VIA )
return (PNS_VIA *)(*i); return (PNS_VIA*)( *i );
}
return NULL; return NULL;
} }
/// trivial accessors /// trivial accessors
const HashTag& Tag() const const HASH_TAG& Tag() const
{ {
return m_tag; return m_tag;
} }
...@@ -156,7 +154,7 @@ public: ...@@ -156,7 +154,7 @@ public:
return m_tag.net; return m_tag.net;
} }
LinkedItems& LinkList() LINKED_ITEMS& LinkList()
{ {
return m_linkedItems; return m_linkedItems;
} }
...@@ -166,10 +164,12 @@ public: ...@@ -166,10 +164,12 @@ public:
{ {
int n = 0; int n = 0;
for( LinkedItems::const_iterator i = m_linkedItems.begin(); for( LINKED_ITEMS::const_iterator i = m_linkedItems.begin();
i != m_linkedItems.end(); ++i ) i != m_linkedItems.end(); ++i )
{
if( (*i)->Kind() & aMask ) if( (*i)->Kind() & aMask )
n++; n++;
}
return n; return n;
} }
...@@ -189,9 +189,11 @@ public: ...@@ -189,9 +189,11 @@ public:
m_layers.Merge( aJoint.m_layers ); m_layers.Merge( aJoint.m_layers );
// fixme: duplicate links (?) // fixme: duplicate links (?)
for( LinkedItems::const_iterator i = aJoint.m_linkedItems.begin(); for( LINKED_ITEMS::const_iterator i = aJoint.m_linkedItems.begin();
i != aJoint.m_linkedItems.end(); ++i ) i != aJoint.m_linkedItems.end(); ++i )
{
m_linkedItems.push_back( *i ); m_linkedItems.push_back( *i );
}
} }
bool Overlaps( const PNS_JOINT& rhs ) const bool Overlaps( const PNS_JOINT& rhs ) const
...@@ -202,27 +204,27 @@ public: ...@@ -202,27 +204,27 @@ public:
private: private:
///> hash tag for unordered_multimap ///> hash tag for unordered_multimap
HashTag m_tag; HASH_TAG m_tag;
///> list of items linked to this joint ///> list of items linked to this joint
LinkedItems m_linkedItems; LINKED_ITEMS m_linkedItems;
}; };
// hash function & comparison operator for boost::unordered_map<> // hash function & comparison operator for boost::unordered_map<>
inline bool operator==( PNS_JOINT::HashTag const& p1, inline bool operator==( PNS_JOINT::HASH_TAG const& aP1,
PNS_JOINT::HashTag const& p2 ) PNS_JOINT::HASH_TAG const& aP2 )
{ {
return p1.pos == p2.pos && p1.net == p2.net; return aP1.pos == aP2.pos && aP1.net == aP2.net;
} }
inline std::size_t hash_value( PNS_JOINT::HashTag const& p ) inline std::size_t hash_value( PNS_JOINT::HASH_TAG const& aP )
{ {
std::size_t seed = 0; std::size_t seed = 0;
boost::hash_combine( seed, p.pos.x ); boost::hash_combine( seed, aP.pos.x );
boost::hash_combine( seed, p.pos.y ); boost::hash_combine( seed, aP.pos.y );
boost::hash_combine( seed, p.net ); boost::hash_combine( seed, aP.net );
return seed; return seed;
} }
......
...@@ -50,17 +50,17 @@ public: ...@@ -50,17 +50,17 @@ public:
m_start = m_end = aLayer; m_start = m_end = aLayer;
} }
PNS_LAYERSET( const PNS_LAYERSET& b ) : PNS_LAYERSET( const PNS_LAYERSET& aB ) :
m_start( b.m_start ), m_start( aB.m_start ),
m_end( b.m_end ) m_end( aB.m_end )
{} {}
~PNS_LAYERSET() {}; ~PNS_LAYERSET() {};
const PNS_LAYERSET& operator=( const PNS_LAYERSET& b ) const PNS_LAYERSET& operator=( const PNS_LAYERSET& aB )
{ {
m_start = b.m_start; m_start = aB.m_start;
m_end = b.m_end; m_end = aB.m_end;
return *this; return *this;
} }
......
This diff is collapsed.
...@@ -57,19 +57,18 @@ class PNS_VIA; ...@@ -57,19 +57,18 @@ class PNS_VIA;
class PNS_LINE : public PNS_ITEM class PNS_LINE : public PNS_ITEM
{ {
public: public:
typedef std::vector<PNS_SEGMENT*> SegmentRefs; typedef std::vector<PNS_SEGMENT*> SEGMENT_REFS;
/** /**
* Constructor * Constructor
* Makes an empty line. * Makes an empty line.
*/ */
PNS_LINE() : PNS_ITEM (LINE) PNS_LINE() : PNS_ITEM( LINE )
{ {
m_segmentRefs = NULL; m_segmentRefs = NULL;
m_hasVia = false; m_hasVia = false;
} }
PNS_LINE( const PNS_LINE& aOther ) ; PNS_LINE( const PNS_LINE& aOther ) ;
/** /**
...@@ -77,7 +76,6 @@ public: ...@@ -77,7 +76,6 @@ public:
* Copies properties (net, layers, etc.) from a base line and replaces the shape * Copies properties (net, layers, etc.) from a base line and replaces the shape
* by another * by another
**/ **/
PNS_LINE( const PNS_LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) : PNS_LINE( const PNS_LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) :
PNS_ITEM( aBase ), PNS_ITEM( aBase ),
m_line( aLine ), m_line( aLine ),
...@@ -92,12 +90,12 @@ public: ...@@ -92,12 +90,12 @@ public:
~PNS_LINE(); ~PNS_LINE();
/// @copydoc PNS_ITEM::Clone() /// @copydoc PNS_ITEM::Clone()
virtual PNS_LINE* Clone( ) const; virtual PNS_LINE* Clone() const;
const PNS_LINE& operator= (const PNS_LINE& aOther); const PNS_LINE& operator=( const PNS_LINE& aOther );
///> Assigns a shape to the line (a polyline/line chain) ///> Assigns a shape to the line (a polyline/line chain)
void SetShape ( const SHAPE_LINE_CHAIN& aLine ) void SetShape( const SHAPE_LINE_CHAIN& aLine )
{ {
m_line = aLine; m_line = aLine;
} }
...@@ -135,13 +133,13 @@ public: ...@@ -135,13 +133,13 @@ public:
///> Returns the aIdx-th point of the line ///> Returns the aIdx-th point of the line
const VECTOR2I& CPoint( int aIdx ) const const VECTOR2I& CPoint( int aIdx ) const
{ {
return m_line.CPoint(aIdx); return m_line.CPoint( aIdx );
} }
///> Returns the aIdx-th segment of the line ///> Returns the aIdx-th segment of the line
const SEG CSegment (int aIdx ) const const SEG CSegment( int aIdx ) const
{ {
return m_line.CSegment(aIdx); return m_line.CSegment( aIdx );
} }
///> Sets line width ///> Sets line width
...@@ -169,14 +167,14 @@ public: ...@@ -169,14 +167,14 @@ public:
void LinkSegment( PNS_SEGMENT* aSeg ) void LinkSegment( PNS_SEGMENT* aSeg )
{ {
if( !m_segmentRefs ) if( !m_segmentRefs )
m_segmentRefs = new SegmentRefs(); m_segmentRefs = new SEGMENT_REFS();
m_segmentRefs->push_back( aSeg ); m_segmentRefs->push_back( aSeg );
} }
///> Returns the list of segments from the owning node that constitute this ///> Returns the list of segments from the owning node that constitute this
///> line (or NULL if the line is not linked) ///> line (or NULL if the line is not linked)
SegmentRefs* LinkedSegments() SEGMENT_REFS* LinkedSegments()
{ {
return m_segmentRefs; return m_segmentRefs;
} }
...@@ -195,9 +193,11 @@ public: ...@@ -195,9 +193,11 @@ public:
void ClearSegmentLinks(); void ClearSegmentLinks();
///> Returns the number of segments that were assembled together to form this line. ///> Returns the number of segments that were assembled together to form this line.
int LinkCount() const { int LinkCount() const
if(!m_segmentRefs) {
if( !m_segmentRefs )
return -1; return -1;
return m_segmentRefs->size(); return m_segmentRefs->size();
} }
...@@ -208,7 +208,6 @@ public: ...@@ -208,7 +208,6 @@ public:
///> Clips the line to a given range of vertices. ///> Clips the line to a given range of vertices.
void ClipVertexRange ( int aStart, int aEnd ); void ClipVertexRange ( int aStart, int aEnd );
///> Returns the number of corners of angles specified by mask aAngles. ///> Returns the number of corners of angles specified by mask aAngles.
int CountCorners( int aAngles ); int CountCorners( int aAngles );
...@@ -218,12 +217,11 @@ public: ...@@ -218,12 +217,11 @@ public:
///> aWalkaroundPath = path around the obstacle ///> aWalkaroundPath = path around the obstacle
///> aPostPath = past from obstacle till the end ///> aPostPath = past from obstacle till the end
///> aCW = whether to walk around in clockwise or counter-clockwise direction. ///> aCW = whether to walk around in clockwise or counter-clockwise direction.
bool Walkaround( SHAPE_LINE_CHAIN aObstacle,
bool Walkaround( SHAPE_LINE_CHAIN obstacle, SHAPE_LINE_CHAIN& aPre,
SHAPE_LINE_CHAIN& pre, SHAPE_LINE_CHAIN& aWalk,
SHAPE_LINE_CHAIN& walk, SHAPE_LINE_CHAIN& aPost,
SHAPE_LINE_CHAIN& post, bool aCw ) const;
bool cw ) const;
void Walkaround( const SHAPE_LINE_CHAIN& aObstacle, void Walkaround( const SHAPE_LINE_CHAIN& aObstacle,
SHAPE_LINE_CHAIN& aPath, SHAPE_LINE_CHAIN& aPath,
...@@ -241,29 +239,31 @@ public: ...@@ -241,29 +239,31 @@ public:
const PNS_VIA& Via() const { return m_via; } const PNS_VIA& Via() const { return m_via; }
virtual void Mark(int aMarker); virtual void Mark( int aMarker );
virtual void Unmark (); virtual void Unmark ();
virtual int Marker() const; virtual int Marker() const;
void DragSegment ( const VECTOR2I& aP, int aIndex, int aSnappingThreshold = 0 ); void DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold = 0 );
void DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThreshold = 0 ); void DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshold = 0 );
void SetRank ( int aRank ); void SetRank( int aRank );
int Rank() const; int Rank() const;
bool HasLoops() const; bool HasLoops() const;
private: private:
VECTOR2I snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP,
int aIndex, int aThreshold) const;
VECTOR2I snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const; VECTOR2I snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP,
VECTOR2I snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP, int aIndex, int aThreshold ) const; int aIndex, int aThreshold ) const;
///> Copies m_segmentRefs from the line aParent. ///> Copies m_segmentRefs from the line aParent.
void copyLinks( const PNS_LINE *aParent ) ; void copyLinks( const PNS_LINE* aParent ) ;
///> List of segments in the owning PNS_NODE (PNS_ITEM::m_owner) that constitute this line, or NULL ///> List of segments in the owning PNS_NODE (PNS_ITEM::m_owner) that constitute this line, or NULL
///> if the line is not a part of any node. ///> if the line is not a part of any node.
SegmentRefs* m_segmentRefs; SEGMENT_REFS* m_segmentRefs;
///> The actual shape of the line ///> The actual shape of the line
SHAPE_LINE_CHAIN m_line; SHAPE_LINE_CHAIN m_line;
......
This diff is collapsed.
...@@ -46,7 +46,7 @@ class PNS_ROUTER_BASE; ...@@ -46,7 +46,7 @@ class PNS_ROUTER_BASE;
class PNS_LINE_PLACER : public PNS_ALGO_BASE class PNS_LINE_PLACER : public PNS_ALGO_BASE
{ {
public: public:
PNS_LINE_PLACER( PNS_ROUTER *aRouter ); PNS_LINE_PLACER( PNS_ROUTER* aRouter );
~PNS_LINE_PLACER(); ~PNS_LINE_PLACER();
/** /**
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
* (unless NULL). * (unless NULL).
*/ */
void Start ( const VECTOR2I& aP, PNS_ITEM* aStartItem ); void Start ( const VECTOR2I& aP, PNS_ITEM* aStartItem );
/** /**
* Function Move() * Function Move()
* *
...@@ -92,14 +92,14 @@ public: ...@@ -92,14 +92,14 @@ public:
* *
* Sets the current routing layer. * Sets the current routing layer.
*/ */
void SetLayer ( int aLayer ); void SetLayer( int aLayer );
/** /**
* Function SetWidth() * Function SetWidth()
* *
* Sets the current track width. * Sets the current track width.
*/ */
void SetWidth ( int aWidth ); void SetWidth( int aWidth );
/** /**
* Function Head() * Function Head()
...@@ -167,7 +167,7 @@ public: ...@@ -167,7 +167,7 @@ public:
* *
* Returns the most recent world state. * Returns the most recent world state.
*/ */
PNS_NODE* CurrentNode(bool aLoopsRemoved = false) const; PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const;
/** /**
* Function FlipPosture() * Function FlipPosture()
...@@ -185,7 +185,6 @@ public: ...@@ -185,7 +185,6 @@ public:
*/ */
void UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings ); void UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings );
private: private:
/** /**
* Function route() * Function route()
...@@ -197,7 +196,6 @@ private: ...@@ -197,7 +196,6 @@ private:
* @param aP ending point of current route. * @param aP ending point of current route.
* @return true, if the routing is complete. * @return true, if the routing is complete.
*/ */
bool route( const VECTOR2I& aP ); bool route( const VECTOR2I& aP );
/** /**
...@@ -214,7 +212,7 @@ private: ...@@ -214,7 +212,7 @@ private:
* *
* Sets the board to route. * Sets the board to route.
*/ */
void setWorld ( PNS_NODE *aWorld ); void setWorld ( PNS_NODE* aWorld );
/** /**
* Function startPlacement() * Function startPlacement()
...@@ -268,9 +266,9 @@ private: ...@@ -268,9 +266,9 @@ private:
* *
* Helper function, checking if segments a and b form an obtuse angle * Helper function, checking if segments a and b form an obtuse angle
* (in 45-degree regime). * (in 45-degree regime).
* @return true, if angle (a, b) is obtuse * @return true, if angle (aA, aB) is obtuse
*/ */
bool checkObtusity( const SEG& a, const SEG& b ) const; bool checkObtusity( const SEG& aA, const SEG& aB ) const;
/** /**
* Function handleSelfIntersections() * Function handleSelfIntersections()
...@@ -339,16 +337,15 @@ private: ...@@ -339,16 +337,15 @@ private:
*/ */
void routeStep( const VECTOR2I& aP ); void routeStep( const VECTOR2I& aP );
///< route step, walkaround mode ///> route step, walkaround mode
bool rhWalkOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead); bool rhWalkOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead);
///< route step, shove mode ///> route step, shove mode
bool rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead); bool rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead);
///< route step, mark obstacles mode ///> route step, mark obstacles mode
bool rhMarkObstacles ( const VECTOR2I& aP, PNS_LINE& aNewHead ); bool rhMarkObstacles ( const VECTOR2I& aP, PNS_LINE& aNewHead );
///> current routing direction ///> current routing direction
DIRECTION_45 m_direction; DIRECTION_45 m_direction;
...@@ -399,7 +396,6 @@ private: ...@@ -399,7 +396,6 @@ private:
PNS_LINE m_currentTrace; PNS_LINE m_currentTrace;
PNS_MODE m_currentMode; PNS_MODE m_currentMode;
}; };
#endif // __PNS_LINE_PLACER_H #endif // __PNS_LINE_PLACER_H
...@@ -38,136 +38,153 @@ PNS_LOGGER::PNS_LOGGER( ) ...@@ -38,136 +38,153 @@ PNS_LOGGER::PNS_LOGGER( )
PNS_LOGGER::~PNS_LOGGER() PNS_LOGGER::~PNS_LOGGER()
{ {
} }
void PNS_LOGGER::Clear() void PNS_LOGGER::Clear()
{ {
m_theLog.str(std::string()); m_theLog.str( std::string() );
m_groupOpened = false; m_groupOpened = false;
} }
void PNS_LOGGER::NewGroup ( const std::string& name, int iter)
void PNS_LOGGER::NewGroup( const std::string& aName, int aIter )
{ {
if(m_groupOpened) if( m_groupOpened )
m_theLog << "endgroup" << std::endl; m_theLog << "endgroup" << std::endl;
m_theLog << "group " << name << " " << iter << std::endl;
m_theLog << "group " << aName << " " << aIter << std::endl;
m_groupOpened = true; m_groupOpened = true;
} }
void PNS_LOGGER::EndGroup() void PNS_LOGGER::EndGroup()
{ {
if(!m_groupOpened) if( !m_groupOpened )
return; return;
m_groupOpened = false; m_groupOpened = false;
m_theLog << "endgroup" << std::endl; m_theLog << "endgroup" << std::endl;
} }
void PNS_LOGGER::Log ( const PNS_ITEM *item, int kind, const std::string name )
void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName )
{ {
m_theLog << "item " << kind << " " << name << " "; m_theLog << "aItem " << aKind << " " << aName << " ";
m_theLog << item->Net() << " " << item->Layers().Start() << " " << item->Layers().End() << " " << item->Marker() << " " << item->Rank(); m_theLog << aItem->Net() << " " << aItem->Layers().Start() << " " <<
aItem->Layers().End() << " " << aItem->Marker() << " " << aItem->Rank();
switch(item->Kind()) switch( aItem->Kind() )
{ {
case PNS_ITEM::LINE: case PNS_ITEM::LINE:
{ {
PNS_LINE *l = (PNS_LINE *) item; PNS_LINE* l = (PNS_LINE*) aItem;
m_theLog << " line "; m_theLog << " line ";
m_theLog << l->Width() << " " << (l->EndsWithVia() ? 1 : 0) << " "; m_theLog << l->Width() << " " << ( l->EndsWithVia() ? 1 : 0 ) << " ";
dumpShape ( l->Shape() ); dumpShape ( l->Shape() );
m_theLog << std::endl; m_theLog << std::endl;
break; break;
} }
case PNS_ITEM::VIA: case PNS_ITEM::VIA:
{ {
m_theLog << " via 0 0 "; m_theLog << " via 0 0 ";
dumpShape ( item->Shape() ); dumpShape ( aItem->Shape() );
m_theLog << std::endl; m_theLog << std::endl;
break; break;
} }
case PNS_ITEM::SEGMENT: case PNS_ITEM::SEGMENT:
{ {
PNS_SEGMENT *s =(PNS_SEGMENT *) item; PNS_SEGMENT* s =(PNS_SEGMENT*) aItem;
m_theLog << " line "; m_theLog << " line ";
m_theLog << s->Width() << " 0 linechain 2 0 " << s->Seg().A.x << " " <<s->Seg().A.y << " " << s->Seg().B.x << " " <<s->Seg().B.y << std::endl; m_theLog << s->Width() << " 0 linechain 2 0 " << s->Seg().A.x << " " <<
s->Seg().A.y << " " << s->Seg().B.x << " " <<s->Seg().B.y << std::endl;
break; break;
} }
case PNS_ITEM::SOLID: case PNS_ITEM::SOLID:
{ {
PNS_SOLID *s = (PNS_SOLID*) item; PNS_SOLID* s = (PNS_SOLID*) aItem;
m_theLog << " solid 0 0 "; m_theLog << " solid 0 0 ";
dumpShape ( s->Shape() ); dumpShape( s->Shape() );
m_theLog << std::endl; m_theLog << std::endl;
break; break;
} }
default: default:
break; break;
} }
} }
void PNS_LOGGER::Log ( const SHAPE_LINE_CHAIN *l, int kind, const std::string name )
void PNS_LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string aName )
{ {
m_theLog << "item " << kind << " " << name << " "; m_theLog << "item " << aKind << " " << aName << " ";
m_theLog << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0; m_theLog << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0;
m_theLog << " line "; m_theLog << " line ";
m_theLog << 0 << " " << 0 << " "; m_theLog << 0 << " " << 0 << " ";
dumpShape ( l ); dumpShape( aL );
m_theLog << std::endl; m_theLog << std::endl;
} }
void PNS_LOGGER::Log ( const VECTOR2I& start, const VECTOR2I& end, int kind , const std::string name)
{
void PNS_LOGGER::Log( const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aKind, const std::string aName)
{
} }
void PNS_LOGGER::dumpShape ( const SHAPE * sh )
void PNS_LOGGER::dumpShape( const SHAPE* aSh )
{ {
switch(sh->Type()) switch( aSh->Type() )
{ {
case SH_LINE_CHAIN: case SH_LINE_CHAIN:
{ {
const SHAPE_LINE_CHAIN *lc = (const SHAPE_LINE_CHAIN *) sh; const SHAPE_LINE_CHAIN* lc = (const SHAPE_LINE_CHAIN*) aSh;
m_theLog << "linechain " << lc->PointCount() << " " << (lc->IsClosed() ? 1 : 0) << " "; m_theLog << "linechain " << lc->PointCount() << " " << ( lc->IsClosed() ? 1 : 0 ) << " ";
for(int i = 0; i < lc->PointCount(); i++)
m_theLog << lc->CPoint(i).x << " " << lc->CPoint(i).y << " "; for( int i = 0; i < lc->PointCount(); i++ )
m_theLog << lc->CPoint( i ).x << " " << lc->CPoint( i ).y << " ";
break; break;
} }
case SH_CIRCLE: case SH_CIRCLE:
{ {
const SHAPE_CIRCLE *c = (const SHAPE_CIRCLE *) sh; const SHAPE_CIRCLE *c = (const SHAPE_CIRCLE*) aSh;
m_theLog << "circle " << c->GetCenter().x << " " << c->GetCenter().y << " " << c->GetRadius(); m_theLog << "circle " << c->GetCenter().x << " " << c->GetCenter().y << " " << c->GetRadius();
break; break;
} }
case SH_RECT: case SH_RECT:
{ {
const SHAPE_RECT *r = (const SHAPE_RECT *) sh; const SHAPE_RECT* r = (const SHAPE_RECT*) aSh;
m_theLog << "rect " << r->GetPosition().x << " " << r->GetPosition().y << " " << r->GetSize().x << " " <<r->GetSize().y; m_theLog << "rect " << r->GetPosition().x << " " << r->GetPosition().y << " " <<
r->GetSize().x << " " <<r->GetSize().y;
break; break;
} }
case SH_SEGMENT: case SH_SEGMENT:
{ {
const SHAPE_SEGMENT *s = (const SHAPE_SEGMENT *) sh; const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) aSh;
m_theLog << "linechain 2 0 " << s->GetSeg().A.x << " " << s->GetSeg().A.y << " " << s->GetSeg().B.x << " " << s->GetSeg().B.y; m_theLog << "linechain 2 0 " << s->GetSeg().A.x << " " << s->GetSeg().A.y << " " <<
s->GetSeg().B.x << " " << s->GetSeg().B.y;
break; break;
} }
default: default:
break; break;
} }
} }
void PNS_LOGGER::Save ( const std::string& filename ) void PNS_LOGGER::Save( const std::string& aFilename )
{ {
EndGroup(); EndGroup();
FILE *f=fopen(filename.c_str(),"wb"); FILE* f = fopen( aFilename.c_str(), "wb" );
printf("Saving to '%s' [%p]\n", filename.c_str(), f); printf( "Saving to '%s' [%p]\n", aFilename.c_str(), f );
const std::string s = m_theLog.str(); const std::string s = m_theLog.str();
fwrite(s.c_str(), 1, s.length(), f); fwrite( s.c_str(), 1, s.length(), f );
fclose(f); fclose( f );
} }
...@@ -32,24 +32,25 @@ class PNS_ITEM; ...@@ -32,24 +32,25 @@ class PNS_ITEM;
class SHAPE_LINE_CHAIN; class SHAPE_LINE_CHAIN;
class SHAPE; class SHAPE;
class PNS_LOGGER { class PNS_LOGGER
{
public: public:
PNS_LOGGER(); PNS_LOGGER();
~PNS_LOGGER(); ~PNS_LOGGER();
void Save ( const std::string& filename ); void Save( const std::string& aFilename );
void Clear(); void Clear();
void NewGroup ( const std::string& name, int iter = 0);
void NewGroup( const std::string& aName, int aIter = 0 );
void EndGroup(); void EndGroup();
void Log ( const PNS_ITEM *item, int kind = 0, const std::string name = std::string () );
void Log ( const SHAPE_LINE_CHAIN *l, int kind = 0, const std::string name = std::string () ); void Log( const PNS_ITEM* aItem, int aKind = 0, const std::string aName = std::string() );
void Log ( const VECTOR2I& start, const VECTOR2I& end, int kind = 0, const std::string name = std::string () ); void Log( const SHAPE_LINE_CHAIN *aL, int aKind = 0, const std::string aName = std::string() );
void Log( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aKind = 0,
const std::string aName = std::string() );
private: private:
void dumpShape ( const SHAPE* aSh );
void dumpShape ( const SHAPE* sh );
bool m_groupOpened; bool m_groupOpened;
std::stringstream m_theLog; std::stringstream m_theLog;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -38,23 +38,22 @@ class PNS_ROUTER; ...@@ -38,23 +38,22 @@ class PNS_ROUTER;
* *
* Calculates the cost of a given line, taking corner angles and total length into account. * Calculates the cost of a given line, taking corner angles and total length into account.
**/ **/
class PNS_COST_ESTIMATOR class PNS_COST_ESTIMATOR
{ {
public: public:
PNS_COST_ESTIMATOR() : PNS_COST_ESTIMATOR() :
m_lengthCost( 0 ), m_lengthCost( 0 ),
m_cornerCost( 0 ) m_cornerCost( 0 )
{}; {}
PNS_COST_ESTIMATOR( const PNS_COST_ESTIMATOR& b ) : PNS_COST_ESTIMATOR( const PNS_COST_ESTIMATOR& aB ) :
m_lengthCost( b.m_lengthCost ), m_lengthCost( aB.m_lengthCost ),
m_cornerCost( b.m_cornerCost ) m_cornerCost( aB.m_cornerCost )
{}; {}
~PNS_COST_ESTIMATOR() {}; ~PNS_COST_ESTIMATOR() {};
static int CornerCost( const SEG& a, const SEG& b ); static int CornerCost( const SEG& aA, const SEG& aB );
static int CornerCost( const SHAPE_LINE_CHAIN& aLine ); static int CornerCost( const SHAPE_LINE_CHAIN& aLine );
static int CornerCost( const PNS_LINE& aLine ); static int CornerCost( const PNS_LINE& aLine );
...@@ -63,7 +62,7 @@ public: ...@@ -63,7 +62,7 @@ public:
void Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine ); void Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine );
bool IsBetter( PNS_COST_ESTIMATOR& aOther, double aLengthTollerance, bool IsBetter( PNS_COST_ESTIMATOR& aOther, double aLengthTollerance,
double aCornerTollerace ) const; double aCornerTollerace ) const;
double GetLengthCost() const { return m_lengthCost; } double GetLengthCost() const { return m_lengthCost; }
double GetCornerCost() const { return m_cornerCost; } double GetCornerCost() const { return m_cornerCost; }
...@@ -84,7 +83,6 @@ private: ...@@ -84,7 +83,6 @@ private:
* the procedure as long as the total cost of the line keeps decreasing * the procedure as long as the total cost of the line keeps decreasing
* - "Smart Pads" - that is, rerouting pad/via exits to make them look nice (SMART_PADS). * - "Smart Pads" - that is, rerouting pad/via exits to make them look nice (SMART_PADS).
**/ **/
class PNS_OPTIMIZER class PNS_OPTIMIZER
{ {
public: public:
...@@ -122,14 +120,14 @@ public: ...@@ -122,14 +120,14 @@ public:
private: private:
static const int MaxCachedItems = 256; static const int MaxCachedItems = 256;
typedef std::vector<SHAPE_LINE_CHAIN> BreakoutList; typedef std::vector<SHAPE_LINE_CHAIN> BREAKOUT_LIST;
struct CacheVisitor; struct CACHE_VISITOR;
struct CachedItem struct CACHED_ITEM
{ {
int hits; int m_hits;
bool isStatic; bool m_isStatic;
}; };
bool mergeObtuse( PNS_LINE* aLine ); bool mergeObtuse( PNS_LINE* aLine );
...@@ -142,15 +140,13 @@ private: ...@@ -142,15 +140,13 @@ private:
bool checkColliding( PNS_ITEM* aItem, bool aUpdateCache = true ); bool checkColliding( PNS_ITEM* aItem, bool aUpdateCache = true );
bool checkColliding( PNS_LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath ); bool checkColliding( PNS_LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath );
void cacheAdd( PNS_ITEM* aItem, bool aIsStatic ); void cacheAdd( PNS_ITEM* aItem, bool aIsStatic );
void removeCachedSegments( PNS_LINE* aLine, int aStartVertex = 0, int aEndVertex = -1 ); void removeCachedSegments( PNS_LINE* aLine, int aStartVertex = 0, int aEndVertex = -1 );
BreakoutList circleBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const; BREAKOUT_LIST circleBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const;
BreakoutList rectBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const; BREAKOUT_LIST rectBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const;
BreakoutList ovalBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const; BREAKOUT_LIST ovalBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const;
BreakoutList computeBreakouts( int aWidth, const PNS_ITEM* aItem, BREAKOUT_LIST computeBreakouts( int aWidth, const PNS_ITEM* aItem, bool aPermitDiagonal ) const;
bool aPermitDiagonal ) const;
int smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, int aEndVertex ); int smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, int aEndVertex );
...@@ -158,7 +154,7 @@ private: ...@@ -158,7 +154,7 @@ private:
SHAPE_INDEX_LIST<PNS_ITEM*> m_cache; SHAPE_INDEX_LIST<PNS_ITEM*> m_cache;
typedef boost::unordered_map<PNS_ITEM*, CachedItem> CachedItemTags; typedef boost::unordered_map<PNS_ITEM*, CACHED_ITEM> CachedItemTags;
CachedItemTags m_cacheTags; CachedItemTags m_cacheTags;
PNS_NODE* m_world; PNS_NODE* m_world;
int m_collisionKindMask; int m_collisionKindMask;
......
This diff is collapsed.
...@@ -51,9 +51,10 @@ class PNS_CLEARANCE_FUNC; ...@@ -51,9 +51,10 @@ class PNS_CLEARANCE_FUNC;
class PNS_SHOVE; class PNS_SHOVE;
class PNS_DRAGGER; class PNS_DRAGGER;
namespace KIGFX { namespace KIGFX
class VIEW; {
class VIEW_GROUP; class VIEW;
class VIEW_GROUP;
}; };
...@@ -62,7 +63,6 @@ class VIEW_GROUP; ...@@ -62,7 +63,6 @@ class VIEW_GROUP;
* *
* Main router class. * Main router class.
*/ */
class PNS_ROUTER class PNS_ROUTER
{ {
private: private:
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
const VECTOR2I CurrentEnd() const; const VECTOR2I CurrentEnd() const;
int GetClearance( const PNS_ITEM* a, const PNS_ITEM* b ) const; int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const;
PNS_NODE* GetWorld() const PNS_NODE* GetWorld() const
{ {
...@@ -114,8 +114,8 @@ public: ...@@ -114,8 +114,8 @@ public:
void ToggleViaPlacement(); void ToggleViaPlacement();
int GetCurrentLayer() const;// { return m_currentLayer; } int GetCurrentLayer() const;
int GetCurrentNet() const;// { return m_currentNet; } int GetCurrentNet() const;
void DumpLog(); void DumpLog();
...@@ -134,14 +134,19 @@ public: ...@@ -134,14 +134,19 @@ public:
// typedef boost::optional<hoverItem> optHoverItem; // typedef boost::optional<hoverItem> optHoverItem;
const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP ); const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP );
const VECTOR2I SnapToItem( PNS_ITEM* item, VECTOR2I aP, bool& aSplitsSegment ); const VECTOR2I SnapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
bool StartDragging( const VECTOR2I& aP, PNS_ITEM* aItem ); bool StartDragging( const VECTOR2I& aP, PNS_ITEM* aItem );
void SetIterLimit( int aX ) { m_iterLimit = aX; } void SetIterLimit( int aX ) { m_iterLimit = aX; }
int GetIterLimit() const { return m_iterLimit; }; int GetIterLimit() const { return m_iterLimit; };
void SetShowIntermediateSteps(bool aX, int aSnapshotIter = -1 ) { m_showInterSteps = aX; m_snapshotIter = aSnapshotIter; } void SetShowIntermediateSteps( bool aX, int aSnapshotIter = -1 )
{
m_showInterSteps = aX;
m_snapshotIter = aSnapshotIter;
}
bool GetShowIntermediateSteps() const { return m_showInterSteps; } bool GetShowIntermediateSteps() const { return m_showInterSteps; }
int GetShapshotIter() const { return m_snapshotIter; } int GetShapshotIter() const { return m_snapshotIter; }
...@@ -168,7 +173,7 @@ public: ...@@ -168,7 +173,7 @@ public:
/** /**
* Applies stored settings. * Applies stored settings.
* \see Settings() * @see Settings()
*/ */
void ApplySettings(); void ApplySettings();
...@@ -183,30 +188,29 @@ public: ...@@ -183,30 +188,29 @@ public:
ApplySettings(); ApplySettings();
} }
void EnableSnapping ( bool aEnable ) void EnableSnapping( bool aEnable )
{ {
m_snappingEnabled = aEnable; m_snappingEnabled = aEnable;
} }
bool SnappingEnabled () const bool SnappingEnabled() const
{ {
return m_snappingEnabled; return m_snappingEnabled;
} }
private: private:
void movePlacing ( const VECTOR2I& aP, PNS_ITEM* aItem ); void movePlacing( const VECTOR2I& aP, PNS_ITEM* aItem );
void moveDragging ( const VECTOR2I& aP, PNS_ITEM* aItem ); void moveDragging( const VECTOR2I& aP, PNS_ITEM* aItem );
void eraseView(); void eraseView();
void updateView( PNS_NODE *aNode, PNS_ITEMSET &aCurrent ); //PNS_LINE *aCurrent = NULL ); void updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent );
void clearViewFlags(); void clearViewFlags();
// optHoverItem queryHoverItemEx(const VECTOR2I& aP); // optHoverItem queryHoverItemEx(const VECTOR2I& aP);
PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const; // std::vector<PNS_ITEM*> aItems) const; PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const;
void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP ); // optHoverItem& aItem); void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP );
PNS_VIA* checkLoneVia( PNS_JOINT* aJoint ) const; PNS_VIA* checkLoneVia( PNS_JOINT* aJoint ) const;
PNS_ITEM* syncPad( D_PAD* aPad ); PNS_ITEM* syncPad( D_PAD* aPad );
...@@ -219,7 +223,7 @@ private: ...@@ -219,7 +223,7 @@ private:
void highlightCurrent( bool enabled ); void highlightCurrent( bool enabled );
void markViolations( PNS_NODE *aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ItemVector& aRemoved ); void markViolations( PNS_NODE *aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
int m_currentLayer; int m_currentLayer;
int m_currentNet; int m_currentNet;
...@@ -241,8 +245,7 @@ private: ...@@ -241,8 +245,7 @@ private:
KIGFX::VIEW* m_view; KIGFX::VIEW* m_view;
KIGFX::VIEW_GROUP* m_previewItems; KIGFX::VIEW_GROUP* m_previewItems;
PNS_ITEM* m_currentEndItem;
PNS_ITEM *m_currentEndItem;
VECTOR2I m_currentEnd; VECTOR2I m_currentEnd;
VECTOR2I m_currentStart; VECTOR2I m_currentStart;
...@@ -252,7 +255,7 @@ private: ...@@ -252,7 +255,7 @@ private:
bool m_snappingEnabled; bool m_snappingEnabled;
bool m_violation; bool m_violation;
// optHoverItem m_startItem, m_endItem; // optHoverItem m_startItem, m_endItem;
PNS_ROUTING_SETTINGS m_settings; PNS_ROUTING_SETTINGS m_settings;
PNS_CLEARANCE_FUNC* m_clearanceFunc; PNS_CLEARANCE_FUNC* m_clearanceFunc;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS() PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
{ {
m_routingMode = RM_Walkaround; m_routingMode = RM_Walkaround;
m_optimizerEffort = OE_Full; m_optimizerEffort = OE_FULL;
m_removeLoops = true; m_removeLoops = true;
m_smartPads = true; m_smartPads = true;
m_shoveVias = true; m_shoveVias = true;
...@@ -38,11 +38,13 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS() ...@@ -38,11 +38,13 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
m_canViolateDRC = false; m_canViolateDRC = false;
} }
TIME_LIMIT PNS_ROUTING_SETTINGS::ShoveTimeLimit() const TIME_LIMIT PNS_ROUTING_SETTINGS::ShoveTimeLimit() const
{ {
return TIME_LIMIT ( m_shoveTimeLimit ); return TIME_LIMIT ( m_shoveTimeLimit );
} }
int PNS_ROUTING_SETTINGS::ShoveIterationLimit() const int PNS_ROUTING_SETTINGS::ShoveIterationLimit() const
{ {
return m_shoveIterationLimit; return m_shoveIterationLimit;
......
...@@ -36,9 +36,9 @@ enum PNS_MODE ...@@ -36,9 +36,9 @@ enum PNS_MODE
///> Optimization effort ///> Optimization effort
enum PNS_OPTIMIZATION_EFFORT enum PNS_OPTIMIZATION_EFFORT
{ {
OE_Low = 0, OE_LOW = 0,
OE_Medium = 1, OE_MEDIUM = 1,
OE_Full = 2 OE_FULL = 2
}; };
/** /**
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
///> Returns true if follow mouse mode is active (permanently on for the moment). ///> Returns true if follow mouse mode is active (permanently on for the moment).
bool FollowMouse() const bool FollowMouse() const
{ {
return m_followMouse && !(Mode() == RM_MarkObstacles); return m_followMouse && !( Mode() == RM_MarkObstacles );
} }
///> Returns true if smoothing segments durign dragging is enabled. ///> Returns true if smoothing segments durign dragging is enabled.
...@@ -120,10 +120,10 @@ public: ...@@ -120,10 +120,10 @@ public:
const DIRECTION_45 InitialDirection() const const DIRECTION_45 InitialDirection() const
{ {
if(m_startDiagonal) if( m_startDiagonal )
return DIRECTION_45 (DIRECTION_45::NE); return DIRECTION_45( DIRECTION_45::NE );
else else
return DIRECTION_45 (DIRECTION_45::N); return DIRECTION_45( DIRECTION_45::N );
} }
int ShoveIterationLimit() const; int ShoveIterationLimit() const;
...@@ -133,7 +133,6 @@ public: ...@@ -133,7 +133,6 @@ public:
TIME_LIMIT WalkaroundTimeLimit() const; TIME_LIMIT WalkaroundTimeLimit() const;
private: private:
bool m_shoveVias; bool m_shoveVias;
bool m_startDiagonal; bool m_startDiagonal;
bool m_removeLoops; bool m_removeLoops;
......
...@@ -37,17 +37,17 @@ class PNS_SEGMENT : public PNS_ITEM ...@@ -37,17 +37,17 @@ class PNS_SEGMENT : public PNS_ITEM
public: public:
PNS_SEGMENT() : PNS_SEGMENT() :
PNS_ITEM( SEGMENT ) PNS_ITEM( SEGMENT )
{}; {}
PNS_SEGMENT( const SEG& aSeg, int aNet ) : PNS_SEGMENT( const SEG& aSeg, int aNet ) :
PNS_ITEM( SEGMENT ), m_seg(aSeg, 0) PNS_ITEM( SEGMENT ), m_seg( aSeg, 0 )
{ {
m_net = aNet; m_net = aNet;
}; }
PNS_SEGMENT( const PNS_LINE& aParentLine, const SEG& aSeg ) : PNS_SEGMENT( const PNS_LINE& aParentLine, const SEG& aSeg ) :
PNS_ITEM( SEGMENT ), PNS_ITEM( SEGMENT ),
m_seg(aSeg, aParentLine.Width()) m_seg( aSeg, aParentLine.Width() )
{ {
m_net = aParentLine.Net(); m_net = aParentLine.Net();
m_layers = aParentLine.Layers(); m_layers = aParentLine.Layers();
...@@ -55,7 +55,6 @@ public: ...@@ -55,7 +55,6 @@ public:
m_rank = aParentLine.Rank(); m_rank = aParentLine.Rank();
}; };
PNS_SEGMENT* Clone( ) const; PNS_SEGMENT* Clone( ) const;
const SHAPE* Shape() const const SHAPE* Shape() const
...@@ -101,14 +100,14 @@ public: ...@@ -101,14 +100,14 @@ public:
void SwapEnds() void SwapEnds()
{ {
SEG tmp = m_seg.GetSeg(); SEG tmp = m_seg.GetSeg();
m_seg.SetSeg( SEG (tmp.B , tmp.A )); m_seg.SetSeg( SEG (tmp.B , tmp.A ) );
} }
const SHAPE_LINE_CHAIN Hull( int aClearance, int aWalkaroundThickness ) const; const SHAPE_LINE_CHAIN Hull( int aClearance, int aWalkaroundThickness ) const;
virtual VECTOR2I Anchor(int n) const virtual VECTOR2I Anchor(int n) const
{ {
if(n == 0) if( n == 0 )
return m_seg.GetSeg().A; return m_seg.GetSeg().A;
else else
return m_seg.GetSeg().B; return m_seg.GetSeg().B;
......
This diff is collapsed.
...@@ -44,7 +44,7 @@ class PNS_SHOVE : public PNS_ALGO_BASE ...@@ -44,7 +44,7 @@ class PNS_SHOVE : public PNS_ALGO_BASE
{ {
public: public:
enum ShoveStatus enum SHOVE_STATUS
{ {
SH_OK = 0, SH_OK = 0,
SH_NULL, SH_NULL,
...@@ -52,72 +52,74 @@ public: ...@@ -52,72 +52,74 @@ public:
SH_HEAD_MODIFIED SH_HEAD_MODIFIED
}; };
PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER *aRouter ); PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter );
~PNS_SHOVE(); ~PNS_SHOVE();
virtual PNS_LOGGER *Logger() virtual PNS_LOGGER* Logger()
{ {
return &m_logger; return &m_logger;
} }
ShoveStatus ShoveLines( const PNS_LINE& aCurrentHead ); SHOVE_STATUS ShoveLines( const PNS_LINE& aCurrentHead );
ShoveStatus ShoveDraggingVia ( PNS_VIA *aVia, const VECTOR2I& aWhere, PNS_VIA **aNewVia ); SHOVE_STATUS ShoveDraggingVia( PNS_VIA*aVia, const VECTOR2I& aWhere, PNS_VIA** aNewVia );
PNS_NODE* CurrentNode(); PNS_NODE* CurrentNode();
const PNS_LINE NewHead() const; const PNS_LINE NewHead() const;
void SetInitialLine ( PNS_LINE *aInitial ); void SetInitialLine ( PNS_LINE* aInitial );
private: private:
typedef std::vector<SHAPE_LINE_CHAIN> HullSet; typedef std::vector<SHAPE_LINE_CHAIN> HULL_SET;
typedef boost::optional<PNS_LINE> OptLine; typedef boost::optional<PNS_LINE> OPT_LINE;
typedef std::pair <PNS_LINE *, PNS_LINE *> LinePair; typedef std::pair <PNS_LINE*, PNS_LINE*> LINE_PAIR;
typedef std::vector<LinePair> LinePairVec; typedef std::vector<LINE_PAIR> LINE_PAIR_VEC;
struct SpringbackTag struct SPRINGBACK_TAG
{ {
int64_t length; int64_t m_length;
int segments; int m_segments;
VECTOR2I p; VECTOR2I m_p;
PNS_NODE *node; PNS_NODE* m_node;
PNS_ITEMSET headItems; PNS_ITEMSET m_headItems;
PNS_COST_ESTIMATOR cost; PNS_COST_ESTIMATOR m_cost;
}; };
ShoveStatus processSingleLine(PNS_LINE *aCurrent, PNS_LINE* aObstacle, PNS_LINE *aShoved ); SHOVE_STATUS processSingleLine( PNS_LINE* aCurrent, PNS_LINE* aObstacle, PNS_LINE* aShoved );
ShoveStatus processHullSet ( PNS_LINE *aCurrent, PNS_LINE *aObstacle, PNS_LINE *aShoved, const HullSet& hulls ); SHOVE_STATUS processHullSet( PNS_LINE* aCurrent, PNS_LINE* aObstacle,
PNS_LINE* aShoved, const HULL_SET& hulls );
bool reduceSpringback( const PNS_ITEMSET &aHeadItems ); bool reduceSpringback( const PNS_ITEMSET& aHeadItems );
bool pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET &aHeadItems, const PNS_COST_ESTIMATOR& aCost ); bool pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET &aHeadItems,
const PNS_COST_ESTIMATOR& aCost );
ShoveStatus walkaroundLoneVia ( PNS_LINE *aCurrent, PNS_LINE *aObstacle, PNS_LINE *aShoved ); SHOVE_STATUS walkaroundLoneVia( PNS_LINE* aCurrent, PNS_LINE* aObstacle, PNS_LINE* aShoved );
bool checkBumpDirection ( PNS_LINE *aCurrent, PNS_LINE *aShoved ) const; bool checkBumpDirection( PNS_LINE* aCurrent, PNS_LINE* aShoved ) const;
ShoveStatus onCollidingLine( PNS_LINE *aCurrent, PNS_LINE *aObstacle ); SHOVE_STATUS onCollidingLine( PNS_LINE* aCurrent, PNS_LINE* aObstacle );
ShoveStatus onCollidingSegment( PNS_LINE *aCurrent, PNS_SEGMENT *aObstacleSeg ); SHOVE_STATUS onCollidingSegment( PNS_LINE* aCurrent, PNS_SEGMENT* aObstacleSeg );
ShoveStatus onCollidingSolid( PNS_LINE *aCurrent, PNS_SOLID *aObstacleSolid ); SHOVE_STATUS onCollidingSolid( PNS_LINE* aCurrent, PNS_SOLID* aObstacleSolid );
ShoveStatus onCollidingVia( PNS_ITEM *aCurrent, PNS_VIA *aObstacleVia ); SHOVE_STATUS onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia );
ShoveStatus onReverseCollidingVia( PNS_LINE *aCurrent, PNS_VIA *aObstacleVia ); SHOVE_STATUS onReverseCollidingVia( PNS_LINE* aCurrent, PNS_VIA* aObstacleVia );
ShoveStatus pushVia ( PNS_VIA *aVia, const VECTOR2I& aForce, int aCurrentRank ); SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank );
void unwindStack ( PNS_SEGMENT *seg ); void unwindStack( PNS_SEGMENT* aSeg );
void unwindStack ( PNS_ITEM *item ); void unwindStack( PNS_ITEM *aItem );
void runOptimizer ( PNS_NODE *node, PNS_LINE *head ); void runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead );
void pushLine ( PNS_LINE *l ); void pushLine( PNS_LINE *aL );
void popLine(); void popLine();
const RANGE<int> findShovedVertexRange ( PNS_LINE *l ); 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 );
ShoveStatus shoveIteration(int aIter); SHOVE_STATUS shoveIteration( int aIter );
ShoveStatus shoveMainLoop(); SHOVE_STATUS shoveMainLoop();
std::vector<SpringbackTag> m_nodeStack; std::vector<SPRINGBACK_TAG> m_nodeStack;
std::vector<PNS_LINE*> m_lineStack; std::vector<PNS_LINE*> m_lineStack;
std::vector<PNS_LINE*> m_optimizerQueue; std::vector<PNS_LINE*> m_optimizerQueue;
std::vector<PNS_ITEM*> m_gcItems; std::vector<PNS_ITEM*> m_gcItems;
...@@ -127,7 +129,7 @@ private: ...@@ -127,7 +129,7 @@ private:
PNS_LINE* m_currentHead; PNS_LINE* m_currentHead;
PNS_LINE* m_collidingLine; PNS_LINE* m_collidingLine;
OptLine m_newHead; OPT_LINE m_newHead;
PNS_LOGGER m_logger; PNS_LOGGER m_logger;
PNS_VIA* m_draggedVia; PNS_VIA* m_draggedVia;
......
This diff is collapsed.
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
m_pos = aSolid.m_pos; m_pos = aSolid.m_pos;
} }
PNS_ITEM* Clone( ) const; PNS_ITEM* Clone() const;
const SHAPE* Shape() const { return m_shape; } const SHAPE* Shape() const { return m_shape; }
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
m_pos = aCenter; m_pos = aCenter;
} }
virtual VECTOR2I Anchor(int n) const virtual VECTOR2I Anchor( int aN ) const
{ {
return m_pos; return m_pos;
} }
...@@ -83,7 +83,6 @@ public: ...@@ -83,7 +83,6 @@ public:
return 1; return 1;
} }
private: private:
VECTOR2I m_pos; VECTOR2I m_pos;
SHAPE* m_shape; SHAPE* m_shape;
......
This diff is collapsed.
...@@ -31,11 +31,10 @@ ...@@ -31,11 +31,10 @@
/** Various utility functions */ /** Various utility functions */
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, const SHAPE_LINE_CHAIN SegmentHull ( const SHAPE_SEGMENT& aSeg, int aClearance,
int aClearance, int aWalkaroundThickness );
int aWalkaroundThickness );
SHAPE_RECT ApproximateSegmentAsRect( const SHAPE_SEGMENT& aSeg ); SHAPE_RECT ApproximateSegmentAsRect( const SHAPE_SEGMENT& aSeg );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
#include <iostream> #include <iostream>
#include <boost/format.hpp> #include <boost/format.hpp>
static inline void _trace_print( const char* aFuncName, int level, const std::string& aMsg ) static inline void _trace_print( const char* aFuncName, int aLevel, const std::string& aMsg )
{ {
#ifdef DEBUG #ifdef DEBUG
std::cerr << "trace[" << level << "]: " << aFuncName << ": " << aMsg << std::endl; std::cerr << "trace[" << aLevel << "]: " << aFuncName << ": " << aMsg << std::endl;
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment