diff --git a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp index 920bf8bb62..3c6ab1e859 100644 --- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp +++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp @@ -26,7 +26,7 @@ #include "dialog_pns_diff_pair_dimensions.h" #include -DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::PNS_SIZES_SETTINGS& aSizes ) : +DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::SIZES_SETTINGS& aSizes ) : DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( aParent ), m_traceWidth( this, m_traceWidthText, m_traceWidthUnit ), m_traceGap( this, m_traceGapText, m_traceGapUnit ), diff --git a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h index 80e413fb20..1ec8ea41c8 100644 --- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h +++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h @@ -32,14 +32,14 @@ namespace PNS { -class PNS_SIZES_SETTINGS; +class SIZES_SETTINGS; } class DIALOG_PNS_DIFF_PAIR_DIMENSIONS : public DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE { public: - DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::PNS_SIZES_SETTINGS& aSizes ); + DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::SIZES_SETTINGS& aSizes ); private: void updateCheckbox(); @@ -51,7 +51,7 @@ private: WX_UNIT_BINDER m_traceGap; WX_UNIT_BINDER m_viaGap; - PNS::PNS_SIZES_SETTINGS& m_sizes; + PNS::SIZES_SETTINGS& m_sizes; }; #endif // __dialog_pns_settings__ diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp index 28f3ae1a77..b7d238e804 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp @@ -27,7 +27,7 @@ #include DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, - PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode ) + PNS::MEANDER_SETTINGS& aSettings, PNS::ROUTER_MODE aMode ) : DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( aParent ), m_minAmpl( this, m_minAmplText, m_minAmplUnit ), diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h index 5057ad86bb..19e7647b43 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h @@ -34,14 +34,14 @@ namespace PNS { -class PNS_MEANDER_SETTINGS; +class MEANDER_SETTINGS; } class DIALOG_PNS_LENGTH_TUNING_SETTINGS : public DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE { public: - DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode ); + DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS::MEANDER_SETTINGS& aSettings, PNS::ROUTER_MODE aMode ); virtual void OnOkClick( wxCommandEvent& aEvent ); @@ -51,8 +51,8 @@ private: WX_UNIT_BINDER m_spacing; WX_UNIT_BINDER m_targetLength; - PNS::PNS_MEANDER_SETTINGS& m_settings; - PNS::PNS_ROUTER_MODE m_mode; + PNS::MEANDER_SETTINGS& m_settings; + PNS::ROUTER_MODE m_mode; }; #endif // __dialog_pns_settings__ diff --git a/pcbnew/dialogs/dialog_pns_settings.cpp b/pcbnew/dialogs/dialog_pns_settings.cpp index 6dc9122e4b..0fa1b43f16 100644 --- a/pcbnew/dialogs/dialog_pns_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_settings.cpp @@ -26,7 +26,7 @@ #include "dialog_pns_settings.h" #include -DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings ) : +DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings ) : DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings ) { // "Figure out what's best" is not available yet diff --git a/pcbnew/dialogs/dialog_pns_settings.h b/pcbnew/dialogs/dialog_pns_settings.h index ec85dfcb1e..09e40f1a9c 100644 --- a/pcbnew/dialogs/dialog_pns_settings.h +++ b/pcbnew/dialogs/dialog_pns_settings.h @@ -30,19 +30,19 @@ namespace PNS { -class PNS_ROUTING_SETTINGS; +class ROUTING_SETTINGS; } class DIALOG_PNS_SETTINGS : public DIALOG_PNS_SETTINGS_BASE { public: - DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings ); + DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings ); private: virtual void OnOkClick( wxCommandEvent& aEvent ); - PNS::PNS_ROUTING_SETTINGS& m_settings; + PNS::ROUTING_SETTINGS& m_settings; }; #endif // __dialog_pns_settings__ diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 06f0b8c869..9d4ce5d84a 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 CERN + * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * @author Tomasz Wlostowski * @author Maciej Suminski * diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp index 595d300ddf..e7cc8064a2 100644 --- a/pcbnew/router/length_tuner_tool.cpp +++ b/pcbnew/router/length_tuner_tool.cpp @@ -68,7 +68,7 @@ static TOOL_ACTION ACT_AmplDecrease( "pcbnew.LengthTuner.AmplDecrease", AS_CONTE LENGTH_TUNER_TOOL::LENGTH_TUNER_TOOL() : - PNS_TOOL_BASE( "pcbnew.LengthTuner" ) + TOOL_BASE( "pcbnew.LengthTuner" ) { } @@ -101,7 +101,7 @@ LENGTH_TUNER_TOOL::~LENGTH_TUNER_TOOL() void LENGTH_TUNER_TOOL::Reset( RESET_REASON aReason ) { - PNS_TOOL_BASE::Reset( aReason ); + TOOL_BASE::Reset( aReason ); Go( &LENGTH_TUNER_TOOL::TuneSingleTrace, COMMON_ACTIONS::routerActivateTuneSingleTrace.MakeEvent() ); Go( &LENGTH_TUNER_TOOL::TuneDiffPair, COMMON_ACTIONS::routerActivateTuneDiffPair.MakeEvent() ); @@ -121,14 +121,14 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) } } - PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast( m_router->Placer() ); + PNS::MEANDER_PLACER_BASE* placer = static_cast( m_router->Placer() ); if( !placer ) return; if( aEvent.IsAction( &ACT_Settings ) ) { - PNS::PNS_MEANDER_SETTINGS settings = placer->MeanderSettings(); + PNS::MEANDER_SETTINGS settings = placer->MeanderSettings(); DIALOG_PNS_LENGTH_TUNING_SETTINGS settingsDlg( m_frame, settings, m_router->Mode() ); if( settingsDlg.ShowModal() ) @@ -171,7 +171,7 @@ void LENGTH_TUNER_TOOL::performTuning() return; } - PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast( + PNS::MEANDER_PLACER_BASE* placer = static_cast( m_router->Placer() ); placer->UpdateSettings( m_savedMeanderSettings ); @@ -256,7 +256,7 @@ int LENGTH_TUNER_TOOL::TuneDiffPairSkew( const TOOL_EVENT& aEvent ) } -int LENGTH_TUNER_TOOL::mainLoop( PNS::PNS_ROUTER_MODE aMode ) +int LENGTH_TUNER_TOOL::mainLoop( PNS::ROUTER_MODE aMode ) { // Deselect all items m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); diff --git a/pcbnew/router/length_tuner_tool.h b/pcbnew/router/length_tuner_tool.h index fbc9c72b55..1fadd44887 100644 --- a/pcbnew/router/length_tuner_tool.h +++ b/pcbnew/router/length_tuner_tool.h @@ -28,7 +28,7 @@ class PNS_TUNE_STATUS_POPUP; -class APIEXPORT LENGTH_TUNER_TOOL : public PNS::PNS_TOOL_BASE +class APIEXPORT LENGTH_TUNER_TOOL : public PNS::TOOL_BASE { public: LENGTH_TUNER_TOOL(); @@ -43,13 +43,13 @@ public: private: void performTuning( ); - int mainLoop( PNS::PNS_ROUTER_MODE aMode ); + int mainLoop( PNS::ROUTER_MODE aMode ); void handleCommonEvents( const TOOL_EVENT& aEvent ); void updateStatusPopup ( PNS_TUNE_STATUS_POPUP& aPopup ); - PNS::PNS_MEANDER_SETTINGS m_savedMeanderSettings; + PNS::MEANDER_SETTINGS m_savedMeanderSettings; }; #endif diff --git a/pcbnew/router/pns_algo_base.cpp b/pcbnew/router/pns_algo_base.cpp index ce3ba8df56..781360d14b 100644 --- a/pcbnew/router/pns_algo_base.cpp +++ b/pcbnew/router/pns_algo_base.cpp @@ -25,13 +25,13 @@ namespace PNS { -PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const +ROUTING_SETTINGS& ALGO_BASE::Settings() const { return m_router->Settings(); } -PNS_LOGGER* PNS_ALGO_BASE::Logger() +LOGGER* ALGO_BASE::Logger() { return NULL; } diff --git a/pcbnew/router/pns_algo_base.h b/pcbnew/router/pns_algo_base.h index ee6d9301b5..36df0a433e 100644 --- a/pcbnew/router/pns_algo_base.h +++ b/pcbnew/router/pns_algo_base.h @@ -26,55 +26,55 @@ namespace PNS { -class PNS_ROUTER; -class PNS_LOGGER; -class PNS_DEBUG_DECORATOR; +class ROUTER; +class LOGGER; +class DEBUG_DECORATOR; /** - * Class PNS_ALGO_BASE + * Class ALGO_BASE * * Base class for all P&S algorithms (shoving, walkaround, line placement, dragging, etc.) * Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router instance, logging) */ -class PNS_ALGO_BASE +class ALGO_BASE { public: - PNS_ALGO_BASE( PNS_ROUTER* aRouter ) : + ALGO_BASE( ROUTER* aRouter ) : m_router( aRouter ) {} - virtual ~PNS_ALGO_BASE() {} + virtual ~ALGO_BASE() {} ///> Returns the instance of our router - PNS_ROUTER* Router() const + ROUTER* Router() const { return m_router; } ///> Returns current router settings - PNS_ROUTING_SETTINGS& Settings() const; + ROUTING_SETTINGS& Settings() const; ///> Returns the logger object, allowing to dump geometry to a file. - virtual PNS_LOGGER* Logger(); + virtual LOGGER* Logger(); /** * Function SetDebugDecorator * * Assign a debug decorator allowing this algo to draw extra graphics for visual debugging */ - void SetDebugDecorator( PNS_DEBUG_DECORATOR* aDecorator ) + void SetDebugDecorator( DEBUG_DECORATOR* aDecorator ) { m_debugDecorator = aDecorator; } - PNS_DEBUG_DECORATOR* Dbg() const + DEBUG_DECORATOR* Dbg() const { return m_debugDecorator; } private: - PNS_DEBUG_DECORATOR *m_debugDecorator; - PNS_ROUTER* m_router; + DEBUG_DECORATOR *m_debugDecorator; + ROUTER* m_router; }; } diff --git a/pcbnew/router/pns_debug_decorator.h b/pcbnew/router/pns_debug_decorator.h index dc991e8070..6663de6df1 100644 --- a/pcbnew/router/pns_debug_decorator.h +++ b/pcbnew/router/pns_debug_decorator.h @@ -29,13 +29,13 @@ namespace PNS { -class PNS_DEBUG_DECORATOR +class DEBUG_DECORATOR { public: - PNS_DEBUG_DECORATOR() + DEBUG_DECORATOR() {} - virtual ~PNS_DEBUG_DECORATOR() + virtual ~DEBUG_DECORATOR() {} virtual void AddPoint( VECTOR2I aP, int aColor ) {}; diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp index a0088f423c..4b2d586dcf 100644 --- a/pcbnew/router/pns_diff_pair.cpp +++ b/pcbnew/router/pns_diff_pair.cpp @@ -39,9 +39,9 @@ namespace PNS { -class PNS_LINE; +class LINE; -PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN ) +DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR( ITEM* aPrimP, ITEM* aPrimN ) { m_primP = aPrimP->Clone(); m_primN = aPrimN->Clone(); @@ -51,14 +51,14 @@ PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN } -void PNS_DP_PRIMITIVE_PAIR::SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN ) +void DP_PRIMITIVE_PAIR::SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN ) { m_anchorP = aAnchorP; m_anchorN = aAnchorN; } -PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN ) +DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN ) { m_anchorP = aAnchorP; m_anchorN = aAnchorN; @@ -66,7 +66,7 @@ PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VE } -PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOther ) +DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR( const DP_PRIMITIVE_PAIR& aOther ) { m_primP = m_primN = NULL; @@ -81,7 +81,7 @@ PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOthe } -PNS_DP_PRIMITIVE_PAIR& PNS_DP_PRIMITIVE_PAIR::operator=( const PNS_DP_PRIMITIVE_PAIR& aOther ) +DP_PRIMITIVE_PAIR& DP_PRIMITIVE_PAIR::operator=( const DP_PRIMITIVE_PAIR& aOther ) { if( aOther.m_primP ) m_primP = aOther.m_primP->Clone(); @@ -95,28 +95,28 @@ PNS_DP_PRIMITIVE_PAIR& PNS_DP_PRIMITIVE_PAIR::operator=( const PNS_DP_PRIMITIVE_ } -PNS_DP_PRIMITIVE_PAIR::~PNS_DP_PRIMITIVE_PAIR() +DP_PRIMITIVE_PAIR::~DP_PRIMITIVE_PAIR() { delete m_primP; delete m_primN; } -bool PNS_DP_PRIMITIVE_PAIR::Directional() const +bool DP_PRIMITIVE_PAIR::Directional() const { if( !m_primP ) return false; - return m_primP->OfKind( PNS_ITEM::SEGMENT_T ); + return m_primP->OfKind( ITEM::SEGMENT_T ); } -DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::anchorDirection( PNS_ITEM* aItem, const VECTOR2I& aP ) const +DIRECTION_45 DP_PRIMITIVE_PAIR::anchorDirection( ITEM* aItem, const VECTOR2I& aP ) const { - if( !aItem->OfKind ( PNS_ITEM::SEGMENT_T ) ) + if( !aItem->OfKind ( ITEM::SEGMENT_T ) ) return DIRECTION_45(); - PNS_SEGMENT* s = static_cast( aItem ); + SEGMENT* s = static_cast( aItem ); if( s->Seg().A == aP ) return DIRECTION_45( s->Seg().A - s->Seg().B ); @@ -124,18 +124,18 @@ DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::anchorDirection( PNS_ITEM* aItem, const VECT return DIRECTION_45( s->Seg().B - s->Seg().A ); } -void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTOR2I& aMidpoint, VECTOR2I& aDirection ) const +void DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTOR2I& aMidpoint, VECTOR2I& aDirection ) const { assert( m_primP && m_primN ); VECTOR2I aP, aN, dir, midpoint; - if ( m_primP->OfKind( PNS_ITEM::SEGMENT_T ) && m_primN->OfKind( PNS_ITEM::SEGMENT_T ) ) + if ( m_primP->OfKind( ITEM::SEGMENT_T ) && m_primN->OfKind( ITEM::SEGMENT_T ) ) { aP = m_primP->Anchor( 1 ); aN = m_primN->Anchor( 1 ); midpoint = ( aP + aN ) / 2; - SEG s = static_cast ( m_primP )->Seg(); + SEG s = static_cast ( m_primP )->Seg(); if ( s.B != s.A ) { @@ -165,13 +165,13 @@ void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTO } -DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::DirP() const +DIRECTION_45 DP_PRIMITIVE_PAIR::DirP() const { return anchorDirection( m_primP, m_anchorP ); } -DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::DirN() const +DIRECTION_45 DP_PRIMITIVE_PAIR::DirN() const { return anchorDirection( m_primN, m_anchorN ); } @@ -205,14 +205,14 @@ static bool checkGap( const SHAPE_LINE_CHAIN &p, const SHAPE_LINE_CHAIN &n, int } -void PNS_DP_GATEWAY::Reverse() +void DP_GATEWAY::Reverse() { m_entryN = m_entryN.Reverse(); m_entryP = m_entryP.Reverse(); } -bool PNS_DIFF_PAIR::BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GATEWAY &aTarget, bool aPrefDiagonal ) +bool DIFF_PAIR::BuildInitial( const DP_GATEWAY& aEntry, const DP_GATEWAY &aTarget, bool aPrefDiagonal ) { SHAPE_LINE_CHAIN p = DIRECTION_45().BuildInitialTrace ( aEntry.AnchorP(), aTarget.AnchorP(), aPrefDiagonal ); SHAPE_LINE_CHAIN n = DIRECTION_45().BuildInitialTrace ( aEntry.AnchorN(), aTarget.AnchorN(), aPrefDiagonal ); @@ -246,7 +246,7 @@ bool PNS_DIFF_PAIR::BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GAT if( aTarget.HasEntryLines() ) { - PNS_DP_GATEWAY t(aTarget) ; + DP_GATEWAY t(aTarget) ; t.Reverse(); if( !CheckConnectionAngle( t.Entry(), mask ) ) @@ -272,7 +272,7 @@ bool PNS_DIFF_PAIR::BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GAT } -bool PNS_DIFF_PAIR::CheckConnectionAngle( const PNS_DIFF_PAIR& aOther, int aAllowedAngles ) const +bool DIFF_PAIR::CheckConnectionAngle( const DIFF_PAIR& aOther, int aAllowedAngles ) const { bool checkP, checkN; @@ -300,16 +300,16 @@ bool PNS_DIFF_PAIR::CheckConnectionAngle( const PNS_DIFF_PAIR& aOther, int aAllo } -const PNS_DIFF_PAIR PNS_DP_GATEWAY::Entry() const +const DIFF_PAIR DP_GATEWAY::Entry() const { - return PNS_DIFF_PAIR( m_entryP, m_entryN, 0 ); + return DIFF_PAIR( m_entryP, m_entryN, 0 ); } -void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries, +void DP_GATEWAYS::BuildOrthoProjections( DP_GATEWAYS& aEntries, const VECTOR2I& aCursorPos, int aOrthoScore ) { - for( PNS_DP_GATEWAY g : aEntries.Gateways() ) + for( DP_GATEWAY g : aEntries.Gateways() ) { VECTOR2I midpoint( ( g.AnchorP() + g.AnchorN() ) / 2 ); SEG guide_s( midpoint, midpoint + VECTOR2I( 1, 0 ) ); @@ -324,7 +324,7 @@ void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries, VECTOR2I proj = ( dist_s < dist_d ? proj_s : proj_d ); - PNS_DP_GATEWAYS targets( m_gap ); + DP_GATEWAYS targets( m_gap ); targets.m_viaGap = m_viaGap; targets.m_viaDiameter = m_viaDiameter; @@ -332,7 +332,7 @@ void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries, targets.BuildForCursor( proj ); - for( PNS_DP_GATEWAY t : targets.Gateways() ) + for( DP_GATEWAY t : targets.Gateways() ) { t.SetPriority( aOrthoScore ); m_gateways.push_back( t ); @@ -341,8 +341,8 @@ void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries, } -bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTarget, - bool aPrefDiagonal, PNS_DIFF_PAIR& aDp ) +bool DP_GATEWAYS::FitGateways( DP_GATEWAYS& aEntry, DP_GATEWAYS& aTarget, + bool aPrefDiagonal, DIFF_PAIR& aDp ) { DP_CANDIDATE best; @@ -350,9 +350,9 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa int bestScore = -1000; bool found = false; - for( const PNS_DP_GATEWAY& g_entry : aEntry.Gateways() ) + for( const DP_GATEWAY& g_entry : aEntry.Gateways() ) { - for( const PNS_DP_GATEWAY& g_target : aTarget.Gateways() ) + for( const DP_GATEWAY& g_target : aTarget.Gateways() ) { n++; @@ -365,7 +365,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa if( score < bestScore ) continue; - PNS_DIFF_PAIR l( m_gap ); + DIFF_PAIR l( m_gap ); if( l.BuildInitial( g_entry, g_target, aPrefDiagonal ^ ( attempt ? true : false ) ) ) { @@ -390,7 +390,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa } -bool PNS_DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const +bool DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const { VECTOR2I dir ( std::abs (a.x - b.x), std::abs ( a.y - b.y )); @@ -398,16 +398,16 @@ bool PNS_DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& } -void PNS_DP_GATEWAYS::FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOrientation ) +void DP_GATEWAYS::FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOrientation ) { - std::remove_if( m_gateways.begin(), m_gateways.end(), [aAngleMask, aRefOrientation]( const PNS_DP_GATEWAY& dp) { + std::remove_if( m_gateways.begin(), m_gateways.end(), [aAngleMask, aRefOrientation]( const DP_GATEWAY& dp) { DIRECTION_45 orient( dp.AnchorP() - dp.AnchorN() ); return !( orient.Angle( aRefOrientation ) & aAngleMask ); } ); } -void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal ) +void DP_GATEWAYS::BuildFromPrimitivePair( DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal ) { VECTOR2I majorDirection; VECTOR2I p0_p, p0_n; @@ -421,7 +421,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool return; } - const int pvMask = PNS_ITEM::SOLID_T | PNS_ITEM::VIA_T; + const int pvMask = ITEM::SOLID_T | ITEM::VIA_T; if( aPair.PrimP()->OfKind( pvMask ) && aPair.PrimN()->OfKind( pvMask ) ) { @@ -430,7 +430,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool shP = aPair.PrimP()->Shape(); } - else if( aPair.PrimP()->OfKind( PNS_ITEM::SEGMENT_T ) && aPair.PrimN()->OfKind( PNS_ITEM::SEGMENT_T ) ) + else if( aPair.PrimP()->OfKind( ITEM::SEGMENT_T ) && aPair.PrimN()->OfKind( ITEM::SEGMENT_T ) ) { buildDpContinuation( aPair, aPreferDiagonal ); @@ -506,7 +506,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool SHAPE_LINE_CHAIN entryP( p0_p, p0_p + sign * dir, gw_p ); SHAPE_LINE_CHAIN entryN( p0_n, p0_n + sign * dir, gw_n ); - PNS_DP_GATEWAY gw( gw_p, gw_n, false ); + DP_GATEWAY gw( gw_p, gw_n, false ); gw.SetEntryLines( entryP, entryN ); gw.SetPriority( 100 - k ); @@ -519,7 +519,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool } -void PNS_DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos ) +void DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos ) { int gap = m_fitVias ? m_viaGap + m_viaDiameter : m_gap; @@ -550,7 +550,7 @@ void PNS_DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos ) if( m_fitVias ) BuildGeneric( aCursorPos + dir, aCursorPos - dir, true, true ); else - m_gateways.push_back( PNS_DP_GATEWAY( aCursorPos + dir, + m_gateways.push_back( DP_GATEWAY( aCursorPos + dir, aCursorPos - dir, attempt ? true : false ) ); } @@ -558,9 +558,9 @@ void PNS_DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos ) } -void PNS_DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n ) +void DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n ) { - for( PNS_DP_GATEWAY &g : m_gateways ) + for( DP_GATEWAY &g : m_gateways ) { if( !g.HasEntryLines() ) { @@ -572,9 +572,9 @@ void PNS_DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n ) } -void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal ) +void DP_GATEWAYS::buildDpContinuation( DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal ) { - PNS_DP_GATEWAY gw( aPair.AnchorP(), aPair.AnchorN(), aIsDiagonal ); + DP_GATEWAY gw( aPair.AnchorP(), aPair.AnchorN(), aIsDiagonal ); gw.SetPriority( 100 ); m_gateways.push_back( gw ); @@ -589,7 +589,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs VECTOR2I vdP = aPair.AnchorP() + dP.Left().ToVector(); VECTOR2I vdN = aPair.AnchorN() + dN.Left().ToVector(); - PNS_SEGMENT* sP = static_cast( aPair.PrimP() ); + SEGMENT* sP = static_cast( aPair.PrimP() ); VECTOR2I t1, t2; @@ -604,7 +604,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs t2 = aPair.AnchorN() + dP.Left().ToVector().Resize( gap ); } - PNS_DP_GATEWAY gwL( t2, aPair.AnchorN(), !aIsDiagonal ); + DP_GATEWAY gwL( t2, aPair.AnchorN(), !aIsDiagonal ); SHAPE_LINE_CHAIN ep = dP.BuildInitialTrace( aPair.AnchorP(), t2, !aIsDiagonal ); gwL.SetPriority( 10 ); @@ -612,7 +612,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs m_gateways.push_back( gwL ); - PNS_DP_GATEWAY gwR( aPair.AnchorP(), t1, !aIsDiagonal ); + DP_GATEWAY gwR( aPair.AnchorP(), t1, !aIsDiagonal ); SHAPE_LINE_CHAIN en = dP.BuildInitialTrace( aPair.AnchorN(), t1, !aIsDiagonal ); gwR.SetPriority( 10) ; gwR.SetEntryLines( SHAPE_LINE_CHAIN(), en ); @@ -621,7 +621,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs } -void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries, bool aViaMode ) +void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries, bool aViaMode ) { SEG st_p[2], st_n[2]; SEG d_n[2], d_p[2]; @@ -652,13 +652,13 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, if( !aViaMode ) { - m_gateways.push_back( PNS_DP_GATEWAY( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio ) ); + m_gateways.push_back( DP_GATEWAY( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio ) ); dir = ( p0_n - p0_p ).Resize( m_gap ); - m_gateways.push_back( PNS_DP_GATEWAY( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl ) ); - m_gateways.push_back( PNS_DP_GATEWAY( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl ) ); - m_gateways.push_back( PNS_DP_GATEWAY( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl ) ); - m_gateways.push_back( PNS_DP_GATEWAY( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl ) ); + m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl ) ); + m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl ) ); + m_gateways.push_back( DP_GATEWAY( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl ) ); + m_gateways.push_back( DP_GATEWAY( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl ) ); } } } @@ -691,7 +691,7 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, VECTOR2I g_p( ( p0_p - m ).Resize( (double) m_gap * M_SQRT1_2 ) ); VECTOR2I g_n( ( p0_n - m ).Resize( (double) m_gap * M_SQRT1_2 ) ); - m_gateways.push_back( PNS_DP_GATEWAY( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio ) ); + m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio ) ); } } } @@ -714,13 +714,13 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, g_n = ( p0_n - m ).Resize( (double) m_gap ); if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE ) - m_gateways.push_back( PNS_DP_GATEWAY( m + g_p, m + g_n, true ) ); + m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) ); g_p = ( p0_p - m ).Resize( m_gap ); g_n = ( p0_n - m ).Resize( (double) m_gap * M_SQRT2 ); if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE ) - m_gateways.push_back( PNS_DP_GATEWAY( m + g_p, m + g_n, true ) ); + m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) ); } } } @@ -732,19 +732,19 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, } -PNS_DP_PRIMITIVE_PAIR PNS_DIFF_PAIR::EndingPrimitives() +DP_PRIMITIVE_PAIR DIFF_PAIR::EndingPrimitives() { if( m_hasVias ) - return PNS_DP_PRIMITIVE_PAIR( &m_via_p, &m_via_n ); + return DP_PRIMITIVE_PAIR( &m_via_p, &m_via_n ); else { - const PNS_LINE lP( PLine() ); - const PNS_LINE lN( NLine() ); + const LINE lP( PLine() ); + const LINE lN( NLine() ); - PNS_SEGMENT sP( lP, lP.CSegment( -1 ) ); - PNS_SEGMENT sN( lN, lN.CSegment( -1 ) ); + SEGMENT sP( lP, lP.CSegment( -1 ) ); + SEGMENT sN( lN, lN.CSegment( -1 ) ); - PNS_DP_PRIMITIVE_PAIR dpair( &sP, &sN ); + DP_PRIMITIVE_PAIR dpair( &sP, &sN ); dpair.SetAnchors( sP.Seg().B, sN.Seg().B ); return dpair; @@ -794,13 +794,13 @@ bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip ) } -double PNS_DIFF_PAIR::Skew() const +double DIFF_PAIR::Skew() const { return m_p.Length() - m_n.Length(); } -void PNS_DIFF_PAIR::CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const +void DIFF_PAIR::CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const { SHAPE_LINE_CHAIN p( m_p ); SHAPE_LINE_CHAIN n( m_n ); @@ -829,7 +829,7 @@ void PNS_DIFF_PAIR::CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const } -int64_t PNS_DIFF_PAIR::CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const +int64_t DIFF_PAIR::CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const { int64_t total = 0; @@ -854,7 +854,7 @@ int64_t PNS_DIFF_PAIR::CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LI } -double PNS_DIFF_PAIR::CoupledLength() const +double DIFF_PAIR::CoupledLength() const { COUPLED_SEGMENTS_VEC pairs; @@ -868,7 +868,7 @@ double PNS_DIFF_PAIR::CoupledLength() const } -double PNS_DIFF_PAIR::CoupledLengthFactor() const +double DIFF_PAIR::CoupledLengthFactor() const { double t = TotalLength(); @@ -879,7 +879,7 @@ double PNS_DIFF_PAIR::CoupledLengthFactor() const } -double PNS_DIFF_PAIR::TotalLength() const +double DIFF_PAIR::TotalLength() const { double lenP = m_p.Length(); double lenN = m_n.Length(); @@ -888,7 +888,7 @@ double PNS_DIFF_PAIR::TotalLength() const } -int PNS_DIFF_PAIR::CoupledLength ( const SEG& aP, const SEG& aN ) const +int DIFF_PAIR::CoupledLength ( const SEG& aP, const SEG& aN ) const { SEG p_clip, n_clip; int64_t dist = std::abs( aP.Distance( aN ) - m_width ); diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h index 902bf20fd1..535026d4f8 100644 --- a/pcbnew/router/pns_diff_pair.h +++ b/pcbnew/router/pns_diff_pair.h @@ -35,18 +35,18 @@ namespace PNS { -class PNS_DIFF_PAIR; +class DIFF_PAIR; /** - * Class PNS_DP_GATEWAY + * Class DP_GATEWAY * * Defines a "gateway" for routing a differential pair - e.g. a pair of points (anchors) with certain * orientation, spacing and (optionally) predefined entry paths. The routing algorithm connects such * gateways with parallel lines, thus creating a difrerential pair. **/ -class PNS_DP_GATEWAY { +class DP_GATEWAY { public: - PNS_DP_GATEWAY( const VECTOR2I& aAnchorP, + DP_GATEWAY( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN, bool aIsDiagonal, int aAllowedEntryAngles = DIRECTION_45::ANG_OBTUSE, @@ -60,7 +60,7 @@ public: m_hasEntryLines = false; } - ~PNS_DP_GATEWAY() + ~DP_GATEWAY() { } @@ -110,7 +110,7 @@ public: const SHAPE_LINE_CHAIN& EntryP() const { return m_entryP; } const SHAPE_LINE_CHAIN& EntryN() const { return m_entryN; } - const PNS_DIFF_PAIR Entry() const ; + const DIFF_PAIR Entry() const ; void Reverse(); @@ -129,31 +129,31 @@ private: }; /** - * Class PNS_DP_PRIMITIVE_PAIR + * Class DP_PRIMITIVE_PAIR * * Stores staring/ending primitives (pads, vias or segments) for a differential pair. **/ -class PNS_DP_PRIMITIVE_PAIR +class DP_PRIMITIVE_PAIR { public: - PNS_DP_PRIMITIVE_PAIR(): + DP_PRIMITIVE_PAIR(): m_primP( NULL ), m_primN( NULL ) {}; - PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOther ); - PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN ); - PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN ); + DP_PRIMITIVE_PAIR( const DP_PRIMITIVE_PAIR& aOther ); + DP_PRIMITIVE_PAIR( ITEM* aPrimP, ITEM* aPrimN ); + DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN ); - ~PNS_DP_PRIMITIVE_PAIR(); + ~DP_PRIMITIVE_PAIR(); void SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN ); const VECTOR2I& AnchorP() const { return m_anchorP; } const VECTOR2I& AnchorN() const { return m_anchorN; } - PNS_DP_PRIMITIVE_PAIR& operator=( const PNS_DP_PRIMITIVE_PAIR& aOther ); + DP_PRIMITIVE_PAIR& operator=( const DP_PRIMITIVE_PAIR& aOther ); - PNS_ITEM* PrimP() const { return m_primP; } - PNS_ITEM* PrimN() const { return m_primN; } + ITEM* PrimP() const { return m_primP; } + ITEM* PrimN() const { return m_primN; } bool Directional() const; @@ -170,23 +170,23 @@ public: } private: - DIRECTION_45 anchorDirection( PNS_ITEM* aItem, const VECTOR2I& aP ) const; + DIRECTION_45 anchorDirection( ITEM* aItem, const VECTOR2I& aP ) const; - PNS_ITEM* m_primP; - PNS_ITEM* m_primN; + ITEM* m_primP; + ITEM* m_primN; VECTOR2I m_anchorP, m_anchorN; }; /** - * Class PNS_GATEWAYS + * Class DP_GATEWAYS * * A set of gateways calculated for the cursor or starting/ending primitive pair. **/ -class PNS_DP_GATEWAYS +class DP_GATEWAYS { public: - PNS_DP_GATEWAYS( int aGap ): + DP_GATEWAYS( int aGap ): m_gap( aGap ), m_viaGap( aGap ) { // Do not leave unitialized members, and keep static analyser quiet: @@ -217,18 +217,18 @@ class PNS_DP_GATEWAYS void BuildForCursor( const VECTOR2I& aCursorPos ); - void BuildOrthoProjections( PNS_DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore ); + void BuildOrthoProjections( DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore ); void BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries = false, bool aViaMode = false ); - void BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal ); + void BuildFromPrimitivePair( DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal ); - bool FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTarget, bool aPrefDiagonal, PNS_DIFF_PAIR& aDp ); + bool FitGateways( DP_GATEWAYS& aEntry, DP_GATEWAYS& aTarget, bool aPrefDiagonal, DIFF_PAIR& aDp ); - std::vector& Gateways() + std::vector& Gateways() { return m_gateways; } - const std::vector& CGateways() const + const std::vector& CGateways() const { return m_gateways; } @@ -244,7 +244,7 @@ class PNS_DP_GATEWAYS }; bool checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const; - void buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal ); + void buildDpContinuation( DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal ); void buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n ); int m_gap; @@ -252,17 +252,17 @@ class PNS_DP_GATEWAYS int m_viaDiameter; bool m_fitVias; - std::vector m_gateways; + std::vector m_gateways; }; /** - * Class PNS_DIFF_PAIR + * Class DIFF_PAIR * * Basic class for a differential pair. Stores two PNS_LINEs (for positive and negative nets, respectively), * the gap and coupling constraints. **/ -class PNS_DIFF_PAIR : public PNS_ITEM { +class DIFF_PAIR : public ITEM { public: struct COUPLED_SEGMENTS { @@ -286,7 +286,7 @@ public: typedef std::vector COUPLED_SEGMENTS_VEC; - PNS_DIFF_PAIR() : PNS_ITEM( DIFF_PAIR_T ), m_hasVias( false ) + DIFF_PAIR() : ITEM( DIFF_PAIR_T ), m_hasVias( false ) { // Initialize some members, to avoid uninitialized variables. m_net_p = 0; @@ -298,8 +298,8 @@ public: m_chamferLimit = 0; } - PNS_DIFF_PAIR( int aGap ) : - PNS_ITEM( DIFF_PAIR_T ), + DIFF_PAIR( int aGap ) : + ITEM( DIFF_PAIR_T ), m_hasVias( false ) { m_gapConstraint = aGap; @@ -314,8 +314,8 @@ public: m_chamferLimit = 0; } - PNS_DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ): - PNS_ITEM( DIFF_PAIR_T ), + DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ): + ITEM( DIFF_PAIR_T ), m_n( aN ), m_p( aP ), m_hasVias( false ) @@ -332,8 +332,8 @@ public: m_chamferLimit = 0; } - PNS_DIFF_PAIR( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ): - PNS_ITEM( DIFF_PAIR_T ), + DIFF_PAIR( const LINE &aLineP, const LINE &aLineN, int aGap = 0 ): + ITEM( DIFF_PAIR_T ), m_line_p( aLineP ), m_line_n( aLineN ), m_hasVias( false ) @@ -352,14 +352,14 @@ public: m_chamferLimit = 0; } - static inline bool ClassOf( const PNS_ITEM* aItem ) + static inline bool ClassOf( const ITEM* aItem ) { return aItem && DIFF_PAIR_T == aItem->Kind(); } - PNS_DIFF_PAIR* Clone() const { assert( false ); return NULL; } + DIFF_PAIR* Clone() const { assert( false ); return NULL; } - static PNS_DIFF_PAIR* AssembleDp( PNS_LINE *aLine ); + static DIFF_PAIR* AssembleDp( LINE *aLine ); void SetShape( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, bool aSwapLanes = false ) { @@ -375,7 +375,7 @@ public: } } - void SetShape( const PNS_DIFF_PAIR& aPair ) + void SetShape( const DIFF_PAIR& aPair ) { m_p = aPair.m_p; m_n = aPair.m_n; @@ -405,7 +405,7 @@ public: return m_gap; } - void AppendVias( const PNS_VIA &aViaP, const PNS_VIA& aViaN ) + void AppendVias( const VIA &aViaP, const VIA& aViaN ) { m_hasVias = true; m_via_p = aViaP; @@ -432,7 +432,7 @@ public: return m_net_n; } - PNS_LINE& PLine() + LINE& PLine() { if( !m_line_p.IsLinked() ) updateLine( m_line_p, m_p, m_net_p, m_via_p ); @@ -440,7 +440,7 @@ public: return m_line_p; } - PNS_LINE& NLine() + LINE& NLine() { if( !m_line_n.IsLinked() ) updateLine( m_line_n, m_n, m_net_n, m_via_n ); @@ -448,7 +448,7 @@ public: return m_line_n; } - PNS_DP_PRIMITIVE_PAIR EndingPrimitives(); + DP_PRIMITIVE_PAIR EndingPrimitives(); double CoupledLength() const; double TotalLength() const; @@ -463,7 +463,7 @@ public: m_p.Clear(); } - void Append( const PNS_DIFF_PAIR& aOther ) + void Append( const DIFF_PAIR& aOther ) { m_n.Append( aOther.m_n ); m_p.Append( aOther.m_p ); @@ -477,8 +477,8 @@ public: const SHAPE_LINE_CHAIN& CP() const { return m_p; } const SHAPE_LINE_CHAIN& CN() const { return m_n; } - bool BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GATEWAY& aTarget, bool aPrefDiagonal ); - bool CheckConnectionAngle( const PNS_DIFF_PAIR &aOther, int allowedAngles ) const; + bool BuildInitial( const DP_GATEWAY& aEntry, const DP_GATEWAY& aTarget, bool aPrefDiagonal ); + bool CheckConnectionAngle( const DIFF_PAIR &aOther, int allowedAngles ) const; int CoupledLength( const SEG& aP, const SEG& aN ) const; int64_t CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const; @@ -489,7 +489,7 @@ public: } private: - void updateLine( PNS_LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, PNS_VIA& aVia ) + void updateLine( LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, VIA& aVia ) { aLine.SetShape( aShape ); aLine.SetWidth( m_width ); @@ -501,8 +501,8 @@ private: } SHAPE_LINE_CHAIN m_n, m_p; - PNS_LINE m_line_p, m_line_n; - PNS_VIA m_via_p, m_via_n; + LINE m_line_p, m_line_n; + VIA m_via_p, m_via_n; bool m_hasVias; int m_net_p, m_net_n; diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index 0cfb493959..7c36035dbe 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -35,8 +35,8 @@ namespace PNS { -PNS_DIFF_PAIR_PLACER::PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter ) : - PNS_PLACEMENT_ALGO( aRouter ) +DIFF_PAIR_PLACER::DIFF_PAIR_PLACER( ROUTER* aRouter ) : + PLACEMENT_ALGO( aRouter ) { m_state = RT_START; m_chainedPlacement = false; @@ -64,30 +64,30 @@ PNS_DIFF_PAIR_PLACER::PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter ) : m_idle = true; } -PNS_DIFF_PAIR_PLACER::~PNS_DIFF_PAIR_PLACER() +DIFF_PAIR_PLACER::~DIFF_PAIR_PLACER() { if( m_shove ) delete m_shove; } -void PNS_DIFF_PAIR_PLACER::setWorld( PNS_NODE* aWorld ) +void DIFF_PAIR_PLACER::setWorld( NODE* aWorld ) { m_world = aWorld; } -const PNS_VIA PNS_DIFF_PAIR_PLACER::makeVia( const VECTOR2I& aP, int aNet ) +const VIA DIFF_PAIR_PLACER::makeVia( const VECTOR2I& aP, int aNet ) { - const PNS_LAYERSET layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() ); + const LAYER_RANGE layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() ); - PNS_VIA v( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() ); + VIA v( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() ); v.SetNet( aNet ); return v; } -void PNS_DIFF_PAIR_PLACER::SetOrthoMode ( bool aOrthoMode ) +void DIFF_PAIR_PLACER::SetOrthoMode ( bool aOrthoMode ) { m_orthoMode = aOrthoMode; @@ -96,7 +96,7 @@ void PNS_DIFF_PAIR_PLACER::SetOrthoMode ( bool aOrthoMode ) } -bool PNS_DIFF_PAIR_PLACER::ToggleVia( bool aEnabled ) +bool DIFF_PAIR_PLACER::ToggleVia( bool aEnabled ) { m_placingVia = aEnabled; @@ -107,7 +107,7 @@ bool PNS_DIFF_PAIR_PLACER::ToggleVia( bool aEnabled ) } -bool PNS_DIFF_PAIR_PLACER::rhMarkObstacles( const VECTOR2I& aP ) +bool DIFF_PAIR_PLACER::rhMarkObstacles( const VECTOR2I& aP ) { if( !routeHead( aP ) ) return false; @@ -121,9 +121,9 @@ bool PNS_DIFF_PAIR_PLACER::rhMarkObstacles( const VECTOR2I& aP ) } -bool PNS_DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNewP ) +bool DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNewP ) { - PNS_VIA virtHead = makeVia( aP, -1 ); + VIA virtHead = makeVia( aP, -1 ); if( m_placingVia ) virtHead.SetDiameter( viaGap() + 2 * virtHead.Diameter() ); @@ -158,11 +158,11 @@ bool PNS_DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& } -bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent, - PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly ) +bool DIFF_PAIR_PLACER::attemptWalk( NODE* aNode, DIFF_PAIR* aCurrent, + DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly ) { - PNS_WALKAROUND walkaround( aNode, Router() ); - PNS_WALKAROUND::WALKAROUND_STATUS wf1; + WALKAROUND walkaround( aNode, Router() ); + WALKAROUND::WALKAROUND_STATUS wf1; Router()->GetRuleResolver()->OverrideClearance( true, aCurrent->NetP(), aCurrent->NetN(), aCurrent->Gap() ); @@ -170,24 +170,24 @@ bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent walkaround.SetSolidsOnly( aSolidsOnly ); walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() ); - PNS_SHOVE shove( aNode, Router() ); - PNS_LINE walkP, walkN; + SHOVE shove( aNode, Router() ); + LINE walkP, walkN; aWalk = *aCurrent; int iter = 0; - PNS_DIFF_PAIR cur( *aCurrent ); + DIFF_PAIR cur( *aCurrent ); bool currentIsP = aPFirst; - int mask = aSolidsOnly ? PNS_ITEM::SOLID_T : PNS_ITEM::ANY_T; + int mask = aSolidsOnly ? ITEM::SOLID_T : ITEM::ANY_T; do { - PNS_LINE preWalk = ( currentIsP ? cur.PLine() : cur.NLine() ); - PNS_LINE preShove = ( currentIsP ? cur.NLine() : cur.PLine() ); - PNS_LINE postWalk; + LINE preWalk = ( currentIsP ? cur.PLine() : cur.NLine() ); + LINE preShove = ( currentIsP ? cur.NLine() : cur.PLine() ); + LINE postWalk; if( !aNode->CheckColliding ( &preWalk, mask ) ) { @@ -201,18 +201,18 @@ bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent wf1 = walkaround.Route( preWalk, postWalk, false ); - if( wf1 != PNS_WALKAROUND::DONE ) + if( wf1 != WALKAROUND::DONE ) return false; - PNS_LINE postShove( preShove ); + LINE postShove( preShove ); shove.ForceClearance( true, cur.Gap() - 2 * PNS_HULL_MARGIN ); - PNS_SHOVE::SHOVE_STATUS sh1; + SHOVE::SHOVE_STATUS sh1; sh1 = shove.ProcessSingleLine( postWalk, preShove, postShove ); - if( sh1 != PNS_SHOVE::SH_OK ) + if( sh1 != SHOVE::SH_OK ) return false; postWalk.Line().Simplify(); @@ -239,15 +239,15 @@ bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent } -bool PNS_DIFF_PAIR_PLACER::tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, bool aSolidsOnly ) +bool DIFF_PAIR_PLACER::tryWalkDp( NODE* aNode, DIFF_PAIR &aPair, bool aSolidsOnly ) { - PNS_DIFF_PAIR best; + DIFF_PAIR best; double bestScore = 100000000000000.0; for( int attempt = 0; attempt <= 3; attempt++ ) { - PNS_DIFF_PAIR p; - PNS_NODE *tmp = m_currentNode->Branch(); + DIFF_PAIR p; + NODE *tmp = m_currentNode->Branch(); bool pfirst = ( attempt & 1 ) ? true : false; bool wind_cw = ( attempt & 2 ) ? true : false; @@ -272,7 +272,7 @@ bool PNS_DIFF_PAIR_PLACER::tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, boo if( bestScore > 0.0 ) { - PNS_OPTIMIZER optimizer( m_currentNode ); + OPTIMIZER optimizer( m_currentNode ); aPair.SetShape( best ); optimizer.Optimize( &aPair ); @@ -284,7 +284,7 @@ bool PNS_DIFF_PAIR_PLACER::tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, boo } -bool PNS_DIFF_PAIR_PLACER::rhWalkOnly( const VECTOR2I& aP ) +bool DIFF_PAIR_PLACER::rhWalkOnly( const VECTOR2I& aP ) { if( !routeHead ( aP ) ) return false; @@ -295,7 +295,7 @@ bool PNS_DIFF_PAIR_PLACER::rhWalkOnly( const VECTOR2I& aP ) } -bool PNS_DIFF_PAIR_PLACER::route( const VECTOR2I& aP ) +bool DIFF_PAIR_PLACER::route( const VECTOR2I& aP ) { switch( m_currentMode ) { @@ -313,7 +313,7 @@ bool PNS_DIFF_PAIR_PLACER::route( const VECTOR2I& aP ) } -bool PNS_DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP ) +bool DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP ) { m_currentNode = m_shove->CurrentNode(); @@ -327,18 +327,18 @@ bool PNS_DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP ) if( !tryWalkDp( m_currentNode, m_currentTrace, true ) ) return false; - PNS_LINE pLine( m_currentTrace.PLine() ); - PNS_LINE nLine( m_currentTrace.NLine() ); - PNS_ITEMSET head; + LINE pLine( m_currentTrace.PLine() ); + LINE nLine( m_currentTrace.NLine() ); + ITEM_SET head; head.Add( &pLine ); head.Add( &nLine ); - PNS_SHOVE::SHOVE_STATUS status = m_shove->ShoveMultiLines( head ); + SHOVE::SHOVE_STATUS status = m_shove->ShoveMultiLines( head ); m_currentNode = m_shove->CurrentNode(); - if( status == PNS_SHOVE::SH_OK ) + if( status == SHOVE::SH_OK ) { m_currentNode = m_shove->CurrentNode(); @@ -353,18 +353,18 @@ bool PNS_DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP ) } -const PNS_ITEMSET PNS_DIFF_PAIR_PLACER::Traces() +const ITEM_SET DIFF_PAIR_PLACER::Traces() { - PNS_ITEMSET t; + ITEM_SET t; - t.Add( const_cast( &m_currentTrace.PLine() ) ); - t.Add( const_cast( &m_currentTrace.NLine() ) ); + t.Add( const_cast( &m_currentTrace.PLine() ) ); + t.Add( const_cast( &m_currentTrace.NLine() ) ); return t; } -void PNS_DIFF_PAIR_PLACER::FlipPosture() +void DIFF_PAIR_PLACER::FlipPosture() { m_startDiagonal = !m_startDiagonal; @@ -373,7 +373,7 @@ void PNS_DIFF_PAIR_PLACER::FlipPosture() } -PNS_NODE* PNS_DIFF_PAIR_PLACER::CurrentNode( bool aLoopsRemoved ) const +NODE* DIFF_PAIR_PLACER::CurrentNode( bool aLoopsRemoved ) const { if( m_lastNode ) return m_lastNode; @@ -382,7 +382,7 @@ PNS_NODE* PNS_DIFF_PAIR_PLACER::CurrentNode( bool aLoopsRemoved ) const } -bool PNS_DIFF_PAIR_PLACER::SetLayer( int aLayer ) +bool DIFF_PAIR_PLACER::SetLayer( int aLayer ) { if( m_idle ) { @@ -392,7 +392,7 @@ bool PNS_DIFF_PAIR_PLACER::SetLayer( int aLayer ) return false; else if( !m_prevPair ) return false; - else if( m_prevPair->PrimP() || ( m_prevPair->PrimP()->OfKind( PNS_ITEM::VIA_T ) && + else if( m_prevPair->PrimP() || ( m_prevPair->PrimP()->OfKind( ITEM::VIA_T ) && m_prevPair->PrimP()->Layers().Overlaps( aLayer ) ) ) { m_currentLayer = aLayer; @@ -406,7 +406,7 @@ bool PNS_DIFF_PAIR_PLACER::SetLayer( int aLayer ) } -int PNS_DIFF_PAIR_PLACER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName ) +int DIFF_PAIR_PLACER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName ) { int rv = 0; @@ -440,20 +440,20 @@ int PNS_DIFF_PAIR_PLACER::matchDpSuffix( wxString aNetName, wxString& aComplemen } -OPT_VECTOR2I PNS_DIFF_PAIR_PLACER::getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM* aItem ) +OPT_VECTOR2I DIFF_PAIR_PLACER::getDanglingAnchor( NODE* aNode, ITEM* aItem ) { switch( aItem->Kind() ) { - case PNS_ITEM::VIA_T: - case PNS_ITEM::SOLID_T: + case ITEM::VIA_T: + case ITEM::SOLID_T: return aItem->Anchor( 0 ); - case PNS_ITEM::SEGMENT_T: + case ITEM::SEGMENT_T: { - PNS_SEGMENT* s =static_cast( aItem ); + SEGMENT* s =static_cast( aItem ); - PNS_JOINT* jA = aNode->FindJoint( s->Seg().A, s ); - PNS_JOINT* jB = aNode->FindJoint( s->Seg().B, s ); + JOINT* jA = aNode->FindJoint( s->Seg().A, s ); + JOINT* jB = aNode->FindJoint( s->Seg().B, s ); if( jA->LinkCount() == 1 ) return s->Seg().A; @@ -471,7 +471,7 @@ OPT_VECTOR2I PNS_DIFF_PAIR_PLACER::getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM* -bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aItem, PNS_DP_PRIMITIVE_PAIR& aPair ) +bool DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, ITEM* aItem, DP_PRIMITIVE_PAIR& aPair ) { int netP, netN; @@ -488,20 +488,20 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI wxLogTrace( "PNS", "result %d", !!result ); OPT_VECTOR2I refAnchor = getDanglingAnchor( m_currentNode, aItem ); - PNS_ITEM* primRef = aItem; + ITEM* primRef = aItem; wxLogTrace( "PNS", "refAnchor %p", aItem ); if( !refAnchor ) return false; - std::set coupledItems; + std::set coupledItems; m_currentNode->AllItemsInNet( coupledNet, coupledItems ); double bestDist = std::numeric_limits::max(); bool found = false; - for( PNS_ITEM* item : coupledItems ) + for( ITEM* item : coupledItems ) { if( item->Kind() == aItem->Kind() ) { @@ -513,7 +513,7 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI bool shapeMatches = true; - if( item->OfKind( PNS_ITEM::SOLID_T ) && item->Layers() != aItem->Layers() ) + if( item->OfKind( ITEM::SOLID_T ) && item->Layers() != aItem->Layers() ) { shapeMatches = false; } @@ -525,12 +525,12 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI if( refNet == netP ) { - aPair = PNS_DP_PRIMITIVE_PAIR ( item, primRef ); + aPair = DP_PRIMITIVE_PAIR ( item, primRef ); aPair.SetAnchors( *anchor, *refAnchor ); } else { - aPair = PNS_DP_PRIMITIVE_PAIR( primRef, item ); + aPair = DP_PRIMITIVE_PAIR( primRef, item ); aPair.SetAnchors( *refAnchor, *anchor ); } } @@ -541,19 +541,19 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI } -int PNS_DIFF_PAIR_PLACER::viaGap() const +int DIFF_PAIR_PLACER::viaGap() const { return m_sizes.DiffPairViaGap(); } -int PNS_DIFF_PAIR_PLACER::gap() const +int DIFF_PAIR_PLACER::gap() const { return m_sizes.DiffPairGap() + m_sizes.DiffPairWidth(); } -bool PNS_DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) +bool DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem ) { VECTOR2I p( aP ); @@ -611,17 +611,17 @@ bool PNS_DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) } -void PNS_DIFF_PAIR_PLACER::initPlacement() +void DIFF_PAIR_PLACER::initPlacement() { m_idle = false; m_orthoMode = false; m_currentEndItem = NULL; m_startDiagonal = m_initialDiagonal; - PNS_NODE* world = Router()->GetWorld(); + NODE* world = Router()->GetWorld(); world->KillChildren(); - PNS_NODE* rootNode = world->Branch(); + NODE* rootNode = world->Branch(); setWorld( rootNode ); @@ -636,24 +636,24 @@ void PNS_DIFF_PAIR_PLACER::initPlacement() if( m_currentMode == RM_Shove || m_currentMode == RM_Smart ) { - m_shove = new PNS_SHOVE( m_currentNode, Router() ); + m_shove = new SHOVE( m_currentNode, Router() ); } } -bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) +bool DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) { m_fitOk = false; - PNS_DP_GATEWAYS gwsEntry( gap() ); - PNS_DP_GATEWAYS gwsTarget( gap() ); + DP_GATEWAYS gwsEntry( gap() ); + DP_GATEWAYS gwsTarget( gap() ); if( !m_prevPair ) m_prevPair = m_start; gwsEntry.BuildFromPrimitivePair( *m_prevPair, m_startDiagonal ); - PNS_DP_PRIMITIVE_PAIR target; + DP_PRIMITIVE_PAIR target; if( findDpPrimitivePair( aP, m_currentEndItem, target ) ) { @@ -688,7 +688,7 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) m_snapOnTarget = false; } - m_currentTrace = PNS_DIFF_PAIR(); + m_currentTrace = DIFF_PAIR(); m_currentTrace.SetGap( gap() ); m_currentTrace.SetLayer( m_currentLayer ); @@ -713,7 +713,7 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) } -bool PNS_DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , PNS_ITEM* aEndItem ) +bool DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , ITEM* aEndItem ) { m_currentEndItem = aEndItem; m_fitOk = false; @@ -724,7 +724,7 @@ bool PNS_DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , PNS_ITEM* aEndItem ) if( !route( aP ) ) return false; - PNS_NODE* latestNode = m_currentNode; + NODE* latestNode = m_currentNode; m_lastNode = latestNode->Branch(); assert( m_lastNode != NULL ); @@ -736,7 +736,7 @@ bool PNS_DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , PNS_ITEM* aEndItem ) } -void PNS_DIFF_PAIR_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ) +void DIFF_PAIR_PLACER::UpdateSizes( const SIZES_SETTINGS& aSizes ) { m_sizes = aSizes; @@ -748,7 +748,7 @@ void PNS_DIFF_PAIR_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ) } -bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) { if( !m_fitOk ) return false; @@ -760,7 +760,7 @@ bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) if( m_currentTrace.CP().SegmentCount() > 1 ) m_initialDiagonal = !DIRECTION_45( m_currentTrace.CP().CSegment( -2 ) ).IsDiagonal(); - PNS_TOPOLOGY topo( m_lastNode ); + TOPOLOGY topo( m_lastNode ); if( !m_snapOnTarget && !m_currentTrace.EndsWithVias() ) { @@ -787,8 +787,8 @@ bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) m_chainedPlacement = !m_snapOnTarget; } - PNS_LINE lineP( m_currentTrace.PLine() ); - PNS_LINE lineN( m_currentTrace.NLine() ); + LINE lineP( m_currentTrace.PLine() ); + LINE lineN( m_currentTrace.NLine() ); m_lastNode->Add( &lineP ); m_lastNode->Add( &lineN ); @@ -816,17 +816,17 @@ bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -void PNS_DIFF_PAIR_PLACER::GetModifiedNets( std::vector &aNets ) const +void DIFF_PAIR_PLACER::GetModifiedNets( std::vector &aNets ) const { aNets.push_back( m_netP ); aNets.push_back( m_netN ); } -void PNS_DIFF_PAIR_PLACER::updateLeadingRatLine() +void DIFF_PAIR_PLACER::updateLeadingRatLine() { SHAPE_LINE_CHAIN ratLineN, ratLineP; - PNS_TOPOLOGY topo( m_lastNode ); + TOPOLOGY topo( m_lastNode ); if( topo.LeadingRatLine( &m_currentTrace.PLine(), ratLineP ) ) { @@ -840,7 +840,7 @@ void PNS_DIFF_PAIR_PLACER::updateLeadingRatLine() } -const std::vector PNS_DIFF_PAIR_PLACER::CurrentNets() const +const std::vector DIFF_PAIR_PLACER::CurrentNets() const { std::vector rv; rv.push_back( m_netP ); diff --git a/pcbnew/router/pns_diff_pair_placer.h b/pcbnew/router/pns_diff_pair_placer.h index e7a076e41d..b84a2e11bb 100644 --- a/pcbnew/router/pns_diff_pair_placer.h +++ b/pcbnew/router/pns_diff_pair_placer.h @@ -38,26 +38,25 @@ namespace PNS { -class PNS_ROUTER; -class PNS_SHOVE; -class PNS_OPTIMIZER; -class PNS_ROUTER_BASE; -class PNS_VIA; -class PNS_SIZES_SETTINGS; +class ROUTER; +class SHOVE; +class OPTIMIZER; +class VIA; +class SIZES_SETTINGS; /** - * Class PNS_LINE_PLACER + * Class LINE_PLACER * * Single track placement algorithm. Interactively routes a track. * Applies shove and walkaround algorithms when needed. */ -class PNS_DIFF_PAIR_PLACER : public PNS_PLACEMENT_ALGO +class DIFF_PAIR_PLACER : public PLACEMENT_ALGO { public: - PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter ); - ~PNS_DIFF_PAIR_PLACER(); + DIFF_PAIR_PLACER( ROUTER* aRouter ); + ~DIFF_PAIR_PLACER(); /** * Function Start() @@ -65,7 +64,7 @@ public: * Starts routing a single track at point aP, taking item aStartItem as anchor * (unless NULL). */ - bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ); + bool Start( const VECTOR2I& aP, ITEM* aStartItem ); /** * Function Move() @@ -74,7 +73,7 @@ public: * aEndItem as anchor (if not NULL). * (unless NULL). */ - bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + bool Move( const VECTOR2I& aP, ITEM* aEndItem ); /** * Function FixRoute() @@ -85,7 +84,7 @@ public: * result is violating design rules - in such case, the track is only committed * if Settings.CanViolateDRC() is on. */ - bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ); /** * Function ToggleVia() @@ -104,9 +103,9 @@ public: /** * Function Traces() * - * Returns the complete routed line, as a single-member PNS_ITEMSET. + * Returns the complete routed line, as a single-member ITEM_SET. */ - const PNS_ITEMSET Traces(); + const ITEM_SET Traces(); /** * Function CurrentEnd() @@ -141,7 +140,7 @@ public: * * Returns the most recent world state. */ - PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const; + NODE* CurrentNode( bool aLoopsRemoved = false ) const; /** * Function FlipPosture() @@ -157,7 +156,7 @@ public: * a settings class. Used to dynamically change these parameters as * the track is routed. */ - void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ); + void UpdateSizes( const SIZES_SETTINGS& aSizes ); bool IsPlacingVia() const { return m_placingVia; } @@ -195,7 +194,7 @@ private: * * Sets the board to route. */ - void setWorld( PNS_NODE* aWorld ); + void setWorld( NODE* aWorld ); /** * Function startPlacement() @@ -214,7 +213,7 @@ private: bool routeHead( const VECTOR2I& aP ); - bool tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR& aPair, bool aSolidsOnly ); + bool tryWalkDp( NODE* aNode, DIFF_PAIR& aPair, bool aSolidsOnly ); ///> route step, walkaround mode bool rhWalkOnly( const VECTOR2I& aP ); @@ -225,12 +224,12 @@ private: ///> route step, mark obstacles mode bool rhMarkObstacles( const VECTOR2I& aP ); - const PNS_VIA makeVia ( const VECTOR2I& aP, int aNet ); + const VIA makeVia ( const VECTOR2I& aP, int aNet ); - bool findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aItem, PNS_DP_PRIMITIVE_PAIR& aPair ); - OPT_VECTOR2I getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM* aItem ); + bool findDpPrimitivePair( const VECTOR2I& aP, ITEM* aItem, DP_PRIMITIVE_PAIR& aPair ); + OPT_VECTOR2I getDanglingAnchor( NODE* aNode, ITEM* aItem ); int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName ); - bool attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent, PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly ); + bool attemptWalk( NODE* aNode, DIFF_PAIR* aCurrent, DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly ); bool propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNewP ); enum State { @@ -248,28 +247,28 @@ private: int m_netP, m_netN; - PNS_DP_PRIMITIVE_PAIR m_start; - boost::optional m_prevPair; + DP_PRIMITIVE_PAIR m_start; + boost::optional m_prevPair; ///> current algorithm iteration int m_iteration; ///> pointer to world to search colliding items - PNS_NODE* m_world; + NODE* m_world; ///> current routing start point (end of tail, beginning of head) VECTOR2I m_p_start; ///> The shove engine - PNS_SHOVE* m_shove; + SHOVE* m_shove; ///> Current world state - PNS_NODE* m_currentNode; + NODE* m_currentNode; ///> Postprocessed world state (including marked collisions & removed loops) - PNS_NODE* m_lastNode; + NODE* m_lastNode; - PNS_SIZES_SETTINGS m_sizes; + SIZES_SETTINGS m_sizes; ///> Are we placing a via? bool m_placingVia; @@ -291,9 +290,9 @@ private: bool m_snapOnTarget; VECTOR2I m_currentEnd, m_currentStart; - PNS_DIFF_PAIR m_currentTrace; + DIFF_PAIR m_currentTrace; - PNS_ITEM* m_currentEndItem; + ITEM* m_currentEndItem; PNS_MODE m_currentMode; bool m_idle; diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index 59ccee9064..7604da0ecc 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -35,8 +35,8 @@ namespace PNS { using boost::optional; -PNS_DP_MEANDER_PLACER::PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter ) : - PNS_MEANDER_PLACER_BASE( aRouter ) +DP_MEANDER_PLACER::DP_MEANDER_PLACER( ROUTER* aRouter ) : + MEANDER_PLACER_BASE( aRouter ) { m_world = NULL; m_currentNode = NULL; @@ -48,18 +48,18 @@ PNS_DP_MEANDER_PLACER::PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter ) : } -PNS_DP_MEANDER_PLACER::~PNS_DP_MEANDER_PLACER() +DP_MEANDER_PLACER::~DP_MEANDER_PLACER() { } -const PNS_LINE PNS_DP_MEANDER_PLACER::Trace() const +const LINE DP_MEANDER_PLACER::Trace() const { return m_currentTraceP; } -PNS_NODE* PNS_DP_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const +NODE* DP_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const { if( !m_currentNode ) return m_world; @@ -68,17 +68,17 @@ PNS_NODE* PNS_DP_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const } -bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) +bool DP_MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem ) { VECTOR2I p; - if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T ) ) { Router()->SetFailureReason( _( "Please select a track whose length you want to tune." ) ); return false; } - m_initialSegment = static_cast( aStartItem ); + m_initialSegment = static_cast( aStartItem ); p = m_initialSegment->Seg().NearestPoint( aP ); @@ -87,7 +87,7 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) m_world = Router()->GetWorld()->Branch(); - PNS_TOPOLOGY topo( m_world ); + TOPOLOGY topo( m_world ); if( !topo.AssembleDiffPair( m_initialSegment, m_originPair ) ) { @@ -116,26 +116,26 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) } -void PNS_DP_MEANDER_PLACER::release() +void DP_MEANDER_PLACER::release() { } -int PNS_DP_MEANDER_PLACER::origPathLength() const +int DP_MEANDER_PLACER::origPathLength() const { int totalP = 0; int totalN = 0; - for( const PNS_ITEM* item : m_tunedPathP.CItems() ) + for( const ITEM* item : m_tunedPathP.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) totalP += l->CLine().Length(); } - for( const PNS_ITEM* item : m_tunedPathN.CItems() ) + for( const ITEM* item : m_tunedPathN.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) totalN += l->CLine().Length(); } @@ -143,7 +143,7 @@ int PNS_DP_MEANDER_PLACER::origPathLength() const } -const SEG PNS_DP_MEANDER_PLACER::baselineSegment( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs ) +const SEG DP_MEANDER_PLACER::baselineSegment( const DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs ) { const VECTOR2I a( ( aCoupledSegs.coupledP.A + aCoupledSegs.coupledN.A ) / 2 ); const VECTOR2I b( ( aCoupledSegs.coupledP.B + aCoupledSegs.coupledN.B ) / 2 ); @@ -152,7 +152,7 @@ const SEG PNS_DP_MEANDER_PLACER::baselineSegment( const PNS_DIFF_PAIR::COUPLED_S } -static bool pairOrientation( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aPair ) +static bool pairOrientation( const DIFF_PAIR::COUPLED_SEGMENTS& aPair ) { VECTOR2I midp = ( aPair.coupledP.A + aPair.coupledN.A ) / 2; @@ -162,11 +162,11 @@ static bool pairOrientation( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aPair ) } -bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) { // return false; - PNS_DIFF_PAIR::COUPLED_SEGMENTS_VEC coupledSegments; + DIFF_PAIR::COUPLED_SEGMENTS_VEC coupledSegments; if( m_currentNode ) delete m_currentNode; @@ -179,7 +179,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) cutTunedLine( m_originPair.CP(), m_currentStart, aP, preP, tunedP, postP ); cutTunedLine( m_originPair.CN(), m_currentStart, aP, preN, tunedN, postN ); - PNS_DIFF_PAIR tuned( m_originPair ); + DIFF_PAIR tuned( m_originPair ); tuned.SetShape( tunedP, tunedN ); @@ -194,7 +194,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) //Router()->DisplayDebugLine( m_originPair.CP(), 5, 20000 ); //Router()->DisplayDebugLine( m_originPair.CN(), 4, 20000 ); - m_result = PNS_MEANDERED_LINE( this, true ); + m_result = MEANDERED_LINE( this, true ); m_result.SetWidth( tuned.Width() ); int offset = ( tuned.Gap() + tuned.Width() ) / 2; @@ -204,21 +204,21 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) m_result.SetBaselineOffset( offset ); - for( const PNS_ITEM* item : m_tunedPathP.CItems() ) + for( const ITEM* item : m_tunedPathP.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) Dbg()->AddLine( l->CLine(), 5, 10000 ); } - for( const PNS_ITEM* item : m_tunedPathN.CItems() ) + for( const ITEM* item : m_tunedPathN.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) Dbg()->AddLine( l->CLine(), 5, 10000 ); } int curIndexP = 0, curIndexN = 0; - for( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& sp : coupledSegments ) + for( const DIFF_PAIR::COUPLED_SEGMENTS& sp : coupledSegments ) { SEG base = baselineSegment( sp ); @@ -265,7 +265,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) tunedP.Clear(); tunedN.Clear(); - for( PNS_MEANDER_SHAPE* m : m_result.Meanders() ) + for( MEANDER_SHAPE* m : m_result.Meanders() ) { if( m->Type() != MT_EMPTY ) { @@ -302,10 +302,10 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -bool PNS_DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) { - PNS_LINE lP( m_originPair.PLine(), m_finalShapeP ); - PNS_LINE lN( m_originPair.NLine(), m_finalShapeN ); + LINE lP( m_originPair.PLine(), m_finalShapeP ); + LINE lN( m_originPair.NLine(), m_finalShapeN ); m_currentNode->Add( &lP ); m_currentNode->Add( &lN ); @@ -316,10 +316,10 @@ bool PNS_DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -bool PNS_DP_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape ) +bool DP_MEANDER_PLACER::CheckFit( MEANDER_SHAPE* aShape ) { - PNS_LINE l1( m_originPair.PLine(), aShape->CLine( 0 ) ); - PNS_LINE l2( m_originPair.NLine(), aShape->CLine( 1 ) ); + LINE l1( m_originPair.PLine(), aShape->CLine( 0 ) ); + LINE l2( m_originPair.NLine(), aShape->CLine( 1 ) ); if( m_currentNode->CheckColliding( &l1 ) ) return false; @@ -334,12 +334,12 @@ bool PNS_DP_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape ) } -const PNS_ITEMSET PNS_DP_MEANDER_PLACER::Traces() +const ITEM_SET DP_MEANDER_PLACER::Traces() { - m_currentTraceP = PNS_LINE( m_originPair.PLine(), m_finalShapeP ); - m_currentTraceN = PNS_LINE( m_originPair.NLine(), m_finalShapeN ); + m_currentTraceP = LINE( m_originPair.PLine(), m_finalShapeP ); + m_currentTraceN = LINE( m_originPair.NLine(), m_finalShapeN ); - PNS_ITEMSET traces; + ITEM_SET traces; traces.Add( &m_currentTraceP ); traces.Add( &m_currentTraceN ); @@ -348,19 +348,19 @@ const PNS_ITEMSET PNS_DP_MEANDER_PLACER::Traces() } -const VECTOR2I& PNS_DP_MEANDER_PLACER::CurrentEnd() const +const VECTOR2I& DP_MEANDER_PLACER::CurrentEnd() const { return m_currentEnd; } -int PNS_DP_MEANDER_PLACER::CurrentLayer() const +int DP_MEANDER_PLACER::CurrentLayer() const { return m_initialSegment->Layers().Start(); } -const wxString PNS_DP_MEANDER_PLACER::TuningInfo() const +const wxString DP_MEANDER_PLACER::TuningInfo() const { wxString status; @@ -390,12 +390,12 @@ const wxString PNS_DP_MEANDER_PLACER::TuningInfo() const } -PNS_DP_MEANDER_PLACER::TUNING_STATUS PNS_DP_MEANDER_PLACER::TuningStatus() const +DP_MEANDER_PLACER::TUNING_STATUS DP_MEANDER_PLACER::TuningStatus() const { return m_lastStatus; } -const std::vector PNS_DP_MEANDER_PLACER::CurrentNets() const +const std::vector DP_MEANDER_PLACER::CurrentNets() const { std::vector rv; rv.push_back( m_originPair.NetP() ); diff --git a/pcbnew/router/pns_dp_meander_placer.h b/pcbnew/router/pns_dp_meander_placer.h index 240d3de96b..dc21f7bb69 100644 --- a/pcbnew/router/pns_dp_meander_placer.h +++ b/pcbnew/router/pns_dp_meander_placer.h @@ -38,19 +38,19 @@ namespace PNS { -class PNS_ROUTER; +class ROUTER; /** - * Class PNS_DP_MEANDER_PLACER + * Class DP_MEANDER_PLACER * * Differential Pair length-matching/meandering tool. */ -class PNS_DP_MEANDER_PLACER : public PNS_MEANDER_PLACER_BASE +class DP_MEANDER_PLACER : public MEANDER_PLACER_BASE { public: - PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter ); - ~PNS_DP_MEANDER_PLACER(); + DP_MEANDER_PLACER( ROUTER* aRouter ); + ~DP_MEANDER_PLACER(); /** * Function Start() @@ -58,7 +58,7 @@ public: * Starts routing a single track at point aP, taking item aStartItem as anchor * (unless NULL). */ - bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ); + bool Start( const VECTOR2I& aP, ITEM* aStartItem ); /** * Function Move() @@ -67,7 +67,7 @@ public: * aEndItem as anchor (if not NULL). * (unless NULL). */ - bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + bool Move( const VECTOR2I& aP, ITEM* aEndItem ); /** * Function FixRoute() @@ -78,22 +78,22 @@ public: * result is violating design rules - in such case, the track is only committed * if Settings.CanViolateDRC() is on. */ - bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ); - const PNS_LINE Trace() const; + const LINE Trace() const; /** * Function CurrentNode() * * Returns the most recent world state. */ - PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const; + NODE* CurrentNode( bool aLoopsRemoved = false ) const; - const PNS_ITEMSET Traces(); + const ITEM_SET Traces(); const VECTOR2I& CurrentEnd() const; - /// @copydoc PNS_PLACEMENT_ALGO::CurrentNets() + /// @copydoc PLACEMENT_ALGO::CurrentNets() const std::vector CurrentNets() const; int CurrentLayer() const; @@ -103,42 +103,42 @@ public: const wxString TuningInfo() const; TUNING_STATUS TuningStatus() const; - bool CheckFit( PNS_MEANDER_SHAPE* aShape ); + bool CheckFit( MEANDER_SHAPE* aShape ); private: - friend class PNS_MEANDER_SHAPE; + friend class MEANDER_SHAPE; void meanderSegment( const SEG& aBase ); // void addMeander ( PNS_MEANDER *aM ); // void addCorner ( const VECTOR2I& aP ); - const SEG baselineSegment( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs ); + const SEG baselineSegment( const DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs ); - void setWorld( PNS_NODE* aWorld ); + void setWorld( NODE* aWorld ); void release(); int origPathLength() const; ///> pointer to world to search colliding items - PNS_NODE* m_world; + NODE* m_world; ///> current routing start point (end of tail, beginning of head) VECTOR2I m_currentStart; ///> Current world state - PNS_NODE* m_currentNode; + NODE* m_currentNode; - PNS_DIFF_PAIR m_originPair; - PNS_DIFF_PAIR::COUPLED_SEGMENTS_VEC m_coupledSegments; + DIFF_PAIR m_originPair; + DIFF_PAIR::COUPLED_SEGMENTS_VEC m_coupledSegments; - PNS_LINE m_currentTraceN, m_currentTraceP; - PNS_ITEMSET m_tunedPath, m_tunedPathP, m_tunedPathN; + LINE m_currentTraceN, m_currentTraceP; + ITEM_SET m_tunedPath, m_tunedPathP, m_tunedPathN; SHAPE_LINE_CHAIN m_finalShapeP, m_finalShapeN; - PNS_MEANDERED_LINE m_result; - PNS_SEGMENT* m_initialSegment; + MEANDERED_LINE m_result; + SEGMENT* m_initialSegment; int m_lastLength; TUNING_STATUS m_lastStatus; diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index 856d016730..dfabc136b3 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -25,12 +25,12 @@ namespace PNS { -PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) : - PNS_ALGO_BASE( aRouter ) +DRAGGER::DRAGGER( ROUTER* aRouter ) : + ALGO_BASE( aRouter ) { m_world = NULL; m_lastNode = NULL; - m_mode = SEGMENT; + m_mode = DRAG_SEGMENT; m_draggedVia = NULL; m_shove = NULL; m_draggedSegmentIndex = 0; @@ -40,20 +40,20 @@ PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) : } -PNS_DRAGGER::~PNS_DRAGGER() +DRAGGER::~DRAGGER() { if( m_shove ) delete m_shove; } -void PNS_DRAGGER::SetWorld( PNS_NODE* aWorld ) +void DRAGGER::SetWorld( NODE* aWorld ) { m_world = aWorld; } -bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg ) +bool DRAGGER::startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg ) { int w2 = aSeg->Width() / 2; @@ -63,37 +63,37 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg ) m_lastValidDraggedLine.ClearSegmentLinks(); if( ( aP - aSeg->Seg().A ).EuclideanNorm() <= w2 ) - m_mode = CORNER; + m_mode = DRAG_CORNER; else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 ) { m_draggedSegmentIndex++; - m_mode = CORNER; + m_mode = DRAG_CORNER; } else - m_mode = SEGMENT; + m_mode = DRAG_SEGMENT; return true; } -bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia ) +bool DRAGGER::startDragVia( const VECTOR2D& aP, VIA* aVia ) { m_draggedVia = aVia; m_initialVia = aVia; - m_mode = VIA; + m_mode = DRAG_VIA; VECTOR2I p0( aVia->Pos() ); - PNS_JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() ); + JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() ); if( !jt ) return false; - for( PNS_ITEM* item : jt->LinkList() ) + for( ITEM* item : jt->LinkList() ) { - if( item->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( item->OfKind( ITEM::SEGMENT_T ) ) { int segIndex; - PNS_SEGMENT* seg = ( PNS_SEGMENT*) item; - PNS_LINE l = m_world->AssembleLine( seg, &segIndex ); + SEGMENT* seg = ( SEGMENT*) item; + LINE l = m_world->AssembleLine( seg, &segIndex ); if( segIndex != 0 ) l.Reverse(); @@ -106,9 +106,9 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia ) } -bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) +bool DRAGGER::Start( const VECTOR2I& aP, ITEM* aStartItem ) { - m_shove = new PNS_SHOVE( m_world, Router() ); + m_shove = new SHOVE( m_world, Router() ); m_lastNode = NULL; m_draggedItems.Clear(); m_currentMode = Settings().Mode(); @@ -119,11 +119,11 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) switch( aStartItem->Kind() ) { - case PNS_ITEM::SEGMENT_T: - return startDragSegment( aP, static_cast( aStartItem ) ); + case ITEM::SEGMENT_T: + return startDragSegment( aP, static_cast( aStartItem ) ); - case PNS_ITEM::VIA_T: - return startDragVia( aP, static_cast( aStartItem ) ); + case ITEM::VIA_T: + return startDragVia( aP, static_cast( aStartItem ) ); default: return false; @@ -131,7 +131,7 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) } -bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) +bool DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) { if( m_lastNode ) { @@ -141,13 +141,13 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) switch( m_mode ) { - case SEGMENT: - case CORNER: + case DRAG_SEGMENT: + case DRAG_CORNER: { int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0; - PNS_LINE dragged( m_draggedLine ); + LINE dragged( m_draggedLine ); - if( m_mode == SEGMENT ) + if( m_mode == DRAG_SEGMENT ) dragged.DragSegment( aP, m_draggedSegmentIndex, thresh ); else dragged.DragCorner( aP, m_draggedSegmentIndex, thresh ); @@ -165,7 +165,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) break; } - case VIA: // fixme... + case DRAG_VIA: // fixme... { m_lastNode = m_shove->CurrentNode()->Branch(); dumbDragVia( m_initialVia, m_lastNode, aP ); @@ -183,7 +183,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) } -void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP ) +void DRAGGER::dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP ) { m_draggedItems.Clear(); @@ -196,12 +196,12 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a m_lastNode->Remove( aVia ); m_lastNode->Add( m_draggedVia ); - for( PNS_ITEM* item : m_origViaConnections.Items() ) + for( ITEM* item : m_origViaConnections.Items() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) { - PNS_LINE origLine( *l ); - PNS_LINE draggedLine( *l ); + LINE origLine( *l ); + LINE draggedLine( *l ); draggedLine.DragCorner( aP, origLine.CLine().Find( aVia->Pos() ) ); draggedLine.ClearSegmentLinks(); @@ -215,7 +215,7 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a } -bool PNS_DRAGGER::dragShove( const VECTOR2I& aP ) +bool DRAGGER::dragShove( const VECTOR2I& aP ) { bool ok = false; @@ -227,22 +227,22 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP ) switch( m_mode ) { - case SEGMENT: - case CORNER: + case DRAG_SEGMENT: + case DRAG_CORNER: { int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0; - PNS_LINE dragged( m_draggedLine ); + LINE dragged( m_draggedLine ); - if( m_mode == SEGMENT ) + if( m_mode == DRAG_SEGMENT ) dragged.DragSegment( aP, m_draggedSegmentIndex, thresh ); else dragged.DragCorner( aP, m_draggedSegmentIndex, thresh ); - PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged ); + SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged ); - if( st == PNS_SHOVE::SH_OK ) + if( st == SHOVE::SH_OK ) ok = true; - else if( st == PNS_SHOVE::SH_HEAD_MODIFIED ) + else if( st == SHOVE::SH_HEAD_MODIFIED ) { dragged = m_shove->NewHead(); ok = true; @@ -262,12 +262,12 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP ) break; } - case VIA: + case DRAG_VIA: { - PNS_VIA* newVia; - PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia ); + VIA* newVia; + 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 == SHOVE::SH_OK || st == SHOVE::SH_HEAD_MODIFIED ) ok = true; m_lastNode = m_shove->CurrentNode()->Branch(); @@ -289,7 +289,7 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP ) } -bool PNS_DRAGGER::FixRoute() +bool DRAGGER::FixRoute() { if( m_dragStatus ) { @@ -301,7 +301,7 @@ bool PNS_DRAGGER::FixRoute() } -bool PNS_DRAGGER::Drag( const VECTOR2I& aP ) +bool DRAGGER::Drag( const VECTOR2I& aP ) { switch( m_currentMode ) { @@ -319,19 +319,19 @@ bool PNS_DRAGGER::Drag( const VECTOR2I& aP ) } -PNS_NODE* PNS_DRAGGER::CurrentNode() const +NODE* DRAGGER::CurrentNode() const { return m_lastNode; } -const PNS_ITEMSET PNS_DRAGGER::Traces() +const ITEM_SET DRAGGER::Traces() { return m_draggedItems; } -PNS_LOGGER* PNS_DRAGGER::Logger() +LOGGER* DRAGGER::Logger() { if( m_shove ) return m_shove->Logger(); diff --git a/pcbnew/router/pns_dragger.h b/pcbnew/router/pns_dragger.h index d4c727afea..8c878373ce 100644 --- a/pcbnew/router/pns_dragger.h +++ b/pcbnew/router/pns_dragger.h @@ -32,28 +32,27 @@ namespace PNS { -class PNS_ROUTER; -class PNS_SHOVE; -class PNS_OPTIMIZER; -class PNS_ROUTER_BASE; +class ROUTER; +class SHOVE; +class OPTIMIZER; /** - * Class PNS_DRAGGER + * Class DRAGGER * * Via, segment and corner dragging algorithm. */ -class PNS_DRAGGER : public PNS_ALGO_BASE +class DRAGGER : public ALGO_BASE { public: - PNS_DRAGGER( PNS_ROUTER* aRouter ); - ~PNS_DRAGGER(); + DRAGGER( ROUTER* aRouter ); + ~DRAGGER(); /** * Function SetWorld() * * Sets the board to work on. */ - void SetWorld( PNS_NODE* aWorld ); + void SetWorld( NODE* aWorld ); /** * Function Start() @@ -61,7 +60,7 @@ public: * Starts routing a single track at point aP, taking item aStartItem as anchor * (unless NULL). Returns true if a dragging operation has started. */ - bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ); + bool Start( const VECTOR2I& aP, ITEM* aStartItem ); /** * Function Drag() @@ -86,44 +85,44 @@ public: * Returns the most recent world state, including all * items changed due to dragging operation. */ - PNS_NODE* CurrentNode() const; + NODE* CurrentNode() const; /** * Function Traces() * * Returns the set of dragged items. */ - const PNS_ITEMSET Traces(); + const ITEM_SET Traces(); - /// @copydoc PNS_ALGO_BASE::Logger() - virtual PNS_LOGGER* Logger(); + /// @copydoc ALGO_BASE::Logger() + virtual LOGGER* Logger(); private: enum DragMode { - CORNER = 0, - SEGMENT, - VIA + DRAG_CORNER = 0, + DRAG_SEGMENT, + DRAG_VIA }; bool dragMarkObstacles( const VECTOR2I& aP ); bool dragShove(const VECTOR2I& aP ); - bool startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg ); - bool startDragVia( const VECTOR2D& aP, PNS_VIA* aVia ); - void dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP ); + bool startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg ); + bool startDragVia( const VECTOR2D& aP, VIA* aVia ); + void dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP ); - PNS_NODE* m_world; - PNS_NODE* m_lastNode; - DragMode m_mode; - PNS_LINE m_draggedLine; - PNS_VIA* m_draggedVia; - PNS_LINE m_lastValidDraggedLine; - PNS_SHOVE* m_shove; - int m_draggedSegmentIndex; - bool m_dragStatus; - PNS_MODE m_currentMode; - PNS_ITEMSET m_origViaConnections; - PNS_VIA* m_initialVia; - PNS_ITEMSET m_draggedItems; + NODE* m_world; + NODE* m_lastNode; + DragMode m_mode; + LINE m_draggedLine; + VIA* m_draggedVia; + LINE m_lastValidDraggedLine; + SHOVE* m_shove; + int m_draggedSegmentIndex; + bool m_dragStatus; + PNS_MODE m_currentMode; + ITEM_SET m_origViaConnections; + VIA* m_initialVia; + ITEM_SET m_draggedItems; }; } diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h index 75636cf50f..a948865322 100644 --- a/pcbnew/router/pns_index.h +++ b/pcbnew/router/pns_index.h @@ -36,42 +36,42 @@ namespace PNS { /** - * Class PNS_INDEX + * Class INDEX * * Custom spatial index, holding our board items and allowing for very fast searches. Items * are assigned to separate R-Tree subindices depending on their type and spanned layers, reducing * overlap and improving search time. **/ -class PNS_INDEX +class INDEX { public: - typedef std::list NET_ITEMS_LIST; - typedef SHAPE_INDEX ITEM_SHAPE_INDEX; - typedef boost::unordered_set ITEM_SET; + typedef std::list NET_ITEMS_LIST; + typedef SHAPE_INDEX ITEM_SHAPE_INDEX; + typedef boost::unordered_set ITEM_SET; - PNS_INDEX(); - ~PNS_INDEX(); + INDEX(); + ~INDEX(); /** * Function Add() * * Adds item to the spatial index. */ - void Add( PNS_ITEM* aItem ); + void Add( ITEM* aItem ); /** * Function Remove() * * Removes an item from the spatial index. */ - void Remove( PNS_ITEM* aItem ); + void Remove( ITEM* aItem ); /** * Function Add() * * Replaces one item with another. */ - void Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem ); + void Replace( ITEM* aOldItem, ITEM* aNewItem ); /** * Function Query() @@ -87,7 +87,7 @@ public: * @return number of items found. */ template - int Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor ); + int Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ); /** * Function Query() @@ -124,7 +124,7 @@ public: * * Returns true if item aItem exists in the index. */ - bool Contains( PNS_ITEM* aItem ) const + bool Contains( ITEM* aItem ) const { return m_allItems.find( aItem ) != m_allItems.end(); } @@ -151,31 +151,31 @@ private: template int querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ); - ITEM_SHAPE_INDEX* getSubindex( const PNS_ITEM* aItem ); + ITEM_SHAPE_INDEX* getSubindex( const ITEM* aItem ); ITEM_SHAPE_INDEX* m_subIndices[MaxSubIndices]; std::map m_netMap; ITEM_SET m_allItems; }; -PNS_INDEX::PNS_INDEX() +INDEX::INDEX() { memset( m_subIndices, 0, sizeof( m_subIndices ) ); } -PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem ) +INDEX::ITEM_SHAPE_INDEX* INDEX::getSubindex( const ITEM* aItem ) { int idx_n = -1; - const PNS_LAYERSET l = aItem->Layers(); + const LAYER_RANGE l = aItem->Layers(); switch( aItem->Kind() ) { - case PNS_ITEM::VIA_T: + case ITEM::VIA_T: idx_n = SI_Multilayer; break; - case PNS_ITEM::SOLID_T: + case ITEM::SOLID_T: { if( l.IsMultilayer() ) idx_n = SI_Multilayer; @@ -186,8 +186,8 @@ PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem ) } break; - case PNS_ITEM::SEGMENT_T: - case PNS_ITEM::LINE_T: + case ITEM::SEGMENT_T: + case ITEM::LINE_T: idx_n = SI_Traces + 2 * l.Start() + SI_SegStraight; break; @@ -203,7 +203,7 @@ PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem ) return m_subIndices[idx_n]; } -void PNS_INDEX::Add( PNS_ITEM* aItem ) +void INDEX::Add( ITEM* aItem ) { ITEM_SHAPE_INDEX* idx = getSubindex( aItem ); @@ -217,7 +217,7 @@ void PNS_INDEX::Add( PNS_ITEM* aItem ) } } -void PNS_INDEX::Remove( PNS_ITEM* aItem ) +void INDEX::Remove( ITEM* aItem ) { ITEM_SHAPE_INDEX* idx = getSubindex( aItem ); @@ -230,14 +230,14 @@ void PNS_INDEX::Remove( PNS_ITEM* aItem ) m_netMap[net].remove( aItem ); } -void PNS_INDEX::Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem ) +void INDEX::Replace( ITEM* aOldItem, ITEM* aNewItem ) { Remove( aOldItem ); Add( aNewItem ); } template -int PNS_INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) +int INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) { if( !m_subIndices[index] ) return 0; @@ -246,14 +246,14 @@ int PNS_INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Vi } template -int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor ) +int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) { const SHAPE* shape = aItem->Shape(); int total = 0; total += querySingle( SI_Multilayer, shape, aMinDistance, aVisitor ); - const PNS_LAYERSET layers = aItem->Layers(); + const LAYER_RANGE layers = aItem->Layers(); if( layers.IsMultilayer() ) { @@ -279,7 +279,7 @@ int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor } template -int PNS_INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) +int INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) { int total = 0; @@ -289,7 +289,7 @@ int PNS_INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) return total; } -void PNS_INDEX::Clear() +void INDEX::Clear() { for( int i = 0; i < MaxSubIndices; ++i ) { @@ -302,12 +302,12 @@ void PNS_INDEX::Clear() } } -PNS_INDEX::~PNS_INDEX() +INDEX::~INDEX() { Clear(); } -PNS_INDEX::NET_ITEMS_LIST* PNS_INDEX::GetItemsForNet( int aNet ) +INDEX::NET_ITEMS_LIST* INDEX::GetItemsForNet( int aNet ) { if( m_netMap.find( aNet ) == m_netMap.end() ) return NULL; diff --git a/pcbnew/router/pns_item.cpp b/pcbnew/router/pns_item.cpp index b060d3181d..da78611798 100644 --- a/pcbnew/router/pns_item.cpp +++ b/pcbnew/router/pns_item.cpp @@ -24,7 +24,7 @@ namespace PNS { -bool PNS_ITEM::collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, +bool ITEM::collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV, VECTOR2I& aMTV, bool aDifferentNetsOnly ) const { // same nets? no collision! @@ -41,7 +41,7 @@ bool PNS_ITEM::collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeed } -bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, +bool ITEM::Collide( const ITEM* aOther, int aClearance, bool aNeedMTV, VECTOR2I& aMTV, bool aDifferentNetsOnly ) const { if( collideSimple( aOther, aClearance, aNeedMTV, aMTV, aDifferentNetsOnly ) ) @@ -50,7 +50,7 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, // special case for "head" line with a via attached at the end. if( aOther->m_kind == LINE_T ) { - const PNS_LINE* line = static_cast( aOther ); + const LINE* line = static_cast( aOther ); if( line->EndsWithVia() ) return collideSimple( &line->Via(), aClearance - line->Width() / 2, aNeedMTV, aMTV, aDifferentNetsOnly ); @@ -60,7 +60,7 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, } -const std::string PNS_ITEM::KindStr() const +const std::string ITEM::KindStr() const { switch( m_kind ) { @@ -85,7 +85,7 @@ const std::string PNS_ITEM::KindStr() const } -PNS_ITEM::~PNS_ITEM() +ITEM::~ITEM() { } diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index 6e4aa0a977..b04631195a 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -33,7 +33,7 @@ class BOARD_CONNECTED_ITEM; namespace PNS { -class PNS_NODE; +class NODE; enum LineMarker { MK_HEAD = ( 1 << 0 ), @@ -44,12 +44,12 @@ enum LineMarker { /** - * Class PNS_ITEM + * Class ITEM * * Base class for PNS router board items. Implements the shared properties of all PCB items - * net, spanned layers, geometric shape & refererence to owning model. */ -class PNS_ITEM +class ITEM { public: static const int UnusedNet = INT_MAX; @@ -66,7 +66,7 @@ public: ANY_T = 0xff }; - PNS_ITEM( PnsKind aKind ) + ITEM( PnsKind aKind ) { m_net = UnusedNet; m_movable = true; @@ -77,7 +77,7 @@ public: m_rank = -1; } - PNS_ITEM( const PNS_ITEM& aOther ) + ITEM( const ITEM& aOther ) { m_layers = aOther.m_layers; m_net = aOther.m_net; @@ -89,14 +89,14 @@ public: m_rank = aOther.m_rank; } - virtual ~PNS_ITEM(); + virtual ~ITEM(); /** * Function Clone() * * Returns a deep copy of the item */ - virtual PNS_ITEM* Clone() const = 0; + virtual ITEM* Clone() const = 0; /* * Function Hull() @@ -183,7 +183,7 @@ public: * * Sets the layers spanned by the item to aLayers. */ - void SetLayers( const PNS_LAYERSET& aLayers ) + void SetLayers( const LAYER_RANGE& aLayers ) { m_layers = aLayers; } @@ -195,7 +195,7 @@ public: */ void SetLayer( int aLayer ) { - m_layers = PNS_LAYERSET( aLayer, aLayer ); + m_layers = LAYER_RANGE( aLayer, aLayer ); } /** @@ -203,7 +203,7 @@ public: * * Returns the contiguous set of layers spanned by the item. */ - const PNS_LAYERSET& Layers() const + const LAYER_RANGE& Layers() const { return m_layers; } @@ -224,7 +224,7 @@ public: * Returns true if the set of layers spanned by aOther overlaps our * layers. */ - bool LayersOverlap( const PNS_ITEM* aOther ) const + bool LayersOverlap( const ITEM* aOther ) const { return Layers().Overlaps( aOther->Layers() ); } @@ -233,9 +233,9 @@ public: * Functon SetOwner() * * Sets the node that owns this item. An item can belong to a single - * PNS_NODE or stay unowned. + * NODE or stay unowned. */ - void SetOwner( PNS_NODE* aOwner ) + void SetOwner( NODE* aOwner ) { m_owner = aOwner; } @@ -245,7 +245,7 @@ public: * * @return true if the item is owned by the node aNode. */ - bool BelongsTo( PNS_NODE* aNode ) const + bool BelongsTo( NODE* aNode ) const { return m_owner == aNode; } @@ -255,7 +255,7 @@ public: * * Returns the owner of this item, or NULL if there's none. */ - PNS_NODE* Owner() const { return m_owner; } + NODE* Owner() const { return m_owner; } /** * Function Collide() @@ -271,15 +271,15 @@ public: * @param aMTV the minimum translation vector * @return true, if a collision was found. */ - virtual bool Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, + virtual bool Collide( const ITEM* aOther, int aClearance, bool aNeedMTV, VECTOR2I& aMTV, bool aDifferentNetsOnly = true ) const; /** * Function Collide() * - * A shortcut for PNS_ITEM::Colllide() without MTV stuff. + * A shortcut for ITEM::Colllide() without MTV stuff. */ - bool Collide( const PNS_ITEM* aOther, int aClearance, bool aDifferentNetsOnly = true ) const + bool Collide( const ITEM* aOther, int aClearance, bool aDifferentNetsOnly = true ) const { VECTOR2I dummy; @@ -338,15 +338,15 @@ public: } private: - bool collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, + bool collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV, VECTOR2I& aMTV, bool aDifferentNetsOnly ) const; protected: PnsKind m_kind; BOARD_CONNECTED_ITEM* m_parent; - PNS_NODE* m_owner; - PNS_LAYERSET m_layers; + NODE* m_owner; + LAYER_RANGE m_layers; bool m_movable; int m_net; diff --git a/pcbnew/router/pns_itemset.cpp b/pcbnew/router/pns_itemset.cpp index 32f19c57ce..139ae5f87f 100644 --- a/pcbnew/router/pns_itemset.cpp +++ b/pcbnew/router/pns_itemset.cpp @@ -24,34 +24,34 @@ namespace PNS { -PNS_ITEMSET::~PNS_ITEMSET() +ITEM_SET::~ITEM_SET() { } -void PNS_ITEMSET::Add( const PNS_LINE& aLine ) +void ITEM_SET::Add( const LINE& aLine ) { - PNS_LINE* copy = aLine.Clone(); + LINE* copy = aLine.Clone(); m_items.push_back( ENTRY( copy, true ) ); } -void PNS_ITEMSET::Prepend( const PNS_LINE& aLine ) +void ITEM_SET::Prepend( const LINE& aLine ) { - PNS_LINE* copy = aLine.Clone(); + LINE* copy = aLine.Clone(); m_items.insert( m_items.begin(), ENTRY( copy, true ) ); } -PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert ) +ITEM_SET& ITEM_SET::FilterLayers( int aStart, int aEnd, bool aInvert ) { ENTRIES newItems; - PNS_LAYERSET l; + LAYER_RANGE l; if( aEnd < 0 ) - l = PNS_LAYERSET( aStart ); + l = LAYER_RANGE( aStart ); else - l = PNS_LAYERSET( aStart, aEnd ); + l = LAYER_RANGE( aStart, aEnd ); for( const ENTRY& ent : m_items ) { @@ -67,7 +67,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert ) } -PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert ) +ITEM_SET& ITEM_SET::FilterKinds( int aKindMask, bool aInvert ) { ENTRIES newItems; @@ -85,7 +85,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert ) } -PNS_ITEMSET& PNS_ITEMSET::FilterMarker( int aMarker, bool aInvert ) +ITEM_SET& ITEM_SET::FilterMarker( int aMarker, bool aInvert ) { ENTRIES newItems; @@ -103,7 +103,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterMarker( int aMarker, bool aInvert ) } -PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert ) +ITEM_SET& ITEM_SET::FilterNet( int aNet, bool aInvert ) { ENTRIES newItems; @@ -121,7 +121,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert ) } -PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem ) +ITEM_SET& ITEM_SET::ExcludeItem( const ITEM* aItem ) { ENTRIES newItems; diff --git a/pcbnew/router/pns_itemset.h b/pcbnew/router/pns_itemset.h index 59e02a5836..d55a180bb1 100644 --- a/pcbnew/router/pns_itemset.h +++ b/pcbnew/router/pns_itemset.h @@ -29,19 +29,19 @@ namespace PNS { /** - * Class PNS_ITEMSET + * Class ITEM_SET * * Holds a list of board items, that can be filtered against net, kinds, * layers, etc. **/ -class PNS_LINE; +class LINE; -class PNS_ITEMSET +class ITEM_SET { public: struct ENTRY { - ENTRY( PNS_ITEM* aItem, bool aOwned = false ) : + ENTRY( ITEM* aItem, bool aOwned = false ) : item( aItem ), owned( aOwned ) {} @@ -84,18 +84,18 @@ public: return *this; } - operator PNS_ITEM* () const + operator ITEM* () const { return item; } - PNS_ITEM *item; + ITEM *item; bool owned; }; typedef std::vector ENTRIES; - PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL, bool aBecomeOwner = false ) + ITEM_SET( ITEM* aInitialItem = NULL, bool aBecomeOwner = false ) { if( aInitialItem ) { @@ -103,14 +103,14 @@ public: } } - PNS_ITEMSET( const PNS_ITEMSET& aOther ) + ITEM_SET( const ITEM_SET& aOther ) { m_items = aOther.m_items; } - ~PNS_ITEMSET(); + ~ITEM_SET(); - const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther ) + const ITEM_SET& operator=( const ITEM_SET& aOther ) { m_items = aOther.m_items; return *this; @@ -120,7 +120,7 @@ public: { int n = 0; - for( PNS_ITEM* item : m_items ) + for( ITEM* item : m_items ) { if( item->Kind() & aKindMask ) n++; @@ -137,47 +137,47 @@ public: ENTRIES& Items() { return m_items; } const ENTRIES& CItems() const { return m_items; } - PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1, bool aInvert = false ); - PNS_ITEMSET& FilterKinds( int aKindMask, bool aInvert = false ); - PNS_ITEMSET& FilterNet( int aNet, bool aInvert = false ); - PNS_ITEMSET& FilterMarker( int aMarker, bool aInvert = false ); + ITEM_SET& FilterLayers( int aStart, int aEnd = -1, bool aInvert = false ); + ITEM_SET& FilterKinds( int aKindMask, bool aInvert = false ); + ITEM_SET& FilterNet( int aNet, bool aInvert = false ); + ITEM_SET& FilterMarker( int aMarker, bool aInvert = false ); - PNS_ITEMSET& ExcludeLayers( int aStart, int aEnd = -1 ) + ITEM_SET& ExcludeLayers( int aStart, int aEnd = -1 ) { return FilterLayers( aStart, aEnd, true ); } - PNS_ITEMSET& ExcludeKinds( int aKindMask ) + ITEM_SET& ExcludeKinds( int aKindMask ) { return FilterKinds( aKindMask, true ); } - PNS_ITEMSET& ExcludeNet( int aNet ) + ITEM_SET& ExcludeNet( int aNet ) { return FilterNet( aNet, true ); } - PNS_ITEMSET& ExcludeItem( const PNS_ITEM* aItem ); + ITEM_SET& ExcludeItem( const ITEM* aItem ); int Size() const { return m_items.size(); } - void Add( const PNS_LINE& aLine ); - void Prepend( const PNS_LINE& aLine ); + void Add( const LINE& aLine ); + void Prepend( const LINE& aLine ); - PNS_ITEM* operator[] ( int index ) const + ITEM* operator[] ( int index ) const { return m_items[index].item; } - void Add( PNS_ITEM* aItem, bool aBecomeOwner = false ) + void Add( ITEM* aItem, bool aBecomeOwner = false ) { m_items.push_back( ENTRY( aItem, aBecomeOwner ) ); } - void Prepend( PNS_ITEM* aItem, bool aBecomeOwner = false ) + void Prepend( ITEM* aItem, bool aBecomeOwner = false ) { m_items.insert( m_items.begin(), ENTRY( aItem, aBecomeOwner ) ); } @@ -187,13 +187,13 @@ public: m_items.clear(); } - bool Contains( PNS_ITEM* aItem ) const + bool Contains( ITEM* aItem ) const { const ENTRY ent( aItem ); return std::find( m_items.begin(), m_items.end(), ent ) != m_items.end(); } - void Erase( PNS_ITEM* aItem ) + void Erase( ITEM* aItem ) { ENTRY ent( aItem ); ENTRIES::iterator f = std::find( m_items.begin(), m_items.end(), ent ); @@ -203,11 +203,11 @@ public: } template - T* FindByKind( PNS_ITEM::PnsKind kind, int index = 0 ) + T* FindByKind( ITEM::PnsKind kind, int index = 0 ) { int n = 0; - for( const PNS_ITEM* item : m_items ) + for( const ITEM* item : m_items ) { if( item->OfKind( kind ) ) { diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index cf41eefd76..1927ffdd7c 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.h @@ -34,17 +34,17 @@ namespace PNS { /** - * Class PNS_JOINT + * Class JOINT * * Represents a 2D point on a given set of layers and belonging to a certain * net, that links together a number of board items. * A hash table of joints is used by the router to follow connectivity between * the items. **/ -class PNS_JOINT : public PNS_ITEM +class JOINT : public ITEM { public: - typedef PNS_ITEMSET::ENTRIES LINKED_ITEMS; + typedef ITEM_SET::ENTRIES LINKED_ITEMS; ///> Joints are hashed by their position, layers and net. /// Linked items are, obviously, not hashed @@ -54,11 +54,11 @@ public: int net; }; - PNS_JOINT() : - PNS_ITEM( JOINT_T ), m_locked( false ) {} + JOINT() : + ITEM( JOINT_T ), m_locked( false ) {} - PNS_JOINT( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aNet = -1 ) : - PNS_ITEM( JOINT_T ) + JOINT( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aNet = -1 ) : + ITEM( JOINT_T ) { m_tag.pos = aPos; m_tag.net = aNet; @@ -66,8 +66,8 @@ public: m_locked = false; } - PNS_JOINT( const PNS_JOINT& aB ) : - PNS_ITEM( JOINT_T ) + JOINT( const JOINT& aB ) : + ITEM( JOINT_T ) { m_layers = aB.m_layers; m_tag.pos = aB.m_tag.pos; @@ -77,7 +77,7 @@ public: m_locked = aB.m_locked; } - PNS_ITEM* Clone( ) const + ITEM* Clone( ) const { assert( false ); return NULL; @@ -90,8 +90,8 @@ public: if( m_linkedItems.Size() != 2 || m_linkedItems.Count( SEGMENT_T ) != 2 ) return false; - PNS_SEGMENT* seg1 = static_cast( m_linkedItems[0] ); - PNS_SEGMENT* seg2 = static_cast( m_linkedItems[1] ); + SEGMENT* seg1 = static_cast( m_linkedItems[0] ); + SEGMENT* seg2 = static_cast( m_linkedItems[1] ); // joints between segments of different widths are not considered trivial. return seg1->Width() == seg2->Width(); @@ -113,14 +113,14 @@ public: if( m_linkedItems.Count( SEGMENT_T ) != 2) return false; - PNS_SEGMENT* seg1 = static_cast( m_linkedItems[0] ); - PNS_SEGMENT* seg2 = static_cast( m_linkedItems[1] ); + SEGMENT* seg1 = static_cast( m_linkedItems[0] ); + SEGMENT* seg2 = static_cast( m_linkedItems[1] ); return seg1->Width() != seg2->Width(); } - ///> Links the joint to a given board item (when it's added to the PNS_NODE) - void Link( PNS_ITEM* aItem ) + ///> Links the joint to a given board item (when it's added to the NODE) + void Link( ITEM* aItem ) { if( m_linkedItems.Contains( aItem ) ) return; @@ -128,9 +128,9 @@ public: 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 NODE) ///> Returns true if the joint became dangling after unlinking. - bool Unlink( PNS_ITEM* aItem ) + bool Unlink( ITEM* aItem ) { m_linkedItems.Erase( aItem ); return m_linkedItems.Size() == 0; @@ -138,20 +138,20 @@ public: ///> For trivial joints, returns the segment adjacent to (aCurrent). For non-trival ones, returns ///> NULL, indicating the end of line. - PNS_SEGMENT* NextSegment( PNS_SEGMENT* aCurrent ) const + SEGMENT* NextSegment( SEGMENT* aCurrent ) const { if( !IsLineCorner() ) return NULL; - return static_cast( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] ); + return static_cast( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] ); } - PNS_VIA* Via() + VIA* Via() { - for( PNS_ITEM* item : m_linkedItems.Items() ) + for( ITEM* item : m_linkedItems.Items() ) { if( item->OfKind( VIA_T ) ) - return static_cast( item ); + return static_cast( item ); } return NULL; @@ -179,12 +179,12 @@ public: return m_linkedItems.CItems(); } - const PNS_ITEMSET& CLinks() const + const ITEM_SET& CLinks() const { return m_linkedItems; } - PNS_ITEMSET& Links() + ITEM_SET& Links() { return m_linkedItems; } @@ -196,12 +196,12 @@ public: void Dump() const; - bool operator==( const PNS_JOINT& rhs ) const + bool operator==( const JOINT& rhs ) const { return m_tag.pos == rhs.m_tag.pos && m_tag.net == rhs.m_tag.net; } - void Merge( const PNS_JOINT& aJoint ) + void Merge( const JOINT& aJoint ) { if( !Overlaps( aJoint ) ) return; @@ -211,13 +211,13 @@ public: if( aJoint.IsLocked() ) m_locked = true; - for( PNS_ITEM* item : aJoint.LinkList() ) + for( ITEM* item : aJoint.LinkList() ) { m_linkedItems.Add( item ); } } - bool Overlaps( const PNS_JOINT& rhs ) const + bool Overlaps( const JOINT& rhs ) const { return m_tag.pos == rhs.m_tag.pos && m_tag.net == rhs.m_tag.net && m_layers.Overlaps( rhs.m_layers ); @@ -238,18 +238,18 @@ private: HASH_TAG m_tag; ///> list of items linked to this joint - PNS_ITEMSET m_linkedItems; + ITEM_SET m_linkedItems; ///> locked (non-movable) flag bool m_locked; }; -inline bool operator==( PNS_JOINT::HASH_TAG const& aP1, PNS_JOINT::HASH_TAG const& aP2 ) +inline bool operator==( JOINT::HASH_TAG const& aP1, JOINT::HASH_TAG const& aP2 ) { return aP1.pos == aP2.pos && aP1.net == aP2.net; } -inline std::size_t hash_value( PNS_JOINT::HASH_TAG const& aP ) +inline std::size_t hash_value( JOINT::HASH_TAG const& aP ) { std::size_t seed = 0; boost::hash_combine( seed, aP.pos.x ); diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 17d52ec377..32c19603fd 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -60,20 +60,18 @@ #include "pns_debug_decorator.h" #include "router_preview_item.h" -using namespace PNS; - -class PNS_PCBNEW_RULE_RESOLVER : public PNS_RULE_RESOLVER +class PNS_PCBNEW_RULE_RESOLVER : public PNS::RULE_RESOLVER { public: - PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS_ROUTER* aRouter ); + PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER* aRouter ); virtual ~PNS_PCBNEW_RULE_RESOLVER(); - virtual int Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB ); + virtual int Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB ); virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 ); virtual void UseDpGap( bool aUseDpGap ) { m_useDpGap = aUseDpGap; } virtual int DpCoupledNet( int aNet ); virtual int DpNetPolarity( int aNet ); - virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN ); + virtual bool DpNetPair( PNS::ITEM* aItem, int& aNetP, int& aNetN ); private: struct CLEARANCE_ENT @@ -82,11 +80,11 @@ private: int clearance; }; - int localPadClearance( const PNS_ITEM* aItem ) const; + int localPadClearance( const PNS::ITEM* aItem ) const; int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName ); - PNS_ROUTER* m_router; - BOARD* m_board; + PNS::ROUTER* m_router; + BOARD* m_board; std::vector m_clearanceCache; int m_defaultClearance; @@ -97,13 +95,13 @@ private: }; -PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS_ROUTER* aRouter ) : +PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER* aRouter ) : m_router( aRouter ), m_board( aBoard ) { - PNS_NODE* world = m_router->GetWorld(); + PNS::NODE* world = m_router->GetWorld(); - PNS_TOPOLOGY topo( world ); + PNS::TOPOLOGY topo( world ); m_clearanceCache.resize( m_board->GetNetCount() ); for( unsigned int i = 0; i < m_board->GetNetCount(); i++ ) @@ -139,7 +137,7 @@ PNS_PCBNEW_RULE_RESOLVER::~PNS_PCBNEW_RULE_RESOLVER() } -int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS_ITEM* aItem ) const +int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS::ITEM* aItem ) const { if( !aItem->Parent() || aItem->Parent()->Type() != PCB_PAD_T ) return 0; @@ -149,14 +147,15 @@ int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS_ITEM* aItem ) const } -int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) +int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB ) { int net_a = aA->Net(); int cl_a = ( net_a >= 0 ? m_clearanceCache[net_a].clearance : m_defaultClearance ); int net_b = aB->Net(); int cl_b = ( net_b >= 0 ? m_clearanceCache[net_b].clearance : m_defaultClearance ); - bool linesOnly = aA->OfKind( PNS_ITEM::SEGMENT_T | PNS_ITEM::LINE_T ) && aB->OfKind( PNS_ITEM::SEGMENT_T | PNS_ITEM::LINE_T ); + bool linesOnly = aA->OfKind( PNS::ITEM::SEGMENT_T | PNS::ITEM::LINE_T ) + && aB->OfKind( PNS::ITEM::SEGMENT_T | PNS::ITEM::LINE_T ); if( linesOnly && net_a >= 0 && net_b >= 0 && m_clearanceCache[net_a].coupledNet == net_b ) { @@ -246,7 +245,7 @@ int PNS_PCBNEW_RULE_RESOLVER::DpNetPolarity( int aNet ) } -bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN ) +bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS::ITEM* aItem, int& aNetP, int& aNetN ) { if( !aItem || !aItem->Parent() || !aItem->Parent()->GetNet() ) return false; @@ -285,10 +284,10 @@ bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNet } -class PNS_PCBNEW_DEBUG_DECORATOR: public PNS_DEBUG_DECORATOR +class PNS_PCBNEW_DEBUG_DECORATOR: public PNS::DEBUG_DECORATOR { public: - PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW* aView = NULL ): PNS_DEBUG_DECORATOR(), + PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW* aView = NULL ): PNS::DEBUG_DECORATOR(), m_view( NULL ), m_items( NULL ) { SetView( aView ); @@ -398,7 +397,7 @@ private: }; -PNS_DEBUG_DECORATOR* PNS_KICAD_IFACE::GetDebugDecorator() +PNS::DEBUG_DECORATOR* PNS_KICAD_IFACE::GetDebugDecorator() { return m_debugDecorator; } @@ -430,9 +429,9 @@ PNS_KICAD_IFACE::~PNS_KICAD_IFACE() } -PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) +PNS::ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) { - PNS_LAYERSET layers( 0, MAX_CU_LAYERS - 1 ); + LAYER_RANGE layers( 0, MAX_CU_LAYERS - 1 ); // ignore non-copper pads if( ( aPad->GetLayerSet() & LSET::AllCuMask()).none() ) @@ -457,7 +456,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) is_copper = true; if( aPad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED ) - layers = PNS_LAYERSET( i ); + layers = LAYER_RANGE( i ); break; } @@ -473,7 +472,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) return NULL; } - PNS_SOLID* solid = new PNS_SOLID; + PNS::SOLID* solid = new PNS::SOLID; solid->SetLayers( layers ); solid->SetNet( aPad->GetNetCode() ); @@ -672,25 +671,25 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad ) } -PNS_ITEM* PNS_KICAD_IFACE::syncTrack( TRACK* aTrack ) +PNS::ITEM* PNS_KICAD_IFACE::syncTrack( TRACK* aTrack ) { - PNS_SEGMENT* s = - new PNS_SEGMENT( SEG( aTrack->GetStart(), aTrack->GetEnd() ), aTrack->GetNetCode() ); + PNS::SEGMENT* s = + new PNS::SEGMENT( SEG( aTrack->GetStart(), aTrack->GetEnd() ), aTrack->GetNetCode() ); s->SetWidth( aTrack->GetWidth() ); - s->SetLayers( PNS_LAYERSET( aTrack->GetLayer() ) ); + s->SetLayers( LAYER_RANGE( aTrack->GetLayer() ) ); s->SetParent( aTrack ); return s; } -PNS_ITEM* PNS_KICAD_IFACE::syncVia( VIA* aVia ) +PNS::ITEM* PNS_KICAD_IFACE::syncVia( VIA* aVia ) { LAYER_ID top, bottom; aVia->LayerPair( &top, &bottom ); - PNS_VIA* v = new PNS_VIA( + PNS::VIA* v = new PNS::VIA( aVia->GetPosition(), - PNS_LAYERSET( top, bottom ), + LAYER_RANGE( top, bottom ), aVia->GetWidth(), aVia->GetDrillValue(), aVia->GetNetCode(), @@ -709,7 +708,7 @@ void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard ) } -void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld ) +void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld ) { if( !m_board ) { @@ -721,7 +720,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld ) { for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) { - PNS_ITEM* solid = syncPad( pad ); + PNS::ITEM* solid = syncPad( pad ); if( solid ) aWorld->Add( solid ); @@ -731,7 +730,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld ) for( TRACK* t = m_board->m_Track; t; t = t->Next() ) { KICAD_T type = t->Type(); - PNS_ITEM* item = NULL; + PNS::ITEM* item = NULL; if( type == PCB_TRACE_T ) item = syncTrack( t ); @@ -739,7 +738,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld ) item = syncVia( static_cast( t ) ); if( t->IsLocked() ) - item->Mark( MK_LOCKED ); + item->Mark( PNS::MK_LOCKED ); if( item ) aWorld->Add( item ); @@ -773,7 +772,7 @@ void PNS_KICAD_IFACE::EraseView() } -void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance ) +void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClearance ) { wxLogTrace( "PNS", "DisplayItem %p", aItem ); @@ -792,7 +791,7 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClear } -void PNS_KICAD_IFACE::HideItem( PNS_ITEM* aItem ) +void PNS_KICAD_IFACE::HideItem( PNS::ITEM* aItem ) { BOARD_CONNECTED_ITEM* parent = aItem->Parent(); @@ -807,7 +806,7 @@ void PNS_KICAD_IFACE::HideItem( PNS_ITEM* aItem ) } -void PNS_KICAD_IFACE::RemoveItem( PNS_ITEM* aItem ) +void PNS_KICAD_IFACE::RemoveItem( PNS::ITEM* aItem ) { BOARD_CONNECTED_ITEM* parent = aItem->Parent(); @@ -820,15 +819,15 @@ void PNS_KICAD_IFACE::RemoveItem( PNS_ITEM* aItem ) } -void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem ) +void PNS_KICAD_IFACE::AddItem( PNS::ITEM* aItem ) { BOARD_CONNECTED_ITEM* newBI = NULL; switch( aItem->Kind() ) { - case PNS_ITEM::SEGMENT_T: + case PNS::ITEM::SEGMENT_T: { - PNS_SEGMENT* seg = static_cast( aItem ); + PNS::SEGMENT* seg = static_cast( aItem ); TRACK* track = new TRACK( m_board ); const SEG& s = seg->Seg(); track->SetStart( wxPoint( s.A.x, s.A.y ) ); @@ -840,10 +839,10 @@ void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem ) break; } - case PNS_ITEM::VIA_T: + case PNS::ITEM::VIA_T: { VIA* via_board = new VIA( m_board ); - PNS_VIA* via = static_cast( aItem ); + PNS::VIA* via = static_cast( aItem ); via_board->SetPosition( wxPoint( via->Pos().x, via->Pos().y ) ); via_board->SetWidth( via->Diameter() ); via_board->SetDrill( via->Drill() ); @@ -906,12 +905,12 @@ void PNS_KICAD_IFACE::UpdateNet( int aNetCode ) wxLogTrace( "PNS", "Update-net %d", aNetCode ); } -PNS_RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver() +PNS::RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver() { return m_ruleResolver; } -void PNS_KICAD_IFACE::SetRouter( PNS_ROUTER* aRouter ) +void PNS_KICAD_IFACE::SetRouter( PNS::ROUTER* aRouter ) { m_router = aRouter; } diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 894e3b584b..37994e3f7d 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2016 CERN + * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -34,43 +35,43 @@ namespace KIGFX class VIEW; }; -class PNS_KICAD_IFACE : public PNS::PNS_ROUTER_IFACE { +class PNS_KICAD_IFACE : public PNS::ROUTER_IFACE { public: PNS_KICAD_IFACE(); ~PNS_KICAD_IFACE(); - void SetRouter( PNS::PNS_ROUTER* aRouter ); + void SetRouter( PNS::ROUTER* aRouter ); void SetHostFrame( PCB_EDIT_FRAME* aFrame ); void SetBoard( BOARD* aBoard ); void SetView( KIGFX::VIEW* aView ); - void SyncWorld( PNS::PNS_NODE* aWorld ); + void SyncWorld( PNS::NODE* aWorld ); void EraseView(); - void HideItem( PNS::PNS_ITEM* aItem ); - void DisplayItem( const PNS::PNS_ITEM* aItem, int aColor = 0, int aClearance = 0 ); - void AddItem( PNS::PNS_ITEM* aItem ); - void RemoveItem( PNS::PNS_ITEM* aItem ); + void HideItem( PNS::ITEM* aItem ); + void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0 ); + void AddItem( PNS::ITEM* aItem ); + void RemoveItem( PNS::ITEM* aItem ); void Commit(); void UpdateNet( int aNetCode ); - PNS::PNS_RULE_RESOLVER* GetRuleResolver(); - PNS::PNS_DEBUG_DECORATOR* GetDebugDecorator(); + PNS::RULE_RESOLVER* GetRuleResolver(); + PNS::DEBUG_DECORATOR* GetDebugDecorator(); private: PNS_PCBNEW_RULE_RESOLVER* m_ruleResolver; PNS_PCBNEW_DEBUG_DECORATOR* m_debugDecorator; - PNS::PNS_ITEM* syncPad( D_PAD* aPad ); - PNS::PNS_ITEM* syncTrack( TRACK* aTrack ); - PNS::PNS_ITEM* syncVia( VIA* aVia ); + PNS::ITEM* syncPad( D_PAD* aPad ); + PNS::ITEM* syncTrack( TRACK* aTrack ); + PNS::ITEM* syncVia( VIA* aVia ); KIGFX::VIEW* m_view; KIGFX::VIEW_GROUP* m_previewItems; std::unordered_set m_hiddenItems; - PNS::PNS_NODE* m_world; - PNS::PNS_ROUTER* m_router; + PNS::NODE* m_world; + PNS::ROUTER* m_router; BOARD* m_board; PICKED_ITEMS_LIST m_undoBuffer; PCB_EDIT_FRAME* m_frame; diff --git a/pcbnew/router/pns_layerset.h b/pcbnew/router/pns_layerset.h index 9d01dd1ade..41546ee28e 100644 --- a/pcbnew/router/pns_layerset.h +++ b/pcbnew/router/pns_layerset.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2014 CERN + * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * * This program is free software: you can redistribute it and/or modify it @@ -24,19 +25,19 @@ #include /** - * Class PNS_LAYERSET + * Class LAYER_RANGE * * Represents a contiguous set of PCB layers. */ -class PNS_LAYERSET +class LAYER_RANGE { public: - PNS_LAYERSET() : + LAYER_RANGE() : m_start( -1 ), m_end( -1 ) {}; - PNS_LAYERSET( int aStart, int aEnd ) + LAYER_RANGE( int aStart, int aEnd ) { if( aStart > aEnd ) std::swap( aStart, aEnd ); @@ -45,26 +46,26 @@ public: m_end = aEnd; } - PNS_LAYERSET( int aLayer ) + LAYER_RANGE( int aLayer ) { m_start = m_end = aLayer; } - PNS_LAYERSET( const PNS_LAYERSET& aB ) : + LAYER_RANGE( const LAYER_RANGE& aB ) : m_start( aB.m_start ), m_end( aB.m_end ) {} - ~PNS_LAYERSET() {}; + ~LAYER_RANGE() {}; - const PNS_LAYERSET& operator=( const PNS_LAYERSET& aB ) + const LAYER_RANGE& operator=( const LAYER_RANGE& aB ) { m_start = aB.m_start; m_end = aB.m_end; return *this; } - bool Overlaps( const PNS_LAYERSET& aOther ) const + bool Overlaps( const LAYER_RANGE& aOther ) const { return m_end >= aOther.m_start && m_start <= aOther.m_end; } @@ -89,7 +90,7 @@ public: return m_end; } - void Merge( const PNS_LAYERSET& aOther ) + void Merge( const LAYER_RANGE& aOther ) { if( m_start < 0 || m_end < 0 ) { @@ -106,17 +107,17 @@ public: } ///> Shortcut for comparisons/overlap tests - static PNS_LAYERSET All() + static LAYER_RANGE All() { - return PNS_LAYERSET( 0, 256 ); // fixme: use layer IDs header + return LAYER_RANGE( 0, 256 ); // fixme: use layer IDs header } - bool operator==( const PNS_LAYERSET& aOther ) const + bool operator==( const LAYER_RANGE& aOther ) const { return ( m_start == aOther.m_start ) && ( m_end == aOther.m_end ); } - bool operator!=( const PNS_LAYERSET& aOther ) const + bool operator!=( const LAYER_RANGE& aOther ) const { return ( m_start != aOther.m_start ) || ( m_end != aOther.m_end ); } diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 78b5985f81..43c92dbe14 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -35,8 +35,8 @@ using boost::optional; namespace PNS { -PNS_LINE::PNS_LINE( const PNS_LINE& aOther ) : - PNS_ITEM( aOther ), +LINE::LINE( const LINE& aOther ) : + ITEM( aOther ), m_line( aOther.m_line ), m_width( aOther.m_width ) { @@ -52,13 +52,13 @@ PNS_LINE::PNS_LINE( const PNS_LINE& aOther ) : } -PNS_LINE::~PNS_LINE() +LINE::~LINE() { delete m_segmentRefs; } -const PNS_LINE& PNS_LINE::operator=( const PNS_LINE& aOther ) +const LINE& LINE::operator=( const LINE& aOther ) { m_line = aOther.m_line; m_width = aOther.m_width; @@ -76,31 +76,31 @@ const PNS_LINE& PNS_LINE::operator=( const PNS_LINE& aOther ) } -PNS_LINE* PNS_LINE::Clone() const +LINE* LINE::Clone() const { - PNS_LINE* l = new PNS_LINE( *this ); + LINE* l = new LINE( *this ); return l; } -void PNS_LINE::Mark( int aMarker ) +void LINE::Mark( int aMarker ) { m_marker = aMarker; if( m_segmentRefs ) { - for( PNS_SEGMENT* s : *m_segmentRefs ) + for( SEGMENT* s : *m_segmentRefs ) s->Mark( aMarker ); } } -void PNS_LINE::Unmark() +void LINE::Unmark() { if( m_segmentRefs ) { - for( PNS_SEGMENT* s : *m_segmentRefs ) + for( SEGMENT* s : *m_segmentRefs ) s->Unmark(); } @@ -108,13 +108,13 @@ void PNS_LINE::Unmark() } -int PNS_LINE::Marker() const +int LINE::Marker() const { int marker = m_marker; if( m_segmentRefs ) { - for( PNS_SEGMENT* s : *m_segmentRefs ) + for( SEGMENT* s : *m_segmentRefs ) { marker |= s->Marker(); } @@ -124,7 +124,7 @@ int PNS_LINE::Marker() const } -void PNS_LINE::copyLinks( const PNS_LINE* aParent ) +void LINE::copyLinks( const LINE* aParent ) { if( aParent->m_segmentRefs == NULL ) { @@ -137,9 +137,9 @@ void PNS_LINE::copyLinks( const PNS_LINE* aParent ) } -PNS_SEGMENT* PNS_SEGMENT::Clone() const +SEGMENT* SEGMENT::Clone() const { - PNS_SEGMENT* s = new PNS_SEGMENT; + SEGMENT* s = new SEGMENT; s->m_seg = m_seg; s->m_net = m_net; @@ -151,7 +151,7 @@ PNS_SEGMENT* PNS_SEGMENT::Clone() const } -int PNS_LINE::CountCorners( int aAngles ) +int LINE::CountCorners( int aAngles ) { int count = 0; @@ -173,7 +173,7 @@ int PNS_LINE::CountCorners( int aAngles ) } -bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, +bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, SHAPE_LINE_CHAIN& aWalk, SHAPE_LINE_CHAIN& aPost, bool aCw ) const { const SHAPE_LINE_CHAIN& line( CLine() ); @@ -269,7 +269,7 @@ bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, } -void PNS_LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, +void LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPath, bool aCw ) const { @@ -282,13 +282,13 @@ void PNS_LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, } -const SHAPE_LINE_CHAIN PNS_SEGMENT::Hull( int aClearance, int aWalkaroundThickness ) const +const SHAPE_LINE_CHAIN SEGMENT::Hull( int aClearance, int aWalkaroundThickness ) const { return SegmentHull( m_seg, aClearance, aWalkaroundThickness ); } -bool PNS_LINE::Is45Degree() +bool LINE::Is45Degree() { for( int i = 0; i < m_line.SegmentCount(); i++ ) { @@ -314,15 +314,15 @@ bool PNS_LINE::Is45Degree() } -const PNS_LINE PNS_LINE::ClipToNearestObstacle( PNS_NODE* aNode ) const +const LINE LINE::ClipToNearestObstacle( NODE* aNode ) const { const int IterationLimit = 5; int i; - PNS_LINE l( *this ); + LINE l( *this ); for( i = 0; i < IterationLimit; i++ ) { - PNS_NODE::OPT_OBSTACLE obs = aNode->NearestObstacle( &l ); + NODE::OPT_OBSTACLE obs = aNode->NearestObstacle( &l ); if( obs ) { @@ -340,7 +340,7 @@ const PNS_LINE PNS_LINE::ClipToNearestObstacle( PNS_NODE* aNode ) const } -void PNS_LINE::ShowLinks() +void LINE::ShowLinks() { if( !m_segmentRefs ) { @@ -423,7 +423,7 @@ SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECT } -void PNS_LINE::DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshold ) +void LINE::DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshold ) { SHAPE_LINE_CHAIN path; @@ -447,7 +447,7 @@ void PNS_LINE::DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshol } -VECTOR2I PNS_LINE::snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP, +VECTOR2I LINE::snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP, int aIndex, int aThreshold ) const { int s_start = std::max( aIndex - 2, 0 ); @@ -489,7 +489,7 @@ VECTOR2I PNS_LINE::snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTO return best_snap; } -VECTOR2I PNS_LINE::snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP, +VECTOR2I LINE::snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP, int aIndex, int aThreshold ) const { VECTOR2I snap_p[2]; @@ -535,7 +535,7 @@ VECTOR2I PNS_LINE::snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const } -void PNS_LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold ) +void LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold ) { SHAPE_LINE_CHAIN path( m_line ); VECTOR2I target( aP ); @@ -702,13 +702,13 @@ void PNS_LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThresho } -bool PNS_LINE::CompareGeometry( const PNS_LINE& aOther ) +bool LINE::CompareGeometry( const LINE& aOther ) { return m_line.CompareGeometry( aOther.m_line ); } -void PNS_LINE::Reverse() +void LINE::Reverse() { m_line = m_line.Reverse(); @@ -717,7 +717,7 @@ void PNS_LINE::Reverse() } -void PNS_LINE::AppendVia( const PNS_VIA& aVia ) +void LINE::AppendVia( const VIA& aVia ) { if( m_line.PointCount() > 1 && aVia.Pos() == m_line.CPoint( 0 ) ) { @@ -730,26 +730,26 @@ void PNS_LINE::AppendVia( const PNS_VIA& aVia ) } -void PNS_LINE::SetRank( int aRank ) +void LINE::SetRank( int aRank ) { m_rank = aRank; if( m_segmentRefs ) { - for( PNS_SEGMENT* s : *m_segmentRefs ) + for( SEGMENT* s : *m_segmentRefs ) s->SetRank( aRank ); } } -int PNS_LINE::Rank() const +int LINE::Rank() const { int min_rank = INT_MAX; int rank; if( m_segmentRefs ) { - for( PNS_SEGMENT *s : *m_segmentRefs ) + for( SEGMENT *s : *m_segmentRefs ) min_rank = std::min( min_rank, s->Rank() ); rank = ( min_rank == INT_MAX ) ? -1 : min_rank; } @@ -762,7 +762,7 @@ int PNS_LINE::Rank() const } -void PNS_LINE::ClipVertexRange( int aStart, int aEnd ) +void LINE::ClipVertexRange( int aStart, int aEnd ) { m_line = m_line.Slice( aStart, aEnd ); @@ -777,7 +777,7 @@ void PNS_LINE::ClipVertexRange( int aStart, int aEnd ) } -bool PNS_LINE::HasLoops() const +bool LINE::HasLoops() const { for( int i = 0; i < PointCount(); i++ ) { @@ -792,7 +792,7 @@ bool PNS_LINE::HasLoops() const } -void PNS_LINE::ClearSegmentLinks() +void LINE::ClearSegmentLinks() { if( m_segmentRefs ) delete m_segmentRefs; @@ -815,7 +815,7 @@ static void extendBox( BOX2I& aBox, bool& aDefined, const VECTOR2I& aP ) } -OPT_BOX2I PNS_LINE::ChangedArea( const PNS_LINE* aOther ) const +OPT_BOX2I LINE::ChangedArea( const LINE* aOther ) const { BOX2I area; bool areaDefined = false; @@ -894,9 +894,9 @@ OPT_BOX2I PNS_LINE::ChangedArea( const PNS_LINE* aOther ) const } -bool PNS_LINE::HasLockedSegments() const +bool LINE::HasLockedSegments() const { - for( const PNS_SEGMENT* seg : *m_segmentRefs ) + for( const SEGMENT* seg : *m_segmentRefs ) { if( seg->Marker() & MK_LOCKED ) return true; diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h index 6e0b48acf1..ea0fd44852 100644 --- a/pcbnew/router/pns_line.h +++ b/pcbnew/router/pns_line.h @@ -34,54 +34,54 @@ namespace PNS { -class PNS_NODE; -class PNS_SEGMENT; -class PNS_VIA; +class NODE; +class SEGMENT; +class VIA; /** - * Class PNS_LINE + * Class LINE * * Represents a track on a PCB, connecting two non-trivial joints (that is, * vias, pads, junctions between multiple traces or two traces different widths - * and combinations of these). PNS_LINEs are NOT stored in the model (PNS_NODE). + * and combinations of these). PNS_LINEs are NOT stored in the model (NODE). * Instead, they are assembled on-the-fly, based on a via/pad/segment that * belongs to/starts/ends them. * * PNS_LINEs can be either loose (consisting of segments that do not belong to - * any PNS_NODE) or owned (with segments taken from a PNS_NODE) - these are - * returned by PNS_NODE::AssembleLine and friends. + * any NODE) or owned (with segments taken from a NODE) - these are + * returned by NODE::AssembleLine and friends. * - * A PNS_LINE may have a PNS_VIA attached at its end (i.e. the last point) - this is used by via + * A LINE may have a VIA attached at its end (i.e. the last point) - this is used by via * dragging/force propagation stuff. */ #define PNS_HULL_MARGIN 10 -class PNS_LINE : public PNS_ITEM +class LINE : public ITEM { public: - typedef std::vector SEGMENT_REFS; + typedef std::vector SEGMENT_REFS; /** * Constructor * Makes an empty line. */ - PNS_LINE() : PNS_ITEM( LINE_T ) + LINE() : ITEM( LINE_T ) { m_segmentRefs = NULL; m_hasVia = false; m_width = 1; // Dummy value } - PNS_LINE( const PNS_LINE& aOther ); + LINE( const LINE& aOther ); /** * Constructor * Copies properties (net, layers, etc.) from a base line and replaces the shape * by another **/ - PNS_LINE( const PNS_LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) : - PNS_ITEM( aBase ), + LINE( const LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) : + ITEM( aBase ), m_line( aLine ), m_width( aBase.m_width ) { @@ -91,17 +91,17 @@ public: m_hasVia = false; } - ~PNS_LINE(); + ~LINE(); - static inline bool ClassOf( const PNS_ITEM* aItem ) + static inline bool ClassOf( const ITEM* aItem ) { return aItem && LINE_T == aItem->Kind(); } - /// @copydoc PNS_ITEM::Clone() - virtual PNS_LINE* Clone() const; + /// @copydoc ITEM::Clone() + virtual LINE* Clone() const; - const PNS_LINE& operator=( const PNS_LINE& aOther ); + const LINE& operator=( const LINE& aOther ); ///> Assigns a shape to the line (a polyline/line chain) void SetShape( const SHAPE_LINE_CHAIN& aLine ) @@ -164,7 +164,7 @@ public: } ///> Returns true if the line is geometrically identical as line aOther - bool CompareGeometry( const PNS_LINE& aOther ); + bool CompareGeometry( const LINE& aOther ); ///> Reverses the point/vertex order void Reverse(); @@ -172,8 +172,8 @@ public: /* Linking functions */ - ///> Adds a reference to a segment registered in a PNS_NODE that is a part of this line. - void LinkSegment( PNS_SEGMENT* aSeg ) + ///> Adds a reference to a segment registered in a NODE that is a part of this line. + void LinkSegment( SEGMENT* aSeg ) { if( !m_segmentRefs ) m_segmentRefs = new SEGMENT_REFS(); @@ -194,7 +194,7 @@ public: } ///> Checks if the segment aSeg is a part of the line. - bool ContainsSegment( PNS_SEGMENT* aSeg ) const + bool ContainsSegment( SEGMENT* aSeg ) const { if( !m_segmentRefs ) return false; @@ -203,7 +203,7 @@ public: aSeg ) != m_segmentRefs->end(); } - PNS_SEGMENT* GetLink( int aIndex ) const + SEGMENT* GetLink( int aIndex ) const { return (*m_segmentRefs)[aIndex]; } @@ -222,7 +222,7 @@ public: ///> Clips the line to the nearest obstacle, traversing from the line's start vertex (0). ///> Returns the clipped line. - const PNS_LINE ClipToNearestObstacle( PNS_NODE* aNode ) const; + const LINE ClipToNearestObstacle( NODE* aNode ) const; ///> Clips the line to a given range of vertices. void ClipVertexRange ( int aStart, int aEnd ); @@ -253,10 +253,10 @@ public: bool EndsWithVia() const { return m_hasVia; } - void AppendVia( const PNS_VIA& aVia ); + void AppendVia( const VIA& aVia ); void RemoveVia() { m_hasVia = false; } - const PNS_VIA& Via() const { return m_via; } + const VIA& Via() const { return m_via; } virtual void Mark( int aMarker ); virtual void Unmark (); @@ -271,7 +271,7 @@ public: bool HasLoops() const; bool HasLockedSegments() const; - OPT_BOX2I ChangedArea( const PNS_LINE* aOther ) const; + OPT_BOX2I ChangedArea( const LINE* aOther ) const; private: VECTOR2I snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP, @@ -281,9 +281,9 @@ private: int aIndex, int aThreshold ) const; ///> Copies m_segmentRefs from the line aParent. - void copyLinks( const PNS_LINE* aParent ) ; + void copyLinks( const 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 NODE (ITEM::m_owner) that constitute this line, or NULL ///> if the line is not a part of any node. SEGMENT_REFS* m_segmentRefs; @@ -297,7 +297,7 @@ private: bool m_hasVia; ///> Via at the end point, if m_hasVia == true - PNS_VIA m_via; + VIA m_via; }; } diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 98b44aca08..c7b29f37bf 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -36,8 +36,8 @@ using boost::optional; namespace PNS { -PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) : - PNS_PLACEMENT_ALGO( aRouter ) +LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) : + PLACEMENT_ALGO( aRouter ) { m_initial_direction = DIRECTION_45::N; m_world = NULL; @@ -57,28 +57,28 @@ PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) : } -PNS_LINE_PLACER::~PNS_LINE_PLACER() +LINE_PLACER::~LINE_PLACER() { if( m_shove ) delete m_shove; } -void PNS_LINE_PLACER::setWorld( PNS_NODE* aWorld ) +void LINE_PLACER::setWorld( NODE* aWorld ) { m_world = aWorld; } -const PNS_VIA PNS_LINE_PLACER::makeVia( const VECTOR2I& aP ) +const VIA LINE_PLACER::makeVia( const VECTOR2I& aP ) { - const PNS_LAYERSET layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() ); + const LAYER_RANGE layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() ); - return PNS_VIA( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() ); + return VIA( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() ); } -bool PNS_LINE_PLACER::ToggleVia( bool aEnabled ) +bool LINE_PLACER::ToggleVia( bool aEnabled ) { m_placingVia = aEnabled; @@ -89,7 +89,7 @@ bool PNS_LINE_PLACER::ToggleVia( bool aEnabled ) } -void PNS_LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection ) +void LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection ) { m_initial_direction = aDirection; @@ -98,7 +98,7 @@ void PNS_LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection ) } -bool PNS_LINE_PLACER::handleSelfIntersections() +bool LINE_PLACER::handleSelfIntersections() { SHAPE_LINE_CHAIN::INTERSECTIONS ips; SHAPE_LINE_CHAIN& head = m_head.Line(); @@ -158,7 +158,7 @@ bool PNS_LINE_PLACER::handleSelfIntersections() } -bool PNS_LINE_PLACER::handlePullback() +bool LINE_PLACER::handlePullback() { SHAPE_LINE_CHAIN& head = m_head.Line(); SHAPE_LINE_CHAIN& tail = m_tail.Line(); @@ -217,7 +217,7 @@ bool PNS_LINE_PLACER::handlePullback() } -bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd ) +bool LINE_PLACER::reduceTail( const VECTOR2I& aEnd ) { SHAPE_LINE_CHAIN& head = m_head.Line(); SHAPE_LINE_CHAIN& tail = m_tail.Line(); @@ -247,9 +247,9 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd ) // the direction of the segment to be replaced SHAPE_LINE_CHAIN replacement = dir.BuildInitialTrace( s.A, aEnd ); - PNS_LINE tmp( m_tail, replacement ); + LINE tmp( m_tail, replacement ); - if( m_currentNode->CheckColliding( &tmp, PNS_ITEM::ANY_T ) ) + if( m_currentNode->CheckColliding( &tmp, ITEM::ANY_T ) ) break; if( DIRECTION_45( replacement.CSegment( 0 ) ) == dir ) @@ -279,7 +279,7 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd ) } -bool PNS_LINE_PLACER::checkObtusity( const SEG& aA, const SEG& aB ) const +bool LINE_PLACER::checkObtusity( const SEG& aA, const SEG& aB ) const { const DIRECTION_45 dir_a( aA ); const DIRECTION_45 dir_b( aB ); @@ -288,7 +288,7 @@ bool PNS_LINE_PLACER::checkObtusity( const SEG& aA, const SEG& aB ) const } -bool PNS_LINE_PLACER::mergeHead() +bool LINE_PLACER::mergeHead() { SHAPE_LINE_CHAIN& head = m_head.Line(); SHAPE_LINE_CHAIN& tail = m_tail.Line(); @@ -356,21 +356,21 @@ bool PNS_LINE_PLACER::mergeHead() } -bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) +bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead ) { - PNS_LINE initTrack( m_head ); - PNS_LINE walkFull; + LINE initTrack( m_head ); + LINE walkFull; int effort = 0; bool rv = true, viaOk; viaOk = buildInitialLine( aP, initTrack ); - PNS_WALKAROUND walkaround( m_currentNode, Router() ); + WALKAROUND walkaround( m_currentNode, Router() ); walkaround.SetSolidsOnly( false ); walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() ); - PNS_WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false ); + WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false ); switch( Settings().OptimizerEffort() ) { @@ -380,14 +380,14 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) case OE_MEDIUM: case OE_FULL: - effort = PNS_OPTIMIZER::MERGE_SEGMENTS; + effort = OPTIMIZER::MERGE_SEGMENTS; break; } if( Settings().SmartPads() ) - effort |= PNS_OPTIMIZER::SMART_PADS; + effort |= OPTIMIZER::SMART_PADS; - if( wf == PNS_WALKAROUND::STUCK ) + if( wf == WALKAROUND::STUCK ) { walkFull = walkFull.ClipToNearestObstacle( m_currentNode ); rv = true; @@ -397,7 +397,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) walkFull.AppendVia( makeVia( walkFull.CPoint( -1 ) ) ); } - PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode ); + OPTIMIZER::Optimize( &walkFull, effort, m_currentNode ); if( m_currentNode->CheckColliding( &walkFull ) ) { @@ -412,7 +412,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) } -bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead ) +bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead ) { buildInitialLine( aP, m_head ); aNewHead = m_head; @@ -420,32 +420,32 @@ bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead ) } -bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) +bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead ) { - PNS_LINE initTrack( m_head ); - PNS_LINE walkSolids, l2; + LINE initTrack( m_head ); + LINE walkSolids, l2; bool viaOk = buildInitialLine( aP, initTrack ); m_currentNode = m_shove->CurrentNode(); - PNS_OPTIMIZER optimizer( m_currentNode ); + OPTIMIZER optimizer( m_currentNode ); - PNS_WALKAROUND walkaround( m_currentNode, Router() ); + WALKAROUND walkaround( m_currentNode, Router() ); walkaround.SetSolidsOnly( true ); walkaround.SetIterationLimit( 10 ); - PNS_WALKAROUND::WALKAROUND_STATUS stat_solids = walkaround.Route( initTrack, walkSolids ); + WALKAROUND::WALKAROUND_STATUS stat_solids = walkaround.Route( initTrack, walkSolids ); - optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_SEGMENTS ); - optimizer.SetCollisionMask( PNS_ITEM::SOLID_T ); + optimizer.SetEffortLevel( OPTIMIZER::MERGE_SEGMENTS ); + optimizer.SetCollisionMask( ITEM::SOLID_T ); optimizer.Optimize( &walkSolids ); - if( stat_solids == PNS_WALKAROUND::DONE ) + if( stat_solids == WALKAROUND::DONE ) l2 = walkSolids; else l2 = initTrack.ClipToNearestObstacle( m_shove->CurrentNode() ); - PNS_LINE l( m_tail ); + LINE l( m_tail ); l.Line().Append( l2.CLine() ); l.Line().Simplify(); @@ -457,8 +457,8 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) if( m_placingVia && viaOk ) { - PNS_VIA v1( makeVia( l.CPoint( -1 ) ) ); - PNS_VIA v2( makeVia( l2.CPoint( -1 ) ) ); + VIA v1( makeVia( l.CPoint( -1 ) ) ); + VIA v2( makeVia( l2.CPoint( -1 ) ) ); l.AppendVia( v1 ); l2.AppendVia( v2 ); @@ -474,20 +474,20 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) return false; } - PNS_SHOVE::SHOVE_STATUS status = m_shove->ShoveLines( l ); + SHOVE::SHOVE_STATUS status = m_shove->ShoveLines( l ); m_currentNode = m_shove->CurrentNode(); - if( status == PNS_SHOVE::SH_OK || status == PNS_SHOVE::SH_HEAD_MODIFIED ) + if( status == SHOVE::SH_OK || status == SHOVE::SH_HEAD_MODIFIED ) { - if( status == PNS_SHOVE::SH_HEAD_MODIFIED ) + if( status == SHOVE::SH_HEAD_MODIFIED ) { l2 = m_shove->NewHead(); } optimizer.SetWorld( m_currentNode ); - optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_OBTUSE | PNS_OPTIMIZER::SMART_PADS ); - optimizer.SetCollisionMask( PNS_ITEM::ANY_T ); + optimizer.SetEffortLevel( OPTIMIZER::MERGE_OBTUSE | OPTIMIZER::SMART_PADS ); + optimizer.SetCollisionMask( ITEM::ANY_T ); optimizer.Optimize( &l2 ); aNewHead = l2; @@ -510,7 +510,7 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead ) } -bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead ) +bool LINE_PLACER::routeHead( const VECTOR2I& aP, LINE& aNewHead ) { switch( m_currentMode ) { @@ -528,11 +528,11 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead ) } -bool PNS_LINE_PLACER::optimizeTailHeadTransition() +bool LINE_PLACER::optimizeTailHeadTransition() { - PNS_LINE tmp = Trace(); + LINE tmp = Trace(); - if( PNS_OPTIMIZER::Optimize( &tmp, PNS_OPTIMIZER::FANOUT_CLEANUP, m_currentNode ) ) + if( OPTIMIZER::Optimize( &tmp, OPTIMIZER::FANOUT_CLEANUP, m_currentNode ) ) { if( tmp.SegmentCount() < 1 ) return false; @@ -565,15 +565,15 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition() opt_line.Append( head.Slice( 0, end ) ); - PNS_LINE new_head( m_tail, opt_line ); + LINE new_head( m_tail, opt_line ); // and see if it could be made simpler by merging obtuse/collnear segments. // If so, replace the (threshold) last tail points and the head with // the optimized line - if( PNS_OPTIMIZER::Optimize( &new_head, PNS_OPTIMIZER::MERGE_OBTUSE, m_currentNode ) ) + if( OPTIMIZER::Optimize( &new_head, OPTIMIZER::MERGE_OBTUSE, m_currentNode ) ) { - PNS_LINE tmp( m_tail, opt_line ); + LINE tmp( m_tail, opt_line ); wxLogTrace( "PNS", "Placer: optimize tail-head [%d]", threshold ); @@ -591,14 +591,14 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition() } -void PNS_LINE_PLACER::routeStep( const VECTOR2I& aP ) +void LINE_PLACER::routeStep( const VECTOR2I& aP ) { bool fail = false; bool go_back = false; int i, n_iter = 1; - PNS_LINE new_head; + LINE new_head; wxLogTrace( "PNS", "INIT-DIR: %s head: %d, tail: %d segs", m_initial_direction.Format().c_str(), m_head.SegmentCount(), m_tail.SegmentCount() ); @@ -644,16 +644,16 @@ void PNS_LINE_PLACER::routeStep( const VECTOR2I& aP ) } -bool PNS_LINE_PLACER::route( const VECTOR2I& aP ) +bool LINE_PLACER::route( const VECTOR2I& aP ) { routeStep( aP ); return CurrentEnd() == aP; } -const PNS_LINE PNS_LINE_PLACER::Trace() const +const LINE LINE_PLACER::Trace() const { - PNS_LINE tmp( m_head ); + LINE tmp( m_head ); tmp.SetShape( m_tail.CLine() ); tmp.Line().Append( m_head.CLine() ); @@ -662,21 +662,21 @@ const PNS_LINE PNS_LINE_PLACER::Trace() const } -const PNS_ITEMSET PNS_LINE_PLACER::Traces() +const ITEM_SET LINE_PLACER::Traces() { m_currentTrace = Trace(); - return PNS_ITEMSET( &m_currentTrace ); + return ITEM_SET( &m_currentTrace ); } -void PNS_LINE_PLACER::FlipPosture() +void LINE_PLACER::FlipPosture() { m_initial_direction = m_initial_direction.Right(); m_direction = m_direction.Right(); } -PNS_NODE* PNS_LINE_PLACER::CurrentNode( bool aLoopsRemoved ) const +NODE* LINE_PLACER::CurrentNode( bool aLoopsRemoved ) const { if( aLoopsRemoved && m_lastNode ) return m_lastNode; @@ -685,21 +685,21 @@ PNS_NODE* PNS_LINE_PLACER::CurrentNode( bool aLoopsRemoved ) const } -void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP ) +void LINE_PLACER::splitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP ) { if( !aSeg ) return; - if( !aSeg->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( !aSeg->OfKind( ITEM::SEGMENT_T ) ) return; - PNS_JOINT* jt = aNode->FindJoint( aP, aSeg ); + JOINT* jt = aNode->FindJoint( aP, aSeg ); if( jt && jt->LinkCount() >= 1 ) return; - PNS_SEGMENT* s_old = static_cast( aSeg ); - PNS_SEGMENT* s_new[2]; + SEGMENT* s_old = static_cast( aSeg ); + SEGMENT* s_new[2]; s_new[0] = s_old->Clone(); s_new[1] = s_old->Clone(); @@ -713,7 +713,7 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co } -bool PNS_LINE_PLACER::SetLayer( int aLayer ) +bool LINE_PLACER::SetLayer( int aLayer ) { if( m_idle ) { @@ -724,7 +724,7 @@ bool PNS_LINE_PLACER::SetLayer( int aLayer ) { return false; } - else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA_T ) && m_startItem->Layers().Overlaps( aLayer ) ) ) + else if( !m_startItem || ( m_startItem->OfKind( ITEM::VIA_T ) && m_startItem->Layers().Overlaps( aLayer ) ) ) { m_currentLayer = aLayer; initPlacement(); @@ -736,7 +736,7 @@ bool PNS_LINE_PLACER::SetLayer( int aLayer ) } -bool PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) +bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem ) { VECTOR2I p( aP ); @@ -762,7 +762,7 @@ bool PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) } -void PNS_LINE_PLACER::initPlacement() +void LINE_PLACER::initPlacement() { m_idle = false; @@ -780,10 +780,10 @@ void PNS_LINE_PLACER::initPlacement() m_p_start = m_currentStart; m_direction = m_initial_direction; - PNS_NODE* world = Router()->GetWorld(); + NODE* world = Router()->GetWorld(); world->KillChildren(); - PNS_NODE* rootNode = world->Branch(); + NODE* rootNode = world->Branch(); splitAdjacentSegments( rootNode, m_startItem, m_currentStart ); @@ -803,19 +803,19 @@ void PNS_LINE_PLACER::initPlacement() if( m_currentMode == RM_Shove || m_currentMode == RM_Smart ) { - m_shove = new PNS_SHOVE( m_world->Branch(), Router() ); + m_shove = new SHOVE( m_world->Branch(), Router() ); } } -bool PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) { - PNS_LINE current; + LINE current; VECTOR2I p = aP; int eiDepth = -1; if( aEndItem && aEndItem->Owner() ) - eiDepth = static_cast( aEndItem->Owner() )->Depth(); + eiDepth = static_cast( aEndItem->Owner() )->Depth(); if( m_lastNode ) { @@ -832,7 +832,7 @@ bool PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) else m_currentEnd = current.CLine().CPoint( -1 ); - PNS_NODE* latestNode = m_currentNode; + NODE* latestNode = m_currentNode; m_lastNode = latestNode->Branch(); if( eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth && current.SegmentCount() ) @@ -848,12 +848,12 @@ bool PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) { bool realEnd = false; int lastV; - PNS_LINE pl = Trace(); + LINE pl = Trace(); if( m_currentMode == RM_MarkObstacles && !Settings().CanViolateDRC() && @@ -893,12 +893,12 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) else lastV = std::max( 1, l.SegmentCount() - 1 ); - PNS_SEGMENT* lastSeg = NULL; + SEGMENT* lastSeg = NULL; for( int i = 0; i < lastV; i++ ) { const SEG& s = pl.CSegment( i ); - PNS_SEGMENT* seg = new PNS_SEGMENT( s, m_currentNet ); + SEGMENT* seg = new SEGMENT( s, m_currentNet ); seg->SetWidth( pl.Width() ); seg->SetLayer( m_currentLayer ); m_lastNode->Add( seg ); @@ -934,7 +934,7 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest ) +void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest ) { if( !aLatest.SegmentCount() ) return; @@ -942,15 +942,15 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest ) if( aLatest.CLine().CPoint( 0 ) == aLatest.CLine().CPoint( -1 ) ) return; - std::set toErase; + std::set toErase; aNode->Add( &aLatest, true ); for( int s = 0; s < aLatest.LinkCount(); s++ ) { - PNS_SEGMENT* seg = ( *aLatest.LinkedSegments() )[s]; - PNS_LINE ourLine = aNode->AssembleLine( seg ); - PNS_JOINT a, b; - std::vector lines; + SEGMENT* seg = ( *aLatest.LinkedSegments() )[s]; + LINE ourLine = aNode->AssembleLine( seg ); + JOINT a, b; + std::vector lines; aNode->FindLineEnds( ourLine, a, b ); @@ -964,13 +964,13 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest ) int removedCount = 0; int total = 0; - for( PNS_LINE& line : lines ) + for( LINE& line : lines ) { total++; if( !( line.ContainsSegment( seg ) ) && line.SegmentCount() ) { - for( PNS_SEGMENT *ss : *line.LinkedSegments() ) + for( SEGMENT *ss : *line.LinkedSegments() ) toErase.insert( ss ); removedCount++; @@ -980,23 +980,23 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest ) wxLogTrace( "PNS", "total segs removed: %d/%d", removedCount, total ); } - for( PNS_SEGMENT *s : toErase ) + for( SEGMENT *s : toErase ) aNode->Remove( s ); aNode->Remove( &aLatest ); } -void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest ) +void LINE_PLACER::simplifyNewLine( NODE* aNode, SEGMENT* aLatest ) { - PNS_LINE l = aNode->AssembleLine( aLatest ); + LINE l = aNode->AssembleLine( aLatest ); SHAPE_LINE_CHAIN simplified( l.CLine() ); simplified.Simplify(); if( simplified.PointCount() != l.PointCount() ) { - PNS_LINE lnew( l ); + LINE lnew( l ); aNode->Remove( &l ); lnew.SetShape( simplified ); aNode->Add( &lnew ); @@ -1004,7 +1004,7 @@ void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest ) } -void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ) +void LINE_PLACER::UpdateSizes( const SIZES_SETTINGS& aSizes ) { m_sizes = aSizes; @@ -1015,24 +1015,24 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ) } -void PNS_LINE_PLACER::updateLeadingRatLine() +void LINE_PLACER::updateLeadingRatLine() { - PNS_LINE current = Trace(); + LINE current = Trace(); SHAPE_LINE_CHAIN ratLine; - PNS_TOPOLOGY topo( m_lastNode ); + TOPOLOGY topo( m_lastNode ); if( topo.LeadingRatLine( ¤t, ratLine ) ) Dbg()->AddLine( ratLine, 5, 10000 ); } -void PNS_LINE_PLACER::SetOrthoMode( bool aOrthoMode ) +void LINE_PLACER::SetOrthoMode( bool aOrthoMode ) { m_orthoMode = aOrthoMode; } -bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead ) +bool LINE_PLACER::buildInitialLine( const VECTOR2I& aP, LINE& aHead ) { SHAPE_LINE_CHAIN l; @@ -1065,7 +1065,7 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead ) if( !m_placingVia ) return true; - PNS_VIA v( makeVia( aP ) ); + VIA v( makeVia( aP ) ); v.SetNet( aHead.Net() ); if( m_currentMode == RM_MarkObstacles ) @@ -1082,7 +1082,7 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead ) if( v.PushoutForce( m_currentNode, lead, force, solidsOnly, 40 ) ) { SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace( m_p_start, aP + force ); - aHead = PNS_LINE( aHead, line ); + aHead = LINE( aHead, line ); v.SetPos( v.Pos() + force ); return true; @@ -1092,12 +1092,12 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead ) } -void PNS_LINE_PLACER::GetModifiedNets( std::vector& aNets ) const +void LINE_PLACER::GetModifiedNets( std::vector& aNets ) const { aNets.push_back( m_currentNet ); } -PNS_LOGGER* PNS_LINE_PLACER::Logger() +LOGGER* LINE_PLACER::Logger() { if( m_shove ) return m_shove->Logger(); diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h index f07199e4e1..2e07cc5907 100644 --- a/pcbnew/router/pns_line_placer.h +++ b/pcbnew/router/pns_line_placer.h @@ -35,26 +35,25 @@ namespace PNS { -class PNS_ROUTER; -class PNS_SHOVE; -class PNS_OPTIMIZER; -class PNS_ROUTER_BASE; -class PNS_VIA; -class PNS_SIZES_SETTINGS; +class ROUTER; +class SHOVE; +class OPTIMIZER; +class VIA; +class SIZES_SETTINGS; /** - * Class PNS_LINE_PLACER + * Class LINE_PLACER * * Single track placement algorithm. Interactively routes a track. * Applies shove and walkaround algorithms when needed. */ -class PNS_LINE_PLACER : public PNS_PLACEMENT_ALGO +class LINE_PLACER : public PLACEMENT_ALGO { public: - PNS_LINE_PLACER( PNS_ROUTER* aRouter ); - ~PNS_LINE_PLACER(); + LINE_PLACER( ROUTER* aRouter ); + ~LINE_PLACER(); /** * Function Start() @@ -62,7 +61,7 @@ public: * Starts routing a single track at point aP, taking item aStartItem as anchor * (unless NULL). */ - bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ); + bool Start( const VECTOR2I& aP, ITEM* aStartItem ); /** * Function Move() @@ -71,7 +70,7 @@ public: * aEndItem as anchor (if not NULL). * (unless NULL). */ - bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + bool Move( const VECTOR2I& aP, ITEM* aEndItem ); /** * Function FixRoute() @@ -82,7 +81,7 @@ public: * result is violating design rules - in such case, the track is only committed * if Settings.CanViolateDRC() is on. */ - bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ); /** * Function ToggleVia() @@ -104,7 +103,7 @@ public: * Returns the "head" of the line being placed, that is the volatile part * that has not "settled" yet. */ - const PNS_LINE& Head() const { return m_head; } + const LINE& Head() const { return m_head; } /** * Function Tail() @@ -112,21 +111,21 @@ public: * Returns the "tail" of the line being placed, the part which has already wrapped around * and shoved some obstacles. */ - const PNS_LINE& Tail() const { return m_tail; } + const LINE& Tail() const { return m_tail; } /** * Function Trace() * * Returns the complete routed line. */ - const PNS_LINE Trace() const; + const LINE Trace() const; /** * Function Traces() * - * Returns the complete routed line, as a single-member PNS_ITEMSET. + * Returns the complete routed line, as a single-member ITEM_SET. */ - const PNS_ITEMSET Traces(); + const ITEM_SET Traces(); /** * Function CurrentEnd() @@ -164,7 +163,7 @@ public: * * Returns the most recent world state. */ - PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const; + NODE* CurrentNode( bool aLoopsRemoved = false ) const; /** * Function FlipPosture() @@ -180,7 +179,7 @@ public: * a settings class. Used to dynamically change these parameters as * the track is routed. */ - void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ); + void UpdateSizes( const SIZES_SETTINGS& aSizes ); void SetOrthoMode( bool aOrthoMode ); @@ -188,7 +187,7 @@ public: void GetModifiedNets( std::vector& aNets ) const; - PNS_LOGGER* Logger(); + LOGGER* Logger(); private: @@ -218,7 +217,7 @@ private: * * Sets the board to route. */ - void setWorld( PNS_NODE* aWorld ); + void setWorld( NODE* aWorld ); /** * Function startPlacement() @@ -241,7 +240,7 @@ private: * Checks if point aP lies on segment aSeg. If so, splits the segment in two, * forming a joint at aP and stores updated topology in node aNode. */ - void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP ); + void splitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP ); /** * Function removeLoops() @@ -249,7 +248,7 @@ private: * Searches aNode for traces concurrent to aLatest and removes them. Updated * topology is stored in aNode. */ - void removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest ); + void removeLoops( NODE* aNode, LINE& aLatest ); /** * Function simplifyNewLine() @@ -258,7 +257,7 @@ private: * and redundant vertexes. If a simplification bhas been found, replaces the * old line with the simplified one in aNode. */ - void simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest ); + void simplifyNewLine( NODE* aNode, SEGMENT* aLatest ); /** * Function checkObtusity() @@ -325,7 +324,7 @@ private: * around all colliding solid or non-movable items. Movable segments are * ignored, as they'll be handled later by the shove algorithm. */ - bool routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead); + bool routeHead( const VECTOR2I& aP, LINE& aNewHead); /** * Function routeStep() @@ -337,17 +336,17 @@ private: void routeStep( const VECTOR2I& aP ); ///> route step, walkaround mode - bool rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead); + bool rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead); ///> route step, shove mode - bool rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead); + bool rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead); ///> route step, mark obstacles mode - bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead ); + bool rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead ); - const PNS_VIA makeVia( const VECTOR2I& aP ); + const VIA makeVia( const VECTOR2I& aP ); - bool buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead ); + bool buildInitialLine( const VECTOR2I& aP, LINE& aHead ); ///> current routing direction DIRECTION_45 m_direction; @@ -357,27 +356,27 @@ private: ///> routing "head": volatile part of the track from the previously /// analyzed point to the current routing destination - PNS_LINE m_head; + LINE m_head; ///> routing "tail": part of the track that has been already fixed due to collisions with obstacles - PNS_LINE m_tail; + LINE m_tail; ///> pointer to world to search colliding items - PNS_NODE* m_world; + NODE* m_world; ///> current routing start point (end of tail, beginning of head) VECTOR2I m_p_start; ///> The shove engine - PNS_SHOVE* m_shove; + SHOVE* m_shove; ///> Current world state - PNS_NODE* m_currentNode; + NODE* m_currentNode; ///> Postprocessed world state (including marked collisions & removed loops) - PNS_NODE* m_lastNode; + NODE* m_lastNode; - PNS_SIZES_SETTINGS m_sizes; + SIZES_SETTINGS m_sizes; ///> Are we placing a via? bool m_placingVia; @@ -386,10 +385,10 @@ private: int m_currentLayer; VECTOR2I m_currentEnd, m_currentStart; - PNS_LINE m_currentTrace; + LINE m_currentTrace; PNS_MODE m_currentMode; - PNS_ITEM* m_startItem; + ITEM* m_startItem; bool m_idle; bool m_chainedPlacement; diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp index 7dcbe63ba5..161b800fd4 100644 --- a/pcbnew/router/pns_logger.cpp +++ b/pcbnew/router/pns_logger.cpp @@ -34,25 +34,25 @@ namespace PNS { -PNS_LOGGER::PNS_LOGGER( ) +LOGGER::LOGGER( ) { m_groupOpened = false; } -PNS_LOGGER::~PNS_LOGGER() +LOGGER::~LOGGER() { } -void PNS_LOGGER::Clear() +void LOGGER::Clear() { m_theLog.str( std::string() ); m_groupOpened = false; } -void PNS_LOGGER::NewGroup( const std::string& aName, int aIter ) +void LOGGER::NewGroup( const std::string& aName, int aIter ) { if( m_groupOpened ) m_theLog << "endgroup" << std::endl; @@ -62,7 +62,7 @@ void PNS_LOGGER::NewGroup( const std::string& aName, int aIter ) } -void PNS_LOGGER::EndGroup() +void LOGGER::EndGroup() { if( !m_groupOpened ) return; @@ -72,7 +72,7 @@ void PNS_LOGGER::EndGroup() } -void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName ) +void LOGGER::Log ( const ITEM* aItem, int aKind, const std::string aName ) { m_theLog << "item " << aKind << " " << aName << " "; m_theLog << aItem->Net() << " " << aItem->Layers().Start() << " " << @@ -80,9 +80,9 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName switch( aItem->Kind() ) { - case PNS_ITEM::LINE_T: + case ITEM::LINE_T: { - PNS_LINE* l = (PNS_LINE*) aItem; + LINE* l = (LINE*) aItem; m_theLog << " line "; m_theLog << l->Width() << " " << ( l->EndsWithVia() ? 1 : 0 ) << " "; dumpShape ( l->Shape() ); @@ -90,7 +90,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName break; } - case PNS_ITEM::VIA_T: + case ITEM::VIA_T: { m_theLog << " via 0 0 "; dumpShape ( aItem->Shape() ); @@ -98,18 +98,18 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName break; } - case PNS_ITEM::SEGMENT_T: + case ITEM::SEGMENT_T: { - PNS_SEGMENT* s =(PNS_SEGMENT*) aItem; + SEGMENT* s =(SEGMENT*) aItem; m_theLog << " line "; m_theLog << s->Width() << " 0 linechain 2 0 " << s->Seg().A.x << " " << s->Seg().A.y << " " << s->Seg().B.x << " " <Seg().B.y << std::endl; break; } - case PNS_ITEM::SOLID_T: + case ITEM::SOLID_T: { - PNS_SOLID* s = (PNS_SOLID*) aItem; + SOLID* s = (SOLID*) aItem; m_theLog << " solid 0 0 "; dumpShape( s->Shape() ); m_theLog << std::endl; @@ -122,7 +122,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName } -void PNS_LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string aName ) +void LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string aName ) { m_theLog << "item " << aKind << " " << aName << " "; m_theLog << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0; @@ -133,13 +133,13 @@ void PNS_LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string a } -void PNS_LOGGER::Log( const VECTOR2I& aStart, const VECTOR2I& aEnd, +void LOGGER::Log( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aKind, const std::string aName) { } -void PNS_LOGGER::dumpShape( const SHAPE* aSh ) +void LOGGER::dumpShape( const SHAPE* aSh ) { switch( aSh->Type() ) { @@ -194,7 +194,7 @@ void PNS_LOGGER::dumpShape( const SHAPE* aSh ) } -void PNS_LOGGER::Save( const std::string& aFilename ) +void LOGGER::Save( const std::string& aFilename ) { EndGroup(); diff --git a/pcbnew/router/pns_logger.h b/pcbnew/router/pns_logger.h index 24f2bd39cd..bcc9c91d05 100644 --- a/pcbnew/router/pns_logger.h +++ b/pcbnew/router/pns_logger.h @@ -34,13 +34,13 @@ class SHAPE; namespace PNS { -class PNS_ITEM; +class ITEM; -class PNS_LOGGER +class LOGGER { public: - PNS_LOGGER(); - ~PNS_LOGGER(); + LOGGER(); + ~LOGGER(); void Save( const std::string& aFilename ); void Clear(); @@ -48,7 +48,7 @@ public: void NewGroup( const std::string& aName, int aIter = 0 ); void EndGroup(); - void Log( const PNS_ITEM* aItem, int aKind = 0, const std::string aName = std::string() ); + void Log( const ITEM* aItem, int aKind = 0, const std::string aName = 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() ); diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index b6fd2578ca..cf562199df 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -31,19 +31,19 @@ namespace PNS { -const PNS_MEANDER_SETTINGS& PNS_MEANDER_SHAPE::Settings() const +const MEANDER_SETTINGS& MEANDER_SHAPE::Settings() const { return m_placer->MeanderSettings(); } -const PNS_MEANDER_SETTINGS& PNS_MEANDERED_LINE::Settings() const +const MEANDER_SETTINGS& MEANDERED_LINE::Settings() const { return m_placer->MeanderSettings(); } -void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) +void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) { double base_len = aBase.Length(); @@ -62,7 +62,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) do { - PNS_MEANDER_SHAPE m( m_placer, m_width, m_dual ); + MEANDER_SHAPE m( m_placer, m_width, m_dual ); m.SetBaselineOffset( m_baselineOffset ); m.SetBaseIndex( aBaseIndex ); @@ -84,7 +84,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) if( m.Fit( MT_CHECK_START, aBase, m_last, i ) ) { turning = true; - AddMeander( new PNS_MEANDER_SHAPE( m ) ); + AddMeander( new MEANDER_SHAPE( m ) ); side = !i; started = true; break; @@ -99,7 +99,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) { if( m.Fit( MT_SINGLE, aBase, m_last, i ) ) { - AddMeander( new PNS_MEANDER_SHAPE( m ) ); + AddMeander( new MEANDER_SHAPE( m ) ); fail = false; started = false; side = !i; @@ -113,12 +113,12 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) if( rv ) { m.Fit( MT_TURN, aBase, m_last, side ); - AddMeander( new PNS_MEANDER_SHAPE( m ) ); + AddMeander( new MEANDER_SHAPE( m ) ); started = true; } else { m.Fit( MT_FINISH, aBase, m_last, side ); started = false; - AddMeander( new PNS_MEANDER_SHAPE( m ) ); + AddMeander( new MEANDER_SHAPE( m ) ); turning = false; } @@ -128,7 +128,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) { bool rv = m.Fit( MT_FINISH, aBase, m_last, side ); if( rv ) - AddMeander( new PNS_MEANDER_SHAPE( m ) ); + AddMeander( new MEANDER_SHAPE( m ) ); break; @@ -143,7 +143,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) if( fail ) { - PNS_MEANDER_SHAPE tmp( m_placer, m_width, m_dual ); + MEANDER_SHAPE tmp( m_placer, m_width, m_dual ); tmp.SetBaselineOffset( m_baselineOffset ); tmp.SetBaseIndex( aBaseIndex ); @@ -165,13 +165,13 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex ) } -int PNS_MEANDER_SHAPE::cornerRadius() const +int MEANDER_SHAPE::cornerRadius() const { return (int64_t) spacing() * Settings().m_cornerRadiusPercentage / 200; } -int PNS_MEANDER_SHAPE::spacing( ) const +int MEANDER_SHAPE::spacing( ) const { if( !m_dual ) return std::max( 2 * m_width, Settings().m_spacing ); @@ -183,7 +183,7 @@ int PNS_MEANDER_SHAPE::spacing( ) const } -SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool aSide ) +SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool aSide ) { SHAPE_LINE_CHAIN lc; @@ -254,7 +254,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, } -VECTOR2I PNS_MEANDER_SHAPE::reflect( VECTOR2I p, const SEG& line ) +VECTOR2I MEANDER_SHAPE::reflect( VECTOR2I p, const SEG& line ) { typedef int64_t ecoord; VECTOR2I d = line.B - line.A; @@ -273,7 +273,7 @@ VECTOR2I PNS_MEANDER_SHAPE::reflect( VECTOR2I p, const SEG& line ) } -void PNS_MEANDER_SHAPE::start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere, const VECTOR2D& aDir ) +void MEANDER_SHAPE::start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere, const VECTOR2D& aDir ) { m_currentTarget = aTarget; m_currentTarget->Clear(); @@ -283,20 +283,20 @@ void PNS_MEANDER_SHAPE::start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere } -void PNS_MEANDER_SHAPE::forward( int aLength ) +void MEANDER_SHAPE::forward( int aLength ) { m_currentPos += m_currentDir.Resize( aLength ); m_currentTarget->Append( m_currentPos ); } -void PNS_MEANDER_SHAPE::turn( int aAngle ) +void MEANDER_SHAPE::turn( int aAngle ) { m_currentDir = m_currentDir.Rotate( (double) aAngle * M_PI / 180.0 ); } -void PNS_MEANDER_SHAPE::miter( int aRadius, bool aSide ) +void MEANDER_SHAPE::miter( int aRadius, bool aSide ) { if( aRadius <= 0 ) { @@ -314,7 +314,7 @@ void PNS_MEANDER_SHAPE::miter( int aRadius, bool aSide ) } -void PNS_MEANDER_SHAPE::uShape( int aSides, int aCorner, int aTop ) +void MEANDER_SHAPE::uShape( int aSides, int aCorner, int aTop ) { forward( aSides ); miter( aCorner, true ); @@ -324,10 +324,10 @@ void PNS_MEANDER_SHAPE::uShape( int aSides, int aCorner, int aTop ) } -SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir, - bool aSide, PNS_MEANDER_TYPE aType, int aAmpl, int aBaselineOffset ) +SHAPE_LINE_CHAIN MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir, + bool aSide, MEANDER_TYPE aType, int aAmpl, int aBaselineOffset ) { - const PNS_MEANDER_SETTINGS& st = Settings(); + const MEANDER_SETTINGS& st = Settings(); int cr = cornerRadius(); int offset = aBaselineOffset; int spc = spacing(); @@ -417,11 +417,11 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir, } -bool PNS_MEANDERED_LINE::CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int aClearance ) +bool MEANDERED_LINE::CheckSelfIntersections( MEANDER_SHAPE* aShape, int aClearance ) { for( int i = m_meanders.size() - 1; i >= 0; i-- ) { - PNS_MEANDER_SHAPE* m = m_meanders[i]; + MEANDER_SHAPE* m = m_meanders[i]; if( m->Type() == MT_EMPTY || m->Type() == MT_CORNER ) continue; @@ -443,12 +443,12 @@ bool PNS_MEANDERED_LINE::CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int } -bool PNS_MEANDER_SHAPE::Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide ) +bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide ) { - const PNS_MEANDER_SETTINGS& st = Settings(); + const MEANDER_SETTINGS& st = Settings(); bool checkMode = false; - PNS_MEANDER_TYPE prim1, prim2; + MEANDER_TYPE prim1, prim2; if( aType == MT_CHECK_START ) { @@ -465,8 +465,8 @@ bool PNS_MEANDER_SHAPE::Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECT if( checkMode ) { - PNS_MEANDER_SHAPE m1( m_placer, m_width, m_dual ); - PNS_MEANDER_SHAPE m2( m_placer, m_width, m_dual ); + MEANDER_SHAPE m1( m_placer, m_width, m_dual ); + MEANDER_SHAPE m2( m_placer, m_width, m_dual ); m1.SetBaselineOffset( m_baselineOffset ); m2.SetBaselineOffset( m_baselineOffset ); @@ -533,7 +533,7 @@ bool PNS_MEANDER_SHAPE::Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECT } -void PNS_MEANDER_SHAPE::Recalculate() +void MEANDER_SHAPE::Recalculate() { m_shapes[0] = genMeanderShape( m_p0, m_baseSeg.B - m_baseSeg.A, m_side, m_type, m_amplitude, m_dual ? m_baselineOffset : 0 ); @@ -544,7 +544,7 @@ void PNS_MEANDER_SHAPE::Recalculate() } -void PNS_MEANDER_SHAPE::Resize( int aAmpl ) +void MEANDER_SHAPE::Resize( int aAmpl ) { if( aAmpl < 0 ) return; @@ -555,7 +555,7 @@ void PNS_MEANDER_SHAPE::Resize( int aAmpl ) } -void PNS_MEANDER_SHAPE::MakeEmpty() +void MEANDER_SHAPE::MakeEmpty() { updateBaseSegment(); @@ -570,9 +570,9 @@ void PNS_MEANDER_SHAPE::MakeEmpty() } -void PNS_MEANDERED_LINE::AddCorner( const VECTOR2I& aA, const VECTOR2I& aB ) +void MEANDERED_LINE::AddCorner( const VECTOR2I& aA, const VECTOR2I& aB ) { - PNS_MEANDER_SHAPE* m = new PNS_MEANDER_SHAPE( m_placer, m_width, m_dual ); + MEANDER_SHAPE* m = new MEANDER_SHAPE( m_placer, m_width, m_dual ); m->MakeCorner( aA, aB ); m_last = aA; @@ -581,7 +581,7 @@ void PNS_MEANDERED_LINE::AddCorner( const VECTOR2I& aA, const VECTOR2I& aB ) } -void PNS_MEANDER_SHAPE::MakeCorner( VECTOR2I aP1, VECTOR2I aP2 ) +void MEANDER_SHAPE::MakeCorner( VECTOR2I aP1, VECTOR2I aP2 ) { SetType( MT_CORNER ); m_shapes[0].Clear(); @@ -593,16 +593,16 @@ void PNS_MEANDER_SHAPE::MakeCorner( VECTOR2I aP1, VECTOR2I aP2 ) } -void PNS_MEANDERED_LINE::AddMeander( PNS_MEANDER_SHAPE* aShape ) +void MEANDERED_LINE::AddMeander( MEANDER_SHAPE* aShape ) { m_last = aShape->BaseSegment().B; m_meanders.push_back( aShape ); } -void PNS_MEANDERED_LINE::Clear() +void MEANDERED_LINE::Clear() { - for( PNS_MEANDER_SHAPE* m : m_meanders ) + for( MEANDER_SHAPE* m : m_meanders ) { delete m; } @@ -611,19 +611,19 @@ void PNS_MEANDERED_LINE::Clear() } -int PNS_MEANDER_SHAPE::BaselineLength() const +int MEANDER_SHAPE::BaselineLength() const { return m_clippedBaseSeg.Length(); } -int PNS_MEANDER_SHAPE::MaxTunableLength() const +int MEANDER_SHAPE::MaxTunableLength() const { return CLine( 0 ).Length(); } -void PNS_MEANDER_SHAPE::updateBaseSegment( ) +void MEANDER_SHAPE::updateBaseSegment( ) { if( m_dual ) { diff --git a/pcbnew/router/pns_meander.h b/pcbnew/router/pns_meander.h index 44ca3b2986..03d29a2438 100644 --- a/pcbnew/router/pns_meander.h +++ b/pcbnew/router/pns_meander.h @@ -29,10 +29,10 @@ namespace PNS { -class PNS_MEANDER_PLACER_BASE; +class MEANDER_PLACER_BASE; ///< Shapes of available meanders -enum PNS_MEANDER_TYPE { +enum MEANDER_TYPE { MT_SINGLE, // _|^|_, single-sided MT_START, // _|^| MT_FINISH, // |^|_ @@ -44,21 +44,21 @@ enum PNS_MEANDER_TYPE { }; ///> meander corner shape -enum PNS_MEANDER_STYLE { +enum MEANDER_STYLE { MEANDER_STYLE_ROUND = 1, // rounded (90 degree arc) MEANDER_STYLE_CHAMFER // chamfered (45 degree segment) }; /** - * Class PNS_MEANDER_SETTINGS + * Class MEANDER_SETTINGS * * Holds dimensions for the meandering algorithm. */ -class PNS_MEANDER_SETTINGS +class MEANDER_SETTINGS { public: - PNS_MEANDER_SETTINGS() + MEANDER_SETTINGS() { m_minAmplitude = 100000; m_maxAmplitude = 1000000; @@ -83,7 +83,7 @@ public: ///> desired length of the tuned line/diff pair int m_targetLength; ///> type of corners for the meandered line - PNS_MEANDER_STYLE m_cornerStyle; + MEANDER_STYLE m_cornerStyle; ///> rounding percentage (0 - 100) int m_cornerRadiusPercentage; ///> allowable tuning error @@ -94,14 +94,14 @@ public: int m_targetSkew; }; -class PNS_MEANDERED_LINE; +class MEANDERED_LINE; /** - * Class PNS_MEANDER_SETTINGS + * Class MEANDER_SETTINGS * * Holds the geometry of a single meander. */ -class PNS_MEANDER_SHAPE +class MEANDER_SHAPE { public: /** @@ -112,7 +112,7 @@ public: * @param aIsDual when true, the shape contains two meandered * lines at a given offset (diff pairs) */ - PNS_MEANDER_SHAPE( PNS_MEANDER_PLACER_BASE* aPlacer, int aWidth, bool aIsDual = false ) : + MEANDER_SHAPE( MEANDER_PLACER_BASE* aPlacer, int aWidth, bool aIsDual = false ) : m_placer( aPlacer ), m_dual( aIsDual ), m_width( aWidth ), @@ -132,7 +132,7 @@ public: * * Sets the type of the meander. */ - void SetType( PNS_MEANDER_TYPE aType ) + void SetType( MEANDER_TYPE aType ) { m_type = aType; } @@ -142,7 +142,7 @@ public: * * @return the type of the meander. */ - PNS_MEANDER_TYPE Type() const + MEANDER_TYPE Type() const { return m_type; } @@ -150,7 +150,7 @@ public: /** * Function SetBaseIndex() * - * Sets an auxillary index of the segment being meandered in its original PNS_LINE. + * Sets an auxillary index of the segment being meandered in its original LINE. */ void SetBaseIndex( int aIndex ) { @@ -160,7 +160,7 @@ public: /** * Function BaseIndex() * - * @return auxillary index of the segment being meandered in its original PNS_LINE. + * @return auxillary index of the segment being meandered in its original LINE. */ int BaseIndex() const { @@ -262,7 +262,7 @@ public: * @param aSide side of aSeg to put the meander on (true = right) * @return true on success. */ - bool Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide ); + bool Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide ); /** * Function BaseSegment() @@ -295,7 +295,7 @@ public: * * @return the current meandering settings. */ - const PNS_MEANDER_SETTINGS& Settings() const; + const MEANDER_SETTINGS& Settings() const; /** * Function Width() @@ -320,7 +320,7 @@ public: } private: - friend class PNS_MEANDERED_LINE; + friend class MEANDERED_LINE; ///> starts turtle drawing void start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere, const VECTOR2D& aDir ); @@ -340,7 +340,7 @@ private: VECTOR2I reflect( VECTOR2I aP, const SEG& aLine ); ///> produces a meander shape of given type - SHAPE_LINE_CHAIN genMeanderShape( VECTOR2D aP, VECTOR2D aDir, bool aSide, PNS_MEANDER_TYPE aType, int aAmpl, int aBaselineOffset = 0 ); + SHAPE_LINE_CHAIN genMeanderShape( VECTOR2D aP, VECTOR2D aDir, bool aSide, MEANDER_TYPE aType, int aAmpl, int aBaselineOffset = 0 ); ///> recalculates the clipped baseline after the parameters of ///> the meander have been changed. @@ -353,9 +353,9 @@ private: int spacing() const; ///> the type - PNS_MEANDER_TYPE m_type; + MEANDER_TYPE m_type; ///> the placer that placed this meander - PNS_MEANDER_PLACER_BASE* m_placer; + MEANDER_PLACER_BASE* m_placer; ///> dual or single line bool m_dual; ///> width of the line @@ -388,14 +388,14 @@ private: /** - * Class PNS_MEANDERED_LINE + * Class MEANDERED_LINE * * Represents a set of meanders fitted over a single or two lines. */ -class PNS_MEANDERED_LINE +class MEANDERED_LINE { public: - PNS_MEANDERED_LINE() + MEANDERED_LINE() { // Do not leave unitialized members, and keep static analyser quiet: m_placer = NULL; @@ -410,7 +410,7 @@ public: * @param aPlacer the meander placer instance * @param aIsDual when true, the meanders are generated for two coupled lines */ - PNS_MEANDERED_LINE( PNS_MEANDER_PLACER_BASE* aPlacer, bool aIsDual = false ) : + MEANDERED_LINE( MEANDER_PLACER_BASE* aPlacer, bool aIsDual = false ) : m_placer( aPlacer ), m_dual( aIsDual ) { @@ -419,7 +419,7 @@ public: m_baselineOffset = 0; } - ~PNS_MEANDERED_LINE() + ~MEANDERED_LINE() { Clear(); } @@ -440,7 +440,7 @@ public: * Adds a new meander shape the the meandered line. * @param aShape the meander shape to add */ - void AddMeander( PNS_MEANDER_SHAPE* aShape ); + void AddMeander( MEANDER_SHAPE* aShape ); /** * Function Clear() @@ -469,7 +469,7 @@ public: */ void MeanderSegment( const SEG& aSeg, int aBaseIndex = 0 ); - /// @copydoc PNS_MEANDER_SHAPE::SetBaselineOffset() + /// @copydoc MEANDER_SHAPE::SetBaselineOffset() void SetBaselineOffset( int aOffset ) { m_baselineOffset = aOffset; @@ -480,7 +480,7 @@ public: * * @return set of meander shapes for this line */ - std::vector& Meanders() + std::vector& Meanders() { return m_meanders; } @@ -494,20 +494,20 @@ public: * @param aClearance clearance value * @return true, if the meander shape is not colliding */ - bool CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int aClearance ); + bool CheckSelfIntersections( MEANDER_SHAPE* aShape, int aClearance ); /** * Function Settings() * * @return the current meandering settings. */ - const PNS_MEANDER_SETTINGS& Settings() const; + const MEANDER_SETTINGS& Settings() const; private: VECTOR2I m_last; - PNS_MEANDER_PLACER_BASE* m_placer; - std::vector m_meanders; + MEANDER_PLACER_BASE* m_placer; + std::vector m_meanders; bool m_dual; int m_width; diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp index 633c599007..42daa7c985 100644 --- a/pcbnew/router/pns_meander_placer.cpp +++ b/pcbnew/router/pns_meander_placer.cpp @@ -30,8 +30,8 @@ namespace PNS { -PNS_MEANDER_PLACER::PNS_MEANDER_PLACER( PNS_ROUTER* aRouter ) : - PNS_MEANDER_PLACER_BASE( aRouter ) +MEANDER_PLACER::MEANDER_PLACER( ROUTER* aRouter ) : + MEANDER_PLACER_BASE( aRouter ) { m_world = NULL; m_currentNode = NULL; @@ -43,12 +43,12 @@ PNS_MEANDER_PLACER::PNS_MEANDER_PLACER( PNS_ROUTER* aRouter ) : } -PNS_MEANDER_PLACER::~PNS_MEANDER_PLACER() +MEANDER_PLACER::~MEANDER_PLACER() { } -PNS_NODE* PNS_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const +NODE* MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const { if( !m_currentNode ) return m_world; @@ -57,17 +57,17 @@ PNS_NODE* PNS_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const } -bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) +bool MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem ) { VECTOR2I p; - if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T ) ) { Router()->SetFailureReason( _( "Please select a track whose length you want to tune." ) ); return false; } - m_initialSegment = static_cast( aStartItem ); + m_initialSegment = static_cast( aStartItem ); p = m_initialSegment->Seg().NearestPoint( aP ); @@ -77,7 +77,7 @@ bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) m_world = Router()->GetWorld()->Branch(); m_originLine = m_world->AssembleLine( m_initialSegment ); - PNS_TOPOLOGY topo( m_world ); + TOPOLOGY topo( m_world ); m_tunedPath = topo.AssembleTrivialPath( m_initialSegment ); m_world->Remove( &m_originLine ); @@ -89,12 +89,12 @@ bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) } -int PNS_MEANDER_PLACER::origPathLength() const +int MEANDER_PLACER::origPathLength() const { int total = 0; - for( const PNS_ITEM* item : m_tunedPath.CItems() ) + for( const ITEM* item : m_tunedPath.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) { total += l->CLine().Length(); } @@ -104,13 +104,13 @@ int PNS_MEANDER_PLACER::origPathLength() const } -bool PNS_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) { return doMove( aP, aEndItem, m_settings.m_targetLength ); } -bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTargetLength ) +bool MEANDER_PLACER::doMove( const VECTOR2I& aP, ITEM* aEndItem, int aTargetLength ) { SHAPE_LINE_CHAIN pre, tuned, post; @@ -121,7 +121,7 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa cutTunedLine( m_originLine.CLine(), m_currentStart, aP, pre, tuned, post ); - m_result = PNS_MEANDERED_LINE( this, false ); + m_result = MEANDERED_LINE( this, false ); m_result.SetWidth( m_originLine.Width() ); m_result.SetBaselineOffset( 0 ); @@ -146,9 +146,9 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa tuneLineLength( m_result, aTargetLength - lineLen ); } - for( const PNS_ITEM* item : m_tunedPath.CItems() ) + for( const ITEM* item : m_tunedPath.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) { Dbg()->AddLine( l->CLine(), 5, 30000 ); } @@ -158,7 +158,7 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa { tuned.Clear(); - for( PNS_MEANDER_SHAPE* m : m_result.Meanders() ) + for( MEANDER_SHAPE* m : m_result.Meanders() ) { if( m->Type() != MT_EMPTY ) { @@ -188,12 +188,12 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa } -bool PNS_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) { if( !m_currentNode ) return false; - m_currentTrace = PNS_LINE( m_originLine, m_finalShape ); + m_currentTrace = LINE( m_originLine, m_finalShape ); m_currentNode->Add( &m_currentTrace ); Router()->CommitRouting( m_currentNode ); @@ -201,9 +201,9 @@ bool PNS_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -bool PNS_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape ) +bool MEANDER_PLACER::CheckFit( MEANDER_SHAPE* aShape ) { - PNS_LINE l( m_originLine, aShape->CLine( 0 ) ); + LINE l( m_originLine, aShape->CLine( 0 ) ); if( m_currentNode->CheckColliding( &l ) ) return false; @@ -215,25 +215,25 @@ bool PNS_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape ) } -const PNS_ITEMSET PNS_MEANDER_PLACER::Traces() +const ITEM_SET MEANDER_PLACER::Traces() { - m_currentTrace = PNS_LINE( m_originLine, m_finalShape ); - return PNS_ITEMSET( &m_currentTrace ); + m_currentTrace = LINE( m_originLine, m_finalShape ); + return ITEM_SET( &m_currentTrace ); } -const VECTOR2I& PNS_MEANDER_PLACER::CurrentEnd() const +const VECTOR2I& MEANDER_PLACER::CurrentEnd() const { return m_currentEnd; } -int PNS_MEANDER_PLACER::CurrentLayer() const +int MEANDER_PLACER::CurrentLayer() const { return m_initialSegment->Layers().Start(); } -const wxString PNS_MEANDER_PLACER::TuningInfo() const +const wxString MEANDER_PLACER::TuningInfo() const { wxString status; @@ -260,7 +260,7 @@ const wxString PNS_MEANDER_PLACER::TuningInfo() const } -PNS_MEANDER_PLACER::TUNING_STATUS PNS_MEANDER_PLACER::TuningStatus() const +MEANDER_PLACER::TUNING_STATUS MEANDER_PLACER::TuningStatus() const { return m_lastStatus; } diff --git a/pcbnew/router/pns_meander_placer.h b/pcbnew/router/pns_meander_placer.h index c6284bfb21..894a04aba1 100644 --- a/pcbnew/router/pns_meander_placer.h +++ b/pcbnew/router/pns_meander_placer.h @@ -36,83 +36,82 @@ namespace PNS { -class PNS_ROUTER; -class PNS_SHOVE; -class PNS_OPTIMIZER; -class PNS_ROUTER_BASE; +class ROUTER; +class SHOVE; +class OPTIMIZER; /** - * Class PNS_MEANDER_PLACER + * Class MEANDER_PLACER * * Single track length matching/meandering tool. */ -class PNS_MEANDER_PLACER : public PNS_MEANDER_PLACER_BASE +class MEANDER_PLACER : public MEANDER_PLACER_BASE { public: - PNS_MEANDER_PLACER( PNS_ROUTER* aRouter ); - virtual ~PNS_MEANDER_PLACER(); + MEANDER_PLACER( ROUTER* aRouter ); + virtual ~MEANDER_PLACER(); - /// @copydoc PNS_PLACEMENT_ALGO::Start() - virtual bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ); + /// @copydoc PLACEMENT_ALGO::Start() + virtual bool Start( const VECTOR2I& aP, ITEM* aStartItem ); - /// @copydoc PNS_PLACEMENT_ALGO::Move() - virtual bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + /// @copydoc PLACEMENT_ALGO::Move() + virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem ); - /// @copydoc PNS_PLACEMENT_ALGO::FixRoute() - virtual bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + /// @copydoc PLACEMENT_ALGO::FixRoute() + virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ); - /// @copydoc PNS_PLACEMENT_ALGO::CurrentNode() - PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const; + /// @copydoc PLACEMENT_ALGO::CurrentNode() + NODE* CurrentNode( bool aLoopsRemoved = false ) const; - /// @copydoc PNS_PLACEMENT_ALGO::Traces() - const PNS_ITEMSET Traces(); + /// @copydoc PLACEMENT_ALGO::Traces() + const ITEM_SET Traces(); - /// @copydoc PNS_PLACEMENT_ALGO::CurrentEnd() + /// @copydoc PLACEMENT_ALGO::CurrentEnd() const VECTOR2I& CurrentEnd() const; - /// @copydoc PNS_PLACEMENT_ALGO::CurrentNets() + /// @copydoc PLACEMENT_ALGO::CurrentNets() const std::vector CurrentNets() const { return std::vector (1, m_originLine.Net() ); } - /// @copydoc PNS_PLACEMENT_ALGO::CurrentLayer() + /// @copydoc PLACEMENT_ALGO::CurrentLayer() int CurrentLayer() const; - /// @copydoc PNS_MEANDER_PLACER_BASE::TuningInfo() + /// @copydoc MEANDER_PLACER_BASE::TuningInfo() virtual const wxString TuningInfo() const; - /// @copydoc PNS_MEANDER_PLACER_BASE::TuningStatus() + /// @copydoc MEANDER_PLACER_BASE::TuningStatus() virtual TUNING_STATUS TuningStatus() const; - /// @copydoc PNS_MEANDER_PLACER_BASE::CheckFit() - bool CheckFit ( PNS_MEANDER_SHAPE* aShape ); + /// @copydoc MEANDER_PLACER_BASE::CheckFit() + bool CheckFit ( MEANDER_SHAPE* aShape ); protected: - bool doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTargetLength ); + bool doMove( const VECTOR2I& aP, ITEM* aEndItem, int aTargetLength ); - void setWorld( PNS_NODE* aWorld ); + void setWorld( NODE* aWorld ); virtual int origPathLength() const; ///> pointer to world to search colliding items - PNS_NODE* m_world; + NODE* m_world; ///> current routing start point (end of tail, beginning of head) VECTOR2I m_currentStart; ///> Current world state - PNS_NODE* m_currentNode; + NODE* m_currentNode; - PNS_LINE m_originLine; - PNS_LINE m_currentTrace; - PNS_ITEMSET m_tunedPath; + LINE m_originLine; + LINE m_currentTrace; + ITEM_SET m_tunedPath; SHAPE_LINE_CHAIN m_finalShape; - PNS_MEANDERED_LINE m_result; - PNS_SEGMENT* m_initialSegment; + MEANDERED_LINE m_result; + SEGMENT* m_initialSegment; int m_lastLength; TUNING_STATUS m_lastStatus; diff --git a/pcbnew/router/pns_meander_placer_base.cpp b/pcbnew/router/pns_meander_placer_base.cpp index dc999b9d14..613c7a5c35 100644 --- a/pcbnew/router/pns_meander_placer_base.cpp +++ b/pcbnew/router/pns_meander_placer_base.cpp @@ -25,19 +25,19 @@ namespace PNS { -PNS_MEANDER_PLACER_BASE::PNS_MEANDER_PLACER_BASE( PNS_ROUTER* aRouter ) : - PNS_PLACEMENT_ALGO( aRouter ) +MEANDER_PLACER_BASE::MEANDER_PLACER_BASE( ROUTER* aRouter ) : + PLACEMENT_ALGO( aRouter ) { m_currentWidth = 0; } -PNS_MEANDER_PLACER_BASE::~PNS_MEANDER_PLACER_BASE() +MEANDER_PLACER_BASE::~MEANDER_PLACER_BASE() { } -void PNS_MEANDER_PLACER_BASE::AmplitudeStep( int aSign ) +void MEANDER_PLACER_BASE::AmplitudeStep( int aSign ) { int a = m_settings.m_maxAmplitude + aSign * m_settings.m_step; a = std::max( a, m_settings.m_minAmplitude ); @@ -46,7 +46,7 @@ void PNS_MEANDER_PLACER_BASE::AmplitudeStep( int aSign ) } -void PNS_MEANDER_PLACER_BASE::SpacingStep( int aSign ) +void MEANDER_PLACER_BASE::SpacingStep( int aSign ) { int s = m_settings.m_spacing + aSign * m_settings.m_step; s = std::max( s, 2 * m_currentWidth ); @@ -55,13 +55,13 @@ void PNS_MEANDER_PLACER_BASE::SpacingStep( int aSign ) } -void PNS_MEANDER_PLACER_BASE::UpdateSettings( const PNS_MEANDER_SETTINGS& aSettings ) +void MEANDER_PLACER_BASE::UpdateSettings( const MEANDER_SETTINGS& aSettings ) { m_settings = aSettings; } -void PNS_MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin, +void MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aTuneStart, const VECTOR2I& aCursorPos, SHAPE_LINE_CHAIN& aPre, @@ -106,12 +106,12 @@ void PNS_MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin, } -void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aElongation ) +void MEANDER_PLACER_BASE::tuneLineLength( MEANDERED_LINE& aTuned, int aElongation ) { int remaining = aElongation; bool finished = false; - for( PNS_MEANDER_SHAPE* m : aTuned.Meanders() ) + for( MEANDER_SHAPE* m : aTuned.Meanders() ) { if( m->Type() != MT_CORNER ) { @@ -122,7 +122,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE { if( !finished ) { - PNS_MEANDER_TYPE newType; + MEANDER_TYPE newType; if( m->Type() == MT_START || m->Type() == MT_SINGLE ) newType = MT_SINGLE; @@ -143,7 +143,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE remaining = aElongation; int meanderCount = 0; - for(PNS_MEANDER_SHAPE* m : aTuned.Meanders()) + for(MEANDER_SHAPE* m : aTuned.Meanders()) { if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY ) { @@ -162,7 +162,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE if( balance >= 0 ) { - for( PNS_MEANDER_SHAPE* m : aTuned.Meanders() ) + for( MEANDER_SHAPE* m : aTuned.Meanders() ) { if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY ) { @@ -173,13 +173,13 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE } -const PNS_MEANDER_SETTINGS& PNS_MEANDER_PLACER_BASE::MeanderSettings() const +const MEANDER_SETTINGS& MEANDER_PLACER_BASE::MeanderSettings() const { return m_settings; } -int PNS_MEANDER_PLACER_BASE::compareWithTolerance( int aValue, int aExpected, int aTolerance ) const +int MEANDER_PLACER_BASE::compareWithTolerance( int aValue, int aExpected, int aTolerance ) const { if( aValue < aExpected - aTolerance ) return -1; diff --git a/pcbnew/router/pns_meander_placer_base.h b/pcbnew/router/pns_meander_placer_base.h index f8f889956c..18d11800a2 100644 --- a/pcbnew/router/pns_meander_placer_base.h +++ b/pcbnew/router/pns_meander_placer_base.h @@ -35,18 +35,17 @@ namespace PNS { -class PNS_ROUTER; -class PNS_SHOVE; -class PNS_OPTIMIZER; -class PNS_ROUTER_BASE; +class ROUTER; +class SHOVE; +class OPTIMIZER; /** - * Class PNS_MEANDER_PLACER_BASE + * Class MEANDER_PLACER_BASE * * Base class for Single trace & Differenial pair meandering tools, as * both of them share a lot of code. */ -class PNS_MEANDER_PLACER_BASE : public PNS_PLACEMENT_ALGO +class MEANDER_PLACER_BASE : public PLACEMENT_ALGO { public: ///> Result of the length tuning operation @@ -56,8 +55,8 @@ public: TUNED }; - PNS_MEANDER_PLACER_BASE( PNS_ROUTER* aRouter ); - virtual ~PNS_MEANDER_PLACER_BASE(); + MEANDER_PLACER_BASE( ROUTER* aRouter ); + virtual ~MEANDER_PLACER_BASE(); /** * Function TuningInfo() @@ -97,7 +96,7 @@ public: * Returns the current meandering configuration. * @return the settings */ - virtual const PNS_MEANDER_SETTINGS& MeanderSettings() const; + virtual const MEANDER_SETTINGS& MeanderSettings() const; /* * Function UpdateSettings() @@ -105,7 +104,7 @@ public: * Sets the current meandering configuration. * @param aSettings the settings */ - virtual void UpdateSettings( const PNS_MEANDER_SETTINGS& aSettings); + virtual void UpdateSettings( const MEANDER_SETTINGS& aSettings); /** * Function CheckFit() @@ -116,7 +115,7 @@ public: * @param aShape the shape to check * @return true if the shape fits */ - virtual bool CheckFit( PNS_MEANDER_SHAPE* aShape ) + virtual bool CheckFit( MEANDER_SHAPE* aShape ) { return false; } @@ -136,11 +135,11 @@ protected: * @param aPost part after the end of meanders */ void cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin, - const VECTOR2I& aTuneStart, - const VECTOR2I& aCursorPos, - SHAPE_LINE_CHAIN& aPre, - SHAPE_LINE_CHAIN& aTuned, - SHAPE_LINE_CHAIN& aPost ); + const VECTOR2I& aTuneStart, + const VECTOR2I& aCursorPos, + SHAPE_LINE_CHAIN& aPre, + SHAPE_LINE_CHAIN& aTuned, + SHAPE_LINE_CHAIN& aPost ); /** * Function tuneLineLength() @@ -148,7 +147,7 @@ protected: * Takes a set of meanders in aTuned and tunes their length to * extend the original line length by aElongation. */ - void tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aElongation ); + void tuneLineLength( MEANDERED_LINE& aTuned, int aElongation ); /** * Function compareWithTolerance() @@ -160,7 +159,7 @@ protected: ///> width of the meandered trace(s) int m_currentWidth; ///> meandering settings - PNS_MEANDER_SETTINGS m_settings; + MEANDER_SETTINGS m_settings; ///> current end point VECTOR2I m_currentEnd; }; diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp index 916cabc2df..cfa26c3cd5 100644 --- a/pcbnew/router/pns_meander_skew_placer.cpp +++ b/pcbnew/router/pns_meander_skew_placer.cpp @@ -31,30 +31,30 @@ namespace PNS { -PNS_MEANDER_SKEW_PLACER::PNS_MEANDER_SKEW_PLACER ( PNS_ROUTER* aRouter ) : - PNS_MEANDER_PLACER ( aRouter ) +MEANDER_SKEW_PLACER::MEANDER_SKEW_PLACER ( ROUTER* aRouter ) : + MEANDER_PLACER ( aRouter ) { // Init temporary variables (do not leave uninitialized members) m_coupledLength = 0; } -PNS_MEANDER_SKEW_PLACER::~PNS_MEANDER_SKEW_PLACER( ) +MEANDER_SKEW_PLACER::~MEANDER_SKEW_PLACER( ) { } -bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) +bool MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem ) { VECTOR2I p; - if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T ) ) { Router()->SetFailureReason( _( "Please select a differential pair trace you want to tune." ) ); return false; } - m_initialSegment = static_cast( aStartItem ); + m_initialSegment = static_cast( aStartItem ); p = m_initialSegment->Seg().NearestPoint( aP ); @@ -64,7 +64,7 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) m_world = Router()->GetWorld( )->Branch(); m_originLine = m_world->AssembleLine( m_initialSegment ); - PNS_TOPOLOGY topo( m_world ); + TOPOLOGY topo( m_world ); m_tunedPath = topo.AssembleTrivialPath( m_initialSegment ); if( !topo.AssembleDiffPair ( m_initialSegment, m_originPair ) ) @@ -99,18 +99,18 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) } -int PNS_MEANDER_SKEW_PLACER::origPathLength( ) const +int MEANDER_SKEW_PLACER::origPathLength( ) const { return itemsetLength ( m_tunedPath ); } -int PNS_MEANDER_SKEW_PLACER::itemsetLength( const PNS_ITEMSET& aSet ) const +int MEANDER_SKEW_PLACER::itemsetLength( const ITEM_SET& aSet ) const { int total = 0; - for( const PNS_ITEM* item : aSet.CItems() ) + for( const ITEM* item : aSet.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) { total += l->CLine().Length(); } @@ -120,23 +120,23 @@ int PNS_MEANDER_SKEW_PLACER::itemsetLength( const PNS_ITEMSET& aSet ) const } -int PNS_MEANDER_SKEW_PLACER::currentSkew() const +int MEANDER_SKEW_PLACER::currentSkew() const { return m_lastLength - m_coupledLength; } -bool PNS_MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) { - for( const PNS_ITEM* item : m_tunedPathP.CItems() ) + for( const ITEM* item : m_tunedPathP.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) Dbg()->AddLine( l->CLine(), 5, 10000 ); } - for( const PNS_ITEM* item : m_tunedPathN.CItems() ) + for( const ITEM* item : m_tunedPathN.CItems() ) { - if( const PNS_LINE* l = dyn_cast( item ) ) + if( const LINE* l = dyn_cast( item ) ) Dbg()->AddLine( l->CLine(), 4, 10000 ); } @@ -144,7 +144,7 @@ bool PNS_MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -const wxString PNS_MEANDER_SKEW_PLACER::TuningInfo() const +const wxString MEANDER_SKEW_PLACER::TuningInfo() const { wxString status; diff --git a/pcbnew/router/pns_meander_skew_placer.h b/pcbnew/router/pns_meander_skew_placer.h index 3ca0c92d62..04b7ef661e 100644 --- a/pcbnew/router/pns_meander_skew_placer.h +++ b/pcbnew/router/pns_meander_skew_placer.h @@ -27,40 +27,39 @@ namespace PNS { -class PNS_ROUTER; -class PNS_SHOVE; -class PNS_OPTIMIZER; -class PNS_ROUTER_BASE; +class ROUTER; +class SHOVE; +class OPTIMIZER; /** - * Class PNS_MEANDER_SKEW_PLACER + * Class MEANDER_SKEW_PLACER * * Differential pair skew adjustment algorithm. */ -class PNS_MEANDER_SKEW_PLACER : public PNS_MEANDER_PLACER +class MEANDER_SKEW_PLACER : public MEANDER_PLACER { public: - PNS_MEANDER_SKEW_PLACER( PNS_ROUTER* aRouter ); - ~PNS_MEANDER_SKEW_PLACER(); + MEANDER_SKEW_PLACER( ROUTER* aRouter ); + ~MEANDER_SKEW_PLACER(); - /// @copydoc PNS_PLACEMENT_ALGO::Start() - bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ); + /// @copydoc PLACEMENT_ALGO::Start() + bool Start( const VECTOR2I& aP, ITEM* aStartItem ); - /// @copydoc PNS_PLACEMENT_ALGO::Move() - bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ); + /// @copydoc PLACEMENT_ALGO::Move() + bool Move( const VECTOR2I& aP, ITEM* aEndItem ); - /// @copydoc PNS_MEANDER_PLACER_BASE::TuningInfo() + /// @copydoc MEANDER_PLACER_BASE::TuningInfo() const wxString TuningInfo() const; private: int currentSkew( ) const; - int itemsetLength( const PNS_ITEMSET& aSet ) const; + int itemsetLength( const ITEM_SET& aSet ) const; int origPathLength () const; - PNS_DIFF_PAIR m_originPair; - PNS_ITEMSET m_tunedPath, m_tunedPathP, m_tunedPathN; + DIFF_PAIR m_originPair; + ITEM_SET m_tunedPath, m_tunedPathP, m_tunedPathN; int m_coupledLength; }; diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index e945eaa63c..3b2c927450 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -44,18 +44,18 @@ using boost::unordered_map; namespace PNS { #ifdef DEBUG -static boost::unordered_set allocNodes; +static boost::unordered_set allocNodes; #endif -PNS_NODE::PNS_NODE() +NODE::NODE() { - wxLogTrace( "PNS", "PNS_NODE::create %p", this ); + wxLogTrace( "PNS", "NODE::create %p", this ); m_depth = 0; m_root = this; m_parent = NULL; m_maxClearance = 800000; // fixme: depends on how thick traces are. m_ruleResolver = NULL; - m_index = new PNS_INDEX; + m_index = new INDEX; #ifdef DEBUG allocNodes.insert( this ); @@ -63,9 +63,9 @@ PNS_NODE::PNS_NODE() } -PNS_NODE::~PNS_NODE() +NODE::~NODE() { - wxLogTrace( "PNS", "PNS_NODE::delete %p", this ); + wxLogTrace( "PNS", "NODE::delete %p", this ); if( !m_children.empty() ) { @@ -85,7 +85,7 @@ PNS_NODE::~PNS_NODE() m_joints.clear(); - for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) + for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) { if( (*i)->BelongsTo( this ) ) delete *i; @@ -97,7 +97,7 @@ PNS_NODE::~PNS_NODE() delete m_index; } -int PNS_NODE::GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const +int NODE::GetClearance( const ITEM* aA, const ITEM* aB ) const { if( !m_ruleResolver ) return 100000; @@ -106,11 +106,11 @@ int PNS_NODE::GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const } -PNS_NODE* PNS_NODE::Branch() +NODE* NODE::Branch() { - PNS_NODE* child = new PNS_NODE; + NODE* child = new NODE; - wxLogTrace( "PNS", "PNS_NODE::branch %p (parent %p)", child, this ); + wxLogTrace( "PNS", "NODE::branch %p (parent %p)", child, this ); m_children.insert( child ); @@ -126,7 +126,7 @@ PNS_NODE* PNS_NODE::Branch() { JOINT_MAP::iterator j; - for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) + for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) child->m_index->Add( *i ); child->m_joints = m_joints; @@ -140,7 +140,7 @@ PNS_NODE* PNS_NODE::Branch() } -void PNS_NODE::unlinkParent() +void NODE::unlinkParent() { if( isRoot() ) return; @@ -149,25 +149,25 @@ void PNS_NODE::unlinkParent() } -PNS_OBSTACLE_VISITOR::PNS_OBSTACLE_VISITOR( const PNS_ITEM* aItem ) : +OBSTACLE_VISITOR::OBSTACLE_VISITOR( const ITEM* aItem ) : m_item( aItem ), m_node( NULL ), m_override( NULL ), m_extraClearance( 0 ) { - if( aItem && aItem->Kind() == PNS_ITEM::LINE_T ) - m_extraClearance += static_cast( aItem )->Width() / 2; + if( aItem && aItem->Kind() == ITEM::LINE_T ) + m_extraClearance += static_cast( aItem )->Width() / 2; } -void PNS_OBSTACLE_VISITOR::SetWorld( const PNS_NODE* aNode, const PNS_NODE* aOverride ) +void OBSTACLE_VISITOR::SetWorld( const NODE* aNode, const NODE* aOverride ) { m_node = aNode; m_override = aOverride; } -bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM* aCandidate ) +bool OBSTACLE_VISITOR::visit( ITEM* aCandidate ) { // check if there is a more recent branch with a newer // (possibily modified) version of this item. @@ -180,7 +180,7 @@ bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM* aCandidate ) // function object that visits potential obstacles and performs // the actual collision refining -struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR +struct NODE::DEFAULT_OBSTACLE_VISITOR : public OBSTACLE_VISITOR { ///> list of encountered obstacles OBSTACLES& m_tab; @@ -201,8 +201,8 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR int m_forceClearance; - DEFAULT_OBSTACLE_VISITOR( PNS_NODE::OBSTACLES& aTab, const PNS_ITEM* aItem, int aKindMask, bool aDifferentNetsOnly ) : - PNS_OBSTACLE_VISITOR( aItem ), + DEFAULT_OBSTACLE_VISITOR( NODE::OBSTACLES& aTab, const ITEM* aItem, int aKindMask, bool aDifferentNetsOnly ) : + OBSTACLE_VISITOR( aItem ), m_tab( aTab ), m_kindMask( aKindMask ), m_limitCount( -1 ), @@ -218,7 +218,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR m_limitCount = aLimit; } - bool operator()( PNS_ITEM* aCandidate ) + bool operator()( ITEM* aCandidate ) { if( !aCandidate->OfKind( m_kindMask ) ) return true; @@ -228,10 +228,10 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR int clearance = m_extraClearance + m_node->GetClearance( aCandidate, m_item ); - if( aCandidate->Kind() == PNS_ITEM::LINE_T ) // this should never happen. + if( aCandidate->Kind() == ITEM::LINE_T ) // this should never happen. { assert( false ); - clearance += static_cast( aCandidate )->Width() / 2; + clearance += static_cast( aCandidate )->Width() / 2; } if( m_forceClearance >= 0 ) @@ -240,7 +240,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR if( !aCandidate->Collide( m_item, clearance, m_differentNetsOnly ) ) return true; - PNS_OBSTACLE obs; + OBSTACLE obs; obs.m_item = aCandidate; obs.m_head = m_item; @@ -256,7 +256,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR }; -int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, PNS_OBSTACLE_VISITOR& aVisitor ) +int NODE::QueryColliding( const ITEM* aItem, OBSTACLE_VISITOR& aVisitor ) { aVisitor.SetWorld( this, NULL ); m_index->Query( aItem, m_maxClearance, aVisitor ); @@ -272,8 +272,8 @@ int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, PNS_OBSTACLE_VISITOR& aVisi } -int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, - PNS_NODE::OBSTACLES& aObstacles, int aKindMask, int aLimitCount, bool aDifferentNetsOnly, int aForceClearance ) +int NODE::QueryColliding( const ITEM* aItem, + NODE::OBSTACLES& aObstacles, int aKindMask, int aLimitCount, bool aDifferentNetsOnly, int aForceClearance ) { DEFAULT_OBSTACLE_VISITOR visitor( aObstacles, aItem, aKindMask, aDifferentNetsOnly ); @@ -298,8 +298,8 @@ int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, } -PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKindMask, - const std::set* aRestrictedSet ) +NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, + const std::set* aRestrictedSet ) { OBSTACLES obs_list; bool found_isects = false; @@ -312,7 +312,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKi for( int i = 0; i < line.SegmentCount(); i++ ) { - const PNS_SEGMENT s( *aItem, line.CSegment( i ) ); + const SEGMENT s( *aItem, line.CSegment( i ) ); n += QueryColliding( &s, obs_list, aKindMask ); } @@ -322,13 +322,13 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKi if( !n ) return OPT_OBSTACLE(); - PNS_LINE& aLine = (PNS_LINE&) *aItem; + LINE& aLine = (LINE&) *aItem; - PNS_OBSTACLE nearest; + OBSTACLE nearest; nearest.m_item = NULL; nearest.m_distFirst = INT_MAX; - for( PNS_OBSTACLE obs : obs_list ) + for( OBSTACLE obs : obs_list ) { VECTOR2I ip_first, ip_last; int dist_max = INT_MIN; @@ -407,9 +407,9 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKi } -PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEMSET& aSet, int aKindMask ) +NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM_SET& aSet, int aKindMask ) { - for( const PNS_ITEM* item : aSet.CItems() ) + for( const ITEM* item : aSet.CItems() ) { OPT_OBSTACLE obs = CheckColliding( item, aKindMask ); @@ -421,21 +421,21 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEMSET& aSet, int aK } -PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, int aKindMask ) +NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM* aItemA, int aKindMask ) { OBSTACLES obs; obs.reserve( 100 ); - if( aItemA->Kind() == PNS_ITEM::LINE_T ) + if( aItemA->Kind() == ITEM::LINE_T ) { int n = 0; - const PNS_LINE* line = static_cast( aItemA ); + const LINE* line = static_cast( aItemA ); const SHAPE_LINE_CHAIN& l = line->CLine(); for( int i = 0; i < l.SegmentCount(); i++ ) { - const PNS_SEGMENT s( *line, l.CSegment( i ) ); + const SEGMENT s( *line, l.CSegment( i ) ); n += QueryColliding( &s, obs, aKindMask, 1 ); if( n ) @@ -457,7 +457,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, int aKi } -bool PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB, int aKindMask, int aForceClearance ) +bool NODE::CheckColliding( const ITEM* aItemA, const ITEM* aItemB, int aKindMask, int aForceClearance ) { assert( aItemB ); int clearance; @@ -467,26 +467,26 @@ bool PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB, i clearance = GetClearance( aItemA, aItemB ); // fixme: refactor - if( aItemA->Kind() == PNS_ITEM::LINE_T ) - clearance += static_cast( aItemA )->Width() / 2; - if( aItemB->Kind() == PNS_ITEM::LINE_T ) - clearance += static_cast( aItemB )->Width() / 2; + if( aItemA->Kind() == ITEM::LINE_T ) + clearance += static_cast( aItemA )->Width() / 2; + if( aItemB->Kind() == ITEM::LINE_T ) + clearance += static_cast( aItemB )->Width() / 2; return aItemA->Collide( aItemB, clearance ); } -struct HIT_VISITOR : public PNS_OBSTACLE_VISITOR +struct HIT_VISITOR : public OBSTACLE_VISITOR { - PNS_ITEMSET& m_items; + ITEM_SET& m_items; const VECTOR2I& m_point; - HIT_VISITOR( PNS_ITEMSET& aTab, const VECTOR2I& aPoint ) : - PNS_OBSTACLE_VISITOR( NULL ), + HIT_VISITOR( ITEM_SET& aTab, const VECTOR2I& aPoint ) : + OBSTACLE_VISITOR( NULL ), m_items( aTab ), m_point( aPoint ) {} - bool operator()( PNS_ITEM* aItem ) + bool operator()( ITEM* aItem ) { SHAPE_CIRCLE cp( m_point, 0 ); @@ -500,9 +500,9 @@ struct HIT_VISITOR : public PNS_OBSTACLE_VISITOR }; -const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const +const ITEM_SET NODE::HitTest( const VECTOR2I& aPoint ) const { - PNS_ITEMSET items; + ITEM_SET items; // fixme: we treat a point as an infinitely small circle - this is inefficient. SHAPE_CIRCLE s( aPoint, 0 ); @@ -513,12 +513,12 @@ const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const if( !isRoot() ) // fixme: could be made cleaner { - PNS_ITEMSET items_root; + ITEM_SET items_root; visitor.SetWorld( m_root, NULL ); HIT_VISITOR visitor_root( items_root, aPoint ); m_root->m_index->Query( &s, m_maxClearance, visitor_root ); - for( PNS_ITEM* item : items_root.Items() ) + for( ITEM* item : items_root.Items() ) { if( !Overrides( item ) ) items.Add( item ); @@ -529,21 +529,21 @@ const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const } -void PNS_NODE::addSolid( PNS_SOLID* aSolid ) +void NODE::addSolid( SOLID* aSolid ) { linkJoint( aSolid->Pos(), aSolid->Layers(), aSolid->Net(), aSolid ); m_index->Add( aSolid ); } -void PNS_NODE::addVia( PNS_VIA* aVia ) +void NODE::addVia( VIA* aVia ) { linkJoint( aVia->Pos(), aVia->Layers(), aVia->Net(), aVia ); m_index->Add( aVia ); } -void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant ) +void NODE::addLine( LINE* aLine, bool aAllowRedundant ) { SHAPE_LINE_CHAIN& l = aLine->Line(); @@ -553,8 +553,8 @@ void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant ) if( s.A != s.B ) { - PNS_SEGMENT* pseg = new PNS_SEGMENT( *aLine, s ); - PNS_SEGMENT* psegR = NULL; + SEGMENT* pseg = new SEGMENT( *aLine, s ); + SEGMENT* psegR = NULL; if( !aAllowRedundant ) psegR = findRedundantSegment( pseg ); @@ -581,7 +581,7 @@ void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant ) } -void PNS_NODE::addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant ) +void NODE::addSegment( SEGMENT* aSeg, bool aAllowRedundant ) { if( aSeg->Seg().A == aSeg->Seg().B ) { @@ -601,26 +601,26 @@ void PNS_NODE::addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant ) } -void PNS_NODE::Add( PNS_ITEM* aItem, bool aAllowRedundant ) +void NODE::Add( ITEM* aItem, bool aAllowRedundant ) { aItem->SetOwner( this ); switch( aItem->Kind() ) { - case PNS_ITEM::SOLID_T: - addSolid( static_cast( aItem ) ); + case ITEM::SOLID_T: + addSolid( static_cast( aItem ) ); break; - case PNS_ITEM::SEGMENT_T: - addSegment( static_cast( aItem ), aAllowRedundant ); + case ITEM::SEGMENT_T: + addSegment( static_cast( aItem ), aAllowRedundant ); break; - case PNS_ITEM::LINE_T: - addLine( static_cast( aItem ), aAllowRedundant ); + case ITEM::LINE_T: + addLine( static_cast( aItem ), aAllowRedundant ); break; - case PNS_ITEM::VIA_T: - addVia( static_cast( aItem ) ); + case ITEM::VIA_T: + addVia( static_cast( aItem ) ); break; default: @@ -629,7 +629,7 @@ void PNS_NODE::Add( PNS_ITEM* aItem, bool aAllowRedundant ) } -void PNS_NODE::doRemove( PNS_ITEM* aItem ) +void NODE::doRemove( ITEM* aItem ) { // case 1: removing an item that is stored in the root node from any branch: // mark it as overridden, but do not remove @@ -650,7 +650,7 @@ void PNS_NODE::doRemove( PNS_ITEM* aItem ) } -void PNS_NODE::removeSegment( PNS_SEGMENT* aSeg ) +void NODE::removeSegment( SEGMENT* aSeg ) { unlinkJoint( aSeg->Seg().A, aSeg->Layers(), aSeg->Net(), aSeg ); unlinkJoint( aSeg->Seg().B, aSeg->Layers(), aSeg->Net(), aSeg ); @@ -659,31 +659,31 @@ void PNS_NODE::removeSegment( PNS_SEGMENT* aSeg ) } -void PNS_NODE::removeLine( PNS_LINE* aLine ) +void NODE::removeLine( LINE* aLine ) { - std::vector* segRefs = aLine->LinkedSegments(); + std::vector* segRefs = aLine->LinkedSegments(); assert( segRefs != NULL ); - for( PNS_SEGMENT* seg : *segRefs ) + for( SEGMENT* seg : *segRefs ) { removeSegment( seg ); } } -void PNS_NODE::removeVia( PNS_VIA* aVia ) +void NODE::removeVia( VIA* aVia ) { // We have to split a single joint (associated with a via, binding together multiple layers) // into multiple independent joints. As I'm a lazy bastard, I simply delete the via and all its links and re-insert them. - PNS_JOINT::HASH_TAG tag; + JOINT::HASH_TAG tag; VECTOR2I p( aVia->Pos() ); - PNS_LAYERSET vLayers( aVia->Layers() ); + LAYER_RANGE vLayers( aVia->Layers() ); int net = aVia->Net(); - PNS_JOINT* jt = FindJoint( p, vLayers.Start(), net ); - PNS_JOINT::LINKED_ITEMS links( jt->LinkList() ); + JOINT* jt = FindJoint( p, vLayers.Start(), net ); + JOINT::LINKED_ITEMS links( jt->LinkList() ); tag.net = net; tag.pos = p; @@ -711,7 +711,7 @@ void PNS_NODE::removeVia( PNS_VIA* aVia ) } while( split ); // and re-link them, using the former via's link list - for(PNS_ITEM* item : links) + for(ITEM* item : links) { if( item != aVia ) linkJoint( p, item->Layers(), net, item ); @@ -721,32 +721,32 @@ void PNS_NODE::removeVia( PNS_VIA* aVia ) } -void PNS_NODE::Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem ) +void NODE::Replace( ITEM* aOldItem, ITEM* aNewItem ) { Remove( aOldItem ); Add( aNewItem ); } -void PNS_NODE::Remove( PNS_ITEM* aItem ) +void NODE::Remove( ITEM* aItem ) { switch( aItem->Kind() ) { - case PNS_ITEM::SOLID_T: + case ITEM::SOLID_T: // fixme: this fucks up the joints, but it's only used for marking colliding obstacles for the moment, so we don't care. doRemove( aItem ); break; - case PNS_ITEM::SEGMENT_T: - removeSegment( static_cast( aItem ) ); + case ITEM::SEGMENT_T: + removeSegment( static_cast( aItem ) ); break; - case PNS_ITEM::LINE_T: - removeLine( static_cast( aItem ) ); + case ITEM::LINE_T: + removeLine( static_cast( aItem ) ); break; - case PNS_ITEM::VIA_T: - removeVia( static_cast( aItem ) ); + case ITEM::VIA_T: + removeVia( static_cast( aItem ) ); break; default: @@ -755,14 +755,14 @@ void PNS_NODE::Remove( PNS_ITEM* aItem ) } -void PNS_NODE::Remove( PNS_LINE& aLine ) +void NODE::Remove( LINE& aLine ) { removeLine( &aLine ); } -void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos, - int aLimit, VECTOR2I* aCorners, PNS_SEGMENT** aSegments, bool& aGuardHit, +void NODE::followLine( SEGMENT* aCurrent, bool aScanDirection, int& aPos, + int aLimit, VECTOR2I* aCorners, SEGMENT** aSegments, bool& aGuardHit, bool aStopAtLockedJoints ) { bool prevReversed = false; @@ -773,7 +773,7 @@ void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos { const VECTOR2I p = ( aScanDirection ^ prevReversed ) ? aCurrent->Seg().B : aCurrent->Seg().A; - const PNS_JOINT* jt = FindJoint( p, aCurrent ); + const JOINT* jt = FindJoint( p, aCurrent ); assert( jt ); @@ -801,14 +801,14 @@ void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos } -const PNS_LINE PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex, bool aStopAtLockedJoints ) +const LINE NODE::AssembleLine( SEGMENT* aSeg, int* aOriginSegmentIndex, bool aStopAtLockedJoints ) { const int MaxVerts = 1024 * 16; VECTOR2I corners[MaxVerts + 1]; - PNS_SEGMENT* segs[MaxVerts + 1]; + SEGMENT* segs[MaxVerts + 1]; - PNS_LINE pl; + LINE pl; bool guardHit = false; int i_start = MaxVerts / 2, i_end = i_start + 1; @@ -825,7 +825,7 @@ const PNS_LINE PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentInd int n = 0; - PNS_SEGMENT* prev_seg = NULL; + SEGMENT* prev_seg = NULL; bool originSet = false; for( int i = i_start + 1; i < i_end; i++ ) @@ -856,7 +856,7 @@ const PNS_LINE PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentInd } -void PNS_NODE::FindLineEnds( const PNS_LINE& aLine, PNS_JOINT& aA, PNS_JOINT& aB ) +void NODE::FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB ) { aA = *FindJoint( aLine.CPoint( 0 ), &aLine ); aB = *FindJoint( aLine.CPoint( -1 ), &aLine ); @@ -864,27 +864,27 @@ void PNS_NODE::FindLineEnds( const PNS_LINE& aLine, PNS_JOINT& aA, PNS_JOINT& aB #if 0 -void PNS_NODE::MapConnectivity( PNS_JOINT* aStart, std::vector& aFoundJoints ) +void NODE::MapConnectivity( JOINT* aStart, std::vector& aFoundJoints ) { - std::deque searchQueue; - std::set processed; + std::deque searchQueue; + std::set processed; searchQueue.push_back( aStart ); processed.insert( aStart ); while( !searchQueue.empty() ) { - PNS_JOINT* current = searchQueue.front(); + JOINT* current = searchQueue.front(); searchQueue.pop_front(); - for( PNS_ITEM* item : current->LinkList() ) + for( ITEM* item : current->LinkList() ) { - if( item->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( item->OfKind( ITEM::SEGMENT_T ) ) { - PNS_SEGMENT* seg = static_cast( item ); - PNS_JOINT* a = FindJoint( seg->Seg().A, seg ); - PNS_JOINT* b = FindJoint( seg->Seg().B, seg ); - PNS_JOINT* next = ( *a == *current ) ? b : a; + SEGMENT* seg = static_cast( item ); + JOINT* a = FindJoint( seg->Seg().A, seg ); + JOINT* b = FindJoint( seg->Seg().B, seg ); + JOINT* next = ( *a == *current ) ? b : a; if( processed.find( next ) == processed.end() ) { @@ -895,25 +895,25 @@ void PNS_NODE::MapConnectivity( PNS_JOINT* aStart, std::vector& aFou } } - for(PNS_JOINT* jt : processed) + for(JOINT* jt : processed) aFoundJoints.push_back( jt ); } #endif -int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector& aLines ) +int NODE::FindLinesBetweenJoints( JOINT& aA, JOINT& aB, std::vector& aLines ) { - for( PNS_ITEM* item : aA.LinkList() ) + for( ITEM* item : aA.LinkList() ) { - if( item->Kind() == PNS_ITEM::SEGMENT_T ) + if( item->Kind() == ITEM::SEGMENT_T ) { - PNS_SEGMENT* seg = static_cast( item ); - PNS_LINE line = AssembleLine( seg ); + SEGMENT* seg = static_cast( item ); + LINE line = AssembleLine( seg ); if( !line.Layers().Overlaps( aB.Layers() ) ) continue; - PNS_JOINT j_start, j_end; + JOINT j_start, j_end; FindLineEnds( line, j_start, j_end ); @@ -935,9 +935,9 @@ int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector< } -PNS_JOINT* PNS_NODE::FindJoint( const VECTOR2I& aPos, int aLayer, int aNet ) +JOINT* NODE::FindJoint( const VECTOR2I& aPos, int aLayer, int aNet ) { - PNS_JOINT::HASH_TAG tag; + JOINT::HASH_TAG tag; tag.net = aNet; tag.pos = aPos; @@ -965,16 +965,16 @@ PNS_JOINT* PNS_NODE::FindJoint( const VECTOR2I& aPos, int aLayer, int aNet ) } -void PNS_NODE::LockJoint( const VECTOR2I& aPos, const PNS_ITEM* aItem, bool aLock ) +void NODE::LockJoint( const VECTOR2I& aPos, const ITEM* aItem, bool aLock ) { - PNS_JOINT& jt = touchJoint( aPos, aItem->Layers(), aItem->Net() ); + JOINT& jt = touchJoint( aPos, aItem->Layers(), aItem->Net() ); jt.Lock( aLock ); } -PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aNet ) +JOINT& NODE::touchJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aNet ) { - PNS_JOINT::HASH_TAG tag; + JOINT::HASH_TAG tag; tag.pos = aPos; tag.net = aNet; @@ -994,7 +994,7 @@ PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLaye } // now insert and combine overlapping joints - PNS_JOINT jt( aPos, aLayers, aNet ); + JOINT jt( aPos, aLayers, aNet ); bool merged; @@ -1023,50 +1023,50 @@ PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLaye } -void PNS_JOINT::Dump() const +void JOINT::Dump() const { wxLogTrace( "PNS", "joint layers %d-%d, net %d, pos %s, links: %d", m_layers.Start(), m_layers.End(), m_tag.net, m_tag.pos.Format().c_str(), LinkCount() ); } -void PNS_NODE::linkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, - int aNet, PNS_ITEM* aWhere ) +void NODE::linkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, + int aNet, ITEM* aWhere ) { - PNS_JOINT& jt = touchJoint( aPos, aLayers, aNet ); + JOINT& jt = touchJoint( aPos, aLayers, aNet ); jt.Link( aWhere ); } -void PNS_NODE::unlinkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, - int aNet, PNS_ITEM* aWhere ) +void NODE::unlinkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, + int aNet, ITEM* aWhere ) { // fixme: remove dangling joints - PNS_JOINT& jt = touchJoint( aPos, aLayers, aNet ); + JOINT& jt = touchJoint( aPos, aLayers, aNet ); jt.Unlink( aWhere ); } -void PNS_NODE::Dump( bool aLong ) +void NODE::Dump( bool aLong ) { #if 0 - boost::unordered_set all_segs; - SHAPE_INDEX_LIST::iterator i; + boost::unordered_set all_segs; + SHAPE_INDEX_LIST::iterator i; for( i = m_items.begin(); i != m_items.end(); i++ ) { - if( (*i)->GetKind() == PNS_ITEM::SEGMENT_T ) - all_segs.insert( static_cast( *i ) ); + if( (*i)->GetKind() == ITEM::SEGMENT_T ) + all_segs.insert( static_cast( *i ) ); } if( !isRoot() ) { for( i = m_root->m_items.begin(); i != m_root->m_items.end(); i++ ) { - if( (*i)->GetKind() == PNS_ITEM::SEGMENT_T && !overrides( *i ) ) - all_segs.insert( static_cast(*i) ); + if( (*i)->GetKind() == ITEM::SEGMENT_T && !overrides( *i ) ) + all_segs.insert( static_cast(*i) ); } } @@ -1077,17 +1077,17 @@ void PNS_NODE::Dump( bool aLong ) { wxLogTrace( "PNS", "joint : %s, links : %d\n", j->second.GetPos().Format().c_str(), j->second.LinkCount() ); - PNS_JOINT::LINKED_ITEMS::const_iterator k; + JOINT::LINKED_ITEMS::const_iterator k; for( k = j->second.GetLinkList().begin(); k != j->second.GetLinkList().end(); ++k ) { - const PNS_ITEM* m_item = *k; + const ITEM* m_item = *k; switch( m_item->GetKind() ) { - case PNS_ITEM::SEGMENT_T: + case ITEM::SEGMENT_T: { - const PNS_SEGMENT* seg = static_cast( m_item ); + const SEGMENT* seg = static_cast( m_item ); wxLogTrace( "PNS", " -> seg %s %s\n", seg->GetSeg().A.Format().c_str(), seg->GetSeg().B.Format().c_str() ); break; @@ -1104,15 +1104,15 @@ void PNS_NODE::Dump( bool aLong ) while( !all_segs.empty() ) { - PNS_SEGMENT* s = *all_segs.begin(); - PNS_LINE* l = AssembleLine( s ); + SEGMENT* s = *all_segs.begin(); + LINE* l = AssembleLine( s ); - PNS_LINE::LinkedSegments* seg_refs = l->GetLinkedSegments(); + LINE::LinkedSegments* seg_refs = l->GetLinkedSegments(); if( aLong ) wxLogTrace( "PNS", "Line: %s, net %d ", l->GetLine().Format().c_str(), l->GetNet() ); - for( std::vector::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j ) + for( std::vector::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j ) { wxLogTrace( "PNS", "%s ", (*j)->GetSeg().A.Format().c_str() ); @@ -1130,7 +1130,7 @@ void PNS_NODE::Dump( bool aLong ) } -void PNS_NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded ) +void NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded ) { aRemoved.reserve( m_override.size() ); aAdded.reserve( m_index->Size() ); @@ -1138,19 +1138,19 @@ void PNS_NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded ) if( isRoot() ) return; - for( PNS_ITEM* item : m_override ) + for( ITEM* item : m_override ) aRemoved.push_back( item ); - for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) + for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) aAdded.push_back( *i ); } -void PNS_NODE::releaseChildren() +void NODE::releaseChildren() { - // copy the kids as the PNS_NODE destructor erases the item from the parent node. - std::set kids = m_children; + // copy the kids as the NODE destructor erases the item from the parent node. + std::set kids = m_children; - for( PNS_NODE* node : kids ) + for( NODE* node : kids ) { node->releaseChildren(); delete node; @@ -1158,12 +1158,12 @@ void PNS_NODE::releaseChildren() } -void PNS_NODE::releaseGarbage() +void NODE::releaseGarbage() { if( !isRoot() ) return; - for( PNS_ITEM* item : m_garbageItems ) + for( ITEM* item : m_garbageItems ) { if( !item->BelongsTo( this ) ) delete item; @@ -1173,15 +1173,15 @@ void PNS_NODE::releaseGarbage() } -void PNS_NODE::Commit( PNS_NODE* aNode ) +void NODE::Commit( NODE* aNode ) { if( aNode->isRoot() ) return; - for( PNS_ITEM* item : aNode->m_override ) + for( ITEM* item : aNode->m_override ) Remove( item ); - for( PNS_INDEX::ITEM_SET::iterator i = aNode->m_index->begin(); + for( INDEX::ITEM_SET::iterator i = aNode->m_index->begin(); i != aNode->m_index->end(); ++i ) { (*i)->SetRank( -1 ); @@ -1194,38 +1194,38 @@ void PNS_NODE::Commit( PNS_NODE* aNode ) } -void PNS_NODE::KillChildren() +void NODE::KillChildren() { assert( isRoot() ); releaseChildren(); } -void PNS_NODE::AllItemsInNet( int aNet, std::set& aItems ) +void NODE::AllItemsInNet( int aNet, std::set& aItems ) { - PNS_INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aNet ); + INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aNet ); if( l_cur ) { - for( PNS_ITEM*item : *l_cur ) + for( ITEM*item : *l_cur ) aItems.insert( item ); } if( !isRoot() ) { - PNS_INDEX::NET_ITEMS_LIST* l_root = m_root->m_index->GetItemsForNet( aNet ); + INDEX::NET_ITEMS_LIST* l_root = m_root->m_index->GetItemsForNet( aNet ); if( l_root ) - for( PNS_INDEX::NET_ITEMS_LIST::iterator i = l_root->begin(); i!= l_root->end(); ++i ) + for( INDEX::NET_ITEMS_LIST::iterator i = l_root->begin(); i!= l_root->end(); ++i ) if( !Overrides( *i ) ) aItems.insert( *i ); } } -void PNS_NODE::ClearRanks( int aMarkerMask ) +void NODE::ClearRanks( int aMarkerMask ) { - for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) + for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) { (*i)->SetRank( -1 ); (*i)->Mark( (*i)->Marker() & (~aMarkerMask) ); @@ -1233,9 +1233,9 @@ void PNS_NODE::ClearRanks( int aMarkerMask ) } -int PNS_NODE::FindByMarker( int aMarker, PNS_ITEMSET& aItems ) +int NODE::FindByMarker( int aMarker, ITEM_SET& aItems ) { - for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) + for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) { if( (*i)->Marker() & aMarker ) aItems.Add( *i ); @@ -1245,11 +1245,11 @@ int PNS_NODE::FindByMarker( int aMarker, PNS_ITEMSET& aItems ) } -int PNS_NODE::RemoveByMarker( int aMarker ) +int NODE::RemoveByMarker( int aMarker ) { - std::list garbage; + std::list garbage; - for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) + for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) { if( (*i)->Marker() & aMarker ) { @@ -1257,7 +1257,7 @@ int PNS_NODE::RemoveByMarker( int aMarker ) } } - for( std::list::const_iterator i = garbage.begin(), end = garbage.end(); i != end; ++i ) + for( std::list::const_iterator i = garbage.begin(), end = garbage.end(); i != end; ++i ) { Remove( *i ); } @@ -1266,18 +1266,18 @@ int PNS_NODE::RemoveByMarker( int aMarker ) } -PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg ) +SEGMENT* NODE::findRedundantSegment( SEGMENT* aSeg ) { - PNS_JOINT* jtStart = FindJoint( aSeg->Seg().A, aSeg ); + JOINT* jtStart = FindJoint( aSeg->Seg().A, aSeg ); if( !jtStart ) return NULL; - for( PNS_ITEM* item : jtStart->LinkList() ) + for( ITEM* item : jtStart->LinkList() ) { - if( item->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( item->OfKind( ITEM::SEGMENT_T ) ) { - PNS_SEGMENT* seg2 = (PNS_SEGMENT*) item; + SEGMENT* seg2 = (SEGMENT*) item; const VECTOR2I a1( aSeg->Seg().A ); const VECTOR2I b1( aSeg->Seg().B ); @@ -1295,11 +1295,11 @@ PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg ) } -PNS_ITEM *PNS_NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent ) +ITEM *NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent ) { - PNS_INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() ); + INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() ); - for( PNS_ITEM*item : *l_cur ) + for( ITEM*item : *l_cur ) if( item->Parent() == aParent ) return item; diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index b56d67463f..80965efa4d 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.h @@ -39,46 +39,46 @@ namespace PNS { -class PNS_SEGMENT; -class PNS_LINE; -class PNS_SOLID; -class PNS_VIA; -class PNS_INDEX; -class PNS_ROUTER; -class PNS_NODE; +class SEGMENT; +class LINE; +class SOLID; +class VIA; +class INDEX; +class ROUTER; +class NODE; /** - * Class PNS_RULE_RESOLVER + * Class RULE_RESOLVER * * An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between two items. **/ -class PNS_RULE_RESOLVER +class RULE_RESOLVER { public: - virtual ~PNS_RULE_RESOLVER() {} + virtual ~RULE_RESOLVER() {} - virtual int Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) = 0; + virtual int Clearance( const ITEM* aA, const ITEM* aB ) = 0; virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 ) = 0; virtual void UseDpGap( bool aUseDpGap ) = 0; virtual int DpCoupledNet( int aNet ) = 0; virtual int DpNetPolarity( int aNet ) = 0; - virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN ) = 0; + virtual bool DpNetPair( ITEM* aItem, int& aNetP, int& aNetN ) = 0; }; /** - * Struct PNS_OBSTACLE + * Struct OBSTACLE * * Holds an object colliding with another object, along with * some useful data about the collision. **/ -struct PNS_OBSTACLE +struct OBSTACLE { ///> Item we search collisions with - const PNS_ITEM* m_head; + const ITEM* m_head; ///> Item found to be colliding with m_head - PNS_ITEM* m_item; + ITEM* m_item; ///> Hull of the colliding m_item SHAPE_LINE_CHAIN m_hull; @@ -92,37 +92,37 @@ struct PNS_OBSTACLE }; /** - * Struct PNS_OBSTACLE_VISITOR + * Struct OBSTACLE_VISITOR **/ -class PNS_OBSTACLE_VISITOR { +class OBSTACLE_VISITOR { public: - PNS_OBSTACLE_VISITOR( const PNS_ITEM* aItem ); + OBSTACLE_VISITOR( const ITEM* aItem ); - void SetWorld( const PNS_NODE* aNode, const PNS_NODE* aOverride = NULL ); + void SetWorld( const NODE* aNode, const NODE* aOverride = NULL ); - virtual bool operator()( PNS_ITEM* aCandidate ) = 0; + virtual bool operator()( ITEM* aCandidate ) = 0; protected: - bool visit( PNS_ITEM* aCandidate ); + bool visit( ITEM* aCandidate ); ///> the item we are looking for collisions with - const PNS_ITEM* m_item; + const ITEM* m_item; ///> node we are searching in (either root or a branch) - const PNS_NODE* m_node; + const NODE* m_node; ///> node that overrides root entries - const PNS_NODE* m_override; + const NODE* m_override; ///> additional clearance int m_extraClearance; }; /** - * Class PNS_NODE + * Class NODE * * Keeps the router "world" - i.e. all the tracks, vias, solids in a * hierarchical and indexed way. @@ -133,18 +133,18 @@ protected: * - lightweight cloning/branching (for recursive optimization and shove * springback) **/ -class PNS_NODE +class NODE { public: - typedef boost::optional OPT_OBSTACLE; - typedef std::vector ITEM_VECTOR; - typedef std::vector OBSTACLES; + typedef boost::optional OPT_OBSTACLE; + typedef std::vector ITEM_VECTOR; + typedef std::vector OBSTACLES; - PNS_NODE(); - ~PNS_NODE(); + NODE(); + ~NODE(); ///> Returns the expected clearance between items a and b. - int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const; + int GetClearance( const ITEM* aA, const ITEM* aB ) const; ///> Returns the pre-set worst case clearance between any pair of items int GetMaxClearance() const @@ -159,12 +159,12 @@ public: } ///> Assigns a clerance resolution function object - void SetRuleResolver( PNS_RULE_RESOLVER* aFunc ) + void SetRuleResolver( RULE_RESOLVER* aFunc ) { m_ruleResolver = aFunc; } - PNS_RULE_RESOLVER* GetRuleResolver() + RULE_RESOLVER* GetRuleResolver() { return m_ruleResolver; } @@ -191,15 +191,15 @@ public: * @param aLimitCount stop looking for collisions after finding this number of colliding items * @return number of obstacles found */ - int QueryColliding( const PNS_ITEM* aItem, - OBSTACLES& aObstacles, - int aKindMask = PNS_ITEM::ANY_T, - int aLimitCount = -1, - bool aDifferentNetsOnly = true, - int aForceClearance = -1 ); + int QueryColliding( const ITEM* aItem, + OBSTACLES& aObstacles, + int aKindMask = ITEM::ANY_T, + int aLimitCount = -1, + bool aDifferentNetsOnly = true, + int aForceClearance = -1 ); - int QueryColliding( const PNS_ITEM* aItem, - PNS_OBSTACLE_VISITOR& aVisitor + int QueryColliding( const ITEM* aItem, + OBSTACLE_VISITOR& aVisitor ); /** @@ -211,9 +211,9 @@ public: * @param aKindMask mask of obstacle types to take into account * @return the obstacle, if found, otherwise empty. */ - OPT_OBSTACLE NearestObstacle( const PNS_LINE* aItem, - int aKindMask = PNS_ITEM::ANY_T, - const std::set* aRestrictedSet = NULL ); + OPT_OBSTACLE NearestObstacle( const LINE* aItem, + int aKindMask = ITEM::ANY_T, + const std::set* aRestrictedSet = NULL ); /** * Function CheckColliding() @@ -224,8 +224,8 @@ public: * @param aKindMask mask of obstacle types to take into account * @return the obstacle, if found, otherwise empty. */ - OPT_OBSTACLE CheckColliding( const PNS_ITEM* aItem, - int aKindMask = PNS_ITEM::ANY_T ); + OPT_OBSTACLE CheckColliding( const ITEM* aItem, + int aKindMask = ITEM::ANY_T ); /** @@ -237,8 +237,8 @@ public: * @param aKindMask mask of obstacle types to take into account * @return the obstacle, if found, otherwise empty. */ - OPT_OBSTACLE CheckColliding( const PNS_ITEMSET& aSet, - int aKindMask = PNS_ITEM::ANY_T ); + OPT_OBSTACLE CheckColliding( const ITEM_SET& aSet, + int aKindMask = ITEM::ANY_T ); /** @@ -251,10 +251,10 @@ public: * @param aKindMask mask of obstacle types to take into account * @return the obstacle, if found, otherwise empty. */ - bool CheckColliding( const PNS_ITEM* aItemA, - const PNS_ITEM* aItemB, - int aKindMask = PNS_ITEM::ANY_T, - int aForceClearance = -1 ); + bool CheckColliding( const ITEM* aItemA, + const ITEM* aItemB, + int aKindMask = ITEM::ANY_T, + int aForceClearance = -1 ); /** * Function HitTest() @@ -263,7 +263,7 @@ public: * @param aPoint the point * @return the items */ - const PNS_ITEMSET HitTest( const VECTOR2I& aPoint ) const; + const ITEM_SET HitTest( const VECTOR2I& aPoint ) const; /** * Function Add() @@ -273,7 +273,7 @@ public: * @param aAllowRedundant if true, duplicate items are allowed (e.g. a segment or via * at the same coordinates as an existing one) */ - void Add( PNS_ITEM* aItem, bool aAllowRedundant = false ); + void Add( ITEM* aItem, bool aAllowRedundant = false ); /** * Function Remove() @@ -281,7 +281,7 @@ public: * Just as the name says, removes an item from this branch. * @param aItem item to remove */ - void Remove( PNS_ITEM* aItem ); + void Remove( ITEM* aItem ); /** * Function Remove() @@ -289,7 +289,7 @@ public: * Just as the name says, removes a line from this branch. * @param aItem item to remove */ - void Remove( PNS_LINE& aLine ); + void Remove( LINE& aLine ); /** * Function Replace() @@ -298,7 +298,7 @@ public: * @param aOldItem item to be removed * @param aNewItem item add instead */ - void Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem ); + void Replace( ITEM* aOldItem, ITEM* aNewItem ); /** * Function Branch() @@ -308,7 +308,7 @@ public: * any branches in use, their parents must NOT be deleted. * @return the new branch */ - PNS_NODE* Branch(); + NODE* Branch(); /** * Function AssembleLine() @@ -319,7 +319,7 @@ public: * @param aOriginSegmentIndex index of aSeg in the resulting line * @return the line */ - const PNS_LINE AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex = NULL, + const LINE AssembleLine( SEGMENT* aSeg, int* aOriginSegmentIndex = NULL, bool aStopAtLockedJoints = false ); ///> Prints the contents and joints structure @@ -342,7 +342,7 @@ public: * a non-root branch will fail. Calling commit also kills all children nodes of the root branch. * @param aNode node to commit changes from */ - void Commit( PNS_NODE* aNode ); + void Commit( NODE* aNode ); /** * Function FindJoint() @@ -350,9 +350,9 @@ public: * Searches for a joint at a given position, layer and belonging to given net. * @return the joint, if found, otherwise empty */ - PNS_JOINT* FindJoint( const VECTOR2I& aPos, int aLayer, int aNet ); + JOINT* FindJoint( const VECTOR2I& aPos, int aLayer, int aNet ); - void LockJoint( const VECTOR2I& aPos, const PNS_ITEM* aItem, bool aLock ); + void LockJoint( const VECTOR2I& aPos, const ITEM* aItem, bool aLock ); /** * Function FindJoint() @@ -360,38 +360,38 @@ public: * Searches for a joint at a given position, linked to given item. * @return the joint, if found, otherwise empty */ - PNS_JOINT* FindJoint( const VECTOR2I& aPos, const PNS_ITEM* aItem ) + JOINT* FindJoint( const VECTOR2I& aPos, const ITEM* aItem ) { return FindJoint( aPos, aItem->Layers().Start(), aItem->Net() ); } #if 0 - void MapConnectivity( PNS_JOINT* aStart, std::vector & aFoundJoints ); + void MapConnectivity( JOINT* aStart, std::vector & aFoundJoints ); - PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL, - int aKindMask = PNS_ITEM::ANY_T); + ITEM* NearestUnconnectedItem( JOINT* aStart, int* aAnchor = NULL, + int aKindMask = ITEM::ANY_T); #endif ///> finds all lines between a pair of joints. Used by the loop removal procedure. - int FindLinesBetweenJoints( PNS_JOINT& aA, - PNS_JOINT& aB, - std::vector& aLines ); + int FindLinesBetweenJoints( JOINT& aA, + JOINT& aB, + std::vector& aLines ); ///> finds the joints corresponding to the ends of line aLine - void FindLineEnds( const PNS_LINE& aLine, PNS_JOINT& aA, PNS_JOINT& aB ); + void FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB ); ///> Destroys all child nodes. Applicable only to the root node. void KillChildren(); - void AllItemsInNet( int aNet, std::set& aItems ); + void AllItemsInNet( int aNet, std::set& aItems ); void ClearRanks( int aMarkerMask = MK_HEAD | MK_VIOLATION ); - int FindByMarker( int aMarker, PNS_ITEMSET& aItems ); + int FindByMarker( int aMarker, ITEM_SET& aItems ); int RemoveByMarker( int aMarker ); - PNS_ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM* aParent ); + ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM* aParent ); bool HasChildren() const { @@ -400,44 +400,44 @@ public: ///> checks if this branch contains an updated version of the m_item ///> from the root branch. - bool Overrides( PNS_ITEM* aItem ) const + bool Overrides( ITEM* aItem ) const { return m_override.find( aItem ) != m_override.end(); } private: struct DEFAULT_OBSTACLE_VISITOR; - typedef boost::unordered_multimap JOINT_MAP; + typedef boost::unordered_multimap JOINT_MAP; typedef JOINT_MAP::value_type TagJointPair; /// nodes are not copyable - PNS_NODE( const PNS_NODE& aB ); - PNS_NODE& operator=( const PNS_NODE& aB ); + NODE( const NODE& aB ); + NODE& operator=( const NODE& aB ); ///> tries to find matching joint and creates a new one if not found - PNS_JOINT& touchJoint( const VECTOR2I& aPos, - const PNS_LAYERSET& aLayers, - int aNet ); + JOINT& touchJoint( const VECTOR2I& aPos, + const LAYER_RANGE& aLayers, + int aNet ); ///> touches a joint and links it to an m_item - void linkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, - int aNet, PNS_ITEM* aWhere ); + void linkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, + int aNet, ITEM* aWhere ); ///> unlinks an item from a joint - void unlinkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, - int aNet, PNS_ITEM* aWhere ); + void unlinkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, + int aNet, ITEM* aWhere ); ///> helpers for adding/removing items - void addSolid( PNS_SOLID* aSeg ); - void addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant ); - void addLine( PNS_LINE* aLine, bool aAllowRedundant ); - void addVia( PNS_VIA* aVia ); - void removeSolid( PNS_SOLID* aSeg ); - void removeLine( PNS_LINE* aLine ); - void removeSegment( PNS_SEGMENT* aSeg ); - void removeVia( PNS_VIA* aVia ); + void addSolid( SOLID* aSeg ); + void addSegment( SEGMENT* aSeg, bool aAllowRedundant ); + void addLine( LINE* aLine, bool aAllowRedundant ); + void addVia( VIA* aVia ); + void removeSolid( SOLID* aSeg ); + void removeLine( LINE* aLine ); + void removeSegment( SEGMENT* aSeg ); + void removeVia( VIA* aVia ); - void doRemove( PNS_ITEM* aItem ); + void doRemove( ITEM* aItem ); void unlinkParent(); void releaseChildren(); void releaseGarbage(); @@ -447,47 +447,47 @@ private: return m_parent == NULL; } - PNS_SEGMENT* findRedundantSegment( PNS_SEGMENT* aSeg ); + SEGMENT* findRedundantSegment( SEGMENT* aSeg ); ///> scans the joint map, forming a line starting from segment (current). - void followLine( PNS_SEGMENT* aCurrent, - bool aScanDirection, - int& aPos, - int aLimit, - VECTOR2I* aCorners, - PNS_SEGMENT** aSegments, - bool& aGuardHit, - bool aStopAtLockedJoints ); + void followLine( SEGMENT* aCurrent, + bool aScanDirection, + int& aPos, + int aLimit, + VECTOR2I* aCorners, + SEGMENT** aSegments, + bool& aGuardHit, + bool aStopAtLockedJoints ); ///> hash table with the joints, linking the items. Joints are hashed by ///> their position, layer set and net. JOINT_MAP m_joints; ///> node this node was branched from - PNS_NODE* m_parent; + NODE* m_parent; ///> root node of the whole hierarchy - PNS_NODE* m_root; + NODE* m_root; ///> list of nodes branched from this one - std::set m_children; + std::set m_children; ///> hash of root's items that have been changed in this node - boost::unordered_set m_override; + boost::unordered_set m_override; ///> worst case item-item clearance int m_maxClearance; ///> Design rules resolver - PNS_RULE_RESOLVER* m_ruleResolver; + RULE_RESOLVER* m_ruleResolver; ///> Geometric/Net index of the items - PNS_INDEX* m_index; + INDEX* m_index; ///> depth of the node (number of parent nodes in the inheritance chain) int m_depth; - boost::unordered_set m_garbageItems; + boost::unordered_set m_garbageItems; }; } diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index a2af3c157b..6a22193012 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -38,7 +38,7 @@ namespace PNS { /** * Cost Estimator Methods */ -int PNS_COST_ESTIMATOR::CornerCost( const SEG& aA, const SEG& aB ) +int COST_ESTIMATOR::CornerCost( const SEG& aA, const SEG& aB ) { DIRECTION_45 dir_a( aA ), dir_b( aB ); @@ -65,7 +65,7 @@ int PNS_COST_ESTIMATOR::CornerCost( const SEG& aA, const SEG& aB ) } -int PNS_COST_ESTIMATOR::CornerCost( const SHAPE_LINE_CHAIN& aLine ) +int COST_ESTIMATOR::CornerCost( const SHAPE_LINE_CHAIN& aLine ) { int total = 0; @@ -76,27 +76,27 @@ int PNS_COST_ESTIMATOR::CornerCost( const SHAPE_LINE_CHAIN& aLine ) } -int PNS_COST_ESTIMATOR::CornerCost( const PNS_LINE& aLine ) +int COST_ESTIMATOR::CornerCost( const LINE& aLine ) { return CornerCost( aLine.CLine() ); } -void PNS_COST_ESTIMATOR::Add( PNS_LINE& aLine ) +void COST_ESTIMATOR::Add( LINE& aLine ) { m_lengthCost += aLine.CLine().Length(); m_cornerCost += CornerCost( aLine ); } -void PNS_COST_ESTIMATOR::Remove( PNS_LINE& aLine ) +void COST_ESTIMATOR::Remove( LINE& aLine ) { m_lengthCost -= aLine.CLine().Length(); m_cornerCost -= CornerCost( aLine ); } -void PNS_COST_ESTIMATOR::Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine ) +void COST_ESTIMATOR::Replace( LINE& aOldLine, LINE& aNewLine ) { m_lengthCost -= aOldLine.CLine().Length(); m_cornerCost -= CornerCost( aOldLine ); @@ -105,7 +105,7 @@ void PNS_COST_ESTIMATOR::Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine ) } -bool PNS_COST_ESTIMATOR::IsBetter( PNS_COST_ESTIMATOR& aOther, +bool COST_ESTIMATOR::IsBetter( COST_ESTIMATOR& aOther, double aLengthTolerance, double aCornerTolerance ) const { @@ -123,9 +123,9 @@ bool PNS_COST_ESTIMATOR::IsBetter( PNS_COST_ESTIMATOR& aOther, /** * Optimizer **/ -PNS_OPTIMIZER::PNS_OPTIMIZER( PNS_NODE* aWorld ) : +OPTIMIZER::OPTIMIZER( NODE* aWorld ) : m_world( aWorld ), - m_collisionKindMask( PNS_ITEM::ANY_T ), + m_collisionKindMask( ITEM::ANY_T ), m_effortLevel( MERGE_SEGMENTS ), m_keepPostures( false ), m_restrictAreaActive( false ) @@ -133,21 +133,21 @@ PNS_OPTIMIZER::PNS_OPTIMIZER( PNS_NODE* aWorld ) : } -PNS_OPTIMIZER::~PNS_OPTIMIZER() +OPTIMIZER::~OPTIMIZER() { } -struct PNS_OPTIMIZER::CACHE_VISITOR +struct OPTIMIZER::CACHE_VISITOR { - CACHE_VISITOR( const PNS_ITEM* aOurItem, PNS_NODE* aNode, int aMask ) : + CACHE_VISITOR( const ITEM* aOurItem, NODE* aNode, int aMask ) : m_ourItem( aOurItem ), m_collidingItem( NULL ), m_node( aNode ), m_mask( aMask ) {} - bool operator()( PNS_ITEM* aOtherItem ) + bool operator()( ITEM* aOtherItem ) { if( !( m_mask & aOtherItem->Kind() ) ) return true; @@ -161,14 +161,14 @@ struct PNS_OPTIMIZER::CACHE_VISITOR return false; } - const PNS_ITEM* m_ourItem; - PNS_ITEM* m_collidingItem; - PNS_NODE* m_node; + const ITEM* m_ourItem; + ITEM* m_collidingItem; + NODE* m_node; int m_mask; }; -void PNS_OPTIMIZER::cacheAdd( PNS_ITEM* aItem, bool aIsStatic = false ) +void OPTIMIZER::cacheAdd( ITEM* aItem, bool aIsStatic = false ) { if( m_cacheTags.find( aItem ) != m_cacheTags.end() ) return; @@ -179,9 +179,9 @@ void PNS_OPTIMIZER::cacheAdd( PNS_ITEM* aItem, bool aIsStatic = false ) } -void PNS_OPTIMIZER::removeCachedSegments( PNS_LINE* aLine, int aStartVertex, int aEndVertex ) +void OPTIMIZER::removeCachedSegments( LINE* aLine, int aStartVertex, int aEndVertex ) { - PNS_LINE::SEGMENT_REFS* segs = aLine->LinkedSegments(); + LINE::SEGMENT_REFS* segs = aLine->LinkedSegments(); if( !segs ) return; @@ -191,27 +191,27 @@ void PNS_OPTIMIZER::removeCachedSegments( PNS_LINE* aLine, int aStartVertex, int for( int i = aStartVertex; i < aEndVertex - 1; i++ ) { - PNS_SEGMENT* s = (*segs)[i]; + SEGMENT* s = (*segs)[i]; m_cacheTags.erase( s ); m_cache.Remove( s ); } } -void PNS_OPTIMIZER::CacheRemove( PNS_ITEM* aItem ) +void OPTIMIZER::CacheRemove( ITEM* aItem ) { - if( aItem->Kind() == PNS_ITEM::LINE_T ) - removeCachedSegments( static_cast( aItem ) ); + if( aItem->Kind() == ITEM::LINE_T ) + removeCachedSegments( static_cast( aItem ) ); } -void PNS_OPTIMIZER::CacheStaticItem( PNS_ITEM* aItem ) +void OPTIMIZER::CacheStaticItem( ITEM* aItem ) { cacheAdd( aItem, true ); } -void PNS_OPTIMIZER::ClearCache( bool aStaticOnly ) +void OPTIMIZER::ClearCache( bool aStaticOnly ) { if( !aStaticOnly ) { @@ -237,12 +237,12 @@ class LINE_RESTRICTIONS LINE_RESTRICTIONS() {}; ~LINE_RESTRICTIONS() {}; - void Build( PNS_NODE* aWorld, PNS_LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable ); + void Build( NODE* aWorld, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable ); bool Check ( int aVertex1, int aVertex2, const SHAPE_LINE_CHAIN& aReplacement ); void Dump(); private: - int allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, const VECTOR2I& aP, bool aFirst ); + int allowedAngles( NODE* aWorld, const LINE* aLine, const VECTOR2I& aP, bool aFirst ); struct RVERTEX { @@ -261,9 +261,9 @@ class LINE_RESTRICTIONS // fixme: use later -int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, const VECTOR2I& aP, bool aFirst ) +int LINE_RESTRICTIONS::allowedAngles( NODE* aWorld, const LINE* aLine, const VECTOR2I& aP, bool aFirst ) { - PNS_JOINT* jt = aWorld->FindJoint( aP , aLine ); + JOINT* jt = aWorld->FindJoint( aP , aLine ); if( !jt ) return 0xff; @@ -272,11 +272,11 @@ int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, c int n_dirs = 0; - for( const PNS_ITEM* item : jt->Links().CItems() ) + for( const ITEM* item : jt->Links().CItems() ) { - if( item->OfKind( PNS_ITEM::VIA_T ) || item->OfKind( PNS_ITEM::SOLID_T ) ) + if( item->OfKind( ITEM::VIA_T ) || item->OfKind( ITEM::SOLID_T ) ) return 0xff; - else if( const PNS_SEGMENT* seg = dyn_cast( item ) ) + else if( const SEGMENT* seg = dyn_cast( item ) ) { SEG s = seg->Seg(); if( s.A != aP ) @@ -306,7 +306,7 @@ int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, c } -void LINE_RESTRICTIONS::Build( PNS_NODE* aWorld, PNS_LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable ) +void LINE_RESTRICTIONS::Build( NODE* aWorld, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable ) { const SHAPE_LINE_CHAIN& l = aLine; VECTOR2I v_prev; @@ -383,7 +383,7 @@ bool LINE_RESTRICTIONS::Check( int aVertex1, int aVertex2, const SHAPE_LINE_CHAI } -bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache ) +bool OPTIMIZER::checkColliding( ITEM* aItem, bool aUpdateCache ) { CACHE_VISITOR v( aItem, m_world, m_collisionKindMask ); @@ -395,7 +395,7 @@ bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache ) if( !v.m_collidingItem ) { - PNS_NODE::OPT_OBSTACLE obs = m_world->CheckColliding( aItem ); + NODE::OPT_OBSTACLE obs = m_world->CheckColliding( aItem ); if( obs ) { @@ -416,15 +416,15 @@ bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache ) } -bool PNS_OPTIMIZER::checkColliding( PNS_LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath ) +bool OPTIMIZER::checkColliding( LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath ) { - PNS_LINE tmp( *aLine, aOptPath ); + LINE tmp( *aLine, aOptPath ); return checkColliding( &tmp ); } -bool PNS_OPTIMIZER::mergeObtuse( PNS_LINE* aLine ) +bool OPTIMIZER::mergeObtuse( LINE* aLine ) { SHAPE_LINE_CHAIN& line = aLine->Line(); @@ -483,7 +483,7 @@ bool PNS_OPTIMIZER::mergeObtuse( PNS_LINE* aLine ) opt_path.Append( s1opt.B ); opt_path.Append( s2opt.B ); - PNS_LINE opt_track( *aLine, opt_path ); + LINE opt_track( *aLine, opt_path ); if( !checkColliding( &opt_track ) ) { @@ -515,7 +515,7 @@ bool PNS_OPTIMIZER::mergeObtuse( PNS_LINE* aLine ) } -bool PNS_OPTIMIZER::mergeFull( PNS_LINE* aLine ) +bool OPTIMIZER::mergeFull( LINE* aLine ) { SHAPE_LINE_CHAIN& line = aLine->Line(); int step = line.SegmentCount() - 1; @@ -552,7 +552,7 @@ bool PNS_OPTIMIZER::mergeFull( PNS_LINE* aLine ) } -bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, PNS_LINE* aResult ) +bool OPTIMIZER::Optimize( LINE* aLine, LINE* aResult ) { if( !aResult ) aResult = aLine; @@ -579,12 +579,12 @@ bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, PNS_LINE* aResult ) } -bool PNS_OPTIMIZER::mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step ) +bool OPTIMIZER::mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step ) { int n = 0; int n_segs = aCurrentPath.SegmentCount(); - int cost_orig = PNS_COST_ESTIMATOR::CornerCost( aCurrentPath ); + int cost_orig = COST_ESTIMATOR::CornerCost( aCurrentPath ); LINE_RESTRICTIONS restr; @@ -623,7 +623,7 @@ bool PNS_OPTIMIZER::mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, path[i] = aCurrentPath; path[i].Replace( s1.Index(), s2.Index(), bypass ); path[i].Simplify(); - cost[i] = PNS_COST_ESTIMATOR::CornerCost( path[i] ); + cost[i] = COST_ESTIMATOR::CornerCost( path[i] ); } } @@ -646,7 +646,7 @@ bool PNS_OPTIMIZER::mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, } -PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::circleBreakouts( int aWidth, +OPTIMIZER::BREAKOUT_LIST OPTIMIZER::circleBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const { BREAKOUT_LIST breakouts; @@ -666,7 +666,7 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::circleBreakouts( int aWidth, } -PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::convexBreakouts( int aWidth, +OPTIMIZER::BREAKOUT_LIST OPTIMIZER::convexBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const { BREAKOUT_LIST breakouts; @@ -708,7 +708,7 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::convexBreakouts( int aWidth, } -PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::rectBreakouts( int aWidth, +OPTIMIZER::BREAKOUT_LIST OPTIMIZER::rectBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const { const SHAPE_RECT* rect = static_cast(aShape); @@ -762,18 +762,18 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::rectBreakouts( int aWidth, } -PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::computeBreakouts( int aWidth, - const PNS_ITEM* aItem, bool aPermitDiagonal ) const +OPTIMIZER::BREAKOUT_LIST OPTIMIZER::computeBreakouts( int aWidth, + const ITEM* aItem, bool aPermitDiagonal ) const { switch( aItem->Kind() ) { - case PNS_ITEM::VIA_T: + case ITEM::VIA_T: { - const PNS_VIA* via = static_cast( aItem ); + const VIA* via = static_cast( aItem ); return circleBreakouts( aWidth, via->Shape(), aPermitDiagonal ); } - case PNS_ITEM::SOLID_T: + case ITEM::SOLID_T: { const SHAPE* shape = aItem->Shape(); @@ -808,16 +808,16 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::computeBreakouts( int aWidth, } -PNS_ITEM* PNS_OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const +ITEM* OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const { - PNS_JOINT* jt = m_world->FindJoint( aP, aLayer, aNet ); + JOINT* jt = m_world->FindJoint( aP, aLayer, aNet ); if( !jt ) return NULL; - for( PNS_ITEM* item : jt->LinkList() ) + for( ITEM* item : jt->LinkList() ) { - if( item->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ) ) + if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) ) return item; } @@ -825,9 +825,9 @@ PNS_ITEM* PNS_OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP } -int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, int aEndVertex ) +int OPTIMIZER::smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVertex ) { - int min_cost = INT_MAX; // PNS_COST_ESTIMATOR::CornerCost( line ); + int min_cost = INT_MAX; // COST_ESTIMATOR::CornerCost( line ); int min_len = INT_MAX; DIRECTION_45 dir; @@ -837,7 +837,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, typedef std::pair RtVariant; std::vector variants; - PNS_SOLID* solid = dyn_cast( aPad ); + SOLID* solid = dyn_cast( aPad ); // don't do auto-neckdown for offset pads if( solid && solid->Offset() != VECTOR2I( 0, 0 ) ) @@ -882,7 +882,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, for( int i = p + 1; i < line.PointCount(); i++ ) v.Append( line.CPoint( i ) ); - PNS_LINE tmp( *aLine, v ); + LINE tmp( *aLine, v ); int cc = tmp.CountCorners( ForbiddenAngles ); if( cc == 0 ) @@ -903,8 +903,8 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, for( RtVariant& vp : variants ) { - PNS_LINE tmp( *aLine, vp.second ); - int cost = PNS_COST_ESTIMATOR::CornerCost( vp.second ); + LINE tmp( *aLine, vp.second ); + int cost = COST_ESTIMATOR::CornerCost( vp.second ); int len = vp.second.Length(); if( !checkColliding( &tmp ) ) @@ -932,7 +932,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, return -1; } -bool PNS_OPTIMIZER::runSmartPads( PNS_LINE* aLine ) +bool OPTIMIZER::runSmartPads( LINE* aLine ) { SHAPE_LINE_CHAIN& line = aLine->Line(); @@ -941,8 +941,8 @@ bool PNS_OPTIMIZER::runSmartPads( PNS_LINE* aLine ) VECTOR2I p_start = line.CPoint( 0 ), p_end = line.CPoint( -1 ); - PNS_ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start ); - PNS_ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end ); + ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start ); + ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end ); int vtx = -1; @@ -959,9 +959,9 @@ bool PNS_OPTIMIZER::runSmartPads( PNS_LINE* aLine ) } -bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, int aEffortLevel, PNS_NODE* aWorld ) +bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld ) { - PNS_OPTIMIZER opt( aWorld ); + OPTIMIZER opt( aWorld ); opt.SetEffortLevel( aEffortLevel ); opt.SetCollisionMask( -1 ); @@ -969,15 +969,15 @@ bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, int aEffortLevel, PNS_NODE* aWorl } -bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine ) +bool OPTIMIZER::fanoutCleanup( LINE* aLine ) { if( aLine->PointCount() < 3 ) return false; VECTOR2I p_start = aLine->CPoint( 0 ), p_end = aLine->CPoint( -1 ); - PNS_ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start ); - PNS_ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end ); + ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start ); + ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end ); int thr = aLine->Width() * 10; int len = aLine->CLine().Length(); @@ -985,12 +985,12 @@ bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine ) if( !startPad ) return false; - bool startMatch = startPad->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ); + bool startMatch = startPad->OfKind( ITEM::VIA_T | ITEM::SOLID_T ); bool endMatch = false; if(endPad) { - endMatch = endPad->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ); + endMatch = endPad->OfKind( ITEM::VIA_T | ITEM::SOLID_T ); } else { @@ -1002,8 +1002,8 @@ bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine ) for( int i = 0; i < 2; i++ ) { SHAPE_LINE_CHAIN l2 = DIRECTION_45().BuildInitialTrace( p_start, p_end, i ); - PNS_LINE repl; - repl = PNS_LINE( *aLine, l2 ); + LINE repl; + repl = LINE( *aLine, l2 ); if( !m_world->CheckColliding( &repl ) ) { @@ -1017,7 +1017,7 @@ bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine ) } -int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg, const SHAPE_LINE_CHAIN& aCoupled, PNS_DIFF_PAIR* aPair, int* aIndices ) +int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg, const SHAPE_LINE_CHAIN& aCoupled, DIFF_PAIR* aPair, int* aIndices ) { int count = 0; for ( int i = 0; i < aCoupled.SegmentCount(); i++ ) @@ -1041,12 +1041,12 @@ int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg, const SHA } -bool verifyDpBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aNewRef, const SHAPE_LINE_CHAIN& aNewCoupled ) +bool verifyDpBypass( NODE* aNode, DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aNewRef, const SHAPE_LINE_CHAIN& aNewCoupled ) { - PNS_LINE refLine ( aRefIsP ? aPair->PLine() : aPair->NLine(), aNewRef ); - PNS_LINE coupledLine ( aRefIsP ? aPair->NLine() : aPair->PLine(), aNewCoupled ); + LINE refLine ( aRefIsP ? aPair->PLine() : aPair->NLine(), aNewRef ); + LINE coupledLine ( aRefIsP ? aPair->NLine() : aPair->PLine(), aNewCoupled ); - if( aNode->CheckColliding( &refLine, &coupledLine, PNS_ITEM::ANY_T, aPair->Gap() - 10 ) ) + if( aNode->CheckColliding( &refLine, &coupledLine, ITEM::ANY_T, aPair->Gap() - 10 ) ) return false; if( aNode->CheckColliding ( &refLine ) ) @@ -1059,7 +1059,7 @@ bool verifyDpBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const } -bool coupledBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aRef, const SHAPE_LINE_CHAIN& aRefBypass, const SHAPE_LINE_CHAIN& aCoupled, SHAPE_LINE_CHAIN& aNewCoupled ) +bool coupledBypass( NODE* aNode, DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aRef, const SHAPE_LINE_CHAIN& aRefBypass, const SHAPE_LINE_CHAIN& aCoupled, SHAPE_LINE_CHAIN& aNewCoupled ) { int vStartIdx[1024]; // fixme: possible overflow @@ -1112,15 +1112,15 @@ bool coupledBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const S } -bool checkDpColliding( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aIsP, const SHAPE_LINE_CHAIN& aPath ) +bool checkDpColliding( NODE* aNode, DIFF_PAIR* aPair, bool aIsP, const SHAPE_LINE_CHAIN& aPath ) { - PNS_LINE tmp ( aIsP ? aPair->PLine() : aPair->NLine(), aPath ); + LINE tmp ( aIsP ? aPair->PLine() : aPair->NLine(), aPath ); return static_cast( aNode->CheckColliding( &tmp ) ); } -bool PNS_OPTIMIZER::mergeDpStep( PNS_DIFF_PAIR* aPair, bool aTryP, int step ) +bool OPTIMIZER::mergeDpStep( DIFF_PAIR* aPair, bool aTryP, int step ) { int n = 1; @@ -1182,7 +1182,7 @@ bool PNS_OPTIMIZER::mergeDpStep( PNS_DIFF_PAIR* aPair, bool aTryP, int step ) } -bool PNS_OPTIMIZER::mergeDpSegments( PNS_DIFF_PAIR* aPair ) +bool OPTIMIZER::mergeDpSegments( DIFF_PAIR* aPair ) { int step_p = aPair->CP().SegmentCount() - 2; int step_n = aPair->CN().SegmentCount() - 2; @@ -1223,7 +1223,7 @@ bool PNS_OPTIMIZER::mergeDpSegments( PNS_DIFF_PAIR* aPair ) } -bool PNS_OPTIMIZER::Optimize( PNS_DIFF_PAIR* aPair ) +bool OPTIMIZER::Optimize( DIFF_PAIR* aPair ) { return mergeDpSegments( aPair ); } diff --git a/pcbnew/router/pns_optimizer.h b/pcbnew/router/pns_optimizer.h index 3be4a3639f..96b3e3b0eb 100644 --- a/pcbnew/router/pns_optimizer.h +++ b/pcbnew/router/pns_optimizer.h @@ -32,40 +32,40 @@ namespace PNS { -class PNS_NODE; -class PNS_ROUTER; -class PNS_LINE; -class PNS_DIFF_PAIR; +class NODE; +class ROUTER; +class LINE; +class DIFF_PAIR; /** - * Class PNS_COST_ESTIMATOR + * Class COST_ESTIMATOR * * Calculates the cost of a given line, taking corner angles and total length into account. **/ -class PNS_COST_ESTIMATOR +class COST_ESTIMATOR { public: - PNS_COST_ESTIMATOR() : + COST_ESTIMATOR() : m_lengthCost( 0 ), m_cornerCost( 0 ) {} - PNS_COST_ESTIMATOR( const PNS_COST_ESTIMATOR& aB ) : + COST_ESTIMATOR( const COST_ESTIMATOR& aB ) : m_lengthCost( aB.m_lengthCost ), m_cornerCost( aB.m_cornerCost ) {} - ~PNS_COST_ESTIMATOR() {}; + ~COST_ESTIMATOR() {}; static int CornerCost( const SEG& aA, const SEG& aB ); static int CornerCost( const SHAPE_LINE_CHAIN& aLine ); - static int CornerCost( const PNS_LINE& aLine ); + static int CornerCost( const LINE& aLine ); - void Add( PNS_LINE& aLine ); - void Remove( PNS_LINE& aLine ); - void Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine ); + void Add( LINE& aLine ); + void Remove( LINE& aLine ); + void Replace( LINE& aOldLine, LINE& aNewLine ); - bool IsBetter( PNS_COST_ESTIMATOR& aOther, double aLengthTolerance, + bool IsBetter( COST_ESTIMATOR& aOther, double aLengthTolerance, double aCornerTollerace ) const; double GetLengthCost() const { return m_lengthCost; } @@ -77,7 +77,7 @@ private: }; /** - * Class PNS_OPTIMIZER + * Class OPTIMIZER * * Performs various optimizations of the lines being routed, attempting to make the lines shorter * and less cornery. There are 3 kinds of optimizations so far: @@ -87,7 +87,7 @@ private: * 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). **/ -class PNS_OPTIMIZER +class OPTIMIZER { public: enum OptimizationEffort @@ -98,19 +98,19 @@ public: FANOUT_CLEANUP = 0x08 }; - PNS_OPTIMIZER( PNS_NODE* aWorld ); - ~PNS_OPTIMIZER(); + OPTIMIZER( NODE* aWorld ); + ~OPTIMIZER(); ///> a quick shortcut to optmize a line without creating and setting up an optimizer - static bool Optimize( PNS_LINE* aLine, int aEffortLevel, PNS_NODE* aWorld); + static bool Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld); - bool Optimize( PNS_LINE* aLine, PNS_LINE* aResult = NULL ); - bool Optimize( PNS_DIFF_PAIR* aPair ); + bool Optimize( LINE* aLine, LINE* aResult = NULL ); + bool Optimize( DIFF_PAIR* aPair ); - void SetWorld( PNS_NODE* aNode ) { m_world = aNode; } - void CacheStaticItem( PNS_ITEM* aItem ); - void CacheRemove( PNS_ITEM* aItem ); + void SetWorld( NODE* aNode ) { m_world = aNode; } + void CacheStaticItem( ITEM* aItem ); + void CacheRemove( ITEM* aItem ); void ClearCache( bool aStaticOnly = false ); void SetCollisionMask( int aMask ) @@ -143,36 +143,36 @@ private: bool m_isStatic; }; - bool mergeObtuse( PNS_LINE* aLine ); - bool mergeFull( PNS_LINE* aLine ); - bool removeUglyCorners( PNS_LINE* aLine ); - bool runSmartPads( PNS_LINE* aLine ); - bool mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentLine, int step ); - bool fanoutCleanup( PNS_LINE * aLine ); - bool mergeDpSegments( PNS_DIFF_PAIR *aPair ); - bool mergeDpStep( PNS_DIFF_PAIR *aPair, bool aTryP, int step ); + bool mergeObtuse( LINE* aLine ); + bool mergeFull( LINE* aLine ); + bool removeUglyCorners( LINE* aLine ); + bool runSmartPads( LINE* aLine ); + bool mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentLine, int step ); + bool fanoutCleanup( LINE * aLine ); + bool mergeDpSegments( DIFF_PAIR *aPair ); + bool mergeDpStep( DIFF_PAIR *aPair, bool aTryP, int step ); - bool checkColliding( PNS_ITEM* aItem, bool aUpdateCache = true ); - bool checkColliding( PNS_LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath ); + bool checkColliding( ITEM* aItem, bool aUpdateCache = true ); + bool checkColliding( LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath ); - void cacheAdd( PNS_ITEM* aItem, bool aIsStatic ); - void removeCachedSegments( PNS_LINE* aLine, int aStartVertex = 0, int aEndVertex = -1 ); + void cacheAdd( ITEM* aItem, bool aIsStatic ); + void removeCachedSegments( LINE* aLine, int aStartVertex = 0, int aEndVertex = -1 ); BREAKOUT_LIST circleBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const; BREAKOUT_LIST rectBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const; BREAKOUT_LIST ovalBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const; BREAKOUT_LIST convexBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const; - BREAKOUT_LIST computeBreakouts( int aWidth, const PNS_ITEM* aItem, bool aPermitDiagonal ) const; + BREAKOUT_LIST computeBreakouts( int aWidth, const ITEM* aItem, bool aPermitDiagonal ) const; - int smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, int aEndVertex ); + int smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVertex ); - PNS_ITEM* findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const; + ITEM* findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const; - SHAPE_INDEX_LIST m_cache; + SHAPE_INDEX_LIST m_cache; - typedef boost::unordered_map CachedItemTags; + typedef boost::unordered_map CachedItemTags; CachedItemTags m_cacheTags; - PNS_NODE* m_world; + NODE* m_world; int m_collisionKindMask; int m_effortLevel; bool m_keepPostures; diff --git a/pcbnew/router/pns_placement_algo.h b/pcbnew/router/pns_placement_algo.h index de61c64641..e7a9540cb0 100644 --- a/pcbnew/router/pns_placement_algo.h +++ b/pcbnew/router/pns_placement_algo.h @@ -30,25 +30,25 @@ namespace PNS { -class PNS_ROUTER; -class PNS_ITEM; -class PNS_NODE; +class ROUTER; +class ITEM; +class NODE; /** - * Class PNS_PLACEMENT_ALGO + * Class PLACEMENT_ALGO * * Abstract class for a P&S placement/dragging algorithm. * All subtools (drag, single/diff pair routing and meandering) * are derived from it. */ -class PNS_PLACEMENT_ALGO : public PNS_ALGO_BASE +class PLACEMENT_ALGO : public ALGO_BASE { public: - PNS_PLACEMENT_ALGO( PNS_ROUTER* aRouter ) : - PNS_ALGO_BASE( aRouter ) {}; + PLACEMENT_ALGO( ROUTER* aRouter ) : + ALGO_BASE( aRouter ) {}; - virtual ~PNS_PLACEMENT_ALGO () {}; + virtual ~PLACEMENT_ALGO () {}; /** * Function Start() @@ -56,7 +56,7 @@ public: * Starts placement/drag operation at point aP, taking item aStartItem as anchor * (unless NULL). */ - virtual bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) = 0; + virtual bool Start( const VECTOR2I& aP, ITEM* aStartItem ) = 0; /** * Function Move() @@ -65,7 +65,7 @@ public: * aEndItem as the anchor (if not NULL). * (unless NULL). */ - virtual bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) = 0; + virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem ) = 0; /** * Function FixRoute() @@ -76,7 +76,7 @@ public: * result is violating design rules - in such case, the track is only committed * if Settings.CanViolateDRC() is on. */ - virtual bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) = 0; + virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) = 0; /** * Function ToggleVia() @@ -113,7 +113,7 @@ public: * * Returns all routed/tuned traces. */ - virtual const PNS_ITEMSET Traces() = 0; + virtual const ITEM_SET Traces() = 0; /** * Function CurrentEnd() @@ -142,7 +142,7 @@ public: * * Returns the most recent board state. */ - virtual PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const = 0; + virtual NODE* CurrentNode( bool aLoopsRemoved = false ) const = 0; /** * Function FlipPosture() @@ -160,7 +160,7 @@ public: * a settings class. Used to dynamically change these parameters as * the track is routed. */ - virtual void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ) + virtual void UpdateSizes( const SIZES_SETTINGS& aSizes ) { } diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index c7c18c2da8..2978e165b0 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -62,9 +62,9 @@ namespace PNS { // an ugly singleton for drawing debug items within the router context. // To be fixed sometime in the future. -static PNS_ROUTER* theRouter; +static ROUTER* theRouter; -PNS_ROUTER::PNS_ROUTER() +ROUTER::ROUTER() { theRouter = this; @@ -87,28 +87,28 @@ PNS_ROUTER::PNS_ROUTER() } -PNS_ROUTER* PNS_ROUTER::GetInstance() +ROUTER* ROUTER::GetInstance() { return theRouter; } -PNS_ROUTER::~PNS_ROUTER() +ROUTER::~ROUTER() { ClearWorld(); theRouter = NULL; } -void PNS_ROUTER::SyncWorld( ) +void ROUTER::SyncWorld( ) { ClearWorld(); - m_world = new PNS_NODE; + m_world = new NODE; m_iface->SyncWorld( m_world ); } -void PNS_ROUTER::ClearWorld() +void ROUTER::ClearWorld() { if( m_world ) { @@ -125,13 +125,13 @@ void PNS_ROUTER::ClearWorld() } -bool PNS_ROUTER::RoutingInProgress() const +bool ROUTER::RoutingInProgress() const { return m_state != IDLE; } -const PNS_ITEMSET PNS_ROUTER::QueryHoverItems( const VECTOR2I& aP ) +const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP ) { if( m_state == IDLE ) return m_world->HitTest( aP ); @@ -141,12 +141,12 @@ const PNS_ITEMSET PNS_ROUTER::QueryHoverItems( const VECTOR2I& aP ) } } -bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem ) +bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM* aStartItem ) { - if( !aStartItem || aStartItem->OfKind( PNS_ITEM::SOLID_T ) ) + if( !aStartItem || aStartItem->OfKind( ITEM::SOLID_T ) ) return false; - m_dragger = new PNS_DRAGGER( this ); + m_dragger = new DRAGGER( this ); m_dragger->SetWorld( m_world ); m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () ); @@ -162,24 +162,24 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem ) return true; } -bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLayer ) +bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer ) { switch( m_mode ) { case PNS_MODE_ROUTE_SINGLE: - m_placer = new PNS_LINE_PLACER( this ); + m_placer = new LINE_PLACER( this ); break; case PNS_MODE_ROUTE_DIFF_PAIR: - m_placer = new PNS_DIFF_PAIR_PLACER( this ); + m_placer = new DIFF_PAIR_PLACER( this ); break; case PNS_MODE_TUNE_SINGLE: - m_placer = new PNS_MEANDER_PLACER( this ); + m_placer = new MEANDER_PLACER( this ); break; case PNS_MODE_TUNE_DIFF_PAIR: - m_placer = new PNS_DP_MEANDER_PLACER( this ); + m_placer = new DP_MEANDER_PLACER( this ); break; case PNS_MODE_TUNE_DIFF_PAIR_SKEW: - m_placer = new PNS_MEANDER_SKEW_PLACER( this ); + m_placer = new MEANDER_SKEW_PLACER( this ); break; default: @@ -201,13 +201,13 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLa } -void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems ) +void ROUTER::DisplayItems( const ITEM_SET& aItems ) { - for( const PNS_ITEM* item : aItems.CItems() ) + for( const ITEM* item : aItems.CItems() ) m_iface->DisplayItem( item ); } -void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem ) +void ROUTER::Move( const VECTOR2I& aP, ITEM* endItem ) { m_currentEnd = aP; @@ -227,41 +227,41 @@ void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem ) } -void PNS_ROUTER::moveDragging( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +void ROUTER::moveDragging( const VECTOR2I& aP, ITEM* aEndItem ) { m_iface->EraseView(); m_dragger->Drag( aP ); - PNS_ITEMSET dragged = m_dragger->Traces(); + ITEM_SET dragged = m_dragger->Traces(); updateView( m_dragger->CurrentNode(), dragged ); } -void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, - PNS_NODE::ITEM_VECTOR& aRemoved ) +void ROUTER::markViolations( NODE* aNode, ITEM_SET& aCurrent, + NODE::ITEM_VECTOR& aRemoved ) { - for( PNS_ITEM* item : aCurrent.Items() ) + for( ITEM* item : aCurrent.Items() ) { - PNS_NODE::OBSTACLES obstacles; + NODE::OBSTACLES obstacles; - aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY_T ); + aNode->QueryColliding( item, obstacles, ITEM::ANY_T ); - if( item->OfKind( PNS_ITEM::LINE_T ) ) + if( item->OfKind( ITEM::LINE_T ) ) { - PNS_LINE* l = static_cast( item ); + LINE* l = static_cast( item ); if( l->EndsWithVia() ) { - PNS_VIA v( l->Via() ); - aNode->QueryColliding( &v, obstacles, PNS_ITEM::ANY_T ); + VIA v( l->Via() ); + aNode->QueryColliding( &v, obstacles, ITEM::ANY_T ); } } - for( PNS_OBSTACLE& obs : obstacles ) + for( OBSTACLE& obs : obstacles ) { int clearance = aNode->GetClearance( item, obs.m_item ); - std::unique_ptr tmp( obs.m_item->Clone() ); + std::unique_ptr tmp( obs.m_item->Clone() ); tmp->Mark( MK_VIOLATION ); m_iface->DisplayItem( tmp.get(), -1, clearance ); aRemoved.push_back( obs.m_item ); @@ -270,10 +270,10 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, } -void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) +void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent ) { - PNS_NODE::ITEM_VECTOR removed, added; - PNS_NODE::OBSTACLES obstacles; + NODE::ITEM_VECTOR removed, added; + NODE::OBSTACLES obstacles; if( !aNode ) return; @@ -291,7 +291,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) } -void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes ) +void ROUTER::UpdateSizes ( const SIZES_SETTINGS& aSizes ) { m_sizes = aSizes; @@ -303,34 +303,34 @@ void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes ) } -void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +void ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem ) { m_iface->EraseView(); m_placer->Move( aP, aEndItem ); - PNS_ITEMSET current = m_placer->Traces(); + ITEM_SET current = m_placer->Traces(); - for( const PNS_ITEM* item : current.CItems() ) + for( const ITEM* item : current.CItems() ) { - if( !item->OfKind( PNS_ITEM::LINE_T ) ) + if( !item->OfKind( ITEM::LINE_T ) ) continue; - const PNS_LINE* l = static_cast( item ); + const LINE* l = static_cast( item ); m_iface->DisplayItem( l ); if( l->EndsWithVia() ) m_iface->DisplayItem( &l->Via() ); } - //PNS_ITEMSET tmp( ¤t ); + //ITEM_SET tmp( ¤t ); updateView( m_placer->CurrentNode( true ), current ); } -void PNS_ROUTER::CommitRouting( PNS_NODE* aNode ) +void ROUTER::CommitRouting( NODE* aNode ) { - PNS_NODE::ITEM_VECTOR removed, added; + NODE::ITEM_VECTOR removed, added; aNode->GetUpdatedItems( removed, added ); @@ -345,7 +345,7 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode ) } -bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) +bool ROUTER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) { bool rv = false; @@ -370,7 +370,7 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) } -void PNS_ROUTER::StopRouting() +void ROUTER::StopRouting() { // Update the ratsnest with new changes @@ -404,7 +404,7 @@ void PNS_ROUTER::StopRouting() } -void PNS_ROUTER::FlipPosture() +void ROUTER::FlipPosture() { if( m_state == ROUTE_TRACK ) { @@ -413,7 +413,7 @@ void PNS_ROUTER::FlipPosture() } -void PNS_ROUTER::SwitchLayer( int aLayer ) +void ROUTER::SwitchLayer( int aLayer ) { switch( m_state ) { @@ -426,7 +426,7 @@ void PNS_ROUTER::SwitchLayer( int aLayer ) } -void PNS_ROUTER::ToggleViaPlacement() +void ROUTER::ToggleViaPlacement() { if( m_state == ROUTE_TRACK ) { @@ -436,7 +436,7 @@ void PNS_ROUTER::ToggleViaPlacement() } -const std::vector PNS_ROUTER::GetCurrentNets() const +const std::vector ROUTER::GetCurrentNets() const { if( m_placer ) return m_placer->CurrentNets(); @@ -445,7 +445,7 @@ const std::vector PNS_ROUTER::GetCurrentNets() const } -int PNS_ROUTER::GetCurrentLayer() const +int ROUTER::GetCurrentLayer() const { if( m_placer ) return m_placer->CurrentLayer(); @@ -453,9 +453,9 @@ int PNS_ROUTER::GetCurrentLayer() const } -void PNS_ROUTER::DumpLog() +void ROUTER::DumpLog() { - PNS_LOGGER* logger = NULL; + LOGGER* logger = NULL; switch( m_state ) { @@ -476,7 +476,7 @@ void PNS_ROUTER::DumpLog() } -bool PNS_ROUTER::IsPlacingVia() const +bool ROUTER::IsPlacingVia() const { if( !m_placer ) return false; @@ -485,7 +485,7 @@ bool PNS_ROUTER::IsPlacingVia() const } -void PNS_ROUTER::SetOrthoMode( bool aEnable ) +void ROUTER::SetOrthoMode( bool aEnable ) { if( !m_placer ) return; @@ -494,12 +494,12 @@ void PNS_ROUTER::SetOrthoMode( bool aEnable ) } -void PNS_ROUTER::SetMode( PNS_ROUTER_MODE aMode ) +void ROUTER::SetMode( ROUTER_MODE aMode ) { m_mode = aMode; } -void PNS_ROUTER::SetInterface( PNS_ROUTER_IFACE *aIface ) +void ROUTER::SetInterface( ROUTER_IFACE *aIface ) { m_iface = aIface; m_iface->SetRouter( this ); diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index 997bd8fefc..e77c2e3b97 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -45,22 +45,22 @@ class VIEW_GROUP; namespace PNS { -class PNS_DEBUG_DECORATOR; -class PNS_NODE; -class PNS_DIFF_PAIR_PLACER; -class PNS_PLACEMENT_ALGO; -class PNS_LINE_PLACER; -class PNS_ITEM; -class PNS_LINE; -class PNS_SOLID; -class PNS_SEGMENT; -class PNS_JOINT; -class PNS_VIA; -class PNS_RULE_RESOLVER; -class PNS_SHOVE; -class PNS_DRAGGER; +class DEBUG_DECORATOR; +class NODE; +class DIFF_PAIR_PLACER; +class PLACEMENT_ALGO; +class LINE_PLACER; +class ITEM; +class LINE; +class SOLID; +class SEGMENT; +class JOINT; +class VIA; +class RULE_RESOLVER; +class SHOVE; +class DRAGGER; -enum PNS_ROUTER_MODE { +enum ROUTER_MODE { PNS_MODE_ROUTE_SINGLE = 1, PNS_MODE_ROUTE_DIFF_PAIR, PNS_MODE_TUNE_SINGLE, @@ -69,34 +69,34 @@ enum PNS_ROUTER_MODE { }; /** - * Class PNS_ROUTER + * Class ROUTER * * Main router class. */ - class PNS_ROUTER_IFACE + class ROUTER_IFACE { public: - PNS_ROUTER_IFACE() {}; - virtual ~PNS_ROUTER_IFACE() {}; + ROUTER_IFACE() {}; + virtual ~ROUTER_IFACE() {}; - virtual void SetRouter( PNS_ROUTER* aRouter ) = 0; - virtual void SyncWorld( PNS_NODE* aNode ) = 0; - virtual void AddItem( PNS_ITEM* aItem ) = 0; - virtual void RemoveItem( PNS_ITEM* aItem ) = 0; - virtual void DisplayItem( const PNS_ITEM* aItem, int aColor = -1, int aClearance = -1 ) = 0; - virtual void HideItem( PNS_ITEM* aItem ) = 0; + virtual void SetRouter( ROUTER* aRouter ) = 0; + virtual void SyncWorld( NODE* aNode ) = 0; + virtual void AddItem( ITEM* aItem ) = 0; + virtual void RemoveItem( ITEM* aItem ) = 0; + virtual void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1 ) = 0; + virtual void HideItem( ITEM* aItem ) = 0; virtual void Commit() = 0; // virtual void Abort () = 0; virtual void EraseView() = 0; virtual void UpdateNet( int aNetCode ) = 0; - virtual PNS_RULE_RESOLVER* GetRuleResolver() = 0; - virtual PNS_DEBUG_DECORATOR* GetDebugDecorator() = 0; + virtual RULE_RESOLVER* GetRuleResolver() = 0; + virtual DEBUG_DECORATOR* GetDebugDecorator() = 0; }; -class PNS_ROUTER +class ROUTER { private: enum RouterState @@ -107,14 +107,14 @@ private: }; public: - PNS_ROUTER(); - ~PNS_ROUTER(); + ROUTER(); + ~ROUTER(); - void SetInterface( PNS_ROUTER_IFACE* aIface ); - void SetMode ( PNS_ROUTER_MODE aMode ); - PNS_ROUTER_MODE Mode() const { return m_mode; } + void SetInterface( ROUTER_IFACE* aIface ); + void SetMode ( ROUTER_MODE aMode ); + ROUTER_MODE Mode() const { return m_mode; } - static PNS_ROUTER* GetInstance(); + static ROUTER* GetInstance(); void ClearWorld(); void SyncWorld(); @@ -122,24 +122,24 @@ public: void SetView( KIGFX::VIEW* aView ); bool RoutingInProgress() const; - bool StartRouting( const VECTOR2I& aP, PNS_ITEM* aItem, int aLayer ); - void Move( const VECTOR2I& aP, PNS_ITEM* aItem ); - bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aItem ); + bool StartRouting( const VECTOR2I& aP, ITEM* aItem, int aLayer ); + void Move( const VECTOR2I& aP, ITEM* aItem ); + bool FixRoute( const VECTOR2I& aP, ITEM* aItem ); void StopRouting(); - int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const; + int GetClearance( const ITEM* aA, const ITEM* aB ) const; - PNS_NODE* GetWorld() const + NODE* GetWorld() const { return m_world; } void FlipPosture(); - void DisplayItem( const PNS_ITEM* aItem, int aColor = -1, int aClearance = -1 ); - void DisplayItems( const PNS_ITEMSET& aItems ); - void DeleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack ); + void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1 ); + void DisplayItems( const ITEM_SET& aItems ); + void DeleteTraces( ITEM* aStartItem, bool aWholeTrack ); void SwitchLayer( int layer ); void ToggleViaPlacement(); @@ -150,17 +150,17 @@ public: void DumpLog(); - PNS_RULE_RESOLVER* GetRuleResolver() const + RULE_RESOLVER* GetRuleResolver() const { return m_iface->GetRuleResolver(); } bool IsPlacingVia() const; - const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP ); - const VECTOR2I SnapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ); + const ITEM_SET QueryHoverItems( const VECTOR2I& aP ); + const VECTOR2I SnapToItem( ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ); - bool StartDragging( const VECTOR2I& aP, PNS_ITEM* aItem ); + bool StartDragging( const VECTOR2I& aP, ITEM* aItem ); void SetIterLimit( int aX ) { m_iterLimit = aX; } int GetIterLimit() const { return m_iterLimit; }; @@ -174,21 +174,21 @@ public: bool GetShowIntermediateSteps() const { return m_showInterSteps; } int GetShapshotIter() const { return m_snapshotIter; } - PNS_ROUTING_SETTINGS& Settings() { return m_settings; } + ROUTING_SETTINGS& Settings() { return m_settings; } - void CommitRouting( PNS_NODE* aNode ); + void CommitRouting( NODE* aNode ); /** * Applies stored settings. * @see Settings() */ - void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes ); + void UpdateSizes( const SIZES_SETTINGS& aSizes ); /** * Changes routing settings to ones passed in the parameter. * @param aSettings are the new settings. */ - void LoadSettings( const PNS_ROUTING_SETTINGS& aSettings ) + void LoadSettings( const ROUTING_SETTINGS& aSettings ) { m_settings = aSettings; } @@ -203,59 +203,59 @@ public: return m_snappingEnabled; } - PNS_SIZES_SETTINGS& Sizes() + SIZES_SETTINGS& Sizes() { return m_sizes; } - PNS_ITEM* QueryItemByParent( const BOARD_ITEM* aItem ) const; + ITEM* QueryItemByParent( const BOARD_ITEM* aItem ) const; void SetFailureReason ( const wxString& aReason ) { m_failureReason = aReason; } const wxString& FailureReason() const { return m_failureReason; } - PNS_PLACEMENT_ALGO* Placer() { return m_placer; } + PLACEMENT_ALGO* Placer() { return m_placer; } - PNS_ROUTER_IFACE* GetInterface() const + ROUTER_IFACE* GetInterface() const { return m_iface; } private: - void movePlacing( const VECTOR2I& aP, PNS_ITEM* aItem ); - void moveDragging( const VECTOR2I& aP, PNS_ITEM* aItem ); + void movePlacing( const VECTOR2I& aP, ITEM* aItem ); + void moveDragging( const VECTOR2I& aP, ITEM* aItem ); void eraseView(); - void updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ); + void updateView( NODE* aNode, ITEM_SET& aCurrent ); void clearViewFlags(); // optHoverItem queryHoverItemEx(const VECTOR2I& aP); - PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const; - void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP ); + ITEM* pickSingleItem( ITEM_SET& aItems ) const; + void splitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP ); - PNS_ITEM* syncPad( D_PAD* aPad ); - PNS_ITEM* syncTrack( TRACK* aTrack ); - PNS_ITEM* syncVia( VIA* aVia ); + ITEM* syncPad( D_PAD* aPad ); + ITEM* syncTrack( TRACK* aTrack ); + ITEM* syncVia( VIA* aVia ); - void commitPad( PNS_SOLID* aPad ); - void commitSegment( PNS_SEGMENT* aTrack ); - void commitVia( PNS_VIA* aVia ); + void commitPad( SOLID* aPad ); + void commitSegment( SEGMENT* aTrack ); + void commitVia( VIA* aVia ); void highlightCurrent( bool enabled ); - void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved ); + void markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR& aRemoved ); VECTOR2I m_currentEnd; RouterState m_state; - PNS_NODE* m_world; - PNS_NODE* m_lastNode; - PNS_PLACEMENT_ALGO * m_placer; - PNS_DRAGGER* m_dragger; - PNS_SHOVE* m_shove; - PNS_ROUTER_IFACE* m_iface; + NODE* m_world; + NODE* m_lastNode; + PLACEMENT_ALGO * m_placer; + DRAGGER* m_dragger; + SHOVE* m_shove; + ROUTER_IFACE* m_iface; int m_iterLimit; bool m_showInterSteps; @@ -266,10 +266,10 @@ private: bool m_snappingEnabled; bool m_violation; - PNS_ROUTING_SETTINGS m_settings; + ROUTING_SETTINGS m_settings; ///> Stores list of modified items in the current operation - PNS_SIZES_SETTINGS m_sizes; - PNS_ROUTER_MODE m_mode; + SIZES_SETTINGS m_sizes; + ROUTER_MODE m_mode; wxString m_toolStatusbarName; wxString m_failureReason; diff --git a/pcbnew/router/pns_routing_settings.cpp b/pcbnew/router/pns_routing_settings.cpp index 59340a31b2..b000eb4f8b 100644 --- a/pcbnew/router/pns_routing_settings.cpp +++ b/pcbnew/router/pns_routing_settings.cpp @@ -26,7 +26,7 @@ namespace PNS { -PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS() +ROUTING_SETTINGS::ROUTING_SETTINGS() { m_routingMode = RM_Walkaround; m_optimizerEffort = OE_MEDIUM; @@ -47,7 +47,7 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS() } -void PNS_ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const +void ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const { aSettings.Set( "Mode", (int) m_routingMode ); aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort ); @@ -67,7 +67,7 @@ void PNS_ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const } -void PNS_ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings ) +void ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings ) { m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround ); m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM ); @@ -87,7 +87,7 @@ void PNS_ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings ) } -const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const +const DIRECTION_45 ROUTING_SETTINGS::InitialDirection() const { if( m_startDiagonal ) return DIRECTION_45( DIRECTION_45::NE ); @@ -96,13 +96,13 @@ const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const } -TIME_LIMIT PNS_ROUTING_SETTINGS::ShoveTimeLimit() const +TIME_LIMIT ROUTING_SETTINGS::ShoveTimeLimit() const { return TIME_LIMIT ( m_shoveTimeLimit ); } -int PNS_ROUTING_SETTINGS::ShoveIterationLimit() const +int ROUTING_SETTINGS::ShoveIterationLimit() const { return m_shoveIterationLimit; } diff --git a/pcbnew/router/pns_routing_settings.h b/pcbnew/router/pns_routing_settings.h index 6a2450cadd..b386c3baac 100644 --- a/pcbnew/router/pns_routing_settings.h +++ b/pcbnew/router/pns_routing_settings.h @@ -49,15 +49,15 @@ enum PNS_OPTIMIZATION_EFFORT }; /** - * Class PNS_ROUTING_SETTINGS + * Class ROUTING_SETTINGS * * Contains all persistent settings of the router, such as the mode, optimization effort, etc. */ -class PNS_ROUTING_SETTINGS +class ROUTING_SETTINGS { public: - PNS_ROUTING_SETTINGS(); + ROUTING_SETTINGS(); void Load( const TOOL_SETTINGS& where ); void Save( TOOL_SETTINGS& where ) const; diff --git a/pcbnew/router/pns_segment.h b/pcbnew/router/pns_segment.h index 1070ae4a8b..7cf94ba283 100644 --- a/pcbnew/router/pns_segment.h +++ b/pcbnew/router/pns_segment.h @@ -33,23 +33,23 @@ namespace PNS { -class PNS_NODE; +class NODE; -class PNS_SEGMENT : public PNS_ITEM +class SEGMENT : public ITEM { public: - PNS_SEGMENT() : - PNS_ITEM( SEGMENT_T ) + SEGMENT() : + ITEM( SEGMENT_T ) {} - PNS_SEGMENT( const SEG& aSeg, int aNet ) : - PNS_ITEM( SEGMENT_T ), m_seg( aSeg, 0 ) + SEGMENT( const SEG& aSeg, int aNet ) : + ITEM( SEGMENT_T ), m_seg( aSeg, 0 ) { m_net = aNet; } - PNS_SEGMENT( const PNS_LINE& aParentLine, const SEG& aSeg ) : - PNS_ITEM( SEGMENT_T ), + SEGMENT( const LINE& aParentLine, const SEG& aSeg ) : + ITEM( SEGMENT_T ), m_seg( aSeg, aParentLine.Width() ) { m_net = aParentLine.Net(); @@ -58,12 +58,12 @@ public: m_rank = aParentLine.Rank(); } - static inline bool ClassOf( const PNS_ITEM* aItem ) + static inline bool ClassOf( const ITEM* aItem ) { return aItem && SEGMENT_T == aItem->Kind(); } - PNS_SEGMENT* Clone() const; + SEGMENT* Clone() const; const SHAPE* Shape() const { @@ -72,7 +72,7 @@ public: void SetLayer( int aLayer ) { - SetLayers( PNS_LAYERSET( aLayer ) ); + SetLayers( LAYER_RANGE( aLayer ) ); } int Layer() const diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index d173792f25..0630d9f7f7 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -45,7 +45,7 @@ namespace PNS { -void PNS_SHOVE::replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew ) +void SHOVE::replaceItems( ITEM* aOld, ITEM* aNew ) { OPT_BOX2I changed_area = ChangedArea( aOld, aNew ); @@ -58,7 +58,7 @@ void PNS_SHOVE::replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew ) } -int PNS_SHOVE::getClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const +int SHOVE::getClearance( const ITEM* aA, const ITEM* aB ) const { if( m_forceClearance >= 0 ) return m_forceClearance; @@ -67,15 +67,15 @@ int PNS_SHOVE::getClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const } -void PNS_SHOVE::sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew ) +void SHOVE::sanityCheck( LINE* aOld, LINE* aNew ) { assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) ); assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) ); } -PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) : - PNS_ALGO_BASE( aRouter ) +SHOVE::SHOVE( NODE* aWorld, ROUTER* aRouter ) : + ALGO_BASE( aRouter ) { m_forceClearance = -1; m_root = aWorld; @@ -88,21 +88,21 @@ PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) : } -PNS_SHOVE::~PNS_SHOVE() +SHOVE::~SHOVE() { } -PNS_LINE PNS_SHOVE::assembleLine( const PNS_SEGMENT* aSeg, int* aIndex ) +LINE SHOVE::assembleLine( const SEGMENT* aSeg, int* aIndex ) { - return m_currentNode->AssembleLine( const_cast( aSeg ), aIndex, true ); + return m_currentNode->AssembleLine( const_cast( aSeg ), aIndex, true ); } // A dumb function that checks if the shoved line is shoved the right way, e.g. // visually "outwards" of the line/via applying pressure on it. Unfortunately there's no // mathematical concept of orientation of an open curve, so we use some primitive heuristics: // if the shoved line wraps around the start of the "pusher", it's likely shoved in wrong direction. -bool PNS_SHOVE::checkBumpDirection( const PNS_LINE& aCurrent, const PNS_LINE& aShoved ) const +bool SHOVE::checkBumpDirection( const LINE& aCurrent, const LINE& aShoved ) const { const SEG& ss = aCurrent.CSegment( 0 ); @@ -117,8 +117,8 @@ bool PNS_SHOVE::checkBumpDirection( const PNS_LINE& aCurrent, const PNS_LINE& aS } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::walkaroundLoneVia( PNS_LINE& aCurrent, PNS_LINE& aObstacle, - PNS_LINE& aShoved ) +SHOVE::SHOVE_STATUS SHOVE::walkaroundLoneVia( LINE& aCurrent, LINE& aObstacle, + LINE& aShoved ) { int clearance = getClearance( &aCurrent, &aObstacle ); const SHAPE_LINE_CHAIN hull = aCurrent.Via().Hull( clearance, aObstacle.Width() ); @@ -147,8 +147,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::walkaroundLoneVia( PNS_LINE& aCurrent, PNS_LI } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& aObstacle, - PNS_LINE& aShoved, const HULL_SET& aHulls ) +SHOVE::SHOVE_STATUS SHOVE::processHullSet( LINE& aCurrent, LINE& aObstacle, + LINE& aShoved, const HULL_SET& aHulls ) { const SHAPE_LINE_CHAIN& obs = aObstacle.CLine(); @@ -161,7 +161,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& int vFirst = -1, vLast = -1; SHAPE_LINE_CHAIN path; - PNS_LINE l( aObstacle ); + LINE l( aObstacle ); for( int i = 0; i < (int) aHulls.size(); i++ ) { @@ -217,13 +217,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& continue; } - bool colliding = m_currentNode->CheckColliding( &l, &aCurrent, PNS_ITEM::ANY_T, m_forceClearance ); + bool colliding = m_currentNode->CheckColliding( &l, &aCurrent, ITEM::ANY_T, m_forceClearance ); if( ( aCurrent.Marker() & MK_HEAD ) && !colliding ) { - PNS_JOINT* jtStart = m_currentNode->FindJoint( aCurrent.CPoint( 0 ), &aCurrent ); + JOINT* jtStart = m_currentNode->FindJoint( aCurrent.CPoint( 0 ), &aCurrent ); - for( PNS_ITEM* item : jtStart->LinkList() ) + for( ITEM* item : jtStart->LinkList() ) { if( m_currentNode->CheckColliding( item, &l ) ) colliding = true; @@ -245,8 +245,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LINE& aObstacle, - PNS_LINE& aShoved ) +SHOVE::SHOVE_STATUS SHOVE::ProcessSingleLine( LINE& aCurrent, LINE& aObstacle, + LINE& aShoved ) { aShoved.ClearSegmentLinks(); @@ -254,7 +254,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI if( aObstacle.LinkedSegments() ) { - for( PNS_SEGMENT* s : *aObstacle.LinkedSegments() ) + for( SEGMENT* s : *aObstacle.LinkedSegments() ) if( s->Marker() & MK_HEAD ) { @@ -284,7 +284,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI for( int i = 0; i < n_segs; i++ ) { - PNS_SEGMENT seg( aCurrent, aCurrent.CSegment( i ) ); + SEGMENT seg( aCurrent, aCurrent.CSegment( i ) ); SHAPE_LINE_CHAIN hull = seg.Hull( clearance, w ); hulls.push_back( hull ); @@ -303,12 +303,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE& aCurrent, PNS_SEGMENT* aObstacleSeg ) +SHOVE::SHOVE_STATUS SHOVE::onCollidingSegment( LINE& aCurrent, SEGMENT* aObstacleSeg ) { int segIndex; - PNS_LINE obstacleLine = assembleLine( aObstacleSeg, &segIndex ); - PNS_LINE shovedLine( obstacleLine ); - PNS_SEGMENT tmp( *aObstacleSeg ); + LINE obstacleLine = assembleLine( aObstacleSeg, &segIndex ); + LINE shovedLine( obstacleLine ); + SEGMENT tmp( *aObstacleSeg ); if( obstacleLine.HasLockedSegments() ) return SH_TRY_WALK; @@ -361,9 +361,9 @@ 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 ) +SHOVE::SHOVE_STATUS SHOVE::onCollidingLine( LINE& aCurrent, LINE& aObstacle ) { - PNS_LINE shovedLine( aObstacle ); + LINE shovedLine( aObstacle ); SHOVE_STATUS rv = ProcessSingleLine( aCurrent, aObstacle, shovedLine ); @@ -400,25 +400,25 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE& aCurrent, PNS_LINE return rv; } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITEM* aObstacle ) +SHOVE::SHOVE_STATUS SHOVE::onCollidingSolid( LINE& aCurrent, ITEM* aObstacle ) { - PNS_WALKAROUND walkaround( m_currentNode, Router() ); - PNS_LINE walkaroundLine( aCurrent ); + WALKAROUND walkaround( m_currentNode, Router() ); + LINE walkaroundLine( aCurrent ); if( aCurrent.EndsWithVia() ) { - PNS_VIA vh = aCurrent.Via(); - PNS_VIA* via = NULL; - PNS_JOINT* jtStart = m_currentNode->FindJoint( vh.Pos(), &aCurrent ); + VIA vh = aCurrent.Via(); + VIA* via = NULL; + JOINT* jtStart = m_currentNode->FindJoint( vh.Pos(), &aCurrent ); if( !jtStart ) return SH_INCOMPLETE; - for( PNS_ITEM* item : jtStart->LinkList() ) + for( ITEM* item : jtStart->LinkList() ) { - if( item->OfKind( PNS_ITEM::VIA_T ) ) + if( item->OfKind( ITEM::VIA_T ) ) { - via = (PNS_VIA*) item; + via = (VIA*) item; break; } } @@ -427,13 +427,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE return onCollidingVia( aObstacle, via ); } - PNS_TOPOLOGY topo( m_currentNode ); + TOPOLOGY topo( m_currentNode ); - std::set cluster = topo.AssembleCluster( aObstacle, aCurrent.Layers().Start() ); + std::set cluster = topo.AssembleCluster( aObstacle, aCurrent.Layers().Start() ); #ifdef DEBUG m_logger.NewGroup( "on-colliding-solid-cluster", m_iter ); - for( PNS_ITEM* item : cluster ) + for( ITEM* item : cluster ) { m_logger.Log( item, 0, "cluster-entry" ); } @@ -463,9 +463,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE } - PNS_WALKAROUND::WALKAROUND_STATUS status = walkaround.Route( aCurrent, walkaroundLine, false ); + WALKAROUND::WALKAROUND_STATUS status = walkaround.Route( aCurrent, walkaroundLine, false ); - if( status != PNS_WALKAROUND::DONE ) + if( status != WALKAROUND::DONE ) continue; walkaroundLine.ClearSegmentLinks(); @@ -489,11 +489,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE if( !m_lineStack.empty() ) { - PNS_LINE lastLine = m_lineStack.front(); + LINE lastLine = m_lineStack.front(); if( m_currentNode->CheckColliding( &lastLine, &walkaroundLine ) ) { - PNS_LINE dummy( lastLine ); + LINE dummy( lastLine ); if( ProcessSingleLine( walkaroundLine, lastLine, dummy ) == SH_OK ) { @@ -529,7 +529,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE } -bool PNS_SHOVE::reduceSpringback( const PNS_ITEMSET& aHeadSet ) +bool SHOVE::reduceSpringback( const ITEM_SET& aHeadSet ) { bool rv = false; @@ -552,8 +552,8 @@ bool PNS_SHOVE::reduceSpringback( const PNS_ITEMSET& aHeadSet ) } -bool PNS_SHOVE::pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET& aHeadItems, - const PNS_COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea ) +bool SHOVE::pushSpringback( NODE* aNode, const ITEM_SET& aHeadItems, + const COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea ) { SPRINGBACK_TAG st; OPT_BOX2I prev_area; @@ -580,11 +580,11 @@ bool PNS_SHOVE::pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET& aHeadItems, } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun ) +SHOVE::SHOVE_STATUS SHOVE::pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun ) { LINE_PAIR_VEC draggedLines; VECTOR2I p0( aVia->Pos() ); - PNS_JOINT* jt = m_currentNode->FindJoint( p0, aVia ); + JOINT* jt = m_currentNode->FindJoint( p0, aVia ); VECTOR2I p0_pushed( p0 + aForce ); if( !jt ) @@ -601,7 +601,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc while( aForce.x != 0 || aForce.y != 0 ) { - PNS_JOINT* jt_next = m_currentNode->FindJoint( p0_pushed, aVia ); + JOINT* jt_next = m_currentNode->FindJoint( p0_pushed, aVia ); if( !jt_next ) break; @@ -609,7 +609,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc p0_pushed += aForce.Resize( 2 ); // make sure pushed via does not overlap with any existing joint } - PNS_VIA* pushedVia = aVia->Clone(); + VIA* pushedVia = aVia->Clone(); pushedVia->SetPos( p0_pushed ); pushedVia->Mark( aVia->Marker() ); @@ -619,9 +619,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc m_draggedViaHeadSet.Clear(); } - for( PNS_ITEM* item : jt->LinkList() ) + for( ITEM* item : jt->LinkList() ) { - if( PNS_SEGMENT* seg = dyn_cast( item ) ) + if( SEGMENT* seg = dyn_cast( item ) ) { LINE_PAIR lp; int segIndex; @@ -701,23 +701,23 @@ 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 ) +SHOVE::SHOVE_STATUS SHOVE::onCollidingVia( ITEM* aCurrent, VIA* aObstacleVia ) { int clearance = getClearance( aCurrent, aObstacleVia ) ; LINE_PAIR_VEC draggedLines; bool colLine = false, colVia = false; - PNS_LINE* currentLine = NULL; + LINE* currentLine = NULL; VECTOR2I mtvLine, mtvVia, mtv, mtvSolid; int rank = -1; - if( aCurrent->OfKind( PNS_ITEM::LINE_T ) ) + if( aCurrent->OfKind( ITEM::LINE_T ) ) { #ifdef DEBUG m_logger.NewGroup( "push-via-by-line", m_iter ); m_logger.Log( aCurrent, 4, "current" ); #endif - currentLine = (PNS_LINE*) aCurrent; + currentLine = (LINE*) aCurrent; colLine = CollideShapes( aObstacleVia->Shape(), currentLine->Shape(), clearance + currentLine->Width() / 2 + PNS_HULL_MARGIN, true, mtvLine ); @@ -738,7 +738,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* rank = currentLine->Rank(); } - else if( aCurrent->OfKind( PNS_ITEM::SOLID_T ) ) + else if( aCurrent->OfKind( ITEM::SOLID_T ) ) { CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(), clearance + PNS_HULL_MARGIN, true, mtvSolid ); @@ -750,25 +750,25 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PNS_VIA* aObstacleVia ) +SHOVE::SHOVE_STATUS SHOVE::onReverseCollidingVia( LINE& aCurrent, VIA* aObstacleVia ) { int n = 0; - PNS_LINE cur( aCurrent ); + LINE cur( aCurrent ); cur.ClearSegmentLinks(); - PNS_JOINT* jt = m_currentNode->FindJoint( aObstacleVia->Pos(), aObstacleVia ); - PNS_LINE shoved( aCurrent ); + JOINT* jt = m_currentNode->FindJoint( aObstacleVia->Pos(), aObstacleVia ); + LINE shoved( aCurrent ); shoved.ClearSegmentLinks(); cur.RemoveVia(); unwindStack( &aCurrent ); - for( PNS_ITEM* item : jt->LinkList() ) + for( ITEM* item : jt->LinkList() ) { - if( item->OfKind( PNS_ITEM::SEGMENT_T ) && item->LayersOverlap( &aCurrent ) ) + if( item->OfKind( ITEM::SEGMENT_T ) && item->LayersOverlap( &aCurrent ) ) { - PNS_SEGMENT* seg = (PNS_SEGMENT*) item; - PNS_LINE head = assembleLine( seg ); + SEGMENT* seg = (SEGMENT*) item; + LINE head = assembleLine( seg ); head.AppendVia( *aObstacleVia ); @@ -799,7 +799,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PN m_logger.Log( &aCurrent, 1, "current-line" ); #endif - PNS_LINE head( aCurrent ); + LINE head( aCurrent ); head.Line().Clear(); head.AppendVia( *aObstacleVia ); head.ClearSegmentLinks(); @@ -833,9 +833,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PN } -void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg ) +void SHOVE::unwindStack( SEGMENT* aSeg ) { - for( std::vector::iterator i = m_lineStack.begin(); i != m_lineStack.end() ; ) + for( std::vector::iterator i = m_lineStack.begin(); i != m_lineStack.end() ; ) { if( i->ContainsSegment( aSeg ) ) i = m_lineStack.erase( i ); @@ -843,7 +843,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg ) i++; } - for( std::vector::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end() ; ) + for( std::vector::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end() ; ) { if( i->ContainsSegment( aSeg ) ) i = m_optimizerQueue.erase( i ); @@ -853,24 +853,24 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg ) } -void PNS_SHOVE::unwindStack( PNS_ITEM* aItem ) +void SHOVE::unwindStack( ITEM* aItem ) { - if( aItem->OfKind( PNS_ITEM::SEGMENT_T ) ) - unwindStack( static_cast( aItem ) ); - else if( aItem->OfKind( PNS_ITEM::LINE_T ) ) + if( aItem->OfKind( ITEM::SEGMENT_T ) ) + unwindStack( static_cast( aItem ) ); + else if( aItem->OfKind( ITEM::LINE_T ) ) { - PNS_LINE* l = static_cast( aItem ); + LINE* l = static_cast( aItem ); if( !l->LinkedSegments() ) return; - for( PNS_SEGMENT* seg : *l->LinkedSegments() ) + for( SEGMENT* seg : *l->LinkedSegments() ) unwindStack( seg ); } } -bool PNS_SHOVE::pushLine( const PNS_LINE& aL, bool aKeepCurrentOnTop ) +bool SHOVE::pushLine( const LINE& aL, bool aKeepCurrentOnTop ) { if( aL.LinkCount() >= 0 && ( aL.LinkCount() != aL.SegmentCount() ) ) return false; @@ -889,18 +889,18 @@ bool PNS_SHOVE::pushLine( const PNS_LINE& aL, bool aKeepCurrentOnTop ) return true; } -void PNS_SHOVE::popLine( ) +void SHOVE::popLine( ) { - PNS_LINE& l = m_lineStack.back(); + LINE& l = m_lineStack.back(); - for( std::vector::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end(); ) + for( std::vector::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end(); ) { bool found = false; if( !l.LinkedSegments() ) continue; - for( PNS_SEGMENT *s : *l.LinkedSegments() ) + for( SEGMENT *s : *l.LinkedSegments() ) { if( i->ContainsSegment( s ) ) { @@ -918,13 +918,13 @@ void PNS_SHOVE::popLine( ) } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) +SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter ) { - PNS_LINE currentLine = m_lineStack.back(); - PNS_NODE::OPT_OBSTACLE nearest; + LINE currentLine = m_lineStack.back(); + NODE::OPT_OBSTACLE nearest; SHOVE_STATUS st = SH_NULL; - PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID_T, PNS_ITEM::VIA_T, PNS_ITEM::SEGMENT_T }; + ITEM::PnsKind search_order[] = { ITEM::SOLID_T, ITEM::VIA_T, ITEM::SEGMENT_T }; for( int i = 0; i < 3; i++ ) { @@ -940,17 +940,17 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) return SH_OK; } - PNS_ITEM* ni = nearest->m_item; + ITEM* ni = nearest->m_item; unwindStack( ni ); - if( !ni->OfKind( PNS_ITEM::SOLID_T ) && ni->Rank() >= 0 && ni->Rank() > currentLine.Rank() ) + if( !ni->OfKind( ITEM::SOLID_T ) && ni->Rank() >= 0 && ni->Rank() > currentLine.Rank() ) { switch( ni->Kind() ) { - case PNS_ITEM::VIA_T: + case ITEM::VIA_T: { - PNS_VIA* revVia = (PNS_VIA*) ni; + VIA* revVia = (VIA*) ni; wxLogTrace( "PNS", "iter %d: reverse-collide-via", aIter ); if( currentLine.EndsWithVia() && m_currentNode->CheckColliding( ¤tLine.Via(), revVia ) ) @@ -965,11 +965,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) break; } - case PNS_ITEM::SEGMENT_T: + case ITEM::SEGMENT_T: { - PNS_SEGMENT* seg = (PNS_SEGMENT*) ni; + SEGMENT* seg = (SEGMENT*) ni; wxLogTrace( "PNS", "iter %d: reverse-collide-segment ", aIter ); - PNS_LINE revLine = assembleLine( seg ); + LINE revLine = assembleLine( seg ); popLine(); st = onCollidingLine( revLine, currentLine ); @@ -987,10 +987,10 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) { // "forward" collisions switch( ni->Kind() ) { - case PNS_ITEM::SEGMENT_T: + case ITEM::SEGMENT_T: wxLogTrace( "PNS", "iter %d: collide-segment ", aIter ); - st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni ); + st = onCollidingSegment( currentLine, (SEGMENT*) ni ); if( st == SH_TRY_WALK ) { @@ -998,9 +998,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) } break; - case PNS_ITEM::VIA_T: + case ITEM::VIA_T: wxLogTrace( "PNS", "iter %d: shove-via ", aIter ); - st = onCollidingVia( ¤tLine, (PNS_VIA*) ni ); + st = onCollidingVia( ¤tLine, (VIA*) ni ); if( st == SH_TRY_WALK ) { @@ -1008,9 +1008,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) } break; - case PNS_ITEM::SOLID_T: + case ITEM::SOLID_T: wxLogTrace( "PNS", "iter %d: walk-solid ", aIter ); - st = onCollidingSolid( currentLine, (PNS_SOLID*) ni ); + st = onCollidingSolid( currentLine, (SOLID*) ni ); break; default: @@ -1022,7 +1022,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveMainLoop() +SHOVE::SHOVE_STATUS SHOVE::shoveMainLoop() { SHOVE_STATUS st = SH_OK; @@ -1055,7 +1055,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveMainLoop() } -OPT_BOX2I PNS_SHOVE::totalAffectedArea() const +OPT_BOX2I SHOVE::totalAffectedArea() const { OPT_BOX2I area; if( !m_nodeStack.empty() ) @@ -1072,7 +1072,7 @@ OPT_BOX2I PNS_SHOVE::totalAffectedArea() const } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) +SHOVE::SHOVE_STATUS SHOVE::ShoveLines( const LINE& aCurrentHead ) { SHOVE_STATUS st = SH_OK; @@ -1083,7 +1083,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) if( !aCurrentHead.SegmentCount() && !aCurrentHead.EndsWithVia() ) return SH_INCOMPLETE; - PNS_LINE head( aCurrentHead ); + LINE head( aCurrentHead ); head.ClearSegmentLinks(); m_lineStack.clear(); @@ -1091,12 +1091,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) m_newHead = OPT_LINE(); m_logger.Clear(); - PNS_ITEMSET headSet; + ITEM_SET headSet; headSet.Add( aCurrentHead ); reduceSpringback( headSet ); - PNS_NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node; + NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node; m_currentNode = parent->Branch(); m_currentNode->ClearRanks(); @@ -1113,7 +1113,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) m_logger.NewGroup( "initial", 0 ); m_logger.Log( &head, 0, "head" ); - PNS_VIA* headVia = NULL; + VIA* headVia = NULL; if( head.EndsWithVia() ) { @@ -1151,7 +1151,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) if( st == SH_OK || st == SH_HEAD_MODIFIED ) { - pushSpringback( m_currentNode, headSet, PNS_COST_ESTIMATOR(), m_affectedAreaSum ); + pushSpringback( m_currentNode, headSet, COST_ESTIMATOR(), m_affectedAreaSum ); } else { @@ -1166,7 +1166,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) if( m_newHead && head.EndsWithVia() ) { - PNS_VIA v = head.Via(); + VIA v = head.Via(); v.SetPos( m_newHead->CPoint( -1 ) ); m_newHead->AppendVia(v); } @@ -1175,17 +1175,17 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet ) +SHOVE::SHOVE_STATUS SHOVE::ShoveMultiLines( const ITEM_SET& aHeadSet ) { SHOVE_STATUS st = SH_OK; m_multiLineMode = true; - PNS_ITEMSET headSet; + ITEM_SET headSet; - for( const PNS_ITEM* item : aHeadSet.CItems() ) + for( const ITEM* item : aHeadSet.CItems() ) { - const PNS_LINE* headOrig = static_cast( item ); + const LINE* headOrig = static_cast( item ); // empty head? nothing to shove... if( !headOrig->SegmentCount() ) @@ -1200,16 +1200,16 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet reduceSpringback( headSet ); - PNS_NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node; + NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node; m_currentNode = parent->Branch(); m_currentNode->ClearRanks(); int n = 0; - for( const PNS_ITEM* item : aHeadSet.CItems() ) + for( const ITEM* item : aHeadSet.CItems() ) { - const PNS_LINE* headOrig = static_cast( item ); - PNS_LINE head( *headOrig ); + const LINE* headOrig = static_cast( item ); + LINE head( *headOrig ); head.ClearSegmentLinks(); m_currentNode->Add( &head ); @@ -1221,7 +1221,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet if( !pushLine( head ) ) return SH_INCOMPLETE; - PNS_VIA* headVia = NULL; + VIA* headVia = NULL; if( head.EndsWithVia() ) { @@ -1248,7 +1248,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet if( st == SH_OK ) { - pushSpringback( m_currentNode, PNS_ITEMSET(), PNS_COST_ESTIMATOR(), m_affectedAreaSum ); + pushSpringback( m_currentNode, ITEM_SET(), COST_ESTIMATOR(), m_affectedAreaSum ); } else { @@ -1260,8 +1260,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet } -PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR2I& aWhere, - PNS_VIA** aNewVia ) +SHOVE::SHOVE_STATUS SHOVE::ShoveDraggingVia( VIA* aVia, const VECTOR2I& aWhere, + VIA** aNewVia ) { SHOVE_STATUS st = SH_OK; @@ -1271,7 +1271,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR m_draggedVia = NULL; m_draggedViaHeadSet.Clear(); - PNS_NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node; + NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node; m_currentNode = parent; @@ -1296,7 +1296,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR *aNewVia = m_draggedVia; } - pushSpringback( m_currentNode, m_draggedViaHeadSet, PNS_COST_ESTIMATOR(), m_affectedAreaSum ); + pushSpringback( m_currentNode, m_draggedViaHeadSet, COST_ESTIMATOR(), m_affectedAreaSum ); } else { @@ -1313,9 +1313,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR } -void PNS_SHOVE::runOptimizer( PNS_NODE* aNode ) +void SHOVE::runOptimizer( NODE* aNode ) { - PNS_OPTIMIZER optimizer( aNode ); + OPTIMIZER optimizer( aNode ); int optFlags = 0, n_passes = 0; PNS_OPTIMIZATION_EFFORT effort = Settings().OptimizerEffort(); @@ -1324,7 +1324,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode ) int maxWidth = 0; - for( std::vector::iterator i = m_optimizerQueue.begin(); + for( std::vector::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end(); ++i ) { maxWidth = std::max( i->Width(), maxWidth ); @@ -1338,12 +1338,12 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode ) switch( effort ) { case OE_LOW: - optFlags = PNS_OPTIMIZER::MERGE_OBTUSE; + optFlags = OPTIMIZER::MERGE_OBTUSE; n_passes = 1; break; case OE_MEDIUM: - optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS; + optFlags = OPTIMIZER::MERGE_SEGMENTS; if( area ) optimizer.SetRestrictArea( *area ); @@ -1352,7 +1352,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode ) break; case OE_FULL: - optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS; + optFlags = OPTIMIZER::MERGE_SEGMENTS; n_passes = 2; break; @@ -1361,23 +1361,23 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode ) } if( Settings().SmartPads() ) - optFlags |= PNS_OPTIMIZER::SMART_PADS; + optFlags |= OPTIMIZER::SMART_PADS; optimizer.SetEffortLevel( optFlags ); - optimizer.SetCollisionMask( PNS_ITEM::ANY_T ); + optimizer.SetCollisionMask( ITEM::ANY_T ); for( int pass = 0; pass < n_passes; pass++ ) { std::reverse( m_optimizerQueue.begin(), m_optimizerQueue.end() ); - for( std::vector::iterator i = m_optimizerQueue.begin(); + for( std::vector::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end(); ++i ) { - PNS_LINE& line = *i; + LINE& line = *i; if( !( line.Marker() & MK_HEAD ) ) { - PNS_LINE optimized; + LINE optimized; if( optimizer.Optimize( &line, &optimized ) ) { @@ -1391,13 +1391,13 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode ) } -PNS_NODE* PNS_SHOVE::CurrentNode() +NODE* SHOVE::CurrentNode() { return m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node; } -const PNS_LINE PNS_SHOVE::NewHead() const +const LINE SHOVE::NewHead() const { assert( m_newHead ); @@ -1405,7 +1405,7 @@ const PNS_LINE PNS_SHOVE::NewHead() const } -void PNS_SHOVE::SetInitialLine( PNS_LINE& aInitial ) +void SHOVE::SetInitialLine( LINE& aInitial ) { m_root = m_root->Branch(); m_root->Remove( &aInitial ); diff --git a/pcbnew/router/pns_shove.h b/pcbnew/router/pns_shove.h index 7c8eea27f5..46de6f5629 100644 --- a/pcbnew/router/pns_shove.h +++ b/pcbnew/router/pns_shove.h @@ -33,17 +33,17 @@ namespace PNS { -class PNS_LINE; -class PNS_NODE; -class PNS_ROUTER; +class LINE; +class NODE; +class ROUTER; /** - * Class PNS_SHOVE + * Class SHOVE * * The actual Push and Shove algorithm. */ -class PNS_SHOVE : public PNS_ALGO_BASE +class SHOVE : public ALGO_BASE { public: @@ -56,20 +56,20 @@ public: SH_TRY_WALK }; - PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ); - ~PNS_SHOVE(); + SHOVE( NODE* aWorld, ROUTER* aRouter ); + ~SHOVE(); - virtual PNS_LOGGER* Logger() + virtual LOGGER* Logger() { return &m_logger; } - SHOVE_STATUS ShoveLines( const PNS_LINE& aCurrentHead ); - SHOVE_STATUS ShoveMultiLines( const PNS_ITEMSET& aHeadSet ); + SHOVE_STATUS ShoveLines( const LINE& aCurrentHead ); + SHOVE_STATUS ShoveMultiLines( const ITEM_SET& aHeadSet ); - SHOVE_STATUS ShoveDraggingVia( PNS_VIA* aVia, const VECTOR2I& aWhere, PNS_VIA** aNewVia ); - SHOVE_STATUS ProcessSingleLine( PNS_LINE& aCurrent, PNS_LINE& aObstacle, - PNS_LINE& aShoved ); + SHOVE_STATUS ShoveDraggingVia( VIA* aVia, const VECTOR2I& aWhere, VIA** aNewVia ); + SHOVE_STATUS ProcessSingleLine( LINE& aCurrent, LINE& aObstacle, + LINE& aShoved ); void ForceClearance ( bool aEnabled, int aClearance ) { @@ -79,16 +79,16 @@ public: m_forceClearance = -1; } - PNS_NODE* CurrentNode(); + NODE* CurrentNode(); - const PNS_LINE NewHead() const; + const LINE NewHead() const; - void SetInitialLine( PNS_LINE& aInitial ); + void SetInitialLine( LINE& aInitial ); private: typedef std::vector HULL_SET; - typedef boost::optional OPT_LINE; - typedef std::pair LINE_PAIR; + typedef boost::optional OPT_LINE; + typedef std::pair LINE_PAIR; typedef std::vector LINE_PAIR_VEC; struct SPRINGBACK_TAG @@ -96,67 +96,67 @@ private: int64_t m_length; int m_segments; VECTOR2I m_p; - PNS_NODE* m_node; - PNS_ITEMSET m_headItems; - PNS_COST_ESTIMATOR m_cost; + NODE* m_node; + ITEM_SET m_headItems; + COST_ESTIMATOR m_cost; OPT_BOX2I m_affectedArea; }; - SHOVE_STATUS processHullSet( PNS_LINE& aCurrent, PNS_LINE& aObstacle, - PNS_LINE& aShoved, const HULL_SET& hulls ); + SHOVE_STATUS processHullSet( LINE& aCurrent, LINE& aObstacle, + LINE& aShoved, const HULL_SET& hulls ); - bool reduceSpringback( const PNS_ITEMSET& aHeadItems ); - bool pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET& aHeadItems, - const PNS_COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea ); + bool reduceSpringback( const ITEM_SET& aHeadItems ); + bool pushSpringback( NODE* aNode, const ITEM_SET& aHeadItems, + const COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea ); - SHOVE_STATUS walkaroundLoneVia( PNS_LINE& aCurrent, PNS_LINE& aObstacle, PNS_LINE& aShoved ); - bool checkBumpDirection( const PNS_LINE& aCurrent, const PNS_LINE& aShoved ) const; + SHOVE_STATUS walkaroundLoneVia( LINE& aCurrent, LINE& aObstacle, LINE& aShoved ); + bool checkBumpDirection( const LINE& aCurrent, const LINE& aShoved ) const; - SHOVE_STATUS onCollidingLine( PNS_LINE& aCurrent, PNS_LINE& aObstacle ); - SHOVE_STATUS onCollidingSegment( PNS_LINE& aCurrent, PNS_SEGMENT* aObstacleSeg ); - SHOVE_STATUS onCollidingSolid( PNS_LINE& aCurrent, PNS_ITEM* aObstacle ); - SHOVE_STATUS onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia ); - SHOVE_STATUS onReverseCollidingVia( PNS_LINE& aCurrent, PNS_VIA* aObstacleVia ); - SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun = false ); + SHOVE_STATUS onCollidingLine( LINE& aCurrent, LINE& aObstacle ); + SHOVE_STATUS onCollidingSegment( LINE& aCurrent, SEGMENT* aObstacleSeg ); + SHOVE_STATUS onCollidingSolid( LINE& aCurrent, ITEM* aObstacle ); + SHOVE_STATUS onCollidingVia( ITEM* aCurrent, VIA* aObstacleVia ); + SHOVE_STATUS onReverseCollidingVia( LINE& aCurrent, VIA* aObstacleVia ); + SHOVE_STATUS pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun = false ); OPT_BOX2I totalAffectedArea() const; - void unwindStack( PNS_SEGMENT* aSeg ); - void unwindStack( PNS_ITEM* aItem ); + void unwindStack( SEGMENT* aSeg ); + void unwindStack( ITEM* aItem ); - void runOptimizer( PNS_NODE* aNode ); + void runOptimizer( NODE* aNode ); - bool pushLine( const PNS_LINE& aL, bool aKeepCurrentOnTop = false ); + bool pushLine( const LINE& aL, bool aKeepCurrentOnTop = false ); void popLine(); - PNS_LINE assembleLine( const PNS_SEGMENT* aSeg, int* aIndex = NULL ); + LINE assembleLine( const SEGMENT* aSeg, int* aIndex = NULL ); - void replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew ); + void replaceItems( ITEM* aOld, ITEM* aNew ); OPT_BOX2I m_affectedAreaSum; SHOVE_STATUS shoveIteration( int aIter ); SHOVE_STATUS shoveMainLoop(); - int getClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const; + int getClearance( const ITEM* aA, const ITEM* aB ) const; std::vector m_nodeStack; - std::vector m_lineStack; - std::vector m_optimizerQueue; + std::vector m_lineStack; + std::vector m_optimizerQueue; - PNS_NODE* m_root; - PNS_NODE* m_currentNode; + NODE* m_root; + NODE* m_currentNode; OPT_LINE m_newHead; - PNS_LOGGER m_logger; - PNS_VIA* m_draggedVia; - PNS_ITEMSET m_draggedViaHeadSet; + LOGGER m_logger; + VIA* m_draggedVia; + ITEM_SET m_draggedViaHeadSet; int m_iter; int m_forceClearance; bool m_multiLineMode; - void sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew ); + void sanityCheck( LINE* aOld, LINE* aNew ); }; } diff --git a/pcbnew/router/pns_sizes_settings.cpp b/pcbnew/router/pns_sizes_settings.cpp index cd604faf6c..4dc94eab6d 100644 --- a/pcbnew/router/pns_sizes_settings.cpp +++ b/pcbnew/router/pns_sizes_settings.cpp @@ -29,7 +29,7 @@ namespace PNS { -int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem ) +int SIZES_SETTINGS::inheritTrackWidth( ITEM* aItem ) { VECTOR2I p; @@ -37,34 +37,34 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem ) switch( aItem->Kind() ) { - case PNS_ITEM::VIA_T: - p = static_cast( aItem )->Pos(); + case ITEM::VIA_T: + p = static_cast( aItem )->Pos(); break; - case PNS_ITEM::SOLID_T: - p = static_cast( aItem )->Pos(); + case ITEM::SOLID_T: + p = static_cast( aItem )->Pos(); break; - case PNS_ITEM::SEGMENT_T: - return static_cast( aItem )->Width(); + case ITEM::SEGMENT_T: + return static_cast( aItem )->Width(); default: return 0; } - PNS_JOINT* jt = static_cast( aItem->Owner() )->FindJoint( p, aItem ); + JOINT* jt = static_cast( aItem->Owner() )->FindJoint( p, aItem ); assert( jt != NULL ); int mval = INT_MAX; - PNS_ITEMSET linkedSegs = jt->Links(); - linkedSegs.ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT_T ); + ITEM_SET linkedSegs = jt->Links(); + linkedSegs.ExcludeItem( aItem ).FilterKinds( ITEM::SEGMENT_T ); - for( PNS_ITEM* item : linkedSegs.Items() ) + for( ITEM* item : linkedSegs.Items() ) { - int w = static_cast( item )->Width(); + int w = static_cast( item )->Width(); mval = std::min( w, mval ); } @@ -72,7 +72,7 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem ) } -void PNS_SIZES_SETTINGS::Init( BOARD* aBoard, PNS_ITEM* aStartItem, int aNet ) +void SIZES_SETTINGS::Init( BOARD* aBoard, ITEM* aStartItem, int aNet ) { BOARD_DESIGN_SETTINGS &bds = aBoard->GetDesignSettings(); @@ -128,13 +128,13 @@ void PNS_SIZES_SETTINGS::Init( BOARD* aBoard, PNS_ITEM* aStartItem, int aNet ) } -void PNS_SIZES_SETTINGS::ClearLayerPairs() +void SIZES_SETTINGS::ClearLayerPairs() { m_layerPairs.clear(); } -void PNS_SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 ) +void SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 ) { int top = std::min( aL1, aL2 ); int bottom = std::max( aL1, aL2 ); @@ -144,7 +144,7 @@ void PNS_SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 ) } -void PNS_SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings ) +void SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings ) { m_trackWidth = aSettings.GetCurrentTrackWidth(); m_viaDiameter = aSettings.GetCurrentViaSize(); @@ -152,7 +152,7 @@ void PNS_SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings ) } -int PNS_SIZES_SETTINGS::GetLayerTop() const +int SIZES_SETTINGS::GetLayerTop() const { if( m_layerPairs.empty() ) return F_Cu; @@ -161,7 +161,7 @@ int PNS_SIZES_SETTINGS::GetLayerTop() const } -int PNS_SIZES_SETTINGS::GetLayerBottom() const +int SIZES_SETTINGS::GetLayerBottom() const { if( m_layerPairs.empty() ) return B_Cu; diff --git a/pcbnew/router/pns_sizes_settings.h b/pcbnew/router/pns_sizes_settings.h index 376317808e..cbc8570ba3 100644 --- a/pcbnew/router/pns_sizes_settings.h +++ b/pcbnew/router/pns_sizes_settings.h @@ -32,12 +32,12 @@ class BOARD_DESIGN_SETTINGS; namespace PNS { -class PNS_ITEM; +class ITEM; -class PNS_SIZES_SETTINGS { +class SIZES_SETTINGS { public: - PNS_SIZES_SETTINGS() : + SIZES_SETTINGS() : m_trackWidth( 155000 ), m_diffPairWidth( 125000 ), m_diffPairGap( 180000 ), @@ -48,9 +48,9 @@ public: m_viaType( VIA_THROUGH ) {}; - ~PNS_SIZES_SETTINGS() {}; + ~SIZES_SETTINGS() {}; - void Init( BOARD* aBoard, PNS_ITEM* aStartItem = NULL, int aNet = -1 ); + void Init( BOARD* aBoard, ITEM* aStartItem = NULL, int aNet = -1 ); void ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings ); void ClearLayerPairs(); @@ -98,7 +98,7 @@ public: private: - int inheritTrackWidth( PNS_ITEM* aItem ); + int inheritTrackWidth( ITEM* aItem ); int m_trackWidth; int m_diffPairWidth; diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp index 2d5e8ba6d8..20b6d0fba7 100644 --- a/pcbnew/router/pns_solid.cpp +++ b/pcbnew/router/pns_solid.cpp @@ -32,7 +32,7 @@ namespace PNS { -const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness ) const +const SHAPE_LINE_CHAIN SOLID::Hull( int aClearance, int aWalkaroundThickness ) const { int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2; @@ -73,9 +73,9 @@ const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness } -PNS_ITEM* PNS_SOLID::Clone() const +ITEM* SOLID::Clone() const { - PNS_ITEM* solid = new PNS_SOLID( *this ); + ITEM* solid = new SOLID( *this ); return solid; } diff --git a/pcbnew/router/pns_solid.h b/pcbnew/router/pns_solid.h index 4bd3c35ffd..d3849ed66f 100644 --- a/pcbnew/router/pns_solid.h +++ b/pcbnew/router/pns_solid.h @@ -32,32 +32,32 @@ namespace PNS { -class PNS_SOLID : public PNS_ITEM +class SOLID : public ITEM { public: - PNS_SOLID() : PNS_ITEM( SOLID_T ), m_shape( NULL ) + SOLID() : ITEM( SOLID_T ), m_shape( NULL ) { m_movable = false; } - ~PNS_SOLID() + ~SOLID() { delete m_shape; } - PNS_SOLID( const PNS_SOLID& aSolid ) : - PNS_ITEM( aSolid ) + SOLID( const SOLID& aSolid ) : + ITEM( aSolid ) { m_shape = aSolid.m_shape->Clone(); m_pos = aSolid.m_pos; } - static inline bool ClassOf( const PNS_ITEM* aItem ) + static inline bool ClassOf( const ITEM* aItem ) { return aItem && SOLID_T == aItem->Kind(); } - PNS_ITEM* Clone() const; + ITEM* Clone() const; const SHAPE* Shape() const { return m_shape; } diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 6bc30cb2b2..0e99918a35 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -60,13 +60,13 @@ using namespace KIGFX; namespace PNS { -TOOL_ACTION PNS_TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions", +TOOL_ACTION TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions", AS_CONTEXT, 'E', _( "Routing Options..." ), _( "Shows a dialog containing router options." ), tools_xpm ); -PNS_TOOL_BASE::PNS_TOOL_BASE( const std::string& aToolName ) : +TOOL_BASE::TOOL_BASE( const std::string& aToolName ) : TOOL_INTERACTIVE( aToolName ) { m_gridHelper = NULL; @@ -85,7 +85,7 @@ PNS_TOOL_BASE::PNS_TOOL_BASE( const std::string& aToolName ) : } -PNS_TOOL_BASE::~PNS_TOOL_BASE() +TOOL_BASE::~TOOL_BASE() { delete m_gridHelper; delete m_iface; @@ -94,7 +94,7 @@ PNS_TOOL_BASE::~PNS_TOOL_BASE() -void PNS_TOOL_BASE::Reset( RESET_REASON aReason ) +void TOOL_BASE::Reset( RESET_REASON aReason ) { delete m_gridHelper; delete m_iface; @@ -110,7 +110,7 @@ void PNS_TOOL_BASE::Reset( RESET_REASON aReason ) m_iface->SetView( getView() ); m_iface->SetHostFrame( m_frame ); - m_router = new PNS_ROUTER; + m_router = new ROUTER; m_router->SetInterface(m_iface); m_router->ClearWorld(); m_router->SyncWorld(); @@ -121,21 +121,21 @@ void PNS_TOOL_BASE::Reset( RESET_REASON aReason ) } -PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer ) +ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer ) { int tl = getView()->GetTopLayer(); if( aLayer > 0 ) tl = aLayer; - PNS_ITEM* prioritized[4]; + ITEM* prioritized[4]; for( int i = 0; i < 4; i++ ) prioritized[i] = 0; - PNS_ITEMSET candidates = m_router->QueryHoverItems( aWhere ); + ITEM_SET candidates = m_router->QueryHoverItems( aWhere ); - for( PNS_ITEM* item : candidates.Items() ) + for( ITEM* item : candidates.Items() ) { if( !IsCopperLayer( item->Layers().Start() ) ) continue; @@ -146,7 +146,7 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a if( aNet < 0 || item->Net() == aNet ) { - if( item->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ) ) + if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) ) { if( !prioritized[2] ) prioritized[2] = item; @@ -163,13 +163,13 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a } } - PNS_ITEM* rv = NULL; + ITEM* rv = NULL; PCB_EDIT_FRAME* frame = getEditFrame(); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions(); for( int i = 0; i < 4; i++ ) { - PNS_ITEM* item = prioritized[i]; + ITEM* item = prioritized[i]; if( displ_opts->m_ContrastModeDisplay ) if( item && !item->Layers().Overlaps( tl ) ) @@ -194,7 +194,7 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a } -void PNS_TOOL_BASE::highlightNet( bool aEnabled, int aNetcode ) +void TOOL_BASE::highlightNet( bool aEnabled, int aNetcode ) { RENDER_SETTINGS* rs = getView()->GetPainter()->GetSettings(); @@ -207,13 +207,13 @@ void PNS_TOOL_BASE::highlightNet( bool aEnabled, int aNetcode ) } -void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent ) +void TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent ) { int tl = getView()->GetTopLayer(); VECTOR2I cp = m_ctls->GetCursorPosition(); VECTOR2I p; - PNS_ITEM* startItem = NULL; + ITEM* startItem = NULL; bool snapEnabled = true; if( aEvent.IsMotion() || aEvent.IsClick() ) @@ -259,7 +259,7 @@ void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent ) } -void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent ) +void TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent ) { VECTOR2I mp = m_ctls->GetMousePosition(); VECTOR2I p = getView()->ToWorld( mp ); @@ -283,7 +283,7 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent ) else layer = m_router->GetCurrentLayer(); - PNS_ITEM* endItem = NULL; + ITEM* endItem = NULL; std::vector nets = m_router->GetCurrentNets(); @@ -316,9 +316,9 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent ) } -void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack ) +void TOOL_BASE::deleteTraces( ITEM* aStartItem, bool aWholeTrack ) { - PNS_NODE *node = m_router->GetWorld()->Branch(); + NODE *node = m_router->GetWorld()->Branch(); if( !aStartItem ) return; @@ -329,8 +329,8 @@ void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack ) } else { - PNS_TOPOLOGY topo( node ); - PNS_ITEMSET path = topo.AssembleTrivialPath( aStartItem ); + TOPOLOGY topo( node ); + ITEM_SET path = topo.AssembleTrivialPath( aStartItem ); for( auto ent : path.Items() ) node->Remove( ent.item ); @@ -340,13 +340,13 @@ void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack ) } -PNS_ROUTER *PNS_TOOL_BASE::Router() const +ROUTER *TOOL_BASE::Router() const { return m_router; } -const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ) +const VECTOR2I TOOL_BASE::snapToItem( ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ) { VECTOR2I anchor; @@ -358,19 +358,19 @@ const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aS switch( aItem->Kind() ) { - case PNS_ITEM::SOLID_T: - anchor = static_cast( aItem )->Pos(); + case ITEM::SOLID_T: + anchor = static_cast( aItem )->Pos(); aSplitsSegment = false; break; - case PNS_ITEM::VIA_T: - anchor = static_cast( aItem )->Pos(); + case ITEM::VIA_T: + anchor = static_cast( aItem )->Pos(); aSplitsSegment = false; break; - case PNS_ITEM::SEGMENT_T: + case ITEM::SEGMENT_T: { - PNS_SEGMENT* seg = static_cast( aItem ); + SEGMENT* seg = static_cast( aItem ); const SEG& s = seg->Seg(); int w = seg->Width(); diff --git a/pcbnew/router/pns_tool_base.h b/pcbnew/router/pns_tool_base.h index 998581da85..ceae7b32b1 100644 --- a/pcbnew/router/pns_tool_base.h +++ b/pcbnew/router/pns_tool_base.h @@ -39,41 +39,41 @@ class PNS_TUNE_STATUS_POPUP; namespace PNS { -class APIEXPORT PNS_TOOL_BASE : public TOOL_INTERACTIVE +class APIEXPORT TOOL_BASE : public TOOL_INTERACTIVE { public: static TOOL_ACTION ACT_RouterOptions; - PNS_TOOL_BASE( const std::string& aToolName ); - virtual ~PNS_TOOL_BASE(); + TOOL_BASE( const std::string& aToolName ); + virtual ~TOOL_BASE(); virtual void Reset( RESET_REASON aReason ); - const PNS_ROUTING_SETTINGS& PNSSettings() const + const ROUTING_SETTINGS& PNSSettings() const { return m_savedSettings; } - PNS_ROUTER* Router() const; + ROUTER* Router() const; protected: - const VECTOR2I snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ); - virtual PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 ); + const VECTOR2I snapToItem( ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ); + virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 ); virtual void highlightNet( bool aEnabled, int aNetcode = -1 ); virtual void updateStartItem( TOOL_EVENT& aEvent ); virtual void updateEndItem( TOOL_EVENT& aEvent ); - void deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack ); + void deleteTraces( ITEM* aStartItem, bool aWholeTrack ); MSG_PANEL_ITEMS m_panelItems; - PNS_ROUTING_SETTINGS m_savedSettings; ///< Stores routing settings between router invocations - PNS_SIZES_SETTINGS m_savedSizes; ///< Stores sizes settings between router invocations - PNS_ITEM* m_startItem; + ROUTING_SETTINGS m_savedSettings; ///< Stores routing settings between router invocations + SIZES_SETTINGS m_savedSizes; ///< Stores sizes settings between router invocations + ITEM* m_startItem; int m_startLayer; VECTOR2I m_startSnapPoint; - PNS_ITEM* m_endItem; + ITEM* m_endItem; VECTOR2I m_endSnapPoint; PCB_EDIT_FRAME* m_frame; @@ -81,7 +81,7 @@ protected: BOARD* m_board; GRID_HELPER* m_gridHelper; PNS_KICAD_IFACE* m_iface; - PNS_ROUTER* m_router; + ROUTER* m_router; }; } diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp index a54bbc060a..c862fd9440 100644 --- a/pcbnew/router/pns_topology.cpp +++ b/pcbnew/router/pns_topology.cpp @@ -34,20 +34,20 @@ namespace PNS { -bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine ) +bool TOPOLOGY::SimplifyLine( LINE* aLine ) { if( !aLine->LinkedSegments() || !aLine->SegmentCount() ) return false; - PNS_SEGMENT* root = ( *aLine->LinkedSegments() )[0]; - PNS_LINE l = m_world->AssembleLine( root ); + SEGMENT* root = ( *aLine->LinkedSegments() )[0]; + LINE l = m_world->AssembleLine( root ); SHAPE_LINE_CHAIN simplified( l.CLine() ); simplified.Simplify(); if( simplified.PointCount() != l.PointCount() ) { - PNS_LINE lnew( l ); + LINE lnew( l ); m_world->Remove( &l ); lnew.SetShape( simplified ); m_world->Add( &lnew ); @@ -58,9 +58,9 @@ bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine ) } -const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart ) +const TOPOLOGY::JOINT_SET TOPOLOGY::ConnectedJoints( JOINT* aStart ) { - std::deque searchQueue; + std::deque searchQueue; JOINT_SET processed; searchQueue.push_back( aStart ); @@ -68,17 +68,17 @@ const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart ) while( !searchQueue.empty() ) { - PNS_JOINT* current = searchQueue.front(); + JOINT* current = searchQueue.front(); searchQueue.pop_front(); - for( PNS_ITEM* item : current->LinkList() ) + for( ITEM* item : current->LinkList() ) { - if( item->OfKind( PNS_ITEM::SEGMENT_T ) ) + if( item->OfKind( ITEM::SEGMENT_T ) ) { - PNS_SEGMENT* seg = static_cast( item ); - PNS_JOINT* a = m_world->FindJoint( seg->Seg().A, seg ); - PNS_JOINT* b = m_world->FindJoint( seg->Seg().B, seg ); - PNS_JOINT* next = ( *a == *current ) ? b : a; + SEGMENT* seg = static_cast( item ); + JOINT* a = m_world->FindJoint( seg->Seg().A, seg ); + JOINT* b = m_world->FindJoint( seg->Seg().B, seg ); + JOINT* next = ( *a == *current ) ? b : a; if( processed.find( next ) == processed.end() ) { @@ -93,18 +93,18 @@ const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart ) } -bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine ) +bool TOPOLOGY::LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine ) { - PNS_LINE track( *aTrack ); + LINE track( *aTrack ); VECTOR2I end; if( !track.PointCount() ) return false; - std::unique_ptr tmpNode( m_world->Branch() ); + std::unique_ptr tmpNode( m_world->Branch() ); tmpNode->Add( &track ); - PNS_JOINT* jt = tmpNode->FindJoint( track.CPoint( -1 ), &track ); + JOINT* jt = tmpNode->FindJoint( track.CPoint( -1 ), &track ); if( !jt ) return false; @@ -117,8 +117,8 @@ bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRa { int anchor; - PNS_TOPOLOGY topo( tmpNode.get() ); - PNS_ITEM* it = topo.NearestUnconnectedItem( jt, &anchor ); + TOPOLOGY topo( tmpNode.get() ); + ITEM* it = topo.NearestUnconnectedItem( jt, &anchor ); if( !it ) return false; @@ -133,15 +133,15 @@ bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRa } -PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor, int aKindMask ) +ITEM* TOPOLOGY::NearestUnconnectedItem( JOINT* aStart, int* aAnchor, int aKindMask ) { - std::set disconnected; + std::set disconnected; m_world->AllItemsInNet( aStart->Net(), disconnected ); - for( const PNS_JOINT* jt : ConnectedJoints( aStart ) ) + for( const JOINT* jt : ConnectedJoints( aStart ) ) { - for( PNS_ITEM* link : jt->LinkList() ) + for( ITEM* link : jt->LinkList() ) { if( disconnected.find( link ) != disconnected.end() ) disconnected.erase( link ); @@ -149,9 +149,9 @@ PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor, } int best_dist = INT_MAX; - PNS_ITEM* best = NULL; + ITEM* best = NULL; - for( PNS_ITEM* item : disconnected ) + for( ITEM* item : disconnected ) { if( item->OfKind( aKindMask ) ) { @@ -176,11 +176,11 @@ PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor, } -bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& aSet, std::set& aVisited ) +bool TOPOLOGY::followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet, std::set& aVisited ) { VECTOR2I anchor = aLeft ? aLine->CPoint( 0 ) : aLine->CPoint( -1 ); - PNS_SEGMENT* last = aLeft ? aLine->LinkedSegments()->front() : aLine->LinkedSegments()->back(); - PNS_JOINT* jt = m_world->FindJoint( anchor, aLine ); + SEGMENT* last = aLeft ? aLine->LinkedSegments()->front() : aLine->LinkedSegments()->back(); + JOINT* jt = m_world->FindJoint( anchor, aLine ); assert( jt != NULL ); @@ -188,21 +188,21 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& if( jt->IsNonFanoutVia() || jt->IsTraceWidthChange() ) { - PNS_ITEM* via = NULL; - PNS_SEGMENT* next_seg = NULL; + ITEM* via = NULL; + SEGMENT* next_seg = NULL; - for( PNS_ITEM* link : jt->Links().Items() ) + for( ITEM* link : jt->Links().Items() ) { - if( link->OfKind( PNS_ITEM::VIA_T ) ) + if( link->OfKind( ITEM::VIA_T ) ) via = link; else if( aVisited.find( link ) == aVisited.end() ) - next_seg = static_cast( link ); + next_seg = static_cast( link ); } if( !next_seg ) return false; - PNS_LINE l = m_world->AssembleLine( next_seg ); + LINE l = m_world->AssembleLine( next_seg ); VECTOR2I nextAnchor = ( aLeft ? l.CLine().CPoint( -1 ) : l.CLine().CPoint( 0 ) ); @@ -233,31 +233,31 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& } -const PNS_ITEMSET PNS_TOPOLOGY::AssembleTrivialPath( PNS_ITEM* aStart ) +const ITEM_SET TOPOLOGY::AssembleTrivialPath( ITEM* aStart ) { - PNS_ITEMSET path; - std::set visited; - PNS_SEGMENT* seg; - PNS_VIA* via; + ITEM_SET path; + std::set visited; + SEGMENT* seg; + VIA* via; - seg = dyn_cast (aStart); + seg = dyn_cast (aStart); - if(!seg && (via = dyn_cast( aStart ) ) ) + if(!seg && (via = dyn_cast( aStart ) ) ) { - PNS_JOINT *jt = m_world->FindJoint( via->Pos(), via ); + JOINT *jt = m_world->FindJoint( via->Pos(), via ); if( !jt->IsNonFanoutVia() ) - return PNS_ITEMSET(); + return ITEM_SET(); for( auto entry : jt->Links().Items() ) - if( ( seg = dyn_cast( entry.item ) ) ) + if( ( seg = dyn_cast( entry.item ) ) ) break; } if( !seg ) - return PNS_ITEMSET(); + return ITEM_SET(); - PNS_LINE l = m_world->AssembleLine( seg ); + LINE l = m_world->AssembleLine( seg ); path.Add( l ); @@ -268,22 +268,22 @@ const PNS_ITEMSET PNS_TOPOLOGY::AssembleTrivialPath( PNS_ITEM* aStart ) } -const PNS_ITEMSET PNS_TOPOLOGY::ConnectedItems( PNS_JOINT* aStart, int aKindMask ) +const ITEM_SET TOPOLOGY::ConnectedItems( JOINT* aStart, int aKindMask ) { - return PNS_ITEMSET(); + return ITEM_SET(); } -const PNS_ITEMSET PNS_TOPOLOGY::ConnectedItems( PNS_ITEM* aStart, int aKindMask ) +const ITEM_SET TOPOLOGY::ConnectedItems( ITEM* aStart, int aKindMask ) { - return PNS_ITEMSET(); + return ITEM_SET(); } bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip ); -bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair ) +bool TOPOLOGY::AssembleDiffPair( ITEM* aStart, DIFF_PAIR& aPair ) { int refNet = aStart->Net(); int coupledNet = m_world->GetRuleResolver()->DpCoupledNet( refNet ); @@ -291,18 +291,18 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair ) if( coupledNet < 0 ) return false; - std::set coupledItems; + std::set coupledItems; m_world->AllItemsInNet( coupledNet, coupledItems ); - PNS_SEGMENT* coupledSeg = NULL, *refSeg; + SEGMENT* coupledSeg = NULL, *refSeg; int minDist = std::numeric_limits::max(); - if( ( refSeg = dyn_cast( aStart ) ) != NULL ) + if( ( refSeg = dyn_cast( aStart ) ) != NULL ) { - for( PNS_ITEM* item : coupledItems ) + for( ITEM* item : coupledItems ) { - if( PNS_SEGMENT* s = dyn_cast( item ) ) + if( SEGMENT* s = dyn_cast( item ) ) { if( s->Layers().Start() == refSeg->Layers().Start() && s->Width() == refSeg->Width() ) { @@ -329,8 +329,8 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair ) if( !coupledSeg ) return false; - PNS_LINE lp = m_world->AssembleLine( refSeg ); - PNS_LINE ln = m_world->AssembleLine( coupledSeg ); + LINE lp = m_world->AssembleLine( refSeg ); + LINE ln = m_world->AssembleLine( coupledSeg ); if( m_world->GetRuleResolver()->DpNetPolarity( refNet ) < 0 ) { @@ -347,7 +347,7 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair ) gap = (int) std::abs( refDir.Cross( displacement ) / refDir.EuclideanNorm() ) - lp.Width(); } - aPair = PNS_DIFF_PAIR( lp, ln ); + aPair = DIFF_PAIR( lp, ln ); aPair.SetWidth( lp.Width() ); aPair.SetLayers( lp.Layers() ); aPair.SetGap( gap ); @@ -355,25 +355,25 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair ) return true; } -const std::set PNS_TOPOLOGY::AssembleCluster( PNS_ITEM* aStart, int aLayer ) +const std::set TOPOLOGY::AssembleCluster( ITEM* aStart, int aLayer ) { - std::set visited; - std::deque pending; + std::set visited; + std::deque pending; pending.push_back( aStart ); while( !pending.empty() ) { - PNS_NODE::OBSTACLES obstacles; - PNS_ITEM* top = pending.front(); + NODE::OBSTACLES obstacles; + ITEM* top = pending.front(); pending.pop_front(); visited.insert( top ); - m_world->QueryColliding( top, obstacles, PNS_ITEM::ANY_T, -1, false ); + m_world->QueryColliding( top, obstacles, ITEM::ANY_T, -1, false ); - for( PNS_OBSTACLE& obs : obstacles ) + for( OBSTACLE& obs : obstacles ) { if( visited.find( obs.m_item ) == visited.end() && obs.m_item->Layers().Overlaps( aLayer ) && !( obs.m_item->Marker() & MK_HEAD ) ) { diff --git a/pcbnew/router/pns_topology.h b/pcbnew/router/pns_topology.h index c4eb435113..d0bfe9302b 100644 --- a/pcbnew/router/pns_topology.h +++ b/pcbnew/router/pns_topology.h @@ -29,46 +29,46 @@ namespace PNS { -class PNS_NODE; -class PNS_SEGMENT; -class PNS_JOINT; -class PNS_ITEM; -class PNS_SOLID; -class PNS_DIFF_PAIR; +class NODE; +class SEGMENT; +class JOINT; +class ITEM; +class SOLID; +class DIFF_PAIR; -class PNS_TOPOLOGY +class TOPOLOGY { public: - typedef std::set JOINT_SET; + typedef std::set JOINT_SET; - PNS_TOPOLOGY( PNS_NODE* aNode ): + TOPOLOGY( NODE* aNode ): m_world( aNode ) {}; - ~PNS_TOPOLOGY() {}; + ~TOPOLOGY() {}; - bool SimplifyLine( PNS_LINE *aLine ); - PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL, int aKindMask = PNS_ITEM::ANY_T ); - bool LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine ); + bool SimplifyLine( LINE *aLine ); + ITEM* NearestUnconnectedItem( JOINT* aStart, int* aAnchor = NULL, int aKindMask = ITEM::ANY_T ); + bool LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine ); - const JOINT_SET ConnectedJoints( PNS_JOINT* aStart ); - const PNS_ITEMSET ConnectedItems( PNS_JOINT* aStart, int aKindMask = PNS_ITEM::ANY_T ); - const PNS_ITEMSET ConnectedItems( PNS_ITEM* aStart, int aKindMask = PNS_ITEM::ANY_T ); - int64_t ShortestConnectionLength( PNS_ITEM* aFrom, PNS_ITEM* aTo ); + const JOINT_SET ConnectedJoints( JOINT* aStart ); + const ITEM_SET ConnectedItems( JOINT* aStart, int aKindMask = ITEM::ANY_T ); + const ITEM_SET ConnectedItems( ITEM* aStart, int aKindMask = ITEM::ANY_T ); + int64_t ShortestConnectionLength( ITEM* aFrom, ITEM* aTo ); - const PNS_ITEMSET AssembleTrivialPath( PNS_ITEM* aStart ); - const PNS_DIFF_PAIR AssembleDiffPair( PNS_SEGMENT* aStart ); + const ITEM_SET AssembleTrivialPath( ITEM* aStart ); + const DIFF_PAIR AssembleDiffPair( SEGMENT* aStart ); int DpCoupledNet( int aNet ); int DpNetPolarity( int aNet ); - const PNS_LINE DpCoupledLine( PNS_LINE* aLine ); - bool AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair ); + const LINE DpCoupledLine( LINE* aLine ); + bool AssembleDiffPair( ITEM* aStart, DIFF_PAIR& aPair ); - const std::set AssembleCluster( PNS_ITEM* aStart, int aLayer ); + const std::set AssembleCluster( ITEM* aStart, int aLayer ); private: - bool followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& aSet, std::set& aVisited ); + bool followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet, std::set& aVisited ); - PNS_NODE *m_world; + NODE *m_world; }; } diff --git a/pcbnew/router/pns_tune_status_popup.cpp b/pcbnew/router/pns_tune_status_popup.cpp index 906fbbd163..0d391a7c5a 100644 --- a/pcbnew/router/pns_tune_status_popup.cpp +++ b/pcbnew/router/pns_tune_status_popup.cpp @@ -37,9 +37,9 @@ PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP() } -void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::PNS_ROUTER* aRouter ) +void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter ) { - PNS::PNS_MEANDER_PLACER_BASE* placer = dynamic_cast( aRouter->Placer() ); + PNS::MEANDER_PLACER_BASE* placer = dynamic_cast( aRouter->Placer() ); if( !placer ) return; @@ -50,13 +50,13 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::PNS_ROUTER* aRouter ) switch( placer->TuningStatus() ) { - case PNS::PNS_MEANDER_PLACER::TUNED: + case PNS::MEANDER_PLACER::TUNED: color = wxColour( 0, 255, 0 ); break; - case PNS::PNS_MEANDER_PLACER::TOO_SHORT: + case PNS::MEANDER_PLACER::TOO_SHORT: color = wxColour( 255, 128, 128 ); break; - case PNS::PNS_MEANDER_PLACER::TOO_LONG: + case PNS::MEANDER_PLACER::TOO_LONG: color = wxColour( 128, 128, 255 ); break; } diff --git a/pcbnew/router/pns_tune_status_popup.h b/pcbnew/router/pns_tune_status_popup.h index 52d4bf0e01..6d02d94413 100644 --- a/pcbnew/router/pns_tune_status_popup.h +++ b/pcbnew/router/pns_tune_status_popup.h @@ -30,7 +30,7 @@ namespace PNS { -class PNS_ROUTER; +class ROUTER; } @@ -40,7 +40,7 @@ public: PNS_TUNE_STATUS_POPUP( PCB_EDIT_FRAME* aParent ); ~PNS_TUNE_STATUS_POPUP(); - void UpdateStatus( PNS::PNS_ROUTER* aRouter ); + void UpdateStatus( PNS::ROUTER* aRouter ); private: wxStaticText* m_statusLine; diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp index 0e3a29d3f1..8c686376ca 100644 --- a/pcbnew/router/pns_utils.cpp +++ b/pcbnew/router/pns_utils.cpp @@ -174,13 +174,13 @@ void DrawDebugPoint( VECTOR2I aP, int aColor ) l.Append( aP - VECTOR2I( -50000, -50000 ) ); l.Append( aP + VECTOR2I( -50000, -50000 ) ); - PNS_ROUTER::GetInstance()->DisplayDebugLine ( l, aColor, 10000 ); + ROUTER::GetInstance()->DisplayDebugLine ( l, aColor, 10000 ); l.Clear(); l.Append( aP - VECTOR2I( 50000, -50000 ) ); l.Append( aP + VECTOR2I( 50000, -50000 ) ); - PNS_ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 ); + ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 ); } @@ -197,7 +197,7 @@ void DrawDebugBox( BOX2I aB, int aColor ) l.Append( o.x, o.y + s.y ); l.Append( o ); - PNS_ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 ); + ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 ); } @@ -208,7 +208,7 @@ void DrawDebugSeg( SEG aS, int aColor ) l.Append( aS.A ); l.Append( aS.B ); - PNS_ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 ); + ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 ); } @@ -228,19 +228,19 @@ void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor ) } #endif -OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB ) +OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB ) { - if( aItemA->OfKind( PNS_ITEM::VIA_T ) && aItemB->OfKind( PNS_ITEM::VIA_T ) ) + if( aItemA->OfKind( ITEM::VIA_T ) && aItemB->OfKind( ITEM::VIA_T ) ) { - const PNS_VIA* va = static_cast( aItemA ); - const PNS_VIA* vb = static_cast( aItemB ); + const VIA* va = static_cast( aItemA ); + const VIA* vb = static_cast( aItemB ); return va->ChangedArea( vb ); } - else if( aItemA->OfKind( PNS_ITEM::LINE_T ) && aItemB->OfKind( PNS_ITEM::LINE_T ) ) + else if( aItemA->OfKind( ITEM::LINE_T ) && aItemB->OfKind( ITEM::LINE_T ) ) { - const PNS_LINE* la = static_cast ( aItemA ); - const PNS_LINE* lb = static_cast ( aItemB ); + const LINE* la = static_cast ( aItemA ); + const LINE* lb = static_cast ( aItemB ); return la->ChangedArea( lb ); } diff --git a/pcbnew/router/pns_utils.h b/pcbnew/router/pns_utils.h index 372879304d..3dbd85f634 100644 --- a/pcbnew/router/pns_utils.h +++ b/pcbnew/router/pns_utils.h @@ -33,7 +33,7 @@ namespace PNS { constexpr int HULL_MARGIN = 10; -class PNS_ITEM; +class ITEM; /** Various utility functions */ @@ -62,7 +62,7 @@ void DrawDebugBox( BOX2I aB, int aColor ); void DrawDebugSeg( SEG aS, int aColor ); void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor ); #endif -OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB ); +OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB ); } diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp index 6706810f88..4ad5b4708d 100644 --- a/pcbnew/router/pns_via.cpp +++ b/pcbnew/router/pns_via.cpp @@ -28,17 +28,17 @@ namespace PNS { -bool PNS_VIA::PushoutForce( PNS_NODE* aNode, const VECTOR2I& aDirection, VECTOR2I& aForce, +bool VIA::PushoutForce( NODE* aNode, const VECTOR2I& aDirection, VECTOR2I& aForce, bool aSolidsOnly, int aMaxIterations ) { int iter = 0; - PNS_VIA mv( *this ); + VIA mv( *this ); VECTOR2I force, totalForce, force2; while( iter < aMaxIterations ) { - PNS_NODE::OPT_OBSTACLE obs = aNode->CheckColliding( &mv, - aSolidsOnly ? PNS_ITEM::SOLID_T : PNS_ITEM::ANY_T ); + NODE::OPT_OBSTACLE obs = aNode->CheckColliding( &mv, + aSolidsOnly ? ITEM::SOLID_T : ITEM::ANY_T ); if( !obs ) break; @@ -71,7 +71,7 @@ bool PNS_VIA::PushoutForce( PNS_NODE* aNode, const VECTOR2I& aDirection, VECTOR2 } -const SHAPE_LINE_CHAIN PNS_VIA::Hull( int aClearance, int aWalkaroundThickness ) const +const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness ) const { int cl = ( aClearance + aWalkaroundThickness / 2 ); @@ -81,9 +81,9 @@ const SHAPE_LINE_CHAIN PNS_VIA::Hull( int aClearance, int aWalkaroundThickness ) } -PNS_VIA* PNS_VIA::Clone() const +VIA* VIA::Clone() const { - PNS_VIA* v = new PNS_VIA(); + VIA* v = new VIA(); v->SetNet( Net() ); v->SetLayers( Layers() ); @@ -99,7 +99,7 @@ PNS_VIA* PNS_VIA::Clone() const } -OPT_BOX2I PNS_VIA::ChangedArea( const PNS_VIA* aOther ) const +OPT_BOX2I VIA::ChangedArea( const VIA* aOther ) const { if ( aOther->Pos() != Pos() ) { diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index 96b126b6af..bf7e9f1fca 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.h @@ -31,22 +31,22 @@ namespace PNS { -class PNS_NODE; +class NODE; -class PNS_VIA : public PNS_ITEM +class VIA : public ITEM { public: - PNS_VIA() : - PNS_ITEM( VIA_T ) + VIA() : + ITEM( VIA_T ) { m_diameter = 2; // Dummy value m_drill = 0; m_viaType = VIA_THROUGH; } - PNS_VIA( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, + VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) : - PNS_ITEM( VIA_T ) + ITEM( VIA_T ) { SetNet( aNet ); SetLayers( aLayers ); @@ -59,14 +59,14 @@ public: //If we're a through-board via, use all layers regardless of the set passed if( aViaType == VIA_THROUGH ) { - PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 ); + LAYER_RANGE allLayers( 0, MAX_CU_LAYERS - 1 ); SetLayers( allLayers ); } } - PNS_VIA( const PNS_VIA& aB ) : - PNS_ITEM( VIA_T ) + VIA( const VIA& aB ) : + ITEM( VIA_T ) { SetNet( aB.Net() ); SetLayers( aB.Layers() ); @@ -79,7 +79,7 @@ public: m_viaType = aB.m_viaType; } - static inline bool ClassOf( const PNS_ITEM* aItem ) + static inline bool ClassOf( const ITEM* aItem ) { return aItem && VIA_T == aItem->Kind(); } @@ -127,7 +127,7 @@ public: m_drill = aDrill; } - bool PushoutForce( PNS_NODE* aNode, + bool PushoutForce( NODE* aNode, const VECTOR2I& aDirection, VECTOR2I& aForce, bool aSolidsOnly = true, @@ -138,7 +138,7 @@ public: return &m_shape; } - PNS_VIA* Clone() const; + VIA* Clone() const; const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const; @@ -152,7 +152,7 @@ public: return 1; } - OPT_BOX2I ChangedArea( const PNS_VIA* aOther ) const; + OPT_BOX2I ChangedArea( const VIA* aOther ) const; private: int m_diameter; diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp index 6ff094dc05..3e26ea46e3 100644 --- a/pcbnew/router/pns_walkaround.cpp +++ b/pcbnew/router/pns_walkaround.cpp @@ -31,16 +31,16 @@ using boost::optional; namespace PNS { -void PNS_WALKAROUND::start( const PNS_LINE& aInitialPath ) +void WALKAROUND::start( const LINE& aInitialPath ) { m_iteration = 0; m_iterationLimit = 50; } -PNS_NODE::OPT_OBSTACLE PNS_WALKAROUND::nearestObstacle( const PNS_LINE& aPath ) +NODE::OPT_OBSTACLE WALKAROUND::nearestObstacle( const LINE& aPath ) { - PNS_NODE::OPT_OBSTACLE obs = m_world->NearestObstacle( &aPath, m_itemMask, m_restrictedSet.empty() ? NULL : &m_restrictedSet ); + NODE::OPT_OBSTACLE obs = m_world->NearestObstacle( &aPath, m_itemMask, m_restrictedSet.empty() ? NULL : &m_restrictedSet ); if( m_restrictedSet.empty() ) return obs; @@ -48,14 +48,14 @@ PNS_NODE::OPT_OBSTACLE PNS_WALKAROUND::nearestObstacle( const PNS_LINE& aPath ) else if( obs && m_restrictedSet.find ( obs->m_item ) != m_restrictedSet.end() ) return obs; - return PNS_NODE::OPT_OBSTACLE(); + return NODE::OPT_OBSTACLE(); } -PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, +WALKAROUND::WALKAROUND_STATUS WALKAROUND::singleStep( LINE& aPath, bool aWindingDirection ) { - optional& current_obs = + optional& current_obs = aWindingDirection ? m_currentObstacle[0] : m_currentObstacle[1]; bool& prev_recursive = aWindingDirection ? m_recursiveCollision[0] : m_recursiveCollision[1]; @@ -97,7 +97,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, int len_pre = path_walk[0].Length(); int len_alt = path_walk[1].Length(); - PNS_LINE walk_path( aPath, path_walk[1] ); + LINE walk_path( aPath, path_walk[1] ); bool alt_collides = static_cast( m_world->CheckColliding( &walk_path, m_itemMask ) ); @@ -110,9 +110,9 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, pnew.Append( path_post[1] ); if( !path_post[1].PointCount() || !path_walk[1].PointCount() ) - current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[1] ) ); + current_obs = nearestObstacle( LINE( aPath, path_pre[1] ) ); else - current_obs = nearestObstacle( PNS_LINE( aPath, path_post[1] ) ); + current_obs = nearestObstacle( LINE( aPath, path_post[1] ) ); prev_recursive = false; } else @@ -122,14 +122,14 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, pnew.Append( path_post[0] ); if( !path_post[0].PointCount() || !path_walk[0].PointCount() ) - current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[0] ) ); + current_obs = nearestObstacle( LINE( aPath, path_pre[0] ) ); else - current_obs = nearestObstacle( PNS_LINE( aPath, path_walk[0] ) ); + current_obs = nearestObstacle( LINE( aPath, path_walk[0] ) ); if( !current_obs ) { prev_recursive = false; - current_obs = nearestObstacle( PNS_LINE( aPath, path_post[0] ) ); + current_obs = nearestObstacle( LINE( aPath, path_post[0] ) ); } else prev_recursive = true; @@ -142,10 +142,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, } -PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitialPath, - PNS_LINE& aWalkPath, bool aOptimize ) +WALKAROUND::WALKAROUND_STATUS WALKAROUND::Route( const LINE& aInitialPath, + LINE& aWalkPath, bool aOptimize ) { - PNS_LINE path_cw( aInitialPath ), path_ccw( aInitialPath ); + LINE path_cw( aInitialPath ), path_ccw( aInitialPath ); WALKAROUND_STATUS s_cw = IN_PROGRESS, s_ccw = IN_PROGRESS; SHAPE_LINE_CHAIN best_path; @@ -268,7 +268,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia if( st == DONE ) { if( aOptimize ) - PNS_OPTIMIZER::Optimize( &aWalkPath, PNS_OPTIMIZER::MERGE_OBTUSE, m_world ); + OPTIMIZER::Optimize( &aWalkPath, OPTIMIZER::MERGE_OBTUSE, m_world ); } return st; diff --git a/pcbnew/router/pns_walkaround.h b/pcbnew/router/pns_walkaround.h index 583595d004..ff6087d314 100644 --- a/pcbnew/router/pns_walkaround.h +++ b/pcbnew/router/pns_walkaround.h @@ -32,13 +32,13 @@ namespace PNS { -class PNS_WALKAROUND : public PNS_ALGO_BASE +class WALKAROUND : public ALGO_BASE { static const int DefaultIterationLimit = 50; public: - PNS_WALKAROUND( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) : - PNS_ALGO_BASE ( aRouter ), + WALKAROUND( NODE* aWorld, ROUTER* aRouter ) : + ALGO_BASE ( aRouter ), m_world( aWorld ), m_iterationLimit( DefaultIterationLimit ) { @@ -46,7 +46,7 @@ public: m_forceLongerPath = false; m_forceWinding = false; m_cursorApproachMode = false; - m_itemMask = PNS_ITEM::ANY_T; + m_itemMask = ITEM::ANY_T; // Initialize other members, to avoid uninitialized variables. m_recursiveBlockageCount = 0; @@ -55,7 +55,7 @@ public: m_forceCw = false; } - ~PNS_WALKAROUND() {}; + ~WALKAROUND() {}; enum WALKAROUND_STATUS { @@ -64,7 +64,7 @@ public: STUCK }; - void SetWorld( PNS_NODE* aNode ) + void SetWorld( NODE* aNode ) { m_world = aNode; } @@ -77,9 +77,9 @@ public: void SetSolidsOnly( bool aSolidsOnly ) { if( aSolidsOnly ) - m_itemMask = PNS_ITEM::SOLID_T; + m_itemMask = ITEM::SOLID_T; else - m_itemMask = PNS_ITEM::ANY_T; + m_itemMask = ITEM::ANY_T; } void SetItemMask( int aMask ) @@ -110,7 +110,7 @@ public: m_forceWinding = aEnabled; } - void RestrictToSet( bool aEnabled, const std::set& aSet ) + void RestrictToSet( bool aEnabled, const std::set& aSet ) { if( aEnabled ) m_restrictedSet = aSet; @@ -118,21 +118,21 @@ public: m_restrictedSet.clear(); } - WALKAROUND_STATUS Route( const PNS_LINE& aInitialPath, PNS_LINE& aWalkPath, + WALKAROUND_STATUS Route( const LINE& aInitialPath, LINE& aWalkPath, bool aOptimize = true ); - virtual PNS_LOGGER* Logger() + virtual LOGGER* Logger() { return &m_logger; } private: - void start( const PNS_LINE& aInitialPath ); + void start( const LINE& aInitialPath ); - WALKAROUND_STATUS singleStep( PNS_LINE& aPath, bool aWindingDirection ); - PNS_NODE::OPT_OBSTACLE nearestObstacle( const PNS_LINE& aPath ); + WALKAROUND_STATUS singleStep( LINE& aPath, bool aWindingDirection ); + NODE::OPT_OBSTACLE nearestObstacle( const LINE& aPath ); - PNS_NODE* m_world; + NODE* m_world; int m_recursiveBlockageCount; int m_iteration; @@ -143,10 +143,10 @@ private: bool m_forceWinding; bool m_forceCw; VECTOR2I m_cursorPos; - PNS_NODE::OPT_OBSTACLE m_currentObstacle[2]; + NODE::OPT_OBSTACLE m_currentObstacle[2]; bool m_recursiveCollision[2]; - PNS_LOGGER m_logger; - std::set m_restrictedSet; + LOGGER m_logger; + std::set m_restrictedSet; }; } diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index 13dc99b10a..7e15edac01 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -37,7 +37,7 @@ using namespace KIGFX; -ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem, VIEW_GROUP* aParent ) : +ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, VIEW_GROUP* aParent ) : EDA_ITEM( NOT_USED ) { m_parent = aParent; @@ -64,13 +64,13 @@ ROUTER_PREVIEW_ITEM::~ROUTER_PREVIEW_ITEM() } -void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem ) +void ROUTER_PREVIEW_ITEM::Update( const PNS::ITEM* aItem ) { m_originLayer = aItem->Layers().Start(); - if( aItem->OfKind( PNS::PNS_ITEM::LINE_T ) ) + if( aItem->OfKind( PNS::ITEM::LINE_T ) ) { - const PNS::PNS_LINE* l = static_cast( aItem ); + const PNS::LINE* l = static_cast( aItem ); if( !l->SegmentCount() ) return; @@ -86,20 +86,20 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem ) switch( aItem->Kind() ) { - case PNS::PNS_ITEM::LINE_T: + case PNS::ITEM::LINE_T: m_type = PR_SHAPE; - m_width = ( (PNS::PNS_LINE*) aItem )->Width(); + m_width = ( (PNS::LINE*) aItem )->Width(); break; - case PNS::PNS_ITEM::SEGMENT_T: + case PNS::ITEM::SEGMENT_T: { - PNS::PNS_SEGMENT* seg = (PNS::PNS_SEGMENT*) aItem; + PNS::SEGMENT* seg = (PNS::SEGMENT*) aItem; m_type = PR_SHAPE; m_width = seg->Width(); break; } - case PNS::PNS_ITEM::VIA_T: + case PNS::ITEM::VIA_T: m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE ); m_type = PR_SHAPE; m_width = 0; @@ -107,7 +107,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem ) m_depth = ViaOverlayDepth; break; - case PNS::PNS_ITEM::SOLID_T: + case PNS::ITEM::SOLID_T: m_type = PR_SHAPE; m_width = 0; break; diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h index 56bb97b551..33f211cbd1 100644 --- a/pcbnew/router/router_preview_item.h +++ b/pcbnew/router/router_preview_item.h @@ -41,8 +41,8 @@ namespace PNS { -class PNS_ITEM; -class PNS_ROUTER; +class ITEM; +class ROUTER; } @@ -56,10 +56,10 @@ public: PR_SHAPE }; - ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL ); + ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL ); ~ROUTER_PREVIEW_ITEM(); - void Update( const PNS::PNS_ITEM* aItem ); + void Update( const PNS::ITEM* aItem ); void StuckMarker( VECTOR2I& aPosition ); @@ -107,7 +107,7 @@ private: KIGFX::VIEW_GROUP* m_parent; - PNS::PNS_ROUTER* m_router; + PNS::ROUTER* m_router; SHAPE* m_shape; ITEM_TYPE m_type; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 9407fc254c..2e62349371 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -110,7 +110,7 @@ static TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimension ROUTER_TOOL::ROUTER_TOOL() : - PNS_TOOL_BASE( "pcbnew.InteractiveRouter" ) + TOOL_BASE( "pcbnew.InteractiveRouter" ) { } @@ -200,7 +200,7 @@ private: class ROUTER_TOOL_MENU: public CONTEXT_MENU { public: - ROUTER_TOOL_MENU( BOARD* aBoard, PNS::PNS_ROUTER_MODE aMode ) + ROUTER_TOOL_MENU( BOARD* aBoard, PNS::ROUTER_MODE aMode ) { SetTitle( _( "Interactive Router" ) ); Add( ACT_NewTrack ); @@ -223,7 +223,7 @@ public: Add( ACT_SetDpDimensions ); AppendSeparator(); - Add( PNS::PNS_TOOL_BASE::ACT_RouterOptions ); + Add( PNS::TOOL_BASE::ACT_RouterOptions ); } private: @@ -245,7 +245,7 @@ bool ROUTER_TOOL::Init() void ROUTER_TOOL::Reset( RESET_REASON aReason ) { - PNS_TOOL_BASE::Reset( aReason ); + TOOL_BASE::Reset( aReason ); Go( &ROUTER_TOOL::RouteSingleTrace, COMMON_ACTIONS::routerActivateSingle.MakeEvent() ); Go( &ROUTER_TOOL::RouteDiffPair, COMMON_ACTIONS::routerActivateDiffPair.MakeEvent() ); @@ -314,7 +314,7 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) } else if( aEvent.IsAction( &ACT_SetDpDimensions ) ) { - PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes(); + PNS::SIZES_SETTINGS sizes = m_router->Sizes(); DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes ); if( settingsDlg.ShowModal() ) @@ -337,20 +337,20 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) else if( aEvent.IsAction( &COMMON_ACTIONS::trackViaSizeChanged ) ) { - PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() ); + PNS::SIZES_SETTINGS sizes( m_router->Sizes() ); sizes.ImportCurrent( m_board->GetDesignSettings() ); m_router->UpdateSizes( sizes ); } } -int ROUTER_TOOL::getStartLayer( const PNS::PNS_ITEM* aItem ) +int ROUTER_TOOL::getStartLayer( const PNS::ITEM* aItem ) { int tl = getView()->GetTopLayer(); if( m_startItem ) { - const PNS_LAYERSET& ls = m_startItem->Layers(); + const LAYER_RANGE& ls = m_startItem->Layers(); if( ls.Overlaps( tl ) ) return tl; @@ -391,7 +391,7 @@ bool ROUTER_TOOL::onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType ) LAYER_ID pairTop = m_frame->GetScreen()->m_Route_Layer_TOP; LAYER_ID pairBottom = m_frame->GetScreen()->m_Route_Layer_BOTTOM; - PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes(); + PNS::SIZES_SETTINGS sizes = m_router->Sizes(); // fixme: P&S supports more than one fixed layer pair. Update the dialog? sizes.ClearLayerPairs(); @@ -507,7 +507,7 @@ bool ROUTER_TOOL::prepareInteractive() m_ctls->ForceCursorPosition( false ); m_ctls->SetAutoPan( true ); - PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() ); + PNS::SIZES_SETTINGS sizes( m_router->Sizes() ); sizes.Init( m_board, m_startItem ); sizes.AddLayerPair( m_frame->GetScreen()->m_Route_Layer_TOP, @@ -619,7 +619,7 @@ int ROUTER_TOOL::DpDimensionsDialog( const TOOL_EVENT& aEvent ) { Activate(); - PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes(); + PNS::SIZES_SETTINGS sizes = m_router->Sizes(); DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes ); if( settingsDlg.ShowModal() ) @@ -660,7 +660,7 @@ int ROUTER_TOOL::RouteDiffPair( const TOOL_EVENT& aEvent ) } -int ROUTER_TOOL::mainLoop( PNS::PNS_ROUTER_MODE aMode ) +int ROUTER_TOOL::mainLoop( PNS::ROUTER_MODE aMode ) { PCB_EDIT_FRAME* frame = getEditFrame(); BOARD* board = getModel(); diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h index ddf1fb93f4..95d0cdd1e5 100644 --- a/pcbnew/router/router_tool.h +++ b/pcbnew/router/router_tool.h @@ -25,7 +25,7 @@ #include "pns_tool_base.h" -class APIEXPORT ROUTER_TOOL : public PNS::PNS_TOOL_BASE +class APIEXPORT ROUTER_TOOL : public PNS::TOOL_BASE { public: ROUTER_TOOL(); @@ -43,7 +43,7 @@ public: private: - int mainLoop( PNS::PNS_ROUTER_MODE aMode ); + int mainLoop( PNS::ROUTER_MODE aMode ); int getDefaultWidth( int aNetCode ); @@ -53,7 +53,7 @@ private: void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill ); void handleCommonEvents( const TOOL_EVENT& evt ); - int getStartLayer( const PNS::PNS_ITEM* aItem ); + int getStartLayer( const PNS::ITEM* aItem ); void switchLayerOnViaPlacement(); bool onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType );