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 <[email protected]>
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
23#include <settings/parameters.h>
24
26
27namespace PNS {
28
29const int pnsSchemaVersion = 0;
30
31
32ROUTING_SETTINGS::ROUTING_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
33 NESTED_SETTINGS( "pns", pnsSchemaVersion, aParent, aPath )
34{
37 m_removeLoops = true;
38 m_smartPads = true;
39 m_shoveVias = true;
40 m_suggestFinish = false;
41 m_followMouse = true;
42 m_startDiagonal = false;
44 m_shoveTimeLimit = 1000;
46 m_jumpOverObstacles = false;
49 m_freeAngleMode = false;
50 m_snapToTracks = false;
51 m_snapToPads = false;
53 m_cornerMode = DIRECTION_45::CORNER_MODE::MITERED_45;
55 m_autoPosture = true;
56 m_fixAllSegments = true;
58
59 m_params.emplace_back( new PARAM<int>( "mode", reinterpret_cast<int*>( &m_routingMode ),
60 static_cast<int>( RM_Walkaround ) ) );
61
62 m_params.emplace_back( new PARAM<int>( "effort", reinterpret_cast<int*>( &m_optimizerEffort ),
63 static_cast<int>( OE_MEDIUM ) ) );
64
65 m_params.emplace_back( new PARAM<bool>( "remove_loops", &m_removeLoops, true ) );
66 m_params.emplace_back( new PARAM<bool>( "smart_pads", &m_smartPads, true ) );
67 m_params.emplace_back( new PARAM<bool>( "shove_vias", &m_shoveVias, true ) );
68 m_params.emplace_back( new PARAM<bool>( "suggest_finish", &m_suggestFinish, false ) );
69 m_params.emplace_back( new PARAM<bool>( "follow_mouse", &m_followMouse, true ) );
70 m_params.emplace_back( new PARAM<bool>( "start_diagonal", &m_startDiagonal, false ) );
71 m_params.emplace_back( new PARAM<int>( "shove_iteration_limit", &m_shoveIterationLimit, 250 ) );
72 m_params.emplace_back( new PARAM<int>( "via_force_prop_iteration_limit", &m_viaForcePropIterationLimit, 40 ) );
73
74 m_params.emplace_back( new PARAM_LAMBDA<int>( "shove_time_limit",
75 [this] () -> int
76 {
77 return m_shoveTimeLimit.Get();
78 },
79 [this] ( int aVal )
80 {
81 m_shoveTimeLimit.Set( aVal );
82 },
83 1000 ) );
84
85 m_params.emplace_back( new PARAM<int>( "walkaround_iteration_limit", &m_walkaroundIterationLimit, 40 ) );
86 m_params.emplace_back( new PARAM<bool>( "jump_over_obstacles", &m_jumpOverObstacles, false ) );
87
88 m_params.emplace_back( new PARAM<bool>( "smooth_dragged_segments", &m_smoothDraggedSegments, true ) );
89
90 m_params.emplace_back( new PARAM<bool>( "can_violate_drc", &m_allowDRCViolations, false ) );
91 m_params.emplace_back( new PARAM<bool>( "free_angle_mode", &m_freeAngleMode, false ) );
92 m_params.emplace_back( new PARAM<bool>( "snap_to_tracks", &m_snapToTracks, false ) );
93 m_params.emplace_back( new PARAM<bool>( "snap_to_pads", &m_snapToPads, false ) );
94 m_params.emplace_back( new PARAM<bool>( "optimize_dragged_track",
96
97 m_params.emplace_back( new PARAM<bool>( "auto_posture", &m_autoPosture, true ) );
98 m_params.emplace_back( new PARAM<bool>( "fix_all_segments", &m_fixAllSegments, true ) );
99
101 "corner_mode", &m_cornerMode, DIRECTION_45::CORNER_MODE::MITERED_45,
102 DIRECTION_45::CORNER_MODE::ROUNDED_90, DIRECTION_45::CORNER_MODE::MITERED_45 ) );
103
104 m_params.emplace_back( new PARAM<double>( "walkaround_hug_length_threshold", &m_walkaroundHugLengthThreshold, 1.5 ) );
105
106 LoadFromFile();
107}
108
109
111{
112 if( m_startDiagonal )
114 else
116}
117
118
120{
121 return TIME_LIMIT ( m_shoveTimeLimit );
122}
123
124
126{
128}
129
130}
Represent route directions & corner angles in a 45-degree metric.
Definition: direction45.h:37
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
NESTED_SETTINGS is a JSON_SETTINGS that lives inside a JSON_SETTINGS.
bool LoadFromFile(const wxString &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
Stores an enum as an integer.
Definition: parameters.h:217
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:282
const DIRECTION_45 InitialDirection() const
TIME_LIMIT ShoveTimeLimit() const
DIRECTION_45::CORNER_MODE m_cornerMode
ROUTING_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
Return the routing mode.
PNS_OPTIMIZATION_EFFORT m_optimizerEffort
void Set(int aMilliseconds)
Definition: time_limit.cpp:51
int Get() const
Definition: time_limit.h:39
Push and Shove diff pair dimensions (gap) settings dialog.
@ RM_Walkaround
Only walk around.
const int pnsSchemaVersion