2012-01-14 19:50:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-05-02 08:31:10 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2020-02-20 12:11:04 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-01-14 19:50: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
|
|
|
|
*/
|
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
/**
|
|
|
|
* @file class_pad.h
|
|
|
|
* @brief Pad object description
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#ifndef PAD_H_
|
|
|
|
#define PAD_H_
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2019-05-14 12:39:34 +00:00
|
|
|
#include "zones.h"
|
2018-02-02 20:57:12 +00:00
|
|
|
#include <board_connected_item.h>
|
2019-05-14 12:39:34 +00:00
|
|
|
#include <class_board_item.h>
|
|
|
|
#include <convert_to_biu.h>
|
2018-12-12 14:28:59 +00:00
|
|
|
#include <geometry/shape_poly_set.h>
|
2019-05-14 12:39:34 +00:00
|
|
|
#include <pad_shapes.h>
|
|
|
|
#include <pcbnew.h>
|
2011-09-17 15:31:21 +00:00
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
class DRAWSEGMENT;
|
2020-01-12 18:40:50 +00:00
|
|
|
class PARAM_CFG;
|
2017-01-13 17:51:22 +00:00
|
|
|
|
|
|
|
enum CUST_PAD_SHAPE_IN_ZONE
|
|
|
|
{
|
|
|
|
CUST_PAD_SHAPE_IN_ZONE_OUTLINE,
|
|
|
|
CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL
|
|
|
|
};
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
class LINE_READER;
|
2011-09-17 15:31:21 +00:00
|
|
|
class EDA_3D_CANVAS;
|
2011-09-23 13:57:12 +00:00
|
|
|
class MODULE;
|
2017-10-21 06:48:26 +00:00
|
|
|
class EDGE_MODULE;
|
2011-11-30 11:45:49 +00:00
|
|
|
class TRACK;
|
2013-01-12 17:32:24 +00:00
|
|
|
class MSG_PANEL_INFO;
|
2011-09-17 15:31:21 +00:00
|
|
|
|
2016-12-02 17:58:12 +00:00
|
|
|
namespace KIGFX
|
|
|
|
{
|
|
|
|
class VIEW;
|
2017-11-02 20:41:29 +00:00
|
|
|
}
|
2011-09-17 15:31:21 +00:00
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/** Helper class to handle a primitive (basic shape: polygon, segment, circle or arc)
|
|
|
|
* to build a custom pad full shape from a set of primitives
|
|
|
|
*/
|
|
|
|
class PAD_CS_PRIMITIVE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
STROKE_T m_Shape; /// S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
|
|
|
|
int m_Thickness; /// thickness of segment or outline
|
|
|
|
/// For filled S_CIRCLE shape, thickness = 0.
|
|
|
|
// if thickness is not = 0 S_CIRCLE shape is a ring
|
|
|
|
int m_Radius; /// radius of a circle
|
|
|
|
double m_ArcAngle; /// angle of an arc, from its starting point, in 0.1 deg
|
|
|
|
wxPoint m_Start; /// is also the center of the circle and arc
|
|
|
|
wxPoint m_End; /// is also the start point of the arc
|
2019-04-14 17:58:35 +00:00
|
|
|
wxPoint m_Ctrl1; /// Bezier Control point 1
|
|
|
|
wxPoint m_Ctrl2; /// Bezier Control point 2
|
2017-01-13 17:51:22 +00:00
|
|
|
std::vector<wxPoint> m_Poly;
|
|
|
|
|
|
|
|
PAD_CS_PRIMITIVE( STROKE_T aShape ):
|
|
|
|
m_Shape( aShape ), m_Thickness( 0 ), m_Radius( 0 ), m_ArcAngle( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// Accessors (helpers for arc and circle shapes)
|
|
|
|
wxPoint GetCenter() { return m_Start; } /// returns the center of a circle or arc
|
|
|
|
wxPoint GetArcStart() { return m_End; } /// returns the start point of an arc
|
|
|
|
|
2017-10-21 09:00:59 +00:00
|
|
|
// Geometric transform
|
|
|
|
/** Move the primitive
|
|
|
|
* @param aMoveVector is the deplacement vector
|
|
|
|
*/
|
|
|
|
void Move( wxPoint aMoveVector );
|
|
|
|
|
2019-07-11 08:48:11 +00:00
|
|
|
/**
|
|
|
|
* Rotates the primitive about a point
|
|
|
|
* @param aRotCentre center of rotation
|
|
|
|
* @param aAngle angle in tenths of degree
|
|
|
|
*/
|
|
|
|
void Rotate( const wxPoint& aRotCentre, double aAngle );
|
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/** Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT
|
|
|
|
* useful to draw a primitive shape
|
|
|
|
* @param aTarget is the DRAWSEGMENT to initialize
|
|
|
|
*/
|
|
|
|
void ExportTo( DRAWSEGMENT* aTarget );
|
2017-10-21 06:48:26 +00:00
|
|
|
|
|
|
|
/** Export the PAD_CS_PRIMITIVE parameters to a EDGE_MODULE
|
2018-06-22 13:05:11 +00:00
|
|
|
* useful to convert a primitive shape to a EDGE_MODULE shape for editing in footprint editor
|
2017-10-21 06:48:26 +00:00
|
|
|
* @param aTarget is the EDGE_MODULE to initialize
|
|
|
|
*/
|
|
|
|
void ExportTo( EDGE_MODULE* aTarget );
|
2017-01-13 17:51:22 +00:00
|
|
|
};
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-18 18:13:55 +00:00
|
|
|
class D_PAD : public BOARD_CONNECTED_ITEM
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-16 17:03:25 +00:00
|
|
|
public:
|
2012-02-19 04:02:19 +00:00
|
|
|
static int m_PadSketchModePenSize; ///< Pen size used to draw pads in sketch mode
|
|
|
|
///< (mode used to print pads on silkscreen layer)
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2007-08-06 20:26:59 +00:00
|
|
|
D_PAD( MODULE* parent );
|
2012-01-14 19:50:32 +00:00
|
|
|
|
2016-05-31 08:27:52 +00:00
|
|
|
// Do not create a copy constructor & operator=.
|
|
|
|
// The ones generated by the compiler are adequate.
|
2012-01-14 19:50:32 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
/* Default layers used for pads, according to the pad type.
|
|
|
|
* this is default values only, they can be changed for a given pad
|
|
|
|
*/
|
2014-07-02 13:08:28 +00:00
|
|
|
static LSET StandardMask(); ///< layer set for a through hole pad
|
|
|
|
static LSET SMDMask(); ///< layer set for a SMD pad on Front layer
|
|
|
|
static LSET ConnSMDMask(); ///< layer set for a SMD pad on Front layer
|
|
|
|
///< used for edge board connectors
|
|
|
|
static LSET UnplatedHoleMask(); ///< layer set for a mechanical unplated through hole pad
|
2018-07-24 13:56:20 +00:00
|
|
|
static LSET ApertureMask(); ///< layer set for an aperture pad
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2015-02-18 16:53:46 +00:00
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
2015-02-17 23:53:57 +00:00
|
|
|
{
|
|
|
|
return aItem && PCB_PAD_T == aItem->Type();
|
|
|
|
}
|
|
|
|
|
2020-05-15 23:25:33 +00:00
|
|
|
bool IsType( const KICAD_T aScanTypes[] ) const override
|
|
|
|
{
|
|
|
|
if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
|
|
|
|
{
|
|
|
|
if( m_Drill.x > 0 && m_Drill.y > 0 )
|
|
|
|
{
|
|
|
|
if( *p == PCB_LOCATE_HOLE_T )
|
|
|
|
return true;
|
|
|
|
else if( *p == PCB_LOCATE_PTH_T && m_Attribute != PAD_ATTRIB_HOLE_NOT_PLATED )
|
|
|
|
return true;
|
|
|
|
else if( *p == PCB_LOCATE_NPTH_T && m_Attribute == PAD_ATTRIB_HOLE_NOT_PLATED )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
MODULE* GetParent() const { return (MODULE*) m_Parent; }
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2017-02-10 19:44:02 +00:00
|
|
|
/**
|
|
|
|
* Imports the pad settings from aMasterPad.
|
|
|
|
* The result is "this" has the same settinds (sizes, shapes ... )
|
|
|
|
* as aMasterPad
|
|
|
|
* @param aMasterPad = the template pad
|
|
|
|
*/
|
2019-06-13 13:34:38 +00:00
|
|
|
void ImportSettingsFrom( const D_PAD& aMasterPad );
|
2017-02-10 19:44:02 +00:00
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
/**
|
|
|
|
* @return true if the pad has a footprint parent flipped
|
|
|
|
* (on the back/bottom layer)
|
|
|
|
*/
|
2017-01-21 20:19:46 +00:00
|
|
|
bool IsFlipped() const;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2015-11-13 11:32:42 +00:00
|
|
|
/**
|
|
|
|
* Set the pad name (sometimes called pad number, although
|
2017-08-10 15:00:28 +00:00
|
|
|
* it can be an array reference like AA12).
|
2015-11-13 11:32:42 +00:00
|
|
|
*/
|
2017-08-11 09:22:13 +00:00
|
|
|
void SetName( const wxString& aName )
|
2017-08-10 15:00:28 +00:00
|
|
|
{
|
|
|
|
m_name = aName;
|
|
|
|
}
|
2015-11-13 11:32:42 +00:00
|
|
|
|
2019-11-17 09:11:29 +00:00
|
|
|
/**
|
|
|
|
* Set the pad function (pin name in schematic)
|
|
|
|
*/
|
|
|
|
void SetPinFunction( const wxString& aName )
|
|
|
|
{
|
|
|
|
m_pinFunction = aName;
|
|
|
|
}
|
|
|
|
|
2015-11-13 11:32:42 +00:00
|
|
|
/**
|
|
|
|
* @return the pad name
|
|
|
|
*/
|
2017-08-11 09:22:13 +00:00
|
|
|
const wxString& GetName() const
|
2017-08-10 15:00:28 +00:00
|
|
|
{
|
|
|
|
return m_name;
|
|
|
|
}
|
2015-11-13 11:32:42 +00:00
|
|
|
|
2019-11-17 09:11:29 +00:00
|
|
|
/**
|
|
|
|
* @return the pad function (pin name in schematic)
|
|
|
|
*/
|
|
|
|
const wxString& GetPinFunction() const
|
|
|
|
{
|
|
|
|
return m_pinFunction;
|
|
|
|
}
|
|
|
|
|
2011-12-16 17:03:25 +00:00
|
|
|
bool PadNameEqual( const D_PAD* other ) const
|
|
|
|
{
|
2017-08-10 15:00:28 +00:00
|
|
|
return m_name == other->m_name; // hide tricks behind sensible API
|
2011-12-16 17:03:25 +00:00
|
|
|
}
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
/**
|
|
|
|
* Function GetShape
|
|
|
|
* @return the shape of this pad.
|
|
|
|
*/
|
2014-01-26 14:20:58 +00:00
|
|
|
PAD_SHAPE_T GetShape() const { return m_padShape; }
|
|
|
|
void SetShape( PAD_SHAPE_T aShape ) { m_padShape = aShape; m_boundingRadius = -1; }
|
2008-12-14 19:45:05 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
|
2017-12-18 17:24:25 +00:00
|
|
|
const wxPoint GetPosition() const override { return m_Pos; }
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/**
|
|
|
|
* Function GetAnchorPadShape
|
|
|
|
* @return the shape of the anchor pad shape, for custom shaped pads.
|
|
|
|
*/
|
|
|
|
PAD_SHAPE_T GetAnchorPadShape() const { return m_anchorPadShape; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the option for the custom pad shape to use as clearance area
|
|
|
|
* in copper zones
|
|
|
|
*/
|
|
|
|
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
|
|
|
|
{
|
|
|
|
return m_customShapeClearanceArea;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the option for the custom pad shape to use as clearance area
|
|
|
|
* in copper zones
|
|
|
|
* @param aOption is the clearance area shape CUST_PAD_SHAPE_IN_ZONE option
|
|
|
|
*/
|
|
|
|
void SetCustomShapeInZoneOpt( CUST_PAD_SHAPE_IN_ZONE aOption )
|
|
|
|
{
|
|
|
|
m_customShapeClearanceArea = aOption;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetAnchorPadShape
|
|
|
|
* Set the shape of the anchor pad for custm shped pads.
|
|
|
|
* @param the shape of the anchor pad shape( currently, only
|
|
|
|
* PAD_SHAPE_RECT or PAD_SHAPE_CIRCLE.
|
|
|
|
*/
|
|
|
|
void SetAnchorPadShape( PAD_SHAPE_T aShape )
|
|
|
|
{
|
|
|
|
m_anchorPadShape = ( aShape == PAD_SHAPE_RECT ) ? PAD_SHAPE_RECT : PAD_SHAPE_CIRCLE;
|
|
|
|
m_boundingRadius = -1;
|
|
|
|
}
|
|
|
|
|
2019-07-25 11:08:41 +00:00
|
|
|
/**
|
|
|
|
* @return true if the pad is on any copper layer, false otherwise.
|
|
|
|
* pads can be only on tech layers to build special pads.
|
|
|
|
* they are therefore not always on a copper layer
|
|
|
|
*/
|
|
|
|
bool IsOnCopperLayer() const override
|
|
|
|
{
|
|
|
|
return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetY( int y ) { m_Pos.y = y; }
|
|
|
|
void SetX( int x ) { m_Pos.x = x; }
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2011-12-01 06:04:23 +00:00
|
|
|
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxPoint& GetPos0() const { return m_Pos0; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetY0( int y ) { m_Pos0.y = y; }
|
|
|
|
void SetX0( int x ) { m_Pos0.x = x; }
|
|
|
|
|
|
|
|
void SetSize( const wxSize& aSize ) { m_Size = aSize; m_boundingRadius = -1; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxSize& GetSize() const { return m_Size; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; m_boundingRadius = -1; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxSize& GetDelta() const { return m_DeltaSize; }
|
|
|
|
|
2011-12-01 06:04:23 +00:00
|
|
|
void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxSize& GetDrillSize() const { return m_Drill; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; }
|
|
|
|
const wxPoint& GetOffset() const { return m_Offset; }
|
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/**
|
|
|
|
* Has meaning only for free shape pads.
|
|
|
|
* add a free shape to the shape list.
|
|
|
|
* the shape can be
|
|
|
|
* a polygon (outline can have a thickness)
|
|
|
|
* a thick segment
|
|
|
|
* a filled circle or ring ( if thickness == 0, this is a filled circle, else a ring)
|
|
|
|
* a arc
|
2019-04-14 17:58:35 +00:00
|
|
|
* a curve
|
2017-01-13 17:51:22 +00:00
|
|
|
*/
|
2020-02-27 23:54:19 +00:00
|
|
|
void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness,
|
|
|
|
bool aMergePrimitives = true ); ///< add a polygonal basic shape
|
|
|
|
void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness,
|
|
|
|
bool aMergePrimitives = true ); ///< add a polygonal basic shape
|
|
|
|
void AddPrimitiveSegment( wxPoint aStart, wxPoint aEnd, int aThickness,
|
|
|
|
bool aMergePrimitives = true ); ///< segment basic shape
|
|
|
|
void AddPrimitiveCircle( wxPoint aCenter, int aRadius, int aThickness,
|
|
|
|
bool aMergePrimitives = true ); ///< ring or circle basic shape
|
|
|
|
void AddPrimitiveArc( wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness,
|
|
|
|
bool aMergePrimitives = true ); ///< arc basic shape
|
|
|
|
void AddPrimitiveCurve( wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2,
|
|
|
|
int aThickness, bool aMergePrimitives = true ); ///< curve basic shape
|
2017-01-13 17:51:22 +00:00
|
|
|
|
|
|
|
|
2017-10-19 21:16:06 +00:00
|
|
|
bool GetBestAnchorPosition( VECTOR2I& aPos );
|
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/**
|
|
|
|
* Merge all basic shapes, converted to a polygon in one polygon,
|
|
|
|
* in m_customShapeAsPolygon
|
|
|
|
* @return true if OK, false in there is more than one polygon
|
|
|
|
* in m_customShapeAsPolygon
|
|
|
|
* @param aMergedPolygon = the SHAPE_POLY_SET to fill.
|
|
|
|
* if NULL, m_customShapeAsPolygon is the target
|
|
|
|
* @param aCircleToSegmentsCount = number of segment to approximate a circle
|
|
|
|
* (default = 32)
|
|
|
|
* Note: The corners coordinates are relative to the pad position, orientation 0,
|
|
|
|
*/
|
2019-05-14 12:39:34 +00:00
|
|
|
bool MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon = NULL );
|
2017-01-13 17:51:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* clear the basic shapes list
|
|
|
|
*/
|
2017-09-20 08:28:52 +00:00
|
|
|
void DeletePrimitivesList();
|
2017-01-13 17:51:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When created, the corners coordinates are relative to the pad position, orientation 0,
|
|
|
|
* in m_customShapeAsPolygon
|
2017-09-20 08:28:52 +00:00
|
|
|
* CustomShapeAsPolygonToBoardPosition transform these coordinates to actual
|
2017-01-13 17:51:22 +00:00
|
|
|
* (board) coordinates
|
|
|
|
* @param aMergedPolygon = the corners coordinates, relative to aPosition and
|
|
|
|
* rotated by aRotation
|
|
|
|
* @param aPosition = the position of the shape (usually the pad shape, but
|
|
|
|
* not always, when moving the pad)
|
|
|
|
* @param aRotation = the rotation of the shape (usually the pad rotation, but
|
|
|
|
* not always, in DRC)
|
|
|
|
*/
|
2017-09-20 08:28:52 +00:00
|
|
|
void CustomShapeAsPolygonToBoardPosition( SHAPE_POLY_SET * aMergedPolygon,
|
2017-01-13 17:51:22 +00:00
|
|
|
wxPoint aPosition, double aRotation ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accessor to the basic shape list
|
|
|
|
*/
|
2017-09-20 08:28:52 +00:00
|
|
|
const std::vector<PAD_CS_PRIMITIVE>& GetPrimitives() const { return m_basicShapes; }
|
2017-01-13 17:51:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Accessor to the custom shape as one polygon
|
|
|
|
*/
|
|
|
|
const SHAPE_POLY_SET& GetCustomShapeAsPolygon() const { return m_customShapeAsPolygon; }
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2019-07-12 21:02:10 +00:00
|
|
|
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
|
2011-12-02 21:56:47 +00:00
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/**
|
|
|
|
* Flip the basic shapes, in custom pads
|
|
|
|
*/
|
2017-09-20 08:28:52 +00:00
|
|
|
void FlipPrimitives();
|
2017-01-13 17:51:22 +00:00
|
|
|
|
2019-01-17 04:55:40 +00:00
|
|
|
/**
|
|
|
|
* Mirror the primitives about a coordinate
|
|
|
|
*
|
|
|
|
* @param aX the x coordinate about which to mirror
|
|
|
|
*/
|
|
|
|
void MirrorXPrimitives( int aX );
|
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/**
|
|
|
|
* Import to the basic shape list
|
|
|
|
* @return true if OK, false if issues
|
|
|
|
* (more than one polygon to build the polygon shape list)
|
|
|
|
*/
|
2017-09-20 08:28:52 +00:00
|
|
|
bool SetPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList );
|
2017-01-13 17:51:22 +00:00
|
|
|
|
2018-03-06 13:58:25 +00:00
|
|
|
/**
|
|
|
|
* Add to the basic shape list
|
|
|
|
* @return true if OK, false if issues
|
|
|
|
* (more than one polygon to build the polygon shape list)
|
|
|
|
*/
|
|
|
|
bool AddPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList );
|
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2011-12-02 21:56:47 +00:00
|
|
|
/**
|
|
|
|
* Function SetOrientation
|
|
|
|
* sets the rotation angle of the pad.
|
2012-02-19 04:02:19 +00:00
|
|
|
* @param aAngle is tenths of degrees, but will soon be degrees. If it is
|
|
|
|
* outside of 0 - 3600, then it will be normalized before being saved.
|
2011-12-02 21:56:47 +00:00
|
|
|
*/
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetOrientation( double aAngle );
|
2011-12-02 21:56:47 +00:00
|
|
|
|
2016-05-02 10:49:14 +00:00
|
|
|
/**
|
|
|
|
* Set orientation in degrees
|
|
|
|
*/
|
|
|
|
void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
|
|
|
|
|
2011-12-02 21:56:47 +00:00
|
|
|
/**
|
|
|
|
* Function GetOrientation
|
2012-04-01 20:51:56 +00:00
|
|
|
* returns the rotation angle of the pad in tenths of degrees, but soon degrees.
|
2011-12-02 21:56:47 +00:00
|
|
|
*/
|
2014-07-09 09:59:24 +00:00
|
|
|
double GetOrientation() const { return m_Orient; }
|
2016-05-02 10:49:14 +00:00
|
|
|
double GetOrientationDegrees() const { return m_Orient/10.0; }
|
|
|
|
double GetOrientationRadians() const { return m_Orient*M_PI/1800; }
|
2011-12-02 21:56:47 +00:00
|
|
|
|
2014-01-26 14:20:58 +00:00
|
|
|
void SetDrillShape( PAD_DRILL_SHAPE_T aDrillShape )
|
|
|
|
{ m_drillShape = aDrillShape; }
|
|
|
|
PAD_DRILL_SHAPE_T GetDrillShape() const { return m_drillShape; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2014-05-17 19:29:15 +00:00
|
|
|
/**
|
2020-04-27 16:22:42 +00:00
|
|
|
* Function GetOblongGeometry calculates the start point, end point and width of an
|
|
|
|
* equivalent segment which have the same position and width as the pad (for circular
|
|
|
|
* of oval pads) or hole
|
|
|
|
*
|
|
|
|
* NB: points returned are RELATIVE to the PAD POSITION. For board coordinates holes
|
|
|
|
* will need to be offset by GetPosition() and pads by ShapePos().
|
|
|
|
*
|
2014-05-17 19:29:15 +00:00
|
|
|
* @param aStartPoint = first point of the equivalent segment, relative to the pad position.
|
|
|
|
* @param aEndPoint = second point of the equivalent segment, relative to the pad position.
|
|
|
|
* @param aWidth = width equivalent segment.
|
|
|
|
*/
|
2020-04-27 16:22:42 +00:00
|
|
|
void GetOblongGeometry( const wxSize& aDrillOrPadSize,
|
|
|
|
wxPoint* aStartPoint, wxPoint* aEndPoint, int* aWidth ) const;
|
2014-05-17 19:29:15 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
|
2016-09-24 18:53:15 +00:00
|
|
|
LSET GetLayerSet() const override { return m_layerMask; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2013-02-13 01:01:22 +00:00
|
|
|
void SetAttribute( PAD_ATTR_T aAttribute );
|
2012-02-19 04:02:19 +00:00
|
|
|
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2019-12-11 10:36:45 +00:00
|
|
|
void SetProperty( PAD_PROP_T aProperty );
|
|
|
|
PAD_PROP_T GetProperty() const { return m_Property; }
|
|
|
|
|
2018-07-24 13:56:20 +00:00
|
|
|
// We don't currently have an attribute for APERTURE, and adding one will change the file
|
|
|
|
// format, so for now just infer a copper-less pad to be an APERTURE pad.
|
|
|
|
bool IsAperturePad() const { return ( m_layerMask & LSET::AllCuMask() ).none(); }
|
|
|
|
|
2013-05-03 17:51:10 +00:00
|
|
|
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
|
|
|
|
int GetPadToDieLength() const { return m_LengthPadToDie; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
|
2011-12-12 08:37:05 +00:00
|
|
|
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
|
|
|
|
|
2020-05-29 12:36:45 +00:00
|
|
|
int GetLocalClearance( wxString* aSource = nullptr ) const override;
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
|
2011-12-12 08:37:05 +00:00
|
|
|
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
|
|
|
|
|
|
|
|
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
|
|
|
|
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
|
2011-12-01 06:04:23 +00:00
|
|
|
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function TransformShapeWithClearanceToPolygon
|
2009-11-14 19:47:52 +00:00
|
|
|
* Convert the pad shape to a closed polygon
|
|
|
|
* Used in filling zones calculations
|
|
|
|
* Circles and arcs are approximated by segments
|
|
|
|
* @param aCornerBuffer = a buffer to store the polygon
|
|
|
|
* @param aClearanceValue = the clearance around the pad
|
2019-05-14 12:39:34 +00:00
|
|
|
* @param aMaxError = Maximum error from true when converting arcs
|
2018-11-14 23:34:32 +00:00
|
|
|
* @param ignoreLineWidth = used for edge cut items where the line width is only
|
|
|
|
* for visualization
|
|
|
|
*/
|
2019-05-14 12:39:34 +00:00
|
|
|
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue,
|
|
|
|
int aMaxError = ARC_HIGH_DEF, bool ignoreLineWidth = false ) const override;
|
2009-03-23 19:54:15 +00:00
|
|
|
|
2018-11-14 23:34:32 +00:00
|
|
|
/**
|
2020-05-29 12:36:45 +00:00
|
|
|
* Function GetLocalClearanceOverrides
|
|
|
|
* returns any local clearance overrides set in the "classic" (ie: pre-rule) system.
|
2020-04-26 12:21:37 +00:00
|
|
|
* @param aSource [out] optionally reports the source as a user-readable string
|
2010-04-08 11:33:43 +00:00
|
|
|
* @return int - the clearance in internal units.
|
2009-11-05 20:59:42 +00:00
|
|
|
*/
|
2020-05-29 12:36:45 +00:00
|
|
|
int GetLocalClearanceOverrides( wxString* aSource = nullptr ) const override;
|
2009-11-05 20:59:42 +00:00
|
|
|
|
|
|
|
// Mask margins handling:
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSolderMaskMargin
|
2009-11-04 19:08:08 +00:00
|
|
|
* @return the margin for the solder mask layer
|
|
|
|
* usually > 0 (mask shape bigger than pad
|
2018-05-02 08:31:10 +00:00
|
|
|
* For pads also on copper layers, the value (used to build a default shape) is
|
2009-11-04 19:08:08 +00:00
|
|
|
* 1 - the local value
|
2018-05-02 08:31:10 +00:00
|
|
|
* 2 - if 0, the parent footprint value
|
|
|
|
* 3 - if 0, the global value
|
|
|
|
* For pads NOT on copper layers, the value is the local value because there is
|
|
|
|
* not default shape to build
|
2009-11-04 19:08:08 +00:00
|
|
|
*/
|
2013-07-26 16:15:11 +00:00
|
|
|
int GetSolderMaskMargin() const;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSolderPasteMargin
|
2009-11-04 19:08:08 +00:00
|
|
|
* @return the margin for the solder mask layer
|
2018-05-02 08:31:10 +00:00
|
|
|
* usually < 0 (mask shape smaller than pad)
|
2009-11-12 15:43:38 +00:00
|
|
|
* because the margin can be dependent on the pad size, the margin has a x and a y value
|
2018-05-02 08:31:10 +00:00
|
|
|
*
|
|
|
|
* For pads also on copper layers, the value (used to build a default shape) is
|
2009-11-04 19:08:08 +00:00
|
|
|
* 1 - the local value
|
2018-05-02 08:31:10 +00:00
|
|
|
* 2 - if 0, the parent footprint value
|
|
|
|
* 3 - if 0, the global value
|
|
|
|
*
|
|
|
|
* For pads NOT on copper layers, the value is the local value because there is
|
|
|
|
* not default shape to build
|
|
|
|
*/
|
2013-07-31 12:51:20 +00:00
|
|
|
wxSize GetSolderPasteMargin() const;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2019-12-28 00:55:11 +00:00
|
|
|
void SetZoneConnection( ZONE_CONNECTION aType )
|
|
|
|
{
|
|
|
|
m_ZoneConnection = aType;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZONE_CONNECTION GetZoneConnection() const;
|
|
|
|
|
|
|
|
ZONE_CONNECTION GetLocalZoneConnection() const
|
|
|
|
{
|
|
|
|
return m_ZoneConnection;
|
|
|
|
}
|
2012-02-24 23:23:46 +00:00
|
|
|
|
2012-03-08 20:44:03 +00:00
|
|
|
void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
|
|
|
|
int GetThermalWidth() const;
|
|
|
|
|
|
|
|
void SetThermalGap( int aGap ) { m_ThermalGap = aGap; }
|
|
|
|
int GetThermalGap() const;
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function BuildPadPolygon
|
2010-09-20 16:21:47 +00:00
|
|
|
* Has meaning only for polygonal pads (trapezoid and rectangular)
|
2010-09-11 16:33:43 +00:00
|
|
|
* Build the Corner list of the polygonal shape,
|
|
|
|
* depending on shape, extra size (clearance ...) and orientation
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aCoord = a buffer to fill (4 corners).
|
2011-08-01 15:29:27 +00:00
|
|
|
* @param aInflateValue = wxSize: the clearance or margin value. value > 0:
|
|
|
|
* inflate, < 0 deflate
|
2010-09-11 16:33:43 +00:00
|
|
|
* @param aRotation = full rotation of the polygon
|
|
|
|
*/
|
2013-05-05 07:17:48 +00:00
|
|
|
void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, double aRotation ) const;
|
2010-09-20 16:21:47 +00:00
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
/**
|
|
|
|
* Function GetRoundRectCornerRadius
|
|
|
|
* Has meaning only for rounded rect pads
|
|
|
|
* @return The radius of the rounded corners for this pad.
|
|
|
|
*/
|
|
|
|
int GetRoundRectCornerRadius() const
|
|
|
|
{
|
|
|
|
return GetRoundRectCornerRadius( m_Size );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper function GetRoundRectCornerRadius
|
|
|
|
* Has meaning only for rounded rect pads
|
|
|
|
* Returns the radius of the rounded corners of a rectangle
|
|
|
|
* size aSize, using others setting of the pad
|
|
|
|
* @param aSize = size of the of the round rect. Usually the pad size
|
|
|
|
* but can be the size of the pad on solder mask or solder paste
|
|
|
|
* @return The radius of the rounded corners for this pad size.
|
|
|
|
*/
|
|
|
|
int GetRoundRectCornerRadius( const wxSize& aSize ) const;
|
|
|
|
|
2018-09-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* Set the rounded rectangle radius ratio based on a given radius
|
|
|
|
* @param aRadius = desired radius of curvature
|
|
|
|
*/
|
|
|
|
void SetRoundRectCornerRadius( double aRadius );
|
|
|
|
|
2013-05-01 19:01:14 +00:00
|
|
|
/**
|
|
|
|
* Function BuildPadShapePolygon
|
|
|
|
* Build the Corner list of the polygonal shape,
|
|
|
|
* depending on shape, extra size (clearance ...) pad and orientation
|
|
|
|
* This function is similar to TransformShapeWithClearanceToPolygon,
|
|
|
|
* but the difference is BuildPadShapePolygon creates a polygon shape exactly
|
|
|
|
* similar to pad shape, which a size inflated by aInflateValue
|
|
|
|
* and TransformShapeWithClearanceToPolygon creates a more complex shape (for instance
|
|
|
|
* a rectangular pad is converted in a rectangulr shape with ronded corners)
|
|
|
|
* @param aCornerBuffer = a buffer to fill.
|
|
|
|
* @param aInflateValue = the clearance or margin value.
|
|
|
|
* value > 0: inflate, < 0 deflate, = 0 : no change
|
|
|
|
* the clearance can have different values for x and y directions
|
|
|
|
* (relative to the pad)
|
2019-05-14 12:39:34 +00:00
|
|
|
* @param aError = Maximum deviation of an arc from the polygon segment
|
2013-05-01 19:01:14 +00:00
|
|
|
*/
|
2019-05-14 12:39:34 +00:00
|
|
|
void BuildPadShapePolygon(
|
|
|
|
SHAPE_POLY_SET& aCornerBuffer, wxSize aInflateValue, int aError = ARC_HIGH_DEF ) const;
|
2013-05-01 19:01:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function BuildPadDrillShapePolygon
|
|
|
|
* Build the Corner list of the polygonal drill shape,
|
|
|
|
* depending on shape pad hole and orientation
|
|
|
|
* @param aCornerBuffer = a buffer to fill.
|
|
|
|
* @param aInflateValue = the clearance or margin value.
|
|
|
|
* value > 0: inflate, < 0 deflate, = 0 : no change
|
2019-05-14 12:39:34 +00:00
|
|
|
* @param aError = Maximum deviation of an arc from the polygon approximation
|
2013-05-01 19:01:14 +00:00
|
|
|
* @return false if the pad has no hole, true otherwise
|
|
|
|
*/
|
2019-05-14 12:39:34 +00:00
|
|
|
bool BuildPadDrillShapePolygon(
|
|
|
|
SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError = ARC_HIGH_DEF ) const;
|
2010-09-20 16:21:47 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function BuildSegmentFromOvalShape
|
2010-09-20 16:21:47 +00:00
|
|
|
* Has meaning only for OVAL (and ROUND) pads
|
|
|
|
* Build an equivalent segment having the same shape as the OVAL shape,
|
|
|
|
* Useful in draw function and in DRC and HitTest functions,
|
|
|
|
* because segments are already well handled by track tests
|
2011-08-01 15:29:27 +00:00
|
|
|
* @param aSegStart = the starting point of the equivalent segment relative to the shape
|
|
|
|
* position.
|
2010-09-20 16:21:47 +00:00
|
|
|
* @param aSegEnd = the ending point of the equivalent segment, relative to the shape position
|
|
|
|
* @param aRotation = full rotation of the segment
|
2013-06-27 19:12:01 +00:00
|
|
|
* @param aRotation = full rotation of the segment
|
|
|
|
* @param aMargin = a margin around the shape (for instance mask margin)
|
2010-09-20 16:21:47 +00:00
|
|
|
* @return the width of the segment
|
|
|
|
*/
|
2013-06-27 19:12:01 +00:00
|
|
|
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd,
|
|
|
|
double aRotation, const wxSize& aMargin ) const;
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingRadius
|
|
|
|
* returns the radius of a minimum sized circle which fully encloses this pad.
|
2016-04-06 18:15:49 +00:00
|
|
|
* The center is the pad position
|
2012-02-19 04:02:19 +00:00
|
|
|
*/
|
2014-05-04 17:08:36 +00:00
|
|
|
int GetBoundingRadius() const
|
2012-02-19 04:02:19 +00:00
|
|
|
{
|
|
|
|
// Any member function which would affect this calculation should set
|
|
|
|
// m_boundingRadius to -1 to re-trigger the calculation from here.
|
2014-01-26 14:20:58 +00:00
|
|
|
// Currently that is only m_Size, m_DeltaSize, and m_padShape accessors.
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_boundingRadius == -1 )
|
|
|
|
{
|
|
|
|
m_boundingRadius = boundingRadius();
|
|
|
|
}
|
2012-03-15 14:31:16 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
return m_boundingRadius;
|
|
|
|
}
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2017-01-21 20:19:46 +00:00
|
|
|
wxPoint ShapePos() const;
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
/**
|
|
|
|
* has meaning only for rounded rect pads
|
|
|
|
* @return the scaling factor between the smaller Y or Y size and the radius
|
|
|
|
* of the rounded corners.
|
|
|
|
* Cannot be > 0.5
|
|
|
|
* the normalized IPC-7351C value is 0.25
|
|
|
|
*/
|
2017-01-21 20:19:46 +00:00
|
|
|
double GetRoundRectRadiusRatio() const
|
2016-04-06 18:15:49 +00:00
|
|
|
{
|
|
|
|
return m_padRoundRectRadiusScale;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* has meaning only for rounded rect pads
|
|
|
|
* Set the scaling factor between the smaller Y or Y size and the radius
|
|
|
|
* of the rounded corners.
|
|
|
|
* Cannot be < 0.5 and obviously must be > 0
|
|
|
|
* the normalized IPC-7351C value is 0.25
|
|
|
|
*/
|
|
|
|
void SetRoundRectRadiusRatio( double aRadiusScale )
|
|
|
|
{
|
|
|
|
if( aRadiusScale < 0.0 )
|
|
|
|
aRadiusScale = 0.0;
|
|
|
|
|
|
|
|
m_padRoundRectRadiusScale = std::min( aRadiusScale, 0.5 );
|
|
|
|
}
|
|
|
|
|
2018-08-29 07:13:07 +00:00
|
|
|
/**
|
|
|
|
* has meaning only for chamfered rect pads
|
|
|
|
* @return the ratio between the smaller Y or Y size and the radius
|
|
|
|
* of the rounded corners.
|
|
|
|
* Cannot be > 0.5
|
|
|
|
*/
|
|
|
|
double GetChamferRectRatio() const
|
|
|
|
{
|
|
|
|
return m_padChamferRectScale;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* has meaning only for chamfered rect pads
|
|
|
|
* Set the ratio between the smaller Y or Y size and the radius
|
|
|
|
* of the rounded corners.
|
|
|
|
* Cannot be < 0.5 and obviously must be > 0
|
|
|
|
*/
|
|
|
|
void SetChamferRectRatio( double aChamferScale )
|
|
|
|
{
|
|
|
|
if( aChamferScale < 0.0 )
|
|
|
|
aChamferScale = 0.0;
|
|
|
|
|
|
|
|
m_padChamferRectScale = std::min( aChamferScale, 0.5 );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* has meaning only for chamfered rect pads
|
|
|
|
* @return the position of the chamfer for a 0 orientation
|
|
|
|
*/
|
|
|
|
int GetChamferPositions() const { return m_chamferPositions; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* has meaning only for chamfered rect pads
|
|
|
|
* set the position of the chamfer for a 0 orientation, one of
|
2019-05-15 06:11:30 +00:00
|
|
|
* RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT,
|
|
|
|
* RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT
|
2018-08-29 07:13:07 +00:00
|
|
|
*/
|
|
|
|
void SetChamferPositions( int aChamferPositions )
|
|
|
|
{
|
|
|
|
m_chamferPositions = aChamferPositions;
|
|
|
|
}
|
|
|
|
|
2007-10-13 06:18:44 +00:00
|
|
|
/**
|
2012-02-19 04:02:19 +00:00
|
|
|
* Function GetSubRatsnest
|
2007-10-13 06:18:44 +00:00
|
|
|
* @return int - the netcode
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
int GetSubRatsnest() const { return m_SubRatsnest; }
|
|
|
|
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2020-04-24 13:36:10 +00:00
|
|
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
|
2014-06-24 16:17:18 +00:00
|
|
|
{
|
|
|
|
return m_layerMask[aLayer];
|
|
|
|
}
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2019-05-05 10:33:34 +00:00
|
|
|
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
2017-04-22 06:49:15 +00:00
|
|
|
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
wxString GetClass() const override
|
2007-08-07 06:21:19 +00:00
|
|
|
{
|
|
|
|
return wxT( "PAD" );
|
|
|
|
}
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2013-11-24 17:48:14 +00:00
|
|
|
// Virtual function:
|
2016-09-24 18:53:15 +00:00
|
|
|
const EDA_RECT GetBoundingBox() const override;
|
2008-04-18 13:28:56 +00:00
|
|
|
|
2014-07-09 09:59:24 +00:00
|
|
|
///> Set absolute coordinates.
|
|
|
|
void SetDrawCoord();
|
|
|
|
|
2019-01-13 21:20:29 +00:00
|
|
|
//todo: Remove SetLocalCoord along with m_pos
|
2014-07-09 09:59:24 +00:00
|
|
|
///> Set relative coordinates.
|
|
|
|
void SetLocalCoord();
|
|
|
|
|
2008-01-24 21:50:12 +00:00
|
|
|
/**
|
|
|
|
* Function Compare
|
|
|
|
* compares two pads and return 0 if they are equal.
|
|
|
|
* @return int - <0 if left less than right, 0 if equal, >0 if left greater than right.
|
|
|
|
*/
|
2008-01-28 18:44:14 +00:00
|
|
|
static int Compare( const D_PAD* padref, const D_PAD* padcmp );
|
2008-01-24 21:50:12 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void Move( const wxPoint& aMoveVector ) override
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2011-11-24 17:32:51 +00:00
|
|
|
m_Pos += aMoveVector;
|
2014-07-09 09:59:24 +00:00
|
|
|
SetLocalCoord();
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
2007-08-07 06:21:19 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
2011-07-14 15:42:44 +00:00
|
|
|
|
2017-02-20 12:20:39 +00:00
|
|
|
BITMAP_DEF GetMenuImage() const override;
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2011-07-14 19:41:20 +00:00
|
|
|
/**
|
|
|
|
* Function ShowPadShape
|
|
|
|
* @return the name of the shape
|
|
|
|
*/
|
|
|
|
wxString ShowPadShape() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ShowPadAttr
|
|
|
|
* @return the name of the pad type (attribute) : STD, SMD ...
|
|
|
|
*/
|
|
|
|
wxString ShowPadAttr() const;
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function AppendConfigs
|
|
|
|
* appends to @a aResult the configuration setting accessors which will later
|
|
|
|
* allow reading or writing of configuration file information directly into
|
|
|
|
* this object.
|
|
|
|
*/
|
2020-01-12 18:40:50 +00:00
|
|
|
void AppendConfigs( std::vector<PARAM_CFG*>* aResult );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
EDA_ITEM* Clone() const override;
|
2012-03-17 14:39:27 +00:00
|
|
|
|
2014-07-02 13:08:28 +00:00
|
|
|
/**
|
|
|
|
* same as Clone, but returns a D_PAD item.
|
2020-02-20 12:11:04 +00:00
|
|
|
* Useful mainly for python scripts, because Clone returns an EDA_ITEM.
|
2014-07-02 13:08:28 +00:00
|
|
|
*/
|
2020-02-20 12:11:04 +00:00
|
|
|
D_PAD* ClonePad() const
|
2014-07-02 13:08:28 +00:00
|
|
|
{
|
|
|
|
return (D_PAD*) Clone();
|
|
|
|
}
|
|
|
|
|
2018-02-04 09:46:38 +00:00
|
|
|
/**
|
|
|
|
* A pad whose hole is the same size as the pad is a NPTH. However, if the user
|
|
|
|
* fails to mark this correctly then the pad will become invisible on the board.
|
|
|
|
* This check allows us to special-case this error-condition.
|
|
|
|
*/
|
|
|
|
bool PadShouldBeNPTH() const;
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
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
|
|
|
|
2016-12-02 17:58:12 +00:00
|
|
|
virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
2013-07-08 09:30:50 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual const BOX2I ViewBBox() const override;
|
2013-07-26 16:15:11 +00:00
|
|
|
|
2017-10-31 13:59:03 +00:00
|
|
|
virtual void SwapData( BOARD_ITEM* aImage ) override;
|
|
|
|
|
2009-03-23 19:54:15 +00:00
|
|
|
#if defined(DEBUG)
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
2007-08-07 06:21:19 +00:00
|
|
|
#endif
|
2012-01-14 19:50:32 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-01-14 19:50:32 +00:00
|
|
|
private:
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function boundingRadius
|
|
|
|
* returns a calculated radius of a bounding circle for this pad.
|
|
|
|
*/
|
|
|
|
int boundingRadius() const;
|
|
|
|
|
2019-05-14 12:39:34 +00:00
|
|
|
bool buildCustomPadPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError );
|
2017-10-19 21:16:06 +00:00
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
private: // Private variable members:
|
|
|
|
|
2014-05-04 17:08:36 +00:00
|
|
|
// Actually computed and cached on demand by the accessor
|
2019-11-17 09:11:29 +00:00
|
|
|
mutable int m_boundingRadius; ///< radius of the circle containing the pad shape
|
|
|
|
|
|
|
|
wxString m_name; ///< pad name (pin number in schematic)
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2019-11-17 09:11:29 +00:00
|
|
|
wxString m_pinFunction; ///< pin function in schematic
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2019-01-13 21:20:29 +00:00
|
|
|
// TODO: Remove m_Pos from Pad or make private. View positions calculated from m_Pos0
|
2012-02-19 04:02:19 +00:00
|
|
|
wxPoint m_Pos; ///< pad Position on board
|
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
PAD_SHAPE_T m_padShape; ///< Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT,
|
|
|
|
///< PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID,
|
|
|
|
///< PAD_SHAPE_ROUNDRECT, PAD_SHAPE_POLYGON
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
/** for free shape pads: a list of basic shapes,
|
|
|
|
* in local coordinates, orient 0, coordinates relative to m_Pos
|
|
|
|
* They are expected to define only one copper area.
|
|
|
|
*/
|
|
|
|
std::vector<PAD_CS_PRIMITIVE> m_basicShapes;
|
|
|
|
|
|
|
|
/** for free shape pads: the set of basic shapes, merged as one polygon,
|
|
|
|
* in local coordinates, orient 0, coordinates relative to m_Pos
|
|
|
|
*/
|
|
|
|
SHAPE_POLY_SET m_customShapeAsPolygon;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How to build the custom shape in zone, to create the clearance area:
|
|
|
|
* CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape
|
|
|
|
* CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape
|
|
|
|
* other values are currently reserved
|
|
|
|
*/
|
|
|
|
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea;
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
int m_SubRatsnest; ///< variable used in rats nest computations
|
|
|
|
///< handle subnet (block) number in ratsnest connection
|
|
|
|
|
|
|
|
wxSize m_Drill; ///< Drill diam (drill shape = PAD_CIRCLE) or drill size
|
|
|
|
///< (shape = OVAL) for drill shape = PAD_CIRCLE, drill
|
|
|
|
///< diam = m_Drill.x
|
|
|
|
|
|
|
|
wxSize m_Size; ///< X and Y size ( relative to orient 0)
|
|
|
|
|
2015-08-23 19:40:33 +00:00
|
|
|
PAD_DRILL_SHAPE_T m_drillShape; ///< PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
|
2014-01-26 14:20:58 +00:00
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
double m_padRoundRectRadiusScale; ///< scaling factor from smallest m_Size coord
|
|
|
|
///< to corner radius, default 0.25
|
2018-08-29 07:13:07 +00:00
|
|
|
double m_padChamferRectScale; ///< scaling factor from smallest m_Size coord
|
|
|
|
///< to chamfer value, default 0.25
|
|
|
|
int m_chamferPositions; ///< the positions of the chamfered position for a 0 orientation
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2017-01-13 17:51:22 +00:00
|
|
|
PAD_SHAPE_T m_anchorPadShape; ///< for custom shaped pads: shape of pad anchor,
|
|
|
|
///< PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
2016-04-06 18:15:49 +00:00
|
|
|
* m_Offset is useful only for oblong and rect pads (it can be used for other
|
2012-02-19 04:02:19 +00:00
|
|
|
* shapes, but without any interest).
|
2012-03-17 02:11:44 +00:00
|
|
|
* This is the offset between the pad hole and the pad shape (you must
|
2012-02-19 04:02:19 +00:00
|
|
|
* understand here pad shape = copper area around the hole)
|
|
|
|
* Most of cases, the hole is the center of the shape (m_Offset = 0).
|
2016-04-06 18:15:49 +00:00
|
|
|
* But some board designers use oblong/rect pads with a hole moved to one of the
|
|
|
|
* oblong/rect pad shape ends.
|
2012-02-19 04:02:19 +00:00
|
|
|
* In all cases the pad position is the pad hole.
|
|
|
|
* The physical shape position (used to draw it for instance) is pad
|
|
|
|
* position (m_Pos) + m_Offset.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* D_PAD::ShapePos() returns the physical shape position according to
|
2012-02-19 04:02:19 +00:00
|
|
|
* the offset and the pad rotation.
|
|
|
|
*/
|
|
|
|
wxPoint m_Offset;
|
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
LSET m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
|
2012-02-19 04:02:19 +00:00
|
|
|
///< 2..14 = internal layers
|
|
|
|
///< 16 .. 31 = technical layers
|
|
|
|
|
|
|
|
wxSize m_DeltaSize; ///< delta on rectangular shapes
|
|
|
|
|
|
|
|
wxPoint m_Pos0; ///< Initial Pad position (i.e. pad position relative to the
|
|
|
|
///< module anchor, orientation 0)
|
|
|
|
|
2015-08-23 19:40:33 +00:00
|
|
|
PAD_ATTR_T m_Attribute; ///< PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD,
|
|
|
|
///< PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED
|
2019-12-11 10:36:45 +00:00
|
|
|
PAD_PROP_T m_Property; ///< property in fab files (BGA, FIDUCIAL, TEST POINT, CASTELLATED)
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
double m_Orient; ///< in 1/10 degrees
|
|
|
|
|
2012-12-12 11:57:17 +00:00
|
|
|
int m_LengthPadToDie; ///< Length net from pad to die, inside the package
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
/// Local clearance. When null, the module default value is used.
|
|
|
|
/// when the module default value is null, the netclass value is used
|
|
|
|
/// Usually the local clearance is null
|
|
|
|
int m_LocalClearance;
|
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
/// Local mask margins: when 0, the parent footprint design values are used
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
int m_LocalSolderMaskMargin; ///< Local solder mask margin
|
|
|
|
int m_LocalSolderPasteMargin; ///< Local solder paste margin absolute value
|
|
|
|
|
|
|
|
double m_LocalSolderPasteMarginRatio; ///< Local solder mask margin ratio value of pad size
|
|
|
|
///< The final margin is the sum of these 2 values
|
2016-04-06 18:15:49 +00:00
|
|
|
/// how the connection to zone is made: no connection, thermal relief ...
|
2019-12-28 00:55:11 +00:00
|
|
|
ZONE_CONNECTION m_ZoneConnection;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2012-05-24 15:00:59 +00:00
|
|
|
int m_ThermalWidth;
|
|
|
|
int m_ThermalGap;
|
2012-02-19 04:02:19 +00:00
|
|
|
};
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#endif // PAD_H_
|