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  m_snapToTracks = false;
49  m_snapToPads = false;
50 }
51 
52 
53 void ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
54 {
55  aSettings.Set( "Mode", (int) m_routingMode );
56  aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort );
57  aSettings.Set( "RemoveLoops", m_removeLoops );
58  aSettings.Set( "SmartPads", m_smartPads );
59  aSettings.Set( "ShoveVias", m_shoveVias );
60  aSettings.Set( "StartDiagonal", m_startDiagonal );
61  aSettings.Set( "ShoveTimeLimit", m_shoveTimeLimit.Get() );
62  aSettings.Set( "ShoveIterationLimit", m_shoveIterationLimit );
63  aSettings.Set( "WalkaroundIterationLimit", m_walkaroundIterationLimit );
64  aSettings.Set( "JumpOverObstacles", m_jumpOverObstacles );
65  aSettings.Set( "SmoothDraggedSegments", m_smoothDraggedSegments );
66  aSettings.Set( "CanViolateDRC", m_canViolateDRC );
67  aSettings.Set( "SuggestFinish", m_suggestFinish );
68  aSettings.Set( "FreeAngleMode", m_freeAngleMode );
69  aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
70 }
71 
72 
73 void ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
74 {
75  m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround );
76  m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM );
77  m_removeLoops = aSettings.Get( "RemoveLoops", true );
78  m_smartPads = aSettings.Get( "SmartPads", true );
79  m_shoveVias = aSettings.Get( "ShoveVias", true );
80  m_startDiagonal = aSettings.Get( "StartDiagonal", false );
81  m_shoveTimeLimit.Set( aSettings.Get( "ShoveTimeLimit", 1000 ) );
82  m_shoveIterationLimit = aSettings.Get( "ShoveIterationLimit", 250 );
83  m_walkaroundIterationLimit = aSettings.Get( "WalkaroundIterationLimit", 50 );
84  m_jumpOverObstacles = aSettings.Get( "JumpOverObstacles", false );
85  m_smoothDraggedSegments = aSettings.Get( "SmoothDraggedSegments", true );
86  m_canViolateDRC = aSettings.Get( "CanViolateDRC", false );
87  m_suggestFinish = aSettings.Get( "SuggestFinish", false );
88  m_freeAngleMode = aSettings.Get( "FreeAngleMode", false );
89  m_inlineDragEnabled = aSettings.Get( "InlineDragEnabled", false );
90 }
91 
92 
94 {
95  if( m_startDiagonal )
97  else
98  return DIRECTION_45( DIRECTION_45::N );
99 }
100 
101 
103 {
104  return TIME_LIMIT ( m_shoveTimeLimit );
105 }
106 
107 
109 {
110  return m_shoveIterationLimit;
111 }
112 
113 }
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.