2012-06-08 09:56:42 +00:00
|
|
|
/**
|
|
|
|
* @brief class ZONE_SETTINGS used to handle zones parameters
|
2008-10-23 10:26:06 +00:00
|
|
|
*/
|
|
|
|
|
2012-06-08 09:56:42 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2008-10-23 10:26:06 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2008-10-23 10:26:06 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <zones.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_zone.h>
|
2008-10-23 10:26:06 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
ZONE_SETTINGS::ZONE_SETTINGS()
|
2008-10-23 10:26:06 +00:00
|
|
|
{
|
2012-01-29 19:29:19 +00:00
|
|
|
m_ZonePriority = 0;
|
2014-06-24 16:17:18 +00:00
|
|
|
m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons
|
2012-06-25 20:59:19 +00:00
|
|
|
// Clearance value
|
|
|
|
m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL );
|
|
|
|
// Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
|
|
|
|
m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL );
|
2014-06-24 16:17:18 +00:00
|
|
|
m_NetcodeSelection = 0; // Net code selection for the current zone
|
|
|
|
m_CurrentZone_Layer = F_Cu; // Layer used to create the current zone
|
|
|
|
m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle
|
|
|
|
// ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
|
|
|
|
// or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2013-03-20 14:50:12 +00:00
|
|
|
// thickness of the gap in thermal reliefs:
|
2012-06-25 20:59:19 +00:00
|
|
|
m_ThermalReliefGap = Mils2iu( ZONE_THERMAL_RELIEF_GAP_MIL );
|
2013-03-20 14:50:12 +00:00
|
|
|
// thickness of the copper bridge in thermal reliefs:
|
2012-06-25 20:59:19 +00:00
|
|
|
m_ThermalReliefCopperBridge = Mils2iu( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL );
|
2008-10-23 10:26:06 +00:00
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
m_PadConnection = THERMAL_PAD; // How pads are covered by copper in zone
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
m_Zone_45_Only = false;
|
2011-02-21 19:43:59 +00:00
|
|
|
|
2012-07-13 18:55:29 +00:00
|
|
|
m_cornerSmoothingType = SMOOTHING_NONE;
|
|
|
|
m_cornerRadius = 0;
|
|
|
|
|
|
|
|
SetIsKeepout( false );
|
2012-07-14 16:27:25 +00:00
|
|
|
SetDoNotAllowCopperPour( false );
|
2012-07-13 18:55:29 +00:00
|
|
|
SetDoNotAllowVias( true );
|
|
|
|
SetDoNotAllowTracks( true );
|
2008-10-23 10:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
|
2008-10-23 10:26:06 +00:00
|
|
|
{
|
2012-01-29 19:29:19 +00:00
|
|
|
m_ZonePriority = aSource.GetPriority();
|
2013-03-18 19:36:07 +00:00
|
|
|
m_FillMode = aSource.GetFillMode();
|
|
|
|
m_ZoneClearance = aSource.GetClearance();
|
|
|
|
m_ZoneMinThickness = aSource.GetMinThickness();
|
2014-02-25 10:40:34 +00:00
|
|
|
m_NetcodeSelection = aSource.GetNetCode();
|
2008-12-12 21:30:07 +00:00
|
|
|
m_CurrentZone_Layer = aSource.GetLayer();
|
|
|
|
m_Zone_HatchingStyle = aSource.GetHatchStyle();
|
2013-03-18 19:36:07 +00:00
|
|
|
m_ArcToSegmentsCount = aSource.GetArcSegmentCount();
|
|
|
|
m_ThermalReliefGap = aSource.GetThermalReliefGap();
|
|
|
|
m_ThermalReliefCopperBridge = aSource.GetThermalReliefCopperBridge();
|
2012-02-24 23:23:46 +00:00
|
|
|
m_PadConnection = aSource.GetPadConnection();
|
2012-07-13 18:55:29 +00:00
|
|
|
m_cornerSmoothingType = aSource.GetCornerSmoothingType();
|
|
|
|
m_cornerRadius = aSource.GetCornerRadius();
|
|
|
|
m_isKeepout = aSource.GetIsKeepout();
|
2012-07-14 16:27:25 +00:00
|
|
|
m_keepoutDoNotAllowCopperPour = aSource.GetDoNotAllowCopperPour();
|
2012-07-13 18:55:29 +00:00
|
|
|
m_keepoutDoNotAllowVias = aSource.GetDoNotAllowVias();
|
|
|
|
m_keepoutDoNotAllowTracks = aSource.GetDoNotAllowTracks();
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
return *this;
|
2008-10-23 10:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) const
|
2008-10-23 10:26:06 +00:00
|
|
|
{
|
2013-03-18 19:36:07 +00:00
|
|
|
aTarget.SetFillMode( m_FillMode );
|
|
|
|
aTarget.SetZoneClearance( m_ZoneClearance );
|
|
|
|
aTarget.SetMinThickness( m_ZoneMinThickness );
|
|
|
|
aTarget.SetArcSegmentCount( m_ArcToSegmentsCount );
|
|
|
|
aTarget.SetThermalReliefGap( m_ThermalReliefGap );
|
|
|
|
aTarget.SetThermalReliefCopperBridge( m_ThermalReliefCopperBridge );
|
2012-02-24 23:23:46 +00:00
|
|
|
aTarget.SetPadConnection( m_PadConnection );
|
2012-07-13 18:55:29 +00:00
|
|
|
aTarget.SetCornerSmoothingType( m_cornerSmoothingType );
|
|
|
|
aTarget.SetCornerRadius( m_cornerRadius );
|
|
|
|
aTarget.SetIsKeepout( GetIsKeepout() );
|
2012-07-14 16:27:25 +00:00
|
|
|
aTarget.SetDoNotAllowCopperPour( GetDoNotAllowCopperPour() );
|
2012-07-13 18:55:29 +00:00
|
|
|
aTarget.SetDoNotAllowVias( GetDoNotAllowVias() );
|
|
|
|
aTarget.SetDoNotAllowTracks( GetDoNotAllowTracks() );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2008-12-12 21:30:07 +00:00
|
|
|
if( aFullExport )
|
2008-12-03 10:32:53 +00:00
|
|
|
{
|
2012-01-29 19:29:19 +00:00
|
|
|
aTarget.SetPriority( m_ZonePriority );
|
2014-02-25 10:40:34 +00:00
|
|
|
aTarget.SetNetCode( m_NetcodeSelection );
|
2008-12-03 10:32:53 +00:00
|
|
|
aTarget.SetLayer( m_CurrentZone_Layer );
|
2013-03-20 14:50:12 +00:00
|
|
|
aTarget.Outline()->SetLayer( m_CurrentZone_Layer );
|
2008-12-03 10:32:53 +00:00
|
|
|
}
|
2012-07-30 07:40:25 +00:00
|
|
|
|
|
|
|
// call SetHatch last, because hatch lines will be rebuilt,
|
|
|
|
// using new parameters values
|
2013-03-20 14:50:12 +00:00
|
|
|
aTarget.Outline()->SetHatch( m_Zone_HatchingStyle, Mils2iu( 20 ), true );
|
2008-10-23 10:26:06 +00:00
|
|
|
}
|