KiCad PCB EDA Suite
pns_routing_settings.h
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-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
8  *
9  * This program is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the
11  * Free Software Foundation, either version 3 of the License, or (at your
12  * option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef __PNS_ROUTING_SETTINGS
24 #define __PNS_ROUTING_SETTINGS
25 
26 #include <cstdio>
27 
29 
30 #include "time_limit.h"
31 
32 class DIRECTION_45;
33 class TOOL_SETTINGS;
34 
35 namespace PNS {
36 
39 {
44 };
45 
48 {
49  OE_LOW = 0,
50  OE_MEDIUM = 1,
51  OE_FULL = 2
52 };
53 
55 enum class CORNER_MODE
56 {
57  MITERED_90,
58  MITERED_45,
59  ROUNDED_90,
60  ROUNDED_45
61 };
62 
68 {
69 public:
70  ROUTING_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath );
71 
73  PNS_MODE Mode() const { return m_routingMode; }
74 
76  void SetMode( PNS_MODE aMode ) { m_routingMode = aMode; }
77 
80 
83 
85  bool ShoveVias() const { return m_shoveVias; }
86 
88  void SetShoveVias( bool aShoveVias ) { m_shoveVias = aShoveVias; }
89 
91  bool RemoveLoops() const { return m_removeLoops; }
92 
94  void SetRemoveLoops( bool aRemoveLoops ) { m_removeLoops = aRemoveLoops; }
95 
97  bool SuggestFinish() { return m_suggestFinish; }
98 
100  void SetSuggestFinish( bool aSuggestFinish ) { m_suggestFinish = aSuggestFinish; }
101 
103  bool SmartPads() const { return m_smartPads; }
104 
106  void SetSmartPads( bool aSmartPads ) { m_smartPads = aSmartPads; }
107 
109  bool FollowMouse() const
110  {
111  return m_followMouse && !( Mode() == RM_MarkObstacles );
112  }
113 
116 
118  void SetSmoothDraggedSegments( bool aSmooth ) { m_smoothDraggedSegments = aSmooth; }
119 
121  bool JumpOverObstacles() const { return m_jumpOverObstacles; }
122 
124  void SetJumpOverObstacles( bool aJumpOverObstacles )
125  {
126  m_jumpOverObstacles = aJumpOverObstacles;
127  }
128 
129  void SetStartDiagonal( bool aStartDiagonal ) { m_startDiagonal = aStartDiagonal; }
130 
131  bool CanViolateDRC() const { return m_canViolateDRC; }
132  void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; }
133 
134  bool GetFreeAngleMode() const { return m_freeAngleMode; }
135 
136  void SetFreeAngleMode( bool aEnable ) { m_freeAngleMode = aEnable; }
137 
138  const DIRECTION_45 InitialDirection() const;
139 
140  int ShoveIterationLimit() const;
141  TIME_LIMIT ShoveTimeLimit() const;
142 
145 
146  void SetInlineDragEnabled ( bool aEnable ) { m_inlineDragEnabled = aEnable; }
147  bool InlineDragEnabled() const { return m_inlineDragEnabled; }
148 
149  void SetSnapToTracks( bool aSnap ) { m_snapToTracks = aSnap; }
150  void SetSnapToPads( bool aSnap ) { m_snapToPads = aSnap; }
151 
152  bool GetSnapToTracks() const { return m_snapToTracks; }
153  bool GetSnapToPads() const { return m_snapToPads; }
154 
156  void SetCornerMode( CORNER_MODE aMode ) { m_cornerMode = aMode; }
157 
159  void SetOptimizeDraggedTrack( bool aEnable ) { m_optimizeDraggedTrack = aEnable; }
160 
161  bool GetAutoPosture() const { return m_autoPosture; }
162  void SetAutoPosture( bool aEnable ) { m_autoPosture = aEnable; }
163 
164  bool GetFixAllSegments() const { return m_fixAllSegments; }
165  void SetFixAllSegments( bool aEnable ) { m_fixAllSegments = aEnable; }
166 
167 private:
184 
186 
189 
194 };
195 
196 }
197 
198 #endif
void SetOptimizerEffort(PNS_OPTIMIZATION_EFFORT aEffort)
Return true if shoving vias is enabled.
Contain all persistent settings of the router, such as the mode, optimization effort,...
bool SmartPads() const
Enable/disable Smart Pads (optimized connections).
void SetMode(PNS_MODE aMode)
Return the optimizer effort. Bigger means cleaner traces, but slower routing.
const DIRECTION_45 InitialDirection() const
void SetFreeAngleMode(bool aEnable)
PNS_MODE
< Routing modes
void SetSuggestFinish(bool aSuggestFinish)
Return true if Smart Pads (optimized connections) is enabled.
PNS_OPTIMIZATION_EFFORT m_optimizerEffort
void SetRemoveLoops(bool aRemoveLoops)
Return true if suggesting the finish of currently placed track is on.
void SetCornerMode(CORNER_MODE aMode)
void SetInlineDragEnabled(bool aEnable)
void SetSmartPads(bool aSmartPads)
Return true if follow mouse mode is active (permanently on for the moment).
H/V/45 with filleted corners.
void SetOptimizeDraggedTrack(bool aEnable)
bool RemoveLoops() const
Enable/disable loop (redundant track) removal.
bool FollowMouse() const
Return true if smoothing segments during dragging is enabled.
NESTED_SETTINGS is a JSON_SETTINGS that lives inside a JSON_SETTINGS.
void SetAutoPosture(bool aEnable)
Represent route directions & corner angles in a 45-degree metric.
Definition: direction45.h:36
PNS_OPTIMIZATION_EFFORT OptimizerEffort() const
Set the optimizer effort. Bigger means cleaner traces, but slower routing.
void SetShoveVias(bool aShoveVias)
Return true if loop (redundant track) removal is on.
bool SmoothDraggedSegments() const
Enable/disable smoothing segments during dragging.
PNS_MODE Mode() const
Set the routing mode.
void SetSnapToPads(bool aSnap)
void SetStartDiagonal(bool aStartDiagonal)
void SetCanViolateDRC(bool aViolate)
void SetSnapToTracks(bool aSnap)
H/V with filleted corners (not yet implemented)
Guess what's better, try to make least mess on the PCB.
H/V only (90-degree corners) (not yet implemented)
Ignore collisions, mark obstacles.
bool SuggestFinish()
Enable displaying suggestions for finishing the currently placed track.
CORNER_MODE GetCornerMode() const
bool JumpOverObstacles() const
Enable/disable jumping over unmovable obstacles.
Only walk around.
ROUTING_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
Return the routing mode.
bool ShoveVias() const
Enable/disable shoving vias.
bool GetOptimizeDraggedTrack() const
H/V/45 with mitered corners (default)
void SetSmoothDraggedSegments(bool aSmooth)
Return true if jumping over unmovable obstacles is on.
void SetJumpOverObstacles(bool aJumpOverObstacles)
Push and Shove diff pair dimensions (gap) settings dialog.
void SetFixAllSegments(bool aEnable)
TIME_LIMIT ShoveTimeLimit() const
TIME_LIMIT WalkaroundTimeLimit() const