summaryrefslogtreecommitdiff
path: root/pcbnew/router/pns_routing_settings.cpp
diff options
context:
space:
mode:
authorsaurabhb172020-02-26 16:01:28 +0530
committerGitHub2020-02-26 16:01:28 +0530
commitd51317f0193609fb43e932730d78aa86a4984083 (patch)
tree6acee185a4dc19113fcbf0f9a3d6941085dedaf7 /pcbnew/router/pns_routing_settings.cpp
parent0db48f6533517ecebfd9f0693f89deca28408b76 (diff)
parent886d9cb772e81d2e5262284bc3082664f084337f (diff)
downloadKiCad-eSim-d51317f0193609fb43e932730d78aa86a4984083.tar.gz
KiCad-eSim-d51317f0193609fb43e932730d78aa86a4984083.tar.bz2
KiCad-eSim-d51317f0193609fb43e932730d78aa86a4984083.zip
Merge pull request #2 from FOSSEE/develop
Develop
Diffstat (limited to 'pcbnew/router/pns_routing_settings.cpp')
-rw-r--r--pcbnew/router/pns_routing_settings.cpp105
1 files changed, 105 insertions, 0 deletions
diff --git a/pcbnew/router/pns_routing_settings.cpp b/pcbnew/router/pns_routing_settings.cpp
new file mode 100644
index 0000000..4ff25e3
--- /dev/null
+++ b/pcbnew/router/pns_routing_settings.cpp
@@ -0,0 +1,105 @@
+/*
+ * KiRouter - a push-and-(sometimes-)shove PCB router
+ *
+ * Copyright (C) 2013-2014 CERN
+ * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tool/tool_settings.h>
+
+#include "pns_routing_settings.h"
+#include "direction.h"
+
+PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
+{
+ m_routingMode = RM_Walkaround;
+ m_optimizerEffort = OE_MEDIUM;
+ m_removeLoops = true;
+ m_smartPads = true;
+ m_shoveVias = true;
+ m_suggestFinish = false;
+ m_followMouse = true;
+ m_startDiagonal = false;
+ m_shoveIterationLimit = 250;
+ m_shoveTimeLimit = 1000;
+ m_walkaroundIterationLimit = 40;
+ m_jumpOverObstacles = false;
+ m_smoothDraggedSegments = true;
+ m_canViolateDRC = false;
+ m_freeAngleMode = false;
+ m_inlineDragEnabled = false;
+}
+
+
+void PNS_ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
+{
+ aSettings.Set( "Mode", (int) m_routingMode );
+ aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort );
+ aSettings.Set( "RemoveLoops", m_removeLoops );
+ aSettings.Set( "SmartPads", m_smartPads );
+ aSettings.Set( "ShoveVias", m_shoveVias );
+ aSettings.Set( "StartDiagonal", m_startDiagonal );
+ aSettings.Set( "ShoveTimeLimit", m_shoveTimeLimit.Get() );
+ aSettings.Set( "ShoveIterationLimit", m_shoveIterationLimit );
+ aSettings.Set( "WalkaroundIterationLimit", m_walkaroundIterationLimit );
+ aSettings.Set( "JumpOverObstacles", m_jumpOverObstacles );
+ aSettings.Set( "SmoothDraggedSegments", m_smoothDraggedSegments );
+ aSettings.Set( "CanViolateDRC", m_canViolateDRC );
+ aSettings.Set( "SuggestFinish", m_suggestFinish );
+ aSettings.Set( "FreeAngleMode", m_freeAngleMode );
+ aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
+}
+
+
+void PNS_ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
+{
+ m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround );
+ m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM );
+ m_removeLoops = aSettings.Get( "RemoveLoops", true );
+ m_smartPads = aSettings.Get( "SmartPads", true );
+ m_shoveVias = aSettings.Get( "ShoveVias", true );
+ m_startDiagonal = aSettings.Get( "StartDiagonal", false );
+ m_shoveTimeLimit.Set( aSettings.Get( "ShoveTimeLimit", 1000 ) );
+ m_shoveIterationLimit = aSettings.Get( "ShoveIterationLimit", 250 );
+ m_walkaroundIterationLimit = aSettings.Get( "WalkaroundIterationLimit", 50 );
+ m_jumpOverObstacles = aSettings.Get( "JumpOverObstacles", false );
+ m_smoothDraggedSegments = aSettings.Get( "SmoothDraggedSegments", true );
+ m_canViolateDRC = aSettings.Get( "CanViolateDRC", false );
+ m_suggestFinish = aSettings.Get( "SuggestFinish", false );
+ m_freeAngleMode = aSettings.Get( "FreeAngleMode", false );
+ m_inlineDragEnabled = aSettings.Get( "InlineDragEnabled", false );
+}
+
+
+const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
+{
+ if( m_startDiagonal )
+ return DIRECTION_45( DIRECTION_45::NE );
+ else
+ return DIRECTION_45( DIRECTION_45::N );
+}
+
+
+TIME_LIMIT PNS_ROUTING_SETTINGS::ShoveTimeLimit() const
+{
+ return TIME_LIMIT ( m_shoveTimeLimit );
+}
+
+
+int PNS_ROUTING_SETTINGS::ShoveIterationLimit() const
+{
+ return m_shoveIterationLimit;
+}