diff --git a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp index 0ce3c63a4e..920bf8bb62 100644 --- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp +++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2014-2015 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 @@ -25,7 +26,7 @@ #include "dialog_pns_diff_pair_dimensions.h" #include -DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes ) : +DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::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 70f0538137..80e413fb20 100644 --- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h +++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2014-2015 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 @@ -29,12 +30,16 @@ #include "dialog_pns_diff_pair_dimensions_base.h" +namespace PNS { + class PNS_SIZES_SETTINGS; +} + class DIALOG_PNS_DIFF_PAIR_DIMENSIONS : public DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE { public: - DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes ); + DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::PNS_SIZES_SETTINGS& aSizes ); private: void updateCheckbox(); @@ -46,7 +51,7 @@ private: WX_UNIT_BINDER m_traceGap; WX_UNIT_BINDER m_viaGap; - PNS_SIZES_SETTINGS& m_sizes; + PNS::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 6ec2534eb0..28f3ae1a77 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2014-2015 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 @@ -25,7 +26,9 @@ #include "dialog_pns_length_tuning_settings.h" #include -DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode ) : +DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, + PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode ) + : DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( aParent ), m_minAmpl( this, m_minAmplText, m_minAmplUnit ), m_maxAmpl( this, m_maxAmplText, m_maxAmplUnit ), @@ -35,7 +38,7 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* m_mode( aMode ) { m_miterStyle->Enable( true ); - m_radiusText->Enable( aMode != PNS_MODE_TUNE_DIFF_PAIR ); + m_radiusText->Enable( aMode != PNS::PNS_MODE_TUNE_DIFF_PAIR ); //m_minAmpl.Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR_SKEW ); m_minAmpl.SetValue( m_settings.m_minAmplitude ); @@ -44,23 +47,23 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* m_spacing.SetValue( m_settings.m_spacing ); m_radiusText->SetValue( wxString::Format( wxT( "%i" ), m_settings.m_cornerRadiusPercentage ) ); - m_miterStyle->SetSelection( m_settings.m_cornerStyle == MEANDER_STYLE_ROUND ? 1 : 0 ); + m_miterStyle->SetSelection( m_settings.m_cornerStyle == PNS::MEANDER_STYLE_ROUND ? 1 : 0 ); switch( aMode ) { - case PNS_MODE_TUNE_SINGLE: + case PNS::PNS_MODE_TUNE_SINGLE: SetTitle( _( "Single Track Length Tuning" ) ); m_legend->SetBitmap( KiBitmap( tune_single_track_length_legend_xpm ) ); m_targetLength.SetValue( m_settings.m_targetLength ); break; - case PNS_MODE_TUNE_DIFF_PAIR: + case PNS::PNS_MODE_TUNE_DIFF_PAIR: SetTitle( _( "Differential Pair Length Tuning" ) ); m_legend->SetBitmap( KiBitmap( tune_diff_pair_length_legend_xpm ) ); m_targetLength.SetValue( m_settings.m_targetLength ); break; - case PNS_MODE_TUNE_DIFF_PAIR_SKEW: + case PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW: SetTitle( _( "Differential Pair Skew Tuning" ) ); m_legend->SetBitmap( KiBitmap( tune_diff_pair_skew_legend_xpm ) ); m_targetLengthLabel->SetLabel( _( "Target skew: " ) ); @@ -89,7 +92,7 @@ void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent ) m_settings.m_cornerRadiusPercentage = wxAtoi( m_radiusText->GetValue() ); - if( m_mode == PNS_MODE_TUNE_DIFF_PAIR_SKEW ) + if( m_mode == PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW ) m_settings.m_targetSkew = m_targetLength.GetValue(); else m_settings.m_targetLength = m_targetLength.GetValue(); @@ -97,7 +100,8 @@ void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent ) if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude ) m_settings.m_maxAmplitude = m_settings.m_minAmplitude; - m_settings.m_cornerStyle = m_miterStyle->GetSelection() ? MEANDER_STYLE_ROUND : MEANDER_STYLE_CHAMFER; + m_settings.m_cornerStyle = m_miterStyle->GetSelection() ? + PNS::MEANDER_STYLE_ROUND : PNS::MEANDER_STYLE_CHAMFER; EndModal( wxID_OK ); } diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h index f6dcba3886..5057ad86bb 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2014 CERN + * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Author: Maciej Suminski * * This program is free software: you can redistribute it and/or modify it @@ -31,12 +32,16 @@ #include +namespace PNS { + class PNS_MEANDER_SETTINGS; +} + class DIALOG_PNS_LENGTH_TUNING_SETTINGS : public DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE { public: - DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode ); + DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode ); virtual void OnOkClick( wxCommandEvent& aEvent ); @@ -46,8 +51,8 @@ private: WX_UNIT_BINDER m_spacing; WX_UNIT_BINDER m_targetLength; - PNS_MEANDER_SETTINGS& m_settings; - PNS_ROUTER_MODE m_mode; + PNS::PNS_MEANDER_SETTINGS& m_settings; + PNS::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 c310a52f7c..6dc9122e4b 100644 --- a/pcbnew/dialogs/dialog_pns_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_settings.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2014 CERN + * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Author: Maciej Suminski * * This program is free software: you can redistribute it and/or modify it @@ -25,11 +26,11 @@ #include "dialog_pns_settings.h" #include -DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) : +DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings ) : DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings ) { // "Figure out what's best" is not available yet - m_mode->Enable( RM_Smart, false ); + m_mode->Enable( PNS::RM_Smart, false ); // Add tool tip to the mode radio box, one by option // (cannot be made with wxFormBuilder for each item ) @@ -59,13 +60,13 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTING void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent ) { // Save widgets' values to settings - m_settings.SetMode( (PNS_MODE) m_mode->GetSelection() ); + m_settings.SetMode( (PNS::PNS_MODE) m_mode->GetSelection() ); m_settings.SetShoveVias( m_shoveVias->GetValue() ); m_settings.SetJumpOverObstacles( m_backPressure->GetValue() ); m_settings.SetRemoveLoops( m_removeLoops->GetValue() ); m_settings.SetSuggestFinish ( m_suggestEnding->GetValue() ); m_settings.SetSmartPads( m_autoNeckdown->GetValue() ); - m_settings.SetOptimizerEffort( (PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() ); + m_settings.SetOptimizerEffort( (PNS::PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() ); m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() ); m_settings.SetCanViolateDRC( m_violateDrc->GetValue() ); m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() ); diff --git a/pcbnew/dialogs/dialog_pns_settings.h b/pcbnew/dialogs/dialog_pns_settings.h index d59cfa5f6a..ec85dfcb1e 100644 --- a/pcbnew/dialogs/dialog_pns_settings.h +++ b/pcbnew/dialogs/dialog_pns_settings.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2014 CERN + * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Author: Maciej Suminski * * This program is free software: you can redistribute it and/or modify it @@ -27,17 +28,21 @@ #include "dialog_pns_settings_base.h" +namespace PNS { + class PNS_ROUTING_SETTINGS; +} + class DIALOG_PNS_SETTINGS : public DIALOG_PNS_SETTINGS_BASE { - public: - DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ); + public: + DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings ); - private: + private: virtual void OnOkClick( wxCommandEvent& aEvent ); - PNS_ROUTING_SETTINGS& m_settings; + PNS::PNS_ROUTING_SETTINGS& m_settings; }; #endif // __dialog_pns_settings__ diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp index 117abecb42..595d300ddf 100644 --- a/pcbnew/router/length_tuner_tool.cpp +++ b/pcbnew/router/length_tuner_tool.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -120,14 +121,14 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) } } - PNS_MEANDER_PLACER_BASE* placer = static_cast( m_router->Placer() ); + PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast( m_router->Placer() ); if( !placer ) return; if( aEvent.IsAction( &ACT_Settings ) ) { - PNS_MEANDER_SETTINGS settings = placer->MeanderSettings(); + PNS::PNS_MEANDER_SETTINGS settings = placer->MeanderSettings(); DIALOG_PNS_LENGTH_TUNING_SETTINGS settingsDlg( m_frame, settings, m_router->Mode() ); if( settingsDlg.ShowModal() ) @@ -170,7 +171,8 @@ void LENGTH_TUNER_TOOL::performTuning() return; } - PNS_MEANDER_PLACER_BASE* placer = static_cast( m_router->Placer() ); + PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast( + m_router->Placer() ); placer->UpdateSettings( m_savedMeanderSettings ); @@ -236,25 +238,25 @@ void LENGTH_TUNER_TOOL::performTuning() int LENGTH_TUNER_TOOL::TuneSingleTrace( const TOOL_EVENT& aEvent ) { m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Trace Length" ) ); - return mainLoop( PNS_MODE_TUNE_SINGLE ); + return mainLoop( PNS::PNS_MODE_TUNE_SINGLE ); } int LENGTH_TUNER_TOOL::TuneDiffPair( const TOOL_EVENT& aEvent ) { m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Length" ) ); - return mainLoop( PNS_MODE_TUNE_DIFF_PAIR ); + return mainLoop( PNS::PNS_MODE_TUNE_DIFF_PAIR ); } int LENGTH_TUNER_TOOL::TuneDiffPairSkew( const TOOL_EVENT& aEvent ) { m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Skew" ) ); - return mainLoop( PNS_MODE_TUNE_DIFF_PAIR_SKEW ); + return mainLoop( PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW ); } -int LENGTH_TUNER_TOOL::mainLoop( PNS_ROUTER_MODE aMode ) +int LENGTH_TUNER_TOOL::mainLoop( PNS::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 075d907b39..fbc9c72b55 100644 --- a/pcbnew/router/length_tuner_tool.h +++ b/pcbnew/router/length_tuner_tool.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 CERN + * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Author: Tomasz Wlostowski * Author: Maciej Suminski * @@ -27,7 +28,7 @@ class PNS_TUNE_STATUS_POPUP; -class APIEXPORT LENGTH_TUNER_TOOL : public PNS_TOOL_BASE +class APIEXPORT LENGTH_TUNER_TOOL : public PNS::PNS_TOOL_BASE { public: LENGTH_TUNER_TOOL(); @@ -42,13 +43,13 @@ public: private: void performTuning( ); - int mainLoop( PNS_ROUTER_MODE aMode ); + int mainLoop( PNS::PNS_ROUTER_MODE aMode ); void handleCommonEvents( const TOOL_EVENT& aEvent ); void updateStatusPopup ( PNS_TUNE_STATUS_POPUP& aPopup ); - PNS_MEANDER_SETTINGS m_savedMeanderSettings; + PNS::PNS_MEANDER_SETTINGS m_savedMeanderSettings; }; #endif diff --git a/pcbnew/router/pns_algo_base.cpp b/pcbnew/router/pns_algo_base.cpp index a24678bf5a..ce3ba8df56 100644 --- a/pcbnew/router/pns_algo_base.cpp +++ b/pcbnew/router/pns_algo_base.cpp @@ -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 @@ -22,6 +23,8 @@ #include "pns_debug_decorator.h" #include "pns_router.h" +namespace PNS { + PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const { return m_router->Settings(); @@ -32,3 +35,5 @@ PNS_LOGGER* PNS_ALGO_BASE::Logger() { return NULL; } + +} diff --git a/pcbnew/router/pns_algo_base.h b/pcbnew/router/pns_algo_base.h index 78e7e87d53..ee6d9301b5 100644 --- a/pcbnew/router/pns_algo_base.h +++ b/pcbnew/router/pns_algo_base.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 @@ -23,6 +24,8 @@ #include "pns_routing_settings.h" +namespace PNS { + class PNS_ROUTER; class PNS_LOGGER; class PNS_DEBUG_DECORATOR; @@ -74,4 +77,6 @@ private: PNS_ROUTER* m_router; }; +} + #endif diff --git a/pcbnew/router/pns_debug_decorator.h b/pcbnew/router/pns_debug_decorator.h index 4cec4c55b2..dc991e8070 100644 --- a/pcbnew/router/pns_debug_decorator.h +++ b/pcbnew/router/pns_debug_decorator.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: Christian Gagneraud * * This program is free software: you can redistribute it and/or modify it @@ -26,6 +27,8 @@ #include #include +namespace PNS { + class PNS_DEBUG_DECORATOR { public: @@ -43,4 +46,6 @@ public: virtual void Clear() {}; }; +} + #endif diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp index 13d631a99f..16887f5748 100644 --- a/pcbnew/router/pns_diff_pair.cpp +++ b/pcbnew/router/pns_diff_pair.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -36,6 +37,8 @@ #include "pns_utils.h" #include "pns_debug_decorator.h" +namespace PNS { + class PNS_LINE; PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN ) @@ -896,3 +899,5 @@ int PNS_DIFF_PAIR::CoupledLength ( const SEG& aP, const SEG& aN ) const return 0; } + +} diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h index 6b6dae3fe3..f5248de581 100644 --- a/pcbnew/router/pns_diff_pair.h +++ b/pcbnew/router/pns_diff_pair.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -32,6 +33,8 @@ #include "ranged_num.h" +namespace PNS { + class PNS_DIFF_PAIR; /** @@ -511,4 +514,6 @@ private: RANGED_NUM m_gapConstraint; }; +} + #endif diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index f55a62ba2f..dd1692e6bf 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -32,6 +33,8 @@ #include "pns_topology.h" #include "pns_debug_decorator.h" +namespace PNS { + PNS_DIFF_PAIR_PLACER::PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter ) : PNS_PLACEMENT_ALGO( aRouter ) { @@ -576,7 +579,7 @@ bool PNS_DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) m_netN = m_start.PrimN()->Net(); #if 0 - // FIXME: this also needs to be factored out but not so important right now + // FIXME: this also needs to be factored out but not so important right now // Check if the current track/via gap & track width settings are violated BOARD* brd = NULL; // FIXME Router()->GetBoard(); NETCLASSPTR netclassP = brd->FindNet( m_netP )->GetNetClass(); @@ -844,3 +847,5 @@ const std::vector PNS_DIFF_PAIR_PLACER::CurrentNets() const rv.push_back( m_netN ); return rv; } + +} diff --git a/pcbnew/router/pns_diff_pair_placer.h b/pcbnew/router/pns_diff_pair_placer.h index e5e31957b3..e7a076e41d 100644 --- a/pcbnew/router/pns_diff_pair_placer.h +++ b/pcbnew/router/pns_diff_pair_placer.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 @@ -35,6 +36,8 @@ #include "pns_placement_algo.h" +namespace PNS { + class PNS_ROUTER; class PNS_SHOVE; class PNS_OPTIMIZER; @@ -296,4 +299,6 @@ private: bool m_idle; }; +} + #endif // __PNS_LINE_PLACER_H diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index 62fb2fe53a..ba9db37b83 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -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 @@ -30,6 +31,8 @@ #include "pns_router.h" #include "pns_utils.h" +namespace PNS { + using boost::optional; PNS_DP_MEANDER_PLACER::PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter ) : @@ -399,3 +402,5 @@ const std::vector PNS_DP_MEANDER_PLACER::CurrentNets() const rv.push_back( m_originPair.NetN() ); return rv; } + +} diff --git a/pcbnew/router/pns_dp_meander_placer.h b/pcbnew/router/pns_dp_meander_placer.h index 38a95aae1f..240d3de96b 100644 --- a/pcbnew/router/pns_dp_meander_placer.h +++ b/pcbnew/router/pns_dp_meander_placer.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 @@ -35,6 +36,8 @@ #include "pns_diff_pair.h" #include "pns_debug_decorator.h" +namespace PNS { + class PNS_ROUTER; /** @@ -141,4 +144,6 @@ private: TUNING_STATUS m_lastStatus; }; +} + #endif // __PNS_DP_MEANDER_PLACER_H diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index 7089ddb6da..2a7f2c202b 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -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 @@ -22,6 +23,8 @@ #include "pns_shove.h" #include "pns_router.h" +namespace PNS { + PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) : PNS_ALGO_BASE( aRouter ) { @@ -335,3 +338,5 @@ PNS_LOGGER* PNS_DRAGGER::Logger() return NULL; } + +} diff --git a/pcbnew/router/pns_dragger.h b/pcbnew/router/pns_dragger.h index ed6a59b19a..d4c727afea 100644 --- a/pcbnew/router/pns_dragger.h +++ b/pcbnew/router/pns_dragger.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 @@ -29,6 +30,8 @@ #include "pns_algo_base.h" #include "pns_itemset.h" +namespace PNS { + class PNS_ROUTER; class PNS_SHOVE; class PNS_OPTIMIZER; @@ -123,4 +126,6 @@ private: PNS_ITEMSET m_draggedItems; }; +} + #endif diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h index abeeb61224..15380b2c83 100644 --- a/pcbnew/router/pns_index.h +++ b/pcbnew/router/pns_index.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 @@ -31,6 +32,9 @@ #include "pns_item.h" +namespace PNS { + + /** * Class PNS_INDEX * @@ -311,4 +315,6 @@ PNS_INDEX::NET_ITEMS_LIST* PNS_INDEX::GetItemsForNet( int aNet ) return &m_netMap[aNet]; } +} + #endif diff --git a/pcbnew/router/pns_item.cpp b/pcbnew/router/pns_item.cpp index eb4b60766c..01d5aa98c8 100644 --- a/pcbnew/router/pns_item.cpp +++ b/pcbnew/router/pns_item.cpp @@ -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 @@ -21,6 +22,8 @@ #include "pns_item.h" #include "pns_line.h" +namespace PNS { + bool PNS_ITEM::collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV, VECTOR2I& aMTV, bool aDifferentNetsOnly ) const { @@ -85,3 +88,5 @@ const std::string PNS_ITEM::KindStr() const PNS_ITEM::~PNS_ITEM() { } + +} diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index 24e1a3e527..43a6e46695 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.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 @@ -29,6 +30,9 @@ #include "pns_layerset.h" class BOARD_CONNECTED_ITEM; + +namespace PNS { + class PNS_NODE; enum LineMarker { @@ -350,4 +354,6 @@ protected: int m_rank; }; +} + #endif // __PNS_ITEM_H diff --git a/pcbnew/router/pns_itemset.cpp b/pcbnew/router/pns_itemset.cpp index dc7b12c857..32f19c57ce 100644 --- a/pcbnew/router/pns_itemset.cpp +++ b/pcbnew/router/pns_itemset.cpp @@ -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 @@ -21,6 +22,7 @@ #include "pns_itemset.h" #include "pns_line.h" +namespace PNS { PNS_ITEMSET::~PNS_ITEMSET() { @@ -134,3 +136,5 @@ PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem ) return *this; } + +} diff --git a/pcbnew/router/pns_itemset.h b/pcbnew/router/pns_itemset.h index e39a65435a..59e02a5836 100644 --- a/pcbnew/router/pns_itemset.h +++ b/pcbnew/router/pns_itemset.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 @@ -25,6 +26,8 @@ #include "pns_item.h" +namespace PNS { + /** * Class PNS_ITEMSET * @@ -223,4 +226,6 @@ private: ENTRIES m_items; }; +} + #endif diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index e3aef6594c..50c6afead9 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.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 @@ -30,6 +31,8 @@ #include "pns_segment.h" #include "pns_itemset.h" +namespace PNS { + /** * Class PNS_JOINT * @@ -256,4 +259,6 @@ inline std::size_t hash_value( PNS_JOINT::HASH_TAG const& aP ) return seed; } +} + #endif // __PNS_JOINT_H diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index e9251f6422..7c75f41740 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -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 @@ -59,6 +60,8 @@ #include "pns_debug_decorator.h" #include "router_preview_item.h" +using namespace PNS; + class PNS_PCBNEW_RULE_RESOLVER : public PNS_RULE_RESOLVER { public: diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 03f84d8159..894e3b584b 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -34,43 +34,43 @@ namespace KIGFX class VIEW; }; -class PNS_KICAD_IFACE : public PNS_ROUTER_IFACE { +class PNS_KICAD_IFACE : public PNS::PNS_ROUTER_IFACE { public: PNS_KICAD_IFACE(); ~PNS_KICAD_IFACE(); - void SetRouter( PNS_ROUTER* aRouter ); + void SetRouter( PNS::PNS_ROUTER* aRouter ); void SetHostFrame( PCB_EDIT_FRAME* aFrame ); void SetBoard( BOARD* aBoard ); void SetView( KIGFX::VIEW* aView ); - void SyncWorld( PNS_NODE* aWorld ); + void SyncWorld( PNS::PNS_NODE* aWorld ); void EraseView(); - 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 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 Commit(); void UpdateNet( int aNetCode ); - PNS_RULE_RESOLVER* GetRuleResolver(); - PNS_DEBUG_DECORATOR* GetDebugDecorator(); + PNS::PNS_RULE_RESOLVER* GetRuleResolver(); + PNS::PNS_DEBUG_DECORATOR* GetDebugDecorator(); private: PNS_PCBNEW_RULE_RESOLVER* m_ruleResolver; PNS_PCBNEW_DEBUG_DECORATOR* m_debugDecorator; - PNS_ITEM* syncPad( D_PAD* aPad ); - PNS_ITEM* syncTrack( TRACK* aTrack ); - PNS_ITEM* syncVia( VIA* aVia ); + PNS::PNS_ITEM* syncPad( D_PAD* aPad ); + PNS::PNS_ITEM* syncTrack( TRACK* aTrack ); + PNS::PNS_ITEM* syncVia( VIA* aVia ); KIGFX::VIEW* m_view; KIGFX::VIEW_GROUP* m_previewItems; std::unordered_set m_hiddenItems; - PNS_NODE* m_world; - PNS_ROUTER* m_router; + PNS::PNS_NODE* m_world; + PNS::PNS_ROUTER* m_router; BOARD* m_board; PICKED_ITEMS_LIST m_undoBuffer; PCB_EDIT_FRAME* m_frame; diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 512ab1b4c5..78b5985f81 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -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 @@ -32,6 +33,8 @@ using boost::optional; +namespace PNS { + PNS_LINE::PNS_LINE( const PNS_LINE& aOther ) : PNS_ITEM( aOther ), m_line( aOther.m_line ), @@ -900,3 +903,5 @@ bool PNS_LINE::HasLockedSegments() const } return false; } + +} diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h index ebfb493a85..6a38499db7 100644 --- a/pcbnew/router/pns_line.h +++ b/pcbnew/router/pns_line.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 @@ -31,6 +32,8 @@ #include "pns_item.h" #include "pns_via.h" +namespace PNS { + class PNS_NODE; class PNS_SEGMENT; class PNS_VIA; @@ -297,4 +300,6 @@ private: PNS_VIA m_via; }; +} + #endif // __PNS_LINE_H diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index c099619689..6a14c81555 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -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 @@ -33,6 +34,8 @@ using boost::optional; +namespace PNS { + PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) : PNS_PLACEMENT_ALGO( aRouter ) { @@ -1101,3 +1104,5 @@ PNS_LOGGER* PNS_LINE_PLACER::Logger() return NULL; } + +} diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h index f74ab93f9b..f07199e4e1 100644 --- a/pcbnew/router/pns_line_placer.h +++ b/pcbnew/router/pns_line_placer.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 @@ -32,6 +33,8 @@ #include "pns_line.h" #include "pns_placement_algo.h" +namespace PNS { + class PNS_ROUTER; class PNS_SHOVE; class PNS_OPTIMIZER; @@ -393,4 +396,6 @@ private: bool m_orthoMode; }; +} + #endif // __PNS_LINE_PLACER_H diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp index 255bffcabf..6735e2fc6d 100644 --- a/pcbnew/router/pns_logger.cpp +++ b/pcbnew/router/pns_logger.cpp @@ -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 @@ -31,6 +32,8 @@ #include #include +namespace PNS { + PNS_LOGGER::PNS_LOGGER( ) { m_groupOpened = false; @@ -201,3 +204,5 @@ void PNS_LOGGER::Save( const std::string& aFilename ) fwrite( s.c_str(), 1, s.length(), f ); fclose( f ); } + +} diff --git a/pcbnew/router/pns_logger.h b/pcbnew/router/pns_logger.h index b38fd427c8..24f2bd39cd 100644 --- a/pcbnew/router/pns_logger.h +++ b/pcbnew/router/pns_logger.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 @@ -28,10 +29,13 @@ #include -class PNS_ITEM; class SHAPE_LINE_CHAIN; class SHAPE; +namespace PNS { + +class PNS_ITEM; + class PNS_LOGGER { public: @@ -56,4 +60,6 @@ private: std::stringstream m_theLog; }; +} + #endif diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index d7408bbde7..b6fd2578ca 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -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 @@ -28,6 +29,8 @@ #include "pns_router.h" #include "pns_debug_decorator.h" +namespace PNS { + const PNS_MEANDER_SETTINGS& PNS_MEANDER_SHAPE::Settings() const { return m_placer->MeanderSettings(); @@ -636,3 +639,5 @@ void PNS_MEANDER_SHAPE::updateBaseSegment( ) m_clippedBaseSeg.B = m_baseSeg.LineProject( CLine( 0 ).CPoint( -1 ) ); } } + +} diff --git a/pcbnew/router/pns_meander.h b/pcbnew/router/pns_meander.h index 0976a09416..44ca3b2986 100644 --- a/pcbnew/router/pns_meander.h +++ b/pcbnew/router/pns_meander.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -26,6 +27,8 @@ #include #include +namespace PNS { + class PNS_MEANDER_PLACER_BASE; ///< Shapes of available meanders @@ -511,4 +514,6 @@ private: int m_baselineOffset; }; +} + #endif // __PNS_MEANDER_H diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp index a67b145f7d..ac0d3fa8cf 100644 --- a/pcbnew/router/pns_meander_placer.cpp +++ b/pcbnew/router/pns_meander_placer.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -27,6 +28,7 @@ #include "pns_router.h" #include "pns_debug_decorator.h" +namespace PNS { PNS_MEANDER_PLACER::PNS_MEANDER_PLACER( PNS_ROUTER* aRouter ) : PNS_MEANDER_PLACER_BASE( aRouter ) @@ -262,3 +264,5 @@ PNS_MEANDER_PLACER::TUNING_STATUS PNS_MEANDER_PLACER::TuningStatus() const { return m_lastStatus; } + +} diff --git a/pcbnew/router/pns_meander_placer.h b/pcbnew/router/pns_meander_placer.h index b38457e666..c6284bfb21 100644 --- a/pcbnew/router/pns_meander_placer.h +++ b/pcbnew/router/pns_meander_placer.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 @@ -33,6 +34,8 @@ #include "pns_meander.h" #include "pns_meander_placer_base.h" +namespace PNS { + class PNS_ROUTER; class PNS_SHOVE; class PNS_OPTIMIZER; @@ -115,4 +118,6 @@ protected: TUNING_STATUS m_lastStatus; }; +} + #endif // __PNS_MEANDER_PLACER_H diff --git a/pcbnew/router/pns_meander_placer_base.cpp b/pcbnew/router/pns_meander_placer_base.cpp index bb154513ec..dc999b9d14 100644 --- a/pcbnew/router/pns_meander_placer_base.cpp +++ b/pcbnew/router/pns_meander_placer_base.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -22,6 +23,8 @@ #include "pns_meander.h" #include "pns_meander_placer_base.h" +namespace PNS { + PNS_MEANDER_PLACER_BASE::PNS_MEANDER_PLACER_BASE( PNS_ROUTER* aRouter ) : PNS_PLACEMENT_ALGO( aRouter ) { @@ -185,3 +188,5 @@ int PNS_MEANDER_PLACER_BASE::compareWithTolerance( int aValue, int aExpected, in else return 0; } + +} diff --git a/pcbnew/router/pns_meander_placer_base.h b/pcbnew/router/pns_meander_placer_base.h index 070e322d3f..f8f889956c 100644 --- a/pcbnew/router/pns_meander_placer_base.h +++ b/pcbnew/router/pns_meander_placer_base.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -32,6 +33,8 @@ #include "pns_placement_algo.h" #include "pns_meander.h" +namespace PNS { + class PNS_ROUTER; class PNS_SHOVE; class PNS_OPTIMIZER; @@ -162,4 +165,6 @@ protected: VECTOR2I m_currentEnd; }; +} + #endif // __PNS_MEANDER_PLACER_BASE_H diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp index a9c6b88334..c125274ee0 100644 --- a/pcbnew/router/pns_meander_skew_placer.cpp +++ b/pcbnew/router/pns_meander_skew_placer.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -28,6 +29,7 @@ #include "pns_router.h" #include "pns_debug_decorator.h" +namespace PNS { PNS_MEANDER_SKEW_PLACER::PNS_MEANDER_SKEW_PLACER ( PNS_ROUTER* aRouter ) : PNS_MEANDER_PLACER ( aRouter ) @@ -126,7 +128,7 @@ int PNS_MEANDER_SKEW_PLACER::currentSkew() const bool PNS_MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) { - for( const PNS_ITEM* item : m_tunedPathP.CItems() ) + for( const PNS_ITEM* item : m_tunedPathP.CItems() ) { if( const PNS_LINE* l = dyn_cast( item ) ) Dbg()->AddLine( l->CLine(), 5, 10000 ); @@ -167,3 +169,5 @@ const wxString PNS_MEANDER_SKEW_PLACER::TuningInfo() const return status; } + +} diff --git a/pcbnew/router/pns_meander_skew_placer.h b/pcbnew/router/pns_meander_skew_placer.h index 7cb303c15d..3ca0c92d62 100644 --- a/pcbnew/router/pns_meander_skew_placer.h +++ b/pcbnew/router/pns_meander_skew_placer.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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,6 +25,8 @@ #include "pns_meander_placer.h" #include "pns_diff_pair.h" +namespace PNS { + class PNS_ROUTER; class PNS_SHOVE; class PNS_OPTIMIZER; @@ -62,4 +65,6 @@ private: int m_coupledLength; }; +} + #endif // __PNS_MEANDER_SKEW_PLACER_H diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index 13922eef8c..b2f1a2c45a 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -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 @@ -40,6 +41,8 @@ using boost::unordered_set; using boost::unordered_map; +namespace PNS { + #ifdef DEBUG static boost::unordered_set allocNodes; #endif @@ -760,7 +763,7 @@ void PNS_NODE::Remove( PNS_LINE& aLine ) void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos, int aLimit, VECTOR2I* aCorners, PNS_SEGMENT** aSegments, bool& aGuardHit, - bool aStopAtLockedJoints ) + bool aStopAtLockedJoints ) { bool prevReversed = false; @@ -1302,3 +1305,5 @@ PNS_ITEM *PNS_NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent ) return NULL; } + +} diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index cdb8a16015..f05803b4ca 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.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 @@ -36,6 +37,8 @@ #include "pns_joint.h" #include "pns_itemset.h" +namespace PNS { + class PNS_SEGMENT; class PNS_LINE; class PNS_SOLID; @@ -487,4 +490,6 @@ private: boost::unordered_set m_garbageItems; }; +} + #endif diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index ee6c4247cc..8b1f394424 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -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 @@ -32,6 +33,8 @@ #include "pns_utils.h" #include "pns_router.h" +namespace PNS { + /** * Cost Estimator Methods */ @@ -1224,3 +1227,5 @@ bool PNS_OPTIMIZER::Optimize( PNS_DIFF_PAIR* aPair ) { return mergeDpSegments( aPair ); } + +} diff --git a/pcbnew/router/pns_optimizer.h b/pcbnew/router/pns_optimizer.h index 61a09234bb..3be4a3639f 100644 --- a/pcbnew/router/pns_optimizer.h +++ b/pcbnew/router/pns_optimizer.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 @@ -29,6 +30,8 @@ #include "range.h" +namespace PNS { + class PNS_NODE; class PNS_ROUTER; class PNS_LINE; @@ -178,4 +181,6 @@ private: bool m_restrictAreaActive; }; +} + #endif diff --git a/pcbnew/router/pns_placement_algo.h b/pcbnew/router/pns_placement_algo.h index 6598d821ac..de61c64641 100644 --- a/pcbnew/router/pns_placement_algo.h +++ b/pcbnew/router/pns_placement_algo.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 @@ -27,6 +28,8 @@ #include "pns_sizes_settings.h" #include "pns_itemset.h" +namespace PNS { + class PNS_ROUTER; class PNS_ITEM; class PNS_NODE; @@ -182,4 +185,6 @@ public: } }; +} + #endif diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 3af2fa4eca..41a1a0a4b6 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -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 @@ -57,6 +58,7 @@ #include #include +namespace PNS { // an ugly singleton for drawing debug items within the router context. // To be fixed sometime in the future. @@ -281,7 +283,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) aNode->GetUpdatedItems( removed, added ); - for ( auto item : added ) + for ( auto item : added ) m_iface->DisplayItem( item ); for ( auto item : removed ) @@ -378,7 +380,7 @@ void PNS_ROUTER::StopRouting() m_placer->GetModifiedNets( nets ); // Update the ratsnest with new changes - for ( auto n : nets ) + for ( auto n : nets ) m_iface->UpdateNet( n ); } @@ -502,3 +504,5 @@ void PNS_ROUTER::SetInterface( PNS_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 4803fbdde8..997bd8fefc 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.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 @@ -34,6 +35,16 @@ #include "pns_itemset.h" #include "pns_node.h" +namespace KIGFX +{ + +class VIEW; +class VIEW_GROUP; + +}; + +namespace PNS { + class PNS_DEBUG_DECORATOR; class PNS_NODE; class PNS_DIFF_PAIR_PLACER; @@ -49,13 +60,6 @@ class PNS_RULE_RESOLVER; class PNS_SHOVE; class PNS_DRAGGER; -namespace KIGFX -{ - class VIEW; - class VIEW_GROUP; -}; - - enum PNS_ROUTER_MODE { PNS_MODE_ROUTE_SINGLE = 1, PNS_MODE_ROUTE_DIFF_PAIR, @@ -271,4 +275,6 @@ private: wxString m_failureReason; }; +} + #endif diff --git a/pcbnew/router/pns_routing_settings.cpp b/pcbnew/router/pns_routing_settings.cpp index 4ff25e31c4..59340a31b2 100644 --- a/pcbnew/router/pns_routing_settings.cpp +++ b/pcbnew/router/pns_routing_settings.cpp @@ -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 @@ -23,6 +24,8 @@ #include "pns_routing_settings.h" #include "direction.h" +namespace PNS { + PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS() { m_routingMode = RM_Walkaround; @@ -103,3 +106,5 @@ int PNS_ROUTING_SETTINGS::ShoveIterationLimit() const { return m_shoveIterationLimit; } + +} diff --git a/pcbnew/router/pns_routing_settings.h b/pcbnew/router/pns_routing_settings.h index f3900455c4..6a2450cadd 100644 --- a/pcbnew/router/pns_routing_settings.h +++ b/pcbnew/router/pns_routing_settings.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 @@ -28,6 +29,8 @@ class DIRECTION_45; class TOOL_SETTINGS; +namespace PNS { + ///> Routing modes enum PNS_MODE { @@ -155,4 +158,6 @@ private: TIME_LIMIT m_walkaroundTimeLimit; }; +} + #endif diff --git a/pcbnew/router/pns_segment.h b/pcbnew/router/pns_segment.h index dbcb16575c..ed8c93a520 100644 --- a/pcbnew/router/pns_segment.h +++ b/pcbnew/router/pns_segment.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 @@ -30,6 +31,8 @@ #include "pns_item.h" #include "pns_line.h" +namespace PNS { + class PNS_NODE; class PNS_SEGMENT : public PNS_ITEM @@ -127,4 +130,6 @@ private: SHAPE_SEGMENT m_seg; }; +} + #endif diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 1e92445dc5..7cd9aab6e2 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -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 @@ -42,6 +43,8 @@ #include +namespace PNS { + void PNS_SHOVE::replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew ) { OPT_BOX2I changed_area = ChangedArea( aOld, aNew ); @@ -1407,3 +1410,5 @@ void PNS_SHOVE::SetInitialLine( PNS_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 f9eb60b958..7c8eea27f5 100644 --- a/pcbnew/router/pns_shove.h +++ b/pcbnew/router/pns_shove.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 @@ -30,6 +31,8 @@ #include "pns_logger.h" #include "range.h" +namespace PNS { + class PNS_LINE; class PNS_NODE; class PNS_ROUTER; @@ -156,4 +159,6 @@ private: void sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew ); }; +} + #endif // __PNS_SHOVE_H diff --git a/pcbnew/router/pns_sizes_settings.cpp b/pcbnew/router/pns_sizes_settings.cpp index 3ec1f78888..7b11c8322a 100644 --- a/pcbnew/router/pns_sizes_settings.cpp +++ b/pcbnew/router/pns_sizes_settings.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 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 @@ -26,6 +27,8 @@ #include "pns_node.h" #include "pns_sizes_settings.h" +namespace PNS { + int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem ) { VECTOR2I p; @@ -165,3 +168,5 @@ int PNS_SIZES_SETTINGS::GetLayerBottom() const else return m_layerPairs.begin()->second; } + +} diff --git a/pcbnew/router/pns_sizes_settings.h b/pcbnew/router/pns_sizes_settings.h index bb30c9a2f8..376317808e 100644 --- a/pcbnew/router/pns_sizes_settings.h +++ b/pcbnew/router/pns_sizes_settings.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 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 @@ -28,6 +29,9 @@ class BOARD; class BOARD_DESIGN_SETTINGS; + +namespace PNS { + class PNS_ITEM; class PNS_SIZES_SETTINGS { @@ -110,4 +114,6 @@ private: std::map m_layerPairs; }; +} + #endif // __PNS_SIZES_SETTINGS_H diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp index d728015833..2d5e8ba6d8 100644 --- a/pcbnew/router/pns_solid.cpp +++ b/pcbnew/router/pns_solid.cpp @@ -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 @@ -29,6 +30,8 @@ #include "pns_solid.h" #include "pns_utils.h" +namespace PNS { + const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness ) const { int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2; @@ -75,3 +78,5 @@ PNS_ITEM* PNS_SOLID::Clone() const PNS_ITEM* solid = new PNS_SOLID( *this ); return solid; } + +} diff --git a/pcbnew/router/pns_solid.h b/pcbnew/router/pns_solid.h index 593b3b09db..5324896872 100644 --- a/pcbnew/router/pns_solid.h +++ b/pcbnew/router/pns_solid.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013 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 @@ -29,6 +30,8 @@ #include "pns_item.h" +namespace PNS { + class PNS_SOLID : public PNS_ITEM { public: @@ -104,4 +107,6 @@ private: VECTOR2I m_offset; }; +} + #endif diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index d89a266dbb..55d4e2f45d 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013 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 @@ -57,6 +58,8 @@ using namespace std::placeholders; using namespace KIGFX; +namespace PNS { + TOOL_ACTION PNS_TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions", AS_CONTEXT, 'E', _( "Routing Options..." ), @@ -395,3 +398,5 @@ const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aS return anchor; } + +} diff --git a/pcbnew/router/pns_tool_base.h b/pcbnew/router/pns_tool_base.h index 4cf7df165d..998581da85 100644 --- a/pcbnew/router/pns_tool_base.h +++ b/pcbnew/router/pns_tool_base.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 * Author: Maciej Suminski * @@ -31,9 +32,12 @@ #include "pns_router.h" -class PNS_TUNE_STATUS_POPUP; class GRID_HELPER; + class PNS_KICAD_IFACE; +class PNS_TUNE_STATUS_POPUP; + +namespace PNS { class APIEXPORT PNS_TOOL_BASE : public TOOL_INTERACTIVE { @@ -80,4 +84,6 @@ protected: PNS_ROUTER* m_router; }; +} + #endif diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp index 13fdac307f..dce4dc4a16 100644 --- a/pcbnew/router/pns_topology.cpp +++ b/pcbnew/router/pns_topology.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -31,6 +32,8 @@ #include +namespace PNS { + bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine ) { if( !aLine->LinkedSegments() || !aLine->SegmentCount() ) @@ -304,7 +307,7 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair ) if( s->Layers().Start() == refSeg->Layers().Start() && s->Width() == refSeg->Width() ) { int dist = s->Seg().Distance( refSeg->Seg() ); - bool isParallel = refSeg->Seg().ApproxParallel( s->Seg() ); + bool isParallel = refSeg->Seg().ApproxParallel( s->Seg() ); SEG p_clip, n_clip; bool isCoupled = commonParallelProjection( refSeg->Seg(), s->Seg(), p_clip, n_clip ); @@ -382,3 +385,5 @@ const std::set PNS_TOPOLOGY::AssembleCluster( PNS_ITEM* aStart, int a return visited; } + +} diff --git a/pcbnew/router/pns_topology.h b/pcbnew/router/pns_topology.h index 5a5a130afc..f16e499f84 100644 --- a/pcbnew/router/pns_topology.h +++ b/pcbnew/router/pns_topology.h @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013-2015 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 @@ -26,6 +27,8 @@ #include "pns_itemset.h" +namespace PNS { + class PNS_NODE; class PNS_SEGMENT; class PNS_JOINT; @@ -68,4 +71,6 @@ private: PNS_NODE *m_world; }; +} + #endif diff --git a/pcbnew/router/pns_tune_status_popup.cpp b/pcbnew/router/pns_tune_status_popup.cpp index 40be366b02..906fbbd163 100644 --- a/pcbnew/router/pns_tune_status_popup.cpp +++ b/pcbnew/router/pns_tune_status_popup.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014-2015 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 @@ -36,9 +37,9 @@ PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP() } -void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS_ROUTER* aRouter ) +void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::PNS_ROUTER* aRouter ) { - PNS_MEANDER_PLACER_BASE* placer = dynamic_cast( aRouter->Placer() ); + PNS::PNS_MEANDER_PLACER_BASE* placer = dynamic_cast( aRouter->Placer() ); if( !placer ) return; @@ -49,13 +50,13 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS_ROUTER* aRouter ) switch( placer->TuningStatus() ) { - case PNS_MEANDER_PLACER::TUNED: + case PNS::PNS_MEANDER_PLACER::TUNED: color = wxColour( 0, 255, 0 ); break; - case PNS_MEANDER_PLACER::TOO_SHORT: + case PNS::PNS_MEANDER_PLACER::TOO_SHORT: color = wxColour( 255, 128, 128 ); break; - case PNS_MEANDER_PLACER::TOO_LONG: + case PNS::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 c6fe469fcd..52d4bf0e01 100644 --- a/pcbnew/router/pns_tune_status_popup.h +++ b/pcbnew/router/pns_tune_status_popup.h @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 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 @@ -27,15 +28,19 @@ #include +namespace PNS { + class PNS_ROUTER; +} + class PNS_TUNE_STATUS_POPUP : public WX_STATUS_POPUP { public: PNS_TUNE_STATUS_POPUP( PCB_EDIT_FRAME* aParent ); ~PNS_TUNE_STATUS_POPUP(); - void UpdateStatus( PNS_ROUTER* aRouter ); + void UpdateStatus( PNS::PNS_ROUTER* aRouter ); private: wxStaticText* m_statusLine; diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp index 0cb28a1c57..cc83c82324 100644 --- a/pcbnew/router/pns_utils.cpp +++ b/pcbnew/router/pns_utils.cpp @@ -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 @@ -27,6 +28,8 @@ #include +namespace PNS { + const SHAPE_LINE_CHAIN OctagonalHull( const VECTOR2I& aP0, const VECTOR2I& aSize, int aClearance, int aChamfer ) { @@ -244,3 +247,5 @@ OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB ) return OPT_BOX2I(); } + +} diff --git a/pcbnew/router/pns_utils.h b/pcbnew/router/pns_utils.h index 709ec53a41..372879304d 100644 --- a/pcbnew/router/pns_utils.h +++ b/pcbnew/router/pns_utils.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 @@ -28,7 +29,9 @@ #include #include -#define HULL_MARGIN 10 +namespace PNS { + +constexpr int HULL_MARGIN = 10; class PNS_ITEM; @@ -61,4 +64,6 @@ void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor ); #endif OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB ); +} + #endif // __PNS_UTILS_H diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp index e09013901d..650cefffbd 100644 --- a/pcbnew/router/pns_via.cpp +++ b/pcbnew/router/pns_via.cpp @@ -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 @@ -25,6 +26,8 @@ #include +namespace PNS { + bool PNS_VIA::PushoutForce( PNS_NODE* aNode, const VECTOR2I& aDirection, VECTOR2I& aForce, bool aSolidsOnly, int aMaxIterations ) { @@ -107,3 +110,5 @@ OPT_BOX2I PNS_VIA::ChangedArea( const PNS_VIA* aOther ) const return OPT_BOX2I(); } + +} diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index 97c99541ee..5fa39b01a6 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.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 @@ -28,6 +29,8 @@ #include "pns_item.h" +namespace PNS { + class PNS_NODE; class PNS_VIA : public PNS_ITEM @@ -159,4 +162,6 @@ private: VIATYPE_T m_viaType; }; +} + #endif diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp index 27e3ad6f96..6ff094dc05 100644 --- a/pcbnew/router/pns_walkaround.cpp +++ b/pcbnew/router/pns_walkaround.cpp @@ -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 @@ -28,6 +29,8 @@ #include "pns_router.h" using boost::optional; +namespace PNS { + void PNS_WALKAROUND::start( const PNS_LINE& aInitialPath ) { m_iteration = 0; @@ -270,3 +273,5 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia return st; } + +} diff --git a/pcbnew/router/pns_walkaround.h b/pcbnew/router/pns_walkaround.h index f143b46b1e..d6c9c8c427 100644 --- a/pcbnew/router/pns_walkaround.h +++ b/pcbnew/router/pns_walkaround.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 @@ -29,6 +30,8 @@ #include "pns_logger.h" #include "pns_algo_base.h" +namespace PNS { + class PNS_WALKAROUND : public PNS_ALGO_BASE { static const int DefaultIterationLimit = 50; @@ -146,4 +149,6 @@ private: std::set m_restrictedSet; }; +} + #endif // __PNS_WALKAROUND_H diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index 92d62c395b..9b1150bc5a 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -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 @@ -36,7 +37,7 @@ using namespace KIGFX; -ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem, VIEW_GROUP* aParent ) : +ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem, VIEW_GROUP* aParent ) : EDA_ITEM( NOT_USED ) { m_parent = aParent; @@ -63,13 +64,13 @@ ROUTER_PREVIEW_ITEM::~ROUTER_PREVIEW_ITEM() } -void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) +void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem ) { m_originLayer = aItem->Layers().Start(); - if( aItem->OfKind( PNS_ITEM::LINE ) ) + if( aItem->OfKind( PNS::PNS_ITEM::LINE ) ) { - const PNS_LINE* l = static_cast( aItem ); + const PNS::PNS_LINE* l = static_cast( aItem ); if( !l->SegmentCount() ) return; @@ -85,20 +86,20 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) switch( aItem->Kind() ) { - case PNS_ITEM::LINE: + case PNS::PNS_ITEM::LINE: m_type = PR_SHAPE; - m_width = ( (PNS_LINE*) aItem )->Width(); + m_width = ( (PNS::PNS_LINE*) aItem )->Width(); break; - case PNS_ITEM::SEGMENT: + case PNS::PNS_ITEM::SEGMENT: { - PNS_SEGMENT* seg = (PNS_SEGMENT*) aItem; + PNS::PNS_SEGMENT* seg = (PNS::PNS_SEGMENT*) aItem; m_type = PR_SHAPE; m_width = seg->Width(); break; } - case PNS_ITEM::VIA: + case PNS::PNS_ITEM::VIA: m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE ); m_type = PR_SHAPE; m_width = 0; @@ -106,7 +107,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) m_depth = ViaOverlayDepth; break; - case PNS_ITEM::SOLID: + case PNS::PNS_ITEM::SOLID: m_type = PR_SHAPE; m_width = 0; break; @@ -115,7 +116,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) break; } - if( aItem->Marker() & MK_VIOLATION ) + if( aItem->Marker() & PNS::MK_VIOLATION ) m_color = COLOR4D( 0, 1, 0, 1 ); ViewSetVisible( true ); diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h index 653900d8ee..56bb97b551 100644 --- a/pcbnew/router/router_preview_item.h +++ b/pcbnew/router/router_preview_item.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 @@ -38,9 +39,13 @@ #include +namespace PNS { + class PNS_ITEM; class PNS_ROUTER; +} + class ROUTER_PREVIEW_ITEM : public EDA_ITEM { public: @@ -51,10 +56,10 @@ public: PR_SHAPE }; - ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL ); + ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL ); ~ROUTER_PREVIEW_ITEM(); - void Update( const PNS_ITEM* aItem ); + void Update( const PNS::PNS_ITEM* aItem ); void StuckMarker( VECTOR2I& aPosition ); @@ -102,7 +107,7 @@ private: KIGFX::VIEW_GROUP* m_parent; - PNS_ROUTER* m_router; + PNS::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 dccbd3331a..9407fc254c 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -2,6 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2013 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 @@ -199,7 +200,7 @@ private: class ROUTER_TOOL_MENU: public CONTEXT_MENU { public: - ROUTER_TOOL_MENU( BOARD* aBoard, PNS_ROUTER_MODE aMode ) + ROUTER_TOOL_MENU( BOARD* aBoard, PNS::PNS_ROUTER_MODE aMode ) { SetTitle( _( "Interactive Router" ) ); Add( ACT_NewTrack ); @@ -218,11 +219,11 @@ public: Add( ACT_CustomTrackWidth ); - if( aMode == PNS_MODE_ROUTE_DIFF_PAIR ) + if( aMode == PNS::PNS_MODE_ROUTE_DIFF_PAIR ) Add( ACT_SetDpDimensions ); AppendSeparator(); - Add( PNS_TOOL_BASE::ACT_RouterOptions ); + Add( PNS::PNS_TOOL_BASE::ACT_RouterOptions ); } private: @@ -313,7 +314,7 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) } else if( aEvent.IsAction( &ACT_SetDpDimensions ) ) { - PNS_SIZES_SETTINGS sizes = m_router->Sizes(); + PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes(); DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes ); if( settingsDlg.ShowModal() ) @@ -336,14 +337,14 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) else if( aEvent.IsAction( &COMMON_ACTIONS::trackViaSizeChanged ) ) { - PNS_SIZES_SETTINGS sizes( m_router->Sizes() ); + PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() ); sizes.ImportCurrent( m_board->GetDesignSettings() ); m_router->UpdateSizes( sizes ); } } -int ROUTER_TOOL::getStartLayer( const PNS_ITEM* aItem ) +int ROUTER_TOOL::getStartLayer( const PNS::PNS_ITEM* aItem ) { int tl = getView()->GetTopLayer(); @@ -390,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_SIZES_SETTINGS sizes = m_router->Sizes(); + PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes(); // fixme: P&S supports more than one fixed layer pair. Update the dialog? sizes.ClearLayerPairs(); @@ -490,7 +491,7 @@ bool ROUTER_TOOL::prepareInteractive() // fixme: switch on invisible layer - // for some reason I don't understand, GetNetclass() may return null sometimes... + // for some reason I don't understand, GetNetclass() may return null sometimes... if( m_startItem && m_startItem->Net() >= 0 && m_startItem->Parent() && @@ -506,7 +507,7 @@ bool ROUTER_TOOL::prepareInteractive() m_ctls->ForceCursorPosition( false ); m_ctls->SetAutoPan( true ); - PNS_SIZES_SETTINGS sizes( m_router->Sizes() ); + PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() ); sizes.Init( m_board, m_startItem ); sizes.AddLayerPair( m_frame->GetScreen()->m_Route_Layer_TOP, @@ -618,7 +619,7 @@ int ROUTER_TOOL::DpDimensionsDialog( const TOOL_EVENT& aEvent ) { Activate(); - PNS_SIZES_SETTINGS sizes = m_router->Sizes(); + PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes(); DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes ); if( settingsDlg.ShowModal() ) @@ -648,18 +649,18 @@ int ROUTER_TOOL::SettingsDialog( const TOOL_EVENT& aEvent ) int ROUTER_TOOL::RouteSingleTrace( const TOOL_EVENT& aEvent ) { m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Route Track" ) ); - return mainLoop( PNS_MODE_ROUTE_SINGLE ); + return mainLoop( PNS::PNS_MODE_ROUTE_SINGLE ); } int ROUTER_TOOL::RouteDiffPair( const TOOL_EVENT& aEvent ) { m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Router Differential Pair" ) ); - return mainLoop( PNS_MODE_ROUTE_DIFF_PAIR ); + return mainLoop( PNS::PNS_MODE_ROUTE_DIFF_PAIR ); } -int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode ) +int ROUTER_TOOL::mainLoop( PNS::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 c1bd1a290f..ddf1fb93f4 100644 --- a/pcbnew/router/router_tool.h +++ b/pcbnew/router/router_tool.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 * Author: Maciej Suminski * @@ -24,7 +25,7 @@ #include "pns_tool_base.h" -class APIEXPORT ROUTER_TOOL : public PNS_TOOL_BASE +class APIEXPORT ROUTER_TOOL : public PNS::PNS_TOOL_BASE { public: ROUTER_TOOL(); @@ -42,7 +43,7 @@ public: private: - int mainLoop( PNS_ROUTER_MODE aMode ); + int mainLoop( PNS::PNS_ROUTER_MODE aMode ); int getDefaultWidth( int aNetCode ); @@ -52,7 +53,7 @@ private: void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill ); void handleCommonEvents( const TOOL_EVENT& evt ); - int getStartLayer( const PNS_ITEM* aItem ); + int getStartLayer( const PNS::PNS_ITEM* aItem ); void switchLayerOnViaPlacement(); bool onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType ); diff --git a/pcbnew/router/time_limit.cpp b/pcbnew/router/time_limit.cpp index e0f250b32a..079daad9bf 100644 --- a/pcbnew/router/time_limit.cpp +++ b/pcbnew/router/time_limit.cpp @@ -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 @@ -22,8 +23,10 @@ #include "time_limit.h" +namespace PNS { + TIME_LIMIT::TIME_LIMIT( int aMilliseconds ) : - m_limitMs( aMilliseconds ) + m_limitMs( aMilliseconds ) { Restart(); } @@ -35,17 +38,19 @@ TIME_LIMIT::~TIME_LIMIT() bool TIME_LIMIT::Expired() const { - return ( wxGetLocalTimeMillis().GetValue() - m_startTics ) >= m_limitMs; + return ( wxGetLocalTimeMillis().GetValue() - m_startTics ) >= m_limitMs; } void TIME_LIMIT::Restart() { - m_startTics = wxGetLocalTimeMillis().GetValue(); + m_startTics = wxGetLocalTimeMillis().GetValue(); } void TIME_LIMIT::Set( int aMilliseconds ) { - m_limitMs = aMilliseconds; + m_limitMs = aMilliseconds; +} + } diff --git a/pcbnew/router/time_limit.h b/pcbnew/router/time_limit.h index d917533866..447f074241 100644 --- a/pcbnew/router/time_limit.h +++ b/pcbnew/router/time_limit.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 @@ -23,6 +24,8 @@ #include +namespace PNS { + class TIME_LIMIT { public: @@ -40,4 +43,6 @@ private: int64_t m_startTics; }; +} + #endif