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;
57
58 m_params.emplace_back( new PARAM<int>( "mode", reinterpret_cast<int*>( &m_routingMode ),
59 static_cast<int>( RM_Walkaround ) ) );
60
61 m_params.emplace_back( new PARAM<int>( "effort", reinterpret_cast<int*>( &m_optimizerEffort ),
62 static_cast<int>( OE_MEDIUM ) ) );
63
64 m_params.emplace_back( new PARAM<bool>( "remove_loops", &m_removeLoops, true ) );
65 m_params.emplace_back( new PARAM<bool>( "smart_pads", &m_smartPads, true ) );
66 m_params.emplace_back( new PARAM<bool>( "shove_vias", &m_shoveVias, true ) );
67 m_params.emplace_back( new PARAM<bool>( "suggest_finish", &m_suggestFinish, false ) );
68 m_params.emplace_back( new PARAM<bool>( "follow_mouse", &m_followMouse, true ) );
69 m_params.emplace_back( new PARAM<bool>( "start_diagonal", &m_startDiagonal, false ) );
70 m_params.emplace_back( new PARAM<int>( "shove_iteration_limit", &m_shoveIterationLimit, 250 ) );
71
72 m_params.emplace_back( new PARAM_LAMBDA<int>( "shove_time_limit",
73 [this] () -> int
74 {
75 return m_shoveTimeLimit.Get();
76 },
77 [this] ( int aVal )
78 {
79 m_shoveTimeLimit.Set( aVal );
80 },
81 1000 ) );
82
83 m_params.emplace_back( new PARAM<int>( "walkaround_iteration_limit", &m_walkaroundIterationLimit, 40 ) );
84 m_params.emplace_back( new PARAM<bool>( "jump_over_obstacles", &m_jumpOverObstacles, false ) );
85
86 m_params.emplace_back( new PARAM<bool>( "smooth_dragged_segments", &m_smoothDraggedSegments, true ) );
87
88 m_params.emplace_back( new PARAM<bool>( "can_violate_drc", &m_allowDRCViolations, false ) );
89 m_params.emplace_back( new PARAM<bool>( "free_angle_mode", &m_freeAngleMode, false ) );
90 m_params.emplace_back( new PARAM<bool>( "snap_to_tracks", &m_snapToTracks, false ) );
91 m_params.emplace_back( new PARAM<bool>( "snap_to_pads", &m_snapToPads, false ) );
92 m_params.emplace_back( new PARAM<bool>( "optimize_dragged_track",
94
95 m_params.emplace_back( new PARAM<bool>( "auto_posture", &m_autoPosture, true ) );
96 m_params.emplace_back( new PARAM<bool>( "fix_all_segments", &m_fixAllSegments, true ) );
97
99 "corner_mode", &m_cornerMode, DIRECTION_45::CORNER_MODE::MITERED_45,
100 DIRECTION_45::CORNER_MODE::ROUNDED_90, DIRECTION_45::CORNER_MODE::MITERED_45 ) );
101
102 m_params.emplace_back( new PARAM<double>( "walkaround_hug_length_threshold", &m_walkaroundHugLengthThreshold, 1.5 ) );
103
104 LoadFromFile();
105}
106
107
109{
110 if( m_startDiagonal )
112 else
114}
115
116
118{
119 return TIME_LIMIT ( m_shoveTimeLimit );
120}
121
122
124{
126}
127
128}
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:216
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:281
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