2014-05-14 13:53:54 +00:00
|
|
|
/*
|
|
|
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013-2014 CERN
|
2016-08-29 14:38:11 +00:00
|
|
|
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-05-14 13:53:54 +00:00
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2015-07-02 14:09:51 +00:00
|
|
|
#include <tool/tool_settings.h>
|
|
|
|
|
2017-03-22 12:35:07 +00:00
|
|
|
#include <geometry/direction45.h>
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
#include "pns_routing_settings.h"
|
|
|
|
|
2016-08-29 14:38:11 +00:00
|
|
|
namespace PNS {
|
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
ROUTING_SETTINGS::ROUTING_SETTINGS()
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
m_routingMode = RM_Walkaround;
|
2015-02-18 00:29:54 +00:00
|
|
|
m_optimizerEffort = OE_MEDIUM;
|
2014-05-14 13:53:54 +00:00
|
|
|
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;
|
2015-07-02 14:09:51 +00:00
|
|
|
m_freeAngleMode = false;
|
2015-07-02 14:10:07 +00:00
|
|
|
m_inlineDragEnabled = false;
|
2017-08-03 15:53:07 +00:00
|
|
|
m_snapToTracks = false;
|
|
|
|
m_snapToPads = false;
|
2015-07-02 14:09:51 +00:00
|
|
|
}
|
|
|
|
|
2015-07-02 14:11:15 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
void ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
|
2015-07-02 14:09:51 +00:00
|
|
|
{
|
2015-07-02 14:11:15 +00:00
|
|
|
aSettings.Set( "Mode", (int) m_routingMode );
|
2015-07-02 14:09:51 +00:00
|
|
|
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 );
|
2015-07-02 14:10:07 +00:00
|
|
|
aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
|
2015-07-02 14:11:15 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
void ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
|
2015-07-02 14:09:51 +00:00
|
|
|
{
|
|
|
|
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 );
|
2015-07-02 14:10:07 +00:00
|
|
|
m_inlineDragEnabled = aSettings.Get( "InlineDragEnabled", false );
|
2015-07-02 14:09:51 +00:00
|
|
|
}
|
2014-05-16 11:37:31 +00:00
|
|
|
|
2015-07-02 14:11:15 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
const DIRECTION_45 ROUTING_SETTINGS::InitialDirection() const
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
|
|
|
if( m_startDiagonal )
|
|
|
|
return DIRECTION_45( DIRECTION_45::NE );
|
|
|
|
else
|
|
|
|
return DIRECTION_45( DIRECTION_45::N );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
TIME_LIMIT ROUTING_SETTINGS::ShoveTimeLimit() const
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
return TIME_LIMIT ( m_shoveTimeLimit );
|
|
|
|
}
|
|
|
|
|
2014-05-16 11:37:31 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
int ROUTING_SETTINGS::ShoveIterationLimit() const
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
return m_shoveIterationLimit;
|
|
|
|
}
|
2016-08-29 14:38:11 +00:00
|
|
|
|
|
|
|
}
|