47#include <google/protobuf/any.pb.h>
51#include <api/board/board_types.pb.h>
146 case VIATYPE::BLIND_BURIED: formatStr =
_(
"Blind/Buried Via %s on %s" );
break;
147 case VIATYPE::MICROVIA: formatStr =
_(
"Micro Via %s on %s" );
break;
148 default: formatStr =
_(
"Via %s on %s" );
break;
168 return *
this == other;
188 double similarity = 1.0;
213 return *
this == other;
234 double similarity = 1.0;
262 return *
this == other;
285 double similarity = 1.0;
314 kiapi::board::types::Track track;
317 track.mutable_start()->set_x_nm(
GetStart().x );
318 track.mutable_start()->set_y_nm(
GetStart().y );
319 track.mutable_end()->set_x_nm(
GetEnd().x );
320 track.mutable_end()->set_y_nm(
GetEnd().y );
321 track.mutable_width()->set_value_nm(
GetWidth() );
322 track.set_layer( ToProtoEnum<PCB_LAYER_ID, kiapi::board::types::BoardLayer>(
GetLayer() ) );
323 track.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
324 : kiapi::common::types::LockedState::LS_UNLOCKED );
325 track.mutable_net()->mutable_code()->set_value(
GetNetCode() );
326 track.mutable_net()->set_name(
GetNetname() );
328 aContainer.PackFrom( track );
334 kiapi::board::types::Track track;
336 if( !aContainer.UnpackTo( &track ) )
342 SetWidth( track.width().value_nm() );
343 SetLayer( FromProtoEnum<PCB_LAYER_ID, kiapi::board::types::BoardLayer>( track.layer() ) );
345 SetLocked( track.locked() == kiapi::common::types::LockedState::LS_LOCKED );
353 kiapi::board::types::Arc arc;
356 arc.mutable_start()->set_x_nm(
GetStart().x );
357 arc.mutable_start()->set_y_nm(
GetStart().y );
358 arc.mutable_mid()->set_x_nm(
GetMid().x );
359 arc.mutable_mid()->set_y_nm(
GetMid().y );
360 arc.mutable_end()->set_x_nm(
GetEnd().x );
361 arc.mutable_end()->set_y_nm(
GetEnd().y );
362 arc.mutable_width()->set_value_nm(
GetWidth() );
363 arc.set_layer( ToProtoEnum<PCB_LAYER_ID, kiapi::board::types::BoardLayer>(
GetLayer() ) );
364 arc.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
365 : kiapi::common::types::LockedState::LS_UNLOCKED );
366 arc.mutable_net()->mutable_code()->set_value(
GetNetCode() );
369 aContainer.PackFrom( arc );
375 kiapi::board::types::Arc arc;
377 if( !aContainer.UnpackTo( &arc ) )
385 SetLayer( FromProtoEnum<PCB_LAYER_ID, kiapi::board::types::BoardLayer>( arc.layer() ) );
387 SetLocked( arc.locked() == kiapi::common::types::LockedState::LS_LOCKED );
395 kiapi::board::types::Via
via;
407 google::protobuf::Any padStackWrapper;
409 padStackWrapper.UnpackTo(
via.mutable_pad_stack() );
413 via.set_type( ToProtoEnum<VIATYPE, kiapi::board::types::ViaType>(
GetViaType() ) );
414 via.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
415 : kiapi::common::types::LockedState::LS_UNLOCKED );
416 via.mutable_net()->mutable_code()->set_value(
GetNetCode() );
419 aContainer.PackFrom(
via );
425 kiapi::board::types::Via
via;
427 if( !aContainer.UnpackTo( &
via ) )
433 SetDrill(
via.pad_stack().drill_diameter().x_nm() );
435 google::protobuf::Any padStackWrapper;
436 padStackWrapper.PackFrom(
via.pad_stack() );
445 SetLocked(
via.locked() == kiapi::common::types::LockedState::LS_LOCKED );
471 *aSource = constraint.
GetName();
473 return constraint.
Value();
489 *aSource = constraint.
GetName();
491 return constraint.
Value();
507 *aSource = constraint.
GetName();
509 return constraint.
Value();
518 *aSource =
_(
"removed annular ring" );
535 *aSource = constraint.
GetName();
578 if( min_dist >= dist )
583 if( min_dist >= dist )
594 int radius = (
m_Width + 1 ) / 2;
595 int ymax, xmax, ymin, xmin;
608 BOX2I bbox = arc->BBox();
632 VECTOR2L( (int64_t) xmax - xmin + 1, (int64_t) ymax - ymin + 1 ) );
659 if( aMirrorAroundXAxis )
674 if( aMirrorAroundXAxis )
731 return start_end.
Cross( start_mid ) < 0;
761 const std::vector<KICAD_T>& aScanTypes )
763 for(
KICAD_T scanType : aScanTypes )
765 if( scanType ==
Type() )
767 if( INSPECT_RESULT::QUIT == inspector(
this, testData ) )
768 return INSPECT_RESULT::QUIT;
772 return INSPECT_RESULT::CONTINUE;
798 TENTING_MODE::TENTED : TENTING_MODE::NOT_TENTED;
801 return TENTING_MODE::FROM_RULES;
821 TENTING_MODE::TENTED : TENTING_MODE::NOT_TENTED;
824 return TENTING_MODE::FROM_RULES;
831 "Invalid layer passed to IsTented" );
843 return front ? board->GetDesignSettings().m_TentViasFront
844 : board->GetDesignSettings().m_TentViasBack;
854 return board->GetDesignSettings().m_SolderMaskExpansion;
867 if( aLayer >=
Padstack().Drill().start && aLayer <=
Padstack().Drill().end )
872 else if( aLayer ==
B_Mask )
970 if( b_layer < t_layer )
971 std::swap( b_layer, t_layer );
975 *top_layer = t_layer;
978 *bottom_layer = b_layer;
1009 for(
size_t ii = 0; ii < aLayers.
size(); ++ii )
1011 if( aLayers.
test( ii ) )
1041 switch(
Padstack().UnconnectedLayerMode() )
1048 if( aLayer ==
Padstack().Drill().start || aLayer ==
Padstack().Drill().end )
1082 bool connected =
false;
1115 constexpr double HIDE = std::numeric_limits<double>::max();
1141 if(
VECTOR2I( end - start ).SquaredEuclideanNorm() < nameSize * nameSize )
1148 if(
VECTOR2I( end - start ).SquaredEuclideanNorm() == 0 )
1179 bbox.
Inflate( 2 * board->GetDesignSettings().GetBiggestClearanceValue() );
1210 aLayers[ aCount++ ] =
F_Mask;
1213 aLayers[ aCount++ ] =
B_Mask;
1219 constexpr double HIDE = (double)std::numeric_limits<double>::max();
1231 visible = board->GetVisibleLayers() & board->GetEnabledLayers();
1239 highContrastLayer =
F_Cu;
1241 highContrastLayer =
B_Cu;
1248 if( highContrastLayer <
Padstack().Drill().start
1249 || highContrastLayer >
Padstack().Drill().end )
1307 default:
return _(
"Track" );
1327 double radius =
static_cast<PCB_ARC*
>( this )->GetRadius();
1340 std::tie( count, trackLen, lenPadToDie ) = board->
GetTrackLength( *
this );
1344 if( lenPadToDie != 0 )
1347 aList.emplace_back(
_(
"Pad To Die Length" ), msg );
1350 aList.emplace_back(
_(
"Full Length" ), msg );
1357 aList.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
1359 wxString::Format(
_(
"(from %s)" ), source ) );
1364 if( !msg.IsEmpty() )
1366 aList.emplace_back( wxString::Format(
_(
"Width Constraints: %s" ), msg ),
1367 wxString::Format(
_(
"(from %s)" ), source ) );
1378 case VIATYPE::MICROVIA: msg =
_(
"Micro Via" );
break;
1379 case VIATYPE::BLIND_BURIED: msg =
_(
"Blind/Buried Via" );
break;
1380 case VIATYPE::THROUGH: msg =
_(
"Through Via" );
break;
1381 default: msg =
_(
"Via" );
break;
1384 aList.emplace_back(
_(
"Type" ), msg );
1395 aList.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
1397 wxString::Format(
_(
"(from %s)" ), source ) );
1401 aList.emplace_back( wxString::Format(
_(
"Min Annular Width: %s" ),
1403 wxString::Format(
_(
"(from %s)" ), source ) );
1408 std::vector<MSG_PANEL_ITEM>& aList )
const
1412 aList.emplace_back(
_(
"Resolved Netclass" ),
1417 aList.emplace_back(
_(
"NetCode" ), wxString::Format( wxT(
"%d" ),
GetNetCode() ) );
1419 aList.emplace_back( wxT(
"Flags" ), wxString::Format( wxT(
"0x%08X" ),
m_flags ) );
1421 aList.emplace_back( wxT(
"Start pos" ), wxString::Format( wxT(
"%d %d" ),
1424 aList.emplace_back( wxT(
"End pos" ), wxString::Format( wxT(
"%d %d" ),
1430 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
1454 double max_dist = aAccuracy + (
m_Width / 2.0 );
1463 VECTOR2L relpos = aPosition - center;
1467 if(
std::abs( dist - radius ) > max_dist )
1475 arc_hittest -= arc_angle_start;
1481 return arc_hittest >=
ANGLE_360 + arc_angle;
1483 return arc_hittest <= arc_angle;
1489 int max_dist = aAccuracy + (
m_Width / 2 );
1493 double dist = (double) rel_pos.
x * rel_pos.x + (
double) rel_pos.y * rel_pos.y;
1494 return dist <= (double) max_dist * max_dist;
1500 BOX2I arect = aRect;
1512 BOX2I arect = aRect;
1530 BOX2I arect = aRect;
1545 return wxString::Format(
Type() ==
PCB_ARC_T ?
_(
"Track (arc) %s on %s, length %s" )
1546 :
_(
"Track %s on %s, length %s" ),
1555 return BITMAPS::add_tracks;
1569 std::swap( *
this, *
static_cast<PCB_ARC*
>( aImage ) );
1590 return center.Distance(
m_Start );
1630 && (
GetMid() -
GetEnd() ).EuclideanNorm() < aThreshold;
1660 if( aFlash == FLASHING::ALWAYS_FLASHED
1661 || ( aFlash == FLASHING::DEFAULT && FlashLayer( aLayer ) ) )
1667 return std::make_shared<SHAPE_CIRCLE>(
m_Start, GetDrillValue() / 2 );
1679 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
1680 bool ignoreLineWidth )
const
1682 wxASSERT_MSG( !ignoreLineWidth, wxT(
"IgnoreLineWidth has no meaning for tracks." ) );
1689 int radius = (
m_Width / 2 ) + aClearance;
1697 int width =
m_Width + ( 2 * aClearance );
1700 aError, aErrorLoc );
1706 int width =
m_Width + ( 2 * aClearance );
1720 .Undefined( VIATYPE::NOT_DEFINED )
1721 .Map( VIATYPE::THROUGH,
_HKI(
"Through" ) )
1722 .Map( VIATYPE::BLIND_BURIED,
_HKI(
"Blind/buried" ) )
1723 .Map( VIATYPE::MICROVIA,
_HKI(
"Micro" ) );
1726 .Undefined( TENTING_MODE::FROM_RULES )
1727 .Map( TENTING_MODE::FROM_RULES,
_HKI(
"From design rules" ) )
1728 .Map( TENTING_MODE::TENTED,
_HKI(
"Tented" ) )
1729 .Map( TENTING_MODE::NOT_TENTED,
_HKI(
"Not tented" ) );
1733 if( layerEnum.
Choices().GetCount() == 0 )
1773 const wxString groupVia =
_HKI(
"Via Properties" );
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
BOX2I BOX2ISafe(const BOX2D &aInput)
BASE_SET & set(size_t pos=std::numeric_limits< size_t >::max(), bool value=true)
bool test(size_t pos) const
BASE_SET & reset(size_t pos=std::numeric_limits< size_t >::max())
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.
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
wxString GetNetname() const
const wxString & GetDisplayNetname() const
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
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 SetLocked(bool aLocked)
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.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) 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.
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
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.
std::string AsStdString() const
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
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 holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
MASK_LAYER_PROPS & FrontOuterLayers()
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
const LSET & LayerSet() const
VECTOR2I & Size(PCB_LAYER_ID aLayer=F_Cu)
@ REMOVE_EXCEPT_START_AND_END
MASK_LAYER_PROPS & BackOuterLayers()
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetShape(PAD_SHAPE aShape, PCB_LAYER_ID aLayer=F_Cu)
virtual VECTOR2I GetPosition() const override
bool IsDegenerated(int aThreshold=5) const
virtual void swapData(BOARD_ITEM *aImage) override
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
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
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetMid(const VECTOR2I &aMid)
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.
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
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.
bool operator==(const PCB_ARC &aOther) const
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
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.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetWidth(int aWidth)
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
virtual void swapData(BOARD_ITEM *aImage) override
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
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
Convert the track shape to a closed polygon.
const VECTOR2I & GetStart() const
virtual bool operator==(const BOARD_ITEM &aOther) const override
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.
virtual double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same 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.
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 MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
virtual void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
EDA_ITEM_FLAGS IsPointOnEnds(const VECTOR2I &point, int min_dist=0) const
Return STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if point if near (dist = m...
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
PCB_LAYER_ID BottomLayer() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
VECTOR2I GetPosition() const override
bool IsTented(PCB_LAYER_ID aLayer) const override
Checks if the given object is tented (its copper shape is covered by solder mask) on a given side of ...
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 Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
const PADSTACK & Padstack() const
void SetFrontTentingMode(TENTING_MODE aMode)
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.
TENTING_MODE GetFrontTentingMode() const
virtual void SetLayerSet(LSET aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
void SetBottomLayer(PCB_LAYER_ID aLayer)
std::array< ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS > m_zoneLayerOverrides
int GetSolderMaskExpansion() const
void SetDrill(int aDrill)
Set the drill value for vias.
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
void SetBackTentingMode(TENTING_MODE aMode)
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.
bool operator==(const PCB_VIA &aOther) const
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
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)
For a via m_layer contains the top layer, the other layer is in m_bottomLayer/.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void SanitizeLayers()
Check so that the layers are correct depending on the type of via, and so that the top actually is on...
PCB_VIA & operator=(const PCB_VIA &aOther)
void swapData(BOARD_ITEM *aImage) override
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
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.
TENTING_MODE GetBackTentingMode() const
PCB_LAYER_ID TopLayer() const
VIATYPE m_viaType
through, blind/buried or micro
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
VIATYPE GetViaType() const
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
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
Return the 2 layers used by the via (the via actually uses all layers between these 2 layers)
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()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
VECTOR2I::extended_type ecoord
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 MessageTextFromMinOptMax(const MINOPTMAX< int > &aValue) const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
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
@ VIA_DIAMETER_CONSTRAINT
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_360
#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.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper 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 ToLAYER_ID(int aLayer)
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
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
wxString UnescapeString(const wxString &aSource)
constexpr int mmToIU(double mm) const
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
std::optional< bool > has_solder_mask
True if this outer layer has mask (is not tented)
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)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
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.
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)
VECTOR2< int32_t > VECTOR2I
VECTOR2< int64_t > VECTOR2L