2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-04-19 08:00:46 +00:00
|
|
|
* Copyright (C) 2012 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>
|
2021-04-19 08:00:46 +00:00
|
|
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
2022-03-03 21:47:05 +00:00
|
|
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-13 19:56:32 +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
|
|
|
|
*/
|
|
|
|
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <pcb_base_frame.h>
|
2022-09-24 18:54:56 +00:00
|
|
|
#include <core/mirror.h>
|
2020-07-27 19:41:50 +00:00
|
|
|
#include <connectivity/connectivity_data.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <board_design_settings.h>
|
2021-10-25 19:50:33 +00:00
|
|
|
#include <convert_basic_shapes_to_polygon.h>
|
2021-06-11 21:07:02 +00:00
|
|
|
#include <pcb_track.h>
|
2012-04-27 14:15:11 +00:00
|
|
|
#include <base_units.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2021-07-29 09:56:22 +00:00
|
|
|
#include <string_utils.h>
|
2018-02-19 14:48:22 +00:00
|
|
|
#include <view/view.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/color_settings.h>
|
|
|
|
#include <settings/settings_manager.h>
|
2020-10-16 15:51:24 +00:00
|
|
|
#include <i18n_utility.h>
|
2021-06-06 12:59:05 +00:00
|
|
|
#include <geometry/seg.h>
|
2020-08-08 22:37:41 +00:00
|
|
|
#include <geometry/shape_segment.h>
|
|
|
|
#include <geometry/shape_circle.h>
|
|
|
|
#include <geometry/shape_arc.h>
|
2020-09-15 19:13:45 +00:00
|
|
|
#include <drc/drc_engine.h>
|
2021-01-30 14:41:31 +00:00
|
|
|
#include <pcb_painter.h>
|
2021-06-06 12:59:05 +00:00
|
|
|
#include <trigo.h>
|
2021-01-30 14:41:31 +00:00
|
|
|
|
|
|
|
using KIGFX::PCB_PAINTER;
|
|
|
|
using KIGFX::PCB_RENDER_SETTINGS;
|
2008-03-11 01:19:08 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
PCB_TRACK::PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
2008-12-04 04:28:11 +00:00
|
|
|
BOARD_CONNECTED_ITEM( aParent, idtype )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2022-09-16 11:33:56 +00:00
|
|
|
m_Width = pcbIUScale.mmToIU( 0.2 ); // Gives a reasonable default width
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
EDA_ITEM* PCB_TRACK::Clone() const
|
2012-01-14 19:50:32 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
return new PCB_TRACK( *this );
|
2012-01-14 19:50:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
PCB_ARC::PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc ) :
|
|
|
|
PCB_TRACK( aParent, PCB_ARC_T )
|
2021-06-06 12:59:05 +00:00
|
|
|
{
|
2022-01-01 18:57:44 +00:00
|
|
|
m_Start = aArc->GetP0();
|
|
|
|
m_End = aArc->GetP1();
|
|
|
|
m_Mid = aArc->GetArcMid();
|
2021-06-06 12:59:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
EDA_ITEM* PCB_ARC::Clone() const
|
2019-03-27 12:38:29 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
return new PCB_ARC( *this );
|
2019-03-27 12:38:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
PCB_VIA::PCB_VIA( BOARD_ITEM* aParent ) :
|
|
|
|
PCB_TRACK( aParent, PCB_VIA_T )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-12-28 00:55:11 +00:00
|
|
|
SetViaType( VIATYPE::THROUGH );
|
2020-11-14 14:29:11 +00:00
|
|
|
m_bottomLayer = B_Cu;
|
2014-04-25 06:00:04 +00:00
|
|
|
SetDrillDefault();
|
2020-11-14 14:29:11 +00:00
|
|
|
m_removeUnconnectedLayer = false;
|
|
|
|
m_keepTopBottomLayer = true;
|
2020-12-20 21:29:43 +00:00
|
|
|
m_isFree = false;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
EDA_ITEM* PCB_VIA::Clone() const
|
2012-01-14 19:50:32 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
return new PCB_VIA( *this );
|
2012-01-14 19:50:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-19 16:09:59 +00:00
|
|
|
wxString PCB_VIA::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
2011-07-14 15:42:44 +00:00
|
|
|
{
|
2020-09-19 18:53:58 +00:00
|
|
|
wxString formatStr;
|
2011-07-14 15:42:44 +00:00
|
|
|
|
2014-04-25 06:00:04 +00:00
|
|
|
switch( GetViaType() )
|
|
|
|
{
|
2020-09-19 18:53:58 +00:00
|
|
|
case VIATYPE::BLIND_BURIED: formatStr = _( "Blind/Buried Via %s on %s" ); break;
|
|
|
|
case VIATYPE::MICROVIA: formatStr = _( "Micro Via %s on %s" ); break;
|
|
|
|
default: formatStr = _( "Via %s on %s" ); break;
|
2014-04-25 06:00:04 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 18:53:58 +00:00
|
|
|
return wxString::Format( formatStr,
|
2020-09-16 09:41:40 +00:00
|
|
|
GetNetnameMsg(),
|
2020-11-16 11:16:44 +00:00
|
|
|
layerMaskDescribe() );
|
2011-07-14 15:42:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
BITMAPS PCB_VIA::GetMenuImage() const
|
2017-02-20 12:20:39 +00:00
|
|
|
{
|
2021-03-08 02:59:07 +00:00
|
|
|
return BITMAPS::via;
|
2017-02-20 12:20:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
bool PCB_TRACK::ApproxCollinear( const PCB_TRACK& aTrack )
|
2021-06-06 12:59:05 +00:00
|
|
|
{
|
|
|
|
SEG a( m_Start, m_End );
|
|
|
|
SEG b( aTrack.GetStart(), aTrack.GetEnd() );
|
|
|
|
return a.ApproxCollinear( b );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
int PCB_TRACK::GetLocalClearance( wxString* aSource ) const
|
2010-04-08 11:33:43 +00:00
|
|
|
{
|
2020-05-29 12:36:45 +00:00
|
|
|
// Not currently implemented
|
|
|
|
return 0;
|
2010-04-08 11:33:43 +00:00
|
|
|
}
|
2007-09-01 12:00:30 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2022-07-31 21:14:24 +00:00
|
|
|
MINOPTMAX<int> PCB_TRACK::GetWidthConstraint( wxString* aSource ) const
|
|
|
|
{
|
|
|
|
DRC_CONSTRAINT constraint;
|
|
|
|
|
|
|
|
if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
|
|
|
|
{
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
|
|
|
|
|
|
|
|
constraint = bds.m_DRCEngine->EvalRules( TRACK_WIDTH_CONSTRAINT, this, nullptr, m_layer );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aSource )
|
|
|
|
*aSource = constraint.GetName();
|
|
|
|
|
|
|
|
return constraint.Value();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
int PCB_VIA::GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const
|
2020-05-21 17:42:42 +00:00
|
|
|
{
|
2020-09-29 20:40:17 +00:00
|
|
|
if( !FlashLayer( aLayer ) )
|
2020-07-27 19:41:50 +00:00
|
|
|
{
|
|
|
|
if( aSource )
|
2020-09-23 10:46:41 +00:00
|
|
|
*aSource = _( "removed annular ring" );
|
2020-07-27 19:41:50 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-09-16 09:41:40 +00:00
|
|
|
DRC_CONSTRAINT constraint;
|
|
|
|
|
|
|
|
if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
|
|
|
|
{
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2021-02-08 14:53:49 +00:00
|
|
|
constraint = bds.m_DRCEngine->EvalRules( ANNULAR_WIDTH_CONSTRAINT, this, nullptr, aLayer );
|
2020-09-16 09:41:40 +00:00
|
|
|
}
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2020-09-15 19:13:45 +00:00
|
|
|
if( constraint.Value().HasMin() )
|
2020-05-23 21:48:24 +00:00
|
|
|
{
|
|
|
|
if( aSource )
|
2020-09-15 19:13:45 +00:00
|
|
|
*aSource = constraint.GetName();
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2020-09-15 19:13:45 +00:00
|
|
|
return constraint.Value().Min();
|
2020-05-23 21:48:24 +00:00
|
|
|
}
|
2020-09-15 19:13:45 +00:00
|
|
|
|
|
|
|
return 0;
|
2020-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
int PCB_VIA::GetDrillValue() const
|
2008-01-12 20:31:56 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
if( m_drill > 0 ) // Use the specific value.
|
|
|
|
return m_drill;
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
// Use the default value from the Netclass
|
2022-08-14 11:03:18 +00:00
|
|
|
NETCLASS* netclass = GetEffectiveNetClass();
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2019-12-28 00:55:11 +00:00
|
|
|
if( GetViaType() == VIATYPE::MICROVIA )
|
2009-10-21 19:16:25 +00:00
|
|
|
return netclass->GetuViaDrill();
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
return netclass->GetViaDrill();
|
2008-01-12 20:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
EDA_ITEM_FLAGS PCB_TRACK::IsPointOnEnds( const VECTOR2I& point, int min_dist ) const
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2021-06-08 03:06:11 +00:00
|
|
|
EDA_ITEM_FLAGS result = 0;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
if( min_dist < 0 )
|
|
|
|
min_dist = m_Width / 2;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
if( min_dist == 0 )
|
2007-08-08 20:51:08 +00:00
|
|
|
{
|
2013-05-04 11:57:09 +00:00
|
|
|
if( m_Start == point )
|
2007-08-08 20:51:08 +00:00
|
|
|
result |= STARTPOINT;
|
2013-05-04 11:57:09 +00:00
|
|
|
|
|
|
|
if( m_End == point )
|
|
|
|
result |= ENDPOINT;
|
2007-08-08 20:51:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-04 11:57:09 +00:00
|
|
|
double dist = GetLineLength( m_Start, point );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2013-05-01 17:32:36 +00:00
|
|
|
if( min_dist >= KiROUND( dist ) )
|
2007-08-08 20:51:08 +00:00
|
|
|
result |= STARTPOINT;
|
|
|
|
|
2013-05-04 11:57:09 +00:00
|
|
|
dist = GetLineLength( m_End, point );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2013-05-01 17:32:36 +00:00
|
|
|
if( min_dist >= KiROUND( dist ) )
|
2007-08-08 20:51:08 +00:00
|
|
|
result |= ENDPOINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2022-08-31 09:15:42 +00:00
|
|
|
const BOX2I PCB_TRACK::GetBoundingBox() const
|
2008-03-05 22:39:33 +00:00
|
|
|
{
|
2008-03-10 13:33:12 +00:00
|
|
|
// end of track is round, this is its radius, rounded up
|
2018-06-12 08:36:41 +00:00
|
|
|
int radius = ( m_Width + 1 ) / 2;
|
|
|
|
int ymax, xmax, ymin, xmin;
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( Type() == PCB_VIA_T )
|
2008-03-10 15:00:22 +00:00
|
|
|
{
|
|
|
|
ymax = m_Start.y;
|
|
|
|
xmax = m_Start.x;
|
|
|
|
|
|
|
|
ymin = m_Start.y;
|
|
|
|
xmin = m_Start.x;
|
|
|
|
}
|
2021-01-29 17:06:42 +00:00
|
|
|
else if( Type() == PCB_ARC_T )
|
|
|
|
{
|
|
|
|
std::shared_ptr<SHAPE> arc = GetEffectiveShape();
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I bbox = arc->BBox();
|
2021-01-29 17:06:42 +00:00
|
|
|
|
|
|
|
xmin = bbox.GetLeft();
|
|
|
|
xmax = bbox.GetRight();
|
|
|
|
ymin = bbox.GetTop();
|
|
|
|
ymax = bbox.GetBottom();
|
|
|
|
}
|
2008-03-10 15:00:22 +00:00
|
|
|
else
|
|
|
|
{
|
2012-09-22 11:19:37 +00:00
|
|
|
ymax = std::max( m_Start.y, m_End.y );
|
|
|
|
xmax = std::max( m_Start.x, m_End.x );
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2012-09-22 11:19:37 +00:00
|
|
|
ymin = std::min( m_Start.y, m_End.y );
|
|
|
|
xmin = std::min( m_Start.x, m_End.x );
|
2008-03-10 15:00:22 +00:00
|
|
|
}
|
2008-03-05 22:39:33 +00:00
|
|
|
|
|
|
|
ymax += radius;
|
|
|
|
xmax += radius;
|
|
|
|
|
|
|
|
ymin -= radius;
|
|
|
|
xmin -= radius;
|
|
|
|
|
2008-03-10 13:33:12 +00:00
|
|
|
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin + 1, ymax - ymin + 1 ) );
|
2008-03-11 01:19:08 +00:00
|
|
|
|
|
|
|
return ret;
|
2008-03-05 22:39:33 +00:00
|
|
|
}
|
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
double PCB_TRACK::GetLength() const
|
2021-06-06 12:59:05 +00:00
|
|
|
{
|
|
|
|
return GetLineLength( m_Start, m_End );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-13 19:32:00 +00:00
|
|
|
void PCB_TRACK::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( m_Start, aRotCentre, aAngle );
|
|
|
|
RotatePoint( m_End, aRotCentre, aAngle );
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
|
2022-01-13 19:32:00 +00:00
|
|
|
void PCB_ARC::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
2019-03-27 12:38:29 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( m_Start, aRotCentre, aAngle );
|
|
|
|
RotatePoint( m_End, aRotCentre, aAngle );
|
|
|
|
RotatePoint( m_Mid, aRotCentre, aAngle );
|
2019-03-27 12:38:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-24 18:54:56 +00:00
|
|
|
void PCB_TRACK::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
|
|
|
|
{
|
|
|
|
if( aMirrorAroundXAxis )
|
|
|
|
{
|
|
|
|
MIRROR( m_Start.y, aCentre.y );
|
|
|
|
MIRROR( m_End.y, aCentre.y );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MIRROR( m_Start.x, aCentre.x );
|
|
|
|
MIRROR( m_End.x, aCentre.x );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_ARC::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
|
|
|
|
{
|
|
|
|
if( aMirrorAroundXAxis )
|
|
|
|
{
|
|
|
|
MIRROR( m_Start.y, aCentre.y );
|
|
|
|
MIRROR( m_End.y, aCentre.y );
|
|
|
|
MIRROR( m_Mid.y, aCentre.y );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MIRROR( m_Start.x, aCentre.x );
|
|
|
|
MIRROR( m_End.x, aCentre.x );
|
|
|
|
MIRROR( m_Mid.x, aCentre.x );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void PCB_TRACK::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2019-07-12 21:02:10 +00:00
|
|
|
if( aFlipLeftRight )
|
|
|
|
{
|
|
|
|
m_Start.x = aCentre.x - ( m_Start.x - aCentre.x );
|
|
|
|
m_End.x = aCentre.x - ( m_End.x - aCentre.x );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Start.y = aCentre.y - ( m_Start.y - aCentre.y );
|
|
|
|
m_End.y = aCentre.y - ( m_End.y - aCentre.y );
|
|
|
|
}
|
|
|
|
|
2015-12-27 15:51:13 +00:00
|
|
|
int copperLayerCount = GetBoard()->GetCopperLayerCount();
|
|
|
|
SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
|
2014-04-30 19:16:22 +00:00
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void PCB_ARC::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
2019-03-27 12:38:29 +00:00
|
|
|
{
|
|
|
|
if( aFlipLeftRight )
|
|
|
|
{
|
|
|
|
m_Start.x = aCentre.x - ( m_Start.x - aCentre.x );
|
|
|
|
m_End.x = aCentre.x - ( m_End.x - aCentre.x );
|
|
|
|
m_Mid.x = aCentre.x - ( m_Mid.x - aCentre.x );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Start.y = aCentre.y - ( m_Start.y - aCentre.y );
|
|
|
|
m_End.y = aCentre.y - ( m_End.y - aCentre.y );
|
|
|
|
m_Mid.y = aCentre.y - ( m_Mid.y - aCentre.y );
|
|
|
|
}
|
|
|
|
|
|
|
|
int copperLayerCount = GetBoard()->GetCopperLayerCount();
|
|
|
|
SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-06-22 16:57:42 +00:00
|
|
|
bool PCB_ARC::IsCCW() const
|
|
|
|
{
|
|
|
|
VECTOR2I start_end = m_End - m_Start;
|
|
|
|
VECTOR2I start_mid = m_Mid - m_Start;
|
|
|
|
|
|
|
|
return start_end.Cross( start_mid ) < 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void PCB_VIA::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
2014-04-30 19:16:22 +00:00
|
|
|
{
|
2019-07-12 21:02:10 +00:00
|
|
|
if( aFlipLeftRight )
|
|
|
|
{
|
|
|
|
m_Start.x = aCentre.x - ( m_Start.x - aCentre.x );
|
|
|
|
m_End.x = aCentre.x - ( m_End.x - aCentre.x );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Start.y = aCentre.y - ( m_Start.y - aCentre.y );
|
|
|
|
m_End.y = aCentre.y - ( m_End.y - aCentre.y );
|
|
|
|
}
|
2015-12-27 15:51:13 +00:00
|
|
|
|
2019-12-28 00:55:11 +00:00
|
|
|
if( GetViaType() != VIATYPE::THROUGH )
|
2015-12-27 15:51:13 +00:00
|
|
|
{
|
2019-12-28 00:55:11 +00:00
|
|
|
int copperLayerCount = GetBoard()->GetCopperLayerCount();
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID top_layer;
|
|
|
|
PCB_LAYER_ID bottom_layer;
|
2015-12-27 15:51:13 +00:00
|
|
|
LayerPair( &top_layer, &bottom_layer );
|
2019-12-28 00:55:11 +00:00
|
|
|
top_layer = FlipLayer( top_layer, copperLayerCount );
|
2015-12-27 15:51:13 +00:00
|
|
|
bottom_layer = FlipLayer( bottom_layer, copperLayerCount );
|
|
|
|
SetLayerPair( top_layer, bottom_layer );
|
|
|
|
}
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
|
|
|
|
2008-03-05 22:39:33 +00:00
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
// see class_track.h
|
2022-08-20 09:27:35 +00:00
|
|
|
INSPECT_RESULT PCB_TRACK::Visit( INSPECTOR inspector, void* testData,
|
2022-08-21 19:54:07 +00:00
|
|
|
const std::vector<KICAD_T>& aScanTypes )
|
2007-08-30 22:20:52 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
for( KICAD_T scanType : aScanTypes )
|
2007-08-30 22:20:52 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
if( scanType == Type() )
|
|
|
|
{
|
|
|
|
if( INSPECT_RESULT::QUIT == inspector( this, testData ) )
|
|
|
|
return INSPECT_RESULT::QUIT;
|
|
|
|
}
|
2007-08-30 22:20:52 +00:00
|
|
|
}
|
|
|
|
|
2022-07-30 00:00:39 +00:00
|
|
|
return INSPECT_RESULT::CONTINUE;
|
2007-08-30 22:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-22 22:05:25 +00:00
|
|
|
std::shared_ptr<SHAPE_SEGMENT> PCB_VIA::GetEffectiveHoleShape() const
|
|
|
|
{
|
2022-09-20 20:40:45 +00:00
|
|
|
return std::make_shared<SHAPE_SEGMENT>( SEG( m_Start, m_Start ), m_drill );
|
2022-07-22 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
bool PCB_VIA::IsTented() const
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2021-08-22 22:05:47 +00:00
|
|
|
const BOARD* board = GetBoard();
|
2007-10-15 07:50:59 +00:00
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
if( board )
|
|
|
|
return board->GetTentVias();
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
2007-10-15 07:50:59 +00:00
|
|
|
|
2014-06-30 04:40:16 +00:00
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
int PCB_VIA::GetSolderMaskExpansion() const
|
|
|
|
{
|
|
|
|
const BOARD* board = GetBoard();
|
|
|
|
|
|
|
|
if( board )
|
|
|
|
return board->GetDesignSettings().m_SolderMaskExpansion;
|
2007-08-08 20:51:08 +00:00
|
|
|
else
|
2021-08-22 22:05:47 +00:00
|
|
|
return 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
bool PCB_VIA::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2022-02-14 13:34:45 +00:00
|
|
|
#if 0
|
|
|
|
// Nice and simple, but raises its ugly head in performance profiles....
|
2021-08-22 22:05:47 +00:00
|
|
|
return GetLayerSet().test( aLayer );
|
2022-02-14 13:34:45 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if( aLayer >= m_layer && aLayer <= m_bottomLayer )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if( !IsTented() )
|
|
|
|
{
|
2022-07-07 21:27:29 +00:00
|
|
|
if( aLayer == F_Mask )
|
2022-02-14 13:34:45 +00:00
|
|
|
return IsOnLayer( F_Cu );
|
2022-07-07 21:27:29 +00:00
|
|
|
else if( aLayer == B_Mask )
|
2022-02-14 13:34:45 +00:00
|
|
|
return IsOnLayer( B_Cu );
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2021-08-22 22:05:47 +00:00
|
|
|
}
|
2007-10-15 07:50:59 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
LSET PCB_VIA::GetLayerSet() const
|
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
LSET layermask;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
if( GetViaType() == VIATYPE::THROUGH )
|
|
|
|
layermask = LSET::AllCuMask();
|
|
|
|
else
|
|
|
|
wxASSERT( m_layer <= m_bottomLayer );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
// PCB_LAYER_IDs are numbered from front to back, this is top to bottom.
|
2021-07-21 23:14:56 +00:00
|
|
|
for( int id = m_layer; id <= m_bottomLayer; ++id )
|
2014-06-24 16:17:18 +00:00
|
|
|
layermask.set( id );
|
2014-04-25 06:00:04 +00:00
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
if( !IsTented() )
|
|
|
|
{
|
|
|
|
if( layermask.test( F_Cu ) )
|
|
|
|
layermask.set( F_Mask );
|
|
|
|
|
|
|
|
if( layermask.test( B_Cu ) )
|
|
|
|
layermask.set( B_Mask );
|
|
|
|
}
|
|
|
|
|
2014-04-25 06:00:04 +00:00
|
|
|
return layermask;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::SetLayerSet( LSET aLayerSet )
|
2020-08-09 11:22:09 +00:00
|
|
|
{
|
|
|
|
bool first = true;
|
|
|
|
|
|
|
|
for( PCB_LAYER_ID layer : aLayerSet.Seq() )
|
|
|
|
{
|
|
|
|
if( first )
|
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
m_layer = layer;
|
2020-08-09 11:22:09 +00:00
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
|
2020-11-14 14:29:11 +00:00
|
|
|
m_bottomLayer = layer;
|
2020-08-09 11:22:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-16 20:52:49 +00:00
|
|
|
|
2020-11-14 14:29:11 +00:00
|
|
|
m_layer = aTopLayer;
|
|
|
|
m_bottomLayer = aBottomLayer;
|
2018-01-06 22:32:22 +00:00
|
|
|
SanitizeLayers();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::SetTopLayer( PCB_LAYER_ID aLayer )
|
2018-01-06 22:32:22 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
m_layer = aLayer;
|
2018-01-06 22:32:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::SetBottomLayer( PCB_LAYER_ID aLayer )
|
2018-01-06 22:32:22 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
m_bottomLayer = aLayer;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID t_layer = F_Cu;
|
|
|
|
PCB_LAYER_ID b_layer = B_Cu;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2019-12-28 00:55:11 +00:00
|
|
|
if( GetViaType() != VIATYPE::THROUGH )
|
2009-05-21 12:45:21 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
b_layer = m_bottomLayer;
|
|
|
|
t_layer = m_layer;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2014-06-25 17:01:50 +00:00
|
|
|
if( b_layer < t_layer )
|
2015-06-26 13:41:56 +00:00
|
|
|
std::swap( b_layer, t_layer );
|
2009-05-21 12:45:21 +00:00
|
|
|
}
|
2007-10-19 06:31:17 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
if( top_layer )
|
|
|
|
*top_layer = t_layer;
|
2007-10-19 06:31:17 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
if( bottom_layer )
|
|
|
|
*bottom_layer = b_layer;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
PCB_LAYER_ID PCB_VIA::TopLayer() const
|
2018-01-06 22:32:22 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
return m_layer;
|
2018-01-06 22:32:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
PCB_LAYER_ID PCB_VIA::BottomLayer() const
|
2018-01-06 22:32:22 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
return m_bottomLayer;
|
2018-01-06 22:32:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::SanitizeLayers()
|
2018-01-06 22:32:22 +00:00
|
|
|
{
|
2019-12-28 00:55:11 +00:00
|
|
|
if( GetViaType() == VIATYPE::THROUGH )
|
2018-01-06 22:32:22 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
m_layer = F_Cu;
|
|
|
|
m_bottomLayer = B_Cu;
|
2018-01-06 22:32:22 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 14:29:11 +00:00
|
|
|
if( m_bottomLayer < m_layer )
|
|
|
|
std::swap( m_bottomLayer, m_layer );
|
2018-01-06 22:32:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
bool PCB_VIA::FlashLayer( LSET aLayers ) const
|
2020-07-27 19:41:50 +00:00
|
|
|
{
|
|
|
|
for( auto layer : aLayers.Seq() )
|
|
|
|
{
|
2020-09-29 20:40:17 +00:00
|
|
|
if( FlashLayer( layer ) )
|
2020-07-27 19:41:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
bool PCB_VIA::FlashLayer( int aLayer ) const
|
2020-07-27 19:41:50 +00:00
|
|
|
{
|
2020-10-27 17:09:27 +00:00
|
|
|
// Return the "normal" shape if the caller doesn't specify a particular layer
|
|
|
|
if( aLayer == UNDEFINED_LAYER )
|
|
|
|
return true;
|
|
|
|
|
2021-08-16 09:53:27 +00:00
|
|
|
const BOARD* board = GetBoard();
|
2020-07-27 19:41:50 +00:00
|
|
|
|
|
|
|
if( !board )
|
2022-04-12 18:37:18 +00:00
|
|
|
return true;
|
2020-07-27 19:41:50 +00:00
|
|
|
|
|
|
|
if( !IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) ) )
|
|
|
|
return false;
|
|
|
|
|
2020-11-14 14:29:11 +00:00
|
|
|
if( !m_removeUnconnectedLayer )
|
2020-07-27 19:41:50 +00:00
|
|
|
return true;
|
|
|
|
|
2020-11-14 14:29:11 +00:00
|
|
|
if( m_keepTopBottomLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
|
2020-07-27 19:41:50 +00:00
|
|
|
return true;
|
|
|
|
|
2022-02-14 13:34:45 +00:00
|
|
|
// Must be static to keep from raising its ugly head in performance profiles
|
2022-08-21 19:54:07 +00:00
|
|
|
static std::initializer_list<KICAD_T> connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
|
|
|
PCB_PAD_T };
|
2022-05-23 09:25:29 +00:00
|
|
|
|
|
|
|
// Do not check zones. Doing so results in race conditions when the via collides with
|
|
|
|
// two different zones of different priorities.
|
|
|
|
// See https://gitlab.com/kicad/code/kicad/-/issues/11299.
|
2022-02-14 13:34:45 +00:00
|
|
|
|
2022-02-20 23:49:02 +00:00
|
|
|
return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, connectedTypes, true );
|
2020-07-27 19:41:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
|
2013-07-08 07:57:23 +00:00
|
|
|
{
|
|
|
|
// Show the track and its netname on different layers
|
|
|
|
aLayers[0] = GetLayer();
|
2013-07-08 14:46:04 +00:00
|
|
|
aLayers[1] = GetNetnameLayer( aLayers[0] );
|
2013-07-08 07:57:23 +00:00
|
|
|
aCount = 2;
|
2022-03-07 17:03:06 +00:00
|
|
|
|
|
|
|
if( IsLocked() )
|
|
|
|
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
2013-07-08 07:57:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
double PCB_TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
2013-07-08 07:57:23 +00:00
|
|
|
{
|
2020-09-21 15:03:08 +00:00
|
|
|
constexpr double HIDE = std::numeric_limits<double>::max();
|
2018-02-19 14:48:22 +00:00
|
|
|
|
2021-01-30 14:41:31 +00:00
|
|
|
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
|
|
|
|
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
|
|
|
|
2018-02-19 14:48:22 +00:00
|
|
|
if( !aView->IsLayerVisible( LAYER_TRACKS ) )
|
|
|
|
return HIDE;
|
|
|
|
|
2014-02-03 13:14:53 +00:00
|
|
|
if( IsNetnameLayer( aLayer ) )
|
2013-07-08 07:57:23 +00:00
|
|
|
{
|
2021-10-24 10:14:54 +00:00
|
|
|
if( GetNetCode() <= NETINFO_LIST::UNCONNECTED )
|
|
|
|
return HIDE;
|
|
|
|
|
2021-01-30 14:41:31 +00:00
|
|
|
// Hide netnames on dimmed tracks
|
|
|
|
if( renderSettings->GetHighContrast() )
|
|
|
|
{
|
|
|
|
if( m_layer != renderSettings->GetPrimaryHighContrastLayer() )
|
|
|
|
return HIDE;
|
|
|
|
}
|
|
|
|
|
2021-10-24 10:14:54 +00:00
|
|
|
// When drawing netnames, clip the track to the viewport
|
|
|
|
VECTOR2I start( GetStart() );
|
|
|
|
VECTOR2I end( GetEnd() );
|
2022-08-31 16:17:14 +00:00
|
|
|
BOX2D viewport = aView->GetViewport();
|
|
|
|
BOX2I clipBox( viewport.GetOrigin(), viewport.GetSize() );
|
2021-10-24 10:14:54 +00:00
|
|
|
|
|
|
|
ClipLine( &clipBox, start.x, start.y, end.x, end.y );
|
|
|
|
|
|
|
|
VECTOR2I line = ( end - start );
|
|
|
|
double length = line.EuclideanNorm();
|
|
|
|
|
|
|
|
// Check if the track is long enough to have a netname displayed
|
|
|
|
if( length < 6 * GetWidth() )
|
|
|
|
return HIDE;
|
|
|
|
|
2021-01-30 14:41:31 +00:00
|
|
|
// Netnames will be shown only if zoom is appropriate
|
2022-09-16 11:33:56 +00:00
|
|
|
return ( double ) pcbIUScale.mmToIU( 4 ) / ( m_Width + 1 );
|
2013-07-08 07:57:23 +00:00
|
|
|
}
|
|
|
|
|
2022-03-07 17:03:06 +00:00
|
|
|
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
|
|
|
{
|
|
|
|
// Hide shadow if the main layer is not shown
|
|
|
|
if( !aView->IsLayerVisible( m_layer ) )
|
|
|
|
return HIDE;
|
|
|
|
|
|
|
|
// Hide shadow on dimmed tracks
|
|
|
|
if( renderSettings->GetHighContrast() )
|
|
|
|
{
|
|
|
|
if( m_layer != renderSettings->GetPrimaryHighContrastLayer() )
|
|
|
|
return HIDE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-08 07:57:23 +00:00
|
|
|
// Other layers are shown without any conditions
|
2020-09-21 15:03:08 +00:00
|
|
|
return 0.0;
|
2013-07-08 07:57:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
const BOX2I PCB_TRACK::ViewBBox() const
|
2018-06-12 08:36:41 +00:00
|
|
|
{
|
2021-08-16 09:53:27 +00:00
|
|
|
BOX2I bbox = GetBoundingBox();
|
|
|
|
const BOARD* board = GetBoard();
|
2021-01-08 00:26:32 +00:00
|
|
|
|
|
|
|
if( board )
|
|
|
|
bbox.Inflate( 2 * board->GetDesignSettings().GetBiggestClearanceValue() );
|
2021-10-26 12:18:08 +00:00
|
|
|
else
|
|
|
|
bbox.Inflate( GetWidth() ); // Add a bit extra for safety
|
2021-01-08 00:26:32 +00:00
|
|
|
|
2018-06-12 08:36:41 +00:00
|
|
|
return bbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::ViewGetLayers( int aLayers[], int& aCount ) const
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2021-01-30 14:41:31 +00:00
|
|
|
aLayers[0] = LAYER_VIA_HOLES;
|
|
|
|
aLayers[1] = LAYER_VIA_HOLEWALLS;
|
|
|
|
aLayers[2] = LAYER_VIA_NETNAMES;
|
2014-08-06 11:53:02 +00:00
|
|
|
|
|
|
|
// Just show it on common via & via holes layers
|
|
|
|
switch( GetViaType() )
|
|
|
|
{
|
2021-01-30 14:41:31 +00:00
|
|
|
case VIATYPE::THROUGH: aLayers[3] = LAYER_VIA_THROUGH; break;
|
|
|
|
case VIATYPE::BLIND_BURIED: aLayers[3] = LAYER_VIA_BBLIND; break;
|
|
|
|
case VIATYPE::MICROVIA: aLayers[3] = LAYER_VIA_MICROVIA; break;
|
|
|
|
default: aLayers[3] = LAYER_GP_OVERLAY; break;
|
2014-08-06 11:53:02 +00:00
|
|
|
}
|
2021-01-30 14:41:31 +00:00
|
|
|
|
|
|
|
aCount = 4;
|
2022-03-07 17:03:06 +00:00
|
|
|
|
|
|
|
if( IsLocked() )
|
|
|
|
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
double PCB_VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
2017-04-20 16:19:41 +00:00
|
|
|
{
|
2020-09-21 15:03:08 +00:00
|
|
|
constexpr double HIDE = (double)std::numeric_limits<double>::max();
|
2018-11-02 23:47:57 +00:00
|
|
|
|
2021-01-30 14:41:31 +00:00
|
|
|
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
|
|
|
|
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
2021-08-16 09:53:27 +00:00
|
|
|
const BOARD* board = GetBoard();
|
2021-02-01 16:03:05 +00:00
|
|
|
LSET visible = LSET::AllLayersMask();
|
2021-01-30 14:41:31 +00:00
|
|
|
|
2021-02-01 16:03:05 +00:00
|
|
|
// Meta control for hiding all vias
|
|
|
|
if( !aView->IsLayerVisible( LAYER_VIAS ) )
|
|
|
|
return HIDE;
|
|
|
|
|
2021-06-25 09:35:17 +00:00
|
|
|
// Handle board visibility
|
|
|
|
if( board )
|
2021-02-01 16:03:05 +00:00
|
|
|
visible = board->GetVisibleLayers() & board->GetEnabledLayers();
|
|
|
|
|
2022-03-01 15:59:34 +00:00
|
|
|
// In high contrast mode don't show vias that don't cross the high-contrast layer
|
|
|
|
if( renderSettings->GetHighContrast() )
|
|
|
|
{
|
|
|
|
PCB_LAYER_ID highContrastLayer = renderSettings->GetPrimaryHighContrastLayer();
|
|
|
|
|
|
|
|
if( LSET::FrontTechMask().Contains( highContrastLayer ) )
|
|
|
|
highContrastLayer = F_Cu;
|
|
|
|
else if( LSET::BackTechMask().Contains( highContrastLayer ) )
|
|
|
|
highContrastLayer = B_Cu;
|
|
|
|
|
|
|
|
if( !GetLayerSet().Contains( highContrastLayer ) )
|
|
|
|
return HIDE;
|
|
|
|
}
|
|
|
|
|
2021-02-01 16:03:05 +00:00
|
|
|
if( IsViaPadLayer( aLayer ) )
|
|
|
|
{
|
|
|
|
if( !FlashLayer( visible ) )
|
|
|
|
return HIDE;
|
|
|
|
}
|
|
|
|
else if( IsHoleLayer( aLayer ) )
|
|
|
|
{
|
2021-04-09 16:02:47 +00:00
|
|
|
if( m_viaType == VIATYPE::BLIND_BURIED || m_viaType == VIATYPE::MICROVIA )
|
|
|
|
{
|
|
|
|
// Show a blind or micro via's hole if it crosses a visible layer
|
|
|
|
if( !( visible & GetLayerSet() ).any() )
|
|
|
|
return HIDE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Show a through via's hole if any physical layer is shown
|
|
|
|
if( !( visible & LSET::PhysicalLayersMask() ).any() )
|
|
|
|
return HIDE;
|
|
|
|
}
|
2021-02-01 16:03:05 +00:00
|
|
|
}
|
|
|
|
else if( IsNetnameLayer( aLayer ) )
|
2021-01-30 14:41:31 +00:00
|
|
|
{
|
|
|
|
if( renderSettings->GetHighContrast() )
|
|
|
|
{
|
2021-02-01 16:03:05 +00:00
|
|
|
// Hide netnames unless via is flashed to a high-contrast layer
|
2021-01-30 14:41:31 +00:00
|
|
|
if( !FlashLayer( renderSettings->GetPrimaryHighContrastLayer() ) )
|
|
|
|
return HIDE;
|
|
|
|
}
|
2021-02-01 16:03:05 +00:00
|
|
|
else
|
2020-08-10 21:52:22 +00:00
|
|
|
{
|
2021-02-01 16:03:05 +00:00
|
|
|
// Hide netnames unless pad is flashed to a visible layer
|
|
|
|
if( !FlashLayer( visible ) )
|
|
|
|
return HIDE;
|
2020-08-10 21:52:22 +00:00
|
|
|
}
|
2017-04-20 16:19:41 +00:00
|
|
|
|
2021-02-01 16:03:05 +00:00
|
|
|
// Netnames will be shown only if zoom is appropriate
|
2022-09-16 11:33:56 +00:00
|
|
|
return m_Width == 0 ? HIDE : ( (double)pcbIUScale.mmToIU( 10 ) / m_Width );
|
2019-11-05 14:20:50 +00:00
|
|
|
}
|
2017-04-20 16:19:41 +00:00
|
|
|
|
2021-02-01 16:03:05 +00:00
|
|
|
// Passed all tests; show.
|
|
|
|
return 0.0;
|
2017-04-20 16:19:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
// see class_track.h
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
2009-10-14 18:14:58 +00:00
|
|
|
{
|
2020-05-21 17:42:42 +00:00
|
|
|
wxString msg;
|
|
|
|
BOARD* board = GetBoard();
|
2009-10-16 17:18:23 +00:00
|
|
|
|
2021-04-19 08:00:46 +00:00
|
|
|
aList.emplace_back( _( "Type" ),
|
2022-02-04 22:44:59 +00:00
|
|
|
Type() == PCB_ARC_T ? _( "Track (arc)" ) : _( "Track" ) );
|
2021-04-19 08:00:46 +00:00
|
|
|
|
2020-05-21 17:42:42 +00:00
|
|
|
|
|
|
|
GetMsgPanelInfoBase_Common( aFrame, aList );
|
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( m_Width ) );
|
2009-10-14 18:14:58 +00:00
|
|
|
|
2021-04-19 08:00:46 +00:00
|
|
|
if( Type() == PCB_ARC_T )
|
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
double radius = static_cast<PCB_ARC*>( this )->GetRadius();
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Radius" ), aFrame->MessageTextFromValue( radius ) );
|
2021-04-19 08:00:46 +00:00
|
|
|
}
|
|
|
|
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Segment Length" ), aFrame->MessageTextFromValue( GetLength() ) );
|
2021-05-11 01:06:17 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// Display full track length (in Pcbnew)
|
2021-05-11 01:06:17 +00:00
|
|
|
if( board && GetNetCode() > 0 )
|
2009-10-14 18:14:58 +00:00
|
|
|
{
|
2019-05-31 02:30:28 +00:00
|
|
|
int count;
|
|
|
|
double trackLen;
|
|
|
|
double lenPadToDie;
|
2018-06-12 14:50:18 +00:00
|
|
|
|
2019-05-31 02:30:28 +00:00
|
|
|
std::tie( count, trackLen, lenPadToDie ) = board->GetTrackLength( *this );
|
2018-06-12 14:50:18 +00:00
|
|
|
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Routed Length" ), aFrame->MessageTextFromValue( trackLen ) );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-12-12 11:57:17 +00:00
|
|
|
if( lenPadToDie != 0 )
|
2011-08-20 14:46:48 +00:00
|
|
|
{
|
2022-09-19 09:25:20 +00:00
|
|
|
msg = aFrame->MessageTextFromValue( lenPadToDie );
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( _( "Pad To Die Length" ), msg );
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2022-09-19 09:25:20 +00:00
|
|
|
msg = aFrame->MessageTextFromValue( trackLen + lenPadToDie );
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( _( "Full Length" ), msg );
|
2011-08-20 14:46:48 +00:00
|
|
|
}
|
2009-10-14 18:14:58 +00:00
|
|
|
}
|
2011-03-11 15:53:28 +00:00
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
wxString source;
|
2020-10-12 17:40:03 +00:00
|
|
|
int clearance = GetOwnClearance( GetLayer(), &source );
|
2018-04-10 10:52:12 +00:00
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
|
2022-09-19 09:25:20 +00:00
|
|
|
aFrame->MessageTextFromValue( clearance ) ),
|
2020-11-30 14:35:48 +00:00
|
|
|
wxString::Format( _( "(from %s)" ), source ) );
|
2022-07-31 21:14:24 +00:00
|
|
|
|
|
|
|
MINOPTMAX<int> c = GetWidthConstraint( &source );
|
|
|
|
|
|
|
|
if( c.HasMax() )
|
|
|
|
{
|
|
|
|
aList.emplace_back( wxString::Format( _( "Width Constraints: min %s, max %s" ),
|
2022-09-19 09:25:20 +00:00
|
|
|
aFrame->MessageTextFromValue( c.Min() ),
|
|
|
|
aFrame->MessageTextFromValue( c.Max() ) ),
|
2022-07-31 21:14:24 +00:00
|
|
|
wxString::Format( _( "(from %s)" ), source ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aList.emplace_back( wxString::Format( _( "Width Constraints: min %s" ),
|
2022-09-19 09:25:20 +00:00
|
|
|
aFrame->MessageTextFromValue( c.Min() ) ),
|
2022-07-31 21:14:24 +00:00
|
|
|
wxString::Format( _( "(from %s)" ), source ) );
|
|
|
|
}
|
2009-10-14 18:14:58 +00:00
|
|
|
}
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
2014-04-25 06:00:04 +00:00
|
|
|
{
|
2020-05-21 17:42:42 +00:00
|
|
|
wxString msg;
|
2014-04-25 06:00:04 +00:00
|
|
|
|
|
|
|
switch( GetViaType() )
|
2009-10-10 17:27:53 +00:00
|
|
|
{
|
2020-09-19 16:12:00 +00:00
|
|
|
case VIATYPE::MICROVIA: msg = _( "Micro Via" ); break;
|
|
|
|
case VIATYPE::BLIND_BURIED: msg = _( "Blind/Buried Via" ); break;
|
|
|
|
case VIATYPE::THROUGH: msg = _( "Through Via" ); break;
|
|
|
|
default: msg = _( "Via" ); break;
|
2009-10-10 17:27:53 +00:00
|
|
|
}
|
2014-04-25 06:00:04 +00:00
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( _( "Type" ), msg );
|
2014-04-25 06:00:04 +00:00
|
|
|
|
2020-04-24 13:36:10 +00:00
|
|
|
GetMsgPanelInfoBase_Common( aFrame, aList );
|
2014-04-25 06:00:04 +00:00
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Diameter" ), aFrame->MessageTextFromValue( m_Width ) );
|
|
|
|
aList.emplace_back( _( "Hole" ), aFrame->MessageTextFromValue( GetDrillValue() ) );
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
wxString source;
|
2020-10-12 17:40:03 +00:00
|
|
|
int clearance = GetOwnClearance( GetLayer(), &source );
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
|
2022-09-19 09:25:20 +00:00
|
|
|
aFrame->MessageTextFromValue( clearance ) ),
|
2020-11-30 14:35:48 +00:00
|
|
|
wxString::Format( _( "(from %s)" ), source ) );
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2020-08-07 20:18:33 +00:00
|
|
|
int minAnnulus = GetMinAnnulus( GetLayer(), &source );
|
2014-04-25 06:00:04 +00:00
|
|
|
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( wxString::Format( _( "Min Annular Width: %s" ),
|
2022-09-19 09:25:20 +00:00
|
|
|
aFrame->MessageTextFromValue( minAnnulus ) ),
|
2020-11-30 14:35:48 +00:00
|
|
|
wxString::Format( _( "(from %s)" ), source ) );
|
2020-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame,
|
|
|
|
std::vector<MSG_PANEL_ITEM>& aList ) const
|
2020-05-21 17:42:42 +00:00
|
|
|
{
|
2020-11-30 14:35:48 +00:00
|
|
|
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
|
2015-06-18 13:19:30 +00:00
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
aList.emplace_back( _( "Resolved Netclass" ),
|
|
|
|
UnescapeString( GetEffectiveNetClass()->GetName() ) );
|
2015-06-18 13:19:30 +00:00
|
|
|
|
2021-09-28 13:28:35 +00:00
|
|
|
#if 0 // Enable for debugging
|
2020-05-21 17:42:42 +00:00
|
|
|
if( GetBoard() )
|
2021-09-28 13:28:35 +00:00
|
|
|
aList.emplace_back( _( "NetCode" ), wxString::Format( wxT( "%d" ), GetNetCode() ) );
|
2015-06-18 13:19:30 +00:00
|
|
|
|
2021-09-28 13:28:35 +00:00
|
|
|
aList.emplace_back( wxT( "Flags" ), wxString::Format( wxT( "0x%08X" ), m_flags ) );
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2021-09-28 13:28:35 +00:00
|
|
|
aList.emplace_back( wxT( "Start pos" ), wxString::Format( wxT( "%d %d" ),
|
|
|
|
m_Start.x,
|
|
|
|
m_Start.y ) );
|
|
|
|
aList.emplace_back( wxT( "End pos" ), wxString::Format( wxT( "%d %d" ),
|
|
|
|
m_End.x,
|
|
|
|
m_End.y ) );
|
2020-05-21 17:42:42 +00:00
|
|
|
#endif
|
|
|
|
|
2021-10-31 16:32:24 +00:00
|
|
|
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
|
|
|
|
aList.emplace_back( _( "Status" ), _( "Locked" ) );
|
2007-08-20 19:33:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
wxString PCB_VIA::layerMaskDescribe() const
|
2020-09-19 16:12:00 +00:00
|
|
|
{
|
2021-08-16 09:53:27 +00:00
|
|
|
const BOARD* board = GetBoard();
|
2020-09-19 16:12:00 +00:00
|
|
|
PCB_LAYER_ID top_layer;
|
|
|
|
PCB_LAYER_ID bottom_layer;
|
|
|
|
|
|
|
|
LayerPair( &top_layer, &bottom_layer );
|
|
|
|
|
|
|
|
return board->GetLayerName( top_layer ) + wxT( " - " ) + board->GetLayerName( bottom_layer );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool PCB_TRACK::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
2007-08-08 20:51:08 +00:00
|
|
|
{
|
2019-05-05 10:33:34 +00:00
|
|
|
return TestSegmentHit( aPosition, m_Start, m_End, aAccuracy + ( m_Width / 2 ) );
|
2014-05-01 06:50:11 +00:00
|
|
|
}
|
2008-03-05 22:39:33 +00:00
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool PCB_ARC::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
2019-03-27 12:38:29 +00:00
|
|
|
{
|
|
|
|
int max_dist = aAccuracy + ( m_Width / 2 );
|
2020-11-19 22:32:54 +00:00
|
|
|
|
|
|
|
// Short-circuit common cases where the arc is connected to a track or via at an endpoint
|
|
|
|
if( EuclideanNorm( GetStart() - aPosition ) <= max_dist ||
|
|
|
|
EuclideanNorm( GetEnd() - aPosition ) <= max_dist )
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I center = GetPosition();
|
|
|
|
VECTOR2I relpos = aPosition - center;
|
2019-05-17 00:13:21 +00:00
|
|
|
double dist = EuclideanNorm( relpos );
|
|
|
|
double radius = GetRadius();
|
2019-03-27 12:38:29 +00:00
|
|
|
|
2019-05-17 00:13:21 +00:00
|
|
|
if( std::abs( dist - radius ) > max_dist )
|
|
|
|
return false;
|
2019-03-27 12:38:29 +00:00
|
|
|
|
2022-01-14 15:34:41 +00:00
|
|
|
EDA_ANGLE arc_angle = GetAngle();
|
|
|
|
EDA_ANGLE arc_angle_start = GetArcAngleStart(); // Always 0.0 ... 360 deg
|
|
|
|
EDA_ANGLE arc_hittest( relpos );
|
2019-05-17 00:13:21 +00:00
|
|
|
|
|
|
|
// Calculate relative angle between the starting point of the arc, and the test point
|
|
|
|
arc_hittest -= arc_angle_start;
|
2019-03-27 12:38:29 +00:00
|
|
|
|
2019-05-17 00:13:21 +00:00
|
|
|
// Normalise arc_hittest between 0 ... 360 deg
|
2022-01-14 15:34:41 +00:00
|
|
|
arc_hittest.Normalize();
|
2019-05-17 00:13:21 +00:00
|
|
|
|
2022-01-14 15:34:41 +00:00
|
|
|
if( arc_angle < ANGLE_0 )
|
|
|
|
return arc_hittest >= ANGLE_360 + arc_angle;
|
2019-05-17 00:13:21 +00:00
|
|
|
|
2022-01-14 15:34:41 +00:00
|
|
|
return arc_hittest <= arc_angle;
|
2019-03-27 12:38:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool PCB_VIA::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
2014-05-01 06:50:11 +00:00
|
|
|
{
|
2019-05-05 10:33:34 +00:00
|
|
|
int max_dist = aAccuracy + ( m_Width / 2 );
|
2008-03-05 22:39:33 +00:00
|
|
|
|
2014-05-01 06:50:11 +00:00
|
|
|
// rel_pos is aPosition relative to m_Start (or the center of the via)
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I rel_pos = aPosition - m_Start;
|
2014-05-01 06:50:11 +00:00
|
|
|
double dist = (double) rel_pos.x * rel_pos.x + (double) rel_pos.y * rel_pos.y;
|
|
|
|
return dist <= (double) max_dist * max_dist;
|
2007-10-19 06:31:17 +00:00
|
|
|
}
|
2007-08-09 01:41:30 +00:00
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
bool PCB_TRACK::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
2022-08-31 09:33:46 +00:00
|
|
|
BOX2I arect = aRect;
|
2013-09-21 18:09:41 +00:00
|
|
|
arect.Inflate( aAccuracy );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2014-05-01 06:50:11 +00:00
|
|
|
if( aContained )
|
2020-08-25 19:10:25 +00:00
|
|
|
return arect.Contains( GetStart() ) && arect.Contains( GetEnd() );
|
2013-09-21 18:09:41 +00:00
|
|
|
else
|
2014-05-01 06:50:11 +00:00
|
|
|
return arect.Intersects( GetStart(), GetEnd() );
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
bool PCB_ARC::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
2019-03-27 12:38:29 +00:00
|
|
|
{
|
2022-08-31 09:33:46 +00:00
|
|
|
BOX2I arect = aRect;
|
2019-03-27 12:38:29 +00:00
|
|
|
arect.Inflate( aAccuracy );
|
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
BOX2I box( GetStart() );
|
2019-03-27 12:38:29 +00:00
|
|
|
box.Merge( GetMid() );
|
|
|
|
box.Merge( GetEnd() );
|
|
|
|
|
|
|
|
box.Inflate( GetWidth() / 2 );
|
|
|
|
|
|
|
|
if( aContained )
|
|
|
|
return arect.Contains( box );
|
|
|
|
else
|
|
|
|
return arect.Intersects( box );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
bool PCB_VIA::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
2011-09-14 20:04:58 +00:00
|
|
|
{
|
2022-08-31 16:17:14 +00:00
|
|
|
BOX2I arect = aRect;
|
2013-09-21 18:09:41 +00:00
|
|
|
arect.Inflate( aAccuracy );
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
BOX2I box( GetStart() );
|
2014-05-01 06:50:11 +00:00
|
|
|
box.Inflate( GetWidth() / 2 );
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2014-05-01 06:50:11 +00:00
|
|
|
if( aContained )
|
|
|
|
return arect.Contains( box );
|
2013-09-21 18:09:41 +00:00
|
|
|
else
|
2017-07-03 10:36:22 +00:00
|
|
|
return arect.IntersectsCircle( GetStart(), GetWidth() / 2 );
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2022-09-19 16:09:59 +00:00
|
|
|
wxString PCB_TRACK::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
2011-07-14 15:42:44 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
return wxString::Format( Type() == PCB_ARC_T ? _("Track (arc) %s on %s, length %s" )
|
|
|
|
: _("Track %s on %s, length %s" ),
|
2018-04-10 10:52:12 +00:00
|
|
|
GetNetnameMsg(),
|
|
|
|
GetLayerName(),
|
2022-09-19 16:09:59 +00:00
|
|
|
aUnitsProvider->MessageTextFromValue( GetLength() ) );
|
2011-07-14 15:42:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
BITMAPS PCB_TRACK::GetMenuImage() const
|
2017-02-20 12:20:39 +00:00
|
|
|
{
|
2021-03-08 02:59:07 +00:00
|
|
|
return BITMAPS::add_tracks;
|
2017-02-20 12:20:39 +00:00
|
|
|
}
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_TRACK::SwapData( BOARD_ITEM* aImage )
|
2017-10-31 13:59:03 +00:00
|
|
|
{
|
|
|
|
assert( aImage->Type() == PCB_TRACE_T );
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
std::swap( *((PCB_TRACK*) this), *((PCB_TRACK*) aImage) );
|
2017-10-31 13:59:03 +00:00
|
|
|
}
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_ARC::SwapData( BOARD_ITEM* aImage )
|
2019-03-27 12:38:29 +00:00
|
|
|
{
|
|
|
|
assert( aImage->Type() == PCB_ARC_T );
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
std::swap( *this, *static_cast<PCB_ARC*>( aImage ) );
|
2019-03-27 12:38:29 +00:00
|
|
|
}
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void PCB_VIA::SwapData( BOARD_ITEM* aImage )
|
2017-10-31 13:59:03 +00:00
|
|
|
{
|
|
|
|
assert( aImage->Type() == PCB_VIA_T );
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
std::swap( *((PCB_VIA*) this), *((PCB_VIA*) aImage) );
|
2017-10-31 13:59:03 +00:00
|
|
|
}
|
2017-02-20 12:20:39 +00:00
|
|
|
|
2019-05-17 00:13:21 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I PCB_ARC::GetPosition() const
|
2019-05-17 00:13:21 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I center = CalcArcCenter( m_Start, m_Mid, m_End );
|
|
|
|
return center;
|
2019-05-17 00:13:21 +00:00
|
|
|
}
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
double PCB_ARC::GetRadius() const
|
2019-05-17 00:13:21 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
auto center = CalcArcCenter( m_Start, m_Mid , m_End );
|
|
|
|
return GetLineLength( center, m_Start );
|
2019-05-17 00:13:21 +00:00
|
|
|
}
|
|
|
|
|
2022-01-14 15:34:41 +00:00
|
|
|
EDA_ANGLE PCB_ARC::GetAngle() const
|
2019-05-17 00:13:21 +00:00
|
|
|
{
|
2022-01-14 15:34:41 +00:00
|
|
|
VECTOR2I center = GetPosition();
|
|
|
|
EDA_ANGLE angle1 = EDA_ANGLE( m_Mid - center ) - EDA_ANGLE( m_Start - center );
|
|
|
|
EDA_ANGLE angle2 = EDA_ANGLE( m_End - center ) - EDA_ANGLE( m_Mid - center );
|
2019-05-17 00:13:21 +00:00
|
|
|
|
2022-01-14 15:34:41 +00:00
|
|
|
return angle1.Normalize180() + angle2.Normalize180();
|
2019-05-17 00:13:21 +00:00
|
|
|
}
|
|
|
|
|
2022-01-14 15:34:41 +00:00
|
|
|
EDA_ANGLE PCB_ARC::GetArcAngleStart() const
|
2019-05-17 00:13:21 +00:00
|
|
|
{
|
2022-01-14 15:34:41 +00:00
|
|
|
EDA_ANGLE angleStart( m_Start - GetPosition() );
|
|
|
|
return angleStart.Normalize();
|
2019-05-17 00:13:21 +00:00
|
|
|
}
|
|
|
|
|
2022-01-14 15:34:41 +00:00
|
|
|
EDA_ANGLE PCB_ARC::GetArcAngleEnd() const
|
2019-05-17 00:13:21 +00:00
|
|
|
{
|
2022-01-14 15:34:41 +00:00
|
|
|
EDA_ANGLE angleEnd( m_End - GetPosition() );
|
|
|
|
return angleEnd.Normalize();
|
2019-05-17 00:13:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
bool PCB_TRACK::cmp_tracks::operator() ( const PCB_TRACK* a, const PCB_TRACK* b ) const
|
2020-07-24 22:08:36 +00:00
|
|
|
{
|
|
|
|
if( a->GetNetCode() != b->GetNetCode() )
|
|
|
|
return a->GetNetCode() < b->GetNetCode();
|
|
|
|
|
|
|
|
if( a->GetLayer() != b->GetLayer() )
|
|
|
|
return a->GetLayer() < b->GetLayer();
|
|
|
|
|
|
|
|
if( a->Type() != b->Type() )
|
|
|
|
return a->Type() < b->Type();
|
|
|
|
|
2020-10-11 17:02:38 +00:00
|
|
|
if( a->m_Uuid != b->m_Uuid )
|
|
|
|
return a->m_Uuid < b->m_Uuid;
|
|
|
|
|
|
|
|
return a < b;
|
2020-07-24 22:08:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-16 23:48:24 +00:00
|
|
|
std::shared_ptr<SHAPE> PCB_TRACK::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
2020-08-08 22:37:41 +00:00
|
|
|
{
|
2020-10-20 10:33:20 +00:00
|
|
|
return std::make_shared<SHAPE_SEGMENT>( m_Start, m_End, m_Width );
|
2020-08-08 22:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-16 23:48:24 +00:00
|
|
|
std::shared_ptr<SHAPE> PCB_VIA::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
2020-08-08 22:37:41 +00:00
|
|
|
{
|
2022-03-16 23:48:24 +00:00
|
|
|
if( aFlash == FLASHING::ALWAYS_FLASHED
|
|
|
|
|| ( aFlash == FLASHING::DEFAULT && FlashLayer( aLayer ) ) )
|
2021-08-09 21:25:16 +00:00
|
|
|
{
|
2020-10-27 17:09:27 +00:00
|
|
|
return std::make_shared<SHAPE_CIRCLE>( m_Start, m_Width / 2 );
|
2021-08-09 21:25:16 +00:00
|
|
|
}
|
2020-10-27 17:09:27 +00:00
|
|
|
else
|
2021-08-09 21:25:16 +00:00
|
|
|
{
|
2022-10-04 15:22:54 +00:00
|
|
|
return std::make_shared<SHAPE_CIRCLE>( m_Start, GetDrillValue() / 2 );
|
2021-08-09 21:25:16 +00:00
|
|
|
}
|
2020-08-08 22:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-16 23:48:24 +00:00
|
|
|
std::shared_ptr<SHAPE> PCB_ARC::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
2020-08-08 22:37:41 +00:00
|
|
|
{
|
2020-10-20 10:33:20 +00:00
|
|
|
return std::make_shared<SHAPE_ARC>( GetStart(), GetMid(), GetEnd(), GetWidth() );
|
2020-08-08 22:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-25 19:50:33 +00:00
|
|
|
void PCB_TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
|
|
|
PCB_LAYER_ID aLayer, int aClearanceValue,
|
|
|
|
int aError, ERROR_LOC aErrorLoc,
|
|
|
|
bool ignoreLineWidth ) const
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
wxASSERT_MSG( !ignoreLineWidth, wxT( "IgnoreLineWidth has no meaning for tracks." ) );
|
2021-10-25 19:50:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
switch( Type() )
|
|
|
|
{
|
|
|
|
case PCB_VIA_T:
|
|
|
|
{
|
|
|
|
int radius = ( m_Width / 2 ) + aClearanceValue;
|
|
|
|
TransformCircleToPolygon( aCornerBuffer, m_Start, radius, aError, aErrorLoc );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PCB_ARC_T:
|
|
|
|
{
|
|
|
|
const PCB_ARC* arc = static_cast<const PCB_ARC*>( this );
|
|
|
|
int width = m_Width + ( 2 * aClearanceValue );
|
|
|
|
|
|
|
|
TransformArcToPolygon( aCornerBuffer, arc->GetStart(), arc->GetMid(),
|
|
|
|
arc->GetEnd(), width, aError, aErrorLoc );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
int width = m_Width + ( 2 * aClearanceValue );
|
|
|
|
|
|
|
|
TransformOvalToPolygon( aCornerBuffer, m_Start, m_End, width, aError, aErrorLoc );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-08 22:37:41 +00:00
|
|
|
|
2020-02-02 18:40:14 +00:00
|
|
|
static struct TRACK_VIA_DESC
|
|
|
|
{
|
|
|
|
TRACK_VIA_DESC()
|
|
|
|
{
|
|
|
|
ENUM_MAP<VIATYPE>::Instance()
|
2020-07-23 10:35:05 +00:00
|
|
|
.Undefined( VIATYPE::NOT_DEFINED )
|
2020-10-16 15:51:24 +00:00
|
|
|
.Map( VIATYPE::THROUGH, _HKI( "Through" ) )
|
|
|
|
.Map( VIATYPE::BLIND_BURIED, _HKI( "Blind/buried" ) )
|
|
|
|
.Map( VIATYPE::MICROVIA, _HKI( "Micro" ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
|
2020-08-18 21:42:56 +00:00
|
|
|
ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
|
|
|
|
|
|
|
|
if( layerEnum.Choices().GetCount() == 0 )
|
|
|
|
{
|
|
|
|
layerEnum.Undefined( UNDEFINED_LAYER );
|
|
|
|
|
|
|
|
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
|
|
|
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
|
|
|
}
|
|
|
|
|
2020-02-02 18:40:14 +00:00
|
|
|
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
|
|
|
|
|
|
|
// Track
|
2021-06-11 21:07:02 +00:00
|
|
|
REGISTER_TYPE( PCB_TRACK );
|
|
|
|
propMgr.InheritsAfter( TYPE_HASH( PCB_TRACK ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TRACK, int>( _HKI( "Width" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetWidth, &PCB_TRACK::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position X" ),
|
2021-06-11 21:07:02 +00:00
|
|
|
new PROPERTY<PCB_TRACK, int, BOARD_ITEM>( _HKI( "Origin X" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetX, &PCB_TRACK::GetX, PROPERTY_DISPLAY::PT_COORD ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position Y" ),
|
2021-06-11 21:07:02 +00:00
|
|
|
new PROPERTY<PCB_TRACK, int, BOARD_ITEM>( _HKI( "Origin Y" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetY, &PCB_TRACK::GetY, PROPERTY_DISPLAY::PT_COORD ) );
|
2021-06-11 21:07:02 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TRACK, int>( _HKI( "End X" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetEndX, &PCB_TRACK::GetEndX, PROPERTY_DISPLAY::PT_COORD ) );
|
2021-06-11 21:07:02 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TRACK, int>( _HKI( "End Y" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetEndY, &PCB_TRACK::GetEndY, PROPERTY_DISPLAY::PT_COORD ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
|
2020-10-23 12:42:48 +00:00
|
|
|
// Arc
|
2021-06-11 21:07:02 +00:00
|
|
|
REGISTER_TYPE( PCB_ARC );
|
|
|
|
propMgr.InheritsAfter( TYPE_HASH( PCB_ARC ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
|
2020-10-23 12:42:48 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TRACK, int>( _HKI( "Width" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_ARC::SetWidth, &PCB_ARC::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
|
2020-10-23 12:42:48 +00:00
|
|
|
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position X" ),
|
2021-06-11 21:07:02 +00:00
|
|
|
new PROPERTY<PCB_ARC, int, BOARD_ITEM>( _HKI( "Origin X" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetX, &PCB_ARC::GetX, PROPERTY_DISPLAY::PT_COORD ) );
|
2020-10-23 12:42:48 +00:00
|
|
|
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Position Y" ),
|
2021-06-11 21:07:02 +00:00
|
|
|
new PROPERTY<PCB_ARC, int, BOARD_ITEM>( _HKI( "Origin Y" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetY, &PCB_ARC::GetY, PROPERTY_DISPLAY::PT_COORD ) );
|
2021-06-11 21:07:02 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TRACK, int>( _HKI( "End X" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetEndX, &PCB_ARC::GetEndX, PROPERTY_DISPLAY::PT_COORD ) );
|
2021-06-11 21:07:02 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TRACK, int>( _HKI( "End Y" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_TRACK::SetEndY, &PCB_ARC::GetEndY, PROPERTY_DISPLAY::PT_COORD ) );
|
2020-10-23 12:42:48 +00:00
|
|
|
|
2020-02-02 18:40:14 +00:00
|
|
|
// Via
|
2021-06-11 21:07:02 +00:00
|
|
|
REGISTER_TYPE( PCB_VIA );
|
|
|
|
propMgr.InheritsAfter( TYPE_HASH( PCB_VIA ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
|
|
|
|
// TODO layerset for vias?
|
|
|
|
// TODO test drill, use getdrillvalue?
|
2021-06-11 21:07:02 +00:00
|
|
|
propMgr.ReplaceProperty( TYPE_HASH( PCB_TRACK ), _HKI( "Width" ),
|
|
|
|
new PROPERTY<PCB_VIA, int, PCB_TRACK>( _HKI( "Diameter" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_VIA::SetWidth, &PCB_VIA::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
|
2022-03-03 21:47:05 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_VIA, int>( _HKI( "Hole" ),
|
2020-04-06 16:23:21 +00:00
|
|
|
&PCB_VIA::SetDrill, &PCB_VIA::GetDrillValue, PROPERTY_DISPLAY::PT_SIZE ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ),
|
2021-06-11 21:07:02 +00:00
|
|
|
new PROPERTY_ENUM<PCB_VIA, PCB_LAYER_ID, BOARD_ITEM>( _HKI( "Layer Top" ),
|
|
|
|
&PCB_VIA::SetLayer, &PCB_VIA::GetLayer ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY_ENUM<PCB_VIA, PCB_LAYER_ID>( _HKI( "Layer Bottom" ),
|
|
|
|
&PCB_VIA::SetBottomLayer, &PCB_VIA::BottomLayer ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY_ENUM<PCB_VIA, VIATYPE>( _HKI( "Via Type" ),
|
|
|
|
&PCB_VIA::SetViaType, &PCB_VIA::GetViaType ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
}
|
|
|
|
} _TRACK_VIA_DESC;
|
|
|
|
|
|
|
|
ENUM_TO_WXANY( VIATYPE );
|