KiCad PCB EDA Suite
pns_routing_settings.cpp
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2013-2014 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include <tool/tool_settings.h>
23 
24 #include <geometry/direction45.h>
25 
26 #include "pns_routing_settings.h"
27 
28 namespace PNS {
29 
31 {
34  m_removeLoops = true;
35  m_smartPads = true;
36  m_shoveVias = true;
37  m_suggestFinish = false;
38  m_followMouse = true;
39  m_startDiagonal = false;
41  m_shoveTimeLimit = 1000;
43  m_jumpOverObstacles = false;
45  m_canViolateDRC = false;
46  m_freeAngleMode = false;
47  m_inlineDragEnabled = false;
48 }
49 
50 
51 void ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
52 {
53  aSettings.Set( "Mode", (int) m_routingMode );
54  aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort );
55  aSettings.Set( "RemoveLoops", m_removeLoops );
56  aSettings.Set( "SmartPads", m_smartPads );
57  aSettings.Set( "ShoveVias", m_shoveVias );
58  aSettings.Set( "StartDiagonal", m_startDiagonal );
59  aSettings.Set( "ShoveTimeLimit", m_shoveTimeLimit.Get() );
60  aSettings.Set( "ShoveIterationLimit", m_shoveIterationLimit );
61  aSettings.Set( "WalkaroundIterationLimit", m_walkaroundIterationLimit );
62  aSettings.Set( "JumpOverObstacles", m_jumpOverObstacles );
63  aSettings.Set( "SmoothDraggedSegments", m_smoothDraggedSegments );
64  aSettings.Set( "CanViolateDRC", m_canViolateDRC );
65  aSettings.Set( "SuggestFinish", m_suggestFinish );
66  aSettings.Set( "FreeAngleMode", m_freeAngleMode );
67  aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
68 }
69 
70 
71 void ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
72 {
73  m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround );
74  m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM );
75  m_removeLoops = aSettings.Get( "RemoveLoops", true );
76  m_smartPads = aSettings.Get( "SmartPads", true );
77  m_shoveVias = aSettings.Get( "ShoveVias", true );
78  m_startDiagonal = aSettings.Get( "StartDiagonal", false );
79  m_shoveTimeLimit.Set( aSettings.Get( "ShoveTimeLimit", 1000 ) );
80  m_shoveIterationLimit = aSettings.Get( "ShoveIterationLimit", 250 );
81  m_walkaroundIterationLimit = aSettings.Get( "WalkaroundIterationLimit", 50 );
82  m_jumpOverObstacles = aSettings.Get( "JumpOverObstacles", false );
83  m_smoothDraggedSegments = aSettings.Get( "SmoothDraggedSegments", true );
84  m_canViolateDRC = aSettings.Get( "CanViolateDRC", false );
85  m_suggestFinish = aSettings.Get( "SuggestFinish", false );
86  m_freeAngleMode = aSettings.Get( "FreeAngleMode", false );
87  m_inlineDragEnabled = aSettings.Get( "InlineDragEnabled", false );
88 }
89 
90 
92 {
93  if( m_startDiagonal )
95  else
96  return DIRECTION_45( DIRECTION_45::N );
97 }
98 
99 
101 {
102  return TIME_LIMIT ( m_shoveTimeLimit );
103 }
104 
105 
107 {
108  return m_shoveIterationLimit;
109 }
110 
111 }
TIME_LIMIT ShoveTimeLimit() const
PNS_MODE
Routing modes
void Set(int aMilliseconds)
Definition: time_limit.cpp:51
PNS_OPTIMIZATION_EFFORT m_optimizerEffort
T Get(const wxString &aName, T aDefaultValue) const
Definition: tool_settings.h:45
Class DIRECTION_45.
Definition: direction45.h:33
void Set(const wxString &aName, const T &aValue)
Definition: tool_settings.h:59
void Load(const TOOL_SETTINGS &where)
int Get() const
Definition: time_limit.h:39
const DIRECTION_45 InitialDirection() const
PNS_OPTIMIZATION_EFFORT
Optimization effort
void Save(TOOL_SETTINGS &where) const
Push and Shove diff pair dimensions (gap) settings dialog.