25#include <google/protobuf/any.pb.h>
26#include <magic_enum.hpp>
45#include <api/board/board_types.pb.h>
64static BOARD_ELLIPSE decompose2x2(
double m00,
double m01,
double m10,
double m11 )
66 const double A = m00 * m00 + m10 * m10;
67 const double B = m00 * m01 + m10 * m11;
68 const double C = m01 * m01 + m11 * m11;
70 const double diff =
A -
C;
71 const double rad = std::hypot( diff, 2.0 *
B );
72 const double lambda1 = (
A +
C + rad ) * 0.5;
73 const double lambda2 = (
A +
C - rad ) * 0.5;
75 const double sigma1 = std::sqrt( std::max( 0.0, lambda1 ) );
76 const double sigma2 = std::sqrt( std::max( 0.0, lambda2 ) );
97 const double vn = std::hypot( v0x, v0y );
106 u0x = ( m00 * v0x + m01 * v0y ) / sigma1;
107 u0y = ( m10 * v0x + m11 * v0y ) / sigma1;
120static BOARD_ELLIPSE decomposeBoardEllipse(
const TRANSFORM_TRS& aXform,
int aLibMajor,
int aLibMinor,
127 const double phi = aLibRotation.
AsRadians();
128 const double cTheta = std::cos( theta );
129 const double sTheta = std::sin( theta );
130 const double cPhi = std::cos( phi );
131 const double sPhi = std::sin( phi );
132 const double a = aLibMajor;
133 const double b = aLibMinor;
135 const double m00 = a * ( sx * cTheta * cPhi - sy * sTheta * sPhi );
136 const double m01 = -b * ( sx * cTheta * sPhi + sy * sTheta * cPhi );
137 const double m10 = a * ( sx * sTheta * cPhi + sy * cTheta * sPhi );
138 const double m11 = b * ( -sx * sTheta * sPhi + sy * cTheta * cPhi );
140 return decompose2x2( m00, m01, m10, m11 );
145static BOARD_ELLIPSE composeLibEllipse(
const TRANSFORM_TRS& aXform,
double aBoardMajor,
double aBoardMinor,
151 const double beta = aBoardRotation.
AsRadians();
153 const double li00 = std::cos( theta ) / sx;
154 const double li01 = std::sin( theta ) / sx;
155 const double li10 = -std::sin( theta ) / sy;
156 const double li11 = std::cos( theta ) / sy;
158 const double e00 = aBoardMajor * std::cos( beta );
159 const double e01 = -aBoardMinor * std::sin( beta );
160 const double e10 = aBoardMajor * std::sin( beta );
161 const double e11 = aBoardMinor * std::cos( beta );
163 return decompose2x2( li00 * e00 + li01 * e10, li00 * e01 + li01 * e11, li10 * e00 + li11 * e10,
164 li10 * e01 + li11 * e11 );
217 *
this = *
static_cast<const PCB_SHAPE*
>( aOther );
225 BoardGraphicShape msg;
229 msg.mutable_id()->set_value(
m_Uuid.AsStdString() );
230 msg.set_locked(
IsLocked() ? types::LockedState::LS_LOCKED : types::LockedState::LS_UNLOCKED );
232 google::protobuf::Any
any;
234 any.UnpackTo( msg.mutable_shape() );
238 aContainer.PackFrom( msg );
247 BoardGraphicShape msg;
249 if( !aContainer.UnpackTo( &msg ) )
265 SetLocked( msg.locked() == types::LS_LOCKED );
269 google::protobuf::Any
any;
270 any.PackFrom( msg.shape() );
284 bool sametype =
false;
286 for(
KICAD_T scanType : aScanTypes )
336 &&
GetBoard()->GetDesignSettings().m_DRCEngine->HasRulesForConstraintType(
353 margin =
board->GetDesignSettings().m_SolderMaskExpansion;
358 margin = std::max( margin, -
GetWidth() / 2 );
388 if( layermask.test(
F_Cu ) )
391 if( layermask.test(
B_Cu ) )
414 std::vector<VECTOR2I> ret;
430 ret.emplace_back( pt.m_point );
441 ret.emplace_back(
GetEnd() );
445 for(
auto iter =
GetPolyShape().CIterate(); iter; ++iter )
446 ret.emplace_back( *iter );
452 ret.emplace_back( pt );
459 const double cosPhi = std::cos( phi );
460 const double sinPhi = std::sin( phi );
477 const double cosPhi = std::cos( phi );
478 const double sinPhi = std::sin( phi );
481 auto eval = [&](
double theta ) ->
VECTOR2I
483 const double lx = a * std::cos( theta );
484 const double ly = b * std::sin( theta );
491 if( thetaEnd < thetaStart )
492 thetaEnd += 2.0 *
M_PI;
494 ret.emplace_back( eval( thetaStart ) );
495 ret.emplace_back( eval( thetaEnd ) );
496 ret.emplace_back( eval( 0.5 * ( thetaStart + thetaEnd ) ) );
534 item->TransformShapeToPolygon( knockouts, layer, margin, maxError,
ERROR_OUTSIDE );
547 if( item->GetLayer() == layer && item->GetBoundingBox().Intersects( bbox ) )
548 knockoutItem( item );
560 knockouts.
Append( footprint->GetCourtyard( layer ) );
563 footprint->RunOnChildren(
571 knockoutItem( item );
606 return s == 1.0 ? lib :
KiROUND( lib * s );
660 std::vector<VECTOR2I> pts;
671 pts.emplace_back( pt );
679 while( pts.size() < 4 )
680 pts.emplace_back( pts.back() +
VECTOR2I( 10, 10 ) );
717 return seg.A.y == seg.B.y;
723 return seg.A.x == seg.B.x;
731 if( horizontal( outline.
Segment( 0 ) )
732 && vertical( outline.
Segment( 1 ) )
733 && horizontal( outline.
Segment( 2 ) )
734 && vertical( outline.
Segment( 3 ) ) )
742 else if( vertical( outline.
Segment( 0 ) )
743 && horizontal( outline.
Segment( 1 ) )
744 && vertical( outline.
Segment( 2 ) )
745 && horizontal( outline.
Segment( 3 ) ) )
765 if( ( libStart.
x > libEnd.
x ) || ( libStart.
x == libEnd.
x && libStart.
y < libEnd.
y ) )
780 rotate( aRotCentre, aAngle );
799 p.x = 2 * libCenter.
x - p.x;
801 p.y = 2 * libCenter.
y - p.y;
825 for(
auto it =
m_libPoly.IterateWithHoles(); it; it++ )
868 flip( aCentre, aFlipDirection );
967 if( minorRadius > majorRadius )
969 std::swap( majorRadius, minorRadius );
992 int libRadius = (
m_libStart - libCenter ).EuclideanNorm();
1012 if( wrap( midAngle, startAngle ) > wrap( endAngle, startAngle ) )
1013 std::swap( startAngle, endAngle );
1015 while( endAngle < startAngle )
1018 if( minorRadius > majorRadius )
1020 std::swap( majorRadius, minorRadius );
1090 std::unique_ptr<SHAPE_ELLIPSE> libEllipse;
1094 libEllipse = std::make_unique<SHAPE_ELLIPSE>(
1100 libEllipse = std::make_unique<SHAPE_ELLIPSE>(
1112 for(
int ii = 0; ii <
chain.PointCount(); ++ii )
1186 return fp->GetTransform().InverseApply(
GetArcMid() );
1198 return fp->GetTransform().InverseApply(
GetBezierC1() );
1210 return fp->GetTransform().InverseApply(
GetBezierC2() );
1308 bool hasXform =
false;
1312 double sx = 1.0, sy = 1.0;
1313 static_cast<const PAD*
>(
static_cast<const BOARD_ITEM*
>(
GetParent() ) )->GetPrimitiveLibScale( sx, sy );
1315 hasXform = ( sx != 1.0 || sy != 1.0 );
1319 xform = fp->GetTransform();
1369 for(
auto it =
m_libPoly.IterateWithHoles(); it; it++ )
1409 flip( aCentre, aFlipDirection );
1415 PAD* parentPad =
nullptr;
1421 for(
PAD*
pad : fp->Pads() )
1423 if(
pad->IsEntered() )
1479 checkLayer = parent->GetLayer();
1494 std::vector<int> layers;
1495 layers.reserve( 4 );
1506 layers.push_back(
F_Mask );
1508 layers.push_back(
B_Mask );
1524 aList.emplace_back(
_(
"Footprint" ), parent->GetReference() );
1527 aList.emplace_back(
_(
"Type" ),
_(
"Drawing" ) );
1530 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
1556 return wxString::Format(
_(
"%s %s of %s on %s" ),
1564 return wxString::Format(
_(
"%s %s on %s" ),
1574 return wxString::Format(
_(
"%s of %s on %s" ),
1581 return wxString::Format(
_(
"%s on %s" ),
1650 if( aFirst->
Type() != aSecond->
Type() )
1651 return aFirst->
Type() < aSecond->
Type();
1670 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
1671 bool ignoreLineWidth )
const
1679 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
1693 return *
this == other;
1739 double similarity = 1.0;
1785 if( layerEnum.
Choices().GetCount() == 0 )
1797 _HKI(
"Layer" ), shapeLayerSetter, shapeLayerGetter );
1801 auto isPolygonOrEllipse = [](
INSPECTABLE* aItem ) ->
bool
1805 const SHAPE_T t = shape->GetShape();
1812 isPolygonOrEllipse );
1814 isPolygonOrEllipse );
1819 auto isNotBezierOrEllipseArc = [](
INSPECTABLE* aItem ) ->
bool
1823 const SHAPE_T t = shape->GetShape();
1830 isNotBezierOrEllipseArc );
1841 auto isNotCircleOrEllipse = [](
INSPECTABLE* aItem ) ->
bool
1845 const SHAPE_T t = shape->GetShape();
1852 isNotCircleOrEllipse );
1854 isNotCircleOrEllipse );
1856 isNotCircleOrEllipse );
1858 isNotCircleOrEllipse );
1860 _HKI(
"Center X" ), isCircle );
1862 _HKI(
"Center Y" ), isCircle );
1864 _HKI(
"Radius" ), isCircle );
1870 return shape->IsOnCopperLayer();
1878 auto isPadEditMode =
1879 [](
BOARD* aBoard ) ->
bool
1881 if( aBoard && aBoard->IsFootprintHolder() )
1883 for(
FOOTPRINT* fp : aBoard->Footprints() )
1885 for(
PAD*
pad : fp->Pads() )
1887 if(
pad->IsEntered() )
1896 auto showNumberBoxProperty =
1902 return isPadEditMode( shape->GetBoard() );
1908 auto showSpokeTemplateProperty =
1914 return isPadEditMode( shape->GetBoard() );
1920 const wxString groupPadPrimitives =
_HKI(
"Pad Primitives" );
1925 groupPadPrimitives )
1931 groupPadPrimitives )
1935 const wxString groupTechLayers =
_HKI(
"Technical Layers" );
1937 auto isExternalCuLayer =
1940 if(
auto shape =
dynamic_cast<PCB_SHAPE*
>( aItem ) )
types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
constexpr EDA_IU_SCALE pcbIUScale
constexpr int ARC_LOW_DEF
BITMAPS
A list of all bitmap identifiers.
#define DEFAULT_LINE_WIDTH
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetnameMsg() const
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
wxString GetNetname() const
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void PackNet(kiapi::board::types::Net *aProto) const
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
void UnpackNet(const kiapi::board::types::Net &aProto)
Assigns a net to this item from an API message.
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
void SetLocked(bool aLocked) override
bool IsLocked() const override
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.
FOOTPRINT * GetParentFootprint() const
BOARD_ITEM_CONTAINER * GetParent() const
virtual bool IsOnCopperLayer() const
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
constexpr const Vec & GetPosition() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr const Vec & GetOrigin() const
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Represent basic circle geometry with utility geometry functions.
The base class for create windows for drawing purpose.
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
KICAD_T Type() const
Returns the type of object.
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
EDA_ITEM * m_parent
Owner.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
virtual int GetHatchLineSpacing() const
virtual void SetEnd(const VECTOR2I &aEnd)
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false, bool includeFill=false) const
Convert the shape to a closed polygon.
int GetEllipseMinorRadius() const
const VECTOR2I & GetBezierC2() const
const VECTOR2I & GetEllipseCenter() const
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
EDA_ANGLE GetEllipseEndAngle() const
int GetEllipseMajorRadius() const
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
SHAPE_POLY_SET & GetPolyShape()
EDA_ANGLE GetEllipseRotation() const
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
virtual void SetEllipseEndAngle(const EDA_ANGLE &aA)
bool operator==(const EDA_SHAPE &aOther) const
virtual void SetBezierC2(const VECTOR2I &aPt)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
virtual void SetBezierC1(const VECTOR2I &aPt)
virtual void SetEllipseRotation(const EDA_ANGLE &aA)
void flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
EDA_SHAPE(SHAPE_T aType, int aLineWidth, FILL_T aFill)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
virtual void SetEllipseCenter(const VECTOR2I &aPt)
virtual void SetEllipseMinorRadius(int aR)
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
virtual void SetEllipseMajorRadius(int aR)
void SwapShape(EDA_SHAPE *aImage)
std::vector< VECTOR2I > GetRectCorners() const
EDA_ANGLE GetEllipseStartAngle() const
virtual void UpdateHatching() const
virtual void SetEllipseStartAngle(const EDA_ANGLE &aA)
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Set the three controlling points for an arc.
wxString SHAPE_T_asString() const
double Similarity(const EDA_SHAPE &aOther) const
const VECTOR2I & GetBezierC1() const
virtual int GetWidth() const
void RebuildBezierToSegmentsPointsList()
virtual void SetPolyShape(const SHAPE_POLY_SET &aShape)
virtual void SetStart(const VECTOR2I &aStart)
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
VECTOR2I GetArcMid() const
virtual bool IsVisible() const
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
Class that other classes need to inherit from, in order to be inspectable.
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.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
bool GetHighContrast() const
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsLayerVisibleCached(int aLayer) const
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
LSET is a set of PCB_LAYER_IDs.
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
static const LSET & AllLayersMask()
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
std::optional< int > GetLocalThermalSpokeWidthOverride() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
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.
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings, bool aCheckSide) override
VECTOR2I m_libEllipseCenter
void swapData(BOARD_ITEM *aImage) override
bool IsConnected() const override
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
void SetEllipseCenter(const VECTOR2I &aPt) override
EDA_ANGLE m_libEllipseStartAngle
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
virtual void syncLibCoords()
SHAPE_POLY_SET getHatchingKnockouts() const override
void SetBezierC1(const VECTOR2I &aPt) override
std::optional< int > GetLocalSolderMaskMargin() const
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
VECTOR2I GetLibraryBezierC1() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
PCB_SHAPE(BOARD_ITEM *aParent, KICAD_T aItemType, SHAPE_T aShapeType)
void SetWidth(int aWidth) override
EDA_ANGLE m_libEllipseEndAngle
void SetLibStrokeWidth(int aWidth)
void rebakeFromTransform(const TRANSFORM_TRS &aXform)
int GetWidth() const override
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
bool HasSolderMask() const
void SetEllipseStartAngle(const EDA_ANGLE &aA) override
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Make a set of SHAPE objects representing the PCB_SHAPE.
void SetHasSolderMask(bool aVal)
std::optional< int > m_solderMaskMargin
int GetSolderMaskExpansion() const
void NormalizeForCompare() override
Normalize coordinates to compare 2 similar PCB_SHAPES similat to Normalize(), but also normalize SEGM...
void TransformShapeToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const override
Convert the item shape to a polyset.
void SetEllipseEndAngle(const EDA_ANGLE &aA) override
int m_libEllipseMinorRadius
const VECTOR2I GetFocusPosition() const override
Allows items to return their visual center rather than their anchor.
virtual void SetLayerSet(const LSET &aLayers) override
void SetEnd(const VECTOR2I &aEnd) override
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
VECTOR2I GetLibraryEnd() const
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
void SetPolyShape(const SHAPE_POLY_SET &aShape) override
virtual std::vector< VECTOR2I > GetCorners() const
Return 4 corners for a rectangle or rotated rectangle (stored as a poly).
bool IsProxyItem() const override
void SetEllipseRotation(const EDA_ANGLE &aA) override
const FOOTPRINT * transformFp() const
VECTOR2I GetLibraryStart() const
void OnFootprintRescaled(double aRatioX, double aRatioY, double aLinearFactor, const VECTOR2I &aAnchor, const EDA_ANGLE &aParentRotate) override
Apply a parent footprint scale to this item.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool operator==(const PCB_SHAPE &aShape) const
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetEllipseMinorRadius(int aR) override
wxString GetFriendlyName() const override
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
STROKE_PARAMS GetStroke() const override
void SetIsProxyItem(bool aIsProxy=true) override
void RebakeWithScale(double aScaleX, double aScaleY)
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
void Move(const VECTOR2I &aMoveVector) override
Move this object.
std::vector< VECTOR2I > GetConnectionPoints() const
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
int getMaxError() const override
void SetStart(const VECTOR2I &aStart) override
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
void SetBezierC2(const VECTOR2I &aPt) override
void UpdateHatching() const override
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void Scale(double aScale)
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
SHAPE_POLY_SET GetLibraryPolyShape() const
void SetStroke(const STROKE_PARAMS &aStroke) override
void Normalize() override
Perform any normalization required after a user rotate and/or flip.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
void CopyFrom(const BOARD_ITEM *aOther) override
VECTOR2I GetLibraryBezierC2() const
std::vector< int > ViewGetLayers() const override
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
EDA_ANGLE m_libEllipseRotation
int m_libEllipseMajorRadius
VECTOR2I GetLibraryArcMid() const
void SetEllipseMajorRadius(int aR) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetIsHiddenFromRulesEditor(bool aHide=true)
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.
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
SEG Segment(int aIndex) const
Return a copy of the aIndex-th segment in the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
void RemoveAllContours()
Remove all outlines & holes (clears) the polygon set.
ITERATOR IterateWithHoles(int aOutline)
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
int OutlineCount() const
Return the number of outlines in the set.
Simple container to manage line stroke parameters.
void SetWidth(int aWidth)
A type-safe container of any type.
@ SOLDER_MASK_EXPANSION_CONSTRAINT
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_360
static constexpr EDA_ANGLE ANGLE_180
#define PCB_EDIT_FRAME_NAME
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
bool IsSolderMaskLayer(int aLayer)
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)
Return a netname layer corresponding to the given layer.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
bool IsExternalCopperLayer(int aLayerId)
Test whether a layer is an external (F_Cu or B_Cu) copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
#define UNIMPLEMENTED_FOR(type)
@ LEFT_RIGHT
Flip left to right (around the Y axis)
std::vector< TYPED_POINT2I > GetCircleKeyPoints(const CIRCLE &aCircle, bool aIncludeCenter)
Get key points of an CIRCLE.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
static double fpScaleLinear(const FOOTPRINT *aFp)
static struct PCB_SHAPE_DESC _PCB_SHAPE_DESC
static bool isCopper(const PNS::ITEM *aItem)
@ PT_SIZE
Size expressed in distance units (mm/inch)
Utility functions for working with shapes.
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
const SHAPE_LINE_CHAIN chain
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
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_SHAPE_LOCATE_ELLIPSE_ARC_T
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_LOCATE_BOARD_EDGE_T
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_SHAPE_LOCATE_CIRCLE_T
@ PCB_SHAPE_LOCATE_SEGMENT_T
@ PCB_SHAPE_LOCATE_RECT_T
@ PCB_SHAPE_LOCATE_ELLIPSE_T
@ PCB_SHAPE_LOCATE_BEZIER_T
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_SHAPE_LOCATE_POLY_T
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MM