Horizon
pns_routing_settings.h
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#ifndef __PNS_ROUTING_SETTINGS
23#define __PNS_ROUTING_SETTINGS
24
25#include <cstdio>
26
27#include "time_limit.h"
28
29class DIRECTION_45;
30class TOOL_SETTINGS;
31
32namespace PNS {
33
35enum PNS_MODE
36{
37 RM_MarkObstacles = 0,
38 RM_Shove,
39 RM_Walkaround,
40 RM_Smart
41};
42
44enum PNS_OPTIMIZATION_EFFORT
45{
46 OE_LOW = 0,
47 OE_MEDIUM = 1,
48 OE_FULL = 2
49};
50
58{
59public:
61
62 //void Load( const TOOL_SETTINGS& where );
63 //void Save( TOOL_SETTINGS& where ) const;
64
66 PNS_MODE Mode() const { return m_routingMode; }
67
69 void SetMode( PNS_MODE aMode ) { m_routingMode = aMode; }
70
72 PNS_OPTIMIZATION_EFFORT OptimizerEffort() const { return m_optimizerEffort; }
73
75 void SetOptimizerEffort( PNS_OPTIMIZATION_EFFORT aEffort ) { m_optimizerEffort = aEffort; }
76
78 bool ShoveVias() const { return m_shoveVias; }
79
81 void SetShoveVias( bool aShoveVias ) { m_shoveVias = aShoveVias; }
82
84 bool RemoveLoops() const { return m_removeLoops; }
85
87 void SetRemoveLoops( bool aRemoveLoops ) { m_removeLoops = aRemoveLoops; }
88
90 bool SuggestFinish() { return m_suggestFinish; }
91
93 void SetSuggestFinish( bool aSuggestFinish ) { m_suggestFinish = aSuggestFinish; }
94
96 bool SmartPads() const { return m_smartPads; }
97
99 void SetSmartPads( bool aSmartPads ) { m_smartPads = aSmartPads; }
100
102 bool FollowMouse() const
103 {
104 return m_followMouse && !( Mode() == RM_MarkObstacles );
105 }
106
108 bool SmoothDraggedSegments() const { return m_smoothDraggedSegments; }
109
111 void SetSmoothDraggedSegments( bool aSmooth ) { m_smoothDraggedSegments = aSmooth; }
112
114 bool JumpOverObstacles() const { return m_jumpOverObstacles; }
115
117 void SetJumpOverObstacles( bool aJumpOverObstacles ) { m_jumpOverObstacles = aJumpOverObstacles; }
118
119 void SetStartDiagonal( bool aStartDiagonal ) { m_startDiagonal = aStartDiagonal; }
120
121 bool CanViolateDRC() const { return m_canViolateDRC; }
122 void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; }
123
124 bool GetFreeAngleMode() const { return m_freeAngleMode; }
125
126 void SetFreeAngleMode( bool aEnable ) { m_freeAngleMode = aEnable; }
127
128 const DIRECTION_45 InitialDirection() const;
129
130 int ShoveIterationLimit() const;
131 TIME_LIMIT ShoveTimeLimit() const;
132
133 int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
134 TIME_LIMIT WalkaroundTimeLimit() const;
135
136 void SetInlineDragEnabled ( bool aEnable ) { m_inlineDragEnabled = aEnable; }
137 bool InlineDragEnabled() const { return m_inlineDragEnabled; }
138
139 void SetSnapToTracks( bool aSnap ) { m_snapToTracks = aSnap; }
140 void SetSnapToPads( bool aSnap ) { m_snapToPads = aSnap; }
141
142 bool GetSnapToTracks() const { return m_snapToTracks; }
143 bool GetSnapToPads() const { return m_snapToPads; }
144
145private:
146 bool m_shoveVias;
147 bool m_startDiagonal;
148 bool m_removeLoops;
149 bool m_smartPads;
150 bool m_suggestFinish;
151 bool m_followMouse;
152 bool m_jumpOverObstacles;
153 bool m_smoothDraggedSegments;
154 bool m_canViolateDRC;
155 bool m_freeAngleMode;
156 bool m_inlineDragEnabled;
157 bool m_snapToTracks;
158 bool m_snapToPads;
159
160 PNS_MODE m_routingMode;
161 PNS_OPTIMIZATION_EFFORT m_optimizerEffort;
162
163 int m_walkaroundIterationLimit;
164 int m_shoveIterationLimit;
165 TIME_LIMIT m_shoveTimeLimit;
166 TIME_LIMIT m_walkaroundTimeLimit;
167};
168
169}
170
171#endif
Class DIRECTION_45.
Definition: direction45.h:37
Class ROUTING_SETTINGS.
Definition: pns_routing_settings.h:58
bool RemoveLoops() const
‍Returns true if loop (redundant track) removal is on.
Definition: pns_routing_settings.h:84
void SetShoveVias(bool aShoveVias)
‍Enables/disables shoving vias.
Definition: pns_routing_settings.h:81
bool SmoothDraggedSegments() const
‍Returns true if smoothing segments durign dragging is enabled.
Definition: pns_routing_settings.h:108
void SetJumpOverObstacles(bool aJumpOverObstacles)
‍Enables/disables jumping over unmovable obstacles.
Definition: pns_routing_settings.h:117
PNS_OPTIMIZATION_EFFORT OptimizerEffort() const
‍Returns the optimizer effort. Bigger means cleaner traces, but slower routing.
Definition: pns_routing_settings.h:72
bool FollowMouse() const
‍Returns true if follow mouse mode is active (permanently on for the moment).
Definition: pns_routing_settings.h:102
void SetSmoothDraggedSegments(bool aSmooth)
‍Enables/disabled smoothing segments during dragging.
Definition: pns_routing_settings.h:111
bool ShoveVias() const
‍Returns true if shoving vias is enbled.
Definition: pns_routing_settings.h:78
bool SmartPads() const
‍Returns true if Smart Pads (optimized connections) is enabled.
Definition: pns_routing_settings.h:96
void SetSuggestFinish(bool aSuggestFinish)
‍Enables displaying suggestions for finishing the currently placed track.
Definition: pns_routing_settings.h:93
bool SuggestFinish()
‍Returns true if suggesting the finish of currently placed track is on.
Definition: pns_routing_settings.h:90
void SetMode(PNS_MODE aMode)
‍Sets the routing mode.
Definition: pns_routing_settings.h:69
bool JumpOverObstacles() const
‍Returns true if jumping over unmovable obstacles is on.
Definition: pns_routing_settings.h:114
PNS_MODE Mode() const
‍Returns the routing mode.
Definition: pns_routing_settings.h:66
void SetSmartPads(bool aSmartPads)
‍Enables/disables Smart Pads (optimized connections).
Definition: pns_routing_settings.h:99
void SetOptimizerEffort(PNS_OPTIMIZATION_EFFORT aEffort)
‍Sets the optimizer effort. Bigger means cleaner traces, but slower routing.
Definition: pns_routing_settings.h:75
void SetRemoveLoops(bool aRemoveLoops)
‍Enables/disables loop (redundant track) removal.
Definition: pns_routing_settings.h:87