kicad/pcbnew/pcb_track.h

596 lines
19 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
2021-06-11 21:07:02 +00:00
* @brief A single base class (PCB_TRACK) represents both tracks and vias, with subclasses
* for curved tracks (PCB_ARC) and vias (PCB_VIA). All told there are three KICAD_Ts:
* PCB_TRACK_T, PCB_ARC_T, and PCB_VIA_T.
*
* For vias there is a further VIATYPE which indicates THROUGH, BLIND_BURIED, or
* MICROVIA, which are supported by the synthetic KICAD_Ts PCB_LOCATE_STDVIA_T,
* PCB_LOCATE_BBVIA_T, and PCB_LOCATE_UVIA_T.
*/
#ifndef CLASS_TRACK_H
#define CLASS_TRACK_H
2023-01-15 17:18:56 +00:00
#include <mutex>
#include <array>
2018-02-02 20:57:12 +00:00
#include <board_connected_item.h>
#include <base_units.h>
#include <geometry/shape_segment.h>
#include <core/minoptmax.h>
#include <core/arraydim.h>
2021-06-11 21:07:02 +00:00
class PCB_TRACK;
class PCB_VIA;
2020-11-12 22:30:02 +00:00
class PAD;
class MSG_PANEL_ITEM;
class SHAPE_POLY_SET;
2021-06-06 12:59:05 +00:00
class SHAPE_ARC;
// Flag used in locate routines (from which endpoint work)
enum ENDPOINT_T : int
{
ENDPOINT_START = 0,
ENDPOINT_END = 1
};
// Via types
// Note that this enum must be synchronized to GAL_LAYER_ID
enum class VIATYPE : int
{
2019-12-28 00:55:11 +00:00
THROUGH = 3, /* Always a through hole via */
BLIND_BURIED = 2, /* this via can be on internal layers */
MICROVIA = 1, /* this via which connect from an external layer
* to the near neighbor internal layer */
2019-12-28 00:55:11 +00:00
NOT_DEFINED = 0 /* not yet used */
};
#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
// Used for tracks and vias for algorithmic safety, not to enforce constraints
2022-09-17 00:45:14 +00:00
#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
2021-06-11 21:07:02 +00:00
class PCB_TRACK : public BOARD_CONNECTED_ITEM
{
public:
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_TRACE_T == aItem->Type();
}
2021-06-11 21:07:02 +00:00
PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
2007-09-01 12:00:30 +00:00
// Do not create a copy constructor. The one generated by the compiler is adequate.
2007-08-08 20:51:08 +00:00
void Move( const VECTOR2I& aMoveVector ) override
2009-08-01 19:26:05 +00:00
{
m_Start += aMoveVector;
2011-12-01 22:50:41 +00:00
m_End += aMoveVector;
2009-08-01 19:26:05 +00:00
}
void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
2009-08-01 19:26:05 +00:00
virtual void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis );
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
2009-08-01 19:26:05 +00:00
void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
VECTOR2I GetPosition() const override { return m_Start; }
const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
2011-12-14 04:29:25 +00:00
void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; }
2011-11-30 07:43:46 +00:00
void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
const VECTOR2I& GetEnd() const { return m_End; }
void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
const VECTOR2I& GetStart() const { return m_Start; }
2011-11-30 07:43:46 +00:00
void SetEndX( int aX ) { m_End.x = aX; }
void SetEndY( int aY ) { m_End.y = aY; }
int GetEndX() const { return m_End.x; }
2021-01-31 20:43:12 +00:00
int GetEndY() const { return m_End.y; }
/// Return the selected endpoint (start or end)
const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
{
if( aEndPoint == ENDPOINT_START )
return m_Start;
else
return m_End;
}
// Virtual function
2022-08-31 09:15:42 +00:00
const BOX2I GetBoundingBox() const override;
2008-03-05 22:39:33 +00:00
2007-10-13 06:18:44 +00:00
/**
* Function GetLength
* returns the length of the track using the hypotenuse calculation.
* @return double - the length of the track
*/
2021-06-06 12:59:05 +00:00
virtual double GetLength() const;
2010-11-12 15:17:10 +00:00
/**
* Function TransformShapeToPolygon
* Convert the track shape to a closed polygon
* Used in filling zones calculations
* Circles (vias) and arcs (ends of tracks) are approximated by segments
* @param aBuffer = a buffer to store the polygon
* @param aClearance = the clearance around the pad
* @param aError = the maximum deviation from true circle
* @param ignoreLineWidth = used for edge cut items where the line width is only for
* visualization
*/
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const override;
// @copydoc BOARD_ITEM::GetEffectiveShape
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
/**
* Function IsPointOnEnds
* returns STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if
* point if near (dist = min_dist) end point,STARTPOINT|ENDPOINT if point if near
* (dist = min_dist) both ends, or 0 if none of the above.
* if min_dist < 0: min_dist = track_width/2
*/
EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
/**
* Function IsNull
* returns true if segment length is zero.
*/
2019-05-31 02:30:28 +00:00
bool IsNull() const
{
return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
}
2007-08-08 20:51:08 +00:00
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
2022-12-22 22:44:40 +00:00
wxString GetFriendlyName() const override;
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
const std::vector<KICAD_T>& aScanTypes ) override;
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
2022-08-31 09:33:46 +00:00
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
2021-06-11 21:07:02 +00:00
bool ApproxCollinear( const PCB_TRACK& aTrack );
2016-09-24 18:53:15 +00:00
wxString GetClass() const override
2007-08-08 20:51:08 +00:00
{
2021-06-11 21:07:02 +00:00
return wxT( "PCB_TRACK" );
2007-08-08 20:51:08 +00:00
}
/**
* Function GetLocalClearance
* returns any local clearance overrides set in the "classic" (ie: pre-rule) system.
* @param aSource [out] optionally reports the source as a user-readable string
* @return int - the clearance in internal units.
*/
int GetLocalClearance( wxString* aSource ) const override;
MINOPTMAX<int> GetWidthConstraint( wxString* aSource ) const;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
BITMAPS GetMenuImage() const override;
2016-09-24 18:53:15 +00:00
virtual EDA_ITEM* Clone() const override;
2016-09-24 18:53:15 +00:00
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
2013-07-08 07:57:23 +00:00
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
2013-07-08 07:57:23 +00:00
const BOX2I ViewBBox() const override;
/**
* @return true because a track or a via is always on a copper layer.
*/
bool IsOnCopperLayer() const override
{
return true;
}
/**
* Get last used LOD for the track net name
* @return LOD from ViewGetLOD()
*/
double GetCachedLOD()
{
return m_CachedLOD;
}
/**
* Set the cached LOD
* @param aLOD value from ViewGetLOD() or 0.0 to always display
*/
void SetCachedLOD( double aLOD )
{
m_CachedLOD = aLOD;
}
/**
* Get last used zoom scale for the track net name
* @return scale from GetScale()
*/
double GetCachedScale()
{
return m_CachedScale;
}
/**
* Set the cached scale
* @param aScale value from GetScale()
*/
void SetCachedScale( double aScale )
{
m_CachedScale = aScale;
}
struct cmp_tracks
{
2021-06-11 21:07:02 +00:00
bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
};
#if defined (DEBUG)
2016-09-24 18:53:15 +00:00
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif
protected:
virtual void swapData( BOARD_ITEM* aImage ) override;
2020-10-27 11:03:35 +00:00
void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) const;
protected:
int m_Width; ///< Thickness of track, or via diameter
VECTOR2I m_Start; ///< Line start point
VECTOR2I m_End; ///< Line end point
double m_CachedLOD; ///< Last LOD used to draw this track's net
double m_CachedScale; ///< Last zoom scale used to draw this track's net (we want to redraw when changing zoom)
};
2007-09-01 12:00:30 +00:00
2021-06-11 21:07:02 +00:00
class PCB_ARC : public PCB_TRACK
{
public:
2021-06-11 21:07:02 +00:00
PCB_ARC( BOARD_ITEM* aParent ) :
PCB_TRACK( aParent, PCB_ARC_T )
{
};
2021-06-11 21:07:02 +00:00
PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
static inline bool ClassOf( const EDA_ITEM *aItem )
{
return aItem && PCB_ARC_T == aItem->Type();
}
virtual void Move( const VECTOR2I& aMoveVector ) override
{
m_Start += aMoveVector;
m_Mid += aMoveVector;
m_End += aMoveVector;
}
void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
const VECTOR2I& GetMid() const { return m_Mid; }
void SetPosition( const VECTOR2I& aPos ) override
{
m_Start = aPos;
}
virtual VECTOR2I GetPosition() const override;
virtual VECTOR2I GetCenter() const override { return GetPosition(); }
double GetRadius() const;
2022-01-14 15:34:41 +00:00
EDA_ANGLE GetAngle() const;
EDA_ANGLE GetArcAngleStart() const;
EDA_ANGLE GetArcAngleEnd() const;
virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
2022-08-31 09:33:46 +00:00
virtual bool HitTest( const BOX2I& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
bool IsCCW() const;
wxString GetClass() const override
{
2021-06-11 21:07:02 +00:00
return wxT( "PCB_ARC" );
}
2020-08-13 10:08:16 +00:00
// @copydoc BOARD_ITEM::GetEffectiveShape
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
2020-08-13 10:08:16 +00:00
/**
* Function GetLength
* returns the length of the arc track
* @return double - the length of the track
*/
virtual double GetLength() const override
{
2022-01-14 15:34:41 +00:00
return GetRadius() * std::abs( GetAngle().AsRadians() );
}
EDA_ITEM* Clone() const override;
protected:
virtual void swapData( BOARD_ITEM* aImage ) override;
private:
VECTOR2I m_Mid; ///< Arc mid point, halfway between start and end
};
2021-06-11 21:07:02 +00:00
class PCB_VIA : public PCB_TRACK
{
public:
2021-06-11 21:07:02 +00:00
PCB_VIA( BOARD_ITEM* aParent );
2007-09-01 12:00:30 +00:00
static inline bool ClassOf( const EDA_ITEM *aItem )
{
return aItem && PCB_VIA_T == aItem->Type();
}
PCB_VIA( const PCB_VIA& aOther );
PCB_VIA& operator=( const PCB_VIA &aOther );
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
return true;
for( KICAD_T scanType : aScanTypes )
{
if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
return true;
else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
return true;
else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
return true;
}
return false;
}
2020-11-14 14:29:11 +00:00
VIATYPE GetViaType() const { return m_viaType; }
void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
bool HasHole() const override
{
return true;
}
std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
bool IsTented() const override;
int GetSolderMaskExpansion() const;
bool IsOnLayer( PCB_LAYER_ID aLayer, bool aIncludeCourtyards = false ) const override;
2016-09-24 18:53:15 +00:00
virtual LSET GetLayerSet() const override;
virtual void SetLayerSet( LSET aLayers ) override;
/**
* Function SetLayerPair
2020-11-14 14:29:11 +00:00
* For a via m_layer contains the top layer, the other layer is in m_bottomLayer
* @param aTopLayer = first layer connected by the via
* @param aBottomLayer = last layer connected by the via
*/
void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
void SetBottomLayer( PCB_LAYER_ID aLayer );
void SetTopLayer( PCB_LAYER_ID aLayer );
/**
* 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
* Function LayerPair
* Return the 2 layers used by the via (the via actually uses
* all layers between these 2 layers)
* @param top_layer = pointer to the first layer (can be null)
* @param bottom_layer = pointer to the last layer (can be null)
*/
void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
PCB_LAYER_ID TopLayer() const;
PCB_LAYER_ID BottomLayer() const;
/**
* Function SanitizeLayers
* Check so that the layers are correct dependin on the type of via, and
* so that the top actually is on top.
*/
void SanitizeLayers();
VECTOR2I GetPosition() const override { return m_Start; }
void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
2022-08-31 09:33:46 +00:00
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
2014-05-01 06:50:11 +00:00
2016-09-24 18:53:15 +00:00
wxString GetClass() const override
2007-08-08 20:51:08 +00:00
{
2021-06-11 21:07:02 +00:00
return wxT( "PCB_VIA" );
2007-08-08 20:51:08 +00:00
}
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
BITMAPS GetMenuImage() const override;
2016-09-24 18:53:15 +00:00
EDA_ITEM* Clone() const override;
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
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
#if defined (DEBUG)
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif
int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
/**
* Sets the unconnected removal property. If true, the copper is removed on zone fill
* or when specifically requested when the via is not connected on a layer.
*/
2020-11-14 14:29:11 +00:00
void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
bool GetRemoveUnconnected() const { return m_removeUnconnectedLayer; }
/**
* Sets whether we keep the start and end annular rings even if they are not connected
*/
void SetKeepStartEnd( bool aSet ) { m_keepStartEndLayer = aSet; }
bool GetKeepStartEnd() const { return m_keepStartEndLayer; }
bool ConditionallyFlashed( PCB_LAYER_ID aLayer ) const
{
if( !m_removeUnconnectedLayer )
return false;
if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
return false;
return true;
}
/**
* Checks to see whether the via should have a pad on the specific layer
* @param aLayer Layer to check for connectivity
* @return true if connected by pad or track (or optionally zone)
*/
bool FlashLayer( int aLayer ) const;
/**
* Checks to see if the via is present on any of the layers in the set
* @param aLayers set of layers to check the via against
* @return true if connected by pad or track (or optionally zone) on any of the associated layers
*/
bool FlashLayer( LSET aLayers ) const;
/**
* Function SetDrill
* sets the drill value for vias.
* @param aDrill is the new drill diameter
*/
2020-11-14 14:29:11 +00:00
void SetDrill( int aDrill ) { m_drill = aDrill; }
/**
* Function GetDrill
2021-06-11 21:07:02 +00:00
* returns the local drill setting for this PCB_VIA. If you want the calculated value,
* use GetDrillValue() instead.
*/
2020-11-14 14:29:11 +00:00
int GetDrill() const { return m_drill; }
/**
* Function GetDrillValue
* "calculates" the drill value for vias (m-Drill if > 0, or default
* drill value for the board.
* @return real drill_value
*/
int GetDrillValue() const;
/**
* Function SetDrillDefault
* sets the drill value for vias to the default value #UNDEFINED_DRILL_DIAMETER.
*/
2020-11-14 14:29:11 +00:00
void SetDrillDefault() { m_drill = UNDEFINED_DRILL_DIAMETER; }
/**
* Checks if the via is a free via (as opposed to one created on a track by the router).
* Free vias don't have their nets automatically updated by the connectivity algorithm.
* @return true if the via is a free via
*/
bool GetIsFree() const { return m_isFree; }
void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
/**
* Function IsDrillDefault
* @return true if the drill value is default value (-1)
*/
2020-11-14 14:29:11 +00:00
bool IsDrillDefault() const { return m_drill <= 0; }
2020-08-13 10:08:16 +00:00
// @copydoc BOARD_ITEM::GetEffectiveShape
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
2020-08-13 10:08:16 +00:00
void ClearZoneLayerOverrides()
{
m_zoneLayerOverrides.fill( ZLO_NONE );
}
const ZONE_LAYER_OVERRIDE& GetZoneLayerOverride( PCB_LAYER_ID aLayer ) const
{
return m_zoneLayerOverrides[ aLayer ];
}
void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride )
{
std::unique_lock<std::mutex> cacheLock( m_zoneLayerOverridesMutex );
m_zoneLayerOverrides[ aLayer ] = aOverride;
}
protected:
void swapData( BOARD_ITEM* aImage ) override;
2020-11-16 11:16:44 +00:00
wxString layerMaskDescribe() const override;
private:
2020-11-14 14:29:11 +00:00
/// The bottom layer of the via (the top layer is in m_layer)
PCB_LAYER_ID m_bottomLayer;
2020-11-14 14:29:11 +00:00
VIATYPE m_viaType; ///< through, blind/buried or micro
2020-11-14 14:29:11 +00:00
int m_drill; ///< for vias: via drill (- 1 for default value)
bool m_removeUnconnectedLayer; ///< Remove annular rings on unconnected layers
bool m_keepStartEndLayer; ///< Keep the start and end annular rings
bool m_isFree; ///< "Free" vias don't get their nets auto-updated
std::mutex m_zoneLayerOverridesMutex;
std::array<ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS> m_zoneLayerOverrides;
};
#endif // CLASS_TRACK_H