143 default: formatStr =
_(
"Via %s on %s" );
break;
185 *aSource = constraint.
GetName();
187 return constraint.
Value();
196 *aSource =
_(
"removed annular ring" );
213 *aSource = constraint.
GetName();
256 if( min_dist >=
KiROUND( dist ) )
261 if( min_dist >=
KiROUND( dist ) )
272 int radius = (
m_Width + 1 ) / 2;
273 int ymax, xmax, ymin, xmin;
286 BOX2I bbox = arc->BBox();
338 if( aMirrorAroundXAxis )
353 if( aMirrorAroundXAxis )
411 return start_end.
Cross( start_mid ) < 0;
434 top_layer =
FlipLayer( top_layer, copperLayerCount );
435 bottom_layer =
FlipLayer( bottom_layer, copperLayerCount );
443 const std::vector<KICAD_T>& aScanTypes )
445 for(
KICAD_T scanType : aScanTypes )
447 if( scanType ==
Type() )
500 else if( aLayer ==
B_Mask )
523 if( layermask.test(
F_Cu ) )
526 if( layermask.test(
B_Cu ) )
582 if( b_layer < t_layer )
583 std::swap( b_layer, t_layer );
587 *top_layer = t_layer;
590 *bottom_layer = b_layer;
621 for(
auto layer : aLayers.
Seq() )
683 constexpr double HIDE = std::numeric_limits<double>::max();
705 size_t num_chars = netName.size();
784 constexpr double HIDE = (double)std::numeric_limits<double>::max();
805 highContrastLayer =
F_Cu;
807 highContrastLayer =
B_Cu;
859 default:
return _(
"Track" );
879 double radius =
static_cast<PCB_ARC*
>( this )->GetRadius();
892 std::tie( count, trackLen, lenPadToDie ) = board->
GetTrackLength( *
this );
896 if( lenPadToDie != 0 )
899 aList.emplace_back(
_(
"Pad To Die Length" ), msg );
902 aList.emplace_back(
_(
"Full Length" ), msg );
940 default: msg =
_(
"Via" );
break;
943 aList.emplace_back(
_(
"Type" ), msg );
967 std::vector<MSG_PANEL_ITEM>& aList )
const
971 aList.emplace_back(
_(
"Resolved Netclass" ),
989 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
1013 int max_dist = aAccuracy + (
m_Width / 2 );
1023 VECTOR2I relpos = aPosition - center;
1027 if(
std::abs( dist - radius ) > max_dist )
1035 arc_hittest -= arc_angle_start;
1041 return arc_hittest >=
ANGLE_360 + arc_angle;
1043 return arc_hittest <= arc_angle;
1049 int max_dist = aAccuracy + (
m_Width / 2 );
1053 double dist = (double) rel_pos.
x * rel_pos.x + (
double) rel_pos.y * rel_pos.y;
1054 return dist <= (double) max_dist * max_dist;
1060 BOX2I arect = aRect;
1072 BOX2I arect = aRect;
1090 BOX2I arect = aRect;
1106 :
_(
"Track %s on %s, length %s" ),
1129 std::swap( *
this, *
static_cast<PCB_ARC*
>( aImage ) );
1207 return std::make_shared<SHAPE_CIRCLE>(
m_Start, GetDrillValue() / 2 );
1219 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
1220 bool ignoreLineWidth )
const
1222 wxASSERT_MSG( !ignoreLineWidth, wxT(
"IgnoreLineWidth has no meaning for tracks." ) );
1229 int radius = (
m_Width / 2 ) + aClearance;
1237 int width =
m_Width + ( 2 * aClearance );
1240 aError, aErrorLoc );
1246 int width =
m_Width + ( 2 * aClearance );
1267 if( layerEnum.
Choices().GetCount() == 0 )
1307 const wxString groupVia =
_HKI(
"Via Properties" );
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetnameMsg() const
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
wxString GetNetname() const
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
wxString GetUnescapedShortNetname() const
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
int m_SolderMaskExpansion
int GetBiggestClearanceValue() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual bool IsLocked() const
virtual wxString layerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
int GetCopperLayerCount() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
std::tuple< int, double, double > GetTrackLength(const PCB_TRACK &aTrack) const
Return data on the length and number of track segments connected to a given track.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
const Vec & GetOrigin() const
bool Intersects(const BOX2< Vec > &aRect) const
coord_type GetTop() const
bool IntersectsCircle(const Vec &aCenter, const int aRadius) const
bool Contains(const Vec &aPoint) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
coord_type GetRight() const
coord_type GetLeft() const
const Vec & GetSize() const
coord_type GetBottom() const
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
MINOPTMAX< int > & Value()
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
KICAD_T Type() const
Returns the type of object.
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
Contains methods for drawing PCB-specific items.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
bool GetHighContrast() const
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
static LSET FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
static LSET BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
A collection of nets and the parameters used to route or test these nets.
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
virtual VECTOR2I GetPosition() const override
virtual void swapData(BOARD_ITEM *aImage) override
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
EDA_ANGLE GetArcAngleStart() const
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
EDA_ANGLE GetArcAngleEnd() const
EDA_ANGLE GetAngle() const
const VECTOR2I & GetMid() const
PCB_ARC(BOARD_ITEM *aParent)
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
double m_CachedScale
Last zoom scale used to draw this track's net (we want to redraw when changing zoom)
double m_CachedLOD
Last LOD used to draw this track's net.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
int GetLocalClearance(wxString *aSource) const override
Function GetLocalClearance returns any local clearance overrides set in the "classic" (ie: pre-rule) ...
void SetWidth(int aWidth)
MINOPTMAX< int > GetWidthConstraint(wxString *aSource) const
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
virtual double GetLength() const
Function GetLength returns the length of the track using the hypotenuse calculation.
virtual void swapData(BOARD_ITEM *aImage) override
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
bool ApproxCollinear(const PCB_TRACK &aTrack)
VECTOR2I m_End
Line end point.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Function TransformShapeToPolygon Convert the track shape to a closed polygon Used in filling zones ca...
const VECTOR2I & GetStart() const
VECTOR2I m_Start
Line start point.
wxString GetFriendlyName() const override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
const VECTOR2I & GetEnd() const
PCB_TRACK(BOARD_ITEM *aParent, KICAD_T idtype=PCB_TRACE_T)
int m_Width
Thickness of track, or via diameter.
virtual void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
EDA_ITEM_FLAGS IsPointOnEnds(const VECTOR2I &point, int min_dist=0) const
Function IsPointOnEnds returns STARTPOINT if point if near (dist = min_dist) start point,...
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
bool IsTented() const override
PCB_LAYER_ID BottomLayer() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
bool FlashLayer(int aLayer) const
Checks to see whether the via should have a pad on the specific layer.
void SetDrillDefault()
Function SetDrillDefault sets the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
PCB_LAYER_ID m_bottomLayer
The bottom layer of the via (the top layer is in m_layer)
bool m_isFree
"Free" vias don't get their nets auto-updated
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
virtual void SetLayerSet(LSET aLayers) override
void SetBottomLayer(PCB_LAYER_ID aLayer)
int GetSolderMaskExpansion() const
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
ZONE_LAYER_CONNECTION m_zoneLayerConnections[B_Cu+1]
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
int m_drill
for vias: via drill (- 1 for default value)
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void SetTopLayer(PCB_LAYER_ID aLayer)
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
Function SetLayerPair For a via m_layer contains the top layer, the other layer is in m_bottomLayer.
bool m_removeUnconnectedLayer
Remove annular rings on unconnected layers.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void SanitizeLayers()
Function SanitizeLayers Check so that the layers are correct dependin on the type of via,...
PCB_VIA & operator=(const PCB_VIA &aOther)
void swapData(BOARD_ITEM *aImage) override
PCB_VIA(BOARD_ITEM *aParent)
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
void SetViaType(VIATYPE aViaType)
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
PCB_LAYER_ID TopLayer() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
VIATYPE m_viaType
through, blind/buried or micro
bool m_keepStartEndLayer
Keep the start and end annular rings.
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
VIATYPE GetViaType() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
void AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
bool ApproxCollinear(const SEG &aSeg, int aDistanceThreshold=1) const
const VECTOR2I & GetArcMid() const
const VECTOR2I & GetP1() const
const VECTOR2I & GetP0() const
Represent a set of closed polygons.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
extended_type Cross(const VECTOR2< T > &aVector) const
Compute cross product of self with aVector.
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
void TransformArcToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc)
Convert arc to multiple straight segments.
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
@ ANNULAR_WIDTH_CONSTRAINT
static constexpr EDA_ANGLE & ANGLE_360
static constexpr EDA_ANGLE & ANGLE_0
#define PCB_EDIT_FRAME_NAME
const INSPECTOR_FUNC & INSPECTOR
#define ENDPOINT
ends. (Used to support dragging.)
std::uint32_t EDA_ITEM_FLAGS
#define STARTPOINT
When a line is selected, these flags indicate which.
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
bool ClipLine(const BOX2I *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
Some functions to handle hotkeys in KiCad.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
@ LAYER_LOCKED_ITEM_SHADOW
shadow layer for locked items
@ LAYER_GP_OVERLAY
general purpose overlay
@ LAYER_VIA_HOLES
to draw via holes (pad holes do not use this layer)
@ LAYER_VIA_MICROVIA
to draw micro vias
@ LAYER_VIA_THROUGH
to draw usual through hole vias
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
@ LAYER_VIA_BBLIND
to draw blind/buried vias
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
bool IsHoleLayer(int aLayer)
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
static struct TRACK_VIA_DESC _TRACK_VIA_DESC
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
@ PT_SIZE
Size expressed in distance units (mm/inch)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
wxString UnescapeString(const wxString &aSource)
constexpr int mmToIU(double mm) const
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
double GetLineLength(const VECTOR2I &aPointA, const VECTOR2I &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
double EuclideanNorm(const VECTOR2I &vector)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".