2011-10-17 20:01:27 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-07-01 13:16:51 +00:00
|
|
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2020-08-05 20:15:27 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-17 20:01:27 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2019-05-14 12:39:34 +00:00
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <geometry/geometry_utils.h>
|
2020-08-26 22:04:16 +00:00
|
|
|
#include <geometry/shape_null.h>
|
2020-09-23 09:35:13 +00:00
|
|
|
#include <advanced_config.h>
|
2020-10-15 00:46:32 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2019-05-14 12:39:34 +00:00
|
|
|
#include <pcb_screen.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2020-11-11 23:05:59 +00:00
|
|
|
#include <zone.h>
|
2020-10-15 02:13:01 +00:00
|
|
|
#include <kicad_string.h>
|
2012-07-30 07:40:25 +00:00
|
|
|
#include <math_for_graphics.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/color_settings.h>
|
|
|
|
#include <settings/settings_manager.h>
|
2020-10-14 03:37:48 +00:00
|
|
|
#include <trigo.h>
|
2020-10-16 15:51:24 +00:00
|
|
|
#include <i18n_utility.h>
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE::ZONE( BOARD_ITEM_CONTAINER* aParent, bool aInFP ) :
|
|
|
|
BOARD_CONNECTED_ITEM( aParent, aInFP ? PCB_FP_ZONE_T : PCB_ZONE_T ),
|
|
|
|
m_area( 0.0 )
|
2007-12-09 12:59:06 +00:00
|
|
|
{
|
2017-03-07 12:06:00 +00:00
|
|
|
m_CornerSelection = nullptr; // no corner is selected
|
2020-09-17 13:14:45 +00:00
|
|
|
m_isFilled = false; // fill status : true when the zone is filled
|
|
|
|
m_fillMode = ZONE_FILL_MODE::POLYGONS;
|
2020-08-07 14:04:34 +00:00
|
|
|
m_borderStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
|
|
|
|
m_borderHatchPitch = GetDefaultHatchPitch();
|
2018-03-19 09:02:05 +00:00
|
|
|
m_hv45 = false;
|
2020-08-07 14:04:34 +00:00
|
|
|
m_hatchThickness = 0;
|
|
|
|
m_hatchGap = 0;
|
|
|
|
m_hatchOrientation = 0.0;
|
|
|
|
m_hatchSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
|
|
|
|
m_hatchSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
|
|
|
|
// used only if m_hatchSmoothingLevel > 0
|
|
|
|
m_hatchHoleMinArea = 0.3; // Min size before holes are dropped (ratio of hole size)
|
|
|
|
m_hatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
|
2012-01-29 19:29:19 +00:00
|
|
|
m_priority = 0;
|
2012-07-13 18:55:29 +00:00
|
|
|
m_cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
|
2020-10-14 23:37:26 +00:00
|
|
|
SetIsRuleArea( aInFP ); // Zones living in footprints have the rule area option
|
|
|
|
SetDoNotAllowCopperPour( false ); // has meaning only if m_isRuleArea == true
|
|
|
|
SetDoNotAllowVias( true ); // has meaning only if m_isRuleArea == true
|
|
|
|
SetDoNotAllowTracks( true ); // has meaning only if m_isRuleArea == true
|
|
|
|
SetDoNotAllowPads( true ); // has meaning only if m_isRuleArea == true
|
|
|
|
SetDoNotAllowFootprints( false ); // has meaning only if m_isRuleArea == true
|
2012-07-13 18:55:29 +00:00
|
|
|
m_cornerRadius = 0;
|
2020-10-14 23:37:26 +00:00
|
|
|
SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
|
|
|
|
m_Poly = new SHAPE_POLY_SET(); // Outlines
|
|
|
|
m_fillVersion = 5; // set the "old" way to build filled polygon areas (< 6.0.x)
|
|
|
|
m_islandRemovalMode = ISLAND_REMOVAL_MODE::ALWAYS;
|
2019-10-28 09:15:03 +00:00
|
|
|
aParent->GetZoneSettings().ExportSetting( *this );
|
2019-03-14 13:35:55 +00:00
|
|
|
|
|
|
|
m_needRefill = false; // True only after some edition.
|
2007-12-09 12:59:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE::ZONE( const ZONE& aZone )
|
2020-09-06 15:33:03 +00:00
|
|
|
: BOARD_CONNECTED_ITEM( aZone ),
|
2020-07-20 10:26:48 +00:00
|
|
|
m_Poly( nullptr ),
|
|
|
|
m_CornerSelection( nullptr )
|
2012-01-14 19:50:32 +00:00
|
|
|
{
|
2020-07-27 17:56:15 +00:00
|
|
|
InitDataFromSrcInCopyCtor( aZone );
|
2012-01-14 19:50:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE& ZONE::operator=( const ZONE& aOther )
|
2016-05-31 08:27:52 +00:00
|
|
|
{
|
|
|
|
BOARD_CONNECTED_ITEM::operator=( aOther );
|
|
|
|
|
2020-07-27 17:56:15 +00:00
|
|
|
InitDataFromSrcInCopyCtor( aOther );
|
2019-09-05 14:36:23 +00:00
|
|
|
|
2016-05-31 08:27:52 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE::~ZONE()
|
2007-12-09 12:59:06 +00:00
|
|
|
{
|
2008-01-31 20:53:44 +00:00
|
|
|
delete m_Poly;
|
2017-03-07 12:06:00 +00:00
|
|
|
delete m_CornerSelection;
|
2007-12-09 12:59:06 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 20:01:27 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone )
|
2019-10-26 15:49:29 +00:00
|
|
|
{
|
2019-10-29 10:09:54 +00:00
|
|
|
// members are expected non initialize in this.
|
2020-07-27 17:56:15 +00:00
|
|
|
// InitDataFromSrcInCopyCtor() is expected to be called
|
2019-10-29 10:09:54 +00:00
|
|
|
// only from a copy constructor.
|
2020-03-15 08:39:42 +00:00
|
|
|
|
|
|
|
// Copy only useful EDA_ITEM flags:
|
2020-08-18 13:26:22 +00:00
|
|
|
m_Flags = aZone.m_Flags;
|
|
|
|
m_forceVisible = aZone.m_forceVisible;
|
2020-03-15 08:39:42 +00:00
|
|
|
|
2020-07-18 22:55:06 +00:00
|
|
|
// Replace the outlines for aZone outlines.
|
|
|
|
delete m_Poly;
|
|
|
|
m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
|
2019-10-29 10:09:54 +00:00
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
m_cornerSmoothingType = aZone.m_cornerSmoothingType;
|
|
|
|
m_cornerRadius = aZone.m_cornerRadius;
|
|
|
|
m_zoneName = aZone.m_zoneName;
|
2020-07-18 22:55:06 +00:00
|
|
|
SetLayerSet( aZone.GetLayerSet() );
|
2020-08-18 13:26:22 +00:00
|
|
|
m_priority = aZone.m_priority;
|
2020-09-21 23:32:07 +00:00
|
|
|
m_isRuleArea = aZone.m_isRuleArea;
|
2020-07-01 02:21:59 +00:00
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
m_doNotAllowCopperPour = aZone.m_doNotAllowCopperPour;
|
|
|
|
m_doNotAllowVias = aZone.m_doNotAllowVias;
|
|
|
|
m_doNotAllowTracks = aZone.m_doNotAllowTracks;
|
|
|
|
m_doNotAllowPads = aZone.m_doNotAllowPads;
|
|
|
|
m_doNotAllowFootprints = aZone.m_doNotAllowFootprints;
|
2019-10-26 15:49:29 +00:00
|
|
|
|
2020-07-18 22:55:06 +00:00
|
|
|
m_PadConnection = aZone.m_PadConnection;
|
|
|
|
m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
|
|
|
|
m_ZoneMinThickness = aZone.m_ZoneMinThickness;
|
2020-09-17 13:14:45 +00:00
|
|
|
m_fillVersion = aZone.m_fillVersion;
|
2020-07-18 22:55:06 +00:00
|
|
|
m_islandRemovalMode = aZone.m_islandRemovalMode;
|
|
|
|
m_minIslandArea = aZone.m_minIslandArea;
|
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
m_isFilled = aZone.m_isFilled;
|
|
|
|
m_needRefill = aZone.m_needRefill;
|
2020-07-18 22:55:06 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
m_thermalReliefGap = aZone.m_thermalReliefGap;
|
|
|
|
m_thermalReliefSpokeWidth = aZone.m_thermalReliefSpokeWidth;
|
2020-07-01 02:21:59 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
m_fillMode = aZone.m_fillMode; // solid vs. hatched
|
2020-08-18 13:26:22 +00:00
|
|
|
m_hatchThickness = aZone.m_hatchThickness;
|
|
|
|
m_hatchGap = aZone.m_hatchGap;
|
|
|
|
m_hatchOrientation = aZone.m_hatchOrientation;
|
|
|
|
m_hatchSmoothingLevel = aZone.m_hatchSmoothingLevel;
|
|
|
|
m_hatchSmoothingValue = aZone.m_hatchSmoothingValue;
|
|
|
|
m_hatchBorderAlgorithm = aZone.m_hatchBorderAlgorithm;
|
|
|
|
m_hatchHoleMinArea = aZone.m_hatchHoleMinArea;
|
2020-07-18 22:55:06 +00:00
|
|
|
|
|
|
|
// For corner moving, corner index to drag, or nullptr if no selection
|
2020-07-20 10:26:48 +00:00
|
|
|
delete m_CornerSelection;
|
2020-08-18 13:26:22 +00:00
|
|
|
m_CornerSelection = nullptr;
|
2020-07-18 22:55:06 +00:00
|
|
|
|
2020-07-01 02:21:59 +00:00
|
|
|
for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
|
|
|
|
{
|
|
|
|
m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
|
|
|
|
m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
|
|
|
|
m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
|
|
|
|
m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
|
|
|
|
m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
|
|
|
|
}
|
2019-10-26 15:49:29 +00:00
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
m_borderStyle = aZone.m_borderStyle;
|
|
|
|
m_borderHatchPitch = aZone.m_borderHatchPitch;
|
|
|
|
m_borderHatchLines = aZone.m_borderHatchLines;
|
2019-10-26 15:49:29 +00:00
|
|
|
|
|
|
|
SetLocalFlags( aZone.GetLocalFlags() );
|
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
m_netinfo = aZone.m_netinfo;
|
2020-03-29 16:42:24 +00:00
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
m_hv45 = aZone.m_hv45;
|
|
|
|
m_area = aZone.m_area;
|
2019-10-26 15:49:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
EDA_ITEM* ZONE::Clone() const
|
2012-01-14 19:50:32 +00:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
return new ZONE( *this );
|
2012-01-14 19:50:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::UnFill()
|
2011-07-16 16:04:49 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
bool change = false;
|
|
|
|
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
|
2020-06-24 02:19:08 +00:00
|
|
|
{
|
|
|
|
change |= !pair.second.IsEmpty();
|
|
|
|
pair.second.RemoveAllContours();
|
|
|
|
}
|
|
|
|
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
|
2020-06-24 02:19:08 +00:00
|
|
|
{
|
|
|
|
change |= !pair.second.empty();
|
|
|
|
pair.second.clear();
|
|
|
|
}
|
2011-07-16 16:04:49 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
m_isFilled = false;
|
|
|
|
m_fillFlags.clear();
|
2011-07-16 16:04:49 +00:00
|
|
|
|
|
|
|
return change;
|
|
|
|
}
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2011-10-17 20:01:27 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
wxPoint ZONE::GetPosition() const
|
2008-10-29 15:26:53 +00:00
|
|
|
{
|
2017-12-18 17:24:25 +00:00
|
|
|
return (wxPoint) GetCornerPosition( 0 );
|
2011-11-29 17:25:30 +00:00
|
|
|
}
|
2011-01-20 18:40:33 +00:00
|
|
|
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
PCB_LAYER_ID ZONE::GetLayer() const
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
|
|
|
return BOARD_ITEM::GetLayer();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::IsOnCopperLayer() const
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
|
2017-10-30 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::CommonLayerExists( const LSET aLayerSet ) const
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
|
|
|
LSET common = GetLayerSet() & aLayerSet;
|
|
|
|
|
|
|
|
return common.count() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::SetLayer( PCB_LAYER_ID aLayer )
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
|
|
|
SetLayerSet( LSET( aLayer ) );
|
|
|
|
|
|
|
|
m_Layer = aLayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::SetLayerSet( LSET aLayerSet )
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
2020-09-21 23:32:07 +00:00
|
|
|
if( GetIsRuleArea() )
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
2020-09-21 23:32:07 +00:00
|
|
|
// Rule areas can only exist on copper layers
|
2017-10-30 17:21:07 +00:00
|
|
|
aLayerSet &= LSET::AllCuMask();
|
|
|
|
}
|
|
|
|
|
2017-09-29 16:49:09 +00:00
|
|
|
if( aLayerSet.count() == 0 )
|
|
|
|
return;
|
|
|
|
|
2019-03-14 13:35:55 +00:00
|
|
|
if( m_layerSet != aLayerSet )
|
2020-06-24 02:19:08 +00:00
|
|
|
{
|
2019-03-14 13:35:55 +00:00
|
|
|
SetNeedRefill( true );
|
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
UnFill();
|
|
|
|
|
2020-07-01 02:21:59 +00:00
|
|
|
m_FillSegmList.clear();
|
|
|
|
m_FilledPolysList.clear();
|
|
|
|
m_RawPolysList.clear();
|
|
|
|
m_filledPolysHash.clear();
|
|
|
|
m_insulatedIslands.clear();
|
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
for( PCB_LAYER_ID layer : aLayerSet.Seq() )
|
|
|
|
{
|
2020-06-26 02:19:51 +00:00
|
|
|
m_FillSegmList[layer] = {};
|
|
|
|
m_FilledPolysList[layer] = {};
|
|
|
|
m_RawPolysList[layer] = {};
|
|
|
|
m_filledPolysHash[layer] = {};
|
|
|
|
m_insulatedIslands[layer] = {};
|
2020-06-24 02:19:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-30 17:21:07 +00:00
|
|
|
m_layerSet = aLayerSet;
|
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
// Set the single layer parameter. For zones that can be on many layers, this parameter
|
|
|
|
// is arbitrary at best, but some code still uses it.
|
2019-10-28 09:15:03 +00:00
|
|
|
// Priority is F_Cu then B_Cu then to the first selected layer
|
2017-10-30 17:21:07 +00:00
|
|
|
m_Layer = aLayerSet.Seq()[0];
|
2019-10-28 09:15:03 +00:00
|
|
|
|
|
|
|
if( m_Layer != F_Cu && aLayerSet[B_Cu] )
|
|
|
|
m_Layer = B_Cu;
|
2017-10-30 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
LSET ZONE::GetLayerSet() const
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
return m_layerSet;
|
2017-10-30 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::ViewGetLayers( int aLayers[], int& aCount ) const
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
LSEQ layers = m_layerSet.Seq();
|
2017-10-30 17:21:07 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
for( unsigned int idx = 0; idx < layers.size(); idx++ )
|
2020-07-11 17:42:00 +00:00
|
|
|
aLayers[idx] = LAYER_ZONE_START + layers[idx];
|
2017-10-30 17:21:07 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
aCount = layers.size();
|
2017-10-30 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
double ZONE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
2020-07-11 17:42:00 +00:00
|
|
|
{
|
2020-09-21 15:03:08 +00:00
|
|
|
constexpr double HIDE = std::numeric_limits<double>::max();
|
2020-07-11 17:42:00 +00:00
|
|
|
|
2020-09-21 15:03:08 +00:00
|
|
|
return aView->IsLayerVisible( LAYER_ZONES ) ? 0.0 : HIDE;
|
2020-07-11 17:42:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
2017-10-30 17:21:07 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
return m_layerSet.test( aLayer );
|
2017-10-30 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
const EDA_RECT ZONE::GetBoundingBox() const
|
2008-05-02 05:16:35 +00:00
|
|
|
{
|
2020-04-13 14:55:26 +00:00
|
|
|
auto bb = m_Poly->BBox();
|
2008-05-02 05:16:35 +00:00
|
|
|
|
2020-04-13 14:55:26 +00:00
|
|
|
EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
|
2008-05-02 05:16:35 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
int ZONE::GetThermalReliefGap( PAD* aPad, wxString* aSource ) const
|
2012-03-08 20:44:03 +00:00
|
|
|
{
|
2020-09-10 18:35:11 +00:00
|
|
|
if( aPad->GetEffectiveThermalGap() == 0 )
|
|
|
|
{
|
|
|
|
if( aSource )
|
|
|
|
*aSource = _( "zone" );
|
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
return m_thermalReliefGap;
|
2020-09-10 18:35:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return aPad->GetEffectiveThermalGap( aSource );
|
|
|
|
|
2012-03-08 20:44:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
int ZONE::GetThermalReliefSpokeWidth( PAD* aPad, wxString* aSource ) const
|
2012-03-08 20:44:03 +00:00
|
|
|
{
|
2020-09-10 18:35:11 +00:00
|
|
|
if( aPad->GetEffectiveThermalSpokeWidth() == 0 )
|
|
|
|
{
|
|
|
|
if( aSource )
|
|
|
|
*aSource = _( "zone" );
|
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
return m_thermalReliefSpokeWidth;
|
2020-09-10 18:35:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return aPad->GetEffectiveThermalSpokeWidth( aSource );
|
2012-03-08 20:44:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::SetCornerRadius( unsigned int aRadius )
|
2015-05-15 12:49:11 +00:00
|
|
|
{
|
2019-03-14 13:35:55 +00:00
|
|
|
if( m_cornerRadius != aRadius )
|
|
|
|
SetNeedRefill( true );
|
|
|
|
|
2015-05-15 12:49:11 +00:00
|
|
|
m_cornerRadius = aRadius;
|
2017-11-02 20:41:29 +00:00
|
|
|
}
|
2015-05-15 12:49:11 +00:00
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const
|
2020-09-22 21:05:24 +00:00
|
|
|
{
|
2020-09-23 09:35:13 +00:00
|
|
|
if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) )
|
2020-09-22 21:05:24 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return GetFilledPolysUseThickness();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
2007-12-29 19:15:58 +00:00
|
|
|
{
|
2018-11-17 00:34:12 +00:00
|
|
|
// Normally accuracy is zoom-relative, but for the generic HitTest we just use
|
|
|
|
// a fixed (small) value.
|
2019-05-05 10:33:34 +00:00
|
|
|
int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
|
2018-11-17 00:34:12 +00:00
|
|
|
|
|
|
|
return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
|
2007-12-29 19:15:58 +00:00
|
|
|
}
|
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::SetSelectedCorner( const wxPoint& aPosition, int aAccuracy )
|
2014-05-04 17:08:36 +00:00
|
|
|
{
|
2017-03-07 12:06:00 +00:00
|
|
|
SHAPE_POLY_SET::VERTEX_INDEX corner;
|
2014-05-04 17:08:36 +00:00
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
// If there is some corner to be selected, assign it to m_CornerSelection
|
2018-11-17 00:34:12 +00:00
|
|
|
if( HitTestForCorner( aPosition, aAccuracy * 2, corner )
|
|
|
|
|| HitTestForEdge( aPosition, aAccuracy, corner ) )
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
|
|
|
if( m_CornerSelection == nullptr )
|
|
|
|
m_CornerSelection = new SHAPE_POLY_SET::VERTEX_INDEX;
|
2014-05-04 17:08:36 +00:00
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
*m_CornerSelection = corner;
|
|
|
|
}
|
|
|
|
}
|
2014-05-04 17:08:36 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTestForCorner( const wxPoint& refPos, int aAccuracy,
|
|
|
|
SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const
|
2007-12-29 19:15:58 +00:00
|
|
|
{
|
2018-11-17 00:34:12 +00:00
|
|
|
return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
|
2007-12-29 19:15:58 +00:00
|
|
|
}
|
|
|
|
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
|
|
|
SHAPE_POLY_SET::VERTEX_INDEX dummy;
|
2018-11-17 00:34:12 +00:00
|
|
|
return HitTestForCorner( refPos, aAccuracy, dummy );
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTestForEdge( const wxPoint& refPos, int aAccuracy,
|
|
|
|
SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const
|
2007-12-29 19:15:58 +00:00
|
|
|
{
|
2018-11-17 00:34:12 +00:00
|
|
|
return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
|
|
|
SHAPE_POLY_SET::VERTEX_INDEX dummy;
|
2018-11-17 00:34:12 +00:00
|
|
|
return HitTestForEdge( refPos, aAccuracy, dummy );
|
2007-12-29 19:15:58 +00:00
|
|
|
}
|
|
|
|
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
2017-05-01 12:10:24 +00:00
|
|
|
// Calculate bounding box for zone
|
|
|
|
EDA_RECT bbox = GetBoundingBox();
|
2014-11-08 12:25:29 +00:00
|
|
|
bbox.Normalize();
|
2013-09-21 18:09:41 +00:00
|
|
|
|
2017-05-01 12:10:24 +00:00
|
|
|
EDA_RECT arect = aRect;
|
|
|
|
arect.Normalize();
|
|
|
|
arect.Inflate( aAccuracy );
|
|
|
|
|
2013-09-21 18:09:41 +00:00
|
|
|
if( aContained )
|
2017-05-01 12:10:24 +00:00
|
|
|
{
|
|
|
|
return arect.Contains( bbox );
|
|
|
|
}
|
2020-08-18 13:26:22 +00:00
|
|
|
else
|
2013-09-21 18:09:41 +00:00
|
|
|
{
|
2019-07-12 21:02:10 +00:00
|
|
|
// Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
|
2017-05-01 12:10:24 +00:00
|
|
|
if( !arect.Intersects( bbox ) )
|
2013-09-21 18:09:41 +00:00
|
|
|
return false;
|
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
int count = m_Poly->TotalVertices();
|
2019-07-12 21:02:10 +00:00
|
|
|
|
|
|
|
for( int ii = 0; ii < count; ii++ )
|
2013-09-21 18:09:41 +00:00
|
|
|
{
|
2019-03-23 18:26:44 +00:00
|
|
|
auto vertex = m_Poly->CVertex( ii );
|
|
|
|
auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
|
2017-05-01 12:10:24 +00:00
|
|
|
|
|
|
|
// Test if the point is within the rect
|
|
|
|
if( arect.Contains( ( wxPoint ) vertex ) )
|
2013-09-21 18:09:41 +00:00
|
|
|
return true;
|
2017-05-01 12:10:24 +00:00
|
|
|
|
|
|
|
// Test if this edge intersects the rect
|
|
|
|
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
|
|
|
|
return true;
|
2013-09-21 18:09:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2011-01-20 18:40:33 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
int ZONE::GetLocalClearance( wxString* aSource ) const
|
2011-08-09 03:41:20 +00:00
|
|
|
{
|
2020-09-21 23:32:07 +00:00
|
|
|
if( m_isRuleArea )
|
2020-05-15 23:25:33 +00:00
|
|
|
return 0;
|
|
|
|
|
2020-05-23 21:48:24 +00:00
|
|
|
if( aSource )
|
2020-05-29 12:36:45 +00:00
|
|
|
*aSource = _( "zone" );
|
2020-05-18 16:11:57 +00:00
|
|
|
|
2020-05-29 12:36:45 +00:00
|
|
|
return m_ZoneClearance;
|
2011-08-09 03:41:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTestFilledArea( PCB_LAYER_ID aLayer, const wxPoint &aRefPos, int aAccuracy ) const
|
2008-11-27 10:12:46 +00:00
|
|
|
{
|
2020-09-21 23:32:07 +00:00
|
|
|
// Rule areas have no filled area, but it's generally nice to treat their interior as if it were
|
|
|
|
// filled so that people don't have to select them by their outline (which is min-width)
|
|
|
|
if( GetIsRuleArea() )
|
2020-08-05 20:15:27 +00:00
|
|
|
return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy );
|
2020-06-30 00:37:57 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
if( !m_FilledPolysList.count( aLayer ) )
|
|
|
|
return false;
|
|
|
|
|
2020-08-05 20:15:27 +00:00
|
|
|
return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1,
|
2020-08-18 13:26:22 +00:00
|
|
|
aAccuracy );
|
2008-11-27 10:12:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::HitTestCutout( const VECTOR2I& aRefPos, int* aOutlineIdx, int* aHoleIdx ) const
|
2020-04-14 16:57:18 +00:00
|
|
|
{
|
|
|
|
// Iterate over each outline polygon in the zone and then iterate over
|
|
|
|
// each hole it has to see if the point is in it.
|
|
|
|
for( int i = 0; i < m_Poly->OutlineCount(); i++ )
|
|
|
|
{
|
|
|
|
for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
|
|
|
|
{
|
|
|
|
if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
|
|
|
|
{
|
|
|
|
if( aOutlineIdx )
|
|
|
|
*aOutlineIdx = i;
|
|
|
|
|
|
|
|
if( aHoleIdx )
|
|
|
|
*aHoleIdx = j;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
2007-12-29 19:15:58 +00:00
|
|
|
{
|
2020-05-21 17:42:42 +00:00
|
|
|
EDA_UNITS units = aFrame->GetUserUnits();
|
|
|
|
wxString msg, msg2;
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
if( GetIsRuleArea() )
|
|
|
|
msg = _( "Rule Area" );
|
2020-05-21 17:42:42 +00:00
|
|
|
else if( IsOnCopperLayer() )
|
|
|
|
msg = _( "Copper Zone" );
|
|
|
|
else
|
|
|
|
msg = _( "Non-copper Zone" );
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
// Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
|
2017-03-07 12:06:00 +00:00
|
|
|
// Check whether the selected corner is in a hole; i.e., in any contour but the first one.
|
|
|
|
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
|
2020-05-21 17:42:42 +00:00
|
|
|
msg << wxT( " " ) << _( "Cutout" );
|
2008-01-05 13:37:51 +00:00
|
|
|
|
2020-05-22 10:31:14 +00:00
|
|
|
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
if( GetIsRuleArea() )
|
2012-11-23 09:10:37 +00:00
|
|
|
{
|
|
|
|
msg.Empty();
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2012-11-23 09:10:37 +00:00
|
|
|
if( GetDoNotAllowVias() )
|
2020-05-07 00:30:46 +00:00
|
|
|
AccumulateDescription( msg, _( "No vias" ) );
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2012-11-23 09:10:37 +00:00
|
|
|
if( GetDoNotAllowTracks() )
|
2020-05-10 14:55:15 +00:00
|
|
|
AccumulateDescription( msg, _( "No tracks" ) );
|
2020-05-07 00:30:46 +00:00
|
|
|
|
|
|
|
if( GetDoNotAllowPads() )
|
2020-05-10 14:55:15 +00:00
|
|
|
AccumulateDescription( msg, _( "No pads" ) );
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2012-11-23 09:10:37 +00:00
|
|
|
if( GetDoNotAllowCopperPour() )
|
2020-05-10 14:55:15 +00:00
|
|
|
AccumulateDescription( msg, _( "No copper zones" ) );
|
2020-05-07 00:30:46 +00:00
|
|
|
|
|
|
|
if( GetDoNotAllowFootprints() )
|
2020-05-10 14:55:15 +00:00
|
|
|
AccumulateDescription( msg, _( "No footprints" ) );
|
2012-11-23 09:10:37 +00:00
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
if( !msg.IsEmpty() )
|
|
|
|
aList.emplace_back( MSG_PANEL_ITEM( _( "Restrictions" ), msg, RED ) );
|
2012-11-23 09:10:37 +00:00
|
|
|
}
|
|
|
|
else if( IsOnCopperLayer() )
|
2008-01-31 20:53:44 +00:00
|
|
|
{
|
2014-02-25 10:40:34 +00:00
|
|
|
if( GetNetCode() >= 0 )
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2015-01-22 12:06:34 +00:00
|
|
|
NETINFO_ITEM* net = GetNet();
|
2020-05-21 17:42:42 +00:00
|
|
|
NETCLASS* netclass = nullptr;
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2015-01-22 12:06:34 +00:00
|
|
|
if( net )
|
2020-05-21 17:42:42 +00:00
|
|
|
{
|
|
|
|
if( net->GetNet() )
|
|
|
|
netclass = GetNetClass();
|
|
|
|
else
|
|
|
|
netclass = GetBoard()->GetDesignSettings().GetDefault();
|
|
|
|
|
2018-10-19 11:28:34 +00:00
|
|
|
msg = UnescapeString( net->GetNetname() );
|
2020-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
msg = wxT( "<no name>" );
|
|
|
|
}
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-05-21 17:42:42 +00:00
|
|
|
aList.emplace_back( _( "Net" ), msg, RED );
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2020-05-21 17:42:42 +00:00
|
|
|
if( netclass )
|
|
|
|
aList.emplace_back( _( "NetClass" ), netclass->GetName(), DARKMAGENTA );
|
|
|
|
}
|
2012-01-29 19:29:19 +00:00
|
|
|
|
|
|
|
// Display priority level
|
|
|
|
msg.Printf( wxT( "%d" ), GetPriority() );
|
2020-06-24 01:09:15 +00:00
|
|
|
aList.emplace_back( _( "Priority" ), msg, BLUE );
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
wxString layerDesc;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
for( PCB_LAYER_ID layer : m_layerSet.Seq() )
|
|
|
|
{
|
|
|
|
if( count == 0 )
|
|
|
|
layerDesc = GetBoard()->GetLayerName( layer );
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( count > 1 )
|
|
|
|
layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
|
|
|
|
|
|
|
|
aList.emplace_back( _( "Layer" ), layerDesc, DARKGREEN );
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2020-06-24 01:09:15 +00:00
|
|
|
if( !m_zoneName.empty() )
|
|
|
|
aList.emplace_back( _( "Name" ), m_zoneName, DARKMAGENTA );
|
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
switch( m_fillMode )
|
2018-02-18 09:09:13 +00:00
|
|
|
{
|
2020-05-21 17:42:42 +00:00
|
|
|
case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
|
|
|
|
case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
|
|
|
|
default: msg = _( "Unknown" ); break;
|
2018-02-18 09:09:13 +00:00
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2020-05-21 17:42:42 +00:00
|
|
|
aList.emplace_back( _( "Fill Mode" ), msg, BROWN );
|
2008-10-07 09:32:56 +00:00
|
|
|
|
2020-10-04 15:29:18 +00:00
|
|
|
msg = MessageTextFromValue( units, m_area, true, EDA_DATA_TYPE::AREA );
|
2020-05-21 17:42:42 +00:00
|
|
|
aList.emplace_back( _( "Filled Area" ), msg, BLUE );
|
2020-02-05 09:43:52 +00:00
|
|
|
|
2020-05-21 17:42:42 +00:00
|
|
|
wxString source;
|
2020-10-12 17:40:03 +00:00
|
|
|
int clearance = GetOwnClearance( GetLayer(), &source );
|
2008-10-08 12:36:27 +00:00
|
|
|
|
2020-10-02 20:51:24 +00:00
|
|
|
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) );
|
2020-05-22 10:31:14 +00:00
|
|
|
msg2.Printf( _( "(from %s)" ), source );
|
2020-05-21 17:42:42 +00:00
|
|
|
aList.emplace_back( msg, msg2, BLACK );
|
2020-06-10 18:46:38 +00:00
|
|
|
|
|
|
|
// Useful for statistics, especially when zones are complex the number of hatches
|
|
|
|
// and filled polygons can explain the display and DRC calculation time:
|
2020-08-07 14:04:34 +00:00
|
|
|
msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
|
|
|
|
aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg, BLUE ) );
|
2020-06-10 18:46:38 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
PCB_LAYER_ID layer = m_Layer;
|
|
|
|
|
|
|
|
// NOTE: This brings in dependence on PCB_EDIT_FRAME to the qa tests, which isn't ideal.
|
|
|
|
// TODO: Figure out a way for items to know the active layer without the whole edit frame?
|
|
|
|
#if 0
|
|
|
|
if( PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( aFrame ) )
|
|
|
|
if( m_FilledPolysList.count( pcbframe->GetActiveLayer() ) )
|
|
|
|
layer = pcbframe->GetActiveLayer();
|
|
|
|
#endif
|
|
|
|
|
2020-10-02 22:42:32 +00:00
|
|
|
if( !GetIsRuleArea() )
|
2020-06-10 18:46:38 +00:00
|
|
|
{
|
2020-10-02 22:42:32 +00:00
|
|
|
auto layer_it = m_FilledPolysList.find( layer );
|
|
|
|
|
|
|
|
if( layer_it == m_FilledPolysList.end() )
|
|
|
|
layer_it = m_FilledPolysList.begin();
|
|
|
|
|
|
|
|
if( layer_it != m_FilledPolysList.end() )
|
|
|
|
{
|
|
|
|
msg.Printf( wxT( "%d" ), layer_it->second.TotalVertices() );
|
|
|
|
aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
|
|
|
|
}
|
2020-06-10 18:46:38 +00:00
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
}
|
2008-01-06 12:43:57 +00:00
|
|
|
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
/* Geometric transforms: */
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::Move( const wxPoint& offset )
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
2008-12-03 10:32:53 +00:00
|
|
|
/* move outlines */
|
2019-07-12 21:02:10 +00:00
|
|
|
m_Poly->Move( offset );
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
HatchBorder();
|
2008-12-03 10:32:53 +00:00
|
|
|
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
|
2020-06-24 02:19:08 +00:00
|
|
|
pair.second.Move( offset );
|
2011-01-20 18:40:33 +00:00
|
|
|
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
|
2009-08-06 18:30:46 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
for( SEG& seg : pair.second )
|
|
|
|
{
|
|
|
|
seg.A += VECTOR2I( offset );
|
|
|
|
seg.B += VECTOR2I( offset );
|
|
|
|
}
|
2009-08-06 18:30:46 +00:00
|
|
|
}
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
|
|
|
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::MoveEdge( const wxPoint& offset, int aEdge )
|
2008-02-01 21:30:45 +00:00
|
|
|
{
|
2017-04-16 16:32:47 +00:00
|
|
|
int next_corner;
|
2008-02-01 21:30:45 +00:00
|
|
|
|
2017-04-16 16:32:47 +00:00
|
|
|
if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
|
|
|
|
{
|
2019-03-23 18:26:44 +00:00
|
|
|
m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
|
|
|
|
m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
|
2020-08-07 14:04:34 +00:00
|
|
|
HatchBorder();
|
2019-03-14 13:35:55 +00:00
|
|
|
|
|
|
|
SetNeedRefill( true );
|
2017-04-16 16:32:47 +00:00
|
|
|
}
|
2008-02-01 21:30:45 +00:00
|
|
|
}
|
|
|
|
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::Rotate( const wxPoint& aCentre, double aAngle )
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
2020-08-18 13:26:22 +00:00
|
|
|
aAngle = -DECIDEG2RAD( aAngle );
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
|
2020-08-07 14:04:34 +00:00
|
|
|
HatchBorder();
|
2009-08-01 19:58:01 +00:00
|
|
|
|
|
|
|
/* rotate filled areas: */
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
|
2020-08-18 13:26:22 +00:00
|
|
|
pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
|
2011-01-20 18:40:33 +00:00
|
|
|
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
|
2009-08-06 18:30:46 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
for( SEG& seg : pair.second )
|
|
|
|
{
|
|
|
|
wxPoint a( seg.A );
|
2020-08-18 13:26:22 +00:00
|
|
|
RotatePoint( &a, aCentre, aAngle );
|
2020-06-24 02:19:08 +00:00
|
|
|
seg.A = a;
|
|
|
|
wxPoint b( seg.B );
|
2020-08-18 13:26:22 +00:00
|
|
|
RotatePoint( &b, aCentre, aAngle );
|
2020-06-24 02:19:08 +00:00
|
|
|
seg.B = a;
|
|
|
|
}
|
2009-08-06 18:30:46 +00:00
|
|
|
}
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-20 18:40:33 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2019-07-12 21:02:10 +00:00
|
|
|
Mirror( aCentre, aFlipLeftRight );
|
2015-12-27 15:51:13 +00:00
|
|
|
int copperLayerCount = GetBoard()->GetCopperLayerCount();
|
2017-10-30 17:21:07 +00:00
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
if( GetIsRuleArea() )
|
2017-10-30 17:21:07 +00:00
|
|
|
SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
|
|
|
|
else
|
|
|
|
SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
2008-01-06 12:43:57 +00:00
|
|
|
|
2011-01-20 18:40:33 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight )
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
// ZONEs mirror about the x-axis (why?!?)
|
2019-03-23 18:26:44 +00:00
|
|
|
m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
|
2008-01-31 20:53:44 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
HatchBorder();
|
2009-08-01 19:58:01 +00:00
|
|
|
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
|
2020-06-24 02:19:08 +00:00
|
|
|
pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
|
2011-01-20 18:40:33 +00:00
|
|
|
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
|
2009-08-06 18:30:46 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
for( SEG& seg : pair.second )
|
2019-07-12 21:02:10 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
if( aMirrorLeftRight )
|
|
|
|
{
|
|
|
|
MIRROR( seg.A.x, aMirrorRef.x );
|
|
|
|
MIRROR( seg.B.x, aMirrorRef.x );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MIRROR( seg.A.y, aMirrorRef.y );
|
|
|
|
MIRROR( seg.B.y, aMirrorRef.y );
|
|
|
|
}
|
2019-07-12 21:02:10 +00:00
|
|
|
}
|
2009-08-06 18:30:46 +00:00
|
|
|
}
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
ZONE_CONNECTION ZONE::GetPadConnection( PAD* aPad, wxString* aSource ) const
|
2012-02-24 23:23:46 +00:00
|
|
|
{
|
2020-06-22 19:35:09 +00:00
|
|
|
if( aPad == NULL || aPad->GetEffectiveZoneConnection() == ZONE_CONNECTION::INHERITED )
|
2020-09-10 18:35:11 +00:00
|
|
|
{
|
|
|
|
if( aSource )
|
|
|
|
*aSource = _( "zone" );
|
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
return m_PadConnection;
|
2020-09-10 18:35:11 +00:00
|
|
|
}
|
2012-02-24 23:23:46 +00:00
|
|
|
else
|
2020-09-10 18:35:11 +00:00
|
|
|
{
|
|
|
|
return aPad->GetEffectiveZoneConnection( aSource );
|
|
|
|
}
|
2012-02-24 23:23:46 +00:00
|
|
|
}
|
2020-04-14 16:57:18 +00:00
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::RemoveCutout( int aOutlineIdx, int aHoleIdx )
|
2020-04-14 16:57:18 +00:00
|
|
|
{
|
|
|
|
// Ensure the requested cutout is valid
|
|
|
|
if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
|
|
|
|
return;
|
|
|
|
|
|
|
|
SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
|
|
|
|
|
|
|
|
// Add the cutout back to the zone
|
|
|
|
m_Poly->BooleanAdd( cutPoly, SHAPE_POLY_SET::PM_FAST );
|
|
|
|
|
|
|
|
SetNeedRefill( true );
|
|
|
|
}
|
2012-02-24 23:23:46 +00:00
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::AddPolygon( const SHAPE_LINE_CHAIN& aPolygon )
|
2019-05-21 02:31:40 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aPolygon.IsClosed() );
|
|
|
|
|
|
|
|
// Add the outline as a new polygon in the polygon set
|
|
|
|
if( m_Poly->OutlineCount() == 0 )
|
|
|
|
m_Poly->AddOutline( aPolygon );
|
|
|
|
else
|
|
|
|
m_Poly->AddHole( aPolygon );
|
|
|
|
|
|
|
|
SetNeedRefill( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::AddPolygon( std::vector< wxPoint >& aPolygon )
|
2012-06-09 17:00:13 +00:00
|
|
|
{
|
|
|
|
if( aPolygon.empty() )
|
|
|
|
return;
|
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
SHAPE_LINE_CHAIN outline;
|
|
|
|
|
|
|
|
// Create an outline and populate it with the points of aPolygon
|
2020-05-21 17:42:42 +00:00
|
|
|
for( const wxPoint& pt : aPolygon)
|
|
|
|
outline.Append( pt );
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
outline.SetClosed( true );
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-04-14 17:00:09 +00:00
|
|
|
AddPolygon( outline );
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2017-04-07 06:02:26 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication )
|
2017-06-19 11:29:57 +00:00
|
|
|
{
|
|
|
|
// Ensure the main outline exists:
|
|
|
|
if( m_Poly->OutlineCount() == 0 )
|
|
|
|
m_Poly->NewOutline();
|
|
|
|
|
|
|
|
// If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
|
|
|
|
// (remember: the index of the first hole is 0)
|
|
|
|
// Return error if if does dot exist.
|
|
|
|
if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
|
|
|
|
|
2019-03-14 13:35:55 +00:00
|
|
|
SetNeedRefill( true );
|
|
|
|
|
2017-06-19 11:29:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
wxString ZONE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
2011-07-14 15:42:44 +00:00
|
|
|
{
|
|
|
|
wxString text;
|
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
// Check whether the selected contour is a hole (contour index > 0)
|
|
|
|
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
|
2018-01-31 09:08:57 +00:00
|
|
|
text << wxT( " " ) << _( "(Cutout)" );
|
2011-07-14 15:42:44 +00:00
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
if( GetIsRuleArea() )
|
|
|
|
text << wxT( " " ) << _( "(Rule Area)" );
|
2018-01-31 09:08:57 +00:00
|
|
|
else
|
|
|
|
text << GetNetnameMsg();
|
2011-07-14 15:42:44 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
wxString layerDesc;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
for( PCB_LAYER_ID layer : m_layerSet.Seq() )
|
|
|
|
{
|
|
|
|
if( count == 0 )
|
|
|
|
layerDesc = GetBoard()->GetLayerName( layer );
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( count > 1 )
|
|
|
|
layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
|
|
|
|
|
|
|
|
return wxString::Format( _( "Zone Outline %s on %s" ), text, layerDesc );
|
2015-12-27 15:51:13 +00:00
|
|
|
}
|
2017-02-20 12:20:39 +00:00
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
int ZONE::GetBorderHatchPitch() const
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
return m_borderHatchPitch;
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch,
|
|
|
|
bool aRebuildHatch )
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
|
|
|
SetHatchPitch( aHatchPitch );
|
2020-08-07 14:04:34 +00:00
|
|
|
m_borderStyle = aHatchStyle;
|
2017-03-07 12:06:00 +00:00
|
|
|
|
|
|
|
if( aRebuildHatch )
|
2020-08-07 14:04:34 +00:00
|
|
|
HatchBorder();
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::SetHatchPitch( int aPitch )
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
m_borderHatchPitch = aPitch;
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::UnHatchBorder()
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
m_borderHatchLines.clear();
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Creates hatch lines inside the outline of the complex polygon
|
2020-08-07 14:04:34 +00:00
|
|
|
// sort function used in ::HatchBorder to sort points by descending wxPoint.x values
|
2017-03-07 12:06:00 +00:00
|
|
|
bool sortEndsByDescendingX( const VECTOR2I& ref, const VECTOR2I& tst )
|
|
|
|
{
|
|
|
|
return tst.x < ref.x;
|
|
|
|
}
|
|
|
|
|
2017-07-01 13:16:51 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::HatchBorder()
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
UnHatchBorder();
|
2017-03-07 12:06:00 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
if( m_borderStyle == ZONE_BORDER_DISPLAY_STYLE::NO_HATCH
|
|
|
|
|| m_borderHatchPitch == 0
|
|
|
|
|| m_Poly->IsEmpty() )
|
|
|
|
{
|
2017-03-07 12:06:00 +00:00
|
|
|
return;
|
2020-08-07 14:04:34 +00:00
|
|
|
}
|
2017-03-07 12:06:00 +00:00
|
|
|
|
|
|
|
// define range for hatch lines
|
2019-03-23 18:26:44 +00:00
|
|
|
int min_x = m_Poly->CVertex( 0 ).x;
|
|
|
|
int max_x = m_Poly->CVertex( 0 ).x;
|
|
|
|
int min_y = m_Poly->CVertex( 0 ).y;
|
|
|
|
int max_y = m_Poly->CVertex( 0 ).y;
|
2017-03-07 12:06:00 +00:00
|
|
|
|
|
|
|
for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
|
|
|
|
{
|
|
|
|
if( iterator->x < min_x )
|
|
|
|
min_x = iterator->x;
|
|
|
|
|
|
|
|
if( iterator->x > max_x )
|
|
|
|
max_x = iterator->x;
|
|
|
|
|
|
|
|
if( iterator->y < min_y )
|
|
|
|
min_y = iterator->y;
|
|
|
|
|
|
|
|
if( iterator->y > max_y )
|
|
|
|
max_y = iterator->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate spacing between 2 hatch lines
|
|
|
|
int spacing;
|
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
if( m_borderStyle == ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE )
|
|
|
|
spacing = m_borderHatchPitch;
|
2017-03-07 12:06:00 +00:00
|
|
|
else
|
2020-08-07 14:04:34 +00:00
|
|
|
spacing = m_borderHatchPitch * 2;
|
2017-03-07 12:06:00 +00:00
|
|
|
|
|
|
|
// set the "length" of hatch lines (the length on horizontal axis)
|
2020-08-07 14:04:34 +00:00
|
|
|
int hatch_line_len = m_borderHatchPitch;
|
2017-03-07 12:06:00 +00:00
|
|
|
|
|
|
|
// To have a better look, give a slope depending on the layer
|
|
|
|
LAYER_NUM layer = GetLayer();
|
|
|
|
int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
|
|
|
|
double slope = 0.707106 * slope_flag; // 45 degrees slope
|
|
|
|
int max_a, min_a;
|
|
|
|
|
|
|
|
if( slope_flag == 1 )
|
|
|
|
{
|
|
|
|
max_a = KiROUND( max_y - slope * min_x );
|
|
|
|
min_a = KiROUND( min_y - slope * max_x );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
max_a = KiROUND( max_y - slope * max_x );
|
|
|
|
min_a = KiROUND( min_y - slope * min_x );
|
|
|
|
}
|
|
|
|
|
|
|
|
min_a = (min_a / spacing) * spacing;
|
|
|
|
|
|
|
|
// calculate an offset depending on layer number,
|
|
|
|
// for a better look of hatches on a multilayer board
|
|
|
|
int offset = (layer * 7) / 8;
|
|
|
|
min_a += offset;
|
|
|
|
|
|
|
|
// loop through hatch lines
|
|
|
|
#define MAXPTS 200 // Usually we store only few values per one hatch line
|
|
|
|
// depending on the complexity of the zone outline
|
|
|
|
|
|
|
|
static std::vector<VECTOR2I> pointbuffer;
|
|
|
|
pointbuffer.clear();
|
|
|
|
pointbuffer.reserve( MAXPTS + 2 );
|
|
|
|
|
|
|
|
for( int a = min_a; a < max_a; a += spacing )
|
|
|
|
{
|
|
|
|
// get intersection points for this hatch line
|
|
|
|
|
|
|
|
// Note: because we should have an even number of intersections with the
|
|
|
|
// current hatch line and the zone outline (a closed polygon,
|
|
|
|
// or a set of closed polygons), if an odd count is found
|
|
|
|
// we skip this line (should not occur)
|
|
|
|
pointbuffer.clear();
|
|
|
|
|
|
|
|
// Iterate through all vertices
|
|
|
|
for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
|
|
|
|
{
|
|
|
|
double x, y, x2, y2;
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
SEG segment = *iterator;
|
|
|
|
|
|
|
|
ok = FindLineSegmentIntersection( a, slope,
|
|
|
|
segment.A.x, segment.A.y,
|
|
|
|
segment.B.x, segment.B.y,
|
|
|
|
&x, &y, &x2, &y2 );
|
|
|
|
|
|
|
|
if( ok )
|
|
|
|
{
|
|
|
|
VECTOR2I point( KiROUND( x ), KiROUND( y ) );
|
|
|
|
pointbuffer.push_back( point );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ok == 2 )
|
|
|
|
{
|
|
|
|
VECTOR2I point( KiROUND( x2 ), KiROUND( y2 ) );
|
|
|
|
pointbuffer.push_back( point );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pointbuffer.size() >= MAXPTS ) // overflow
|
|
|
|
{
|
|
|
|
wxASSERT( 0 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ensure we have found an even intersection points count
|
|
|
|
// because intersections are the ends of segments
|
|
|
|
// inside the polygon(s) and a segment has 2 ends.
|
|
|
|
// if not, this is a strange case (a bug ?) so skip this hatch
|
|
|
|
if( pointbuffer.size() % 2 != 0 )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// sort points in order of descending x (if more than 2) to
|
|
|
|
// ensure the starting point and the ending point of the same segment
|
|
|
|
// are stored one just after the other.
|
|
|
|
if( pointbuffer.size() > 2 )
|
|
|
|
sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
|
|
|
|
|
|
|
|
// creates lines or short segments inside the complex polygon
|
|
|
|
for( unsigned ip = 0; ip < pointbuffer.size(); ip += 2 )
|
|
|
|
{
|
|
|
|
int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
|
|
|
|
|
|
|
|
// Push only one line for diagonal hatch,
|
|
|
|
// or for small lines < twice the line length
|
|
|
|
// else push 2 small lines
|
2020-08-07 14:04:34 +00:00
|
|
|
if( m_borderStyle == ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL
|
|
|
|
|| std::abs( dx ) < 2 * hatch_line_len )
|
2017-03-07 12:06:00 +00:00
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
m_borderHatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ ip + 1] ) );
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
|
|
|
|
slope = dy / dx;
|
|
|
|
|
|
|
|
if( dx > 0 )
|
|
|
|
dx = hatch_line_len;
|
|
|
|
else
|
|
|
|
dx = -hatch_line_len;
|
|
|
|
|
|
|
|
int x1 = KiROUND( pointbuffer[ip].x + dx );
|
|
|
|
int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
|
|
|
|
int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
|
|
|
|
int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
|
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
m_borderHatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y, x1, y1 ) );
|
2017-03-07 12:06:00 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
m_borderHatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
|
2017-03-07 12:06:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
int ZONE::GetDefaultHatchPitch()
|
2017-07-01 13:16:51 +00:00
|
|
|
{
|
|
|
|
return Mils2iu( 20 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
BITMAP_DEF ZONE::GetMenuImage() const
|
2017-02-20 12:20:39 +00:00
|
|
|
{
|
|
|
|
return add_zone_xpm;
|
|
|
|
}
|
2017-10-31 13:59:03 +00:00
|
|
|
|
2018-06-22 23:35:07 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::SwapData( BOARD_ITEM* aImage )
|
2017-10-31 13:59:03 +00:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
assert( aImage->Type() == PCB_ZONE_T );
|
2017-10-31 13:59:03 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
std::swap( *((ZONE*) this), *((ZONE*) aImage) );
|
2017-10-31 13:59:03 +00:00
|
|
|
}
|
2017-11-23 16:20:27 +00:00
|
|
|
|
2018-06-22 23:35:07 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::CacheTriangulation( PCB_LAYER_ID aLayer )
|
2017-11-23 16:20:27 +00:00
|
|
|
{
|
2020-09-14 17:54:14 +00:00
|
|
|
if( aLayer == UNDEFINED_LAYER )
|
|
|
|
{
|
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
|
|
|
|
pair.second.CacheTriangulation();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_FilledPolysList.count( aLayer ) )
|
|
|
|
m_FilledPolysList[ aLayer ].CacheTriangulation();
|
|
|
|
}
|
2017-11-23 16:20:27 +00:00
|
|
|
}
|
2017-12-04 18:06:47 +00:00
|
|
|
|
2018-06-22 23:35:07 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::IsIsland( PCB_LAYER_ID aLayer, int aPolyIdx )
|
2020-06-26 02:19:51 +00:00
|
|
|
{
|
|
|
|
if( GetNetCode() < 1 )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if( !m_insulatedIslands.count( aLayer ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::GetInteractingZones( PCB_LAYER_ID aLayer, std::vector<ZONE*>* aZones ) const
|
2019-07-13 22:34:09 +00:00
|
|
|
{
|
|
|
|
int epsilon = Millimeter2iu( 0.001 );
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
for( ZONE* candidate : GetBoard()->Zones() )
|
2019-07-13 22:34:09 +00:00
|
|
|
{
|
2019-07-28 16:31:26 +00:00
|
|
|
if( candidate == this )
|
|
|
|
continue;
|
|
|
|
|
2020-08-12 18:42:40 +00:00
|
|
|
if( !candidate->GetLayerSet().test( aLayer ) )
|
2019-07-28 16:31:26 +00:00
|
|
|
continue;
|
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
if( candidate->GetIsRuleArea() )
|
2020-08-12 18:42:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if( candidate->GetNetCode() != GetNetCode() )
|
2019-07-28 16:31:26 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
for( auto iter = m_Poly->CIterate(); iter; iter++ )
|
2019-07-13 22:34:09 +00:00
|
|
|
{
|
2019-07-28 16:31:26 +00:00
|
|
|
if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
|
2019-07-13 22:34:09 +00:00
|
|
|
{
|
2020-08-12 18:42:40 +00:00
|
|
|
aZones->push_back( candidate );
|
|
|
|
break;
|
2019-07-13 22:34:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer,
|
|
|
|
SHAPE_POLY_SET* aBoardOutline,
|
|
|
|
SHAPE_POLY_SET* aSmoothedPolyWithApron ) const
|
2017-12-04 18:06:47 +00:00
|
|
|
{
|
2020-08-30 14:18:35 +00:00
|
|
|
if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
|
2017-12-04 18:06:47 +00:00
|
|
|
return false;
|
|
|
|
|
2020-10-10 22:09:00 +00:00
|
|
|
if( GetIsRuleArea() )
|
|
|
|
{
|
|
|
|
// We like keepouts just the way they are....
|
|
|
|
aSmoothedPoly = *m_Poly;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
BOARD* board = GetBoard();
|
|
|
|
int maxError = ARC_HIGH_DEF;
|
|
|
|
bool keepExternalFillets = false;
|
2020-08-12 18:42:40 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
if( board )
|
|
|
|
{
|
|
|
|
maxError = board->GetDesignSettings().m_MaxError;
|
|
|
|
keepExternalFillets = board->GetDesignSettings().m_ZoneKeepExternalFillets;
|
|
|
|
}
|
2020-08-12 18:42:40 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
auto smooth = [&]( SHAPE_POLY_SET& aPoly )
|
|
|
|
{
|
|
|
|
switch( m_cornerSmoothingType )
|
|
|
|
{
|
|
|
|
case ZONE_SETTINGS::SMOOTHING_CHAMFER:
|
|
|
|
aPoly = aPoly.Chamfer( (int) m_cornerRadius );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ZONE_SETTINGS::SMOOTHING_FILLET:
|
|
|
|
{
|
|
|
|
aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
2020-08-12 18:42:40 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
std::vector<ZONE*> interactingZones;
|
2020-08-30 14:18:35 +00:00
|
|
|
GetInteractingZones( aLayer, &interactingZones );
|
2017-12-04 18:06:47 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
SHAPE_POLY_SET* maxExtents = m_Poly;
|
|
|
|
SHAPE_POLY_SET withFillets;
|
2017-12-04 18:06:47 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
aSmoothedPoly = *m_Poly;
|
2019-05-22 14:47:38 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
// Should external fillets (that is, those applied to concave corners) be kept? While it
|
|
|
|
// seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
|
|
|
|
// indeed fill them so we leave the mode available.
|
|
|
|
if( keepExternalFillets )
|
|
|
|
{
|
|
|
|
withFillets = *m_Poly;
|
|
|
|
smooth( withFillets );
|
|
|
|
withFillets.BooleanAdd( *m_Poly, SHAPE_POLY_SET::PM_FAST );
|
|
|
|
maxExtents = &withFillets;
|
2019-05-22 14:47:38 +00:00
|
|
|
}
|
2020-08-25 18:03:21 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
for( ZONE* zone : interactingZones )
|
2020-08-30 14:18:35 +00:00
|
|
|
aSmoothedPoly.BooleanAdd( *zone->Outline(), SHAPE_POLY_SET::PM_FAST );
|
|
|
|
|
2020-10-10 22:09:00 +00:00
|
|
|
if( !GetIsRuleArea() && aBoardOutline )
|
|
|
|
aSmoothedPoly.BooleanIntersection( *aBoardOutline, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
smooth( aSmoothedPoly );
|
2017-12-04 18:06:47 +00:00
|
|
|
|
2020-10-29 21:17:57 +00:00
|
|
|
if( aSmoothedPolyWithApron )
|
|
|
|
{
|
|
|
|
SHAPE_POLY_SET bufferedExtents = *maxExtents;
|
|
|
|
bufferedExtents.Inflate( m_ZoneMinThickness, 8 );
|
|
|
|
*aSmoothedPolyWithApron = aSmoothedPoly;
|
|
|
|
aSmoothedPolyWithApron->BooleanIntersection( bufferedExtents, SHAPE_POLY_SET::PM_FAST );
|
|
|
|
}
|
|
|
|
|
2020-10-10 12:10:52 +00:00
|
|
|
aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
|
2020-08-12 18:42:40 +00:00
|
|
|
|
2017-12-04 18:06:47 +00:00
|
|
|
return true;
|
2020-08-30 14:18:35 +00:00
|
|
|
}
|
2017-12-13 23:33:20 +00:00
|
|
|
|
2020-02-05 09:43:52 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
double ZONE::CalculateFilledArea()
|
2020-02-05 09:43:52 +00:00
|
|
|
{
|
|
|
|
m_area = 0.0;
|
|
|
|
|
|
|
|
// Iterate over each outline polygon in the zone and then iterate over
|
|
|
|
// each hole it has to compute the total area.
|
2020-06-30 17:32:48 +00:00
|
|
|
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
|
2020-02-05 09:43:52 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
SHAPE_POLY_SET& poly = pair.second;
|
2020-02-05 09:43:52 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
for( int i = 0; i < poly.OutlineCount(); i++ )
|
2020-02-05 09:43:52 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
m_area += poly.Outline( i ).Area();
|
|
|
|
|
|
|
|
for( int j = 0; j < poly.HoleCount( i ); j++ )
|
|
|
|
m_area -= poly.Hole( i, j ).Area();
|
2020-02-05 09:43:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return m_area;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
/**
|
2020-10-10 22:09:00 +00:00
|
|
|
* Function TransformSmoothedOutlineToPolygon
|
2020-09-17 13:14:45 +00:00
|
|
|
* Convert the smoothed outline to polygons (optionally inflated by \a aClearance) and copy them
|
2020-08-18 13:26:22 +00:00
|
|
|
* into \a aCornerBuffer.
|
2017-12-13 23:33:20 +00:00
|
|
|
*/
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearance,
|
|
|
|
SHAPE_POLY_SET* aBoardOutline ) const
|
2017-12-13 23:33:20 +00:00
|
|
|
{
|
|
|
|
// Creates the zone outline polygon (with holes if any)
|
|
|
|
SHAPE_POLY_SET polybuffer;
|
2020-10-10 22:09:00 +00:00
|
|
|
BuildSmoothedPoly( polybuffer, GetLayer(), aBoardOutline );
|
2017-12-13 23:33:20 +00:00
|
|
|
|
|
|
|
// Calculate the polygon with clearance
|
|
|
|
// holes are linked to the main outline, so only one polygon is created.
|
2020-05-18 16:11:57 +00:00
|
|
|
if( aClearance )
|
2019-05-14 12:39:34 +00:00
|
|
|
{
|
2019-07-13 16:35:57 +00:00
|
|
|
BOARD* board = GetBoard();
|
2019-05-22 14:47:38 +00:00
|
|
|
int maxError = ARC_HIGH_DEF;
|
|
|
|
|
|
|
|
if( board )
|
|
|
|
maxError = board->GetDesignSettings().m_MaxError;
|
|
|
|
|
2020-09-10 23:05:20 +00:00
|
|
|
int segCount = GetArcToSegmentCount( aClearance, maxError, 360.0 );
|
2020-05-18 16:11:57 +00:00
|
|
|
polybuffer.Inflate( aClearance, segCount );
|
2019-05-14 12:39:34 +00:00
|
|
|
}
|
2019-07-13 16:35:57 +00:00
|
|
|
|
2017-12-13 23:33:20 +00:00
|
|
|
polybuffer.Fracture( SHAPE_POLY_SET::PM_FAST );
|
|
|
|
aCornerBuffer.Append( polybuffer );
|
|
|
|
}
|
2019-10-26 15:49:29 +00:00
|
|
|
|
2020-08-18 13:26:22 +00:00
|
|
|
|
2019-10-29 10:09:54 +00:00
|
|
|
//
|
2020-11-11 23:05:59 +00:00
|
|
|
/********* FP_ZONE **************/
|
2019-10-29 10:09:54 +00:00
|
|
|
//
|
2020-11-11 23:05:59 +00:00
|
|
|
FP_ZONE::FP_ZONE( BOARD_ITEM_CONTAINER* aParent ) :
|
|
|
|
ZONE( aParent, true )
|
2019-10-29 10:09:54 +00:00
|
|
|
{
|
|
|
|
// in a footprint, net classes are not managed.
|
|
|
|
// so set the net to NETINFO_LIST::ORPHANED_ITEM
|
|
|
|
SetNetCode( -1, true );
|
|
|
|
}
|
|
|
|
|
2019-10-26 15:49:29 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
FP_ZONE::FP_ZONE( const FP_ZONE& aZone ) :
|
|
|
|
ZONE( aZone.GetParent(), true )
|
2019-10-26 15:49:29 +00:00
|
|
|
{
|
2020-07-27 17:56:15 +00:00
|
|
|
InitDataFromSrcInCopyCtor( aZone );
|
2019-10-26 15:49:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
FP_ZONE& FP_ZONE::operator=( const FP_ZONE& aOther )
|
2019-10-26 15:49:29 +00:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE::operator=( aOther );
|
2019-10-26 15:49:29 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
EDA_ITEM* FP_ZONE::Clone() const
|
2019-10-26 15:49:29 +00:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
return new FP_ZONE( *this );
|
2019-10-26 15:49:29 +00:00
|
|
|
}
|
2019-10-28 09:15:03 +00:00
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
double FP_ZONE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
2019-10-28 09:15:03 +00:00
|
|
|
{
|
2020-09-21 15:03:08 +00:00
|
|
|
constexpr double HIDE = (double)std::numeric_limits<double>::max();
|
2019-10-28 09:15:03 +00:00
|
|
|
|
|
|
|
if( !aView )
|
|
|
|
return 0;
|
|
|
|
|
2020-10-02 22:42:32 +00:00
|
|
|
if( !aView->IsLayerVisible( LAYER_ZONES ) )
|
|
|
|
return HIDE;
|
|
|
|
|
2019-10-28 09:15:03 +00:00
|
|
|
bool flipped = GetParent() && GetParent()->GetLayer() == B_Cu;
|
|
|
|
|
|
|
|
// Handle Render tab switches
|
|
|
|
if( !flipped && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
|
|
|
return HIDE;
|
|
|
|
|
|
|
|
if( flipped && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
|
|
|
return HIDE;
|
|
|
|
|
|
|
|
// Other layers are shown without any conditions
|
2020-09-21 15:03:08 +00:00
|
|
|
return 0.0;
|
2019-10-28 09:15:03 +00:00
|
|
|
}
|
2020-02-02 18:40:14 +00:00
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
std::shared_ptr<SHAPE> ZONE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
|
2020-08-26 22:04:16 +00:00
|
|
|
{
|
|
|
|
std::shared_ptr<SHAPE> shape;
|
|
|
|
|
|
|
|
if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
|
|
|
|
{
|
2020-10-26 23:49:11 +00:00
|
|
|
shape = std::make_shared<SHAPE_NULL>();
|
2020-08-26 22:04:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
shape.reset( m_FilledPolysList.at( aLayer ).Clone() );
|
|
|
|
}
|
|
|
|
|
|
|
|
return shape;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
static struct ZONE_DESC
|
2020-02-02 18:40:14 +00:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE_DESC()
|
2020-02-02 18:40:14 +00:00
|
|
|
{
|
2020-09-05 16:00:29 +00:00
|
|
|
ENUM_MAP<ZONE_CONNECTION>::Instance()
|
2020-10-16 15:51:24 +00:00
|
|
|
.Map( ZONE_CONNECTION::INHERITED, _HKI( "Inherited" ) )
|
|
|
|
.Map( ZONE_CONNECTION::NONE, _HKI( "None" ) )
|
|
|
|
.Map( ZONE_CONNECTION::THERMAL, _HKI( "Thermal reliefs" ) )
|
|
|
|
.Map( ZONE_CONNECTION::FULL, _HKI( "Solid" ) )
|
|
|
|
.Map( ZONE_CONNECTION::THT_THERMAL, _HKI( "Reliefs for PTH" ) );
|
2020-09-05 16:00:29 +00:00
|
|
|
|
2020-02-02 18:40:14 +00:00
|
|
|
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
2020-11-11 23:05:59 +00:00
|
|
|
REGISTER_TYPE( ZONE );
|
|
|
|
propMgr.InheritsAfter( TYPE_HASH( ZONE ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY<ZONE, unsigned>( _HKI( "Priority" ),
|
|
|
|
&ZONE::SetPriority, &ZONE::GetPriority ) );
|
|
|
|
//propMgr.AddProperty( new PROPERTY<ZONE, bool>( "Filled",
|
|
|
|
//&ZONE::SetIsFilled, &ZONE::IsFilled ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY<ZONE, wxString>( _HKI( "Name" ),
|
|
|
|
&ZONE::SetZoneName, &ZONE::GetZoneName ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Clearance" ),
|
|
|
|
&ZONE::SetLocalClearance, &ZONE::GetLocalClearance,
|
2020-09-05 16:00:29 +00:00
|
|
|
PROPERTY_DISPLAY::DISTANCE ) );
|
2020-11-11 23:05:59 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Min Width" ),
|
|
|
|
&ZONE::SetMinThickness, &ZONE::GetMinThickness,
|
2020-09-05 16:00:29 +00:00
|
|
|
PROPERTY_DISPLAY::DISTANCE ) );
|
2020-11-11 23:05:59 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY_ENUM<ZONE, ZONE_CONNECTION>( _HKI( "Pad Connections" ),
|
|
|
|
&ZONE::SetPadConnection, &ZONE::GetPadConnection ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Thermal Clearance" ),
|
|
|
|
&ZONE::SetThermalReliefGap, &ZONE::GetThermalReliefGap,
|
2020-09-05 16:00:29 +00:00
|
|
|
PROPERTY_DISPLAY::DISTANCE ) );
|
2020-11-11 23:05:59 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<ZONE, int>( _HKI( "Thermal Spoke Width" ),
|
|
|
|
&ZONE::SetThermalReliefSpokeWidth, &ZONE::GetThermalReliefSpokeWidth,
|
2020-10-14 23:37:26 +00:00
|
|
|
PROPERTY_DISPLAY::DISTANCE ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
}
|
2020-11-11 23:05:59 +00:00
|
|
|
} _ZONE_DESC;
|
2020-09-05 16:00:29 +00:00
|
|
|
|
|
|
|
ENUM_TO_WXANY( ZONE_CONNECTION );
|